id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
21,615
static bool get_phys_addr(CPUARMState *env, target_ulong address, MMUAccessType access_type, ARMMMUIdx mmu_idx, hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, target_ulong *page_size, uint32_t *fsr, ARMMMUFaultInfo *fi) { if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) { /* Call ourselves recursively to do the stage 1 and then stage 2 * translations. */ if (arm_feature(env, ARM_FEATURE_EL2)) { hwaddr ipa; int s2_prot; int ret; ret = get_phys_addr(env, address, access_type, stage_1_mmu_idx(mmu_idx), &ipa, attrs, prot, page_size, fsr, fi); /* If S1 fails or S2 is disabled, return early. */ if (ret || regime_translation_disabled(env, ARMMMUIdx_S2NS)) { *phys_ptr = ipa; return ret; } /* S1 is done. Now do S2 translation. */ ret = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_S2NS, phys_ptr, attrs, &s2_prot, page_size, fsr, fi); fi->s2addr = ipa; /* Combine the S1 and S2 perms. */ *prot &= s2_prot; return ret; } else { /* * For non-EL2 CPUs a stage1+stage2 translation is just stage 1. */ mmu_idx = stage_1_mmu_idx(mmu_idx); } } /* The page table entries may downgrade secure to non-secure, but * cannot upgrade an non-secure translation regime's attributes * to secure. */ attrs->secure = regime_is_secure(env, mmu_idx); attrs->user = regime_is_user(env, mmu_idx); /* Fast Context Switch Extension. This doesn't exist at all in v8. * In v7 and earlier it affects all stage 1 translations. */ if (address < 0x02000000 && mmu_idx != ARMMMUIdx_S2NS && !arm_feature(env, ARM_FEATURE_V8)) { if (regime_el(env, mmu_idx) == 3) { address += env->cp15.fcseidr_s; } else { address += env->cp15.fcseidr_ns; } } if (arm_feature(env, ARM_FEATURE_PMSA)) { bool ret; *page_size = TARGET_PAGE_SIZE; if (arm_feature(env, ARM_FEATURE_V8)) { /* PMSAv8 */ ret = get_phys_addr_pmsav8(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); } else if (arm_feature(env, ARM_FEATURE_V7)) { /* PMSAv7 */ ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); } else { /* Pre-v7 MPU */ ret = get_phys_addr_pmsav5(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); } qemu_log_mask(CPU_LOG_MMU, "PMSA MPU lookup for %s at 0x%08" PRIx32 " mmu_idx %u -> %s (prot %c%c%c)\n", access_type == MMU_DATA_LOAD ? "reading" : (access_type == MMU_DATA_STORE ? "writing" : "execute"), (uint32_t)address, mmu_idx, ret ? "Miss" : "Hit", *prot & PAGE_READ ? 'r' : '-', *prot & PAGE_WRITE ? 'w' : '-', *prot & PAGE_EXEC ? 'x' : '-'); return ret; } /* Definitely a real MMU, not an MPU */ if (regime_translation_disabled(env, mmu_idx)) { /* MMU disabled. */ *phys_ptr = address; *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; *page_size = TARGET_PAGE_SIZE; return 0; } if (regime_using_lpae_format(env, mmu_idx)) { return get_phys_addr_lpae(env, address, access_type, mmu_idx, phys_ptr, attrs, prot, page_size, fsr, fi); } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { return get_phys_addr_v6(env, address, access_type, mmu_idx, phys_ptr, attrs, prot, page_size, fsr, fi); } else { return get_phys_addr_v5(env, address, access_type, mmu_idx, phys_ptr, prot, page_size, fsr, fi); } }
false
qemu
35337cc391245f251bfb9134f181c33e6375d6c1
static bool get_phys_addr(CPUARMState *env, target_ulong address, MMUAccessType access_type, ARMMMUIdx mmu_idx, hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, target_ulong *page_size, uint32_t *fsr, ARMMMUFaultInfo *fi) { if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) { if (arm_feature(env, ARM_FEATURE_EL2)) { hwaddr ipa; int s2_prot; int ret; ret = get_phys_addr(env, address, access_type, stage_1_mmu_idx(mmu_idx), &ipa, attrs, prot, page_size, fsr, fi); if (ret || regime_translation_disabled(env, ARMMMUIdx_S2NS)) { *phys_ptr = ipa; return ret; } ret = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_S2NS, phys_ptr, attrs, &s2_prot, page_size, fsr, fi); fi->s2addr = ipa; *prot &= s2_prot; return ret; } else { mmu_idx = stage_1_mmu_idx(mmu_idx); } } attrs->secure = regime_is_secure(env, mmu_idx); attrs->user = regime_is_user(env, mmu_idx); if (address < 0x02000000 && mmu_idx != ARMMMUIdx_S2NS && !arm_feature(env, ARM_FEATURE_V8)) { if (regime_el(env, mmu_idx) == 3) { address += env->cp15.fcseidr_s; } else { address += env->cp15.fcseidr_ns; } } if (arm_feature(env, ARM_FEATURE_PMSA)) { bool ret; *page_size = TARGET_PAGE_SIZE; if (arm_feature(env, ARM_FEATURE_V8)) { ret = get_phys_addr_pmsav8(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); } else if (arm_feature(env, ARM_FEATURE_V7)) { ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); } else { ret = get_phys_addr_pmsav5(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); } qemu_log_mask(CPU_LOG_MMU, "PMSA MPU lookup for %s at 0x%08" PRIx32 " mmu_idx %u -> %s (prot %c%c%c)\n", access_type == MMU_DATA_LOAD ? "reading" : (access_type == MMU_DATA_STORE ? "writing" : "execute"), (uint32_t)address, mmu_idx, ret ? "Miss" : "Hit", *prot & PAGE_READ ? 'r' : '-', *prot & PAGE_WRITE ? 'w' : '-', *prot & PAGE_EXEC ? 'x' : '-'); return ret; } if (regime_translation_disabled(env, mmu_idx)) { *phys_ptr = address; *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; *page_size = TARGET_PAGE_SIZE; return 0; } if (regime_using_lpae_format(env, mmu_idx)) { return get_phys_addr_lpae(env, address, access_type, mmu_idx, phys_ptr, attrs, prot, page_size, fsr, fi); } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { return get_phys_addr_v6(env, address, access_type, mmu_idx, phys_ptr, attrs, prot, page_size, fsr, fi); } else { return get_phys_addr_v5(env, address, access_type, mmu_idx, phys_ptr, prot, page_size, fsr, fi); } }
{ "code": [], "line_no": [] }
static bool FUNC_0(CPUARMState *env, target_ulong address, MMUAccessType access_type, ARMMMUIdx mmu_idx, hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, target_ulong *page_size, uint32_t *fsr, ARMMMUFaultInfo *fi) { if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) { if (arm_feature(env, ARM_FEATURE_EL2)) { hwaddr ipa; int VAR_0; int VAR_1; VAR_1 = FUNC_0(env, address, access_type, stage_1_mmu_idx(mmu_idx), &ipa, attrs, prot, page_size, fsr, fi); if (VAR_1 || regime_translation_disabled(env, ARMMMUIdx_S2NS)) { *phys_ptr = ipa; return VAR_1; } VAR_1 = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_S2NS, phys_ptr, attrs, &VAR_0, page_size, fsr, fi); fi->s2addr = ipa; *prot &= VAR_0; return VAR_1; } else { mmu_idx = stage_1_mmu_idx(mmu_idx); } } attrs->secure = regime_is_secure(env, mmu_idx); attrs->user = regime_is_user(env, mmu_idx); if (address < 0x02000000 && mmu_idx != ARMMMUIdx_S2NS && !arm_feature(env, ARM_FEATURE_V8)) { if (regime_el(env, mmu_idx) == 3) { address += env->cp15.fcseidr_s; } else { address += env->cp15.fcseidr_ns; } } if (arm_feature(env, ARM_FEATURE_PMSA)) { bool VAR_1; *page_size = TARGET_PAGE_SIZE; if (arm_feature(env, ARM_FEATURE_V8)) { VAR_1 = get_phys_addr_pmsav8(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); } else if (arm_feature(env, ARM_FEATURE_V7)) { VAR_1 = get_phys_addr_pmsav7(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); } else { VAR_1 = get_phys_addr_pmsav5(env, address, access_type, mmu_idx, phys_ptr, prot, fsr); } qemu_log_mask(CPU_LOG_MMU, "PMSA MPU lookup for %s at 0x%08" PRIx32 " mmu_idx %u -> %s (prot %c%c%c)\n", access_type == MMU_DATA_LOAD ? "reading" : (access_type == MMU_DATA_STORE ? "writing" : "execute"), (uint32_t)address, mmu_idx, VAR_1 ? "Miss" : "Hit", *prot & PAGE_READ ? 'r' : '-', *prot & PAGE_WRITE ? 'w' : '-', *prot & PAGE_EXEC ? 'x' : '-'); return VAR_1; } if (regime_translation_disabled(env, mmu_idx)) { *phys_ptr = address; *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; *page_size = TARGET_PAGE_SIZE; return 0; } if (regime_using_lpae_format(env, mmu_idx)) { return get_phys_addr_lpae(env, address, access_type, mmu_idx, phys_ptr, attrs, prot, page_size, fsr, fi); } else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) { return get_phys_addr_v6(env, address, access_type, mmu_idx, phys_ptr, attrs, prot, page_size, fsr, fi); } else { return get_phys_addr_v5(env, address, access_type, mmu_idx, phys_ptr, prot, page_size, fsr, fi); } }
[ "static bool FUNC_0(CPUARMState *env, target_ulong address,\nMMUAccessType access_type, ARMMMUIdx mmu_idx,\nhwaddr *phys_ptr, MemTxAttrs *attrs, int *prot,\ntarget_ulong *page_size, uint32_t *fsr,\nARMMMUFaultInfo *fi)\n{", "if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) {", "if (arm_feature(env, ARM_FEATURE_EL2)) {", "hwaddr ipa;", "int VAR_0;", "int VAR_1;", "VAR_1 = FUNC_0(env, address, access_type,\nstage_1_mmu_idx(mmu_idx), &ipa, attrs,\nprot, page_size, fsr, fi);", "if (VAR_1 || regime_translation_disabled(env, ARMMMUIdx_S2NS)) {", "*phys_ptr = ipa;", "return VAR_1;", "}", "VAR_1 = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_S2NS,\nphys_ptr, attrs, &VAR_0,\npage_size, fsr, fi);", "fi->s2addr = ipa;", "*prot &= VAR_0;", "return VAR_1;", "} else {", "mmu_idx = stage_1_mmu_idx(mmu_idx);", "}", "}", "attrs->secure = regime_is_secure(env, mmu_idx);", "attrs->user = regime_is_user(env, mmu_idx);", "if (address < 0x02000000 && mmu_idx != ARMMMUIdx_S2NS\n&& !arm_feature(env, ARM_FEATURE_V8)) {", "if (regime_el(env, mmu_idx) == 3) {", "address += env->cp15.fcseidr_s;", "} else {", "address += env->cp15.fcseidr_ns;", "}", "}", "if (arm_feature(env, ARM_FEATURE_PMSA)) {", "bool VAR_1;", "*page_size = TARGET_PAGE_SIZE;", "if (arm_feature(env, ARM_FEATURE_V8)) {", "VAR_1 = get_phys_addr_pmsav8(env, address, access_type, mmu_idx,\nphys_ptr, prot, fsr);", "} else if (arm_feature(env, ARM_FEATURE_V7)) {", "VAR_1 = get_phys_addr_pmsav7(env, address, access_type, mmu_idx,\nphys_ptr, prot, fsr);", "} else {", "VAR_1 = get_phys_addr_pmsav5(env, address, access_type, mmu_idx,\nphys_ptr, prot, fsr);", "}", "qemu_log_mask(CPU_LOG_MMU, \"PMSA MPU lookup for %s at 0x%08\" PRIx32\n\" mmu_idx %u -> %s (prot %c%c%c)\\n\",\naccess_type == MMU_DATA_LOAD ? \"reading\" :\n(access_type == MMU_DATA_STORE ? \"writing\" : \"execute\"),\n(uint32_t)address, mmu_idx,\nVAR_1 ? \"Miss\" : \"Hit\",\n*prot & PAGE_READ ? 'r' : '-',\n*prot & PAGE_WRITE ? 'w' : '-',\n*prot & PAGE_EXEC ? 'x' : '-');", "return VAR_1;", "}", "if (regime_translation_disabled(env, mmu_idx)) {", "*phys_ptr = address;", "*prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;", "*page_size = TARGET_PAGE_SIZE;", "return 0;", "}", "if (regime_using_lpae_format(env, mmu_idx)) {", "return get_phys_addr_lpae(env, address, access_type, mmu_idx, phys_ptr,\nattrs, prot, page_size, fsr, fi);", "} else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) {", "return get_phys_addr_v6(env, address, access_type, mmu_idx, phys_ptr,\nattrs, prot, page_size, fsr, fi);", "} else {", "return get_phys_addr_v5(env, address, access_type, mmu_idx, phys_ptr,\nprot, page_size, fsr, fi);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33, 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53, 55, 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 75 ], [ 77 ], [ 79 ], [ 91 ], [ 93 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 133, 135 ], [ 137 ], [ 141, 143 ], [ 145 ], [ 149, 151 ], [ 153 ], [ 155, 157, 159, 161, 163, 165, 167, 169, 171 ], [ 175 ], [ 177 ], [ 185 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209, 211 ], [ 213 ], [ 215, 217 ], [ 219 ], [ 221 ] ]
21,616
void bdrv_error_action(BlockDriverState *bs, BlockErrorAction action, bool is_read, int error) { assert(error >= 0); if (action == BLOCK_ERROR_ACTION_STOP) { /* First set the iostatus, so that "info block" returns an iostatus * that matches the events raised so far (an additional error iostatus * is fine, but not a lost one). */ bdrv_iostatus_set_err(bs, error); /* Then raise the request to stop the VM and the event. * qemu_system_vmstop_request_prepare has two effects. First, * it ensures that the STOP event always comes after the * BLOCK_IO_ERROR event. Second, it ensures that even if management * can observe the STOP event and do a "cont" before the STOP * event is issued, the VM will not stop. In this case, vm_start() * also ensures that the STOP/RESUME pair of events is emitted. */ qemu_system_vmstop_request_prepare(); send_qmp_error_event(bs, action, is_read, error); qemu_system_vmstop_request(RUN_STATE_IO_ERROR); } else { send_qmp_error_event(bs, action, is_read, error); } }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
void bdrv_error_action(BlockDriverState *bs, BlockErrorAction action, bool is_read, int error) { assert(error >= 0); if (action == BLOCK_ERROR_ACTION_STOP) { bdrv_iostatus_set_err(bs, error); qemu_system_vmstop_request_prepare(); send_qmp_error_event(bs, action, is_read, error); qemu_system_vmstop_request(RUN_STATE_IO_ERROR); } else { send_qmp_error_event(bs, action, is_read, error); } }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0, BlockErrorAction VAR_1, bool VAR_2, int VAR_3) { assert(VAR_3 >= 0); if (VAR_1 == BLOCK_ERROR_ACTION_STOP) { bdrv_iostatus_set_err(VAR_0, VAR_3); qemu_system_vmstop_request_prepare(); send_qmp_error_event(VAR_0, VAR_1, VAR_2, VAR_3); qemu_system_vmstop_request(RUN_STATE_IO_ERROR); } else { send_qmp_error_event(VAR_0, VAR_1, VAR_2, VAR_3); } }
[ "void FUNC_0(BlockDriverState *VAR_0, BlockErrorAction VAR_1,\nbool VAR_2, int VAR_3)\n{", "assert(VAR_3 >= 0);", "if (VAR_1 == BLOCK_ERROR_ACTION_STOP) {", "bdrv_iostatus_set_err(VAR_0, VAR_3);", "qemu_system_vmstop_request_prepare();", "send_qmp_error_event(VAR_0, VAR_1, VAR_2, VAR_3);", "qemu_system_vmstop_request(RUN_STATE_IO_ERROR);", "} else {", "send_qmp_error_event(VAR_0, VAR_1, VAR_2, VAR_3);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 21 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
21,617
static void ide_atapi_cmd_reply(IDEState *s, int size, int max_size) { if (size > max_size) size = max_size; s->lba = -1; /* no sector read */ s->packet_transfer_size = size; s->io_buffer_size = size; /* dma: send the reply data as one chunk */ s->elementary_transfer_size = 0; s->io_buffer_index = 0; if (s->atapi_dma) { block_acct_start(bdrv_get_stats(s->bs), &s->acct, size, BLOCK_ACCT_READ); s->status = READY_STAT | SEEK_STAT | DRQ_STAT; ide_start_dma(s, ide_atapi_cmd_read_dma_cb); } else { s->status = READY_STAT | SEEK_STAT; ide_atapi_cmd_reply_end(s); } }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void ide_atapi_cmd_reply(IDEState *s, int size, int max_size) { if (size > max_size) size = max_size; s->lba = -1; s->packet_transfer_size = size; s->io_buffer_size = size; s->elementary_transfer_size = 0; s->io_buffer_index = 0; if (s->atapi_dma) { block_acct_start(bdrv_get_stats(s->bs), &s->acct, size, BLOCK_ACCT_READ); s->status = READY_STAT | SEEK_STAT | DRQ_STAT; ide_start_dma(s, ide_atapi_cmd_read_dma_cb); } else { s->status = READY_STAT | SEEK_STAT; ide_atapi_cmd_reply_end(s); } }
{ "code": [], "line_no": [] }
static void FUNC_0(IDEState *VAR_0, int VAR_1, int VAR_2) { if (VAR_1 > VAR_2) VAR_1 = VAR_2; VAR_0->lba = -1; VAR_0->packet_transfer_size = VAR_1; VAR_0->io_buffer_size = VAR_1; VAR_0->elementary_transfer_size = 0; VAR_0->io_buffer_index = 0; if (VAR_0->atapi_dma) { block_acct_start(bdrv_get_stats(VAR_0->bs), &VAR_0->acct, VAR_1, BLOCK_ACCT_READ); VAR_0->status = READY_STAT | SEEK_STAT | DRQ_STAT; ide_start_dma(VAR_0, ide_atapi_cmd_read_dma_cb); } else { VAR_0->status = READY_STAT | SEEK_STAT; ide_atapi_cmd_reply_end(VAR_0); } }
[ "static void FUNC_0(IDEState *VAR_0, int VAR_1, int VAR_2)\n{", "if (VAR_1 > VAR_2)\nVAR_1 = VAR_2;", "VAR_0->lba = -1;", "VAR_0->packet_transfer_size = VAR_1;", "VAR_0->io_buffer_size = VAR_1;", "VAR_0->elementary_transfer_size = 0;", "VAR_0->io_buffer_index = 0;", "if (VAR_0->atapi_dma) {", "block_acct_start(bdrv_get_stats(VAR_0->bs), &VAR_0->acct, VAR_1,\nBLOCK_ACCT_READ);", "VAR_0->status = READY_STAT | SEEK_STAT | DRQ_STAT;", "ide_start_dma(VAR_0, ide_atapi_cmd_read_dma_cb);", "} else {", "VAR_0->status = READY_STAT | SEEK_STAT;", "ide_atapi_cmd_reply_end(VAR_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 ] ]
21,618
static int stream_component_open(VideoState *is, int stream_index) { AVFormatContext *ic = is->ic; AVCodecContext *enc; AVCodec *codec; SDL_AudioSpec wanted_spec, spec; if (stream_index < 0 || stream_index >= ic->nb_streams) return -1; enc = ic->streams[stream_index]->codec; /* prepare audio output */ if (enc->codec_type == CODEC_TYPE_AUDIO) { if (enc->channels > 0) { enc->request_channels = FFMIN(2, enc->channels); } else { enc->request_channels = 2; } } codec = avcodec_find_decoder(enc->codec_id); enc->debug_mv = debug_mv; enc->debug = debug; enc->workaround_bugs = workaround_bugs; enc->lowres = lowres; if(lowres) enc->flags |= CODEC_FLAG_EMU_EDGE; enc->idct_algo= idct; if(fast) enc->flags2 |= CODEC_FLAG2_FAST; enc->skip_frame= skip_frame; enc->skip_idct= skip_idct; enc->skip_loop_filter= skip_loop_filter; enc->error_recognition= error_recognition; enc->error_concealment= error_concealment; set_context_opts(enc, avcodec_opts[enc->codec_type], 0); if (!codec || avcodec_open(enc, codec) < 0) return -1; /* prepare audio output */ if (enc->codec_type == CODEC_TYPE_AUDIO) { wanted_spec.freq = enc->sample_rate; wanted_spec.format = AUDIO_S16SYS; wanted_spec.channels = enc->channels; wanted_spec.silence = 0; wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE; wanted_spec.callback = sdl_audio_callback; wanted_spec.userdata = is; if (SDL_OpenAudio(&wanted_spec, &spec) < 0) { fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError()); return -1; } is->audio_hw_buf_size = spec.size; is->audio_src_fmt= SAMPLE_FMT_S16; } if(thread_count>1) avcodec_thread_init(enc, thread_count); enc->thread_count= thread_count; ic->streams[stream_index]->discard = AVDISCARD_DEFAULT; switch(enc->codec_type) { case CODEC_TYPE_AUDIO: is->audio_stream = stream_index; is->audio_st = ic->streams[stream_index]; is->audio_buf_size = 0; is->audio_buf_index = 0; /* init averaging filter */ is->audio_diff_avg_coef = exp(log(0.01) / AUDIO_DIFF_AVG_NB); is->audio_diff_avg_count = 0; /* since we do not have a precise anough audio fifo fullness, we correct audio sync only if larger than this threshold */ is->audio_diff_threshold = 2.0 * SDL_AUDIO_BUFFER_SIZE / enc->sample_rate; memset(&is->audio_pkt, 0, sizeof(is->audio_pkt)); packet_queue_init(&is->audioq); SDL_PauseAudio(0); break; case CODEC_TYPE_VIDEO: is->video_stream = stream_index; is->video_st = ic->streams[stream_index]; is->frame_last_delay = 40e-3; is->frame_timer = (double)av_gettime() / 1000000.0; is->video_current_pts_time = av_gettime(); packet_queue_init(&is->videoq); is->video_tid = SDL_CreateThread(video_thread, is); break; case CODEC_TYPE_SUBTITLE: is->subtitle_stream = stream_index; is->subtitle_st = ic->streams[stream_index]; packet_queue_init(&is->subtitleq); is->subtitle_tid = SDL_CreateThread(subtitle_thread, is); break; default: break; } return 0; }
false
FFmpeg
de4898a22909ff8a9ff846820627094bdd68b648
static int stream_component_open(VideoState *is, int stream_index) { AVFormatContext *ic = is->ic; AVCodecContext *enc; AVCodec *codec; SDL_AudioSpec wanted_spec, spec; if (stream_index < 0 || stream_index >= ic->nb_streams) return -1; enc = ic->streams[stream_index]->codec; if (enc->codec_type == CODEC_TYPE_AUDIO) { if (enc->channels > 0) { enc->request_channels = FFMIN(2, enc->channels); } else { enc->request_channels = 2; } } codec = avcodec_find_decoder(enc->codec_id); enc->debug_mv = debug_mv; enc->debug = debug; enc->workaround_bugs = workaround_bugs; enc->lowres = lowres; if(lowres) enc->flags |= CODEC_FLAG_EMU_EDGE; enc->idct_algo= idct; if(fast) enc->flags2 |= CODEC_FLAG2_FAST; enc->skip_frame= skip_frame; enc->skip_idct= skip_idct; enc->skip_loop_filter= skip_loop_filter; enc->error_recognition= error_recognition; enc->error_concealment= error_concealment; set_context_opts(enc, avcodec_opts[enc->codec_type], 0); if (!codec || avcodec_open(enc, codec) < 0) return -1; if (enc->codec_type == CODEC_TYPE_AUDIO) { wanted_spec.freq = enc->sample_rate; wanted_spec.format = AUDIO_S16SYS; wanted_spec.channels = enc->channels; wanted_spec.silence = 0; wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE; wanted_spec.callback = sdl_audio_callback; wanted_spec.userdata = is; if (SDL_OpenAudio(&wanted_spec, &spec) < 0) { fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError()); return -1; } is->audio_hw_buf_size = spec.size; is->audio_src_fmt= SAMPLE_FMT_S16; } if(thread_count>1) avcodec_thread_init(enc, thread_count); enc->thread_count= thread_count; ic->streams[stream_index]->discard = AVDISCARD_DEFAULT; switch(enc->codec_type) { case CODEC_TYPE_AUDIO: is->audio_stream = stream_index; is->audio_st = ic->streams[stream_index]; is->audio_buf_size = 0; is->audio_buf_index = 0; is->audio_diff_avg_coef = exp(log(0.01) / AUDIO_DIFF_AVG_NB); is->audio_diff_avg_count = 0; is->audio_diff_threshold = 2.0 * SDL_AUDIO_BUFFER_SIZE / enc->sample_rate; memset(&is->audio_pkt, 0, sizeof(is->audio_pkt)); packet_queue_init(&is->audioq); SDL_PauseAudio(0); break; case CODEC_TYPE_VIDEO: is->video_stream = stream_index; is->video_st = ic->streams[stream_index]; is->frame_last_delay = 40e-3; is->frame_timer = (double)av_gettime() / 1000000.0; is->video_current_pts_time = av_gettime(); packet_queue_init(&is->videoq); is->video_tid = SDL_CreateThread(video_thread, is); break; case CODEC_TYPE_SUBTITLE: is->subtitle_stream = stream_index; is->subtitle_st = ic->streams[stream_index]; packet_queue_init(&is->subtitleq); is->subtitle_tid = SDL_CreateThread(subtitle_thread, is); break; default: break; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VideoState *VAR_0, int VAR_1) { AVFormatContext *ic = VAR_0->ic; AVCodecContext *enc; AVCodec *codec; SDL_AudioSpec wanted_spec, spec; if (VAR_1 < 0 || VAR_1 >= ic->nb_streams) return -1; enc = ic->streams[VAR_1]->codec; if (enc->codec_type == CODEC_TYPE_AUDIO) { if (enc->channels > 0) { enc->request_channels = FFMIN(2, enc->channels); } else { enc->request_channels = 2; } } codec = avcodec_find_decoder(enc->codec_id); enc->debug_mv = debug_mv; enc->debug = debug; enc->workaround_bugs = workaround_bugs; enc->lowres = lowres; if(lowres) enc->flags |= CODEC_FLAG_EMU_EDGE; enc->idct_algo= idct; if(fast) enc->flags2 |= CODEC_FLAG2_FAST; enc->skip_frame= skip_frame; enc->skip_idct= skip_idct; enc->skip_loop_filter= skip_loop_filter; enc->error_recognition= error_recognition; enc->error_concealment= error_concealment; set_context_opts(enc, avcodec_opts[enc->codec_type], 0); if (!codec || avcodec_open(enc, codec) < 0) return -1; if (enc->codec_type == CODEC_TYPE_AUDIO) { wanted_spec.freq = enc->sample_rate; wanted_spec.format = AUDIO_S16SYS; wanted_spec.channels = enc->channels; wanted_spec.silence = 0; wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE; wanted_spec.callback = sdl_audio_callback; wanted_spec.userdata = VAR_0; if (SDL_OpenAudio(&wanted_spec, &spec) < 0) { fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError()); return -1; } VAR_0->audio_hw_buf_size = spec.size; VAR_0->audio_src_fmt= SAMPLE_FMT_S16; } if(thread_count>1) avcodec_thread_init(enc, thread_count); enc->thread_count= thread_count; ic->streams[VAR_1]->discard = AVDISCARD_DEFAULT; switch(enc->codec_type) { case CODEC_TYPE_AUDIO: VAR_0->audio_stream = VAR_1; VAR_0->audio_st = ic->streams[VAR_1]; VAR_0->audio_buf_size = 0; VAR_0->audio_buf_index = 0; VAR_0->audio_diff_avg_coef = exp(log(0.01) / AUDIO_DIFF_AVG_NB); VAR_0->audio_diff_avg_count = 0; VAR_0->audio_diff_threshold = 2.0 * SDL_AUDIO_BUFFER_SIZE / enc->sample_rate; memset(&VAR_0->audio_pkt, 0, sizeof(VAR_0->audio_pkt)); packet_queue_init(&VAR_0->audioq); SDL_PauseAudio(0); break; case CODEC_TYPE_VIDEO: VAR_0->video_stream = VAR_1; VAR_0->video_st = ic->streams[VAR_1]; VAR_0->frame_last_delay = 40e-3; VAR_0->frame_timer = (double)av_gettime() / 1000000.0; VAR_0->video_current_pts_time = av_gettime(); packet_queue_init(&VAR_0->videoq); VAR_0->video_tid = SDL_CreateThread(video_thread, VAR_0); break; case CODEC_TYPE_SUBTITLE: VAR_0->subtitle_stream = VAR_1; VAR_0->subtitle_st = ic->streams[VAR_1]; packet_queue_init(&VAR_0->subtitleq); VAR_0->subtitle_tid = SDL_CreateThread(subtitle_thread, VAR_0); break; default: break; } return 0; }
[ "static int FUNC_0(VideoState *VAR_0, int VAR_1)\n{", "AVFormatContext *ic = VAR_0->ic;", "AVCodecContext *enc;", "AVCodec *codec;", "SDL_AudioSpec wanted_spec, spec;", "if (VAR_1 < 0 || VAR_1 >= ic->nb_streams)\nreturn -1;", "enc = ic->streams[VAR_1]->codec;", "if (enc->codec_type == CODEC_TYPE_AUDIO) {", "if (enc->channels > 0) {", "enc->request_channels = FFMIN(2, enc->channels);", "} else {", "enc->request_channels = 2;", "}", "}", "codec = avcodec_find_decoder(enc->codec_id);", "enc->debug_mv = debug_mv;", "enc->debug = debug;", "enc->workaround_bugs = workaround_bugs;", "enc->lowres = lowres;", "if(lowres) enc->flags |= CODEC_FLAG_EMU_EDGE;", "enc->idct_algo= idct;", "if(fast) enc->flags2 |= CODEC_FLAG2_FAST;", "enc->skip_frame= skip_frame;", "enc->skip_idct= skip_idct;", "enc->skip_loop_filter= skip_loop_filter;", "enc->error_recognition= error_recognition;", "enc->error_concealment= error_concealment;", "set_context_opts(enc, avcodec_opts[enc->codec_type], 0);", "if (!codec ||\navcodec_open(enc, codec) < 0)\nreturn -1;", "if (enc->codec_type == CODEC_TYPE_AUDIO) {", "wanted_spec.freq = enc->sample_rate;", "wanted_spec.format = AUDIO_S16SYS;", "wanted_spec.channels = enc->channels;", "wanted_spec.silence = 0;", "wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;", "wanted_spec.callback = sdl_audio_callback;", "wanted_spec.userdata = VAR_0;", "if (SDL_OpenAudio(&wanted_spec, &spec) < 0) {", "fprintf(stderr, \"SDL_OpenAudio: %s\\n\", SDL_GetError());", "return -1;", "}", "VAR_0->audio_hw_buf_size = spec.size;", "VAR_0->audio_src_fmt= SAMPLE_FMT_S16;", "}", "if(thread_count>1)\navcodec_thread_init(enc, thread_count);", "enc->thread_count= thread_count;", "ic->streams[VAR_1]->discard = AVDISCARD_DEFAULT;", "switch(enc->codec_type) {", "case CODEC_TYPE_AUDIO:\nVAR_0->audio_stream = VAR_1;", "VAR_0->audio_st = ic->streams[VAR_1];", "VAR_0->audio_buf_size = 0;", "VAR_0->audio_buf_index = 0;", "VAR_0->audio_diff_avg_coef = exp(log(0.01) / AUDIO_DIFF_AVG_NB);", "VAR_0->audio_diff_avg_count = 0;", "VAR_0->audio_diff_threshold = 2.0 * SDL_AUDIO_BUFFER_SIZE / enc->sample_rate;", "memset(&VAR_0->audio_pkt, 0, sizeof(VAR_0->audio_pkt));", "packet_queue_init(&VAR_0->audioq);", "SDL_PauseAudio(0);", "break;", "case CODEC_TYPE_VIDEO:\nVAR_0->video_stream = VAR_1;", "VAR_0->video_st = ic->streams[VAR_1];", "VAR_0->frame_last_delay = 40e-3;", "VAR_0->frame_timer = (double)av_gettime() / 1000000.0;", "VAR_0->video_current_pts_time = av_gettime();", "packet_queue_init(&VAR_0->videoq);", "VAR_0->video_tid = SDL_CreateThread(video_thread, VAR_0);", "break;", "case CODEC_TYPE_SUBTITLE:\nVAR_0->subtitle_stream = VAR_1;", "VAR_0->subtitle_st = ic->streams[VAR_1];", "packet_queue_init(&VAR_0->subtitleq);", "VAR_0->subtitle_tid = SDL_CreateThread(subtitle_thread, VAR_0);", "break;", "default:\nbreak;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 73, 75, 77 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 139 ], [ 141 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ] ]
21,620
void qemu_set_version(const char *version) { qemu_version = version; }
false
qemu
35c2c8dc8c0899882a8e0d349d93bd657772f1e7
void qemu_set_version(const char *version) { qemu_version = version; }
{ "code": [], "line_no": [] }
void FUNC_0(const char *VAR_0) { qemu_version = VAR_0; }
[ "void FUNC_0(const char *VAR_0)\n{", "qemu_version = VAR_0;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
21,623
tcg_target_ulong tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr) { tcg_target_ulong next_tb = 0; tci_reg[TCG_AREG0] = (tcg_target_ulong)env; assert(tb_ptr); for (;;) { #if defined(GETPC) tci_tb_ptr = (uintptr_t)tb_ptr; #endif TCGOpcode opc = tb_ptr[0]; #if !defined(NDEBUG) uint8_t op_size = tb_ptr[1]; uint8_t *old_code_ptr = tb_ptr; #endif tcg_target_ulong t0; tcg_target_ulong t1; tcg_target_ulong t2; tcg_target_ulong label; TCGCond condition; target_ulong taddr; #ifndef CONFIG_SOFTMMU tcg_target_ulong host_addr; #endif uint8_t tmp8; uint16_t tmp16; uint32_t tmp32; uint64_t tmp64; #if TCG_TARGET_REG_BITS == 32 uint64_t v64; #endif /* Skip opcode and size entry. */ tb_ptr += 2; switch (opc) { case INDEX_op_end: case INDEX_op_nop: break; case INDEX_op_nop1: case INDEX_op_nop2: case INDEX_op_nop3: case INDEX_op_nopn: case INDEX_op_discard: TODO(); break; case INDEX_op_set_label: TODO(); break; case INDEX_op_call: t0 = tci_read_ri(&tb_ptr); #if TCG_TARGET_REG_BITS == 32 tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0), tci_read_reg(TCG_REG_R1), tci_read_reg(TCG_REG_R2), tci_read_reg(TCG_REG_R3), tci_read_reg(TCG_REG_R5), tci_read_reg(TCG_REG_R6), tci_read_reg(TCG_REG_R7), tci_read_reg(TCG_REG_R8), tci_read_reg(TCG_REG_R9), tci_read_reg(TCG_REG_R10)); tci_write_reg(TCG_REG_R0, tmp64); tci_write_reg(TCG_REG_R1, tmp64 >> 32); #else tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0), tci_read_reg(TCG_REG_R1), tci_read_reg(TCG_REG_R2), tci_read_reg(TCG_REG_R3), tci_read_reg(TCG_REG_R5)); tci_write_reg(TCG_REG_R0, tmp64); #endif break; case INDEX_op_br: label = tci_read_label(&tb_ptr); assert(tb_ptr == old_code_ptr + op_size); tb_ptr = (uint8_t *)label; continue; case INDEX_op_setcond_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); condition = *tb_ptr++; tci_write_reg32(t0, tci_compare32(t1, t2, condition)); break; #if TCG_TARGET_REG_BITS == 32 case INDEX_op_setcond2_i32: t0 = *tb_ptr++; tmp64 = tci_read_r64(&tb_ptr); v64 = tci_read_ri64(&tb_ptr); condition = *tb_ptr++; tci_write_reg32(t0, tci_compare64(tmp64, v64, condition)); break; #elif TCG_TARGET_REG_BITS == 64 case INDEX_op_setcond_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); condition = *tb_ptr++; tci_write_reg64(t0, tci_compare64(t1, t2, condition)); break; #endif case INDEX_op_mov_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg32(t0, t1); break; case INDEX_op_movi_i32: t0 = *tb_ptr++; t1 = tci_read_i32(&tb_ptr); tci_write_reg32(t0, t1); break; /* Load/store operations (32 bit). */ case INDEX_op_ld8u_i32: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg8(t0, *(uint8_t *)(t1 + t2)); break; case INDEX_op_ld8s_i32: case INDEX_op_ld16u_i32: TODO(); break; case INDEX_op_ld16s_i32: TODO(); break; case INDEX_op_ld_i32: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg32(t0, *(uint32_t *)(t1 + t2)); break; case INDEX_op_st8_i32: t0 = tci_read_r8(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint8_t *)(t1 + t2) = t0; break; case INDEX_op_st16_i32: t0 = tci_read_r16(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint16_t *)(t1 + t2) = t0; break; case INDEX_op_st_i32: t0 = tci_read_r32(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint32_t *)(t1 + t2) = t0; break; /* Arithmetic operations (32 bit). */ case INDEX_op_add_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 + t2); break; case INDEX_op_sub_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 - t2); break; case INDEX_op_mul_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 * t2); break; #if TCG_TARGET_HAS_div_i32 case INDEX_op_div_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, (int32_t)t1 / (int32_t)t2); break; case INDEX_op_divu_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 / t2); break; case INDEX_op_rem_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, (int32_t)t1 % (int32_t)t2); break; case INDEX_op_remu_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 % t2); break; #elif TCG_TARGET_HAS_div2_i32 case INDEX_op_div2_i32: case INDEX_op_divu2_i32: TODO(); break; #endif case INDEX_op_and_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 & t2); break; case INDEX_op_or_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 | t2); break; case INDEX_op_xor_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 ^ t2); break; /* Shift/rotate operations (32 bit). */ case INDEX_op_shl_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 << t2); break; case INDEX_op_shr_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 >> t2); break; case INDEX_op_sar_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, ((int32_t)t1 >> t2)); break; #if TCG_TARGET_HAS_rot_i32 case INDEX_op_rotl_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, (t1 << t2) | (t1 >> (32 - t2))); break; case INDEX_op_rotr_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, (t1 >> t2) | (t1 << (32 - t2))); break; #endif #if TCG_TARGET_HAS_deposit_i32 case INDEX_op_deposit_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); t2 = tci_read_r32(&tb_ptr); tmp16 = *tb_ptr++; tmp8 = *tb_ptr++; tmp32 = (((1 << tmp8) - 1) << tmp16); tci_write_reg32(t0, (t1 & ~tmp32) | ((t2 << tmp16) & tmp32)); break; #endif case INDEX_op_brcond_i32: t0 = tci_read_r32(&tb_ptr); t1 = tci_read_ri32(&tb_ptr); condition = *tb_ptr++; label = tci_read_label(&tb_ptr); if (tci_compare32(t0, t1, condition)) { assert(tb_ptr == old_code_ptr + op_size); tb_ptr = (uint8_t *)label; continue; } break; #if TCG_TARGET_REG_BITS == 32 case INDEX_op_add2_i32: t0 = *tb_ptr++; t1 = *tb_ptr++; tmp64 = tci_read_r64(&tb_ptr); tmp64 += tci_read_r64(&tb_ptr); tci_write_reg64(t1, t0, tmp64); break; case INDEX_op_sub2_i32: t0 = *tb_ptr++; t1 = *tb_ptr++; tmp64 = tci_read_r64(&tb_ptr); tmp64 -= tci_read_r64(&tb_ptr); tci_write_reg64(t1, t0, tmp64); break; case INDEX_op_brcond2_i32: tmp64 = tci_read_r64(&tb_ptr); v64 = tci_read_ri64(&tb_ptr); condition = *tb_ptr++; label = tci_read_label(&tb_ptr); if (tci_compare64(tmp64, v64, condition)) { assert(tb_ptr == old_code_ptr + op_size); tb_ptr = (uint8_t *)label; continue; } break; case INDEX_op_mulu2_i32: t0 = *tb_ptr++; t1 = *tb_ptr++; t2 = tci_read_r32(&tb_ptr); tmp64 = tci_read_r32(&tb_ptr); tci_write_reg64(t1, t0, t2 * tmp64); break; #endif /* TCG_TARGET_REG_BITS == 32 */ #if TCG_TARGET_HAS_ext8s_i32 case INDEX_op_ext8s_i32: t0 = *tb_ptr++; t1 = tci_read_r8s(&tb_ptr); tci_write_reg32(t0, t1); break; #endif #if TCG_TARGET_HAS_ext16s_i32 case INDEX_op_ext16s_i32: t0 = *tb_ptr++; t1 = tci_read_r16s(&tb_ptr); tci_write_reg32(t0, t1); break; #endif #if TCG_TARGET_HAS_ext8u_i32 case INDEX_op_ext8u_i32: t0 = *tb_ptr++; t1 = tci_read_r8(&tb_ptr); tci_write_reg32(t0, t1); break; #endif #if TCG_TARGET_HAS_ext16u_i32 case INDEX_op_ext16u_i32: t0 = *tb_ptr++; t1 = tci_read_r16(&tb_ptr); tci_write_reg32(t0, t1); break; #endif #if TCG_TARGET_HAS_bswap16_i32 case INDEX_op_bswap16_i32: t0 = *tb_ptr++; t1 = tci_read_r16(&tb_ptr); tci_write_reg32(t0, bswap16(t1)); break; #endif #if TCG_TARGET_HAS_bswap32_i32 case INDEX_op_bswap32_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg32(t0, bswap32(t1)); break; #endif #if TCG_TARGET_HAS_not_i32 case INDEX_op_not_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg32(t0, ~t1); break; #endif #if TCG_TARGET_HAS_neg_i32 case INDEX_op_neg_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg32(t0, -t1); break; #endif #if TCG_TARGET_REG_BITS == 64 case INDEX_op_mov_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); tci_write_reg64(t0, t1); break; case INDEX_op_movi_i64: t0 = *tb_ptr++; t1 = tci_read_i64(&tb_ptr); tci_write_reg64(t0, t1); break; /* Load/store operations (64 bit). */ case INDEX_op_ld8u_i64: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg8(t0, *(uint8_t *)(t1 + t2)); break; case INDEX_op_ld8s_i64: case INDEX_op_ld16u_i64: case INDEX_op_ld16s_i64: TODO(); break; case INDEX_op_ld32u_i64: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg32(t0, *(uint32_t *)(t1 + t2)); break; case INDEX_op_ld32s_i64: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg32s(t0, *(int32_t *)(t1 + t2)); break; case INDEX_op_ld_i64: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg64(t0, *(uint64_t *)(t1 + t2)); break; case INDEX_op_st8_i64: t0 = tci_read_r8(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint8_t *)(t1 + t2) = t0; break; case INDEX_op_st16_i64: t0 = tci_read_r16(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint16_t *)(t1 + t2) = t0; break; case INDEX_op_st32_i64: t0 = tci_read_r32(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint32_t *)(t1 + t2) = t0; break; case INDEX_op_st_i64: t0 = tci_read_r64(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint64_t *)(t1 + t2) = t0; break; /* Arithmetic operations (64 bit). */ case INDEX_op_add_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 + t2); break; case INDEX_op_sub_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 - t2); break; case INDEX_op_mul_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 * t2); break; #if TCG_TARGET_HAS_div_i64 case INDEX_op_div_i64: case INDEX_op_divu_i64: case INDEX_op_rem_i64: case INDEX_op_remu_i64: TODO(); break; #elif TCG_TARGET_HAS_div2_i64 case INDEX_op_div2_i64: case INDEX_op_divu2_i64: TODO(); break; #endif case INDEX_op_and_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 & t2); break; case INDEX_op_or_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 | t2); break; case INDEX_op_xor_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 ^ t2); break; /* Shift/rotate operations (64 bit). */ case INDEX_op_shl_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 << t2); break; case INDEX_op_shr_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 >> t2); break; case INDEX_op_sar_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, ((int64_t)t1 >> t2)); break; #if TCG_TARGET_HAS_rot_i64 case INDEX_op_rotl_i64: case INDEX_op_rotr_i64: TODO(); break; #endif #if TCG_TARGET_HAS_deposit_i64 case INDEX_op_deposit_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); t2 = tci_read_r64(&tb_ptr); tmp16 = *tb_ptr++; tmp8 = *tb_ptr++; tmp64 = (((1ULL << tmp8) - 1) << tmp16); tci_write_reg64(t0, (t1 & ~tmp64) | ((t2 << tmp16) & tmp64)); break; #endif case INDEX_op_brcond_i64: t0 = tci_read_r64(&tb_ptr); t1 = tci_read_ri64(&tb_ptr); condition = *tb_ptr++; label = tci_read_label(&tb_ptr); if (tci_compare64(t0, t1, condition)) { assert(tb_ptr == old_code_ptr + op_size); tb_ptr = (uint8_t *)label; continue; } break; #if TCG_TARGET_HAS_ext8u_i64 case INDEX_op_ext8u_i64: t0 = *tb_ptr++; t1 = tci_read_r8(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext8s_i64 case INDEX_op_ext8s_i64: t0 = *tb_ptr++; t1 = tci_read_r8s(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext16s_i64 case INDEX_op_ext16s_i64: t0 = *tb_ptr++; t1 = tci_read_r16s(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext16u_i64 case INDEX_op_ext16u_i64: t0 = *tb_ptr++; t1 = tci_read_r16(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext32s_i64 case INDEX_op_ext32s_i64: t0 = *tb_ptr++; t1 = tci_read_r32s(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext32u_i64 case INDEX_op_ext32u_i64: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_bswap16_i64 case INDEX_op_bswap16_i64: TODO(); t0 = *tb_ptr++; t1 = tci_read_r16(&tb_ptr); tci_write_reg64(t0, bswap16(t1)); break; #endif #if TCG_TARGET_HAS_bswap32_i64 case INDEX_op_bswap32_i64: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg64(t0, bswap32(t1)); break; #endif #if TCG_TARGET_HAS_bswap64_i64 case INDEX_op_bswap64_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); tci_write_reg64(t0, bswap64(t1)); break; #endif #if TCG_TARGET_HAS_not_i64 case INDEX_op_not_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); tci_write_reg64(t0, ~t1); break; #endif #if TCG_TARGET_HAS_neg_i64 case INDEX_op_neg_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); tci_write_reg64(t0, -t1); break; #endif #endif /* TCG_TARGET_REG_BITS == 64 */ /* QEMU specific operations. */ #if TARGET_LONG_BITS > TCG_TARGET_REG_BITS case INDEX_op_debug_insn_start: TODO(); break; #else case INDEX_op_debug_insn_start: TODO(); break; #endif case INDEX_op_exit_tb: next_tb = *(uint64_t *)tb_ptr; goto exit; break; case INDEX_op_goto_tb: t0 = tci_read_i32(&tb_ptr); assert(tb_ptr == old_code_ptr + op_size); tb_ptr += (int32_t)t0; continue; case INDEX_op_qemu_ld8u: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp8 = *(uint8_t *)(host_addr + GUEST_BASE); #endif tci_write_reg8(t0, tmp8); break; case INDEX_op_qemu_ld8s: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp8 = *(uint8_t *)(host_addr + GUEST_BASE); #endif tci_write_reg8s(t0, tmp8); break; case INDEX_op_qemu_ld16u: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg16(t0, tmp16); break; case INDEX_op_qemu_ld16s: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg16s(t0, tmp16); break; #if TCG_TARGET_REG_BITS == 64 case INDEX_op_qemu_ld32u: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg32(t0, tmp32); break; case INDEX_op_qemu_ld32s: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg32s(t0, tmp32); break; #endif /* TCG_TARGET_REG_BITS == 64 */ case INDEX_op_qemu_ld32: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg32(t0, tmp32); break; case INDEX_op_qemu_ld64: t0 = *tb_ptr++; #if TCG_TARGET_REG_BITS == 32 t1 = *tb_ptr++; #endif taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp64 = helper_ldq_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp64 = tswap64(*(uint64_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg(t0, tmp64); #if TCG_TARGET_REG_BITS == 32 tci_write_reg(t1, tmp64 >> 32); #endif break; case INDEX_op_qemu_st8: t0 = tci_read_r8(&tb_ptr); taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU t2 = tci_read_i(&tb_ptr); helper_stb_mmu(env, taddr, t0, t2); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); *(uint8_t *)(host_addr + GUEST_BASE) = t0; #endif break; case INDEX_op_qemu_st16: t0 = tci_read_r16(&tb_ptr); taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU t2 = tci_read_i(&tb_ptr); helper_stw_mmu(env, taddr, t0, t2); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); *(uint16_t *)(host_addr + GUEST_BASE) = tswap16(t0); #endif break; case INDEX_op_qemu_st32: t0 = tci_read_r32(&tb_ptr); taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU t2 = tci_read_i(&tb_ptr); helper_stl_mmu(env, taddr, t0, t2); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); *(uint32_t *)(host_addr + GUEST_BASE) = tswap32(t0); #endif break; case INDEX_op_qemu_st64: tmp64 = tci_read_r64(&tb_ptr); taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU t2 = tci_read_i(&tb_ptr); helper_stq_mmu(env, taddr, tmp64, t2); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); *(uint64_t *)(host_addr + GUEST_BASE) = tswap64(tmp64); #endif break; default: TODO(); break; } assert(tb_ptr == old_code_ptr + op_size); } exit: return next_tb; }
false
qemu
dea8fde8b8cb1ab14e15308aadbf88eeccd4e873
tcg_target_ulong tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr) { tcg_target_ulong next_tb = 0; tci_reg[TCG_AREG0] = (tcg_target_ulong)env; assert(tb_ptr); for (;;) { #if defined(GETPC) tci_tb_ptr = (uintptr_t)tb_ptr; #endif TCGOpcode opc = tb_ptr[0]; #if !defined(NDEBUG) uint8_t op_size = tb_ptr[1]; uint8_t *old_code_ptr = tb_ptr; #endif tcg_target_ulong t0; tcg_target_ulong t1; tcg_target_ulong t2; tcg_target_ulong label; TCGCond condition; target_ulong taddr; #ifndef CONFIG_SOFTMMU tcg_target_ulong host_addr; #endif uint8_t tmp8; uint16_t tmp16; uint32_t tmp32; uint64_t tmp64; #if TCG_TARGET_REG_BITS == 32 uint64_t v64; #endif tb_ptr += 2; switch (opc) { case INDEX_op_end: case INDEX_op_nop: break; case INDEX_op_nop1: case INDEX_op_nop2: case INDEX_op_nop3: case INDEX_op_nopn: case INDEX_op_discard: TODO(); break; case INDEX_op_set_label: TODO(); break; case INDEX_op_call: t0 = tci_read_ri(&tb_ptr); #if TCG_TARGET_REG_BITS == 32 tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0), tci_read_reg(TCG_REG_R1), tci_read_reg(TCG_REG_R2), tci_read_reg(TCG_REG_R3), tci_read_reg(TCG_REG_R5), tci_read_reg(TCG_REG_R6), tci_read_reg(TCG_REG_R7), tci_read_reg(TCG_REG_R8), tci_read_reg(TCG_REG_R9), tci_read_reg(TCG_REG_R10)); tci_write_reg(TCG_REG_R0, tmp64); tci_write_reg(TCG_REG_R1, tmp64 >> 32); #else tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0), tci_read_reg(TCG_REG_R1), tci_read_reg(TCG_REG_R2), tci_read_reg(TCG_REG_R3), tci_read_reg(TCG_REG_R5)); tci_write_reg(TCG_REG_R0, tmp64); #endif break; case INDEX_op_br: label = tci_read_label(&tb_ptr); assert(tb_ptr == old_code_ptr + op_size); tb_ptr = (uint8_t *)label; continue; case INDEX_op_setcond_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); condition = *tb_ptr++; tci_write_reg32(t0, tci_compare32(t1, t2, condition)); break; #if TCG_TARGET_REG_BITS == 32 case INDEX_op_setcond2_i32: t0 = *tb_ptr++; tmp64 = tci_read_r64(&tb_ptr); v64 = tci_read_ri64(&tb_ptr); condition = *tb_ptr++; tci_write_reg32(t0, tci_compare64(tmp64, v64, condition)); break; #elif TCG_TARGET_REG_BITS == 64 case INDEX_op_setcond_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); condition = *tb_ptr++; tci_write_reg64(t0, tci_compare64(t1, t2, condition)); break; #endif case INDEX_op_mov_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg32(t0, t1); break; case INDEX_op_movi_i32: t0 = *tb_ptr++; t1 = tci_read_i32(&tb_ptr); tci_write_reg32(t0, t1); break; case INDEX_op_ld8u_i32: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg8(t0, *(uint8_t *)(t1 + t2)); break; case INDEX_op_ld8s_i32: case INDEX_op_ld16u_i32: TODO(); break; case INDEX_op_ld16s_i32: TODO(); break; case INDEX_op_ld_i32: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg32(t0, *(uint32_t *)(t1 + t2)); break; case INDEX_op_st8_i32: t0 = tci_read_r8(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint8_t *)(t1 + t2) = t0; break; case INDEX_op_st16_i32: t0 = tci_read_r16(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint16_t *)(t1 + t2) = t0; break; case INDEX_op_st_i32: t0 = tci_read_r32(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint32_t *)(t1 + t2) = t0; break; case INDEX_op_add_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 + t2); break; case INDEX_op_sub_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 - t2); break; case INDEX_op_mul_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 * t2); break; #if TCG_TARGET_HAS_div_i32 case INDEX_op_div_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, (int32_t)t1 / (int32_t)t2); break; case INDEX_op_divu_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 / t2); break; case INDEX_op_rem_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, (int32_t)t1 % (int32_t)t2); break; case INDEX_op_remu_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 % t2); break; #elif TCG_TARGET_HAS_div2_i32 case INDEX_op_div2_i32: case INDEX_op_divu2_i32: TODO(); break; #endif case INDEX_op_and_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 & t2); break; case INDEX_op_or_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 | t2); break; case INDEX_op_xor_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 ^ t2); break; case INDEX_op_shl_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 << t2); break; case INDEX_op_shr_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 >> t2); break; case INDEX_op_sar_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, ((int32_t)t1 >> t2)); break; #if TCG_TARGET_HAS_rot_i32 case INDEX_op_rotl_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, (t1 << t2) | (t1 >> (32 - t2))); break; case INDEX_op_rotr_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, (t1 >> t2) | (t1 << (32 - t2))); break; #endif #if TCG_TARGET_HAS_deposit_i32 case INDEX_op_deposit_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); t2 = tci_read_r32(&tb_ptr); tmp16 = *tb_ptr++; tmp8 = *tb_ptr++; tmp32 = (((1 << tmp8) - 1) << tmp16); tci_write_reg32(t0, (t1 & ~tmp32) | ((t2 << tmp16) & tmp32)); break; #endif case INDEX_op_brcond_i32: t0 = tci_read_r32(&tb_ptr); t1 = tci_read_ri32(&tb_ptr); condition = *tb_ptr++; label = tci_read_label(&tb_ptr); if (tci_compare32(t0, t1, condition)) { assert(tb_ptr == old_code_ptr + op_size); tb_ptr = (uint8_t *)label; continue; } break; #if TCG_TARGET_REG_BITS == 32 case INDEX_op_add2_i32: t0 = *tb_ptr++; t1 = *tb_ptr++; tmp64 = tci_read_r64(&tb_ptr); tmp64 += tci_read_r64(&tb_ptr); tci_write_reg64(t1, t0, tmp64); break; case INDEX_op_sub2_i32: t0 = *tb_ptr++; t1 = *tb_ptr++; tmp64 = tci_read_r64(&tb_ptr); tmp64 -= tci_read_r64(&tb_ptr); tci_write_reg64(t1, t0, tmp64); break; case INDEX_op_brcond2_i32: tmp64 = tci_read_r64(&tb_ptr); v64 = tci_read_ri64(&tb_ptr); condition = *tb_ptr++; label = tci_read_label(&tb_ptr); if (tci_compare64(tmp64, v64, condition)) { assert(tb_ptr == old_code_ptr + op_size); tb_ptr = (uint8_t *)label; continue; } break; case INDEX_op_mulu2_i32: t0 = *tb_ptr++; t1 = *tb_ptr++; t2 = tci_read_r32(&tb_ptr); tmp64 = tci_read_r32(&tb_ptr); tci_write_reg64(t1, t0, t2 * tmp64); break; #endif #if TCG_TARGET_HAS_ext8s_i32 case INDEX_op_ext8s_i32: t0 = *tb_ptr++; t1 = tci_read_r8s(&tb_ptr); tci_write_reg32(t0, t1); break; #endif #if TCG_TARGET_HAS_ext16s_i32 case INDEX_op_ext16s_i32: t0 = *tb_ptr++; t1 = tci_read_r16s(&tb_ptr); tci_write_reg32(t0, t1); break; #endif #if TCG_TARGET_HAS_ext8u_i32 case INDEX_op_ext8u_i32: t0 = *tb_ptr++; t1 = tci_read_r8(&tb_ptr); tci_write_reg32(t0, t1); break; #endif #if TCG_TARGET_HAS_ext16u_i32 case INDEX_op_ext16u_i32: t0 = *tb_ptr++; t1 = tci_read_r16(&tb_ptr); tci_write_reg32(t0, t1); break; #endif #if TCG_TARGET_HAS_bswap16_i32 case INDEX_op_bswap16_i32: t0 = *tb_ptr++; t1 = tci_read_r16(&tb_ptr); tci_write_reg32(t0, bswap16(t1)); break; #endif #if TCG_TARGET_HAS_bswap32_i32 case INDEX_op_bswap32_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg32(t0, bswap32(t1)); break; #endif #if TCG_TARGET_HAS_not_i32 case INDEX_op_not_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg32(t0, ~t1); break; #endif #if TCG_TARGET_HAS_neg_i32 case INDEX_op_neg_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg32(t0, -t1); break; #endif #if TCG_TARGET_REG_BITS == 64 case INDEX_op_mov_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); tci_write_reg64(t0, t1); break; case INDEX_op_movi_i64: t0 = *tb_ptr++; t1 = tci_read_i64(&tb_ptr); tci_write_reg64(t0, t1); break; case INDEX_op_ld8u_i64: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg8(t0, *(uint8_t *)(t1 + t2)); break; case INDEX_op_ld8s_i64: case INDEX_op_ld16u_i64: case INDEX_op_ld16s_i64: TODO(); break; case INDEX_op_ld32u_i64: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg32(t0, *(uint32_t *)(t1 + t2)); break; case INDEX_op_ld32s_i64: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg32s(t0, *(int32_t *)(t1 + t2)); break; case INDEX_op_ld_i64: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg64(t0, *(uint64_t *)(t1 + t2)); break; case INDEX_op_st8_i64: t0 = tci_read_r8(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint8_t *)(t1 + t2) = t0; break; case INDEX_op_st16_i64: t0 = tci_read_r16(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint16_t *)(t1 + t2) = t0; break; case INDEX_op_st32_i64: t0 = tci_read_r32(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint32_t *)(t1 + t2) = t0; break; case INDEX_op_st_i64: t0 = tci_read_r64(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint64_t *)(t1 + t2) = t0; break; case INDEX_op_add_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 + t2); break; case INDEX_op_sub_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 - t2); break; case INDEX_op_mul_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 * t2); break; #if TCG_TARGET_HAS_div_i64 case INDEX_op_div_i64: case INDEX_op_divu_i64: case INDEX_op_rem_i64: case INDEX_op_remu_i64: TODO(); break; #elif TCG_TARGET_HAS_div2_i64 case INDEX_op_div2_i64: case INDEX_op_divu2_i64: TODO(); break; #endif case INDEX_op_and_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 & t2); break; case INDEX_op_or_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 | t2); break; case INDEX_op_xor_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 ^ t2); break; case INDEX_op_shl_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 << t2); break; case INDEX_op_shr_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 >> t2); break; case INDEX_op_sar_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, ((int64_t)t1 >> t2)); break; #if TCG_TARGET_HAS_rot_i64 case INDEX_op_rotl_i64: case INDEX_op_rotr_i64: TODO(); break; #endif #if TCG_TARGET_HAS_deposit_i64 case INDEX_op_deposit_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); t2 = tci_read_r64(&tb_ptr); tmp16 = *tb_ptr++; tmp8 = *tb_ptr++; tmp64 = (((1ULL << tmp8) - 1) << tmp16); tci_write_reg64(t0, (t1 & ~tmp64) | ((t2 << tmp16) & tmp64)); break; #endif case INDEX_op_brcond_i64: t0 = tci_read_r64(&tb_ptr); t1 = tci_read_ri64(&tb_ptr); condition = *tb_ptr++; label = tci_read_label(&tb_ptr); if (tci_compare64(t0, t1, condition)) { assert(tb_ptr == old_code_ptr + op_size); tb_ptr = (uint8_t *)label; continue; } break; #if TCG_TARGET_HAS_ext8u_i64 case INDEX_op_ext8u_i64: t0 = *tb_ptr++; t1 = tci_read_r8(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext8s_i64 case INDEX_op_ext8s_i64: t0 = *tb_ptr++; t1 = tci_read_r8s(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext16s_i64 case INDEX_op_ext16s_i64: t0 = *tb_ptr++; t1 = tci_read_r16s(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext16u_i64 case INDEX_op_ext16u_i64: t0 = *tb_ptr++; t1 = tci_read_r16(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext32s_i64 case INDEX_op_ext32s_i64: t0 = *tb_ptr++; t1 = tci_read_r32s(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext32u_i64 case INDEX_op_ext32u_i64: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_bswap16_i64 case INDEX_op_bswap16_i64: TODO(); t0 = *tb_ptr++; t1 = tci_read_r16(&tb_ptr); tci_write_reg64(t0, bswap16(t1)); break; #endif #if TCG_TARGET_HAS_bswap32_i64 case INDEX_op_bswap32_i64: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg64(t0, bswap32(t1)); break; #endif #if TCG_TARGET_HAS_bswap64_i64 case INDEX_op_bswap64_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); tci_write_reg64(t0, bswap64(t1)); break; #endif #if TCG_TARGET_HAS_not_i64 case INDEX_op_not_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); tci_write_reg64(t0, ~t1); break; #endif #if TCG_TARGET_HAS_neg_i64 case INDEX_op_neg_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); tci_write_reg64(t0, -t1); break; #endif #endif #if TARGET_LONG_BITS > TCG_TARGET_REG_BITS case INDEX_op_debug_insn_start: TODO(); break; #else case INDEX_op_debug_insn_start: TODO(); break; #endif case INDEX_op_exit_tb: next_tb = *(uint64_t *)tb_ptr; goto exit; break; case INDEX_op_goto_tb: t0 = tci_read_i32(&tb_ptr); assert(tb_ptr == old_code_ptr + op_size); tb_ptr += (int32_t)t0; continue; case INDEX_op_qemu_ld8u: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp8 = *(uint8_t *)(host_addr + GUEST_BASE); #endif tci_write_reg8(t0, tmp8); break; case INDEX_op_qemu_ld8s: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp8 = *(uint8_t *)(host_addr + GUEST_BASE); #endif tci_write_reg8s(t0, tmp8); break; case INDEX_op_qemu_ld16u: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg16(t0, tmp16); break; case INDEX_op_qemu_ld16s: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg16s(t0, tmp16); break; #if TCG_TARGET_REG_BITS == 64 case INDEX_op_qemu_ld32u: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg32(t0, tmp32); break; case INDEX_op_qemu_ld32s: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg32s(t0, tmp32); break; #endif case INDEX_op_qemu_ld32: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg32(t0, tmp32); break; case INDEX_op_qemu_ld64: t0 = *tb_ptr++; #if TCG_TARGET_REG_BITS == 32 t1 = *tb_ptr++; #endif taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp64 = helper_ldq_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp64 = tswap64(*(uint64_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg(t0, tmp64); #if TCG_TARGET_REG_BITS == 32 tci_write_reg(t1, tmp64 >> 32); #endif break; case INDEX_op_qemu_st8: t0 = tci_read_r8(&tb_ptr); taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU t2 = tci_read_i(&tb_ptr); helper_stb_mmu(env, taddr, t0, t2); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); *(uint8_t *)(host_addr + GUEST_BASE) = t0; #endif break; case INDEX_op_qemu_st16: t0 = tci_read_r16(&tb_ptr); taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU t2 = tci_read_i(&tb_ptr); helper_stw_mmu(env, taddr, t0, t2); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); *(uint16_t *)(host_addr + GUEST_BASE) = tswap16(t0); #endif break; case INDEX_op_qemu_st32: t0 = tci_read_r32(&tb_ptr); taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU t2 = tci_read_i(&tb_ptr); helper_stl_mmu(env, taddr, t0, t2); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); *(uint32_t *)(host_addr + GUEST_BASE) = tswap32(t0); #endif break; case INDEX_op_qemu_st64: tmp64 = tci_read_r64(&tb_ptr); taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU t2 = tci_read_i(&tb_ptr); helper_stq_mmu(env, taddr, tmp64, t2); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); *(uint64_t *)(host_addr + GUEST_BASE) = tswap64(tmp64); #endif break; default: TODO(); break; } assert(tb_ptr == old_code_ptr + op_size); } exit: return next_tb; }
{ "code": [], "line_no": [] }
tcg_target_ulong FUNC_0(CPUArchState *env, uint8_t *tb_ptr) { tcg_target_ulong next_tb = 0; tci_reg[TCG_AREG0] = (tcg_target_ulong)env; assert(tb_ptr); for (;;) { #if defined(GETPC) tci_tb_ptr = (uintptr_t)tb_ptr; #endif TCGOpcode opc = tb_ptr[0]; #if !defined(NDEBUG) uint8_t op_size = tb_ptr[1]; uint8_t *old_code_ptr = tb_ptr; #endif tcg_target_ulong t0; tcg_target_ulong t1; tcg_target_ulong t2; tcg_target_ulong label; TCGCond condition; target_ulong taddr; #ifndef CONFIG_SOFTMMU tcg_target_ulong host_addr; #endif uint8_t tmp8; uint16_t tmp16; uint32_t tmp32; uint64_t tmp64; #if TCG_TARGET_REG_BITS == 32 uint64_t v64; #endif tb_ptr += 2; switch (opc) { case INDEX_op_end: case INDEX_op_nop: break; case INDEX_op_nop1: case INDEX_op_nop2: case INDEX_op_nop3: case INDEX_op_nopn: case INDEX_op_discard: TODO(); break; case INDEX_op_set_label: TODO(); break; case INDEX_op_call: t0 = tci_read_ri(&tb_ptr); #if TCG_TARGET_REG_BITS == 32 tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0), tci_read_reg(TCG_REG_R1), tci_read_reg(TCG_REG_R2), tci_read_reg(TCG_REG_R3), tci_read_reg(TCG_REG_R5), tci_read_reg(TCG_REG_R6), tci_read_reg(TCG_REG_R7), tci_read_reg(TCG_REG_R8), tci_read_reg(TCG_REG_R9), tci_read_reg(TCG_REG_R10)); tci_write_reg(TCG_REG_R0, tmp64); tci_write_reg(TCG_REG_R1, tmp64 >> 32); #else tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0), tci_read_reg(TCG_REG_R1), tci_read_reg(TCG_REG_R2), tci_read_reg(TCG_REG_R3), tci_read_reg(TCG_REG_R5)); tci_write_reg(TCG_REG_R0, tmp64); #endif break; case INDEX_op_br: label = tci_read_label(&tb_ptr); assert(tb_ptr == old_code_ptr + op_size); tb_ptr = (uint8_t *)label; continue; case INDEX_op_setcond_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); condition = *tb_ptr++; tci_write_reg32(t0, tci_compare32(t1, t2, condition)); break; #if TCG_TARGET_REG_BITS == 32 case INDEX_op_setcond2_i32: t0 = *tb_ptr++; tmp64 = tci_read_r64(&tb_ptr); v64 = tci_read_ri64(&tb_ptr); condition = *tb_ptr++; tci_write_reg32(t0, tci_compare64(tmp64, v64, condition)); break; #elif TCG_TARGET_REG_BITS == 64 case INDEX_op_setcond_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); condition = *tb_ptr++; tci_write_reg64(t0, tci_compare64(t1, t2, condition)); break; #endif case INDEX_op_mov_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg32(t0, t1); break; case INDEX_op_movi_i32: t0 = *tb_ptr++; t1 = tci_read_i32(&tb_ptr); tci_write_reg32(t0, t1); break; case INDEX_op_ld8u_i32: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg8(t0, *(uint8_t *)(t1 + t2)); break; case INDEX_op_ld8s_i32: case INDEX_op_ld16u_i32: TODO(); break; case INDEX_op_ld16s_i32: TODO(); break; case INDEX_op_ld_i32: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg32(t0, *(uint32_t *)(t1 + t2)); break; case INDEX_op_st8_i32: t0 = tci_read_r8(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint8_t *)(t1 + t2) = t0; break; case INDEX_op_st16_i32: t0 = tci_read_r16(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint16_t *)(t1 + t2) = t0; break; case INDEX_op_st_i32: t0 = tci_read_r32(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint32_t *)(t1 + t2) = t0; break; case INDEX_op_add_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 + t2); break; case INDEX_op_sub_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 - t2); break; case INDEX_op_mul_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 * t2); break; #if TCG_TARGET_HAS_div_i32 case INDEX_op_div_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, (int32_t)t1 / (int32_t)t2); break; case INDEX_op_divu_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 / t2); break; case INDEX_op_rem_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, (int32_t)t1 % (int32_t)t2); break; case INDEX_op_remu_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 % t2); break; #elif TCG_TARGET_HAS_div2_i32 case INDEX_op_div2_i32: case INDEX_op_divu2_i32: TODO(); break; #endif case INDEX_op_and_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 & t2); break; case INDEX_op_or_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 | t2); break; case INDEX_op_xor_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 ^ t2); break; case INDEX_op_shl_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 << t2); break; case INDEX_op_shr_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, t1 >> t2); break; case INDEX_op_sar_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, ((int32_t)t1 >> t2)); break; #if TCG_TARGET_HAS_rot_i32 case INDEX_op_rotl_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, (t1 << t2) | (t1 >> (32 - t2))); break; case INDEX_op_rotr_i32: t0 = *tb_ptr++; t1 = tci_read_ri32(&tb_ptr); t2 = tci_read_ri32(&tb_ptr); tci_write_reg32(t0, (t1 >> t2) | (t1 << (32 - t2))); break; #endif #if TCG_TARGET_HAS_deposit_i32 case INDEX_op_deposit_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); t2 = tci_read_r32(&tb_ptr); tmp16 = *tb_ptr++; tmp8 = *tb_ptr++; tmp32 = (((1 << tmp8) - 1) << tmp16); tci_write_reg32(t0, (t1 & ~tmp32) | ((t2 << tmp16) & tmp32)); break; #endif case INDEX_op_brcond_i32: t0 = tci_read_r32(&tb_ptr); t1 = tci_read_ri32(&tb_ptr); condition = *tb_ptr++; label = tci_read_label(&tb_ptr); if (tci_compare32(t0, t1, condition)) { assert(tb_ptr == old_code_ptr + op_size); tb_ptr = (uint8_t *)label; continue; } break; #if TCG_TARGET_REG_BITS == 32 case INDEX_op_add2_i32: t0 = *tb_ptr++; t1 = *tb_ptr++; tmp64 = tci_read_r64(&tb_ptr); tmp64 += tci_read_r64(&tb_ptr); tci_write_reg64(t1, t0, tmp64); break; case INDEX_op_sub2_i32: t0 = *tb_ptr++; t1 = *tb_ptr++; tmp64 = tci_read_r64(&tb_ptr); tmp64 -= tci_read_r64(&tb_ptr); tci_write_reg64(t1, t0, tmp64); break; case INDEX_op_brcond2_i32: tmp64 = tci_read_r64(&tb_ptr); v64 = tci_read_ri64(&tb_ptr); condition = *tb_ptr++; label = tci_read_label(&tb_ptr); if (tci_compare64(tmp64, v64, condition)) { assert(tb_ptr == old_code_ptr + op_size); tb_ptr = (uint8_t *)label; continue; } break; case INDEX_op_mulu2_i32: t0 = *tb_ptr++; t1 = *tb_ptr++; t2 = tci_read_r32(&tb_ptr); tmp64 = tci_read_r32(&tb_ptr); tci_write_reg64(t1, t0, t2 * tmp64); break; #endif #if TCG_TARGET_HAS_ext8s_i32 case INDEX_op_ext8s_i32: t0 = *tb_ptr++; t1 = tci_read_r8s(&tb_ptr); tci_write_reg32(t0, t1); break; #endif #if TCG_TARGET_HAS_ext16s_i32 case INDEX_op_ext16s_i32: t0 = *tb_ptr++; t1 = tci_read_r16s(&tb_ptr); tci_write_reg32(t0, t1); break; #endif #if TCG_TARGET_HAS_ext8u_i32 case INDEX_op_ext8u_i32: t0 = *tb_ptr++; t1 = tci_read_r8(&tb_ptr); tci_write_reg32(t0, t1); break; #endif #if TCG_TARGET_HAS_ext16u_i32 case INDEX_op_ext16u_i32: t0 = *tb_ptr++; t1 = tci_read_r16(&tb_ptr); tci_write_reg32(t0, t1); break; #endif #if TCG_TARGET_HAS_bswap16_i32 case INDEX_op_bswap16_i32: t0 = *tb_ptr++; t1 = tci_read_r16(&tb_ptr); tci_write_reg32(t0, bswap16(t1)); break; #endif #if TCG_TARGET_HAS_bswap32_i32 case INDEX_op_bswap32_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg32(t0, bswap32(t1)); break; #endif #if TCG_TARGET_HAS_not_i32 case INDEX_op_not_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg32(t0, ~t1); break; #endif #if TCG_TARGET_HAS_neg_i32 case INDEX_op_neg_i32: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg32(t0, -t1); break; #endif #if TCG_TARGET_REG_BITS == 64 case INDEX_op_mov_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); tci_write_reg64(t0, t1); break; case INDEX_op_movi_i64: t0 = *tb_ptr++; t1 = tci_read_i64(&tb_ptr); tci_write_reg64(t0, t1); break; case INDEX_op_ld8u_i64: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg8(t0, *(uint8_t *)(t1 + t2)); break; case INDEX_op_ld8s_i64: case INDEX_op_ld16u_i64: case INDEX_op_ld16s_i64: TODO(); break; case INDEX_op_ld32u_i64: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg32(t0, *(uint32_t *)(t1 + t2)); break; case INDEX_op_ld32s_i64: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg32s(t0, *(int32_t *)(t1 + t2)); break; case INDEX_op_ld_i64: t0 = *tb_ptr++; t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); tci_write_reg64(t0, *(uint64_t *)(t1 + t2)); break; case INDEX_op_st8_i64: t0 = tci_read_r8(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint8_t *)(t1 + t2) = t0; break; case INDEX_op_st16_i64: t0 = tci_read_r16(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint16_t *)(t1 + t2) = t0; break; case INDEX_op_st32_i64: t0 = tci_read_r32(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint32_t *)(t1 + t2) = t0; break; case INDEX_op_st_i64: t0 = tci_read_r64(&tb_ptr); t1 = tci_read_r(&tb_ptr); t2 = tci_read_s32(&tb_ptr); *(uint64_t *)(t1 + t2) = t0; break; case INDEX_op_add_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 + t2); break; case INDEX_op_sub_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 - t2); break; case INDEX_op_mul_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 * t2); break; #if TCG_TARGET_HAS_div_i64 case INDEX_op_div_i64: case INDEX_op_divu_i64: case INDEX_op_rem_i64: case INDEX_op_remu_i64: TODO(); break; #elif TCG_TARGET_HAS_div2_i64 case INDEX_op_div2_i64: case INDEX_op_divu2_i64: TODO(); break; #endif case INDEX_op_and_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 & t2); break; case INDEX_op_or_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 | t2); break; case INDEX_op_xor_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 ^ t2); break; case INDEX_op_shl_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 << t2); break; case INDEX_op_shr_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, t1 >> t2); break; case INDEX_op_sar_i64: t0 = *tb_ptr++; t1 = tci_read_ri64(&tb_ptr); t2 = tci_read_ri64(&tb_ptr); tci_write_reg64(t0, ((int64_t)t1 >> t2)); break; #if TCG_TARGET_HAS_rot_i64 case INDEX_op_rotl_i64: case INDEX_op_rotr_i64: TODO(); break; #endif #if TCG_TARGET_HAS_deposit_i64 case INDEX_op_deposit_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); t2 = tci_read_r64(&tb_ptr); tmp16 = *tb_ptr++; tmp8 = *tb_ptr++; tmp64 = (((1ULL << tmp8) - 1) << tmp16); tci_write_reg64(t0, (t1 & ~tmp64) | ((t2 << tmp16) & tmp64)); break; #endif case INDEX_op_brcond_i64: t0 = tci_read_r64(&tb_ptr); t1 = tci_read_ri64(&tb_ptr); condition = *tb_ptr++; label = tci_read_label(&tb_ptr); if (tci_compare64(t0, t1, condition)) { assert(tb_ptr == old_code_ptr + op_size); tb_ptr = (uint8_t *)label; continue; } break; #if TCG_TARGET_HAS_ext8u_i64 case INDEX_op_ext8u_i64: t0 = *tb_ptr++; t1 = tci_read_r8(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext8s_i64 case INDEX_op_ext8s_i64: t0 = *tb_ptr++; t1 = tci_read_r8s(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext16s_i64 case INDEX_op_ext16s_i64: t0 = *tb_ptr++; t1 = tci_read_r16s(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext16u_i64 case INDEX_op_ext16u_i64: t0 = *tb_ptr++; t1 = tci_read_r16(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext32s_i64 case INDEX_op_ext32s_i64: t0 = *tb_ptr++; t1 = tci_read_r32s(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_ext32u_i64 case INDEX_op_ext32u_i64: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg64(t0, t1); break; #endif #if TCG_TARGET_HAS_bswap16_i64 case INDEX_op_bswap16_i64: TODO(); t0 = *tb_ptr++; t1 = tci_read_r16(&tb_ptr); tci_write_reg64(t0, bswap16(t1)); break; #endif #if TCG_TARGET_HAS_bswap32_i64 case INDEX_op_bswap32_i64: t0 = *tb_ptr++; t1 = tci_read_r32(&tb_ptr); tci_write_reg64(t0, bswap32(t1)); break; #endif #if TCG_TARGET_HAS_bswap64_i64 case INDEX_op_bswap64_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); tci_write_reg64(t0, bswap64(t1)); break; #endif #if TCG_TARGET_HAS_not_i64 case INDEX_op_not_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); tci_write_reg64(t0, ~t1); break; #endif #if TCG_TARGET_HAS_neg_i64 case INDEX_op_neg_i64: t0 = *tb_ptr++; t1 = tci_read_r64(&tb_ptr); tci_write_reg64(t0, -t1); break; #endif #endif #if TARGET_LONG_BITS > TCG_TARGET_REG_BITS case INDEX_op_debug_insn_start: TODO(); break; #else case INDEX_op_debug_insn_start: TODO(); break; #endif case INDEX_op_exit_tb: next_tb = *(uint64_t *)tb_ptr; goto exit; break; case INDEX_op_goto_tb: t0 = tci_read_i32(&tb_ptr); assert(tb_ptr == old_code_ptr + op_size); tb_ptr += (int32_t)t0; continue; case INDEX_op_qemu_ld8u: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp8 = *(uint8_t *)(host_addr + GUEST_BASE); #endif tci_write_reg8(t0, tmp8); break; case INDEX_op_qemu_ld8s: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp8 = *(uint8_t *)(host_addr + GUEST_BASE); #endif tci_write_reg8s(t0, tmp8); break; case INDEX_op_qemu_ld16u: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg16(t0, tmp16); break; case INDEX_op_qemu_ld16s: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg16s(t0, tmp16); break; #if TCG_TARGET_REG_BITS == 64 case INDEX_op_qemu_ld32u: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg32(t0, tmp32); break; case INDEX_op_qemu_ld32s: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg32s(t0, tmp32); break; #endif case INDEX_op_qemu_ld32: t0 = *tb_ptr++; taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg32(t0, tmp32); break; case INDEX_op_qemu_ld64: t0 = *tb_ptr++; #if TCG_TARGET_REG_BITS == 32 t1 = *tb_ptr++; #endif taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU tmp64 = helper_ldq_mmu(env, taddr, tci_read_i(&tb_ptr)); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); tmp64 = tswap64(*(uint64_t *)(host_addr + GUEST_BASE)); #endif tci_write_reg(t0, tmp64); #if TCG_TARGET_REG_BITS == 32 tci_write_reg(t1, tmp64 >> 32); #endif break; case INDEX_op_qemu_st8: t0 = tci_read_r8(&tb_ptr); taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU t2 = tci_read_i(&tb_ptr); helper_stb_mmu(env, taddr, t0, t2); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); *(uint8_t *)(host_addr + GUEST_BASE) = t0; #endif break; case INDEX_op_qemu_st16: t0 = tci_read_r16(&tb_ptr); taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU t2 = tci_read_i(&tb_ptr); helper_stw_mmu(env, taddr, t0, t2); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); *(uint16_t *)(host_addr + GUEST_BASE) = tswap16(t0); #endif break; case INDEX_op_qemu_st32: t0 = tci_read_r32(&tb_ptr); taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU t2 = tci_read_i(&tb_ptr); helper_stl_mmu(env, taddr, t0, t2); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); *(uint32_t *)(host_addr + GUEST_BASE) = tswap32(t0); #endif break; case INDEX_op_qemu_st64: tmp64 = tci_read_r64(&tb_ptr); taddr = tci_read_ulong(&tb_ptr); #ifdef CONFIG_SOFTMMU t2 = tci_read_i(&tb_ptr); helper_stq_mmu(env, taddr, tmp64, t2); #else host_addr = (tcg_target_ulong)taddr; assert(taddr == host_addr); *(uint64_t *)(host_addr + GUEST_BASE) = tswap64(tmp64); #endif break; default: TODO(); break; } assert(tb_ptr == old_code_ptr + op_size); } exit: return next_tb; }
[ "tcg_target_ulong FUNC_0(CPUArchState *env, uint8_t *tb_ptr)\n{", "tcg_target_ulong next_tb = 0;", "tci_reg[TCG_AREG0] = (tcg_target_ulong)env;", "assert(tb_ptr);", "for (;;) {", "#if defined(GETPC)\ntci_tb_ptr = (uintptr_t)tb_ptr;", "#endif\nTCGOpcode opc = tb_ptr[0];", "#if !defined(NDEBUG)\nuint8_t op_size = tb_ptr[1];", "uint8_t *old_code_ptr = tb_ptr;", "#endif\ntcg_target_ulong t0;", "tcg_target_ulong t1;", "tcg_target_ulong t2;", "tcg_target_ulong label;", "TCGCond condition;", "target_ulong taddr;", "#ifndef CONFIG_SOFTMMU\ntcg_target_ulong host_addr;", "#endif\nuint8_t tmp8;", "uint16_t tmp16;", "uint32_t tmp32;", "uint64_t tmp64;", "#if TCG_TARGET_REG_BITS == 32\nuint64_t v64;", "#endif\ntb_ptr += 2;", "switch (opc) {", "case INDEX_op_end:\ncase INDEX_op_nop:\nbreak;", "case INDEX_op_nop1:\ncase INDEX_op_nop2:\ncase INDEX_op_nop3:\ncase INDEX_op_nopn:\ncase INDEX_op_discard:\nTODO();", "break;", "case INDEX_op_set_label:\nTODO();", "break;", "case INDEX_op_call:\nt0 = tci_read_ri(&tb_ptr);", "#if TCG_TARGET_REG_BITS == 32\ntmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),\ntci_read_reg(TCG_REG_R1),\ntci_read_reg(TCG_REG_R2),\ntci_read_reg(TCG_REG_R3),\ntci_read_reg(TCG_REG_R5),\ntci_read_reg(TCG_REG_R6),\ntci_read_reg(TCG_REG_R7),\ntci_read_reg(TCG_REG_R8),\ntci_read_reg(TCG_REG_R9),\ntci_read_reg(TCG_REG_R10));", "tci_write_reg(TCG_REG_R0, tmp64);", "tci_write_reg(TCG_REG_R1, tmp64 >> 32);", "#else\ntmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),\ntci_read_reg(TCG_REG_R1),\ntci_read_reg(TCG_REG_R2),\ntci_read_reg(TCG_REG_R3),\ntci_read_reg(TCG_REG_R5));", "tci_write_reg(TCG_REG_R0, tmp64);", "#endif\nbreak;", "case INDEX_op_br:\nlabel = tci_read_label(&tb_ptr);", "assert(tb_ptr == old_code_ptr + op_size);", "tb_ptr = (uint8_t *)label;", "continue;", "case INDEX_op_setcond_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_r32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "condition = *tb_ptr++;", "tci_write_reg32(t0, tci_compare32(t1, t2, condition));", "break;", "#if TCG_TARGET_REG_BITS == 32\ncase INDEX_op_setcond2_i32:\nt0 = *tb_ptr++;", "tmp64 = tci_read_r64(&tb_ptr);", "v64 = tci_read_ri64(&tb_ptr);", "condition = *tb_ptr++;", "tci_write_reg32(t0, tci_compare64(tmp64, v64, condition));", "break;", "#elif TCG_TARGET_REG_BITS == 64\ncase INDEX_op_setcond_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r64(&tb_ptr);", "t2 = tci_read_ri64(&tb_ptr);", "condition = *tb_ptr++;", "tci_write_reg64(t0, tci_compare64(t1, t2, condition));", "break;", "#endif\ncase INDEX_op_mov_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_r32(&tb_ptr);", "tci_write_reg32(t0, t1);", "break;", "case INDEX_op_movi_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_i32(&tb_ptr);", "tci_write_reg32(t0, t1);", "break;", "case INDEX_op_ld8u_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_r(&tb_ptr);", "t2 = tci_read_s32(&tb_ptr);", "tci_write_reg8(t0, *(uint8_t *)(t1 + t2));", "break;", "case INDEX_op_ld8s_i32:\ncase INDEX_op_ld16u_i32:\nTODO();", "break;", "case INDEX_op_ld16s_i32:\nTODO();", "break;", "case INDEX_op_ld_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_r(&tb_ptr);", "t2 = tci_read_s32(&tb_ptr);", "tci_write_reg32(t0, *(uint32_t *)(t1 + t2));", "break;", "case INDEX_op_st8_i32:\nt0 = tci_read_r8(&tb_ptr);", "t1 = tci_read_r(&tb_ptr);", "t2 = tci_read_s32(&tb_ptr);", "*(uint8_t *)(t1 + t2) = t0;", "break;", "case INDEX_op_st16_i32:\nt0 = tci_read_r16(&tb_ptr);", "t1 = tci_read_r(&tb_ptr);", "t2 = tci_read_s32(&tb_ptr);", "*(uint16_t *)(t1 + t2) = t0;", "break;", "case INDEX_op_st_i32:\nt0 = tci_read_r32(&tb_ptr);", "t1 = tci_read_r(&tb_ptr);", "t2 = tci_read_s32(&tb_ptr);", "*(uint32_t *)(t1 + t2) = t0;", "break;", "case INDEX_op_add_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, t1 + t2);", "break;", "case INDEX_op_sub_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, t1 - t2);", "break;", "case INDEX_op_mul_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, t1 * t2);", "break;", "#if TCG_TARGET_HAS_div_i32\ncase INDEX_op_div_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, (int32_t)t1 / (int32_t)t2);", "break;", "case INDEX_op_divu_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, t1 / t2);", "break;", "case INDEX_op_rem_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, (int32_t)t1 % (int32_t)t2);", "break;", "case INDEX_op_remu_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, t1 % t2);", "break;", "#elif TCG_TARGET_HAS_div2_i32\ncase INDEX_op_div2_i32:\ncase INDEX_op_divu2_i32:\nTODO();", "break;", "#endif\ncase INDEX_op_and_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, t1 & t2);", "break;", "case INDEX_op_or_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, t1 | t2);", "break;", "case INDEX_op_xor_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, t1 ^ t2);", "break;", "case INDEX_op_shl_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, t1 << t2);", "break;", "case INDEX_op_shr_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, t1 >> t2);", "break;", "case INDEX_op_sar_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, ((int32_t)t1 >> t2));", "break;", "#if TCG_TARGET_HAS_rot_i32\ncase INDEX_op_rotl_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, (t1 << t2) | (t1 >> (32 - t2)));", "break;", "case INDEX_op_rotr_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_ri32(&tb_ptr);", "t2 = tci_read_ri32(&tb_ptr);", "tci_write_reg32(t0, (t1 >> t2) | (t1 << (32 - t2)));", "break;", "#endif\n#if TCG_TARGET_HAS_deposit_i32\ncase INDEX_op_deposit_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_r32(&tb_ptr);", "t2 = tci_read_r32(&tb_ptr);", "tmp16 = *tb_ptr++;", "tmp8 = *tb_ptr++;", "tmp32 = (((1 << tmp8) - 1) << tmp16);", "tci_write_reg32(t0, (t1 & ~tmp32) | ((t2 << tmp16) & tmp32));", "break;", "#endif\ncase INDEX_op_brcond_i32:\nt0 = tci_read_r32(&tb_ptr);", "t1 = tci_read_ri32(&tb_ptr);", "condition = *tb_ptr++;", "label = tci_read_label(&tb_ptr);", "if (tci_compare32(t0, t1, condition)) {", "assert(tb_ptr == old_code_ptr + op_size);", "tb_ptr = (uint8_t *)label;", "continue;", "}", "break;", "#if TCG_TARGET_REG_BITS == 32\ncase INDEX_op_add2_i32:\nt0 = *tb_ptr++;", "t1 = *tb_ptr++;", "tmp64 = tci_read_r64(&tb_ptr);", "tmp64 += tci_read_r64(&tb_ptr);", "tci_write_reg64(t1, t0, tmp64);", "break;", "case INDEX_op_sub2_i32:\nt0 = *tb_ptr++;", "t1 = *tb_ptr++;", "tmp64 = tci_read_r64(&tb_ptr);", "tmp64 -= tci_read_r64(&tb_ptr);", "tci_write_reg64(t1, t0, tmp64);", "break;", "case INDEX_op_brcond2_i32:\ntmp64 = tci_read_r64(&tb_ptr);", "v64 = tci_read_ri64(&tb_ptr);", "condition = *tb_ptr++;", "label = tci_read_label(&tb_ptr);", "if (tci_compare64(tmp64, v64, condition)) {", "assert(tb_ptr == old_code_ptr + op_size);", "tb_ptr = (uint8_t *)label;", "continue;", "}", "break;", "case INDEX_op_mulu2_i32:\nt0 = *tb_ptr++;", "t1 = *tb_ptr++;", "t2 = tci_read_r32(&tb_ptr);", "tmp64 = tci_read_r32(&tb_ptr);", "tci_write_reg64(t1, t0, t2 * tmp64);", "break;", "#endif\n#if TCG_TARGET_HAS_ext8s_i32\ncase INDEX_op_ext8s_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_r8s(&tb_ptr);", "tci_write_reg32(t0, t1);", "break;", "#endif\n#if TCG_TARGET_HAS_ext16s_i32\ncase INDEX_op_ext16s_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_r16s(&tb_ptr);", "tci_write_reg32(t0, t1);", "break;", "#endif\n#if TCG_TARGET_HAS_ext8u_i32\ncase INDEX_op_ext8u_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_r8(&tb_ptr);", "tci_write_reg32(t0, t1);", "break;", "#endif\n#if TCG_TARGET_HAS_ext16u_i32\ncase INDEX_op_ext16u_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_r16(&tb_ptr);", "tci_write_reg32(t0, t1);", "break;", "#endif\n#if TCG_TARGET_HAS_bswap16_i32\ncase INDEX_op_bswap16_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_r16(&tb_ptr);", "tci_write_reg32(t0, bswap16(t1));", "break;", "#endif\n#if TCG_TARGET_HAS_bswap32_i32\ncase INDEX_op_bswap32_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_r32(&tb_ptr);", "tci_write_reg32(t0, bswap32(t1));", "break;", "#endif\n#if TCG_TARGET_HAS_not_i32\ncase INDEX_op_not_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_r32(&tb_ptr);", "tci_write_reg32(t0, ~t1);", "break;", "#endif\n#if TCG_TARGET_HAS_neg_i32\ncase INDEX_op_neg_i32:\nt0 = *tb_ptr++;", "t1 = tci_read_r32(&tb_ptr);", "tci_write_reg32(t0, -t1);", "break;", "#endif\n#if TCG_TARGET_REG_BITS == 64\ncase INDEX_op_mov_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r64(&tb_ptr);", "tci_write_reg64(t0, t1);", "break;", "case INDEX_op_movi_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_i64(&tb_ptr);", "tci_write_reg64(t0, t1);", "break;", "case INDEX_op_ld8u_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r(&tb_ptr);", "t2 = tci_read_s32(&tb_ptr);", "tci_write_reg8(t0, *(uint8_t *)(t1 + t2));", "break;", "case INDEX_op_ld8s_i64:\ncase INDEX_op_ld16u_i64:\ncase INDEX_op_ld16s_i64:\nTODO();", "break;", "case INDEX_op_ld32u_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r(&tb_ptr);", "t2 = tci_read_s32(&tb_ptr);", "tci_write_reg32(t0, *(uint32_t *)(t1 + t2));", "break;", "case INDEX_op_ld32s_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r(&tb_ptr);", "t2 = tci_read_s32(&tb_ptr);", "tci_write_reg32s(t0, *(int32_t *)(t1 + t2));", "break;", "case INDEX_op_ld_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r(&tb_ptr);", "t2 = tci_read_s32(&tb_ptr);", "tci_write_reg64(t0, *(uint64_t *)(t1 + t2));", "break;", "case INDEX_op_st8_i64:\nt0 = tci_read_r8(&tb_ptr);", "t1 = tci_read_r(&tb_ptr);", "t2 = tci_read_s32(&tb_ptr);", "*(uint8_t *)(t1 + t2) = t0;", "break;", "case INDEX_op_st16_i64:\nt0 = tci_read_r16(&tb_ptr);", "t1 = tci_read_r(&tb_ptr);", "t2 = tci_read_s32(&tb_ptr);", "*(uint16_t *)(t1 + t2) = t0;", "break;", "case INDEX_op_st32_i64:\nt0 = tci_read_r32(&tb_ptr);", "t1 = tci_read_r(&tb_ptr);", "t2 = tci_read_s32(&tb_ptr);", "*(uint32_t *)(t1 + t2) = t0;", "break;", "case INDEX_op_st_i64:\nt0 = tci_read_r64(&tb_ptr);", "t1 = tci_read_r(&tb_ptr);", "t2 = tci_read_s32(&tb_ptr);", "*(uint64_t *)(t1 + t2) = t0;", "break;", "case INDEX_op_add_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_ri64(&tb_ptr);", "t2 = tci_read_ri64(&tb_ptr);", "tci_write_reg64(t0, t1 + t2);", "break;", "case INDEX_op_sub_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_ri64(&tb_ptr);", "t2 = tci_read_ri64(&tb_ptr);", "tci_write_reg64(t0, t1 - t2);", "break;", "case INDEX_op_mul_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_ri64(&tb_ptr);", "t2 = tci_read_ri64(&tb_ptr);", "tci_write_reg64(t0, t1 * t2);", "break;", "#if TCG_TARGET_HAS_div_i64\ncase INDEX_op_div_i64:\ncase INDEX_op_divu_i64:\ncase INDEX_op_rem_i64:\ncase INDEX_op_remu_i64:\nTODO();", "break;", "#elif TCG_TARGET_HAS_div2_i64\ncase INDEX_op_div2_i64:\ncase INDEX_op_divu2_i64:\nTODO();", "break;", "#endif\ncase INDEX_op_and_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_ri64(&tb_ptr);", "t2 = tci_read_ri64(&tb_ptr);", "tci_write_reg64(t0, t1 & t2);", "break;", "case INDEX_op_or_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_ri64(&tb_ptr);", "t2 = tci_read_ri64(&tb_ptr);", "tci_write_reg64(t0, t1 | t2);", "break;", "case INDEX_op_xor_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_ri64(&tb_ptr);", "t2 = tci_read_ri64(&tb_ptr);", "tci_write_reg64(t0, t1 ^ t2);", "break;", "case INDEX_op_shl_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_ri64(&tb_ptr);", "t2 = tci_read_ri64(&tb_ptr);", "tci_write_reg64(t0, t1 << t2);", "break;", "case INDEX_op_shr_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_ri64(&tb_ptr);", "t2 = tci_read_ri64(&tb_ptr);", "tci_write_reg64(t0, t1 >> t2);", "break;", "case INDEX_op_sar_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_ri64(&tb_ptr);", "t2 = tci_read_ri64(&tb_ptr);", "tci_write_reg64(t0, ((int64_t)t1 >> t2));", "break;", "#if TCG_TARGET_HAS_rot_i64\ncase INDEX_op_rotl_i64:\ncase INDEX_op_rotr_i64:\nTODO();", "break;", "#endif\n#if TCG_TARGET_HAS_deposit_i64\ncase INDEX_op_deposit_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r64(&tb_ptr);", "t2 = tci_read_r64(&tb_ptr);", "tmp16 = *tb_ptr++;", "tmp8 = *tb_ptr++;", "tmp64 = (((1ULL << tmp8) - 1) << tmp16);", "tci_write_reg64(t0, (t1 & ~tmp64) | ((t2 << tmp16) & tmp64));", "break;", "#endif\ncase INDEX_op_brcond_i64:\nt0 = tci_read_r64(&tb_ptr);", "t1 = tci_read_ri64(&tb_ptr);", "condition = *tb_ptr++;", "label = tci_read_label(&tb_ptr);", "if (tci_compare64(t0, t1, condition)) {", "assert(tb_ptr == old_code_ptr + op_size);", "tb_ptr = (uint8_t *)label;", "continue;", "}", "break;", "#if TCG_TARGET_HAS_ext8u_i64\ncase INDEX_op_ext8u_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r8(&tb_ptr);", "tci_write_reg64(t0, t1);", "break;", "#endif\n#if TCG_TARGET_HAS_ext8s_i64\ncase INDEX_op_ext8s_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r8s(&tb_ptr);", "tci_write_reg64(t0, t1);", "break;", "#endif\n#if TCG_TARGET_HAS_ext16s_i64\ncase INDEX_op_ext16s_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r16s(&tb_ptr);", "tci_write_reg64(t0, t1);", "break;", "#endif\n#if TCG_TARGET_HAS_ext16u_i64\ncase INDEX_op_ext16u_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r16(&tb_ptr);", "tci_write_reg64(t0, t1);", "break;", "#endif\n#if TCG_TARGET_HAS_ext32s_i64\ncase INDEX_op_ext32s_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r32s(&tb_ptr);", "tci_write_reg64(t0, t1);", "break;", "#endif\n#if TCG_TARGET_HAS_ext32u_i64\ncase INDEX_op_ext32u_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r32(&tb_ptr);", "tci_write_reg64(t0, t1);", "break;", "#endif\n#if TCG_TARGET_HAS_bswap16_i64\ncase INDEX_op_bswap16_i64:\nTODO();", "t0 = *tb_ptr++;", "t1 = tci_read_r16(&tb_ptr);", "tci_write_reg64(t0, bswap16(t1));", "break;", "#endif\n#if TCG_TARGET_HAS_bswap32_i64\ncase INDEX_op_bswap32_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r32(&tb_ptr);", "tci_write_reg64(t0, bswap32(t1));", "break;", "#endif\n#if TCG_TARGET_HAS_bswap64_i64\ncase INDEX_op_bswap64_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r64(&tb_ptr);", "tci_write_reg64(t0, bswap64(t1));", "break;", "#endif\n#if TCG_TARGET_HAS_not_i64\ncase INDEX_op_not_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r64(&tb_ptr);", "tci_write_reg64(t0, ~t1);", "break;", "#endif\n#if TCG_TARGET_HAS_neg_i64\ncase INDEX_op_neg_i64:\nt0 = *tb_ptr++;", "t1 = tci_read_r64(&tb_ptr);", "tci_write_reg64(t0, -t1);", "break;", "#endif\n#endif\n#if TARGET_LONG_BITS > TCG_TARGET_REG_BITS\ncase INDEX_op_debug_insn_start:\nTODO();", "break;", "#else\ncase INDEX_op_debug_insn_start:\nTODO();", "break;", "#endif\ncase INDEX_op_exit_tb:\nnext_tb = *(uint64_t *)tb_ptr;", "goto exit;", "break;", "case INDEX_op_goto_tb:\nt0 = tci_read_i32(&tb_ptr);", "assert(tb_ptr == old_code_ptr + op_size);", "tb_ptr += (int32_t)t0;", "continue;", "case INDEX_op_qemu_ld8u:\nt0 = *tb_ptr++;", "taddr = tci_read_ulong(&tb_ptr);", "#ifdef CONFIG_SOFTMMU\ntmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr));", "#else\nhost_addr = (tcg_target_ulong)taddr;", "assert(taddr == host_addr);", "tmp8 = *(uint8_t *)(host_addr + GUEST_BASE);", "#endif\ntci_write_reg8(t0, tmp8);", "break;", "case INDEX_op_qemu_ld8s:\nt0 = *tb_ptr++;", "taddr = tci_read_ulong(&tb_ptr);", "#ifdef CONFIG_SOFTMMU\ntmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr));", "#else\nhost_addr = (tcg_target_ulong)taddr;", "assert(taddr == host_addr);", "tmp8 = *(uint8_t *)(host_addr + GUEST_BASE);", "#endif\ntci_write_reg8s(t0, tmp8);", "break;", "case INDEX_op_qemu_ld16u:\nt0 = *tb_ptr++;", "taddr = tci_read_ulong(&tb_ptr);", "#ifdef CONFIG_SOFTMMU\ntmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr));", "#else\nhost_addr = (tcg_target_ulong)taddr;", "assert(taddr == host_addr);", "tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE));", "#endif\ntci_write_reg16(t0, tmp16);", "break;", "case INDEX_op_qemu_ld16s:\nt0 = *tb_ptr++;", "taddr = tci_read_ulong(&tb_ptr);", "#ifdef CONFIG_SOFTMMU\ntmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr));", "#else\nhost_addr = (tcg_target_ulong)taddr;", "assert(taddr == host_addr);", "tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE));", "#endif\ntci_write_reg16s(t0, tmp16);", "break;", "#if TCG_TARGET_REG_BITS == 64\ncase INDEX_op_qemu_ld32u:\nt0 = *tb_ptr++;", "taddr = tci_read_ulong(&tb_ptr);", "#ifdef CONFIG_SOFTMMU\ntmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));", "#else\nhost_addr = (tcg_target_ulong)taddr;", "assert(taddr == host_addr);", "tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));", "#endif\ntci_write_reg32(t0, tmp32);", "break;", "case INDEX_op_qemu_ld32s:\nt0 = *tb_ptr++;", "taddr = tci_read_ulong(&tb_ptr);", "#ifdef CONFIG_SOFTMMU\ntmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));", "#else\nhost_addr = (tcg_target_ulong)taddr;", "assert(taddr == host_addr);", "tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));", "#endif\ntci_write_reg32s(t0, tmp32);", "break;", "#endif\ncase INDEX_op_qemu_ld32:\nt0 = *tb_ptr++;", "taddr = tci_read_ulong(&tb_ptr);", "#ifdef CONFIG_SOFTMMU\ntmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));", "#else\nhost_addr = (tcg_target_ulong)taddr;", "assert(taddr == host_addr);", "tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));", "#endif\ntci_write_reg32(t0, tmp32);", "break;", "case INDEX_op_qemu_ld64:\nt0 = *tb_ptr++;", "#if TCG_TARGET_REG_BITS == 32\nt1 = *tb_ptr++;", "#endif\ntaddr = tci_read_ulong(&tb_ptr);", "#ifdef CONFIG_SOFTMMU\ntmp64 = helper_ldq_mmu(env, taddr, tci_read_i(&tb_ptr));", "#else\nhost_addr = (tcg_target_ulong)taddr;", "assert(taddr == host_addr);", "tmp64 = tswap64(*(uint64_t *)(host_addr + GUEST_BASE));", "#endif\ntci_write_reg(t0, tmp64);", "#if TCG_TARGET_REG_BITS == 32\ntci_write_reg(t1, tmp64 >> 32);", "#endif\nbreak;", "case INDEX_op_qemu_st8:\nt0 = tci_read_r8(&tb_ptr);", "taddr = tci_read_ulong(&tb_ptr);", "#ifdef CONFIG_SOFTMMU\nt2 = tci_read_i(&tb_ptr);", "helper_stb_mmu(env, taddr, t0, t2);", "#else\nhost_addr = (tcg_target_ulong)taddr;", "assert(taddr == host_addr);", "*(uint8_t *)(host_addr + GUEST_BASE) = t0;", "#endif\nbreak;", "case INDEX_op_qemu_st16:\nt0 = tci_read_r16(&tb_ptr);", "taddr = tci_read_ulong(&tb_ptr);", "#ifdef CONFIG_SOFTMMU\nt2 = tci_read_i(&tb_ptr);", "helper_stw_mmu(env, taddr, t0, t2);", "#else\nhost_addr = (tcg_target_ulong)taddr;", "assert(taddr == host_addr);", "*(uint16_t *)(host_addr + GUEST_BASE) = tswap16(t0);", "#endif\nbreak;", "case INDEX_op_qemu_st32:\nt0 = tci_read_r32(&tb_ptr);", "taddr = tci_read_ulong(&tb_ptr);", "#ifdef CONFIG_SOFTMMU\nt2 = tci_read_i(&tb_ptr);", "helper_stl_mmu(env, taddr, t0, t2);", "#else\nhost_addr = (tcg_target_ulong)taddr;", "assert(taddr == host_addr);", "*(uint32_t *)(host_addr + GUEST_BASE) = tswap32(t0);", "#endif\nbreak;", "case INDEX_op_qemu_st64:\ntmp64 = tci_read_r64(&tb_ptr);", "taddr = tci_read_ulong(&tb_ptr);", "#ifdef CONFIG_SOFTMMU\nt2 = tci_read_i(&tb_ptr);", "helper_stq_mmu(env, taddr, tmp64, t2);", "#else\nhost_addr = (tcg_target_ulong)taddr;", "assert(taddr == host_addr);", "*(uint64_t *)(host_addr + GUEST_BASE) = tswap64(tmp64);", "#endif\nbreak;", "default:\nTODO();", "break;", "}", "assert(tb_ptr == old_code_ptr + op_size);", "}", "exit:\nreturn next_tb;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 21, 23 ], [ 25, 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63, 69 ], [ 73 ], [ 75, 77, 79 ], [ 81, 83, 85, 87, 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101, 103 ], [ 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125 ], [ 127 ], [ 129 ], [ 131, 133, 135, 137, 139, 141 ], [ 143 ], [ 145, 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175, 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205, 207, 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 225 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245, 247, 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259, 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283, 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295, 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 313, 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325, 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337, 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349, 351, 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363, 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375, 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387, 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399, 401, 403, 405 ], [ 407 ], [ 409, 411, 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423, 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435, 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 453, 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465, 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477, 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489, 491, 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503, 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515, 517, 519, 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537, 539, 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561, 563, 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577, 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 591, 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613, 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627, 629, 631, 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641, 643, 645, 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655, 657, 659, 661 ], [ 663 ], [ 665 ], [ 667 ], [ 669, 671, 673, 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683, 685, 687, 689 ], [ 691 ], [ 693 ], [ 695 ], [ 697, 699, 701, 703 ], [ 705 ], [ 707 ], [ 709 ], [ 711, 713, 715, 717 ], [ 719 ], [ 721 ], [ 723 ], [ 725, 727, 729, 731 ], [ 733 ], [ 735 ], [ 737 ], [ 739, 741, 743, 745 ], [ 747 ], [ 749 ], [ 751 ], [ 753, 755 ], [ 757 ], [ 759 ], [ 761 ], [ 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 ], [ 867 ], [ 869 ], [ 871 ], [ 873 ], [ 881, 883 ], [ 885 ], [ 887 ], [ 889 ], [ 891 ], [ 893, 895 ], [ 897 ], [ 899 ], [ 901 ], [ 903 ], [ 905, 907 ], [ 909 ], [ 911 ], [ 913 ], [ 915 ], [ 917, 919, 921, 923, 925, 927 ], [ 929 ], [ 931, 933, 935, 937 ], [ 939 ], [ 941, 943, 945 ], [ 947 ], [ 949 ], [ 951 ], [ 953 ], [ 955, 957 ], [ 959 ], [ 961 ], [ 963 ], [ 965 ], [ 967, 969 ], [ 971 ], [ 973 ], [ 975 ], [ 977 ], [ 985, 987 ], [ 989 ], [ 991 ], [ 993 ], [ 995 ], [ 997, 999 ], [ 1001 ], [ 1003 ], [ 1005 ], [ 1007 ], [ 1009, 1011 ], [ 1013 ], [ 1015 ], [ 1017 ], [ 1019 ], [ 1021, 1023, 1025, 1027 ], [ 1029 ], [ 1031, 1033, 1035, 1037 ], [ 1039 ], [ 1041 ], [ 1043 ], [ 1045 ], [ 1047 ], [ 1049 ], [ 1051 ], [ 1053, 1055, 1057 ], [ 1059 ], [ 1061 ], [ 1063 ], [ 1065 ], [ 1067 ], [ 1069 ], [ 1071 ], [ 1073 ], [ 1075 ], [ 1077, 1079, 1081 ], [ 1083 ], [ 1085 ], [ 1087 ], [ 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, 1209 ], [ 1211 ], [ 1213 ], [ 1215 ], [ 1217, 1219, 1221, 1223 ], [ 1225 ], [ 1227 ], [ 1229 ], [ 1231, 1233, 1241, 1243, 1245 ], [ 1247 ], [ 1249, 1251, 1253 ], [ 1255 ], [ 1257, 1259, 1261 ], [ 1263 ], [ 1265 ], [ 1267, 1269 ], [ 1271 ], [ 1273 ], [ 1275 ], [ 1277, 1279 ], [ 1281 ], [ 1283, 1285 ], [ 1287, 1289 ], [ 1291 ], [ 1293 ], [ 1295, 1297 ], [ 1299 ], [ 1301, 1303 ], [ 1305 ], [ 1307, 1309 ], [ 1311, 1313 ], [ 1315 ], [ 1317 ], [ 1319, 1321 ], [ 1323 ], [ 1325, 1327 ], [ 1329 ], [ 1331, 1333 ], [ 1335, 1337 ], [ 1339 ], [ 1341 ], [ 1343, 1345 ], [ 1347 ], [ 1349, 1351 ], [ 1353 ], [ 1355, 1357 ], [ 1359, 1361 ], [ 1363 ], [ 1365 ], [ 1367, 1369 ], [ 1371 ], [ 1373, 1375, 1377 ], [ 1379 ], [ 1381, 1383 ], [ 1385, 1387 ], [ 1389 ], [ 1391 ], [ 1393, 1395 ], [ 1397 ], [ 1399, 1401 ], [ 1403 ], [ 1405, 1407 ], [ 1409, 1411 ], [ 1413 ], [ 1415 ], [ 1417, 1419 ], [ 1421 ], [ 1423, 1425, 1427 ], [ 1429 ], [ 1431, 1433 ], [ 1435, 1437 ], [ 1439 ], [ 1441 ], [ 1443, 1445 ], [ 1447 ], [ 1449, 1451 ], [ 1453, 1455 ], [ 1457, 1459 ], [ 1461, 1463 ], [ 1465, 1467 ], [ 1469 ], [ 1471 ], [ 1473, 1475 ], [ 1477, 1479 ], [ 1481, 1483 ], [ 1485, 1487 ], [ 1489 ], [ 1491, 1493 ], [ 1495 ], [ 1497, 1499 ], [ 1501 ], [ 1503 ], [ 1505, 1507 ], [ 1509, 1511 ], [ 1513 ], [ 1515, 1517 ], [ 1519 ], [ 1521, 1523 ], [ 1525 ], [ 1527 ], [ 1529, 1531 ], [ 1533, 1535 ], [ 1537 ], [ 1539, 1541 ], [ 1543 ], [ 1545, 1547 ], [ 1549 ], [ 1551 ], [ 1553, 1555 ], [ 1557, 1559 ], [ 1561 ], [ 1563, 1565 ], [ 1567 ], [ 1569, 1571 ], [ 1573 ], [ 1575 ], [ 1577, 1579 ], [ 1581, 1583 ], [ 1585 ], [ 1587 ], [ 1589 ], [ 1591 ], [ 1593, 1595 ], [ 1597 ] ]
21,624
static void do_commit(void) { int i; for (i = 0; i < MAX_DISKS; i++) { if (bs_table[i]) bdrv_commit(bs_table[i]); } }
false
qemu
7e2515e87c41e2e658aaed466e11cbdf1ea8bcb1
static void do_commit(void) { int i; for (i = 0; i < MAX_DISKS; i++) { if (bs_table[i]) bdrv_commit(bs_table[i]); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { int VAR_0; for (VAR_0 = 0; VAR_0 < MAX_DISKS; VAR_0++) { if (bs_table[VAR_0]) bdrv_commit(bs_table[VAR_0]); } }
[ "static void FUNC_0(void)\n{", "int VAR_0;", "for (VAR_0 = 0; VAR_0 < MAX_DISKS; VAR_0++) {", "if (bs_table[VAR_0])\nbdrv_commit(bs_table[VAR_0]);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ] ]
21,625
static int v9fs_do_mknod(V9fsState *s, V9fsString *path, mode_t mode, dev_t dev) { return s->ops->mknod(&s->ctx, path->data, mode, dev); }
false
qemu
1c29331248d82e5a9caaf7974756a9d8bd5cd1e5
static int v9fs_do_mknod(V9fsState *s, V9fsString *path, mode_t mode, dev_t dev) { return s->ops->mknod(&s->ctx, path->data, mode, dev); }
{ "code": [], "line_no": [] }
static int FUNC_0(V9fsState *VAR_0, V9fsString *VAR_1, mode_t VAR_2, dev_t VAR_3) { return VAR_0->ops->mknod(&VAR_0->ctx, VAR_1->data, VAR_2, VAR_3); }
[ "static int FUNC_0(V9fsState *VAR_0, V9fsString *VAR_1, mode_t VAR_2, dev_t VAR_3)\n{", "return VAR_0->ops->mknod(&VAR_0->ctx, VAR_1->data, VAR_2, VAR_3);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
21,626
static uint64_t g364fb_ctrl_read(void *opaque, target_phys_addr_t addr, unsigned int size) { G364State *s = opaque; uint32_t val; if (addr >= REG_CURS_PAT && addr < REG_CURS_PAT + 0x1000) { /* cursor pattern */ int idx = (addr - REG_CURS_PAT) >> 3; val = s->cursor[idx]; } else if (addr >= REG_CURS_PAL && addr < REG_CURS_PAL + 0x18) { /* cursor palette */ int idx = (addr - REG_CURS_PAL) >> 3; val = ((uint32_t)s->cursor_palette[idx][0] << 16); val |= ((uint32_t)s->cursor_palette[idx][1] << 8); val |= ((uint32_t)s->cursor_palette[idx][2] << 0); } else { switch (addr) { case REG_DISPLAY: val = s->width / 4; break; case REG_VDISPLAY: val = s->height * 2; break; case REG_CTLA: val = s->ctla; break; default: { error_report("g364: invalid read at [" TARGET_FMT_plx "]", addr); val = 0; break; } } } trace_g364fb_read(addr, val); return val; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t g364fb_ctrl_read(void *opaque, target_phys_addr_t addr, unsigned int size) { G364State *s = opaque; uint32_t val; if (addr >= REG_CURS_PAT && addr < REG_CURS_PAT + 0x1000) { int idx = (addr - REG_CURS_PAT) >> 3; val = s->cursor[idx]; } else if (addr >= REG_CURS_PAL && addr < REG_CURS_PAL + 0x18) { int idx = (addr - REG_CURS_PAL) >> 3; val = ((uint32_t)s->cursor_palette[idx][0] << 16); val |= ((uint32_t)s->cursor_palette[idx][1] << 8); val |= ((uint32_t)s->cursor_palette[idx][2] << 0); } else { switch (addr) { case REG_DISPLAY: val = s->width / 4; break; case REG_VDISPLAY: val = s->height * 2; break; case REG_CTLA: val = s->ctla; break; default: { error_report("g364: invalid read at [" TARGET_FMT_plx "]", addr); val = 0; break; } } } trace_g364fb_read(addr, val); return val; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned int size) { G364State *s = opaque; uint32_t val; if (addr >= REG_CURS_PAT && addr < REG_CURS_PAT + 0x1000) { int VAR_1 = (addr - REG_CURS_PAT) >> 3; val = s->cursor[VAR_1]; } else if (addr >= REG_CURS_PAL && addr < REG_CURS_PAL + 0x18) { int VAR_1 = (addr - REG_CURS_PAL) >> 3; val = ((uint32_t)s->cursor_palette[VAR_1][0] << 16); val |= ((uint32_t)s->cursor_palette[VAR_1][1] << 8); val |= ((uint32_t)s->cursor_palette[VAR_1][2] << 0); } else { switch (addr) { case REG_DISPLAY: val = s->width / 4; break; case REG_VDISPLAY: val = s->height * 2; break; case REG_CTLA: val = s->ctla; break; default: { error_report("g364: invalid read at [" TARGET_FMT_plx "]", addr); val = 0; break; } } } trace_g364fb_read(addr, val); return val; }
[ "static uint64_t FUNC_0(void *opaque,\ntarget_phys_addr_t addr,\nunsigned int size)\n{", "G364State *s = opaque;", "uint32_t val;", "if (addr >= REG_CURS_PAT && addr < REG_CURS_PAT + 0x1000) {", "int VAR_1 = (addr - REG_CURS_PAT) >> 3;", "val = s->cursor[VAR_1];", "} else if (addr >= REG_CURS_PAL && addr < REG_CURS_PAL + 0x18) {", "int VAR_1 = (addr - REG_CURS_PAL) >> 3;", "val = ((uint32_t)s->cursor_palette[VAR_1][0] << 16);", "val |= ((uint32_t)s->cursor_palette[VAR_1][1] << 8);", "val |= ((uint32_t)s->cursor_palette[VAR_1][2] << 0);", "} else {", "switch (addr) {", "case REG_DISPLAY:\nval = s->width / 4;", "break;", "case REG_VDISPLAY:\nval = s->height * 2;", "break;", "case REG_CTLA:\nval = s->ctla;", "break;", "default:\n{", "error_report(\"g364: invalid read at [\" TARGET_FMT_plx \"]\",\naddr);", "val = 0;", "break;", "}", "}", "}", "trace_g364fb_read(addr, val);", "return val;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83 ] ]
21,628
static void vncws_send_handshake_response(VncState *vs, const char* key) { char combined_key[WS_CLIENT_KEY_LEN + WS_GUID_LEN + 1]; unsigned char hash[SHA1_DIGEST_LEN]; size_t hash_size = sizeof(hash); char *accept = NULL, *response = NULL; gnutls_datum_t in; int ret; g_strlcpy(combined_key, key, WS_CLIENT_KEY_LEN + 1); g_strlcat(combined_key, WS_GUID, WS_CLIENT_KEY_LEN + WS_GUID_LEN + 1); /* hash and encode it */ in.data = (void *)combined_key; in.size = WS_CLIENT_KEY_LEN + WS_GUID_LEN; ret = gnutls_fingerprint(GNUTLS_DIG_SHA1, &in, hash, &hash_size); if (ret == GNUTLS_E_SUCCESS && hash_size <= SHA1_DIGEST_LEN) { accept = g_base64_encode(hash, hash_size); } if (accept == NULL) { VNC_DEBUG("Hashing Websocket combined key failed\n"); vnc_client_error(vs); return; } response = g_strdup_printf(WS_HANDSHAKE, accept); vnc_client_write_buf(vs, (const uint8_t *)response, strlen(response)); g_free(accept); g_free(response); vs->encode_ws = 1; vnc_init_state(vs); }
false
qemu
8e9b0d24fb986d4241ae3b77752eca5dab4cb486
static void vncws_send_handshake_response(VncState *vs, const char* key) { char combined_key[WS_CLIENT_KEY_LEN + WS_GUID_LEN + 1]; unsigned char hash[SHA1_DIGEST_LEN]; size_t hash_size = sizeof(hash); char *accept = NULL, *response = NULL; gnutls_datum_t in; int ret; g_strlcpy(combined_key, key, WS_CLIENT_KEY_LEN + 1); g_strlcat(combined_key, WS_GUID, WS_CLIENT_KEY_LEN + WS_GUID_LEN + 1); in.data = (void *)combined_key; in.size = WS_CLIENT_KEY_LEN + WS_GUID_LEN; ret = gnutls_fingerprint(GNUTLS_DIG_SHA1, &in, hash, &hash_size); if (ret == GNUTLS_E_SUCCESS && hash_size <= SHA1_DIGEST_LEN) { accept = g_base64_encode(hash, hash_size); } if (accept == NULL) { VNC_DEBUG("Hashing Websocket combined key failed\n"); vnc_client_error(vs); return; } response = g_strdup_printf(WS_HANDSHAKE, accept); vnc_client_write_buf(vs, (const uint8_t *)response, strlen(response)); g_free(accept); g_free(response); vs->encode_ws = 1; vnc_init_state(vs); }
{ "code": [], "line_no": [] }
static void FUNC_0(VncState *VAR_0, const char* VAR_1) { char VAR_2[WS_CLIENT_KEY_LEN + WS_GUID_LEN + 1]; unsigned char VAR_3[SHA1_DIGEST_LEN]; size_t hash_size = sizeof(VAR_3); char *VAR_4 = NULL, *VAR_5 = NULL; gnutls_datum_t in; int VAR_6; g_strlcpy(VAR_2, VAR_1, WS_CLIENT_KEY_LEN + 1); g_strlcat(VAR_2, WS_GUID, WS_CLIENT_KEY_LEN + WS_GUID_LEN + 1); in.data = (void *)VAR_2; in.size = WS_CLIENT_KEY_LEN + WS_GUID_LEN; VAR_6 = gnutls_fingerprint(GNUTLS_DIG_SHA1, &in, VAR_3, &hash_size); if (VAR_6 == GNUTLS_E_SUCCESS && hash_size <= SHA1_DIGEST_LEN) { VAR_4 = g_base64_encode(VAR_3, hash_size); } if (VAR_4 == NULL) { VNC_DEBUG("Hashing Websocket combined VAR_1 failed\n"); vnc_client_error(VAR_0); return; } VAR_5 = g_strdup_printf(WS_HANDSHAKE, VAR_4); vnc_client_write_buf(VAR_0, (const uint8_t *)VAR_5, strlen(VAR_5)); g_free(VAR_4); g_free(VAR_5); VAR_0->encode_ws = 1; vnc_init_state(VAR_0); }
[ "static void FUNC_0(VncState *VAR_0, const char* VAR_1)\n{", "char VAR_2[WS_CLIENT_KEY_LEN + WS_GUID_LEN + 1];", "unsigned char VAR_3[SHA1_DIGEST_LEN];", "size_t hash_size = sizeof(VAR_3);", "char *VAR_4 = NULL, *VAR_5 = NULL;", "gnutls_datum_t in;", "int VAR_6;", "g_strlcpy(VAR_2, VAR_1, WS_CLIENT_KEY_LEN + 1);", "g_strlcat(VAR_2, WS_GUID, WS_CLIENT_KEY_LEN + WS_GUID_LEN + 1);", "in.data = (void *)VAR_2;", "in.size = WS_CLIENT_KEY_LEN + WS_GUID_LEN;", "VAR_6 = gnutls_fingerprint(GNUTLS_DIG_SHA1, &in, VAR_3, &hash_size);", "if (VAR_6 == GNUTLS_E_SUCCESS && hash_size <= SHA1_DIGEST_LEN) {", "VAR_4 = g_base64_encode(VAR_3, hash_size);", "}", "if (VAR_4 == NULL) {", "VNC_DEBUG(\"Hashing Websocket combined VAR_1 failed\\n\");", "vnc_client_error(VAR_0);", "return;", "}", "VAR_5 = g_strdup_printf(WS_HANDSHAKE, VAR_4);", "vnc_client_write_buf(VAR_0, (const uint8_t *)VAR_5, strlen(VAR_5));", "g_free(VAR_4);", "g_free(VAR_5);", "VAR_0->encode_ws = 1;", "vnc_init_state(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ] ]
21,629
av_cold int ff_ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs) { int j; fs->plane_count = f->plane_count; fs->transparency = f->transparency; for (j = 0; j < f->plane_count; j++) { PlaneContext *const p = &fs->plane[j]; if (fs->ac) { if (!p->state) p->state = av_malloc_array(p->context_count, CONTEXT_SIZE * sizeof(uint8_t)); if (!p->state) return AVERROR(ENOMEM); } else { if (!p->vlc_state) p->vlc_state = av_malloc_array(p->context_count, sizeof(VlcState)); if (!p->vlc_state) return AVERROR(ENOMEM); } } if (fs->ac > 1) { //FIXME only redo if state_transition changed for (j = 1; j < 256; j++) { fs->c. one_state[ j] = f->state_transition[j]; fs->c.zero_state[256 - j] = 256 - fs->c.one_state[j]; } } return 0; }
false
FFmpeg
a878dfa4f57d068eb69fb6614f7a4a20f769ee7b
av_cold int ff_ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs) { int j; fs->plane_count = f->plane_count; fs->transparency = f->transparency; for (j = 0; j < f->plane_count; j++) { PlaneContext *const p = &fs->plane[j]; if (fs->ac) { if (!p->state) p->state = av_malloc_array(p->context_count, CONTEXT_SIZE * sizeof(uint8_t)); if (!p->state) return AVERROR(ENOMEM); } else { if (!p->vlc_state) p->vlc_state = av_malloc_array(p->context_count, sizeof(VlcState)); if (!p->vlc_state) return AVERROR(ENOMEM); } } if (fs->ac > 1) { for (j = 1; j < 256; j++) { fs->c. one_state[ j] = f->state_transition[j]; fs->c.zero_state[256 - j] = 256 - fs->c.one_state[j]; } } return 0; }
{ "code": [], "line_no": [] }
av_cold int FUNC_0(FFV1Context *f, FFV1Context *fs) { int VAR_0; fs->plane_count = f->plane_count; fs->transparency = f->transparency; for (VAR_0 = 0; VAR_0 < f->plane_count; VAR_0++) { PlaneContext *const p = &fs->plane[VAR_0]; if (fs->ac) { if (!p->state) p->state = av_malloc_array(p->context_count, CONTEXT_SIZE * sizeof(uint8_t)); if (!p->state) return AVERROR(ENOMEM); } else { if (!p->vlc_state) p->vlc_state = av_malloc_array(p->context_count, sizeof(VlcState)); if (!p->vlc_state) return AVERROR(ENOMEM); } } if (fs->ac > 1) { for (VAR_0 = 1; VAR_0 < 256; VAR_0++) { fs->c. one_state[ VAR_0] = f->state_transition[VAR_0]; fs->c.zero_state[256 - VAR_0] = 256 - fs->c.one_state[VAR_0]; } } return 0; }
[ "av_cold int FUNC_0(FFV1Context *f, FFV1Context *fs)\n{", "int VAR_0;", "fs->plane_count = f->plane_count;", "fs->transparency = f->transparency;", "for (VAR_0 = 0; VAR_0 < f->plane_count; VAR_0++) {", "PlaneContext *const p = &fs->plane[VAR_0];", "if (fs->ac) {", "if (!p->state)\np->state = av_malloc_array(p->context_count, CONTEXT_SIZE *\nsizeof(uint8_t));", "if (!p->state)\nreturn AVERROR(ENOMEM);", "} else {", "if (!p->vlc_state)\np->vlc_state = av_malloc_array(p->context_count, sizeof(VlcState));", "if (!p->vlc_state)\nreturn AVERROR(ENOMEM);", "}", "}", "if (fs->ac > 1) {", "for (VAR_0 = 1; VAR_0 < 256; VAR_0++) {", "fs->c. one_state[ VAR_0] = f->state_transition[VAR_0];", "fs->c.zero_state[256 - VAR_0] = 256 - fs->c.one_state[VAR_0];", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23, 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
21,630
static void spitz_init(int ram_size, int vga_ram_size, int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { spitz_common_init(ram_size, vga_ram_size, ds, kernel_filename, kernel_cmdline, initrd_filename, spitz, 0x2c9); }
false
qemu
4207117c93357347500235952ce7891688089cb1
static void spitz_init(int ram_size, int vga_ram_size, int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { spitz_common_init(ram_size, vga_ram_size, ds, kernel_filename, kernel_cmdline, initrd_filename, spitz, 0x2c9); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, int VAR_1, int VAR_2, DisplayState *VAR_3, const char **VAR_4, int VAR_5, const char *VAR_6, const char *VAR_7, const char *VAR_8, const char *VAR_9) { spitz_common_init(VAR_0, VAR_1, VAR_3, VAR_6, VAR_7, VAR_8, spitz, 0x2c9); }
[ "static void FUNC_0(int VAR_0, int VAR_1, int VAR_2,\nDisplayState *VAR_3, const char **VAR_4, int VAR_5,\nconst char *VAR_6, const char *VAR_7,\nconst char *VAR_8, const char *VAR_9)\n{", "spitz_common_init(VAR_0, VAR_1, VAR_3, VAR_6,\nVAR_7, VAR_8, spitz, 0x2c9);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11, 13 ], [ 15 ] ]
21,631
static int vcr1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; VCR1Context *const a = avctx->priv_data; AVFrame *const p = data; const uint8_t *bytestream = buf; int i, x, y, ret; if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; if (buf_size < 32) for (i = 0; i < 16; i++) { a->delta[i] = *bytestream++; bytestream++; buf_size--; } for (y = 0; y < avctx->height; y++) { int offset; uint8_t *luma = &p->data[0][y * p->linesize[0]]; if ((y & 3) == 0) { uint8_t *cb = &p->data[1][(y >> 2) * p->linesize[1]]; uint8_t *cr = &p->data[2][(y >> 2) * p->linesize[2]]; for (i = 0; i < 4; i++) a->offset[i] = *bytestream++; offset = a->offset[0] - a->delta[bytestream[2] & 0xF]; for (x = 0; x < avctx->width; x += 4) { luma[0] = offset += a->delta[bytestream[2] & 0xF]; luma[1] = offset += a->delta[bytestream[2] >> 4]; luma[2] = offset += a->delta[bytestream[0] & 0xF]; luma[3] = offset += a->delta[bytestream[0] >> 4]; luma += 4; *cb++ = bytestream[3]; *cr++ = bytestream[1]; bytestream += 4; buf_size -= 4; } } else { if (buf_size < avctx->width / 2) offset = a->offset[y & 3] - a->delta[bytestream[2] & 0xF]; for (x = 0; x < avctx->width; x += 8) { luma[0] = offset += a->delta[bytestream[2] & 0xF]; luma[1] = offset += a->delta[bytestream[2] >> 4]; luma[2] = offset += a->delta[bytestream[3] & 0xF]; luma[3] = offset += a->delta[bytestream[3] >> 4]; luma[4] = offset += a->delta[bytestream[0] & 0xF]; luma[5] = offset += a->delta[bytestream[0] >> 4]; luma[6] = offset += a->delta[bytestream[1] & 0xF]; luma[7] = offset += a->delta[bytestream[1] >> 4]; luma += 8; bytestream += 4; buf_size -= 4; } } } *got_frame = 1; return buf_size; packet_small: av_log(avctx, AV_LOG_ERROR, "Input packet too small.\n"); return AVERROR_INVALIDDATA; }
true
FFmpeg
8aba7968dd604aae91ee42cbce0be3dad7dceb30
static int vcr1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; VCR1Context *const a = avctx->priv_data; AVFrame *const p = data; const uint8_t *bytestream = buf; int i, x, y, ret; if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; if (buf_size < 32) for (i = 0; i < 16; i++) { a->delta[i] = *bytestream++; bytestream++; buf_size--; } for (y = 0; y < avctx->height; y++) { int offset; uint8_t *luma = &p->data[0][y * p->linesize[0]]; if ((y & 3) == 0) { uint8_t *cb = &p->data[1][(y >> 2) * p->linesize[1]]; uint8_t *cr = &p->data[2][(y >> 2) * p->linesize[2]]; for (i = 0; i < 4; i++) a->offset[i] = *bytestream++; offset = a->offset[0] - a->delta[bytestream[2] & 0xF]; for (x = 0; x < avctx->width; x += 4) { luma[0] = offset += a->delta[bytestream[2] & 0xF]; luma[1] = offset += a->delta[bytestream[2] >> 4]; luma[2] = offset += a->delta[bytestream[0] & 0xF]; luma[3] = offset += a->delta[bytestream[0] >> 4]; luma += 4; *cb++ = bytestream[3]; *cr++ = bytestream[1]; bytestream += 4; buf_size -= 4; } } else { if (buf_size < avctx->width / 2) offset = a->offset[y & 3] - a->delta[bytestream[2] & 0xF]; for (x = 0; x < avctx->width; x += 8) { luma[0] = offset += a->delta[bytestream[2] & 0xF]; luma[1] = offset += a->delta[bytestream[2] >> 4]; luma[2] = offset += a->delta[bytestream[3] & 0xF]; luma[3] = offset += a->delta[bytestream[3] >> 4]; luma[4] = offset += a->delta[bytestream[0] & 0xF]; luma[5] = offset += a->delta[bytestream[0] >> 4]; luma[6] = offset += a->delta[bytestream[1] & 0xF]; luma[7] = offset += a->delta[bytestream[1] >> 4]; luma += 8; bytestream += 4; buf_size -= 4; } } } *got_frame = 1; return buf_size; packet_small: av_log(avctx, AV_LOG_ERROR, "Input packet too small.\n"); return AVERROR_INVALIDDATA; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; VCR1Context *const a = VAR_0->priv_data; AVFrame *const p = VAR_1; const uint8_t *VAR_6 = VAR_4; int VAR_7, VAR_8, VAR_9, VAR_10; if ((VAR_10 = ff_get_buffer(VAR_0, p, 0)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_10; } p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; if (VAR_5 < 32) for (VAR_7 = 0; VAR_7 < 16; VAR_7++) { a->delta[VAR_7] = *VAR_6++; VAR_6++; VAR_5--; } for (VAR_9 = 0; VAR_9 < VAR_0->height; VAR_9++) { int offset; uint8_t *luma = &p->VAR_1[0][VAR_9 * p->linesize[0]]; if ((VAR_9 & 3) == 0) { uint8_t *cb = &p->VAR_1[1][(VAR_9 >> 2) * p->linesize[1]]; uint8_t *cr = &p->VAR_1[2][(VAR_9 >> 2) * p->linesize[2]]; for (VAR_7 = 0; VAR_7 < 4; VAR_7++) a->offset[VAR_7] = *VAR_6++; offset = a->offset[0] - a->delta[VAR_6[2] & 0xF]; for (VAR_8 = 0; VAR_8 < VAR_0->width; VAR_8 += 4) { luma[0] = offset += a->delta[VAR_6[2] & 0xF]; luma[1] = offset += a->delta[VAR_6[2] >> 4]; luma[2] = offset += a->delta[VAR_6[0] & 0xF]; luma[3] = offset += a->delta[VAR_6[0] >> 4]; luma += 4; *cb++ = VAR_6[3]; *cr++ = VAR_6[1]; VAR_6 += 4; VAR_5 -= 4; } } else { if (VAR_5 < VAR_0->width / 2) offset = a->offset[VAR_9 & 3] - a->delta[VAR_6[2] & 0xF]; for (VAR_8 = 0; VAR_8 < VAR_0->width; VAR_8 += 8) { luma[0] = offset += a->delta[VAR_6[2] & 0xF]; luma[1] = offset += a->delta[VAR_6[2] >> 4]; luma[2] = offset += a->delta[VAR_6[3] & 0xF]; luma[3] = offset += a->delta[VAR_6[3] >> 4]; luma[4] = offset += a->delta[VAR_6[0] & 0xF]; luma[5] = offset += a->delta[VAR_6[0] >> 4]; luma[6] = offset += a->delta[VAR_6[1] & 0xF]; luma[7] = offset += a->delta[VAR_6[1] >> 4]; luma += 8; VAR_6 += 4; VAR_5 -= 4; } } } *VAR_2 = 1; return VAR_5; packet_small: av_log(VAR_0, AV_LOG_ERROR, "Input packet too small.\n"); return AVERROR_INVALIDDATA; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "VCR1Context *const a = VAR_0->priv_data;", "AVFrame *const p = VAR_1;", "const uint8_t *VAR_6 = VAR_4;", "int VAR_7, VAR_8, VAR_9, VAR_10;", "if ((VAR_10 = ff_get_buffer(VAR_0, p, 0)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return VAR_10;", "}", "p->pict_type = AV_PICTURE_TYPE_I;", "p->key_frame = 1;", "if (VAR_5 < 32)\nfor (VAR_7 = 0; VAR_7 < 16; VAR_7++) {", "a->delta[VAR_7] = *VAR_6++;", "VAR_6++;", "VAR_5--;", "}", "for (VAR_9 = 0; VAR_9 < VAR_0->height; VAR_9++) {", "int offset;", "uint8_t *luma = &p->VAR_1[0][VAR_9 * p->linesize[0]];", "if ((VAR_9 & 3) == 0) {", "uint8_t *cb = &p->VAR_1[1][(VAR_9 >> 2) * p->linesize[1]];", "uint8_t *cr = &p->VAR_1[2][(VAR_9 >> 2) * p->linesize[2]];", "for (VAR_7 = 0; VAR_7 < 4; VAR_7++)", "a->offset[VAR_7] = *VAR_6++;", "offset = a->offset[0] - a->delta[VAR_6[2] & 0xF];", "for (VAR_8 = 0; VAR_8 < VAR_0->width; VAR_8 += 4) {", "luma[0] = offset += a->delta[VAR_6[2] & 0xF];", "luma[1] = offset += a->delta[VAR_6[2] >> 4];", "luma[2] = offset += a->delta[VAR_6[0] & 0xF];", "luma[3] = offset += a->delta[VAR_6[0] >> 4];", "luma += 4;", "*cb++ = VAR_6[3];", "*cr++ = VAR_6[1];", "VAR_6 += 4;", "VAR_5 -= 4;", "}", "} else {", "if (VAR_5 < VAR_0->width / 2)\noffset = a->offset[VAR_9 & 3] - a->delta[VAR_6[2] & 0xF];", "for (VAR_8 = 0; VAR_8 < VAR_0->width; VAR_8 += 8) {", "luma[0] = offset += a->delta[VAR_6[2] & 0xF];", "luma[1] = offset += a->delta[VAR_6[2] >> 4];", "luma[2] = offset += a->delta[VAR_6[3] & 0xF];", "luma[3] = offset += a->delta[VAR_6[3] >> 4];", "luma[4] = offset += a->delta[VAR_6[0] & 0xF];", "luma[5] = offset += a->delta[VAR_6[0] >> 4];", "luma[6] = offset += a->delta[VAR_6[1] & 0xF];", "luma[7] = offset += a->delta[VAR_6[1] >> 4];", "luma += 8;", "VAR_6 += 4;", "VAR_5 -= 4;", "}", "}", "}", "*VAR_2 = 1;", "return VAR_5;", "packet_small:\nav_log(VAR_0, AV_LOG_ERROR, \"Input packet too small.\\n\");", "return AVERROR_INVALIDDATA;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16, 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43, 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60 ], [ 61 ], [ 62, 63 ], [ 64 ], [ 65 ] ]
21,632
long disas_insn(DisasContext *s, uint8_t *pc_start) { int b, prefixes, aflag, dflag; int shift, ot; int modrm, reg, rm, mod, reg_addr, op, opreg, offset_addr, val; unsigned int next_eip; s->pc = pc_start; prefixes = 0; aflag = s->code32; dflag = s->code32; s->override = -1; next_byte: b = ldub(s->pc); s->pc++; /* check prefixes */ switch (b) { case 0xf3: prefixes |= PREFIX_REPZ; goto next_byte; case 0xf2: prefixes |= PREFIX_REPNZ; goto next_byte; case 0xf0: prefixes |= PREFIX_LOCK; goto next_byte; case 0x2e: s->override = R_CS; goto next_byte; case 0x36: s->override = R_SS; goto next_byte; case 0x3e: s->override = R_DS; goto next_byte; case 0x26: s->override = R_ES; goto next_byte; case 0x64: s->override = R_FS; goto next_byte; case 0x65: s->override = R_GS; goto next_byte; case 0x66: prefixes |= PREFIX_DATA; goto next_byte; case 0x67: prefixes |= PREFIX_ADR; goto next_byte; case 0x9b: prefixes |= PREFIX_FWAIT; goto next_byte; } if (prefixes & PREFIX_DATA) dflag ^= 1; if (prefixes & PREFIX_ADR) aflag ^= 1; s->prefix = prefixes; s->aflag = aflag; s->dflag = dflag; /* lock generation */ if (prefixes & PREFIX_LOCK) gen_op_lock(); /* now check op code */ reswitch: switch(b) { case 0x0f: /**************************/ /* extended op code */ b = ldub(s->pc++) | 0x100; goto reswitch; /**************************/ /* arith & logic */ case 0x00 ... 0x05: case 0x08 ... 0x0d: case 0x10 ... 0x15: case 0x18 ... 0x1d: case 0x20 ... 0x25: case 0x28 ... 0x2d: case 0x30 ... 0x35: case 0x38 ... 0x3d: { int op, f, val; op = (b >> 3) & 7; f = (b >> 1) & 3; if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; switch(f) { case 0: /* OP Ev, Gv */ modrm = ldub(s->pc++); reg = ((modrm >> 3) & 7) + OR_EAX; mod = (modrm >> 6) & 3; rm = modrm & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); opreg = OR_TMP0; } else { opreg = OR_EAX + rm; } gen_op(s, op, ot, opreg, reg); if (mod != 3 && op != 7) { gen_op_st_T0_A0[ot](); } break; case 1: /* OP Gv, Ev */ modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; reg = ((modrm >> 3) & 7) + OR_EAX; rm = modrm & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T1_A0[ot](); opreg = OR_TMP1; } else { opreg = OR_EAX + rm; } gen_op(s, op, ot, reg, opreg); break; case 2: /* OP A, Iv */ val = insn_get(s, ot); gen_opi(s, op, ot, OR_EAX, val); break; } } break; case 0x80: /* GRP1 */ case 0x81: case 0x83: { int val; if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; op = (modrm >> 3) & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); opreg = OR_TMP0; } else { opreg = rm + OR_EAX; } switch(b) { default: case 0x80: case 0x81: val = insn_get(s, ot); break; case 0x83: val = (int8_t)insn_get(s, OT_BYTE); break; } gen_opi(s, op, ot, opreg, val); if (op != 7 && mod != 3) { gen_op_st_T0_A0[ot](); } } break; /**************************/ /* inc, dec, and other misc arith */ case 0x40 ... 0x47: /* inc Gv */ ot = dflag ? OT_LONG : OT_WORD; gen_inc(s, ot, OR_EAX + (b & 7), 1); break; case 0x48 ... 0x4f: /* dec Gv */ ot = dflag ? OT_LONG : OT_WORD; gen_inc(s, ot, OR_EAX + (b & 7), -1); break; case 0xf6: /* GRP3 */ case 0xf7: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; op = (modrm >> 3) & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); } else { gen_op_mov_TN_reg[ot][0][rm](); } switch(op) { case 0: /* test */ val = insn_get(s, ot); gen_op_movl_T1_im(val); gen_op_testl_T0_T1_cc(); s->cc_op = CC_OP_LOGICB + ot; break; case 2: /* not */ gen_op_notl_T0(); if (mod != 3) { gen_op_st_T0_A0[ot](); } else { gen_op_mov_reg_T0[ot][rm](); } break; case 3: /* neg */ gen_op_negl_T0_cc(); if (mod != 3) { gen_op_st_T0_A0[ot](); } else { gen_op_mov_reg_T0[ot][rm](); } s->cc_op = CC_OP_SUBB + ot; break; case 4: /* mul */ switch(ot) { case OT_BYTE: gen_op_mulb_AL_T0(); break; case OT_WORD: gen_op_mulw_AX_T0(); break; default: case OT_LONG: gen_op_mull_EAX_T0(); break; } s->cc_op = CC_OP_MUL; break; case 5: /* imul */ switch(ot) { case OT_BYTE: gen_op_imulb_AL_T0(); break; case OT_WORD: gen_op_imulw_AX_T0(); break; default: case OT_LONG: gen_op_imull_EAX_T0(); break; } s->cc_op = CC_OP_MUL; break; case 6: /* div */ switch(ot) { case OT_BYTE: gen_op_divb_AL_T0(); break; case OT_WORD: gen_op_divw_AX_T0(); break; default: case OT_LONG: gen_op_divl_EAX_T0(); break; } break; case 7: /* idiv */ switch(ot) { case OT_BYTE: gen_op_idivb_AL_T0(); break; case OT_WORD: gen_op_idivw_AX_T0(); break; default: case OT_LONG: gen_op_idivl_EAX_T0(); break; } break; default: goto illegal_op; } break; case 0xfe: /* GRP4 */ case 0xff: /* GRP5 */ if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; op = (modrm >> 3) & 7; if (op >= 2 && b == 0xfe) { goto illegal_op; } if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); if (op != 3 && op != 5) gen_op_ld_T0_A0[ot](); } else { gen_op_mov_TN_reg[ot][0][rm](); } switch(op) { case 0: /* inc Ev */ gen_inc(s, ot, OR_TMP0, 1); if (mod != 3) gen_op_st_T0_A0[ot](); else gen_op_mov_reg_T0[ot][rm](); break; case 1: /* dec Ev */ gen_inc(s, ot, OR_TMP0, -1); if (mod != 3) gen_op_st_T0_A0[ot](); else gen_op_mov_reg_T0[ot][rm](); break; case 2: /* call Ev */ /* XXX: optimize if memory (no and is necessary) */ if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); next_eip = s->pc - s->cs_base; gen_op_movl_T0_im(next_eip); gen_push_T0(s); s->is_jmp = 1; break; case 3: /* lcall Ev */ /* push return segment + offset */ gen_op_movl_T0_seg(R_CS); gen_push_T0(s); next_eip = s->pc - s->cs_base; gen_op_movl_T0_im(next_eip); gen_push_T0(s); gen_op_ld_T1_A0[ot](); gen_op_addl_A0_im(1 << (ot - OT_WORD + 1)); gen_op_lduw_T0_A0(); gen_movl_seg_T0(s, R_CS); gen_op_movl_T0_T1(); gen_op_jmp_T0(); s->is_jmp = 1; break; case 4: /* jmp Ev */ if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); s->is_jmp = 1; break; case 5: /* ljmp Ev */ gen_op_ld_T1_A0[ot](); gen_op_addl_A0_im(1 << (ot - OT_WORD + 1)); gen_op_lduw_T0_A0(); gen_movl_seg_T0(s, R_CS); gen_op_movl_T0_T1(); gen_op_jmp_T0(); s->is_jmp = 1; break; case 6: /* push Ev */ gen_push_T0(s); break; default: goto illegal_op; } break; case 0x84: /* test Ev, Gv */ case 0x85: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; reg = (modrm >> 3) & 7; gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); gen_op_mov_TN_reg[ot][1][reg + OR_EAX](); gen_op_testl_T0_T1_cc(); s->cc_op = CC_OP_LOGICB + ot; break; case 0xa8: /* test eAX, Iv */ case 0xa9: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; val = insn_get(s, ot); gen_op_mov_TN_reg[ot][0][OR_EAX](); gen_op_movl_T1_im(val); gen_op_testl_T0_T1_cc(); s->cc_op = CC_OP_LOGICB + ot; break; case 0x98: /* CWDE/CBW */ if (dflag) gen_op_movswl_EAX_AX(); else gen_op_movsbw_AX_AL(); break; case 0x99: /* CDQ/CWD */ if (dflag) gen_op_movslq_EDX_EAX(); else gen_op_movswl_DX_AX(); break; case 0x1af: /* imul Gv, Ev */ case 0x69: /* imul Gv, Ev, I */ case 0x6b: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = ((modrm >> 3) & 7) + OR_EAX; gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); if (b == 0x69) { val = insn_get(s, ot); gen_op_movl_T1_im(val); } else if (b == 0x6b) { val = insn_get(s, OT_BYTE); gen_op_movl_T1_im(val); } else { gen_op_mov_TN_reg[ot][1][reg](); } if (ot == OT_LONG) { gen_op_imull_T0_T1(); } else { gen_op_imulw_T0_T1(); } gen_op_mov_reg_T0[ot][reg](); s->cc_op = CC_OP_MUL; break; case 0x1c0: case 0x1c1: /* xadd Ev, Gv */ if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; if (mod == 3) { rm = modrm & 7; gen_op_mov_TN_reg[ot][0][reg](); gen_op_mov_TN_reg[ot][1][rm](); gen_op_addl_T0_T1_cc(); gen_op_mov_reg_T0[ot][rm](); gen_op_mov_reg_T1[ot][reg](); } else { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_mov_TN_reg[ot][0][reg](); gen_op_ld_T1_A0[ot](); gen_op_addl_T0_T1_cc(); gen_op_st_T0_A0[ot](); gen_op_mov_reg_T1[ot][reg](); } s->cc_op = CC_OP_ADDB + ot; break; case 0x1b0: case 0x1b1: /* cmpxchg Ev, Gv */ if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; gen_op_mov_TN_reg[ot][1][reg](); if (mod == 3) { rm = modrm & 7; gen_op_mov_TN_reg[ot][0][rm](); gen_op_cmpxchg_T0_T1_EAX_cc[ot](); gen_op_mov_reg_T0[ot][rm](); } else { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); gen_op_cmpxchg_T0_T1_EAX_cc[ot](); gen_op_st_T0_A0[ot](); } s->cc_op = CC_OP_SUBB + ot; break; case 0x1c7: /* cmpxchg8b */ modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; if (mod == 3) goto illegal_op; if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_cmpxchg8b(); s->cc_op = CC_OP_EFLAGS; break; /**************************/ /* push/pop */ case 0x50 ... 0x57: /* push */ gen_op_mov_TN_reg[OT_LONG][0][b & 7](); gen_push_T0(s); break; case 0x58 ... 0x5f: /* pop */ ot = dflag ? OT_LONG : OT_WORD; gen_pop_T0(s); gen_op_mov_reg_T0[ot][b & 7](); gen_pop_update(s); break; case 0x60: /* pusha */ gen_pusha(s); break; case 0x61: /* popa */ gen_popa(s); break; case 0x68: /* push Iv */ case 0x6a: ot = dflag ? OT_LONG : OT_WORD; if (b == 0x68) val = insn_get(s, ot); else val = (int8_t)insn_get(s, OT_BYTE); gen_op_movl_T0_im(val); gen_push_T0(s); break; case 0x8f: /* pop Ev */ ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); gen_pop_T0(s); gen_ldst_modrm(s, modrm, ot, OR_TMP0, 1); gen_pop_update(s); break; case 0xc8: /* enter */ { int level; val = lduw(s->pc); s->pc += 2; level = ldub(s->pc++); gen_enter(s, val, level); } break; case 0xc9: /* leave */ /* XXX: exception not precise (ESP is update before potential exception) */ if (s->ss32) { gen_op_mov_TN_reg[OT_LONG][0][R_EBP](); gen_op_mov_reg_T0[OT_LONG][R_ESP](); } else { gen_op_mov_TN_reg[OT_WORD][0][R_EBP](); gen_op_mov_reg_T0[OT_WORD][R_ESP](); } gen_pop_T0(s); ot = dflag ? OT_LONG : OT_WORD; gen_op_mov_reg_T0[ot][R_EBP](); gen_pop_update(s); break; case 0x06: /* push es */ case 0x0e: /* push cs */ case 0x16: /* push ss */ case 0x1e: /* push ds */ gen_op_movl_T0_seg(b >> 3); gen_push_T0(s); break; case 0x1a0: /* push fs */ case 0x1a8: /* push gs */ gen_op_movl_T0_seg((b >> 3) & 7); gen_push_T0(s); break; case 0x07: /* pop es */ case 0x17: /* pop ss */ case 0x1f: /* pop ds */ gen_pop_T0(s); gen_movl_seg_T0(s, b >> 3); gen_pop_update(s); break; case 0x1a1: /* pop fs */ case 0x1a9: /* pop gs */ gen_pop_T0(s); gen_movl_seg_T0(s, (b >> 3) & 7); gen_pop_update(s); break; /**************************/ /* mov */ case 0x88: case 0x89: /* mov Gv, Ev */ if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; /* generate a generic store */ gen_ldst_modrm(s, modrm, ot, OR_EAX + reg, 1); break; case 0xc6: case 0xc7: /* mov Ev, Iv */ if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; if (mod != 3) gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); val = insn_get(s, ot); gen_op_movl_T0_im(val); if (mod != 3) gen_op_st_T0_A0[ot](); else gen_op_mov_reg_T0[ot][modrm & 7](); break; case 0x8a: case 0x8b: /* mov Ev, Gv */ if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); gen_op_mov_reg_T0[ot][reg](); break; case 0x8e: /* mov seg, Gv */ ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); if (reg >= 6 || reg == R_CS) goto illegal_op; gen_movl_seg_T0(s, reg); break; case 0x8c: /* mov Gv, seg */ ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; if (reg >= 6) goto illegal_op; gen_op_movl_T0_seg(reg); gen_ldst_modrm(s, modrm, ot, OR_TMP0, 1); break; case 0x1b6: /* movzbS Gv, Eb */ case 0x1b7: /* movzwS Gv, Eb */ case 0x1be: /* movsbS Gv, Eb */ case 0x1bf: /* movswS Gv, Eb */ { int d_ot; /* d_ot is the size of destination */ d_ot = dflag + OT_WORD; /* ot is the size of source */ ot = (b & 1) + OT_BYTE; modrm = ldub(s->pc++); reg = ((modrm >> 3) & 7) + OR_EAX; mod = (modrm >> 6) & 3; rm = modrm & 7; if (mod == 3) { gen_op_mov_TN_reg[ot][0][rm](); switch(ot | (b & 8)) { case OT_BYTE: gen_op_movzbl_T0_T0(); break; case OT_BYTE | 8: gen_op_movsbl_T0_T0(); break; case OT_WORD: gen_op_movzwl_T0_T0(); break; default: case OT_WORD | 8: gen_op_movswl_T0_T0(); break; } gen_op_mov_reg_T0[d_ot][reg](); } else { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); if (b & 8) { gen_op_lds_T0_A0[ot](); } else { gen_op_ldu_T0_A0[ot](); } gen_op_mov_reg_T0[d_ot][reg](); } } break; case 0x8d: /* lea */ ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; /* we must ensure that no segment is added */ s->override = -1; val = s->addseg; s->addseg = 0; gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); s->addseg = val; gen_op_mov_reg_A0[ot - OT_WORD][reg](); break; case 0xa0: /* mov EAX, Ov */ case 0xa1: case 0xa2: /* mov Ov, EAX */ case 0xa3: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (s->aflag) offset_addr = insn_get(s, OT_LONG); else offset_addr = insn_get(s, OT_WORD); gen_op_movl_A0_im(offset_addr); /* handle override */ { int override, must_add_seg; must_add_seg = s->addseg; if (s->override >= 0) { override = s->override; must_add_seg = 1; } else { override = R_DS; } if (must_add_seg) { gen_op_addl_A0_seg(offsetof(CPUX86State,seg_cache[override].base)); } } if ((b & 2) == 0) { gen_op_ld_T0_A0[ot](); gen_op_mov_reg_T0[ot][R_EAX](); } else { gen_op_mov_TN_reg[ot][0][R_EAX](); gen_op_st_T0_A0[ot](); } break; case 0xd7: /* xlat */ gen_op_movl_A0_reg[R_EBX](); gen_op_addl_A0_AL(); if (s->aflag == 0) gen_op_andl_A0_ffff(); /* handle override */ { int override, must_add_seg; must_add_seg = s->addseg; override = R_DS; if (s->override >= 0) { override = s->override; must_add_seg = 1; } else { override = R_DS; } if (must_add_seg) { gen_op_addl_A0_seg(offsetof(CPUX86State,seg_cache[override].base)); } } gen_op_ldub_T0_A0(); gen_op_mov_reg_T0[OT_BYTE][R_EAX](); break; case 0xb0 ... 0xb7: /* mov R, Ib */ val = insn_get(s, OT_BYTE); gen_op_movl_T0_im(val); gen_op_mov_reg_T0[OT_BYTE][b & 7](); break; case 0xb8 ... 0xbf: /* mov R, Iv */ ot = dflag ? OT_LONG : OT_WORD; val = insn_get(s, ot); reg = OR_EAX + (b & 7); gen_op_movl_T0_im(val); gen_op_mov_reg_T0[ot][reg](); break; case 0x91 ... 0x97: /* xchg R, EAX */ ot = dflag ? OT_LONG : OT_WORD; reg = b & 7; rm = R_EAX; goto do_xchg_reg; case 0x86: case 0x87: /* xchg Ev, Gv */ if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; if (mod == 3) { rm = modrm & 7; do_xchg_reg: gen_op_mov_TN_reg[ot][0][reg](); gen_op_mov_TN_reg[ot][1][rm](); gen_op_mov_reg_T0[ot][rm](); gen_op_mov_reg_T1[ot][reg](); } else { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_mov_TN_reg[ot][0][reg](); /* for xchg, lock is implicit */ if (!(prefixes & PREFIX_LOCK)) gen_op_lock(); gen_op_ld_T1_A0[ot](); gen_op_st_T0_A0[ot](); if (!(prefixes & PREFIX_LOCK)) gen_op_unlock(); gen_op_mov_reg_T1[ot][reg](); } break; case 0xc4: /* les Gv */ op = R_ES; goto do_lxx; case 0xc5: /* lds Gv */ op = R_DS; goto do_lxx; case 0x1b2: /* lss Gv */ op = R_SS; goto do_lxx; case 0x1b4: /* lfs Gv */ op = R_FS; goto do_lxx; case 0x1b5: /* lgs Gv */ op = R_GS; do_lxx: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; if (mod == 3) goto illegal_op; gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T1_A0[ot](); gen_op_addl_A0_im(1 << (ot - OT_WORD + 1)); /* load the segment first to handle exceptions properly */ gen_op_lduw_T0_A0(); gen_movl_seg_T0(s, op); /* then put the data */ gen_op_mov_reg_T1[ot][reg](); break; /************************/ /* shifts */ case 0xc0: case 0xc1: /* shift Ev,Ib */ shift = 2; grp2: { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; op = (modrm >> 3) & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); opreg = OR_TMP0; } else { opreg = rm + OR_EAX; } /* simpler op */ if (shift == 0) { gen_shift(s, op, ot, opreg, OR_ECX); } else { if (shift == 2) { shift = ldub(s->pc++); } gen_shifti(s, op, ot, opreg, shift); } if (mod != 3) { gen_op_st_T0_A0[ot](); } } break; case 0xd0: case 0xd1: /* shift Ev,1 */ shift = 1; goto grp2; case 0xd2: case 0xd3: /* shift Ev,cl */ shift = 0; goto grp2; case 0x1a4: /* shld imm */ op = 0; shift = 1; goto do_shiftd; case 0x1a5: /* shld cl */ op = 0; shift = 0; goto do_shiftd; case 0x1ac: /* shrd imm */ op = 1; shift = 1; goto do_shiftd; case 0x1ad: /* shrd cl */ op = 1; shift = 0; do_shiftd: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; reg = (modrm >> 3) & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); } else { gen_op_mov_TN_reg[ot][0][rm](); } gen_op_mov_TN_reg[ot][1][reg](); if (shift) { val = ldub(s->pc++); val &= 0x1f; if (val) { gen_op_shiftd_T0_T1_im_cc[ot - OT_WORD][op](val); if (op == 0 && ot != OT_WORD) s->cc_op = CC_OP_SHLB + ot; else s->cc_op = CC_OP_SARB + ot; } } else { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_shiftd_T0_T1_ECX_cc[ot - OT_WORD][op](); s->cc_op = CC_OP_DYNAMIC; /* cannot predict flags after */ } if (mod != 3) { gen_op_st_T0_A0[ot](); } else { gen_op_mov_reg_T0[ot][rm](); } break; /************************/ /* floats */ case 0xd8 ... 0xdf: modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; op = ((b & 7) << 3) | ((modrm >> 3) & 7); if (mod != 3) { /* memory op */ gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); switch(op) { case 0x00 ... 0x07: /* fxxxs */ case 0x10 ... 0x17: /* fixxxl */ case 0x20 ... 0x27: /* fxxxl */ case 0x30 ... 0x37: /* fixxx */ { int op1; op1 = op & 7; switch(op >> 4) { case 0: gen_op_flds_FT0_A0(); break; case 1: gen_op_fildl_FT0_A0(); break; case 2: gen_op_fldl_FT0_A0(); break; case 3: default: gen_op_fild_FT0_A0(); break; } gen_op_fp_arith_ST0_FT0[op1](); if (op1 == 3) { /* fcomp needs pop */ gen_op_fpop(); } } break; case 0x08: /* flds */ case 0x0a: /* fsts */ case 0x0b: /* fstps */ case 0x18: /* fildl */ case 0x1a: /* fistl */ case 0x1b: /* fistpl */ case 0x28: /* fldl */ case 0x2a: /* fstl */ case 0x2b: /* fstpl */ case 0x38: /* filds */ case 0x3a: /* fists */ case 0x3b: /* fistps */ switch(op & 7) { case 0: gen_op_fpush(); switch(op >> 4) { case 0: gen_op_flds_ST0_A0(); break; case 1: gen_op_fildl_ST0_A0(); break; case 2: gen_op_fldl_ST0_A0(); break; case 3: default: gen_op_fild_ST0_A0(); break; } break; default: switch(op >> 4) { case 0: gen_op_fsts_ST0_A0(); break; case 1: gen_op_fistl_ST0_A0(); break; case 2: gen_op_fstl_ST0_A0(); break; case 3: default: gen_op_fist_ST0_A0(); break; } if ((op & 7) == 3) gen_op_fpop(); break; } break; case 0x0d: /* fldcw mem */ gen_op_fldcw_A0(); break; case 0x0f: /* fnstcw mem */ gen_op_fnstcw_A0(); break; case 0x1d: /* fldt mem */ gen_op_fpush(); gen_op_fldt_ST0_A0(); break; case 0x1f: /* fstpt mem */ gen_op_fstt_ST0_A0(); gen_op_fpop(); break; case 0x2f: /* fnstsw mem */ gen_op_fnstsw_A0(); break; case 0x3c: /* fbld */ gen_op_fpush(); gen_op_fbld_ST0_A0(); break; case 0x3e: /* fbstp */ gen_op_fbst_ST0_A0(); gen_op_fpop(); break; case 0x3d: /* fildll */ gen_op_fpush(); gen_op_fildll_ST0_A0(); break; case 0x3f: /* fistpll */ gen_op_fistll_ST0_A0(); gen_op_fpop(); break; default: goto illegal_op; } } else { /* register float ops */ opreg = rm; switch(op) { case 0x08: /* fld sti */ gen_op_fpush(); gen_op_fmov_ST0_STN((opreg + 1) & 7); break; case 0x09: /* fxchg sti */ gen_op_fxchg_ST0_STN(opreg); break; case 0x0a: /* grp d9/2 */ switch(rm) { case 0: /* fnop */ break; default: goto illegal_op; } break; case 0x0c: /* grp d9/4 */ switch(rm) { case 0: /* fchs */ gen_op_fchs_ST0(); break; case 1: /* fabs */ gen_op_fabs_ST0(); break; case 4: /* ftst */ gen_op_fldz_FT0(); gen_op_fcom_ST0_FT0(); break; case 5: /* fxam */ gen_op_fxam_ST0(); break; default: goto illegal_op; } break; case 0x0d: /* grp d9/5 */ { switch(rm) { case 0: gen_op_fpush(); gen_op_fld1_ST0(); break; case 1: gen_op_fpush(); gen_op_fldl2t_ST0(); break; case 2: gen_op_fpush(); gen_op_fldl2e_ST0(); break; case 3: gen_op_fpush(); gen_op_fldpi_ST0(); break; case 4: gen_op_fpush(); gen_op_fldlg2_ST0(); break; case 5: gen_op_fpush(); gen_op_fldln2_ST0(); break; case 6: gen_op_fpush(); gen_op_fldz_ST0(); break; default: goto illegal_op; } } break; case 0x0e: /* grp d9/6 */ switch(rm) { case 0: /* f2xm1 */ gen_op_f2xm1(); break; case 1: /* fyl2x */ gen_op_fyl2x(); break; case 2: /* fptan */ gen_op_fptan(); break; case 3: /* fpatan */ gen_op_fpatan(); break; case 4: /* fxtract */ gen_op_fxtract(); break; case 5: /* fprem1 */ gen_op_fprem1(); break; case 6: /* fdecstp */ gen_op_fdecstp(); break; default: case 7: /* fincstp */ gen_op_fincstp(); break; } break; case 0x0f: /* grp d9/7 */ switch(rm) { case 0: /* fprem */ gen_op_fprem(); break; case 1: /* fyl2xp1 */ gen_op_fyl2xp1(); break; case 2: /* fsqrt */ gen_op_fsqrt(); break; case 3: /* fsincos */ gen_op_fsincos(); break; case 5: /* fscale */ gen_op_fscale(); break; case 4: /* frndint */ gen_op_frndint(); break; case 6: /* fsin */ gen_op_fsin(); break; default: case 7: /* fcos */ gen_op_fcos(); break; } break; case 0x00: case 0x01: case 0x04 ... 0x07: /* fxxx st, sti */ case 0x20: case 0x21: case 0x24 ... 0x27: /* fxxx sti, st */ case 0x30: case 0x31: case 0x34 ... 0x37: /* fxxxp sti, st */ { int op1; op1 = op & 7; if (op >= 0x20) { gen_op_fp_arith_STN_ST0[op1](opreg); if (op >= 0x30) gen_op_fpop(); } else { gen_op_fmov_FT0_STN(opreg); gen_op_fp_arith_ST0_FT0[op1](); } } break; case 0x02: /* fcom */ gen_op_fmov_FT0_STN(opreg); gen_op_fcom_ST0_FT0(); break; case 0x03: /* fcomp */ gen_op_fmov_FT0_STN(opreg); gen_op_fcom_ST0_FT0(); gen_op_fpop(); break; case 0x15: /* da/5 */ switch(rm) { case 1: /* fucompp */ gen_op_fmov_FT0_STN(1); gen_op_fucom_ST0_FT0(); gen_op_fpop(); gen_op_fpop(); break; default: goto illegal_op; } break; case 0x1c: switch(rm) { case 2: /* fclex */ gen_op_fclex(); break; case 3: /* fninit */ gen_op_fninit(); break; default: goto illegal_op; } break; case 0x2a: /* fst sti */ gen_op_fmov_STN_ST0(opreg); break; case 0x2b: /* fstp sti */ gen_op_fmov_STN_ST0(opreg); gen_op_fpop(); break; case 0x2c: /* fucom st(i) */ gen_op_fmov_FT0_STN(opreg); gen_op_fucom_ST0_FT0(); break; case 0x2d: /* fucomp st(i) */ gen_op_fmov_FT0_STN(opreg); gen_op_fucom_ST0_FT0(); gen_op_fpop(); break; case 0x33: /* de/3 */ switch(rm) { case 1: /* fcompp */ gen_op_fmov_FT0_STN(1); gen_op_fcom_ST0_FT0(); gen_op_fpop(); gen_op_fpop(); break; default: goto illegal_op; } break; case 0x3c: /* df/4 */ switch(rm) { case 0: gen_op_fnstsw_EAX(); break; default: goto illegal_op; } break; default: goto illegal_op; } } break; /************************/ /* string ops */ case 0xa4: /* movsS */ case 0xa5: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPZ) { gen_string_ds(s, ot, gen_op_movs + 9); } else { gen_string_ds(s, ot, gen_op_movs); } break; case 0xaa: /* stosS */ case 0xab: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPZ) { gen_string_es(s, ot, gen_op_stos + 9); } else { gen_string_es(s, ot, gen_op_stos); } break; case 0xac: /* lodsS */ case 0xad: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPZ) { gen_string_ds(s, ot, gen_op_lods + 9); } else { gen_string_ds(s, ot, gen_op_lods); } break; case 0xae: /* scasS */ case 0xaf: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPNZ) { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_string_es(s, ot, gen_op_scas + 9 * 2); s->cc_op = CC_OP_DYNAMIC; /* cannot predict flags after */ } else if (prefixes & PREFIX_REPZ) { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_string_es(s, ot, gen_op_scas + 9); s->cc_op = CC_OP_DYNAMIC; /* cannot predict flags after */ } else { gen_string_es(s, ot, gen_op_scas); s->cc_op = CC_OP_SUBB + ot; } break; case 0xa6: /* cmpsS */ case 0xa7: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPNZ) { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_string_ds(s, ot, gen_op_cmps + 9 * 2); s->cc_op = CC_OP_DYNAMIC; /* cannot predict flags after */ } else if (prefixes & PREFIX_REPZ) { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_string_ds(s, ot, gen_op_cmps + 9); s->cc_op = CC_OP_DYNAMIC; /* cannot predict flags after */ } else { gen_string_ds(s, ot, gen_op_cmps); s->cc_op = CC_OP_SUBB + ot; } break; case 0x6c: /* insS */ case 0x6d: if (s->cpl > s->iopl || s->vm86) { /* NOTE: even for (E)CX = 0 the exception is raised */ gen_op_gpf(pc_start - s->cs_base); } else { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPZ) { gen_string_es(s, ot, gen_op_ins + 9); } else { gen_string_es(s, ot, gen_op_ins); } } break; case 0x6e: /* outsS */ case 0x6f: if (s->cpl > s->iopl || s->vm86) { /* NOTE: even for (E)CX = 0 the exception is raised */ gen_op_gpf(pc_start - s->cs_base); } else { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPZ) { gen_string_ds(s, ot, gen_op_outs + 9); } else { gen_string_ds(s, ot, gen_op_outs); } } break; /************************/ /* port I/O */ case 0xe4: case 0xe5: if (s->cpl > s->iopl || s->vm86) { gen_op_gpf(pc_start - s->cs_base); } else { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; val = ldub(s->pc++); gen_op_movl_T0_im(val); gen_op_in[ot](); gen_op_mov_reg_T1[ot][R_EAX](); } break; case 0xe6: case 0xe7: if (s->cpl > s->iopl || s->vm86) { gen_op_gpf(pc_start - s->cs_base); } else { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; val = ldub(s->pc++); gen_op_movl_T0_im(val); gen_op_mov_TN_reg[ot][1][R_EAX](); gen_op_out[ot](); } break; case 0xec: case 0xed: if (s->cpl > s->iopl || s->vm86) { gen_op_gpf(pc_start - s->cs_base); } else { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; gen_op_mov_TN_reg[OT_WORD][0][R_EDX](); gen_op_in[ot](); gen_op_mov_reg_T1[ot][R_EAX](); } break; case 0xee: case 0xef: if (s->cpl > s->iopl || s->vm86) { gen_op_gpf(pc_start - s->cs_base); } else { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; gen_op_mov_TN_reg[OT_WORD][0][R_EDX](); gen_op_mov_TN_reg[ot][1][R_EAX](); gen_op_out[ot](); } break; /************************/ /* control */ case 0xc2: /* ret im */ val = ldsw(s->pc); s->pc += 2; gen_pop_T0(s); if (s->ss32) gen_op_addl_ESP_im(val + (2 << s->dflag)); else gen_op_addw_ESP_im(val + (2 << s->dflag)); if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); s->is_jmp = 1; break; case 0xc3: /* ret */ gen_pop_T0(s); gen_pop_update(s); if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); s->is_jmp = 1; break; case 0xca: /* lret im */ /* XXX: not restartable */ val = ldsw(s->pc); s->pc += 2; /* pop offset */ gen_pop_T0(s); if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); gen_pop_update(s); /* pop selector */ gen_pop_T0(s); gen_movl_seg_T0(s, R_CS); gen_pop_update(s); /* add stack offset */ if (s->ss32) gen_op_addl_ESP_im(val + (2 << s->dflag)); else gen_op_addw_ESP_im(val + (2 << s->dflag)); s->is_jmp = 1; break; case 0xcb: /* lret */ /* XXX: not restartable */ /* pop offset */ gen_pop_T0(s); if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); gen_pop_update(s); /* pop selector */ gen_pop_T0(s); gen_movl_seg_T0(s, R_CS); gen_pop_update(s); s->is_jmp = 1; break; case 0xcf: /* iret */ /* XXX: not restartable */ /* pop offset */ gen_pop_T0(s); if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); gen_pop_update(s); /* pop selector */ gen_pop_T0(s); gen_movl_seg_T0(s, R_CS); gen_pop_update(s); /* pop eflags */ gen_pop_T0(s); if (s->dflag) { if (s->vm86) gen_op_movl_eflags_T0_vm(pc_start - s->cs_base); else gen_op_movl_eflags_T0(); } else { if (s->vm86) gen_op_movw_eflags_T0_vm(pc_start - s->cs_base); else gen_op_movw_eflags_T0(); } gen_pop_update(s); s->cc_op = CC_OP_EFLAGS; s->is_jmp = 1; break; case 0xe8: /* call im */ { unsigned int next_eip; ot = dflag ? OT_LONG : OT_WORD; val = insn_get(s, ot); next_eip = s->pc - s->cs_base; val += next_eip; if (s->dflag == 0) val &= 0xffff; gen_op_movl_T0_im(next_eip); gen_push_T0(s); gen_op_jmp_im(val); s->is_jmp = 1; } break; case 0x9a: /* lcall im */ { unsigned int selector, offset; ot = dflag ? OT_LONG : OT_WORD; offset = insn_get(s, ot); selector = insn_get(s, OT_WORD); /* push return segment + offset */ gen_op_movl_T0_seg(R_CS); gen_push_T0(s); next_eip = s->pc - s->cs_base; gen_op_movl_T0_im(next_eip); gen_push_T0(s); /* change cs and pc */ gen_op_movl_T0_im(selector); gen_movl_seg_T0(s, R_CS); gen_op_jmp_im((unsigned long)offset); s->is_jmp = 1; } break; case 0xe9: /* jmp */ ot = dflag ? OT_LONG : OT_WORD; val = insn_get(s, ot); val += s->pc - s->cs_base; if (s->dflag == 0) val = val & 0xffff; gen_op_jmp_im(val); s->is_jmp = 1; break; case 0xea: /* ljmp im */ { unsigned int selector, offset; ot = dflag ? OT_LONG : OT_WORD; offset = insn_get(s, ot); selector = insn_get(s, OT_WORD); /* change cs and pc */ gen_op_movl_T0_im(selector); gen_movl_seg_T0(s, R_CS); gen_op_jmp_im((unsigned long)offset); s->is_jmp = 1; } break; case 0xeb: /* jmp Jb */ val = (int8_t)insn_get(s, OT_BYTE); val += s->pc - s->cs_base; if (s->dflag == 0) val = val & 0xffff; gen_op_jmp_im(val); s->is_jmp = 1; break; case 0x70 ... 0x7f: /* jcc Jb */ val = (int8_t)insn_get(s, OT_BYTE); goto do_jcc; case 0x180 ... 0x18f: /* jcc Jv */ if (dflag) { val = insn_get(s, OT_LONG); } else { val = (int16_t)insn_get(s, OT_WORD); } do_jcc: next_eip = s->pc - s->cs_base; val += next_eip; if (s->dflag == 0) val &= 0xffff; gen_jcc(s, b, val, next_eip); s->is_jmp = 1; break; case 0x190 ... 0x19f: /* setcc Gv */ modrm = ldub(s->pc++); gen_setcc(s, b); gen_ldst_modrm(s, modrm, OT_BYTE, OR_TMP0, 1); break; case 0x140 ... 0x14f: /* cmov Gv, Ev */ ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; gen_setcc(s, b); if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T1_A0[ot](); } else { rm = modrm & 7; gen_op_mov_TN_reg[ot][1][rm](); } gen_op_cmov_reg_T1_T0[ot - OT_WORD][reg](); break; /************************/ /* flags */ case 0x9c: /* pushf */ if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); if (s->vm86) gen_op_movl_T0_eflags_vm(); else gen_op_movl_T0_eflags(); gen_push_T0(s); break; case 0x9d: /* popf */ gen_pop_T0(s); if (s->dflag) { if (s->vm86) gen_op_movl_eflags_T0_vm(pc_start - s->cs_base); else gen_op_movl_eflags_T0(); } else { if (s->vm86) gen_op_movw_eflags_T0_vm(pc_start - s->cs_base); else gen_op_movw_eflags_T0(); } gen_pop_update(s); s->cc_op = CC_OP_EFLAGS; break; case 0x9e: /* sahf */ gen_op_mov_TN_reg[OT_BYTE][0][R_AH](); if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_movb_eflags_T0(); s->cc_op = CC_OP_EFLAGS; break; case 0x9f: /* lahf */ if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_movl_T0_eflags(); gen_op_mov_reg_T0[OT_BYTE][R_AH](); break; case 0xf5: /* cmc */ if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_cmc(); s->cc_op = CC_OP_EFLAGS; break; case 0xf8: /* clc */ if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_clc(); s->cc_op = CC_OP_EFLAGS; break; case 0xf9: /* stc */ if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_stc(); s->cc_op = CC_OP_EFLAGS; break; case 0xfc: /* cld */ gen_op_cld(); break; case 0xfd: /* std */ gen_op_std(); break; /************************/ /* bit operations */ case 0x1ba: /* bt/bts/btr/btc Gv, im */ ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); op = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; rm = modrm & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); } else { gen_op_mov_TN_reg[ot][0][rm](); } /* load shift */ val = ldub(s->pc++); gen_op_movl_T1_im(val); if (op < 4) goto illegal_op; op -= 4; gen_op_btx_T0_T1_cc[ot - OT_WORD][op](); s->cc_op = CC_OP_SARB + ot; if (op != 0) { if (mod != 3) gen_op_st_T0_A0[ot](); else gen_op_mov_reg_T0[ot][rm](); } break; case 0x1a3: /* bt Gv, Ev */ op = 0; goto do_btx; case 0x1ab: /* bts */ op = 1; goto do_btx; case 0x1b3: /* btr */ op = 2; goto do_btx; case 0x1bb: /* btc */ op = 3; do_btx: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; rm = modrm & 7; gen_op_mov_TN_reg[OT_LONG][1][reg](); if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); /* specific case: we need to add a displacement */ if (ot == OT_WORD) gen_op_add_bitw_A0_T1(); else gen_op_add_bitl_A0_T1(); gen_op_ld_T0_A0[ot](); } else { gen_op_mov_TN_reg[ot][0][rm](); } gen_op_btx_T0_T1_cc[ot - OT_WORD][op](); s->cc_op = CC_OP_SARB + ot; if (op != 0) { if (mod != 3) gen_op_st_T0_A0[ot](); else gen_op_mov_reg_T0[ot][rm](); } break; case 0x1bc: /* bsf */ case 0x1bd: /* bsr */ ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); gen_op_bsx_T0_cc[ot - OT_WORD][b & 1](); /* NOTE: we always write back the result. Intel doc says it is undefined if T0 == 0 */ gen_op_mov_reg_T0[ot][reg](); s->cc_op = CC_OP_LOGICB + ot; break; /************************/ /* bcd */ case 0x27: /* daa */ if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_daa(); s->cc_op = CC_OP_EFLAGS; break; case 0x2f: /* das */ if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_das(); s->cc_op = CC_OP_EFLAGS; break; case 0x37: /* aaa */ if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_aaa(); s->cc_op = CC_OP_EFLAGS; break; case 0x3f: /* aas */ if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_aas(); s->cc_op = CC_OP_EFLAGS; break; case 0xd4: /* aam */ val = ldub(s->pc++); gen_op_aam(val); s->cc_op = CC_OP_LOGICB; break; case 0xd5: /* aad */ val = ldub(s->pc++); gen_op_aad(val); s->cc_op = CC_OP_LOGICB; break; /************************/ /* misc */ case 0x90: /* nop */ break; case 0xcc: /* int3 */ gen_op_int3((long)pc_start); s->is_jmp = 1; break; case 0xcd: /* int N */ val = ldub(s->pc++); gen_op_int_im(val, pc_start - s->cs_base); s->is_jmp = 1; break; case 0xce: /* into */ if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_into(); break; case 0xfa: /* cli */ if (!s->vm86) { if (s->cpl <= s->iopl) gen_op_cli(); else gen_op_gpf(pc_start - s->cs_base); } else { if (s->iopl == 3) gen_op_cli(); else gen_op_cli_vm(); } break; case 0xfb: /* sti */ if (!s->vm86) { if (s->cpl <= s->iopl) gen_op_sti(); else gen_op_gpf(pc_start - s->cs_base); } else { if (s->iopl == 3) gen_op_sti(); else gen_op_sti_vm(pc_start - s->cs_base); } break; case 0x62: /* bound */ ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; if (mod == 3) goto illegal_op; gen_op_mov_reg_T0[ot][reg](); gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); if (ot == OT_WORD) gen_op_boundw(); else gen_op_boundl(); break; case 0x1c8 ... 0x1cf: /* bswap reg */ reg = b & 7; gen_op_mov_TN_reg[OT_LONG][0][reg](); gen_op_bswapl_T0(); gen_op_mov_reg_T0[OT_LONG][reg](); break; case 0xd6: /* salc */ if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_salc(); break; case 0xe0: /* loopnz */ case 0xe1: /* loopz */ if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); /* FALL THRU */ case 0xe2: /* loop */ case 0xe3: /* jecxz */ val = (int8_t)insn_get(s, OT_BYTE); next_eip = s->pc - s->cs_base; val += next_eip; if (s->dflag == 0) val &= 0xffff; gen_op_loop[s->aflag][b & 3](val, next_eip); s->is_jmp = 1; break; case 0x131: /* rdtsc */ gen_op_rdtsc(); break; case 0x1a2: /* cpuid */ gen_op_cpuid(); break; case 0xf4: /* hlt */ if (s->cpl == 0) { /* ignored */ } else { gen_op_gpf(pc_start - s->cs_base); } break; default: goto illegal_op; } /* lock generation */ if (s->prefix & PREFIX_LOCK) gen_op_unlock(); return (long)s->pc; illegal_op: /* XXX: ensure that no lock was generated */ return -1; }
true
qemu
148dfc2a8be0b237ef80b4d421f549464aa6a3d0
long disas_insn(DisasContext *s, uint8_t *pc_start) { int b, prefixes, aflag, dflag; int shift, ot; int modrm, reg, rm, mod, reg_addr, op, opreg, offset_addr, val; unsigned int next_eip; s->pc = pc_start; prefixes = 0; aflag = s->code32; dflag = s->code32; s->override = -1; next_byte: b = ldub(s->pc); s->pc++; switch (b) { case 0xf3: prefixes |= PREFIX_REPZ; goto next_byte; case 0xf2: prefixes |= PREFIX_REPNZ; goto next_byte; case 0xf0: prefixes |= PREFIX_LOCK; goto next_byte; case 0x2e: s->override = R_CS; goto next_byte; case 0x36: s->override = R_SS; goto next_byte; case 0x3e: s->override = R_DS; goto next_byte; case 0x26: s->override = R_ES; goto next_byte; case 0x64: s->override = R_FS; goto next_byte; case 0x65: s->override = R_GS; goto next_byte; case 0x66: prefixes |= PREFIX_DATA; goto next_byte; case 0x67: prefixes |= PREFIX_ADR; goto next_byte; case 0x9b: prefixes |= PREFIX_FWAIT; goto next_byte; } if (prefixes & PREFIX_DATA) dflag ^= 1; if (prefixes & PREFIX_ADR) aflag ^= 1; s->prefix = prefixes; s->aflag = aflag; s->dflag = dflag; if (prefixes & PREFIX_LOCK) gen_op_lock(); reswitch: switch(b) { case 0x0f: b = ldub(s->pc++) | 0x100; goto reswitch; case 0x00 ... 0x05: case 0x08 ... 0x0d: case 0x10 ... 0x15: case 0x18 ... 0x1d: case 0x20 ... 0x25: case 0x28 ... 0x2d: case 0x30 ... 0x35: case 0x38 ... 0x3d: { int op, f, val; op = (b >> 3) & 7; f = (b >> 1) & 3; if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; switch(f) { case 0: modrm = ldub(s->pc++); reg = ((modrm >> 3) & 7) + OR_EAX; mod = (modrm >> 6) & 3; rm = modrm & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); opreg = OR_TMP0; } else { opreg = OR_EAX + rm; } gen_op(s, op, ot, opreg, reg); if (mod != 3 && op != 7) { gen_op_st_T0_A0[ot](); } break; case 1: modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; reg = ((modrm >> 3) & 7) + OR_EAX; rm = modrm & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T1_A0[ot](); opreg = OR_TMP1; } else { opreg = OR_EAX + rm; } gen_op(s, op, ot, reg, opreg); break; case 2: val = insn_get(s, ot); gen_opi(s, op, ot, OR_EAX, val); break; } } break; case 0x80: case 0x81: case 0x83: { int val; if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; op = (modrm >> 3) & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); opreg = OR_TMP0; } else { opreg = rm + OR_EAX; } switch(b) { default: case 0x80: case 0x81: val = insn_get(s, ot); break; case 0x83: val = (int8_t)insn_get(s, OT_BYTE); break; } gen_opi(s, op, ot, opreg, val); if (op != 7 && mod != 3) { gen_op_st_T0_A0[ot](); } } break; case 0x40 ... 0x47: ot = dflag ? OT_LONG : OT_WORD; gen_inc(s, ot, OR_EAX + (b & 7), 1); break; case 0x48 ... 0x4f: ot = dflag ? OT_LONG : OT_WORD; gen_inc(s, ot, OR_EAX + (b & 7), -1); break; case 0xf6: case 0xf7: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; op = (modrm >> 3) & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); } else { gen_op_mov_TN_reg[ot][0][rm](); } switch(op) { case 0: val = insn_get(s, ot); gen_op_movl_T1_im(val); gen_op_testl_T0_T1_cc(); s->cc_op = CC_OP_LOGICB + ot; break; case 2: gen_op_notl_T0(); if (mod != 3) { gen_op_st_T0_A0[ot](); } else { gen_op_mov_reg_T0[ot][rm](); } break; case 3: gen_op_negl_T0_cc(); if (mod != 3) { gen_op_st_T0_A0[ot](); } else { gen_op_mov_reg_T0[ot][rm](); } s->cc_op = CC_OP_SUBB + ot; break; case 4: switch(ot) { case OT_BYTE: gen_op_mulb_AL_T0(); break; case OT_WORD: gen_op_mulw_AX_T0(); break; default: case OT_LONG: gen_op_mull_EAX_T0(); break; } s->cc_op = CC_OP_MUL; break; case 5: switch(ot) { case OT_BYTE: gen_op_imulb_AL_T0(); break; case OT_WORD: gen_op_imulw_AX_T0(); break; default: case OT_LONG: gen_op_imull_EAX_T0(); break; } s->cc_op = CC_OP_MUL; break; case 6: switch(ot) { case OT_BYTE: gen_op_divb_AL_T0(); break; case OT_WORD: gen_op_divw_AX_T0(); break; default: case OT_LONG: gen_op_divl_EAX_T0(); break; } break; case 7: switch(ot) { case OT_BYTE: gen_op_idivb_AL_T0(); break; case OT_WORD: gen_op_idivw_AX_T0(); break; default: case OT_LONG: gen_op_idivl_EAX_T0(); break; } break; default: goto illegal_op; } break; case 0xfe: case 0xff: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; op = (modrm >> 3) & 7; if (op >= 2 && b == 0xfe) { goto illegal_op; } if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); if (op != 3 && op != 5) gen_op_ld_T0_A0[ot](); } else { gen_op_mov_TN_reg[ot][0][rm](); } switch(op) { case 0: gen_inc(s, ot, OR_TMP0, 1); if (mod != 3) gen_op_st_T0_A0[ot](); else gen_op_mov_reg_T0[ot][rm](); break; case 1: gen_inc(s, ot, OR_TMP0, -1); if (mod != 3) gen_op_st_T0_A0[ot](); else gen_op_mov_reg_T0[ot][rm](); break; case 2: if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); next_eip = s->pc - s->cs_base; gen_op_movl_T0_im(next_eip); gen_push_T0(s); s->is_jmp = 1; break; case 3: gen_op_movl_T0_seg(R_CS); gen_push_T0(s); next_eip = s->pc - s->cs_base; gen_op_movl_T0_im(next_eip); gen_push_T0(s); gen_op_ld_T1_A0[ot](); gen_op_addl_A0_im(1 << (ot - OT_WORD + 1)); gen_op_lduw_T0_A0(); gen_movl_seg_T0(s, R_CS); gen_op_movl_T0_T1(); gen_op_jmp_T0(); s->is_jmp = 1; break; case 4: if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); s->is_jmp = 1; break; case 5: gen_op_ld_T1_A0[ot](); gen_op_addl_A0_im(1 << (ot - OT_WORD + 1)); gen_op_lduw_T0_A0(); gen_movl_seg_T0(s, R_CS); gen_op_movl_T0_T1(); gen_op_jmp_T0(); s->is_jmp = 1; break; case 6: gen_push_T0(s); break; default: goto illegal_op; } break; case 0x84: case 0x85: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; reg = (modrm >> 3) & 7; gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); gen_op_mov_TN_reg[ot][1][reg + OR_EAX](); gen_op_testl_T0_T1_cc(); s->cc_op = CC_OP_LOGICB + ot; break; case 0xa8: case 0xa9: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; val = insn_get(s, ot); gen_op_mov_TN_reg[ot][0][OR_EAX](); gen_op_movl_T1_im(val); gen_op_testl_T0_T1_cc(); s->cc_op = CC_OP_LOGICB + ot; break; case 0x98: if (dflag) gen_op_movswl_EAX_AX(); else gen_op_movsbw_AX_AL(); break; case 0x99: if (dflag) gen_op_movslq_EDX_EAX(); else gen_op_movswl_DX_AX(); break; case 0x1af: case 0x69: case 0x6b: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = ((modrm >> 3) & 7) + OR_EAX; gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); if (b == 0x69) { val = insn_get(s, ot); gen_op_movl_T1_im(val); } else if (b == 0x6b) { val = insn_get(s, OT_BYTE); gen_op_movl_T1_im(val); } else { gen_op_mov_TN_reg[ot][1][reg](); } if (ot == OT_LONG) { gen_op_imull_T0_T1(); } else { gen_op_imulw_T0_T1(); } gen_op_mov_reg_T0[ot][reg](); s->cc_op = CC_OP_MUL; break; case 0x1c0: case 0x1c1: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; if (mod == 3) { rm = modrm & 7; gen_op_mov_TN_reg[ot][0][reg](); gen_op_mov_TN_reg[ot][1][rm](); gen_op_addl_T0_T1_cc(); gen_op_mov_reg_T0[ot][rm](); gen_op_mov_reg_T1[ot][reg](); } else { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_mov_TN_reg[ot][0][reg](); gen_op_ld_T1_A0[ot](); gen_op_addl_T0_T1_cc(); gen_op_st_T0_A0[ot](); gen_op_mov_reg_T1[ot][reg](); } s->cc_op = CC_OP_ADDB + ot; break; case 0x1b0: case 0x1b1: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; gen_op_mov_TN_reg[ot][1][reg](); if (mod == 3) { rm = modrm & 7; gen_op_mov_TN_reg[ot][0][rm](); gen_op_cmpxchg_T0_T1_EAX_cc[ot](); gen_op_mov_reg_T0[ot][rm](); } else { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); gen_op_cmpxchg_T0_T1_EAX_cc[ot](); gen_op_st_T0_A0[ot](); } s->cc_op = CC_OP_SUBB + ot; break; case 0x1c7: modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; if (mod == 3) goto illegal_op; if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_cmpxchg8b(); s->cc_op = CC_OP_EFLAGS; break; case 0x50 ... 0x57: gen_op_mov_TN_reg[OT_LONG][0][b & 7](); gen_push_T0(s); break; case 0x58 ... 0x5f: ot = dflag ? OT_LONG : OT_WORD; gen_pop_T0(s); gen_op_mov_reg_T0[ot][b & 7](); gen_pop_update(s); break; case 0x60: gen_pusha(s); break; case 0x61: gen_popa(s); break; case 0x68: case 0x6a: ot = dflag ? OT_LONG : OT_WORD; if (b == 0x68) val = insn_get(s, ot); else val = (int8_t)insn_get(s, OT_BYTE); gen_op_movl_T0_im(val); gen_push_T0(s); break; case 0x8f: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); gen_pop_T0(s); gen_ldst_modrm(s, modrm, ot, OR_TMP0, 1); gen_pop_update(s); break; case 0xc8: { int level; val = lduw(s->pc); s->pc += 2; level = ldub(s->pc++); gen_enter(s, val, level); } break; case 0xc9: if (s->ss32) { gen_op_mov_TN_reg[OT_LONG][0][R_EBP](); gen_op_mov_reg_T0[OT_LONG][R_ESP](); } else { gen_op_mov_TN_reg[OT_WORD][0][R_EBP](); gen_op_mov_reg_T0[OT_WORD][R_ESP](); } gen_pop_T0(s); ot = dflag ? OT_LONG : OT_WORD; gen_op_mov_reg_T0[ot][R_EBP](); gen_pop_update(s); break; case 0x06: case 0x0e: case 0x16: case 0x1e: gen_op_movl_T0_seg(b >> 3); gen_push_T0(s); break; case 0x1a0: case 0x1a8: gen_op_movl_T0_seg((b >> 3) & 7); gen_push_T0(s); break; case 0x07: case 0x17: case 0x1f: gen_pop_T0(s); gen_movl_seg_T0(s, b >> 3); gen_pop_update(s); break; case 0x1a1: case 0x1a9: gen_pop_T0(s); gen_movl_seg_T0(s, (b >> 3) & 7); gen_pop_update(s); break; case 0x88: case 0x89: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; gen_ldst_modrm(s, modrm, ot, OR_EAX + reg, 1); break; case 0xc6: case 0xc7: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; if (mod != 3) gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); val = insn_get(s, ot); gen_op_movl_T0_im(val); if (mod != 3) gen_op_st_T0_A0[ot](); else gen_op_mov_reg_T0[ot][modrm & 7](); break; case 0x8a: case 0x8b: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); gen_op_mov_reg_T0[ot][reg](); break; case 0x8e: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); if (reg >= 6 || reg == R_CS) goto illegal_op; gen_movl_seg_T0(s, reg); break; case 0x8c: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; if (reg >= 6) goto illegal_op; gen_op_movl_T0_seg(reg); gen_ldst_modrm(s, modrm, ot, OR_TMP0, 1); break; case 0x1b6: case 0x1b7: case 0x1be: case 0x1bf: { int d_ot; d_ot = dflag + OT_WORD; ot = (b & 1) + OT_BYTE; modrm = ldub(s->pc++); reg = ((modrm >> 3) & 7) + OR_EAX; mod = (modrm >> 6) & 3; rm = modrm & 7; if (mod == 3) { gen_op_mov_TN_reg[ot][0][rm](); switch(ot | (b & 8)) { case OT_BYTE: gen_op_movzbl_T0_T0(); break; case OT_BYTE | 8: gen_op_movsbl_T0_T0(); break; case OT_WORD: gen_op_movzwl_T0_T0(); break; default: case OT_WORD | 8: gen_op_movswl_T0_T0(); break; } gen_op_mov_reg_T0[d_ot][reg](); } else { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); if (b & 8) { gen_op_lds_T0_A0[ot](); } else { gen_op_ldu_T0_A0[ot](); } gen_op_mov_reg_T0[d_ot][reg](); } } break; case 0x8d: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; s->override = -1; val = s->addseg; s->addseg = 0; gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); s->addseg = val; gen_op_mov_reg_A0[ot - OT_WORD][reg](); break; case 0xa0: case 0xa1: case 0xa2: case 0xa3: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (s->aflag) offset_addr = insn_get(s, OT_LONG); else offset_addr = insn_get(s, OT_WORD); gen_op_movl_A0_im(offset_addr); { int override, must_add_seg; must_add_seg = s->addseg; if (s->override >= 0) { override = s->override; must_add_seg = 1; } else { override = R_DS; } if (must_add_seg) { gen_op_addl_A0_seg(offsetof(CPUX86State,seg_cache[override].base)); } } if ((b & 2) == 0) { gen_op_ld_T0_A0[ot](); gen_op_mov_reg_T0[ot][R_EAX](); } else { gen_op_mov_TN_reg[ot][0][R_EAX](); gen_op_st_T0_A0[ot](); } break; case 0xd7: gen_op_movl_A0_reg[R_EBX](); gen_op_addl_A0_AL(); if (s->aflag == 0) gen_op_andl_A0_ffff(); { int override, must_add_seg; must_add_seg = s->addseg; override = R_DS; if (s->override >= 0) { override = s->override; must_add_seg = 1; } else { override = R_DS; } if (must_add_seg) { gen_op_addl_A0_seg(offsetof(CPUX86State,seg_cache[override].base)); } } gen_op_ldub_T0_A0(); gen_op_mov_reg_T0[OT_BYTE][R_EAX](); break; case 0xb0 ... 0xb7: val = insn_get(s, OT_BYTE); gen_op_movl_T0_im(val); gen_op_mov_reg_T0[OT_BYTE][b & 7](); break; case 0xb8 ... 0xbf: ot = dflag ? OT_LONG : OT_WORD; val = insn_get(s, ot); reg = OR_EAX + (b & 7); gen_op_movl_T0_im(val); gen_op_mov_reg_T0[ot][reg](); break; case 0x91 ... 0x97: ot = dflag ? OT_LONG : OT_WORD; reg = b & 7; rm = R_EAX; goto do_xchg_reg; case 0x86: case 0x87: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; if (mod == 3) { rm = modrm & 7; do_xchg_reg: gen_op_mov_TN_reg[ot][0][reg](); gen_op_mov_TN_reg[ot][1][rm](); gen_op_mov_reg_T0[ot][rm](); gen_op_mov_reg_T1[ot][reg](); } else { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_mov_TN_reg[ot][0][reg](); if (!(prefixes & PREFIX_LOCK)) gen_op_lock(); gen_op_ld_T1_A0[ot](); gen_op_st_T0_A0[ot](); if (!(prefixes & PREFIX_LOCK)) gen_op_unlock(); gen_op_mov_reg_T1[ot][reg](); } break; case 0xc4: op = R_ES; goto do_lxx; case 0xc5: op = R_DS; goto do_lxx; case 0x1b2: op = R_SS; goto do_lxx; case 0x1b4: op = R_FS; goto do_lxx; case 0x1b5: op = R_GS; do_lxx: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; if (mod == 3) goto illegal_op; gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T1_A0[ot](); gen_op_addl_A0_im(1 << (ot - OT_WORD + 1)); gen_op_lduw_T0_A0(); gen_movl_seg_T0(s, op); gen_op_mov_reg_T1[ot][reg](); break; case 0xc0: case 0xc1: shift = 2; grp2: { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; op = (modrm >> 3) & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); opreg = OR_TMP0; } else { opreg = rm + OR_EAX; } if (shift == 0) { gen_shift(s, op, ot, opreg, OR_ECX); } else { if (shift == 2) { shift = ldub(s->pc++); } gen_shifti(s, op, ot, opreg, shift); } if (mod != 3) { gen_op_st_T0_A0[ot](); } } break; case 0xd0: case 0xd1: shift = 1; goto grp2; case 0xd2: case 0xd3: shift = 0; goto grp2; case 0x1a4: op = 0; shift = 1; goto do_shiftd; case 0x1a5: op = 0; shift = 0; goto do_shiftd; case 0x1ac: op = 1; shift = 1; goto do_shiftd; case 0x1ad: op = 1; shift = 0; do_shiftd: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; reg = (modrm >> 3) & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); } else { gen_op_mov_TN_reg[ot][0][rm](); } gen_op_mov_TN_reg[ot][1][reg](); if (shift) { val = ldub(s->pc++); val &= 0x1f; if (val) { gen_op_shiftd_T0_T1_im_cc[ot - OT_WORD][op](val); if (op == 0 && ot != OT_WORD) s->cc_op = CC_OP_SHLB + ot; else s->cc_op = CC_OP_SARB + ot; } } else { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_shiftd_T0_T1_ECX_cc[ot - OT_WORD][op](); s->cc_op = CC_OP_DYNAMIC; } if (mod != 3) { gen_op_st_T0_A0[ot](); } else { gen_op_mov_reg_T0[ot][rm](); } break; case 0xd8 ... 0xdf: modrm = ldub(s->pc++); mod = (modrm >> 6) & 3; rm = modrm & 7; op = ((b & 7) << 3) | ((modrm >> 3) & 7); if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); switch(op) { case 0x00 ... 0x07: case 0x10 ... 0x17: case 0x20 ... 0x27: case 0x30 ... 0x37: { int op1; op1 = op & 7; switch(op >> 4) { case 0: gen_op_flds_FT0_A0(); break; case 1: gen_op_fildl_FT0_A0(); break; case 2: gen_op_fldl_FT0_A0(); break; case 3: default: gen_op_fild_FT0_A0(); break; } gen_op_fp_arith_ST0_FT0[op1](); if (op1 == 3) { gen_op_fpop(); } } break; case 0x08: case 0x0a: case 0x0b: case 0x18: case 0x1a: case 0x1b: case 0x28: case 0x2a: case 0x2b: case 0x38: case 0x3a: case 0x3b: switch(op & 7) { case 0: gen_op_fpush(); switch(op >> 4) { case 0: gen_op_flds_ST0_A0(); break; case 1: gen_op_fildl_ST0_A0(); break; case 2: gen_op_fldl_ST0_A0(); break; case 3: default: gen_op_fild_ST0_A0(); break; } break; default: switch(op >> 4) { case 0: gen_op_fsts_ST0_A0(); break; case 1: gen_op_fistl_ST0_A0(); break; case 2: gen_op_fstl_ST0_A0(); break; case 3: default: gen_op_fist_ST0_A0(); break; } if ((op & 7) == 3) gen_op_fpop(); break; } break; case 0x0d: gen_op_fldcw_A0(); break; case 0x0f: gen_op_fnstcw_A0(); break; case 0x1d: gen_op_fpush(); gen_op_fldt_ST0_A0(); break; case 0x1f: gen_op_fstt_ST0_A0(); gen_op_fpop(); break; case 0x2f: gen_op_fnstsw_A0(); break; case 0x3c: gen_op_fpush(); gen_op_fbld_ST0_A0(); break; case 0x3e: gen_op_fbst_ST0_A0(); gen_op_fpop(); break; case 0x3d: gen_op_fpush(); gen_op_fildll_ST0_A0(); break; case 0x3f: gen_op_fistll_ST0_A0(); gen_op_fpop(); break; default: goto illegal_op; } } else { opreg = rm; switch(op) { case 0x08: gen_op_fpush(); gen_op_fmov_ST0_STN((opreg + 1) & 7); break; case 0x09: gen_op_fxchg_ST0_STN(opreg); break; case 0x0a: switch(rm) { case 0: break; default: goto illegal_op; } break; case 0x0c: switch(rm) { case 0: gen_op_fchs_ST0(); break; case 1: gen_op_fabs_ST0(); break; case 4: gen_op_fldz_FT0(); gen_op_fcom_ST0_FT0(); break; case 5: gen_op_fxam_ST0(); break; default: goto illegal_op; } break; case 0x0d: { switch(rm) { case 0: gen_op_fpush(); gen_op_fld1_ST0(); break; case 1: gen_op_fpush(); gen_op_fldl2t_ST0(); break; case 2: gen_op_fpush(); gen_op_fldl2e_ST0(); break; case 3: gen_op_fpush(); gen_op_fldpi_ST0(); break; case 4: gen_op_fpush(); gen_op_fldlg2_ST0(); break; case 5: gen_op_fpush(); gen_op_fldln2_ST0(); break; case 6: gen_op_fpush(); gen_op_fldz_ST0(); break; default: goto illegal_op; } } break; case 0x0e: switch(rm) { case 0: gen_op_f2xm1(); break; case 1: gen_op_fyl2x(); break; case 2: gen_op_fptan(); break; case 3: gen_op_fpatan(); break; case 4: gen_op_fxtract(); break; case 5: gen_op_fprem1(); break; case 6: gen_op_fdecstp(); break; default: case 7: gen_op_fincstp(); break; } break; case 0x0f: switch(rm) { case 0: gen_op_fprem(); break; case 1: gen_op_fyl2xp1(); break; case 2: gen_op_fsqrt(); break; case 3: gen_op_fsincos(); break; case 5: gen_op_fscale(); break; case 4: gen_op_frndint(); break; case 6: gen_op_fsin(); break; default: case 7: gen_op_fcos(); break; } break; case 0x00: case 0x01: case 0x04 ... 0x07: case 0x20: case 0x21: case 0x24 ... 0x27: case 0x30: case 0x31: case 0x34 ... 0x37: { int op1; op1 = op & 7; if (op >= 0x20) { gen_op_fp_arith_STN_ST0[op1](opreg); if (op >= 0x30) gen_op_fpop(); } else { gen_op_fmov_FT0_STN(opreg); gen_op_fp_arith_ST0_FT0[op1](); } } break; case 0x02: gen_op_fmov_FT0_STN(opreg); gen_op_fcom_ST0_FT0(); break; case 0x03: gen_op_fmov_FT0_STN(opreg); gen_op_fcom_ST0_FT0(); gen_op_fpop(); break; case 0x15: switch(rm) { case 1: gen_op_fmov_FT0_STN(1); gen_op_fucom_ST0_FT0(); gen_op_fpop(); gen_op_fpop(); break; default: goto illegal_op; } break; case 0x1c: switch(rm) { case 2: gen_op_fclex(); break; case 3: gen_op_fninit(); break; default: goto illegal_op; } break; case 0x2a: gen_op_fmov_STN_ST0(opreg); break; case 0x2b: gen_op_fmov_STN_ST0(opreg); gen_op_fpop(); break; case 0x2c: gen_op_fmov_FT0_STN(opreg); gen_op_fucom_ST0_FT0(); break; case 0x2d: gen_op_fmov_FT0_STN(opreg); gen_op_fucom_ST0_FT0(); gen_op_fpop(); break; case 0x33: switch(rm) { case 1: gen_op_fmov_FT0_STN(1); gen_op_fcom_ST0_FT0(); gen_op_fpop(); gen_op_fpop(); break; default: goto illegal_op; } break; case 0x3c: switch(rm) { case 0: gen_op_fnstsw_EAX(); break; default: goto illegal_op; } break; default: goto illegal_op; } } break; case 0xa4: case 0xa5: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPZ) { gen_string_ds(s, ot, gen_op_movs + 9); } else { gen_string_ds(s, ot, gen_op_movs); } break; case 0xaa: case 0xab: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPZ) { gen_string_es(s, ot, gen_op_stos + 9); } else { gen_string_es(s, ot, gen_op_stos); } break; case 0xac: case 0xad: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPZ) { gen_string_ds(s, ot, gen_op_lods + 9); } else { gen_string_ds(s, ot, gen_op_lods); } break; case 0xae: case 0xaf: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPNZ) { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_string_es(s, ot, gen_op_scas + 9 * 2); s->cc_op = CC_OP_DYNAMIC; } else if (prefixes & PREFIX_REPZ) { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_string_es(s, ot, gen_op_scas + 9); s->cc_op = CC_OP_DYNAMIC; } else { gen_string_es(s, ot, gen_op_scas); s->cc_op = CC_OP_SUBB + ot; } break; case 0xa6: case 0xa7: if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPNZ) { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_string_ds(s, ot, gen_op_cmps + 9 * 2); s->cc_op = CC_OP_DYNAMIC; } else if (prefixes & PREFIX_REPZ) { if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_string_ds(s, ot, gen_op_cmps + 9); s->cc_op = CC_OP_DYNAMIC; } else { gen_string_ds(s, ot, gen_op_cmps); s->cc_op = CC_OP_SUBB + ot; } break; case 0x6c: case 0x6d: if (s->cpl > s->iopl || s->vm86) { gen_op_gpf(pc_start - s->cs_base); } else { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPZ) { gen_string_es(s, ot, gen_op_ins + 9); } else { gen_string_es(s, ot, gen_op_ins); } } break; case 0x6e: case 0x6f: if (s->cpl > s->iopl || s->vm86) { gen_op_gpf(pc_start - s->cs_base); } else { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; if (prefixes & PREFIX_REPZ) { gen_string_ds(s, ot, gen_op_outs + 9); } else { gen_string_ds(s, ot, gen_op_outs); } } break; case 0xe4: case 0xe5: if (s->cpl > s->iopl || s->vm86) { gen_op_gpf(pc_start - s->cs_base); } else { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; val = ldub(s->pc++); gen_op_movl_T0_im(val); gen_op_in[ot](); gen_op_mov_reg_T1[ot][R_EAX](); } break; case 0xe6: case 0xe7: if (s->cpl > s->iopl || s->vm86) { gen_op_gpf(pc_start - s->cs_base); } else { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; val = ldub(s->pc++); gen_op_movl_T0_im(val); gen_op_mov_TN_reg[ot][1][R_EAX](); gen_op_out[ot](); } break; case 0xec: case 0xed: if (s->cpl > s->iopl || s->vm86) { gen_op_gpf(pc_start - s->cs_base); } else { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; gen_op_mov_TN_reg[OT_WORD][0][R_EDX](); gen_op_in[ot](); gen_op_mov_reg_T1[ot][R_EAX](); } break; case 0xee: case 0xef: if (s->cpl > s->iopl || s->vm86) { gen_op_gpf(pc_start - s->cs_base); } else { if ((b & 1) == 0) ot = OT_BYTE; else ot = dflag ? OT_LONG : OT_WORD; gen_op_mov_TN_reg[OT_WORD][0][R_EDX](); gen_op_mov_TN_reg[ot][1][R_EAX](); gen_op_out[ot](); } break; case 0xc2: val = ldsw(s->pc); s->pc += 2; gen_pop_T0(s); if (s->ss32) gen_op_addl_ESP_im(val + (2 << s->dflag)); else gen_op_addw_ESP_im(val + (2 << s->dflag)); if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); s->is_jmp = 1; break; case 0xc3: gen_pop_T0(s); gen_pop_update(s); if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); s->is_jmp = 1; break; case 0xca: val = ldsw(s->pc); s->pc += 2; gen_pop_T0(s); if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); gen_pop_update(s); gen_pop_T0(s); gen_movl_seg_T0(s, R_CS); gen_pop_update(s); if (s->ss32) gen_op_addl_ESP_im(val + (2 << s->dflag)); else gen_op_addw_ESP_im(val + (2 << s->dflag)); s->is_jmp = 1; break; case 0xcb: gen_pop_T0(s); if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); gen_pop_update(s); gen_pop_T0(s); gen_movl_seg_T0(s, R_CS); gen_pop_update(s); s->is_jmp = 1; break; case 0xcf: gen_pop_T0(s); if (s->dflag == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); gen_pop_update(s); gen_pop_T0(s); gen_movl_seg_T0(s, R_CS); gen_pop_update(s); gen_pop_T0(s); if (s->dflag) { if (s->vm86) gen_op_movl_eflags_T0_vm(pc_start - s->cs_base); else gen_op_movl_eflags_T0(); } else { if (s->vm86) gen_op_movw_eflags_T0_vm(pc_start - s->cs_base); else gen_op_movw_eflags_T0(); } gen_pop_update(s); s->cc_op = CC_OP_EFLAGS; s->is_jmp = 1; break; case 0xe8: { unsigned int next_eip; ot = dflag ? OT_LONG : OT_WORD; val = insn_get(s, ot); next_eip = s->pc - s->cs_base; val += next_eip; if (s->dflag == 0) val &= 0xffff; gen_op_movl_T0_im(next_eip); gen_push_T0(s); gen_op_jmp_im(val); s->is_jmp = 1; } break; case 0x9a: { unsigned int selector, offset; ot = dflag ? OT_LONG : OT_WORD; offset = insn_get(s, ot); selector = insn_get(s, OT_WORD); gen_op_movl_T0_seg(R_CS); gen_push_T0(s); next_eip = s->pc - s->cs_base; gen_op_movl_T0_im(next_eip); gen_push_T0(s); gen_op_movl_T0_im(selector); gen_movl_seg_T0(s, R_CS); gen_op_jmp_im((unsigned long)offset); s->is_jmp = 1; } break; case 0xe9: ot = dflag ? OT_LONG : OT_WORD; val = insn_get(s, ot); val += s->pc - s->cs_base; if (s->dflag == 0) val = val & 0xffff; gen_op_jmp_im(val); s->is_jmp = 1; break; case 0xea: { unsigned int selector, offset; ot = dflag ? OT_LONG : OT_WORD; offset = insn_get(s, ot); selector = insn_get(s, OT_WORD); gen_op_movl_T0_im(selector); gen_movl_seg_T0(s, R_CS); gen_op_jmp_im((unsigned long)offset); s->is_jmp = 1; } break; case 0xeb: val = (int8_t)insn_get(s, OT_BYTE); val += s->pc - s->cs_base; if (s->dflag == 0) val = val & 0xffff; gen_op_jmp_im(val); s->is_jmp = 1; break; case 0x70 ... 0x7f: val = (int8_t)insn_get(s, OT_BYTE); goto do_jcc; case 0x180 ... 0x18f: if (dflag) { val = insn_get(s, OT_LONG); } else { val = (int16_t)insn_get(s, OT_WORD); } do_jcc: next_eip = s->pc - s->cs_base; val += next_eip; if (s->dflag == 0) val &= 0xffff; gen_jcc(s, b, val, next_eip); s->is_jmp = 1; break; case 0x190 ... 0x19f: modrm = ldub(s->pc++); gen_setcc(s, b); gen_ldst_modrm(s, modrm, OT_BYTE, OR_TMP0, 1); break; case 0x140 ... 0x14f: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; gen_setcc(s, b); if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T1_A0[ot](); } else { rm = modrm & 7; gen_op_mov_TN_reg[ot][1][rm](); } gen_op_cmov_reg_T1_T0[ot - OT_WORD][reg](); break; case 0x9c: if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); if (s->vm86) gen_op_movl_T0_eflags_vm(); else gen_op_movl_T0_eflags(); gen_push_T0(s); break; case 0x9d: gen_pop_T0(s); if (s->dflag) { if (s->vm86) gen_op_movl_eflags_T0_vm(pc_start - s->cs_base); else gen_op_movl_eflags_T0(); } else { if (s->vm86) gen_op_movw_eflags_T0_vm(pc_start - s->cs_base); else gen_op_movw_eflags_T0(); } gen_pop_update(s); s->cc_op = CC_OP_EFLAGS; break; case 0x9e: gen_op_mov_TN_reg[OT_BYTE][0][R_AH](); if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_movb_eflags_T0(); s->cc_op = CC_OP_EFLAGS; break; case 0x9f: if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_movl_T0_eflags(); gen_op_mov_reg_T0[OT_BYTE][R_AH](); break; case 0xf5: if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_cmc(); s->cc_op = CC_OP_EFLAGS; break; case 0xf8: if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_clc(); s->cc_op = CC_OP_EFLAGS; break; case 0xf9: if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_stc(); s->cc_op = CC_OP_EFLAGS; break; case 0xfc: gen_op_cld(); break; case 0xfd: gen_op_std(); break; case 0x1ba: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); op = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; rm = modrm & 7; if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); gen_op_ld_T0_A0[ot](); } else { gen_op_mov_TN_reg[ot][0][rm](); } val = ldub(s->pc++); gen_op_movl_T1_im(val); if (op < 4) goto illegal_op; op -= 4; gen_op_btx_T0_T1_cc[ot - OT_WORD][op](); s->cc_op = CC_OP_SARB + ot; if (op != 0) { if (mod != 3) gen_op_st_T0_A0[ot](); else gen_op_mov_reg_T0[ot][rm](); } break; case 0x1a3: op = 0; goto do_btx; case 0x1ab: op = 1; goto do_btx; case 0x1b3: op = 2; goto do_btx; case 0x1bb: op = 3; do_btx: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; rm = modrm & 7; gen_op_mov_TN_reg[OT_LONG][1][reg](); if (mod != 3) { gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); if (ot == OT_WORD) gen_op_add_bitw_A0_T1(); else gen_op_add_bitl_A0_T1(); gen_op_ld_T0_A0[ot](); } else { gen_op_mov_TN_reg[ot][0][rm](); } gen_op_btx_T0_T1_cc[ot - OT_WORD][op](); s->cc_op = CC_OP_SARB + ot; if (op != 0) { if (mod != 3) gen_op_st_T0_A0[ot](); else gen_op_mov_reg_T0[ot][rm](); } break; case 0x1bc: case 0x1bd: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0); gen_op_bsx_T0_cc[ot - OT_WORD][b & 1](); gen_op_mov_reg_T0[ot][reg](); s->cc_op = CC_OP_LOGICB + ot; break; case 0x27: if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_daa(); s->cc_op = CC_OP_EFLAGS; break; case 0x2f: if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_das(); s->cc_op = CC_OP_EFLAGS; break; case 0x37: if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_aaa(); s->cc_op = CC_OP_EFLAGS; break; case 0x3f: if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_aas(); s->cc_op = CC_OP_EFLAGS; break; case 0xd4: val = ldub(s->pc++); gen_op_aam(val); s->cc_op = CC_OP_LOGICB; break; case 0xd5: val = ldub(s->pc++); gen_op_aad(val); s->cc_op = CC_OP_LOGICB; break; case 0x90: break; case 0xcc: gen_op_int3((long)pc_start); s->is_jmp = 1; break; case 0xcd: val = ldub(s->pc++); gen_op_int_im(val, pc_start - s->cs_base); s->is_jmp = 1; break; case 0xce: if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_into(); break; case 0xfa: if (!s->vm86) { if (s->cpl <= s->iopl) gen_op_cli(); else gen_op_gpf(pc_start - s->cs_base); } else { if (s->iopl == 3) gen_op_cli(); else gen_op_cli_vm(); } break; case 0xfb: if (!s->vm86) { if (s->cpl <= s->iopl) gen_op_sti(); else gen_op_gpf(pc_start - s->cs_base); } else { if (s->iopl == 3) gen_op_sti(); else gen_op_sti_vm(pc_start - s->cs_base); } break; case 0x62: ot = dflag ? OT_LONG : OT_WORD; modrm = ldub(s->pc++); reg = (modrm >> 3) & 7; mod = (modrm >> 6) & 3; if (mod == 3) goto illegal_op; gen_op_mov_reg_T0[ot][reg](); gen_lea_modrm(s, modrm, &reg_addr, &offset_addr); if (ot == OT_WORD) gen_op_boundw(); else gen_op_boundl(); break; case 0x1c8 ... 0x1cf: reg = b & 7; gen_op_mov_TN_reg[OT_LONG][0][reg](); gen_op_bswapl_T0(); gen_op_mov_reg_T0[OT_LONG][reg](); break; case 0xd6: if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_op_salc(); break; case 0xe0: case 0xe1: if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); case 0xe2: case 0xe3: val = (int8_t)insn_get(s, OT_BYTE); next_eip = s->pc - s->cs_base; val += next_eip; if (s->dflag == 0) val &= 0xffff; gen_op_loop[s->aflag][b & 3](val, next_eip); s->is_jmp = 1; break; case 0x131: gen_op_rdtsc(); break; case 0x1a2: gen_op_cpuid(); break; case 0xf4: if (s->cpl == 0) { } else { gen_op_gpf(pc_start - s->cs_base); } break; default: goto illegal_op; } if (s->prefix & PREFIX_LOCK) gen_op_unlock(); return (long)s->pc; illegal_op: return -1; }
{ "code": [ " gen_op_addl_ESP_im(val + (2 << s->dflag));", " gen_op_addw_ESP_im(val + (2 << s->dflag));", " gen_pop_T0(s);", " if (s->dflag == 0)", " gen_op_andl_T0_ffff();", " gen_op_jmp_T0();", " gen_pop_update(s);", " gen_pop_T0(s);", " gen_movl_seg_T0(s, R_CS);", " gen_pop_update(s);", " gen_pop_T0(s);", " if (s->dflag) {", " if (s->vm86)", " gen_op_movl_eflags_T0_vm(pc_start - s->cs_base);", " gen_op_movl_eflags_T0();", " if (s->vm86)", " gen_op_movw_eflags_T0_vm(pc_start - s->cs_base);", " gen_pop_update(s);", " s->cc_op = CC_OP_EFLAGS;", " if (s->cc_op != CC_OP_DYNAMIC)", " gen_op_set_cc_op(s->cc_op);", " if (s->vm86)", " gen_op_movl_T0_eflags_vm();", " gen_push_T0(s);", " gen_pop_T0(s);", " if (s->dflag) {", " if (s->vm86)", " gen_op_movl_eflags_T0_vm(pc_start - s->cs_base);", " gen_op_movl_eflags_T0();", " if (s->vm86)", " gen_op_movw_eflags_T0_vm(pc_start - s->cs_base);", " gen_pop_update(s);", " s->cc_op = CC_OP_EFLAGS;", " if (s->cpl <= s->iopl)", " if (s->iopl == 3)", " gen_op_cli_vm();", " if (s->cpl <= s->iopl)", " if (s->iopl == 3)", " gen_op_sti_vm(pc_start - s->cs_base);", " if (s->cpl == 0) {", " } else {", " gen_op_gpf(pc_start - s->cs_base);" ], "line_no": [ 3001, 3005, 1037, 3007, 3009, 3011, 1041, 1037, 3057, 1041, 1037, 3131, 3133, 3135, 3139, 3133, 3145, 1041, 1015, 1007, 1009, 3387, 3389, 1029, 1037, 3131, 3133, 3135, 3139, 3133, 3145, 1041, 1015, 3777, 3787, 3793, 3777, 3787, 3819, 3919, 407, 2803 ] }
long FUNC_0(DisasContext *VAR_0, uint8_t *VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5; int VAR_6, VAR_7; int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_18, VAR_14, VAR_15, VAR_19; unsigned int VAR_24; VAR_0->pc = VAR_1; VAR_3 = 0; VAR_4 = VAR_0->code32; VAR_5 = VAR_0->code32; VAR_0->VAR_23 = -1; next_byte: VAR_2 = ldub(VAR_0->pc); VAR_0->pc++; switch (VAR_2) { case 0xf3: VAR_3 |= PREFIX_REPZ; goto next_byte; case 0xf2: VAR_3 |= PREFIX_REPNZ; goto next_byte; case 0xf0: VAR_3 |= PREFIX_LOCK; goto next_byte; case 0x2e: VAR_0->VAR_23 = R_CS; goto next_byte; case 0x36: VAR_0->VAR_23 = R_SS; goto next_byte; case 0x3e: VAR_0->VAR_23 = R_DS; goto next_byte; case 0x26: VAR_0->VAR_23 = R_ES; goto next_byte; case 0x64: VAR_0->VAR_23 = R_FS; goto next_byte; case 0x65: VAR_0->VAR_23 = R_GS; goto next_byte; case 0x66: VAR_3 |= PREFIX_DATA; goto next_byte; case 0x67: VAR_3 |= PREFIX_ADR; goto next_byte; case 0x9b: VAR_3 |= PREFIX_FWAIT; goto next_byte; } if (VAR_3 & PREFIX_DATA) VAR_5 ^= 1; if (VAR_3 & PREFIX_ADR) VAR_4 ^= 1; VAR_0->prefix = VAR_3; VAR_0->VAR_4 = VAR_4; VAR_0->VAR_5 = VAR_5; if (VAR_3 & PREFIX_LOCK) gen_op_lock(); reswitch: switch(VAR_2) { case 0x0f: VAR_2 = ldub(VAR_0->pc++) | 0x100; goto reswitch; case 0x00 ... 0x05: case 0x08 ... 0x0d: case 0x10 ... 0x15: case 0x18 ... 0x1d: case 0x20 ... 0x25: case 0x28 ... 0x2d: case 0x30 ... 0x35: case 0x38 ... 0x3d: { int VAR_18, VAR_18, VAR_19; VAR_18 = (VAR_2 >> 3) & 7; VAR_18 = (VAR_2 >> 1) & 3; if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; switch(VAR_18) { case 0: VAR_8 = ldub(VAR_0->pc++); VAR_9 = ((VAR_8 >> 3) & 7) + OR_EAX; VAR_11 = (VAR_8 >> 6) & 3; VAR_10 = VAR_8 & 7; if (VAR_11 != 3) { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); gen_op_ld_T0_A0[VAR_7](); VAR_14 = OR_TMP0; } else { VAR_14 = OR_EAX + VAR_10; } gen_op(VAR_0, VAR_18, VAR_7, VAR_14, VAR_9); if (VAR_11 != 3 && VAR_18 != 7) { gen_op_st_T0_A0[VAR_7](); } break; case 1: VAR_8 = ldub(VAR_0->pc++); VAR_11 = (VAR_8 >> 6) & 3; VAR_9 = ((VAR_8 >> 3) & 7) + OR_EAX; VAR_10 = VAR_8 & 7; if (VAR_11 != 3) { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); gen_op_ld_T1_A0[VAR_7](); VAR_14 = OR_TMP1; } else { VAR_14 = OR_EAX + VAR_10; } gen_op(VAR_0, VAR_18, VAR_7, VAR_9, VAR_14); break; case 2: VAR_19 = insn_get(VAR_0, VAR_7); gen_opi(VAR_0, VAR_18, VAR_7, OR_EAX, VAR_19); break; } } break; case 0x80: case 0x81: case 0x83: { int VAR_19; if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_11 = (VAR_8 >> 6) & 3; VAR_10 = VAR_8 & 7; VAR_18 = (VAR_8 >> 3) & 7; if (VAR_11 != 3) { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); gen_op_ld_T0_A0[VAR_7](); VAR_14 = OR_TMP0; } else { VAR_14 = VAR_10 + OR_EAX; } switch(VAR_2) { default: case 0x80: case 0x81: VAR_19 = insn_get(VAR_0, VAR_7); break; case 0x83: VAR_19 = (int8_t)insn_get(VAR_0, OT_BYTE); break; } gen_opi(VAR_0, VAR_18, VAR_7, VAR_14, VAR_19); if (VAR_18 != 7 && VAR_11 != 3) { gen_op_st_T0_A0[VAR_7](); } } break; case 0x40 ... 0x47: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; gen_inc(VAR_0, VAR_7, OR_EAX + (VAR_2 & 7), 1); break; case 0x48 ... 0x4f: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; gen_inc(VAR_0, VAR_7, OR_EAX + (VAR_2 & 7), -1); break; case 0xf6: case 0xf7: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_11 = (VAR_8 >> 6) & 3; VAR_10 = VAR_8 & 7; VAR_18 = (VAR_8 >> 3) & 7; if (VAR_11 != 3) { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); gen_op_ld_T0_A0[VAR_7](); } else { gen_op_mov_TN_reg[VAR_7][0][VAR_10](); } switch(VAR_18) { case 0: VAR_19 = insn_get(VAR_0, VAR_7); gen_op_movl_T1_im(VAR_19); gen_op_testl_T0_T1_cc(); VAR_0->cc_op = CC_OP_LOGICB + VAR_7; break; case 2: gen_op_notl_T0(); if (VAR_11 != 3) { gen_op_st_T0_A0[VAR_7](); } else { gen_op_mov_reg_T0[VAR_7][VAR_10](); } break; case 3: gen_op_negl_T0_cc(); if (VAR_11 != 3) { gen_op_st_T0_A0[VAR_7](); } else { gen_op_mov_reg_T0[VAR_7][VAR_10](); } VAR_0->cc_op = CC_OP_SUBB + VAR_7; break; case 4: switch(VAR_7) { case OT_BYTE: gen_op_mulb_AL_T0(); break; case OT_WORD: gen_op_mulw_AX_T0(); break; default: case OT_LONG: gen_op_mull_EAX_T0(); break; } VAR_0->cc_op = CC_OP_MUL; break; case 5: switch(VAR_7) { case OT_BYTE: gen_op_imulb_AL_T0(); break; case OT_WORD: gen_op_imulw_AX_T0(); break; default: case OT_LONG: gen_op_imull_EAX_T0(); break; } VAR_0->cc_op = CC_OP_MUL; break; case 6: switch(VAR_7) { case OT_BYTE: gen_op_divb_AL_T0(); break; case OT_WORD: gen_op_divw_AX_T0(); break; default: case OT_LONG: gen_op_divl_EAX_T0(); break; } break; case 7: switch(VAR_7) { case OT_BYTE: gen_op_idivb_AL_T0(); break; case OT_WORD: gen_op_idivw_AX_T0(); break; default: case OT_LONG: gen_op_idivl_EAX_T0(); break; } break; default: goto illegal_op; } break; case 0xfe: case 0xff: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_11 = (VAR_8 >> 6) & 3; VAR_10 = VAR_8 & 7; VAR_18 = (VAR_8 >> 3) & 7; if (VAR_18 >= 2 && VAR_2 == 0xfe) { goto illegal_op; } if (VAR_11 != 3) { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); if (VAR_18 != 3 && VAR_18 != 5) gen_op_ld_T0_A0[VAR_7](); } else { gen_op_mov_TN_reg[VAR_7][0][VAR_10](); } switch(VAR_18) { case 0: gen_inc(VAR_0, VAR_7, OR_TMP0, 1); if (VAR_11 != 3) gen_op_st_T0_A0[VAR_7](); else gen_op_mov_reg_T0[VAR_7][VAR_10](); break; case 1: gen_inc(VAR_0, VAR_7, OR_TMP0, -1); if (VAR_11 != 3) gen_op_st_T0_A0[VAR_7](); else gen_op_mov_reg_T0[VAR_7][VAR_10](); break; case 2: if (VAR_0->VAR_5 == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); VAR_24 = VAR_0->pc - VAR_0->cs_base; gen_op_movl_T0_im(VAR_24); gen_push_T0(VAR_0); VAR_0->is_jmp = 1; break; case 3: gen_op_movl_T0_seg(R_CS); gen_push_T0(VAR_0); VAR_24 = VAR_0->pc - VAR_0->cs_base; gen_op_movl_T0_im(VAR_24); gen_push_T0(VAR_0); gen_op_ld_T1_A0[VAR_7](); gen_op_addl_A0_im(1 << (VAR_7 - OT_WORD + 1)); gen_op_lduw_T0_A0(); gen_movl_seg_T0(VAR_0, R_CS); gen_op_movl_T0_T1(); gen_op_jmp_T0(); VAR_0->is_jmp = 1; break; case 4: if (VAR_0->VAR_5 == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); VAR_0->is_jmp = 1; break; case 5: gen_op_ld_T1_A0[VAR_7](); gen_op_addl_A0_im(1 << (VAR_7 - OT_WORD + 1)); gen_op_lduw_T0_A0(); gen_movl_seg_T0(VAR_0, R_CS); gen_op_movl_T0_T1(); gen_op_jmp_T0(); VAR_0->is_jmp = 1; break; case 6: gen_push_T0(VAR_0); break; default: goto illegal_op; } break; case 0x84: case 0x85: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_11 = (VAR_8 >> 6) & 3; VAR_10 = VAR_8 & 7; VAR_9 = (VAR_8 >> 3) & 7; gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 0); gen_op_mov_TN_reg[VAR_7][1][VAR_9 + OR_EAX](); gen_op_testl_T0_T1_cc(); VAR_0->cc_op = CC_OP_LOGICB + VAR_7; break; case 0xa8: case 0xa9: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_19 = insn_get(VAR_0, VAR_7); gen_op_mov_TN_reg[VAR_7][0][OR_EAX](); gen_op_movl_T1_im(VAR_19); gen_op_testl_T0_T1_cc(); VAR_0->cc_op = CC_OP_LOGICB + VAR_7; break; case 0x98: if (VAR_5) gen_op_movswl_EAX_AX(); else gen_op_movsbw_AX_AL(); break; case 0x99: if (VAR_5) gen_op_movslq_EDX_EAX(); else gen_op_movswl_DX_AX(); break; case 0x1af: case 0x69: case 0x6b: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = ((VAR_8 >> 3) & 7) + OR_EAX; gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 0); if (VAR_2 == 0x69) { VAR_19 = insn_get(VAR_0, VAR_7); gen_op_movl_T1_im(VAR_19); } else if (VAR_2 == 0x6b) { VAR_19 = insn_get(VAR_0, OT_BYTE); gen_op_movl_T1_im(VAR_19); } else { gen_op_mov_TN_reg[VAR_7][1][VAR_9](); } if (VAR_7 == OT_LONG) { gen_op_imull_T0_T1(); } else { gen_op_imulw_T0_T1(); } gen_op_mov_reg_T0[VAR_7][VAR_9](); VAR_0->cc_op = CC_OP_MUL; break; case 0x1c0: case 0x1c1: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = (VAR_8 >> 3) & 7; VAR_11 = (VAR_8 >> 6) & 3; if (VAR_11 == 3) { VAR_10 = VAR_8 & 7; gen_op_mov_TN_reg[VAR_7][0][VAR_9](); gen_op_mov_TN_reg[VAR_7][1][VAR_10](); gen_op_addl_T0_T1_cc(); gen_op_mov_reg_T0[VAR_7][VAR_10](); gen_op_mov_reg_T1[VAR_7][VAR_9](); } else { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); gen_op_mov_TN_reg[VAR_7][0][VAR_9](); gen_op_ld_T1_A0[VAR_7](); gen_op_addl_T0_T1_cc(); gen_op_st_T0_A0[VAR_7](); gen_op_mov_reg_T1[VAR_7][VAR_9](); } VAR_0->cc_op = CC_OP_ADDB + VAR_7; break; case 0x1b0: case 0x1b1: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = (VAR_8 >> 3) & 7; VAR_11 = (VAR_8 >> 6) & 3; gen_op_mov_TN_reg[VAR_7][1][VAR_9](); if (VAR_11 == 3) { VAR_10 = VAR_8 & 7; gen_op_mov_TN_reg[VAR_7][0][VAR_10](); gen_op_cmpxchg_T0_T1_EAX_cc[VAR_7](); gen_op_mov_reg_T0[VAR_7][VAR_10](); } else { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); gen_op_ld_T0_A0[VAR_7](); gen_op_cmpxchg_T0_T1_EAX_cc[VAR_7](); gen_op_st_T0_A0[VAR_7](); } VAR_0->cc_op = CC_OP_SUBB + VAR_7; break; case 0x1c7: VAR_8 = ldub(VAR_0->pc++); VAR_11 = (VAR_8 >> 6) & 3; if (VAR_11 == 3) goto illegal_op; if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); gen_op_cmpxchg8b(); VAR_0->cc_op = CC_OP_EFLAGS; break; case 0x50 ... 0x57: gen_op_mov_TN_reg[OT_LONG][0][VAR_2 & 7](); gen_push_T0(VAR_0); break; case 0x58 ... 0x5f: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; gen_pop_T0(VAR_0); gen_op_mov_reg_T0[VAR_7][VAR_2 & 7](); gen_pop_update(VAR_0); break; case 0x60: gen_pusha(VAR_0); break; case 0x61: gen_popa(VAR_0); break; case 0x68: case 0x6a: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; if (VAR_2 == 0x68) VAR_19 = insn_get(VAR_0, VAR_7); else VAR_19 = (int8_t)insn_get(VAR_0, OT_BYTE); gen_op_movl_T0_im(VAR_19); gen_push_T0(VAR_0); break; case 0x8f: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); gen_pop_T0(VAR_0); gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 1); gen_pop_update(VAR_0); break; case 0xc8: { int VAR_19; VAR_19 = lduw(VAR_0->pc); VAR_0->pc += 2; VAR_19 = ldub(VAR_0->pc++); gen_enter(VAR_0, VAR_19, VAR_19); } break; case 0xc9: if (VAR_0->ss32) { gen_op_mov_TN_reg[OT_LONG][0][R_EBP](); gen_op_mov_reg_T0[OT_LONG][R_ESP](); } else { gen_op_mov_TN_reg[OT_WORD][0][R_EBP](); gen_op_mov_reg_T0[OT_WORD][R_ESP](); } gen_pop_T0(VAR_0); VAR_7 = VAR_5 ? OT_LONG : OT_WORD; gen_op_mov_reg_T0[VAR_7][R_EBP](); gen_pop_update(VAR_0); break; case 0x06: case 0x0e: case 0x16: case 0x1e: gen_op_movl_T0_seg(VAR_2 >> 3); gen_push_T0(VAR_0); break; case 0x1a0: case 0x1a8: gen_op_movl_T0_seg((VAR_2 >> 3) & 7); gen_push_T0(VAR_0); break; case 0x07: case 0x17: case 0x1f: gen_pop_T0(VAR_0); gen_movl_seg_T0(VAR_0, VAR_2 >> 3); gen_pop_update(VAR_0); break; case 0x1a1: case 0x1a9: gen_pop_T0(VAR_0); gen_movl_seg_T0(VAR_0, (VAR_2 >> 3) & 7); gen_pop_update(VAR_0); break; case 0x88: case 0x89: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = (VAR_8 >> 3) & 7; gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_EAX + VAR_9, 1); break; case 0xc6: case 0xc7: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_11 = (VAR_8 >> 6) & 3; if (VAR_11 != 3) gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); VAR_19 = insn_get(VAR_0, VAR_7); gen_op_movl_T0_im(VAR_19); if (VAR_11 != 3) gen_op_st_T0_A0[VAR_7](); else gen_op_mov_reg_T0[VAR_7][VAR_8 & 7](); break; case 0x8a: case 0x8b: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = (VAR_8 >> 3) & 7; gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 0); gen_op_mov_reg_T0[VAR_7][VAR_9](); break; case 0x8e: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = (VAR_8 >> 3) & 7; gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 0); if (VAR_9 >= 6 || VAR_9 == R_CS) goto illegal_op; gen_movl_seg_T0(VAR_0, VAR_9); break; case 0x8c: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = (VAR_8 >> 3) & 7; if (VAR_9 >= 6) goto illegal_op; gen_op_movl_T0_seg(VAR_9); gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 1); break; case 0x1b6: case 0x1b7: case 0x1be: case 0x1bf: { int VAR_20; VAR_20 = VAR_5 + OT_WORD; VAR_7 = (VAR_2 & 1) + OT_BYTE; VAR_8 = ldub(VAR_0->pc++); VAR_9 = ((VAR_8 >> 3) & 7) + OR_EAX; VAR_11 = (VAR_8 >> 6) & 3; VAR_10 = VAR_8 & 7; if (VAR_11 == 3) { gen_op_mov_TN_reg[VAR_7][0][VAR_10](); switch(VAR_7 | (VAR_2 & 8)) { case OT_BYTE: gen_op_movzbl_T0_T0(); break; case OT_BYTE | 8: gen_op_movsbl_T0_T0(); break; case OT_WORD: gen_op_movzwl_T0_T0(); break; default: case OT_WORD | 8: gen_op_movswl_T0_T0(); break; } gen_op_mov_reg_T0[VAR_20][VAR_9](); } else { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); if (VAR_2 & 8) { gen_op_lds_T0_A0[VAR_7](); } else { gen_op_ldu_T0_A0[VAR_7](); } gen_op_mov_reg_T0[VAR_20][VAR_9](); } } break; case 0x8d: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = (VAR_8 >> 3) & 7; VAR_0->VAR_23 = -1; VAR_19 = VAR_0->addseg; VAR_0->addseg = 0; gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); VAR_0->addseg = VAR_19; gen_op_mov_reg_A0[VAR_7 - OT_WORD][VAR_9](); break; case 0xa0: case 0xa1: case 0xa2: case 0xa3: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; if (VAR_0->VAR_4) VAR_15 = insn_get(VAR_0, OT_LONG); else VAR_15 = insn_get(VAR_0, OT_WORD); gen_op_movl_A0_im(VAR_15); { int VAR_23, VAR_23; VAR_23 = VAR_0->addseg; if (VAR_0->VAR_23 >= 0) { VAR_23 = VAR_0->VAR_23; VAR_23 = 1; } else { VAR_23 = R_DS; } if (VAR_23) { gen_op_addl_A0_seg(offsetof(CPUX86State,seg_cache[VAR_23].base)); } } if ((VAR_2 & 2) == 0) { gen_op_ld_T0_A0[VAR_7](); gen_op_mov_reg_T0[VAR_7][R_EAX](); } else { gen_op_mov_TN_reg[VAR_7][0][R_EAX](); gen_op_st_T0_A0[VAR_7](); } break; case 0xd7: gen_op_movl_A0_reg[R_EBX](); gen_op_addl_A0_AL(); if (VAR_0->VAR_4 == 0) gen_op_andl_A0_ffff(); { int VAR_23, VAR_23; VAR_23 = VAR_0->addseg; VAR_23 = R_DS; if (VAR_0->VAR_23 >= 0) { VAR_23 = VAR_0->VAR_23; VAR_23 = 1; } else { VAR_23 = R_DS; } if (VAR_23) { gen_op_addl_A0_seg(offsetof(CPUX86State,seg_cache[VAR_23].base)); } } gen_op_ldub_T0_A0(); gen_op_mov_reg_T0[OT_BYTE][R_EAX](); break; case 0xb0 ... 0xb7: VAR_19 = insn_get(VAR_0, OT_BYTE); gen_op_movl_T0_im(VAR_19); gen_op_mov_reg_T0[OT_BYTE][VAR_2 & 7](); break; case 0xb8 ... 0xbf: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_19 = insn_get(VAR_0, VAR_7); VAR_9 = OR_EAX + (VAR_2 & 7); gen_op_movl_T0_im(VAR_19); gen_op_mov_reg_T0[VAR_7][VAR_9](); break; case 0x91 ... 0x97: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_9 = VAR_2 & 7; VAR_10 = R_EAX; goto do_xchg_reg; case 0x86: case 0x87: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = (VAR_8 >> 3) & 7; VAR_11 = (VAR_8 >> 6) & 3; if (VAR_11 == 3) { VAR_10 = VAR_8 & 7; do_xchg_reg: gen_op_mov_TN_reg[VAR_7][0][VAR_9](); gen_op_mov_TN_reg[VAR_7][1][VAR_10](); gen_op_mov_reg_T0[VAR_7][VAR_10](); gen_op_mov_reg_T1[VAR_7][VAR_9](); } else { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); gen_op_mov_TN_reg[VAR_7][0][VAR_9](); if (!(VAR_3 & PREFIX_LOCK)) gen_op_lock(); gen_op_ld_T1_A0[VAR_7](); gen_op_st_T0_A0[VAR_7](); if (!(VAR_3 & PREFIX_LOCK)) gen_op_unlock(); gen_op_mov_reg_T1[VAR_7][VAR_9](); } break; case 0xc4: VAR_18 = R_ES; goto do_lxx; case 0xc5: VAR_18 = R_DS; goto do_lxx; case 0x1b2: VAR_18 = R_SS; goto do_lxx; case 0x1b4: VAR_18 = R_FS; goto do_lxx; case 0x1b5: VAR_18 = R_GS; do_lxx: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = (VAR_8 >> 3) & 7; VAR_11 = (VAR_8 >> 6) & 3; if (VAR_11 == 3) goto illegal_op; gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); gen_op_ld_T1_A0[VAR_7](); gen_op_addl_A0_im(1 << (VAR_7 - OT_WORD + 1)); gen_op_lduw_T0_A0(); gen_movl_seg_T0(VAR_0, VAR_18); gen_op_mov_reg_T1[VAR_7][VAR_9](); break; case 0xc0: case 0xc1: VAR_6 = 2; grp2: { if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_11 = (VAR_8 >> 6) & 3; VAR_10 = VAR_8 & 7; VAR_18 = (VAR_8 >> 3) & 7; if (VAR_11 != 3) { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); gen_op_ld_T0_A0[VAR_7](); VAR_14 = OR_TMP0; } else { VAR_14 = VAR_10 + OR_EAX; } if (VAR_6 == 0) { gen_shift(VAR_0, VAR_18, VAR_7, VAR_14, OR_ECX); } else { if (VAR_6 == 2) { VAR_6 = ldub(VAR_0->pc++); } gen_shifti(VAR_0, VAR_18, VAR_7, VAR_14, VAR_6); } if (VAR_11 != 3) { gen_op_st_T0_A0[VAR_7](); } } break; case 0xd0: case 0xd1: VAR_6 = 1; goto grp2; case 0xd2: case 0xd3: VAR_6 = 0; goto grp2; case 0x1a4: VAR_18 = 0; VAR_6 = 1; goto do_shiftd; case 0x1a5: VAR_18 = 0; VAR_6 = 0; goto do_shiftd; case 0x1ac: VAR_18 = 1; VAR_6 = 1; goto do_shiftd; case 0x1ad: VAR_18 = 1; VAR_6 = 0; do_shiftd: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_11 = (VAR_8 >> 6) & 3; VAR_10 = VAR_8 & 7; VAR_9 = (VAR_8 >> 3) & 7; if (VAR_11 != 3) { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); gen_op_ld_T0_A0[VAR_7](); } else { gen_op_mov_TN_reg[VAR_7][0][VAR_10](); } gen_op_mov_TN_reg[VAR_7][1][VAR_9](); if (VAR_6) { VAR_19 = ldub(VAR_0->pc++); VAR_19 &= 0x1f; if (VAR_19) { gen_op_shiftd_T0_T1_im_cc[VAR_7 - OT_WORD][VAR_18](VAR_19); if (VAR_18 == 0 && VAR_7 != OT_WORD) VAR_0->cc_op = CC_OP_SHLB + VAR_7; else VAR_0->cc_op = CC_OP_SARB + VAR_7; } } else { if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_op_shiftd_T0_T1_ECX_cc[VAR_7 - OT_WORD][VAR_18](); VAR_0->cc_op = CC_OP_DYNAMIC; } if (VAR_11 != 3) { gen_op_st_T0_A0[VAR_7](); } else { gen_op_mov_reg_T0[VAR_7][VAR_10](); } break; case 0xd8 ... 0xdf: VAR_8 = ldub(VAR_0->pc++); VAR_11 = (VAR_8 >> 6) & 3; VAR_10 = VAR_8 & 7; VAR_18 = ((VAR_2 & 7) << 3) | ((VAR_8 >> 3) & 7); if (VAR_11 != 3) { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); switch(VAR_18) { case 0x00 ... 0x07: case 0x10 ... 0x17: case 0x20 ... 0x27: case 0x30 ... 0x37: { int VAR_24; VAR_24 = VAR_18 & 7; switch(VAR_18 >> 4) { case 0: gen_op_flds_FT0_A0(); break; case 1: gen_op_fildl_FT0_A0(); break; case 2: gen_op_fldl_FT0_A0(); break; case 3: default: gen_op_fild_FT0_A0(); break; } gen_op_fp_arith_ST0_FT0[VAR_24](); if (VAR_24 == 3) { gen_op_fpop(); } } break; case 0x08: case 0x0a: case 0x0b: case 0x18: case 0x1a: case 0x1b: case 0x28: case 0x2a: case 0x2b: case 0x38: case 0x3a: case 0x3b: switch(VAR_18 & 7) { case 0: gen_op_fpush(); switch(VAR_18 >> 4) { case 0: gen_op_flds_ST0_A0(); break; case 1: gen_op_fildl_ST0_A0(); break; case 2: gen_op_fldl_ST0_A0(); break; case 3: default: gen_op_fild_ST0_A0(); break; } break; default: switch(VAR_18 >> 4) { case 0: gen_op_fsts_ST0_A0(); break; case 1: gen_op_fistl_ST0_A0(); break; case 2: gen_op_fstl_ST0_A0(); break; case 3: default: gen_op_fist_ST0_A0(); break; } if ((VAR_18 & 7) == 3) gen_op_fpop(); break; } break; case 0x0d: gen_op_fldcw_A0(); break; case 0x0f: gen_op_fnstcw_A0(); break; case 0x1d: gen_op_fpush(); gen_op_fldt_ST0_A0(); break; case 0x1f: gen_op_fstt_ST0_A0(); gen_op_fpop(); break; case 0x2f: gen_op_fnstsw_A0(); break; case 0x3c: gen_op_fpush(); gen_op_fbld_ST0_A0(); break; case 0x3e: gen_op_fbst_ST0_A0(); gen_op_fpop(); break; case 0x3d: gen_op_fpush(); gen_op_fildll_ST0_A0(); break; case 0x3f: gen_op_fistll_ST0_A0(); gen_op_fpop(); break; default: goto illegal_op; } } else { VAR_14 = VAR_10; switch(VAR_18) { case 0x08: gen_op_fpush(); gen_op_fmov_ST0_STN((VAR_14 + 1) & 7); break; case 0x09: gen_op_fxchg_ST0_STN(VAR_14); break; case 0x0a: switch(VAR_10) { case 0: break; default: goto illegal_op; } break; case 0x0c: switch(VAR_10) { case 0: gen_op_fchs_ST0(); break; case 1: gen_op_fabs_ST0(); break; case 4: gen_op_fldz_FT0(); gen_op_fcom_ST0_FT0(); break; case 5: gen_op_fxam_ST0(); break; default: goto illegal_op; } break; case 0x0d: { switch(VAR_10) { case 0: gen_op_fpush(); gen_op_fld1_ST0(); break; case 1: gen_op_fpush(); gen_op_fldl2t_ST0(); break; case 2: gen_op_fpush(); gen_op_fldl2e_ST0(); break; case 3: gen_op_fpush(); gen_op_fldpi_ST0(); break; case 4: gen_op_fpush(); gen_op_fldlg2_ST0(); break; case 5: gen_op_fpush(); gen_op_fldln2_ST0(); break; case 6: gen_op_fpush(); gen_op_fldz_ST0(); break; default: goto illegal_op; } } break; case 0x0e: switch(VAR_10) { case 0: gen_op_f2xm1(); break; case 1: gen_op_fyl2x(); break; case 2: gen_op_fptan(); break; case 3: gen_op_fpatan(); break; case 4: gen_op_fxtract(); break; case 5: gen_op_fprem1(); break; case 6: gen_op_fdecstp(); break; default: case 7: gen_op_fincstp(); break; } break; case 0x0f: switch(VAR_10) { case 0: gen_op_fprem(); break; case 1: gen_op_fyl2xp1(); break; case 2: gen_op_fsqrt(); break; case 3: gen_op_fsincos(); break; case 5: gen_op_fscale(); break; case 4: gen_op_frndint(); break; case 6: gen_op_fsin(); break; default: case 7: gen_op_fcos(); break; } break; case 0x00: case 0x01: case 0x04 ... 0x07: case 0x20: case 0x21: case 0x24 ... 0x27: case 0x30: case 0x31: case 0x34 ... 0x37: { int VAR_24; VAR_24 = VAR_18 & 7; if (VAR_18 >= 0x20) { gen_op_fp_arith_STN_ST0[VAR_24](VAR_14); if (VAR_18 >= 0x30) gen_op_fpop(); } else { gen_op_fmov_FT0_STN(VAR_14); gen_op_fp_arith_ST0_FT0[VAR_24](); } } break; case 0x02: gen_op_fmov_FT0_STN(VAR_14); gen_op_fcom_ST0_FT0(); break; case 0x03: gen_op_fmov_FT0_STN(VAR_14); gen_op_fcom_ST0_FT0(); gen_op_fpop(); break; case 0x15: switch(VAR_10) { case 1: gen_op_fmov_FT0_STN(1); gen_op_fucom_ST0_FT0(); gen_op_fpop(); gen_op_fpop(); break; default: goto illegal_op; } break; case 0x1c: switch(VAR_10) { case 2: gen_op_fclex(); break; case 3: gen_op_fninit(); break; default: goto illegal_op; } break; case 0x2a: gen_op_fmov_STN_ST0(VAR_14); break; case 0x2b: gen_op_fmov_STN_ST0(VAR_14); gen_op_fpop(); break; case 0x2c: gen_op_fmov_FT0_STN(VAR_14); gen_op_fucom_ST0_FT0(); break; case 0x2d: gen_op_fmov_FT0_STN(VAR_14); gen_op_fucom_ST0_FT0(); gen_op_fpop(); break; case 0x33: switch(VAR_10) { case 1: gen_op_fmov_FT0_STN(1); gen_op_fcom_ST0_FT0(); gen_op_fpop(); gen_op_fpop(); break; default: goto illegal_op; } break; case 0x3c: switch(VAR_10) { case 0: gen_op_fnstsw_EAX(); break; default: goto illegal_op; } break; default: goto illegal_op; } } break; case 0xa4: case 0xa5: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; if (VAR_3 & PREFIX_REPZ) { gen_string_ds(VAR_0, VAR_7, gen_op_movs + 9); } else { gen_string_ds(VAR_0, VAR_7, gen_op_movs); } break; case 0xaa: case 0xab: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; if (VAR_3 & PREFIX_REPZ) { gen_string_es(VAR_0, VAR_7, gen_op_stos + 9); } else { gen_string_es(VAR_0, VAR_7, gen_op_stos); } break; case 0xac: case 0xad: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; if (VAR_3 & PREFIX_REPZ) { gen_string_ds(VAR_0, VAR_7, gen_op_lods + 9); } else { gen_string_ds(VAR_0, VAR_7, gen_op_lods); } break; case 0xae: case 0xaf: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; if (VAR_3 & PREFIX_REPNZ) { if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_string_es(VAR_0, VAR_7, gen_op_scas + 9 * 2); VAR_0->cc_op = CC_OP_DYNAMIC; } else if (VAR_3 & PREFIX_REPZ) { if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_string_es(VAR_0, VAR_7, gen_op_scas + 9); VAR_0->cc_op = CC_OP_DYNAMIC; } else { gen_string_es(VAR_0, VAR_7, gen_op_scas); VAR_0->cc_op = CC_OP_SUBB + VAR_7; } break; case 0xa6: case 0xa7: if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; if (VAR_3 & PREFIX_REPNZ) { if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_string_ds(VAR_0, VAR_7, gen_op_cmps + 9 * 2); VAR_0->cc_op = CC_OP_DYNAMIC; } else if (VAR_3 & PREFIX_REPZ) { if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_string_ds(VAR_0, VAR_7, gen_op_cmps + 9); VAR_0->cc_op = CC_OP_DYNAMIC; } else { gen_string_ds(VAR_0, VAR_7, gen_op_cmps); VAR_0->cc_op = CC_OP_SUBB + VAR_7; } break; case 0x6c: case 0x6d: if (VAR_0->cpl > VAR_0->iopl || VAR_0->vm86) { gen_op_gpf(VAR_1 - VAR_0->cs_base); } else { if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; if (VAR_3 & PREFIX_REPZ) { gen_string_es(VAR_0, VAR_7, gen_op_ins + 9); } else { gen_string_es(VAR_0, VAR_7, gen_op_ins); } } break; case 0x6e: case 0x6f: if (VAR_0->cpl > VAR_0->iopl || VAR_0->vm86) { gen_op_gpf(VAR_1 - VAR_0->cs_base); } else { if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; if (VAR_3 & PREFIX_REPZ) { gen_string_ds(VAR_0, VAR_7, gen_op_outs + 9); } else { gen_string_ds(VAR_0, VAR_7, gen_op_outs); } } break; case 0xe4: case 0xe5: if (VAR_0->cpl > VAR_0->iopl || VAR_0->vm86) { gen_op_gpf(VAR_1 - VAR_0->cs_base); } else { if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_19 = ldub(VAR_0->pc++); gen_op_movl_T0_im(VAR_19); gen_op_in[VAR_7](); gen_op_mov_reg_T1[VAR_7][R_EAX](); } break; case 0xe6: case 0xe7: if (VAR_0->cpl > VAR_0->iopl || VAR_0->vm86) { gen_op_gpf(VAR_1 - VAR_0->cs_base); } else { if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_19 = ldub(VAR_0->pc++); gen_op_movl_T0_im(VAR_19); gen_op_mov_TN_reg[VAR_7][1][R_EAX](); gen_op_out[VAR_7](); } break; case 0xec: case 0xed: if (VAR_0->cpl > VAR_0->iopl || VAR_0->vm86) { gen_op_gpf(VAR_1 - VAR_0->cs_base); } else { if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; gen_op_mov_TN_reg[OT_WORD][0][R_EDX](); gen_op_in[VAR_7](); gen_op_mov_reg_T1[VAR_7][R_EAX](); } break; case 0xee: case 0xef: if (VAR_0->cpl > VAR_0->iopl || VAR_0->vm86) { gen_op_gpf(VAR_1 - VAR_0->cs_base); } else { if ((VAR_2 & 1) == 0) VAR_7 = OT_BYTE; else VAR_7 = VAR_5 ? OT_LONG : OT_WORD; gen_op_mov_TN_reg[OT_WORD][0][R_EDX](); gen_op_mov_TN_reg[VAR_7][1][R_EAX](); gen_op_out[VAR_7](); } break; case 0xc2: VAR_19 = ldsw(VAR_0->pc); VAR_0->pc += 2; gen_pop_T0(VAR_0); if (VAR_0->ss32) gen_op_addl_ESP_im(VAR_19 + (2 << VAR_0->VAR_5)); else gen_op_addw_ESP_im(VAR_19 + (2 << VAR_0->VAR_5)); if (VAR_0->VAR_5 == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); VAR_0->is_jmp = 1; break; case 0xc3: gen_pop_T0(VAR_0); gen_pop_update(VAR_0); if (VAR_0->VAR_5 == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); VAR_0->is_jmp = 1; break; case 0xca: VAR_19 = ldsw(VAR_0->pc); VAR_0->pc += 2; gen_pop_T0(VAR_0); if (VAR_0->VAR_5 == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); gen_pop_update(VAR_0); gen_pop_T0(VAR_0); gen_movl_seg_T0(VAR_0, R_CS); gen_pop_update(VAR_0); if (VAR_0->ss32) gen_op_addl_ESP_im(VAR_19 + (2 << VAR_0->VAR_5)); else gen_op_addw_ESP_im(VAR_19 + (2 << VAR_0->VAR_5)); VAR_0->is_jmp = 1; break; case 0xcb: gen_pop_T0(VAR_0); if (VAR_0->VAR_5 == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); gen_pop_update(VAR_0); gen_pop_T0(VAR_0); gen_movl_seg_T0(VAR_0, R_CS); gen_pop_update(VAR_0); VAR_0->is_jmp = 1; break; case 0xcf: gen_pop_T0(VAR_0); if (VAR_0->VAR_5 == 0) gen_op_andl_T0_ffff(); gen_op_jmp_T0(); gen_pop_update(VAR_0); gen_pop_T0(VAR_0); gen_movl_seg_T0(VAR_0, R_CS); gen_pop_update(VAR_0); gen_pop_T0(VAR_0); if (VAR_0->VAR_5) { if (VAR_0->vm86) gen_op_movl_eflags_T0_vm(VAR_1 - VAR_0->cs_base); else gen_op_movl_eflags_T0(); } else { if (VAR_0->vm86) gen_op_movw_eflags_T0_vm(VAR_1 - VAR_0->cs_base); else gen_op_movw_eflags_T0(); } gen_pop_update(VAR_0); VAR_0->cc_op = CC_OP_EFLAGS; VAR_0->is_jmp = 1; break; case 0xe8: { unsigned int VAR_24; VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_19 = insn_get(VAR_0, VAR_7); VAR_24 = VAR_0->pc - VAR_0->cs_base; VAR_19 += VAR_24; if (VAR_0->VAR_5 == 0) VAR_19 &= 0xffff; gen_op_movl_T0_im(VAR_24); gen_push_T0(VAR_0); gen_op_jmp_im(VAR_19); VAR_0->is_jmp = 1; } break; case 0x9a: { unsigned int VAR_26, VAR_26; VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_26 = insn_get(VAR_0, VAR_7); VAR_26 = insn_get(VAR_0, OT_WORD); gen_op_movl_T0_seg(R_CS); gen_push_T0(VAR_0); VAR_24 = VAR_0->pc - VAR_0->cs_base; gen_op_movl_T0_im(VAR_24); gen_push_T0(VAR_0); gen_op_movl_T0_im(VAR_26); gen_movl_seg_T0(VAR_0, R_CS); gen_op_jmp_im((unsigned long)VAR_26); VAR_0->is_jmp = 1; } break; case 0xe9: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_19 = insn_get(VAR_0, VAR_7); VAR_19 += VAR_0->pc - VAR_0->cs_base; if (VAR_0->VAR_5 == 0) VAR_19 = VAR_19 & 0xffff; gen_op_jmp_im(VAR_19); VAR_0->is_jmp = 1; break; case 0xea: { unsigned int VAR_26, VAR_26; VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_26 = insn_get(VAR_0, VAR_7); VAR_26 = insn_get(VAR_0, OT_WORD); gen_op_movl_T0_im(VAR_26); gen_movl_seg_T0(VAR_0, R_CS); gen_op_jmp_im((unsigned long)VAR_26); VAR_0->is_jmp = 1; } break; case 0xeb: VAR_19 = (int8_t)insn_get(VAR_0, OT_BYTE); VAR_19 += VAR_0->pc - VAR_0->cs_base; if (VAR_0->VAR_5 == 0) VAR_19 = VAR_19 & 0xffff; gen_op_jmp_im(VAR_19); VAR_0->is_jmp = 1; break; case 0x70 ... 0x7f: VAR_19 = (int8_t)insn_get(VAR_0, OT_BYTE); goto do_jcc; case 0x180 ... 0x18f: if (VAR_5) { VAR_19 = insn_get(VAR_0, OT_LONG); } else { VAR_19 = (int16_t)insn_get(VAR_0, OT_WORD); } do_jcc: VAR_24 = VAR_0->pc - VAR_0->cs_base; VAR_19 += VAR_24; if (VAR_0->VAR_5 == 0) VAR_19 &= 0xffff; gen_jcc(VAR_0, VAR_2, VAR_19, VAR_24); VAR_0->is_jmp = 1; break; case 0x190 ... 0x19f: VAR_8 = ldub(VAR_0->pc++); gen_setcc(VAR_0, VAR_2); gen_ldst_modrm(VAR_0, VAR_8, OT_BYTE, OR_TMP0, 1); break; case 0x140 ... 0x14f: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = (VAR_8 >> 3) & 7; VAR_11 = (VAR_8 >> 6) & 3; gen_setcc(VAR_0, VAR_2); if (VAR_11 != 3) { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); gen_op_ld_T1_A0[VAR_7](); } else { VAR_10 = VAR_8 & 7; gen_op_mov_TN_reg[VAR_7][1][VAR_10](); } gen_op_cmov_reg_T1_T0[VAR_7 - OT_WORD][VAR_9](); break; case 0x9c: if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); if (VAR_0->vm86) gen_op_movl_T0_eflags_vm(); else gen_op_movl_T0_eflags(); gen_push_T0(VAR_0); break; case 0x9d: gen_pop_T0(VAR_0); if (VAR_0->VAR_5) { if (VAR_0->vm86) gen_op_movl_eflags_T0_vm(VAR_1 - VAR_0->cs_base); else gen_op_movl_eflags_T0(); } else { if (VAR_0->vm86) gen_op_movw_eflags_T0_vm(VAR_1 - VAR_0->cs_base); else gen_op_movw_eflags_T0(); } gen_pop_update(VAR_0); VAR_0->cc_op = CC_OP_EFLAGS; break; case 0x9e: gen_op_mov_TN_reg[OT_BYTE][0][R_AH](); if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_op_movb_eflags_T0(); VAR_0->cc_op = CC_OP_EFLAGS; break; case 0x9f: if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_op_movl_T0_eflags(); gen_op_mov_reg_T0[OT_BYTE][R_AH](); break; case 0xf5: if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_op_cmc(); VAR_0->cc_op = CC_OP_EFLAGS; break; case 0xf8: if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_op_clc(); VAR_0->cc_op = CC_OP_EFLAGS; break; case 0xf9: if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_op_stc(); VAR_0->cc_op = CC_OP_EFLAGS; break; case 0xfc: gen_op_cld(); break; case 0xfd: gen_op_std(); break; case 0x1ba: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_18 = (VAR_8 >> 3) & 7; VAR_11 = (VAR_8 >> 6) & 3; VAR_10 = VAR_8 & 7; if (VAR_11 != 3) { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); gen_op_ld_T0_A0[VAR_7](); } else { gen_op_mov_TN_reg[VAR_7][0][VAR_10](); } VAR_19 = ldub(VAR_0->pc++); gen_op_movl_T1_im(VAR_19); if (VAR_18 < 4) goto illegal_op; VAR_18 -= 4; gen_op_btx_T0_T1_cc[VAR_7 - OT_WORD][VAR_18](); VAR_0->cc_op = CC_OP_SARB + VAR_7; if (VAR_18 != 0) { if (VAR_11 != 3) gen_op_st_T0_A0[VAR_7](); else gen_op_mov_reg_T0[VAR_7][VAR_10](); } break; case 0x1a3: VAR_18 = 0; goto do_btx; case 0x1ab: VAR_18 = 1; goto do_btx; case 0x1b3: VAR_18 = 2; goto do_btx; case 0x1bb: VAR_18 = 3; do_btx: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = (VAR_8 >> 3) & 7; VAR_11 = (VAR_8 >> 6) & 3; VAR_10 = VAR_8 & 7; gen_op_mov_TN_reg[OT_LONG][1][VAR_9](); if (VAR_11 != 3) { gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); if (VAR_7 == OT_WORD) gen_op_add_bitw_A0_T1(); else gen_op_add_bitl_A0_T1(); gen_op_ld_T0_A0[VAR_7](); } else { gen_op_mov_TN_reg[VAR_7][0][VAR_10](); } gen_op_btx_T0_T1_cc[VAR_7 - OT_WORD][VAR_18](); VAR_0->cc_op = CC_OP_SARB + VAR_7; if (VAR_18 != 0) { if (VAR_11 != 3) gen_op_st_T0_A0[VAR_7](); else gen_op_mov_reg_T0[VAR_7][VAR_10](); } break; case 0x1bc: case 0x1bd: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = (VAR_8 >> 3) & 7; gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 0); gen_op_bsx_T0_cc[VAR_7 - OT_WORD][VAR_2 & 1](); gen_op_mov_reg_T0[VAR_7][VAR_9](); VAR_0->cc_op = CC_OP_LOGICB + VAR_7; break; case 0x27: if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_op_daa(); VAR_0->cc_op = CC_OP_EFLAGS; break; case 0x2f: if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_op_das(); VAR_0->cc_op = CC_OP_EFLAGS; break; case 0x37: if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_op_aaa(); VAR_0->cc_op = CC_OP_EFLAGS; break; case 0x3f: if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_op_aas(); VAR_0->cc_op = CC_OP_EFLAGS; break; case 0xd4: VAR_19 = ldub(VAR_0->pc++); gen_op_aam(VAR_19); VAR_0->cc_op = CC_OP_LOGICB; break; case 0xd5: VAR_19 = ldub(VAR_0->pc++); gen_op_aad(VAR_19); VAR_0->cc_op = CC_OP_LOGICB; break; case 0x90: break; case 0xcc: gen_op_int3((long)VAR_1); VAR_0->is_jmp = 1; break; case 0xcd: VAR_19 = ldub(VAR_0->pc++); gen_op_int_im(VAR_19, VAR_1 - VAR_0->cs_base); VAR_0->is_jmp = 1; break; case 0xce: if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_op_into(); break; case 0xfa: if (!VAR_0->vm86) { if (VAR_0->cpl <= VAR_0->iopl) gen_op_cli(); else gen_op_gpf(VAR_1 - VAR_0->cs_base); } else { if (VAR_0->iopl == 3) gen_op_cli(); else gen_op_cli_vm(); } break; case 0xfb: if (!VAR_0->vm86) { if (VAR_0->cpl <= VAR_0->iopl) gen_op_sti(); else gen_op_gpf(VAR_1 - VAR_0->cs_base); } else { if (VAR_0->iopl == 3) gen_op_sti(); else gen_op_sti_vm(VAR_1 - VAR_0->cs_base); } break; case 0x62: VAR_7 = VAR_5 ? OT_LONG : OT_WORD; VAR_8 = ldub(VAR_0->pc++); VAR_9 = (VAR_8 >> 3) & 7; VAR_11 = (VAR_8 >> 6) & 3; if (VAR_11 == 3) goto illegal_op; gen_op_mov_reg_T0[VAR_7][VAR_9](); gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15); if (VAR_7 == OT_WORD) gen_op_boundw(); else gen_op_boundl(); break; case 0x1c8 ... 0x1cf: VAR_9 = VAR_2 & 7; gen_op_mov_TN_reg[OT_LONG][0][VAR_9](); gen_op_bswapl_T0(); gen_op_mov_reg_T0[OT_LONG][VAR_9](); break; case 0xd6: if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); gen_op_salc(); break; case 0xe0: case 0xe1: if (VAR_0->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(VAR_0->cc_op); case 0xe2: case 0xe3: VAR_19 = (int8_t)insn_get(VAR_0, OT_BYTE); VAR_24 = VAR_0->pc - VAR_0->cs_base; VAR_19 += VAR_24; if (VAR_0->VAR_5 == 0) VAR_19 &= 0xffff; gen_op_loop[VAR_0->VAR_4][VAR_2 & 3](VAR_19, VAR_24); VAR_0->is_jmp = 1; break; case 0x131: gen_op_rdtsc(); break; case 0x1a2: gen_op_cpuid(); break; case 0xf4: if (VAR_0->cpl == 0) { } else { gen_op_gpf(VAR_1 - VAR_0->cs_base); } break; default: goto illegal_op; } if (VAR_0->prefix & PREFIX_LOCK) gen_op_unlock(); return (long)VAR_0->pc; illegal_op: return -1; }
[ "long FUNC_0(DisasContext *VAR_0, uint8_t *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5;", "int VAR_6, VAR_7;", "int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_18, VAR_14, VAR_15, VAR_19;", "unsigned int VAR_24;", "VAR_0->pc = VAR_1;", "VAR_3 = 0;", "VAR_4 = VAR_0->code32;", "VAR_5 = VAR_0->code32;", "VAR_0->VAR_23 = -1;", "next_byte:\nVAR_2 = ldub(VAR_0->pc);", "VAR_0->pc++;", "switch (VAR_2) {", "case 0xf3:\nVAR_3 |= PREFIX_REPZ;", "goto next_byte;", "case 0xf2:\nVAR_3 |= PREFIX_REPNZ;", "goto next_byte;", "case 0xf0:\nVAR_3 |= PREFIX_LOCK;", "goto next_byte;", "case 0x2e:\nVAR_0->VAR_23 = R_CS;", "goto next_byte;", "case 0x36:\nVAR_0->VAR_23 = R_SS;", "goto next_byte;", "case 0x3e:\nVAR_0->VAR_23 = R_DS;", "goto next_byte;", "case 0x26:\nVAR_0->VAR_23 = R_ES;", "goto next_byte;", "case 0x64:\nVAR_0->VAR_23 = R_FS;", "goto next_byte;", "case 0x65:\nVAR_0->VAR_23 = R_GS;", "goto next_byte;", "case 0x66:\nVAR_3 |= PREFIX_DATA;", "goto next_byte;", "case 0x67:\nVAR_3 |= PREFIX_ADR;", "goto next_byte;", "case 0x9b:\nVAR_3 |= PREFIX_FWAIT;", "goto next_byte;", "}", "if (VAR_3 & PREFIX_DATA)\nVAR_5 ^= 1;", "if (VAR_3 & PREFIX_ADR)\nVAR_4 ^= 1;", "VAR_0->prefix = VAR_3;", "VAR_0->VAR_4 = VAR_4;", "VAR_0->VAR_5 = VAR_5;", "if (VAR_3 & PREFIX_LOCK)\ngen_op_lock();", "reswitch:\nswitch(VAR_2) {", "case 0x0f:\nVAR_2 = ldub(VAR_0->pc++) | 0x100;", "goto reswitch;", "case 0x00 ... 0x05:\ncase 0x08 ... 0x0d:\ncase 0x10 ... 0x15:\ncase 0x18 ... 0x1d:\ncase 0x20 ... 0x25:\ncase 0x28 ... 0x2d:\ncase 0x30 ... 0x35:\ncase 0x38 ... 0x3d:\n{", "int VAR_18, VAR_18, VAR_19;", "VAR_18 = (VAR_2 >> 3) & 7;", "VAR_18 = (VAR_2 >> 1) & 3;", "if ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "switch(VAR_18) {", "case 0:\nVAR_8 = ldub(VAR_0->pc++);", "VAR_9 = ((VAR_8 >> 3) & 7) + OR_EAX;", "VAR_11 = (VAR_8 >> 6) & 3;", "VAR_10 = VAR_8 & 7;", "if (VAR_11 != 3) {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "gen_op_ld_T0_A0[VAR_7]();", "VAR_14 = OR_TMP0;", "} else {", "VAR_14 = OR_EAX + VAR_10;", "}", "gen_op(VAR_0, VAR_18, VAR_7, VAR_14, VAR_9);", "if (VAR_11 != 3 && VAR_18 != 7) {", "gen_op_st_T0_A0[VAR_7]();", "}", "break;", "case 1:\nVAR_8 = ldub(VAR_0->pc++);", "VAR_11 = (VAR_8 >> 6) & 3;", "VAR_9 = ((VAR_8 >> 3) & 7) + OR_EAX;", "VAR_10 = VAR_8 & 7;", "if (VAR_11 != 3) {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "gen_op_ld_T1_A0[VAR_7]();", "VAR_14 = OR_TMP1;", "} else {", "VAR_14 = OR_EAX + VAR_10;", "}", "gen_op(VAR_0, VAR_18, VAR_7, VAR_9, VAR_14);", "break;", "case 2:\nVAR_19 = insn_get(VAR_0, VAR_7);", "gen_opi(VAR_0, VAR_18, VAR_7, OR_EAX, VAR_19);", "break;", "}", "}", "break;", "case 0x80:\ncase 0x81:\ncase 0x83:\n{", "int VAR_19;", "if ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_11 = (VAR_8 >> 6) & 3;", "VAR_10 = VAR_8 & 7;", "VAR_18 = (VAR_8 >> 3) & 7;", "if (VAR_11 != 3) {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "gen_op_ld_T0_A0[VAR_7]();", "VAR_14 = OR_TMP0;", "} else {", "VAR_14 = VAR_10 + OR_EAX;", "}", "switch(VAR_2) {", "default:\ncase 0x80:\ncase 0x81:\nVAR_19 = insn_get(VAR_0, VAR_7);", "break;", "case 0x83:\nVAR_19 = (int8_t)insn_get(VAR_0, OT_BYTE);", "break;", "}", "gen_opi(VAR_0, VAR_18, VAR_7, VAR_14, VAR_19);", "if (VAR_18 != 7 && VAR_11 != 3) {", "gen_op_st_T0_A0[VAR_7]();", "}", "}", "break;", "case 0x40 ... 0x47:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "gen_inc(VAR_0, VAR_7, OR_EAX + (VAR_2 & 7), 1);", "break;", "case 0x48 ... 0x4f:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "gen_inc(VAR_0, VAR_7, OR_EAX + (VAR_2 & 7), -1);", "break;", "case 0xf6:\ncase 0xf7:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_11 = (VAR_8 >> 6) & 3;", "VAR_10 = VAR_8 & 7;", "VAR_18 = (VAR_8 >> 3) & 7;", "if (VAR_11 != 3) {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "gen_op_ld_T0_A0[VAR_7]();", "} else {", "gen_op_mov_TN_reg[VAR_7][0][VAR_10]();", "}", "switch(VAR_18) {", "case 0:\nVAR_19 = insn_get(VAR_0, VAR_7);", "gen_op_movl_T1_im(VAR_19);", "gen_op_testl_T0_T1_cc();", "VAR_0->cc_op = CC_OP_LOGICB + VAR_7;", "break;", "case 2:\ngen_op_notl_T0();", "if (VAR_11 != 3) {", "gen_op_st_T0_A0[VAR_7]();", "} else {", "gen_op_mov_reg_T0[VAR_7][VAR_10]();", "}", "break;", "case 3:\ngen_op_negl_T0_cc();", "if (VAR_11 != 3) {", "gen_op_st_T0_A0[VAR_7]();", "} else {", "gen_op_mov_reg_T0[VAR_7][VAR_10]();", "}", "VAR_0->cc_op = CC_OP_SUBB + VAR_7;", "break;", "case 4:\nswitch(VAR_7) {", "case OT_BYTE:\ngen_op_mulb_AL_T0();", "break;", "case OT_WORD:\ngen_op_mulw_AX_T0();", "break;", "default:\ncase OT_LONG:\ngen_op_mull_EAX_T0();", "break;", "}", "VAR_0->cc_op = CC_OP_MUL;", "break;", "case 5:\nswitch(VAR_7) {", "case OT_BYTE:\ngen_op_imulb_AL_T0();", "break;", "case OT_WORD:\ngen_op_imulw_AX_T0();", "break;", "default:\ncase OT_LONG:\ngen_op_imull_EAX_T0();", "break;", "}", "VAR_0->cc_op = CC_OP_MUL;", "break;", "case 6:\nswitch(VAR_7) {", "case OT_BYTE:\ngen_op_divb_AL_T0();", "break;", "case OT_WORD:\ngen_op_divw_AX_T0();", "break;", "default:\ncase OT_LONG:\ngen_op_divl_EAX_T0();", "break;", "}", "break;", "case 7:\nswitch(VAR_7) {", "case OT_BYTE:\ngen_op_idivb_AL_T0();", "break;", "case OT_WORD:\ngen_op_idivw_AX_T0();", "break;", "default:\ncase OT_LONG:\ngen_op_idivl_EAX_T0();", "break;", "}", "break;", "default:\ngoto illegal_op;", "}", "break;", "case 0xfe:\ncase 0xff:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_11 = (VAR_8 >> 6) & 3;", "VAR_10 = VAR_8 & 7;", "VAR_18 = (VAR_8 >> 3) & 7;", "if (VAR_18 >= 2 && VAR_2 == 0xfe) {", "goto illegal_op;", "}", "if (VAR_11 != 3) {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "if (VAR_18 != 3 && VAR_18 != 5)\ngen_op_ld_T0_A0[VAR_7]();", "} else {", "gen_op_mov_TN_reg[VAR_7][0][VAR_10]();", "}", "switch(VAR_18) {", "case 0:\ngen_inc(VAR_0, VAR_7, OR_TMP0, 1);", "if (VAR_11 != 3)\ngen_op_st_T0_A0[VAR_7]();", "else\ngen_op_mov_reg_T0[VAR_7][VAR_10]();", "break;", "case 1:\ngen_inc(VAR_0, VAR_7, OR_TMP0, -1);", "if (VAR_11 != 3)\ngen_op_st_T0_A0[VAR_7]();", "else\ngen_op_mov_reg_T0[VAR_7][VAR_10]();", "break;", "case 2:\nif (VAR_0->VAR_5 == 0)\ngen_op_andl_T0_ffff();", "gen_op_jmp_T0();", "VAR_24 = VAR_0->pc - VAR_0->cs_base;", "gen_op_movl_T0_im(VAR_24);", "gen_push_T0(VAR_0);", "VAR_0->is_jmp = 1;", "break;", "case 3:\ngen_op_movl_T0_seg(R_CS);", "gen_push_T0(VAR_0);", "VAR_24 = VAR_0->pc - VAR_0->cs_base;", "gen_op_movl_T0_im(VAR_24);", "gen_push_T0(VAR_0);", "gen_op_ld_T1_A0[VAR_7]();", "gen_op_addl_A0_im(1 << (VAR_7 - OT_WORD + 1));", "gen_op_lduw_T0_A0();", "gen_movl_seg_T0(VAR_0, R_CS);", "gen_op_movl_T0_T1();", "gen_op_jmp_T0();", "VAR_0->is_jmp = 1;", "break;", "case 4:\nif (VAR_0->VAR_5 == 0)\ngen_op_andl_T0_ffff();", "gen_op_jmp_T0();", "VAR_0->is_jmp = 1;", "break;", "case 5:\ngen_op_ld_T1_A0[VAR_7]();", "gen_op_addl_A0_im(1 << (VAR_7 - OT_WORD + 1));", "gen_op_lduw_T0_A0();", "gen_movl_seg_T0(VAR_0, R_CS);", "gen_op_movl_T0_T1();", "gen_op_jmp_T0();", "VAR_0->is_jmp = 1;", "break;", "case 6:\ngen_push_T0(VAR_0);", "break;", "default:\ngoto illegal_op;", "}", "break;", "case 0x84:\ncase 0x85:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_11 = (VAR_8 >> 6) & 3;", "VAR_10 = VAR_8 & 7;", "VAR_9 = (VAR_8 >> 3) & 7;", "gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 0);", "gen_op_mov_TN_reg[VAR_7][1][VAR_9 + OR_EAX]();", "gen_op_testl_T0_T1_cc();", "VAR_0->cc_op = CC_OP_LOGICB + VAR_7;", "break;", "case 0xa8:\ncase 0xa9:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_19 = insn_get(VAR_0, VAR_7);", "gen_op_mov_TN_reg[VAR_7][0][OR_EAX]();", "gen_op_movl_T1_im(VAR_19);", "gen_op_testl_T0_T1_cc();", "VAR_0->cc_op = CC_OP_LOGICB + VAR_7;", "break;", "case 0x98:\nif (VAR_5)\ngen_op_movswl_EAX_AX();", "else\ngen_op_movsbw_AX_AL();", "break;", "case 0x99:\nif (VAR_5)\ngen_op_movslq_EDX_EAX();", "else\ngen_op_movswl_DX_AX();", "break;", "case 0x1af:\ncase 0x69:\ncase 0x6b:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = ((VAR_8 >> 3) & 7) + OR_EAX;", "gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 0);", "if (VAR_2 == 0x69) {", "VAR_19 = insn_get(VAR_0, VAR_7);", "gen_op_movl_T1_im(VAR_19);", "} else if (VAR_2 == 0x6b) {", "VAR_19 = insn_get(VAR_0, OT_BYTE);", "gen_op_movl_T1_im(VAR_19);", "} else {", "gen_op_mov_TN_reg[VAR_7][1][VAR_9]();", "}", "if (VAR_7 == OT_LONG) {", "gen_op_imull_T0_T1();", "} else {", "gen_op_imulw_T0_T1();", "}", "gen_op_mov_reg_T0[VAR_7][VAR_9]();", "VAR_0->cc_op = CC_OP_MUL;", "break;", "case 0x1c0:\ncase 0x1c1:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = (VAR_8 >> 3) & 7;", "VAR_11 = (VAR_8 >> 6) & 3;", "if (VAR_11 == 3) {", "VAR_10 = VAR_8 & 7;", "gen_op_mov_TN_reg[VAR_7][0][VAR_9]();", "gen_op_mov_TN_reg[VAR_7][1][VAR_10]();", "gen_op_addl_T0_T1_cc();", "gen_op_mov_reg_T0[VAR_7][VAR_10]();", "gen_op_mov_reg_T1[VAR_7][VAR_9]();", "} else {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "gen_op_mov_TN_reg[VAR_7][0][VAR_9]();", "gen_op_ld_T1_A0[VAR_7]();", "gen_op_addl_T0_T1_cc();", "gen_op_st_T0_A0[VAR_7]();", "gen_op_mov_reg_T1[VAR_7][VAR_9]();", "}", "VAR_0->cc_op = CC_OP_ADDB + VAR_7;", "break;", "case 0x1b0:\ncase 0x1b1:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = (VAR_8 >> 3) & 7;", "VAR_11 = (VAR_8 >> 6) & 3;", "gen_op_mov_TN_reg[VAR_7][1][VAR_9]();", "if (VAR_11 == 3) {", "VAR_10 = VAR_8 & 7;", "gen_op_mov_TN_reg[VAR_7][0][VAR_10]();", "gen_op_cmpxchg_T0_T1_EAX_cc[VAR_7]();", "gen_op_mov_reg_T0[VAR_7][VAR_10]();", "} else {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "gen_op_ld_T0_A0[VAR_7]();", "gen_op_cmpxchg_T0_T1_EAX_cc[VAR_7]();", "gen_op_st_T0_A0[VAR_7]();", "}", "VAR_0->cc_op = CC_OP_SUBB + VAR_7;", "break;", "case 0x1c7:\nVAR_8 = ldub(VAR_0->pc++);", "VAR_11 = (VAR_8 >> 6) & 3;", "if (VAR_11 == 3)\ngoto illegal_op;", "if (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "gen_op_cmpxchg8b();", "VAR_0->cc_op = CC_OP_EFLAGS;", "break;", "case 0x50 ... 0x57:\ngen_op_mov_TN_reg[OT_LONG][0][VAR_2 & 7]();", "gen_push_T0(VAR_0);", "break;", "case 0x58 ... 0x5f:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "gen_pop_T0(VAR_0);", "gen_op_mov_reg_T0[VAR_7][VAR_2 & 7]();", "gen_pop_update(VAR_0);", "break;", "case 0x60:\ngen_pusha(VAR_0);", "break;", "case 0x61:\ngen_popa(VAR_0);", "break;", "case 0x68:\ncase 0x6a:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "if (VAR_2 == 0x68)\nVAR_19 = insn_get(VAR_0, VAR_7);", "else\nVAR_19 = (int8_t)insn_get(VAR_0, OT_BYTE);", "gen_op_movl_T0_im(VAR_19);", "gen_push_T0(VAR_0);", "break;", "case 0x8f:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "gen_pop_T0(VAR_0);", "gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 1);", "gen_pop_update(VAR_0);", "break;", "case 0xc8:\n{", "int VAR_19;", "VAR_19 = lduw(VAR_0->pc);", "VAR_0->pc += 2;", "VAR_19 = ldub(VAR_0->pc++);", "gen_enter(VAR_0, VAR_19, VAR_19);", "}", "break;", "case 0xc9:\nif (VAR_0->ss32) {", "gen_op_mov_TN_reg[OT_LONG][0][R_EBP]();", "gen_op_mov_reg_T0[OT_LONG][R_ESP]();", "} else {", "gen_op_mov_TN_reg[OT_WORD][0][R_EBP]();", "gen_op_mov_reg_T0[OT_WORD][R_ESP]();", "}", "gen_pop_T0(VAR_0);", "VAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "gen_op_mov_reg_T0[VAR_7][R_EBP]();", "gen_pop_update(VAR_0);", "break;", "case 0x06:\ncase 0x0e:\ncase 0x16:\ncase 0x1e:\ngen_op_movl_T0_seg(VAR_2 >> 3);", "gen_push_T0(VAR_0);", "break;", "case 0x1a0:\ncase 0x1a8:\ngen_op_movl_T0_seg((VAR_2 >> 3) & 7);", "gen_push_T0(VAR_0);", "break;", "case 0x07:\ncase 0x17:\ncase 0x1f:\ngen_pop_T0(VAR_0);", "gen_movl_seg_T0(VAR_0, VAR_2 >> 3);", "gen_pop_update(VAR_0);", "break;", "case 0x1a1:\ncase 0x1a9:\ngen_pop_T0(VAR_0);", "gen_movl_seg_T0(VAR_0, (VAR_2 >> 3) & 7);", "gen_pop_update(VAR_0);", "break;", "case 0x88:\ncase 0x89:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = (VAR_8 >> 3) & 7;", "gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_EAX + VAR_9, 1);", "break;", "case 0xc6:\ncase 0xc7:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_11 = (VAR_8 >> 6) & 3;", "if (VAR_11 != 3)\ngen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "VAR_19 = insn_get(VAR_0, VAR_7);", "gen_op_movl_T0_im(VAR_19);", "if (VAR_11 != 3)\ngen_op_st_T0_A0[VAR_7]();", "else\ngen_op_mov_reg_T0[VAR_7][VAR_8 & 7]();", "break;", "case 0x8a:\ncase 0x8b:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = (VAR_8 >> 3) & 7;", "gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 0);", "gen_op_mov_reg_T0[VAR_7][VAR_9]();", "break;", "case 0x8e:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = (VAR_8 >> 3) & 7;", "gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 0);", "if (VAR_9 >= 6 || VAR_9 == R_CS)\ngoto illegal_op;", "gen_movl_seg_T0(VAR_0, VAR_9);", "break;", "case 0x8c:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = (VAR_8 >> 3) & 7;", "if (VAR_9 >= 6)\ngoto illegal_op;", "gen_op_movl_T0_seg(VAR_9);", "gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 1);", "break;", "case 0x1b6:\ncase 0x1b7:\ncase 0x1be:\ncase 0x1bf:\n{", "int VAR_20;", "VAR_20 = VAR_5 + OT_WORD;", "VAR_7 = (VAR_2 & 1) + OT_BYTE;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = ((VAR_8 >> 3) & 7) + OR_EAX;", "VAR_11 = (VAR_8 >> 6) & 3;", "VAR_10 = VAR_8 & 7;", "if (VAR_11 == 3) {", "gen_op_mov_TN_reg[VAR_7][0][VAR_10]();", "switch(VAR_7 | (VAR_2 & 8)) {", "case OT_BYTE:\ngen_op_movzbl_T0_T0();", "break;", "case OT_BYTE | 8:\ngen_op_movsbl_T0_T0();", "break;", "case OT_WORD:\ngen_op_movzwl_T0_T0();", "break;", "default:\ncase OT_WORD | 8:\ngen_op_movswl_T0_T0();", "break;", "}", "gen_op_mov_reg_T0[VAR_20][VAR_9]();", "} else {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "if (VAR_2 & 8) {", "gen_op_lds_T0_A0[VAR_7]();", "} else {", "gen_op_ldu_T0_A0[VAR_7]();", "}", "gen_op_mov_reg_T0[VAR_20][VAR_9]();", "}", "}", "break;", "case 0x8d:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = (VAR_8 >> 3) & 7;", "VAR_0->VAR_23 = -1;", "VAR_19 = VAR_0->addseg;", "VAR_0->addseg = 0;", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "VAR_0->addseg = VAR_19;", "gen_op_mov_reg_A0[VAR_7 - OT_WORD][VAR_9]();", "break;", "case 0xa0:\ncase 0xa1:\ncase 0xa2:\ncase 0xa3:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "if (VAR_0->VAR_4)\nVAR_15 = insn_get(VAR_0, OT_LONG);", "else\nVAR_15 = insn_get(VAR_0, OT_WORD);", "gen_op_movl_A0_im(VAR_15);", "{", "int VAR_23, VAR_23;", "VAR_23 = VAR_0->addseg;", "if (VAR_0->VAR_23 >= 0) {", "VAR_23 = VAR_0->VAR_23;", "VAR_23 = 1;", "} else {", "VAR_23 = R_DS;", "}", "if (VAR_23) {", "gen_op_addl_A0_seg(offsetof(CPUX86State,seg_cache[VAR_23].base));", "}", "}", "if ((VAR_2 & 2) == 0) {", "gen_op_ld_T0_A0[VAR_7]();", "gen_op_mov_reg_T0[VAR_7][R_EAX]();", "} else {", "gen_op_mov_TN_reg[VAR_7][0][R_EAX]();", "gen_op_st_T0_A0[VAR_7]();", "}", "break;", "case 0xd7:\ngen_op_movl_A0_reg[R_EBX]();", "gen_op_addl_A0_AL();", "if (VAR_0->VAR_4 == 0)\ngen_op_andl_A0_ffff();", "{", "int VAR_23, VAR_23;", "VAR_23 = VAR_0->addseg;", "VAR_23 = R_DS;", "if (VAR_0->VAR_23 >= 0) {", "VAR_23 = VAR_0->VAR_23;", "VAR_23 = 1;", "} else {", "VAR_23 = R_DS;", "}", "if (VAR_23) {", "gen_op_addl_A0_seg(offsetof(CPUX86State,seg_cache[VAR_23].base));", "}", "}", "gen_op_ldub_T0_A0();", "gen_op_mov_reg_T0[OT_BYTE][R_EAX]();", "break;", "case 0xb0 ... 0xb7:\nVAR_19 = insn_get(VAR_0, OT_BYTE);", "gen_op_movl_T0_im(VAR_19);", "gen_op_mov_reg_T0[OT_BYTE][VAR_2 & 7]();", "break;", "case 0xb8 ... 0xbf:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_19 = insn_get(VAR_0, VAR_7);", "VAR_9 = OR_EAX + (VAR_2 & 7);", "gen_op_movl_T0_im(VAR_19);", "gen_op_mov_reg_T0[VAR_7][VAR_9]();", "break;", "case 0x91 ... 0x97:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_9 = VAR_2 & 7;", "VAR_10 = R_EAX;", "goto do_xchg_reg;", "case 0x86:\ncase 0x87:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = (VAR_8 >> 3) & 7;", "VAR_11 = (VAR_8 >> 6) & 3;", "if (VAR_11 == 3) {", "VAR_10 = VAR_8 & 7;", "do_xchg_reg:\ngen_op_mov_TN_reg[VAR_7][0][VAR_9]();", "gen_op_mov_TN_reg[VAR_7][1][VAR_10]();", "gen_op_mov_reg_T0[VAR_7][VAR_10]();", "gen_op_mov_reg_T1[VAR_7][VAR_9]();", "} else {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "gen_op_mov_TN_reg[VAR_7][0][VAR_9]();", "if (!(VAR_3 & PREFIX_LOCK))\ngen_op_lock();", "gen_op_ld_T1_A0[VAR_7]();", "gen_op_st_T0_A0[VAR_7]();", "if (!(VAR_3 & PREFIX_LOCK))\ngen_op_unlock();", "gen_op_mov_reg_T1[VAR_7][VAR_9]();", "}", "break;", "case 0xc4:\nVAR_18 = R_ES;", "goto do_lxx;", "case 0xc5:\nVAR_18 = R_DS;", "goto do_lxx;", "case 0x1b2:\nVAR_18 = R_SS;", "goto do_lxx;", "case 0x1b4:\nVAR_18 = R_FS;", "goto do_lxx;", "case 0x1b5:\nVAR_18 = R_GS;", "do_lxx:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = (VAR_8 >> 3) & 7;", "VAR_11 = (VAR_8 >> 6) & 3;", "if (VAR_11 == 3)\ngoto illegal_op;", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "gen_op_ld_T1_A0[VAR_7]();", "gen_op_addl_A0_im(1 << (VAR_7 - OT_WORD + 1));", "gen_op_lduw_T0_A0();", "gen_movl_seg_T0(VAR_0, VAR_18);", "gen_op_mov_reg_T1[VAR_7][VAR_9]();", "break;", "case 0xc0:\ncase 0xc1:\nVAR_6 = 2;", "grp2:\n{", "if ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_11 = (VAR_8 >> 6) & 3;", "VAR_10 = VAR_8 & 7;", "VAR_18 = (VAR_8 >> 3) & 7;", "if (VAR_11 != 3) {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "gen_op_ld_T0_A0[VAR_7]();", "VAR_14 = OR_TMP0;", "} else {", "VAR_14 = VAR_10 + OR_EAX;", "}", "if (VAR_6 == 0) {", "gen_shift(VAR_0, VAR_18, VAR_7, VAR_14, OR_ECX);", "} else {", "if (VAR_6 == 2) {", "VAR_6 = ldub(VAR_0->pc++);", "}", "gen_shifti(VAR_0, VAR_18, VAR_7, VAR_14, VAR_6);", "}", "if (VAR_11 != 3) {", "gen_op_st_T0_A0[VAR_7]();", "}", "}", "break;", "case 0xd0:\ncase 0xd1:\nVAR_6 = 1;", "goto grp2;", "case 0xd2:\ncase 0xd3:\nVAR_6 = 0;", "goto grp2;", "case 0x1a4:\nVAR_18 = 0;", "VAR_6 = 1;", "goto do_shiftd;", "case 0x1a5:\nVAR_18 = 0;", "VAR_6 = 0;", "goto do_shiftd;", "case 0x1ac:\nVAR_18 = 1;", "VAR_6 = 1;", "goto do_shiftd;", "case 0x1ad:\nVAR_18 = 1;", "VAR_6 = 0;", "do_shiftd:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_11 = (VAR_8 >> 6) & 3;", "VAR_10 = VAR_8 & 7;", "VAR_9 = (VAR_8 >> 3) & 7;", "if (VAR_11 != 3) {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "gen_op_ld_T0_A0[VAR_7]();", "} else {", "gen_op_mov_TN_reg[VAR_7][0][VAR_10]();", "}", "gen_op_mov_TN_reg[VAR_7][1][VAR_9]();", "if (VAR_6) {", "VAR_19 = ldub(VAR_0->pc++);", "VAR_19 &= 0x1f;", "if (VAR_19) {", "gen_op_shiftd_T0_T1_im_cc[VAR_7 - OT_WORD][VAR_18](VAR_19);", "if (VAR_18 == 0 && VAR_7 != OT_WORD)\nVAR_0->cc_op = CC_OP_SHLB + VAR_7;", "else\nVAR_0->cc_op = CC_OP_SARB + VAR_7;", "}", "} else {", "if (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_op_shiftd_T0_T1_ECX_cc[VAR_7 - OT_WORD][VAR_18]();", "VAR_0->cc_op = CC_OP_DYNAMIC;", "}", "if (VAR_11 != 3) {", "gen_op_st_T0_A0[VAR_7]();", "} else {", "gen_op_mov_reg_T0[VAR_7][VAR_10]();", "}", "break;", "case 0xd8 ... 0xdf:\nVAR_8 = ldub(VAR_0->pc++);", "VAR_11 = (VAR_8 >> 6) & 3;", "VAR_10 = VAR_8 & 7;", "VAR_18 = ((VAR_2 & 7) << 3) | ((VAR_8 >> 3) & 7);", "if (VAR_11 != 3) {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "switch(VAR_18) {", "case 0x00 ... 0x07:\ncase 0x10 ... 0x17:\ncase 0x20 ... 0x27:\ncase 0x30 ... 0x37:\n{", "int VAR_24;", "VAR_24 = VAR_18 & 7;", "switch(VAR_18 >> 4) {", "case 0:\ngen_op_flds_FT0_A0();", "break;", "case 1:\ngen_op_fildl_FT0_A0();", "break;", "case 2:\ngen_op_fldl_FT0_A0();", "break;", "case 3:\ndefault:\ngen_op_fild_FT0_A0();", "break;", "}", "gen_op_fp_arith_ST0_FT0[VAR_24]();", "if (VAR_24 == 3) {", "gen_op_fpop();", "}", "}", "break;", "case 0x08:\ncase 0x0a:\ncase 0x0b:\ncase 0x18:\ncase 0x1a:\ncase 0x1b:\ncase 0x28:\ncase 0x2a:\ncase 0x2b:\ncase 0x38:\ncase 0x3a:\ncase 0x3b:\nswitch(VAR_18 & 7) {", "case 0:\ngen_op_fpush();", "switch(VAR_18 >> 4) {", "case 0:\ngen_op_flds_ST0_A0();", "break;", "case 1:\ngen_op_fildl_ST0_A0();", "break;", "case 2:\ngen_op_fldl_ST0_A0();", "break;", "case 3:\ndefault:\ngen_op_fild_ST0_A0();", "break;", "}", "break;", "default:\nswitch(VAR_18 >> 4) {", "case 0:\ngen_op_fsts_ST0_A0();", "break;", "case 1:\ngen_op_fistl_ST0_A0();", "break;", "case 2:\ngen_op_fstl_ST0_A0();", "break;", "case 3:\ndefault:\ngen_op_fist_ST0_A0();", "break;", "}", "if ((VAR_18 & 7) == 3)\ngen_op_fpop();", "break;", "}", "break;", "case 0x0d:\ngen_op_fldcw_A0();", "break;", "case 0x0f:\ngen_op_fnstcw_A0();", "break;", "case 0x1d:\ngen_op_fpush();", "gen_op_fldt_ST0_A0();", "break;", "case 0x1f:\ngen_op_fstt_ST0_A0();", "gen_op_fpop();", "break;", "case 0x2f:\ngen_op_fnstsw_A0();", "break;", "case 0x3c:\ngen_op_fpush();", "gen_op_fbld_ST0_A0();", "break;", "case 0x3e:\ngen_op_fbst_ST0_A0();", "gen_op_fpop();", "break;", "case 0x3d:\ngen_op_fpush();", "gen_op_fildll_ST0_A0();", "break;", "case 0x3f:\ngen_op_fistll_ST0_A0();", "gen_op_fpop();", "break;", "default:\ngoto illegal_op;", "}", "} else {", "VAR_14 = VAR_10;", "switch(VAR_18) {", "case 0x08:\ngen_op_fpush();", "gen_op_fmov_ST0_STN((VAR_14 + 1) & 7);", "break;", "case 0x09:\ngen_op_fxchg_ST0_STN(VAR_14);", "break;", "case 0x0a:\nswitch(VAR_10) {", "case 0:\nbreak;", "default:\ngoto illegal_op;", "}", "break;", "case 0x0c:\nswitch(VAR_10) {", "case 0:\ngen_op_fchs_ST0();", "break;", "case 1:\ngen_op_fabs_ST0();", "break;", "case 4:\ngen_op_fldz_FT0();", "gen_op_fcom_ST0_FT0();", "break;", "case 5:\ngen_op_fxam_ST0();", "break;", "default:\ngoto illegal_op;", "}", "break;", "case 0x0d:\n{", "switch(VAR_10) {", "case 0:\ngen_op_fpush();", "gen_op_fld1_ST0();", "break;", "case 1:\ngen_op_fpush();", "gen_op_fldl2t_ST0();", "break;", "case 2:\ngen_op_fpush();", "gen_op_fldl2e_ST0();", "break;", "case 3:\ngen_op_fpush();", "gen_op_fldpi_ST0();", "break;", "case 4:\ngen_op_fpush();", "gen_op_fldlg2_ST0();", "break;", "case 5:\ngen_op_fpush();", "gen_op_fldln2_ST0();", "break;", "case 6:\ngen_op_fpush();", "gen_op_fldz_ST0();", "break;", "default:\ngoto illegal_op;", "}", "}", "break;", "case 0x0e:\nswitch(VAR_10) {", "case 0:\ngen_op_f2xm1();", "break;", "case 1:\ngen_op_fyl2x();", "break;", "case 2:\ngen_op_fptan();", "break;", "case 3:\ngen_op_fpatan();", "break;", "case 4:\ngen_op_fxtract();", "break;", "case 5:\ngen_op_fprem1();", "break;", "case 6:\ngen_op_fdecstp();", "break;", "default:\ncase 7:\ngen_op_fincstp();", "break;", "}", "break;", "case 0x0f:\nswitch(VAR_10) {", "case 0:\ngen_op_fprem();", "break;", "case 1:\ngen_op_fyl2xp1();", "break;", "case 2:\ngen_op_fsqrt();", "break;", "case 3:\ngen_op_fsincos();", "break;", "case 5:\ngen_op_fscale();", "break;", "case 4:\ngen_op_frndint();", "break;", "case 6:\ngen_op_fsin();", "break;", "default:\ncase 7:\ngen_op_fcos();", "break;", "}", "break;", "case 0x00: case 0x01: case 0x04 ... 0x07:\ncase 0x20: case 0x21: case 0x24 ... 0x27:\ncase 0x30: case 0x31: case 0x34 ... 0x37:\n{", "int VAR_24;", "VAR_24 = VAR_18 & 7;", "if (VAR_18 >= 0x20) {", "gen_op_fp_arith_STN_ST0[VAR_24](VAR_14);", "if (VAR_18 >= 0x30)\ngen_op_fpop();", "} else {", "gen_op_fmov_FT0_STN(VAR_14);", "gen_op_fp_arith_ST0_FT0[VAR_24]();", "}", "}", "break;", "case 0x02:\ngen_op_fmov_FT0_STN(VAR_14);", "gen_op_fcom_ST0_FT0();", "break;", "case 0x03:\ngen_op_fmov_FT0_STN(VAR_14);", "gen_op_fcom_ST0_FT0();", "gen_op_fpop();", "break;", "case 0x15:\nswitch(VAR_10) {", "case 1:\ngen_op_fmov_FT0_STN(1);", "gen_op_fucom_ST0_FT0();", "gen_op_fpop();", "gen_op_fpop();", "break;", "default:\ngoto illegal_op;", "}", "break;", "case 0x1c:\nswitch(VAR_10) {", "case 2:\ngen_op_fclex();", "break;", "case 3:\ngen_op_fninit();", "break;", "default:\ngoto illegal_op;", "}", "break;", "case 0x2a:\ngen_op_fmov_STN_ST0(VAR_14);", "break;", "case 0x2b:\ngen_op_fmov_STN_ST0(VAR_14);", "gen_op_fpop();", "break;", "case 0x2c:\ngen_op_fmov_FT0_STN(VAR_14);", "gen_op_fucom_ST0_FT0();", "break;", "case 0x2d:\ngen_op_fmov_FT0_STN(VAR_14);", "gen_op_fucom_ST0_FT0();", "gen_op_fpop();", "break;", "case 0x33:\nswitch(VAR_10) {", "case 1:\ngen_op_fmov_FT0_STN(1);", "gen_op_fcom_ST0_FT0();", "gen_op_fpop();", "gen_op_fpop();", "break;", "default:\ngoto illegal_op;", "}", "break;", "case 0x3c:\nswitch(VAR_10) {", "case 0:\ngen_op_fnstsw_EAX();", "break;", "default:\ngoto illegal_op;", "}", "break;", "default:\ngoto illegal_op;", "}", "}", "break;", "case 0xa4:\ncase 0xa5:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "if (VAR_3 & PREFIX_REPZ) {", "gen_string_ds(VAR_0, VAR_7, gen_op_movs + 9);", "} else {", "gen_string_ds(VAR_0, VAR_7, gen_op_movs);", "}", "break;", "case 0xaa:\ncase 0xab:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "if (VAR_3 & PREFIX_REPZ) {", "gen_string_es(VAR_0, VAR_7, gen_op_stos + 9);", "} else {", "gen_string_es(VAR_0, VAR_7, gen_op_stos);", "}", "break;", "case 0xac:\ncase 0xad:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "if (VAR_3 & PREFIX_REPZ) {", "gen_string_ds(VAR_0, VAR_7, gen_op_lods + 9);", "} else {", "gen_string_ds(VAR_0, VAR_7, gen_op_lods);", "}", "break;", "case 0xae:\ncase 0xaf:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "if (VAR_3 & PREFIX_REPNZ) {", "if (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_string_es(VAR_0, VAR_7, gen_op_scas + 9 * 2);", "VAR_0->cc_op = CC_OP_DYNAMIC;", "} else if (VAR_3 & PREFIX_REPZ) {", "if (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_string_es(VAR_0, VAR_7, gen_op_scas + 9);", "VAR_0->cc_op = CC_OP_DYNAMIC;", "} else {", "gen_string_es(VAR_0, VAR_7, gen_op_scas);", "VAR_0->cc_op = CC_OP_SUBB + VAR_7;", "}", "break;", "case 0xa6:\ncase 0xa7:\nif ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "if (VAR_3 & PREFIX_REPNZ) {", "if (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_string_ds(VAR_0, VAR_7, gen_op_cmps + 9 * 2);", "VAR_0->cc_op = CC_OP_DYNAMIC;", "} else if (VAR_3 & PREFIX_REPZ) {", "if (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_string_ds(VAR_0, VAR_7, gen_op_cmps + 9);", "VAR_0->cc_op = CC_OP_DYNAMIC;", "} else {", "gen_string_ds(VAR_0, VAR_7, gen_op_cmps);", "VAR_0->cc_op = CC_OP_SUBB + VAR_7;", "}", "break;", "case 0x6c:\ncase 0x6d:\nif (VAR_0->cpl > VAR_0->iopl || VAR_0->vm86) {", "gen_op_gpf(VAR_1 - VAR_0->cs_base);", "} else {", "if ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "if (VAR_3 & PREFIX_REPZ) {", "gen_string_es(VAR_0, VAR_7, gen_op_ins + 9);", "} else {", "gen_string_es(VAR_0, VAR_7, gen_op_ins);", "}", "}", "break;", "case 0x6e:\ncase 0x6f:\nif (VAR_0->cpl > VAR_0->iopl || VAR_0->vm86) {", "gen_op_gpf(VAR_1 - VAR_0->cs_base);", "} else {", "if ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "if (VAR_3 & PREFIX_REPZ) {", "gen_string_ds(VAR_0, VAR_7, gen_op_outs + 9);", "} else {", "gen_string_ds(VAR_0, VAR_7, gen_op_outs);", "}", "}", "break;", "case 0xe4:\ncase 0xe5:\nif (VAR_0->cpl > VAR_0->iopl || VAR_0->vm86) {", "gen_op_gpf(VAR_1 - VAR_0->cs_base);", "} else {", "if ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_19 = ldub(VAR_0->pc++);", "gen_op_movl_T0_im(VAR_19);", "gen_op_in[VAR_7]();", "gen_op_mov_reg_T1[VAR_7][R_EAX]();", "}", "break;", "case 0xe6:\ncase 0xe7:\nif (VAR_0->cpl > VAR_0->iopl || VAR_0->vm86) {", "gen_op_gpf(VAR_1 - VAR_0->cs_base);", "} else {", "if ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_19 = ldub(VAR_0->pc++);", "gen_op_movl_T0_im(VAR_19);", "gen_op_mov_TN_reg[VAR_7][1][R_EAX]();", "gen_op_out[VAR_7]();", "}", "break;", "case 0xec:\ncase 0xed:\nif (VAR_0->cpl > VAR_0->iopl || VAR_0->vm86) {", "gen_op_gpf(VAR_1 - VAR_0->cs_base);", "} else {", "if ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "gen_op_mov_TN_reg[OT_WORD][0][R_EDX]();", "gen_op_in[VAR_7]();", "gen_op_mov_reg_T1[VAR_7][R_EAX]();", "}", "break;", "case 0xee:\ncase 0xef:\nif (VAR_0->cpl > VAR_0->iopl || VAR_0->vm86) {", "gen_op_gpf(VAR_1 - VAR_0->cs_base);", "} else {", "if ((VAR_2 & 1) == 0)\nVAR_7 = OT_BYTE;", "else\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "gen_op_mov_TN_reg[OT_WORD][0][R_EDX]();", "gen_op_mov_TN_reg[VAR_7][1][R_EAX]();", "gen_op_out[VAR_7]();", "}", "break;", "case 0xc2:\nVAR_19 = ldsw(VAR_0->pc);", "VAR_0->pc += 2;", "gen_pop_T0(VAR_0);", "if (VAR_0->ss32)\ngen_op_addl_ESP_im(VAR_19 + (2 << VAR_0->VAR_5));", "else\ngen_op_addw_ESP_im(VAR_19 + (2 << VAR_0->VAR_5));", "if (VAR_0->VAR_5 == 0)\ngen_op_andl_T0_ffff();", "gen_op_jmp_T0();", "VAR_0->is_jmp = 1;", "break;", "case 0xc3:\ngen_pop_T0(VAR_0);", "gen_pop_update(VAR_0);", "if (VAR_0->VAR_5 == 0)\ngen_op_andl_T0_ffff();", "gen_op_jmp_T0();", "VAR_0->is_jmp = 1;", "break;", "case 0xca:\nVAR_19 = ldsw(VAR_0->pc);", "VAR_0->pc += 2;", "gen_pop_T0(VAR_0);", "if (VAR_0->VAR_5 == 0)\ngen_op_andl_T0_ffff();", "gen_op_jmp_T0();", "gen_pop_update(VAR_0);", "gen_pop_T0(VAR_0);", "gen_movl_seg_T0(VAR_0, R_CS);", "gen_pop_update(VAR_0);", "if (VAR_0->ss32)\ngen_op_addl_ESP_im(VAR_19 + (2 << VAR_0->VAR_5));", "else\ngen_op_addw_ESP_im(VAR_19 + (2 << VAR_0->VAR_5));", "VAR_0->is_jmp = 1;", "break;", "case 0xcb:\ngen_pop_T0(VAR_0);", "if (VAR_0->VAR_5 == 0)\ngen_op_andl_T0_ffff();", "gen_op_jmp_T0();", "gen_pop_update(VAR_0);", "gen_pop_T0(VAR_0);", "gen_movl_seg_T0(VAR_0, R_CS);", "gen_pop_update(VAR_0);", "VAR_0->is_jmp = 1;", "break;", "case 0xcf:\ngen_pop_T0(VAR_0);", "if (VAR_0->VAR_5 == 0)\ngen_op_andl_T0_ffff();", "gen_op_jmp_T0();", "gen_pop_update(VAR_0);", "gen_pop_T0(VAR_0);", "gen_movl_seg_T0(VAR_0, R_CS);", "gen_pop_update(VAR_0);", "gen_pop_T0(VAR_0);", "if (VAR_0->VAR_5) {", "if (VAR_0->vm86)\ngen_op_movl_eflags_T0_vm(VAR_1 - VAR_0->cs_base);", "else\ngen_op_movl_eflags_T0();", "} else {", "if (VAR_0->vm86)\ngen_op_movw_eflags_T0_vm(VAR_1 - VAR_0->cs_base);", "else\ngen_op_movw_eflags_T0();", "}", "gen_pop_update(VAR_0);", "VAR_0->cc_op = CC_OP_EFLAGS;", "VAR_0->is_jmp = 1;", "break;", "case 0xe8:\n{", "unsigned int VAR_24;", "VAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_19 = insn_get(VAR_0, VAR_7);", "VAR_24 = VAR_0->pc - VAR_0->cs_base;", "VAR_19 += VAR_24;", "if (VAR_0->VAR_5 == 0)\nVAR_19 &= 0xffff;", "gen_op_movl_T0_im(VAR_24);", "gen_push_T0(VAR_0);", "gen_op_jmp_im(VAR_19);", "VAR_0->is_jmp = 1;", "}", "break;", "case 0x9a:\n{", "unsigned int VAR_26, VAR_26;", "VAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_26 = insn_get(VAR_0, VAR_7);", "VAR_26 = insn_get(VAR_0, OT_WORD);", "gen_op_movl_T0_seg(R_CS);", "gen_push_T0(VAR_0);", "VAR_24 = VAR_0->pc - VAR_0->cs_base;", "gen_op_movl_T0_im(VAR_24);", "gen_push_T0(VAR_0);", "gen_op_movl_T0_im(VAR_26);", "gen_movl_seg_T0(VAR_0, R_CS);", "gen_op_jmp_im((unsigned long)VAR_26);", "VAR_0->is_jmp = 1;", "}", "break;", "case 0xe9:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_19 = insn_get(VAR_0, VAR_7);", "VAR_19 += VAR_0->pc - VAR_0->cs_base;", "if (VAR_0->VAR_5 == 0)\nVAR_19 = VAR_19 & 0xffff;", "gen_op_jmp_im(VAR_19);", "VAR_0->is_jmp = 1;", "break;", "case 0xea:\n{", "unsigned int VAR_26, VAR_26;", "VAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_26 = insn_get(VAR_0, VAR_7);", "VAR_26 = insn_get(VAR_0, OT_WORD);", "gen_op_movl_T0_im(VAR_26);", "gen_movl_seg_T0(VAR_0, R_CS);", "gen_op_jmp_im((unsigned long)VAR_26);", "VAR_0->is_jmp = 1;", "}", "break;", "case 0xeb:\nVAR_19 = (int8_t)insn_get(VAR_0, OT_BYTE);", "VAR_19 += VAR_0->pc - VAR_0->cs_base;", "if (VAR_0->VAR_5 == 0)\nVAR_19 = VAR_19 & 0xffff;", "gen_op_jmp_im(VAR_19);", "VAR_0->is_jmp = 1;", "break;", "case 0x70 ... 0x7f:\nVAR_19 = (int8_t)insn_get(VAR_0, OT_BYTE);", "goto do_jcc;", "case 0x180 ... 0x18f:\nif (VAR_5) {", "VAR_19 = insn_get(VAR_0, OT_LONG);", "} else {", "VAR_19 = (int16_t)insn_get(VAR_0, OT_WORD);", "}", "do_jcc:\nVAR_24 = VAR_0->pc - VAR_0->cs_base;", "VAR_19 += VAR_24;", "if (VAR_0->VAR_5 == 0)\nVAR_19 &= 0xffff;", "gen_jcc(VAR_0, VAR_2, VAR_19, VAR_24);", "VAR_0->is_jmp = 1;", "break;", "case 0x190 ... 0x19f:\nVAR_8 = ldub(VAR_0->pc++);", "gen_setcc(VAR_0, VAR_2);", "gen_ldst_modrm(VAR_0, VAR_8, OT_BYTE, OR_TMP0, 1);", "break;", "case 0x140 ... 0x14f:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = (VAR_8 >> 3) & 7;", "VAR_11 = (VAR_8 >> 6) & 3;", "gen_setcc(VAR_0, VAR_2);", "if (VAR_11 != 3) {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "gen_op_ld_T1_A0[VAR_7]();", "} else {", "VAR_10 = VAR_8 & 7;", "gen_op_mov_TN_reg[VAR_7][1][VAR_10]();", "}", "gen_op_cmov_reg_T1_T0[VAR_7 - OT_WORD][VAR_9]();", "break;", "case 0x9c:\nif (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "if (VAR_0->vm86)\ngen_op_movl_T0_eflags_vm();", "else\ngen_op_movl_T0_eflags();", "gen_push_T0(VAR_0);", "break;", "case 0x9d:\ngen_pop_T0(VAR_0);", "if (VAR_0->VAR_5) {", "if (VAR_0->vm86)\ngen_op_movl_eflags_T0_vm(VAR_1 - VAR_0->cs_base);", "else\ngen_op_movl_eflags_T0();", "} else {", "if (VAR_0->vm86)\ngen_op_movw_eflags_T0_vm(VAR_1 - VAR_0->cs_base);", "else\ngen_op_movw_eflags_T0();", "}", "gen_pop_update(VAR_0);", "VAR_0->cc_op = CC_OP_EFLAGS;", "break;", "case 0x9e:\ngen_op_mov_TN_reg[OT_BYTE][0][R_AH]();", "if (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_op_movb_eflags_T0();", "VAR_0->cc_op = CC_OP_EFLAGS;", "break;", "case 0x9f:\nif (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_op_movl_T0_eflags();", "gen_op_mov_reg_T0[OT_BYTE][R_AH]();", "break;", "case 0xf5:\nif (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_op_cmc();", "VAR_0->cc_op = CC_OP_EFLAGS;", "break;", "case 0xf8:\nif (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_op_clc();", "VAR_0->cc_op = CC_OP_EFLAGS;", "break;", "case 0xf9:\nif (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_op_stc();", "VAR_0->cc_op = CC_OP_EFLAGS;", "break;", "case 0xfc:\ngen_op_cld();", "break;", "case 0xfd:\ngen_op_std();", "break;", "case 0x1ba:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_18 = (VAR_8 >> 3) & 7;", "VAR_11 = (VAR_8 >> 6) & 3;", "VAR_10 = VAR_8 & 7;", "if (VAR_11 != 3) {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "gen_op_ld_T0_A0[VAR_7]();", "} else {", "gen_op_mov_TN_reg[VAR_7][0][VAR_10]();", "}", "VAR_19 = ldub(VAR_0->pc++);", "gen_op_movl_T1_im(VAR_19);", "if (VAR_18 < 4)\ngoto illegal_op;", "VAR_18 -= 4;", "gen_op_btx_T0_T1_cc[VAR_7 - OT_WORD][VAR_18]();", "VAR_0->cc_op = CC_OP_SARB + VAR_7;", "if (VAR_18 != 0) {", "if (VAR_11 != 3)\ngen_op_st_T0_A0[VAR_7]();", "else\ngen_op_mov_reg_T0[VAR_7][VAR_10]();", "}", "break;", "case 0x1a3:\nVAR_18 = 0;", "goto do_btx;", "case 0x1ab:\nVAR_18 = 1;", "goto do_btx;", "case 0x1b3:\nVAR_18 = 2;", "goto do_btx;", "case 0x1bb:\nVAR_18 = 3;", "do_btx:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = (VAR_8 >> 3) & 7;", "VAR_11 = (VAR_8 >> 6) & 3;", "VAR_10 = VAR_8 & 7;", "gen_op_mov_TN_reg[OT_LONG][1][VAR_9]();", "if (VAR_11 != 3) {", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "if (VAR_7 == OT_WORD)\ngen_op_add_bitw_A0_T1();", "else\ngen_op_add_bitl_A0_T1();", "gen_op_ld_T0_A0[VAR_7]();", "} else {", "gen_op_mov_TN_reg[VAR_7][0][VAR_10]();", "}", "gen_op_btx_T0_T1_cc[VAR_7 - OT_WORD][VAR_18]();", "VAR_0->cc_op = CC_OP_SARB + VAR_7;", "if (VAR_18 != 0) {", "if (VAR_11 != 3)\ngen_op_st_T0_A0[VAR_7]();", "else\ngen_op_mov_reg_T0[VAR_7][VAR_10]();", "}", "break;", "case 0x1bc:\ncase 0x1bd:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = (VAR_8 >> 3) & 7;", "gen_ldst_modrm(VAR_0, VAR_8, VAR_7, OR_TMP0, 0);", "gen_op_bsx_T0_cc[VAR_7 - OT_WORD][VAR_2 & 1]();", "gen_op_mov_reg_T0[VAR_7][VAR_9]();", "VAR_0->cc_op = CC_OP_LOGICB + VAR_7;", "break;", "case 0x27:\nif (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_op_daa();", "VAR_0->cc_op = CC_OP_EFLAGS;", "break;", "case 0x2f:\nif (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_op_das();", "VAR_0->cc_op = CC_OP_EFLAGS;", "break;", "case 0x37:\nif (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_op_aaa();", "VAR_0->cc_op = CC_OP_EFLAGS;", "break;", "case 0x3f:\nif (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_op_aas();", "VAR_0->cc_op = CC_OP_EFLAGS;", "break;", "case 0xd4:\nVAR_19 = ldub(VAR_0->pc++);", "gen_op_aam(VAR_19);", "VAR_0->cc_op = CC_OP_LOGICB;", "break;", "case 0xd5:\nVAR_19 = ldub(VAR_0->pc++);", "gen_op_aad(VAR_19);", "VAR_0->cc_op = CC_OP_LOGICB;", "break;", "case 0x90:\nbreak;", "case 0xcc:\ngen_op_int3((long)VAR_1);", "VAR_0->is_jmp = 1;", "break;", "case 0xcd:\nVAR_19 = ldub(VAR_0->pc++);", "gen_op_int_im(VAR_19, VAR_1 - VAR_0->cs_base);", "VAR_0->is_jmp = 1;", "break;", "case 0xce:\nif (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_op_into();", "break;", "case 0xfa:\nif (!VAR_0->vm86) {", "if (VAR_0->cpl <= VAR_0->iopl)\ngen_op_cli();", "else\ngen_op_gpf(VAR_1 - VAR_0->cs_base);", "} else {", "if (VAR_0->iopl == 3)\ngen_op_cli();", "else\ngen_op_cli_vm();", "}", "break;", "case 0xfb:\nif (!VAR_0->vm86) {", "if (VAR_0->cpl <= VAR_0->iopl)\ngen_op_sti();", "else\ngen_op_gpf(VAR_1 - VAR_0->cs_base);", "} else {", "if (VAR_0->iopl == 3)\ngen_op_sti();", "else\ngen_op_sti_vm(VAR_1 - VAR_0->cs_base);", "}", "break;", "case 0x62:\nVAR_7 = VAR_5 ? OT_LONG : OT_WORD;", "VAR_8 = ldub(VAR_0->pc++);", "VAR_9 = (VAR_8 >> 3) & 7;", "VAR_11 = (VAR_8 >> 6) & 3;", "if (VAR_11 == 3)\ngoto illegal_op;", "gen_op_mov_reg_T0[VAR_7][VAR_9]();", "gen_lea_modrm(VAR_0, VAR_8, &VAR_12, &VAR_15);", "if (VAR_7 == OT_WORD)\ngen_op_boundw();", "else\ngen_op_boundl();", "break;", "case 0x1c8 ... 0x1cf:\nVAR_9 = VAR_2 & 7;", "gen_op_mov_TN_reg[OT_LONG][0][VAR_9]();", "gen_op_bswapl_T0();", "gen_op_mov_reg_T0[OT_LONG][VAR_9]();", "break;", "case 0xd6:\nif (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "gen_op_salc();", "break;", "case 0xe0:\ncase 0xe1:\nif (VAR_0->cc_op != CC_OP_DYNAMIC)\ngen_op_set_cc_op(VAR_0->cc_op);", "case 0xe2:\ncase 0xe3:\nVAR_19 = (int8_t)insn_get(VAR_0, OT_BYTE);", "VAR_24 = VAR_0->pc - VAR_0->cs_base;", "VAR_19 += VAR_24;", "if (VAR_0->VAR_5 == 0)\nVAR_19 &= 0xffff;", "gen_op_loop[VAR_0->VAR_4][VAR_2 & 3](VAR_19, VAR_24);", "VAR_0->is_jmp = 1;", "break;", "case 0x131:\ngen_op_rdtsc();", "break;", "case 0x1a2:\ngen_op_cpuid();", "break;", "case 0xf4:\nif (VAR_0->cpl == 0) {", "} else {", "gen_op_gpf(VAR_1 - VAR_0->cs_base);", "}", "break;", "default:\ngoto illegal_op;", "}", "if (VAR_0->prefix & PREFIX_LOCK)\ngen_op_unlock();", "return (long)VAR_0->pc;", "illegal_op:\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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 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, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 111, 113 ], [ 115, 117 ], [ 121 ], [ 123 ], [ 125 ], [ 131, 133 ], [ 139, 141 ], [ 143, 149 ], [ 151 ], [ 159, 161, 163, 165, 167, 169, 171, 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185, 187 ], [ 189, 191 ], [ 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 ], [ 275, 277, 279, 281 ], [ 283 ], [ 287, 289 ], [ 291, 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 323 ], [ 325, 327, 329, 331 ], [ 333 ], [ 335, 337 ], [ 339 ], [ 341 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 363, 365 ], [ 367 ], [ 369 ], [ 371, 373 ], [ 375 ], [ 377 ], [ 379, 381, 383, 385 ], [ 387, 389 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 415 ], [ 417, 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429, 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445, 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463, 465 ], [ 467, 469 ], [ 471 ], [ 473, 475 ], [ 477 ], [ 479, 481, 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 493, 495 ], [ 497, 499 ], [ 501 ], [ 503, 505 ], [ 507 ], [ 509, 511, 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523, 525 ], [ 527, 529 ], [ 531 ], [ 533, 535 ], [ 537 ], [ 539, 541, 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551, 553 ], [ 555, 557 ], [ 559 ], [ 561, 563 ], [ 565 ], [ 567, 569, 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579, 581 ], [ 583 ], [ 585 ], [ 589, 591, 593, 595 ], [ 597, 599 ], [ 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, 667, 669 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683, 687 ], [ 689 ], [ 691 ], [ 693 ], [ 695 ], [ 699 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 709 ], [ 711 ], [ 713 ], [ 715, 717, 719 ], [ 721 ], [ 723 ], [ 725 ], [ 727, 729 ], [ 731 ], [ 733 ], [ 735 ], [ 737 ], [ 739 ], [ 741 ], [ 743 ], [ 745, 747 ], [ 749 ], [ 751, 753 ], [ 755 ], [ 757 ], [ 761, 763, 765, 767 ], [ 769, 771 ], [ 775 ], [ 777 ], [ 779 ], [ 781 ], [ 785 ], [ 787 ], [ 789 ], [ 791 ], [ 793 ], [ 797, 799, 801, 803 ], [ 805, 807 ], [ 809 ], [ 813 ], [ 815 ], [ 817 ], [ 819 ], [ 821 ], [ 825, 827, 829 ], [ 831, 833 ], [ 835 ], [ 837, 839, 841 ], [ 843, 845 ], [ 847 ], [ 849, 851, 853, 855 ], [ 857 ], [ 859 ], [ 861 ], [ 863 ], [ 865 ], [ 867 ], [ 869 ], [ 871 ], [ 873 ], [ 875 ], [ 877 ], [ 879 ], [ 883 ], [ 885 ], [ 887 ], [ 889 ], [ 891 ], [ 893 ], [ 895 ], [ 897 ], [ 899, 901, 903, 905 ], [ 907, 909 ], [ 911 ], [ 913 ], [ 915 ], [ 917 ], [ 919 ], [ 921 ], [ 923 ], [ 925 ], [ 927 ], [ 929 ], [ 931 ], [ 933 ], [ 935 ], [ 937 ], [ 939 ], [ 941 ], [ 943 ], [ 945 ], [ 947 ], [ 949 ], [ 951, 953, 955, 957 ], [ 959, 961 ], [ 963 ], [ 965 ], [ 967 ], [ 969 ], [ 971 ], [ 973 ], [ 975 ], [ 977 ], [ 979 ], [ 981 ], [ 983 ], [ 985 ], [ 987 ], [ 989 ], [ 991 ], [ 993 ], [ 995 ], [ 997, 999 ], [ 1001 ], [ 1003, 1005 ], [ 1007, 1009 ], [ 1011 ], [ 1013 ], [ 1015 ], [ 1017 ], [ 1025, 1027 ], [ 1029 ], [ 1031 ], [ 1033, 1035 ], [ 1037 ], [ 1039 ], [ 1041 ], [ 1043 ], [ 1045, 1047 ], [ 1049 ], [ 1051, 1053 ], [ 1055 ], [ 1057, 1059, 1061 ], [ 1063, 1065 ], [ 1067, 1069 ], [ 1071 ], [ 1073 ], [ 1075 ], [ 1077, 1079 ], [ 1081 ], [ 1083 ], [ 1085 ], [ 1087 ], [ 1089 ], [ 1091, 1093 ], [ 1095 ], [ 1097 ], [ 1099 ], [ 1101 ], [ 1103 ], [ 1105 ], [ 1107 ], [ 1109, 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 ], [ 1193, 1195, 1197, 1199 ], [ 1201, 1203 ], [ 1205 ], [ 1207 ], [ 1213 ], [ 1215 ], [ 1217, 1219, 1221, 1223 ], [ 1225, 1227 ], [ 1229 ], [ 1231 ], [ 1233, 1235 ], [ 1237 ], [ 1239 ], [ 1241, 1243 ], [ 1245, 1247 ], [ 1249 ], [ 1251, 1253, 1255, 1257 ], [ 1259, 1261 ], [ 1263 ], [ 1265 ], [ 1269 ], [ 1271 ], [ 1273 ], [ 1275, 1277 ], [ 1279 ], [ 1281 ], [ 1283 ], [ 1285, 1287 ], [ 1289 ], [ 1291 ], [ 1293, 1295 ], [ 1297 ], [ 1299 ], [ 1301, 1303 ], [ 1305 ], [ 1307 ], [ 1309 ], [ 1313, 1315, 1317, 1319, 1321 ], [ 1323 ], [ 1327 ], [ 1331 ], [ 1333 ], [ 1335 ], [ 1337 ], [ 1339 ], [ 1343 ], [ 1345 ], [ 1347 ], [ 1349, 1351 ], [ 1353 ], [ 1355, 1357 ], [ 1359 ], [ 1361, 1363 ], [ 1365 ], [ 1367, 1369, 1371 ], [ 1373 ], [ 1375 ], [ 1377 ], [ 1379 ], [ 1381 ], [ 1383 ], [ 1385 ], [ 1387 ], [ 1389 ], [ 1391 ], [ 1393 ], [ 1395 ], [ 1397 ], [ 1399 ], [ 1403, 1405 ], [ 1407 ], [ 1409 ], [ 1413 ], [ 1415 ], [ 1417 ], [ 1419 ], [ 1421 ], [ 1423 ], [ 1425 ], [ 1429, 1431, 1433, 1435, 1437, 1439 ], [ 1441, 1443 ], [ 1445, 1447 ], [ 1449, 1451 ], [ 1453 ], [ 1457 ], [ 1459 ], [ 1461 ], [ 1463 ], [ 1465 ], [ 1467 ], [ 1469 ], [ 1471 ], [ 1473 ], [ 1475 ], [ 1477 ], [ 1479 ], [ 1481 ], [ 1483 ], [ 1485 ], [ 1487 ], [ 1489 ], [ 1491 ], [ 1493 ], [ 1495 ], [ 1497 ], [ 1499, 1501 ], [ 1503 ], [ 1505, 1507 ], [ 1511 ], [ 1513 ], [ 1515 ], [ 1517 ], [ 1519 ], [ 1521 ], [ 1523 ], [ 1525 ], [ 1527 ], [ 1529 ], [ 1531 ], [ 1533 ], [ 1535 ], [ 1537 ], [ 1539 ], [ 1541 ], [ 1543 ], [ 1545, 1547 ], [ 1549 ], [ 1551 ], [ 1553 ], [ 1555, 1557 ], [ 1559 ], [ 1561 ], [ 1563 ], [ 1565 ], [ 1567 ], [ 1571, 1573 ], [ 1575 ], [ 1577 ], [ 1579 ], [ 1581, 1583, 1585, 1587 ], [ 1589, 1591 ], [ 1593 ], [ 1595 ], [ 1597 ], [ 1599 ], [ 1601 ], [ 1603, 1605 ], [ 1607 ], [ 1609 ], [ 1611 ], [ 1613 ], [ 1615 ], [ 1617 ], [ 1621, 1623 ], [ 1625 ], [ 1627 ], [ 1629, 1631 ], [ 1633 ], [ 1635 ], [ 1637 ], [ 1639, 1641 ], [ 1643 ], [ 1645, 1647 ], [ 1649 ], [ 1651, 1653 ], [ 1655 ], [ 1657, 1659 ], [ 1661 ], [ 1663, 1665 ], [ 1667, 1669 ], [ 1671 ], [ 1673 ], [ 1675 ], [ 1677, 1679 ], [ 1681 ], [ 1683 ], [ 1685 ], [ 1689 ], [ 1691 ], [ 1695 ], [ 1697 ], [ 1705, 1707, 1711 ], [ 1713, 1715 ], [ 1717, 1719 ], [ 1721, 1723 ], [ 1727 ], [ 1729 ], [ 1731 ], [ 1733 ], [ 1737 ], [ 1739 ], [ 1741 ], [ 1743 ], [ 1745 ], [ 1747 ], [ 1749 ], [ 1755 ], [ 1757 ], [ 1759 ], [ 1761 ], [ 1763 ], [ 1765 ], [ 1767 ], [ 1769 ], [ 1773 ], [ 1775 ], [ 1777 ], [ 1779 ], [ 1781 ], [ 1783, 1785, 1789 ], [ 1791 ], [ 1793, 1795, 1799 ], [ 1801 ], [ 1805, 1807 ], [ 1809 ], [ 1811 ], [ 1813, 1815 ], [ 1817 ], [ 1819 ], [ 1821, 1823 ], [ 1825 ], [ 1827 ], [ 1829, 1831 ], [ 1833 ], [ 1835, 1837 ], [ 1839 ], [ 1841 ], [ 1843 ], [ 1845 ], [ 1849 ], [ 1851 ], [ 1853 ], [ 1855 ], [ 1857 ], [ 1859 ], [ 1861 ], [ 1865 ], [ 1867 ], [ 1869 ], [ 1871 ], [ 1873 ], [ 1875, 1877 ], [ 1879, 1881 ], [ 1883 ], [ 1885 ], [ 1887, 1889 ], [ 1891 ], [ 1893 ], [ 1895 ], [ 1897 ], [ 1899 ], [ 1901 ], [ 1903 ], [ 1905 ], [ 1907 ], [ 1915, 1917 ], [ 1919 ], [ 1921 ], [ 1923 ], [ 1927 ], [ 1931 ], [ 1933 ], [ 1935, 1937, 1939, 1941, 1943 ], [ 1945 ], [ 1947 ], [ 1951 ], [ 1953, 1955 ], [ 1957 ], [ 1959, 1961 ], [ 1963 ], [ 1965, 1967 ], [ 1969 ], [ 1971, 1973, 1975 ], [ 1977 ], [ 1979 ], [ 1983 ], [ 1985 ], [ 1989 ], [ 1991 ], [ 1993 ], [ 1995 ], [ 1997, 1999, 2001, 2003, 2005, 2007, 2009, 2011, 2013, 2015, 2017, 2019, 2023 ], [ 2025, 2027 ], [ 2029 ], [ 2031, 2033 ], [ 2035 ], [ 2037, 2039 ], [ 2041 ], [ 2043, 2045 ], [ 2047 ], [ 2049, 2051, 2053 ], [ 2055 ], [ 2057 ], [ 2059 ], [ 2061, 2063 ], [ 2065, 2067 ], [ 2069 ], [ 2071, 2073 ], [ 2075 ], [ 2077, 2079 ], [ 2081 ], [ 2083, 2085, 2087 ], [ 2089 ], [ 2091 ], [ 2093, 2095 ], [ 2097 ], [ 2099 ], [ 2101 ], [ 2103, 2105 ], [ 2107 ], [ 2109, 2111 ], [ 2113 ], [ 2115, 2117 ], [ 2119 ], [ 2121 ], [ 2123, 2125 ], [ 2127 ], [ 2129 ], [ 2131, 2133 ], [ 2135 ], [ 2137, 2139 ], [ 2141 ], [ 2143 ], [ 2145, 2147 ], [ 2149 ], [ 2151 ], [ 2153, 2155 ], [ 2157 ], [ 2159 ], [ 2161, 2163 ], [ 2165 ], [ 2167 ], [ 2169, 2171 ], [ 2173 ], [ 2175 ], [ 2179 ], [ 2183 ], [ 2185, 2187 ], [ 2189 ], [ 2191 ], [ 2193, 2195 ], [ 2197 ], [ 2199, 2201 ], [ 2203, 2205 ], [ 2207, 2209 ], [ 2211 ], [ 2213 ], [ 2215, 2217 ], [ 2219, 2221 ], [ 2223 ], [ 2225, 2227 ], [ 2229 ], [ 2231, 2233 ], [ 2235 ], [ 2237 ], [ 2239, 2241 ], [ 2243 ], [ 2245, 2247 ], [ 2249 ], [ 2251 ], [ 2253, 2255 ], [ 2257 ], [ 2259, 2261 ], [ 2263 ], [ 2265 ], [ 2267, 2269 ], [ 2271 ], [ 2273 ], [ 2275, 2277 ], [ 2279 ], [ 2281 ], [ 2283, 2285 ], [ 2287 ], [ 2289 ], [ 2291, 2293 ], [ 2295 ], [ 2297 ], [ 2299, 2301 ], [ 2303 ], [ 2305 ], [ 2307, 2309 ], [ 2311 ], [ 2313 ], [ 2315, 2317 ], [ 2319 ], [ 2321 ], [ 2323 ], [ 2325, 2327 ], [ 2329, 2331 ], [ 2333 ], [ 2335, 2337 ], [ 2339 ], [ 2341, 2343 ], [ 2345 ], [ 2347, 2349 ], [ 2351 ], [ 2353, 2355 ], [ 2357 ], [ 2359, 2361 ], [ 2363 ], [ 2365, 2367 ], [ 2369 ], [ 2371, 2373, 2375 ], [ 2377 ], [ 2379 ], [ 2381 ], [ 2383, 2385 ], [ 2387, 2389 ], [ 2391 ], [ 2393, 2395 ], [ 2397 ], [ 2399, 2401 ], [ 2403 ], [ 2405, 2407 ], [ 2409 ], [ 2411, 2413 ], [ 2415 ], [ 2417, 2419 ], [ 2421 ], [ 2423, 2425 ], [ 2427 ], [ 2429, 2431, 2433 ], [ 2435 ], [ 2437 ], [ 2439 ], [ 2441, 2443, 2445, 2447 ], [ 2449 ], [ 2453 ], [ 2455 ], [ 2457 ], [ 2459, 2461 ], [ 2463 ], [ 2465 ], [ 2467 ], [ 2469 ], [ 2471 ], [ 2473 ], [ 2475, 2477 ], [ 2479 ], [ 2481 ], [ 2483, 2485 ], [ 2487 ], [ 2489 ], [ 2491 ], [ 2493, 2495 ], [ 2497, 2499 ], [ 2501 ], [ 2503 ], [ 2505 ], [ 2507 ], [ 2509, 2511 ], [ 2513 ], [ 2515 ], [ 2517, 2519 ], [ 2521, 2523 ], [ 2525 ], [ 2527, 2529 ], [ 2531 ], [ 2533, 2535 ], [ 2537 ], [ 2539 ], [ 2541, 2543 ], [ 2545 ], [ 2547, 2549 ], [ 2551 ], [ 2553 ], [ 2555, 2557 ], [ 2559 ], [ 2561 ], [ 2563, 2565 ], [ 2567 ], [ 2569 ], [ 2571 ], [ 2573, 2575 ], [ 2577, 2579 ], [ 2581 ], [ 2583 ], [ 2585 ], [ 2587 ], [ 2589, 2591 ], [ 2593 ], [ 2595 ], [ 2597, 2599 ], [ 2601, 2603 ], [ 2605 ], [ 2607, 2609 ], [ 2611 ], [ 2613 ], [ 2615, 2617 ], [ 2619 ], [ 2621 ], [ 2623 ], [ 2631, 2633, 2635, 2637 ], [ 2639, 2641 ], [ 2645 ], [ 2647 ], [ 2649 ], [ 2651 ], [ 2653 ], [ 2655 ], [ 2659, 2661, 2663, 2665 ], [ 2667, 2669 ], [ 2673 ], [ 2675 ], [ 2677 ], [ 2679 ], [ 2681 ], [ 2683 ], [ 2685, 2687, 2689, 2691 ], [ 2693, 2695 ], [ 2697 ], [ 2699 ], [ 2701 ], [ 2703 ], [ 2705 ], [ 2707 ], [ 2709, 2711, 2713, 2715 ], [ 2717, 2719 ], [ 2721 ], [ 2723, 2725 ], [ 2727 ], [ 2729 ], [ 2731 ], [ 2733, 2735 ], [ 2737 ], [ 2739 ], [ 2741 ], [ 2743 ], [ 2745 ], [ 2747 ], [ 2749 ], [ 2753, 2755, 2757, 2759 ], [ 2761, 2763 ], [ 2765 ], [ 2767, 2769 ], [ 2771 ], [ 2773 ], [ 2775 ], [ 2777, 2779 ], [ 2781 ], [ 2783 ], [ 2785 ], [ 2787 ], [ 2789 ], [ 2791 ], [ 2793 ], [ 2795, 2797, 2799 ], [ 2803 ], [ 2805 ], [ 2807, 2809 ], [ 2811, 2813 ], [ 2815 ], [ 2817 ], [ 2819 ], [ 2821 ], [ 2823 ], [ 2825 ], [ 2827 ], [ 2829, 2831, 2833 ], [ 2837 ], [ 2839 ], [ 2841, 2843 ], [ 2845, 2847 ], [ 2849 ], [ 2851 ], [ 2853 ], [ 2855 ], [ 2857 ], [ 2859 ], [ 2861 ], [ 2869, 2871, 2873 ], [ 2875 ], [ 2877 ], [ 2879, 2881 ], [ 2883, 2885 ], [ 2887 ], [ 2889 ], [ 2891 ], [ 2893 ], [ 2895 ], [ 2897 ], [ 2899, 2901, 2903 ], [ 2905 ], [ 2907 ], [ 2909, 2911 ], [ 2913, 2915 ], [ 2917 ], [ 2919 ], [ 2921 ], [ 2923 ], [ 2925 ], [ 2927 ], [ 2929, 2931, 2933 ], [ 2935 ], [ 2937 ], [ 2939, 2941 ], [ 2943, 2945 ], [ 2947 ], [ 2949 ], [ 2951 ], [ 2953 ], [ 2955 ], [ 2957, 2959, 2961 ], [ 2963 ], [ 2965 ], [ 2967, 2969 ], [ 2971, 2973 ], [ 2975 ], [ 2977 ], [ 2979 ], [ 2981 ], [ 2983 ], [ 2991, 2993 ], [ 2995 ], [ 2997 ], [ 2999, 3001 ], [ 3003, 3005 ], [ 3007, 3009 ], [ 3011 ], [ 3013 ], [ 3015 ], [ 3017, 3019 ], [ 3021 ], [ 3023, 3025 ], [ 3027 ], [ 3029 ], [ 3031 ], [ 3033, 3037 ], [ 3039 ], [ 3043 ], [ 3045, 3047 ], [ 3049 ], [ 3051 ], [ 3055 ], [ 3057 ], [ 3059 ], [ 3063, 3065 ], [ 3067, 3069 ], [ 3071 ], [ 3073 ], [ 3075, 3081 ], [ 3083, 3085 ], [ 3087 ], [ 3089 ], [ 3093 ], [ 3095 ], [ 3097 ], [ 3099 ], [ 3101 ], [ 3103, 3109 ], [ 3111, 3113 ], [ 3115 ], [ 3117 ], [ 3121 ], [ 3123 ], [ 3125 ], [ 3129 ], [ 3131 ], [ 3133, 3135 ], [ 3137, 3139 ], [ 3141 ], [ 3143, 3145 ], [ 3147, 3149 ], [ 3151 ], [ 3153 ], [ 3155 ], [ 3157 ], [ 3159 ], [ 3161, 3163 ], [ 3165 ], [ 3167 ], [ 3169 ], [ 3171 ], [ 3173 ], [ 3175, 3177 ], [ 3179 ], [ 3181 ], [ 3183 ], [ 3185 ], [ 3187 ], [ 3189 ], [ 3191, 3193 ], [ 3195 ], [ 3199 ], [ 3201 ], [ 3203 ], [ 3209 ], [ 3211 ], [ 3213 ], [ 3215 ], [ 3217 ], [ 3223 ], [ 3225 ], [ 3227 ], [ 3229 ], [ 3231 ], [ 3233 ], [ 3235, 3237 ], [ 3239 ], [ 3241 ], [ 3243, 3245 ], [ 3247 ], [ 3249 ], [ 3251 ], [ 3253, 3255 ], [ 3257 ], [ 3261 ], [ 3263 ], [ 3265 ], [ 3271 ], [ 3273 ], [ 3275 ], [ 3277 ], [ 3279 ], [ 3281 ], [ 3283, 3285 ], [ 3287 ], [ 3289, 3291 ], [ 3293 ], [ 3295 ], [ 3297 ], [ 3299, 3301 ], [ 3303 ], [ 3305, 3307 ], [ 3309 ], [ 3311 ], [ 3313 ], [ 3315 ], [ 3317, 3319 ], [ 3321 ], [ 3323, 3325 ], [ 3327 ], [ 3329 ], [ 3331 ], [ 3335, 3337 ], [ 3339 ], [ 3341 ], [ 3343 ], [ 3345, 3347 ], [ 3349 ], [ 3351 ], [ 3353 ], [ 3355 ], [ 3357 ], [ 3359 ], [ 3361 ], [ 3363 ], [ 3365 ], [ 3367 ], [ 3369 ], [ 3371 ], [ 3373 ], [ 3381, 3383, 3385 ], [ 3387, 3389 ], [ 3391, 3393 ], [ 3395 ], [ 3397 ], [ 3399, 3401 ], [ 3403 ], [ 3405, 3407 ], [ 3409, 3411 ], [ 3413 ], [ 3415, 3417 ], [ 3419, 3421 ], [ 3423 ], [ 3425 ], [ 3427 ], [ 3429 ], [ 3431, 3433 ], [ 3435, 3437 ], [ 3439 ], [ 3441 ], [ 3443 ], [ 3445, 3447, 3449 ], [ 3451 ], [ 3453 ], [ 3455 ], [ 3457, 3459, 3461 ], [ 3463 ], [ 3465 ], [ 3467 ], [ 3469, 3471, 3473 ], [ 3475 ], [ 3477 ], [ 3479 ], [ 3481, 3483, 3485 ], [ 3487 ], [ 3489 ], [ 3491 ], [ 3493, 3495 ], [ 3497 ], [ 3499, 3501 ], [ 3503 ], [ 3511, 3513 ], [ 3515 ], [ 3517 ], [ 3519 ], [ 3521 ], [ 3523 ], [ 3525 ], [ 3527 ], [ 3529 ], [ 3531 ], [ 3533 ], [ 3537 ], [ 3539 ], [ 3541, 3543 ], [ 3545 ], [ 3547 ], [ 3549 ], [ 3551 ], [ 3553, 3555 ], [ 3557, 3559 ], [ 3561 ], [ 3563 ], [ 3565, 3567 ], [ 3569 ], [ 3571, 3573 ], [ 3575 ], [ 3577, 3579 ], [ 3581 ], [ 3583, 3585 ], [ 3587, 3589 ], [ 3591 ], [ 3593 ], [ 3595 ], [ 3597 ], [ 3599 ], [ 3601 ], [ 3603 ], [ 3607, 3609 ], [ 3611, 3613 ], [ 3615 ], [ 3617 ], [ 3619 ], [ 3621 ], [ 3623 ], [ 3625 ], [ 3627 ], [ 3629, 3631 ], [ 3633, 3635 ], [ 3637 ], [ 3639 ], [ 3641, 3643, 3645 ], [ 3647 ], [ 3649 ], [ 3651 ], [ 3653 ], [ 3659 ], [ 3661 ], [ 3663 ], [ 3669, 3671, 3673 ], [ 3675 ], [ 3677 ], [ 3679 ], [ 3681, 3683, 3685 ], [ 3687 ], [ 3689 ], [ 3691 ], [ 3693, 3695, 3697 ], [ 3699 ], [ 3701 ], [ 3703 ], [ 3705, 3707, 3709 ], [ 3711 ], [ 3713 ], [ 3715 ], [ 3717, 3719 ], [ 3721 ], [ 3723 ], [ 3725 ], [ 3727, 3729 ], [ 3731 ], [ 3733 ], [ 3735 ], [ 3741, 3743 ], [ 3745, 3747 ], [ 3749 ], [ 3751 ], [ 3753, 3755 ], [ 3757 ], [ 3759 ], [ 3761 ], [ 3763, 3765, 3767 ], [ 3769 ], [ 3771 ], [ 3773, 3775 ], [ 3777, 3779 ], [ 3781, 3783 ], [ 3785 ], [ 3787, 3789 ], [ 3791, 3793 ], [ 3795 ], [ 3797 ], [ 3799, 3801 ], [ 3803, 3805 ], [ 3807, 3809 ], [ 3811 ], [ 3813, 3815 ], [ 3817, 3819 ], [ 3821 ], [ 3823 ], [ 3825, 3827 ], [ 3829 ], [ 3831 ], [ 3833 ], [ 3835, 3837 ], [ 3839 ], [ 3841 ], [ 3843, 3845 ], [ 3847, 3849 ], [ 3851 ], [ 3853, 3855 ], [ 3857 ], [ 3859 ], [ 3861 ], [ 3863 ], [ 3865, 3867, 3869 ], [ 3871 ], [ 3873 ], [ 3875, 3877, 3879, 3881 ], [ 3885, 3887, 3889 ], [ 3891 ], [ 3893 ], [ 3895, 3897 ], [ 3899 ], [ 3901 ], [ 3903 ], [ 3905, 3907 ], [ 3909 ], [ 3911, 3913 ], [ 3915 ], [ 3917, 3919 ], [ 3923 ], [ 3925 ], [ 3927 ], [ 3929 ], [ 3931, 3933 ], [ 3935 ], [ 3939, 3941 ], [ 3943 ], [ 3945, 3949 ], [ 3951 ] ]
21,634
static void xhci_process_commands(XHCIState *xhci) { XHCITRB trb; TRBType type; XHCIEvent event = {ER_COMMAND_COMPLETE, CC_SUCCESS}; dma_addr_t addr; unsigned int i, slotid = 0; DPRINTF("xhci_process_commands()\n"); if (!xhci_running(xhci)) { DPRINTF("xhci_process_commands() called while xHC stopped or paused\n"); return; } xhci->crcr_low |= CRCR_CRR; while ((type = xhci_ring_fetch(xhci, &xhci->cmd_ring, &trb, &addr))) { event.ptr = addr; switch (type) { case CR_ENABLE_SLOT: for (i = 0; i < xhci->numslots; i++) { if (!xhci->slots[i].enabled) { break; } } if (i >= xhci->numslots) { DPRINTF("xhci: no device slots available\n"); event.ccode = CC_NO_SLOTS_ERROR; } else { slotid = i+1; event.ccode = xhci_enable_slot(xhci, slotid); } break; case CR_DISABLE_SLOT: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { event.ccode = xhci_disable_slot(xhci, slotid); } break; case CR_ADDRESS_DEVICE: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { event.ccode = xhci_address_slot(xhci, slotid, trb.parameter, trb.control & TRB_CR_BSR); } break; case CR_CONFIGURE_ENDPOINT: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { event.ccode = xhci_configure_slot(xhci, slotid, trb.parameter, trb.control & TRB_CR_DC); } break; case CR_EVALUATE_CONTEXT: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { event.ccode = xhci_evaluate_slot(xhci, slotid, trb.parameter); } break; case CR_STOP_ENDPOINT: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { unsigned int epid = (trb.control >> TRB_CR_EPID_SHIFT) & TRB_CR_EPID_MASK; event.ccode = xhci_stop_ep(xhci, slotid, epid); } break; case CR_RESET_ENDPOINT: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { unsigned int epid = (trb.control >> TRB_CR_EPID_SHIFT) & TRB_CR_EPID_MASK; event.ccode = xhci_reset_ep(xhci, slotid, epid); } break; case CR_SET_TR_DEQUEUE: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { unsigned int epid = (trb.control >> TRB_CR_EPID_SHIFT) & TRB_CR_EPID_MASK; unsigned int streamid = (trb.status >> 16) & 0xffff; event.ccode = xhci_set_ep_dequeue(xhci, slotid, epid, streamid, trb.parameter); } break; case CR_RESET_DEVICE: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { event.ccode = xhci_reset_slot(xhci, slotid); } break; case CR_GET_PORT_BANDWIDTH: event.ccode = xhci_get_port_bandwidth(xhci, trb.parameter); break; case CR_VENDOR_VIA_CHALLENGE_RESPONSE: xhci_via_challenge(xhci, trb.parameter); break; case CR_VENDOR_NEC_FIRMWARE_REVISION: event.type = 48; /* NEC reply */ event.length = 0x3025; break; case CR_VENDOR_NEC_CHALLENGE_RESPONSE: { uint32_t chi = trb.parameter >> 32; uint32_t clo = trb.parameter; uint32_t val = xhci_nec_challenge(chi, clo); event.length = val & 0xFFFF; event.epid = val >> 16; slotid = val >> 24; event.type = 48; /* NEC reply */ } break; default: trace_usb_xhci_unimplemented("command", type); event.ccode = CC_TRB_ERROR; break; } event.slotid = slotid; xhci_event(xhci, &event, 0); } }
true
qemu
f89b60f6e5fee3923bedf80e82b4e5efc1bb156b
static void xhci_process_commands(XHCIState *xhci) { XHCITRB trb; TRBType type; XHCIEvent event = {ER_COMMAND_COMPLETE, CC_SUCCESS}; dma_addr_t addr; unsigned int i, slotid = 0; DPRINTF("xhci_process_commands()\n"); if (!xhci_running(xhci)) { DPRINTF("xhci_process_commands() called while xHC stopped or paused\n"); return; } xhci->crcr_low |= CRCR_CRR; while ((type = xhci_ring_fetch(xhci, &xhci->cmd_ring, &trb, &addr))) { event.ptr = addr; switch (type) { case CR_ENABLE_SLOT: for (i = 0; i < xhci->numslots; i++) { if (!xhci->slots[i].enabled) { break; } } if (i >= xhci->numslots) { DPRINTF("xhci: no device slots available\n"); event.ccode = CC_NO_SLOTS_ERROR; } else { slotid = i+1; event.ccode = xhci_enable_slot(xhci, slotid); } break; case CR_DISABLE_SLOT: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { event.ccode = xhci_disable_slot(xhci, slotid); } break; case CR_ADDRESS_DEVICE: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { event.ccode = xhci_address_slot(xhci, slotid, trb.parameter, trb.control & TRB_CR_BSR); } break; case CR_CONFIGURE_ENDPOINT: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { event.ccode = xhci_configure_slot(xhci, slotid, trb.parameter, trb.control & TRB_CR_DC); } break; case CR_EVALUATE_CONTEXT: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { event.ccode = xhci_evaluate_slot(xhci, slotid, trb.parameter); } break; case CR_STOP_ENDPOINT: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { unsigned int epid = (trb.control >> TRB_CR_EPID_SHIFT) & TRB_CR_EPID_MASK; event.ccode = xhci_stop_ep(xhci, slotid, epid); } break; case CR_RESET_ENDPOINT: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { unsigned int epid = (trb.control >> TRB_CR_EPID_SHIFT) & TRB_CR_EPID_MASK; event.ccode = xhci_reset_ep(xhci, slotid, epid); } break; case CR_SET_TR_DEQUEUE: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { unsigned int epid = (trb.control >> TRB_CR_EPID_SHIFT) & TRB_CR_EPID_MASK; unsigned int streamid = (trb.status >> 16) & 0xffff; event.ccode = xhci_set_ep_dequeue(xhci, slotid, epid, streamid, trb.parameter); } break; case CR_RESET_DEVICE: slotid = xhci_get_slot(xhci, &event, &trb); if (slotid) { event.ccode = xhci_reset_slot(xhci, slotid); } break; case CR_GET_PORT_BANDWIDTH: event.ccode = xhci_get_port_bandwidth(xhci, trb.parameter); break; case CR_VENDOR_VIA_CHALLENGE_RESPONSE: xhci_via_challenge(xhci, trb.parameter); break; case CR_VENDOR_NEC_FIRMWARE_REVISION: event.type = 48; event.length = 0x3025; break; case CR_VENDOR_NEC_CHALLENGE_RESPONSE: { uint32_t chi = trb.parameter >> 32; uint32_t clo = trb.parameter; uint32_t val = xhci_nec_challenge(chi, clo); event.length = val & 0xFFFF; event.epid = val >> 16; slotid = val >> 24; event.type = 48; } break; default: trace_usb_xhci_unimplemented("command", type); event.ccode = CC_TRB_ERROR; break; } event.slotid = slotid; xhci_event(xhci, &event, 0); } }
{ "code": [ " unsigned int i, slotid = 0;" ], "line_no": [ 13 ] }
static void FUNC_0(XHCIState *VAR_0) { XHCITRB trb; TRBType type; XHCIEvent event = {ER_COMMAND_COMPLETE, CC_SUCCESS}; dma_addr_t addr; unsigned int VAR_1, VAR_2 = 0; DPRINTF("FUNC_0()\n"); if (!xhci_running(VAR_0)) { DPRINTF("FUNC_0() called while xHC stopped or paused\n"); return; } VAR_0->crcr_low |= CRCR_CRR; while ((type = xhci_ring_fetch(VAR_0, &VAR_0->cmd_ring, &trb, &addr))) { event.ptr = addr; switch (type) { case CR_ENABLE_SLOT: for (VAR_1 = 0; VAR_1 < VAR_0->numslots; VAR_1++) { if (!VAR_0->slots[VAR_1].enabled) { break; } } if (VAR_1 >= VAR_0->numslots) { DPRINTF("VAR_0: no device slots available\n"); event.ccode = CC_NO_SLOTS_ERROR; } else { VAR_2 = VAR_1+1; event.ccode = xhci_enable_slot(VAR_0, VAR_2); } break; case CR_DISABLE_SLOT: VAR_2 = xhci_get_slot(VAR_0, &event, &trb); if (VAR_2) { event.ccode = xhci_disable_slot(VAR_0, VAR_2); } break; case CR_ADDRESS_DEVICE: VAR_2 = xhci_get_slot(VAR_0, &event, &trb); if (VAR_2) { event.ccode = xhci_address_slot(VAR_0, VAR_2, trb.parameter, trb.control & TRB_CR_BSR); } break; case CR_CONFIGURE_ENDPOINT: VAR_2 = xhci_get_slot(VAR_0, &event, &trb); if (VAR_2) { event.ccode = xhci_configure_slot(VAR_0, VAR_2, trb.parameter, trb.control & TRB_CR_DC); } break; case CR_EVALUATE_CONTEXT: VAR_2 = xhci_get_slot(VAR_0, &event, &trb); if (VAR_2) { event.ccode = xhci_evaluate_slot(VAR_0, VAR_2, trb.parameter); } break; case CR_STOP_ENDPOINT: VAR_2 = xhci_get_slot(VAR_0, &event, &trb); if (VAR_2) { unsigned int VAR_4 = (trb.control >> TRB_CR_EPID_SHIFT) & TRB_CR_EPID_MASK; event.ccode = xhci_stop_ep(VAR_0, VAR_2, VAR_4); } break; case CR_RESET_ENDPOINT: VAR_2 = xhci_get_slot(VAR_0, &event, &trb); if (VAR_2) { unsigned int VAR_4 = (trb.control >> TRB_CR_EPID_SHIFT) & TRB_CR_EPID_MASK; event.ccode = xhci_reset_ep(VAR_0, VAR_2, VAR_4); } break; case CR_SET_TR_DEQUEUE: VAR_2 = xhci_get_slot(VAR_0, &event, &trb); if (VAR_2) { unsigned int VAR_4 = (trb.control >> TRB_CR_EPID_SHIFT) & TRB_CR_EPID_MASK; unsigned int VAR_4 = (trb.status >> 16) & 0xffff; event.ccode = xhci_set_ep_dequeue(VAR_0, VAR_2, VAR_4, VAR_4, trb.parameter); } break; case CR_RESET_DEVICE: VAR_2 = xhci_get_slot(VAR_0, &event, &trb); if (VAR_2) { event.ccode = xhci_reset_slot(VAR_0, VAR_2); } break; case CR_GET_PORT_BANDWIDTH: event.ccode = xhci_get_port_bandwidth(VAR_0, trb.parameter); break; case CR_VENDOR_VIA_CHALLENGE_RESPONSE: xhci_via_challenge(VAR_0, trb.parameter); break; case CR_VENDOR_NEC_FIRMWARE_REVISION: event.type = 48; event.length = 0x3025; break; case CR_VENDOR_NEC_CHALLENGE_RESPONSE: { uint32_t chi = trb.parameter >> 32; uint32_t clo = trb.parameter; uint32_t val = xhci_nec_challenge(chi, clo); event.length = val & 0xFFFF; event.VAR_4 = val >> 16; VAR_2 = val >> 24; event.type = 48; } break; default: trace_usb_xhci_unimplemented("command", type); event.ccode = CC_TRB_ERROR; break; } event.VAR_2 = VAR_2; xhci_event(VAR_0, &event, 0); } }
[ "static void FUNC_0(XHCIState *VAR_0)\n{", "XHCITRB trb;", "TRBType type;", "XHCIEvent event = {ER_COMMAND_COMPLETE, CC_SUCCESS};", "dma_addr_t addr;", "unsigned int VAR_1, VAR_2 = 0;", "DPRINTF(\"FUNC_0()\\n\");", "if (!xhci_running(VAR_0)) {", "DPRINTF(\"FUNC_0() called while xHC stopped or paused\\n\");", "return;", "}", "VAR_0->crcr_low |= CRCR_CRR;", "while ((type = xhci_ring_fetch(VAR_0, &VAR_0->cmd_ring, &trb, &addr))) {", "event.ptr = addr;", "switch (type) {", "case CR_ENABLE_SLOT:\nfor (VAR_1 = 0; VAR_1 < VAR_0->numslots; VAR_1++) {", "if (!VAR_0->slots[VAR_1].enabled) {", "break;", "}", "}", "if (VAR_1 >= VAR_0->numslots) {", "DPRINTF(\"VAR_0: no device slots available\\n\");", "event.ccode = CC_NO_SLOTS_ERROR;", "} else {", "VAR_2 = VAR_1+1;", "event.ccode = xhci_enable_slot(VAR_0, VAR_2);", "}", "break;", "case CR_DISABLE_SLOT:\nVAR_2 = xhci_get_slot(VAR_0, &event, &trb);", "if (VAR_2) {", "event.ccode = xhci_disable_slot(VAR_0, VAR_2);", "}", "break;", "case CR_ADDRESS_DEVICE:\nVAR_2 = xhci_get_slot(VAR_0, &event, &trb);", "if (VAR_2) {", "event.ccode = xhci_address_slot(VAR_0, VAR_2, trb.parameter,\ntrb.control & TRB_CR_BSR);", "}", "break;", "case CR_CONFIGURE_ENDPOINT:\nVAR_2 = xhci_get_slot(VAR_0, &event, &trb);", "if (VAR_2) {", "event.ccode = xhci_configure_slot(VAR_0, VAR_2, trb.parameter,\ntrb.control & TRB_CR_DC);", "}", "break;", "case CR_EVALUATE_CONTEXT:\nVAR_2 = xhci_get_slot(VAR_0, &event, &trb);", "if (VAR_2) {", "event.ccode = xhci_evaluate_slot(VAR_0, VAR_2, trb.parameter);", "}", "break;", "case CR_STOP_ENDPOINT:\nVAR_2 = xhci_get_slot(VAR_0, &event, &trb);", "if (VAR_2) {", "unsigned int VAR_4 = (trb.control >> TRB_CR_EPID_SHIFT)\n& TRB_CR_EPID_MASK;", "event.ccode = xhci_stop_ep(VAR_0, VAR_2, VAR_4);", "}", "break;", "case CR_RESET_ENDPOINT:\nVAR_2 = xhci_get_slot(VAR_0, &event, &trb);", "if (VAR_2) {", "unsigned int VAR_4 = (trb.control >> TRB_CR_EPID_SHIFT)\n& TRB_CR_EPID_MASK;", "event.ccode = xhci_reset_ep(VAR_0, VAR_2, VAR_4);", "}", "break;", "case CR_SET_TR_DEQUEUE:\nVAR_2 = xhci_get_slot(VAR_0, &event, &trb);", "if (VAR_2) {", "unsigned int VAR_4 = (trb.control >> TRB_CR_EPID_SHIFT)\n& TRB_CR_EPID_MASK;", "unsigned int VAR_4 = (trb.status >> 16) & 0xffff;", "event.ccode = xhci_set_ep_dequeue(VAR_0, VAR_2,\nVAR_4, VAR_4,\ntrb.parameter);", "}", "break;", "case CR_RESET_DEVICE:\nVAR_2 = xhci_get_slot(VAR_0, &event, &trb);", "if (VAR_2) {", "event.ccode = xhci_reset_slot(VAR_0, VAR_2);", "}", "break;", "case CR_GET_PORT_BANDWIDTH:\nevent.ccode = xhci_get_port_bandwidth(VAR_0, trb.parameter);", "break;", "case CR_VENDOR_VIA_CHALLENGE_RESPONSE:\nxhci_via_challenge(VAR_0, trb.parameter);", "break;", "case CR_VENDOR_NEC_FIRMWARE_REVISION:\nevent.type = 48;", "event.length = 0x3025;", "break;", "case CR_VENDOR_NEC_CHALLENGE_RESPONSE:\n{", "uint32_t chi = trb.parameter >> 32;", "uint32_t clo = trb.parameter;", "uint32_t val = xhci_nec_challenge(chi, clo);", "event.length = val & 0xFFFF;", "event.VAR_4 = val >> 16;", "VAR_2 = val >> 24;", "event.type = 48;", "}", "break;", "default:\ntrace_usb_xhci_unimplemented(\"command\", type);", "event.ccode = CC_TRB_ERROR;", "break;", "}", "event.VAR_2 = VAR_2;", "xhci_event(VAR_0, &event, 0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163, 165, 167 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227, 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ] ]
21,635
void cpu_loop(CPUTLGState *env) { CPUState *cs = CPU(tilegx_env_get_cpu(env)); int trapnr; while (1) { cpu_exec_start(cs); trapnr = cpu_tilegx_exec(cs); cpu_exec_end(cs); switch (trapnr) { case TILEGX_EXCP_SYSCALL: env->regs[TILEGX_R_RE] = do_syscall(env, env->regs[TILEGX_R_NR], env->regs[0], env->regs[1], env->regs[2], env->regs[3], env->regs[4], env->regs[5], env->regs[6], env->regs[7]); env->regs[TILEGX_R_ERR] = TILEGX_IS_ERRNO(env->regs[TILEGX_R_RE]) ? - env->regs[TILEGX_R_RE] : 0; break; case TILEGX_EXCP_OPCODE_EXCH: do_exch(env, true, false); break; case TILEGX_EXCP_OPCODE_EXCH4: do_exch(env, false, false); break; case TILEGX_EXCP_OPCODE_CMPEXCH: do_exch(env, true, true); break; case TILEGX_EXCP_OPCODE_CMPEXCH4: do_exch(env, false, true); break; case TILEGX_EXCP_OPCODE_FETCHADD: case TILEGX_EXCP_OPCODE_FETCHADDGEZ: case TILEGX_EXCP_OPCODE_FETCHAND: case TILEGX_EXCP_OPCODE_FETCHOR: do_fetch(env, trapnr, true); break; case TILEGX_EXCP_OPCODE_FETCHADD4: case TILEGX_EXCP_OPCODE_FETCHADDGEZ4: case TILEGX_EXCP_OPCODE_FETCHAND4: case TILEGX_EXCP_OPCODE_FETCHOR4: do_fetch(env, trapnr, false); break; case TILEGX_EXCP_SIGNAL: do_signal(env, env->signo, env->sigcode); break; case TILEGX_EXCP_REG_IDN_ACCESS: case TILEGX_EXCP_REG_UDN_ACCESS: gen_sigill_reg(env); break; default: fprintf(stderr, "trapnr is %d[0x%x].\n", trapnr, trapnr); g_assert_not_reached(); } process_pending_signals(env); } }
true
qemu
a9175169cc55ecff23a158dfee7d9cbb0b75d185
void cpu_loop(CPUTLGState *env) { CPUState *cs = CPU(tilegx_env_get_cpu(env)); int trapnr; while (1) { cpu_exec_start(cs); trapnr = cpu_tilegx_exec(cs); cpu_exec_end(cs); switch (trapnr) { case TILEGX_EXCP_SYSCALL: env->regs[TILEGX_R_RE] = do_syscall(env, env->regs[TILEGX_R_NR], env->regs[0], env->regs[1], env->regs[2], env->regs[3], env->regs[4], env->regs[5], env->regs[6], env->regs[7]); env->regs[TILEGX_R_ERR] = TILEGX_IS_ERRNO(env->regs[TILEGX_R_RE]) ? - env->regs[TILEGX_R_RE] : 0; break; case TILEGX_EXCP_OPCODE_EXCH: do_exch(env, true, false); break; case TILEGX_EXCP_OPCODE_EXCH4: do_exch(env, false, false); break; case TILEGX_EXCP_OPCODE_CMPEXCH: do_exch(env, true, true); break; case TILEGX_EXCP_OPCODE_CMPEXCH4: do_exch(env, false, true); break; case TILEGX_EXCP_OPCODE_FETCHADD: case TILEGX_EXCP_OPCODE_FETCHADDGEZ: case TILEGX_EXCP_OPCODE_FETCHAND: case TILEGX_EXCP_OPCODE_FETCHOR: do_fetch(env, trapnr, true); break; case TILEGX_EXCP_OPCODE_FETCHADD4: case TILEGX_EXCP_OPCODE_FETCHADDGEZ4: case TILEGX_EXCP_OPCODE_FETCHAND4: case TILEGX_EXCP_OPCODE_FETCHOR4: do_fetch(env, trapnr, false); break; case TILEGX_EXCP_SIGNAL: do_signal(env, env->signo, env->sigcode); break; case TILEGX_EXCP_REG_IDN_ACCESS: case TILEGX_EXCP_REG_UDN_ACCESS: gen_sigill_reg(env); break; default: fprintf(stderr, "trapnr is %d[0x%x].\n", trapnr, trapnr); g_assert_not_reached(); } process_pending_signals(env); } }
{ "code": [ " env->regs[TILEGX_R_RE] = do_syscall(env, env->regs[TILEGX_R_NR],", " env->regs[0], env->regs[1],", " env->regs[2], env->regs[3],", " env->regs[4], env->regs[5],", " env->regs[6], env->regs[7]);", " env->regs[TILEGX_R_ERR] = TILEGX_IS_ERRNO(env->regs[TILEGX_R_RE])", " ? - env->regs[TILEGX_R_RE]", " : 0;" ], "line_no": [ 23, 25, 27, 29, 31, 33, 35, 37 ] }
void FUNC_0(CPUTLGState *VAR_0) { CPUState *cs = CPU(tilegx_env_get_cpu(VAR_0)); int VAR_1; while (1) { cpu_exec_start(cs); VAR_1 = cpu_tilegx_exec(cs); cpu_exec_end(cs); switch (VAR_1) { case TILEGX_EXCP_SYSCALL: VAR_0->regs[TILEGX_R_RE] = do_syscall(VAR_0, VAR_0->regs[TILEGX_R_NR], VAR_0->regs[0], VAR_0->regs[1], VAR_0->regs[2], VAR_0->regs[3], VAR_0->regs[4], VAR_0->regs[5], VAR_0->regs[6], VAR_0->regs[7]); VAR_0->regs[TILEGX_R_ERR] = TILEGX_IS_ERRNO(VAR_0->regs[TILEGX_R_RE]) ? - VAR_0->regs[TILEGX_R_RE] : 0; break; case TILEGX_EXCP_OPCODE_EXCH: do_exch(VAR_0, true, false); break; case TILEGX_EXCP_OPCODE_EXCH4: do_exch(VAR_0, false, false); break; case TILEGX_EXCP_OPCODE_CMPEXCH: do_exch(VAR_0, true, true); break; case TILEGX_EXCP_OPCODE_CMPEXCH4: do_exch(VAR_0, false, true); break; case TILEGX_EXCP_OPCODE_FETCHADD: case TILEGX_EXCP_OPCODE_FETCHADDGEZ: case TILEGX_EXCP_OPCODE_FETCHAND: case TILEGX_EXCP_OPCODE_FETCHOR: do_fetch(VAR_0, VAR_1, true); break; case TILEGX_EXCP_OPCODE_FETCHADD4: case TILEGX_EXCP_OPCODE_FETCHADDGEZ4: case TILEGX_EXCP_OPCODE_FETCHAND4: case TILEGX_EXCP_OPCODE_FETCHOR4: do_fetch(VAR_0, VAR_1, false); break; case TILEGX_EXCP_SIGNAL: do_signal(VAR_0, VAR_0->signo, VAR_0->sigcode); break; case TILEGX_EXCP_REG_IDN_ACCESS: case TILEGX_EXCP_REG_UDN_ACCESS: gen_sigill_reg(VAR_0); break; default: fprintf(stderr, "VAR_1 is %d[0x%x].\n", VAR_1, VAR_1); g_assert_not_reached(); } process_pending_signals(VAR_0); } }
[ "void FUNC_0(CPUTLGState *VAR_0)\n{", "CPUState *cs = CPU(tilegx_env_get_cpu(VAR_0));", "int VAR_1;", "while (1) {", "cpu_exec_start(cs);", "VAR_1 = cpu_tilegx_exec(cs);", "cpu_exec_end(cs);", "switch (VAR_1) {", "case TILEGX_EXCP_SYSCALL:\nVAR_0->regs[TILEGX_R_RE] = do_syscall(VAR_0, VAR_0->regs[TILEGX_R_NR],\nVAR_0->regs[0], VAR_0->regs[1],\nVAR_0->regs[2], VAR_0->regs[3],\nVAR_0->regs[4], VAR_0->regs[5],\nVAR_0->regs[6], VAR_0->regs[7]);", "VAR_0->regs[TILEGX_R_ERR] = TILEGX_IS_ERRNO(VAR_0->regs[TILEGX_R_RE])\n? - VAR_0->regs[TILEGX_R_RE]\n: 0;", "break;", "case TILEGX_EXCP_OPCODE_EXCH:\ndo_exch(VAR_0, true, false);", "break;", "case TILEGX_EXCP_OPCODE_EXCH4:\ndo_exch(VAR_0, false, false);", "break;", "case TILEGX_EXCP_OPCODE_CMPEXCH:\ndo_exch(VAR_0, true, true);", "break;", "case TILEGX_EXCP_OPCODE_CMPEXCH4:\ndo_exch(VAR_0, false, true);", "break;", "case TILEGX_EXCP_OPCODE_FETCHADD:\ncase TILEGX_EXCP_OPCODE_FETCHADDGEZ:\ncase TILEGX_EXCP_OPCODE_FETCHAND:\ncase TILEGX_EXCP_OPCODE_FETCHOR:\ndo_fetch(VAR_0, VAR_1, true);", "break;", "case TILEGX_EXCP_OPCODE_FETCHADD4:\ncase TILEGX_EXCP_OPCODE_FETCHADDGEZ4:\ncase TILEGX_EXCP_OPCODE_FETCHAND4:\ncase TILEGX_EXCP_OPCODE_FETCHOR4:\ndo_fetch(VAR_0, VAR_1, false);", "break;", "case TILEGX_EXCP_SIGNAL:\ndo_signal(VAR_0, VAR_0->signo, VAR_0->sigcode);", "break;", "case TILEGX_EXCP_REG_IDN_ACCESS:\ncase TILEGX_EXCP_REG_UDN_ACCESS:\ngen_sigill_reg(VAR_0);", "break;", "default:\nfprintf(stderr, \"VAR_1 is %d[0x%x].\\n\", VAR_1, VAR_1);", "g_assert_not_reached();", "}", "process_pending_signals(VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 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, 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97, 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ] ]
21,636
sofree(struct socket *so) { Slirp *slirp = so->slirp; struct mbuf *ifm; for (ifm = (struct mbuf *) slirp->if_fastq.qh_link; (struct quehead *) ifm != &slirp->if_fastq; ifm = ifm->ifq_next) { if (ifm->ifq_so == so) { ifm->ifq_so = NULL; for (ifm = (struct mbuf *) slirp->if_batchq.qh_link; (struct quehead *) ifm != &slirp->if_batchq; ifm = ifm->ifq_next) { if (ifm->ifq_so == so) { ifm->ifq_so = NULL; if (so->so_emu==EMU_RSH && so->extra) { sofree(so->extra); so->extra=NULL; if (so == slirp->tcp_last_so) { slirp->tcp_last_so = &slirp->tcb; } else if (so == slirp->udp_last_so) { slirp->udp_last_so = &slirp->udb; } else if (so == slirp->icmp_last_so) { slirp->icmp_last_so = &slirp->icmp; m_free(so->so_m); if(so->so_next && so->so_prev) remque(so); /* crashes if so is not in a queue */ free(so);
true
qemu
7d8246960e03dabf37726c01d231e89dfde9b229
sofree(struct socket *so) { Slirp *slirp = so->slirp; struct mbuf *ifm; for (ifm = (struct mbuf *) slirp->if_fastq.qh_link; (struct quehead *) ifm != &slirp->if_fastq; ifm = ifm->ifq_next) { if (ifm->ifq_so == so) { ifm->ifq_so = NULL; for (ifm = (struct mbuf *) slirp->if_batchq.qh_link; (struct quehead *) ifm != &slirp->if_batchq; ifm = ifm->ifq_next) { if (ifm->ifq_so == so) { ifm->ifq_so = NULL; if (so->so_emu==EMU_RSH && so->extra) { sofree(so->extra); so->extra=NULL; if (so == slirp->tcp_last_so) { slirp->tcp_last_so = &slirp->tcb; } else if (so == slirp->udp_last_so) { slirp->udp_last_so = &slirp->udb; } else if (so == slirp->icmp_last_so) { slirp->icmp_last_so = &slirp->icmp; m_free(so->so_m); if(so->so_next && so->so_prev) remque(so); free(so);
{ "code": [], "line_no": [] }
FUNC_0(struct socket *VAR_0) { Slirp *slirp = VAR_0->slirp; struct mbuf *VAR_1; for (VAR_1 = (struct mbuf *) slirp->if_fastq.qh_link; (struct quehead *) VAR_1 != &slirp->if_fastq; VAR_1 = VAR_1->ifq_next) { if (VAR_1->ifq_so == VAR_0) { VAR_1->ifq_so = NULL; for (VAR_1 = (struct mbuf *) slirp->if_batchq.qh_link; (struct quehead *) VAR_1 != &slirp->if_batchq; VAR_1 = VAR_1->ifq_next) { if (VAR_1->ifq_so == VAR_0) { VAR_1->ifq_so = NULL; if (VAR_0->so_emu==EMU_RSH && VAR_0->extra) { FUNC_0(VAR_0->extra); VAR_0->extra=NULL; if (VAR_0 == slirp->tcp_last_so) { slirp->tcp_last_so = &slirp->tcb; } else if (VAR_0 == slirp->udp_last_so) { slirp->udp_last_so = &slirp->udb; } else if (VAR_0 == slirp->icmp_last_so) { slirp->icmp_last_so = &slirp->icmp; m_free(VAR_0->so_m); if(VAR_0->so_next && VAR_0->so_prev) remque(VAR_0); free(VAR_0);
[ "FUNC_0(struct socket *VAR_0)\n{", "Slirp *slirp = VAR_0->slirp;", "struct mbuf *VAR_1;", "for (VAR_1 = (struct mbuf *) slirp->if_fastq.qh_link;", "(struct quehead *) VAR_1 != &slirp->if_fastq;", "VAR_1 = VAR_1->ifq_next) {", "if (VAR_1->ifq_so == VAR_0) {", "VAR_1->ifq_so = NULL;", "for (VAR_1 = (struct mbuf *) slirp->if_batchq.qh_link;", "(struct quehead *) VAR_1 != &slirp->if_batchq;", "VAR_1 = VAR_1->ifq_next) {", "if (VAR_1->ifq_so == VAR_0) {", "VAR_1->ifq_so = NULL;", "if (VAR_0->so_emu==EMU_RSH && VAR_0->extra) {", "FUNC_0(VAR_0->extra);", "VAR_0->extra=NULL;", "if (VAR_0 == slirp->tcp_last_so) {", "slirp->tcp_last_so = &slirp->tcb;", "} else if (VAR_0 == slirp->udp_last_so) {", "slirp->udp_last_so = &slirp->udb;", "} else if (VAR_0 == slirp->icmp_last_so) {", "slirp->icmp_last_so = &slirp->icmp;", "m_free(VAR_0->so_m);", "if(VAR_0->so_next && VAR_0->so_prev)\nremque(VAR_0);", "free(VAR_0);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 46 ], [ 48 ], [ 50 ], [ 52 ], [ 54 ], [ 56 ], [ 59 ], [ 63, 65 ], [ 72 ] ]
21,637
static void close_slave(TeeSlave *tee_slave) { AVFormatContext *avf; unsigned i; avf = tee_slave->avf; for (i = 0; i < avf->nb_streams; ++i) { AVBitStreamFilterContext *bsf_next, *bsf = tee_slave->bsfs[i]; while (bsf) { bsf_next = bsf->next; av_bitstream_filter_close(bsf); bsf = bsf_next; } } av_freep(&tee_slave->stream_map); av_freep(&tee_slave->bsfs); ff_format_io_close(avf, &avf->pb); avformat_free_context(avf); tee_slave->avf = NULL; }
true
FFmpeg
f9d7e9feec2a0fd7f7930d01876a70a9b8a4a3b9
static void close_slave(TeeSlave *tee_slave) { AVFormatContext *avf; unsigned i; avf = tee_slave->avf; for (i = 0; i < avf->nb_streams; ++i) { AVBitStreamFilterContext *bsf_next, *bsf = tee_slave->bsfs[i]; while (bsf) { bsf_next = bsf->next; av_bitstream_filter_close(bsf); bsf = bsf_next; } } av_freep(&tee_slave->stream_map); av_freep(&tee_slave->bsfs); ff_format_io_close(avf, &avf->pb); avformat_free_context(avf); tee_slave->avf = NULL; }
{ "code": [ "static void close_slave(TeeSlave *tee_slave)", " for (i = 0; i < avf->nb_streams; ++i) {", " AVBitStreamFilterContext *bsf_next, *bsf = tee_slave->bsfs[i];", " while (bsf) {", " bsf_next = bsf->next;", " av_bitstream_filter_close(bsf);", " bsf = bsf_next;" ], "line_no": [ 1, 13, 15, 17, 19, 21, 23 ] }
static void FUNC_0(TeeSlave *VAR_0) { AVFormatContext *avf; unsigned VAR_1; avf = VAR_0->avf; for (VAR_1 = 0; VAR_1 < avf->nb_streams; ++VAR_1) { AVBitStreamFilterContext *bsf_next, *bsf = VAR_0->bsfs[VAR_1]; while (bsf) { bsf_next = bsf->next; av_bitstream_filter_close(bsf); bsf = bsf_next; } } av_freep(&VAR_0->stream_map); av_freep(&VAR_0->bsfs); ff_format_io_close(avf, &avf->pb); avformat_free_context(avf); VAR_0->avf = NULL; }
[ "static void FUNC_0(TeeSlave *VAR_0)\n{", "AVFormatContext *avf;", "unsigned VAR_1;", "avf = VAR_0->avf;", "for (VAR_1 = 0; VAR_1 < avf->nb_streams; ++VAR_1) {", "AVBitStreamFilterContext *bsf_next, *bsf = VAR_0->bsfs[VAR_1];", "while (bsf) {", "bsf_next = bsf->next;", "av_bitstream_filter_close(bsf);", "bsf = bsf_next;", "}", "}", "av_freep(&VAR_0->stream_map);", "av_freep(&VAR_0->bsfs);", "ff_format_io_close(avf, &avf->pb);", "avformat_free_context(avf);", "VAR_0->avf = NULL;", "}" ]
[ 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
21,638
static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AC3DecodeContext *s = avctx->priv_data; int blk, ch, err, ret; const uint8_t *channel_map; const float *output[AC3_MAX_CHANNELS]; /* copy input buffer to decoder context to avoid reading past the end of the buffer, which can be caused by a damaged input stream. */ if (buf_size >= 2 && AV_RB16(buf) == 0x770B) { // seems to be byte-swapped AC-3 int cnt = FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE) >> 1; s->dsp.bswap16_buf((uint16_t *)s->input_buffer, (const uint16_t *)buf, cnt); } else memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE)); buf = s->input_buffer; /* initialize the GetBitContext with the start of valid AC-3 Frame */ init_get_bits(&s->gbc, buf, buf_size * 8); /* parse the syncinfo */ err = parse_frame_header(s); if (err) { switch (err) { case AAC_AC3_PARSE_ERROR_SYNC: av_log(avctx, AV_LOG_ERROR, "frame sync error\n"); return -1; case AAC_AC3_PARSE_ERROR_BSID: av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n"); break; case AAC_AC3_PARSE_ERROR_SAMPLE_RATE: av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n"); break; case AAC_AC3_PARSE_ERROR_FRAME_SIZE: av_log(avctx, AV_LOG_ERROR, "invalid frame size\n"); break; case AAC_AC3_PARSE_ERROR_FRAME_TYPE: /* skip frame if CRC is ok. otherwise use error concealment. */ /* TODO: add support for substreams and dependent frames */ if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) { av_log(avctx, AV_LOG_ERROR, "unsupported frame type : " "skipping frame\n"); *got_frame_ptr = 0; return s->frame_size; } else { av_log(avctx, AV_LOG_ERROR, "invalid frame type\n"); } break; default: av_log(avctx, AV_LOG_ERROR, "invalid header\n"); break; } } else { /* check that reported frame size fits in input buffer */ if (s->frame_size > buf_size) { av_log(avctx, AV_LOG_ERROR, "incomplete frame\n"); err = AAC_AC3_PARSE_ERROR_FRAME_SIZE; } else if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) { /* check for crc mismatch */ if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size - 2)) { av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n"); err = AAC_AC3_PARSE_ERROR_CRC; } } } /* if frame is ok, set audio parameters */ if (!err) { avctx->sample_rate = s->sample_rate; avctx->bit_rate = s->bit_rate; /* channel config */ s->out_channels = s->channels; s->output_mode = s->channel_mode; if (s->lfe_on) s->output_mode |= AC3_OUTPUT_LFEON; if (avctx->request_channels > 0 && avctx->request_channels <= 2 && avctx->request_channels < s->channels) { s->out_channels = avctx->request_channels; s->output_mode = avctx->request_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO; s->channel_layout = avpriv_ac3_channel_layout_tab[s->output_mode]; } avctx->channels = s->out_channels; avctx->channel_layout = s->channel_layout; s->loro_center_mix_level = gain_levels[s-> center_mix_level]; s->loro_surround_mix_level = gain_levels[s->surround_mix_level]; s->ltrt_center_mix_level = LEVEL_MINUS_3DB; s->ltrt_surround_mix_level = LEVEL_MINUS_3DB; /* set downmixing coefficients if needed */ if (s->channels != s->out_channels && !((s->output_mode & AC3_OUTPUT_LFEON) && s->fbw_channels == s->out_channels)) { set_downmix_coeffs(s); } } else if (!s->out_channels) { s->out_channels = avctx->channels; if (s->out_channels < s->channels) s->output_mode = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO; } if (avctx->channels != s->out_channels) { av_log(avctx, AV_LOG_ERROR, "channel number mismatching on damaged frame\n"); return AVERROR_INVALIDDATA; } /* set audio service type based on bitstream mode for AC-3 */ avctx->audio_service_type = s->bitstream_mode; if (s->bitstream_mode == 0x7 && s->channels > 1) avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE; /* get output buffer */ avctx->channels = s->out_channels; s->frame.nb_samples = s->num_blocks * 256; if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } /* decode the audio blocks */ channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on]; for (ch = 0; ch < s->channels; ch++) { if (ch < s->out_channels) s->outptr[channel_map[ch]] = (float *)s->frame.data[ch]; else s->outptr[ch] = s->output[ch]; output[ch] = s->output[ch]; } for (blk = 0; blk < s->num_blocks; blk++) { if (!err && decode_audio_block(s, blk)) { av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n"); err = 1; } if (err) for (ch = 0; ch < s->out_channels; ch++) memcpy(s->outptr[channel_map[ch]], output[ch], 1024); for (ch = 0; ch < s->out_channels; ch++) { output[ch] = s->outptr[channel_map[ch]]; s->outptr[channel_map[ch]] += AC3_BLOCK_SIZE; } } s->frame.decode_error_flags = err ? FF_DECODE_ERROR_INVALID_BITSTREAM : 0; /* keep last block for error concealment in next frame */ for (ch = 0; ch < s->out_channels; ch++) memcpy(s->output[ch], output[ch], 1024); *got_frame_ptr = 1; *(AVFrame *)data = s->frame; return FFMIN(buf_size, s->frame_size); }
true
FFmpeg
7aabeea9ba0e557e834c886de5ea4db8e9a5193d
static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AC3DecodeContext *s = avctx->priv_data; int blk, ch, err, ret; const uint8_t *channel_map; const float *output[AC3_MAX_CHANNELS]; if (buf_size >= 2 && AV_RB16(buf) == 0x770B) { int cnt = FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE) >> 1; s->dsp.bswap16_buf((uint16_t *)s->input_buffer, (const uint16_t *)buf, cnt); } else memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE)); buf = s->input_buffer; init_get_bits(&s->gbc, buf, buf_size * 8); err = parse_frame_header(s); if (err) { switch (err) { case AAC_AC3_PARSE_ERROR_SYNC: av_log(avctx, AV_LOG_ERROR, "frame sync error\n"); return -1; case AAC_AC3_PARSE_ERROR_BSID: av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n"); break; case AAC_AC3_PARSE_ERROR_SAMPLE_RATE: av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n"); break; case AAC_AC3_PARSE_ERROR_FRAME_SIZE: av_log(avctx, AV_LOG_ERROR, "invalid frame size\n"); break; case AAC_AC3_PARSE_ERROR_FRAME_TYPE: if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) { av_log(avctx, AV_LOG_ERROR, "unsupported frame type : " "skipping frame\n"); *got_frame_ptr = 0; return s->frame_size; } else { av_log(avctx, AV_LOG_ERROR, "invalid frame type\n"); } break; default: av_log(avctx, AV_LOG_ERROR, "invalid header\n"); break; } } else { if (s->frame_size > buf_size) { av_log(avctx, AV_LOG_ERROR, "incomplete frame\n"); err = AAC_AC3_PARSE_ERROR_FRAME_SIZE; } else if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) { if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size - 2)) { av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n"); err = AAC_AC3_PARSE_ERROR_CRC; } } } if (!err) { avctx->sample_rate = s->sample_rate; avctx->bit_rate = s->bit_rate; s->out_channels = s->channels; s->output_mode = s->channel_mode; if (s->lfe_on) s->output_mode |= AC3_OUTPUT_LFEON; if (avctx->request_channels > 0 && avctx->request_channels <= 2 && avctx->request_channels < s->channels) { s->out_channels = avctx->request_channels; s->output_mode = avctx->request_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO; s->channel_layout = avpriv_ac3_channel_layout_tab[s->output_mode]; } avctx->channels = s->out_channels; avctx->channel_layout = s->channel_layout; s->loro_center_mix_level = gain_levels[s-> center_mix_level]; s->loro_surround_mix_level = gain_levels[s->surround_mix_level]; s->ltrt_center_mix_level = LEVEL_MINUS_3DB; s->ltrt_surround_mix_level = LEVEL_MINUS_3DB; if (s->channels != s->out_channels && !((s->output_mode & AC3_OUTPUT_LFEON) && s->fbw_channels == s->out_channels)) { set_downmix_coeffs(s); } } else if (!s->out_channels) { s->out_channels = avctx->channels; if (s->out_channels < s->channels) s->output_mode = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO; } if (avctx->channels != s->out_channels) { av_log(avctx, AV_LOG_ERROR, "channel number mismatching on damaged frame\n"); return AVERROR_INVALIDDATA; } avctx->audio_service_type = s->bitstream_mode; if (s->bitstream_mode == 0x7 && s->channels > 1) avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE; avctx->channels = s->out_channels; s->frame.nb_samples = s->num_blocks * 256; if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on]; for (ch = 0; ch < s->channels; ch++) { if (ch < s->out_channels) s->outptr[channel_map[ch]] = (float *)s->frame.data[ch]; else s->outptr[ch] = s->output[ch]; output[ch] = s->output[ch]; } for (blk = 0; blk < s->num_blocks; blk++) { if (!err && decode_audio_block(s, blk)) { av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n"); err = 1; } if (err) for (ch = 0; ch < s->out_channels; ch++) memcpy(s->outptr[channel_map[ch]], output[ch], 1024); for (ch = 0; ch < s->out_channels; ch++) { output[ch] = s->outptr[channel_map[ch]]; s->outptr[channel_map[ch]] += AC3_BLOCK_SIZE; } } s->frame.decode_error_flags = err ? FF_DECODE_ERROR_INVALID_BITSTREAM : 0; for (ch = 0; ch < s->out_channels; ch++) memcpy(s->output[ch], output[ch], 1024); *got_frame_ptr = 1; *(AVFrame *)data = s->frame; return FFMIN(buf_size, s->frame_size); }
{ "code": [ " output[ch] = s->output[ch];", " memcpy(s->outptr[channel_map[ch]], output[ch], 1024);", " s->outptr[channel_map[ch]] += AC3_BLOCK_SIZE;" ], "line_no": [ 255, 273, 279 ] }
static int FUNC_0(AVCodecContext * VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; AC3DecodeContext *s = VAR_0->priv_data; int VAR_6, VAR_7, VAR_8, VAR_9; const uint8_t *VAR_10; const float *VAR_11[AC3_MAX_CHANNELS]; if (VAR_5 >= 2 && AV_RB16(VAR_4) == 0x770B) { int VAR_12 = FFMIN(VAR_5, AC3_FRAME_BUFFER_SIZE) >> 1; s->dsp.bswap16_buf((uint16_t *)s->input_buffer, (const uint16_t *)VAR_4, VAR_12); } else memcpy(s->input_buffer, VAR_4, FFMIN(VAR_5, AC3_FRAME_BUFFER_SIZE)); VAR_4 = s->input_buffer; init_get_bits(&s->gbc, VAR_4, VAR_5 * 8); VAR_8 = parse_frame_header(s); if (VAR_8) { switch (VAR_8) { case AAC_AC3_PARSE_ERROR_SYNC: av_log(VAR_0, AV_LOG_ERROR, "frame sync error\n"); return -1; case AAC_AC3_PARSE_ERROR_BSID: av_log(VAR_0, AV_LOG_ERROR, "invalid bitstream id\n"); break; case AAC_AC3_PARSE_ERROR_SAMPLE_RATE: av_log(VAR_0, AV_LOG_ERROR, "invalid sample rate\n"); break; case AAC_AC3_PARSE_ERROR_FRAME_SIZE: av_log(VAR_0, AV_LOG_ERROR, "invalid frame size\n"); break; case AAC_AC3_PARSE_ERROR_FRAME_TYPE: if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) { av_log(VAR_0, AV_LOG_ERROR, "unsupported frame type : " "skipping frame\n"); *VAR_2 = 0; return s->frame_size; } else { av_log(VAR_0, AV_LOG_ERROR, "invalid frame type\n"); } break; default: av_log(VAR_0, AV_LOG_ERROR, "invalid header\n"); break; } } else { if (s->frame_size > VAR_5) { av_log(VAR_0, AV_LOG_ERROR, "incomplete frame\n"); VAR_8 = AAC_AC3_PARSE_ERROR_FRAME_SIZE; } else if (VAR_0->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) { if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &VAR_4[2], s->frame_size - 2)) { av_log(VAR_0, AV_LOG_ERROR, "frame CRC mismatch\n"); VAR_8 = AAC_AC3_PARSE_ERROR_CRC; } } } if (!VAR_8) { VAR_0->sample_rate = s->sample_rate; VAR_0->bit_rate = s->bit_rate; s->out_channels = s->channels; s->output_mode = s->channel_mode; if (s->lfe_on) s->output_mode |= AC3_OUTPUT_LFEON; if (VAR_0->request_channels > 0 && VAR_0->request_channels <= 2 && VAR_0->request_channels < s->channels) { s->out_channels = VAR_0->request_channels; s->output_mode = VAR_0->request_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO; s->channel_layout = avpriv_ac3_channel_layout_tab[s->output_mode]; } VAR_0->channels = s->out_channels; VAR_0->channel_layout = s->channel_layout; s->loro_center_mix_level = gain_levels[s-> center_mix_level]; s->loro_surround_mix_level = gain_levels[s->surround_mix_level]; s->ltrt_center_mix_level = LEVEL_MINUS_3DB; s->ltrt_surround_mix_level = LEVEL_MINUS_3DB; if (s->channels != s->out_channels && !((s->output_mode & AC3_OUTPUT_LFEON) && s->fbw_channels == s->out_channels)) { set_downmix_coeffs(s); } } else if (!s->out_channels) { s->out_channels = VAR_0->channels; if (s->out_channels < s->channels) s->output_mode = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO; } if (VAR_0->channels != s->out_channels) { av_log(VAR_0, AV_LOG_ERROR, "channel number mismatching on damaged frame\n"); return AVERROR_INVALIDDATA; } VAR_0->audio_service_type = s->bitstream_mode; if (s->bitstream_mode == 0x7 && s->channels > 1) VAR_0->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE; VAR_0->channels = s->out_channels; s->frame.nb_samples = s->num_blocks * 256; if ((VAR_9 = ff_get_buffer(VAR_0, &s->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_9; } VAR_10 = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on]; for (VAR_7 = 0; VAR_7 < s->channels; VAR_7++) { if (VAR_7 < s->out_channels) s->outptr[VAR_10[VAR_7]] = (float *)s->frame.VAR_1[VAR_7]; else s->outptr[VAR_7] = s->VAR_11[VAR_7]; VAR_11[VAR_7] = s->VAR_11[VAR_7]; } for (VAR_6 = 0; VAR_6 < s->num_blocks; VAR_6++) { if (!VAR_8 && decode_audio_block(s, VAR_6)) { av_log(VAR_0, AV_LOG_ERROR, "error decoding the audio block\n"); VAR_8 = 1; } if (VAR_8) for (VAR_7 = 0; VAR_7 < s->out_channels; VAR_7++) memcpy(s->outptr[VAR_10[VAR_7]], VAR_11[VAR_7], 1024); for (VAR_7 = 0; VAR_7 < s->out_channels; VAR_7++) { VAR_11[VAR_7] = s->outptr[VAR_10[VAR_7]]; s->outptr[VAR_10[VAR_7]] += AC3_BLOCK_SIZE; } } s->frame.decode_error_flags = VAR_8 ? FF_DECODE_ERROR_INVALID_BITSTREAM : 0; for (VAR_7 = 0; VAR_7 < s->out_channels; VAR_7++) memcpy(s->VAR_11[VAR_7], VAR_11[VAR_7], 1024); *VAR_2 = 1; *(AVFrame *)VAR_1 = s->frame; return FFMIN(VAR_5, s->frame_size); }
[ "static int FUNC_0(AVCodecContext * VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "AC3DecodeContext *s = VAR_0->priv_data;", "int VAR_6, VAR_7, VAR_8, VAR_9;", "const uint8_t *VAR_10;", "const float *VAR_11[AC3_MAX_CHANNELS];", "if (VAR_5 >= 2 && AV_RB16(VAR_4) == 0x770B) {", "int VAR_12 = FFMIN(VAR_5, AC3_FRAME_BUFFER_SIZE) >> 1;", "s->dsp.bswap16_buf((uint16_t *)s->input_buffer, (const uint16_t *)VAR_4, VAR_12);", "} else", "memcpy(s->input_buffer, VAR_4, FFMIN(VAR_5, AC3_FRAME_BUFFER_SIZE));", "VAR_4 = s->input_buffer;", "init_get_bits(&s->gbc, VAR_4, VAR_5 * 8);", "VAR_8 = parse_frame_header(s);", "if (VAR_8) {", "switch (VAR_8) {", "case AAC_AC3_PARSE_ERROR_SYNC:\nav_log(VAR_0, AV_LOG_ERROR, \"frame sync error\\n\");", "return -1;", "case AAC_AC3_PARSE_ERROR_BSID:\nav_log(VAR_0, AV_LOG_ERROR, \"invalid bitstream id\\n\");", "break;", "case AAC_AC3_PARSE_ERROR_SAMPLE_RATE:\nav_log(VAR_0, AV_LOG_ERROR, \"invalid sample rate\\n\");", "break;", "case AAC_AC3_PARSE_ERROR_FRAME_SIZE:\nav_log(VAR_0, AV_LOG_ERROR, \"invalid frame size\\n\");", "break;", "case AAC_AC3_PARSE_ERROR_FRAME_TYPE:\nif (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) {", "av_log(VAR_0, AV_LOG_ERROR, \"unsupported frame type : \"\n\"skipping frame\\n\");", "*VAR_2 = 0;", "return s->frame_size;", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid frame type\\n\");", "}", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"invalid header\\n\");", "break;", "}", "} else {", "if (s->frame_size > VAR_5) {", "av_log(VAR_0, AV_LOG_ERROR, \"incomplete frame\\n\");", "VAR_8 = AAC_AC3_PARSE_ERROR_FRAME_SIZE;", "} else if (VAR_0->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) {", "if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &VAR_4[2],\ns->frame_size - 2)) {", "av_log(VAR_0, AV_LOG_ERROR, \"frame CRC mismatch\\n\");", "VAR_8 = AAC_AC3_PARSE_ERROR_CRC;", "}", "}", "}", "if (!VAR_8) {", "VAR_0->sample_rate = s->sample_rate;", "VAR_0->bit_rate = s->bit_rate;", "s->out_channels = s->channels;", "s->output_mode = s->channel_mode;", "if (s->lfe_on)\ns->output_mode |= AC3_OUTPUT_LFEON;", "if (VAR_0->request_channels > 0 && VAR_0->request_channels <= 2 &&\nVAR_0->request_channels < s->channels) {", "s->out_channels = VAR_0->request_channels;", "s->output_mode = VAR_0->request_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;", "s->channel_layout = avpriv_ac3_channel_layout_tab[s->output_mode];", "}", "VAR_0->channels = s->out_channels;", "VAR_0->channel_layout = s->channel_layout;", "s->loro_center_mix_level = gain_levels[s-> center_mix_level];", "s->loro_surround_mix_level = gain_levels[s->surround_mix_level];", "s->ltrt_center_mix_level = LEVEL_MINUS_3DB;", "s->ltrt_surround_mix_level = LEVEL_MINUS_3DB;", "if (s->channels != s->out_channels && !((s->output_mode & AC3_OUTPUT_LFEON) &&\ns->fbw_channels == s->out_channels)) {", "set_downmix_coeffs(s);", "}", "} else if (!s->out_channels) {", "s->out_channels = VAR_0->channels;", "if (s->out_channels < s->channels)\ns->output_mode = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;", "}", "if (VAR_0->channels != s->out_channels) {", "av_log(VAR_0, AV_LOG_ERROR, \"channel number mismatching on damaged frame\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_0->audio_service_type = s->bitstream_mode;", "if (s->bitstream_mode == 0x7 && s->channels > 1)\nVAR_0->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;", "VAR_0->channels = s->out_channels;", "s->frame.nb_samples = s->num_blocks * 256;", "if ((VAR_9 = ff_get_buffer(VAR_0, &s->frame)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return VAR_9;", "}", "VAR_10 = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on];", "for (VAR_7 = 0; VAR_7 < s->channels; VAR_7++) {", "if (VAR_7 < s->out_channels)\ns->outptr[VAR_10[VAR_7]] = (float *)s->frame.VAR_1[VAR_7];", "else\ns->outptr[VAR_7] = s->VAR_11[VAR_7];", "VAR_11[VAR_7] = s->VAR_11[VAR_7];", "}", "for (VAR_6 = 0; VAR_6 < s->num_blocks; VAR_6++) {", "if (!VAR_8 && decode_audio_block(s, VAR_6)) {", "av_log(VAR_0, AV_LOG_ERROR, \"error decoding the audio block\\n\");", "VAR_8 = 1;", "}", "if (VAR_8)\nfor (VAR_7 = 0; VAR_7 < s->out_channels; VAR_7++)", "memcpy(s->outptr[VAR_10[VAR_7]], VAR_11[VAR_7], 1024);", "for (VAR_7 = 0; VAR_7 < s->out_channels; VAR_7++) {", "VAR_11[VAR_7] = s->outptr[VAR_10[VAR_7]];", "s->outptr[VAR_10[VAR_7]] += AC3_BLOCK_SIZE;", "}", "}", "s->frame.decode_error_flags = VAR_8 ? FF_DECODE_ERROR_INVALID_BITSTREAM : 0;", "for (VAR_7 = 0; VAR_7 < s->out_channels; VAR_7++)", "memcpy(s->VAR_11[VAR_7], VAR_11[VAR_7], 1024);", "*VAR_2 = 1;", "*(AVFrame *)VAR_1 = s->frame;", "return FFMIN(VAR_5, s->frame_size);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 47 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79, 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 143 ], [ 145 ], [ 147 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161, 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219, 221 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 243 ], [ 245 ], [ 247, 249 ], [ 251, 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 287 ], [ 293 ], [ 295 ], [ 299 ], [ 301 ], [ 305 ], [ 307 ] ]
21,639
static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd, const char **p, int line_num) { int val; char arg[1024]; if (!av_strcasecmp(cmd, "Port") || !av_strcasecmp(cmd, "HTTPPort")) { if (!av_strcasecmp(cmd, "Port")) WARNING("Port option is deprecated, use HTTPPort instead\n"); ffserver_get_arg(arg, sizeof(arg), p); val = atoi(arg); if (val < 1 || val > 65536) ERROR("Invalid port: %s\n", arg); if (val < 1024) WARNING("Trying to use IETF assigned system port: %d\n", val); config->http_addr.sin_port = htons(val); } else if (!av_strcasecmp(cmd, "HTTPBindAddress") || !av_strcasecmp(cmd, "BindAddress")) { if (!av_strcasecmp(cmd, "BindAddress")) WARNING("BindAddress option is deprecated, use HTTPBindAddress instead\n"); ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(&config->http_addr.sin_addr, arg) != 0) ERROR("%s:%d: Invalid host/IP address: %s\n", arg); } else if (!av_strcasecmp(cmd, "NoDaemon")) { WARNING("NoDaemon option has no effect, you should remove it\n"); } else if (!av_strcasecmp(cmd, "RTSPPort")) { ffserver_get_arg(arg, sizeof(arg), p); val = atoi(arg); if (val < 1 || val > 65536) ERROR("%s:%d: Invalid port: %s\n", arg); config->rtsp_addr.sin_port = htons(atoi(arg)); } else if (!av_strcasecmp(cmd, "RTSPBindAddress")) { ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(&config->rtsp_addr.sin_addr, arg) != 0) ERROR("Invalid host/IP address: %s\n", arg); } else if (!av_strcasecmp(cmd, "MaxHTTPConnections")) { ffserver_get_arg(arg, sizeof(arg), p); val = atoi(arg); if (val < 1 || val > 65536) ERROR("Invalid MaxHTTPConnections: %s\n", arg); config->nb_max_http_connections = val; } else if (!av_strcasecmp(cmd, "MaxClients")) { ffserver_get_arg(arg, sizeof(arg), p); val = atoi(arg); if (val < 1 || val > config->nb_max_http_connections) ERROR("Invalid MaxClients: %s\n", arg); else config->nb_max_connections = val; } else if (!av_strcasecmp(cmd, "MaxBandwidth")) { int64_t llval; ffserver_get_arg(arg, sizeof(arg), p); llval = strtoll(arg, NULL, 10); if (llval < 10 || llval > 10000000) ERROR("Invalid MaxBandwidth: %s\n", arg); else config->max_bandwidth = llval; } else if (!av_strcasecmp(cmd, "CustomLog")) { if (!config->debug) ffserver_get_arg(config->logfilename, sizeof(config->logfilename), p); } else if (!av_strcasecmp(cmd, "LoadModule")) { ERROR("Loadable modules no longer supported\n"); } else ERROR("Incorrect keyword: '%s'\n", cmd); return 0; }
false
FFmpeg
2121e3e1306181acc39316639bb731919af5bab7
static int ffserver_parse_config_global(FFServerConfig *config, const char *cmd, const char **p, int line_num) { int val; char arg[1024]; if (!av_strcasecmp(cmd, "Port") || !av_strcasecmp(cmd, "HTTPPort")) { if (!av_strcasecmp(cmd, "Port")) WARNING("Port option is deprecated, use HTTPPort instead\n"); ffserver_get_arg(arg, sizeof(arg), p); val = atoi(arg); if (val < 1 || val > 65536) ERROR("Invalid port: %s\n", arg); if (val < 1024) WARNING("Trying to use IETF assigned system port: %d\n", val); config->http_addr.sin_port = htons(val); } else if (!av_strcasecmp(cmd, "HTTPBindAddress") || !av_strcasecmp(cmd, "BindAddress")) { if (!av_strcasecmp(cmd, "BindAddress")) WARNING("BindAddress option is deprecated, use HTTPBindAddress instead\n"); ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(&config->http_addr.sin_addr, arg) != 0) ERROR("%s:%d: Invalid host/IP address: %s\n", arg); } else if (!av_strcasecmp(cmd, "NoDaemon")) { WARNING("NoDaemon option has no effect, you should remove it\n"); } else if (!av_strcasecmp(cmd, "RTSPPort")) { ffserver_get_arg(arg, sizeof(arg), p); val = atoi(arg); if (val < 1 || val > 65536) ERROR("%s:%d: Invalid port: %s\n", arg); config->rtsp_addr.sin_port = htons(atoi(arg)); } else if (!av_strcasecmp(cmd, "RTSPBindAddress")) { ffserver_get_arg(arg, sizeof(arg), p); if (resolve_host(&config->rtsp_addr.sin_addr, arg) != 0) ERROR("Invalid host/IP address: %s\n", arg); } else if (!av_strcasecmp(cmd, "MaxHTTPConnections")) { ffserver_get_arg(arg, sizeof(arg), p); val = atoi(arg); if (val < 1 || val > 65536) ERROR("Invalid MaxHTTPConnections: %s\n", arg); config->nb_max_http_connections = val; } else if (!av_strcasecmp(cmd, "MaxClients")) { ffserver_get_arg(arg, sizeof(arg), p); val = atoi(arg); if (val < 1 || val > config->nb_max_http_connections) ERROR("Invalid MaxClients: %s\n", arg); else config->nb_max_connections = val; } else if (!av_strcasecmp(cmd, "MaxBandwidth")) { int64_t llval; ffserver_get_arg(arg, sizeof(arg), p); llval = strtoll(arg, NULL, 10); if (llval < 10 || llval > 10000000) ERROR("Invalid MaxBandwidth: %s\n", arg); else config->max_bandwidth = llval; } else if (!av_strcasecmp(cmd, "CustomLog")) { if (!config->debug) ffserver_get_arg(config->logfilename, sizeof(config->logfilename), p); } else if (!av_strcasecmp(cmd, "LoadModule")) { ERROR("Loadable modules no longer supported\n"); } else ERROR("Incorrect keyword: '%s'\n", cmd); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FFServerConfig *VAR_0, const char *VAR_1, const char **VAR_2, int VAR_3) { int VAR_4; char VAR_5[1024]; if (!av_strcasecmp(VAR_1, "Port") || !av_strcasecmp(VAR_1, "HTTPPort")) { if (!av_strcasecmp(VAR_1, "Port")) WARNING("Port option is deprecated, use HTTPPort instead\n"); ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); VAR_4 = atoi(VAR_5); if (VAR_4 < 1 || VAR_4 > 65536) ERROR("Invalid port: %s\n", VAR_5); if (VAR_4 < 1024) WARNING("Trying to use IETF assigned system port: %d\n", VAR_4); VAR_0->http_addr.sin_port = htons(VAR_4); } else if (!av_strcasecmp(VAR_1, "HTTPBindAddress") || !av_strcasecmp(VAR_1, "BindAddress")) { if (!av_strcasecmp(VAR_1, "BindAddress")) WARNING("BindAddress option is deprecated, use HTTPBindAddress instead\n"); ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); if (resolve_host(&VAR_0->http_addr.sin_addr, VAR_5) != 0) ERROR("%s:%d: Invalid host/IP address: %s\n", VAR_5); } else if (!av_strcasecmp(VAR_1, "NoDaemon")) { WARNING("NoDaemon option has no effect, you should remove it\n"); } else if (!av_strcasecmp(VAR_1, "RTSPPort")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); VAR_4 = atoi(VAR_5); if (VAR_4 < 1 || VAR_4 > 65536) ERROR("%s:%d: Invalid port: %s\n", VAR_5); VAR_0->rtsp_addr.sin_port = htons(atoi(VAR_5)); } else if (!av_strcasecmp(VAR_1, "RTSPBindAddress")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); if (resolve_host(&VAR_0->rtsp_addr.sin_addr, VAR_5) != 0) ERROR("Invalid host/IP address: %s\n", VAR_5); } else if (!av_strcasecmp(VAR_1, "MaxHTTPConnections")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); VAR_4 = atoi(VAR_5); if (VAR_4 < 1 || VAR_4 > 65536) ERROR("Invalid MaxHTTPConnections: %s\n", VAR_5); VAR_0->nb_max_http_connections = VAR_4; } else if (!av_strcasecmp(VAR_1, "MaxClients")) { ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); VAR_4 = atoi(VAR_5); if (VAR_4 < 1 || VAR_4 > VAR_0->nb_max_http_connections) ERROR("Invalid MaxClients: %s\n", VAR_5); else VAR_0->nb_max_connections = VAR_4; } else if (!av_strcasecmp(VAR_1, "MaxBandwidth")) { int64_t llval; ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2); llval = strtoll(VAR_5, NULL, 10); if (llval < 10 || llval > 10000000) ERROR("Invalid MaxBandwidth: %s\n", VAR_5); else VAR_0->max_bandwidth = llval; } else if (!av_strcasecmp(VAR_1, "CustomLog")) { if (!VAR_0->debug) ffserver_get_arg(VAR_0->logfilename, sizeof(VAR_0->logfilename), VAR_2); } else if (!av_strcasecmp(VAR_1, "LoadModule")) { ERROR("Loadable modules no longer supported\n"); } else ERROR("Incorrect keyword: '%s'\n", VAR_1); return 0; }
[ "static int FUNC_0(FFServerConfig *VAR_0, const char *VAR_1,\nconst char **VAR_2, int VAR_3)\n{", "int VAR_4;", "char VAR_5[1024];", "if (!av_strcasecmp(VAR_1, \"Port\") || !av_strcasecmp(VAR_1, \"HTTPPort\")) {", "if (!av_strcasecmp(VAR_1, \"Port\"))\nWARNING(\"Port option is deprecated, use HTTPPort instead\\n\");", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "VAR_4 = atoi(VAR_5);", "if (VAR_4 < 1 || VAR_4 > 65536)\nERROR(\"Invalid port: %s\\n\", VAR_5);", "if (VAR_4 < 1024)\nWARNING(\"Trying to use IETF assigned system port: %d\\n\", VAR_4);", "VAR_0->http_addr.sin_port = htons(VAR_4);", "} else if (!av_strcasecmp(VAR_1, \"HTTPBindAddress\") || !av_strcasecmp(VAR_1, \"BindAddress\")) {", "if (!av_strcasecmp(VAR_1, \"BindAddress\"))\nWARNING(\"BindAddress option is deprecated, use HTTPBindAddress instead\\n\");", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "if (resolve_host(&VAR_0->http_addr.sin_addr, VAR_5) != 0)\nERROR(\"%s:%d: Invalid host/IP address: %s\\n\", VAR_5);", "} else if (!av_strcasecmp(VAR_1, \"NoDaemon\")) {", "WARNING(\"NoDaemon option has no effect, you should remove it\\n\");", "} else if (!av_strcasecmp(VAR_1, \"RTSPPort\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "VAR_4 = atoi(VAR_5);", "if (VAR_4 < 1 || VAR_4 > 65536)\nERROR(\"%s:%d: Invalid port: %s\\n\", VAR_5);", "VAR_0->rtsp_addr.sin_port = htons(atoi(VAR_5));", "} else if (!av_strcasecmp(VAR_1, \"RTSPBindAddress\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "if (resolve_host(&VAR_0->rtsp_addr.sin_addr, VAR_5) != 0)\nERROR(\"Invalid host/IP address: %s\\n\", VAR_5);", "} else if (!av_strcasecmp(VAR_1, \"MaxHTTPConnections\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "VAR_4 = atoi(VAR_5);", "if (VAR_4 < 1 || VAR_4 > 65536)\nERROR(\"Invalid MaxHTTPConnections: %s\\n\", VAR_5);", "VAR_0->nb_max_http_connections = VAR_4;", "} else if (!av_strcasecmp(VAR_1, \"MaxClients\")) {", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "VAR_4 = atoi(VAR_5);", "if (VAR_4 < 1 || VAR_4 > VAR_0->nb_max_http_connections)\nERROR(\"Invalid MaxClients: %s\\n\", VAR_5);", "else\nVAR_0->nb_max_connections = VAR_4;", "} else if (!av_strcasecmp(VAR_1, \"MaxBandwidth\")) {", "int64_t llval;", "ffserver_get_arg(VAR_5, sizeof(VAR_5), VAR_2);", "llval = strtoll(VAR_5, NULL, 10);", "if (llval < 10 || llval > 10000000)\nERROR(\"Invalid MaxBandwidth: %s\\n\", VAR_5);", "else\nVAR_0->max_bandwidth = llval;", "} else if (!av_strcasecmp(VAR_1, \"CustomLog\")) {", "if (!VAR_0->debug)\nffserver_get_arg(VAR_0->logfilename, sizeof(VAR_0->logfilename), VAR_2);", "} else if (!av_strcasecmp(VAR_1, \"LoadModule\")) {", "ERROR(\"Loadable modules no longer supported\\n\");", "} else", "ERROR(\"Incorrect keyword: '%s'\\n\", VAR_1);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105, 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ] ]
21,640
int ff_h264_fill_default_ref_list(H264Context *h) { int i, len; if (h->slice_type_nos == AV_PICTURE_TYPE_B) { Picture *sorted[32]; int cur_poc, list; int lens[2]; if (FIELD_PICTURE(h)) cur_poc = h->cur_pic_ptr->field_poc[h->picture_structure == PICT_BOTTOM_FIELD]; else cur_poc = h->cur_pic_ptr->poc; for (list = 0; list < 2; list++) { len = add_sorted(sorted, h->short_ref, h->short_ref_count, cur_poc, 1 ^ list); len += add_sorted(sorted + len, h->short_ref, h->short_ref_count, cur_poc, 0 ^ list); assert(len <= 32); len = build_def_list(h->default_ref_list[list], sorted, len, 0, h->picture_structure); len += build_def_list(h->default_ref_list[list] + len, h->long_ref, 16, 1, h->picture_structure); assert(len <= 32); if (len < h->ref_count[list]) memset(&h->default_ref_list[list][len], 0, sizeof(Picture) * (h->ref_count[list] - len)); lens[list] = len; } if (lens[0] == lens[1] && lens[1] > 1) { for (i = 0; h->default_ref_list[0][i].f.data[0] == h->default_ref_list[1][i].f.data[0] && i < lens[0]; i++); if (i == lens[0]) { Picture tmp; COPY_PICTURE(&tmp, &h->default_ref_list[1][0]); COPY_PICTURE(&h->default_ref_list[1][0], &h->default_ref_list[1][1]); COPY_PICTURE(&h->default_ref_list[1][1], &tmp); } } } else { len = build_def_list(h->default_ref_list[0], h->short_ref, h->short_ref_count, 0, h->picture_structure); len += build_def_list(h->default_ref_list[0] + len, h-> long_ref, 16, 1, h->picture_structure); assert(len <= 32); if (len < h->ref_count[0]) memset(&h->default_ref_list[0][len], 0, sizeof(Picture) * (h->ref_count[0] - len)); } #ifdef TRACE for (i = 0; i < h->ref_count[0]; i++) { tprintf(h->avctx, "List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].f.data[0]); } if (h->slice_type_nos == AV_PICTURE_TYPE_B) { for (i = 0; i < h->ref_count[1]; i++) { tprintf(h->avctx, "List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[1][i].f.data[0]); } } #endif return 0; }
false
FFmpeg
a553c6a347d3d28d7ee44c3df3d5c4ee780dba23
int ff_h264_fill_default_ref_list(H264Context *h) { int i, len; if (h->slice_type_nos == AV_PICTURE_TYPE_B) { Picture *sorted[32]; int cur_poc, list; int lens[2]; if (FIELD_PICTURE(h)) cur_poc = h->cur_pic_ptr->field_poc[h->picture_structure == PICT_BOTTOM_FIELD]; else cur_poc = h->cur_pic_ptr->poc; for (list = 0; list < 2; list++) { len = add_sorted(sorted, h->short_ref, h->short_ref_count, cur_poc, 1 ^ list); len += add_sorted(sorted + len, h->short_ref, h->short_ref_count, cur_poc, 0 ^ list); assert(len <= 32); len = build_def_list(h->default_ref_list[list], sorted, len, 0, h->picture_structure); len += build_def_list(h->default_ref_list[list] + len, h->long_ref, 16, 1, h->picture_structure); assert(len <= 32); if (len < h->ref_count[list]) memset(&h->default_ref_list[list][len], 0, sizeof(Picture) * (h->ref_count[list] - len)); lens[list] = len; } if (lens[0] == lens[1] && lens[1] > 1) { for (i = 0; h->default_ref_list[0][i].f.data[0] == h->default_ref_list[1][i].f.data[0] && i < lens[0]; i++); if (i == lens[0]) { Picture tmp; COPY_PICTURE(&tmp, &h->default_ref_list[1][0]); COPY_PICTURE(&h->default_ref_list[1][0], &h->default_ref_list[1][1]); COPY_PICTURE(&h->default_ref_list[1][1], &tmp); } } } else { len = build_def_list(h->default_ref_list[0], h->short_ref, h->short_ref_count, 0, h->picture_structure); len += build_def_list(h->default_ref_list[0] + len, h-> long_ref, 16, 1, h->picture_structure); assert(len <= 32); if (len < h->ref_count[0]) memset(&h->default_ref_list[0][len], 0, sizeof(Picture) * (h->ref_count[0] - len)); } #ifdef TRACE for (i = 0; i < h->ref_count[0]; i++) { tprintf(h->avctx, "List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].f.data[0]); } if (h->slice_type_nos == AV_PICTURE_TYPE_B) { for (i = 0; i < h->ref_count[1]; i++) { tprintf(h->avctx, "List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[1][i].f.data[0]); } } #endif return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(H264Context *VAR_0) { int VAR_1, VAR_2; if (VAR_0->slice_type_nos == AV_PICTURE_TYPE_B) { Picture *sorted[32]; int VAR_3, VAR_4; int VAR_5[2]; if (FIELD_PICTURE(VAR_0)) VAR_3 = VAR_0->cur_pic_ptr->field_poc[VAR_0->picture_structure == PICT_BOTTOM_FIELD]; else VAR_3 = VAR_0->cur_pic_ptr->poc; for (VAR_4 = 0; VAR_4 < 2; VAR_4++) { VAR_2 = add_sorted(sorted, VAR_0->short_ref, VAR_0->short_ref_count, VAR_3, 1 ^ VAR_4); VAR_2 += add_sorted(sorted + VAR_2, VAR_0->short_ref, VAR_0->short_ref_count, VAR_3, 0 ^ VAR_4); assert(VAR_2 <= 32); VAR_2 = build_def_list(VAR_0->default_ref_list[VAR_4], sorted, VAR_2, 0, VAR_0->picture_structure); VAR_2 += build_def_list(VAR_0->default_ref_list[VAR_4] + VAR_2, VAR_0->long_ref, 16, 1, VAR_0->picture_structure); assert(VAR_2 <= 32); if (VAR_2 < VAR_0->ref_count[VAR_4]) memset(&VAR_0->default_ref_list[VAR_4][VAR_2], 0, sizeof(Picture) * (VAR_0->ref_count[VAR_4] - VAR_2)); VAR_5[VAR_4] = VAR_2; } if (VAR_5[0] == VAR_5[1] && VAR_5[1] > 1) { for (VAR_1 = 0; VAR_0->default_ref_list[0][VAR_1].f.data[0] == VAR_0->default_ref_list[1][VAR_1].f.data[0] && VAR_1 < VAR_5[0]; VAR_1++); if (VAR_1 == VAR_5[0]) { Picture tmp; COPY_PICTURE(&tmp, &VAR_0->default_ref_list[1][0]); COPY_PICTURE(&VAR_0->default_ref_list[1][0], &VAR_0->default_ref_list[1][1]); COPY_PICTURE(&VAR_0->default_ref_list[1][1], &tmp); } } } else { VAR_2 = build_def_list(VAR_0->default_ref_list[0], VAR_0->short_ref, VAR_0->short_ref_count, 0, VAR_0->picture_structure); VAR_2 += build_def_list(VAR_0->default_ref_list[0] + VAR_2, VAR_0-> long_ref, 16, 1, VAR_0->picture_structure); assert(VAR_2 <= 32); if (VAR_2 < VAR_0->ref_count[0]) memset(&VAR_0->default_ref_list[0][VAR_2], 0, sizeof(Picture) * (VAR_0->ref_count[0] - VAR_2)); } #ifdef TRACE for (VAR_1 = 0; VAR_1 < VAR_0->ref_count[0]; VAR_1++) { tprintf(VAR_0->avctx, "List0: %s fn:%d 0x%p\n", (VAR_0->default_ref_list[0][VAR_1].long_ref ? "LT" : "ST"), VAR_0->default_ref_list[0][VAR_1].pic_id, VAR_0->default_ref_list[0][VAR_1].f.data[0]); } if (VAR_0->slice_type_nos == AV_PICTURE_TYPE_B) { for (VAR_1 = 0; VAR_1 < VAR_0->ref_count[1]; VAR_1++) { tprintf(VAR_0->avctx, "List1: %s fn:%d 0x%p\n", (VAR_0->default_ref_list[1][VAR_1].long_ref ? "LT" : "ST"), VAR_0->default_ref_list[1][VAR_1].pic_id, VAR_0->default_ref_list[1][VAR_1].f.data[0]); } } #endif return 0; }
[ "int FUNC_0(H264Context *VAR_0)\n{", "int VAR_1, VAR_2;", "if (VAR_0->slice_type_nos == AV_PICTURE_TYPE_B) {", "Picture *sorted[32];", "int VAR_3, VAR_4;", "int VAR_5[2];", "if (FIELD_PICTURE(VAR_0))\nVAR_3 = VAR_0->cur_pic_ptr->field_poc[VAR_0->picture_structure == PICT_BOTTOM_FIELD];", "else\nVAR_3 = VAR_0->cur_pic_ptr->poc;", "for (VAR_4 = 0; VAR_4 < 2; VAR_4++) {", "VAR_2 = add_sorted(sorted, VAR_0->short_ref, VAR_0->short_ref_count, VAR_3, 1 ^ VAR_4);", "VAR_2 += add_sorted(sorted + VAR_2, VAR_0->short_ref, VAR_0->short_ref_count, VAR_3, 0 ^ VAR_4);", "assert(VAR_2 <= 32);", "VAR_2 = build_def_list(VAR_0->default_ref_list[VAR_4], sorted, VAR_2, 0, VAR_0->picture_structure);", "VAR_2 += build_def_list(VAR_0->default_ref_list[VAR_4] + VAR_2, VAR_0->long_ref, 16, 1, VAR_0->picture_structure);", "assert(VAR_2 <= 32);", "if (VAR_2 < VAR_0->ref_count[VAR_4])\nmemset(&VAR_0->default_ref_list[VAR_4][VAR_2], 0, sizeof(Picture) * (VAR_0->ref_count[VAR_4] - VAR_2));", "VAR_5[VAR_4] = VAR_2;", "}", "if (VAR_5[0] == VAR_5[1] && VAR_5[1] > 1) {", "for (VAR_1 = 0; VAR_0->default_ref_list[0][VAR_1].f.data[0] == VAR_0->default_ref_list[1][VAR_1].f.data[0] && VAR_1 < VAR_5[0]; VAR_1++);", "if (VAR_1 == VAR_5[0]) {", "Picture tmp;", "COPY_PICTURE(&tmp, &VAR_0->default_ref_list[1][0]);", "COPY_PICTURE(&VAR_0->default_ref_list[1][0], &VAR_0->default_ref_list[1][1]);", "COPY_PICTURE(&VAR_0->default_ref_list[1][1], &tmp);", "}", "}", "} else {", "VAR_2 = build_def_list(VAR_0->default_ref_list[0], VAR_0->short_ref, VAR_0->short_ref_count, 0, VAR_0->picture_structure);", "VAR_2 += build_def_list(VAR_0->default_ref_list[0] + VAR_2, VAR_0-> long_ref, 16, 1, VAR_0->picture_structure);", "assert(VAR_2 <= 32);", "if (VAR_2 < VAR_0->ref_count[0])\nmemset(&VAR_0->default_ref_list[0][VAR_2], 0, sizeof(Picture) * (VAR_0->ref_count[0] - VAR_2));", "}", "#ifdef TRACE\nfor (VAR_1 = 0; VAR_1 < VAR_0->ref_count[0]; VAR_1++) {", "tprintf(VAR_0->avctx, \"List0: %s fn:%d 0x%p\\n\",\n(VAR_0->default_ref_list[0][VAR_1].long_ref ? \"LT\" : \"ST\"),\nVAR_0->default_ref_list[0][VAR_1].pic_id,\nVAR_0->default_ref_list[0][VAR_1].f.data[0]);", "}", "if (VAR_0->slice_type_nos == AV_PICTURE_TYPE_B) {", "for (VAR_1 = 0; VAR_1 < VAR_0->ref_count[1]; VAR_1++) {", "tprintf(VAR_0->avctx, \"List1: %s fn:%d 0x%p\\n\",\n(VAR_0->default_ref_list[1][VAR_1].long_ref ? \"LT\" : \"ST\"),\nVAR_0->default_ref_list[1][VAR_1].pic_id,\nVAR_0->default_ref_list[1][VAR_1].f.data[0]);", "}", "}", "#endif\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87, 89 ], [ 91, 93, 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107, 109, 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ] ]
21,642
static int check_strtox_error(const char *p, char *endptr, const char **next, int err) { /* If no conversion was performed, prefer BSD behavior over glibc * behavior. */ if (err == 0 && endptr == p) { err = EINVAL; } if (!next && *endptr) { return -EINVAL; } if (next) { *next = endptr; } return -err; }
true
qemu
4295f879becfbbb9f4330489311586b96915d920
static int check_strtox_error(const char *p, char *endptr, const char **next, int err) { if (err == 0 && endptr == p) { err = EINVAL; } if (!next && *endptr) { return -EINVAL; } if (next) { *next = endptr; } return -err; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0, char *VAR_1, const char **VAR_2, int VAR_3) { if (VAR_3 == 0 && VAR_1 == VAR_0) { VAR_3 = EINVAL; } if (!VAR_2 && *VAR_1) { return -EINVAL; } if (VAR_2) { *VAR_2 = VAR_1; } return -VAR_3; }
[ "static int FUNC_0(const char *VAR_0, char *VAR_1, const char **VAR_2,\nint VAR_3)\n{", "if (VAR_3 == 0 && VAR_1 == VAR_0) {", "VAR_3 = EINVAL;", "}", "if (!VAR_2 && *VAR_1) {", "return -EINVAL;", "}", "if (VAR_2) {", "*VAR_2 = VAR_1;", "}", "return -VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
21,643
static void ram_decompress_close(RamDecompressState *s) { inflateEnd(&s->zstream); }
true
qemu
94fb0909645de18481cc726ee0ec9b5afa861394
static void ram_decompress_close(RamDecompressState *s) { inflateEnd(&s->zstream); }
{ "code": [ "static void ram_decompress_close(RamDecompressState *s)", " inflateEnd(&s->zstream);" ], "line_no": [ 1, 5 ] }
static void FUNC_0(RamDecompressState *VAR_0) { inflateEnd(&VAR_0->zstream); }
[ "static void FUNC_0(RamDecompressState *VAR_0)\n{", "inflateEnd(&VAR_0->zstream);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
21,644
static void ahci_hba_enable(AHCIQState *ahci) { /* Bits of interest in this section: * GHC.AE Global Host Control / AHCI Enable * PxCMD.ST Port Command: Start * PxCMD.SUD "Spin Up Device" * PxCMD.POD "Power On Device" * PxCMD.FRE "FIS Receive Enable" * PxCMD.FR "FIS Receive Running" * PxCMD.CR "Command List Running" */ uint32_t reg, ports_impl; uint16_t i; uint8_t num_cmd_slots; g_assert(ahci != NULL); /* Set GHC.AE to 1 */ ahci_set(ahci, AHCI_GHC, AHCI_GHC_AE); reg = ahci_rreg(ahci, AHCI_GHC); ASSERT_BIT_SET(reg, AHCI_GHC_AE); /* Cache CAP and CAP2. */ ahci->cap = ahci_rreg(ahci, AHCI_CAP); ahci->cap2 = ahci_rreg(ahci, AHCI_CAP2); /* Read CAP.NCS, how many command slots do we have? */ num_cmd_slots = ((ahci->cap & AHCI_CAP_NCS) >> ctzl(AHCI_CAP_NCS)) + 1; g_test_message("Number of Command Slots: %u", num_cmd_slots); /* Determine which ports are implemented. */ ports_impl = ahci_rreg(ahci, AHCI_PI); for (i = 0; ports_impl; ports_impl >>= 1, ++i) { if (!(ports_impl & 0x01)) { continue; } g_test_message("Initializing port %u", i); reg = ahci_px_rreg(ahci, i, AHCI_PX_CMD); if (BITCLR(reg, AHCI_PX_CMD_ST | AHCI_PX_CMD_CR | AHCI_PX_CMD_FRE | AHCI_PX_CMD_FR)) { g_test_message("port is idle"); } else { g_test_message("port needs to be idled"); ahci_px_clr(ahci, i, AHCI_PX_CMD, (AHCI_PX_CMD_ST | AHCI_PX_CMD_FRE)); /* The port has 500ms to disengage. */ usleep(500000); reg = ahci_px_rreg(ahci, i, AHCI_PX_CMD); ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_CR); ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_FR); g_test_message("port is now idle"); /* The spec does allow for possibly needing a PORT RESET * or HBA reset if we fail to idle the port. */ } /* Allocate Memory for the Command List Buffer & FIS Buffer */ /* PxCLB space ... 0x20 per command, as in 4.2.2 p 36 */ ahci->port[i].clb = ahci_alloc(ahci, num_cmd_slots * 0x20); qmemset(ahci->port[i].clb, 0x00, 0x100); g_test_message("CLB: 0x%08" PRIx64, ahci->port[i].clb); ahci_px_wreg(ahci, i, AHCI_PX_CLB, ahci->port[i].clb); g_assert_cmphex(ahci->port[i].clb, ==, ahci_px_rreg(ahci, i, AHCI_PX_CLB)); /* PxFB space ... 0x100, as in 4.2.1 p 35 */ ahci->port[i].fb = ahci_alloc(ahci, 0x100); qmemset(ahci->port[i].fb, 0x00, 0x100); g_test_message("FB: 0x%08" PRIx64, ahci->port[i].fb); ahci_px_wreg(ahci, i, AHCI_PX_FB, ahci->port[i].fb); g_assert_cmphex(ahci->port[i].fb, ==, ahci_px_rreg(ahci, i, AHCI_PX_FB)); /* Clear PxSERR, PxIS, then IS.IPS[x] by writing '1's. */ ahci_px_wreg(ahci, i, AHCI_PX_SERR, 0xFFFFFFFF); ahci_px_wreg(ahci, i, AHCI_PX_IS, 0xFFFFFFFF); ahci_wreg(ahci, AHCI_IS, (1 << i)); /* Verify Interrupts Cleared */ reg = ahci_px_rreg(ahci, i, AHCI_PX_SERR); g_assert_cmphex(reg, ==, 0); reg = ahci_px_rreg(ahci, i, AHCI_PX_IS); g_assert_cmphex(reg, ==, 0); reg = ahci_rreg(ahci, AHCI_IS); ASSERT_BIT_CLEAR(reg, (1 << i)); /* Enable All Interrupts: */ ahci_px_wreg(ahci, i, AHCI_PX_IE, 0xFFFFFFFF); reg = ahci_px_rreg(ahci, i, AHCI_PX_IE); g_assert_cmphex(reg, ==, ~((uint32_t)AHCI_PX_IE_RESERVED)); /* Enable the FIS Receive Engine. */ ahci_px_set(ahci, i, AHCI_PX_CMD, AHCI_PX_CMD_FRE); reg = ahci_px_rreg(ahci, i, AHCI_PX_CMD); ASSERT_BIT_SET(reg, AHCI_PX_CMD_FR); /* AHCI 1.3 spec: if !STS.BSY, !STS.DRQ and PxSSTS.DET indicates * physical presence, a device is present and may be started. However, * PxSERR.DIAG.X /may/ need to be cleared a priori. */ reg = ahci_px_rreg(ahci, i, AHCI_PX_SERR); if (BITSET(reg, AHCI_PX_SERR_DIAG_X)) { ahci_px_set(ahci, i, AHCI_PX_SERR, AHCI_PX_SERR_DIAG_X); } reg = ahci_px_rreg(ahci, i, AHCI_PX_TFD); if (BITCLR(reg, AHCI_PX_TFD_STS_BSY | AHCI_PX_TFD_STS_DRQ)) { reg = ahci_px_rreg(ahci, i, AHCI_PX_SSTS); if ((reg & AHCI_PX_SSTS_DET) == SSTS_DET_ESTABLISHED) { /* Device Found: set PxCMD.ST := 1 */ ahci_px_set(ahci, i, AHCI_PX_CMD, AHCI_PX_CMD_ST); ASSERT_BIT_SET(ahci_px_rreg(ahci, i, AHCI_PX_CMD), AHCI_PX_CMD_CR); g_test_message("Started Device %u", i); } else if ((reg & AHCI_PX_SSTS_DET)) { /* Device present, but in some unknown state. */ g_assert_not_reached(); } } } /* Enable GHC.IE */ ahci_set(ahci, AHCI_GHC, AHCI_GHC_IE); reg = ahci_rreg(ahci, AHCI_GHC); ASSERT_BIT_SET(reg, AHCI_GHC_IE); /* TODO: The device should now be idling and waiting for commands. * In the future, a small test-case to inspect the Register D2H FIS * and clear the initial interrupts might be good. */ }
true
qemu
9a75b0a037e3a8030992244353f17b62f6daf2ab
static void ahci_hba_enable(AHCIQState *ahci) { uint32_t reg, ports_impl; uint16_t i; uint8_t num_cmd_slots; g_assert(ahci != NULL); ahci_set(ahci, AHCI_GHC, AHCI_GHC_AE); reg = ahci_rreg(ahci, AHCI_GHC); ASSERT_BIT_SET(reg, AHCI_GHC_AE); ahci->cap = ahci_rreg(ahci, AHCI_CAP); ahci->cap2 = ahci_rreg(ahci, AHCI_CAP2); num_cmd_slots = ((ahci->cap & AHCI_CAP_NCS) >> ctzl(AHCI_CAP_NCS)) + 1; g_test_message("Number of Command Slots: %u", num_cmd_slots); ports_impl = ahci_rreg(ahci, AHCI_PI); for (i = 0; ports_impl; ports_impl >>= 1, ++i) { if (!(ports_impl & 0x01)) { continue; } g_test_message("Initializing port %u", i); reg = ahci_px_rreg(ahci, i, AHCI_PX_CMD); if (BITCLR(reg, AHCI_PX_CMD_ST | AHCI_PX_CMD_CR | AHCI_PX_CMD_FRE | AHCI_PX_CMD_FR)) { g_test_message("port is idle"); } else { g_test_message("port needs to be idled"); ahci_px_clr(ahci, i, AHCI_PX_CMD, (AHCI_PX_CMD_ST | AHCI_PX_CMD_FRE)); usleep(500000); reg = ahci_px_rreg(ahci, i, AHCI_PX_CMD); ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_CR); ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_FR); g_test_message("port is now idle"); } ahci->port[i].clb = ahci_alloc(ahci, num_cmd_slots * 0x20); qmemset(ahci->port[i].clb, 0x00, 0x100); g_test_message("CLB: 0x%08" PRIx64, ahci->port[i].clb); ahci_px_wreg(ahci, i, AHCI_PX_CLB, ahci->port[i].clb); g_assert_cmphex(ahci->port[i].clb, ==, ahci_px_rreg(ahci, i, AHCI_PX_CLB)); ahci->port[i].fb = ahci_alloc(ahci, 0x100); qmemset(ahci->port[i].fb, 0x00, 0x100); g_test_message("FB: 0x%08" PRIx64, ahci->port[i].fb); ahci_px_wreg(ahci, i, AHCI_PX_FB, ahci->port[i].fb); g_assert_cmphex(ahci->port[i].fb, ==, ahci_px_rreg(ahci, i, AHCI_PX_FB)); ahci_px_wreg(ahci, i, AHCI_PX_SERR, 0xFFFFFFFF); ahci_px_wreg(ahci, i, AHCI_PX_IS, 0xFFFFFFFF); ahci_wreg(ahci, AHCI_IS, (1 << i)); reg = ahci_px_rreg(ahci, i, AHCI_PX_SERR); g_assert_cmphex(reg, ==, 0); reg = ahci_px_rreg(ahci, i, AHCI_PX_IS); g_assert_cmphex(reg, ==, 0); reg = ahci_rreg(ahci, AHCI_IS); ASSERT_BIT_CLEAR(reg, (1 << i)); ahci_px_wreg(ahci, i, AHCI_PX_IE, 0xFFFFFFFF); reg = ahci_px_rreg(ahci, i, AHCI_PX_IE); g_assert_cmphex(reg, ==, ~((uint32_t)AHCI_PX_IE_RESERVED)); ahci_px_set(ahci, i, AHCI_PX_CMD, AHCI_PX_CMD_FRE); reg = ahci_px_rreg(ahci, i, AHCI_PX_CMD); ASSERT_BIT_SET(reg, AHCI_PX_CMD_FR); reg = ahci_px_rreg(ahci, i, AHCI_PX_SERR); if (BITSET(reg, AHCI_PX_SERR_DIAG_X)) { ahci_px_set(ahci, i, AHCI_PX_SERR, AHCI_PX_SERR_DIAG_X); } reg = ahci_px_rreg(ahci, i, AHCI_PX_TFD); if (BITCLR(reg, AHCI_PX_TFD_STS_BSY | AHCI_PX_TFD_STS_DRQ)) { reg = ahci_px_rreg(ahci, i, AHCI_PX_SSTS); if ((reg & AHCI_PX_SSTS_DET) == SSTS_DET_ESTABLISHED) { ahci_px_set(ahci, i, AHCI_PX_CMD, AHCI_PX_CMD_ST); ASSERT_BIT_SET(ahci_px_rreg(ahci, i, AHCI_PX_CMD), AHCI_PX_CMD_CR); g_test_message("Started Device %u", i); } else if ((reg & AHCI_PX_SSTS_DET)) { g_assert_not_reached(); } } } ahci_set(ahci, AHCI_GHC, AHCI_GHC_IE); reg = ahci_rreg(ahci, AHCI_GHC); ASSERT_BIT_SET(reg, AHCI_GHC_IE); }
{ "code": [ " g_assert(ahci != NULL);", "static void ahci_hba_enable(AHCIQState *ahci)", " uint32_t reg, ports_impl;", " uint16_t i;", " uint8_t num_cmd_slots;", " g_assert(ahci != NULL);", " ahci_set(ahci, AHCI_GHC, AHCI_GHC_AE);", " reg = ahci_rreg(ahci, AHCI_GHC);", " ASSERT_BIT_SET(reg, AHCI_GHC_AE);", " ahci->cap = ahci_rreg(ahci, AHCI_CAP);", " ahci->cap2 = ahci_rreg(ahci, AHCI_CAP2);", " num_cmd_slots = ((ahci->cap & AHCI_CAP_NCS) >> ctzl(AHCI_CAP_NCS)) + 1;", " g_test_message(\"Number of Command Slots: %u\", num_cmd_slots);", " ports_impl = ahci_rreg(ahci, AHCI_PI);", " for (i = 0; ports_impl; ports_impl >>= 1, ++i) {", " if (!(ports_impl & 0x01)) {", " continue;", " g_test_message(\"Initializing port %u\", i);", " reg = ahci_px_rreg(ahci, i, AHCI_PX_CMD);", " if (BITCLR(reg, AHCI_PX_CMD_ST | AHCI_PX_CMD_CR |", " AHCI_PX_CMD_FRE | AHCI_PX_CMD_FR)) {", " g_test_message(\"port is idle\");", " } else {", " g_test_message(\"port needs to be idled\");", " ahci_px_clr(ahci, i, AHCI_PX_CMD,", " (AHCI_PX_CMD_ST | AHCI_PX_CMD_FRE));", " usleep(500000);", " reg = ahci_px_rreg(ahci, i, AHCI_PX_CMD);", " ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_CR);", " ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_FR);", " g_test_message(\"port is now idle\");", " ahci->port[i].clb = ahci_alloc(ahci, num_cmd_slots * 0x20);", " qmemset(ahci->port[i].clb, 0x00, 0x100);", " g_test_message(\"CLB: 0x%08\" PRIx64, ahci->port[i].clb);", " ahci_px_wreg(ahci, i, AHCI_PX_CLB, ahci->port[i].clb);", " g_assert_cmphex(ahci->port[i].clb, ==,", " ahci_px_rreg(ahci, i, AHCI_PX_CLB));", " ahci->port[i].fb = ahci_alloc(ahci, 0x100);", " qmemset(ahci->port[i].fb, 0x00, 0x100);", " g_test_message(\"FB: 0x%08\" PRIx64, ahci->port[i].fb);", " ahci_px_wreg(ahci, i, AHCI_PX_FB, ahci->port[i].fb);", " g_assert_cmphex(ahci->port[i].fb, ==,", " ahci_px_rreg(ahci, i, AHCI_PX_FB));", " ahci_px_wreg(ahci, i, AHCI_PX_SERR, 0xFFFFFFFF);", " ahci_px_wreg(ahci, i, AHCI_PX_IS, 0xFFFFFFFF);", " ahci_wreg(ahci, AHCI_IS, (1 << i));", " reg = ahci_px_rreg(ahci, i, AHCI_PX_SERR);", " g_assert_cmphex(reg, ==, 0);", " reg = ahci_px_rreg(ahci, i, AHCI_PX_IS);", " g_assert_cmphex(reg, ==, 0);", " reg = ahci_rreg(ahci, AHCI_IS);", " ASSERT_BIT_CLEAR(reg, (1 << i));", " ahci_px_wreg(ahci, i, AHCI_PX_IE, 0xFFFFFFFF);", " reg = ahci_px_rreg(ahci, i, AHCI_PX_IE);", " g_assert_cmphex(reg, ==, ~((uint32_t)AHCI_PX_IE_RESERVED));", " ahci_px_set(ahci, i, AHCI_PX_CMD, AHCI_PX_CMD_FRE);", " reg = ahci_px_rreg(ahci, i, AHCI_PX_CMD);", " ASSERT_BIT_SET(reg, AHCI_PX_CMD_FR);", " reg = ahci_px_rreg(ahci, i, AHCI_PX_SERR);", " if (BITSET(reg, AHCI_PX_SERR_DIAG_X)) {", " ahci_px_set(ahci, i, AHCI_PX_SERR, AHCI_PX_SERR_DIAG_X);", " reg = ahci_px_rreg(ahci, i, AHCI_PX_TFD);", " if (BITCLR(reg, AHCI_PX_TFD_STS_BSY | AHCI_PX_TFD_STS_DRQ)) {", " reg = ahci_px_rreg(ahci, i, AHCI_PX_SSTS);", " if ((reg & AHCI_PX_SSTS_DET) == SSTS_DET_ESTABLISHED) {", " ahci_px_set(ahci, i, AHCI_PX_CMD, AHCI_PX_CMD_ST);", " ASSERT_BIT_SET(ahci_px_rreg(ahci, i, AHCI_PX_CMD),", " AHCI_PX_CMD_CR);", " g_test_message(\"Started Device %u\", i);", " } else if ((reg & AHCI_PX_SSTS_DET)) {", " g_assert_not_reached();", " ahci_set(ahci, AHCI_GHC, AHCI_GHC_IE);", " reg = ahci_rreg(ahci, AHCI_GHC);", " ASSERT_BIT_SET(reg, AHCI_GHC_IE);" ], "line_no": [ 31, 1, 23, 25, 27, 31, 37, 39, 41, 47, 49, 55, 57, 63, 67, 69, 71, 77, 81, 83, 85, 87, 89, 91, 93, 95, 99, 101, 103, 105, 107, 121, 123, 125, 127, 129, 131, 137, 139, 141, 143, 145, 147, 153, 155, 157, 163, 165, 169, 165, 175, 177, 183, 185, 187, 193, 81, 197, 163, 209, 211, 217, 219, 221, 223, 227, 229, 231, 233, 235, 239, 251, 39, 255 ] }
static void FUNC_0(AHCIQState *VAR_0) { uint32_t reg, ports_impl; uint16_t i; uint8_t num_cmd_slots; g_assert(VAR_0 != NULL); ahci_set(VAR_0, AHCI_GHC, AHCI_GHC_AE); reg = ahci_rreg(VAR_0, AHCI_GHC); ASSERT_BIT_SET(reg, AHCI_GHC_AE); VAR_0->cap = ahci_rreg(VAR_0, AHCI_CAP); VAR_0->cap2 = ahci_rreg(VAR_0, AHCI_CAP2); num_cmd_slots = ((VAR_0->cap & AHCI_CAP_NCS) >> ctzl(AHCI_CAP_NCS)) + 1; g_test_message("Number of Command Slots: %u", num_cmd_slots); ports_impl = ahci_rreg(VAR_0, AHCI_PI); for (i = 0; ports_impl; ports_impl >>= 1, ++i) { if (!(ports_impl & 0x01)) { continue; } g_test_message("Initializing port %u", i); reg = ahci_px_rreg(VAR_0, i, AHCI_PX_CMD); if (BITCLR(reg, AHCI_PX_CMD_ST | AHCI_PX_CMD_CR | AHCI_PX_CMD_FRE | AHCI_PX_CMD_FR)) { g_test_message("port is idle"); } else { g_test_message("port needs to be idled"); ahci_px_clr(VAR_0, i, AHCI_PX_CMD, (AHCI_PX_CMD_ST | AHCI_PX_CMD_FRE)); usleep(500000); reg = ahci_px_rreg(VAR_0, i, AHCI_PX_CMD); ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_CR); ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_FR); g_test_message("port is now idle"); } VAR_0->port[i].clb = ahci_alloc(VAR_0, num_cmd_slots * 0x20); qmemset(VAR_0->port[i].clb, 0x00, 0x100); g_test_message("CLB: 0x%08" PRIx64, VAR_0->port[i].clb); ahci_px_wreg(VAR_0, i, AHCI_PX_CLB, VAR_0->port[i].clb); g_assert_cmphex(VAR_0->port[i].clb, ==, ahci_px_rreg(VAR_0, i, AHCI_PX_CLB)); VAR_0->port[i].fb = ahci_alloc(VAR_0, 0x100); qmemset(VAR_0->port[i].fb, 0x00, 0x100); g_test_message("FB: 0x%08" PRIx64, VAR_0->port[i].fb); ahci_px_wreg(VAR_0, i, AHCI_PX_FB, VAR_0->port[i].fb); g_assert_cmphex(VAR_0->port[i].fb, ==, ahci_px_rreg(VAR_0, i, AHCI_PX_FB)); ahci_px_wreg(VAR_0, i, AHCI_PX_SERR, 0xFFFFFFFF); ahci_px_wreg(VAR_0, i, AHCI_PX_IS, 0xFFFFFFFF); ahci_wreg(VAR_0, AHCI_IS, (1 << i)); reg = ahci_px_rreg(VAR_0, i, AHCI_PX_SERR); g_assert_cmphex(reg, ==, 0); reg = ahci_px_rreg(VAR_0, i, AHCI_PX_IS); g_assert_cmphex(reg, ==, 0); reg = ahci_rreg(VAR_0, AHCI_IS); ASSERT_BIT_CLEAR(reg, (1 << i)); ahci_px_wreg(VAR_0, i, AHCI_PX_IE, 0xFFFFFFFF); reg = ahci_px_rreg(VAR_0, i, AHCI_PX_IE); g_assert_cmphex(reg, ==, ~((uint32_t)AHCI_PX_IE_RESERVED)); ahci_px_set(VAR_0, i, AHCI_PX_CMD, AHCI_PX_CMD_FRE); reg = ahci_px_rreg(VAR_0, i, AHCI_PX_CMD); ASSERT_BIT_SET(reg, AHCI_PX_CMD_FR); reg = ahci_px_rreg(VAR_0, i, AHCI_PX_SERR); if (BITSET(reg, AHCI_PX_SERR_DIAG_X)) { ahci_px_set(VAR_0, i, AHCI_PX_SERR, AHCI_PX_SERR_DIAG_X); } reg = ahci_px_rreg(VAR_0, i, AHCI_PX_TFD); if (BITCLR(reg, AHCI_PX_TFD_STS_BSY | AHCI_PX_TFD_STS_DRQ)) { reg = ahci_px_rreg(VAR_0, i, AHCI_PX_SSTS); if ((reg & AHCI_PX_SSTS_DET) == SSTS_DET_ESTABLISHED) { ahci_px_set(VAR_0, i, AHCI_PX_CMD, AHCI_PX_CMD_ST); ASSERT_BIT_SET(ahci_px_rreg(VAR_0, i, AHCI_PX_CMD), AHCI_PX_CMD_CR); g_test_message("Started Device %u", i); } else if ((reg & AHCI_PX_SSTS_DET)) { g_assert_not_reached(); } } } ahci_set(VAR_0, AHCI_GHC, AHCI_GHC_IE); reg = ahci_rreg(VAR_0, AHCI_GHC); ASSERT_BIT_SET(reg, AHCI_GHC_IE); }
[ "static void FUNC_0(AHCIQState *VAR_0)\n{", "uint32_t reg, ports_impl;", "uint16_t i;", "uint8_t num_cmd_slots;", "g_assert(VAR_0 != NULL);", "ahci_set(VAR_0, AHCI_GHC, AHCI_GHC_AE);", "reg = ahci_rreg(VAR_0, AHCI_GHC);", "ASSERT_BIT_SET(reg, AHCI_GHC_AE);", "VAR_0->cap = ahci_rreg(VAR_0, AHCI_CAP);", "VAR_0->cap2 = ahci_rreg(VAR_0, AHCI_CAP2);", "num_cmd_slots = ((VAR_0->cap & AHCI_CAP_NCS) >> ctzl(AHCI_CAP_NCS)) + 1;", "g_test_message(\"Number of Command Slots: %u\", num_cmd_slots);", "ports_impl = ahci_rreg(VAR_0, AHCI_PI);", "for (i = 0; ports_impl; ports_impl >>= 1, ++i) {", "if (!(ports_impl & 0x01)) {", "continue;", "}", "g_test_message(\"Initializing port %u\", i);", "reg = ahci_px_rreg(VAR_0, i, AHCI_PX_CMD);", "if (BITCLR(reg, AHCI_PX_CMD_ST | AHCI_PX_CMD_CR |\nAHCI_PX_CMD_FRE | AHCI_PX_CMD_FR)) {", "g_test_message(\"port is idle\");", "} else {", "g_test_message(\"port needs to be idled\");", "ahci_px_clr(VAR_0, i, AHCI_PX_CMD,\n(AHCI_PX_CMD_ST | AHCI_PX_CMD_FRE));", "usleep(500000);", "reg = ahci_px_rreg(VAR_0, i, AHCI_PX_CMD);", "ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_CR);", "ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_FR);", "g_test_message(\"port is now idle\");", "}", "VAR_0->port[i].clb = ahci_alloc(VAR_0, num_cmd_slots * 0x20);", "qmemset(VAR_0->port[i].clb, 0x00, 0x100);", "g_test_message(\"CLB: 0x%08\" PRIx64, VAR_0->port[i].clb);", "ahci_px_wreg(VAR_0, i, AHCI_PX_CLB, VAR_0->port[i].clb);", "g_assert_cmphex(VAR_0->port[i].clb, ==,\nahci_px_rreg(VAR_0, i, AHCI_PX_CLB));", "VAR_0->port[i].fb = ahci_alloc(VAR_0, 0x100);", "qmemset(VAR_0->port[i].fb, 0x00, 0x100);", "g_test_message(\"FB: 0x%08\" PRIx64, VAR_0->port[i].fb);", "ahci_px_wreg(VAR_0, i, AHCI_PX_FB, VAR_0->port[i].fb);", "g_assert_cmphex(VAR_0->port[i].fb, ==,\nahci_px_rreg(VAR_0, i, AHCI_PX_FB));", "ahci_px_wreg(VAR_0, i, AHCI_PX_SERR, 0xFFFFFFFF);", "ahci_px_wreg(VAR_0, i, AHCI_PX_IS, 0xFFFFFFFF);", "ahci_wreg(VAR_0, AHCI_IS, (1 << i));", "reg = ahci_px_rreg(VAR_0, i, AHCI_PX_SERR);", "g_assert_cmphex(reg, ==, 0);", "reg = ahci_px_rreg(VAR_0, i, AHCI_PX_IS);", "g_assert_cmphex(reg, ==, 0);", "reg = ahci_rreg(VAR_0, AHCI_IS);", "ASSERT_BIT_CLEAR(reg, (1 << i));", "ahci_px_wreg(VAR_0, i, AHCI_PX_IE, 0xFFFFFFFF);", "reg = ahci_px_rreg(VAR_0, i, AHCI_PX_IE);", "g_assert_cmphex(reg, ==, ~((uint32_t)AHCI_PX_IE_RESERVED));", "ahci_px_set(VAR_0, i, AHCI_PX_CMD, AHCI_PX_CMD_FRE);", "reg = ahci_px_rreg(VAR_0, i, AHCI_PX_CMD);", "ASSERT_BIT_SET(reg, AHCI_PX_CMD_FR);", "reg = ahci_px_rreg(VAR_0, i, AHCI_PX_SERR);", "if (BITSET(reg, AHCI_PX_SERR_DIAG_X)) {", "ahci_px_set(VAR_0, i, AHCI_PX_SERR, AHCI_PX_SERR_DIAG_X);", "}", "reg = ahci_px_rreg(VAR_0, i, AHCI_PX_TFD);", "if (BITCLR(reg, AHCI_PX_TFD_STS_BSY | AHCI_PX_TFD_STS_DRQ)) {", "reg = ahci_px_rreg(VAR_0, i, AHCI_PX_SSTS);", "if ((reg & AHCI_PX_SSTS_DET) == SSTS_DET_ESTABLISHED) {", "ahci_px_set(VAR_0, i, AHCI_PX_CMD, AHCI_PX_CMD_ST);", "ASSERT_BIT_SET(ahci_px_rreg(VAR_0, i, AHCI_PX_CMD),\nAHCI_PX_CMD_CR);", "g_test_message(\"Started Device %u\", i);", "} else if ((reg & AHCI_PX_SSTS_DET)) {", "g_assert_not_reached();", "}", "}", "}", "ahci_set(VAR_0, AHCI_GHC, AHCI_GHC_IE);", "reg = ahci_rreg(VAR_0, AHCI_GHC);", "ASSERT_BIT_SET(reg, AHCI_GHC_IE);", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 37 ], [ 39 ], [ 41 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 113 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 153 ], [ 155 ], [ 157 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 183 ], [ 185 ], [ 187 ], [ 193 ], [ 195 ], [ 197 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 251 ], [ 253 ], [ 255 ], [ 265 ] ]
21,645
static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length) { int x, y; const int width = f->avctx->width; const int height = f->avctx->height; uint16_t *src = (uint16_t *)f->last_picture.data[0]; uint16_t *dst = (uint16_t *)f->current_picture.data[0]; const int stride = f->current_picture.linesize[0] >> 1; unsigned int bitstream_size, bytestream_size, wordstream_size, extra, bytestream_offset, wordstream_offset; if (f->version > 1) { extra = 20; if (length < extra) return -1; bitstream_size = AV_RL32(buf + 8); wordstream_size = AV_RL32(buf + 12); bytestream_size = AV_RL32(buf + 16); } else { extra = 0; bitstream_size = AV_RL16(buf - 4); wordstream_size = AV_RL16(buf - 2); bytestream_size = FFMAX(length - bitstream_size - wordstream_size, 0); } if (bitstream_size > length || bytestream_size > length - bitstream_size || wordstream_size > length - bytestream_size - bitstream_size || extra > length - bytestream_size - bitstream_size - wordstream_size) { av_log(f->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size, bitstream_size+ bytestream_size+ wordstream_size - length); return -1; } av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!f->bitstream_buffer) return AVERROR(ENOMEM); f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra), bitstream_size / 4); memset((uint8_t*)f->bitstream_buffer + bitstream_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); init_get_bits(&f->gb, f->bitstream_buffer, 8 * bitstream_size); wordstream_offset = extra + bitstream_size; bytestream_offset = extra + bitstream_size + wordstream_size; bytestream2_init(&f->g2, buf + wordstream_offset, length - wordstream_offset); bytestream2_init(&f->g, buf + bytestream_offset, length - bytestream_offset); init_mv(f); for (y = 0; y < height; y += 8) { for (x = 0; x < width; x += 8) decode_p_block(f, dst + x, src + x, 3, 3, stride); src += 8 * stride; dst += 8 * stride; } return 0; }
true
FFmpeg
aed128f07d142a7afc51f1f0c572a31b3b9bc2a6
static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length) { int x, y; const int width = f->avctx->width; const int height = f->avctx->height; uint16_t *src = (uint16_t *)f->last_picture.data[0]; uint16_t *dst = (uint16_t *)f->current_picture.data[0]; const int stride = f->current_picture.linesize[0] >> 1; unsigned int bitstream_size, bytestream_size, wordstream_size, extra, bytestream_offset, wordstream_offset; if (f->version > 1) { extra = 20; if (length < extra) return -1; bitstream_size = AV_RL32(buf + 8); wordstream_size = AV_RL32(buf + 12); bytestream_size = AV_RL32(buf + 16); } else { extra = 0; bitstream_size = AV_RL16(buf - 4); wordstream_size = AV_RL16(buf - 2); bytestream_size = FFMAX(length - bitstream_size - wordstream_size, 0); } if (bitstream_size > length || bytestream_size > length - bitstream_size || wordstream_size > length - bytestream_size - bitstream_size || extra > length - bytestream_size - bitstream_size - wordstream_size) { av_log(f->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size, bitstream_size+ bytestream_size+ wordstream_size - length); return -1; } av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!f->bitstream_buffer) return AVERROR(ENOMEM); f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra), bitstream_size / 4); memset((uint8_t*)f->bitstream_buffer + bitstream_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); init_get_bits(&f->gb, f->bitstream_buffer, 8 * bitstream_size); wordstream_offset = extra + bitstream_size; bytestream_offset = extra + bitstream_size + wordstream_size; bytestream2_init(&f->g2, buf + wordstream_offset, length - wordstream_offset); bytestream2_init(&f->g, buf + bytestream_offset, length - bytestream_offset); init_mv(f); for (y = 0; y < height; y += 8) { for (x = 0; x < width; x += 8) decode_p_block(f, dst + x, src + x, 3, 3, stride); src += 8 * stride; dst += 8 * stride; } return 0; }
{ "code": [ " if (bitstream_size > length ||" ], "line_no": [ 51 ] }
static int FUNC_0(FourXContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { int VAR_3, VAR_4; const int VAR_5 = VAR_0->avctx->VAR_5; const int VAR_6 = VAR_0->avctx->VAR_6; uint16_t *src = (uint16_t *)VAR_0->last_picture.data[0]; uint16_t *dst = (uint16_t *)VAR_0->current_picture.data[0]; const int VAR_7 = VAR_0->current_picture.linesize[0] >> 1; unsigned int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13; if (VAR_0->version > 1) { VAR_11 = 20; if (VAR_2 < VAR_11) return -1; VAR_8 = AV_RL32(VAR_1 + 8); VAR_10 = AV_RL32(VAR_1 + 12); VAR_9 = AV_RL32(VAR_1 + 16); } else { VAR_11 = 0; VAR_8 = AV_RL16(VAR_1 - 4); VAR_10 = AV_RL16(VAR_1 - 2); VAR_9 = FFMAX(VAR_2 - VAR_8 - VAR_10, 0); } if (VAR_8 > VAR_2 || VAR_9 > VAR_2 - VAR_8 || VAR_10 > VAR_2 - VAR_9 - VAR_8 || VAR_11 > VAR_2 - VAR_9 - VAR_8 - VAR_10) { av_log(VAR_0->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", VAR_8, VAR_9, VAR_10, VAR_8+ VAR_9+ VAR_10 - VAR_2); return -1; } av_fast_malloc(&VAR_0->bitstream_buffer, &VAR_0->bitstream_buffer_size, VAR_8 + FF_INPUT_BUFFER_PADDING_SIZE); if (!VAR_0->bitstream_buffer) return AVERROR(ENOMEM); VAR_0->dsp.bswap_buf(VAR_0->bitstream_buffer, (const uint32_t*)(VAR_1 + VAR_11), VAR_8 / 4); memset((uint8_t*)VAR_0->bitstream_buffer + VAR_8, 0, FF_INPUT_BUFFER_PADDING_SIZE); init_get_bits(&VAR_0->gb, VAR_0->bitstream_buffer, 8 * VAR_8); VAR_13 = VAR_11 + VAR_8; VAR_12 = VAR_11 + VAR_8 + VAR_10; bytestream2_init(&VAR_0->g2, VAR_1 + VAR_13, VAR_2 - VAR_13); bytestream2_init(&VAR_0->g, VAR_1 + VAR_12, VAR_2 - VAR_12); init_mv(VAR_0); for (VAR_4 = 0; VAR_4 < VAR_6; VAR_4 += 8) { for (VAR_3 = 0; VAR_3 < VAR_5; VAR_3 += 8) decode_p_block(VAR_0, dst + VAR_3, src + VAR_3, 3, 3, VAR_7); src += 8 * VAR_7; dst += 8 * VAR_7; } return 0; }
[ "static int FUNC_0(FourXContext *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "int VAR_3, VAR_4;", "const int VAR_5 = VAR_0->avctx->VAR_5;", "const int VAR_6 = VAR_0->avctx->VAR_6;", "uint16_t *src = (uint16_t *)VAR_0->last_picture.data[0];", "uint16_t *dst = (uint16_t *)VAR_0->current_picture.data[0];", "const int VAR_7 = VAR_0->current_picture.linesize[0] >> 1;", "unsigned int VAR_8, VAR_9, VAR_10, VAR_11,\nVAR_12, VAR_13;", "if (VAR_0->version > 1) {", "VAR_11 = 20;", "if (VAR_2 < VAR_11)\nreturn -1;", "VAR_8 = AV_RL32(VAR_1 + 8);", "VAR_10 = AV_RL32(VAR_1 + 12);", "VAR_9 = AV_RL32(VAR_1 + 16);", "} else {", "VAR_11 = 0;", "VAR_8 = AV_RL16(VAR_1 - 4);", "VAR_10 = AV_RL16(VAR_1 - 2);", "VAR_9 = FFMAX(VAR_2 - VAR_8 - VAR_10, 0);", "}", "if (VAR_8 > VAR_2 ||\nVAR_9 > VAR_2 - VAR_8 ||\nVAR_10 > VAR_2 - VAR_9 - VAR_8 ||\nVAR_11 > VAR_2 - VAR_9 - VAR_8 - VAR_10) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"lengths %d %d %d %d\\n\", VAR_8, VAR_9, VAR_10,\nVAR_8+ VAR_9+ VAR_10 - VAR_2);", "return -1;", "}", "av_fast_malloc(&VAR_0->bitstream_buffer, &VAR_0->bitstream_buffer_size,\nVAR_8 + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!VAR_0->bitstream_buffer)\nreturn AVERROR(ENOMEM);", "VAR_0->dsp.bswap_buf(VAR_0->bitstream_buffer, (const uint32_t*)(VAR_1 + VAR_11),\nVAR_8 / 4);", "memset((uint8_t*)VAR_0->bitstream_buffer + VAR_8,\n0, FF_INPUT_BUFFER_PADDING_SIZE);", "init_get_bits(&VAR_0->gb, VAR_0->bitstream_buffer, 8 * VAR_8);", "VAR_13 = VAR_11 + VAR_8;", "VAR_12 = VAR_11 + VAR_8 + VAR_10;", "bytestream2_init(&VAR_0->g2, VAR_1 + VAR_13,\nVAR_2 - VAR_13);", "bytestream2_init(&VAR_0->g, VAR_1 + VAR_12,\nVAR_2 - VAR_12);", "init_mv(VAR_0);", "for (VAR_4 = 0; VAR_4 < VAR_6; VAR_4 += 8) {", "for (VAR_3 = 0; VAR_3 < VAR_5; VAR_3 += 8)", "decode_p_block(VAR_0, dst + VAR_3, src + VAR_3, 3, 3, VAR_7);", "src += 8 * VAR_7;", "dst += 8 * VAR_7;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53, 55, 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 73, 75 ], [ 77, 79 ], [ 81, 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97, 99 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ] ]
21,646
void *kqemu_vmalloc(size_t size) { static int phys_ram_fd = -1; static int phys_ram_size = 0; const char *tmpdir; char phys_ram_file[1024]; void *ptr; struct statfs stfs; if (phys_ram_fd < 0) { tmpdir = getenv("QEMU_TMPDIR"); if (!tmpdir) tmpdir = "/dev/shm"; if (statfs(tmpdir, &stfs) == 0) { int64_t free_space; int ram_mb; extern int ram_size; free_space = (int64_t)stfs.f_bavail * stfs.f_bsize; if ((ram_size + 8192 * 1024) >= free_space) { ram_mb = (ram_size / (1024 * 1024)); fprintf(stderr, "You do not have enough space in '%s' for the %d MB of QEMU virtual RAM.\n", tmpdir, ram_mb); if (strcmp(tmpdir, "/dev/shm") == 0) { fprintf(stderr, "To have more space available provided you have enough RAM and swap, do as root:\n" "umount /dev/shm\n" "mount -t tmpfs -o size=%dm none /dev/shm\n", ram_mb + 16); } else { fprintf(stderr, "Use the '-m' option of QEMU to diminish the amount of virtual RAM or use the\n" "QEMU_TMPDIR environment variable to set another directory where the QEMU\n" "temporary RAM file will be opened.\n"); } fprintf(stderr, "Or disable the accelerator module with -no-kqemu\n"); exit(1); } } snprintf(phys_ram_file, sizeof(phys_ram_file), "%s/qemuXXXXXX", tmpdir); if (mkstemp(phys_ram_file) < 0) { fprintf(stderr, "warning: could not create temporary file in '%s'.\n" "Use QEMU_TMPDIR to select a directory in a tmpfs filesystem.\n" "Using '/tmp' as fallback.\n", tmpdir); snprintf(phys_ram_file, sizeof(phys_ram_file), "%s/qemuXXXXXX", "/tmp"); if (mkstemp(phys_ram_file) < 0) { fprintf(stderr, "Could not create temporary memory file '%s'\n", phys_ram_file); exit(1); } } phys_ram_fd = open(phys_ram_file, O_CREAT | O_TRUNC | O_RDWR, 0600); if (phys_ram_fd < 0) { fprintf(stderr, "Could not open temporary memory file '%s'\n", phys_ram_file); exit(1); } unlink(phys_ram_file); } size = (size + 4095) & ~4095; ftruncate(phys_ram_fd, phys_ram_size + size); ptr = mmap(NULL, size, PROT_WRITE | PROT_READ, MAP_SHARED, phys_ram_fd, phys_ram_size); if (ptr == MAP_FAILED) { fprintf(stderr, "Could not map physical memory\n"); exit(1); } phys_ram_size += size; return ptr; }
true
qemu
243a273ee0168fc373f342479ae92fe3028b45c1
void *kqemu_vmalloc(size_t size) { static int phys_ram_fd = -1; static int phys_ram_size = 0; const char *tmpdir; char phys_ram_file[1024]; void *ptr; struct statfs stfs; if (phys_ram_fd < 0) { tmpdir = getenv("QEMU_TMPDIR"); if (!tmpdir) tmpdir = "/dev/shm"; if (statfs(tmpdir, &stfs) == 0) { int64_t free_space; int ram_mb; extern int ram_size; free_space = (int64_t)stfs.f_bavail * stfs.f_bsize; if ((ram_size + 8192 * 1024) >= free_space) { ram_mb = (ram_size / (1024 * 1024)); fprintf(stderr, "You do not have enough space in '%s' for the %d MB of QEMU virtual RAM.\n", tmpdir, ram_mb); if (strcmp(tmpdir, "/dev/shm") == 0) { fprintf(stderr, "To have more space available provided you have enough RAM and swap, do as root:\n" "umount /dev/shm\n" "mount -t tmpfs -o size=%dm none /dev/shm\n", ram_mb + 16); } else { fprintf(stderr, "Use the '-m' option of QEMU to diminish the amount of virtual RAM or use the\n" "QEMU_TMPDIR environment variable to set another directory where the QEMU\n" "temporary RAM file will be opened.\n"); } fprintf(stderr, "Or disable the accelerator module with -no-kqemu\n"); exit(1); } } snprintf(phys_ram_file, sizeof(phys_ram_file), "%s/qemuXXXXXX", tmpdir); if (mkstemp(phys_ram_file) < 0) { fprintf(stderr, "warning: could not create temporary file in '%s'.\n" "Use QEMU_TMPDIR to select a directory in a tmpfs filesystem.\n" "Using '/tmp' as fallback.\n", tmpdir); snprintf(phys_ram_file, sizeof(phys_ram_file), "%s/qemuXXXXXX", "/tmp"); if (mkstemp(phys_ram_file) < 0) { fprintf(stderr, "Could not create temporary memory file '%s'\n", phys_ram_file); exit(1); } } phys_ram_fd = open(phys_ram_file, O_CREAT | O_TRUNC | O_RDWR, 0600); if (phys_ram_fd < 0) { fprintf(stderr, "Could not open temporary memory file '%s'\n", phys_ram_file); exit(1); } unlink(phys_ram_file); } size = (size + 4095) & ~4095; ftruncate(phys_ram_fd, phys_ram_size + size); ptr = mmap(NULL, size, PROT_WRITE | PROT_READ, MAP_SHARED, phys_ram_fd, phys_ram_size); if (ptr == MAP_FAILED) { fprintf(stderr, "Could not map physical memory\n"); exit(1); } phys_ram_size += size; return ptr; }
{ "code": [ " if (mkstemp(phys_ram_file) < 0) {", " if (mkstemp(phys_ram_file) < 0) {", " phys_ram_fd = open(phys_ram_file, O_CREAT | O_TRUNC | O_RDWR, 0600);", " if (phys_ram_fd < 0) {", " fprintf(stderr, \"Could not open temporary memory file '%s'\\n\", ", " phys_ram_file);", " exit(1);" ], "line_no": [ 83, 99, 111, 113, 115, 117, 119 ] }
void *FUNC_0(size_t VAR_0) { static int VAR_1 = -1; static int VAR_2 = 0; const char *VAR_3; char VAR_4[1024]; void *VAR_5; struct statfs VAR_6; if (VAR_1 < 0) { VAR_3 = getenv("QEMU_TMPDIR"); if (!VAR_3) VAR_3 = "/dev/shm"; if (statfs(VAR_3, &VAR_6) == 0) { int64_t free_space; int VAR_7; extern int VAR_8; free_space = (int64_t)VAR_6.f_bavail * VAR_6.f_bsize; if ((VAR_8 + 8192 * 1024) >= free_space) { VAR_7 = (VAR_8 / (1024 * 1024)); fprintf(stderr, "You do not have enough space in '%s' for the %d MB of QEMU virtual RAM.\n", VAR_3, VAR_7); if (strcmp(VAR_3, "/dev/shm") == 0) { fprintf(stderr, "To have more space available provided you have enough RAM and swap, do as root:\n" "umount /dev/shm\n" "mount -t tmpfs -o VAR_0=%dm none /dev/shm\n", VAR_7 + 16); } else { fprintf(stderr, "Use the '-m' option of QEMU to diminish the amount of virtual RAM or use the\n" "QEMU_TMPDIR environment variable to set another directory where the QEMU\n" "temporary RAM file will be opened.\n"); } fprintf(stderr, "Or disable the accelerator module with -no-kqemu\n"); exit(1); } } snprintf(VAR_4, sizeof(VAR_4), "%s/qemuXXXXXX", VAR_3); if (mkstemp(VAR_4) < 0) { fprintf(stderr, "warning: could not create temporary file in '%s'.\n" "Use QEMU_TMPDIR to select a directory in a tmpfs filesystem.\n" "Using '/tmp' as fallback.\n", VAR_3); snprintf(VAR_4, sizeof(VAR_4), "%s/qemuXXXXXX", "/tmp"); if (mkstemp(VAR_4) < 0) { fprintf(stderr, "Could not create temporary memory file '%s'\n", VAR_4); exit(1); } } VAR_1 = open(VAR_4, O_CREAT | O_TRUNC | O_RDWR, 0600); if (VAR_1 < 0) { fprintf(stderr, "Could not open temporary memory file '%s'\n", VAR_4); exit(1); } unlink(VAR_4); } VAR_0 = (VAR_0 + 4095) & ~4095; ftruncate(VAR_1, VAR_2 + VAR_0); VAR_5 = mmap(NULL, VAR_0, PROT_WRITE | PROT_READ, MAP_SHARED, VAR_1, VAR_2); if (VAR_5 == MAP_FAILED) { fprintf(stderr, "Could not map physical memory\n"); exit(1); } VAR_2 += VAR_0; return VAR_5; }
[ "void *FUNC_0(size_t VAR_0)\n{", "static int VAR_1 = -1;", "static int VAR_2 = 0;", "const char *VAR_3;", "char VAR_4[1024];", "void *VAR_5;", "struct statfs VAR_6;", "if (VAR_1 < 0) {", "VAR_3 = getenv(\"QEMU_TMPDIR\");", "if (!VAR_3)\nVAR_3 = \"/dev/shm\";", "if (statfs(VAR_3, &VAR_6) == 0) {", "int64_t free_space;", "int VAR_7;", "extern int VAR_8;", "free_space = (int64_t)VAR_6.f_bavail * VAR_6.f_bsize;", "if ((VAR_8 + 8192 * 1024) >= free_space) {", "VAR_7 = (VAR_8 / (1024 * 1024));", "fprintf(stderr,\n\"You do not have enough space in '%s' for the %d MB of QEMU virtual RAM.\\n\",\nVAR_3, VAR_7);", "if (strcmp(VAR_3, \"/dev/shm\") == 0) {", "fprintf(stderr, \"To have more space available provided you have enough RAM and swap, do as root:\\n\"\n\"umount /dev/shm\\n\"\n\"mount -t tmpfs -o VAR_0=%dm none /dev/shm\\n\",\nVAR_7 + 16);", "} else {", "fprintf(stderr,\n\"Use the '-m' option of QEMU to diminish the amount of virtual RAM or use the\\n\"\n\"QEMU_TMPDIR environment variable to set another directory where the QEMU\\n\"\n\"temporary RAM file will be opened.\\n\");", "}", "fprintf(stderr, \"Or disable the accelerator module with -no-kqemu\\n\");", "exit(1);", "}", "}", "snprintf(VAR_4, sizeof(VAR_4), \"%s/qemuXXXXXX\",\nVAR_3);", "if (mkstemp(VAR_4) < 0) {", "fprintf(stderr,\n\"warning: could not create temporary file in '%s'.\\n\"\n\"Use QEMU_TMPDIR to select a directory in a tmpfs filesystem.\\n\"\n\"Using '/tmp' as fallback.\\n\",\nVAR_3);", "snprintf(VAR_4, sizeof(VAR_4), \"%s/qemuXXXXXX\",\n\"/tmp\");", "if (mkstemp(VAR_4) < 0) {", "fprintf(stderr, \"Could not create temporary memory file '%s'\\n\",\nVAR_4);", "exit(1);", "}", "}", "VAR_1 = open(VAR_4, O_CREAT | O_TRUNC | O_RDWR, 0600);", "if (VAR_1 < 0) {", "fprintf(stderr, \"Could not open temporary memory file '%s'\\n\",\nVAR_4);", "exit(1);", "}", "unlink(VAR_4);", "}", "VAR_0 = (VAR_0 + 4095) & ~4095;", "ftruncate(VAR_1, VAR_2 + VAR_0);", "VAR_5 = mmap(NULL,\nVAR_0,\nPROT_WRITE | PROT_READ, MAP_SHARED,\nVAR_1, VAR_2);", "if (VAR_5 == MAP_FAILED) {", "fprintf(stderr, \"Could not map physical memory\\n\");", "exit(1);", "}", "VAR_2 += VAR_0;", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45, 47 ], [ 49 ], [ 51, 53, 55, 57 ], [ 59 ], [ 61, 63, 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85, 87, 89, 91, 93 ], [ 95, 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133, 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ] ]
21,647
static uint64_t qvirtio_pci_config_readq(QVirtioDevice *d, uint64_t off) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; uint64_t val; val = qpci_io_readq(dev->pdev, CONFIG_BASE(dev) + off); if (qvirtio_is_big_endian(d)) { val = bswap64(val); } return val; }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
static uint64_t qvirtio_pci_config_readq(QVirtioDevice *d, uint64_t off) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; uint64_t val; val = qpci_io_readq(dev->pdev, CONFIG_BASE(dev) + off); if (qvirtio_is_big_endian(d)) { val = bswap64(val); } return val; }
{ "code": [ " val = qpci_io_readq(dev->pdev, CONFIG_BASE(dev) + off);" ], "line_no": [ 11 ] }
static uint64_t FUNC_0(QVirtioDevice *d, uint64_t off) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; uint64_t val; val = qpci_io_readq(dev->pdev, CONFIG_BASE(dev) + off); if (qvirtio_is_big_endian(d)) { val = bswap64(val); } return val; }
[ "static uint64_t FUNC_0(QVirtioDevice *d, uint64_t off)\n{", "QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;", "uint64_t val;", "val = qpci_io_readq(dev->pdev, CONFIG_BASE(dev) + off);", "if (qvirtio_is_big_endian(d)) {", "val = bswap64(val);", "}", "return val;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
21,648
void video_decode_example(const char *outfilename, const char *filename) { AVCodec *codec; AVCodecContext *c= NULL; int frame, size, got_picture, len; FILE *f; AVFrame *picture; uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE], *inbuf_ptr; char buf[1024]; /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */ memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); printf("Video decoding\n"); /* find the mpeg1 video decoder */ codec = avcodec_find_decoder(CODEC_ID_MPEG1VIDEO); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); } c= avcodec_alloc_context(); picture= avcodec_alloc_frame(); if(codec->capabilities&CODEC_CAP_TRUNCATED) c->flags|= CODEC_FLAG_TRUNCATED; /* we dont send complete frames */ /* for some codecs, such as msmpeg4 and mpeg4, width and height MUST be initialized there because these info are not available in the bitstream */ /* open it */ if (avcodec_open(c, codec) < 0) { fprintf(stderr, "could not open codec\n"); exit(1); } /* the codec gives us the frame size, in samples */ f = fopen(filename, "r"); if (!f) { fprintf(stderr, "could not open %s\n", filename); exit(1); } frame = 0; for(;;) { size = fread(inbuf, 1, INBUF_SIZE, f); if (size == 0) break; /* NOTE1: some codecs are stream based (mpegvideo, mpegaudio) and this is the only method to use them because you cannot know the compressed data size before analysing it. BUT some other codecs (msmpeg4, mpeg4) are inherently frame based, so you must call them with all the data for one frame exactly. You must also initialize 'width' and 'height' before initializing them. */ /* NOTE2: some codecs allow the raw parameters (frame size, sample rate) to be changed at any frame. We handle this, so you should also take care of it */ /* here, we use a stream based decoder (mpeg1video), so we feed decoder and see if it could decode a frame */ inbuf_ptr = inbuf; while (size > 0) { len = avcodec_decode_video(c, picture, &got_picture, inbuf_ptr, size); if (len < 0) { fprintf(stderr, "Error while decoding frame %d\n", frame); exit(1); } if (got_picture) { printf("saving frame %3d\n", frame); fflush(stdout); /* the picture is allocated by the decoder. no need to free it */ snprintf(buf, sizeof(buf), outfilename, frame); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, buf); frame++; } size -= len; inbuf_ptr += len; } } /* some codecs, such as MPEG, transmit the I and P frame with a latency of one frame. You must do the following to have a chance to get the last frame of the video */ len = avcodec_decode_video(c, picture, &got_picture, NULL, 0); if (got_picture) { printf("saving last frame %3d\n", frame); fflush(stdout); /* the picture is allocated by the decoder. no need to free it */ snprintf(buf, sizeof(buf), outfilename, frame); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, buf); frame++; } fclose(f); avcodec_close(c); free(c); free(picture); printf("\n"); }
true
FFmpeg
1c0e205fab4bd5bbfa0399af2cd5e281b414b3d5
void video_decode_example(const char *outfilename, const char *filename) { AVCodec *codec; AVCodecContext *c= NULL; int frame, size, got_picture, len; FILE *f; AVFrame *picture; uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE], *inbuf_ptr; char buf[1024]; memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); printf("Video decoding\n"); codec = avcodec_find_decoder(CODEC_ID_MPEG1VIDEO); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); } c= avcodec_alloc_context(); picture= avcodec_alloc_frame(); if(codec->capabilities&CODEC_CAP_TRUNCATED) c->flags|= CODEC_FLAG_TRUNCATED; if (avcodec_open(c, codec) < 0) { fprintf(stderr, "could not open codec\n"); exit(1); } f = fopen(filename, "r"); if (!f) { fprintf(stderr, "could not open %s\n", filename); exit(1); } frame = 0; for(;;) { size = fread(inbuf, 1, INBUF_SIZE, f); if (size == 0) break; inbuf_ptr = inbuf; while (size > 0) { len = avcodec_decode_video(c, picture, &got_picture, inbuf_ptr, size); if (len < 0) { fprintf(stderr, "Error while decoding frame %d\n", frame); exit(1); } if (got_picture) { printf("saving frame %3d\n", frame); fflush(stdout); snprintf(buf, sizeof(buf), outfilename, frame); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, buf); frame++; } size -= len; inbuf_ptr += len; } } len = avcodec_decode_video(c, picture, &got_picture, NULL, 0); if (got_picture) { printf("saving last frame %3d\n", frame); fflush(stdout); snprintf(buf, sizeof(buf), outfilename, frame); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, buf); frame++; } fclose(f); avcodec_close(c); free(c); free(picture); printf("\n"); }
{ "code": [ " f = fopen(filename, \"r\");", " f = fopen(filename, \"r\");" ], "line_no": [ 81, 81 ] }
void FUNC_0(const char *VAR_0, const char *VAR_1) { AVCodec *codec; AVCodecContext *c= NULL; int VAR_2, VAR_3, VAR_4, VAR_5; FILE *f; AVFrame *picture; uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE], *inbuf_ptr; char VAR_6[1024]; memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); printf("Video decoding\n"); codec = avcodec_find_decoder(CODEC_ID_MPEG1VIDEO); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); } c= avcodec_alloc_context(); picture= avcodec_alloc_frame(); if(codec->capabilities&CODEC_CAP_TRUNCATED) c->flags|= CODEC_FLAG_TRUNCATED; if (avcodec_open(c, codec) < 0) { fprintf(stderr, "could not open codec\n"); exit(1); } f = fopen(VAR_1, "r"); if (!f) { fprintf(stderr, "could not open %s\n", VAR_1); exit(1); } VAR_2 = 0; for(;;) { VAR_3 = fread(inbuf, 1, INBUF_SIZE, f); if (VAR_3 == 0) break; inbuf_ptr = inbuf; while (VAR_3 > 0) { VAR_5 = avcodec_decode_video(c, picture, &VAR_4, inbuf_ptr, VAR_3); if (VAR_5 < 0) { fprintf(stderr, "Error while decoding VAR_2 %d\n", VAR_2); exit(1); } if (VAR_4) { printf("saving VAR_2 %3d\n", VAR_2); fflush(stdout); snprintf(VAR_6, sizeof(VAR_6), VAR_0, VAR_2); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, VAR_6); VAR_2++; } VAR_3 -= VAR_5; inbuf_ptr += VAR_5; } } VAR_5 = avcodec_decode_video(c, picture, &VAR_4, NULL, 0); if (VAR_4) { printf("saving last VAR_2 %3d\n", VAR_2); fflush(stdout); snprintf(VAR_6, sizeof(VAR_6), VAR_0, VAR_2); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, VAR_6); VAR_2++; } fclose(f); avcodec_close(c); free(c); free(picture); printf("\n"); }
[ "void FUNC_0(const char *VAR_0, const char *VAR_1)\n{", "AVCodec *codec;", "AVCodecContext *c= NULL;", "int VAR_2, VAR_3, VAR_4, VAR_5;", "FILE *f;", "AVFrame *picture;", "uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE], *inbuf_ptr;", "char VAR_6[1024];", "memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE);", "printf(\"Video decoding\\n\");", "codec = avcodec_find_decoder(CODEC_ID_MPEG1VIDEO);", "if (!codec) {", "fprintf(stderr, \"codec not found\\n\");", "exit(1);", "}", "c= avcodec_alloc_context();", "picture= avcodec_alloc_frame();", "if(codec->capabilities&CODEC_CAP_TRUNCATED)\nc->flags|= CODEC_FLAG_TRUNCATED;", "if (avcodec_open(c, codec) < 0) {", "fprintf(stderr, \"could not open codec\\n\");", "exit(1);", "}", "f = fopen(VAR_1, \"r\");", "if (!f) {", "fprintf(stderr, \"could not open %s\\n\", VAR_1);", "exit(1);", "}", "VAR_2 = 0;", "for(;;) {", "VAR_3 = fread(inbuf, 1, INBUF_SIZE, f);", "if (VAR_3 == 0)\nbreak;", "inbuf_ptr = inbuf;", "while (VAR_3 > 0) {", "VAR_5 = avcodec_decode_video(c, picture, &VAR_4,\ninbuf_ptr, VAR_3);", "if (VAR_5 < 0) {", "fprintf(stderr, \"Error while decoding VAR_2 %d\\n\", VAR_2);", "exit(1);", "}", "if (VAR_4) {", "printf(\"saving VAR_2 %3d\\n\", VAR_2);", "fflush(stdout);", "snprintf(VAR_6, sizeof(VAR_6), VAR_0, VAR_2);", "pgm_save(picture->data[0], picture->linesize[0],\nc->width, c->height, VAR_6);", "VAR_2++;", "}", "VAR_3 -= VAR_5;", "inbuf_ptr += VAR_5;", "}", "}", "VAR_5 = avcodec_decode_video(c, picture, &VAR_4,\nNULL, 0);", "if (VAR_4) {", "printf(\"saving last VAR_2 %3d\\n\", VAR_2);", "fflush(stdout);", "snprintf(VAR_6, sizeof(VAR_6), VAR_0, VAR_2);", "pgm_save(picture->data[0], picture->linesize[0],\nc->width, c->height, VAR_6);", "VAR_2++;", "}", "fclose(f);", "avcodec_close(c);", "free(c);", "free(picture);", "printf(\"\\n\");", "}" ]
[ 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, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 217 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ] ]
21,649
static int rebuild_refcount_structure(BlockDriverState *bs, BdrvCheckResult *res, uint16_t **refcount_table, int64_t *nb_clusters) { BDRVQcowState *s = bs->opaque; int64_t first_free_cluster = 0, reftable_offset = -1, cluster = 0; int64_t refblock_offset, refblock_start, refblock_index; uint32_t reftable_size = 0; uint64_t *on_disk_reftable = NULL; uint16_t *on_disk_refblock; int i, ret = 0; struct { uint64_t reftable_offset; uint32_t reftable_clusters; } QEMU_PACKED reftable_offset_and_clusters; qcow2_cache_empty(bs, s->refcount_block_cache); write_refblocks: for (; cluster < *nb_clusters; cluster++) { if (!(*refcount_table)[cluster]) { continue; } refblock_index = cluster >> s->refcount_block_bits; refblock_start = refblock_index << s->refcount_block_bits; /* Don't allocate a cluster in a refblock already written to disk */ if (first_free_cluster < refblock_start) { first_free_cluster = refblock_start; } refblock_offset = alloc_clusters_imrt(bs, 1, refcount_table, nb_clusters, &first_free_cluster); if (refblock_offset < 0) { fprintf(stderr, "ERROR allocating refblock: %s\n", strerror(-refblock_offset)); res->check_errors++; ret = refblock_offset; goto fail; } if (reftable_size <= refblock_index) { uint32_t old_reftable_size = reftable_size; uint64_t *new_on_disk_reftable; reftable_size = ROUND_UP((refblock_index + 1) * sizeof(uint64_t), s->cluster_size) / sizeof(uint64_t); new_on_disk_reftable = g_try_realloc(on_disk_reftable, reftable_size * sizeof(uint64_t)); if (!new_on_disk_reftable) { res->check_errors++; ret = -ENOMEM; goto fail; } on_disk_reftable = new_on_disk_reftable; memset(on_disk_reftable + old_reftable_size, 0, (reftable_size - old_reftable_size) * sizeof(uint64_t)); /* The offset we have for the reftable is now no longer valid; * this will leak that range, but we can easily fix that by running * a leak-fixing check after this rebuild operation */ reftable_offset = -1; } on_disk_reftable[refblock_index] = refblock_offset; /* If this is apparently the last refblock (for now), try to squeeze the * reftable in */ if (refblock_index == (*nb_clusters - 1) >> s->refcount_block_bits && reftable_offset < 0) { uint64_t reftable_clusters = size_to_clusters(s, reftable_size * sizeof(uint64_t)); reftable_offset = alloc_clusters_imrt(bs, reftable_clusters, refcount_table, nb_clusters, &first_free_cluster); if (reftable_offset < 0) { fprintf(stderr, "ERROR allocating reftable: %s\n", strerror(-reftable_offset)); res->check_errors++; ret = reftable_offset; goto fail; } } ret = qcow2_pre_write_overlap_check(bs, 0, refblock_offset, s->cluster_size); if (ret < 0) { fprintf(stderr, "ERROR writing refblock: %s\n", strerror(-ret)); goto fail; } on_disk_refblock = qemu_blockalign0(bs->file, s->cluster_size); for (i = 0; i < s->refcount_block_size && refblock_start + i < *nb_clusters; i++) { on_disk_refblock[i] = cpu_to_be16((*refcount_table)[refblock_start + i]); } ret = bdrv_write(bs->file, refblock_offset / BDRV_SECTOR_SIZE, (void *)on_disk_refblock, s->cluster_sectors); qemu_vfree(on_disk_refblock); if (ret < 0) { fprintf(stderr, "ERROR writing refblock: %s\n", strerror(-ret)); goto fail; } /* Go to the end of this refblock */ cluster = refblock_start + s->refcount_block_size - 1; } if (reftable_offset < 0) { uint64_t post_refblock_start, reftable_clusters; post_refblock_start = ROUND_UP(*nb_clusters, s->refcount_block_size); reftable_clusters = size_to_clusters(s, reftable_size * sizeof(uint64_t)); /* Not pretty but simple */ if (first_free_cluster < post_refblock_start) { first_free_cluster = post_refblock_start; } reftable_offset = alloc_clusters_imrt(bs, reftable_clusters, refcount_table, nb_clusters, &first_free_cluster); if (reftable_offset < 0) { fprintf(stderr, "ERROR allocating reftable: %s\n", strerror(-reftable_offset)); res->check_errors++; ret = reftable_offset; goto fail; } goto write_refblocks; } assert(on_disk_reftable); for (refblock_index = 0; refblock_index < reftable_size; refblock_index++) { cpu_to_be64s(&on_disk_reftable[refblock_index]); } ret = qcow2_pre_write_overlap_check(bs, 0, reftable_offset, reftable_size * sizeof(uint64_t)); if (ret < 0) { fprintf(stderr, "ERROR writing reftable: %s\n", strerror(-ret)); goto fail; } assert(reftable_size < INT_MAX / sizeof(uint64_t)); ret = bdrv_pwrite(bs->file, reftable_offset, on_disk_reftable, reftable_size * sizeof(uint64_t)); if (ret < 0) { fprintf(stderr, "ERROR writing reftable: %s\n", strerror(-ret)); goto fail; } /* Enter new reftable into the image header */ cpu_to_be64w(&reftable_offset_and_clusters.reftable_offset, reftable_offset); cpu_to_be32w(&reftable_offset_and_clusters.reftable_clusters, size_to_clusters(s, reftable_size * sizeof(uint64_t))); ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, refcount_table_offset), &reftable_offset_and_clusters, sizeof(reftable_offset_and_clusters)); if (ret < 0) { fprintf(stderr, "ERROR setting reftable: %s\n", strerror(-ret)); goto fail; } for (refblock_index = 0; refblock_index < reftable_size; refblock_index++) { be64_to_cpus(&on_disk_reftable[refblock_index]); } s->refcount_table = on_disk_reftable; s->refcount_table_offset = reftable_offset; s->refcount_table_size = reftable_size; return 0; fail: g_free(on_disk_reftable); return ret; }
true
qemu
7453c96b78c2b09aa72924f933bb9616e5474194
static int rebuild_refcount_structure(BlockDriverState *bs, BdrvCheckResult *res, uint16_t **refcount_table, int64_t *nb_clusters) { BDRVQcowState *s = bs->opaque; int64_t first_free_cluster = 0, reftable_offset = -1, cluster = 0; int64_t refblock_offset, refblock_start, refblock_index; uint32_t reftable_size = 0; uint64_t *on_disk_reftable = NULL; uint16_t *on_disk_refblock; int i, ret = 0; struct { uint64_t reftable_offset; uint32_t reftable_clusters; } QEMU_PACKED reftable_offset_and_clusters; qcow2_cache_empty(bs, s->refcount_block_cache); write_refblocks: for (; cluster < *nb_clusters; cluster++) { if (!(*refcount_table)[cluster]) { continue; } refblock_index = cluster >> s->refcount_block_bits; refblock_start = refblock_index << s->refcount_block_bits; if (first_free_cluster < refblock_start) { first_free_cluster = refblock_start; } refblock_offset = alloc_clusters_imrt(bs, 1, refcount_table, nb_clusters, &first_free_cluster); if (refblock_offset < 0) { fprintf(stderr, "ERROR allocating refblock: %s\n", strerror(-refblock_offset)); res->check_errors++; ret = refblock_offset; goto fail; } if (reftable_size <= refblock_index) { uint32_t old_reftable_size = reftable_size; uint64_t *new_on_disk_reftable; reftable_size = ROUND_UP((refblock_index + 1) * sizeof(uint64_t), s->cluster_size) / sizeof(uint64_t); new_on_disk_reftable = g_try_realloc(on_disk_reftable, reftable_size * sizeof(uint64_t)); if (!new_on_disk_reftable) { res->check_errors++; ret = -ENOMEM; goto fail; } on_disk_reftable = new_on_disk_reftable; memset(on_disk_reftable + old_reftable_size, 0, (reftable_size - old_reftable_size) * sizeof(uint64_t)); reftable_offset = -1; } on_disk_reftable[refblock_index] = refblock_offset; if (refblock_index == (*nb_clusters - 1) >> s->refcount_block_bits && reftable_offset < 0) { uint64_t reftable_clusters = size_to_clusters(s, reftable_size * sizeof(uint64_t)); reftable_offset = alloc_clusters_imrt(bs, reftable_clusters, refcount_table, nb_clusters, &first_free_cluster); if (reftable_offset < 0) { fprintf(stderr, "ERROR allocating reftable: %s\n", strerror(-reftable_offset)); res->check_errors++; ret = reftable_offset; goto fail; } } ret = qcow2_pre_write_overlap_check(bs, 0, refblock_offset, s->cluster_size); if (ret < 0) { fprintf(stderr, "ERROR writing refblock: %s\n", strerror(-ret)); goto fail; } on_disk_refblock = qemu_blockalign0(bs->file, s->cluster_size); for (i = 0; i < s->refcount_block_size && refblock_start + i < *nb_clusters; i++) { on_disk_refblock[i] = cpu_to_be16((*refcount_table)[refblock_start + i]); } ret = bdrv_write(bs->file, refblock_offset / BDRV_SECTOR_SIZE, (void *)on_disk_refblock, s->cluster_sectors); qemu_vfree(on_disk_refblock); if (ret < 0) { fprintf(stderr, "ERROR writing refblock: %s\n", strerror(-ret)); goto fail; } cluster = refblock_start + s->refcount_block_size - 1; } if (reftable_offset < 0) { uint64_t post_refblock_start, reftable_clusters; post_refblock_start = ROUND_UP(*nb_clusters, s->refcount_block_size); reftable_clusters = size_to_clusters(s, reftable_size * sizeof(uint64_t)); if (first_free_cluster < post_refblock_start) { first_free_cluster = post_refblock_start; } reftable_offset = alloc_clusters_imrt(bs, reftable_clusters, refcount_table, nb_clusters, &first_free_cluster); if (reftable_offset < 0) { fprintf(stderr, "ERROR allocating reftable: %s\n", strerror(-reftable_offset)); res->check_errors++; ret = reftable_offset; goto fail; } goto write_refblocks; } assert(on_disk_reftable); for (refblock_index = 0; refblock_index < reftable_size; refblock_index++) { cpu_to_be64s(&on_disk_reftable[refblock_index]); } ret = qcow2_pre_write_overlap_check(bs, 0, reftable_offset, reftable_size * sizeof(uint64_t)); if (ret < 0) { fprintf(stderr, "ERROR writing reftable: %s\n", strerror(-ret)); goto fail; } assert(reftable_size < INT_MAX / sizeof(uint64_t)); ret = bdrv_pwrite(bs->file, reftable_offset, on_disk_reftable, reftable_size * sizeof(uint64_t)); if (ret < 0) { fprintf(stderr, "ERROR writing reftable: %s\n", strerror(-ret)); goto fail; } cpu_to_be64w(&reftable_offset_and_clusters.reftable_offset, reftable_offset); cpu_to_be32w(&reftable_offset_and_clusters.reftable_clusters, size_to_clusters(s, reftable_size * sizeof(uint64_t))); ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, refcount_table_offset), &reftable_offset_and_clusters, sizeof(reftable_offset_and_clusters)); if (ret < 0) { fprintf(stderr, "ERROR setting reftable: %s\n", strerror(-ret)); goto fail; } for (refblock_index = 0; refblock_index < reftable_size; refblock_index++) { be64_to_cpus(&on_disk_reftable[refblock_index]); } s->refcount_table = on_disk_reftable; s->refcount_table_offset = reftable_offset; s->refcount_table_size = reftable_size; return 0; fail: g_free(on_disk_reftable); return ret; }
{ "code": [ " if (!(*refcount_table)[cluster]) {", " uint16_t **refcount_table,", " uint16_t *on_disk_refblock;", " int i, ret = 0;", " if (!(*refcount_table)[cluster]) {", " on_disk_refblock = qemu_blockalign0(bs->file, s->cluster_size);", " for (i = 0; i < s->refcount_block_size &&", " refblock_start + i < *nb_clusters; i++)", " on_disk_refblock[i] =", " cpu_to_be16((*refcount_table)[refblock_start + i]);", " (void *)on_disk_refblock, s->cluster_sectors);", " qemu_vfree(on_disk_refblock);" ], "line_no": [ 43, 5, 21, 23, 43, 189, 191, 193, 197, 199, 207, 209 ] }
static int FUNC_0(BlockDriverState *VAR_0, BdrvCheckResult *VAR_1, uint16_t **VAR_2, int64_t *VAR_3) { BDRVQcowState *s = VAR_0->opaque; int64_t first_free_cluster = 0, reftable_offset = -1, cluster = 0; int64_t refblock_offset, refblock_start, refblock_index; uint32_t reftable_size = 0; uint64_t *on_disk_reftable = NULL; uint16_t *on_disk_refblock; int VAR_4, VAR_5 = 0; struct { uint64_t reftable_offset; uint32_t reftable_clusters; } QEMU_PACKED VAR_6; qcow2_cache_empty(VAR_0, s->refcount_block_cache); write_refblocks: for (; cluster < *VAR_3; cluster++) { if (!(*VAR_2)[cluster]) { continue; } refblock_index = cluster >> s->refcount_block_bits; refblock_start = refblock_index << s->refcount_block_bits; if (first_free_cluster < refblock_start) { first_free_cluster = refblock_start; } refblock_offset = alloc_clusters_imrt(VAR_0, 1, VAR_2, VAR_3, &first_free_cluster); if (refblock_offset < 0) { fprintf(stderr, "ERROR allocating refblock: %s\n", strerror(-refblock_offset)); VAR_1->check_errors++; VAR_5 = refblock_offset; goto fail; } if (reftable_size <= refblock_index) { uint32_t old_reftable_size = reftable_size; uint64_t *new_on_disk_reftable; reftable_size = ROUND_UP((refblock_index + 1) * sizeof(uint64_t), s->cluster_size) / sizeof(uint64_t); new_on_disk_reftable = g_try_realloc(on_disk_reftable, reftable_size * sizeof(uint64_t)); if (!new_on_disk_reftable) { VAR_1->check_errors++; VAR_5 = -ENOMEM; goto fail; } on_disk_reftable = new_on_disk_reftable; memset(on_disk_reftable + old_reftable_size, 0, (reftable_size - old_reftable_size) * sizeof(uint64_t)); reftable_offset = -1; } on_disk_reftable[refblock_index] = refblock_offset; if (refblock_index == (*VAR_3 - 1) >> s->refcount_block_bits && reftable_offset < 0) { uint64_t reftable_clusters = size_to_clusters(s, reftable_size * sizeof(uint64_t)); reftable_offset = alloc_clusters_imrt(VAR_0, reftable_clusters, VAR_2, VAR_3, &first_free_cluster); if (reftable_offset < 0) { fprintf(stderr, "ERROR allocating reftable: %s\n", strerror(-reftable_offset)); VAR_1->check_errors++; VAR_5 = reftable_offset; goto fail; } } VAR_5 = qcow2_pre_write_overlap_check(VAR_0, 0, refblock_offset, s->cluster_size); if (VAR_5 < 0) { fprintf(stderr, "ERROR writing refblock: %s\n", strerror(-VAR_5)); goto fail; } on_disk_refblock = qemu_blockalign0(VAR_0->file, s->cluster_size); for (VAR_4 = 0; VAR_4 < s->refcount_block_size && refblock_start + VAR_4 < *VAR_3; VAR_4++) { on_disk_refblock[VAR_4] = cpu_to_be16((*VAR_2)[refblock_start + VAR_4]); } VAR_5 = bdrv_write(VAR_0->file, refblock_offset / BDRV_SECTOR_SIZE, (void *)on_disk_refblock, s->cluster_sectors); qemu_vfree(on_disk_refblock); if (VAR_5 < 0) { fprintf(stderr, "ERROR writing refblock: %s\n", strerror(-VAR_5)); goto fail; } cluster = refblock_start + s->refcount_block_size - 1; } if (reftable_offset < 0) { uint64_t post_refblock_start, reftable_clusters; post_refblock_start = ROUND_UP(*VAR_3, s->refcount_block_size); reftable_clusters = size_to_clusters(s, reftable_size * sizeof(uint64_t)); if (first_free_cluster < post_refblock_start) { first_free_cluster = post_refblock_start; } reftable_offset = alloc_clusters_imrt(VAR_0, reftable_clusters, VAR_2, VAR_3, &first_free_cluster); if (reftable_offset < 0) { fprintf(stderr, "ERROR allocating reftable: %s\n", strerror(-reftable_offset)); VAR_1->check_errors++; VAR_5 = reftable_offset; goto fail; } goto write_refblocks; } assert(on_disk_reftable); for (refblock_index = 0; refblock_index < reftable_size; refblock_index++) { cpu_to_be64s(&on_disk_reftable[refblock_index]); } VAR_5 = qcow2_pre_write_overlap_check(VAR_0, 0, reftable_offset, reftable_size * sizeof(uint64_t)); if (VAR_5 < 0) { fprintf(stderr, "ERROR writing reftable: %s\n", strerror(-VAR_5)); goto fail; } assert(reftable_size < INT_MAX / sizeof(uint64_t)); VAR_5 = bdrv_pwrite(VAR_0->file, reftable_offset, on_disk_reftable, reftable_size * sizeof(uint64_t)); if (VAR_5 < 0) { fprintf(stderr, "ERROR writing reftable: %s\n", strerror(-VAR_5)); goto fail; } cpu_to_be64w(&VAR_6.reftable_offset, reftable_offset); cpu_to_be32w(&VAR_6.reftable_clusters, size_to_clusters(s, reftable_size * sizeof(uint64_t))); VAR_5 = bdrv_pwrite_sync(VAR_0->file, offsetof(QCowHeader, refcount_table_offset), &VAR_6, sizeof(VAR_6)); if (VAR_5 < 0) { fprintf(stderr, "ERROR setting reftable: %s\n", strerror(-VAR_5)); goto fail; } for (refblock_index = 0; refblock_index < reftable_size; refblock_index++) { be64_to_cpus(&on_disk_reftable[refblock_index]); } s->VAR_2 = on_disk_reftable; s->refcount_table_offset = reftable_offset; s->refcount_table_size = reftable_size; return 0; fail: g_free(on_disk_reftable); return VAR_5; }
[ "static int FUNC_0(BlockDriverState *VAR_0,\nBdrvCheckResult *VAR_1,\nuint16_t **VAR_2,\nint64_t *VAR_3)\n{", "BDRVQcowState *s = VAR_0->opaque;", "int64_t first_free_cluster = 0, reftable_offset = -1, cluster = 0;", "int64_t refblock_offset, refblock_start, refblock_index;", "uint32_t reftable_size = 0;", "uint64_t *on_disk_reftable = NULL;", "uint16_t *on_disk_refblock;", "int VAR_4, VAR_5 = 0;", "struct {", "uint64_t reftable_offset;", "uint32_t reftable_clusters;", "} QEMU_PACKED VAR_6;", "qcow2_cache_empty(VAR_0, s->refcount_block_cache);", "write_refblocks:\nfor (; cluster < *VAR_3; cluster++) {", "if (!(*VAR_2)[cluster]) {", "continue;", "}", "refblock_index = cluster >> s->refcount_block_bits;", "refblock_start = refblock_index << s->refcount_block_bits;", "if (first_free_cluster < refblock_start) {", "first_free_cluster = refblock_start;", "}", "refblock_offset = alloc_clusters_imrt(VAR_0, 1, VAR_2,\nVAR_3, &first_free_cluster);", "if (refblock_offset < 0) {", "fprintf(stderr, \"ERROR allocating refblock: %s\\n\",\nstrerror(-refblock_offset));", "VAR_1->check_errors++;", "VAR_5 = refblock_offset;", "goto fail;", "}", "if (reftable_size <= refblock_index) {", "uint32_t old_reftable_size = reftable_size;", "uint64_t *new_on_disk_reftable;", "reftable_size = ROUND_UP((refblock_index + 1) * sizeof(uint64_t),\ns->cluster_size) / sizeof(uint64_t);", "new_on_disk_reftable = g_try_realloc(on_disk_reftable,\nreftable_size *\nsizeof(uint64_t));", "if (!new_on_disk_reftable) {", "VAR_1->check_errors++;", "VAR_5 = -ENOMEM;", "goto fail;", "}", "on_disk_reftable = new_on_disk_reftable;", "memset(on_disk_reftable + old_reftable_size, 0,\n(reftable_size - old_reftable_size) * sizeof(uint64_t));", "reftable_offset = -1;", "}", "on_disk_reftable[refblock_index] = refblock_offset;", "if (refblock_index == (*VAR_3 - 1) >> s->refcount_block_bits &&\nreftable_offset < 0)\n{", "uint64_t reftable_clusters = size_to_clusters(s, reftable_size *\nsizeof(uint64_t));", "reftable_offset = alloc_clusters_imrt(VAR_0, reftable_clusters,\nVAR_2, VAR_3,\n&first_free_cluster);", "if (reftable_offset < 0) {", "fprintf(stderr, \"ERROR allocating reftable: %s\\n\",\nstrerror(-reftable_offset));", "VAR_1->check_errors++;", "VAR_5 = reftable_offset;", "goto fail;", "}", "}", "VAR_5 = qcow2_pre_write_overlap_check(VAR_0, 0, refblock_offset,\ns->cluster_size);", "if (VAR_5 < 0) {", "fprintf(stderr, \"ERROR writing refblock: %s\\n\", strerror(-VAR_5));", "goto fail;", "}", "on_disk_refblock = qemu_blockalign0(VAR_0->file, s->cluster_size);", "for (VAR_4 = 0; VAR_4 < s->refcount_block_size &&", "refblock_start + VAR_4 < *VAR_3; VAR_4++)", "{", "on_disk_refblock[VAR_4] =\ncpu_to_be16((*VAR_2)[refblock_start + VAR_4]);", "}", "VAR_5 = bdrv_write(VAR_0->file, refblock_offset / BDRV_SECTOR_SIZE,\n(void *)on_disk_refblock, s->cluster_sectors);", "qemu_vfree(on_disk_refblock);", "if (VAR_5 < 0) {", "fprintf(stderr, \"ERROR writing refblock: %s\\n\", strerror(-VAR_5));", "goto fail;", "}", "cluster = refblock_start + s->refcount_block_size - 1;", "}", "if (reftable_offset < 0) {", "uint64_t post_refblock_start, reftable_clusters;", "post_refblock_start = ROUND_UP(*VAR_3, s->refcount_block_size);", "reftable_clusters = size_to_clusters(s,\nreftable_size * sizeof(uint64_t));", "if (first_free_cluster < post_refblock_start) {", "first_free_cluster = post_refblock_start;", "}", "reftable_offset = alloc_clusters_imrt(VAR_0, reftable_clusters,\nVAR_2, VAR_3,\n&first_free_cluster);", "if (reftable_offset < 0) {", "fprintf(stderr, \"ERROR allocating reftable: %s\\n\",\nstrerror(-reftable_offset));", "VAR_1->check_errors++;", "VAR_5 = reftable_offset;", "goto fail;", "}", "goto write_refblocks;", "}", "assert(on_disk_reftable);", "for (refblock_index = 0; refblock_index < reftable_size; refblock_index++) {", "cpu_to_be64s(&on_disk_reftable[refblock_index]);", "}", "VAR_5 = qcow2_pre_write_overlap_check(VAR_0, 0, reftable_offset,\nreftable_size * sizeof(uint64_t));", "if (VAR_5 < 0) {", "fprintf(stderr, \"ERROR writing reftable: %s\\n\", strerror(-VAR_5));", "goto fail;", "}", "assert(reftable_size < INT_MAX / sizeof(uint64_t));", "VAR_5 = bdrv_pwrite(VAR_0->file, reftable_offset, on_disk_reftable,\nreftable_size * sizeof(uint64_t));", "if (VAR_5 < 0) {", "fprintf(stderr, \"ERROR writing reftable: %s\\n\", strerror(-VAR_5));", "goto fail;", "}", "cpu_to_be64w(&VAR_6.reftable_offset,\nreftable_offset);", "cpu_to_be32w(&VAR_6.reftable_clusters,\nsize_to_clusters(s, reftable_size * sizeof(uint64_t)));", "VAR_5 = bdrv_pwrite_sync(VAR_0->file, offsetof(QCowHeader,\nrefcount_table_offset),\n&VAR_6,\nsizeof(VAR_6));", "if (VAR_5 < 0) {", "fprintf(stderr, \"ERROR setting reftable: %s\\n\", strerror(-VAR_5));", "goto fail;", "}", "for (refblock_index = 0; refblock_index < reftable_size; refblock_index++) {", "be64_to_cpus(&on_disk_reftable[refblock_index]);", "}", "s->VAR_2 = on_disk_reftable;", "s->refcount_table_offset = reftable_offset;", "s->refcount_table_size = reftable_size;", "return 0;", "fail:\ng_free(on_disk_reftable);", "return VAR_5;", "}" ]
[ 1, 0, 0, 0, 0, 0, 1, 1, 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, 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, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 93, 95 ], [ 97, 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 129 ], [ 131 ], [ 133 ], [ 141, 143, 145 ], [ 147, 149 ], [ 151, 153, 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175, 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 223 ], [ 225 ], [ 229 ], [ 231 ], [ 235 ], [ 237, 239 ], [ 243 ], [ 245 ], [ 247 ], [ 249, 251, 253 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 271 ], [ 273 ], [ 277 ], [ 281 ], [ 283 ], [ 285 ], [ 289, 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 303 ], [ 305, 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 321, 323 ], [ 325, 327 ], [ 329, 331, 333, 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 361 ], [ 365, 367 ], [ 369 ], [ 371 ] ]
21,650
static void vp8_idct_dc_add4uv_c(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride) { vp8_idct_dc_add_c(dst + stride * 0 + 0, block[0], stride); vp8_idct_dc_add_c(dst + stride * 0 + 4, block[1], stride); vp8_idct_dc_add_c(dst + stride * 4 + 0, block[2], stride); vp8_idct_dc_add_c(dst + stride * 4 + 4, block[3], stride); }
true
FFmpeg
ac4b32df71bd932838043a4838b86d11e169707f
static void vp8_idct_dc_add4uv_c(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride) { vp8_idct_dc_add_c(dst + stride * 0 + 0, block[0], stride); vp8_idct_dc_add_c(dst + stride * 0 + 4, block[1], stride); vp8_idct_dc_add_c(dst + stride * 4 + 0, block[2], stride); vp8_idct_dc_add_c(dst + stride * 4 + 4, block[3], stride); }
{ "code": [ "static void vp8_idct_dc_add4uv_c(uint8_t *dst, int16_t block[4][16],", " ptrdiff_t stride)", " vp8_idct_dc_add_c(dst + stride * 0 + 0, block[0], stride);", " vp8_idct_dc_add_c(dst + stride * 0 + 4, block[1], stride);", " vp8_idct_dc_add_c(dst + stride * 4 + 0, block[2], stride);", " vp8_idct_dc_add_c(dst + stride * 4 + 4, block[3], stride);" ], "line_no": [ 1, 3, 7, 9, 11, 13 ] }
static void FUNC_0(uint8_t *VAR_0, int16_t VAR_1[4][16], ptrdiff_t VAR_2) { vp8_idct_dc_add_c(VAR_0 + VAR_2 * 0 + 0, VAR_1[0], VAR_2); vp8_idct_dc_add_c(VAR_0 + VAR_2 * 0 + 4, VAR_1[1], VAR_2); vp8_idct_dc_add_c(VAR_0 + VAR_2 * 4 + 0, VAR_1[2], VAR_2); vp8_idct_dc_add_c(VAR_0 + VAR_2 * 4 + 4, VAR_1[3], VAR_2); }
[ "static void FUNC_0(uint8_t *VAR_0, int16_t VAR_1[4][16],\nptrdiff_t VAR_2)\n{", "vp8_idct_dc_add_c(VAR_0 + VAR_2 * 0 + 0, VAR_1[0], VAR_2);", "vp8_idct_dc_add_c(VAR_0 + VAR_2 * 0 + 4, VAR_1[1], VAR_2);", "vp8_idct_dc_add_c(VAR_0 + VAR_2 * 4 + 0, VAR_1[2], VAR_2);", "vp8_idct_dc_add_c(VAR_0 + VAR_2 * 4 + 4, VAR_1[3], VAR_2);", "}" ]
[ 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
21,651
static void fw_cfg_mem_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = fw_cfg_mem_realize; dc->props = fw_cfg_mem_properties; }
true
qemu
e4f4fb1eca795e36f363b4647724221e774523c1
static void fw_cfg_mem_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = fw_cfg_mem_realize; dc->props = fw_cfg_mem_properties; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->realize = fw_cfg_mem_realize; dc->props = fw_cfg_mem_properties; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->realize = fw_cfg_mem_realize;", "dc->props = fw_cfg_mem_properties;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 18 ] ]
21,652
int xen_pt_msix_init(XenPCIPassthroughState *s, uint32_t base) { uint8_t id = 0; uint16_t control = 0; uint32_t table_off = 0; int i, total_entries, bar_index; XenHostPCIDevice *hd = &s->real_device; PCIDevice *d = &s->dev; int fd = -1; XenPTMSIX *msix = NULL; int rc = 0; rc = xen_host_pci_get_byte(hd, base + PCI_CAP_LIST_ID, &id); if (rc) { return rc; } if (id != PCI_CAP_ID_MSIX) { XEN_PT_ERR(d, "Invalid id %#x base %#x\n", id, base); return -1; } xen_host_pci_get_word(hd, base + PCI_MSIX_FLAGS, &control); total_entries = control & PCI_MSIX_FLAGS_QSIZE; total_entries += 1; s->msix = g_malloc0(sizeof (XenPTMSIX) + total_entries * sizeof (XenPTMSIXEntry)); msix = s->msix; msix->total_entries = total_entries; for (i = 0; i < total_entries; i++) { msix->msix_entry[i].pirq = XEN_PT_UNASSIGNED_PIRQ; } memory_region_init_io(&msix->mmio, OBJECT(s), &pci_msix_ops, s, "xen-pci-pt-msix", (total_entries * PCI_MSIX_ENTRY_SIZE + XC_PAGE_SIZE - 1) & XC_PAGE_MASK); xen_host_pci_get_long(hd, base + PCI_MSIX_TABLE, &table_off); bar_index = msix->bar_index = table_off & PCI_MSIX_FLAGS_BIRMASK; table_off = table_off & ~PCI_MSIX_FLAGS_BIRMASK; msix->table_base = s->real_device.io_regions[bar_index].base_addr; XEN_PT_LOG(d, "get MSI-X table BAR base 0x%"PRIx64"\n", msix->table_base); fd = open("/dev/mem", O_RDWR); if (fd == -1) { rc = -errno; XEN_PT_ERR(d, "Can't open /dev/mem: %s\n", strerror(errno)); goto error_out; } XEN_PT_LOG(d, "table_off = %#x, total_entries = %d\n", table_off, total_entries); msix->table_offset_adjust = table_off & 0x0fff; msix->phys_iomem_base = mmap(NULL, total_entries * PCI_MSIX_ENTRY_SIZE + msix->table_offset_adjust, PROT_READ, MAP_SHARED | MAP_LOCKED, fd, msix->table_base + table_off - msix->table_offset_adjust); close(fd); if (msix->phys_iomem_base == MAP_FAILED) { rc = -errno; XEN_PT_ERR(d, "Can't map physical MSI-X table: %s\n", strerror(errno)); goto error_out; } msix->phys_iomem_base = (char *)msix->phys_iomem_base + msix->table_offset_adjust; XEN_PT_LOG(d, "mapping physical MSI-X table to %p\n", msix->phys_iomem_base); memory_region_add_subregion_overlap(&s->bar[bar_index], table_off, &msix->mmio, 2); /* Priority: pci default + 1 */ return 0; error_out: g_free(s->msix); s->msix = NULL; return rc; }
true
qemu
64c7c1175b4e3e6fe005934cde63259d8adad392
int xen_pt_msix_init(XenPCIPassthroughState *s, uint32_t base) { uint8_t id = 0; uint16_t control = 0; uint32_t table_off = 0; int i, total_entries, bar_index; XenHostPCIDevice *hd = &s->real_device; PCIDevice *d = &s->dev; int fd = -1; XenPTMSIX *msix = NULL; int rc = 0; rc = xen_host_pci_get_byte(hd, base + PCI_CAP_LIST_ID, &id); if (rc) { return rc; } if (id != PCI_CAP_ID_MSIX) { XEN_PT_ERR(d, "Invalid id %#x base %#x\n", id, base); return -1; } xen_host_pci_get_word(hd, base + PCI_MSIX_FLAGS, &control); total_entries = control & PCI_MSIX_FLAGS_QSIZE; total_entries += 1; s->msix = g_malloc0(sizeof (XenPTMSIX) + total_entries * sizeof (XenPTMSIXEntry)); msix = s->msix; msix->total_entries = total_entries; for (i = 0; i < total_entries; i++) { msix->msix_entry[i].pirq = XEN_PT_UNASSIGNED_PIRQ; } memory_region_init_io(&msix->mmio, OBJECT(s), &pci_msix_ops, s, "xen-pci-pt-msix", (total_entries * PCI_MSIX_ENTRY_SIZE + XC_PAGE_SIZE - 1) & XC_PAGE_MASK); xen_host_pci_get_long(hd, base + PCI_MSIX_TABLE, &table_off); bar_index = msix->bar_index = table_off & PCI_MSIX_FLAGS_BIRMASK; table_off = table_off & ~PCI_MSIX_FLAGS_BIRMASK; msix->table_base = s->real_device.io_regions[bar_index].base_addr; XEN_PT_LOG(d, "get MSI-X table BAR base 0x%"PRIx64"\n", msix->table_base); fd = open("/dev/mem", O_RDWR); if (fd == -1) { rc = -errno; XEN_PT_ERR(d, "Can't open /dev/mem: %s\n", strerror(errno)); goto error_out; } XEN_PT_LOG(d, "table_off = %#x, total_entries = %d\n", table_off, total_entries); msix->table_offset_adjust = table_off & 0x0fff; msix->phys_iomem_base = mmap(NULL, total_entries * PCI_MSIX_ENTRY_SIZE + msix->table_offset_adjust, PROT_READ, MAP_SHARED | MAP_LOCKED, fd, msix->table_base + table_off - msix->table_offset_adjust); close(fd); if (msix->phys_iomem_base == MAP_FAILED) { rc = -errno; XEN_PT_ERR(d, "Can't map physical MSI-X table: %s\n", strerror(errno)); goto error_out; } msix->phys_iomem_base = (char *)msix->phys_iomem_base + msix->table_offset_adjust; XEN_PT_LOG(d, "mapping physical MSI-X table to %p\n", msix->phys_iomem_base); memory_region_add_subregion_overlap(&s->bar[bar_index], table_off, &msix->mmio, 2); return 0; error_out: g_free(s->msix); s->msix = NULL; return rc; }
{ "code": [ " xen_host_pci_get_word(hd, base + PCI_MSIX_FLAGS, &control);", " xen_host_pci_get_long(hd, base + PCI_MSIX_TABLE, &table_off);" ], "line_no": [ 45, 83 ] }
int FUNC_0(XenPCIPassthroughState *VAR_0, uint32_t VAR_1) { uint8_t id = 0; uint16_t control = 0; uint32_t table_off = 0; int VAR_2, VAR_3, VAR_4; XenHostPCIDevice *hd = &VAR_0->real_device; PCIDevice *d = &VAR_0->dev; int VAR_5 = -1; XenPTMSIX *msix = NULL; int VAR_6 = 0; VAR_6 = xen_host_pci_get_byte(hd, VAR_1 + PCI_CAP_LIST_ID, &id); if (VAR_6) { return VAR_6; } if (id != PCI_CAP_ID_MSIX) { XEN_PT_ERR(d, "Invalid id %#x VAR_1 %#x\n", id, VAR_1); return -1; } xen_host_pci_get_word(hd, VAR_1 + PCI_MSIX_FLAGS, &control); VAR_3 = control & PCI_MSIX_FLAGS_QSIZE; VAR_3 += 1; VAR_0->msix = g_malloc0(sizeof (XenPTMSIX) + VAR_3 * sizeof (XenPTMSIXEntry)); msix = VAR_0->msix; msix->VAR_3 = VAR_3; for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) { msix->msix_entry[VAR_2].pirq = XEN_PT_UNASSIGNED_PIRQ; } memory_region_init_io(&msix->mmio, OBJECT(VAR_0), &pci_msix_ops, VAR_0, "xen-pci-pt-msix", (VAR_3 * PCI_MSIX_ENTRY_SIZE + XC_PAGE_SIZE - 1) & XC_PAGE_MASK); xen_host_pci_get_long(hd, VAR_1 + PCI_MSIX_TABLE, &table_off); VAR_4 = msix->VAR_4 = table_off & PCI_MSIX_FLAGS_BIRMASK; table_off = table_off & ~PCI_MSIX_FLAGS_BIRMASK; msix->table_base = VAR_0->real_device.io_regions[VAR_4].base_addr; XEN_PT_LOG(d, "get MSI-X table BAR VAR_1 0x%"PRIx64"\n", msix->table_base); VAR_5 = open("/dev/mem", O_RDWR); if (VAR_5 == -1) { VAR_6 = -errno; XEN_PT_ERR(d, "Can't open /dev/mem: %VAR_0\n", strerror(errno)); goto error_out; } XEN_PT_LOG(d, "table_off = %#x, VAR_3 = %d\n", table_off, VAR_3); msix->table_offset_adjust = table_off & 0x0fff; msix->phys_iomem_base = mmap(NULL, VAR_3 * PCI_MSIX_ENTRY_SIZE + msix->table_offset_adjust, PROT_READ, MAP_SHARED | MAP_LOCKED, VAR_5, msix->table_base + table_off - msix->table_offset_adjust); close(VAR_5); if (msix->phys_iomem_base == MAP_FAILED) { VAR_6 = -errno; XEN_PT_ERR(d, "Can't map physical MSI-X table: %VAR_0\n", strerror(errno)); goto error_out; } msix->phys_iomem_base = (char *)msix->phys_iomem_base + msix->table_offset_adjust; XEN_PT_LOG(d, "mapping physical MSI-X table to %p\n", msix->phys_iomem_base); memory_region_add_subregion_overlap(&VAR_0->bar[VAR_4], table_off, &msix->mmio, 2); return 0; error_out: g_free(VAR_0->msix); VAR_0->msix = NULL; return VAR_6; }
[ "int FUNC_0(XenPCIPassthroughState *VAR_0, uint32_t VAR_1)\n{", "uint8_t id = 0;", "uint16_t control = 0;", "uint32_t table_off = 0;", "int VAR_2, VAR_3, VAR_4;", "XenHostPCIDevice *hd = &VAR_0->real_device;", "PCIDevice *d = &VAR_0->dev;", "int VAR_5 = -1;", "XenPTMSIX *msix = NULL;", "int VAR_6 = 0;", "VAR_6 = xen_host_pci_get_byte(hd, VAR_1 + PCI_CAP_LIST_ID, &id);", "if (VAR_6) {", "return VAR_6;", "}", "if (id != PCI_CAP_ID_MSIX) {", "XEN_PT_ERR(d, \"Invalid id %#x VAR_1 %#x\\n\", id, VAR_1);", "return -1;", "}", "xen_host_pci_get_word(hd, VAR_1 + PCI_MSIX_FLAGS, &control);", "VAR_3 = control & PCI_MSIX_FLAGS_QSIZE;", "VAR_3 += 1;", "VAR_0->msix = g_malloc0(sizeof (XenPTMSIX)\n+ VAR_3 * sizeof (XenPTMSIXEntry));", "msix = VAR_0->msix;", "msix->VAR_3 = VAR_3;", "for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) {", "msix->msix_entry[VAR_2].pirq = XEN_PT_UNASSIGNED_PIRQ;", "}", "memory_region_init_io(&msix->mmio, OBJECT(VAR_0), &pci_msix_ops,\nVAR_0, \"xen-pci-pt-msix\",\n(VAR_3 * PCI_MSIX_ENTRY_SIZE\n+ XC_PAGE_SIZE - 1)\n& XC_PAGE_MASK);", "xen_host_pci_get_long(hd, VAR_1 + PCI_MSIX_TABLE, &table_off);", "VAR_4 = msix->VAR_4 = table_off & PCI_MSIX_FLAGS_BIRMASK;", "table_off = table_off & ~PCI_MSIX_FLAGS_BIRMASK;", "msix->table_base = VAR_0->real_device.io_regions[VAR_4].base_addr;", "XEN_PT_LOG(d, \"get MSI-X table BAR VAR_1 0x%\"PRIx64\"\\n\", msix->table_base);", "VAR_5 = open(\"/dev/mem\", O_RDWR);", "if (VAR_5 == -1) {", "VAR_6 = -errno;", "XEN_PT_ERR(d, \"Can't open /dev/mem: %VAR_0\\n\", strerror(errno));", "goto error_out;", "}", "XEN_PT_LOG(d, \"table_off = %#x, VAR_3 = %d\\n\",\ntable_off, VAR_3);", "msix->table_offset_adjust = table_off & 0x0fff;", "msix->phys_iomem_base =\nmmap(NULL,\nVAR_3 * PCI_MSIX_ENTRY_SIZE + msix->table_offset_adjust,\nPROT_READ,\nMAP_SHARED | MAP_LOCKED,\nVAR_5,\nmsix->table_base + table_off - msix->table_offset_adjust);", "close(VAR_5);", "if (msix->phys_iomem_base == MAP_FAILED) {", "VAR_6 = -errno;", "XEN_PT_ERR(d, \"Can't map physical MSI-X table: %VAR_0\\n\", strerror(errno));", "goto error_out;", "}", "msix->phys_iomem_base = (char *)msix->phys_iomem_base\n+ msix->table_offset_adjust;", "XEN_PT_LOG(d, \"mapping physical MSI-X table to %p\\n\",\nmsix->phys_iomem_base);", "memory_region_add_subregion_overlap(&VAR_0->bar[VAR_4], table_off,\n&msix->mmio,\n2);", "return 0;", "error_out:\ng_free(VAR_0->msix);", "VAR_0->msix = NULL;", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 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 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71, 73, 75, 77, 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113, 115, 117, 119, 121, 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 145, 147 ], [ 151, 153, 155 ], [ 159 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171 ] ]
21,653
static int64_t archipelago_volume_info(BDRVArchipelagoState *s) { uint64_t size; int ret, targetlen; struct xseg_request *req; struct xseg_reply_info *xinfo; AIORequestData *reqdata = g_malloc(sizeof(AIORequestData)); const char *volname = s->volname; targetlen = strlen(volname); req = xseg_get_request(s->xseg, s->srcport, s->mportno, X_ALLOC); if (!req) { archipelagolog("Cannot get XSEG request\n"); goto err_exit2; } ret = xseg_prep_request(s->xseg, req, targetlen, sizeof(struct xseg_reply_info)); if (ret < 0) { archipelagolog("Cannot prepare XSEG request\n"); goto err_exit; } char *target = xseg_get_target(s->xseg, req); if (!target) { archipelagolog("Cannot get XSEG target\n"); goto err_exit; } memcpy(target, volname, targetlen); req->size = req->datalen; req->offset = 0; req->op = X_INFO; reqdata->op = ARCHIP_OP_VOLINFO; reqdata->volname = volname; xseg_set_req_data(s->xseg, req, reqdata); xport p = xseg_submit(s->xseg, req, s->srcport, X_ALLOC); if (p == NoPort) { archipelagolog("Cannot submit XSEG request\n"); goto err_exit; } xseg_signal(s->xseg, p); qemu_mutex_lock(&s->archip_mutex); while (!s->is_signaled) { qemu_cond_wait(&s->archip_cond, &s->archip_mutex); } s->is_signaled = false; qemu_mutex_unlock(&s->archip_mutex); xinfo = (struct xseg_reply_info *) xseg_get_data(s->xseg, req); size = xinfo->size; xseg_put_request(s->xseg, req, s->srcport); g_free(reqdata); s->size = size; return size; err_exit: xseg_put_request(s->xseg, req, s->srcport); err_exit2: g_free(reqdata); return -EIO; }
true
qemu
5839e53bbc0fec56021d758aab7610df421ed8c8
static int64_t archipelago_volume_info(BDRVArchipelagoState *s) { uint64_t size; int ret, targetlen; struct xseg_request *req; struct xseg_reply_info *xinfo; AIORequestData *reqdata = g_malloc(sizeof(AIORequestData)); const char *volname = s->volname; targetlen = strlen(volname); req = xseg_get_request(s->xseg, s->srcport, s->mportno, X_ALLOC); if (!req) { archipelagolog("Cannot get XSEG request\n"); goto err_exit2; } ret = xseg_prep_request(s->xseg, req, targetlen, sizeof(struct xseg_reply_info)); if (ret < 0) { archipelagolog("Cannot prepare XSEG request\n"); goto err_exit; } char *target = xseg_get_target(s->xseg, req); if (!target) { archipelagolog("Cannot get XSEG target\n"); goto err_exit; } memcpy(target, volname, targetlen); req->size = req->datalen; req->offset = 0; req->op = X_INFO; reqdata->op = ARCHIP_OP_VOLINFO; reqdata->volname = volname; xseg_set_req_data(s->xseg, req, reqdata); xport p = xseg_submit(s->xseg, req, s->srcport, X_ALLOC); if (p == NoPort) { archipelagolog("Cannot submit XSEG request\n"); goto err_exit; } xseg_signal(s->xseg, p); qemu_mutex_lock(&s->archip_mutex); while (!s->is_signaled) { qemu_cond_wait(&s->archip_cond, &s->archip_mutex); } s->is_signaled = false; qemu_mutex_unlock(&s->archip_mutex); xinfo = (struct xseg_reply_info *) xseg_get_data(s->xseg, req); size = xinfo->size; xseg_put_request(s->xseg, req, s->srcport); g_free(reqdata); s->size = size; return size; err_exit: xseg_put_request(s->xseg, req, s->srcport); err_exit2: g_free(reqdata); return -EIO; }
{ "code": [ " AIORequestData *reqdata = g_malloc(sizeof(AIORequestData));", " AIORequestData *reqdata = g_malloc(sizeof(AIORequestData));" ], "line_no": [ 13, 13 ] }
static int64_t FUNC_0(BDRVArchipelagoState *s) { uint64_t size; int VAR_0, VAR_1; struct xseg_request *VAR_2; struct xseg_reply_info *VAR_3; AIORequestData *reqdata = g_malloc(sizeof(AIORequestData)); const char *VAR_4 = s->VAR_4; VAR_1 = strlen(VAR_4); VAR_2 = xseg_get_request(s->xseg, s->srcport, s->mportno, X_ALLOC); if (!VAR_2) { archipelagolog("Cannot get XSEG request\n"); goto err_exit2; } VAR_0 = xseg_prep_request(s->xseg, VAR_2, VAR_1, sizeof(struct xseg_reply_info)); if (VAR_0 < 0) { archipelagolog("Cannot prepare XSEG request\n"); goto err_exit; } char *VAR_5 = xseg_get_target(s->xseg, VAR_2); if (!VAR_5) { archipelagolog("Cannot get XSEG VAR_5\n"); goto err_exit; } memcpy(VAR_5, VAR_4, VAR_1); VAR_2->size = VAR_2->datalen; VAR_2->offset = 0; VAR_2->op = X_INFO; reqdata->op = ARCHIP_OP_VOLINFO; reqdata->VAR_4 = VAR_4; xseg_set_req_data(s->xseg, VAR_2, reqdata); xport p = xseg_submit(s->xseg, VAR_2, s->srcport, X_ALLOC); if (p == NoPort) { archipelagolog("Cannot submit XSEG request\n"); goto err_exit; } xseg_signal(s->xseg, p); qemu_mutex_lock(&s->archip_mutex); while (!s->is_signaled) { qemu_cond_wait(&s->archip_cond, &s->archip_mutex); } s->is_signaled = false; qemu_mutex_unlock(&s->archip_mutex); VAR_3 = (struct xseg_reply_info *) xseg_get_data(s->xseg, VAR_2); size = VAR_3->size; xseg_put_request(s->xseg, VAR_2, s->srcport); g_free(reqdata); s->size = size; return size; err_exit: xseg_put_request(s->xseg, VAR_2, s->srcport); err_exit2: g_free(reqdata); return -EIO; }
[ "static int64_t FUNC_0(BDRVArchipelagoState *s)\n{", "uint64_t size;", "int VAR_0, VAR_1;", "struct xseg_request *VAR_2;", "struct xseg_reply_info *VAR_3;", "AIORequestData *reqdata = g_malloc(sizeof(AIORequestData));", "const char *VAR_4 = s->VAR_4;", "VAR_1 = strlen(VAR_4);", "VAR_2 = xseg_get_request(s->xseg, s->srcport, s->mportno, X_ALLOC);", "if (!VAR_2) {", "archipelagolog(\"Cannot get XSEG request\\n\");", "goto err_exit2;", "}", "VAR_0 = xseg_prep_request(s->xseg, VAR_2, VAR_1,\nsizeof(struct xseg_reply_info));", "if (VAR_0 < 0) {", "archipelagolog(\"Cannot prepare XSEG request\\n\");", "goto err_exit;", "}", "char *VAR_5 = xseg_get_target(s->xseg, VAR_2);", "if (!VAR_5) {", "archipelagolog(\"Cannot get XSEG VAR_5\\n\");", "goto err_exit;", "}", "memcpy(VAR_5, VAR_4, VAR_1);", "VAR_2->size = VAR_2->datalen;", "VAR_2->offset = 0;", "VAR_2->op = X_INFO;", "reqdata->op = ARCHIP_OP_VOLINFO;", "reqdata->VAR_4 = VAR_4;", "xseg_set_req_data(s->xseg, VAR_2, reqdata);", "xport p = xseg_submit(s->xseg, VAR_2, s->srcport, X_ALLOC);", "if (p == NoPort) {", "archipelagolog(\"Cannot submit XSEG request\\n\");", "goto err_exit;", "}", "xseg_signal(s->xseg, p);", "qemu_mutex_lock(&s->archip_mutex);", "while (!s->is_signaled) {", "qemu_cond_wait(&s->archip_cond, &s->archip_mutex);", "}", "s->is_signaled = false;", "qemu_mutex_unlock(&s->archip_mutex);", "VAR_3 = (struct xseg_reply_info *) xseg_get_data(s->xseg, VAR_2);", "size = VAR_3->size;", "xseg_put_request(s->xseg, VAR_2, s->srcport);", "g_free(reqdata);", "s->size = size;", "return size;", "err_exit:\nxseg_put_request(s->xseg, VAR_2, s->srcport);", "err_exit2:\ng_free(reqdata);", "return -EIO;", "}" ]
[ 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 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111, 113 ], [ 115, 117 ], [ 119 ], [ 121 ] ]
21,654
static void openpic_set_irq(void *opaque, int n_IRQ, int level) { OpenPICState *opp = opaque; IRQSource *src; src = &opp->src[n_IRQ]; DPRINTF("openpic: set irq %d = %d ipvp=%08x\n", n_IRQ, level, src->ipvp); if (src->ipvp & IPVP_SENSE_MASK) { /* level-sensitive irq */ src->pending = level; if (!level) { src->ipvp &= ~IPVP_ACTIVITY_MASK; } } else { /* edge-sensitive irq */ if (level) { src->pending = 1; } } openpic_update_irq(opp, n_IRQ); }
true
qemu
4c4f0e4801ac79632d03867c88aafc90b4ce503c
static void openpic_set_irq(void *opaque, int n_IRQ, int level) { OpenPICState *opp = opaque; IRQSource *src; src = &opp->src[n_IRQ]; DPRINTF("openpic: set irq %d = %d ipvp=%08x\n", n_IRQ, level, src->ipvp); if (src->ipvp & IPVP_SENSE_MASK) { src->pending = level; if (!level) { src->ipvp &= ~IPVP_ACTIVITY_MASK; } } else { if (level) { src->pending = 1; } } openpic_update_irq(opp, n_IRQ); }
{ "code": [ " DPRINTF(\"openpic: set irq %d = %d ipvp=%08x\\n\"," ], "line_no": [ 13 ] }
static void FUNC_0(void *VAR_0, int VAR_1, int VAR_2) { OpenPICState *opp = VAR_0; IRQSource *src; src = &opp->src[VAR_1]; DPRINTF("openpic: set irq %d = %d ipvp=%08x\n", VAR_1, VAR_2, src->ipvp); if (src->ipvp & IPVP_SENSE_MASK) { src->pending = VAR_2; if (!VAR_2) { src->ipvp &= ~IPVP_ACTIVITY_MASK; } } else { if (VAR_2) { src->pending = 1; } } openpic_update_irq(opp, VAR_1); }
[ "static void FUNC_0(void *VAR_0, int VAR_1, int VAR_2)\n{", "OpenPICState *opp = VAR_0;", "IRQSource *src;", "src = &opp->src[VAR_1];", "DPRINTF(\"openpic: set irq %d = %d ipvp=%08x\\n\",\nVAR_1, VAR_2, src->ipvp);", "if (src->ipvp & IPVP_SENSE_MASK) {", "src->pending = VAR_2;", "if (!VAR_2) {", "src->ipvp &= ~IPVP_ACTIVITY_MASK;", "}", "} else {", "if (VAR_2) {", "src->pending = 1;", "}", "}", "openpic_update_irq(opp, VAR_1);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
21,655
static int libschroedinger_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int64_t pts = avpkt->pts; SchroTag *tag; SchroDecoderParams *p_schro_params = avctx->priv_data; SchroDecoder *decoder = p_schro_params->decoder; SchroBuffer *enc_buf; SchroFrame* frame; AVFrame *avframe = data; int state; int go = 1; int outer = 1; SchroParseUnitContext parse_ctx; LibSchroFrameContext *framewithpts = NULL; int ret; *got_frame = 0; parse_context_init(&parse_ctx, buf, buf_size); if (!buf_size) { if (!p_schro_params->eos_signalled) { state = schro_decoder_push_end_of_stream(decoder); p_schro_params->eos_signalled = 1; } } /* Loop through all the individual parse units in the input buffer */ do { if ((enc_buf = find_next_parse_unit(&parse_ctx))) { /* Set Schrotag with the pts to be recovered after decoding*/ enc_buf->tag = schro_tag_new(av_malloc(sizeof(int64_t)), av_free); if (!enc_buf->tag->value) { av_log(avctx, AV_LOG_ERROR, "Unable to allocate SchroTag\n"); return AVERROR(ENOMEM); } AV_WN(64, enc_buf->tag->value, pts); /* Push buffer into decoder. */ if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) && SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4]) > 0) avctx->has_b_frames = 1; state = schro_decoder_push(decoder, enc_buf); if (state == SCHRO_DECODER_FIRST_ACCESS_UNIT) libschroedinger_handle_first_access_unit(avctx); go = 1; } else outer = 0; while (go) { /* Parse data and process result. */ state = schro_decoder_wait(decoder); switch (state) { case SCHRO_DECODER_FIRST_ACCESS_UNIT: libschroedinger_handle_first_access_unit(avctx); break; case SCHRO_DECODER_NEED_BITS: /* Need more input data - stop iterating over what we have. */ go = 0; break; case SCHRO_DECODER_NEED_FRAME: /* Decoder needs a frame - create one and push it in. */ frame = ff_create_schro_frame(avctx, p_schro_params->frame_format); if (!frame) return AVERROR(ENOMEM); schro_decoder_add_output_picture(decoder, frame); break; case SCHRO_DECODER_OK: /* Pull a frame out of the decoder. */ tag = schro_decoder_get_picture_tag(decoder); frame = schro_decoder_pull(decoder); if (frame) { /* Add relation between schroframe and pts. */ framewithpts = av_malloc(sizeof(LibSchroFrameContext)); if (!framewithpts) { av_log(avctx, AV_LOG_ERROR, "Unable to allocate FrameWithPts\n"); return AVERROR(ENOMEM); } framewithpts->frame = frame; framewithpts->pts = AV_RN64(tag->value); ff_schro_queue_push_back(&p_schro_params->dec_frame_queue, framewithpts); } break; case SCHRO_DECODER_EOS: go = 0; p_schro_params->eos_pulled = 1; schro_decoder_reset(decoder); outer = 0; break; case SCHRO_DECODER_ERROR: return -1; break; } } } while (outer); /* Grab next frame to be returned from the top of the queue. */ framewithpts = ff_schro_queue_pop(&p_schro_params->dec_frame_queue); if (framewithpts && framewithpts->frame && framewithpts->frame->components[0].stride) { if ((ret = ff_get_buffer(avctx, avframe, 0)) < 0) { goto end; } memcpy(avframe->data[0], framewithpts->frame->components[0].data, framewithpts->frame->components[0].length); memcpy(avframe->data[1], framewithpts->frame->components[1].data, framewithpts->frame->components[1].length); memcpy(avframe->data[2], framewithpts->frame->components[2].data, framewithpts->frame->components[2].length); /* Fill frame with current buffer data from Schroedinger. */ avframe->pts = framewithpts->pts; #if FF_API_PKT_PTS FF_DISABLE_DEPRECATION_WARNINGS avframe->pkt_pts = avframe->pts; FF_ENABLE_DEPRECATION_WARNINGS #endif avframe->linesize[0] = framewithpts->frame->components[0].stride; avframe->linesize[1] = framewithpts->frame->components[1].stride; avframe->linesize[2] = framewithpts->frame->components[2].stride; *got_frame = 1; } else { data = NULL; *got_frame = 0; } ret = buf_size; end: /* Now free the frame resources. */ if (framewithpts && framewithpts->frame) libschroedinger_decode_frame_free(framewithpts->frame); av_freep(&framewithpts); return ret; }
true
FFmpeg
220b24c7c97dc033ceab1510549f66d0e7b52ef1
static int libschroedinger_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int64_t pts = avpkt->pts; SchroTag *tag; SchroDecoderParams *p_schro_params = avctx->priv_data; SchroDecoder *decoder = p_schro_params->decoder; SchroBuffer *enc_buf; SchroFrame* frame; AVFrame *avframe = data; int state; int go = 1; int outer = 1; SchroParseUnitContext parse_ctx; LibSchroFrameContext *framewithpts = NULL; int ret; *got_frame = 0; parse_context_init(&parse_ctx, buf, buf_size); if (!buf_size) { if (!p_schro_params->eos_signalled) { state = schro_decoder_push_end_of_stream(decoder); p_schro_params->eos_signalled = 1; } } do { if ((enc_buf = find_next_parse_unit(&parse_ctx))) { enc_buf->tag = schro_tag_new(av_malloc(sizeof(int64_t)), av_free); if (!enc_buf->tag->value) { av_log(avctx, AV_LOG_ERROR, "Unable to allocate SchroTag\n"); return AVERROR(ENOMEM); } AV_WN(64, enc_buf->tag->value, pts); if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) && SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4]) > 0) avctx->has_b_frames = 1; state = schro_decoder_push(decoder, enc_buf); if (state == SCHRO_DECODER_FIRST_ACCESS_UNIT) libschroedinger_handle_first_access_unit(avctx); go = 1; } else outer = 0; while (go) { state = schro_decoder_wait(decoder); switch (state) { case SCHRO_DECODER_FIRST_ACCESS_UNIT: libschroedinger_handle_first_access_unit(avctx); break; case SCHRO_DECODER_NEED_BITS: go = 0; break; case SCHRO_DECODER_NEED_FRAME: frame = ff_create_schro_frame(avctx, p_schro_params->frame_format); if (!frame) return AVERROR(ENOMEM); schro_decoder_add_output_picture(decoder, frame); break; case SCHRO_DECODER_OK: tag = schro_decoder_get_picture_tag(decoder); frame = schro_decoder_pull(decoder); if (frame) { framewithpts = av_malloc(sizeof(LibSchroFrameContext)); if (!framewithpts) { av_log(avctx, AV_LOG_ERROR, "Unable to allocate FrameWithPts\n"); return AVERROR(ENOMEM); } framewithpts->frame = frame; framewithpts->pts = AV_RN64(tag->value); ff_schro_queue_push_back(&p_schro_params->dec_frame_queue, framewithpts); } break; case SCHRO_DECODER_EOS: go = 0; p_schro_params->eos_pulled = 1; schro_decoder_reset(decoder); outer = 0; break; case SCHRO_DECODER_ERROR: return -1; break; } } } while (outer); framewithpts = ff_schro_queue_pop(&p_schro_params->dec_frame_queue); if (framewithpts && framewithpts->frame && framewithpts->frame->components[0].stride) { if ((ret = ff_get_buffer(avctx, avframe, 0)) < 0) { goto end; } memcpy(avframe->data[0], framewithpts->frame->components[0].data, framewithpts->frame->components[0].length); memcpy(avframe->data[1], framewithpts->frame->components[1].data, framewithpts->frame->components[1].length); memcpy(avframe->data[2], framewithpts->frame->components[2].data, framewithpts->frame->components[2].length); avframe->pts = framewithpts->pts; #if FF_API_PKT_PTS FF_DISABLE_DEPRECATION_WARNINGS avframe->pkt_pts = avframe->pts; FF_ENABLE_DEPRECATION_WARNINGS #endif avframe->linesize[0] = framewithpts->frame->components[0].stride; avframe->linesize[1] = framewithpts->frame->components[1].stride; avframe->linesize[2] = framewithpts->frame->components[2].stride; *got_frame = 1; } else { data = NULL; *got_frame = 0; } ret = buf_size; end: if (framewithpts && framewithpts->frame) libschroedinger_decode_frame_free(framewithpts->frame); av_freep(&framewithpts); return ret; }
{ "code": [ " SchroDecoderParams *p_schro_params = avctx->priv_data;", " SchroDecoderParams *p_schro_params = avctx->priv_data;", " SchroDecoder *decoder = p_schro_params->decoder;", "static int libschroedinger_decode_frame(AVCodecContext *avctx,", " void *data, int *got_frame,", " AVPacket *avpkt)", " const uint8_t *buf = avpkt->data;", " int buf_size = avpkt->size;", " int64_t pts = avpkt->pts;", " SchroTag *tag;", " SchroDecoderParams *p_schro_params = avctx->priv_data;", " SchroDecoder *decoder = p_schro_params->decoder;", " SchroBuffer *enc_buf;", " SchroFrame* frame;", " AVFrame *avframe = data;", " int state;", " int go = 1;", " int outer = 1;", " SchroParseUnitContext parse_ctx;", " LibSchroFrameContext *framewithpts = NULL;", " int ret;", " *got_frame = 0;", " parse_context_init(&parse_ctx, buf, buf_size);", " if (!buf_size) {", " if (!p_schro_params->eos_signalled) {", " state = schro_decoder_push_end_of_stream(decoder);", " p_schro_params->eos_signalled = 1;", " do {", " if ((enc_buf = find_next_parse_unit(&parse_ctx))) {", " enc_buf->tag = schro_tag_new(av_malloc(sizeof(int64_t)), av_free);", " if (!enc_buf->tag->value) {", " av_log(avctx, AV_LOG_ERROR, \"Unable to allocate SchroTag\\n\");", " return AVERROR(ENOMEM);", " AV_WN(64, enc_buf->tag->value, pts);", " if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) &&", " SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4]) > 0)", " avctx->has_b_frames = 1;", " state = schro_decoder_push(decoder, enc_buf);", " if (state == SCHRO_DECODER_FIRST_ACCESS_UNIT)", " libschroedinger_handle_first_access_unit(avctx);", " go = 1;", " } else", " outer = 0;", " while (go) {", " state = schro_decoder_wait(decoder);", " switch (state) {", " case SCHRO_DECODER_FIRST_ACCESS_UNIT:", " libschroedinger_handle_first_access_unit(avctx);", " break;", " case SCHRO_DECODER_NEED_BITS:", " go = 0;", " break;", " case SCHRO_DECODER_NEED_FRAME:", " frame = ff_create_schro_frame(avctx,", " p_schro_params->frame_format);", " if (!frame)", " return AVERROR(ENOMEM);", " schro_decoder_add_output_picture(decoder, frame);", " break;", " case SCHRO_DECODER_OK:", " tag = schro_decoder_get_picture_tag(decoder);", " frame = schro_decoder_pull(decoder);", " if (frame) {", " framewithpts = av_malloc(sizeof(LibSchroFrameContext));", " if (!framewithpts) {", " av_log(avctx, AV_LOG_ERROR, \"Unable to allocate FrameWithPts\\n\");", " return AVERROR(ENOMEM);", " framewithpts->frame = frame;", " framewithpts->pts = AV_RN64(tag->value);", " ff_schro_queue_push_back(&p_schro_params->dec_frame_queue,", " framewithpts);", " break;", " case SCHRO_DECODER_EOS:", " go = 0;", " p_schro_params->eos_pulled = 1;", " schro_decoder_reset(decoder);", " outer = 0;", " break;", " case SCHRO_DECODER_ERROR:", " return -1;", " break;", " } while (outer);", " framewithpts = ff_schro_queue_pop(&p_schro_params->dec_frame_queue);", " if (framewithpts && framewithpts->frame && framewithpts->frame->components[0].stride) {", " if ((ret = ff_get_buffer(avctx, avframe, 0)) < 0) {", " goto end;", " memcpy(avframe->data[0],", " framewithpts->frame->components[0].data,", " framewithpts->frame->components[0].length);", " memcpy(avframe->data[1],", " framewithpts->frame->components[1].data,", " framewithpts->frame->components[1].length);", " memcpy(avframe->data[2],", " framewithpts->frame->components[2].data,", " framewithpts->frame->components[2].length);", " avframe->pts = framewithpts->pts;", "#if FF_API_PKT_PTS", "FF_DISABLE_DEPRECATION_WARNINGS", " avframe->pkt_pts = avframe->pts;", "FF_ENABLE_DEPRECATION_WARNINGS", "#endif", " avframe->linesize[0] = framewithpts->frame->components[0].stride;", " avframe->linesize[1] = framewithpts->frame->components[1].stride;", " avframe->linesize[2] = framewithpts->frame->components[2].stride;", " *got_frame = 1;", " } else {", " data = NULL;", " *got_frame = 0;", " ret = buf_size;", "end:", " if (framewithpts && framewithpts->frame)", " libschroedinger_decode_frame_free(framewithpts->frame);", " av_freep(&framewithpts);", " return ret;", " SchroDecoderParams *p_schro_params = avctx->priv_data;", " SchroDecoderParams *p_schro_params = avctx->priv_data;", "FF_DISABLE_DEPRECATION_WARNINGS", "FF_ENABLE_DEPRECATION_WARNINGS", "#endif", " } else {", " } else {", " int go = 1;", " SchroBuffer *enc_buf;", " if (!p_schro_params->eos_signalled) {", " p_schro_params->eos_signalled = 1;", " } else {", " p_schro_params->eos_pulled = 1;", " go = 0;", " break;", " return AVERROR(ENOMEM);", "FF_DISABLE_DEPRECATION_WARNINGS", "FF_ENABLE_DEPRECATION_WARNINGS", "#endif", " return ret;" ], "line_no": [ 19, 19, 21, 1, 3, 5, 9, 11, 13, 15, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 43, 47, 49, 51, 53, 55, 65, 67, 71, 73, 75, 77, 81, 85, 87, 89, 91, 93, 95, 97, 99, 101, 105, 109, 111, 113, 95, 117, 121, 125, 117, 131, 135, 137, 139, 141, 143, 117, 149, 153, 155, 159, 163, 165, 167, 169, 173, 175, 177, 179, 117, 185, 125, 189, 191, 193, 117, 199, 201, 117, 209, 215, 219, 221, 223, 229, 231, 233, 237, 239, 241, 245, 247, 249, 255, 257, 259, 261, 263, 265, 267, 269, 271, 275, 277, 279, 281, 285, 287, 291, 293, 295, 297, 19, 19, 259, 263, 265, 277, 277, 31, 23, 51, 55, 277, 189, 125, 117, 77, 259, 263, 265, 297 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; int64_t pts = VAR_3->pts; SchroTag *tag; SchroDecoderParams *p_schro_params = VAR_0->priv_data; SchroDecoder *decoder = p_schro_params->decoder; SchroBuffer *enc_buf; SchroFrame* frame; AVFrame *avframe = VAR_1; int VAR_6; int VAR_7 = 1; int VAR_8 = 1; SchroParseUnitContext parse_ctx; LibSchroFrameContext *framewithpts = NULL; int VAR_9; *VAR_2 = 0; parse_context_init(&parse_ctx, VAR_4, VAR_5); if (!VAR_5) { if (!p_schro_params->eos_signalled) { VAR_6 = schro_decoder_push_end_of_stream(decoder); p_schro_params->eos_signalled = 1; } } do { if ((enc_buf = find_next_parse_unit(&parse_ctx))) { enc_buf->tag = schro_tag_new(av_malloc(sizeof(int64_t)), av_free); if (!enc_buf->tag->value) { av_log(VAR_0, AV_LOG_ERROR, "Unable to allocate SchroTag\n"); return AVERROR(ENOMEM); } AV_WN(64, enc_buf->tag->value, pts); if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->VAR_1[4]) && SCHRO_PARSE_CODE_NUM_REFS(enc_buf->VAR_1[4]) > 0) VAR_0->has_b_frames = 1; VAR_6 = schro_decoder_push(decoder, enc_buf); if (VAR_6 == SCHRO_DECODER_FIRST_ACCESS_UNIT) libschroedinger_handle_first_access_unit(VAR_0); VAR_7 = 1; } else VAR_8 = 0; while (VAR_7) { VAR_6 = schro_decoder_wait(decoder); switch (VAR_6) { case SCHRO_DECODER_FIRST_ACCESS_UNIT: libschroedinger_handle_first_access_unit(VAR_0); break; case SCHRO_DECODER_NEED_BITS: VAR_7 = 0; break; case SCHRO_DECODER_NEED_FRAME: frame = ff_create_schro_frame(VAR_0, p_schro_params->frame_format); if (!frame) return AVERROR(ENOMEM); schro_decoder_add_output_picture(decoder, frame); break; case SCHRO_DECODER_OK: tag = schro_decoder_get_picture_tag(decoder); frame = schro_decoder_pull(decoder); if (frame) { framewithpts = av_malloc(sizeof(LibSchroFrameContext)); if (!framewithpts) { av_log(VAR_0, AV_LOG_ERROR, "Unable to allocate FrameWithPts\n"); return AVERROR(ENOMEM); } framewithpts->frame = frame; framewithpts->pts = AV_RN64(tag->value); ff_schro_queue_push_back(&p_schro_params->dec_frame_queue, framewithpts); } break; case SCHRO_DECODER_EOS: VAR_7 = 0; p_schro_params->eos_pulled = 1; schro_decoder_reset(decoder); VAR_8 = 0; break; case SCHRO_DECODER_ERROR: return -1; break; } } } while (VAR_8); framewithpts = ff_schro_queue_pop(&p_schro_params->dec_frame_queue); if (framewithpts && framewithpts->frame && framewithpts->frame->components[0].stride) { if ((VAR_9 = ff_get_buffer(VAR_0, avframe, 0)) < 0) { goto end; } memcpy(avframe->VAR_1[0], framewithpts->frame->components[0].VAR_1, framewithpts->frame->components[0].length); memcpy(avframe->VAR_1[1], framewithpts->frame->components[1].VAR_1, framewithpts->frame->components[1].length); memcpy(avframe->VAR_1[2], framewithpts->frame->components[2].VAR_1, framewithpts->frame->components[2].length); avframe->pts = framewithpts->pts; #if FF_API_PKT_PTS FF_DISABLE_DEPRECATION_WARNINGS avframe->pkt_pts = avframe->pts; FF_ENABLE_DEPRECATION_WARNINGS #endif avframe->linesize[0] = framewithpts->frame->components[0].stride; avframe->linesize[1] = framewithpts->frame->components[1].stride; avframe->linesize[2] = framewithpts->frame->components[2].stride; *VAR_2 = 1; } else { VAR_1 = NULL; *VAR_2 = 0; } VAR_9 = VAR_5; end: if (framewithpts && framewithpts->frame) libschroedinger_decode_frame_free(framewithpts->frame); av_freep(&framewithpts); return VAR_9; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "int64_t pts = VAR_3->pts;", "SchroTag *tag;", "SchroDecoderParams *p_schro_params = VAR_0->priv_data;", "SchroDecoder *decoder = p_schro_params->decoder;", "SchroBuffer *enc_buf;", "SchroFrame* frame;", "AVFrame *avframe = VAR_1;", "int VAR_6;", "int VAR_7 = 1;", "int VAR_8 = 1;", "SchroParseUnitContext parse_ctx;", "LibSchroFrameContext *framewithpts = NULL;", "int VAR_9;", "*VAR_2 = 0;", "parse_context_init(&parse_ctx, VAR_4, VAR_5);", "if (!VAR_5) {", "if (!p_schro_params->eos_signalled) {", "VAR_6 = schro_decoder_push_end_of_stream(decoder);", "p_schro_params->eos_signalled = 1;", "}", "}", "do {", "if ((enc_buf = find_next_parse_unit(&parse_ctx))) {", "enc_buf->tag = schro_tag_new(av_malloc(sizeof(int64_t)), av_free);", "if (!enc_buf->tag->value) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unable to allocate SchroTag\\n\");", "return AVERROR(ENOMEM);", "}", "AV_WN(64, enc_buf->tag->value, pts);", "if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->VAR_1[4]) &&\nSCHRO_PARSE_CODE_NUM_REFS(enc_buf->VAR_1[4]) > 0)\nVAR_0->has_b_frames = 1;", "VAR_6 = schro_decoder_push(decoder, enc_buf);", "if (VAR_6 == SCHRO_DECODER_FIRST_ACCESS_UNIT)\nlibschroedinger_handle_first_access_unit(VAR_0);", "VAR_7 = 1;", "} else", "VAR_8 = 0;", "while (VAR_7) {", "VAR_6 = schro_decoder_wait(decoder);", "switch (VAR_6) {", "case SCHRO_DECODER_FIRST_ACCESS_UNIT:\nlibschroedinger_handle_first_access_unit(VAR_0);", "break;", "case SCHRO_DECODER_NEED_BITS:\nVAR_7 = 0;", "break;", "case SCHRO_DECODER_NEED_FRAME:\nframe = ff_create_schro_frame(VAR_0,\np_schro_params->frame_format);", "if (!frame)\nreturn AVERROR(ENOMEM);", "schro_decoder_add_output_picture(decoder, frame);", "break;", "case SCHRO_DECODER_OK:\ntag = schro_decoder_get_picture_tag(decoder);", "frame = schro_decoder_pull(decoder);", "if (frame) {", "framewithpts = av_malloc(sizeof(LibSchroFrameContext));", "if (!framewithpts) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unable to allocate FrameWithPts\\n\");", "return AVERROR(ENOMEM);", "}", "framewithpts->frame = frame;", "framewithpts->pts = AV_RN64(tag->value);", "ff_schro_queue_push_back(&p_schro_params->dec_frame_queue,\nframewithpts);", "}", "break;", "case SCHRO_DECODER_EOS:\nVAR_7 = 0;", "p_schro_params->eos_pulled = 1;", "schro_decoder_reset(decoder);", "VAR_8 = 0;", "break;", "case SCHRO_DECODER_ERROR:\nreturn -1;", "break;", "}", "}", "} while (VAR_8);", "framewithpts = ff_schro_queue_pop(&p_schro_params->dec_frame_queue);", "if (framewithpts && framewithpts->frame && framewithpts->frame->components[0].stride) {", "if ((VAR_9 = ff_get_buffer(VAR_0, avframe, 0)) < 0) {", "goto end;", "}", "memcpy(avframe->VAR_1[0],\nframewithpts->frame->components[0].VAR_1,\nframewithpts->frame->components[0].length);", "memcpy(avframe->VAR_1[1],\nframewithpts->frame->components[1].VAR_1,\nframewithpts->frame->components[1].length);", "memcpy(avframe->VAR_1[2],\nframewithpts->frame->components[2].VAR_1,\nframewithpts->frame->components[2].length);", "avframe->pts = framewithpts->pts;", "#if FF_API_PKT_PTS\nFF_DISABLE_DEPRECATION_WARNINGS\navframe->pkt_pts = avframe->pts;", "FF_ENABLE_DEPRECATION_WARNINGS\n#endif\navframe->linesize[0] = framewithpts->frame->components[0].stride;", "avframe->linesize[1] = framewithpts->frame->components[1].stride;", "avframe->linesize[2] = framewithpts->frame->components[2].stride;", "*VAR_2 = 1;", "} else {", "VAR_1 = NULL;", "*VAR_2 = 0;", "}", "VAR_9 = VAR_5;", "end:\nif (framewithpts && framewithpts->frame)\nlibschroedinger_decode_frame_free(framewithpts->frame);", "av_freep(&framewithpts);", "return VAR_9;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87, 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 121, 125 ], [ 127 ], [ 131, 135, 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 149, 153 ], [ 155 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 199, 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 215 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 229, 231, 233 ], [ 237, 239, 241 ], [ 245, 247, 249 ], [ 255 ], [ 257, 259, 261 ], [ 263, 265, 267 ], [ 269 ], [ 271 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287, 291, 293 ], [ 295 ], [ 297 ], [ 299 ] ]
21,656
static void qemu_tcg_wait_io_event(CPUState *cpu) { while (all_cpu_threads_idle()) { stop_tcg_kick_timer(); qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); } start_tcg_kick_timer(); CPU_FOREACH(cpu) { qemu_wait_io_event_common(cpu); } }
true
qemu
372579427a5040a26dfee78464b50e2bdf27ef26
static void qemu_tcg_wait_io_event(CPUState *cpu) { while (all_cpu_threads_idle()) { stop_tcg_kick_timer(); qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); } start_tcg_kick_timer(); CPU_FOREACH(cpu) { qemu_wait_io_event_common(cpu); } }
{ "code": [ " while (all_cpu_threads_idle()) {", " CPU_FOREACH(cpu) {", " qemu_wait_io_event_common(cpu);" ], "line_no": [ 5, 19, 21 ] }
static void FUNC_0(CPUState *VAR_0) { while (all_cpu_threads_idle()) { stop_tcg_kick_timer(); qemu_cond_wait(VAR_0->halt_cond, &qemu_global_mutex); } start_tcg_kick_timer(); CPU_FOREACH(VAR_0) { qemu_wait_io_event_common(VAR_0); } }
[ "static void FUNC_0(CPUState *VAR_0)\n{", "while (all_cpu_threads_idle()) {", "stop_tcg_kick_timer();", "qemu_cond_wait(VAR_0->halt_cond, &qemu_global_mutex);", "}", "start_tcg_kick_timer();", "CPU_FOREACH(VAR_0) {", "qemu_wait_io_event_common(VAR_0);", "}", "}" ]
[ 0, 1, 0, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
21,657
TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *old_op, TCGOpcode opc, int nargs) { int oi = s->gen_next_op_idx; int prev = old_op - s->gen_op_buf; int next = old_op->next; TCGOp *new_op; tcg_debug_assert(oi < OPC_BUF_SIZE); s->gen_next_op_idx = oi + 1; new_op = &s->gen_op_buf[oi]; *new_op = (TCGOp){ .opc = opc, .prev = prev, .next = next }; s->gen_op_buf[next].prev = oi; old_op->next = oi; return new_op; }
true
qemu
15fa08f8451babc88d733bd411d4c94976f9d0f8
TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *old_op, TCGOpcode opc, int nargs) { int oi = s->gen_next_op_idx; int prev = old_op - s->gen_op_buf; int next = old_op->next; TCGOp *new_op; tcg_debug_assert(oi < OPC_BUF_SIZE); s->gen_next_op_idx = oi + 1; new_op = &s->gen_op_buf[oi]; *new_op = (TCGOp){ .opc = opc, .prev = prev, .next = next }; s->gen_op_buf[next].prev = oi; old_op->next = oi; return new_op; }
{ "code": [ " tcg_debug_assert(oi < OPC_BUF_SIZE);", " int oi = s->gen_next_op_idx;", " TCGOp *new_op;", " tcg_debug_assert(oi < OPC_BUF_SIZE);", " s->gen_next_op_idx = oi + 1;", " new_op = &s->gen_op_buf[oi];", " *new_op = (TCGOp){", " .opc = opc,", " .prev = prev,", " .next = next", " };", " int oi = s->gen_next_op_idx;", " int prev = old_op - s->gen_op_buf;", " int next = old_op->next;", " TCGOp *new_op;", " tcg_debug_assert(oi < OPC_BUF_SIZE);", " s->gen_next_op_idx = oi + 1;", " new_op = &s->gen_op_buf[oi];", " *new_op = (TCGOp){", " .opc = opc,", " .prev = prev,", " .next = next", " };", " s->gen_op_buf[next].prev = oi;", " old_op->next = oi;" ], "line_no": [ 17, 7, 13, 17, 19, 23, 25, 27, 29, 31, 33, 7, 9, 11, 13, 17, 19, 23, 25, 27, 29, 31, 33, 35, 37 ] }
TCGOp *FUNC_0(TCGContext *s, TCGOp *old_op, TCGOpcode opc, int nargs) { int VAR_0 = s->gen_next_op_idx; int VAR_1 = old_op - s->gen_op_buf; int VAR_2 = old_op->VAR_2; TCGOp *new_op; tcg_debug_assert(VAR_0 < OPC_BUF_SIZE); s->gen_next_op_idx = VAR_0 + 1; new_op = &s->gen_op_buf[VAR_0]; *new_op = (TCGOp){ .opc = opc, .VAR_1 = VAR_1, .VAR_2 = VAR_2 }; s->gen_op_buf[VAR_2].VAR_1 = VAR_0; old_op->VAR_2 = VAR_0; return new_op; }
[ "TCGOp *FUNC_0(TCGContext *s, TCGOp *old_op,\nTCGOpcode opc, int nargs)\n{", "int VAR_0 = s->gen_next_op_idx;", "int VAR_1 = old_op - s->gen_op_buf;", "int VAR_2 = old_op->VAR_2;", "TCGOp *new_op;", "tcg_debug_assert(VAR_0 < OPC_BUF_SIZE);", "s->gen_next_op_idx = VAR_0 + 1;", "new_op = &s->gen_op_buf[VAR_0];", "*new_op = (TCGOp){", ".opc = opc,\n.VAR_1 = VAR_1,\n.VAR_2 = VAR_2\n};", "s->gen_op_buf[VAR_2].VAR_1 = VAR_0;", "old_op->VAR_2 = VAR_0;", "return new_op;", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27, 29, 31, 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ] ]
21,658
static inline bool check_lba_range(SCSIDiskState *s, uint64_t sector_num, uint32_t nb_sectors) { /* * The first line tests that no overflow happens when computing the last * sector. The second line tests that the last accessed sector is in * range. */ return (sector_num <= sector_num + nb_sectors && sector_num + nb_sectors - 1 <= s->qdev.max_lba); }
true
qemu
12ca76fc48081b3a0ad1a70546abfcf198aedfc4
static inline bool check_lba_range(SCSIDiskState *s, uint64_t sector_num, uint32_t nb_sectors) { return (sector_num <= sector_num + nb_sectors && sector_num + nb_sectors - 1 <= s->qdev.max_lba); }
{ "code": [ " sector_num + nb_sectors - 1 <= s->qdev.max_lba);" ], "line_no": [ 19 ] }
static inline bool FUNC_0(SCSIDiskState *s, uint64_t sector_num, uint32_t nb_sectors) { return (sector_num <= sector_num + nb_sectors && sector_num + nb_sectors - 1 <= s->qdev.max_lba); }
[ "static inline bool FUNC_0(SCSIDiskState *s,\nuint64_t sector_num, uint32_t nb_sectors)\n{", "return (sector_num <= sector_num + nb_sectors &&\nsector_num + nb_sectors - 1 <= s->qdev.max_lba);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 17, 19 ], [ 21 ] ]
21,659
static av_cold int rv30_decode_init(AVCodecContext *avctx) { RV34DecContext *r = avctx->priv_data; int ret; r->rv30 = 1; if ((ret = ff_rv34_decode_init(avctx)) < 0) return ret; if(avctx->extradata_size < 2){ av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n"); return -1; } r->rpr = (avctx->extradata[1] & 7) >> 1; r->rpr = FFMIN(r->rpr + 1, 3); if(avctx->extradata_size - 8 < (r->rpr - 1) * 2){ av_log(avctx, AV_LOG_ERROR, "Insufficient extradata - need at least %d bytes, got %d\n", 6 + r->rpr * 2, avctx->extradata_size); return AVERROR(EINVAL); } r->parse_slice_header = rv30_parse_slice_header; r->decode_intra_types = rv30_decode_intra_types; r->decode_mb_info = rv30_decode_mb_info; r->loop_filter = rv30_loop_filter; r->luma_dc_quant_i = rv30_luma_dc_quant; r->luma_dc_quant_p = rv30_luma_dc_quant; return 0; }
false
FFmpeg
a6a2282c25abe43e352010a7c3fbc92994c0bc1c
static av_cold int rv30_decode_init(AVCodecContext *avctx) { RV34DecContext *r = avctx->priv_data; int ret; r->rv30 = 1; if ((ret = ff_rv34_decode_init(avctx)) < 0) return ret; if(avctx->extradata_size < 2){ av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n"); return -1; } r->rpr = (avctx->extradata[1] & 7) >> 1; r->rpr = FFMIN(r->rpr + 1, 3); if(avctx->extradata_size - 8 < (r->rpr - 1) * 2){ av_log(avctx, AV_LOG_ERROR, "Insufficient extradata - need at least %d bytes, got %d\n", 6 + r->rpr * 2, avctx->extradata_size); return AVERROR(EINVAL); } r->parse_slice_header = rv30_parse_slice_header; r->decode_intra_types = rv30_decode_intra_types; r->decode_mb_info = rv30_decode_mb_info; r->loop_filter = rv30_loop_filter; r->luma_dc_quant_i = rv30_luma_dc_quant; r->luma_dc_quant_p = rv30_luma_dc_quant; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { RV34DecContext *r = avctx->priv_data; int VAR_0; r->rv30 = 1; if ((VAR_0 = ff_rv34_decode_init(avctx)) < 0) return VAR_0; if(avctx->extradata_size < 2){ av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n"); return -1; } r->rpr = (avctx->extradata[1] & 7) >> 1; r->rpr = FFMIN(r->rpr + 1, 3); if(avctx->extradata_size - 8 < (r->rpr - 1) * 2){ av_log(avctx, AV_LOG_ERROR, "Insufficient extradata - need at least %d bytes, got %d\n", 6 + r->rpr * 2, avctx->extradata_size); return AVERROR(EINVAL); } r->parse_slice_header = rv30_parse_slice_header; r->decode_intra_types = rv30_decode_intra_types; r->decode_mb_info = rv30_decode_mb_info; r->loop_filter = rv30_loop_filter; r->luma_dc_quant_i = rv30_luma_dc_quant; r->luma_dc_quant_p = rv30_luma_dc_quant; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "RV34DecContext *r = avctx->priv_data;", "int VAR_0;", "r->rv30 = 1;", "if ((VAR_0 = ff_rv34_decode_init(avctx)) < 0)\nreturn VAR_0;", "if(avctx->extradata_size < 2){", "av_log(avctx, AV_LOG_ERROR, \"Extradata is too small.\\n\");", "return -1;", "}", "r->rpr = (avctx->extradata[1] & 7) >> 1;", "r->rpr = FFMIN(r->rpr + 1, 3);", "if(avctx->extradata_size - 8 < (r->rpr - 1) * 2){", "av_log(avctx, AV_LOG_ERROR, \"Insufficient extradata - need at least %d bytes, got %d\\n\",\n6 + r->rpr * 2, avctx->extradata_size);", "return AVERROR(EINVAL);", "}", "r->parse_slice_header = rv30_parse_slice_header;", "r->decode_intra_types = rv30_decode_intra_types;", "r->decode_mb_info = rv30_decode_mb_info;", "r->loop_filter = rv30_loop_filter;", "r->luma_dc_quant_i = rv30_luma_dc_quant;", "r->luma_dc_quant_p = rv30_luma_dc_quant;", "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 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
21,660
static int jpeg2000_decode_packets_po_iteration(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, int RSpoc, int CSpoc, int LYEpoc, int REpoc, int CEpoc, int Ppoc) { int ret = 0; int layno, reslevelno, compno, precno, ok_reslevel; int x, y; int tp_index = 0; int step_x, step_y; switch (Ppoc) { case JPEG2000_PGOD_RLCP: av_log(s->avctx, AV_LOG_DEBUG, "Progression order RLCP\n"); ok_reslevel = 1; for (reslevelno = RSpoc; ok_reslevel && reslevelno < REpoc; reslevelno++) { ok_reslevel = 0; for (layno = 0; layno < LYEpoc; layno++) { for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; if (reslevelno < codsty->nreslevels) { Jpeg2000ResLevel *rlevel = tile->comp[compno].reslevel + reslevelno; ok_reslevel = 1; for (precno = 0; precno < rlevel->num_precincts_x * rlevel->num_precincts_y; precno++) if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } break; case JPEG2000_PGOD_LRCP: av_log(s->avctx, AV_LOG_DEBUG, "Progression order LRCP\n"); for (layno = 0; layno < LYEpoc; layno++) { ok_reslevel = 1; for (reslevelno = RSpoc; ok_reslevel && reslevelno < REpoc; reslevelno++) { ok_reslevel = 0; for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; if (reslevelno < codsty->nreslevels) { Jpeg2000ResLevel *rlevel = tile->comp[compno].reslevel + reslevelno; ok_reslevel = 1; for (precno = 0; precno < rlevel->num_precincts_x * rlevel->num_precincts_y; precno++) if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } break; case JPEG2000_PGOD_CPRL: av_log(s->avctx, AV_LOG_DEBUG, "Progression order CPRL\n"); for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; step_x = 32; step_y = 32; for (reslevelno = RSpoc; reslevelno < FFMIN(codsty->nreslevels, REpoc); reslevelno++) { uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; // ==> N_L - r Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; step_x = FFMIN(step_x, rlevel->log2_prec_width + reducedresno); step_y = FFMIN(step_y, rlevel->log2_prec_height + reducedresno); } step_x = 1<<step_x; step_y = 1<<step_y; for (y = tile->coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) { for (x = tile->coord[0][0]; x < tile->coord[0][1]; x = (x/step_x + 1)*step_x) { for (reslevelno = RSpoc; reslevelno < FFMIN(codsty->nreslevels, REpoc); reslevelno++) { unsigned prcx, prcy; uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; // ==> N_L - r Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; int xc = x / s->cdx[compno]; int yc = y / s->cdy[compno]; if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) //FIXME this is a subset of the check continue; if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) //FIXME this is a subset of the check continue; // check if a precinct exists prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width; prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height; prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width; prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height; precno = prcx + rlevel->num_precincts_x * prcy; if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) { av_log(s->avctx, AV_LOG_WARNING, "prc %d %d outside limits %d %d\n", prcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y); continue; } for (layno = 0; layno < LYEpoc; layno++) { if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } } break; case JPEG2000_PGOD_RPCL: av_log(s->avctx, AV_LOG_WARNING, "Progression order RPCL\n"); ok_reslevel = 1; for (reslevelno = RSpoc; ok_reslevel && reslevelno < REpoc; reslevelno++) { ok_reslevel = 0; step_x = 30; step_y = 30; for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; if (reslevelno < codsty->nreslevels) { uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; // ==> N_L - r Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; step_x = FFMIN(step_x, rlevel->log2_prec_width + reducedresno); step_y = FFMIN(step_y, rlevel->log2_prec_height + reducedresno); } } step_x = 1<<step_x; step_y = 1<<step_y; for (y = tile->coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) { for (x = tile->coord[0][0]; x < tile->coord[0][1]; x = (x/step_x + 1)*step_x) { for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; // ==> N_L - r Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; unsigned prcx, prcy; int xc = x / s->cdx[compno]; int yc = y / s->cdy[compno]; if (reslevelno >= codsty->nreslevels) continue; if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) //FIXME this is a subset of the check continue; if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) //FIXME this is a subset of the check continue; // check if a precinct exists prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width; prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height; prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width; prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height; precno = prcx + rlevel->num_precincts_x * prcy; ok_reslevel = 1; if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) { av_log(s->avctx, AV_LOG_WARNING, "prc %d %d outside limits %d %d\n", prcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y); continue; } for (layno = 0; layno < LYEpoc; layno++) { if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } } break; case JPEG2000_PGOD_PCRL: av_log(s->avctx, AV_LOG_WARNING, "Progression order PCRL\n"); step_x = 32; step_y = 32; for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; for (reslevelno = RSpoc; reslevelno < FFMIN(codsty->nreslevels, REpoc); reslevelno++) { uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; // ==> N_L - r Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; step_x = FFMIN(step_x, rlevel->log2_prec_width + reducedresno); step_y = FFMIN(step_y, rlevel->log2_prec_height + reducedresno); } } step_x = 1<<step_x; step_y = 1<<step_y; for (y = tile->coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) { for (x = tile->coord[0][0]; x < tile->coord[0][1]; x = (x/step_x + 1)*step_x) { for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; int xc = x / s->cdx[compno]; int yc = y / s->cdy[compno]; for (reslevelno = RSpoc; reslevelno < FFMIN(codsty->nreslevels, REpoc); reslevelno++) { unsigned prcx, prcy; uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; // ==> N_L - r Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) //FIXME this is a subset of the check continue; if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) //FIXME this is a subset of the check continue; // check if a precinct exists prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width; prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height; prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width; prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height; precno = prcx + rlevel->num_precincts_x * prcy; if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) { av_log(s->avctx, AV_LOG_WARNING, "prc %d %d outside limits %d %d\n", prcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y); continue; } for (layno = 0; layno < LYEpoc; layno++) { if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } } break; default: break; } return ret; }
false
FFmpeg
b75c0a72ed3bb5fab0a0b66ede94f6de887db585
static int jpeg2000_decode_packets_po_iteration(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, int RSpoc, int CSpoc, int LYEpoc, int REpoc, int CEpoc, int Ppoc) { int ret = 0; int layno, reslevelno, compno, precno, ok_reslevel; int x, y; int tp_index = 0; int step_x, step_y; switch (Ppoc) { case JPEG2000_PGOD_RLCP: av_log(s->avctx, AV_LOG_DEBUG, "Progression order RLCP\n"); ok_reslevel = 1; for (reslevelno = RSpoc; ok_reslevel && reslevelno < REpoc; reslevelno++) { ok_reslevel = 0; for (layno = 0; layno < LYEpoc; layno++) { for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; if (reslevelno < codsty->nreslevels) { Jpeg2000ResLevel *rlevel = tile->comp[compno].reslevel + reslevelno; ok_reslevel = 1; for (precno = 0; precno < rlevel->num_precincts_x * rlevel->num_precincts_y; precno++) if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } break; case JPEG2000_PGOD_LRCP: av_log(s->avctx, AV_LOG_DEBUG, "Progression order LRCP\n"); for (layno = 0; layno < LYEpoc; layno++) { ok_reslevel = 1; for (reslevelno = RSpoc; ok_reslevel && reslevelno < REpoc; reslevelno++) { ok_reslevel = 0; for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; if (reslevelno < codsty->nreslevels) { Jpeg2000ResLevel *rlevel = tile->comp[compno].reslevel + reslevelno; ok_reslevel = 1; for (precno = 0; precno < rlevel->num_precincts_x * rlevel->num_precincts_y; precno++) if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } break; case JPEG2000_PGOD_CPRL: av_log(s->avctx, AV_LOG_DEBUG, "Progression order CPRL\n"); for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; step_x = 32; step_y = 32; for (reslevelno = RSpoc; reslevelno < FFMIN(codsty->nreslevels, REpoc); reslevelno++) { uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; step_x = FFMIN(step_x, rlevel->log2_prec_width + reducedresno); step_y = FFMIN(step_y, rlevel->log2_prec_height + reducedresno); } step_x = 1<<step_x; step_y = 1<<step_y; for (y = tile->coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) { for (x = tile->coord[0][0]; x < tile->coord[0][1]; x = (x/step_x + 1)*step_x) { for (reslevelno = RSpoc; reslevelno < FFMIN(codsty->nreslevels, REpoc); reslevelno++) { unsigned prcx, prcy; uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; int xc = x / s->cdx[compno]; int yc = y / s->cdy[compno]; if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) continue; if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) continue; prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width; prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height; prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width; prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height; precno = prcx + rlevel->num_precincts_x * prcy; if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) { av_log(s->avctx, AV_LOG_WARNING, "prc %d %d outside limits %d %d\n", prcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y); continue; } for (layno = 0; layno < LYEpoc; layno++) { if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } } break; case JPEG2000_PGOD_RPCL: av_log(s->avctx, AV_LOG_WARNING, "Progression order RPCL\n"); ok_reslevel = 1; for (reslevelno = RSpoc; ok_reslevel && reslevelno < REpoc; reslevelno++) { ok_reslevel = 0; step_x = 30; step_y = 30; for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; if (reslevelno < codsty->nreslevels) { uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; step_x = FFMIN(step_x, rlevel->log2_prec_width + reducedresno); step_y = FFMIN(step_y, rlevel->log2_prec_height + reducedresno); } } step_x = 1<<step_x; step_y = 1<<step_y; for (y = tile->coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) { for (x = tile->coord[0][0]; x < tile->coord[0][1]; x = (x/step_x + 1)*step_x) { for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; unsigned prcx, prcy; int xc = x / s->cdx[compno]; int yc = y / s->cdy[compno]; if (reslevelno >= codsty->nreslevels) continue; if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) continue; if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) continue; prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width; prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height; prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width; prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height; precno = prcx + rlevel->num_precincts_x * prcy; ok_reslevel = 1; if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) { av_log(s->avctx, AV_LOG_WARNING, "prc %d %d outside limits %d %d\n", prcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y); continue; } for (layno = 0; layno < LYEpoc; layno++) { if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } } break; case JPEG2000_PGOD_PCRL: av_log(s->avctx, AV_LOG_WARNING, "Progression order PCRL\n"); step_x = 32; step_y = 32; for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; for (reslevelno = RSpoc; reslevelno < FFMIN(codsty->nreslevels, REpoc); reslevelno++) { uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; step_x = FFMIN(step_x, rlevel->log2_prec_width + reducedresno); step_y = FFMIN(step_y, rlevel->log2_prec_height + reducedresno); } } step_x = 1<<step_x; step_y = 1<<step_y; for (y = tile->coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) { for (x = tile->coord[0][0]; x < tile->coord[0][1]; x = (x/step_x + 1)*step_x) { for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; int xc = x / s->cdx[compno]; int yc = y / s->cdy[compno]; for (reslevelno = RSpoc; reslevelno < FFMIN(codsty->nreslevels, REpoc); reslevelno++) { unsigned prcx, prcy; uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) continue; if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) continue; prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width; prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height; prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width; prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height; precno = prcx + rlevel->num_precincts_x * prcy; if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) { av_log(s->avctx, AV_LOG_WARNING, "prc %d %d outside limits %d %d\n", prcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y); continue; } for (layno = 0; layno < LYEpoc; layno++) { if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } } break; default: break; } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000Tile *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7) { int VAR_8 = 0; int VAR_9, VAR_10, VAR_11, VAR_12, VAR_13; int VAR_14, VAR_15; int VAR_16 = 0; int VAR_17, VAR_18; switch (VAR_7) { case JPEG2000_PGOD_RLCP: av_log(VAR_0->avctx, AV_LOG_DEBUG, "Progression order RLCP\n"); VAR_13 = 1; for (VAR_10 = VAR_2; VAR_13 && VAR_10 < VAR_5; VAR_10++) { VAR_13 = 0; for (VAR_9 = 0; VAR_9 < VAR_4; VAR_9++) { for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) { Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11; Jpeg2000QuantStyle *qntsty = VAR_1->qntsty + VAR_11; if (VAR_10 < codsty->nreslevels) { Jpeg2000ResLevel *rlevel = VAR_1->comp[VAR_11].reslevel + VAR_10; VAR_13 = 1; for (VAR_12 = 0; VAR_12 < rlevel->num_precincts_x * rlevel->num_precincts_y; VAR_12++) if ((VAR_8 = jpeg2000_decode_packet(VAR_0, VAR_1, &VAR_16, codsty, rlevel, VAR_12, VAR_9, qntsty->expn + (VAR_10 ? 3 * (VAR_10 - 1) + 1 : 0), qntsty->nguardbits)) < 0) return VAR_8; } } } } break; case JPEG2000_PGOD_LRCP: av_log(VAR_0->avctx, AV_LOG_DEBUG, "Progression order LRCP\n"); for (VAR_9 = 0; VAR_9 < VAR_4; VAR_9++) { VAR_13 = 1; for (VAR_10 = VAR_2; VAR_13 && VAR_10 < VAR_5; VAR_10++) { VAR_13 = 0; for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) { Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11; Jpeg2000QuantStyle *qntsty = VAR_1->qntsty + VAR_11; if (VAR_10 < codsty->nreslevels) { Jpeg2000ResLevel *rlevel = VAR_1->comp[VAR_11].reslevel + VAR_10; VAR_13 = 1; for (VAR_12 = 0; VAR_12 < rlevel->num_precincts_x * rlevel->num_precincts_y; VAR_12++) if ((VAR_8 = jpeg2000_decode_packet(VAR_0, VAR_1, &VAR_16, codsty, rlevel, VAR_12, VAR_9, qntsty->expn + (VAR_10 ? 3 * (VAR_10 - 1) + 1 : 0), qntsty->nguardbits)) < 0) return VAR_8; } } } } break; case JPEG2000_PGOD_CPRL: av_log(VAR_0->avctx, AV_LOG_DEBUG, "Progression order CPRL\n"); for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) { Jpeg2000Component *comp = VAR_1->comp + VAR_11; Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11; Jpeg2000QuantStyle *qntsty = VAR_1->qntsty + VAR_11; VAR_17 = 32; VAR_18 = 32; for (VAR_10 = VAR_2; VAR_10 < FFMIN(codsty->nreslevels, VAR_5); VAR_10++) { uint8_t reducedresno = codsty->nreslevels - 1 -VAR_10; Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_10; VAR_17 = FFMIN(VAR_17, rlevel->log2_prec_width + reducedresno); VAR_18 = FFMIN(VAR_18, rlevel->log2_prec_height + reducedresno); } VAR_17 = 1<<VAR_17; VAR_18 = 1<<VAR_18; for (VAR_15 = VAR_1->coord[1][0]; VAR_15 < VAR_1->coord[1][1]; VAR_15 = (VAR_15/VAR_18 + 1)*VAR_18) { for (VAR_14 = VAR_1->coord[0][0]; VAR_14 < VAR_1->coord[0][1]; VAR_14 = (VAR_14/VAR_17 + 1)*VAR_17) { for (VAR_10 = VAR_2; VAR_10 < FFMIN(codsty->nreslevels, VAR_5); VAR_10++) { unsigned prcx, prcy; uint8_t reducedresno = codsty->nreslevels - 1 -VAR_10; Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_10; int xc = VAR_14 / VAR_0->cdx[VAR_11]; int yc = VAR_15 / VAR_0->cdy[VAR_11]; if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && VAR_15 != VAR_1->coord[1][0]) continue; if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && VAR_14 != VAR_1->coord[0][0]) continue; prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width; prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height; prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width; prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height; VAR_12 = prcx + rlevel->num_precincts_x * prcy; if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) { av_log(VAR_0->avctx, AV_LOG_WARNING, "prc %d %d outside limits %d %d\n", prcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y); continue; } for (VAR_9 = 0; VAR_9 < VAR_4; VAR_9++) { if ((VAR_8 = jpeg2000_decode_packet(VAR_0, VAR_1, &VAR_16, codsty, rlevel, VAR_12, VAR_9, qntsty->expn + (VAR_10 ? 3 * (VAR_10 - 1) + 1 : 0), qntsty->nguardbits)) < 0) return VAR_8; } } } } } break; case JPEG2000_PGOD_RPCL: av_log(VAR_0->avctx, AV_LOG_WARNING, "Progression order RPCL\n"); VAR_13 = 1; for (VAR_10 = VAR_2; VAR_13 && VAR_10 < VAR_5; VAR_10++) { VAR_13 = 0; VAR_17 = 30; VAR_18 = 30; for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) { Jpeg2000Component *comp = VAR_1->comp + VAR_11; Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11; if (VAR_10 < codsty->nreslevels) { uint8_t reducedresno = codsty->nreslevels - 1 -VAR_10; Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_10; VAR_17 = FFMIN(VAR_17, rlevel->log2_prec_width + reducedresno); VAR_18 = FFMIN(VAR_18, rlevel->log2_prec_height + reducedresno); } } VAR_17 = 1<<VAR_17; VAR_18 = 1<<VAR_18; for (VAR_15 = VAR_1->coord[1][0]; VAR_15 < VAR_1->coord[1][1]; VAR_15 = (VAR_15/VAR_18 + 1)*VAR_18) { for (VAR_14 = VAR_1->coord[0][0]; VAR_14 < VAR_1->coord[0][1]; VAR_14 = (VAR_14/VAR_17 + 1)*VAR_17) { for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) { Jpeg2000Component *comp = VAR_1->comp + VAR_11; Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11; Jpeg2000QuantStyle *qntsty = VAR_1->qntsty + VAR_11; uint8_t reducedresno = codsty->nreslevels - 1 -VAR_10; Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_10; unsigned prcx, prcy; int xc = VAR_14 / VAR_0->cdx[VAR_11]; int yc = VAR_15 / VAR_0->cdy[VAR_11]; if (VAR_10 >= codsty->nreslevels) continue; if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && VAR_15 != VAR_1->coord[1][0]) continue; if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && VAR_14 != VAR_1->coord[0][0]) continue; prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width; prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height; prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width; prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height; VAR_12 = prcx + rlevel->num_precincts_x * prcy; VAR_13 = 1; if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) { av_log(VAR_0->avctx, AV_LOG_WARNING, "prc %d %d outside limits %d %d\n", prcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y); continue; } for (VAR_9 = 0; VAR_9 < VAR_4; VAR_9++) { if ((VAR_8 = jpeg2000_decode_packet(VAR_0, VAR_1, &VAR_16, codsty, rlevel, VAR_12, VAR_9, qntsty->expn + (VAR_10 ? 3 * (VAR_10 - 1) + 1 : 0), qntsty->nguardbits)) < 0) return VAR_8; } } } } } break; case JPEG2000_PGOD_PCRL: av_log(VAR_0->avctx, AV_LOG_WARNING, "Progression order PCRL\n"); VAR_17 = 32; VAR_18 = 32; for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) { Jpeg2000Component *comp = VAR_1->comp + VAR_11; Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11; Jpeg2000QuantStyle *qntsty = VAR_1->qntsty + VAR_11; for (VAR_10 = VAR_2; VAR_10 < FFMIN(codsty->nreslevels, VAR_5); VAR_10++) { uint8_t reducedresno = codsty->nreslevels - 1 -VAR_10; Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_10; VAR_17 = FFMIN(VAR_17, rlevel->log2_prec_width + reducedresno); VAR_18 = FFMIN(VAR_18, rlevel->log2_prec_height + reducedresno); } } VAR_17 = 1<<VAR_17; VAR_18 = 1<<VAR_18; for (VAR_15 = VAR_1->coord[1][0]; VAR_15 < VAR_1->coord[1][1]; VAR_15 = (VAR_15/VAR_18 + 1)*VAR_18) { for (VAR_14 = VAR_1->coord[0][0]; VAR_14 < VAR_1->coord[0][1]; VAR_14 = (VAR_14/VAR_17 + 1)*VAR_17) { for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) { Jpeg2000Component *comp = VAR_1->comp + VAR_11; Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11; Jpeg2000QuantStyle *qntsty = VAR_1->qntsty + VAR_11; int xc = VAR_14 / VAR_0->cdx[VAR_11]; int yc = VAR_15 / VAR_0->cdy[VAR_11]; for (VAR_10 = VAR_2; VAR_10 < FFMIN(codsty->nreslevels, VAR_5); VAR_10++) { unsigned prcx, prcy; uint8_t reducedresno = codsty->nreslevels - 1 -VAR_10; Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_10; if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && VAR_15 != VAR_1->coord[1][0]) continue; if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && VAR_14 != VAR_1->coord[0][0]) continue; prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width; prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height; prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width; prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height; VAR_12 = prcx + rlevel->num_precincts_x * prcy; if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) { av_log(VAR_0->avctx, AV_LOG_WARNING, "prc %d %d outside limits %d %d\n", prcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y); continue; } for (VAR_9 = 0; VAR_9 < VAR_4; VAR_9++) { if ((VAR_8 = jpeg2000_decode_packet(VAR_0, VAR_1, &VAR_16, codsty, rlevel, VAR_12, VAR_9, qntsty->expn + (VAR_10 ? 3 * (VAR_10 - 1) + 1 : 0), qntsty->nguardbits)) < 0) return VAR_8; } } } } } break; default: break; } return VAR_8; }
[ "static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000Tile *VAR_1,\nint VAR_2, int VAR_3,\nint VAR_4, int VAR_5, int VAR_6,\nint VAR_7)\n{", "int VAR_8 = 0;", "int VAR_9, VAR_10, VAR_11, VAR_12, VAR_13;", "int VAR_14, VAR_15;", "int VAR_16 = 0;", "int VAR_17, VAR_18;", "switch (VAR_7) {", "case JPEG2000_PGOD_RLCP:\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"Progression order RLCP\\n\");", "VAR_13 = 1;", "for (VAR_10 = VAR_2; VAR_13 && VAR_10 < VAR_5; VAR_10++) {", "VAR_13 = 0;", "for (VAR_9 = 0; VAR_9 < VAR_4; VAR_9++) {", "for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) {", "Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11;", "Jpeg2000QuantStyle *qntsty = VAR_1->qntsty + VAR_11;", "if (VAR_10 < codsty->nreslevels) {", "Jpeg2000ResLevel *rlevel = VAR_1->comp[VAR_11].reslevel +\nVAR_10;", "VAR_13 = 1;", "for (VAR_12 = 0; VAR_12 < rlevel->num_precincts_x * rlevel->num_precincts_y; VAR_12++)", "if ((VAR_8 = jpeg2000_decode_packet(VAR_0, VAR_1, &VAR_16,\ncodsty, rlevel,\nVAR_12, VAR_9,\nqntsty->expn + (VAR_10 ? 3 * (VAR_10 - 1) + 1 : 0),\nqntsty->nguardbits)) < 0)\nreturn VAR_8;", "}", "}", "}", "}", "break;", "case JPEG2000_PGOD_LRCP:\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"Progression order LRCP\\n\");", "for (VAR_9 = 0; VAR_9 < VAR_4; VAR_9++) {", "VAR_13 = 1;", "for (VAR_10 = VAR_2; VAR_13 && VAR_10 < VAR_5; VAR_10++) {", "VAR_13 = 0;", "for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) {", "Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11;", "Jpeg2000QuantStyle *qntsty = VAR_1->qntsty + VAR_11;", "if (VAR_10 < codsty->nreslevels) {", "Jpeg2000ResLevel *rlevel = VAR_1->comp[VAR_11].reslevel +\nVAR_10;", "VAR_13 = 1;", "for (VAR_12 = 0; VAR_12 < rlevel->num_precincts_x * rlevel->num_precincts_y; VAR_12++)", "if ((VAR_8 = jpeg2000_decode_packet(VAR_0, VAR_1, &VAR_16,\ncodsty, rlevel,\nVAR_12, VAR_9,\nqntsty->expn + (VAR_10 ? 3 * (VAR_10 - 1) + 1 : 0),\nqntsty->nguardbits)) < 0)\nreturn VAR_8;", "}", "}", "}", "}", "break;", "case JPEG2000_PGOD_CPRL:\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"Progression order CPRL\\n\");", "for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) {", "Jpeg2000Component *comp = VAR_1->comp + VAR_11;", "Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11;", "Jpeg2000QuantStyle *qntsty = VAR_1->qntsty + VAR_11;", "VAR_17 = 32;", "VAR_18 = 32;", "for (VAR_10 = VAR_2; VAR_10 < FFMIN(codsty->nreslevels, VAR_5); VAR_10++) {", "uint8_t reducedresno = codsty->nreslevels - 1 -VAR_10;", "Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_10;", "VAR_17 = FFMIN(VAR_17, rlevel->log2_prec_width + reducedresno);", "VAR_18 = FFMIN(VAR_18, rlevel->log2_prec_height + reducedresno);", "}", "VAR_17 = 1<<VAR_17;", "VAR_18 = 1<<VAR_18;", "for (VAR_15 = VAR_1->coord[1][0]; VAR_15 < VAR_1->coord[1][1]; VAR_15 = (VAR_15/VAR_18 + 1)*VAR_18) {", "for (VAR_14 = VAR_1->coord[0][0]; VAR_14 < VAR_1->coord[0][1]; VAR_14 = (VAR_14/VAR_17 + 1)*VAR_17) {", "for (VAR_10 = VAR_2; VAR_10 < FFMIN(codsty->nreslevels, VAR_5); VAR_10++) {", "unsigned prcx, prcy;", "uint8_t reducedresno = codsty->nreslevels - 1 -VAR_10;", "Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_10;", "int xc = VAR_14 / VAR_0->cdx[VAR_11];", "int yc = VAR_15 / VAR_0->cdy[VAR_11];", "if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && VAR_15 != VAR_1->coord[1][0])\ncontinue;", "if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && VAR_14 != VAR_1->coord[0][0])\ncontinue;", "prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width;", "prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height;", "prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width;", "prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height;", "VAR_12 = prcx + rlevel->num_precincts_x * prcy;", "if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) {", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"prc %d %d outside limits %d %d\\n\",\nprcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y);", "continue;", "}", "for (VAR_9 = 0; VAR_9 < VAR_4; VAR_9++) {", "if ((VAR_8 = jpeg2000_decode_packet(VAR_0, VAR_1, &VAR_16, codsty, rlevel,\nVAR_12, VAR_9,\nqntsty->expn + (VAR_10 ? 3 * (VAR_10 - 1) + 1 : 0),\nqntsty->nguardbits)) < 0)\nreturn VAR_8;", "}", "}", "}", "}", "}", "break;", "case JPEG2000_PGOD_RPCL:\nav_log(VAR_0->avctx, AV_LOG_WARNING, \"Progression order RPCL\\n\");", "VAR_13 = 1;", "for (VAR_10 = VAR_2; VAR_13 && VAR_10 < VAR_5; VAR_10++) {", "VAR_13 = 0;", "VAR_17 = 30;", "VAR_18 = 30;", "for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) {", "Jpeg2000Component *comp = VAR_1->comp + VAR_11;", "Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11;", "if (VAR_10 < codsty->nreslevels) {", "uint8_t reducedresno = codsty->nreslevels - 1 -VAR_10;", "Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_10;", "VAR_17 = FFMIN(VAR_17, rlevel->log2_prec_width + reducedresno);", "VAR_18 = FFMIN(VAR_18, rlevel->log2_prec_height + reducedresno);", "}", "}", "VAR_17 = 1<<VAR_17;", "VAR_18 = 1<<VAR_18;", "for (VAR_15 = VAR_1->coord[1][0]; VAR_15 < VAR_1->coord[1][1]; VAR_15 = (VAR_15/VAR_18 + 1)*VAR_18) {", "for (VAR_14 = VAR_1->coord[0][0]; VAR_14 < VAR_1->coord[0][1]; VAR_14 = (VAR_14/VAR_17 + 1)*VAR_17) {", "for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) {", "Jpeg2000Component *comp = VAR_1->comp + VAR_11;", "Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11;", "Jpeg2000QuantStyle *qntsty = VAR_1->qntsty + VAR_11;", "uint8_t reducedresno = codsty->nreslevels - 1 -VAR_10;", "Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_10;", "unsigned prcx, prcy;", "int xc = VAR_14 / VAR_0->cdx[VAR_11];", "int yc = VAR_15 / VAR_0->cdy[VAR_11];", "if (VAR_10 >= codsty->nreslevels)\ncontinue;", "if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && VAR_15 != VAR_1->coord[1][0])\ncontinue;", "if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && VAR_14 != VAR_1->coord[0][0])\ncontinue;", "prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width;", "prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height;", "prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width;", "prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height;", "VAR_12 = prcx + rlevel->num_precincts_x * prcy;", "VAR_13 = 1;", "if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) {", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"prc %d %d outside limits %d %d\\n\",\nprcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y);", "continue;", "}", "for (VAR_9 = 0; VAR_9 < VAR_4; VAR_9++) {", "if ((VAR_8 = jpeg2000_decode_packet(VAR_0, VAR_1, &VAR_16,\ncodsty, rlevel,\nVAR_12, VAR_9,\nqntsty->expn + (VAR_10 ? 3 * (VAR_10 - 1) + 1 : 0),\nqntsty->nguardbits)) < 0)\nreturn VAR_8;", "}", "}", "}", "}", "}", "break;", "case JPEG2000_PGOD_PCRL:\nav_log(VAR_0->avctx, AV_LOG_WARNING, \"Progression order PCRL\\n\");", "VAR_17 = 32;", "VAR_18 = 32;", "for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) {", "Jpeg2000Component *comp = VAR_1->comp + VAR_11;", "Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11;", "Jpeg2000QuantStyle *qntsty = VAR_1->qntsty + VAR_11;", "for (VAR_10 = VAR_2; VAR_10 < FFMIN(codsty->nreslevels, VAR_5); VAR_10++) {", "uint8_t reducedresno = codsty->nreslevels - 1 -VAR_10;", "Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_10;", "VAR_17 = FFMIN(VAR_17, rlevel->log2_prec_width + reducedresno);", "VAR_18 = FFMIN(VAR_18, rlevel->log2_prec_height + reducedresno);", "}", "}", "VAR_17 = 1<<VAR_17;", "VAR_18 = 1<<VAR_18;", "for (VAR_15 = VAR_1->coord[1][0]; VAR_15 < VAR_1->coord[1][1]; VAR_15 = (VAR_15/VAR_18 + 1)*VAR_18) {", "for (VAR_14 = VAR_1->coord[0][0]; VAR_14 < VAR_1->coord[0][1]; VAR_14 = (VAR_14/VAR_17 + 1)*VAR_17) {", "for (VAR_11 = VAR_3; VAR_11 < VAR_6; VAR_11++) {", "Jpeg2000Component *comp = VAR_1->comp + VAR_11;", "Jpeg2000CodingStyle *codsty = VAR_1->codsty + VAR_11;", "Jpeg2000QuantStyle *qntsty = VAR_1->qntsty + VAR_11;", "int xc = VAR_14 / VAR_0->cdx[VAR_11];", "int yc = VAR_15 / VAR_0->cdy[VAR_11];", "for (VAR_10 = VAR_2; VAR_10 < FFMIN(codsty->nreslevels, VAR_5); VAR_10++) {", "unsigned prcx, prcy;", "uint8_t reducedresno = codsty->nreslevels - 1 -VAR_10;", "Jpeg2000ResLevel *rlevel = comp->reslevel + VAR_10;", "if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && VAR_15 != VAR_1->coord[1][0])\ncontinue;", "if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && VAR_14 != VAR_1->coord[0][0])\ncontinue;", "prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width;", "prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height;", "prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width;", "prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height;", "VAR_12 = prcx + rlevel->num_precincts_x * prcy;", "if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) {", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"prc %d %d outside limits %d %d\\n\",\nprcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y);", "continue;", "}", "for (VAR_9 = 0; VAR_9 < VAR_4; VAR_9++) {", "if ((VAR_8 = jpeg2000_decode_packet(VAR_0, VAR_1, &VAR_16, codsty, rlevel,\nVAR_12, VAR_9,\nqntsty->expn + (VAR_10 ? 3 * (VAR_10 - 1) + 1 : 0),\nqntsty->nguardbits)) < 0)\nreturn VAR_8;", "}", "}", "}", "}", "}", "break;", "default:\nbreak;", "}", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53, 55, 57, 59, 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 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 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183, 185 ], [ 189, 191 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 207 ], [ 211 ], [ 213, 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225, 227, 229, 231, 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 311 ], [ 313 ], [ 317, 319 ], [ 323, 325 ], [ 329, 331 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 347 ], [ 351 ], [ 353 ], [ 355, 357 ], [ 359 ], [ 361 ], [ 365 ], [ 367, 369, 371, 373, 375, 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 393, 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 459, 461 ], [ 465, 467 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 483 ], [ 487 ], [ 489, 491 ], [ 493 ], [ 495 ], [ 499 ], [ 501, 503, 505, 507, 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 525, 527 ], [ 529 ], [ 533 ], [ 535 ] ]
21,661
static av_cold int vmdaudio_decode_init(AVCodecContext *avctx) { VmdAudioContext *s = avctx->priv_data; if (avctx->channels < 1 || avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n"); return AVERROR(EINVAL); } if (avctx->block_align < 1) { av_log(avctx, AV_LOG_ERROR, "invalid block align\n"); return AVERROR(EINVAL); } avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; if (avctx->bits_per_coded_sample == 16) avctx->sample_fmt = AV_SAMPLE_FMT_S16; else avctx->sample_fmt = AV_SAMPLE_FMT_U8; s->out_bps = av_get_bytes_per_sample(avctx->sample_fmt); s->chunk_size = avctx->block_align + avctx->channels * (s->out_bps == 2); avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, " "block align = %d, sample rate = %d\n", avctx->channels, avctx->bits_per_coded_sample, avctx->block_align, avctx->sample_rate); return 0; }
false
FFmpeg
c2409a7c5b1c1f43ee8b00c13ed41edc0321db0b
static av_cold int vmdaudio_decode_init(AVCodecContext *avctx) { VmdAudioContext *s = avctx->priv_data; if (avctx->channels < 1 || avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n"); return AVERROR(EINVAL); } if (avctx->block_align < 1) { av_log(avctx, AV_LOG_ERROR, "invalid block align\n"); return AVERROR(EINVAL); } avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; if (avctx->bits_per_coded_sample == 16) avctx->sample_fmt = AV_SAMPLE_FMT_S16; else avctx->sample_fmt = AV_SAMPLE_FMT_U8; s->out_bps = av_get_bytes_per_sample(avctx->sample_fmt); s->chunk_size = avctx->block_align + avctx->channels * (s->out_bps == 2); avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, " "block align = %d, sample rate = %d\n", avctx->channels, avctx->bits_per_coded_sample, avctx->block_align, avctx->sample_rate); return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { VmdAudioContext *s = avctx->priv_data; if (avctx->channels < 1 || avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n"); return AVERROR(EINVAL); } if (avctx->block_align < 1) { av_log(avctx, AV_LOG_ERROR, "invalid block align\n"); return AVERROR(EINVAL); } avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; if (avctx->bits_per_coded_sample == 16) avctx->sample_fmt = AV_SAMPLE_FMT_S16; else avctx->sample_fmt = AV_SAMPLE_FMT_U8; s->out_bps = av_get_bytes_per_sample(avctx->sample_fmt); s->chunk_size = avctx->block_align + avctx->channels * (s->out_bps == 2); avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; av_log(avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, " "block align = %d, sample rate = %d\n", avctx->channels, avctx->bits_per_coded_sample, avctx->block_align, avctx->sample_rate); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "VmdAudioContext *s = avctx->priv_data;", "if (avctx->channels < 1 || avctx->channels > 2) {", "av_log(avctx, AV_LOG_ERROR, \"invalid number of channels\\n\");", "return AVERROR(EINVAL);", "}", "if (avctx->block_align < 1) {", "av_log(avctx, AV_LOG_ERROR, \"invalid block align\\n\");", "return AVERROR(EINVAL);", "}", "avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO :\nAV_CH_LAYOUT_STEREO;", "if (avctx->bits_per_coded_sample == 16)\navctx->sample_fmt = AV_SAMPLE_FMT_S16;", "else\navctx->sample_fmt = AV_SAMPLE_FMT_U8;", "s->out_bps = av_get_bytes_per_sample(avctx->sample_fmt);", "s->chunk_size = avctx->block_align + avctx->channels * (s->out_bps == 2);", "avcodec_get_frame_defaults(&s->frame);", "avctx->coded_frame = &s->frame;", "av_log(avctx, AV_LOG_DEBUG, \"%d channels, %d bits/sample, \"\n\"block align = %d, sample rate = %d\\n\",\navctx->channels, avctx->bits_per_coded_sample, avctx->block_align,\navctx->sample_rate);", "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 ], [ 27, 29 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 55, 57, 59, 61 ], [ 65 ], [ 67 ] ]
21,662
static int sunrast_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; const uint8_t *buf_end = avpkt->data + avpkt->size; AVFrame * const p = data; unsigned int w, h, depth, type, maptype, maplength, stride, x, y, len, alen; uint8_t *ptr, *ptr2 = NULL; const uint8_t *bufstart = buf; int ret; if (avpkt->size < 32) return AVERROR_INVALIDDATA; if (AV_RB32(buf) != RAS_MAGIC) { av_log(avctx, AV_LOG_ERROR, "this is not sunras encoded data\n"); return AVERROR_INVALIDDATA; } w = AV_RB32(buf + 4); h = AV_RB32(buf + 8); depth = AV_RB32(buf + 12); type = AV_RB32(buf + 20); maptype = AV_RB32(buf + 24); maplength = AV_RB32(buf + 28); buf += 32; if (type == RT_EXPERIMENTAL) { avpriv_request_sample(avctx, "TIFF/IFF/EXPERIMENTAL (compression) type"); return AVERROR_PATCHWELCOME; } if (type > RT_FORMAT_IFF) { av_log(avctx, AV_LOG_ERROR, "invalid (compression) type\n"); return AVERROR_INVALIDDATA; } if (maptype == RMT_RAW) { avpriv_request_sample(avctx, "Unknown colormap type"); return AVERROR_PATCHWELCOME; } if (maptype > RMT_RAW) { av_log(avctx, AV_LOG_ERROR, "invalid colormap type\n"); return AVERROR_INVALIDDATA; } if (type == RT_FORMAT_TIFF || type == RT_FORMAT_IFF) { av_log(avctx, AV_LOG_ERROR, "unsupported (compression) type\n"); return -1; } switch (depth) { case 1: avctx->pix_fmt = maplength ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_MONOWHITE; break; case 4: avctx->pix_fmt = maplength ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_NONE; break; case 8: avctx->pix_fmt = maplength ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_GRAY8; break; case 24: avctx->pix_fmt = (type == RT_FORMAT_RGB) ? AV_PIX_FMT_RGB24 : AV_PIX_FMT_BGR24; break; case 32: avctx->pix_fmt = (type == RT_FORMAT_RGB) ? AV_PIX_FMT_0RGB : AV_PIX_FMT_0BGR; break; default: av_log(avctx, AV_LOG_ERROR, "invalid depth\n"); return AVERROR_INVALIDDATA; } ret = ff_set_dimensions(avctx, w, h); if (ret < 0) return ret; if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; p->pict_type = AV_PICTURE_TYPE_I; if (buf_end - buf < maplength) return AVERROR_INVALIDDATA; if (depth > 8 && maplength) { av_log(avctx, AV_LOG_WARNING, "useless colormap found or file is corrupted, trying to recover\n"); } else if (maplength) { unsigned int len = maplength / 3; if (maplength % 3 || maplength > 768) { av_log(avctx, AV_LOG_WARNING, "invalid colormap length\n"); return AVERROR_INVALIDDATA; } ptr = p->data[1]; for (x = 0; x < len; x++, ptr += 4) *(uint32_t *)ptr = (0xFFU<<24) + (buf[x]<<16) + (buf[len+x]<<8) + buf[len+len+x]; } buf += maplength; if (maplength && depth < 8) { ptr = ptr2 = av_malloc_array((w + 15), h); if (!ptr) return AVERROR(ENOMEM); stride = (w + 15 >> 3) * depth; } else { ptr = p->data[0]; stride = p->linesize[0]; } /* scanlines are aligned on 16 bit boundaries */ len = (depth * w + 7) >> 3; alen = len + (len & 1); if (type == RT_BYTE_ENCODED) { int value, run; uint8_t *end = ptr + h * stride; x = 0; while (ptr != end && buf < buf_end) { run = 1; if (buf_end - buf < 1) return AVERROR_INVALIDDATA; if ((value = *buf++) == RLE_TRIGGER) { run = *buf++ + 1; if (run != 1) value = *buf++; } while (run--) { if (x < len) ptr[x] = value; if (++x >= alen) { x = 0; ptr += stride; if (ptr == end) break; } } } } else { for (y = 0; y < h; y++) { if (buf_end - buf < len) break; memcpy(ptr, buf, len); ptr += stride; buf += alen; } } if (avctx->pix_fmt == AV_PIX_FMT_PAL8 && depth < 8) { uint8_t *ptr_free = ptr2; ptr = p->data[0]; for (y=0; y<h; y++) { for (x = 0; x < (w + 7 >> 3) * depth; x++) { if (depth == 1) { ptr[8*x] = ptr2[x] >> 7; ptr[8*x+1] = ptr2[x] >> 6 & 1; ptr[8*x+2] = ptr2[x] >> 5 & 1; ptr[8*x+3] = ptr2[x] >> 4 & 1; ptr[8*x+4] = ptr2[x] >> 3 & 1; ptr[8*x+5] = ptr2[x] >> 2 & 1; ptr[8*x+6] = ptr2[x] >> 1 & 1; ptr[8*x+7] = ptr2[x] & 1; } else { ptr[2*x] = ptr2[x] >> 4; ptr[2*x+1] = ptr2[x] & 0xF; } } ptr += p->linesize[0]; ptr2 += (w + 15 >> 3) * depth; } av_freep(&ptr_free); } *got_frame = 1; return buf - bufstart; }
false
FFmpeg
37138338ff602803d174b13fecd363a083bc2f9a
static int sunrast_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; const uint8_t *buf_end = avpkt->data + avpkt->size; AVFrame * const p = data; unsigned int w, h, depth, type, maptype, maplength, stride, x, y, len, alen; uint8_t *ptr, *ptr2 = NULL; const uint8_t *bufstart = buf; int ret; if (avpkt->size < 32) return AVERROR_INVALIDDATA; if (AV_RB32(buf) != RAS_MAGIC) { av_log(avctx, AV_LOG_ERROR, "this is not sunras encoded data\n"); return AVERROR_INVALIDDATA; } w = AV_RB32(buf + 4); h = AV_RB32(buf + 8); depth = AV_RB32(buf + 12); type = AV_RB32(buf + 20); maptype = AV_RB32(buf + 24); maplength = AV_RB32(buf + 28); buf += 32; if (type == RT_EXPERIMENTAL) { avpriv_request_sample(avctx, "TIFF/IFF/EXPERIMENTAL (compression) type"); return AVERROR_PATCHWELCOME; } if (type > RT_FORMAT_IFF) { av_log(avctx, AV_LOG_ERROR, "invalid (compression) type\n"); return AVERROR_INVALIDDATA; } if (maptype == RMT_RAW) { avpriv_request_sample(avctx, "Unknown colormap type"); return AVERROR_PATCHWELCOME; } if (maptype > RMT_RAW) { av_log(avctx, AV_LOG_ERROR, "invalid colormap type\n"); return AVERROR_INVALIDDATA; } if (type == RT_FORMAT_TIFF || type == RT_FORMAT_IFF) { av_log(avctx, AV_LOG_ERROR, "unsupported (compression) type\n"); return -1; } switch (depth) { case 1: avctx->pix_fmt = maplength ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_MONOWHITE; break; case 4: avctx->pix_fmt = maplength ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_NONE; break; case 8: avctx->pix_fmt = maplength ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_GRAY8; break; case 24: avctx->pix_fmt = (type == RT_FORMAT_RGB) ? AV_PIX_FMT_RGB24 : AV_PIX_FMT_BGR24; break; case 32: avctx->pix_fmt = (type == RT_FORMAT_RGB) ? AV_PIX_FMT_0RGB : AV_PIX_FMT_0BGR; break; default: av_log(avctx, AV_LOG_ERROR, "invalid depth\n"); return AVERROR_INVALIDDATA; } ret = ff_set_dimensions(avctx, w, h); if (ret < 0) return ret; if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; p->pict_type = AV_PICTURE_TYPE_I; if (buf_end - buf < maplength) return AVERROR_INVALIDDATA; if (depth > 8 && maplength) { av_log(avctx, AV_LOG_WARNING, "useless colormap found or file is corrupted, trying to recover\n"); } else if (maplength) { unsigned int len = maplength / 3; if (maplength % 3 || maplength > 768) { av_log(avctx, AV_LOG_WARNING, "invalid colormap length\n"); return AVERROR_INVALIDDATA; } ptr = p->data[1]; for (x = 0; x < len; x++, ptr += 4) *(uint32_t *)ptr = (0xFFU<<24) + (buf[x]<<16) + (buf[len+x]<<8) + buf[len+len+x]; } buf += maplength; if (maplength && depth < 8) { ptr = ptr2 = av_malloc_array((w + 15), h); if (!ptr) return AVERROR(ENOMEM); stride = (w + 15 >> 3) * depth; } else { ptr = p->data[0]; stride = p->linesize[0]; } len = (depth * w + 7) >> 3; alen = len + (len & 1); if (type == RT_BYTE_ENCODED) { int value, run; uint8_t *end = ptr + h * stride; x = 0; while (ptr != end && buf < buf_end) { run = 1; if (buf_end - buf < 1) return AVERROR_INVALIDDATA; if ((value = *buf++) == RLE_TRIGGER) { run = *buf++ + 1; if (run != 1) value = *buf++; } while (run--) { if (x < len) ptr[x] = value; if (++x >= alen) { x = 0; ptr += stride; if (ptr == end) break; } } } } else { for (y = 0; y < h; y++) { if (buf_end - buf < len) break; memcpy(ptr, buf, len); ptr += stride; buf += alen; } } if (avctx->pix_fmt == AV_PIX_FMT_PAL8 && depth < 8) { uint8_t *ptr_free = ptr2; ptr = p->data[0]; for (y=0; y<h; y++) { for (x = 0; x < (w + 7 >> 3) * depth; x++) { if (depth == 1) { ptr[8*x] = ptr2[x] >> 7; ptr[8*x+1] = ptr2[x] >> 6 & 1; ptr[8*x+2] = ptr2[x] >> 5 & 1; ptr[8*x+3] = ptr2[x] >> 4 & 1; ptr[8*x+4] = ptr2[x] >> 3 & 1; ptr[8*x+5] = ptr2[x] >> 2 & 1; ptr[8*x+6] = ptr2[x] >> 1 & 1; ptr[8*x+7] = ptr2[x] & 1; } else { ptr[2*x] = ptr2[x] >> 4; ptr[2*x+1] = ptr2[x] & 0xF; } } ptr += p->linesize[0]; ptr2 += (w + 15 >> 3) * depth; } av_freep(&ptr_free); } *got_frame = 1; return buf - bufstart; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; const uint8_t *VAR_5 = VAR_3->VAR_1 + VAR_3->size; AVFrame * const p = VAR_1; unsigned int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_19, VAR_16; uint8_t *ptr, *ptr2 = NULL; const uint8_t *VAR_17 = VAR_4; int VAR_18; if (VAR_3->size < 32) return AVERROR_INVALIDDATA; if (AV_RB32(VAR_4) != RAS_MAGIC) { av_log(VAR_0, AV_LOG_ERROR, "this is not sunras encoded VAR_1\n"); return AVERROR_INVALIDDATA; } VAR_6 = AV_RB32(VAR_4 + 4); VAR_7 = AV_RB32(VAR_4 + 8); VAR_8 = AV_RB32(VAR_4 + 12); VAR_9 = AV_RB32(VAR_4 + 20); VAR_10 = AV_RB32(VAR_4 + 24); VAR_11 = AV_RB32(VAR_4 + 28); VAR_4 += 32; if (VAR_9 == RT_EXPERIMENTAL) { avpriv_request_sample(VAR_0, "TIFF/IFF/EXPERIMENTAL (compression) VAR_9"); return AVERROR_PATCHWELCOME; } if (VAR_9 > RT_FORMAT_IFF) { av_log(VAR_0, AV_LOG_ERROR, "invalid (compression) VAR_9\n"); return AVERROR_INVALIDDATA; } if (VAR_10 == RMT_RAW) { avpriv_request_sample(VAR_0, "Unknown colormap VAR_9"); return AVERROR_PATCHWELCOME; } if (VAR_10 > RMT_RAW) { av_log(VAR_0, AV_LOG_ERROR, "invalid colormap VAR_9\n"); return AVERROR_INVALIDDATA; } if (VAR_9 == RT_FORMAT_TIFF || VAR_9 == RT_FORMAT_IFF) { av_log(VAR_0, AV_LOG_ERROR, "unsupported (compression) VAR_9\n"); return -1; } switch (VAR_8) { case 1: VAR_0->pix_fmt = VAR_11 ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_MONOWHITE; break; case 4: VAR_0->pix_fmt = VAR_11 ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_NONE; break; case 8: VAR_0->pix_fmt = VAR_11 ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_GRAY8; break; case 24: VAR_0->pix_fmt = (VAR_9 == RT_FORMAT_RGB) ? AV_PIX_FMT_RGB24 : AV_PIX_FMT_BGR24; break; case 32: VAR_0->pix_fmt = (VAR_9 == RT_FORMAT_RGB) ? AV_PIX_FMT_0RGB : AV_PIX_FMT_0BGR; break; default: av_log(VAR_0, AV_LOG_ERROR, "invalid VAR_8\n"); return AVERROR_INVALIDDATA; } VAR_18 = ff_set_dimensions(VAR_0, VAR_6, VAR_7); if (VAR_18 < 0) return VAR_18; if ((VAR_18 = ff_get_buffer(VAR_0, p, 0)) < 0) return VAR_18; p->pict_type = AV_PICTURE_TYPE_I; if (VAR_5 - VAR_4 < VAR_11) return AVERROR_INVALIDDATA; if (VAR_8 > 8 && VAR_11) { av_log(VAR_0, AV_LOG_WARNING, "useless colormap found or file is corrupted, trying to recover\n"); } else if (VAR_11) { unsigned int VAR_19 = VAR_11 / 3; if (VAR_11 % 3 || VAR_11 > 768) { av_log(VAR_0, AV_LOG_WARNING, "invalid colormap length\n"); return AVERROR_INVALIDDATA; } ptr = p->VAR_1[1]; for (VAR_13 = 0; VAR_13 < VAR_19; VAR_13++, ptr += 4) *(uint32_t *)ptr = (0xFFU<<24) + (VAR_4[VAR_13]<<16) + (VAR_4[VAR_19+VAR_13]<<8) + VAR_4[VAR_19+VAR_19+VAR_13]; } VAR_4 += VAR_11; if (VAR_11 && VAR_8 < 8) { ptr = ptr2 = av_malloc_array((VAR_6 + 15), VAR_7); if (!ptr) return AVERROR(ENOMEM); VAR_12 = (VAR_6 + 15 >> 3) * VAR_8; } else { ptr = p->VAR_1[0]; VAR_12 = p->linesize[0]; } VAR_19 = (VAR_8 * VAR_6 + 7) >> 3; VAR_16 = VAR_19 + (VAR_19 & 1); if (VAR_9 == RT_BYTE_ENCODED) { int VAR_19, VAR_20; uint8_t *end = ptr + VAR_7 * VAR_12; VAR_13 = 0; while (ptr != end && VAR_4 < VAR_5) { VAR_20 = 1; if (VAR_5 - VAR_4 < 1) return AVERROR_INVALIDDATA; if ((VAR_19 = *VAR_4++) == RLE_TRIGGER) { VAR_20 = *VAR_4++ + 1; if (VAR_20 != 1) VAR_19 = *VAR_4++; } while (VAR_20--) { if (VAR_13 < VAR_19) ptr[VAR_13] = VAR_19; if (++VAR_13 >= VAR_16) { VAR_13 = 0; ptr += VAR_12; if (ptr == end) break; } } } } else { for (VAR_14 = 0; VAR_14 < VAR_7; VAR_14++) { if (VAR_5 - VAR_4 < VAR_19) break; memcpy(ptr, VAR_4, VAR_19); ptr += VAR_12; VAR_4 += VAR_16; } } if (VAR_0->pix_fmt == AV_PIX_FMT_PAL8 && VAR_8 < 8) { uint8_t *ptr_free = ptr2; ptr = p->VAR_1[0]; for (VAR_14=0; VAR_14<VAR_7; VAR_14++) { for (VAR_13 = 0; VAR_13 < (VAR_6 + 7 >> 3) * VAR_8; VAR_13++) { if (VAR_8 == 1) { ptr[8*VAR_13] = ptr2[VAR_13] >> 7; ptr[8*VAR_13+1] = ptr2[VAR_13] >> 6 & 1; ptr[8*VAR_13+2] = ptr2[VAR_13] >> 5 & 1; ptr[8*VAR_13+3] = ptr2[VAR_13] >> 4 & 1; ptr[8*VAR_13+4] = ptr2[VAR_13] >> 3 & 1; ptr[8*VAR_13+5] = ptr2[VAR_13] >> 2 & 1; ptr[8*VAR_13+6] = ptr2[VAR_13] >> 1 & 1; ptr[8*VAR_13+7] = ptr2[VAR_13] & 1; } else { ptr[2*VAR_13] = ptr2[VAR_13] >> 4; ptr[2*VAR_13+1] = ptr2[VAR_13] & 0xF; } } ptr += p->linesize[0]; ptr2 += (VAR_6 + 15 >> 3) * VAR_8; } av_freep(&ptr_free); } *VAR_2 = 1; return VAR_4 - VAR_17; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "const uint8_t *VAR_5 = VAR_3->VAR_1 + VAR_3->size;", "AVFrame * const p = VAR_1;", "unsigned int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_19, VAR_16;", "uint8_t *ptr, *ptr2 = NULL;", "const uint8_t *VAR_17 = VAR_4;", "int VAR_18;", "if (VAR_3->size < 32)\nreturn AVERROR_INVALIDDATA;", "if (AV_RB32(VAR_4) != RAS_MAGIC) {", "av_log(VAR_0, AV_LOG_ERROR, \"this is not sunras encoded VAR_1\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_6 = AV_RB32(VAR_4 + 4);", "VAR_7 = AV_RB32(VAR_4 + 8);", "VAR_8 = AV_RB32(VAR_4 + 12);", "VAR_9 = AV_RB32(VAR_4 + 20);", "VAR_10 = AV_RB32(VAR_4 + 24);", "VAR_11 = AV_RB32(VAR_4 + 28);", "VAR_4 += 32;", "if (VAR_9 == RT_EXPERIMENTAL) {", "avpriv_request_sample(VAR_0, \"TIFF/IFF/EXPERIMENTAL (compression) VAR_9\");", "return AVERROR_PATCHWELCOME;", "}", "if (VAR_9 > RT_FORMAT_IFF) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid (compression) VAR_9\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (VAR_10 == RMT_RAW) {", "avpriv_request_sample(VAR_0, \"Unknown colormap VAR_9\");", "return AVERROR_PATCHWELCOME;", "}", "if (VAR_10 > RMT_RAW) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid colormap VAR_9\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (VAR_9 == RT_FORMAT_TIFF || VAR_9 == RT_FORMAT_IFF) {", "av_log(VAR_0, AV_LOG_ERROR, \"unsupported (compression) VAR_9\\n\");", "return -1;", "}", "switch (VAR_8) {", "case 1:\nVAR_0->pix_fmt = VAR_11 ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_MONOWHITE;", "break;", "case 4:\nVAR_0->pix_fmt = VAR_11 ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_NONE;", "break;", "case 8:\nVAR_0->pix_fmt = VAR_11 ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_GRAY8;", "break;", "case 24:\nVAR_0->pix_fmt = (VAR_9 == RT_FORMAT_RGB) ? AV_PIX_FMT_RGB24 : AV_PIX_FMT_BGR24;", "break;", "case 32:\nVAR_0->pix_fmt = (VAR_9 == RT_FORMAT_RGB) ? AV_PIX_FMT_0RGB : AV_PIX_FMT_0BGR;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"invalid VAR_8\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_18 = ff_set_dimensions(VAR_0, VAR_6, VAR_7);", "if (VAR_18 < 0)\nreturn VAR_18;", "if ((VAR_18 = ff_get_buffer(VAR_0, p, 0)) < 0)\nreturn VAR_18;", "p->pict_type = AV_PICTURE_TYPE_I;", "if (VAR_5 - VAR_4 < VAR_11)\nreturn AVERROR_INVALIDDATA;", "if (VAR_8 > 8 && VAR_11) {", "av_log(VAR_0, AV_LOG_WARNING, \"useless colormap found or file is corrupted, trying to recover\\n\");", "} else if (VAR_11) {", "unsigned int VAR_19 = VAR_11 / 3;", "if (VAR_11 % 3 || VAR_11 > 768) {", "av_log(VAR_0, AV_LOG_WARNING, \"invalid colormap length\\n\");", "return AVERROR_INVALIDDATA;", "}", "ptr = p->VAR_1[1];", "for (VAR_13 = 0; VAR_13 < VAR_19; VAR_13++, ptr += 4)", "*(uint32_t *)ptr = (0xFFU<<24) + (VAR_4[VAR_13]<<16) + (VAR_4[VAR_19+VAR_13]<<8) + VAR_4[VAR_19+VAR_19+VAR_13];", "}", "VAR_4 += VAR_11;", "if (VAR_11 && VAR_8 < 8) {", "ptr = ptr2 = av_malloc_array((VAR_6 + 15), VAR_7);", "if (!ptr)\nreturn AVERROR(ENOMEM);", "VAR_12 = (VAR_6 + 15 >> 3) * VAR_8;", "} else {", "ptr = p->VAR_1[0];", "VAR_12 = p->linesize[0];", "}", "VAR_19 = (VAR_8 * VAR_6 + 7) >> 3;", "VAR_16 = VAR_19 + (VAR_19 & 1);", "if (VAR_9 == RT_BYTE_ENCODED) {", "int VAR_19, VAR_20;", "uint8_t *end = ptr + VAR_7 * VAR_12;", "VAR_13 = 0;", "while (ptr != end && VAR_4 < VAR_5) {", "VAR_20 = 1;", "if (VAR_5 - VAR_4 < 1)\nreturn AVERROR_INVALIDDATA;", "if ((VAR_19 = *VAR_4++) == RLE_TRIGGER) {", "VAR_20 = *VAR_4++ + 1;", "if (VAR_20 != 1)\nVAR_19 = *VAR_4++;", "}", "while (VAR_20--) {", "if (VAR_13 < VAR_19)\nptr[VAR_13] = VAR_19;", "if (++VAR_13 >= VAR_16) {", "VAR_13 = 0;", "ptr += VAR_12;", "if (ptr == end)\nbreak;", "}", "}", "}", "} else {", "for (VAR_14 = 0; VAR_14 < VAR_7; VAR_14++) {", "if (VAR_5 - VAR_4 < VAR_19)\nbreak;", "memcpy(ptr, VAR_4, VAR_19);", "ptr += VAR_12;", "VAR_4 += VAR_16;", "}", "}", "if (VAR_0->pix_fmt == AV_PIX_FMT_PAL8 && VAR_8 < 8) {", "uint8_t *ptr_free = ptr2;", "ptr = p->VAR_1[0];", "for (VAR_14=0; VAR_14<VAR_7; VAR_14++) {", "for (VAR_13 = 0; VAR_13 < (VAR_6 + 7 >> 3) * VAR_8; VAR_13++) {", "if (VAR_8 == 1) {", "ptr[8*VAR_13] = ptr2[VAR_13] >> 7;", "ptr[8*VAR_13+1] = ptr2[VAR_13] >> 6 & 1;", "ptr[8*VAR_13+2] = ptr2[VAR_13] >> 5 & 1;", "ptr[8*VAR_13+3] = ptr2[VAR_13] >> 4 & 1;", "ptr[8*VAR_13+4] = ptr2[VAR_13] >> 3 & 1;", "ptr[8*VAR_13+5] = ptr2[VAR_13] >> 2 & 1;", "ptr[8*VAR_13+6] = ptr2[VAR_13] >> 1 & 1;", "ptr[8*VAR_13+7] = ptr2[VAR_13] & 1;", "} else {", "ptr[2*VAR_13] = ptr2[VAR_13] >> 4;", "ptr[2*VAR_13+1] = ptr2[VAR_13] & 0xF;", "}", "}", "ptr += p->linesize[0];", "ptr2 += (VAR_6 + 15 >> 3) * VAR_8;", "}", "av_freep(&ptr_free);", "}", "*VAR_2 = 1;", "return VAR_4 - VAR_17;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143, 145 ], [ 149, 151 ], [ 155 ], [ 159, 161 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 223 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239 ], [ 241 ], [ 243, 245 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285, 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 349 ], [ 353 ], [ 355 ] ]
21,663
static int xan_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int ret, buf_size = avpkt->size; XanContext *s = avctx->priv_data; if (avctx->codec->id == CODEC_ID_XAN_WC3) { const uint8_t *buf_end = buf + buf_size; int tag = 0; while (buf_end - buf > 8 && tag != VGA__TAG) { unsigned *tmpptr; uint32_t new_pal; int size; int i; tag = bytestream_get_le32(&buf); size = bytestream_get_be32(&buf); size = FFMIN(size, buf_end - buf); switch (tag) { case PALT_TAG: if (size < PALETTE_SIZE) return AVERROR_INVALIDDATA; if (s->palettes_count >= PALETTES_MAX) return AVERROR_INVALIDDATA; tmpptr = av_realloc(s->palettes, (s->palettes_count + 1) * AVPALETTE_SIZE); if (!tmpptr) return AVERROR(ENOMEM); s->palettes = tmpptr; tmpptr += s->palettes_count * AVPALETTE_COUNT; for (i = 0; i < PALETTE_COUNT; i++) { #if RUNTIME_GAMMA int r = gamma_corr(*buf++); int g = gamma_corr(*buf++); int b = gamma_corr(*buf++); #else int r = gamma_lookup[*buf++]; int g = gamma_lookup[*buf++]; int b = gamma_lookup[*buf++]; #endif *tmpptr++ = (r << 16) | (g << 8) | b; } s->palettes_count++; break; case SHOT_TAG: if (size < 4) return AVERROR_INVALIDDATA; new_pal = bytestream_get_le32(&buf); if (new_pal < s->palettes_count) { s->cur_palette = new_pal; } else av_log(avctx, AV_LOG_ERROR, "Invalid palette selected\n"); break; case VGA__TAG: break; default: buf += size; break; } } buf_size = buf_end - buf; } if ((ret = avctx->get_buffer(avctx, &s->current_frame))) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } s->current_frame.reference = 3; if (!s->frame_size) s->frame_size = s->current_frame.linesize[0] * s->avctx->height; memcpy(s->current_frame.data[1], s->palettes + s->cur_palette * AVPALETTE_COUNT, AVPALETTE_SIZE); s->buf = buf; s->size = buf_size; xan_wc3_decode_frame(s); /* release the last frame if it is allocated */ if (s->last_frame.data[0]) avctx->release_buffer(avctx, &s->last_frame); *data_size = sizeof(AVFrame); *(AVFrame*)data = s->current_frame; /* shuffle frames */ FFSWAP(AVFrame, s->current_frame, s->last_frame); /* always report that the buffer was completely consumed */ return buf_size; }
false
FFmpeg
0872bb23b4bd2d94a8ba91070f706d1bc1c3ced8
static int xan_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int ret, buf_size = avpkt->size; XanContext *s = avctx->priv_data; if (avctx->codec->id == CODEC_ID_XAN_WC3) { const uint8_t *buf_end = buf + buf_size; int tag = 0; while (buf_end - buf > 8 && tag != VGA__TAG) { unsigned *tmpptr; uint32_t new_pal; int size; int i; tag = bytestream_get_le32(&buf); size = bytestream_get_be32(&buf); size = FFMIN(size, buf_end - buf); switch (tag) { case PALT_TAG: if (size < PALETTE_SIZE) return AVERROR_INVALIDDATA; if (s->palettes_count >= PALETTES_MAX) return AVERROR_INVALIDDATA; tmpptr = av_realloc(s->palettes, (s->palettes_count + 1) * AVPALETTE_SIZE); if (!tmpptr) return AVERROR(ENOMEM); s->palettes = tmpptr; tmpptr += s->palettes_count * AVPALETTE_COUNT; for (i = 0; i < PALETTE_COUNT; i++) { #if RUNTIME_GAMMA int r = gamma_corr(*buf++); int g = gamma_corr(*buf++); int b = gamma_corr(*buf++); #else int r = gamma_lookup[*buf++]; int g = gamma_lookup[*buf++]; int b = gamma_lookup[*buf++]; #endif *tmpptr++ = (r << 16) | (g << 8) | b; } s->palettes_count++; break; case SHOT_TAG: if (size < 4) return AVERROR_INVALIDDATA; new_pal = bytestream_get_le32(&buf); if (new_pal < s->palettes_count) { s->cur_palette = new_pal; } else av_log(avctx, AV_LOG_ERROR, "Invalid palette selected\n"); break; case VGA__TAG: break; default: buf += size; break; } } buf_size = buf_end - buf; } if ((ret = avctx->get_buffer(avctx, &s->current_frame))) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } s->current_frame.reference = 3; if (!s->frame_size) s->frame_size = s->current_frame.linesize[0] * s->avctx->height; memcpy(s->current_frame.data[1], s->palettes + s->cur_palette * AVPALETTE_COUNT, AVPALETTE_SIZE); s->buf = buf; s->size = buf_size; xan_wc3_decode_frame(s); if (s->last_frame.data[0]) avctx->release_buffer(avctx, &s->last_frame); *data_size = sizeof(AVFrame); *(AVFrame*)data = s->current_frame; FFSWAP(AVFrame, s->current_frame, s->last_frame); return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5, VAR_6 = VAR_3->VAR_10; XanContext *s = VAR_0->priv_data; if (VAR_0->codec->id == CODEC_ID_XAN_WC3) { const uint8_t *VAR_7 = VAR_4 + VAR_6; int VAR_8 = 0; while (VAR_7 - VAR_4 > 8 && VAR_8 != VGA__TAG) { unsigned *VAR_9; uint32_t new_pal; int VAR_10; int VAR_11; VAR_8 = bytestream_get_le32(&VAR_4); VAR_10 = bytestream_get_be32(&VAR_4); VAR_10 = FFMIN(VAR_10, VAR_7 - VAR_4); switch (VAR_8) { case PALT_TAG: if (VAR_10 < PALETTE_SIZE) return AVERROR_INVALIDDATA; if (s->palettes_count >= PALETTES_MAX) return AVERROR_INVALIDDATA; VAR_9 = av_realloc(s->palettes, (s->palettes_count + 1) * AVPALETTE_SIZE); if (!VAR_9) return AVERROR(ENOMEM); s->palettes = VAR_9; VAR_9 += s->palettes_count * AVPALETTE_COUNT; for (VAR_11 = 0; VAR_11 < PALETTE_COUNT; VAR_11++) { #if RUNTIME_GAMMA int r = gamma_corr(*VAR_4++); int g = gamma_corr(*VAR_4++); int b = gamma_corr(*VAR_4++); #else int r = gamma_lookup[*VAR_4++]; int g = gamma_lookup[*VAR_4++]; int b = gamma_lookup[*VAR_4++]; #endif *VAR_9++ = (r << 16) | (g << 8) | b; } s->palettes_count++; break; case SHOT_TAG: if (VAR_10 < 4) return AVERROR_INVALIDDATA; new_pal = bytestream_get_le32(&VAR_4); if (new_pal < s->palettes_count) { s->cur_palette = new_pal; } else av_log(VAR_0, AV_LOG_ERROR, "Invalid palette selected\n"); break; case VGA__TAG: break; default: VAR_4 += VAR_10; break; } } VAR_6 = VAR_7 - VAR_4; } if ((VAR_5 = VAR_0->get_buffer(VAR_0, &s->current_frame))) { av_log(s->VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_5; } s->current_frame.reference = 3; if (!s->frame_size) s->frame_size = s->current_frame.linesize[0] * s->VAR_0->height; memcpy(s->current_frame.VAR_1[1], s->palettes + s->cur_palette * AVPALETTE_COUNT, AVPALETTE_SIZE); s->VAR_4 = VAR_4; s->VAR_10 = VAR_6; xan_wc3_decode_frame(s); if (s->last_frame.VAR_1[0]) VAR_0->release_buffer(VAR_0, &s->last_frame); *VAR_2 = sizeof(AVFrame); *(AVFrame*)VAR_1 = s->current_frame; FFSWAP(AVFrame, s->current_frame, s->last_frame); return VAR_6; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5, VAR_6 = VAR_3->VAR_10;", "XanContext *s = VAR_0->priv_data;", "if (VAR_0->codec->id == CODEC_ID_XAN_WC3) {", "const uint8_t *VAR_7 = VAR_4 + VAR_6;", "int VAR_8 = 0;", "while (VAR_7 - VAR_4 > 8 && VAR_8 != VGA__TAG) {", "unsigned *VAR_9;", "uint32_t new_pal;", "int VAR_10;", "int VAR_11;", "VAR_8 = bytestream_get_le32(&VAR_4);", "VAR_10 = bytestream_get_be32(&VAR_4);", "VAR_10 = FFMIN(VAR_10, VAR_7 - VAR_4);", "switch (VAR_8) {", "case PALT_TAG:\nif (VAR_10 < PALETTE_SIZE)\nreturn AVERROR_INVALIDDATA;", "if (s->palettes_count >= PALETTES_MAX)\nreturn AVERROR_INVALIDDATA;", "VAR_9 = av_realloc(s->palettes, (s->palettes_count + 1) * AVPALETTE_SIZE);", "if (!VAR_9)\nreturn AVERROR(ENOMEM);", "s->palettes = VAR_9;", "VAR_9 += s->palettes_count * AVPALETTE_COUNT;", "for (VAR_11 = 0; VAR_11 < PALETTE_COUNT; VAR_11++) {", "#if RUNTIME_GAMMA\nint r = gamma_corr(*VAR_4++);", "int g = gamma_corr(*VAR_4++);", "int b = gamma_corr(*VAR_4++);", "#else\nint r = gamma_lookup[*VAR_4++];", "int g = gamma_lookup[*VAR_4++];", "int b = gamma_lookup[*VAR_4++];", "#endif\n*VAR_9++ = (r << 16) | (g << 8) | b;", "}", "s->palettes_count++;", "break;", "case SHOT_TAG:\nif (VAR_10 < 4)\nreturn AVERROR_INVALIDDATA;", "new_pal = bytestream_get_le32(&VAR_4);", "if (new_pal < s->palettes_count) {", "s->cur_palette = new_pal;", "} else", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid palette selected\\n\");", "break;", "case VGA__TAG:\nbreak;", "default:\nVAR_4 += VAR_10;", "break;", "}", "}", "VAR_6 = VAR_7 - VAR_4;", "}", "if ((VAR_5 = VAR_0->get_buffer(VAR_0, &s->current_frame))) {", "av_log(s->VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return VAR_5;", "}", "s->current_frame.reference = 3;", "if (!s->frame_size)\ns->frame_size = s->current_frame.linesize[0] * s->VAR_0->height;", "memcpy(s->current_frame.VAR_1[1], s->palettes + s->cur_palette * AVPALETTE_COUNT, AVPALETTE_SIZE);", "s->VAR_4 = VAR_4;", "s->VAR_10 = VAR_6;", "xan_wc3_decode_frame(s);", "if (s->last_frame.VAR_1[0])\nVAR_0->release_buffer(VAR_0, &s->last_frame);", "*VAR_2 = sizeof(AVFrame);", "*(AVFrame*)VAR_1 = s->current_frame;", "FFSWAP(AVFrame, s->current_frame, s->last_frame);", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43, 45 ], [ 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 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 ], [ 137, 139 ], [ 143 ], [ 147 ], [ 149 ], [ 153 ], [ 159, 161 ], [ 165 ], [ 167 ], [ 173 ], [ 179 ], [ 181 ] ]
21,666
av_cold int MPV_encode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; int i; int chroma_h_shift, chroma_v_shift; MPV_encode_defaults(s); switch (avctx->codec_id) { case CODEC_ID_MPEG2VIDEO: if(avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P){ av_log(avctx, AV_LOG_ERROR, "only YUV420 and YUV422 are supported\n"); return -1; } break; case CODEC_ID_LJPEG: case CODEC_ID_MJPEG: if(avctx->pix_fmt != PIX_FMT_YUVJ420P && avctx->pix_fmt != PIX_FMT_YUVJ422P && avctx->pix_fmt != PIX_FMT_RGB32 && ((avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P) || avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL)){ av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n"); return -1; } break; default: if(avctx->pix_fmt != PIX_FMT_YUV420P){ av_log(avctx, AV_LOG_ERROR, "only YUV420 is supported\n"); return -1; } } switch (avctx->pix_fmt) { case PIX_FMT_YUVJ422P: case PIX_FMT_YUV422P: s->chroma_format = CHROMA_422; break; case PIX_FMT_YUVJ420P: case PIX_FMT_YUV420P: default: s->chroma_format = CHROMA_420; break; } s->bit_rate = avctx->bit_rate; s->width = avctx->width; s->height = avctx->height; if(avctx->gop_size > 600 && avctx->strict_std_compliance>FF_COMPLIANCE_EXPERIMENTAL){ av_log(avctx, AV_LOG_ERROR, "Warning keyframe interval too large! reducing it ...\n"); avctx->gop_size=600; } s->gop_size = avctx->gop_size; s->avctx = avctx; s->flags= avctx->flags; s->flags2= avctx->flags2; s->max_b_frames= avctx->max_b_frames; s->codec_id= avctx->codec->id; s->luma_elim_threshold = avctx->luma_elim_threshold; s->chroma_elim_threshold= avctx->chroma_elim_threshold; s->strict_std_compliance= avctx->strict_std_compliance; s->data_partitioning= avctx->flags & CODEC_FLAG_PART; s->quarter_sample= (avctx->flags & CODEC_FLAG_QPEL)!=0; s->mpeg_quant= avctx->mpeg_quant; s->rtp_mode= !!avctx->rtp_payload_size; s->intra_dc_precision= avctx->intra_dc_precision; s->user_specified_pts = AV_NOPTS_VALUE; if (s->gop_size <= 1) { s->intra_only = 1; s->gop_size = 12; } else { s->intra_only = 0; } s->me_method = avctx->me_method; /* Fixed QSCALE */ s->fixed_qscale = !!(avctx->flags & CODEC_FLAG_QSCALE); s->adaptive_quant= ( s->avctx->lumi_masking || s->avctx->dark_masking || s->avctx->temporal_cplx_masking || s->avctx->spatial_cplx_masking || s->avctx->p_masking || s->avctx->border_masking || (s->flags&CODEC_FLAG_QP_RD)) && !s->fixed_qscale; s->obmc= !!(s->flags & CODEC_FLAG_OBMC); s->loop_filter= !!(s->flags & CODEC_FLAG_LOOP_FILTER); s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN); s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC); s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT); if(avctx->rc_max_rate && !avctx->rc_buffer_size){ av_log(avctx, AV_LOG_ERROR, "a vbv buffer size is needed, for encoding with a maximum bitrate\n"); return -1; } if(avctx->rc_min_rate && avctx->rc_max_rate != avctx->rc_min_rate){ av_log(avctx, AV_LOG_INFO, "Warning min_rate > 0 but min_rate != max_rate isn't recommended!\n"); } if(avctx->rc_min_rate && avctx->rc_min_rate > avctx->bit_rate){ av_log(avctx, AV_LOG_ERROR, "bitrate below min bitrate\n"); return -1; } if(avctx->rc_max_rate && avctx->rc_max_rate < avctx->bit_rate){ av_log(avctx, AV_LOG_INFO, "bitrate above max bitrate\n"); return -1; } if(avctx->rc_max_rate && avctx->rc_max_rate == avctx->bit_rate && avctx->rc_max_rate != avctx->rc_min_rate){ av_log(avctx, AV_LOG_INFO, "impossible bitrate constraints, this will fail\n"); } if(avctx->rc_buffer_size && avctx->bit_rate*av_q2d(avctx->time_base) > avctx->rc_buffer_size){ av_log(avctx, AV_LOG_ERROR, "VBV buffer too small for bitrate\n"); return -1; } if(avctx->bit_rate*av_q2d(avctx->time_base) > avctx->bit_rate_tolerance){ av_log(avctx, AV_LOG_ERROR, "bitrate tolerance too small for bitrate\n"); return -1; } if( s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO) && 90000LL * (avctx->rc_buffer_size-1) > s->avctx->rc_max_rate*0xFFFFLL){ av_log(avctx, AV_LOG_INFO, "Warning vbv_delay will be set to 0xFFFF (=VBR) as the specified vbv buffer is too large for the given bitrate!\n"); } if((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P && s->codec_id != CODEC_ID_FLV1){ av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n"); return -1; } if(s->obmc && s->avctx->mb_decision != FF_MB_DECISION_SIMPLE){ av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with simple mb decision\n"); return -1; } if(s->obmc && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P){ av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with H263(+)\n"); return -1; } if(s->quarter_sample && s->codec_id != CODEC_ID_MPEG4){ av_log(avctx, AV_LOG_ERROR, "qpel not supported by codec\n"); return -1; } if(s->data_partitioning && s->codec_id != CODEC_ID_MPEG4){ av_log(avctx, AV_LOG_ERROR, "data partitioning not supported by codec\n"); return -1; } if(s->max_b_frames && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "b frames not supported by codec\n"); return -1; } if((s->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN)) && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n"); return -1; } if(s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4){ //FIXME mpeg2 uses that too av_log(avctx, AV_LOG_ERROR, "mpeg2 style quantization not supported by codec\n"); return -1; } if((s->flags & CODEC_FLAG_CBP_RD) && !avctx->trellis){ av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n"); return -1; } if((s->flags & CODEC_FLAG_QP_RD) && s->avctx->mb_decision != FF_MB_DECISION_RD){ av_log(avctx, AV_LOG_ERROR, "QP RD needs mbd=2\n"); return -1; } if(s->avctx->scenechange_threshold < 1000000000 && (s->flags & CODEC_FLAG_CLOSED_GOP)){ av_log(avctx, AV_LOG_ERROR, "closed gop with scene change detection are not supported yet, set threshold to 1000000000\n"); return -1; } if((s->flags2 & CODEC_FLAG2_INTRA_VLC) && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "intra vlc table not supported by codec\n"); return -1; } if(s->flags & CODEC_FLAG_LOW_DELAY){ if (s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "low delay forcing is only available for mpeg2\n"); return -1; } if (s->max_b_frames != 0){ av_log(avctx, AV_LOG_ERROR, "b frames cannot be used with low delay\n"); return -1; } } if(s->q_scale_type == 1){ if(s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "non linear quant is only available for mpeg2\n"); return -1; } if(avctx->qmax > 12){ av_log(avctx, AV_LOG_ERROR, "non linear quant only supports qmax <= 12 currently\n"); return -1; } } if(s->avctx->thread_count > 1 && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO && (s->codec_id != CODEC_ID_H263P || !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT))){ av_log(avctx, AV_LOG_ERROR, "multi threaded encoding not supported by codec\n"); return -1; } if(s->avctx->thread_count < 1){ av_log(avctx, AV_LOG_ERROR, "automatic thread number detection not supported by codec, patch welcome\n"); return -1; } if(s->avctx->thread_count > 1) s->rtp_mode= 1; if(!avctx->time_base.den || !avctx->time_base.num){ av_log(avctx, AV_LOG_ERROR, "framerate not set\n"); return -1; } i= (INT_MAX/2+128)>>8; if(avctx->me_threshold >= i){ av_log(avctx, AV_LOG_ERROR, "me_threshold too large, max is %d\n", i - 1); return -1; } if(avctx->mb_threshold >= i){ av_log(avctx, AV_LOG_ERROR, "mb_threshold too large, max is %d\n", i - 1); return -1; } if(avctx->b_frame_strategy && (avctx->flags&CODEC_FLAG_PASS2)){ av_log(avctx, AV_LOG_INFO, "notice: b_frame_strategy only affects the first pass\n"); avctx->b_frame_strategy = 0; } i= av_gcd(avctx->time_base.den, avctx->time_base.num); if(i > 1){ av_log(avctx, AV_LOG_INFO, "removing common factors from framerate\n"); avctx->time_base.den /= i; avctx->time_base.num /= i; // return -1; } if(s->codec_id==CODEC_ID_MJPEG){ s->intra_quant_bias= 1<<(QUANT_BIAS_SHIFT-1); //(a + x/2)/x s->inter_quant_bias= 0; }else if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO){ s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3); //(a + x*3/8)/x s->inter_quant_bias= 0; }else{ s->intra_quant_bias=0; s->inter_quant_bias=-(1<<(QUANT_BIAS_SHIFT-2)); //(a - x/4)/x } if(avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS) s->intra_quant_bias= avctx->intra_quant_bias; if(avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS) s->inter_quant_bias= avctx->inter_quant_bias; avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, &chroma_v_shift); if(avctx->codec_id == CODEC_ID_MPEG4 && s->avctx->time_base.den > (1<<16)-1){ av_log(avctx, AV_LOG_ERROR, "timebase not supported by mpeg 4 standard\n"); return -1; } s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1; switch(avctx->codec->id) { case CODEC_ID_MPEG1VIDEO: s->out_format = FMT_MPEG1; s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; case CODEC_ID_MPEG2VIDEO: s->out_format = FMT_MPEG1; s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); s->rtp_mode= 1; break; case CODEC_ID_LJPEG: case CODEC_ID_MJPEG: s->out_format = FMT_MJPEG; s->intra_only = 1; /* force intra only for jpeg */ if(avctx->codec->id == CODEC_ID_MJPEG || avctx->pix_fmt != PIX_FMT_BGRA){ s->mjpeg_vsample[0] = 2; s->mjpeg_vsample[1] = 2>>chroma_v_shift; s->mjpeg_vsample[2] = 2>>chroma_v_shift; s->mjpeg_hsample[0] = 2; s->mjpeg_hsample[1] = 2>>chroma_h_shift; s->mjpeg_hsample[2] = 2>>chroma_h_shift; }else{ s->mjpeg_vsample[0] = s->mjpeg_hsample[0] = s->mjpeg_vsample[1] = s->mjpeg_hsample[1] = s->mjpeg_vsample[2] = s->mjpeg_hsample[2] = 1; } if (!(CONFIG_MJPEG_ENCODER || CONFIG_LJPEG_ENCODER) || ff_mjpeg_encode_init(s) < 0) return -1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H261: if (!CONFIG_H261_ENCODER) return -1; if (ff_h261_get_picture_format(s->width, s->height) < 0) { av_log(avctx, AV_LOG_ERROR, "The specified picture size of %dx%d is not valid for the H.261 codec.\nValid sizes are 176x144, 352x288\n", s->width, s->height); return -1; } s->out_format = FMT_H261; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H263: if (!CONFIG_H263_ENCODER) return -1; if (h263_get_picture_format(s->width, s->height) == 7) { av_log(avctx, AV_LOG_INFO, "The specified picture size of %dx%d is not valid for the H.263 codec.\nValid sizes are 128x96, 176x144, 352x288, 704x576, and 1408x1152. Try H.263+.\n", s->width, s->height); return -1; } s->out_format = FMT_H263; s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H263P: s->out_format = FMT_H263; s->h263_plus = 1; /* Fx */ s->umvplus = (avctx->flags & CODEC_FLAG_H263P_UMV) ? 1:0; s->h263_aic= (avctx->flags & CODEC_FLAG_AC_PRED) ? 1:0; s->modified_quant= s->h263_aic; s->alt_inter_vlc= (avctx->flags & CODEC_FLAG_H263P_AIV) ? 1:0; s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0; s->loop_filter= (avctx->flags & CODEC_FLAG_LOOP_FILTER) ? 1:0; s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus; s->h263_slice_structured= (s->flags & CODEC_FLAG_H263P_SLICE_STRUCT) ? 1:0; /* /Fx */ /* These are just to be sure */ avctx->delay=0; s->low_delay=1; break; case CODEC_ID_FLV1: s->out_format = FMT_H263; s->h263_flv = 2; /* format = 1; 11-bit codes */ s->unrestricted_mv = 1; s->rtp_mode=0; /* don't allow GOB */ avctx->delay=0; s->low_delay=1; break; case CODEC_ID_RV10: s->out_format = FMT_H263; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_RV20: s->out_format = FMT_H263; avctx->delay=0; s->low_delay=1; s->modified_quant=1; s->h263_aic=1; s->h263_plus=1; s->loop_filter=1; s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus; break; case CODEC_ID_MPEG4: s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; s->low_delay= s->max_b_frames ? 0 : 1; avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; case CODEC_ID_MSMPEG4V1: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_MSMPEG4V2: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 2; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_MSMPEG4V3: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 3; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_WMV1: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 4; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_WMV2: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 5; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; default: return -1; } avctx->has_b_frames= !s->low_delay; s->encoding = 1; s->progressive_frame= s->progressive_sequence= !(avctx->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN)); /* init */ if (MPV_common_init(s) < 0) return -1; if(!s->dct_quantize) s->dct_quantize = dct_quantize_c; if(!s->denoise_dct) s->denoise_dct = denoise_dct_c; s->fast_dct_quantize = s->dct_quantize; if(avctx->trellis) s->dct_quantize = dct_quantize_trellis_c; if((CONFIG_H263P_ENCODER || CONFIG_RV20_ENCODER) && s->modified_quant) s->chroma_qscale_table= ff_h263_chroma_qscale_table; s->quant_precision=5; ff_set_cmp(&s->dsp, s->dsp.ildct_cmp, s->avctx->ildct_cmp); ff_set_cmp(&s->dsp, s->dsp.frame_skip_cmp, s->avctx->frame_skip_cmp); if (CONFIG_H261_ENCODER && s->out_format == FMT_H261) ff_h261_encode_init(s); if (CONFIG_ANY_H263_ENCODER && s->out_format == FMT_H263) h263_encode_init(s); if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version) ff_msmpeg4_encode_init(s); if ((CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) && s->out_format == FMT_MPEG1) ff_mpeg1_encode_init(s); /* init q matrix */ for(i=0;i<64;i++) { int j= s->dsp.idct_permutation[i]; if(CONFIG_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->mpeg_quant){ s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i]; s->inter_matrix[j] = ff_mpeg4_default_non_intra_matrix[i]; }else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){ s->intra_matrix[j] = s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; }else { /* mpeg1/2 */ s->intra_matrix[j] = ff_mpeg1_default_intra_matrix[i]; s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; } if(s->avctx->intra_matrix) s->intra_matrix[j] = s->avctx->intra_matrix[i]; if(s->avctx->inter_matrix) s->inter_matrix[j] = s->avctx->inter_matrix[i]; } /* precompute matrix */ /* for mjpeg, we do include qscale in the matrix */ if (s->out_format != FMT_MJPEG) { ff_convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->intra_quant_bias, avctx->qmin, 31, 1); ff_convert_matrix(&s->dsp, s->q_inter_matrix, s->q_inter_matrix16, s->inter_matrix, s->inter_quant_bias, avctx->qmin, 31, 0); } if(ff_rate_control_init(s) < 0) return -1; return 0; }
false
FFmpeg
a1a63143f182729c40037b4fb8d8f9d84039e7ab
av_cold int MPV_encode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; int i; int chroma_h_shift, chroma_v_shift; MPV_encode_defaults(s); switch (avctx->codec_id) { case CODEC_ID_MPEG2VIDEO: if(avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P){ av_log(avctx, AV_LOG_ERROR, "only YUV420 and YUV422 are supported\n"); return -1; } break; case CODEC_ID_LJPEG: case CODEC_ID_MJPEG: if(avctx->pix_fmt != PIX_FMT_YUVJ420P && avctx->pix_fmt != PIX_FMT_YUVJ422P && avctx->pix_fmt != PIX_FMT_RGB32 && ((avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P) || avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL)){ av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n"); return -1; } break; default: if(avctx->pix_fmt != PIX_FMT_YUV420P){ av_log(avctx, AV_LOG_ERROR, "only YUV420 is supported\n"); return -1; } } switch (avctx->pix_fmt) { case PIX_FMT_YUVJ422P: case PIX_FMT_YUV422P: s->chroma_format = CHROMA_422; break; case PIX_FMT_YUVJ420P: case PIX_FMT_YUV420P: default: s->chroma_format = CHROMA_420; break; } s->bit_rate = avctx->bit_rate; s->width = avctx->width; s->height = avctx->height; if(avctx->gop_size > 600 && avctx->strict_std_compliance>FF_COMPLIANCE_EXPERIMENTAL){ av_log(avctx, AV_LOG_ERROR, "Warning keyframe interval too large! reducing it ...\n"); avctx->gop_size=600; } s->gop_size = avctx->gop_size; s->avctx = avctx; s->flags= avctx->flags; s->flags2= avctx->flags2; s->max_b_frames= avctx->max_b_frames; s->codec_id= avctx->codec->id; s->luma_elim_threshold = avctx->luma_elim_threshold; s->chroma_elim_threshold= avctx->chroma_elim_threshold; s->strict_std_compliance= avctx->strict_std_compliance; s->data_partitioning= avctx->flags & CODEC_FLAG_PART; s->quarter_sample= (avctx->flags & CODEC_FLAG_QPEL)!=0; s->mpeg_quant= avctx->mpeg_quant; s->rtp_mode= !!avctx->rtp_payload_size; s->intra_dc_precision= avctx->intra_dc_precision; s->user_specified_pts = AV_NOPTS_VALUE; if (s->gop_size <= 1) { s->intra_only = 1; s->gop_size = 12; } else { s->intra_only = 0; } s->me_method = avctx->me_method; s->fixed_qscale = !!(avctx->flags & CODEC_FLAG_QSCALE); s->adaptive_quant= ( s->avctx->lumi_masking || s->avctx->dark_masking || s->avctx->temporal_cplx_masking || s->avctx->spatial_cplx_masking || s->avctx->p_masking || s->avctx->border_masking || (s->flags&CODEC_FLAG_QP_RD)) && !s->fixed_qscale; s->obmc= !!(s->flags & CODEC_FLAG_OBMC); s->loop_filter= !!(s->flags & CODEC_FLAG_LOOP_FILTER); s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN); s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC); s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT); if(avctx->rc_max_rate && !avctx->rc_buffer_size){ av_log(avctx, AV_LOG_ERROR, "a vbv buffer size is needed, for encoding with a maximum bitrate\n"); return -1; } if(avctx->rc_min_rate && avctx->rc_max_rate != avctx->rc_min_rate){ av_log(avctx, AV_LOG_INFO, "Warning min_rate > 0 but min_rate != max_rate isn't recommended!\n"); } if(avctx->rc_min_rate && avctx->rc_min_rate > avctx->bit_rate){ av_log(avctx, AV_LOG_ERROR, "bitrate below min bitrate\n"); return -1; } if(avctx->rc_max_rate && avctx->rc_max_rate < avctx->bit_rate){ av_log(avctx, AV_LOG_INFO, "bitrate above max bitrate\n"); return -1; } if(avctx->rc_max_rate && avctx->rc_max_rate == avctx->bit_rate && avctx->rc_max_rate != avctx->rc_min_rate){ av_log(avctx, AV_LOG_INFO, "impossible bitrate constraints, this will fail\n"); } if(avctx->rc_buffer_size && avctx->bit_rate*av_q2d(avctx->time_base) > avctx->rc_buffer_size){ av_log(avctx, AV_LOG_ERROR, "VBV buffer too small for bitrate\n"); return -1; } if(avctx->bit_rate*av_q2d(avctx->time_base) > avctx->bit_rate_tolerance){ av_log(avctx, AV_LOG_ERROR, "bitrate tolerance too small for bitrate\n"); return -1; } if( s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO) && 90000LL * (avctx->rc_buffer_size-1) > s->avctx->rc_max_rate*0xFFFFLL){ av_log(avctx, AV_LOG_INFO, "Warning vbv_delay will be set to 0xFFFF (=VBR) as the specified vbv buffer is too large for the given bitrate!\n"); } if((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P && s->codec_id != CODEC_ID_FLV1){ av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n"); return -1; } if(s->obmc && s->avctx->mb_decision != FF_MB_DECISION_SIMPLE){ av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with simple mb decision\n"); return -1; } if(s->obmc && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P){ av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with H263(+)\n"); return -1; } if(s->quarter_sample && s->codec_id != CODEC_ID_MPEG4){ av_log(avctx, AV_LOG_ERROR, "qpel not supported by codec\n"); return -1; } if(s->data_partitioning && s->codec_id != CODEC_ID_MPEG4){ av_log(avctx, AV_LOG_ERROR, "data partitioning not supported by codec\n"); return -1; } if(s->max_b_frames && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "b frames not supported by codec\n"); return -1; } if((s->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN)) && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n"); return -1; } if(s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4){ av_log(avctx, AV_LOG_ERROR, "mpeg2 style quantization not supported by codec\n"); return -1; } if((s->flags & CODEC_FLAG_CBP_RD) && !avctx->trellis){ av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n"); return -1; } if((s->flags & CODEC_FLAG_QP_RD) && s->avctx->mb_decision != FF_MB_DECISION_RD){ av_log(avctx, AV_LOG_ERROR, "QP RD needs mbd=2\n"); return -1; } if(s->avctx->scenechange_threshold < 1000000000 && (s->flags & CODEC_FLAG_CLOSED_GOP)){ av_log(avctx, AV_LOG_ERROR, "closed gop with scene change detection are not supported yet, set threshold to 1000000000\n"); return -1; } if((s->flags2 & CODEC_FLAG2_INTRA_VLC) && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "intra vlc table not supported by codec\n"); return -1; } if(s->flags & CODEC_FLAG_LOW_DELAY){ if (s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "low delay forcing is only available for mpeg2\n"); return -1; } if (s->max_b_frames != 0){ av_log(avctx, AV_LOG_ERROR, "b frames cannot be used with low delay\n"); return -1; } } if(s->q_scale_type == 1){ if(s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "non linear quant is only available for mpeg2\n"); return -1; } if(avctx->qmax > 12){ av_log(avctx, AV_LOG_ERROR, "non linear quant only supports qmax <= 12 currently\n"); return -1; } } if(s->avctx->thread_count > 1 && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO && (s->codec_id != CODEC_ID_H263P || !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT))){ av_log(avctx, AV_LOG_ERROR, "multi threaded encoding not supported by codec\n"); return -1; } if(s->avctx->thread_count < 1){ av_log(avctx, AV_LOG_ERROR, "automatic thread number detection not supported by codec, patch welcome\n"); return -1; } if(s->avctx->thread_count > 1) s->rtp_mode= 1; if(!avctx->time_base.den || !avctx->time_base.num){ av_log(avctx, AV_LOG_ERROR, "framerate not set\n"); return -1; } i= (INT_MAX/2+128)>>8; if(avctx->me_threshold >= i){ av_log(avctx, AV_LOG_ERROR, "me_threshold too large, max is %d\n", i - 1); return -1; } if(avctx->mb_threshold >= i){ av_log(avctx, AV_LOG_ERROR, "mb_threshold too large, max is %d\n", i - 1); return -1; } if(avctx->b_frame_strategy && (avctx->flags&CODEC_FLAG_PASS2)){ av_log(avctx, AV_LOG_INFO, "notice: b_frame_strategy only affects the first pass\n"); avctx->b_frame_strategy = 0; } i= av_gcd(avctx->time_base.den, avctx->time_base.num); if(i > 1){ av_log(avctx, AV_LOG_INFO, "removing common factors from framerate\n"); avctx->time_base.den /= i; avctx->time_base.num /= i; } if(s->codec_id==CODEC_ID_MJPEG){ s->intra_quant_bias= 1<<(QUANT_BIAS_SHIFT-1); s->inter_quant_bias= 0; }else if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO){ s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3); s->inter_quant_bias= 0; }else{ s->intra_quant_bias=0; s->inter_quant_bias=-(1<<(QUANT_BIAS_SHIFT-2)); } if(avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS) s->intra_quant_bias= avctx->intra_quant_bias; if(avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS) s->inter_quant_bias= avctx->inter_quant_bias; avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, &chroma_v_shift); if(avctx->codec_id == CODEC_ID_MPEG4 && s->avctx->time_base.den > (1<<16)-1){ av_log(avctx, AV_LOG_ERROR, "timebase not supported by mpeg 4 standard\n"); return -1; } s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1; switch(avctx->codec->id) { case CODEC_ID_MPEG1VIDEO: s->out_format = FMT_MPEG1; s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; case CODEC_ID_MPEG2VIDEO: s->out_format = FMT_MPEG1; s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); s->rtp_mode= 1; break; case CODEC_ID_LJPEG: case CODEC_ID_MJPEG: s->out_format = FMT_MJPEG; s->intra_only = 1; if(avctx->codec->id == CODEC_ID_MJPEG || avctx->pix_fmt != PIX_FMT_BGRA){ s->mjpeg_vsample[0] = 2; s->mjpeg_vsample[1] = 2>>chroma_v_shift; s->mjpeg_vsample[2] = 2>>chroma_v_shift; s->mjpeg_hsample[0] = 2; s->mjpeg_hsample[1] = 2>>chroma_h_shift; s->mjpeg_hsample[2] = 2>>chroma_h_shift; }else{ s->mjpeg_vsample[0] = s->mjpeg_hsample[0] = s->mjpeg_vsample[1] = s->mjpeg_hsample[1] = s->mjpeg_vsample[2] = s->mjpeg_hsample[2] = 1; } if (!(CONFIG_MJPEG_ENCODER || CONFIG_LJPEG_ENCODER) || ff_mjpeg_encode_init(s) < 0) return -1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H261: if (!CONFIG_H261_ENCODER) return -1; if (ff_h261_get_picture_format(s->width, s->height) < 0) { av_log(avctx, AV_LOG_ERROR, "The specified picture size of %dx%d is not valid for the H.261 codec.\nValid sizes are 176x144, 352x288\n", s->width, s->height); return -1; } s->out_format = FMT_H261; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H263: if (!CONFIG_H263_ENCODER) return -1; if (h263_get_picture_format(s->width, s->height) == 7) { av_log(avctx, AV_LOG_INFO, "The specified picture size of %dx%d is not valid for the H.263 codec.\nValid sizes are 128x96, 176x144, 352x288, 704x576, and 1408x1152. Try H.263+.\n", s->width, s->height); return -1; } s->out_format = FMT_H263; s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H263P: s->out_format = FMT_H263; s->h263_plus = 1; s->umvplus = (avctx->flags & CODEC_FLAG_H263P_UMV) ? 1:0; s->h263_aic= (avctx->flags & CODEC_FLAG_AC_PRED) ? 1:0; s->modified_quant= s->h263_aic; s->alt_inter_vlc= (avctx->flags & CODEC_FLAG_H263P_AIV) ? 1:0; s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0; s->loop_filter= (avctx->flags & CODEC_FLAG_LOOP_FILTER) ? 1:0; s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus; s->h263_slice_structured= (s->flags & CODEC_FLAG_H263P_SLICE_STRUCT) ? 1:0; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_FLV1: s->out_format = FMT_H263; s->h263_flv = 2; s->unrestricted_mv = 1; s->rtp_mode=0; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_RV10: s->out_format = FMT_H263; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_RV20: s->out_format = FMT_H263; avctx->delay=0; s->low_delay=1; s->modified_quant=1; s->h263_aic=1; s->h263_plus=1; s->loop_filter=1; s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus; break; case CODEC_ID_MPEG4: s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; s->low_delay= s->max_b_frames ? 0 : 1; avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; case CODEC_ID_MSMPEG4V1: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_MSMPEG4V2: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 2; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_MSMPEG4V3: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 3; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_WMV1: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 4; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_WMV2: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 5; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; default: return -1; } avctx->has_b_frames= !s->low_delay; s->encoding = 1; s->progressive_frame= s->progressive_sequence= !(avctx->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN)); if (MPV_common_init(s) < 0) return -1; if(!s->dct_quantize) s->dct_quantize = dct_quantize_c; if(!s->denoise_dct) s->denoise_dct = denoise_dct_c; s->fast_dct_quantize = s->dct_quantize; if(avctx->trellis) s->dct_quantize = dct_quantize_trellis_c; if((CONFIG_H263P_ENCODER || CONFIG_RV20_ENCODER) && s->modified_quant) s->chroma_qscale_table= ff_h263_chroma_qscale_table; s->quant_precision=5; ff_set_cmp(&s->dsp, s->dsp.ildct_cmp, s->avctx->ildct_cmp); ff_set_cmp(&s->dsp, s->dsp.frame_skip_cmp, s->avctx->frame_skip_cmp); if (CONFIG_H261_ENCODER && s->out_format == FMT_H261) ff_h261_encode_init(s); if (CONFIG_ANY_H263_ENCODER && s->out_format == FMT_H263) h263_encode_init(s); if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version) ff_msmpeg4_encode_init(s); if ((CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) && s->out_format == FMT_MPEG1) ff_mpeg1_encode_init(s); for(i=0;i<64;i++) { int j= s->dsp.idct_permutation[i]; if(CONFIG_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->mpeg_quant){ s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i]; s->inter_matrix[j] = ff_mpeg4_default_non_intra_matrix[i]; }else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){ s->intra_matrix[j] = s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; }else { s->intra_matrix[j] = ff_mpeg1_default_intra_matrix[i]; s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; } if(s->avctx->intra_matrix) s->intra_matrix[j] = s->avctx->intra_matrix[i]; if(s->avctx->inter_matrix) s->inter_matrix[j] = s->avctx->inter_matrix[i]; } if (s->out_format != FMT_MJPEG) { ff_convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->intra_quant_bias, avctx->qmin, 31, 1); ff_convert_matrix(&s->dsp, s->q_inter_matrix, s->q_inter_matrix16, s->inter_matrix, s->inter_quant_bias, avctx->qmin, 31, 0); } if(ff_rate_control_init(s) < 0) return -1; return 0; }
{ "code": [], "line_no": [] }
av_cold int FUNC_0(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; int VAR_0; int VAR_1, VAR_2; MPV_encode_defaults(s); switch (avctx->codec_id) { case CODEC_ID_MPEG2VIDEO: if(avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P){ av_log(avctx, AV_LOG_ERROR, "only YUV420 and YUV422 are supported\n"); return -1; } break; case CODEC_ID_LJPEG: case CODEC_ID_MJPEG: if(avctx->pix_fmt != PIX_FMT_YUVJ420P && avctx->pix_fmt != PIX_FMT_YUVJ422P && avctx->pix_fmt != PIX_FMT_RGB32 && ((avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P) || avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL)){ av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n"); return -1; } break; default: if(avctx->pix_fmt != PIX_FMT_YUV420P){ av_log(avctx, AV_LOG_ERROR, "only YUV420 is supported\n"); return -1; } } switch (avctx->pix_fmt) { case PIX_FMT_YUVJ422P: case PIX_FMT_YUV422P: s->chroma_format = CHROMA_422; break; case PIX_FMT_YUVJ420P: case PIX_FMT_YUV420P: default: s->chroma_format = CHROMA_420; break; } s->bit_rate = avctx->bit_rate; s->width = avctx->width; s->height = avctx->height; if(avctx->gop_size > 600 && avctx->strict_std_compliance>FF_COMPLIANCE_EXPERIMENTAL){ av_log(avctx, AV_LOG_ERROR, "Warning keyframe interval too large! reducing it ...\n"); avctx->gop_size=600; } s->gop_size = avctx->gop_size; s->avctx = avctx; s->flags= avctx->flags; s->flags2= avctx->flags2; s->max_b_frames= avctx->max_b_frames; s->codec_id= avctx->codec->id; s->luma_elim_threshold = avctx->luma_elim_threshold; s->chroma_elim_threshold= avctx->chroma_elim_threshold; s->strict_std_compliance= avctx->strict_std_compliance; s->data_partitioning= avctx->flags & CODEC_FLAG_PART; s->quarter_sample= (avctx->flags & CODEC_FLAG_QPEL)!=0; s->mpeg_quant= avctx->mpeg_quant; s->rtp_mode= !!avctx->rtp_payload_size; s->intra_dc_precision= avctx->intra_dc_precision; s->user_specified_pts = AV_NOPTS_VALUE; if (s->gop_size <= 1) { s->intra_only = 1; s->gop_size = 12; } else { s->intra_only = 0; } s->me_method = avctx->me_method; s->fixed_qscale = !!(avctx->flags & CODEC_FLAG_QSCALE); s->adaptive_quant= ( s->avctx->lumi_masking || s->avctx->dark_masking || s->avctx->temporal_cplx_masking || s->avctx->spatial_cplx_masking || s->avctx->p_masking || s->avctx->border_masking || (s->flags&CODEC_FLAG_QP_RD)) && !s->fixed_qscale; s->obmc= !!(s->flags & CODEC_FLAG_OBMC); s->loop_filter= !!(s->flags & CODEC_FLAG_LOOP_FILTER); s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN); s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC); s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT); if(avctx->rc_max_rate && !avctx->rc_buffer_size){ av_log(avctx, AV_LOG_ERROR, "a vbv buffer size is needed, for encoding with a maximum bitrate\n"); return -1; } if(avctx->rc_min_rate && avctx->rc_max_rate != avctx->rc_min_rate){ av_log(avctx, AV_LOG_INFO, "Warning min_rate > 0 but min_rate != max_rate isn't recommended!\n"); } if(avctx->rc_min_rate && avctx->rc_min_rate > avctx->bit_rate){ av_log(avctx, AV_LOG_ERROR, "bitrate below min bitrate\n"); return -1; } if(avctx->rc_max_rate && avctx->rc_max_rate < avctx->bit_rate){ av_log(avctx, AV_LOG_INFO, "bitrate above max bitrate\n"); return -1; } if(avctx->rc_max_rate && avctx->rc_max_rate == avctx->bit_rate && avctx->rc_max_rate != avctx->rc_min_rate){ av_log(avctx, AV_LOG_INFO, "impossible bitrate constraints, this will fail\n"); } if(avctx->rc_buffer_size && avctx->bit_rate*av_q2d(avctx->time_base) > avctx->rc_buffer_size){ av_log(avctx, AV_LOG_ERROR, "VBV buffer too small for bitrate\n"); return -1; } if(avctx->bit_rate*av_q2d(avctx->time_base) > avctx->bit_rate_tolerance){ av_log(avctx, AV_LOG_ERROR, "bitrate tolerance too small for bitrate\n"); return -1; } if( s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO) && 90000LL * (avctx->rc_buffer_size-1) > s->avctx->rc_max_rate*0xFFFFLL){ av_log(avctx, AV_LOG_INFO, "Warning vbv_delay will be set to 0xFFFF (=VBR) as the specified vbv buffer is too large for the given bitrate!\n"); } if((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P && s->codec_id != CODEC_ID_FLV1){ av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n"); return -1; } if(s->obmc && s->avctx->mb_decision != FF_MB_DECISION_SIMPLE){ av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with simple mb decision\n"); return -1; } if(s->obmc && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P){ av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with H263(+)\n"); return -1; } if(s->quarter_sample && s->codec_id != CODEC_ID_MPEG4){ av_log(avctx, AV_LOG_ERROR, "qpel not supported by codec\n"); return -1; } if(s->data_partitioning && s->codec_id != CODEC_ID_MPEG4){ av_log(avctx, AV_LOG_ERROR, "data partitioning not supported by codec\n"); return -1; } if(s->max_b_frames && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "b frames not supported by codec\n"); return -1; } if((s->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN)) && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n"); return -1; } if(s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4){ av_log(avctx, AV_LOG_ERROR, "mpeg2 style quantization not supported by codec\n"); return -1; } if((s->flags & CODEC_FLAG_CBP_RD) && !avctx->trellis){ av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n"); return -1; } if((s->flags & CODEC_FLAG_QP_RD) && s->avctx->mb_decision != FF_MB_DECISION_RD){ av_log(avctx, AV_LOG_ERROR, "QP RD needs mbd=2\n"); return -1; } if(s->avctx->scenechange_threshold < 1000000000 && (s->flags & CODEC_FLAG_CLOSED_GOP)){ av_log(avctx, AV_LOG_ERROR, "closed gop with scene change detection are not supported yet, set threshold to 1000000000\n"); return -1; } if((s->flags2 & CODEC_FLAG2_INTRA_VLC) && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "intra vlc table not supported by codec\n"); return -1; } if(s->flags & CODEC_FLAG_LOW_DELAY){ if (s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "low delay forcing is only available for mpeg2\n"); return -1; } if (s->max_b_frames != 0){ av_log(avctx, AV_LOG_ERROR, "b frames cannot be used with low delay\n"); return -1; } } if(s->q_scale_type == 1){ if(s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "non linear quant is only available for mpeg2\n"); return -1; } if(avctx->qmax > 12){ av_log(avctx, AV_LOG_ERROR, "non linear quant only supports qmax <= 12 currently\n"); return -1; } } if(s->avctx->thread_count > 1 && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO && (s->codec_id != CODEC_ID_H263P || !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT))){ av_log(avctx, AV_LOG_ERROR, "multi threaded encoding not supported by codec\n"); return -1; } if(s->avctx->thread_count < 1){ av_log(avctx, AV_LOG_ERROR, "automatic thread number detection not supported by codec, patch welcome\n"); return -1; } if(s->avctx->thread_count > 1) s->rtp_mode= 1; if(!avctx->time_base.den || !avctx->time_base.num){ av_log(avctx, AV_LOG_ERROR, "framerate not set\n"); return -1; } VAR_0= (INT_MAX/2+128)>>8; if(avctx->me_threshold >= VAR_0){ av_log(avctx, AV_LOG_ERROR, "me_threshold too large, max is %d\n", VAR_0 - 1); return -1; } if(avctx->mb_threshold >= VAR_0){ av_log(avctx, AV_LOG_ERROR, "mb_threshold too large, max is %d\n", VAR_0 - 1); return -1; } if(avctx->b_frame_strategy && (avctx->flags&CODEC_FLAG_PASS2)){ av_log(avctx, AV_LOG_INFO, "notice: b_frame_strategy only affects the first pass\n"); avctx->b_frame_strategy = 0; } VAR_0= av_gcd(avctx->time_base.den, avctx->time_base.num); if(VAR_0 > 1){ av_log(avctx, AV_LOG_INFO, "removing common factors from framerate\n"); avctx->time_base.den /= VAR_0; avctx->time_base.num /= VAR_0; } if(s->codec_id==CODEC_ID_MJPEG){ s->intra_quant_bias= 1<<(QUANT_BIAS_SHIFT-1); s->inter_quant_bias= 0; }else if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO){ s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3); s->inter_quant_bias= 0; }else{ s->intra_quant_bias=0; s->inter_quant_bias=-(1<<(QUANT_BIAS_SHIFT-2)); } if(avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS) s->intra_quant_bias= avctx->intra_quant_bias; if(avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS) s->inter_quant_bias= avctx->inter_quant_bias; avcodec_get_chroma_sub_sample(avctx->pix_fmt, &VAR_1, &VAR_2); if(avctx->codec_id == CODEC_ID_MPEG4 && s->avctx->time_base.den > (1<<16)-1){ av_log(avctx, AV_LOG_ERROR, "timebase not supported by mpeg 4 standard\n"); return -1; } s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1; switch(avctx->codec->id) { case CODEC_ID_MPEG1VIDEO: s->out_format = FMT_MPEG1; s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; case CODEC_ID_MPEG2VIDEO: s->out_format = FMT_MPEG1; s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); s->rtp_mode= 1; break; case CODEC_ID_LJPEG: case CODEC_ID_MJPEG: s->out_format = FMT_MJPEG; s->intra_only = 1; if(avctx->codec->id == CODEC_ID_MJPEG || avctx->pix_fmt != PIX_FMT_BGRA){ s->mjpeg_vsample[0] = 2; s->mjpeg_vsample[1] = 2>>VAR_2; s->mjpeg_vsample[2] = 2>>VAR_2; s->mjpeg_hsample[0] = 2; s->mjpeg_hsample[1] = 2>>VAR_1; s->mjpeg_hsample[2] = 2>>VAR_1; }else{ s->mjpeg_vsample[0] = s->mjpeg_hsample[0] = s->mjpeg_vsample[1] = s->mjpeg_hsample[1] = s->mjpeg_vsample[2] = s->mjpeg_hsample[2] = 1; } if (!(CONFIG_MJPEG_ENCODER || CONFIG_LJPEG_ENCODER) || ff_mjpeg_encode_init(s) < 0) return -1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H261: if (!CONFIG_H261_ENCODER) return -1; if (ff_h261_get_picture_format(s->width, s->height) < 0) { av_log(avctx, AV_LOG_ERROR, "The specified picture size of %dx%d is not valid for the H.261 codec.\nValid sizes are 176x144, 352x288\n", s->width, s->height); return -1; } s->out_format = FMT_H261; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H263: if (!CONFIG_H263_ENCODER) return -1; if (h263_get_picture_format(s->width, s->height) == 7) { av_log(avctx, AV_LOG_INFO, "The specified picture size of %dx%d is not valid for the H.263 codec.\nValid sizes are 128x96, 176x144, 352x288, 704x576, and 1408x1152. Try H.263+.\n", s->width, s->height); return -1; } s->out_format = FMT_H263; s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H263P: s->out_format = FMT_H263; s->h263_plus = 1; s->umvplus = (avctx->flags & CODEC_FLAG_H263P_UMV) ? 1:0; s->h263_aic= (avctx->flags & CODEC_FLAG_AC_PRED) ? 1:0; s->modified_quant= s->h263_aic; s->alt_inter_vlc= (avctx->flags & CODEC_FLAG_H263P_AIV) ? 1:0; s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0; s->loop_filter= (avctx->flags & CODEC_FLAG_LOOP_FILTER) ? 1:0; s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus; s->h263_slice_structured= (s->flags & CODEC_FLAG_H263P_SLICE_STRUCT) ? 1:0; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_FLV1: s->out_format = FMT_H263; s->h263_flv = 2; s->unrestricted_mv = 1; s->rtp_mode=0; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_RV10: s->out_format = FMT_H263; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_RV20: s->out_format = FMT_H263; avctx->delay=0; s->low_delay=1; s->modified_quant=1; s->h263_aic=1; s->h263_plus=1; s->loop_filter=1; s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus; break; case CODEC_ID_MPEG4: s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; s->low_delay= s->max_b_frames ? 0 : 1; avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; case CODEC_ID_MSMPEG4V1: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_MSMPEG4V2: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 2; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_MSMPEG4V3: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 3; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_WMV1: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 4; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_WMV2: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 5; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; default: return -1; } avctx->has_b_frames= !s->low_delay; s->encoding = 1; s->progressive_frame= s->progressive_sequence= !(avctx->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN)); if (MPV_common_init(s) < 0) return -1; if(!s->dct_quantize) s->dct_quantize = dct_quantize_c; if(!s->denoise_dct) s->denoise_dct = denoise_dct_c; s->fast_dct_quantize = s->dct_quantize; if(avctx->trellis) s->dct_quantize = dct_quantize_trellis_c; if((CONFIG_H263P_ENCODER || CONFIG_RV20_ENCODER) && s->modified_quant) s->chroma_qscale_table= ff_h263_chroma_qscale_table; s->quant_precision=5; ff_set_cmp(&s->dsp, s->dsp.ildct_cmp, s->avctx->ildct_cmp); ff_set_cmp(&s->dsp, s->dsp.frame_skip_cmp, s->avctx->frame_skip_cmp); if (CONFIG_H261_ENCODER && s->out_format == FMT_H261) ff_h261_encode_init(s); if (CONFIG_ANY_H263_ENCODER && s->out_format == FMT_H263) h263_encode_init(s); if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version) ff_msmpeg4_encode_init(s); if ((CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) && s->out_format == FMT_MPEG1) ff_mpeg1_encode_init(s); for(VAR_0=0;VAR_0<64;VAR_0++) { int VAR_3= s->dsp.idct_permutation[VAR_0]; if(CONFIG_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->mpeg_quant){ s->intra_matrix[VAR_3] = ff_mpeg4_default_intra_matrix[VAR_0]; s->inter_matrix[VAR_3] = ff_mpeg4_default_non_intra_matrix[VAR_0]; }else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){ s->intra_matrix[VAR_3] = s->inter_matrix[VAR_3] = ff_mpeg1_default_non_intra_matrix[VAR_0]; }else { s->intra_matrix[VAR_3] = ff_mpeg1_default_intra_matrix[VAR_0]; s->inter_matrix[VAR_3] = ff_mpeg1_default_non_intra_matrix[VAR_0]; } if(s->avctx->intra_matrix) s->intra_matrix[VAR_3] = s->avctx->intra_matrix[VAR_0]; if(s->avctx->inter_matrix) s->inter_matrix[VAR_3] = s->avctx->inter_matrix[VAR_0]; } if (s->out_format != FMT_MJPEG) { ff_convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->intra_quant_bias, avctx->qmin, 31, 1); ff_convert_matrix(&s->dsp, s->q_inter_matrix, s->q_inter_matrix16, s->inter_matrix, s->inter_quant_bias, avctx->qmin, 31, 0); } if(ff_rate_control_init(s) < 0) return -1; return 0; }
[ "av_cold int FUNC_0(AVCodecContext *avctx)\n{", "MpegEncContext *s = avctx->priv_data;", "int VAR_0;", "int VAR_1, VAR_2;", "MPV_encode_defaults(s);", "switch (avctx->codec_id) {", "case CODEC_ID_MPEG2VIDEO:\nif(avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P){", "av_log(avctx, AV_LOG_ERROR, \"only YUV420 and YUV422 are supported\\n\");", "return -1;", "}", "break;", "case CODEC_ID_LJPEG:\ncase CODEC_ID_MJPEG:\nif(avctx->pix_fmt != PIX_FMT_YUVJ420P && avctx->pix_fmt != PIX_FMT_YUVJ422P && avctx->pix_fmt != PIX_FMT_RGB32 &&\n((avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P) || avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL)){", "av_log(avctx, AV_LOG_ERROR, \"colorspace not supported in jpeg\\n\");", "return -1;", "}", "break;", "default:\nif(avctx->pix_fmt != PIX_FMT_YUV420P){", "av_log(avctx, AV_LOG_ERROR, \"only YUV420 is supported\\n\");", "return -1;", "}", "}", "switch (avctx->pix_fmt) {", "case PIX_FMT_YUVJ422P:\ncase PIX_FMT_YUV422P:\ns->chroma_format = CHROMA_422;", "break;", "case PIX_FMT_YUVJ420P:\ncase PIX_FMT_YUV420P:\ndefault:\ns->chroma_format = CHROMA_420;", "break;", "}", "s->bit_rate = avctx->bit_rate;", "s->width = avctx->width;", "s->height = avctx->height;", "if(avctx->gop_size > 600 && avctx->strict_std_compliance>FF_COMPLIANCE_EXPERIMENTAL){", "av_log(avctx, AV_LOG_ERROR, \"Warning keyframe interval too large! reducing it ...\\n\");", "avctx->gop_size=600;", "}", "s->gop_size = avctx->gop_size;", "s->avctx = avctx;", "s->flags= avctx->flags;", "s->flags2= avctx->flags2;", "s->max_b_frames= avctx->max_b_frames;", "s->codec_id= avctx->codec->id;", "s->luma_elim_threshold = avctx->luma_elim_threshold;", "s->chroma_elim_threshold= avctx->chroma_elim_threshold;", "s->strict_std_compliance= avctx->strict_std_compliance;", "s->data_partitioning= avctx->flags & CODEC_FLAG_PART;", "s->quarter_sample= (avctx->flags & CODEC_FLAG_QPEL)!=0;", "s->mpeg_quant= avctx->mpeg_quant;", "s->rtp_mode= !!avctx->rtp_payload_size;", "s->intra_dc_precision= avctx->intra_dc_precision;", "s->user_specified_pts = AV_NOPTS_VALUE;", "if (s->gop_size <= 1) {", "s->intra_only = 1;", "s->gop_size = 12;", "} else {", "s->intra_only = 0;", "}", "s->me_method = avctx->me_method;", "s->fixed_qscale = !!(avctx->flags & CODEC_FLAG_QSCALE);", "s->adaptive_quant= ( s->avctx->lumi_masking\n|| s->avctx->dark_masking\n|| s->avctx->temporal_cplx_masking\n|| s->avctx->spatial_cplx_masking\n|| s->avctx->p_masking\n|| s->avctx->border_masking\n|| (s->flags&CODEC_FLAG_QP_RD))\n&& !s->fixed_qscale;", "s->obmc= !!(s->flags & CODEC_FLAG_OBMC);", "s->loop_filter= !!(s->flags & CODEC_FLAG_LOOP_FILTER);", "s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN);", "s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC);", "s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT);", "if(avctx->rc_max_rate && !avctx->rc_buffer_size){", "av_log(avctx, AV_LOG_ERROR, \"a vbv buffer size is needed, for encoding with a maximum bitrate\\n\");", "return -1;", "}", "if(avctx->rc_min_rate && avctx->rc_max_rate != avctx->rc_min_rate){", "av_log(avctx, AV_LOG_INFO, \"Warning min_rate > 0 but min_rate != max_rate isn't recommended!\\n\");", "}", "if(avctx->rc_min_rate && avctx->rc_min_rate > avctx->bit_rate){", "av_log(avctx, AV_LOG_ERROR, \"bitrate below min bitrate\\n\");", "return -1;", "}", "if(avctx->rc_max_rate && avctx->rc_max_rate < avctx->bit_rate){", "av_log(avctx, AV_LOG_INFO, \"bitrate above max bitrate\\n\");", "return -1;", "}", "if(avctx->rc_max_rate && avctx->rc_max_rate == avctx->bit_rate && avctx->rc_max_rate != avctx->rc_min_rate){", "av_log(avctx, AV_LOG_INFO, \"impossible bitrate constraints, this will fail\\n\");", "}", "if(avctx->rc_buffer_size && avctx->bit_rate*av_q2d(avctx->time_base) > avctx->rc_buffer_size){", "av_log(avctx, AV_LOG_ERROR, \"VBV buffer too small for bitrate\\n\");", "return -1;", "}", "if(avctx->bit_rate*av_q2d(avctx->time_base) > avctx->bit_rate_tolerance){", "av_log(avctx, AV_LOG_ERROR, \"bitrate tolerance too small for bitrate\\n\");", "return -1;", "}", "if( s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate\n&& (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO)\n&& 90000LL * (avctx->rc_buffer_size-1) > s->avctx->rc_max_rate*0xFFFFLL){", "av_log(avctx, AV_LOG_INFO, \"Warning vbv_delay will be set to 0xFFFF (=VBR) as the specified vbv buffer is too large for the given bitrate!\\n\");", "}", "if((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4\n&& s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P && s->codec_id != CODEC_ID_FLV1){", "av_log(avctx, AV_LOG_ERROR, \"4MV not supported by codec\\n\");", "return -1;", "}", "if(s->obmc && s->avctx->mb_decision != FF_MB_DECISION_SIMPLE){", "av_log(avctx, AV_LOG_ERROR, \"OBMC is only supported with simple mb decision\\n\");", "return -1;", "}", "if(s->obmc && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P){", "av_log(avctx, AV_LOG_ERROR, \"OBMC is only supported with H263(+)\\n\");", "return -1;", "}", "if(s->quarter_sample && s->codec_id != CODEC_ID_MPEG4){", "av_log(avctx, AV_LOG_ERROR, \"qpel not supported by codec\\n\");", "return -1;", "}", "if(s->data_partitioning && s->codec_id != CODEC_ID_MPEG4){", "av_log(avctx, AV_LOG_ERROR, \"data partitioning not supported by codec\\n\");", "return -1;", "}", "if(s->max_b_frames && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO){", "av_log(avctx, AV_LOG_ERROR, \"b frames not supported by codec\\n\");", "return -1;", "}", "if((s->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN))\n&& s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG2VIDEO){", "av_log(avctx, AV_LOG_ERROR, \"interlacing not supported by codec\\n\");", "return -1;", "}", "if(s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4){", "av_log(avctx, AV_LOG_ERROR, \"mpeg2 style quantization not supported by codec\\n\");", "return -1;", "}", "if((s->flags & CODEC_FLAG_CBP_RD) && !avctx->trellis){", "av_log(avctx, AV_LOG_ERROR, \"CBP RD needs trellis quant\\n\");", "return -1;", "}", "if((s->flags & CODEC_FLAG_QP_RD) && s->avctx->mb_decision != FF_MB_DECISION_RD){", "av_log(avctx, AV_LOG_ERROR, \"QP RD needs mbd=2\\n\");", "return -1;", "}", "if(s->avctx->scenechange_threshold < 1000000000 && (s->flags & CODEC_FLAG_CLOSED_GOP)){", "av_log(avctx, AV_LOG_ERROR, \"closed gop with scene change detection are not supported yet, set threshold to 1000000000\\n\");", "return -1;", "}", "if((s->flags2 & CODEC_FLAG2_INTRA_VLC) && s->codec_id != CODEC_ID_MPEG2VIDEO){", "av_log(avctx, AV_LOG_ERROR, \"intra vlc table not supported by codec\\n\");", "return -1;", "}", "if(s->flags & CODEC_FLAG_LOW_DELAY){", "if (s->codec_id != CODEC_ID_MPEG2VIDEO){", "av_log(avctx, AV_LOG_ERROR, \"low delay forcing is only available for mpeg2\\n\");", "return -1;", "}", "if (s->max_b_frames != 0){", "av_log(avctx, AV_LOG_ERROR, \"b frames cannot be used with low delay\\n\");", "return -1;", "}", "}", "if(s->q_scale_type == 1){", "if(s->codec_id != CODEC_ID_MPEG2VIDEO){", "av_log(avctx, AV_LOG_ERROR, \"non linear quant is only available for mpeg2\\n\");", "return -1;", "}", "if(avctx->qmax > 12){", "av_log(avctx, AV_LOG_ERROR, \"non linear quant only supports qmax <= 12 currently\\n\");", "return -1;", "}", "}", "if(s->avctx->thread_count > 1 && s->codec_id != CODEC_ID_MPEG4\n&& s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO\n&& (s->codec_id != CODEC_ID_H263P || !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT))){", "av_log(avctx, AV_LOG_ERROR, \"multi threaded encoding not supported by codec\\n\");", "return -1;", "}", "if(s->avctx->thread_count < 1){", "av_log(avctx, AV_LOG_ERROR, \"automatic thread number detection not supported by codec, patch welcome\\n\");", "return -1;", "}", "if(s->avctx->thread_count > 1)\ns->rtp_mode= 1;", "if(!avctx->time_base.den || !avctx->time_base.num){", "av_log(avctx, AV_LOG_ERROR, \"framerate not set\\n\");", "return -1;", "}", "VAR_0= (INT_MAX/2+128)>>8;", "if(avctx->me_threshold >= VAR_0){", "av_log(avctx, AV_LOG_ERROR, \"me_threshold too large, max is %d\\n\", VAR_0 - 1);", "return -1;", "}", "if(avctx->mb_threshold >= VAR_0){", "av_log(avctx, AV_LOG_ERROR, \"mb_threshold too large, max is %d\\n\", VAR_0 - 1);", "return -1;", "}", "if(avctx->b_frame_strategy && (avctx->flags&CODEC_FLAG_PASS2)){", "av_log(avctx, AV_LOG_INFO, \"notice: b_frame_strategy only affects the first pass\\n\");", "avctx->b_frame_strategy = 0;", "}", "VAR_0= av_gcd(avctx->time_base.den, avctx->time_base.num);", "if(VAR_0 > 1){", "av_log(avctx, AV_LOG_INFO, \"removing common factors from framerate\\n\");", "avctx->time_base.den /= VAR_0;", "avctx->time_base.num /= VAR_0;", "}", "if(s->codec_id==CODEC_ID_MJPEG){", "s->intra_quant_bias= 1<<(QUANT_BIAS_SHIFT-1);", "s->inter_quant_bias= 0;", "}else if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO){", "s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3);", "s->inter_quant_bias= 0;", "}else{", "s->intra_quant_bias=0;", "s->inter_quant_bias=-(1<<(QUANT_BIAS_SHIFT-2));", "}", "if(avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS)\ns->intra_quant_bias= avctx->intra_quant_bias;", "if(avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS)\ns->inter_quant_bias= avctx->inter_quant_bias;", "avcodec_get_chroma_sub_sample(avctx->pix_fmt, &VAR_1, &VAR_2);", "if(avctx->codec_id == CODEC_ID_MPEG4 && s->avctx->time_base.den > (1<<16)-1){", "av_log(avctx, AV_LOG_ERROR, \"timebase not supported by mpeg 4 standard\\n\");", "return -1;", "}", "s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1;", "switch(avctx->codec->id) {", "case CODEC_ID_MPEG1VIDEO:\ns->out_format = FMT_MPEG1;", "s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY);", "avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);", "break;", "case CODEC_ID_MPEG2VIDEO:\ns->out_format = FMT_MPEG1;", "s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY);", "avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);", "s->rtp_mode= 1;", "break;", "case CODEC_ID_LJPEG:\ncase CODEC_ID_MJPEG:\ns->out_format = FMT_MJPEG;", "s->intra_only = 1;", "if(avctx->codec->id == CODEC_ID_MJPEG || avctx->pix_fmt != PIX_FMT_BGRA){", "s->mjpeg_vsample[0] = 2;", "s->mjpeg_vsample[1] = 2>>VAR_2;", "s->mjpeg_vsample[2] = 2>>VAR_2;", "s->mjpeg_hsample[0] = 2;", "s->mjpeg_hsample[1] = 2>>VAR_1;", "s->mjpeg_hsample[2] = 2>>VAR_1;", "}else{", "s->mjpeg_vsample[0] = s->mjpeg_hsample[0] =\ns->mjpeg_vsample[1] = s->mjpeg_hsample[1] =\ns->mjpeg_vsample[2] = s->mjpeg_hsample[2] = 1;", "}", "if (!(CONFIG_MJPEG_ENCODER || CONFIG_LJPEG_ENCODER)\n|| ff_mjpeg_encode_init(s) < 0)\nreturn -1;", "avctx->delay=0;", "s->low_delay=1;", "break;", "case CODEC_ID_H261:\nif (!CONFIG_H261_ENCODER) return -1;", "if (ff_h261_get_picture_format(s->width, s->height) < 0) {", "av_log(avctx, AV_LOG_ERROR, \"The specified picture size of %dx%d is not valid for the H.261 codec.\\nValid sizes are 176x144, 352x288\\n\", s->width, s->height);", "return -1;", "}", "s->out_format = FMT_H261;", "avctx->delay=0;", "s->low_delay=1;", "break;", "case CODEC_ID_H263:\nif (!CONFIG_H263_ENCODER) return -1;", "if (h263_get_picture_format(s->width, s->height) == 7) {", "av_log(avctx, AV_LOG_INFO, \"The specified picture size of %dx%d is not valid for the H.263 codec.\\nValid sizes are 128x96, 176x144, 352x288, 704x576, and 1408x1152. Try H.263+.\\n\", s->width, s->height);", "return -1;", "}", "s->out_format = FMT_H263;", "s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0;", "avctx->delay=0;", "s->low_delay=1;", "break;", "case CODEC_ID_H263P:\ns->out_format = FMT_H263;", "s->h263_plus = 1;", "s->umvplus = (avctx->flags & CODEC_FLAG_H263P_UMV) ? 1:0;", "s->h263_aic= (avctx->flags & CODEC_FLAG_AC_PRED) ? 1:0;", "s->modified_quant= s->h263_aic;", "s->alt_inter_vlc= (avctx->flags & CODEC_FLAG_H263P_AIV) ? 1:0;", "s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0;", "s->loop_filter= (avctx->flags & CODEC_FLAG_LOOP_FILTER) ? 1:0;", "s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus;", "s->h263_slice_structured= (s->flags & CODEC_FLAG_H263P_SLICE_STRUCT) ? 1:0;", "avctx->delay=0;", "s->low_delay=1;", "break;", "case CODEC_ID_FLV1:\ns->out_format = FMT_H263;", "s->h263_flv = 2;", "s->unrestricted_mv = 1;", "s->rtp_mode=0;", "avctx->delay=0;", "s->low_delay=1;", "break;", "case CODEC_ID_RV10:\ns->out_format = FMT_H263;", "avctx->delay=0;", "s->low_delay=1;", "break;", "case CODEC_ID_RV20:\ns->out_format = FMT_H263;", "avctx->delay=0;", "s->low_delay=1;", "s->modified_quant=1;", "s->h263_aic=1;", "s->h263_plus=1;", "s->loop_filter=1;", "s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus;", "break;", "case CODEC_ID_MPEG4:\ns->out_format = FMT_H263;", "s->h263_pred = 1;", "s->unrestricted_mv = 1;", "s->low_delay= s->max_b_frames ? 0 : 1;", "avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);", "break;", "case CODEC_ID_MSMPEG4V1:\ns->out_format = FMT_H263;", "s->h263_msmpeg4 = 1;", "s->h263_pred = 1;", "s->unrestricted_mv = 1;", "s->msmpeg4_version= 1;", "avctx->delay=0;", "s->low_delay=1;", "break;", "case CODEC_ID_MSMPEG4V2:\ns->out_format = FMT_H263;", "s->h263_msmpeg4 = 1;", "s->h263_pred = 1;", "s->unrestricted_mv = 1;", "s->msmpeg4_version= 2;", "avctx->delay=0;", "s->low_delay=1;", "break;", "case CODEC_ID_MSMPEG4V3:\ns->out_format = FMT_H263;", "s->h263_msmpeg4 = 1;", "s->h263_pred = 1;", "s->unrestricted_mv = 1;", "s->msmpeg4_version= 3;", "s->flipflop_rounding=1;", "avctx->delay=0;", "s->low_delay=1;", "break;", "case CODEC_ID_WMV1:\ns->out_format = FMT_H263;", "s->h263_msmpeg4 = 1;", "s->h263_pred = 1;", "s->unrestricted_mv = 1;", "s->msmpeg4_version= 4;", "s->flipflop_rounding=1;", "avctx->delay=0;", "s->low_delay=1;", "break;", "case CODEC_ID_WMV2:\ns->out_format = FMT_H263;", "s->h263_msmpeg4 = 1;", "s->h263_pred = 1;", "s->unrestricted_mv = 1;", "s->msmpeg4_version= 5;", "s->flipflop_rounding=1;", "avctx->delay=0;", "s->low_delay=1;", "break;", "default:\nreturn -1;", "}", "avctx->has_b_frames= !s->low_delay;", "s->encoding = 1;", "s->progressive_frame=\ns->progressive_sequence= !(avctx->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN));", "if (MPV_common_init(s) < 0)\nreturn -1;", "if(!s->dct_quantize)\ns->dct_quantize = dct_quantize_c;", "if(!s->denoise_dct)\ns->denoise_dct = denoise_dct_c;", "s->fast_dct_quantize = s->dct_quantize;", "if(avctx->trellis)\ns->dct_quantize = dct_quantize_trellis_c;", "if((CONFIG_H263P_ENCODER || CONFIG_RV20_ENCODER) && s->modified_quant)\ns->chroma_qscale_table= ff_h263_chroma_qscale_table;", "s->quant_precision=5;", "ff_set_cmp(&s->dsp, s->dsp.ildct_cmp, s->avctx->ildct_cmp);", "ff_set_cmp(&s->dsp, s->dsp.frame_skip_cmp, s->avctx->frame_skip_cmp);", "if (CONFIG_H261_ENCODER && s->out_format == FMT_H261)\nff_h261_encode_init(s);", "if (CONFIG_ANY_H263_ENCODER && s->out_format == FMT_H263)\nh263_encode_init(s);", "if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version)\nff_msmpeg4_encode_init(s);", "if ((CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER)\n&& s->out_format == FMT_MPEG1)\nff_mpeg1_encode_init(s);", "for(VAR_0=0;VAR_0<64;VAR_0++) {", "int VAR_3= s->dsp.idct_permutation[VAR_0];", "if(CONFIG_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->mpeg_quant){", "s->intra_matrix[VAR_3] = ff_mpeg4_default_intra_matrix[VAR_0];", "s->inter_matrix[VAR_3] = ff_mpeg4_default_non_intra_matrix[VAR_0];", "}else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){", "s->intra_matrix[VAR_3] =\ns->inter_matrix[VAR_3] = ff_mpeg1_default_non_intra_matrix[VAR_0];", "}else", "{", "s->intra_matrix[VAR_3] = ff_mpeg1_default_intra_matrix[VAR_0];", "s->inter_matrix[VAR_3] = ff_mpeg1_default_non_intra_matrix[VAR_0];", "}", "if(s->avctx->intra_matrix)\ns->intra_matrix[VAR_3] = s->avctx->intra_matrix[VAR_0];", "if(s->avctx->inter_matrix)\ns->inter_matrix[VAR_3] = s->avctx->inter_matrix[VAR_0];", "}", "if (s->out_format != FMT_MJPEG) {", "ff_convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16,\ns->intra_matrix, s->intra_quant_bias, avctx->qmin, 31, 1);", "ff_convert_matrix(&s->dsp, s->q_inter_matrix, s->q_inter_matrix16,\ns->inter_matrix, s->inter_quant_bias, avctx->qmin, 31, 0);", "}", "if(ff_rate_control_init(s) < 0)\nreturn -1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63, 65, 67 ], [ 69 ], [ 71, 73, 75, 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 151 ], [ 155, 157, 159, 161, 163, 165, 167, 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251, 253, 255 ], [ 259 ], [ 261 ], [ 265, 267 ], [ 269 ], [ 271 ], [ 273 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 327, 329 ], [ 331 ], [ 333 ], [ 335 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 433, 435, 437 ], [ 439 ], [ 441 ], [ 443 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 457, 459 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 515 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 541, 543 ], [ 545, 547 ], [ 551 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 567 ], [ 569, 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579, 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 591, 593, 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615, 617, 619 ], [ 621 ], [ 623, 625, 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635, 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655, 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 669 ], [ 671 ], [ 673 ], [ 675 ], [ 677, 679 ], [ 681 ], [ 685 ], [ 687 ], [ 689 ], [ 691 ], [ 693 ], [ 695 ], [ 697 ], [ 699 ], [ 707 ], [ 709 ], [ 711 ], [ 713, 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 ], [ 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 ], [ 867 ], [ 869, 871 ], [ 873 ], [ 877 ], [ 881 ], [ 885, 887 ], [ 893, 895 ], [ 899, 901 ], [ 903, 905 ], [ 907 ], [ 909, 911 ], [ 915, 917 ], [ 921 ], [ 925 ], [ 927 ], [ 931, 933 ], [ 935, 937 ], [ 939, 941 ], [ 943, 945, 947 ], [ 953 ], [ 955 ], [ 957 ], [ 959 ], [ 961 ], [ 963 ], [ 965, 967 ], [ 969 ], [ 971 ], [ 973 ], [ 975 ], [ 977 ], [ 979, 981 ], [ 983, 985 ], [ 987 ], [ 995 ], [ 997, 999 ], [ 1001, 1003 ], [ 1005 ], [ 1009, 1011 ], [ 1015 ], [ 1017 ] ]
21,667
static void read_sbr_envelope(SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data, int ch) { int bits; int i, j, k; VLC_TYPE (*t_huff)[2], (*f_huff)[2]; int t_lav, f_lav; const int delta = (ch == 1 && sbr->bs_coupling == 1) + 1; const int odd = sbr->n[1] & 1; if (sbr->bs_coupling && ch) { if (ch_data->bs_amp_res) { bits = 5; t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_3_0DB].table; t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_3_0DB]; f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table; f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB]; } else { bits = 6; t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_1_5DB].table; t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_1_5DB]; f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_1_5DB].table; f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_1_5DB]; } } else { if (ch_data->bs_amp_res) { bits = 6; t_huff = vlc_sbr[T_HUFFMAN_ENV_3_0DB].table; t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_3_0DB]; f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table; f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB]; } else { bits = 7; t_huff = vlc_sbr[T_HUFFMAN_ENV_1_5DB].table; t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_1_5DB]; f_huff = vlc_sbr[F_HUFFMAN_ENV_1_5DB].table; f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_1_5DB]; } } for (i = 0; i < ch_data->bs_num_env; i++) { if (ch_data->bs_df_env[i]) { // bs_freq_res[0] == bs_freq_res[bs_num_env] from prev frame if (ch_data->bs_freq_res[i + 1] == ch_data->bs_freq_res[i]) { for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][j] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav); } else if (ch_data->bs_freq_res[i + 1]) { for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) { k = (j + odd) >> 1; // find k such that f_tablelow[k] <= f_tablehigh[j] < f_tablelow[k + 1] ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav); } } else { for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) { k = j ? 2*j - odd : 0; // find k such that f_tablehigh[k] == f_tablelow[j] ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav); } } } else { ch_data->env_facs_q[i + 1][0] = delta * get_bits(gb, bits); // bs_env_start_value_balance for (j = 1; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i + 1][j - 1] + delta * (get_vlc2(gb, f_huff, 9, 3) - f_lav); } } //assign 0th elements of env_facs_q from last elements memcpy(ch_data->env_facs_q[0], ch_data->env_facs_q[ch_data->bs_num_env], sizeof(ch_data->env_facs_q[0])); }
false
FFmpeg
625b582d5a9196c582e7702b542b3e0face30ccf
static void read_sbr_envelope(SpectralBandReplication *sbr, GetBitContext *gb, SBRData *ch_data, int ch) { int bits; int i, j, k; VLC_TYPE (*t_huff)[2], (*f_huff)[2]; int t_lav, f_lav; const int delta = (ch == 1 && sbr->bs_coupling == 1) + 1; const int odd = sbr->n[1] & 1; if (sbr->bs_coupling && ch) { if (ch_data->bs_amp_res) { bits = 5; t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_3_0DB].table; t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_3_0DB]; f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table; f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB]; } else { bits = 6; t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_1_5DB].table; t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_1_5DB]; f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_1_5DB].table; f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_1_5DB]; } } else { if (ch_data->bs_amp_res) { bits = 6; t_huff = vlc_sbr[T_HUFFMAN_ENV_3_0DB].table; t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_3_0DB]; f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table; f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB]; } else { bits = 7; t_huff = vlc_sbr[T_HUFFMAN_ENV_1_5DB].table; t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_1_5DB]; f_huff = vlc_sbr[F_HUFFMAN_ENV_1_5DB].table; f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_1_5DB]; } } for (i = 0; i < ch_data->bs_num_env; i++) { if (ch_data->bs_df_env[i]) { if (ch_data->bs_freq_res[i + 1] == ch_data->bs_freq_res[i]) { for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][j] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav); } else if (ch_data->bs_freq_res[i + 1]) { for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) { k = (j + odd) >> 1; ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav); } } else { for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) { k = j ? 2*j - odd : 0; ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav); } } } else { ch_data->env_facs_q[i + 1][0] = delta * get_bits(gb, bits); for (j = 1; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) ch_data->env_facs_q[i + 1][j] = ch_data->env_facs_q[i + 1][j - 1] + delta * (get_vlc2(gb, f_huff, 9, 3) - f_lav); } } memcpy(ch_data->env_facs_q[0], ch_data->env_facs_q[ch_data->bs_num_env], sizeof(ch_data->env_facs_q[0])); }
{ "code": [], "line_no": [] }
static void FUNC_0(SpectralBandReplication *VAR_0, GetBitContext *VAR_1, SBRData *VAR_2, int VAR_3) { int VAR_4; int VAR_5, VAR_6, VAR_7; VLC_TYPE (*t_huff)[2], (*f_huff)[2]; int VAR_8, VAR_9; const int VAR_10 = (VAR_3 == 1 && VAR_0->bs_coupling == 1) + 1; const int VAR_11 = VAR_0->n[1] & 1; if (VAR_0->bs_coupling && VAR_3) { if (VAR_2->bs_amp_res) { VAR_4 = 5; t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_3_0DB].table; VAR_8 = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_3_0DB]; f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table; VAR_9 = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB]; } else { VAR_4 = 6; t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_1_5DB].table; VAR_8 = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_1_5DB]; f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_1_5DB].table; VAR_9 = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_1_5DB]; } } else { if (VAR_2->bs_amp_res) { VAR_4 = 6; t_huff = vlc_sbr[T_HUFFMAN_ENV_3_0DB].table; VAR_8 = vlc_sbr_lav[T_HUFFMAN_ENV_3_0DB]; f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table; VAR_9 = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB]; } else { VAR_4 = 7; t_huff = vlc_sbr[T_HUFFMAN_ENV_1_5DB].table; VAR_8 = vlc_sbr_lav[T_HUFFMAN_ENV_1_5DB]; f_huff = vlc_sbr[F_HUFFMAN_ENV_1_5DB].table; VAR_9 = vlc_sbr_lav[F_HUFFMAN_ENV_1_5DB]; } } for (VAR_5 = 0; VAR_5 < VAR_2->bs_num_env; VAR_5++) { if (VAR_2->bs_df_env[VAR_5]) { if (VAR_2->bs_freq_res[VAR_5 + 1] == VAR_2->bs_freq_res[VAR_5]) { for (VAR_6 = 0; VAR_6 < VAR_0->n[VAR_2->bs_freq_res[VAR_5 + 1]]; VAR_6++) VAR_2->env_facs_q[VAR_5 + 1][VAR_6] = VAR_2->env_facs_q[VAR_5][VAR_6] + VAR_10 * (get_vlc2(VAR_1, t_huff, 9, 3) - VAR_8); } else if (VAR_2->bs_freq_res[VAR_5 + 1]) { for (VAR_6 = 0; VAR_6 < VAR_0->n[VAR_2->bs_freq_res[VAR_5 + 1]]; VAR_6++) { VAR_7 = (VAR_6 + VAR_11) >> 1; VAR_2->env_facs_q[VAR_5 + 1][VAR_6] = VAR_2->env_facs_q[VAR_5][VAR_7] + VAR_10 * (get_vlc2(VAR_1, t_huff, 9, 3) - VAR_8); } } else { for (VAR_6 = 0; VAR_6 < VAR_0->n[VAR_2->bs_freq_res[VAR_5 + 1]]; VAR_6++) { VAR_7 = VAR_6 ? 2*VAR_6 - VAR_11 : 0; VAR_2->env_facs_q[VAR_5 + 1][VAR_6] = VAR_2->env_facs_q[VAR_5][VAR_7] + VAR_10 * (get_vlc2(VAR_1, t_huff, 9, 3) - VAR_8); } } } else { VAR_2->env_facs_q[VAR_5 + 1][0] = VAR_10 * get_bits(VAR_1, VAR_4); for (VAR_6 = 1; VAR_6 < VAR_0->n[VAR_2->bs_freq_res[VAR_5 + 1]]; VAR_6++) VAR_2->env_facs_q[VAR_5 + 1][VAR_6] = VAR_2->env_facs_q[VAR_5 + 1][VAR_6 - 1] + VAR_10 * (get_vlc2(VAR_1, f_huff, 9, 3) - VAR_9); } } memcpy(VAR_2->env_facs_q[0], VAR_2->env_facs_q[VAR_2->bs_num_env], sizeof(VAR_2->env_facs_q[0])); }
[ "static void FUNC_0(SpectralBandReplication *VAR_0, GetBitContext *VAR_1,\nSBRData *VAR_2, int VAR_3)\n{", "int VAR_4;", "int VAR_5, VAR_6, VAR_7;", "VLC_TYPE (*t_huff)[2], (*f_huff)[2];", "int VAR_8, VAR_9;", "const int VAR_10 = (VAR_3 == 1 && VAR_0->bs_coupling == 1) + 1;", "const int VAR_11 = VAR_0->n[1] & 1;", "if (VAR_0->bs_coupling && VAR_3) {", "if (VAR_2->bs_amp_res) {", "VAR_4 = 5;", "t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_3_0DB].table;", "VAR_8 = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_3_0DB];", "f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table;", "VAR_9 = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB];", "} else {", "VAR_4 = 6;", "t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_1_5DB].table;", "VAR_8 = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_1_5DB];", "f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_1_5DB].table;", "VAR_9 = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_1_5DB];", "}", "} else {", "if (VAR_2->bs_amp_res) {", "VAR_4 = 6;", "t_huff = vlc_sbr[T_HUFFMAN_ENV_3_0DB].table;", "VAR_8 = vlc_sbr_lav[T_HUFFMAN_ENV_3_0DB];", "f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table;", "VAR_9 = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB];", "} else {", "VAR_4 = 7;", "t_huff = vlc_sbr[T_HUFFMAN_ENV_1_5DB].table;", "VAR_8 = vlc_sbr_lav[T_HUFFMAN_ENV_1_5DB];", "f_huff = vlc_sbr[F_HUFFMAN_ENV_1_5DB].table;", "VAR_9 = vlc_sbr_lav[F_HUFFMAN_ENV_1_5DB];", "}", "}", "for (VAR_5 = 0; VAR_5 < VAR_2->bs_num_env; VAR_5++) {", "if (VAR_2->bs_df_env[VAR_5]) {", "if (VAR_2->bs_freq_res[VAR_5 + 1] == VAR_2->bs_freq_res[VAR_5]) {", "for (VAR_6 = 0; VAR_6 < VAR_0->n[VAR_2->bs_freq_res[VAR_5 + 1]]; VAR_6++)", "VAR_2->env_facs_q[VAR_5 + 1][VAR_6] = VAR_2->env_facs_q[VAR_5][VAR_6] + VAR_10 * (get_vlc2(VAR_1, t_huff, 9, 3) - VAR_8);", "} else if (VAR_2->bs_freq_res[VAR_5 + 1]) {", "for (VAR_6 = 0; VAR_6 < VAR_0->n[VAR_2->bs_freq_res[VAR_5 + 1]]; VAR_6++) {", "VAR_7 = (VAR_6 + VAR_11) >> 1;", "VAR_2->env_facs_q[VAR_5 + 1][VAR_6] = VAR_2->env_facs_q[VAR_5][VAR_7] + VAR_10 * (get_vlc2(VAR_1, t_huff, 9, 3) - VAR_8);", "}", "} else {", "for (VAR_6 = 0; VAR_6 < VAR_0->n[VAR_2->bs_freq_res[VAR_5 + 1]]; VAR_6++) {", "VAR_7 = VAR_6 ? 2*VAR_6 - VAR_11 : 0;", "VAR_2->env_facs_q[VAR_5 + 1][VAR_6] = VAR_2->env_facs_q[VAR_5][VAR_7] + VAR_10 * (get_vlc2(VAR_1, t_huff, 9, 3) - VAR_8);", "}", "}", "} else {", "VAR_2->env_facs_q[VAR_5 + 1][0] = VAR_10 * get_bits(VAR_1, VAR_4);", "for (VAR_6 = 1; VAR_6 < VAR_0->n[VAR_2->bs_freq_res[VAR_5 + 1]]; VAR_6++)", "VAR_2->env_facs_q[VAR_5 + 1][VAR_6] = VAR_2->env_facs_q[VAR_5 + 1][VAR_6 - 1] + VAR_10 * (get_vlc2(VAR_1, f_huff, 9, 3) - VAR_9);", "}", "}", "memcpy(VAR_2->env_facs_q[0], VAR_2->env_facs_q[VAR_2->bs_num_env],\nsizeof(VAR_2->env_facs_q[0]));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 131, 133 ], [ 135 ] ]
21,668
static int pva_read_packet(AVFormatContext *s, AVPacket *pkt) { ByteIOContext *pb = s->pb; PVAContext *pvactx = s->priv_data; int ret, syncword, streamid, reserved, flags, length, pts_flag; int64_t pva_pts = AV_NOPTS_VALUE; recover: syncword = get_be16(pb); streamid = get_byte(pb); get_byte(pb); /* counter not used */ reserved = get_byte(pb); flags = get_byte(pb); length = get_be16(pb); pts_flag = flags & 0x10; if (syncword != PVA_MAGIC) { av_log(s, AV_LOG_ERROR, "invalid syncword\n"); return AVERROR(EIO); } if (streamid != PVA_VIDEO_PAYLOAD && streamid != PVA_AUDIO_PAYLOAD) { av_log(s, AV_LOG_ERROR, "invalid streamid\n"); return AVERROR(EIO); } if (reserved != 0x55) { av_log(s, AV_LOG_WARNING, "expected reserved byte to be 0x55\n"); } if (length > PVA_MAX_PAYLOAD_LENGTH) { av_log(s, AV_LOG_ERROR, "invalid payload length %u\n", length); return AVERROR(EIO); } if (streamid == PVA_VIDEO_PAYLOAD && pts_flag) { pva_pts = get_be32(pb); length -= 4; } else if (streamid == PVA_AUDIO_PAYLOAD) { /* PVA Audio Packets either start with a signaled PES packet or * are a continuation of the previous PES packet. New PES packets * always start at the beginning of a PVA Packet, never somewhere in * the middle. */ if (!pvactx->continue_pes) { int pes_signal, pes_header_data_length, pes_packet_length, pes_flags; unsigned char pes_header_data[256]; pes_signal = get_be24(pb); get_byte(pb); pes_packet_length = get_be16(pb); pes_flags = get_be16(pb); pes_header_data_length = get_byte(pb); if (pes_signal != 1) { av_log(s, AV_LOG_WARNING, "expected signaled PES packet, " "trying to recover\n"); url_fskip(pb, length - 9); goto recover; } get_buffer(pb, pes_header_data, pes_header_data_length); length -= 9 + pes_header_data_length; pes_packet_length -= 3 + pes_header_data_length; pvactx->continue_pes = pes_packet_length; if (pes_flags & 0x80 && (pes_header_data[0] & 0xf0) == 0x20) pva_pts = ff_parse_pes_pts(pes_header_data); } pvactx->continue_pes -= length; if (pvactx->continue_pes < 0) { av_log(s, AV_LOG_WARNING, "audio data corruption\n"); pvactx->continue_pes = 0; } } if ((ret = av_get_packet(pb, pkt, length)) <= 0) return AVERROR(EIO); pkt->stream_index = streamid - 1; if (pva_pts != AV_NOPTS_VALUE) pkt->pts = pva_pts; return ret; }
false
FFmpeg
e661f760517b5843903941d5803de1890ebd8b1d
static int pva_read_packet(AVFormatContext *s, AVPacket *pkt) { ByteIOContext *pb = s->pb; PVAContext *pvactx = s->priv_data; int ret, syncword, streamid, reserved, flags, length, pts_flag; int64_t pva_pts = AV_NOPTS_VALUE; recover: syncword = get_be16(pb); streamid = get_byte(pb); get_byte(pb); reserved = get_byte(pb); flags = get_byte(pb); length = get_be16(pb); pts_flag = flags & 0x10; if (syncword != PVA_MAGIC) { av_log(s, AV_LOG_ERROR, "invalid syncword\n"); return AVERROR(EIO); } if (streamid != PVA_VIDEO_PAYLOAD && streamid != PVA_AUDIO_PAYLOAD) { av_log(s, AV_LOG_ERROR, "invalid streamid\n"); return AVERROR(EIO); } if (reserved != 0x55) { av_log(s, AV_LOG_WARNING, "expected reserved byte to be 0x55\n"); } if (length > PVA_MAX_PAYLOAD_LENGTH) { av_log(s, AV_LOG_ERROR, "invalid payload length %u\n", length); return AVERROR(EIO); } if (streamid == PVA_VIDEO_PAYLOAD && pts_flag) { pva_pts = get_be32(pb); length -= 4; } else if (streamid == PVA_AUDIO_PAYLOAD) { if (!pvactx->continue_pes) { int pes_signal, pes_header_data_length, pes_packet_length, pes_flags; unsigned char pes_header_data[256]; pes_signal = get_be24(pb); get_byte(pb); pes_packet_length = get_be16(pb); pes_flags = get_be16(pb); pes_header_data_length = get_byte(pb); if (pes_signal != 1) { av_log(s, AV_LOG_WARNING, "expected signaled PES packet, " "trying to recover\n"); url_fskip(pb, length - 9); goto recover; } get_buffer(pb, pes_header_data, pes_header_data_length); length -= 9 + pes_header_data_length; pes_packet_length -= 3 + pes_header_data_length; pvactx->continue_pes = pes_packet_length; if (pes_flags & 0x80 && (pes_header_data[0] & 0xf0) == 0x20) pva_pts = ff_parse_pes_pts(pes_header_data); } pvactx->continue_pes -= length; if (pvactx->continue_pes < 0) { av_log(s, AV_LOG_WARNING, "audio data corruption\n"); pvactx->continue_pes = 0; } } if ((ret = av_get_packet(pb, pkt, length)) <= 0) return AVERROR(EIO); pkt->stream_index = streamid - 1; if (pva_pts != AV_NOPTS_VALUE) pkt->pts = pva_pts; return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { ByteIOContext *pb = VAR_0->pb; PVAContext *pvactx = VAR_0->priv_data; int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; int64_t pva_pts = AV_NOPTS_VALUE; recover: VAR_3 = get_be16(pb); VAR_4 = get_byte(pb); get_byte(pb); VAR_5 = get_byte(pb); VAR_6 = get_byte(pb); VAR_7 = get_be16(pb); VAR_8 = VAR_6 & 0x10; if (VAR_3 != PVA_MAGIC) { av_log(VAR_0, AV_LOG_ERROR, "invalid VAR_3\n"); return AVERROR(EIO); } if (VAR_4 != PVA_VIDEO_PAYLOAD && VAR_4 != PVA_AUDIO_PAYLOAD) { av_log(VAR_0, AV_LOG_ERROR, "invalid VAR_4\n"); return AVERROR(EIO); } if (VAR_5 != 0x55) { av_log(VAR_0, AV_LOG_WARNING, "expected VAR_5 byte to be 0x55\n"); } if (VAR_7 > PVA_MAX_PAYLOAD_LENGTH) { av_log(VAR_0, AV_LOG_ERROR, "invalid payload VAR_7 %u\n", VAR_7); return AVERROR(EIO); } if (VAR_4 == PVA_VIDEO_PAYLOAD && VAR_8) { pva_pts = get_be32(pb); VAR_7 -= 4; } else if (VAR_4 == PVA_AUDIO_PAYLOAD) { if (!pvactx->continue_pes) { int VAR_9, VAR_10, VAR_11, VAR_12; unsigned char VAR_13[256]; VAR_9 = get_be24(pb); get_byte(pb); VAR_11 = get_be16(pb); VAR_12 = get_be16(pb); VAR_10 = get_byte(pb); if (VAR_9 != 1) { av_log(VAR_0, AV_LOG_WARNING, "expected signaled PES packet, " "trying to recover\n"); url_fskip(pb, VAR_7 - 9); goto recover; } get_buffer(pb, VAR_13, VAR_10); VAR_7 -= 9 + VAR_10; VAR_11 -= 3 + VAR_10; pvactx->continue_pes = VAR_11; if (VAR_12 & 0x80 && (VAR_13[0] & 0xf0) == 0x20) pva_pts = ff_parse_pes_pts(VAR_13); } pvactx->continue_pes -= VAR_7; if (pvactx->continue_pes < 0) { av_log(VAR_0, AV_LOG_WARNING, "audio data corruption\n"); pvactx->continue_pes = 0; } } if ((VAR_2 = av_get_packet(pb, VAR_1, VAR_7)) <= 0) return AVERROR(EIO); VAR_1->stream_index = VAR_4 - 1; if (pva_pts != AV_NOPTS_VALUE) VAR_1->pts = pva_pts; return VAR_2; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) {", "ByteIOContext *pb = VAR_0->pb;", "PVAContext *pvactx = VAR_0->priv_data;", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;", "int64_t pva_pts = AV_NOPTS_VALUE;", "recover:\nVAR_3 = get_be16(pb);", "VAR_4 = get_byte(pb);", "get_byte(pb);", "VAR_5 = get_byte(pb);", "VAR_6 = get_byte(pb);", "VAR_7 = get_be16(pb);", "VAR_8 = VAR_6 & 0x10;", "if (VAR_3 != PVA_MAGIC) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid VAR_3\\n\");", "return AVERROR(EIO);", "}", "if (VAR_4 != PVA_VIDEO_PAYLOAD && VAR_4 != PVA_AUDIO_PAYLOAD) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid VAR_4\\n\");", "return AVERROR(EIO);", "}", "if (VAR_5 != 0x55) {", "av_log(VAR_0, AV_LOG_WARNING, \"expected VAR_5 byte to be 0x55\\n\");", "}", "if (VAR_7 > PVA_MAX_PAYLOAD_LENGTH) {", "av_log(VAR_0, AV_LOG_ERROR, \"invalid payload VAR_7 %u\\n\", VAR_7);", "return AVERROR(EIO);", "}", "if (VAR_4 == PVA_VIDEO_PAYLOAD && VAR_8) {", "pva_pts = get_be32(pb);", "VAR_7 -= 4;", "} else if (VAR_4 == PVA_AUDIO_PAYLOAD) {", "if (!pvactx->continue_pes) {", "int VAR_9, VAR_10, VAR_11,\nVAR_12;", "unsigned char VAR_13[256];", "VAR_9 = get_be24(pb);", "get_byte(pb);", "VAR_11 = get_be16(pb);", "VAR_12 = get_be16(pb);", "VAR_10 = get_byte(pb);", "if (VAR_9 != 1) {", "av_log(VAR_0, AV_LOG_WARNING, \"expected signaled PES packet, \"\n\"trying to recover\\n\");", "url_fskip(pb, VAR_7 - 9);", "goto recover;", "}", "get_buffer(pb, VAR_13, VAR_10);", "VAR_7 -= 9 + VAR_10;", "VAR_11 -= 3 + VAR_10;", "pvactx->continue_pes = VAR_11;", "if (VAR_12 & 0x80 && (VAR_13[0] & 0xf0) == 0x20)\npva_pts = ff_parse_pes_pts(VAR_13);", "}", "pvactx->continue_pes -= VAR_7;", "if (pvactx->continue_pes < 0) {", "av_log(VAR_0, AV_LOG_WARNING, \"audio data corruption\\n\");", "pvactx->continue_pes = 0;", "}", "}", "if ((VAR_2 = av_get_packet(pb, VAR_1, VAR_7)) <= 0)\nreturn AVERROR(EIO);", "VAR_1->stream_index = VAR_4 - 1;", "if (pva_pts != AV_NOPTS_VALUE)\nVAR_1->pts = pva_pts;", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 123 ], [ 127 ], [ 131, 133 ], [ 135 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155, 157 ], [ 161 ], [ 163, 165 ], [ 169 ], [ 171 ] ]
21,669
static int decode_blck(uint8_t *frame, int width, int height, const uint8_t *src, const uint8_t *src_end) { memset(frame, 0, width * height); return 0; }
true
FFmpeg
29b0d94b43ac960cb442049a5d737a3386ff0337
static int decode_blck(uint8_t *frame, int width, int height, const uint8_t *src, const uint8_t *src_end) { memset(frame, 0, width * height); return 0; }
{ "code": [ " const uint8_t *src, const uint8_t *src_end)", " const uint8_t *src, const uint8_t *src_end)", " const uint8_t *src, const uint8_t *src_end)", " const uint8_t *src, const uint8_t *src_end)", " const uint8_t *src, const uint8_t *src_end)", " const uint8_t *src, const uint8_t *src_end)", " const uint8_t *src, const uint8_t *src_end)", "static int decode_blck(uint8_t *frame, int width, int height,", " const uint8_t *src, const uint8_t *src_end)" ], "line_no": [ 3, 3, 3, 3, 3, 3, 3, 1, 3 ] }
static int FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, const uint8_t *VAR_3, const uint8_t *VAR_4) { memset(VAR_0, 0, VAR_1 * VAR_2); return 0; }
[ "static int FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2,\nconst uint8_t *VAR_3, const uint8_t *VAR_4)\n{", "memset(VAR_0, 0, VAR_1 * VAR_2);", "return 0;", "}" ]
[ 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
21,671
static CharDriverState *qmp_chardev_open_socket(const char *id, ChardevBackend *backend, ChardevReturn *ret, Error **errp) { CharDriverState *chr; TCPCharDriver *s; ChardevSocket *sock = backend->u.socket; SocketAddress *addr = sock->addr; bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; bool is_listen = sock->has_server ? sock->server : true; bool is_telnet = sock->has_telnet ? sock->telnet : false; bool is_waitconnect = sock->has_wait ? sock->wait : false; int64_t reconnect = sock->has_reconnect ? sock->reconnect : 0; ChardevCommon *common = qapi_ChardevSocket_base(backend->u.socket); chr = qemu_chr_alloc(common, errp); if (!chr) { return NULL; } s = g_new0(TCPCharDriver, 1); s->is_unix = addr->type == SOCKET_ADDRESS_KIND_UNIX; s->is_listen = is_listen; s->is_telnet = is_telnet; s->do_nodelay = do_nodelay; qapi_copy_SocketAddress(&s->addr, sock->addr); chr->opaque = s; chr->chr_write = tcp_chr_write; chr->chr_sync_read = tcp_chr_sync_read; chr->chr_close = tcp_chr_close; chr->get_msgfds = tcp_get_msgfds; chr->set_msgfds = tcp_set_msgfds; chr->chr_add_client = tcp_chr_add_client; chr->chr_add_watch = tcp_chr_add_watch; chr->chr_update_read_handler = tcp_chr_update_read_handler; /* be isn't opened until we get a connection */ chr->explicit_be_open = true; chr->filename = SocketAddress_to_str("disconnected:", addr, is_listen, is_telnet); if (is_listen) { if (is_telnet) { s->do_telnetopt = 1; } } else if (reconnect > 0) { s->reconnect_time = reconnect; } if (s->reconnect_time) { socket_try_connect(chr); } else if (!qemu_chr_open_socket_fd(chr, errp)) { g_free(s); qemu_chr_free_common(chr); return NULL; } if (is_listen && is_waitconnect) { fprintf(stderr, "QEMU waiting for connection on: %s\n", chr->filename); tcp_chr_accept(QIO_CHANNEL(s->listen_ioc), G_IO_IN, chr); qio_channel_set_blocking(QIO_CHANNEL(s->listen_ioc), false, NULL); } return chr; }
true
qemu
a8fb542705ac7e0dcf00908bc47bf49cdd058abe
static CharDriverState *qmp_chardev_open_socket(const char *id, ChardevBackend *backend, ChardevReturn *ret, Error **errp) { CharDriverState *chr; TCPCharDriver *s; ChardevSocket *sock = backend->u.socket; SocketAddress *addr = sock->addr; bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; bool is_listen = sock->has_server ? sock->server : true; bool is_telnet = sock->has_telnet ? sock->telnet : false; bool is_waitconnect = sock->has_wait ? sock->wait : false; int64_t reconnect = sock->has_reconnect ? sock->reconnect : 0; ChardevCommon *common = qapi_ChardevSocket_base(backend->u.socket); chr = qemu_chr_alloc(common, errp); if (!chr) { return NULL; } s = g_new0(TCPCharDriver, 1); s->is_unix = addr->type == SOCKET_ADDRESS_KIND_UNIX; s->is_listen = is_listen; s->is_telnet = is_telnet; s->do_nodelay = do_nodelay; qapi_copy_SocketAddress(&s->addr, sock->addr); chr->opaque = s; chr->chr_write = tcp_chr_write; chr->chr_sync_read = tcp_chr_sync_read; chr->chr_close = tcp_chr_close; chr->get_msgfds = tcp_get_msgfds; chr->set_msgfds = tcp_set_msgfds; chr->chr_add_client = tcp_chr_add_client; chr->chr_add_watch = tcp_chr_add_watch; chr->chr_update_read_handler = tcp_chr_update_read_handler; chr->explicit_be_open = true; chr->filename = SocketAddress_to_str("disconnected:", addr, is_listen, is_telnet); if (is_listen) { if (is_telnet) { s->do_telnetopt = 1; } } else if (reconnect > 0) { s->reconnect_time = reconnect; } if (s->reconnect_time) { socket_try_connect(chr); } else if (!qemu_chr_open_socket_fd(chr, errp)) { g_free(s); qemu_chr_free_common(chr); return NULL; } if (is_listen && is_waitconnect) { fprintf(stderr, "QEMU waiting for connection on: %s\n", chr->filename); tcp_chr_accept(QIO_CHANNEL(s->listen_ioc), G_IO_IN, chr); qio_channel_set_blocking(QIO_CHANNEL(s->listen_ioc), false, NULL); } return chr; }
{ "code": [ " g_free(s);", " qemu_chr_free_common(chr);", " return NULL;" ], "line_no": [ 109, 111, 37 ] }
static CharDriverState *FUNC_0(const char *id, ChardevBackend *backend, ChardevReturn *ret, Error **errp) { CharDriverState *chr; TCPCharDriver *s; ChardevSocket *sock = backend->u.socket; SocketAddress *addr = sock->addr; bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; bool is_listen = sock->has_server ? sock->server : true; bool is_telnet = sock->has_telnet ? sock->telnet : false; bool is_waitconnect = sock->has_wait ? sock->wait : false; int64_t reconnect = sock->has_reconnect ? sock->reconnect : 0; ChardevCommon *common = qapi_ChardevSocket_base(backend->u.socket); chr = qemu_chr_alloc(common, errp); if (!chr) { return NULL; } s = g_new0(TCPCharDriver, 1); s->is_unix = addr->type == SOCKET_ADDRESS_KIND_UNIX; s->is_listen = is_listen; s->is_telnet = is_telnet; s->do_nodelay = do_nodelay; qapi_copy_SocketAddress(&s->addr, sock->addr); chr->opaque = s; chr->chr_write = tcp_chr_write; chr->chr_sync_read = tcp_chr_sync_read; chr->chr_close = tcp_chr_close; chr->get_msgfds = tcp_get_msgfds; chr->set_msgfds = tcp_set_msgfds; chr->chr_add_client = tcp_chr_add_client; chr->chr_add_watch = tcp_chr_add_watch; chr->chr_update_read_handler = tcp_chr_update_read_handler; chr->explicit_be_open = true; chr->filename = SocketAddress_to_str("disconnected:", addr, is_listen, is_telnet); if (is_listen) { if (is_telnet) { s->do_telnetopt = 1; } } else if (reconnect > 0) { s->reconnect_time = reconnect; } if (s->reconnect_time) { socket_try_connect(chr); } else if (!qemu_chr_open_socket_fd(chr, errp)) { g_free(s); qemu_chr_free_common(chr); return NULL; } if (is_listen && is_waitconnect) { fprintf(stderr, "QEMU waiting for connection on: %s\n", chr->filename); tcp_chr_accept(QIO_CHANNEL(s->listen_ioc), G_IO_IN, chr); qio_channel_set_blocking(QIO_CHANNEL(s->listen_ioc), false, NULL); } return chr; }
[ "static CharDriverState *FUNC_0(const char *id,\nChardevBackend *backend,\nChardevReturn *ret,\nError **errp)\n{", "CharDriverState *chr;", "TCPCharDriver *s;", "ChardevSocket *sock = backend->u.socket;", "SocketAddress *addr = sock->addr;", "bool do_nodelay = sock->has_nodelay ? sock->nodelay : false;", "bool is_listen = sock->has_server ? sock->server : true;", "bool is_telnet = sock->has_telnet ? sock->telnet : false;", "bool is_waitconnect = sock->has_wait ? sock->wait : false;", "int64_t reconnect = sock->has_reconnect ? sock->reconnect : 0;", "ChardevCommon *common = qapi_ChardevSocket_base(backend->u.socket);", "chr = qemu_chr_alloc(common, errp);", "if (!chr) {", "return NULL;", "}", "s = g_new0(TCPCharDriver, 1);", "s->is_unix = addr->type == SOCKET_ADDRESS_KIND_UNIX;", "s->is_listen = is_listen;", "s->is_telnet = is_telnet;", "s->do_nodelay = do_nodelay;", "qapi_copy_SocketAddress(&s->addr, sock->addr);", "chr->opaque = s;", "chr->chr_write = tcp_chr_write;", "chr->chr_sync_read = tcp_chr_sync_read;", "chr->chr_close = tcp_chr_close;", "chr->get_msgfds = tcp_get_msgfds;", "chr->set_msgfds = tcp_set_msgfds;", "chr->chr_add_client = tcp_chr_add_client;", "chr->chr_add_watch = tcp_chr_add_watch;", "chr->chr_update_read_handler = tcp_chr_update_read_handler;", "chr->explicit_be_open = true;", "chr->filename = SocketAddress_to_str(\"disconnected:\",\naddr, is_listen, is_telnet);", "if (is_listen) {", "if (is_telnet) {", "s->do_telnetopt = 1;", "}", "} else if (reconnect > 0) {", "s->reconnect_time = reconnect;", "}", "if (s->reconnect_time) {", "socket_try_connect(chr);", "} else if (!qemu_chr_open_socket_fd(chr, errp)) {", "g_free(s);", "qemu_chr_free_common(chr);", "return NULL;", "}", "if (is_listen && is_waitconnect) {", "fprintf(stderr, \"QEMU waiting for connection on: %s\\n\",\nchr->filename);", "tcp_chr_accept(QIO_CHANNEL(s->listen_ioc), G_IO_IN, chr);", "qio_channel_set_blocking(QIO_CHANNEL(s->listen_ioc), false, NULL);", "}", "return chr;", "}" ]
[ 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, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81, 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ] ]
21,672
static void pci_vpb_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = pci_vpb_realize; dc->reset = pci_vpb_reset; dc->vmsd = &pci_vpb_vmstate; dc->props = pci_vpb_properties; }
true
qemu
4c315c27661502a0813b129e41c0bf640c34a8d6
static void pci_vpb_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = pci_vpb_realize; dc->reset = pci_vpb_reset; dc->vmsd = &pci_vpb_vmstate; dc->props = pci_vpb_properties; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->realize = pci_vpb_realize; dc->reset = pci_vpb_reset; dc->vmsd = &pci_vpb_vmstate; dc->props = pci_vpb_properties; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->realize = pci_vpb_realize;", "dc->reset = pci_vpb_reset;", "dc->vmsd = &pci_vpb_vmstate;", "dc->props = pci_vpb_properties;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ] ]
21,673
static void gt64120_pci_mapping(GT64120State *s) { /* Update IO mapping */ if ((s->regs[GT_PCI0IOLD] & 0x7f) <= s->regs[GT_PCI0IOHD]) { /* Unmap old IO address */ if (s->PCI0IO_length) { memory_region_del_subregion(get_system_memory(), &s->PCI0IO_mem); memory_region_destroy(&s->PCI0IO_mem); } /* Map new IO address */ s->PCI0IO_start = s->regs[GT_PCI0IOLD] << 21; s->PCI0IO_length = ((s->regs[GT_PCI0IOHD] + 1) - (s->regs[GT_PCI0IOLD] & 0x7f)) << 21; isa_mem_base = s->PCI0IO_start; isa_mmio_init(s->PCI0IO_start, s->PCI0IO_length); } }
true
qemu
89da90b1b4acf24a9a3f2fd197b1bdf69ab24e72
static void gt64120_pci_mapping(GT64120State *s) { if ((s->regs[GT_PCI0IOLD] & 0x7f) <= s->regs[GT_PCI0IOHD]) { if (s->PCI0IO_length) { memory_region_del_subregion(get_system_memory(), &s->PCI0IO_mem); memory_region_destroy(&s->PCI0IO_mem); } s->PCI0IO_start = s->regs[GT_PCI0IOLD] << 21; s->PCI0IO_length = ((s->regs[GT_PCI0IOHD] + 1) - (s->regs[GT_PCI0IOLD] & 0x7f)) << 21; isa_mem_base = s->PCI0IO_start; isa_mmio_init(s->PCI0IO_start, s->PCI0IO_length); } }
{ "code": [ " isa_mmio_init(s->PCI0IO_start, s->PCI0IO_length);" ], "line_no": [ 31 ] }
static void FUNC_0(GT64120State *VAR_0) { if ((VAR_0->regs[GT_PCI0IOLD] & 0x7f) <= VAR_0->regs[GT_PCI0IOHD]) { if (VAR_0->PCI0IO_length) { memory_region_del_subregion(get_system_memory(), &VAR_0->PCI0IO_mem); memory_region_destroy(&VAR_0->PCI0IO_mem); } VAR_0->PCI0IO_start = VAR_0->regs[GT_PCI0IOLD] << 21; VAR_0->PCI0IO_length = ((VAR_0->regs[GT_PCI0IOHD] + 1) - (VAR_0->regs[GT_PCI0IOLD] & 0x7f)) << 21; isa_mem_base = VAR_0->PCI0IO_start; isa_mmio_init(VAR_0->PCI0IO_start, VAR_0->PCI0IO_length); } }
[ "static void FUNC_0(GT64120State *VAR_0)\n{", "if ((VAR_0->regs[GT_PCI0IOLD] & 0x7f) <= VAR_0->regs[GT_PCI0IOHD])\n{", "if (VAR_0->PCI0IO_length)\n{", "memory_region_del_subregion(get_system_memory(), &VAR_0->PCI0IO_mem);", "memory_region_destroy(&VAR_0->PCI0IO_mem);", "}", "VAR_0->PCI0IO_start = VAR_0->regs[GT_PCI0IOLD] << 21;", "VAR_0->PCI0IO_length = ((VAR_0->regs[GT_PCI0IOHD] + 1) - (VAR_0->regs[GT_PCI0IOLD] & 0x7f)) << 21;", "isa_mem_base = VAR_0->PCI0IO_start;", "isa_mmio_init(VAR_0->PCI0IO_start, VAR_0->PCI0IO_length);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 7, 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
21,674
static void *qemu_dummy_cpu_thread_fn(void *arg) { #ifdef _WIN32 fprintf(stderr, "qtest is not supported under Windows\n"); exit(1); #else CPUState *cpu = arg; sigset_t waitset; int r; rcu_register_thread(); qemu_mutex_lock_iothread(); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); cpu->can_do_io = 1; sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); /* signal CPU creation */ cpu->created = true; qemu_cond_signal(&qemu_cpu_cond); current_cpu = cpu; while (1) { current_cpu = NULL; qemu_mutex_unlock_iothread(); do { int sig; r = sigwait(&waitset, &sig); } while (r == -1 && (errno == EAGAIN || errno == EINTR)); if (r == -1) { perror("sigwait"); exit(1); } qemu_mutex_lock_iothread(); current_cpu = cpu; qemu_wait_io_event_common(cpu); } return NULL; #endif }
true
qemu
372579427a5040a26dfee78464b50e2bdf27ef26
static void *qemu_dummy_cpu_thread_fn(void *arg) { #ifdef _WIN32 fprintf(stderr, "qtest is not supported under Windows\n"); exit(1); #else CPUState *cpu = arg; sigset_t waitset; int r; rcu_register_thread(); qemu_mutex_lock_iothread(); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); cpu->can_do_io = 1; sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); cpu->created = true; qemu_cond_signal(&qemu_cpu_cond); current_cpu = cpu; while (1) { current_cpu = NULL; qemu_mutex_unlock_iothread(); do { int sig; r = sigwait(&waitset, &sig); } while (r == -1 && (errno == EAGAIN || errno == EINTR)); if (r == -1) { perror("sigwait"); exit(1); } qemu_mutex_lock_iothread(); current_cpu = cpu; qemu_wait_io_event_common(cpu); } return NULL; #endif }
{ "code": [ " qemu_wait_io_event_common(cpu);", " current_cpu = cpu;", " current_cpu = NULL;", " current_cpu = cpu;" ], "line_no": [ 77, 49, 53, 75 ] }
static void *FUNC_0(void *VAR_0) { #ifdef _WIN32 fprintf(stderr, "qtest is not supported under Windows\n"); exit(1); #else CPUState *cpu = VAR_0; sigset_t waitset; int VAR_1; rcu_register_thread(); qemu_mutex_lock_iothread(); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); cpu->can_do_io = 1; sigemptyset(&waitset); sigaddset(&waitset, SIG_IPI); cpu->created = true; qemu_cond_signal(&qemu_cpu_cond); current_cpu = cpu; while (1) { current_cpu = NULL; qemu_mutex_unlock_iothread(); do { int VAR_2; VAR_1 = sigwait(&waitset, &VAR_2); } while (VAR_1 == -1 && (errno == EAGAIN || errno == EINTR)); if (VAR_1 == -1) { perror("sigwait"); exit(1); } qemu_mutex_lock_iothread(); current_cpu = cpu; qemu_wait_io_event_common(cpu); } return NULL; #endif }
[ "static void *FUNC_0(void *VAR_0)\n{", "#ifdef _WIN32\nfprintf(stderr, \"qtest is not supported under Windows\\n\");", "exit(1);", "#else\nCPUState *cpu = VAR_0;", "sigset_t waitset;", "int VAR_1;", "rcu_register_thread();", "qemu_mutex_lock_iothread();", "qemu_thread_get_self(cpu->thread);", "cpu->thread_id = qemu_get_thread_id();", "cpu->can_do_io = 1;", "sigemptyset(&waitset);", "sigaddset(&waitset, SIG_IPI);", "cpu->created = true;", "qemu_cond_signal(&qemu_cpu_cond);", "current_cpu = cpu;", "while (1) {", "current_cpu = NULL;", "qemu_mutex_unlock_iothread();", "do {", "int VAR_2;", "VAR_1 = sigwait(&waitset, &VAR_2);", "} while (VAR_1 == -1 && (errno == EAGAIN || errno == EINTR));", "if (VAR_1 == -1) {", "perror(\"sigwait\");", "exit(1);", "}", "qemu_mutex_lock_iothread();", "current_cpu = cpu;", "qemu_wait_io_event_common(cpu);", "}", "return NULL;", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85, 87 ] ]
21,675
void target_disas(FILE *out, CPUState *cpu, target_ulong code, target_ulong size, int flags) { CPUClass *cc = CPU_GET_CLASS(cpu); target_ulong pc; int count; CPUDebug s; INIT_DISASSEMBLE_INFO(s.info, out, fprintf); s.cpu = cpu; s.info.read_memory_func = target_read_memory; s.info.read_memory_inner_func = NULL; s.info.buffer_vma = code; s.info.buffer_length = size; s.info.print_address_func = generic_print_address; #ifdef TARGET_WORDS_BIGENDIAN s.info.endian = BFD_ENDIAN_BIG; #else s.info.endian = BFD_ENDIAN_LITTLE; #endif if (cc->disas_set_info) { cc->disas_set_info(cpu, &s.info); } #if defined(TARGET_I386) if (flags == 2) { s.info.mach = bfd_mach_x86_64; } else if (flags == 1) { s.info.mach = bfd_mach_i386_i8086; } else { s.info.mach = bfd_mach_i386_i386; } s.info.print_insn = print_insn_i386; #elif defined(TARGET_PPC) if ((flags >> 16) & 1) { s.info.endian = BFD_ENDIAN_LITTLE; } if (flags & 0xFFFF) { /* If we have a precise definition of the instruction set, use it. */ s.info.mach = flags & 0xFFFF; } else { #ifdef TARGET_PPC64 s.info.mach = bfd_mach_ppc64; #else s.info.mach = bfd_mach_ppc; #endif } s.info.disassembler_options = (char *)"any"; s.info.print_insn = print_insn_ppc; #endif if (s.info.print_insn == NULL) { s.info.print_insn = print_insn_od_target; } for (pc = code; size > 0; pc += count, size -= count) { fprintf(out, "0x" TARGET_FMT_lx ": ", pc); count = s.info.print_insn(pc, &s.info); #if 0 { int i; uint8_t b; fprintf(out, " {"); for(i = 0; i < count; i++) { target_read_memory(pc + i, &b, 1, &s.info); fprintf(out, " %02x", b); } fprintf(out, " }"); } #endif fprintf(out, "\n"); if (count < 0) break; if (size < count) { fprintf(out, "Disassembler disagrees with translator over instruction " "decoding\n" "Please report this to [email protected]\n"); break; } } }
true
qemu
eb584b401fdc0866d2ff0c03ab8b09d2ba04a49b
void target_disas(FILE *out, CPUState *cpu, target_ulong code, target_ulong size, int flags) { CPUClass *cc = CPU_GET_CLASS(cpu); target_ulong pc; int count; CPUDebug s; INIT_DISASSEMBLE_INFO(s.info, out, fprintf); s.cpu = cpu; s.info.read_memory_func = target_read_memory; s.info.read_memory_inner_func = NULL; s.info.buffer_vma = code; s.info.buffer_length = size; s.info.print_address_func = generic_print_address; #ifdef TARGET_WORDS_BIGENDIAN s.info.endian = BFD_ENDIAN_BIG; #else s.info.endian = BFD_ENDIAN_LITTLE; #endif if (cc->disas_set_info) { cc->disas_set_info(cpu, &s.info); } #if defined(TARGET_I386) if (flags == 2) { s.info.mach = bfd_mach_x86_64; } else if (flags == 1) { s.info.mach = bfd_mach_i386_i8086; } else { s.info.mach = bfd_mach_i386_i386; } s.info.print_insn = print_insn_i386; #elif defined(TARGET_PPC) if ((flags >> 16) & 1) { s.info.endian = BFD_ENDIAN_LITTLE; } if (flags & 0xFFFF) { s.info.mach = flags & 0xFFFF; } else { #ifdef TARGET_PPC64 s.info.mach = bfd_mach_ppc64; #else s.info.mach = bfd_mach_ppc; #endif } s.info.disassembler_options = (char *)"any"; s.info.print_insn = print_insn_ppc; #endif if (s.info.print_insn == NULL) { s.info.print_insn = print_insn_od_target; } for (pc = code; size > 0; pc += count, size -= count) { fprintf(out, "0x" TARGET_FMT_lx ": ", pc); count = s.info.print_insn(pc, &s.info); #if 0 { int i; uint8_t b; fprintf(out, " {"); for(i = 0; i < count; i++) { target_read_memory(pc + i, &b, 1, &s.info); fprintf(out, " %02x", b); } fprintf(out, " }"); } #endif fprintf(out, "\n"); if (count < 0) break; if (size < count) { fprintf(out, "Disassembler disagrees with translator over instruction " "decoding\n" "Please report this to [email protected]\n"); break; } } }
{ "code": [ " s.info.read_memory_inner_func = NULL;" ], "line_no": [ 25 ] }
void FUNC_0(FILE *VAR_0, CPUState *VAR_1, target_ulong VAR_2, target_ulong VAR_3, int VAR_4) { CPUClass *cc = CPU_GET_CLASS(VAR_1); target_ulong pc; int VAR_5; CPUDebug s; INIT_DISASSEMBLE_INFO(s.info, VAR_0, fprintf); s.VAR_1 = VAR_1; s.info.read_memory_func = target_read_memory; s.info.read_memory_inner_func = NULL; s.info.buffer_vma = VAR_2; s.info.buffer_length = VAR_3; s.info.print_address_func = generic_print_address; #ifdef TARGET_WORDS_BIGENDIAN s.info.endian = BFD_ENDIAN_BIG; #else s.info.endian = BFD_ENDIAN_LITTLE; #endif if (cc->disas_set_info) { cc->disas_set_info(VAR_1, &s.info); } #if defined(TARGET_I386) if (VAR_4 == 2) { s.info.mach = bfd_mach_x86_64; } else if (VAR_4 == 1) { s.info.mach = bfd_mach_i386_i8086; } else { s.info.mach = bfd_mach_i386_i386; } s.info.print_insn = print_insn_i386; #elif defined(TARGET_PPC) if ((VAR_4 >> 16) & 1) { s.info.endian = BFD_ENDIAN_LITTLE; } if (VAR_4 & 0xFFFF) { s.info.mach = VAR_4 & 0xFFFF; } else { #ifdef TARGET_PPC64 s.info.mach = bfd_mach_ppc64; #else s.info.mach = bfd_mach_ppc; #endif } s.info.disassembler_options = (char *)"any"; s.info.print_insn = print_insn_ppc; #endif if (s.info.print_insn == NULL) { s.info.print_insn = print_insn_od_target; } for (pc = VAR_2; VAR_3 > 0; pc += VAR_5, VAR_3 -= VAR_5) { fprintf(VAR_0, "0x" TARGET_FMT_lx ": ", pc); VAR_5 = s.info.print_insn(pc, &s.info); #if 0 { int i; uint8_t b; fprintf(VAR_0, " {"); for(i = 0; i < VAR_5; i++) { target_read_memory(pc + i, &b, 1, &s.info); fprintf(VAR_0, " %02x", b); } fprintf(VAR_0, " }"); } #endif fprintf(VAR_0, "\n"); if (VAR_5 < 0) break; if (VAR_3 < VAR_5) { fprintf(VAR_0, "Disassembler disagrees with translator over instruction " "decoding\n" "Please report this to [email protected]\n"); break; } } }
[ "void FUNC_0(FILE *VAR_0, CPUState *VAR_1, target_ulong VAR_2,\ntarget_ulong VAR_3, int VAR_4)\n{", "CPUClass *cc = CPU_GET_CLASS(VAR_1);", "target_ulong pc;", "int VAR_5;", "CPUDebug s;", "INIT_DISASSEMBLE_INFO(s.info, VAR_0, fprintf);", "s.VAR_1 = VAR_1;", "s.info.read_memory_func = target_read_memory;", "s.info.read_memory_inner_func = NULL;", "s.info.buffer_vma = VAR_2;", "s.info.buffer_length = VAR_3;", "s.info.print_address_func = generic_print_address;", "#ifdef TARGET_WORDS_BIGENDIAN\ns.info.endian = BFD_ENDIAN_BIG;", "#else\ns.info.endian = BFD_ENDIAN_LITTLE;", "#endif\nif (cc->disas_set_info) {", "cc->disas_set_info(VAR_1, &s.info);", "}", "#if defined(TARGET_I386)\nif (VAR_4 == 2) {", "s.info.mach = bfd_mach_x86_64;", "} else if (VAR_4 == 1) {", "s.info.mach = bfd_mach_i386_i8086;", "} else {", "s.info.mach = bfd_mach_i386_i386;", "}", "s.info.print_insn = print_insn_i386;", "#elif defined(TARGET_PPC)\nif ((VAR_4 >> 16) & 1) {", "s.info.endian = BFD_ENDIAN_LITTLE;", "}", "if (VAR_4 & 0xFFFF) {", "s.info.mach = VAR_4 & 0xFFFF;", "} else {", "#ifdef TARGET_PPC64\ns.info.mach = bfd_mach_ppc64;", "#else\ns.info.mach = bfd_mach_ppc;", "#endif\n}", "s.info.disassembler_options = (char *)\"any\";", "s.info.print_insn = print_insn_ppc;", "#endif\nif (s.info.print_insn == NULL) {", "s.info.print_insn = print_insn_od_target;", "}", "for (pc = VAR_2; VAR_3 > 0; pc += VAR_5, VAR_3 -= VAR_5) {", "fprintf(VAR_0, \"0x\" TARGET_FMT_lx \": \", pc);", "VAR_5 = s.info.print_insn(pc, &s.info);", "#if 0\n{", "int i;", "uint8_t b;", "fprintf(VAR_0, \" {\");", "for(i = 0; i < VAR_5; i++) {", "target_read_memory(pc + i, &b, 1, &s.info);", "fprintf(VAR_0, \" %02x\", b);", "}", "fprintf(VAR_0, \" }\");", "}", "#endif\nfprintf(VAR_0, \"\\n\");", "if (VAR_5 < 0)\nbreak;", "if (VAR_3 < VAR_5) {", "fprintf(VAR_0,\n\"Disassembler disagrees with translator over instruction \"\n\"decoding\\n\"\n\"Please report this to [email protected]\\n\");", "break;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 39, 41 ], [ 43, 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 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 ] ]
21,676
static inline int decode_bytes(const uint8_t *inbuffer, uint8_t *out, int bytes) { static const uint32_t tab[4] = { AV_BE2NE32C(0x37c511f2), AV_BE2NE32C(0xf237c511), AV_BE2NE32C(0x11f237c5), AV_BE2NE32C(0xc511f237), }; int i, off; uint32_t c; const uint32_t *buf; uint32_t *obuf = (uint32_t *) out; /* FIXME: 64 bit platforms would be able to do 64 bits at a time. * I'm too lazy though, should be something like * for (i = 0; i < bitamount / 64; i++) * (int64_t) out[i] = 0x37c511f237c511f2 ^ av_be2ne64(int64_t) in[i]); * Buffer alignment needs to be checked. */ off = (intptr_t) inbuffer & 3; buf = (const uint32_t *) (inbuffer - off); c = tab[off]; bytes += 3 + off; for (i = 0; i < bytes / 4; i++) obuf[i] = c ^ buf[i]; return off; }
true
FFmpeg
b5d2bf964be338bf8e86a01619646332729b434e
static inline int decode_bytes(const uint8_t *inbuffer, uint8_t *out, int bytes) { static const uint32_t tab[4] = { AV_BE2NE32C(0x37c511f2), AV_BE2NE32C(0xf237c511), AV_BE2NE32C(0x11f237c5), AV_BE2NE32C(0xc511f237), }; int i, off; uint32_t c; const uint32_t *buf; uint32_t *obuf = (uint32_t *) out; off = (intptr_t) inbuffer & 3; buf = (const uint32_t *) (inbuffer - off); c = tab[off]; bytes += 3 + off; for (i = 0; i < bytes / 4; i++) obuf[i] = c ^ buf[i]; return off; }
{ "code": [ " AV_BE2NE32C(0x37c511f2), AV_BE2NE32C(0xf237c511),", " AV_BE2NE32C(0x11f237c5), AV_BE2NE32C(0xc511f237)," ], "line_no": [ 7, 9 ] }
static inline int FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, int VAR_2) { static const uint32_t VAR_3[4] = { AV_BE2NE32C(0x37c511f2), AV_BE2NE32C(0xf237c511), AV_BE2NE32C(0x11f237c5), AV_BE2NE32C(0xc511f237), }; int VAR_4, VAR_5; uint32_t c; const uint32_t *VAR_6; uint32_t *obuf = (uint32_t *) VAR_1; VAR_5 = (intptr_t) VAR_0 & 3; VAR_6 = (const uint32_t *) (VAR_0 - VAR_5); c = VAR_3[VAR_5]; VAR_2 += 3 + VAR_5; for (VAR_4 = 0; VAR_4 < VAR_2 / 4; VAR_4++) obuf[VAR_4] = c ^ VAR_6[VAR_4]; return VAR_5; }
[ "static inline int FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, int VAR_2)\n{", "static const uint32_t VAR_3[4] = {", "AV_BE2NE32C(0x37c511f2), AV_BE2NE32C(0xf237c511),\nAV_BE2NE32C(0x11f237c5), AV_BE2NE32C(0xc511f237),\n};", "int VAR_4, VAR_5;", "uint32_t c;", "const uint32_t *VAR_6;", "uint32_t *obuf = (uint32_t *) VAR_1;", "VAR_5 = (intptr_t) VAR_0 & 3;", "VAR_6 = (const uint32_t *) (VAR_0 - VAR_5);", "c = VAR_3[VAR_5];", "VAR_2 += 3 + VAR_5;", "for (VAR_4 = 0; VAR_4 < VAR_2 / 4; VAR_4++)", "obuf[VAR_4] = c ^ VAR_6[VAR_4];", "return VAR_5;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
21,677
static void coroutine_fn v9fs_fix_fid_paths(V9fsPDU *pdu, V9fsPath *olddir, V9fsString *old_name, V9fsPath *newdir, V9fsString *new_name) { V9fsFidState *tfidp; V9fsPath oldpath, newpath; V9fsState *s = pdu->s; v9fs_path_init(&oldpath); v9fs_path_init(&newpath); v9fs_co_name_to_path(pdu, olddir, old_name->data, &oldpath); v9fs_co_name_to_path(pdu, newdir, new_name->data, &newpath); /* * Fixup fid's pointing to the old name to * start pointing to the new name */ for (tfidp = s->fid_list; tfidp; tfidp = tfidp->next) { if (v9fs_path_is_ancestor(&oldpath, &tfidp->path)) { /* replace the name */ v9fs_fix_path(&tfidp->path, &newpath, strlen(oldpath.data)); } } v9fs_path_free(&oldpath); v9fs_path_free(&newpath); }
true
qemu
4fa62005d0a85df9bb14ea9f53109d7c5f66eeb9
static void coroutine_fn v9fs_fix_fid_paths(V9fsPDU *pdu, V9fsPath *olddir, V9fsString *old_name, V9fsPath *newdir, V9fsString *new_name) { V9fsFidState *tfidp; V9fsPath oldpath, newpath; V9fsState *s = pdu->s; v9fs_path_init(&oldpath); v9fs_path_init(&newpath); v9fs_co_name_to_path(pdu, olddir, old_name->data, &oldpath); v9fs_co_name_to_path(pdu, newdir, new_name->data, &newpath); for (tfidp = s->fid_list; tfidp; tfidp = tfidp->next) { if (v9fs_path_is_ancestor(&oldpath, &tfidp->path)) { v9fs_fix_path(&tfidp->path, &newpath, strlen(oldpath.data)); } } v9fs_path_free(&oldpath); v9fs_path_free(&newpath); }
{ "code": [ "static void coroutine_fn v9fs_fix_fid_paths(V9fsPDU *pdu, V9fsPath *olddir,", " V9fsString *old_name,", " V9fsPath *newdir,", " V9fsString *new_name)", " v9fs_co_name_to_path(pdu, olddir, old_name->data, &oldpath);", " v9fs_co_name_to_path(pdu, newdir, new_name->data, &newpath);" ], "line_no": [ 1, 3, 5, 7, 25, 27 ] }
static void VAR_0 v9fs_fix_fid_paths(V9fsPDU *pdu, V9fsPath *olddir, V9fsString *old_name, V9fsPath *newdir, V9fsString *new_name) { V9fsFidState *tfidp; V9fsPath oldpath, newpath; V9fsState *s = pdu->s; v9fs_path_init(&oldpath); v9fs_path_init(&newpath); v9fs_co_name_to_path(pdu, olddir, old_name->data, &oldpath); v9fs_co_name_to_path(pdu, newdir, new_name->data, &newpath); for (tfidp = s->fid_list; tfidp; tfidp = tfidp->next) { if (v9fs_path_is_ancestor(&oldpath, &tfidp->path)) { v9fs_fix_path(&tfidp->path, &newpath, strlen(oldpath.data)); } } v9fs_path_free(&oldpath); v9fs_path_free(&newpath); }
[ "static void VAR_0 v9fs_fix_fid_paths(V9fsPDU *pdu, V9fsPath *olddir,\nV9fsString *old_name,\nV9fsPath *newdir,\nV9fsString *new_name)\n{", "V9fsFidState *tfidp;", "V9fsPath oldpath, newpath;", "V9fsState *s = pdu->s;", "v9fs_path_init(&oldpath);", "v9fs_path_init(&newpath);", "v9fs_co_name_to_path(pdu, olddir, old_name->data, &oldpath);", "v9fs_co_name_to_path(pdu, newdir, new_name->data, &newpath);", "for (tfidp = s->fid_list; tfidp; tfidp = tfidp->next) {", "if (v9fs_path_is_ancestor(&oldpath, &tfidp->path)) {", "v9fs_fix_path(&tfidp->path, &newpath, strlen(oldpath.data));", "}", "}", "v9fs_path_free(&oldpath);", "v9fs_path_free(&newpath);", "}" ]
[ 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ] ]
21,678
static inline void rv40_weak_loop_filter(uint8_t *src, const int step, const int filter_p1, const int filter_q1, const int alpha, const int beta, const int lim_p0q0, const int lim_q1, const int lim_p1, const int diff_p1p0, const int diff_q1q0, const int diff_p1p2, const int diff_q1q2) { uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int t, u, diff; t = src[0*step] - src[-1*step]; if(!t) return; u = (alpha * FFABS(t)) >> 7; if(u > 3 - (filter_p1 && filter_q1)) return; t <<= 2; if(filter_p1 && filter_q1) t += src[-2*step] - src[1*step]; diff = CLIP_SYMM((t + 4) >> 3, lim_p0q0); src[-1*step] = cm[src[-1*step] + diff]; src[ 0*step] = cm[src[ 0*step] - diff]; if(FFABS(diff_p1p2) <= beta && filter_p1){ t = (diff_p1p0 + diff_p1p2 - diff) >> 1; src[-2*step] = cm[src[-2*step] - CLIP_SYMM(t, lim_p1)]; } if(FFABS(diff_q1q2) <= beta && filter_q1){ t = (diff_q1q0 + diff_q1q2 + diff) >> 1; src[ 1*step] = cm[src[ 1*step] - CLIP_SYMM(t, lim_q1)]; } }
false
FFmpeg
d8edf1b515ae9fbcea2103305241d130c16e1003
static inline void rv40_weak_loop_filter(uint8_t *src, const int step, const int filter_p1, const int filter_q1, const int alpha, const int beta, const int lim_p0q0, const int lim_q1, const int lim_p1, const int diff_p1p0, const int diff_q1q0, const int diff_p1p2, const int diff_q1q2) { uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int t, u, diff; t = src[0*step] - src[-1*step]; if(!t) return; u = (alpha * FFABS(t)) >> 7; if(u > 3 - (filter_p1 && filter_q1)) return; t <<= 2; if(filter_p1 && filter_q1) t += src[-2*step] - src[1*step]; diff = CLIP_SYMM((t + 4) >> 3, lim_p0q0); src[-1*step] = cm[src[-1*step] + diff]; src[ 0*step] = cm[src[ 0*step] - diff]; if(FFABS(diff_p1p2) <= beta && filter_p1){ t = (diff_p1p0 + diff_p1p2 - diff) >> 1; src[-2*step] = cm[src[-2*step] - CLIP_SYMM(t, lim_p1)]; } if(FFABS(diff_q1q2) <= beta && filter_q1){ t = (diff_q1q0 + diff_q1q2 + diff) >> 1; src[ 1*step] = cm[src[ 1*step] - CLIP_SYMM(t, lim_q1)]; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(uint8_t *VAR_0, const int VAR_1, const int VAR_2, const int VAR_3, const int VAR_4, const int VAR_5, const int VAR_6, const int VAR_7, const int VAR_8, const int VAR_9, const int VAR_10, const int VAR_11, const int VAR_12) { uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int VAR_13, VAR_14, VAR_15; VAR_13 = VAR_0[0*VAR_1] - VAR_0[-1*VAR_1]; if(!VAR_13) return; VAR_14 = (VAR_4 * FFABS(VAR_13)) >> 7; if(VAR_14 > 3 - (VAR_2 && VAR_3)) return; VAR_13 <<= 2; if(VAR_2 && VAR_3) VAR_13 += VAR_0[-2*VAR_1] - VAR_0[1*VAR_1]; VAR_15 = CLIP_SYMM((VAR_13 + 4) >> 3, VAR_6); VAR_0[-1*VAR_1] = cm[VAR_0[-1*VAR_1] + VAR_15]; VAR_0[ 0*VAR_1] = cm[VAR_0[ 0*VAR_1] - VAR_15]; if(FFABS(VAR_11) <= VAR_5 && VAR_2){ VAR_13 = (VAR_9 + VAR_11 - VAR_15) >> 1; VAR_0[-2*VAR_1] = cm[VAR_0[-2*VAR_1] - CLIP_SYMM(VAR_13, VAR_8)]; } if(FFABS(VAR_12) <= VAR_5 && VAR_3){ VAR_13 = (VAR_10 + VAR_12 + VAR_15) >> 1; VAR_0[ 1*VAR_1] = cm[VAR_0[ 1*VAR_1] - CLIP_SYMM(VAR_13, VAR_7)]; } }
[ "static inline void FUNC_0(uint8_t *VAR_0, const int VAR_1,\nconst int VAR_2, const int VAR_3,\nconst int VAR_4, const int VAR_5,\nconst int VAR_6,\nconst int VAR_7, const int VAR_8,\nconst int VAR_9, const int VAR_10,\nconst int VAR_11, const int VAR_12)\n{", "uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", "int VAR_13, VAR_14, VAR_15;", "VAR_13 = VAR_0[0*VAR_1] - VAR_0[-1*VAR_1];", "if(!VAR_13)\nreturn;", "VAR_14 = (VAR_4 * FFABS(VAR_13)) >> 7;", "if(VAR_14 > 3 - (VAR_2 && VAR_3))\nreturn;", "VAR_13 <<= 2;", "if(VAR_2 && VAR_3)\nVAR_13 += VAR_0[-2*VAR_1] - VAR_0[1*VAR_1];", "VAR_15 = CLIP_SYMM((VAR_13 + 4) >> 3, VAR_6);", "VAR_0[-1*VAR_1] = cm[VAR_0[-1*VAR_1] + VAR_15];", "VAR_0[ 0*VAR_1] = cm[VAR_0[ 0*VAR_1] - VAR_15];", "if(FFABS(VAR_11) <= VAR_5 && VAR_2){", "VAR_13 = (VAR_9 + VAR_11 - VAR_15) >> 1;", "VAR_0[-2*VAR_1] = cm[VAR_0[-2*VAR_1] - CLIP_SYMM(VAR_13, VAR_8)];", "}", "if(FFABS(VAR_12) <= VAR_5 && VAR_3){", "VAR_13 = (VAR_10 + VAR_12 + VAR_15) >> 1;", "VAR_0[ 1*VAR_1] = cm[VAR_0[ 1*VAR_1] - CLIP_SYMM(VAR_13, VAR_7)];", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ] ]
21,679
static int fileTest(uint8_t *ref[4], int refStride[4], int w, int h, FILE *fp, enum AVPixelFormat srcFormat_in, enum AVPixelFormat dstFormat_in) { char buf[256]; while (fgets(buf, sizeof(buf), fp)) { struct Results r; enum AVPixelFormat srcFormat; char srcStr[12]; int srcW, srcH; enum AVPixelFormat dstFormat; char dstStr[12]; int dstW, dstH; int flags; int ret; ret = sscanf(buf, " %12s %dx%d -> %12s %dx%d flags=%d CRC=%x" " SSD=%"PRId64 ", %"PRId64 ", %"PRId64 ", %"PRId64 "\n", srcStr, &srcW, &srcH, dstStr, &dstW, &dstH, &flags, &r.crc, &r.ssdY, &r.ssdU, &r.ssdV, &r.ssdA); if (ret != 12) { srcStr[0] = dstStr[0] = 0; ret = sscanf(buf, "%12s -> %12s\n", srcStr, dstStr); } srcFormat = av_get_pix_fmt(srcStr); dstFormat = av_get_pix_fmt(dstStr); if (srcFormat == AV_PIX_FMT_NONE || dstFormat == AV_PIX_FMT_NONE) { fprintf(stderr, "malformed input file\n"); return -1; } if ((srcFormat_in != AV_PIX_FMT_NONE && srcFormat_in != srcFormat) || (dstFormat_in != AV_PIX_FMT_NONE && dstFormat_in != dstFormat)) continue; if (ret != 12) { printf("%s", buf); continue; } doTest(ref, refStride, w, h, srcFormat, dstFormat, srcW, srcH, dstW, dstH, flags, &r); } return 0; }
false
FFmpeg
c0f0bec2f205e567fc0eef8a9bf59d585e14094c
static int fileTest(uint8_t *ref[4], int refStride[4], int w, int h, FILE *fp, enum AVPixelFormat srcFormat_in, enum AVPixelFormat dstFormat_in) { char buf[256]; while (fgets(buf, sizeof(buf), fp)) { struct Results r; enum AVPixelFormat srcFormat; char srcStr[12]; int srcW, srcH; enum AVPixelFormat dstFormat; char dstStr[12]; int dstW, dstH; int flags; int ret; ret = sscanf(buf, " %12s %dx%d -> %12s %dx%d flags=%d CRC=%x" " SSD=%"PRId64 ", %"PRId64 ", %"PRId64 ", %"PRId64 "\n", srcStr, &srcW, &srcH, dstStr, &dstW, &dstH, &flags, &r.crc, &r.ssdY, &r.ssdU, &r.ssdV, &r.ssdA); if (ret != 12) { srcStr[0] = dstStr[0] = 0; ret = sscanf(buf, "%12s -> %12s\n", srcStr, dstStr); } srcFormat = av_get_pix_fmt(srcStr); dstFormat = av_get_pix_fmt(dstStr); if (srcFormat == AV_PIX_FMT_NONE || dstFormat == AV_PIX_FMT_NONE) { fprintf(stderr, "malformed input file\n"); return -1; } if ((srcFormat_in != AV_PIX_FMT_NONE && srcFormat_in != srcFormat) || (dstFormat_in != AV_PIX_FMT_NONE && dstFormat_in != dstFormat)) continue; if (ret != 12) { printf("%s", buf); continue; } doTest(ref, refStride, w, h, srcFormat, dstFormat, srcW, srcH, dstW, dstH, flags, &r); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4], int VAR_2, int VAR_3, FILE *VAR_4, enum AVPixelFormat VAR_5, enum AVPixelFormat VAR_6) { char VAR_7[256]; while (fgets(VAR_7, sizeof(VAR_7), VAR_4)) { struct Results VAR_8; enum AVPixelFormat VAR_9; char VAR_10[12]; int VAR_11, VAR_12; enum AVPixelFormat VAR_13; char VAR_14[12]; int VAR_15, VAR_16; int VAR_17; int VAR_18; VAR_18 = sscanf(VAR_7, " %12s %dx%d -> %12s %dx%d VAR_17=%d CRC=%x" " SSD=%"PRId64 ", %"PRId64 ", %"PRId64 ", %"PRId64 "\n", VAR_10, &VAR_11, &VAR_12, VAR_14, &VAR_15, &VAR_16, &VAR_17, &VAR_8.crc, &VAR_8.ssdY, &VAR_8.ssdU, &VAR_8.ssdV, &VAR_8.ssdA); if (VAR_18 != 12) { VAR_10[0] = VAR_14[0] = 0; VAR_18 = sscanf(VAR_7, "%12s -> %12s\n", VAR_10, VAR_14); } VAR_9 = av_get_pix_fmt(VAR_10); VAR_13 = av_get_pix_fmt(VAR_14); if (VAR_9 == AV_PIX_FMT_NONE || VAR_13 == AV_PIX_FMT_NONE) { fprintf(stderr, "malformed input file\n"); return -1; } if ((VAR_5 != AV_PIX_FMT_NONE && VAR_5 != VAR_9) || (VAR_6 != AV_PIX_FMT_NONE && VAR_6 != VAR_13)) continue; if (VAR_18 != 12) { printf("%s", VAR_7); continue; } doTest(VAR_0, VAR_1, VAR_2, VAR_3, VAR_9, VAR_13, VAR_11, VAR_12, VAR_15, VAR_16, VAR_17, &VAR_8); } return 0; }
[ "static int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4], int VAR_2, int VAR_3, FILE *VAR_4,\nenum AVPixelFormat VAR_5,\nenum AVPixelFormat VAR_6)\n{", "char VAR_7[256];", "while (fgets(VAR_7, sizeof(VAR_7), VAR_4)) {", "struct Results VAR_8;", "enum AVPixelFormat VAR_9;", "char VAR_10[12];", "int VAR_11, VAR_12;", "enum AVPixelFormat VAR_13;", "char VAR_14[12];", "int VAR_15, VAR_16;", "int VAR_17;", "int VAR_18;", "VAR_18 = sscanf(VAR_7,\n\" %12s %dx%d -> %12s %dx%d VAR_17=%d CRC=%x\"\n\" SSD=%\"PRId64 \", %\"PRId64 \", %\"PRId64 \", %\"PRId64 \"\\n\",\nVAR_10, &VAR_11, &VAR_12, VAR_14, &VAR_15, &VAR_16,\n&VAR_17, &VAR_8.crc, &VAR_8.ssdY, &VAR_8.ssdU, &VAR_8.ssdV, &VAR_8.ssdA);", "if (VAR_18 != 12) {", "VAR_10[0] = VAR_14[0] = 0;", "VAR_18 = sscanf(VAR_7, \"%12s -> %12s\\n\", VAR_10, VAR_14);", "}", "VAR_9 = av_get_pix_fmt(VAR_10);", "VAR_13 = av_get_pix_fmt(VAR_14);", "if (VAR_9 == AV_PIX_FMT_NONE || VAR_13 == AV_PIX_FMT_NONE) {", "fprintf(stderr, \"malformed input file\\n\");", "return -1;", "}", "if ((VAR_5 != AV_PIX_FMT_NONE && VAR_5 != VAR_9) ||\n(VAR_6 != AV_PIX_FMT_NONE && VAR_6 != VAR_13))\ncontinue;", "if (VAR_18 != 12) {", "printf(\"%s\", VAR_7);", "continue;", "}", "doTest(VAR_0, VAR_1, VAR_2, VAR_3,\nVAR_9, VAR_13,\nVAR_11, VAR_12, VAR_15, VAR_16, VAR_17,\n&VAR_8);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35, 37, 39, 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87, 89, 91 ], [ 93 ], [ 97 ], [ 99 ] ]
21,680
static int dirac_decode_frame_internal(DiracContext *s) { DWTContext d; int y, i, comp, dsty; if (s->low_delay) { /* [DIRAC_STD] 13.5.1 low_delay_transform_data() */ for (comp = 0; comp < 3; comp++) { Plane *p = &s->plane[comp]; memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); } if (!s->zero_res) decode_lowdelay(s); } for (comp = 0; comp < 3; comp++) { Plane *p = &s->plane[comp]; uint8_t *frame = s->current_picture->avframe->data[comp]; /* FIXME: small resolutions */ for (i = 0; i < 4; i++) s->edge_emu_buffer[i] = s->edge_emu_buffer_base + i*FFALIGN(p->width, 16); if (!s->zero_res && !s->low_delay) { memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); decode_component(s, comp); /* [DIRAC_STD] 13.4.1 core_transform_data() */ } if (ff_spatial_idwt_init2(&d, p->idwt_buf, p->idwt_width, p->idwt_height, p->idwt_stride, s->wavelet_idx+2, s->wavelet_depth, p->idwt_tmp)) return -1; if (!s->num_refs) { /* intra */ for (y = 0; y < p->height; y += 16) { ff_spatial_idwt_slice2(&d, y+16); /* decode */ s->diracdsp.put_signed_rect_clamped(frame + y*p->stride, p->stride, p->idwt_buf + y*p->idwt_stride, p->idwt_stride, p->width, 16); } } else { /* inter */ int rowheight = p->ybsep*p->stride; select_dsp_funcs(s, p->width, p->height, p->xblen, p->yblen); for (i = 0; i < s->num_refs; i++) interpolate_refplane(s, s->ref_pics[i], comp, p->width, p->height); memset(s->mctmp, 0, 4*p->yoffset*p->stride); dsty = -p->yoffset; for (y = 0; y < s->blheight; y++) { int h = 0, start = FFMAX(dsty, 0); uint16_t *mctmp = s->mctmp + y*rowheight; DiracBlock *blocks = s->blmotion + y*s->blwidth; init_obmc_weights(s, p, y); if (y == s->blheight-1 || start+p->ybsep > p->height) h = p->height - start; else h = p->ybsep - (start - dsty); if (h < 0) break; memset(mctmp+2*p->yoffset*p->stride, 0, 2*rowheight); mc_row(s, blocks, mctmp, comp, dsty); mctmp += (start - dsty)*p->stride + p->xoffset; ff_spatial_idwt_slice2(&d, start + h); /* decode */ s->diracdsp.add_rect_clamped(frame + start*p->stride, mctmp, p->stride, p->idwt_buf + start*p->idwt_stride, p->idwt_stride, p->width, h); dsty += p->ybsep; } } } return 0; }
false
FFmpeg
a4d3cf10b2ece441ae25849a66b1c11d838f9381
static int dirac_decode_frame_internal(DiracContext *s) { DWTContext d; int y, i, comp, dsty; if (s->low_delay) { for (comp = 0; comp < 3; comp++) { Plane *p = &s->plane[comp]; memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); } if (!s->zero_res) decode_lowdelay(s); } for (comp = 0; comp < 3; comp++) { Plane *p = &s->plane[comp]; uint8_t *frame = s->current_picture->avframe->data[comp]; for (i = 0; i < 4; i++) s->edge_emu_buffer[i] = s->edge_emu_buffer_base + i*FFALIGN(p->width, 16); if (!s->zero_res && !s->low_delay) { memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); decode_component(s, comp); } if (ff_spatial_idwt_init2(&d, p->idwt_buf, p->idwt_width, p->idwt_height, p->idwt_stride, s->wavelet_idx+2, s->wavelet_depth, p->idwt_tmp)) return -1; if (!s->num_refs) { for (y = 0; y < p->height; y += 16) { ff_spatial_idwt_slice2(&d, y+16); s->diracdsp.put_signed_rect_clamped(frame + y*p->stride, p->stride, p->idwt_buf + y*p->idwt_stride, p->idwt_stride, p->width, 16); } } else { int rowheight = p->ybsep*p->stride; select_dsp_funcs(s, p->width, p->height, p->xblen, p->yblen); for (i = 0; i < s->num_refs; i++) interpolate_refplane(s, s->ref_pics[i], comp, p->width, p->height); memset(s->mctmp, 0, 4*p->yoffset*p->stride); dsty = -p->yoffset; for (y = 0; y < s->blheight; y++) { int h = 0, start = FFMAX(dsty, 0); uint16_t *mctmp = s->mctmp + y*rowheight; DiracBlock *blocks = s->blmotion + y*s->blwidth; init_obmc_weights(s, p, y); if (y == s->blheight-1 || start+p->ybsep > p->height) h = p->height - start; else h = p->ybsep - (start - dsty); if (h < 0) break; memset(mctmp+2*p->yoffset*p->stride, 0, 2*rowheight); mc_row(s, blocks, mctmp, comp, dsty); mctmp += (start - dsty)*p->stride + p->xoffset; ff_spatial_idwt_slice2(&d, start + h); s->diracdsp.add_rect_clamped(frame + start*p->stride, mctmp, p->stride, p->idwt_buf + start*p->idwt_stride, p->idwt_stride, p->width, h); dsty += p->ybsep; } } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(DiracContext *VAR_0) { DWTContext d; int VAR_1, VAR_2, VAR_3, VAR_4; if (VAR_0->low_delay) { for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { Plane *p = &VAR_0->plane[VAR_3]; memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); } if (!VAR_0->zero_res) decode_lowdelay(VAR_0); } for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { Plane *p = &VAR_0->plane[VAR_3]; uint8_t *frame = VAR_0->current_picture->avframe->data[VAR_3]; for (VAR_2 = 0; VAR_2 < 4; VAR_2++) VAR_0->edge_emu_buffer[VAR_2] = VAR_0->edge_emu_buffer_base + VAR_2*FFALIGN(p->width, 16); if (!VAR_0->zero_res && !VAR_0->low_delay) { memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); decode_component(VAR_0, VAR_3); } if (ff_spatial_idwt_init2(&d, p->idwt_buf, p->idwt_width, p->idwt_height, p->idwt_stride, VAR_0->wavelet_idx+2, VAR_0->wavelet_depth, p->idwt_tmp)) return -1; if (!VAR_0->num_refs) { for (VAR_1 = 0; VAR_1 < p->height; VAR_1 += 16) { ff_spatial_idwt_slice2(&d, VAR_1+16); VAR_0->diracdsp.put_signed_rect_clamped(frame + VAR_1*p->stride, p->stride, p->idwt_buf + VAR_1*p->idwt_stride, p->idwt_stride, p->width, 16); } } else { int VAR_5 = p->ybsep*p->stride; select_dsp_funcs(VAR_0, p->width, p->height, p->xblen, p->yblen); for (VAR_2 = 0; VAR_2 < VAR_0->num_refs; VAR_2++) interpolate_refplane(VAR_0, VAR_0->ref_pics[VAR_2], VAR_3, p->width, p->height); memset(VAR_0->mctmp, 0, 4*p->yoffset*p->stride); VAR_4 = -p->yoffset; for (VAR_1 = 0; VAR_1 < VAR_0->blheight; VAR_1++) { int h = 0, start = FFMAX(VAR_4, 0); uint16_t *mctmp = VAR_0->mctmp + VAR_1*VAR_5; DiracBlock *blocks = VAR_0->blmotion + VAR_1*VAR_0->blwidth; init_obmc_weights(VAR_0, p, VAR_1); if (VAR_1 == VAR_0->blheight-1 || start+p->ybsep > p->height) h = p->height - start; else h = p->ybsep - (start - VAR_4); if (h < 0) break; memset(mctmp+2*p->yoffset*p->stride, 0, 2*VAR_5); mc_row(VAR_0, blocks, mctmp, VAR_3, VAR_4); mctmp += (start - VAR_4)*p->stride + p->xoffset; ff_spatial_idwt_slice2(&d, start + h); VAR_0->diracdsp.add_rect_clamped(frame + start*p->stride, mctmp, p->stride, p->idwt_buf + start*p->idwt_stride, p->idwt_stride, p->width, h); VAR_4 += p->ybsep; } } } return 0; }
[ "static int FUNC_0(DiracContext *VAR_0)\n{", "DWTContext d;", "int VAR_1, VAR_2, VAR_3, VAR_4;", "if (VAR_0->low_delay) {", "for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {", "Plane *p = &VAR_0->plane[VAR_3];", "memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM));", "}", "if (!VAR_0->zero_res)\ndecode_lowdelay(VAR_0);", "}", "for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {", "Plane *p = &VAR_0->plane[VAR_3];", "uint8_t *frame = VAR_0->current_picture->avframe->data[VAR_3];", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++)", "VAR_0->edge_emu_buffer[VAR_2] = VAR_0->edge_emu_buffer_base + VAR_2*FFALIGN(p->width, 16);", "if (!VAR_0->zero_res && !VAR_0->low_delay)\n{", "memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM));", "decode_component(VAR_0, VAR_3);", "}", "if (ff_spatial_idwt_init2(&d, p->idwt_buf, p->idwt_width, p->idwt_height, p->idwt_stride,\nVAR_0->wavelet_idx+2, VAR_0->wavelet_depth, p->idwt_tmp))\nreturn -1;", "if (!VAR_0->num_refs) {", "for (VAR_1 = 0; VAR_1 < p->height; VAR_1 += 16) {", "ff_spatial_idwt_slice2(&d, VAR_1+16);", "VAR_0->diracdsp.put_signed_rect_clamped(frame + VAR_1*p->stride, p->stride,\np->idwt_buf + VAR_1*p->idwt_stride, p->idwt_stride, p->width, 16);", "}", "} else {", "int VAR_5 = p->ybsep*p->stride;", "select_dsp_funcs(VAR_0, p->width, p->height, p->xblen, p->yblen);", "for (VAR_2 = 0; VAR_2 < VAR_0->num_refs; VAR_2++)", "interpolate_refplane(VAR_0, VAR_0->ref_pics[VAR_2], VAR_3, p->width, p->height);", "memset(VAR_0->mctmp, 0, 4*p->yoffset*p->stride);", "VAR_4 = -p->yoffset;", "for (VAR_1 = 0; VAR_1 < VAR_0->blheight; VAR_1++) {", "int h = 0,\nstart = FFMAX(VAR_4, 0);", "uint16_t *mctmp = VAR_0->mctmp + VAR_1*VAR_5;", "DiracBlock *blocks = VAR_0->blmotion + VAR_1*VAR_0->blwidth;", "init_obmc_weights(VAR_0, p, VAR_1);", "if (VAR_1 == VAR_0->blheight-1 || start+p->ybsep > p->height)\nh = p->height - start;", "else\nh = p->ybsep - (start - VAR_4);", "if (h < 0)\nbreak;", "memset(mctmp+2*p->yoffset*p->stride, 0, 2*VAR_5);", "mc_row(VAR_0, blocks, mctmp, VAR_3, VAR_4);", "mctmp += (start - VAR_4)*p->stride + p->xoffset;", "ff_spatial_idwt_slice2(&d, start + h);", "VAR_0->diracdsp.add_rect_clamped(frame + start*p->stride, mctmp, p->stride,\np->idwt_buf + start*p->idwt_stride, p->idwt_stride, p->width, h);", "VAR_4 += p->ybsep;", "}", "}", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59, 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 87 ], [ 89 ], [ 93 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 111 ], [ 115, 117 ], [ 119, 121 ], [ 123, 125 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 157 ], [ 159 ] ]
21,681
void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex, int lastInLumBuf, int lastInChrBuf) { const int dstH= c->dstH; const int flags= c->flags; int16_t **lumPixBuf= c->lumPixBuf; int16_t **chrUPixBuf= c->chrUPixBuf; int16_t **alpPixBuf= c->alpPixBuf; const int vLumBufSize= c->vLumBufSize; const int vChrBufSize= c->vChrBufSize; int32_t *vLumFilterPos= c->vLumFilterPos; int32_t *vChrFilterPos= c->vChrFilterPos; int16_t *vLumFilter= c->vLumFilter; int16_t *vChrFilter= c->vChrFilter; int32_t *lumMmxFilter= c->lumMmxFilter; int32_t *chrMmxFilter= c->chrMmxFilter; int32_t av_unused *alpMmxFilter= c->alpMmxFilter; const int vLumFilterSize= c->vLumFilterSize; const int vChrFilterSize= c->vChrFilterSize; const int chrDstY= dstY>>c->chrDstVSubSample; const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input c->blueDither= ff_dither8[dstY&1]; if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555) c->greenDither= ff_dither8[dstY&1]; else c->greenDither= ff_dither4[dstY&1]; c->redDither= ff_dither8[(dstY+1)&1]; if (dstY < dstH - 2) { const int16_t **lumSrcPtr= (const int16_t **)(void*) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; const int16_t **chrUSrcPtr= (const int16_t **)(void*) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **)(void*) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; int i; if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->srcH) { const int16_t **tmpY = (const int16_t **) lumPixBuf + 2 * vLumBufSize; int neg = -firstLumSrcY, i, end = FFMIN(c->srcH - firstLumSrcY, vLumFilterSize); for (i = 0; i < neg; i++) tmpY[i] = lumSrcPtr[neg]; for ( ; i < end; i++) tmpY[i] = lumSrcPtr[i]; for ( ; i < vLumFilterSize; i++) tmpY[i] = tmpY[i-1]; lumSrcPtr = tmpY; if (alpSrcPtr) { const int16_t **tmpA = (const int16_t **) alpPixBuf + 2 * vLumBufSize; for (i = 0; i < neg; i++) tmpA[i] = alpSrcPtr[neg]; for ( ; i < end; i++) tmpA[i] = alpSrcPtr[i]; for ( ; i < vLumFilterSize; i++) tmpA[i] = tmpA[i - 1]; alpSrcPtr = tmpA; } } if (firstChrSrcY < 0 || firstChrSrcY + vChrFilterSize > c->chrSrcH) { const int16_t **tmpU = (const int16_t **) chrUPixBuf + 2 * vChrBufSize; int neg = -firstChrSrcY, i, end = FFMIN(c->chrSrcH - firstChrSrcY, vChrFilterSize); for (i = 0; i < neg; i++) { tmpU[i] = chrUSrcPtr[neg]; } for ( ; i < end; i++) { tmpU[i] = chrUSrcPtr[i]; } for ( ; i < vChrFilterSize; i++) { tmpU[i] = tmpU[i - 1]; } chrUSrcPtr = tmpU; } if (flags & SWS_ACCURATE_RND) { int s= APCK_SIZE / 8; for (i=0; i<vLumFilterSize; i+=2) { *(const void**)&lumMmxFilter[s*i ]= lumSrcPtr[i ]; *(const void**)&lumMmxFilter[s*i+APCK_PTR2/4 ]= lumSrcPtr[i+(vLumFilterSize>1)]; lumMmxFilter[s*i+APCK_COEF/4 ]= lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i ] + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0); if (CONFIG_SWSCALE_ALPHA && alpPixBuf) { *(const void**)&alpMmxFilter[s*i ]= alpSrcPtr[i ]; *(const void**)&alpMmxFilter[s*i+APCK_PTR2/4 ]= alpSrcPtr[i+(vLumFilterSize>1)]; alpMmxFilter[s*i+APCK_COEF/4 ]= alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4 ]; } } for (i=0; i<vChrFilterSize; i+=2) { *(const void**)&chrMmxFilter[s*i ]= chrUSrcPtr[i ]; *(const void**)&chrMmxFilter[s*i+APCK_PTR2/4 ]= chrUSrcPtr[i+(vChrFilterSize>1)]; chrMmxFilter[s*i+APCK_COEF/4 ]= chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i ] + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0); } } else { for (i=0; i<vLumFilterSize; i++) { *(const void**)&lumMmxFilter[4*i+0]= lumSrcPtr[i]; lumMmxFilter[4*i+2]= lumMmxFilter[4*i+3]= ((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001; if (CONFIG_SWSCALE_ALPHA && alpPixBuf) { *(const void**)&alpMmxFilter[4*i+0]= alpSrcPtr[i]; alpMmxFilter[4*i+2]= alpMmxFilter[4*i+3]= lumMmxFilter[4*i+2]; } } for (i=0; i<vChrFilterSize; i++) { *(const void**)&chrMmxFilter[4*i+0]= chrUSrcPtr[i]; chrMmxFilter[4*i+2]= chrMmxFilter[4*i+3]= ((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001; } } } }
true
FFmpeg
ef912134f01c1fba3ab201fdf98d90ab4eb55179
void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex, int lastInLumBuf, int lastInChrBuf) { const int dstH= c->dstH; const int flags= c->flags; int16_t **lumPixBuf= c->lumPixBuf; int16_t **chrUPixBuf= c->chrUPixBuf; int16_t **alpPixBuf= c->alpPixBuf; const int vLumBufSize= c->vLumBufSize; const int vChrBufSize= c->vChrBufSize; int32_t *vLumFilterPos= c->vLumFilterPos; int32_t *vChrFilterPos= c->vChrFilterPos; int16_t *vLumFilter= c->vLumFilter; int16_t *vChrFilter= c->vChrFilter; int32_t *lumMmxFilter= c->lumMmxFilter; int32_t *chrMmxFilter= c->chrMmxFilter; int32_t av_unused *alpMmxFilter= c->alpMmxFilter; const int vLumFilterSize= c->vLumFilterSize; const int vChrFilterSize= c->vChrFilterSize; const int chrDstY= dstY>>c->chrDstVSubSample; const int firstLumSrcY= vLumFilterPos[dstY]; const int firstChrSrcY= vChrFilterPos[chrDstY]; c->blueDither= ff_dither8[dstY&1]; if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555) c->greenDither= ff_dither8[dstY&1]; else c->greenDither= ff_dither4[dstY&1]; c->redDither= ff_dither8[(dstY+1)&1]; if (dstY < dstH - 2) { const int16_t **lumSrcPtr= (const int16_t **)(void*) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; const int16_t **chrUSrcPtr= (const int16_t **)(void*) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **)(void*) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; int i; if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->srcH) { const int16_t **tmpY = (const int16_t **) lumPixBuf + 2 * vLumBufSize; int neg = -firstLumSrcY, i, end = FFMIN(c->srcH - firstLumSrcY, vLumFilterSize); for (i = 0; i < neg; i++) tmpY[i] = lumSrcPtr[neg]; for ( ; i < end; i++) tmpY[i] = lumSrcPtr[i]; for ( ; i < vLumFilterSize; i++) tmpY[i] = tmpY[i-1]; lumSrcPtr = tmpY; if (alpSrcPtr) { const int16_t **tmpA = (const int16_t **) alpPixBuf + 2 * vLumBufSize; for (i = 0; i < neg; i++) tmpA[i] = alpSrcPtr[neg]; for ( ; i < end; i++) tmpA[i] = alpSrcPtr[i]; for ( ; i < vLumFilterSize; i++) tmpA[i] = tmpA[i - 1]; alpSrcPtr = tmpA; } } if (firstChrSrcY < 0 || firstChrSrcY + vChrFilterSize > c->chrSrcH) { const int16_t **tmpU = (const int16_t **) chrUPixBuf + 2 * vChrBufSize; int neg = -firstChrSrcY, i, end = FFMIN(c->chrSrcH - firstChrSrcY, vChrFilterSize); for (i = 0; i < neg; i++) { tmpU[i] = chrUSrcPtr[neg]; } for ( ; i < end; i++) { tmpU[i] = chrUSrcPtr[i]; } for ( ; i < vChrFilterSize; i++) { tmpU[i] = tmpU[i - 1]; } chrUSrcPtr = tmpU; } if (flags & SWS_ACCURATE_RND) { int s= APCK_SIZE / 8; for (i=0; i<vLumFilterSize; i+=2) { *(const void**)&lumMmxFilter[s*i ]= lumSrcPtr[i ]; *(const void**)&lumMmxFilter[s*i+APCK_PTR2/4 ]= lumSrcPtr[i+(vLumFilterSize>1)]; lumMmxFilter[s*i+APCK_COEF/4 ]= lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i ] + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0); if (CONFIG_SWSCALE_ALPHA && alpPixBuf) { *(const void**)&alpMmxFilter[s*i ]= alpSrcPtr[i ]; *(const void**)&alpMmxFilter[s*i+APCK_PTR2/4 ]= alpSrcPtr[i+(vLumFilterSize>1)]; alpMmxFilter[s*i+APCK_COEF/4 ]= alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4 ]; } } for (i=0; i<vChrFilterSize; i+=2) { *(const void**)&chrMmxFilter[s*i ]= chrUSrcPtr[i ]; *(const void**)&chrMmxFilter[s*i+APCK_PTR2/4 ]= chrUSrcPtr[i+(vChrFilterSize>1)]; chrMmxFilter[s*i+APCK_COEF/4 ]= chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i ] + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0); } } else { for (i=0; i<vLumFilterSize; i++) { *(const void**)&lumMmxFilter[4*i+0]= lumSrcPtr[i]; lumMmxFilter[4*i+2]= lumMmxFilter[4*i+3]= ((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001; if (CONFIG_SWSCALE_ALPHA && alpPixBuf) { *(const void**)&alpMmxFilter[4*i+0]= alpSrcPtr[i]; alpMmxFilter[4*i+2]= alpMmxFilter[4*i+3]= lumMmxFilter[4*i+2]; } } for (i=0; i<vChrFilterSize; i++) { *(const void**)&chrMmxFilter[4*i+0]= chrUSrcPtr[i]; chrMmxFilter[4*i+2]= chrMmxFilter[4*i+3]= ((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001; } } } }
{ "code": [ " ((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001;", " ((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001;" ], "line_no": [ 199, 221 ] }
void FUNC_0(SwsContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5) { const int VAR_6= VAR_0->VAR_6; const int VAR_7= VAR_0->VAR_7; int16_t **lumPixBuf= VAR_0->lumPixBuf; int16_t **chrUPixBuf= VAR_0->chrUPixBuf; int16_t **alpPixBuf= VAR_0->alpPixBuf; const int VAR_8= VAR_0->VAR_8; const int VAR_9= VAR_0->VAR_9; int32_t *vLumFilterPos= VAR_0->vLumFilterPos; int32_t *vChrFilterPos= VAR_0->vChrFilterPos; int16_t *vLumFilter= VAR_0->vLumFilter; int16_t *vChrFilter= VAR_0->vChrFilter; int32_t *lumMmxFilter= VAR_0->lumMmxFilter; int32_t *chrMmxFilter= VAR_0->chrMmxFilter; int32_t av_unused *alpMmxFilter= VAR_0->alpMmxFilter; const int VAR_10= VAR_0->VAR_10; const int VAR_11= VAR_0->VAR_11; const int VAR_12= VAR_1>>VAR_0->chrDstVSubSample; const int VAR_13= vLumFilterPos[VAR_1]; const int VAR_14= vChrFilterPos[VAR_12]; VAR_0->blueDither= ff_dither8[VAR_1&1]; if (VAR_0->dstFormat == PIX_FMT_RGB555 || VAR_0->dstFormat == PIX_FMT_BGR555) VAR_0->greenDither= ff_dither8[VAR_1&1]; else VAR_0->greenDither= ff_dither4[VAR_1&1]; VAR_0->redDither= ff_dither8[(VAR_1+1)&1]; if (VAR_1 < VAR_6 - 2) { const int16_t **VAR_15= (const int16_t **)(void*) lumPixBuf + VAR_2 + VAR_13 - VAR_4 + VAR_8; const int16_t **VAR_16= (const int16_t **)(void*) chrUPixBuf + VAR_3 + VAR_14 - VAR_5 + VAR_9; const int16_t **VAR_17= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **)(void*) alpPixBuf + VAR_2 + VAR_13 - VAR_4 + VAR_8 : NULL; int VAR_24; if (VAR_13 < 0 || VAR_13 + VAR_10 > VAR_0->srcH) { const int16_t **VAR_19 = (const int16_t **) lumPixBuf + 2 * VAR_8; int VAR_24 = -VAR_13, VAR_24, VAR_24 = FFMIN(VAR_0->srcH - VAR_13, VAR_10); for (VAR_24 = 0; VAR_24 < VAR_24; VAR_24++) VAR_19[VAR_24] = VAR_15[VAR_24]; for ( ; VAR_24 < VAR_24; VAR_24++) VAR_19[VAR_24] = VAR_15[VAR_24]; for ( ; VAR_24 < VAR_10; VAR_24++) VAR_19[VAR_24] = VAR_19[VAR_24-1]; VAR_15 = VAR_19; if (VAR_17) { const int16_t **VAR_22 = (const int16_t **) alpPixBuf + 2 * VAR_8; for (VAR_24 = 0; VAR_24 < VAR_24; VAR_24++) VAR_22[VAR_24] = VAR_17[VAR_24]; for ( ; VAR_24 < VAR_24; VAR_24++) VAR_22[VAR_24] = VAR_17[VAR_24]; for ( ; VAR_24 < VAR_10; VAR_24++) VAR_22[VAR_24] = VAR_22[VAR_24 - 1]; VAR_17 = VAR_22; } } if (VAR_14 < 0 || VAR_14 + VAR_11 > VAR_0->chrSrcH) { const int16_t **VAR_23 = (const int16_t **) chrUPixBuf + 2 * VAR_9; int VAR_24 = -VAR_14, VAR_24, VAR_24 = FFMIN(VAR_0->chrSrcH - VAR_14, VAR_11); for (VAR_24 = 0; VAR_24 < VAR_24; VAR_24++) { VAR_23[VAR_24] = VAR_16[VAR_24]; } for ( ; VAR_24 < VAR_24; VAR_24++) { VAR_23[VAR_24] = VAR_16[VAR_24]; } for ( ; VAR_24 < VAR_11; VAR_24++) { VAR_23[VAR_24] = VAR_23[VAR_24 - 1]; } VAR_16 = VAR_23; } if (VAR_7 & SWS_ACCURATE_RND) { int VAR_24= APCK_SIZE / 8; for (VAR_24=0; VAR_24<VAR_10; VAR_24+=2) { *(const void**)&lumMmxFilter[VAR_24*VAR_24 ]= VAR_15[VAR_24 ]; *(const void**)&lumMmxFilter[VAR_24*VAR_24+APCK_PTR2/4 ]= VAR_15[VAR_24+(VAR_10>1)]; lumMmxFilter[VAR_24*VAR_24+APCK_COEF/4 ]= lumMmxFilter[VAR_24*VAR_24+APCK_COEF/4+1]= vLumFilter[VAR_1*VAR_10 + VAR_24 ] + (VAR_10>1 ? vLumFilter[VAR_1*VAR_10 + VAR_24 + 1]<<16 : 0); if (CONFIG_SWSCALE_ALPHA && alpPixBuf) { *(const void**)&alpMmxFilter[VAR_24*VAR_24 ]= VAR_17[VAR_24 ]; *(const void**)&alpMmxFilter[VAR_24*VAR_24+APCK_PTR2/4 ]= VAR_17[VAR_24+(VAR_10>1)]; alpMmxFilter[VAR_24*VAR_24+APCK_COEF/4 ]= alpMmxFilter[VAR_24*VAR_24+APCK_COEF/4+1]= lumMmxFilter[VAR_24*VAR_24+APCK_COEF/4 ]; } } for (VAR_24=0; VAR_24<VAR_11; VAR_24+=2) { *(const void**)&chrMmxFilter[VAR_24*VAR_24 ]= VAR_16[VAR_24 ]; *(const void**)&chrMmxFilter[VAR_24*VAR_24+APCK_PTR2/4 ]= VAR_16[VAR_24+(VAR_11>1)]; chrMmxFilter[VAR_24*VAR_24+APCK_COEF/4 ]= chrMmxFilter[VAR_24*VAR_24+APCK_COEF/4+1]= vChrFilter[VAR_12*VAR_11 + VAR_24 ] + (VAR_11>1 ? vChrFilter[VAR_12*VAR_11 + VAR_24 + 1]<<16 : 0); } } else { for (VAR_24=0; VAR_24<VAR_10; VAR_24++) { *(const void**)&lumMmxFilter[4*VAR_24+0]= VAR_15[VAR_24]; lumMmxFilter[4*VAR_24+2]= lumMmxFilter[4*VAR_24+3]= ((uint16_t)vLumFilter[VAR_1*VAR_10 + VAR_24])*0x10001; if (CONFIG_SWSCALE_ALPHA && alpPixBuf) { *(const void**)&alpMmxFilter[4*VAR_24+0]= VAR_17[VAR_24]; alpMmxFilter[4*VAR_24+2]= alpMmxFilter[4*VAR_24+3]= lumMmxFilter[4*VAR_24+2]; } } for (VAR_24=0; VAR_24<VAR_11; VAR_24++) { *(const void**)&chrMmxFilter[4*VAR_24+0]= VAR_16[VAR_24]; chrMmxFilter[4*VAR_24+2]= chrMmxFilter[4*VAR_24+3]= ((uint16_t)vChrFilter[VAR_12*VAR_11 + VAR_24])*0x10001; } } } }
[ "void FUNC_0(SwsContext *VAR_0, int VAR_1, int VAR_2, int VAR_3,\nint VAR_4, int VAR_5)\n{", "const int VAR_6= VAR_0->VAR_6;", "const int VAR_7= VAR_0->VAR_7;", "int16_t **lumPixBuf= VAR_0->lumPixBuf;", "int16_t **chrUPixBuf= VAR_0->chrUPixBuf;", "int16_t **alpPixBuf= VAR_0->alpPixBuf;", "const int VAR_8= VAR_0->VAR_8;", "const int VAR_9= VAR_0->VAR_9;", "int32_t *vLumFilterPos= VAR_0->vLumFilterPos;", "int32_t *vChrFilterPos= VAR_0->vChrFilterPos;", "int16_t *vLumFilter= VAR_0->vLumFilter;", "int16_t *vChrFilter= VAR_0->vChrFilter;", "int32_t *lumMmxFilter= VAR_0->lumMmxFilter;", "int32_t *chrMmxFilter= VAR_0->chrMmxFilter;", "int32_t av_unused *alpMmxFilter= VAR_0->alpMmxFilter;", "const int VAR_10= VAR_0->VAR_10;", "const int VAR_11= VAR_0->VAR_11;", "const int VAR_12= VAR_1>>VAR_0->chrDstVSubSample;", "const int VAR_13= vLumFilterPos[VAR_1];", "const int VAR_14= vChrFilterPos[VAR_12];", "VAR_0->blueDither= ff_dither8[VAR_1&1];", "if (VAR_0->dstFormat == PIX_FMT_RGB555 || VAR_0->dstFormat == PIX_FMT_BGR555)\nVAR_0->greenDither= ff_dither8[VAR_1&1];", "else\nVAR_0->greenDither= ff_dither4[VAR_1&1];", "VAR_0->redDither= ff_dither8[(VAR_1+1)&1];", "if (VAR_1 < VAR_6 - 2) {", "const int16_t **VAR_15= (const int16_t **)(void*) lumPixBuf + VAR_2 + VAR_13 - VAR_4 + VAR_8;", "const int16_t **VAR_16= (const int16_t **)(void*) chrUPixBuf + VAR_3 + VAR_14 - VAR_5 + VAR_9;", "const int16_t **VAR_17= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **)(void*) alpPixBuf + VAR_2 + VAR_13 - VAR_4 + VAR_8 : NULL;", "int VAR_24;", "if (VAR_13 < 0 || VAR_13 + VAR_10 > VAR_0->srcH) {", "const int16_t **VAR_19 = (const int16_t **) lumPixBuf + 2 * VAR_8;", "int VAR_24 = -VAR_13, VAR_24, VAR_24 = FFMIN(VAR_0->srcH - VAR_13, VAR_10);", "for (VAR_24 = 0; VAR_24 < VAR_24; VAR_24++)", "VAR_19[VAR_24] = VAR_15[VAR_24];", "for ( ; VAR_24 < VAR_24; VAR_24++)", "VAR_19[VAR_24] = VAR_15[VAR_24];", "for ( ; VAR_24 < VAR_10; VAR_24++)", "VAR_19[VAR_24] = VAR_19[VAR_24-1];", "VAR_15 = VAR_19;", "if (VAR_17) {", "const int16_t **VAR_22 = (const int16_t **) alpPixBuf + 2 * VAR_8;", "for (VAR_24 = 0; VAR_24 < VAR_24; VAR_24++)", "VAR_22[VAR_24] = VAR_17[VAR_24];", "for ( ; VAR_24 < VAR_24; VAR_24++)", "VAR_22[VAR_24] = VAR_17[VAR_24];", "for ( ; VAR_24 < VAR_10; VAR_24++)", "VAR_22[VAR_24] = VAR_22[VAR_24 - 1];", "VAR_17 = VAR_22;", "}", "}", "if (VAR_14 < 0 || VAR_14 + VAR_11 > VAR_0->chrSrcH) {", "const int16_t **VAR_23 = (const int16_t **) chrUPixBuf + 2 * VAR_9;", "int VAR_24 = -VAR_14, VAR_24, VAR_24 = FFMIN(VAR_0->chrSrcH - VAR_14, VAR_11);", "for (VAR_24 = 0; VAR_24 < VAR_24; VAR_24++) {", "VAR_23[VAR_24] = VAR_16[VAR_24];", "}", "for ( ; VAR_24 < VAR_24; VAR_24++) {", "VAR_23[VAR_24] = VAR_16[VAR_24];", "}", "for ( ; VAR_24 < VAR_11; VAR_24++) {", "VAR_23[VAR_24] = VAR_23[VAR_24 - 1];", "}", "VAR_16 = VAR_23;", "}", "if (VAR_7 & SWS_ACCURATE_RND) {", "int VAR_24= APCK_SIZE / 8;", "for (VAR_24=0; VAR_24<VAR_10; VAR_24+=2) {", "*(const void**)&lumMmxFilter[VAR_24*VAR_24 ]= VAR_15[VAR_24 ];", "*(const void**)&lumMmxFilter[VAR_24*VAR_24+APCK_PTR2/4 ]= VAR_15[VAR_24+(VAR_10>1)];", "lumMmxFilter[VAR_24*VAR_24+APCK_COEF/4 ]=\nlumMmxFilter[VAR_24*VAR_24+APCK_COEF/4+1]= vLumFilter[VAR_1*VAR_10 + VAR_24 ]\n+ (VAR_10>1 ? vLumFilter[VAR_1*VAR_10 + VAR_24 + 1]<<16 : 0);", "if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {", "*(const void**)&alpMmxFilter[VAR_24*VAR_24 ]= VAR_17[VAR_24 ];", "*(const void**)&alpMmxFilter[VAR_24*VAR_24+APCK_PTR2/4 ]= VAR_17[VAR_24+(VAR_10>1)];", "alpMmxFilter[VAR_24*VAR_24+APCK_COEF/4 ]=\nalpMmxFilter[VAR_24*VAR_24+APCK_COEF/4+1]= lumMmxFilter[VAR_24*VAR_24+APCK_COEF/4 ];", "}", "}", "for (VAR_24=0; VAR_24<VAR_11; VAR_24+=2) {", "*(const void**)&chrMmxFilter[VAR_24*VAR_24 ]= VAR_16[VAR_24 ];", "*(const void**)&chrMmxFilter[VAR_24*VAR_24+APCK_PTR2/4 ]= VAR_16[VAR_24+(VAR_11>1)];", "chrMmxFilter[VAR_24*VAR_24+APCK_COEF/4 ]=\nchrMmxFilter[VAR_24*VAR_24+APCK_COEF/4+1]= vChrFilter[VAR_12*VAR_11 + VAR_24 ]\n+ (VAR_11>1 ? vChrFilter[VAR_12*VAR_11 + VAR_24 + 1]<<16 : 0);", "}", "} else {", "for (VAR_24=0; VAR_24<VAR_10; VAR_24++) {", "*(const void**)&lumMmxFilter[4*VAR_24+0]= VAR_15[VAR_24];", "lumMmxFilter[4*VAR_24+2]=\nlumMmxFilter[4*VAR_24+3]=\n((uint16_t)vLumFilter[VAR_1*VAR_10 + VAR_24])*0x10001;", "if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {", "*(const void**)&alpMmxFilter[4*VAR_24+0]= VAR_17[VAR_24];", "alpMmxFilter[4*VAR_24+2]=\nalpMmxFilter[4*VAR_24+3]= lumMmxFilter[4*VAR_24+2];", "}", "}", "for (VAR_24=0; VAR_24<VAR_11; VAR_24++) {", "*(const void**)&chrMmxFilter[4*VAR_24+0]= VAR_16[VAR_24];", "chrMmxFilter[4*VAR_24+2]=\nchrMmxFilter[4*VAR_24+3]=\n((uint16_t)vChrFilter[VAR_12*VAR_11 + VAR_24])*0x10001;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49, 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 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 ] ]
21,682
static inline void gen_outs(DisasContext *s, TCGMemOp ot) { if (s->base.tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_string_movl_A0_ESI(s); gen_op_ld_v(s, ot, cpu_T0, cpu_A0); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[R_EDX]); tcg_gen_andi_i32(cpu_tmp2_i32, cpu_tmp2_i32, 0xffff); tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_T0); gen_helper_out_func(ot, cpu_tmp2_i32, cpu_tmp3_i32); gen_op_movl_T0_Dshift(ot); gen_op_add_reg_T0(s->aflag, R_ESI); gen_bpt_io(s, cpu_tmp2_i32, ot); if (s->base.tb->cflags & CF_USE_ICOUNT) { gen_io_end(); } }
true
qemu
c5a49c63fa26e8825ad101dfe86339ae4c216539
static inline void gen_outs(DisasContext *s, TCGMemOp ot) { if (s->base.tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_string_movl_A0_ESI(s); gen_op_ld_v(s, ot, cpu_T0, cpu_A0); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[R_EDX]); tcg_gen_andi_i32(cpu_tmp2_i32, cpu_tmp2_i32, 0xffff); tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_T0); gen_helper_out_func(ot, cpu_tmp2_i32, cpu_tmp3_i32); gen_op_movl_T0_Dshift(ot); gen_op_add_reg_T0(s->aflag, R_ESI); gen_bpt_io(s, cpu_tmp2_i32, ot); if (s->base.tb->cflags & CF_USE_ICOUNT) { gen_io_end(); } }
{ "code": [ " if (s->base.tb->cflags & CF_USE_ICOUNT) {", " if (s->base.tb->cflags & CF_USE_ICOUNT) {", " if (s->base.tb->cflags & CF_USE_ICOUNT) {", " if (s->base.tb->cflags & CF_USE_ICOUNT) {" ], "line_no": [ 5, 5, 5, 5 ] }
static inline void FUNC_0(DisasContext *VAR_0, TCGMemOp VAR_1) { if (VAR_0->base.tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_string_movl_A0_ESI(VAR_0); gen_op_ld_v(VAR_0, VAR_1, cpu_T0, cpu_A0); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[R_EDX]); tcg_gen_andi_i32(cpu_tmp2_i32, cpu_tmp2_i32, 0xffff); tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_T0); gen_helper_out_func(VAR_1, cpu_tmp2_i32, cpu_tmp3_i32); gen_op_movl_T0_Dshift(VAR_1); gen_op_add_reg_T0(VAR_0->aflag, R_ESI); gen_bpt_io(VAR_0, cpu_tmp2_i32, VAR_1); if (VAR_0->base.tb->cflags & CF_USE_ICOUNT) { gen_io_end(); } }
[ "static inline void FUNC_0(DisasContext *VAR_0, TCGMemOp VAR_1)\n{", "if (VAR_0->base.tb->cflags & CF_USE_ICOUNT) {", "gen_io_start();", "}", "gen_string_movl_A0_ESI(VAR_0);", "gen_op_ld_v(VAR_0, VAR_1, cpu_T0, cpu_A0);", "tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[R_EDX]);", "tcg_gen_andi_i32(cpu_tmp2_i32, cpu_tmp2_i32, 0xffff);", "tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_T0);", "gen_helper_out_func(VAR_1, cpu_tmp2_i32, cpu_tmp3_i32);", "gen_op_movl_T0_Dshift(VAR_1);", "gen_op_add_reg_T0(VAR_0->aflag, R_ESI);", "gen_bpt_io(VAR_0, cpu_tmp2_i32, VAR_1);", "if (VAR_0->base.tb->cflags & CF_USE_ICOUNT) {", "gen_io_end();", "}", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
21,684
static av_cold int alloc_buffers(AVCodecContext *avctx, AACEncContext *s) { FF_ALLOCZ_OR_GOTO(avctx, s->buffer.samples, 3 * 1024 * s->channels * sizeof(s->buffer.samples[0]), alloc_fail); FF_ALLOCZ_OR_GOTO(avctx, s->cpe, sizeof(ChannelElement) * s->chan_map[0], alloc_fail); FF_ALLOCZ_OR_GOTO(avctx, avctx->extradata, 5 + FF_INPUT_BUFFER_PADDING_SIZE, alloc_fail); for(int ch = 0; ch < s->channels; ch++) s->planar_samples[ch] = s->buffer.samples + 3 * 1024 * ch; return 0; alloc_fail: return AVERROR(ENOMEM); }
false
FFmpeg
3715d841a619f1cbc4776d9b00575dae6fb6534a
static av_cold int alloc_buffers(AVCodecContext *avctx, AACEncContext *s) { FF_ALLOCZ_OR_GOTO(avctx, s->buffer.samples, 3 * 1024 * s->channels * sizeof(s->buffer.samples[0]), alloc_fail); FF_ALLOCZ_OR_GOTO(avctx, s->cpe, sizeof(ChannelElement) * s->chan_map[0], alloc_fail); FF_ALLOCZ_OR_GOTO(avctx, avctx->extradata, 5 + FF_INPUT_BUFFER_PADDING_SIZE, alloc_fail); for(int ch = 0; ch < s->channels; ch++) s->planar_samples[ch] = s->buffer.samples + 3 * 1024 * ch; return 0; alloc_fail: return AVERROR(ENOMEM); }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx, AACEncContext *s) { FF_ALLOCZ_OR_GOTO(avctx, s->buffer.samples, 3 * 1024 * s->channels * sizeof(s->buffer.samples[0]), alloc_fail); FF_ALLOCZ_OR_GOTO(avctx, s->cpe, sizeof(ChannelElement) * s->chan_map[0], alloc_fail); FF_ALLOCZ_OR_GOTO(avctx, avctx->extradata, 5 + FF_INPUT_BUFFER_PADDING_SIZE, alloc_fail); for(int ch = 0; ch < s->channels; ch++) s->planar_samples[ch] = s->buffer.samples + 3 * 1024 * ch; return 0; alloc_fail: return AVERROR(ENOMEM); }
[ "static av_cold int FUNC_0(AVCodecContext *avctx, AACEncContext *s)\n{", "FF_ALLOCZ_OR_GOTO(avctx, s->buffer.samples, 3 * 1024 * s->channels * sizeof(s->buffer.samples[0]), alloc_fail);", "FF_ALLOCZ_OR_GOTO(avctx, s->cpe, sizeof(ChannelElement) * s->chan_map[0], alloc_fail);", "FF_ALLOCZ_OR_GOTO(avctx, avctx->extradata, 5 + FF_INPUT_BUFFER_PADDING_SIZE, alloc_fail);", "for(int ch = 0; ch < s->channels; ch++)", "s->planar_samples[ch] = s->buffer.samples + 3 * 1024 * ch;", "return 0;", "alloc_fail:\nreturn AVERROR(ENOMEM);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25 ] ]
21,686
void ff_aac_update_ltp(AACEncContext *s, SingleChannelElement *sce) { int i, j, lag; float corr, s0, s1, max_corr = 0.0f; float *samples = &s->planar_samples[s->cur_channel][1024]; float *pred_signal = &sce->ltp_state[0]; int samples_num = 2048; if (s->profile != FF_PROFILE_AAC_LTP) return; /* Calculate lag */ for (i = 0; i < samples_num; i++) { s0 = s1 = 0.0f; for (j = 0; j < samples_num; j++) { if (j + 1024 < i) continue; s0 += samples[j]*pred_signal[j-i+1024]; s1 += pred_signal[j-i+1024]*pred_signal[j-i+1024]; } corr = s1 > 0.0f ? s0/sqrt(s1) : 0.0f; if (corr > max_corr) { max_corr = corr; lag = i; } } lag = av_clip_uintp2(lag, 11); /* 11 bits => 2^11 = 0->2047 */ if (!lag) { sce->ics.ltp.lag = lag; return; } s0 = s1 = 0.0f; for (i = 0; i < lag; i++) { s0 += samples[i]; s1 += pred_signal[i-lag+1024]; } sce->ics.ltp.coef_idx = quant_array_idx(s0/s1, ltp_coef, 8); sce->ics.ltp.coef = ltp_coef[sce->ics.ltp.coef_idx]; /* Predict the new samples */ if (lag < 1024) samples_num = lag + 1024; for (i = 0; i < samples_num; i++) pred_signal[i+1024] = sce->ics.ltp.coef*pred_signal[i-lag+1024]; memset(&pred_signal[samples_num], 0, (2048 - samples_num)*sizeof(float)); sce->ics.ltp.lag = lag; }
false
FFmpeg
7303962f1467e302906561be53ca4d51abbe5522
void ff_aac_update_ltp(AACEncContext *s, SingleChannelElement *sce) { int i, j, lag; float corr, s0, s1, max_corr = 0.0f; float *samples = &s->planar_samples[s->cur_channel][1024]; float *pred_signal = &sce->ltp_state[0]; int samples_num = 2048; if (s->profile != FF_PROFILE_AAC_LTP) return; for (i = 0; i < samples_num; i++) { s0 = s1 = 0.0f; for (j = 0; j < samples_num; j++) { if (j + 1024 < i) continue; s0 += samples[j]*pred_signal[j-i+1024]; s1 += pred_signal[j-i+1024]*pred_signal[j-i+1024]; } corr = s1 > 0.0f ? s0/sqrt(s1) : 0.0f; if (corr > max_corr) { max_corr = corr; lag = i; } } lag = av_clip_uintp2(lag, 11); if (!lag) { sce->ics.ltp.lag = lag; return; } s0 = s1 = 0.0f; for (i = 0; i < lag; i++) { s0 += samples[i]; s1 += pred_signal[i-lag+1024]; } sce->ics.ltp.coef_idx = quant_array_idx(s0/s1, ltp_coef, 8); sce->ics.ltp.coef = ltp_coef[sce->ics.ltp.coef_idx]; if (lag < 1024) samples_num = lag + 1024; for (i = 0; i < samples_num; i++) pred_signal[i+1024] = sce->ics.ltp.coef*pred_signal[i-lag+1024]; memset(&pred_signal[samples_num], 0, (2048 - samples_num)*sizeof(float)); sce->ics.ltp.lag = lag; }
{ "code": [], "line_no": [] }
void FUNC_0(AACEncContext *VAR_0, SingleChannelElement *VAR_1) { int VAR_2, VAR_3, VAR_4; float VAR_5, VAR_6, VAR_7, VAR_8 = 0.0f; float *VAR_9 = &VAR_0->planar_samples[VAR_0->cur_channel][1024]; float *VAR_10 = &VAR_1->ltp_state[0]; int VAR_11 = 2048; if (VAR_0->profile != FF_PROFILE_AAC_LTP) return; for (VAR_2 = 0; VAR_2 < VAR_11; VAR_2++) { VAR_6 = VAR_7 = 0.0f; for (VAR_3 = 0; VAR_3 < VAR_11; VAR_3++) { if (VAR_3 + 1024 < VAR_2) continue; VAR_6 += VAR_9[VAR_3]*VAR_10[VAR_3-VAR_2+1024]; VAR_7 += VAR_10[VAR_3-VAR_2+1024]*VAR_10[VAR_3-VAR_2+1024]; } VAR_5 = VAR_7 > 0.0f ? VAR_6/sqrt(VAR_7) : 0.0f; if (VAR_5 > VAR_8) { VAR_8 = VAR_5; VAR_4 = VAR_2; } } VAR_4 = av_clip_uintp2(VAR_4, 11); if (!VAR_4) { VAR_1->ics.ltp.VAR_4 = VAR_4; return; } VAR_6 = VAR_7 = 0.0f; for (VAR_2 = 0; VAR_2 < VAR_4; VAR_2++) { VAR_6 += VAR_9[VAR_2]; VAR_7 += VAR_10[VAR_2-VAR_4+1024]; } VAR_1->ics.ltp.coef_idx = quant_array_idx(VAR_6/VAR_7, ltp_coef, 8); VAR_1->ics.ltp.coef = ltp_coef[VAR_1->ics.ltp.coef_idx]; if (VAR_4 < 1024) VAR_11 = VAR_4 + 1024; for (VAR_2 = 0; VAR_2 < VAR_11; VAR_2++) VAR_10[VAR_2+1024] = VAR_1->ics.ltp.coef*VAR_10[VAR_2-VAR_4+1024]; memset(&VAR_10[VAR_11], 0, (2048 - VAR_11)*sizeof(float)); VAR_1->ics.ltp.VAR_4 = VAR_4; }
[ "void FUNC_0(AACEncContext *VAR_0, SingleChannelElement *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4;", "float VAR_5, VAR_6, VAR_7, VAR_8 = 0.0f;", "float *VAR_9 = &VAR_0->planar_samples[VAR_0->cur_channel][1024];", "float *VAR_10 = &VAR_1->ltp_state[0];", "int VAR_11 = 2048;", "if (VAR_0->profile != FF_PROFILE_AAC_LTP)\nreturn;", "for (VAR_2 = 0; VAR_2 < VAR_11; VAR_2++) {", "VAR_6 = VAR_7 = 0.0f;", "for (VAR_3 = 0; VAR_3 < VAR_11; VAR_3++) {", "if (VAR_3 + 1024 < VAR_2)\ncontinue;", "VAR_6 += VAR_9[VAR_3]*VAR_10[VAR_3-VAR_2+1024];", "VAR_7 += VAR_10[VAR_3-VAR_2+1024]*VAR_10[VAR_3-VAR_2+1024];", "}", "VAR_5 = VAR_7 > 0.0f ? VAR_6/sqrt(VAR_7) : 0.0f;", "if (VAR_5 > VAR_8) {", "VAR_8 = VAR_5;", "VAR_4 = VAR_2;", "}", "}", "VAR_4 = av_clip_uintp2(VAR_4, 11);", "if (!VAR_4) {", "VAR_1->ics.ltp.VAR_4 = VAR_4;", "return;", "}", "VAR_6 = VAR_7 = 0.0f;", "for (VAR_2 = 0; VAR_2 < VAR_4; VAR_2++) {", "VAR_6 += VAR_9[VAR_2];", "VAR_7 += VAR_10[VAR_2-VAR_4+1024];", "}", "VAR_1->ics.ltp.coef_idx = quant_array_idx(VAR_6/VAR_7, ltp_coef, 8);", "VAR_1->ics.ltp.coef = ltp_coef[VAR_1->ics.ltp.coef_idx];", "if (VAR_4 < 1024)\nVAR_11 = VAR_4 + 1024;", "for (VAR_2 = 0; VAR_2 < VAR_11; VAR_2++)", "VAR_10[VAR_2+1024] = VAR_1->ics.ltp.coef*VAR_10[VAR_2-VAR_4+1024];", "memset(&VAR_10[VAR_11], 0, (2048 - VAR_11)*sizeof(float));", "VAR_1->ics.ltp.VAR_4 = 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ] ]
21,687
void ff_biweight_h264_pixels4_8_msa(uint8_t *dst, uint8_t *src, int stride, int height, int log2_denom, int weight_dst, int weight_src, int offset) { avc_biwgt_4width_msa(src, stride, dst, stride, height, log2_denom, weight_src, weight_dst, offset); }
false
FFmpeg
bcd7bf7eeb09a395cc01698842d1b8be9af483fc
void ff_biweight_h264_pixels4_8_msa(uint8_t *dst, uint8_t *src, int stride, int height, int log2_denom, int weight_dst, int weight_src, int offset) { avc_biwgt_4width_msa(src, stride, dst, stride, height, log2_denom, weight_src, weight_dst, offset); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7) { avc_biwgt_4width_msa(VAR_1, VAR_2, VAR_0, VAR_2, VAR_3, VAR_4, VAR_6, VAR_5, VAR_7); }
[ "void FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1,\nint VAR_2, int VAR_3,\nint VAR_4, int VAR_5,\nint VAR_6, int VAR_7)\n{", "avc_biwgt_4width_msa(VAR_1, VAR_2,\nVAR_0, VAR_2,\nVAR_3, VAR_4,\nVAR_6, VAR_5, VAR_7);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11, 13, 15, 17 ], [ 19 ] ]
21,688
void clear_blocks_dcbz128_ppc(DCTELEM *blocks) { POWERPC_TBL_DECLARE(powerpc_clear_blocks_dcbz128, 1); register int misal = ((unsigned long)blocks & 0x0000007f); register int i = 0; POWERPC_TBL_START_COUNT(powerpc_clear_blocks_dcbz128, 1); #if 1 if (misal) { // we could probably also optimize this case, // but there's not much point as the machines // aren't available yet (2003-06-26) memset(blocks, 0, sizeof(DCTELEM)*6*64); } else for ( ; i < sizeof(DCTELEM)*6*64 ; i += 128) { asm volatile("dcbzl %0,%1" : : "b" (blocks), "r" (i) : "memory"); } #else memset(blocks, 0, sizeof(DCTELEM)*6*64); #endif POWERPC_TBL_STOP_COUNT(powerpc_clear_blocks_dcbz128, 1); }
false
FFmpeg
e45a2872fafe631c14aee9f79d0963d68c4fc1fd
void clear_blocks_dcbz128_ppc(DCTELEM *blocks) { POWERPC_TBL_DECLARE(powerpc_clear_blocks_dcbz128, 1); register int misal = ((unsigned long)blocks & 0x0000007f); register int i = 0; POWERPC_TBL_START_COUNT(powerpc_clear_blocks_dcbz128, 1); #if 1 if (misal) { memset(blocks, 0, sizeof(DCTELEM)*6*64); } else for ( ; i < sizeof(DCTELEM)*6*64 ; i += 128) { asm volatile("dcbzl %0,%1" : : "b" (blocks), "r" (i) : "memory"); } #else memset(blocks, 0, sizeof(DCTELEM)*6*64); #endif POWERPC_TBL_STOP_COUNT(powerpc_clear_blocks_dcbz128, 1); }
{ "code": [], "line_no": [] }
void FUNC_0(DCTELEM *VAR_0) { POWERPC_TBL_DECLARE(powerpc_clear_blocks_dcbz128, 1); register int VAR_1 = ((unsigned long)VAR_0 & 0x0000007f); register int VAR_2 = 0; POWERPC_TBL_START_COUNT(powerpc_clear_blocks_dcbz128, 1); #if 1 if (VAR_1) { memset(VAR_0, 0, sizeof(DCTELEM)*6*64); } else for ( ; VAR_2 < sizeof(DCTELEM)*6*64 ; VAR_2 += 128) { asm volatile("dcbzl %0,%1" : : "b" (VAR_0), "r" (VAR_2) : "memory"); } #else memset(VAR_0, 0, sizeof(DCTELEM)*6*64); #endif POWERPC_TBL_STOP_COUNT(powerpc_clear_blocks_dcbz128, 1); }
[ "void FUNC_0(DCTELEM *VAR_0)\n{", "POWERPC_TBL_DECLARE(powerpc_clear_blocks_dcbz128, 1);", "register int VAR_1 = ((unsigned long)VAR_0 & 0x0000007f);", "register int VAR_2 = 0;", "POWERPC_TBL_START_COUNT(powerpc_clear_blocks_dcbz128, 1);", "#if 1\nif (VAR_1) {", "memset(VAR_0, 0, sizeof(DCTELEM)*6*64);", "}", "else\nfor ( ; VAR_2 < sizeof(DCTELEM)*6*64 ; VAR_2 += 128) {", "asm volatile(\"dcbzl %0,%1\" : : \"b\" (VAR_0), \"r\" (VAR_2) : \"memory\");", "}", "#else\nmemset(VAR_0, 0, sizeof(DCTELEM)*6*64);", "#endif\nPOWERPC_TBL_STOP_COUNT(powerpc_clear_blocks_dcbz128, 1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 43 ] ]
21,689
static void ppc_cpu_class_init(ObjectClass *oc, void *data) { PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); CPUClass *cc = CPU_CLASS(oc); DeviceClass *dc = DEVICE_CLASS(oc); pcc->parent_realize = dc->realize; dc->realize = ppc_cpu_realizefn; dc->unrealize = ppc_cpu_unrealizefn; pcc->parent_reset = cc->reset; cc->reset = ppc_cpu_reset; cc->class_by_name = ppc_cpu_class_by_name; cc->do_interrupt = ppc_cpu_do_interrupt; cc->dump_state = ppc_cpu_dump_state; cc->dump_statistics = ppc_cpu_dump_statistics; cc->set_pc = ppc_cpu_set_pc; cc->gdb_read_register = ppc_cpu_gdb_read_register; cc->gdb_write_register = ppc_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug; cc->vmsd = &vmstate_ppc_cpu; cc->gdb_num_core_regs = 71; cc->gdb_core_xml_file = "power64-core.xml"; #else cc->gdb_core_xml_file = "power-core.xml"; }
true
qemu
e62fbc54d459d4cc8e91dc0938383a7f4c13768c
static void ppc_cpu_class_init(ObjectClass *oc, void *data) { PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); CPUClass *cc = CPU_CLASS(oc); DeviceClass *dc = DEVICE_CLASS(oc); pcc->parent_realize = dc->realize; dc->realize = ppc_cpu_realizefn; dc->unrealize = ppc_cpu_unrealizefn; pcc->parent_reset = cc->reset; cc->reset = ppc_cpu_reset; cc->class_by_name = ppc_cpu_class_by_name; cc->do_interrupt = ppc_cpu_do_interrupt; cc->dump_state = ppc_cpu_dump_state; cc->dump_statistics = ppc_cpu_dump_statistics; cc->set_pc = ppc_cpu_set_pc; cc->gdb_read_register = ppc_cpu_gdb_read_register; cc->gdb_write_register = ppc_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug; cc->vmsd = &vmstate_ppc_cpu; cc->gdb_num_core_regs = 71; cc->gdb_core_xml_file = "power64-core.xml"; #else cc->gdb_core_xml_file = "power-core.xml"; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(VAR_0); CPUClass *cc = CPU_CLASS(VAR_0); DeviceClass *dc = DEVICE_CLASS(VAR_0); pcc->parent_realize = dc->realize; dc->realize = ppc_cpu_realizefn; dc->unrealize = ppc_cpu_unrealizefn; pcc->parent_reset = cc->reset; cc->reset = ppc_cpu_reset; cc->class_by_name = ppc_cpu_class_by_name; cc->do_interrupt = ppc_cpu_do_interrupt; cc->dump_state = ppc_cpu_dump_state; cc->dump_statistics = ppc_cpu_dump_statistics; cc->set_pc = ppc_cpu_set_pc; cc->gdb_read_register = ppc_cpu_gdb_read_register; cc->gdb_write_register = ppc_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug; cc->vmsd = &vmstate_ppc_cpu; cc->gdb_num_core_regs = 71; cc->gdb_core_xml_file = "power64-core.xml"; #else cc->gdb_core_xml_file = "power-core.xml"; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(VAR_0);", "CPUClass *cc = CPU_CLASS(VAR_0);", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "pcc->parent_realize = dc->realize;", "dc->realize = ppc_cpu_realizefn;", "dc->unrealize = ppc_cpu_unrealizefn;", "pcc->parent_reset = cc->reset;", "cc->reset = ppc_cpu_reset;", "cc->class_by_name = ppc_cpu_class_by_name;", "cc->do_interrupt = ppc_cpu_do_interrupt;", "cc->dump_state = ppc_cpu_dump_state;", "cc->dump_statistics = ppc_cpu_dump_statistics;", "cc->set_pc = ppc_cpu_set_pc;", "cc->gdb_read_register = ppc_cpu_gdb_read_register;", "cc->gdb_write_register = ppc_cpu_gdb_write_register;", "#ifndef CONFIG_USER_ONLY\ncc->get_phys_page_debug = ppc_cpu_get_phys_page_debug;", "cc->vmsd = &vmstate_ppc_cpu;", "cc->gdb_num_core_regs = 71;", "cc->gdb_core_xml_file = \"power64-core.xml\";", "#else\ncc->gdb_core_xml_file = \"power-core.xml\";", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 54 ], [ 57 ], [ 59, 61 ], [ 64 ] ]
21,690
static CharDriverState *qmp_chardev_open_socket(ChardevSocket *sock, Error **errp) { SocketAddress *addr = sock->addr; bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; bool is_listen = sock->has_server ? sock->server : true; bool is_telnet = sock->has_telnet ? sock->telnet : false; bool is_waitconnect = sock->has_wait ? sock->wait : false; int fd; if (is_listen) { fd = socket_listen(addr, errp); } else { fd = socket_connect(addr, errp, NULL, NULL); } if (error_is_set(errp)) { return NULL; } return qemu_chr_open_socket_fd(fd, do_nodelay, is_listen, is_telnet, is_waitconnect, errp); }
true
qemu
5f758366c0710d23e43f4d0f83816b98616a13d0
static CharDriverState *qmp_chardev_open_socket(ChardevSocket *sock, Error **errp) { SocketAddress *addr = sock->addr; bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; bool is_listen = sock->has_server ? sock->server : true; bool is_telnet = sock->has_telnet ? sock->telnet : false; bool is_waitconnect = sock->has_wait ? sock->wait : false; int fd; if (is_listen) { fd = socket_listen(addr, errp); } else { fd = socket_connect(addr, errp, NULL, NULL); } if (error_is_set(errp)) { return NULL; } return qemu_chr_open_socket_fd(fd, do_nodelay, is_listen, is_telnet, is_waitconnect, errp); }
{ "code": [ " if (error_is_set(errp)) {", " if (error_is_set(errp)) {", " if (error_is_set(errp)) {", " if (error_is_set(errp)) {", " if (error_is_set(errp)) {" ], "line_no": [ 31, 31, 31, 31, 31 ] }
static CharDriverState *FUNC_0(ChardevSocket *sock, Error **errp) { SocketAddress *addr = sock->addr; bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; bool is_listen = sock->has_server ? sock->server : true; bool is_telnet = sock->has_telnet ? sock->telnet : false; bool is_waitconnect = sock->has_wait ? sock->wait : false; int VAR_0; if (is_listen) { VAR_0 = socket_listen(addr, errp); } else { VAR_0 = socket_connect(addr, errp, NULL, NULL); } if (error_is_set(errp)) { return NULL; } return qemu_chr_open_socket_fd(VAR_0, do_nodelay, is_listen, is_telnet, is_waitconnect, errp); }
[ "static CharDriverState *FUNC_0(ChardevSocket *sock,\nError **errp)\n{", "SocketAddress *addr = sock->addr;", "bool do_nodelay = sock->has_nodelay ? sock->nodelay : false;", "bool is_listen = sock->has_server ? sock->server : true;", "bool is_telnet = sock->has_telnet ? sock->telnet : false;", "bool is_waitconnect = sock->has_wait ? sock->wait : false;", "int VAR_0;", "if (is_listen) {", "VAR_0 = socket_listen(addr, errp);", "} else {", "VAR_0 = socket_connect(addr, errp, NULL, NULL);", "}", "if (error_is_set(errp)) {", "return NULL;", "}", "return qemu_chr_open_socket_fd(VAR_0, do_nodelay, is_listen,\nis_telnet, is_waitconnect, errp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ] ]
21,692
static const char *ass_split_section(ASSSplitContext *ctx, const char *buf) { const ASSSection *section = &ass_sections[ctx->current_section]; int *number = &ctx->field_number[ctx->current_section]; int *order = ctx->field_order[ctx->current_section]; int *tmp, i, len; while (buf && *buf) { if (buf[0] == '[') { ctx->current_section = -1; break; } if (buf[0] == ';' || (buf[0] == '!' && buf[1] == ':')) { /* skip comments */ } else if (section->format_header && !order) { len = strlen(section->format_header); if (strncmp(buf, section->format_header, len) || buf[len] != ':') return NULL; buf += len + 1; while (!is_eol(*buf)) { buf = skip_space(buf); len = strcspn(buf, ", \r\n"); if (!(tmp = av_realloc(order, (*number + 1) * sizeof(*order)))) return NULL; order = tmp; order[*number] = -1; for (i=0; section->fields[i].name; i++) if (!strncmp(buf, section->fields[i].name, len)) { order[*number] = i; break; } (*number)++; buf = skip_space(buf + len + (buf[len] == ',')); } ctx->field_order[ctx->current_section] = order; } else if (section->fields_header) { len = strlen(section->fields_header); if (!strncmp(buf, section->fields_header, len) && buf[len] == ':') { uint8_t *ptr, *struct_ptr = realloc_section_array(ctx); if (!struct_ptr) return NULL; buf += len + 1; for (i=0; !is_eol(*buf) && i < *number; i++) { int last = i == *number - 1; buf = skip_space(buf); len = strcspn(buf, last ? "\r\n" : ",\r\n"); if (order[i] >= 0) { ASSFieldType type = section->fields[order[i]].type; ptr = struct_ptr + section->fields[order[i]].offset; convert_func[type](ptr, buf, len); } buf = skip_space(buf + len + !last); } } } else { len = strcspn(buf, ":\r\n"); if (buf[len] == ':') { for (i=0; section->fields[i].name; i++) if (!strncmp(buf, section->fields[i].name, len)) { ASSFieldType type = section->fields[i].type; uint8_t *ptr = (uint8_t *)&ctx->ass + section->offset; ptr += section->fields[i].offset; buf = skip_space(buf + len + 1); convert_func[type](ptr, buf, strcspn(buf, "\r\n")); break; } } } buf += strcspn(buf, "\n") + 1; } return buf; }
true
FFmpeg
6ca2465556836d20ab9ea5689960fbf1fbda0e23
static const char *ass_split_section(ASSSplitContext *ctx, const char *buf) { const ASSSection *section = &ass_sections[ctx->current_section]; int *number = &ctx->field_number[ctx->current_section]; int *order = ctx->field_order[ctx->current_section]; int *tmp, i, len; while (buf && *buf) { if (buf[0] == '[') { ctx->current_section = -1; break; } if (buf[0] == ';' || (buf[0] == '!' && buf[1] == ':')) { } else if (section->format_header && !order) { len = strlen(section->format_header); if (strncmp(buf, section->format_header, len) || buf[len] != ':') return NULL; buf += len + 1; while (!is_eol(*buf)) { buf = skip_space(buf); len = strcspn(buf, ", \r\n"); if (!(tmp = av_realloc(order, (*number + 1) * sizeof(*order)))) return NULL; order = tmp; order[*number] = -1; for (i=0; section->fields[i].name; i++) if (!strncmp(buf, section->fields[i].name, len)) { order[*number] = i; break; } (*number)++; buf = skip_space(buf + len + (buf[len] == ',')); } ctx->field_order[ctx->current_section] = order; } else if (section->fields_header) { len = strlen(section->fields_header); if (!strncmp(buf, section->fields_header, len) && buf[len] == ':') { uint8_t *ptr, *struct_ptr = realloc_section_array(ctx); if (!struct_ptr) return NULL; buf += len + 1; for (i=0; !is_eol(*buf) && i < *number; i++) { int last = i == *number - 1; buf = skip_space(buf); len = strcspn(buf, last ? "\r\n" : ",\r\n"); if (order[i] >= 0) { ASSFieldType type = section->fields[order[i]].type; ptr = struct_ptr + section->fields[order[i]].offset; convert_func[type](ptr, buf, len); } buf = skip_space(buf + len + !last); } } } else { len = strcspn(buf, ":\r\n"); if (buf[len] == ':') { for (i=0; section->fields[i].name; i++) if (!strncmp(buf, section->fields[i].name, len)) { ASSFieldType type = section->fields[i].type; uint8_t *ptr = (uint8_t *)&ctx->ass + section->offset; ptr += section->fields[i].offset; buf = skip_space(buf + len + 1); convert_func[type](ptr, buf, strcspn(buf, "\r\n")); break; } } } buf += strcspn(buf, "\n") + 1; } return buf; }
{ "code": [ " buf += strcspn(buf, \"\\n\") + 1;" ], "line_no": [ 135 ] }
static const char *FUNC_0(ASSSplitContext *VAR_0, const char *VAR_1) { const ASSSection *VAR_2 = &ass_sections[VAR_0->current_section]; int *VAR_3 = &VAR_0->field_number[VAR_0->current_section]; int *VAR_4 = VAR_0->field_order[VAR_0->current_section]; int *VAR_5, VAR_6, VAR_7; while (VAR_1 && *VAR_1) { if (VAR_1[0] == '[') { VAR_0->current_section = -1; break; } if (VAR_1[0] == ';' || (VAR_1[0] == '!' && VAR_1[1] == ':')) { } else if (VAR_2->format_header && !VAR_4) { VAR_7 = strlen(VAR_2->format_header); if (strncmp(VAR_1, VAR_2->format_header, VAR_7) || VAR_1[VAR_7] != ':') return NULL; VAR_1 += VAR_7 + 1; while (!is_eol(*VAR_1)) { VAR_1 = skip_space(VAR_1); VAR_7 = strcspn(VAR_1, ", \r\n"); if (!(VAR_5 = av_realloc(VAR_4, (*VAR_3 + 1) * sizeof(*VAR_4)))) return NULL; VAR_4 = VAR_5; VAR_4[*VAR_3] = -1; for (VAR_6=0; VAR_2->fields[VAR_6].name; VAR_6++) if (!strncmp(VAR_1, VAR_2->fields[VAR_6].name, VAR_7)) { VAR_4[*VAR_3] = VAR_6; break; } (*VAR_3)++; VAR_1 = skip_space(VAR_1 + VAR_7 + (VAR_1[VAR_7] == ',')); } VAR_0->field_order[VAR_0->current_section] = VAR_4; } else if (VAR_2->fields_header) { VAR_7 = strlen(VAR_2->fields_header); if (!strncmp(VAR_1, VAR_2->fields_header, VAR_7) && VAR_1[VAR_7] == ':') { uint8_t *ptr, *struct_ptr = realloc_section_array(VAR_0); if (!struct_ptr) return NULL; VAR_1 += VAR_7 + 1; for (VAR_6=0; !is_eol(*VAR_1) && VAR_6 < *VAR_3; VAR_6++) { int VAR_8 = VAR_6 == *VAR_3 - 1; VAR_1 = skip_space(VAR_1); VAR_7 = strcspn(VAR_1, VAR_8 ? "\r\n" : ",\r\n"); if (VAR_4[VAR_6] >= 0) { ASSFieldType type = VAR_2->fields[VAR_4[VAR_6]].type; ptr = struct_ptr + VAR_2->fields[VAR_4[VAR_6]].offset; convert_func[type](ptr, VAR_1, VAR_7); } VAR_1 = skip_space(VAR_1 + VAR_7 + !VAR_8); } } } else { VAR_7 = strcspn(VAR_1, ":\r\n"); if (VAR_1[VAR_7] == ':') { for (VAR_6=0; VAR_2->fields[VAR_6].name; VAR_6++) if (!strncmp(VAR_1, VAR_2->fields[VAR_6].name, VAR_7)) { ASSFieldType type = VAR_2->fields[VAR_6].type; uint8_t *ptr = (uint8_t *)&VAR_0->ass + VAR_2->offset; ptr += VAR_2->fields[VAR_6].offset; VAR_1 = skip_space(VAR_1 + VAR_7 + 1); convert_func[type](ptr, VAR_1, strcspn(VAR_1, "\r\n")); break; } } } VAR_1 += strcspn(VAR_1, "\n") + 1; } return VAR_1; }
[ "static const char *FUNC_0(ASSSplitContext *VAR_0, const char *VAR_1)\n{", "const ASSSection *VAR_2 = &ass_sections[VAR_0->current_section];", "int *VAR_3 = &VAR_0->field_number[VAR_0->current_section];", "int *VAR_4 = VAR_0->field_order[VAR_0->current_section];", "int *VAR_5, VAR_6, VAR_7;", "while (VAR_1 && *VAR_1) {", "if (VAR_1[0] == '[') {", "VAR_0->current_section = -1;", "break;", "}", "if (VAR_1[0] == ';' || (VAR_1[0] == '!' && VAR_1[1] == ':')) {", "} else if (VAR_2->format_header && !VAR_4) {", "VAR_7 = strlen(VAR_2->format_header);", "if (strncmp(VAR_1, VAR_2->format_header, VAR_7) || VAR_1[VAR_7] != ':')\nreturn NULL;", "VAR_1 += VAR_7 + 1;", "while (!is_eol(*VAR_1)) {", "VAR_1 = skip_space(VAR_1);", "VAR_7 = strcspn(VAR_1, \", \\r\\n\");", "if (!(VAR_5 = av_realloc(VAR_4, (*VAR_3 + 1) * sizeof(*VAR_4))))\nreturn NULL;", "VAR_4 = VAR_5;", "VAR_4[*VAR_3] = -1;", "for (VAR_6=0; VAR_2->fields[VAR_6].name; VAR_6++)", "if (!strncmp(VAR_1, VAR_2->fields[VAR_6].name, VAR_7)) {", "VAR_4[*VAR_3] = VAR_6;", "break;", "}", "(*VAR_3)++;", "VAR_1 = skip_space(VAR_1 + VAR_7 + (VAR_1[VAR_7] == ','));", "}", "VAR_0->field_order[VAR_0->current_section] = VAR_4;", "} else if (VAR_2->fields_header) {", "VAR_7 = strlen(VAR_2->fields_header);", "if (!strncmp(VAR_1, VAR_2->fields_header, VAR_7) && VAR_1[VAR_7] == ':') {", "uint8_t *ptr, *struct_ptr = realloc_section_array(VAR_0);", "if (!struct_ptr) return NULL;", "VAR_1 += VAR_7 + 1;", "for (VAR_6=0; !is_eol(*VAR_1) && VAR_6 < *VAR_3; VAR_6++) {", "int VAR_8 = VAR_6 == *VAR_3 - 1;", "VAR_1 = skip_space(VAR_1);", "VAR_7 = strcspn(VAR_1, VAR_8 ? \"\\r\\n\" : \",\\r\\n\");", "if (VAR_4[VAR_6] >= 0) {", "ASSFieldType type = VAR_2->fields[VAR_4[VAR_6]].type;", "ptr = struct_ptr + VAR_2->fields[VAR_4[VAR_6]].offset;", "convert_func[type](ptr, VAR_1, VAR_7);", "}", "VAR_1 = skip_space(VAR_1 + VAR_7 + !VAR_8);", "}", "}", "} else {", "VAR_7 = strcspn(VAR_1, \":\\r\\n\");", "if (VAR_1[VAR_7] == ':') {", "for (VAR_6=0; VAR_2->fields[VAR_6].name; VAR_6++)", "if (!strncmp(VAR_1, VAR_2->fields[VAR_6].name, VAR_7)) {", "ASSFieldType type = VAR_2->fields[VAR_6].type;", "uint8_t *ptr = (uint8_t *)&VAR_0->ass + VAR_2->offset;", "ptr += VAR_2->fields[VAR_6].offset;", "VAR_1 = skip_space(VAR_1 + VAR_7 + 1);", "convert_func[type](ptr, VAR_1, strcspn(VAR_1, \"\\r\\n\"));", "break;", "}", "}", "}", "VAR_1 += strcspn(VAR_1, \"\\n\") + 1;", "}", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 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 ] ]
21,693
static inline void yuv2rgbXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int dstbpp) { if(dstbpp==32) { int i; for(i=0; i<(dstW>>1); i++){ int j; int Y1=0; int Y2=0; int U=0; int V=0; int Cb, Cr, Cg; for(j=0; j<lumFilterSize; j++) { Y1 += lumSrc[j][2*i] * lumFilter[j]; Y2 += lumSrc[j][2*i+1] * lumFilter[j]; } for(j=0; j<chrFilterSize; j++) { U += chrSrc[j][i] * chrFilter[j]; V += chrSrc[j][i+2048] * chrFilter[j]; } Y1= clip_yuvtab_2568[ (Y1>>19) + 256 ]; Y2= clip_yuvtab_2568[ (Y2>>19) + 256 ]; U >>= 19; V >>= 19; Cb= clip_yuvtab_40cf[U+ 256]; Cg= clip_yuvtab_1a1e[V+ 256] + yuvtab_0c92[U+ 256]; Cr= clip_yuvtab_3343[V+ 256]; dest[8*i+0]=clip_table[((Y1 + Cb) >>13)]; dest[8*i+1]=clip_table[((Y1 + Cg) >>13)]; dest[8*i+2]=clip_table[((Y1 + Cr) >>13)]; dest[8*i+4]=clip_table[((Y2 + Cb) >>13)]; dest[8*i+5]=clip_table[((Y2 + Cg) >>13)]; dest[8*i+6]=clip_table[((Y2 + Cr) >>13)]; } } else if(dstbpp==24) { int i; for(i=0; i<(dstW>>1); i++){ int j; int Y1=0; int Y2=0; int U=0; int V=0; int Cb, Cr, Cg; for(j=0; j<lumFilterSize; j++) { Y1 += lumSrc[j][2*i] * lumFilter[j]; Y2 += lumSrc[j][2*i+1] * lumFilter[j]; } for(j=0; j<chrFilterSize; j++) { U += chrSrc[j][i] * chrFilter[j]; V += chrSrc[j][i+2048] * chrFilter[j]; } Y1= clip_yuvtab_2568[ (Y1>>19) + 256 ]; Y2= clip_yuvtab_2568[ (Y2>>19) + 256 ]; U >>= 19; V >>= 19; Cb= clip_yuvtab_40cf[U+ 256]; Cg= clip_yuvtab_1a1e[V+ 256] + yuvtab_0c92[U+ 256]; Cr= clip_yuvtab_3343[V+ 256]; dest[0]=clip_table[((Y1 + Cb) >>13)]; dest[1]=clip_table[((Y1 + Cg) >>13)]; dest[2]=clip_table[((Y1 + Cr) >>13)]; dest[3]=clip_table[((Y2 + Cb) >>13)]; dest[4]=clip_table[((Y2 + Cg) >>13)]; dest[5]=clip_table[((Y2 + Cr) >>13)]; dest+=6; } } else if(dstbpp==16) { int i; for(i=0; i<(dstW>>1); i++){ int j; int Y1=0; int Y2=0; int U=0; int V=0; int Cb, Cr, Cg; for(j=0; j<lumFilterSize; j++) { Y1 += lumSrc[j][2*i] * lumFilter[j]; Y2 += lumSrc[j][2*i+1] * lumFilter[j]; } for(j=0; j<chrFilterSize; j++) { U += chrSrc[j][i] * chrFilter[j]; V += chrSrc[j][i+2048] * chrFilter[j]; } Y1= clip_yuvtab_2568[ (Y1>>19) + 256 ]; Y2= clip_yuvtab_2568[ (Y2>>19) + 256 ]; U >>= 19; V >>= 19; Cb= clip_yuvtab_40cf[U+ 256]; Cg= clip_yuvtab_1a1e[V+ 256] + yuvtab_0c92[U+ 256]; Cr= clip_yuvtab_3343[V+ 256]; ((uint16_t*)dest)[2*i] = clip_table16b[(Y1 + Cb) >>13] | clip_table16g[(Y1 + Cg) >>13] | clip_table16r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[2*i+1] = clip_table16b[(Y2 + Cb) >>13] | clip_table16g[(Y2 + Cg) >>13] | clip_table16r[(Y2 + Cr) >>13]; } } else if(dstbpp==15) { int i; for(i=0; i<(dstW>>1); i++){ int j; int Y1=0; int Y2=0; int U=0; int V=0; int Cb, Cr, Cg; for(j=0; j<lumFilterSize; j++) { Y1 += lumSrc[j][2*i] * lumFilter[j]; Y2 += lumSrc[j][2*i+1] * lumFilter[j]; } for(j=0; j<chrFilterSize; j++) { U += chrSrc[j][i] * chrFilter[j]; V += chrSrc[j][i+2048] * chrFilter[j]; } Y1= clip_yuvtab_2568[ (Y1>>19) + 256 ]; Y2= clip_yuvtab_2568[ (Y2>>19) + 256 ]; U >>= 19; V >>= 19; Cb= clip_yuvtab_40cf[U+ 256]; Cg= clip_yuvtab_1a1e[V+ 256] + yuvtab_0c92[U+ 256]; Cr= clip_yuvtab_3343[V+ 256]; ((uint16_t*)dest)[2*i] = clip_table15b[(Y1 + Cb) >>13] | clip_table15g[(Y1 + Cg) >>13] | clip_table15r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[2*i+1] = clip_table15b[(Y2 + Cb) >>13] | clip_table15g[(Y2 + Cg) >>13] | clip_table15r[(Y2 + Cr) >>13]; } } }
true
FFmpeg
28bf81c90d36a55cf76e2be913c5215ebebf61f2
static inline void yuv2rgbXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int dstbpp) { if(dstbpp==32) { int i; for(i=0; i<(dstW>>1); i++){ int j; int Y1=0; int Y2=0; int U=0; int V=0; int Cb, Cr, Cg; for(j=0; j<lumFilterSize; j++) { Y1 += lumSrc[j][2*i] * lumFilter[j]; Y2 += lumSrc[j][2*i+1] * lumFilter[j]; } for(j=0; j<chrFilterSize; j++) { U += chrSrc[j][i] * chrFilter[j]; V += chrSrc[j][i+2048] * chrFilter[j]; } Y1= clip_yuvtab_2568[ (Y1>>19) + 256 ]; Y2= clip_yuvtab_2568[ (Y2>>19) + 256 ]; U >>= 19; V >>= 19; Cb= clip_yuvtab_40cf[U+ 256]; Cg= clip_yuvtab_1a1e[V+ 256] + yuvtab_0c92[U+ 256]; Cr= clip_yuvtab_3343[V+ 256]; dest[8*i+0]=clip_table[((Y1 + Cb) >>13)]; dest[8*i+1]=clip_table[((Y1 + Cg) >>13)]; dest[8*i+2]=clip_table[((Y1 + Cr) >>13)]; dest[8*i+4]=clip_table[((Y2 + Cb) >>13)]; dest[8*i+5]=clip_table[((Y2 + Cg) >>13)]; dest[8*i+6]=clip_table[((Y2 + Cr) >>13)]; } } else if(dstbpp==24) { int i; for(i=0; i<(dstW>>1); i++){ int j; int Y1=0; int Y2=0; int U=0; int V=0; int Cb, Cr, Cg; for(j=0; j<lumFilterSize; j++) { Y1 += lumSrc[j][2*i] * lumFilter[j]; Y2 += lumSrc[j][2*i+1] * lumFilter[j]; } for(j=0; j<chrFilterSize; j++) { U += chrSrc[j][i] * chrFilter[j]; V += chrSrc[j][i+2048] * chrFilter[j]; } Y1= clip_yuvtab_2568[ (Y1>>19) + 256 ]; Y2= clip_yuvtab_2568[ (Y2>>19) + 256 ]; U >>= 19; V >>= 19; Cb= clip_yuvtab_40cf[U+ 256]; Cg= clip_yuvtab_1a1e[V+ 256] + yuvtab_0c92[U+ 256]; Cr= clip_yuvtab_3343[V+ 256]; dest[0]=clip_table[((Y1 + Cb) >>13)]; dest[1]=clip_table[((Y1 + Cg) >>13)]; dest[2]=clip_table[((Y1 + Cr) >>13)]; dest[3]=clip_table[((Y2 + Cb) >>13)]; dest[4]=clip_table[((Y2 + Cg) >>13)]; dest[5]=clip_table[((Y2 + Cr) >>13)]; dest+=6; } } else if(dstbpp==16) { int i; for(i=0; i<(dstW>>1); i++){ int j; int Y1=0; int Y2=0; int U=0; int V=0; int Cb, Cr, Cg; for(j=0; j<lumFilterSize; j++) { Y1 += lumSrc[j][2*i] * lumFilter[j]; Y2 += lumSrc[j][2*i+1] * lumFilter[j]; } for(j=0; j<chrFilterSize; j++) { U += chrSrc[j][i] * chrFilter[j]; V += chrSrc[j][i+2048] * chrFilter[j]; } Y1= clip_yuvtab_2568[ (Y1>>19) + 256 ]; Y2= clip_yuvtab_2568[ (Y2>>19) + 256 ]; U >>= 19; V >>= 19; Cb= clip_yuvtab_40cf[U+ 256]; Cg= clip_yuvtab_1a1e[V+ 256] + yuvtab_0c92[U+ 256]; Cr= clip_yuvtab_3343[V+ 256]; ((uint16_t*)dest)[2*i] = clip_table16b[(Y1 + Cb) >>13] | clip_table16g[(Y1 + Cg) >>13] | clip_table16r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[2*i+1] = clip_table16b[(Y2 + Cb) >>13] | clip_table16g[(Y2 + Cg) >>13] | clip_table16r[(Y2 + Cr) >>13]; } } else if(dstbpp==15) { int i; for(i=0; i<(dstW>>1); i++){ int j; int Y1=0; int Y2=0; int U=0; int V=0; int Cb, Cr, Cg; for(j=0; j<lumFilterSize; j++) { Y1 += lumSrc[j][2*i] * lumFilter[j]; Y2 += lumSrc[j][2*i+1] * lumFilter[j]; } for(j=0; j<chrFilterSize; j++) { U += chrSrc[j][i] * chrFilter[j]; V += chrSrc[j][i+2048] * chrFilter[j]; } Y1= clip_yuvtab_2568[ (Y1>>19) + 256 ]; Y2= clip_yuvtab_2568[ (Y2>>19) + 256 ]; U >>= 19; V >>= 19; Cb= clip_yuvtab_40cf[U+ 256]; Cg= clip_yuvtab_1a1e[V+ 256] + yuvtab_0c92[U+ 256]; Cr= clip_yuvtab_3343[V+ 256]; ((uint16_t*)dest)[2*i] = clip_table15b[(Y1 + Cb) >>13] | clip_table15g[(Y1 + Cg) >>13] | clip_table15r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[2*i+1] = clip_table15b[(Y2 + Cb) >>13] | clip_table15g[(Y2 + Cg) >>13] | clip_table15r[(Y2 + Cr) >>13]; } } }
{ "code": [ "\t\t\t\t uint8_t *dest, int dstW, int dstbpp)", "\tif(dstbpp==32)", "\telse if(dstbpp==24)", "\telse if(dstbpp==16)", "\telse if(dstbpp==15)", "\tif(dstbpp==32)", "\telse if(dstbpp==24)", "\telse if(dstbpp==16)", "\telse if(dstbpp==15)", "\t\tint i;", "\t\tint i;", "\t\t\tint j;", "\t\t\tint j;", "\telse if(dstbpp==16)", "\telse if(dstbpp==24)", "\t\tint i;" ], "line_no": [ 5, 9, 85, 163, 243, 9, 85, 163, 243, 13, 13, 17, 17, 163, 85, 13 ] }
static inline void FUNC_0(int16_t *VAR_0, int16_t **VAR_1, int VAR_2, int16_t *VAR_3, int16_t **VAR_4, int VAR_5, uint8_t *VAR_6, int VAR_7, int VAR_8) { if(VAR_8==32) { int VAR_18; for(VAR_18=0; VAR_18<(VAR_7>>1); VAR_18++){ int VAR_18; int VAR_18=0; int VAR_18=0; int VAR_18=0; int VAR_18=0; int VAR_18, VAR_18, VAR_18; for(VAR_18=0; VAR_18<VAR_2; VAR_18++) { VAR_18 += VAR_1[VAR_18][2*VAR_18] * VAR_0[VAR_18]; VAR_18 += VAR_1[VAR_18][2*VAR_18+1] * VAR_0[VAR_18]; } for(VAR_18=0; VAR_18<VAR_5; VAR_18++) { VAR_18 += VAR_4[VAR_18][VAR_18] * VAR_3[VAR_18]; VAR_18 += VAR_4[VAR_18][VAR_18+2048] * VAR_3[VAR_18]; } VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ]; VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ]; VAR_18 >>= 19; VAR_18 >>= 19; VAR_18= clip_yuvtab_40cf[VAR_18+ 256]; VAR_18= clip_yuvtab_1a1e[VAR_18+ 256] + yuvtab_0c92[VAR_18+ 256]; VAR_18= clip_yuvtab_3343[VAR_18+ 256]; VAR_6[8*VAR_18+0]=clip_table[((VAR_18 + VAR_18) >>13)]; VAR_6[8*VAR_18+1]=clip_table[((VAR_18 + VAR_18) >>13)]; VAR_6[8*VAR_18+2]=clip_table[((VAR_18 + VAR_18) >>13)]; VAR_6[8*VAR_18+4]=clip_table[((VAR_18 + VAR_18) >>13)]; VAR_6[8*VAR_18+5]=clip_table[((VAR_18 + VAR_18) >>13)]; VAR_6[8*VAR_18+6]=clip_table[((VAR_18 + VAR_18) >>13)]; } } else if(VAR_8==24) { int VAR_18; for(VAR_18=0; VAR_18<(VAR_7>>1); VAR_18++){ int VAR_18; int VAR_18=0; int VAR_18=0; int VAR_18=0; int VAR_18=0; int VAR_18, VAR_18, VAR_18; for(VAR_18=0; VAR_18<VAR_2; VAR_18++) { VAR_18 += VAR_1[VAR_18][2*VAR_18] * VAR_0[VAR_18]; VAR_18 += VAR_1[VAR_18][2*VAR_18+1] * VAR_0[VAR_18]; } for(VAR_18=0; VAR_18<VAR_5; VAR_18++) { VAR_18 += VAR_4[VAR_18][VAR_18] * VAR_3[VAR_18]; VAR_18 += VAR_4[VAR_18][VAR_18+2048] * VAR_3[VAR_18]; } VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ]; VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ]; VAR_18 >>= 19; VAR_18 >>= 19; VAR_18= clip_yuvtab_40cf[VAR_18+ 256]; VAR_18= clip_yuvtab_1a1e[VAR_18+ 256] + yuvtab_0c92[VAR_18+ 256]; VAR_18= clip_yuvtab_3343[VAR_18+ 256]; VAR_6[0]=clip_table[((VAR_18 + VAR_18) >>13)]; VAR_6[1]=clip_table[((VAR_18 + VAR_18) >>13)]; VAR_6[2]=clip_table[((VAR_18 + VAR_18) >>13)]; VAR_6[3]=clip_table[((VAR_18 + VAR_18) >>13)]; VAR_6[4]=clip_table[((VAR_18 + VAR_18) >>13)]; VAR_6[5]=clip_table[((VAR_18 + VAR_18) >>13)]; VAR_6+=6; } } else if(VAR_8==16) { int VAR_18; for(VAR_18=0; VAR_18<(VAR_7>>1); VAR_18++){ int VAR_18; int VAR_18=0; int VAR_18=0; int VAR_18=0; int VAR_18=0; int VAR_18, VAR_18, VAR_18; for(VAR_18=0; VAR_18<VAR_2; VAR_18++) { VAR_18 += VAR_1[VAR_18][2*VAR_18] * VAR_0[VAR_18]; VAR_18 += VAR_1[VAR_18][2*VAR_18+1] * VAR_0[VAR_18]; } for(VAR_18=0; VAR_18<VAR_5; VAR_18++) { VAR_18 += VAR_4[VAR_18][VAR_18] * VAR_3[VAR_18]; VAR_18 += VAR_4[VAR_18][VAR_18+2048] * VAR_3[VAR_18]; } VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ]; VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ]; VAR_18 >>= 19; VAR_18 >>= 19; VAR_18= clip_yuvtab_40cf[VAR_18+ 256]; VAR_18= clip_yuvtab_1a1e[VAR_18+ 256] + yuvtab_0c92[VAR_18+ 256]; VAR_18= clip_yuvtab_3343[VAR_18+ 256]; ((uint16_t*)VAR_6)[2*VAR_18] = clip_table16b[(VAR_18 + VAR_18) >>13] | clip_table16g[(VAR_18 + VAR_18) >>13] | clip_table16r[(VAR_18 + VAR_18) >>13]; ((uint16_t*)VAR_6)[2*VAR_18+1] = clip_table16b[(VAR_18 + VAR_18) >>13] | clip_table16g[(VAR_18 + VAR_18) >>13] | clip_table16r[(VAR_18 + VAR_18) >>13]; } } else if(VAR_8==15) { int VAR_18; for(VAR_18=0; VAR_18<(VAR_7>>1); VAR_18++){ int VAR_18; int VAR_18=0; int VAR_18=0; int VAR_18=0; int VAR_18=0; int VAR_18, VAR_18, VAR_18; for(VAR_18=0; VAR_18<VAR_2; VAR_18++) { VAR_18 += VAR_1[VAR_18][2*VAR_18] * VAR_0[VAR_18]; VAR_18 += VAR_1[VAR_18][2*VAR_18+1] * VAR_0[VAR_18]; } for(VAR_18=0; VAR_18<VAR_5; VAR_18++) { VAR_18 += VAR_4[VAR_18][VAR_18] * VAR_3[VAR_18]; VAR_18 += VAR_4[VAR_18][VAR_18+2048] * VAR_3[VAR_18]; } VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ]; VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ]; VAR_18 >>= 19; VAR_18 >>= 19; VAR_18= clip_yuvtab_40cf[VAR_18+ 256]; VAR_18= clip_yuvtab_1a1e[VAR_18+ 256] + yuvtab_0c92[VAR_18+ 256]; VAR_18= clip_yuvtab_3343[VAR_18+ 256]; ((uint16_t*)VAR_6)[2*VAR_18] = clip_table15b[(VAR_18 + VAR_18) >>13] | clip_table15g[(VAR_18 + VAR_18) >>13] | clip_table15r[(VAR_18 + VAR_18) >>13]; ((uint16_t*)VAR_6)[2*VAR_18+1] = clip_table15b[(VAR_18 + VAR_18) >>13] | clip_table15g[(VAR_18 + VAR_18) >>13] | clip_table15r[(VAR_18 + VAR_18) >>13]; } } }
[ "static inline void FUNC_0(int16_t *VAR_0, int16_t **VAR_1, int VAR_2,\nint16_t *VAR_3, int16_t **VAR_4, int VAR_5,\nuint8_t *VAR_6, int VAR_7, int VAR_8)\n{", "if(VAR_8==32)\n{", "int VAR_18;", "for(VAR_18=0; VAR_18<(VAR_7>>1); VAR_18++){", "int VAR_18;", "int VAR_18=0;", "int VAR_18=0;", "int VAR_18=0;", "int VAR_18=0;", "int VAR_18, VAR_18, VAR_18;", "for(VAR_18=0; VAR_18<VAR_2; VAR_18++)", "{", "VAR_18 += VAR_1[VAR_18][2*VAR_18] * VAR_0[VAR_18];", "VAR_18 += VAR_1[VAR_18][2*VAR_18+1] * VAR_0[VAR_18];", "}", "for(VAR_18=0; VAR_18<VAR_5; VAR_18++)", "{", "VAR_18 += VAR_4[VAR_18][VAR_18] * VAR_3[VAR_18];", "VAR_18 += VAR_4[VAR_18][VAR_18+2048] * VAR_3[VAR_18];", "}", "VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ];", "VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ];", "VAR_18 >>= 19;", "VAR_18 >>= 19;", "VAR_18= clip_yuvtab_40cf[VAR_18+ 256];", "VAR_18= clip_yuvtab_1a1e[VAR_18+ 256] + yuvtab_0c92[VAR_18+ 256];", "VAR_18= clip_yuvtab_3343[VAR_18+ 256];", "VAR_6[8*VAR_18+0]=clip_table[((VAR_18 + VAR_18) >>13)];", "VAR_6[8*VAR_18+1]=clip_table[((VAR_18 + VAR_18) >>13)];", "VAR_6[8*VAR_18+2]=clip_table[((VAR_18 + VAR_18) >>13)];", "VAR_6[8*VAR_18+4]=clip_table[((VAR_18 + VAR_18) >>13)];", "VAR_6[8*VAR_18+5]=clip_table[((VAR_18 + VAR_18) >>13)];", "VAR_6[8*VAR_18+6]=clip_table[((VAR_18 + VAR_18) >>13)];", "}", "}", "else if(VAR_8==24)\n{", "int VAR_18;", "for(VAR_18=0; VAR_18<(VAR_7>>1); VAR_18++){", "int VAR_18;", "int VAR_18=0;", "int VAR_18=0;", "int VAR_18=0;", "int VAR_18=0;", "int VAR_18, VAR_18, VAR_18;", "for(VAR_18=0; VAR_18<VAR_2; VAR_18++)", "{", "VAR_18 += VAR_1[VAR_18][2*VAR_18] * VAR_0[VAR_18];", "VAR_18 += VAR_1[VAR_18][2*VAR_18+1] * VAR_0[VAR_18];", "}", "for(VAR_18=0; VAR_18<VAR_5; VAR_18++)", "{", "VAR_18 += VAR_4[VAR_18][VAR_18] * VAR_3[VAR_18];", "VAR_18 += VAR_4[VAR_18][VAR_18+2048] * VAR_3[VAR_18];", "}", "VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ];", "VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ];", "VAR_18 >>= 19;", "VAR_18 >>= 19;", "VAR_18= clip_yuvtab_40cf[VAR_18+ 256];", "VAR_18= clip_yuvtab_1a1e[VAR_18+ 256] + yuvtab_0c92[VAR_18+ 256];", "VAR_18= clip_yuvtab_3343[VAR_18+ 256];", "VAR_6[0]=clip_table[((VAR_18 + VAR_18) >>13)];", "VAR_6[1]=clip_table[((VAR_18 + VAR_18) >>13)];", "VAR_6[2]=clip_table[((VAR_18 + VAR_18) >>13)];", "VAR_6[3]=clip_table[((VAR_18 + VAR_18) >>13)];", "VAR_6[4]=clip_table[((VAR_18 + VAR_18) >>13)];", "VAR_6[5]=clip_table[((VAR_18 + VAR_18) >>13)];", "VAR_6+=6;", "}", "}", "else if(VAR_8==16)\n{", "int VAR_18;", "for(VAR_18=0; VAR_18<(VAR_7>>1); VAR_18++){", "int VAR_18;", "int VAR_18=0;", "int VAR_18=0;", "int VAR_18=0;", "int VAR_18=0;", "int VAR_18, VAR_18, VAR_18;", "for(VAR_18=0; VAR_18<VAR_2; VAR_18++)", "{", "VAR_18 += VAR_1[VAR_18][2*VAR_18] * VAR_0[VAR_18];", "VAR_18 += VAR_1[VAR_18][2*VAR_18+1] * VAR_0[VAR_18];", "}", "for(VAR_18=0; VAR_18<VAR_5; VAR_18++)", "{", "VAR_18 += VAR_4[VAR_18][VAR_18] * VAR_3[VAR_18];", "VAR_18 += VAR_4[VAR_18][VAR_18+2048] * VAR_3[VAR_18];", "}", "VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ];", "VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ];", "VAR_18 >>= 19;", "VAR_18 >>= 19;", "VAR_18= clip_yuvtab_40cf[VAR_18+ 256];", "VAR_18= clip_yuvtab_1a1e[VAR_18+ 256] + yuvtab_0c92[VAR_18+ 256];", "VAR_18= clip_yuvtab_3343[VAR_18+ 256];", "((uint16_t*)VAR_6)[2*VAR_18] =\nclip_table16b[(VAR_18 + VAR_18) >>13] |\nclip_table16g[(VAR_18 + VAR_18) >>13] |\nclip_table16r[(VAR_18 + VAR_18) >>13];", "((uint16_t*)VAR_6)[2*VAR_18+1] =\nclip_table16b[(VAR_18 + VAR_18) >>13] |\nclip_table16g[(VAR_18 + VAR_18) >>13] |\nclip_table16r[(VAR_18 + VAR_18) >>13];", "}", "}", "else if(VAR_8==15)\n{", "int VAR_18;", "for(VAR_18=0; VAR_18<(VAR_7>>1); VAR_18++){", "int VAR_18;", "int VAR_18=0;", "int VAR_18=0;", "int VAR_18=0;", "int VAR_18=0;", "int VAR_18, VAR_18, VAR_18;", "for(VAR_18=0; VAR_18<VAR_2; VAR_18++)", "{", "VAR_18 += VAR_1[VAR_18][2*VAR_18] * VAR_0[VAR_18];", "VAR_18 += VAR_1[VAR_18][2*VAR_18+1] * VAR_0[VAR_18];", "}", "for(VAR_18=0; VAR_18<VAR_5; VAR_18++)", "{", "VAR_18 += VAR_4[VAR_18][VAR_18] * VAR_3[VAR_18];", "VAR_18 += VAR_4[VAR_18][VAR_18+2048] * VAR_3[VAR_18];", "}", "VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ];", "VAR_18= clip_yuvtab_2568[ (VAR_18>>19) + 256 ];", "VAR_18 >>= 19;", "VAR_18 >>= 19;", "VAR_18= clip_yuvtab_40cf[VAR_18+ 256];", "VAR_18= clip_yuvtab_1a1e[VAR_18+ 256] + yuvtab_0c92[VAR_18+ 256];", "VAR_18= clip_yuvtab_3343[VAR_18+ 256];", "((uint16_t*)VAR_6)[2*VAR_18] =\nclip_table15b[(VAR_18 + VAR_18) >>13] |\nclip_table15g[(VAR_18 + VAR_18) >>13] |\nclip_table15r[(VAR_18 + VAR_18) >>13];", "((uint16_t*)VAR_6)[2*VAR_18+1] =\nclip_table15b[(VAR_18 + VAR_18) >>13] |\nclip_table15g[(VAR_18 + VAR_18) >>13] |\nclip_table15r[(VAR_18 + VAR_18) >>13];", "}", "}", "}" ]
[ 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 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 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 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 ], [ 213 ], [ 215 ], [ 217 ], [ 221, 223, 225, 227 ], [ 231, 233, 235, 237 ], [ 239 ], [ 241 ], [ 243, 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 293 ], [ 295 ], [ 297 ], [ 301, 303, 305, 307 ], [ 311, 313, 315, 317 ], [ 319 ], [ 321 ], [ 323 ] ]
21,695
static int halfpel_interpol(SnowContext *s, uint8_t *halfpel[4][4], AVFrame *frame){ int p,x,y; for(p=0; p < s->nb_planes; p++){ int is_chroma= !!p; int w= is_chroma ? s->avctx->width >>s->chroma_h_shift : s->avctx->width; int h= is_chroma ? s->avctx->height>>s->chroma_v_shift : s->avctx->height; int ls= frame->linesize[p]; uint8_t *src= frame->data[p]; halfpel[1][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); halfpel[2][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); halfpel[3][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); if (!halfpel[1][p] || !halfpel[2][p] || !halfpel[3][p]) return AVERROR(ENOMEM); halfpel[0][p]= src; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int i= y*ls + x; halfpel[1][p][i]= (20*(src[i] + src[i+1]) - 5*(src[i-1] + src[i+2]) + (src[i-2] + src[i+3]) + 16 )>>5; } } for(y=0; y<h; y++){ for(x=0; x<w; x++){ int i= y*ls + x; halfpel[2][p][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5; } } src= halfpel[1][p]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int i= y*ls + x; halfpel[3][p][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5; } } //FIXME border! } return 0; }
true
FFmpeg
56c7e1059ab993da68caa3847372f3fb5e010dc4
static int halfpel_interpol(SnowContext *s, uint8_t *halfpel[4][4], AVFrame *frame){ int p,x,y; for(p=0; p < s->nb_planes; p++){ int is_chroma= !!p; int w= is_chroma ? s->avctx->width >>s->chroma_h_shift : s->avctx->width; int h= is_chroma ? s->avctx->height>>s->chroma_v_shift : s->avctx->height; int ls= frame->linesize[p]; uint8_t *src= frame->data[p]; halfpel[1][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); halfpel[2][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); halfpel[3][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); if (!halfpel[1][p] || !halfpel[2][p] || !halfpel[3][p]) return AVERROR(ENOMEM); halfpel[0][p]= src; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int i= y*ls + x; halfpel[1][p][i]= (20*(src[i] + src[i+1]) - 5*(src[i-1] + src[i+2]) + (src[i-2] + src[i+3]) + 16 )>>5; } } for(y=0; y<h; y++){ for(x=0; x<w; x++){ int i= y*ls + x; halfpel[2][p][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5; } } src= halfpel[1][p]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int i= y*ls + x; halfpel[3][p][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5; } } } return 0; }
{ "code": [ " halfpel[1][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls);", " halfpel[2][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls);", " halfpel[3][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls);", " if (!halfpel[1][p] || !halfpel[2][p] || !halfpel[3][p])" ], "line_no": [ 21, 23, 25, 27 ] }
static int FUNC_0(SnowContext *VAR_0, uint8_t *VAR_1[4][4], AVFrame *VAR_2){ int VAR_3,VAR_4,VAR_5; for(VAR_3=0; VAR_3 < VAR_0->nb_planes; VAR_3++){ int is_chroma= !!VAR_3; int w= is_chroma ? VAR_0->avctx->width >>VAR_0->chroma_h_shift : VAR_0->avctx->width; int h= is_chroma ? VAR_0->avctx->height>>VAR_0->chroma_v_shift : VAR_0->avctx->height; int ls= VAR_2->linesize[VAR_3]; uint8_t *src= VAR_2->data[VAR_3]; VAR_1[1][VAR_3] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); VAR_1[2][VAR_3] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); VAR_1[3][VAR_3] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); if (!VAR_1[1][VAR_3] || !VAR_1[2][VAR_3] || !VAR_1[3][VAR_3]) return AVERROR(ENOMEM); VAR_1[0][VAR_3]= src; for(VAR_5=0; VAR_5<h; VAR_5++){ for(VAR_4=0; VAR_4<w; VAR_4++){ int i= VAR_5*ls + VAR_4; VAR_1[1][VAR_3][i]= (20*(src[i] + src[i+1]) - 5*(src[i-1] + src[i+2]) + (src[i-2] + src[i+3]) + 16 )>>5; } } for(VAR_5=0; VAR_5<h; VAR_5++){ for(VAR_4=0; VAR_4<w; VAR_4++){ int i= VAR_5*ls + VAR_4; VAR_1[2][VAR_3][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5; } } src= VAR_1[1][VAR_3]; for(VAR_5=0; VAR_5<h; VAR_5++){ for(VAR_4=0; VAR_4<w; VAR_4++){ int i= VAR_5*ls + VAR_4; VAR_1[3][VAR_3][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5; } } } return 0; }
[ "static int FUNC_0(SnowContext *VAR_0, uint8_t *VAR_1[4][4], AVFrame *VAR_2){", "int VAR_3,VAR_4,VAR_5;", "for(VAR_3=0; VAR_3 < VAR_0->nb_planes; VAR_3++){", "int is_chroma= !!VAR_3;", "int w= is_chroma ? VAR_0->avctx->width >>VAR_0->chroma_h_shift : VAR_0->avctx->width;", "int h= is_chroma ? VAR_0->avctx->height>>VAR_0->chroma_v_shift : VAR_0->avctx->height;", "int ls= VAR_2->linesize[VAR_3];", "uint8_t *src= VAR_2->data[VAR_3];", "VAR_1[1][VAR_3] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls);", "VAR_1[2][VAR_3] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls);", "VAR_1[3][VAR_3] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls);", "if (!VAR_1[1][VAR_3] || !VAR_1[2][VAR_3] || !VAR_1[3][VAR_3])\nreturn AVERROR(ENOMEM);", "VAR_1[0][VAR_3]= src;", "for(VAR_5=0; VAR_5<h; VAR_5++){", "for(VAR_4=0; VAR_4<w; VAR_4++){", "int i= VAR_5*ls + VAR_4;", "VAR_1[1][VAR_3][i]= (20*(src[i] + src[i+1]) - 5*(src[i-1] + src[i+2]) + (src[i-2] + src[i+3]) + 16 )>>5;", "}", "}", "for(VAR_5=0; VAR_5<h; VAR_5++){", "for(VAR_4=0; VAR_4<w; VAR_4++){", "int i= VAR_5*ls + VAR_4;", "VAR_1[2][VAR_3][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5;", "}", "}", "src= VAR_1[1][VAR_3];", "for(VAR_5=0; VAR_5<h; VAR_5++){", "for(VAR_4=0; VAR_4<w; VAR_4++){", "int i= VAR_5*ls + VAR_4;", "VAR_1[3][VAR_3][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5;", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 83 ], [ 85 ], [ 87 ] ]
21,696
static void *qpa_thread_in (void *arg) { PAVoiceIn *pa = arg; HWVoiceIn *hw = &pa->hw; if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { return NULL; } for (;;) { int incr, to_grab, wpos; for (;;) { if (pa->done) { goto exit; } if (pa->dead > 0) { break; } if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) { goto exit; } } incr = to_grab = audio_MIN (pa->dead, conf.samples >> 2); wpos = pa->wpos; if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) { return NULL; } while (to_grab) { int error; int chunk = audio_MIN (to_grab, hw->samples - wpos); void *buf = advance (pa->pcm_buf, wpos); if (pa_simple_read (pa->s, buf, chunk << hw->info.shift, &error) < 0) { qpa_logerr (error, "pa_simple_read failed\n"); return NULL; } hw->conv (hw->conv_buf + wpos, buf, chunk); wpos = (wpos + chunk) % hw->samples; to_grab -= chunk; } if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { return NULL; } pa->wpos = wpos; pa->dead -= incr; pa->incr += incr; } exit: audio_pt_unlock (&pa->pt, AUDIO_FUNC); return NULL; }
true
qemu
ea9ebc2ce69198f7aca4b43652824c5d621ac978
static void *qpa_thread_in (void *arg) { PAVoiceIn *pa = arg; HWVoiceIn *hw = &pa->hw; if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { return NULL; } for (;;) { int incr, to_grab, wpos; for (;;) { if (pa->done) { goto exit; } if (pa->dead > 0) { break; } if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) { goto exit; } } incr = to_grab = audio_MIN (pa->dead, conf.samples >> 2); wpos = pa->wpos; if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) { return NULL; } while (to_grab) { int error; int chunk = audio_MIN (to_grab, hw->samples - wpos); void *buf = advance (pa->pcm_buf, wpos); if (pa_simple_read (pa->s, buf, chunk << hw->info.shift, &error) < 0) { qpa_logerr (error, "pa_simple_read failed\n"); return NULL; } hw->conv (hw->conv_buf + wpos, buf, chunk); wpos = (wpos + chunk) % hw->samples; to_grab -= chunk; } if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { return NULL; } pa->wpos = wpos; pa->dead -= incr; pa->incr += incr; } exit: audio_pt_unlock (&pa->pt, AUDIO_FUNC); return NULL; }
{ "code": [ " incr = to_grab = audio_MIN (pa->dead, conf.samples >> 2);", " if (pa_simple_read (pa->s, buf,", " chunk << hw->info.shift, &error) < 0) {" ], "line_no": [ 53, 77, 79 ] }
static void *FUNC_0 (void *VAR_0) { PAVoiceIn *pa = VAR_0; HWVoiceIn *hw = &pa->hw; if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { return NULL; } for (;;) { int VAR_1, VAR_2, VAR_3; for (;;) { if (pa->done) { goto exit; } if (pa->dead > 0) { break; } if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) { goto exit; } } VAR_1 = VAR_2 = audio_MIN (pa->dead, conf.samples >> 2); VAR_3 = pa->VAR_3; if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) { return NULL; } while (VAR_2) { int VAR_4; int VAR_5 = audio_MIN (VAR_2, hw->samples - VAR_3); void *VAR_6 = advance (pa->pcm_buf, VAR_3); if (pa_simple_read (pa->s, VAR_6, VAR_5 << hw->info.shift, &VAR_4) < 0) { qpa_logerr (VAR_4, "pa_simple_read failed\n"); return NULL; } hw->conv (hw->conv_buf + VAR_3, VAR_6, VAR_5); VAR_3 = (VAR_3 + VAR_5) % hw->samples; VAR_2 -= VAR_5; } if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) { return NULL; } pa->VAR_3 = VAR_3; pa->dead -= VAR_1; pa->VAR_1 += VAR_1; } exit: audio_pt_unlock (&pa->pt, AUDIO_FUNC); return NULL; }
[ "static void *FUNC_0 (void *VAR_0)\n{", "PAVoiceIn *pa = VAR_0;", "HWVoiceIn *hw = &pa->hw;", "if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) {", "return NULL;", "}", "for (;;) {", "int VAR_1, VAR_2, VAR_3;", "for (;;) {", "if (pa->done) {", "goto exit;", "}", "if (pa->dead > 0) {", "break;", "}", "if (audio_pt_wait (&pa->pt, AUDIO_FUNC)) {", "goto exit;", "}", "}", "VAR_1 = VAR_2 = audio_MIN (pa->dead, conf.samples >> 2);", "VAR_3 = pa->VAR_3;", "if (audio_pt_unlock (&pa->pt, AUDIO_FUNC)) {", "return NULL;", "}", "while (VAR_2) {", "int VAR_4;", "int VAR_5 = audio_MIN (VAR_2, hw->samples - VAR_3);", "void *VAR_6 = advance (pa->pcm_buf, VAR_3);", "if (pa_simple_read (pa->s, VAR_6,\nVAR_5 << hw->info.shift, &VAR_4) < 0) {", "qpa_logerr (VAR_4, \"pa_simple_read failed\\n\");", "return NULL;", "}", "hw->conv (hw->conv_buf + VAR_3, VAR_6, VAR_5);", "VAR_3 = (VAR_3 + VAR_5) % hw->samples;", "VAR_2 -= VAR_5;", "}", "if (audio_pt_lock (&pa->pt, AUDIO_FUNC)) {", "return NULL;", "}", "pa->VAR_3 = VAR_3;", "pa->dead -= VAR_1;", "pa->VAR_1 += VAR_1;", "}", "exit:\naudio_pt_unlock (&pa->pt, AUDIO_FUNC);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 121 ], [ 123 ] ]
21,697
void ff_h261_encode_init(MpegEncContext *s){ static int done = 0; if (!done) { done = 1; init_rl(&h261_rl_tcoeff); } s->min_qcoeff= -127; s->max_qcoeff= 127; s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; }
true
FFmpeg
073c2593c9f0aa4445a6fc1b9b24e6e52a8cc2c1
void ff_h261_encode_init(MpegEncContext *s){ static int done = 0; if (!done) { done = 1; init_rl(&h261_rl_tcoeff); } s->min_qcoeff= -127; s->max_qcoeff= 127; s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; }
{ "code": [ " static int done = 0;", " if (!done) {", " done = 1;", " init_rl(&h261_rl_tcoeff);", " init_rl(&h261_rl_tcoeff);" ], "line_no": [ 3, 7, 9, 11, 11 ] }
void FUNC_0(MpegEncContext *VAR_0){ static int VAR_1 = 0; if (!VAR_1) { VAR_1 = 1; init_rl(&h261_rl_tcoeff); } VAR_0->min_qcoeff= -127; VAR_0->max_qcoeff= 127; VAR_0->y_dc_scale_table= VAR_0->c_dc_scale_table= ff_mpeg1_dc_scale_table; }
[ "void FUNC_0(MpegEncContext *VAR_0){", "static int VAR_1 = 0;", "if (!VAR_1) {", "VAR_1 = 1;", "init_rl(&h261_rl_tcoeff);", "}", "VAR_0->min_qcoeff= -127;", "VAR_0->max_qcoeff= 127;", "VAR_0->y_dc_scale_table=\nVAR_0->c_dc_scale_table= ff_mpeg1_dc_scale_table;", "}" ]
[ 0, 1, 1, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ] ]
21,698
static int mmu_translate_region(CPUS390XState *env, target_ulong vaddr, uint64_t asc, uint64_t entry, int level, target_ulong *raddr, int *flags, int rw, bool exc) { CPUState *cs = CPU(s390_env_get_cpu(env)); uint64_t origin, offs, new_entry; const int pchks[4] = { PGM_SEGMENT_TRANS, PGM_REG_THIRD_TRANS, PGM_REG_SEC_TRANS, PGM_REG_FIRST_TRANS }; PTE_DPRINTF("%s: 0x%" PRIx64 "\n", __func__, entry); origin = entry & _REGION_ENTRY_ORIGIN; offs = (vaddr >> (17 + 11 * level / 4)) & 0x3ff8; new_entry = ldq_phys(cs->as, origin + offs); PTE_DPRINTF("%s: 0x%" PRIx64 " + 0x%" PRIx64 " => 0x%016" PRIx64 "\n", __func__, origin, offs, new_entry); if ((new_entry & _REGION_ENTRY_INV) != 0) { /* XXX different regions have different faults */ DPRINTF("%s: invalid region\n", __func__); trigger_page_fault(env, vaddr, PGM_SEGMENT_TRANS, asc, rw, exc); return -1; } if ((new_entry & _REGION_ENTRY_TYPE_MASK) != level) { trigger_page_fault(env, vaddr, PGM_TRANS_SPEC, asc, rw, exc); return -1; } /* XXX region protection flags */ /* *flags &= ~PAGE_WRITE */ if (level == _ASCE_TYPE_SEGMENT) { return mmu_translate_segment(env, vaddr, asc, new_entry, raddr, flags, rw, exc); } /* Check region table offset and length */ offs = (vaddr >> (28 + 11 * (level - 4) / 4)) & 3; if (offs < ((new_entry & _REGION_ENTRY_TF) >> 6) || offs > (new_entry & _REGION_ENTRY_LENGTH)) { DPRINTF("%s: invalid offset or len (%lx)\n", __func__, new_entry); trigger_page_fault(env, vaddr, pchks[level / 4 - 1], asc, rw, exc); return -1; } /* yet another region */ return mmu_translate_region(env, vaddr, asc, new_entry, level - 4, raddr, flags, rw, exc); }
true
qemu
5a123b3c1a1d3540d4455772c42c466870d81061
static int mmu_translate_region(CPUS390XState *env, target_ulong vaddr, uint64_t asc, uint64_t entry, int level, target_ulong *raddr, int *flags, int rw, bool exc) { CPUState *cs = CPU(s390_env_get_cpu(env)); uint64_t origin, offs, new_entry; const int pchks[4] = { PGM_SEGMENT_TRANS, PGM_REG_THIRD_TRANS, PGM_REG_SEC_TRANS, PGM_REG_FIRST_TRANS }; PTE_DPRINTF("%s: 0x%" PRIx64 "\n", __func__, entry); origin = entry & _REGION_ENTRY_ORIGIN; offs = (vaddr >> (17 + 11 * level / 4)) & 0x3ff8; new_entry = ldq_phys(cs->as, origin + offs); PTE_DPRINTF("%s: 0x%" PRIx64 " + 0x%" PRIx64 " => 0x%016" PRIx64 "\n", __func__, origin, offs, new_entry); if ((new_entry & _REGION_ENTRY_INV) != 0) { DPRINTF("%s: invalid region\n", __func__); trigger_page_fault(env, vaddr, PGM_SEGMENT_TRANS, asc, rw, exc); return -1; } if ((new_entry & _REGION_ENTRY_TYPE_MASK) != level) { trigger_page_fault(env, vaddr, PGM_TRANS_SPEC, asc, rw, exc); return -1; } if (level == _ASCE_TYPE_SEGMENT) { return mmu_translate_segment(env, vaddr, asc, new_entry, raddr, flags, rw, exc); } offs = (vaddr >> (28 + 11 * (level - 4) / 4)) & 3; if (offs < ((new_entry & _REGION_ENTRY_TF) >> 6) || offs > (new_entry & _REGION_ENTRY_LENGTH)) { DPRINTF("%s: invalid offset or len (%lx)\n", __func__, new_entry); trigger_page_fault(env, vaddr, pchks[level / 4 - 1], asc, rw, exc); return -1; } return mmu_translate_region(env, vaddr, asc, new_entry, level - 4, raddr, flags, rw, exc); }
{ "code": [ " trigger_page_fault(env, vaddr, PGM_SEGMENT_TRANS, asc, rw, exc);" ], "line_no": [ 49 ] }
static int FUNC_0(CPUS390XState *VAR_0, target_ulong VAR_1, uint64_t VAR_2, uint64_t VAR_3, int VAR_4, target_ulong *VAR_5, int *VAR_6, int VAR_7, bool VAR_8) { CPUState *cs = CPU(s390_env_get_cpu(VAR_0)); uint64_t origin, offs, new_entry; const int VAR_9[4] = { PGM_SEGMENT_TRANS, PGM_REG_THIRD_TRANS, PGM_REG_SEC_TRANS, PGM_REG_FIRST_TRANS }; PTE_DPRINTF("%s: 0x%" PRIx64 "\n", __func__, VAR_3); origin = VAR_3 & _REGION_ENTRY_ORIGIN; offs = (VAR_1 >> (17 + 11 * VAR_4 / 4)) & 0x3ff8; new_entry = ldq_phys(cs->as, origin + offs); PTE_DPRINTF("%s: 0x%" PRIx64 " + 0x%" PRIx64 " => 0x%016" PRIx64 "\n", __func__, origin, offs, new_entry); if ((new_entry & _REGION_ENTRY_INV) != 0) { DPRINTF("%s: invalid region\n", __func__); trigger_page_fault(VAR_0, VAR_1, PGM_SEGMENT_TRANS, VAR_2, VAR_7, VAR_8); return -1; } if ((new_entry & _REGION_ENTRY_TYPE_MASK) != VAR_4) { trigger_page_fault(VAR_0, VAR_1, PGM_TRANS_SPEC, VAR_2, VAR_7, VAR_8); return -1; } if (VAR_4 == _ASCE_TYPE_SEGMENT) { return mmu_translate_segment(VAR_0, VAR_1, VAR_2, new_entry, VAR_5, VAR_6, VAR_7, VAR_8); } offs = (VAR_1 >> (28 + 11 * (VAR_4 - 4) / 4)) & 3; if (offs < ((new_entry & _REGION_ENTRY_TF) >> 6) || offs > (new_entry & _REGION_ENTRY_LENGTH)) { DPRINTF("%s: invalid offset or len (%lx)\n", __func__, new_entry); trigger_page_fault(VAR_0, VAR_1, VAR_9[VAR_4 / 4 - 1], VAR_2, VAR_7, VAR_8); return -1; } return FUNC_0(VAR_0, VAR_1, VAR_2, new_entry, VAR_4 - 4, VAR_5, VAR_6, VAR_7, VAR_8); }
[ "static int FUNC_0(CPUS390XState *VAR_0, target_ulong VAR_1,\nuint64_t VAR_2, uint64_t VAR_3, int VAR_4,\ntarget_ulong *VAR_5, int *VAR_6, int VAR_7,\nbool VAR_8)\n{", "CPUState *cs = CPU(s390_env_get_cpu(VAR_0));", "uint64_t origin, offs, new_entry;", "const int VAR_9[4] = {", "PGM_SEGMENT_TRANS, PGM_REG_THIRD_TRANS,\nPGM_REG_SEC_TRANS, PGM_REG_FIRST_TRANS\n};", "PTE_DPRINTF(\"%s: 0x%\" PRIx64 \"\\n\", __func__, VAR_3);", "origin = VAR_3 & _REGION_ENTRY_ORIGIN;", "offs = (VAR_1 >> (17 + 11 * VAR_4 / 4)) & 0x3ff8;", "new_entry = ldq_phys(cs->as, origin + offs);", "PTE_DPRINTF(\"%s: 0x%\" PRIx64 \" + 0x%\" PRIx64 \" => 0x%016\" PRIx64 \"\\n\",\n__func__, origin, offs, new_entry);", "if ((new_entry & _REGION_ENTRY_INV) != 0) {", "DPRINTF(\"%s: invalid region\\n\", __func__);", "trigger_page_fault(VAR_0, VAR_1, PGM_SEGMENT_TRANS, VAR_2, VAR_7, VAR_8);", "return -1;", "}", "if ((new_entry & _REGION_ENTRY_TYPE_MASK) != VAR_4) {", "trigger_page_fault(VAR_0, VAR_1, PGM_TRANS_SPEC, VAR_2, VAR_7, VAR_8);", "return -1;", "}", "if (VAR_4 == _ASCE_TYPE_SEGMENT) {", "return mmu_translate_segment(VAR_0, VAR_1, VAR_2, new_entry, VAR_5, VAR_6,\nVAR_7, VAR_8);", "}", "offs = (VAR_1 >> (28 + 11 * (VAR_4 - 4) / 4)) & 3;", "if (offs < ((new_entry & _REGION_ENTRY_TF) >> 6)\n|| offs > (new_entry & _REGION_ENTRY_LENGTH)) {", "DPRINTF(\"%s: invalid offset or len (%lx)\\n\", __func__, new_entry);", "trigger_page_fault(VAR_0, VAR_1, VAR_9[VAR_4 / 4 - 1], VAR_2, VAR_7, VAR_8);", "return -1;", "}", "return FUNC_0(VAR_0, VAR_1, VAR_2, new_entry, VAR_4 - 4,\nVAR_5, VAR_6, VAR_7, VAR_8);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19, 21 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37, 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 103, 105 ], [ 107 ] ]
21,699
static int pcx_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data) { PCXContext *s = avctx->priv_data; AVFrame *const pict = &s->picture; const uint8_t *buf_start = buf; const uint8_t *buf_end = buf + buf_size; int bpp, nplanes, i, y, line_bytes, written; const uint32_t *pal = NULL; const uint8_t *src; *pict = *(AVFrame *)data; pict->pict_type = AV_PICTURE_TYPE_I; pict->key_frame = 1; if (avctx->width > 65535 || avctx->height > 65535) { av_log(avctx, AV_LOG_ERROR, "image dimensions do not fit in 16 bits\n"); return -1; } switch (avctx->pix_fmt) { case PIX_FMT_RGB24: bpp = 8; nplanes = 3; break; case PIX_FMT_RGB8: case PIX_FMT_BGR8: case PIX_FMT_RGB4_BYTE: case PIX_FMT_BGR4_BYTE: case PIX_FMT_GRAY8: bpp = 8; nplanes = 1; ff_set_systematic_pal2(palette256, avctx->pix_fmt); pal = palette256; break; case PIX_FMT_PAL8: bpp = 8; nplanes = 1; pal = (uint32_t *)pict->data[1]; break; case PIX_FMT_MONOBLACK: bpp = 1; nplanes = 1; pal = monoblack_pal; break; default: av_log(avctx, AV_LOG_ERROR, "unsupported pixfmt\n"); return -1; } line_bytes = (avctx->width * bpp + 7) >> 3; line_bytes = (line_bytes + 1) & ~1; bytestream_put_byte(&buf, 10); // manufacturer bytestream_put_byte(&buf, 5); // version bytestream_put_byte(&buf, 1); // encoding bytestream_put_byte(&buf, bpp); // bits per pixel per plane bytestream_put_le16(&buf, 0); // x min bytestream_put_le16(&buf, 0); // y min bytestream_put_le16(&buf, avctx->width - 1); // x max bytestream_put_le16(&buf, avctx->height - 1); // y max bytestream_put_le16(&buf, 0); // horizontal DPI bytestream_put_le16(&buf, 0); // vertical DPI for (i = 0; i < 16; i++) bytestream_put_be24(&buf, pal ? pal[i] : 0);// palette (<= 16 color only) bytestream_put_byte(&buf, 0); // reserved bytestream_put_byte(&buf, nplanes); // number of planes bytestream_put_le16(&buf, line_bytes); // scanline plane size in bytes while (buf - buf_start < 128) *buf++= 0; src = pict->data[0]; for (y = 0; y < avctx->height; y++) { if ((written = pcx_rle_encode(buf, buf_end - buf, src, line_bytes, nplanes)) < 0) { av_log(avctx, AV_LOG_ERROR, "buffer too small\n"); return -1; } buf += written; src += pict->linesize[0]; } if (nplanes == 1 && bpp == 8) { if (buf_end - buf < 257) { av_log(avctx, AV_LOG_ERROR, "buffer too small\n"); return -1; } bytestream_put_byte(&buf, 12); for (i = 0; i < 256; i++) { bytestream_put_be24(&buf, pal[i]); } } return buf - buf_start; }
true
FFmpeg
ad1c50255735c20bd86572d3e8b3c88a5ca6c8f1
static int pcx_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data) { PCXContext *s = avctx->priv_data; AVFrame *const pict = &s->picture; const uint8_t *buf_start = buf; const uint8_t *buf_end = buf + buf_size; int bpp, nplanes, i, y, line_bytes, written; const uint32_t *pal = NULL; const uint8_t *src; *pict = *(AVFrame *)data; pict->pict_type = AV_PICTURE_TYPE_I; pict->key_frame = 1; if (avctx->width > 65535 || avctx->height > 65535) { av_log(avctx, AV_LOG_ERROR, "image dimensions do not fit in 16 bits\n"); return -1; } switch (avctx->pix_fmt) { case PIX_FMT_RGB24: bpp = 8; nplanes = 3; break; case PIX_FMT_RGB8: case PIX_FMT_BGR8: case PIX_FMT_RGB4_BYTE: case PIX_FMT_BGR4_BYTE: case PIX_FMT_GRAY8: bpp = 8; nplanes = 1; ff_set_systematic_pal2(palette256, avctx->pix_fmt); pal = palette256; break; case PIX_FMT_PAL8: bpp = 8; nplanes = 1; pal = (uint32_t *)pict->data[1]; break; case PIX_FMT_MONOBLACK: bpp = 1; nplanes = 1; pal = monoblack_pal; break; default: av_log(avctx, AV_LOG_ERROR, "unsupported pixfmt\n"); return -1; } line_bytes = (avctx->width * bpp + 7) >> 3; line_bytes = (line_bytes + 1) & ~1; bytestream_put_byte(&buf, 10); bytestream_put_byte(&buf, 5); bytestream_put_byte(&buf, 1); bytestream_put_byte(&buf, bpp); bytestream_put_le16(&buf, 0); bytestream_put_le16(&buf, 0); bytestream_put_le16(&buf, avctx->width - 1); bytestream_put_le16(&buf, avctx->height - 1); bytestream_put_le16(&buf, 0); bytestream_put_le16(&buf, 0); for (i = 0; i < 16; i++) bytestream_put_be24(&buf, pal ? pal[i] : 0); bytestream_put_byte(&buf, 0); bytestream_put_byte(&buf, nplanes); bytestream_put_le16(&buf, line_bytes); while (buf - buf_start < 128) *buf++= 0; src = pict->data[0]; for (y = 0; y < avctx->height; y++) { if ((written = pcx_rle_encode(buf, buf_end - buf, src, line_bytes, nplanes)) < 0) { av_log(avctx, AV_LOG_ERROR, "buffer too small\n"); return -1; } buf += written; src += pict->linesize[0]; } if (nplanes == 1 && bpp == 8) { if (buf_end - buf < 257) { av_log(avctx, AV_LOG_ERROR, "buffer too small\n"); return -1; } bytestream_put_byte(&buf, 12); for (i = 0; i < 256; i++) { bytestream_put_be24(&buf, pal[i]); } } return buf - buf_start; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1, int VAR_2, void *VAR_3) { PCXContext *s = VAR_0->priv_data; AVFrame *const pict = &s->picture; const uint8_t *VAR_4 = VAR_1; const uint8_t *VAR_5 = VAR_1 + VAR_2; int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; const uint32_t *VAR_12 = NULL; const uint8_t *VAR_13; *pict = *(AVFrame *)VAR_3; pict->pict_type = AV_PICTURE_TYPE_I; pict->key_frame = 1; if (VAR_0->width > 65535 || VAR_0->height > 65535) { av_log(VAR_0, AV_LOG_ERROR, "image dimensions do not fit in 16 bits\n"); return -1; } switch (VAR_0->pix_fmt) { case PIX_FMT_RGB24: VAR_6 = 8; VAR_7 = 3; break; case PIX_FMT_RGB8: case PIX_FMT_BGR8: case PIX_FMT_RGB4_BYTE: case PIX_FMT_BGR4_BYTE: case PIX_FMT_GRAY8: VAR_6 = 8; VAR_7 = 1; ff_set_systematic_pal2(palette256, VAR_0->pix_fmt); VAR_12 = palette256; break; case PIX_FMT_PAL8: VAR_6 = 8; VAR_7 = 1; VAR_12 = (uint32_t *)pict->VAR_3[1]; break; case PIX_FMT_MONOBLACK: VAR_6 = 1; VAR_7 = 1; VAR_12 = monoblack_pal; break; default: av_log(VAR_0, AV_LOG_ERROR, "unsupported pixfmt\n"); return -1; } VAR_10 = (VAR_0->width * VAR_6 + 7) >> 3; VAR_10 = (VAR_10 + 1) & ~1; bytestream_put_byte(&VAR_1, 10); bytestream_put_byte(&VAR_1, 5); bytestream_put_byte(&VAR_1, 1); bytestream_put_byte(&VAR_1, VAR_6); bytestream_put_le16(&VAR_1, 0); bytestream_put_le16(&VAR_1, 0); bytestream_put_le16(&VAR_1, VAR_0->width - 1); bytestream_put_le16(&VAR_1, VAR_0->height - 1); bytestream_put_le16(&VAR_1, 0); bytestream_put_le16(&VAR_1, 0); for (VAR_8 = 0; VAR_8 < 16; VAR_8++) bytestream_put_be24(&VAR_1, VAR_12 ? VAR_12[VAR_8] : 0); bytestream_put_byte(&VAR_1, 0); bytestream_put_byte(&VAR_1, VAR_7); bytestream_put_le16(&VAR_1, VAR_10); while (VAR_1 - VAR_4 < 128) *VAR_1++= 0; VAR_13 = pict->VAR_3[0]; for (VAR_9 = 0; VAR_9 < VAR_0->height; VAR_9++) { if ((VAR_11 = pcx_rle_encode(VAR_1, VAR_5 - VAR_1, VAR_13, VAR_10, VAR_7)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "buffer too small\n"); return -1; } VAR_1 += VAR_11; VAR_13 += pict->linesize[0]; } if (VAR_7 == 1 && VAR_6 == 8) { if (VAR_5 - VAR_1 < 257) { av_log(VAR_0, AV_LOG_ERROR, "buffer too small\n"); return -1; } bytestream_put_byte(&VAR_1, 12); for (VAR_8 = 0; VAR_8 < 256; VAR_8++) { bytestream_put_be24(&VAR_1, VAR_12[VAR_8]); } } return VAR_1 - VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nunsigned char *VAR_1, int VAR_2, void *VAR_3)\n{", "PCXContext *s = VAR_0->priv_data;", "AVFrame *const pict = &s->picture;", "const uint8_t *VAR_4 = VAR_1;", "const uint8_t *VAR_5 = VAR_1 + VAR_2;", "int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;", "const uint32_t *VAR_12 = NULL;", "const uint8_t *VAR_13;", "*pict = *(AVFrame *)VAR_3;", "pict->pict_type = AV_PICTURE_TYPE_I;", "pict->key_frame = 1;", "if (VAR_0->width > 65535 || VAR_0->height > 65535) {", "av_log(VAR_0, AV_LOG_ERROR, \"image dimensions do not fit in 16 bits\\n\");", "return -1;", "}", "switch (VAR_0->pix_fmt) {", "case PIX_FMT_RGB24:\nVAR_6 = 8;", "VAR_7 = 3;", "break;", "case PIX_FMT_RGB8:\ncase PIX_FMT_BGR8:\ncase PIX_FMT_RGB4_BYTE:\ncase PIX_FMT_BGR4_BYTE:\ncase PIX_FMT_GRAY8:\nVAR_6 = 8;", "VAR_7 = 1;", "ff_set_systematic_pal2(palette256, VAR_0->pix_fmt);", "VAR_12 = palette256;", "break;", "case PIX_FMT_PAL8:\nVAR_6 = 8;", "VAR_7 = 1;", "VAR_12 = (uint32_t *)pict->VAR_3[1];", "break;", "case PIX_FMT_MONOBLACK:\nVAR_6 = 1;", "VAR_7 = 1;", "VAR_12 = monoblack_pal;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"unsupported pixfmt\\n\");", "return -1;", "}", "VAR_10 = (VAR_0->width * VAR_6 + 7) >> 3;", "VAR_10 = (VAR_10 + 1) & ~1;", "bytestream_put_byte(&VAR_1, 10);", "bytestream_put_byte(&VAR_1, 5);", "bytestream_put_byte(&VAR_1, 1);", "bytestream_put_byte(&VAR_1, VAR_6);", "bytestream_put_le16(&VAR_1, 0);", "bytestream_put_le16(&VAR_1, 0);", "bytestream_put_le16(&VAR_1, VAR_0->width - 1);", "bytestream_put_le16(&VAR_1, VAR_0->height - 1);", "bytestream_put_le16(&VAR_1, 0);", "bytestream_put_le16(&VAR_1, 0);", "for (VAR_8 = 0; VAR_8 < 16; VAR_8++)", "bytestream_put_be24(&VAR_1, VAR_12 ? VAR_12[VAR_8] : 0);", "bytestream_put_byte(&VAR_1, 0);", "bytestream_put_byte(&VAR_1, VAR_7);", "bytestream_put_le16(&VAR_1, VAR_10);", "while (VAR_1 - VAR_4 < 128)\n*VAR_1++= 0;", "VAR_13 = pict->VAR_3[0];", "for (VAR_9 = 0; VAR_9 < VAR_0->height; VAR_9++) {", "if ((VAR_11 = pcx_rle_encode(VAR_1, VAR_5 - VAR_1,\nVAR_13, VAR_10, VAR_7)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"buffer too small\\n\");", "return -1;", "}", "VAR_1 += VAR_11;", "VAR_13 += pict->linesize[0];", "}", "if (VAR_7 == 1 && VAR_6 == 8) {", "if (VAR_5 - VAR_1 < 257) {", "av_log(VAR_0, AV_LOG_ERROR, \"buffer too small\\n\");", "return -1;", "}", "bytestream_put_byte(&VAR_1, 12);", "for (VAR_8 = 0; VAR_8 < 256; VAR_8++) {", "bytestream_put_be24(&VAR_1, VAR_12[VAR_8]);", "}", "}", "return VAR_1 - 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 22 ], [ 26 ], [ 28 ], [ 30 ], [ 34 ], [ 36 ], [ 38 ], [ 40 ], [ 44 ], [ 46, 48 ], [ 50 ], [ 52 ], [ 54, 56, 58, 60, 62, 64 ], [ 66 ], [ 68 ], [ 70 ], [ 72 ], [ 74, 76 ], [ 78 ], [ 80 ], [ 82 ], [ 84, 86 ], [ 88 ], [ 90 ], [ 92 ], [ 94, 96 ], [ 98 ], [ 100 ], [ 104 ], [ 106 ], [ 110 ], [ 112 ], [ 114 ], [ 116 ], [ 118 ], [ 120 ], [ 122 ], [ 124 ], [ 126 ], [ 128 ], [ 130 ], [ 132 ], [ 134 ], [ 136 ], [ 138 ], [ 142, 144 ], [ 148 ], [ 152 ], [ 154, 156 ], [ 158 ], [ 160 ], [ 162 ], [ 164 ], [ 166 ], [ 168 ], [ 172 ], [ 174 ], [ 176 ], [ 178 ], [ 180 ], [ 182 ], [ 184 ], [ 186 ], [ 188 ], [ 190 ], [ 194 ], [ 196 ] ]
21,700
static void GCC_FMT_ATTR(2, 3) qtest_send(CharDriverState *chr, const char *fmt, ...) { va_list ap; char buffer[1024]; size_t len; va_start(ap, fmt); len = vsnprintf(buffer, sizeof(buffer), fmt, ap); va_end(ap); qemu_chr_fe_write_all(chr, (uint8_t *)buffer, len); if (qtest_log_fp && qtest_opened) { fprintf(qtest_log_fp, "%s", buffer); } }
true
qemu
332cc7e9b39ddb2feacb4c71dcd18c3e5b0c3147
static void GCC_FMT_ATTR(2, 3) qtest_send(CharDriverState *chr, const char *fmt, ...) { va_list ap; char buffer[1024]; size_t len; va_start(ap, fmt); len = vsnprintf(buffer, sizeof(buffer), fmt, ap); va_end(ap); qemu_chr_fe_write_all(chr, (uint8_t *)buffer, len); if (qtest_log_fp && qtest_opened) { fprintf(qtest_log_fp, "%s", buffer); } }
{ "code": [ "static void GCC_FMT_ATTR(2, 3) qtest_send(CharDriverState *chr,", " const char *fmt, ...)", " char buffer[1024];", " size_t len;", " len = vsnprintf(buffer, sizeof(buffer), fmt, ap);", " qemu_chr_fe_write_all(chr, (uint8_t *)buffer, len);", " if (qtest_log_fp && qtest_opened) {", " fprintf(qtest_log_fp, \"%s\", buffer);" ], "line_no": [ 1, 3, 9, 11, 17, 23, 25, 27 ] }
static void GCC_FMT_ATTR(2, 3) qtest_send(CharDriverState *chr, const char *fmt, ...) { va_list ap; char buffer[1024]; size_t len; va_start(ap, fmt); len = vsnprintf(buffer, sizeof(buffer), fmt, ap); va_end(ap); qemu_chr_fe_write_all(chr, (uint8_t *)buffer, len); if (qtest_log_fp && qtest_opened) { fprintf(qtest_log_fp, "%s", buffer); } }
[ "static void GCC_FMT_ATTR(2, 3) qtest_send(CharDriverState *chr,\nconst char *fmt, ...)\n{", "va_list ap;", "char buffer[1024];", "size_t len;", "va_start(ap, fmt);", "len = vsnprintf(buffer, sizeof(buffer), fmt, ap);", "va_end(ap);", "qemu_chr_fe_write_all(chr, (uint8_t *)buffer, len);", "if (qtest_log_fp && qtest_opened) {", "fprintf(qtest_log_fp, \"%s\", buffer);", "}", "}" ]
[ 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
21,701
static int dxtory_decode_v1_rgb(AVCodecContext *avctx, AVFrame *pic, const uint8_t *src, int src_size, int id, int bpp) { int h; uint8_t *dst; int ret; if (src_size < avctx->width * avctx->height * bpp) { av_log(avctx, AV_LOG_ERROR, "packet too small\n"); return AVERROR_INVALIDDATA; } avctx->pix_fmt = id; if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; dst = pic->data[0]; for (h = 0; h < avctx->height; h++) { memcpy(dst, src, avctx->width * bpp); src += avctx->width * bpp; dst += pic->linesize[0]; } return 0; }
true
FFmpeg
a392bf657015c9a79a5a13adfbfb15086c1943b9
static int dxtory_decode_v1_rgb(AVCodecContext *avctx, AVFrame *pic, const uint8_t *src, int src_size, int id, int bpp) { int h; uint8_t *dst; int ret; if (src_size < avctx->width * avctx->height * bpp) { av_log(avctx, AV_LOG_ERROR, "packet too small\n"); return AVERROR_INVALIDDATA; } avctx->pix_fmt = id; if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; dst = pic->data[0]; for (h = 0; h < avctx->height; h++) { memcpy(dst, src, avctx->width * bpp); src += avctx->width * bpp; dst += pic->linesize[0]; } return 0; }
{ "code": [ " if (src_size < avctx->width * avctx->height * bpp) {" ], "line_no": [ 17 ] }
static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, const uint8_t *VAR_2, int VAR_3, int VAR_4, int VAR_5) { int VAR_6; uint8_t *dst; int VAR_7; if (VAR_3 < VAR_0->width * VAR_0->height * VAR_5) { av_log(VAR_0, AV_LOG_ERROR, "packet too small\n"); return AVERROR_INVALIDDATA; } VAR_0->pix_fmt = VAR_4; if ((VAR_7 = ff_get_buffer(VAR_0, VAR_1, 0)) < 0) return VAR_7; dst = VAR_1->data[0]; for (VAR_6 = 0; VAR_6 < VAR_0->height; VAR_6++) { memcpy(dst, VAR_2, VAR_0->width * VAR_5); VAR_2 += VAR_0->width * VAR_5; dst += VAR_1->linesize[0]; } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1,\nconst uint8_t *VAR_2, int VAR_3,\nint VAR_4, int VAR_5)\n{", "int VAR_6;", "uint8_t *dst;", "int VAR_7;", "if (VAR_3 < VAR_0->width * VAR_0->height * VAR_5) {", "av_log(VAR_0, AV_LOG_ERROR, \"packet too small\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_0->pix_fmt = VAR_4;", "if ((VAR_7 = ff_get_buffer(VAR_0, VAR_1, 0)) < 0)\nreturn VAR_7;", "dst = VAR_1->data[0];", "for (VAR_6 = 0; VAR_6 < VAR_0->height; VAR_6++) {", "memcpy(dst, VAR_2, VAR_0->width * VAR_5);", "VAR_2 += VAR_0->width * VAR_5;", "dst += VAR_1->linesize[0];", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ] ]
21,702
void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val) { VGACommonState *s = opaque; if (s->vbe_index <= VBE_DISPI_INDEX_NB) { #ifdef DEBUG_BOCHS_VBE printf("VBE: write index=0x%x val=0x%x\n", s->vbe_index, val); #endif switch(s->vbe_index) { case VBE_DISPI_INDEX_ID: if (val == VBE_DISPI_ID0 || val == VBE_DISPI_ID1 || val == VBE_DISPI_ID2 || val == VBE_DISPI_ID3 || val == VBE_DISPI_ID4) { s->vbe_regs[s->vbe_index] = val; } break; case VBE_DISPI_INDEX_XRES: case VBE_DISPI_INDEX_YRES: case VBE_DISPI_INDEX_BPP: case VBE_DISPI_INDEX_VIRT_WIDTH: case VBE_DISPI_INDEX_X_OFFSET: case VBE_DISPI_INDEX_Y_OFFSET: s->vbe_regs[s->vbe_index] = val; vbe_fixup_regs(s); break; case VBE_DISPI_INDEX_BANK: if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) { val &= (s->vbe_bank_mask >> 2); } else { val &= s->vbe_bank_mask; } s->vbe_regs[s->vbe_index] = val; s->bank_offset = (val << 16); vga_update_memory_access(s); break; case VBE_DISPI_INDEX_ENABLE: if ((val & VBE_DISPI_ENABLED) && !(s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED)) { int h, shift_control; s->vbe_regs[VBE_DISPI_INDEX_VIRT_WIDTH] = 0; s->vbe_regs[VBE_DISPI_INDEX_X_OFFSET] = 0; s->vbe_regs[VBE_DISPI_INDEX_Y_OFFSET] = 0; s->vbe_regs[VBE_DISPI_INDEX_ENABLE] |= VBE_DISPI_ENABLED; vbe_fixup_regs(s); /* clear the screen */ if (!(val & VBE_DISPI_NOCLEARMEM)) { memset(s->vram_ptr, 0, s->vbe_regs[VBE_DISPI_INDEX_YRES] * s->vbe_line_offset); } /* we initialize the VGA graphic mode */ /* graphic mode + memory map 1 */ s->gr[VGA_GFX_MISC] = (s->gr[VGA_GFX_MISC] & ~0x0c) | 0x04 | VGA_GR06_GRAPHICS_MODE; s->cr[VGA_CRTC_MODE] |= 3; /* no CGA modes */ s->cr[VGA_CRTC_OFFSET] = s->vbe_line_offset >> 3; /* width */ s->cr[VGA_CRTC_H_DISP] = (s->vbe_regs[VBE_DISPI_INDEX_XRES] >> 3) - 1; /* height (only meaningful if < 1024) */ h = s->vbe_regs[VBE_DISPI_INDEX_YRES] - 1; s->cr[VGA_CRTC_V_DISP_END] = h; s->cr[VGA_CRTC_OVERFLOW] = (s->cr[VGA_CRTC_OVERFLOW] & ~0x42) | ((h >> 7) & 0x02) | ((h >> 3) & 0x40); /* line compare to 1023 */ s->cr[VGA_CRTC_LINE_COMPARE] = 0xff; s->cr[VGA_CRTC_OVERFLOW] |= 0x10; s->cr[VGA_CRTC_MAX_SCAN] |= 0x40; if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) { shift_control = 0; s->sr[VGA_SEQ_CLOCK_MODE] &= ~8; /* no double line */ } else { shift_control = 2; /* set chain 4 mode */ s->sr[VGA_SEQ_MEMORY_MODE] |= VGA_SR04_CHN_4M; /* activate all planes */ s->sr[VGA_SEQ_PLANE_WRITE] |= VGA_SR02_ALL_PLANES; } s->gr[VGA_GFX_MODE] = (s->gr[VGA_GFX_MODE] & ~0x60) | (shift_control << 5); s->cr[VGA_CRTC_MAX_SCAN] &= ~0x9f; /* no double scan */ } else { s->bank_offset = 0; } s->dac_8bit = (val & VBE_DISPI_8BIT_DAC) > 0; s->vbe_regs[s->vbe_index] = val; vga_update_memory_access(s); break; default: break; } } }
true
qemu
3bf1817079bb0d80c0d8a86a7c7dd0bfe90eb82e
void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val) { VGACommonState *s = opaque; if (s->vbe_index <= VBE_DISPI_INDEX_NB) { #ifdef DEBUG_BOCHS_VBE printf("VBE: write index=0x%x val=0x%x\n", s->vbe_index, val); #endif switch(s->vbe_index) { case VBE_DISPI_INDEX_ID: if (val == VBE_DISPI_ID0 || val == VBE_DISPI_ID1 || val == VBE_DISPI_ID2 || val == VBE_DISPI_ID3 || val == VBE_DISPI_ID4) { s->vbe_regs[s->vbe_index] = val; } break; case VBE_DISPI_INDEX_XRES: case VBE_DISPI_INDEX_YRES: case VBE_DISPI_INDEX_BPP: case VBE_DISPI_INDEX_VIRT_WIDTH: case VBE_DISPI_INDEX_X_OFFSET: case VBE_DISPI_INDEX_Y_OFFSET: s->vbe_regs[s->vbe_index] = val; vbe_fixup_regs(s); break; case VBE_DISPI_INDEX_BANK: if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) { val &= (s->vbe_bank_mask >> 2); } else { val &= s->vbe_bank_mask; } s->vbe_regs[s->vbe_index] = val; s->bank_offset = (val << 16); vga_update_memory_access(s); break; case VBE_DISPI_INDEX_ENABLE: if ((val & VBE_DISPI_ENABLED) && !(s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED)) { int h, shift_control; s->vbe_regs[VBE_DISPI_INDEX_VIRT_WIDTH] = 0; s->vbe_regs[VBE_DISPI_INDEX_X_OFFSET] = 0; s->vbe_regs[VBE_DISPI_INDEX_Y_OFFSET] = 0; s->vbe_regs[VBE_DISPI_INDEX_ENABLE] |= VBE_DISPI_ENABLED; vbe_fixup_regs(s); if (!(val & VBE_DISPI_NOCLEARMEM)) { memset(s->vram_ptr, 0, s->vbe_regs[VBE_DISPI_INDEX_YRES] * s->vbe_line_offset); } s->gr[VGA_GFX_MISC] = (s->gr[VGA_GFX_MISC] & ~0x0c) | 0x04 | VGA_GR06_GRAPHICS_MODE; s->cr[VGA_CRTC_MODE] |= 3; s->cr[VGA_CRTC_OFFSET] = s->vbe_line_offset >> 3; s->cr[VGA_CRTC_H_DISP] = (s->vbe_regs[VBE_DISPI_INDEX_XRES] >> 3) - 1; h = s->vbe_regs[VBE_DISPI_INDEX_YRES] - 1; s->cr[VGA_CRTC_V_DISP_END] = h; s->cr[VGA_CRTC_OVERFLOW] = (s->cr[VGA_CRTC_OVERFLOW] & ~0x42) | ((h >> 7) & 0x02) | ((h >> 3) & 0x40); s->cr[VGA_CRTC_LINE_COMPARE] = 0xff; s->cr[VGA_CRTC_OVERFLOW] |= 0x10; s->cr[VGA_CRTC_MAX_SCAN] |= 0x40; if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) { shift_control = 0; s->sr[VGA_SEQ_CLOCK_MODE] &= ~8; } else { shift_control = 2; s->sr[VGA_SEQ_MEMORY_MODE] |= VGA_SR04_CHN_4M; s->sr[VGA_SEQ_PLANE_WRITE] |= VGA_SR02_ALL_PLANES; } s->gr[VGA_GFX_MODE] = (s->gr[VGA_GFX_MODE] & ~0x60) | (shift_control << 5); s->cr[VGA_CRTC_MAX_SCAN] &= ~0x9f; } else { s->bank_offset = 0; } s->dac_8bit = (val & VBE_DISPI_8BIT_DAC) > 0; s->vbe_regs[s->vbe_index] = val; vga_update_memory_access(s); break; default: break; } } }
{ "code": [ " if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) {", " val &= (s->vbe_bank_mask >> 2);", " } else {", " val &= s->vbe_bank_mask;" ], "line_no": [ 57, 59, 61, 63 ] }
void FUNC_0(void *VAR_0, uint32_t VAR_1, uint32_t VAR_2) { VGACommonState *s = VAR_0; if (s->vbe_index <= VBE_DISPI_INDEX_NB) { #ifdef DEBUG_BOCHS_VBE printf("VBE: write index=0x%x VAR_2=0x%x\n", s->vbe_index, VAR_2); #endif switch(s->vbe_index) { case VBE_DISPI_INDEX_ID: if (VAR_2 == VBE_DISPI_ID0 || VAR_2 == VBE_DISPI_ID1 || VAR_2 == VBE_DISPI_ID2 || VAR_2 == VBE_DISPI_ID3 || VAR_2 == VBE_DISPI_ID4) { s->vbe_regs[s->vbe_index] = VAR_2; } break; case VBE_DISPI_INDEX_XRES: case VBE_DISPI_INDEX_YRES: case VBE_DISPI_INDEX_BPP: case VBE_DISPI_INDEX_VIRT_WIDTH: case VBE_DISPI_INDEX_X_OFFSET: case VBE_DISPI_INDEX_Y_OFFSET: s->vbe_regs[s->vbe_index] = VAR_2; vbe_fixup_regs(s); break; case VBE_DISPI_INDEX_BANK: if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) { VAR_2 &= (s->vbe_bank_mask >> 2); } else { VAR_2 &= s->vbe_bank_mask; } s->vbe_regs[s->vbe_index] = VAR_2; s->bank_offset = (VAR_2 << 16); vga_update_memory_access(s); break; case VBE_DISPI_INDEX_ENABLE: if ((VAR_2 & VBE_DISPI_ENABLED) && !(s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED)) { int VAR_3, VAR_4; s->vbe_regs[VBE_DISPI_INDEX_VIRT_WIDTH] = 0; s->vbe_regs[VBE_DISPI_INDEX_X_OFFSET] = 0; s->vbe_regs[VBE_DISPI_INDEX_Y_OFFSET] = 0; s->vbe_regs[VBE_DISPI_INDEX_ENABLE] |= VBE_DISPI_ENABLED; vbe_fixup_regs(s); if (!(VAR_2 & VBE_DISPI_NOCLEARMEM)) { memset(s->vram_ptr, 0, s->vbe_regs[VBE_DISPI_INDEX_YRES] * s->vbe_line_offset); } s->gr[VGA_GFX_MISC] = (s->gr[VGA_GFX_MISC] & ~0x0c) | 0x04 | VGA_GR06_GRAPHICS_MODE; s->cr[VGA_CRTC_MODE] |= 3; s->cr[VGA_CRTC_OFFSET] = s->vbe_line_offset >> 3; s->cr[VGA_CRTC_H_DISP] = (s->vbe_regs[VBE_DISPI_INDEX_XRES] >> 3) - 1; VAR_3 = s->vbe_regs[VBE_DISPI_INDEX_YRES] - 1; s->cr[VGA_CRTC_V_DISP_END] = VAR_3; s->cr[VGA_CRTC_OVERFLOW] = (s->cr[VGA_CRTC_OVERFLOW] & ~0x42) | ((VAR_3 >> 7) & 0x02) | ((VAR_3 >> 3) & 0x40); s->cr[VGA_CRTC_LINE_COMPARE] = 0xff; s->cr[VGA_CRTC_OVERFLOW] |= 0x10; s->cr[VGA_CRTC_MAX_SCAN] |= 0x40; if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) { VAR_4 = 0; s->sr[VGA_SEQ_CLOCK_MODE] &= ~8; } else { VAR_4 = 2; s->sr[VGA_SEQ_MEMORY_MODE] |= VGA_SR04_CHN_4M; s->sr[VGA_SEQ_PLANE_WRITE] |= VGA_SR02_ALL_PLANES; } s->gr[VGA_GFX_MODE] = (s->gr[VGA_GFX_MODE] & ~0x60) | (VAR_4 << 5); s->cr[VGA_CRTC_MAX_SCAN] &= ~0x9f; } else { s->bank_offset = 0; } s->dac_8bit = (VAR_2 & VBE_DISPI_8BIT_DAC) > 0; s->vbe_regs[s->vbe_index] = VAR_2; vga_update_memory_access(s); break; default: break; } } }
[ "void FUNC_0(void *VAR_0, uint32_t VAR_1, uint32_t VAR_2)\n{", "VGACommonState *s = VAR_0;", "if (s->vbe_index <= VBE_DISPI_INDEX_NB) {", "#ifdef DEBUG_BOCHS_VBE\nprintf(\"VBE: write index=0x%x VAR_2=0x%x\\n\", s->vbe_index, VAR_2);", "#endif\nswitch(s->vbe_index) {", "case VBE_DISPI_INDEX_ID:\nif (VAR_2 == VBE_DISPI_ID0 ||\nVAR_2 == VBE_DISPI_ID1 ||\nVAR_2 == VBE_DISPI_ID2 ||\nVAR_2 == VBE_DISPI_ID3 ||\nVAR_2 == VBE_DISPI_ID4) {", "s->vbe_regs[s->vbe_index] = VAR_2;", "}", "break;", "case VBE_DISPI_INDEX_XRES:\ncase VBE_DISPI_INDEX_YRES:\ncase VBE_DISPI_INDEX_BPP:\ncase VBE_DISPI_INDEX_VIRT_WIDTH:\ncase VBE_DISPI_INDEX_X_OFFSET:\ncase VBE_DISPI_INDEX_Y_OFFSET:\ns->vbe_regs[s->vbe_index] = VAR_2;", "vbe_fixup_regs(s);", "break;", "case VBE_DISPI_INDEX_BANK:\nif (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) {", "VAR_2 &= (s->vbe_bank_mask >> 2);", "} else {", "VAR_2 &= s->vbe_bank_mask;", "}", "s->vbe_regs[s->vbe_index] = VAR_2;", "s->bank_offset = (VAR_2 << 16);", "vga_update_memory_access(s);", "break;", "case VBE_DISPI_INDEX_ENABLE:\nif ((VAR_2 & VBE_DISPI_ENABLED) &&\n!(s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED)) {", "int VAR_3, VAR_4;", "s->vbe_regs[VBE_DISPI_INDEX_VIRT_WIDTH] = 0;", "s->vbe_regs[VBE_DISPI_INDEX_X_OFFSET] = 0;", "s->vbe_regs[VBE_DISPI_INDEX_Y_OFFSET] = 0;", "s->vbe_regs[VBE_DISPI_INDEX_ENABLE] |= VBE_DISPI_ENABLED;", "vbe_fixup_regs(s);", "if (!(VAR_2 & VBE_DISPI_NOCLEARMEM)) {", "memset(s->vram_ptr, 0,\ns->vbe_regs[VBE_DISPI_INDEX_YRES] * s->vbe_line_offset);", "}", "s->gr[VGA_GFX_MISC] = (s->gr[VGA_GFX_MISC] & ~0x0c) | 0x04 |\nVGA_GR06_GRAPHICS_MODE;", "s->cr[VGA_CRTC_MODE] |= 3;", "s->cr[VGA_CRTC_OFFSET] = s->vbe_line_offset >> 3;", "s->cr[VGA_CRTC_H_DISP] =\n(s->vbe_regs[VBE_DISPI_INDEX_XRES] >> 3) - 1;", "VAR_3 = s->vbe_regs[VBE_DISPI_INDEX_YRES] - 1;", "s->cr[VGA_CRTC_V_DISP_END] = VAR_3;", "s->cr[VGA_CRTC_OVERFLOW] = (s->cr[VGA_CRTC_OVERFLOW] & ~0x42) |\n((VAR_3 >> 7) & 0x02) | ((VAR_3 >> 3) & 0x40);", "s->cr[VGA_CRTC_LINE_COMPARE] = 0xff;", "s->cr[VGA_CRTC_OVERFLOW] |= 0x10;", "s->cr[VGA_CRTC_MAX_SCAN] |= 0x40;", "if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) {", "VAR_4 = 0;", "s->sr[VGA_SEQ_CLOCK_MODE] &= ~8;", "} else {", "VAR_4 = 2;", "s->sr[VGA_SEQ_MEMORY_MODE] |= VGA_SR04_CHN_4M;", "s->sr[VGA_SEQ_PLANE_WRITE] |= VGA_SR02_ALL_PLANES;", "}", "s->gr[VGA_GFX_MODE] = (s->gr[VGA_GFX_MODE] & ~0x60) |\n(VAR_4 << 5);", "s->cr[VGA_CRTC_MAX_SCAN] &= ~0x9f;", "} else {", "s->bank_offset = 0;", "}", "s->dac_8bit = (VAR_2 & VBE_DISPI_8BIT_DAC) > 0;", "s->vbe_regs[s->vbe_index] = VAR_2;", "vga_update_memory_access(s);", "break;", "default:\nbreak;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19, 21, 23, 25, 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39, 41, 43, 45, 47, 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77, 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 123, 125 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 195 ] ]
21,703
static void vexpress_common_init(MachineState *machine) { VexpressMachineState *vms = VEXPRESS_MACHINE(machine); VexpressMachineClass *vmc = VEXPRESS_MACHINE_GET_CLASS(machine); VEDBoardInfo *daughterboard = vmc->daughterboard; DeviceState *dev, *sysctl, *pl041; qemu_irq pic[64]; uint32_t sys_id; DriveInfo *dinfo; pflash_t *pflash0; ram_addr_t vram_size, sram_size; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *vram = g_new(MemoryRegion, 1); MemoryRegion *sram = g_new(MemoryRegion, 1); MemoryRegion *flashalias = g_new(MemoryRegion, 1); MemoryRegion *flash0mem; const hwaddr *map = daughterboard->motherboard_map; int i; daughterboard->init(vms, machine->ram_size, machine->cpu_model, pic); /* * If a bios file was provided, attempt to map it into memory */ if (bios_name) { char *fn; int image_size; if (drive_get(IF_PFLASH, 0, 0)) { error_report("The contents of the first flash device may be " "specified with -bios or with -drive if=pflash... " "but you cannot use both options at once"); exit(1); } fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (!fn) { error_report("Could not find ROM image '%s'", bios_name); exit(1); } image_size = load_image_targphys(fn, map[VE_NORFLASH0], VEXPRESS_FLASH_SIZE); g_free(fn); if (image_size < 0) { error_report("Could not load ROM image '%s'", bios_name); exit(1); } } /* Motherboard peripherals: the wiring is the same but the * addresses vary between the legacy and A-Series memory maps. */ sys_id = 0x1190f500; sysctl = qdev_create(NULL, "realview_sysctl"); qdev_prop_set_uint32(sysctl, "sys_id", sys_id); qdev_prop_set_uint32(sysctl, "proc_id", daughterboard->proc_id); qdev_prop_set_uint32(sysctl, "len-db-voltage", daughterboard->num_voltage_sensors); for (i = 0; i < daughterboard->num_voltage_sensors; i++) { char *propname = g_strdup_printf("db-voltage[%d]", i); qdev_prop_set_uint32(sysctl, propname, daughterboard->voltages[i]); g_free(propname); } qdev_prop_set_uint32(sysctl, "len-db-clock", daughterboard->num_clocks); for (i = 0; i < daughterboard->num_clocks; i++) { char *propname = g_strdup_printf("db-clock[%d]", i); qdev_prop_set_uint32(sysctl, propname, daughterboard->clocks[i]); g_free(propname); } qdev_init_nofail(sysctl); sysbus_mmio_map(SYS_BUS_DEVICE(sysctl), 0, map[VE_SYSREGS]); /* VE_SP810: not modelled */ /* VE_SERIALPCI: not modelled */ pl041 = qdev_create(NULL, "pl041"); qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512); qdev_init_nofail(pl041); sysbus_mmio_map(SYS_BUS_DEVICE(pl041), 0, map[VE_PL041]); sysbus_connect_irq(SYS_BUS_DEVICE(pl041), 0, pic[11]); dev = sysbus_create_varargs("pl181", map[VE_MMCI], pic[9], pic[10], NULL); /* Wire up MMC card detect and read-only signals */ qdev_connect_gpio_out(dev, 0, qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT)); qdev_connect_gpio_out(dev, 1, qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN)); sysbus_create_simple("pl050_keyboard", map[VE_KMI0], pic[12]); sysbus_create_simple("pl050_mouse", map[VE_KMI1], pic[13]); sysbus_create_simple("pl011", map[VE_UART0], pic[5]); sysbus_create_simple("pl011", map[VE_UART1], pic[6]); sysbus_create_simple("pl011", map[VE_UART2], pic[7]); sysbus_create_simple("pl011", map[VE_UART3], pic[8]); sysbus_create_simple("sp804", map[VE_TIMER01], pic[2]); sysbus_create_simple("sp804", map[VE_TIMER23], pic[3]); /* VE_SERIALDVI: not modelled */ sysbus_create_simple("pl031", map[VE_RTC], pic[4]); /* RTC */ /* VE_COMPACTFLASH: not modelled */ sysbus_create_simple("pl111", map[VE_CLCD], pic[14]); dinfo = drive_get_next(IF_PFLASH); pflash0 = ve_pflash_cfi01_register(map[VE_NORFLASH0], "vexpress.flash0", dinfo); if (!pflash0) { fprintf(stderr, "vexpress: error registering flash 0.\n"); exit(1); } if (map[VE_NORFLASHALIAS] != -1) { /* Map flash 0 as an alias into low memory */ flash0mem = sysbus_mmio_get_region(SYS_BUS_DEVICE(pflash0), 0); memory_region_init_alias(flashalias, NULL, "vexpress.flashalias", flash0mem, 0, VEXPRESS_FLASH_SIZE); memory_region_add_subregion(sysmem, map[VE_NORFLASHALIAS], flashalias); } dinfo = drive_get_next(IF_PFLASH); if (!ve_pflash_cfi01_register(map[VE_NORFLASH1], "vexpress.flash1", dinfo)) { fprintf(stderr, "vexpress: error registering flash 1.\n"); exit(1); } sram_size = 0x2000000; memory_region_init_ram(sram, NULL, "vexpress.sram", sram_size, &error_abort); vmstate_register_ram_global(sram); memory_region_add_subregion(sysmem, map[VE_SRAM], sram); vram_size = 0x800000; memory_region_init_ram(vram, NULL, "vexpress.vram", vram_size, &error_abort); vmstate_register_ram_global(vram); memory_region_add_subregion(sysmem, map[VE_VIDEORAM], vram); /* 0x4e000000 LAN9118 Ethernet */ if (nd_table[0].used) { lan9118_init(&nd_table[0], map[VE_ETHERNET], pic[15]); } /* VE_USB: not modelled */ /* VE_DAPROM: not modelled */ /* Create mmio transports, so the user can create virtio backends * (which will be automatically plugged in to the transports). If * no backend is created the transport will just sit harmlessly idle. */ for (i = 0; i < NUM_VIRTIO_TRANSPORTS; i++) { sysbus_create_simple("virtio-mmio", map[VE_VIRTIO] + 0x200 * i, pic[40 + i]); } daughterboard->bootinfo.ram_size = machine->ram_size; daughterboard->bootinfo.kernel_filename = machine->kernel_filename; daughterboard->bootinfo.kernel_cmdline = machine->kernel_cmdline; daughterboard->bootinfo.initrd_filename = machine->initrd_filename; daughterboard->bootinfo.nb_cpus = smp_cpus; daughterboard->bootinfo.board_id = VEXPRESS_BOARD_ID; daughterboard->bootinfo.loader_start = daughterboard->loader_start; daughterboard->bootinfo.smp_loader_start = map[VE_SRAM]; daughterboard->bootinfo.smp_bootreg_addr = map[VE_SYSREGS] + 0x30; daughterboard->bootinfo.gic_cpu_if_addr = daughterboard->gic_cpu_if_addr; daughterboard->bootinfo.modify_dtb = vexpress_modify_dtb; /* Indicate that when booting Linux we should be in secure state */ daughterboard->bootinfo.secure_boot = true; arm_load_kernel(ARM_CPU(first_cpu), &daughterboard->bootinfo); }
true
qemu
f8ed85ac992c48814d916d5df4d44f9a971c5de4
static void vexpress_common_init(MachineState *machine) { VexpressMachineState *vms = VEXPRESS_MACHINE(machine); VexpressMachineClass *vmc = VEXPRESS_MACHINE_GET_CLASS(machine); VEDBoardInfo *daughterboard = vmc->daughterboard; DeviceState *dev, *sysctl, *pl041; qemu_irq pic[64]; uint32_t sys_id; DriveInfo *dinfo; pflash_t *pflash0; ram_addr_t vram_size, sram_size; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *vram = g_new(MemoryRegion, 1); MemoryRegion *sram = g_new(MemoryRegion, 1); MemoryRegion *flashalias = g_new(MemoryRegion, 1); MemoryRegion *flash0mem; const hwaddr *map = daughterboard->motherboard_map; int i; daughterboard->init(vms, machine->ram_size, machine->cpu_model, pic); if (bios_name) { char *fn; int image_size; if (drive_get(IF_PFLASH, 0, 0)) { error_report("The contents of the first flash device may be " "specified with -bios or with -drive if=pflash... " "but you cannot use both options at once"); exit(1); } fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (!fn) { error_report("Could not find ROM image '%s'", bios_name); exit(1); } image_size = load_image_targphys(fn, map[VE_NORFLASH0], VEXPRESS_FLASH_SIZE); g_free(fn); if (image_size < 0) { error_report("Could not load ROM image '%s'", bios_name); exit(1); } } sys_id = 0x1190f500; sysctl = qdev_create(NULL, "realview_sysctl"); qdev_prop_set_uint32(sysctl, "sys_id", sys_id); qdev_prop_set_uint32(sysctl, "proc_id", daughterboard->proc_id); qdev_prop_set_uint32(sysctl, "len-db-voltage", daughterboard->num_voltage_sensors); for (i = 0; i < daughterboard->num_voltage_sensors; i++) { char *propname = g_strdup_printf("db-voltage[%d]", i); qdev_prop_set_uint32(sysctl, propname, daughterboard->voltages[i]); g_free(propname); } qdev_prop_set_uint32(sysctl, "len-db-clock", daughterboard->num_clocks); for (i = 0; i < daughterboard->num_clocks; i++) { char *propname = g_strdup_printf("db-clock[%d]", i); qdev_prop_set_uint32(sysctl, propname, daughterboard->clocks[i]); g_free(propname); } qdev_init_nofail(sysctl); sysbus_mmio_map(SYS_BUS_DEVICE(sysctl), 0, map[VE_SYSREGS]); pl041 = qdev_create(NULL, "pl041"); qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512); qdev_init_nofail(pl041); sysbus_mmio_map(SYS_BUS_DEVICE(pl041), 0, map[VE_PL041]); sysbus_connect_irq(SYS_BUS_DEVICE(pl041), 0, pic[11]); dev = sysbus_create_varargs("pl181", map[VE_MMCI], pic[9], pic[10], NULL); qdev_connect_gpio_out(dev, 0, qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT)); qdev_connect_gpio_out(dev, 1, qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN)); sysbus_create_simple("pl050_keyboard", map[VE_KMI0], pic[12]); sysbus_create_simple("pl050_mouse", map[VE_KMI1], pic[13]); sysbus_create_simple("pl011", map[VE_UART0], pic[5]); sysbus_create_simple("pl011", map[VE_UART1], pic[6]); sysbus_create_simple("pl011", map[VE_UART2], pic[7]); sysbus_create_simple("pl011", map[VE_UART3], pic[8]); sysbus_create_simple("sp804", map[VE_TIMER01], pic[2]); sysbus_create_simple("sp804", map[VE_TIMER23], pic[3]); sysbus_create_simple("pl031", map[VE_RTC], pic[4]); sysbus_create_simple("pl111", map[VE_CLCD], pic[14]); dinfo = drive_get_next(IF_PFLASH); pflash0 = ve_pflash_cfi01_register(map[VE_NORFLASH0], "vexpress.flash0", dinfo); if (!pflash0) { fprintf(stderr, "vexpress: error registering flash 0.\n"); exit(1); } if (map[VE_NORFLASHALIAS] != -1) { flash0mem = sysbus_mmio_get_region(SYS_BUS_DEVICE(pflash0), 0); memory_region_init_alias(flashalias, NULL, "vexpress.flashalias", flash0mem, 0, VEXPRESS_FLASH_SIZE); memory_region_add_subregion(sysmem, map[VE_NORFLASHALIAS], flashalias); } dinfo = drive_get_next(IF_PFLASH); if (!ve_pflash_cfi01_register(map[VE_NORFLASH1], "vexpress.flash1", dinfo)) { fprintf(stderr, "vexpress: error registering flash 1.\n"); exit(1); } sram_size = 0x2000000; memory_region_init_ram(sram, NULL, "vexpress.sram", sram_size, &error_abort); vmstate_register_ram_global(sram); memory_region_add_subregion(sysmem, map[VE_SRAM], sram); vram_size = 0x800000; memory_region_init_ram(vram, NULL, "vexpress.vram", vram_size, &error_abort); vmstate_register_ram_global(vram); memory_region_add_subregion(sysmem, map[VE_VIDEORAM], vram); if (nd_table[0].used) { lan9118_init(&nd_table[0], map[VE_ETHERNET], pic[15]); } for (i = 0; i < NUM_VIRTIO_TRANSPORTS; i++) { sysbus_create_simple("virtio-mmio", map[VE_VIRTIO] + 0x200 * i, pic[40 + i]); } daughterboard->bootinfo.ram_size = machine->ram_size; daughterboard->bootinfo.kernel_filename = machine->kernel_filename; daughterboard->bootinfo.kernel_cmdline = machine->kernel_cmdline; daughterboard->bootinfo.initrd_filename = machine->initrd_filename; daughterboard->bootinfo.nb_cpus = smp_cpus; daughterboard->bootinfo.board_id = VEXPRESS_BOARD_ID; daughterboard->bootinfo.loader_start = daughterboard->loader_start; daughterboard->bootinfo.smp_loader_start = map[VE_SRAM]; daughterboard->bootinfo.smp_bootreg_addr = map[VE_SYSREGS] + 0x30; daughterboard->bootinfo.gic_cpu_if_addr = daughterboard->gic_cpu_if_addr; daughterboard->bootinfo.modify_dtb = vexpress_modify_dtb; daughterboard->bootinfo.secure_boot = true; arm_load_kernel(ARM_CPU(first_cpu), &daughterboard->bootinfo); }
{ "code": [ " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);" ], "line_no": [ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269 ] }
static void FUNC_0(MachineState *VAR_0) { VexpressMachineState *vms = VEXPRESS_MACHINE(VAR_0); VexpressMachineClass *vmc = VEXPRESS_MACHINE_GET_CLASS(VAR_0); VEDBoardInfo *daughterboard = vmc->daughterboard; DeviceState *dev, *sysctl, *pl041; qemu_irq pic[64]; uint32_t sys_id; DriveInfo *dinfo; pflash_t *pflash0; ram_addr_t vram_size, sram_size; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *vram = g_new(MemoryRegion, 1); MemoryRegion *sram = g_new(MemoryRegion, 1); MemoryRegion *flashalias = g_new(MemoryRegion, 1); MemoryRegion *flash0mem; const hwaddr *VAR_1 = daughterboard->motherboard_map; int VAR_2; daughterboard->init(vms, VAR_0->ram_size, VAR_0->cpu_model, pic); if (bios_name) { char *VAR_3; int VAR_4; if (drive_get(IF_PFLASH, 0, 0)) { error_report("The contents of the first flash device may be " "specified with -bios or with -drive if=pflash... " "but you cannot use both options at once"); exit(1); } VAR_3 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (!VAR_3) { error_report("Could not find ROM image '%s'", bios_name); exit(1); } VAR_4 = load_image_targphys(VAR_3, VAR_1[VE_NORFLASH0], VEXPRESS_FLASH_SIZE); g_free(VAR_3); if (VAR_4 < 0) { error_report("Could not load ROM image '%s'", bios_name); exit(1); } } sys_id = 0x1190f500; sysctl = qdev_create(NULL, "realview_sysctl"); qdev_prop_set_uint32(sysctl, "sys_id", sys_id); qdev_prop_set_uint32(sysctl, "proc_id", daughterboard->proc_id); qdev_prop_set_uint32(sysctl, "len-db-voltage", daughterboard->num_voltage_sensors); for (VAR_2 = 0; VAR_2 < daughterboard->num_voltage_sensors; VAR_2++) { char *propname = g_strdup_printf("db-voltage[%d]", VAR_2); qdev_prop_set_uint32(sysctl, propname, daughterboard->voltages[VAR_2]); g_free(propname); } qdev_prop_set_uint32(sysctl, "len-db-clock", daughterboard->num_clocks); for (VAR_2 = 0; VAR_2 < daughterboard->num_clocks; VAR_2++) { char *propname = g_strdup_printf("db-clock[%d]", VAR_2); qdev_prop_set_uint32(sysctl, propname, daughterboard->clocks[VAR_2]); g_free(propname); } qdev_init_nofail(sysctl); sysbus_mmio_map(SYS_BUS_DEVICE(sysctl), 0, VAR_1[VE_SYSREGS]); pl041 = qdev_create(NULL, "pl041"); qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512); qdev_init_nofail(pl041); sysbus_mmio_map(SYS_BUS_DEVICE(pl041), 0, VAR_1[VE_PL041]); sysbus_connect_irq(SYS_BUS_DEVICE(pl041), 0, pic[11]); dev = sysbus_create_varargs("pl181", VAR_1[VE_MMCI], pic[9], pic[10], NULL); qdev_connect_gpio_out(dev, 0, qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT)); qdev_connect_gpio_out(dev, 1, qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN)); sysbus_create_simple("pl050_keyboard", VAR_1[VE_KMI0], pic[12]); sysbus_create_simple("pl050_mouse", VAR_1[VE_KMI1], pic[13]); sysbus_create_simple("pl011", VAR_1[VE_UART0], pic[5]); sysbus_create_simple("pl011", VAR_1[VE_UART1], pic[6]); sysbus_create_simple("pl011", VAR_1[VE_UART2], pic[7]); sysbus_create_simple("pl011", VAR_1[VE_UART3], pic[8]); sysbus_create_simple("sp804", VAR_1[VE_TIMER01], pic[2]); sysbus_create_simple("sp804", VAR_1[VE_TIMER23], pic[3]); sysbus_create_simple("pl031", VAR_1[VE_RTC], pic[4]); sysbus_create_simple("pl111", VAR_1[VE_CLCD], pic[14]); dinfo = drive_get_next(IF_PFLASH); pflash0 = ve_pflash_cfi01_register(VAR_1[VE_NORFLASH0], "vexpress.flash0", dinfo); if (!pflash0) { fprintf(stderr, "vexpress: error registering flash 0.\n"); exit(1); } if (VAR_1[VE_NORFLASHALIAS] != -1) { flash0mem = sysbus_mmio_get_region(SYS_BUS_DEVICE(pflash0), 0); memory_region_init_alias(flashalias, NULL, "vexpress.flashalias", flash0mem, 0, VEXPRESS_FLASH_SIZE); memory_region_add_subregion(sysmem, VAR_1[VE_NORFLASHALIAS], flashalias); } dinfo = drive_get_next(IF_PFLASH); if (!ve_pflash_cfi01_register(VAR_1[VE_NORFLASH1], "vexpress.flash1", dinfo)) { fprintf(stderr, "vexpress: error registering flash 1.\n"); exit(1); } sram_size = 0x2000000; memory_region_init_ram(sram, NULL, "vexpress.sram", sram_size, &error_abort); vmstate_register_ram_global(sram); memory_region_add_subregion(sysmem, VAR_1[VE_SRAM], sram); vram_size = 0x800000; memory_region_init_ram(vram, NULL, "vexpress.vram", vram_size, &error_abort); vmstate_register_ram_global(vram); memory_region_add_subregion(sysmem, VAR_1[VE_VIDEORAM], vram); if (nd_table[0].used) { lan9118_init(&nd_table[0], VAR_1[VE_ETHERNET], pic[15]); } for (VAR_2 = 0; VAR_2 < NUM_VIRTIO_TRANSPORTS; VAR_2++) { sysbus_create_simple("virtio-mmio", VAR_1[VE_VIRTIO] + 0x200 * VAR_2, pic[40 + VAR_2]); } daughterboard->bootinfo.ram_size = VAR_0->ram_size; daughterboard->bootinfo.kernel_filename = VAR_0->kernel_filename; daughterboard->bootinfo.kernel_cmdline = VAR_0->kernel_cmdline; daughterboard->bootinfo.initrd_filename = VAR_0->initrd_filename; daughterboard->bootinfo.nb_cpus = smp_cpus; daughterboard->bootinfo.board_id = VEXPRESS_BOARD_ID; daughterboard->bootinfo.loader_start = daughterboard->loader_start; daughterboard->bootinfo.smp_loader_start = VAR_1[VE_SRAM]; daughterboard->bootinfo.smp_bootreg_addr = VAR_1[VE_SYSREGS] + 0x30; daughterboard->bootinfo.gic_cpu_if_addr = daughterboard->gic_cpu_if_addr; daughterboard->bootinfo.modify_dtb = vexpress_modify_dtb; daughterboard->bootinfo.secure_boot = true; arm_load_kernel(ARM_CPU(first_cpu), &daughterboard->bootinfo); }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "VexpressMachineState *vms = VEXPRESS_MACHINE(VAR_0);", "VexpressMachineClass *vmc = VEXPRESS_MACHINE_GET_CLASS(VAR_0);", "VEDBoardInfo *daughterboard = vmc->daughterboard;", "DeviceState *dev, *sysctl, *pl041;", "qemu_irq pic[64];", "uint32_t sys_id;", "DriveInfo *dinfo;", "pflash_t *pflash0;", "ram_addr_t vram_size, sram_size;", "MemoryRegion *sysmem = get_system_memory();", "MemoryRegion *vram = g_new(MemoryRegion, 1);", "MemoryRegion *sram = g_new(MemoryRegion, 1);", "MemoryRegion *flashalias = g_new(MemoryRegion, 1);", "MemoryRegion *flash0mem;", "const hwaddr *VAR_1 = daughterboard->motherboard_map;", "int VAR_2;", "daughterboard->init(vms, VAR_0->ram_size, VAR_0->cpu_model, pic);", "if (bios_name) {", "char *VAR_3;", "int VAR_4;", "if (drive_get(IF_PFLASH, 0, 0)) {", "error_report(\"The contents of the first flash device may be \"\n\"specified with -bios or with -drive if=pflash... \"\n\"but you cannot use both options at once\");", "exit(1);", "}", "VAR_3 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "if (!VAR_3) {", "error_report(\"Could not find ROM image '%s'\", bios_name);", "exit(1);", "}", "VAR_4 = load_image_targphys(VAR_3, VAR_1[VE_NORFLASH0],\nVEXPRESS_FLASH_SIZE);", "g_free(VAR_3);", "if (VAR_4 < 0) {", "error_report(\"Could not load ROM image '%s'\", bios_name);", "exit(1);", "}", "}", "sys_id = 0x1190f500;", "sysctl = qdev_create(NULL, \"realview_sysctl\");", "qdev_prop_set_uint32(sysctl, \"sys_id\", sys_id);", "qdev_prop_set_uint32(sysctl, \"proc_id\", daughterboard->proc_id);", "qdev_prop_set_uint32(sysctl, \"len-db-voltage\",\ndaughterboard->num_voltage_sensors);", "for (VAR_2 = 0; VAR_2 < daughterboard->num_voltage_sensors; VAR_2++) {", "char *propname = g_strdup_printf(\"db-voltage[%d]\", VAR_2);", "qdev_prop_set_uint32(sysctl, propname, daughterboard->voltages[VAR_2]);", "g_free(propname);", "}", "qdev_prop_set_uint32(sysctl, \"len-db-clock\",\ndaughterboard->num_clocks);", "for (VAR_2 = 0; VAR_2 < daughterboard->num_clocks; VAR_2++) {", "char *propname = g_strdup_printf(\"db-clock[%d]\", VAR_2);", "qdev_prop_set_uint32(sysctl, propname, daughterboard->clocks[VAR_2]);", "g_free(propname);", "}", "qdev_init_nofail(sysctl);", "sysbus_mmio_map(SYS_BUS_DEVICE(sysctl), 0, VAR_1[VE_SYSREGS]);", "pl041 = qdev_create(NULL, \"pl041\");", "qdev_prop_set_uint32(pl041, \"nc_fifo_depth\", 512);", "qdev_init_nofail(pl041);", "sysbus_mmio_map(SYS_BUS_DEVICE(pl041), 0, VAR_1[VE_PL041]);", "sysbus_connect_irq(SYS_BUS_DEVICE(pl041), 0, pic[11]);", "dev = sysbus_create_varargs(\"pl181\", VAR_1[VE_MMCI], pic[9], pic[10], NULL);", "qdev_connect_gpio_out(dev, 0,\nqdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT));", "qdev_connect_gpio_out(dev, 1,\nqdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN));", "sysbus_create_simple(\"pl050_keyboard\", VAR_1[VE_KMI0], pic[12]);", "sysbus_create_simple(\"pl050_mouse\", VAR_1[VE_KMI1], pic[13]);", "sysbus_create_simple(\"pl011\", VAR_1[VE_UART0], pic[5]);", "sysbus_create_simple(\"pl011\", VAR_1[VE_UART1], pic[6]);", "sysbus_create_simple(\"pl011\", VAR_1[VE_UART2], pic[7]);", "sysbus_create_simple(\"pl011\", VAR_1[VE_UART3], pic[8]);", "sysbus_create_simple(\"sp804\", VAR_1[VE_TIMER01], pic[2]);", "sysbus_create_simple(\"sp804\", VAR_1[VE_TIMER23], pic[3]);", "sysbus_create_simple(\"pl031\", VAR_1[VE_RTC], pic[4]);", "sysbus_create_simple(\"pl111\", VAR_1[VE_CLCD], pic[14]);", "dinfo = drive_get_next(IF_PFLASH);", "pflash0 = ve_pflash_cfi01_register(VAR_1[VE_NORFLASH0], \"vexpress.flash0\",\ndinfo);", "if (!pflash0) {", "fprintf(stderr, \"vexpress: error registering flash 0.\\n\");", "exit(1);", "}", "if (VAR_1[VE_NORFLASHALIAS] != -1) {", "flash0mem = sysbus_mmio_get_region(SYS_BUS_DEVICE(pflash0), 0);", "memory_region_init_alias(flashalias, NULL, \"vexpress.flashalias\",\nflash0mem, 0, VEXPRESS_FLASH_SIZE);", "memory_region_add_subregion(sysmem, VAR_1[VE_NORFLASHALIAS], flashalias);", "}", "dinfo = drive_get_next(IF_PFLASH);", "if (!ve_pflash_cfi01_register(VAR_1[VE_NORFLASH1], \"vexpress.flash1\",\ndinfo)) {", "fprintf(stderr, \"vexpress: error registering flash 1.\\n\");", "exit(1);", "}", "sram_size = 0x2000000;", "memory_region_init_ram(sram, NULL, \"vexpress.sram\", sram_size,\n&error_abort);", "vmstate_register_ram_global(sram);", "memory_region_add_subregion(sysmem, VAR_1[VE_SRAM], sram);", "vram_size = 0x800000;", "memory_region_init_ram(vram, NULL, \"vexpress.vram\", vram_size,\n&error_abort);", "vmstate_register_ram_global(vram);", "memory_region_add_subregion(sysmem, VAR_1[VE_VIDEORAM], vram);", "if (nd_table[0].used) {", "lan9118_init(&nd_table[0], VAR_1[VE_ETHERNET], pic[15]);", "}", "for (VAR_2 = 0; VAR_2 < NUM_VIRTIO_TRANSPORTS; VAR_2++) {", "sysbus_create_simple(\"virtio-mmio\", VAR_1[VE_VIRTIO] + 0x200 * VAR_2,\npic[40 + VAR_2]);", "}", "daughterboard->bootinfo.ram_size = VAR_0->ram_size;", "daughterboard->bootinfo.kernel_filename = VAR_0->kernel_filename;", "daughterboard->bootinfo.kernel_cmdline = VAR_0->kernel_cmdline;", "daughterboard->bootinfo.initrd_filename = VAR_0->initrd_filename;", "daughterboard->bootinfo.nb_cpus = smp_cpus;", "daughterboard->bootinfo.board_id = VEXPRESS_BOARD_ID;", "daughterboard->bootinfo.loader_start = daughterboard->loader_start;", "daughterboard->bootinfo.smp_loader_start = VAR_1[VE_SRAM];", "daughterboard->bootinfo.smp_bootreg_addr = VAR_1[VE_SYSREGS] + 0x30;", "daughterboard->bootinfo.gic_cpu_if_addr = daughterboard->gic_cpu_if_addr;", "daughterboard->bootinfo.modify_dtb = vexpress_modify_dtb;", "daughterboard->bootinfo.secure_boot = true;", "arm_load_kernel(ARM_CPU(first_cpu), &daughterboard->bootinfo);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59, 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 171, 173 ], [ 175, 177 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 199 ], [ 207 ], [ 215 ], [ 219 ], [ 221, 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 239 ], [ 241, 243 ], [ 245 ], [ 247 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 261 ], [ 265 ], [ 267, 269 ], [ 271 ], [ 273 ], [ 277 ], [ 279, 281 ], [ 283 ], [ 285 ], [ 291 ], [ 293 ], [ 295 ], [ 315 ], [ 317, 319 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 349 ], [ 351 ], [ 353 ] ]
21,705
static int vnc_set_gnutls_priority(gnutls_session_t s, int x509) { const char *priority = x509 ? "NORMAL" : "NORMAL:+ANON-DH"; int rc; rc = gnutls_priority_set_direct(s, priority, NULL); if (rc != GNUTLS_E_SUCCESS) { return -1; } return 0; }
true
qemu
3e305e4a4752f70c0b5c3cf5b43ec957881714f7
static int vnc_set_gnutls_priority(gnutls_session_t s, int x509) { const char *priority = x509 ? "NORMAL" : "NORMAL:+ANON-DH"; int rc; rc = gnutls_priority_set_direct(s, priority, NULL); if (rc != GNUTLS_E_SUCCESS) { return -1; } return 0; }
{ "code": [ " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return 0;", "static int vnc_set_gnutls_priority(gnutls_session_t s, int x509)", " const char *priority = x509 ? \"NORMAL\" : \"NORMAL:+ANON-DH\";", " int rc;", " rc = gnutls_priority_set_direct(s, priority, NULL);", " if (rc != GNUTLS_E_SUCCESS) {", " return -1;", " return 0;", "static int vnc_set_gnutls_priority(gnutls_session_t s, int x509)", " int rc;", " if (rc != GNUTLS_E_SUCCESS) {", " return -1;", " if (rc != GNUTLS_E_SUCCESS) {", " return -1;", " if (rc != GNUTLS_E_SUCCESS) {", " return -1;", " return 0;", " return -1;", " return 0;", " return -1;", " return 0;", " return 0;", " return -1;" ], "line_no": [ 15, 15, 15, 15, 15, 15, 15, 19, 1, 5, 7, 11, 13, 15, 19, 1, 7, 13, 15, 13, 15, 13, 15, 19, 15, 19, 15, 19, 19, 15 ] }
static int FUNC_0(gnutls_session_t VAR_0, int VAR_1) { const char *VAR_2 = VAR_1 ? "NORMAL" : "NORMAL:+ANON-DH"; int VAR_3; VAR_3 = gnutls_priority_set_direct(VAR_0, VAR_2, NULL); if (VAR_3 != GNUTLS_E_SUCCESS) { return -1; } return 0; }
[ "static int FUNC_0(gnutls_session_t VAR_0, int VAR_1)\n{", "const char *VAR_2 = VAR_1 ? \"NORMAL\" : \"NORMAL:+ANON-DH\";", "int VAR_3;", "VAR_3 = gnutls_priority_set_direct(VAR_0, VAR_2, NULL);", "if (VAR_3 != GNUTLS_E_SUCCESS) {", "return -1;", "}", "return 0;", "}" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
21,706
static void vfio_platform_eoi(VFIODevice *vbasedev) { VFIOINTp *intp; VFIOPlatformDevice *vdev = container_of(vbasedev, VFIOPlatformDevice, vbasedev); qemu_mutex_lock(&vdev->intp_mutex); QLIST_FOREACH(intp, &vdev->intp_list, next) { if (intp->state == VFIO_IRQ_ACTIVE) { trace_vfio_platform_eoi(intp->pin, event_notifier_get_fd(intp->interrupt)); intp->state = VFIO_IRQ_INACTIVE; /* deassert the virtual IRQ */ qemu_set_irq(intp->qemuirq, 0); if (intp->flags & VFIO_IRQ_INFO_AUTOMASKED) { /* unmasks the physical level-sensitive IRQ */ vfio_unmask_single_irqindex(vbasedev, intp->pin); } /* a single IRQ can be active at a time */ break; } } /* in case there are pending IRQs, handle the first one */ if (!QSIMPLEQ_EMPTY(&vdev->pending_intp_queue)) { intp = QSIMPLEQ_FIRST(&vdev->pending_intp_queue); vfio_intp_inject_pending_lockheld(intp); QSIMPLEQ_REMOVE_HEAD(&vdev->pending_intp_queue, pqnext); } qemu_mutex_unlock(&vdev->intp_mutex); }
true
qemu
a5b39cd3f647eaaaef5b648beda5cb2f387418c0
static void vfio_platform_eoi(VFIODevice *vbasedev) { VFIOINTp *intp; VFIOPlatformDevice *vdev = container_of(vbasedev, VFIOPlatformDevice, vbasedev); qemu_mutex_lock(&vdev->intp_mutex); QLIST_FOREACH(intp, &vdev->intp_list, next) { if (intp->state == VFIO_IRQ_ACTIVE) { trace_vfio_platform_eoi(intp->pin, event_notifier_get_fd(intp->interrupt)); intp->state = VFIO_IRQ_INACTIVE; qemu_set_irq(intp->qemuirq, 0); if (intp->flags & VFIO_IRQ_INFO_AUTOMASKED) { vfio_unmask_single_irqindex(vbasedev, intp->pin); } break; } } if (!QSIMPLEQ_EMPTY(&vdev->pending_intp_queue)) { intp = QSIMPLEQ_FIRST(&vdev->pending_intp_queue); vfio_intp_inject_pending_lockheld(intp); QSIMPLEQ_REMOVE_HEAD(&vdev->pending_intp_queue, pqnext); } qemu_mutex_unlock(&vdev->intp_mutex); }
{ "code": [ " if (intp->flags & VFIO_IRQ_INFO_AUTOMASKED) {" ], "line_no": [ 33 ] }
static void FUNC_0(VFIODevice *VAR_0) { VFIOINTp *intp; VFIOPlatformDevice *vdev = container_of(VAR_0, VFIOPlatformDevice, VAR_0); qemu_mutex_lock(&vdev->intp_mutex); QLIST_FOREACH(intp, &vdev->intp_list, next) { if (intp->state == VFIO_IRQ_ACTIVE) { trace_vfio_platform_eoi(intp->pin, event_notifier_get_fd(intp->interrupt)); intp->state = VFIO_IRQ_INACTIVE; qemu_set_irq(intp->qemuirq, 0); if (intp->flags & VFIO_IRQ_INFO_AUTOMASKED) { vfio_unmask_single_irqindex(VAR_0, intp->pin); } break; } } if (!QSIMPLEQ_EMPTY(&vdev->pending_intp_queue)) { intp = QSIMPLEQ_FIRST(&vdev->pending_intp_queue); vfio_intp_inject_pending_lockheld(intp); QSIMPLEQ_REMOVE_HEAD(&vdev->pending_intp_queue, pqnext); } qemu_mutex_unlock(&vdev->intp_mutex); }
[ "static void FUNC_0(VFIODevice *VAR_0)\n{", "VFIOINTp *intp;", "VFIOPlatformDevice *vdev =\ncontainer_of(VAR_0, VFIOPlatformDevice, VAR_0);", "qemu_mutex_lock(&vdev->intp_mutex);", "QLIST_FOREACH(intp, &vdev->intp_list, next) {", "if (intp->state == VFIO_IRQ_ACTIVE) {", "trace_vfio_platform_eoi(intp->pin,\nevent_notifier_get_fd(intp->interrupt));", "intp->state = VFIO_IRQ_INACTIVE;", "qemu_set_irq(intp->qemuirq, 0);", "if (intp->flags & VFIO_IRQ_INFO_AUTOMASKED) {", "vfio_unmask_single_irqindex(VAR_0, intp->pin);", "}", "break;", "}", "}", "if (!QSIMPLEQ_EMPTY(&vdev->pending_intp_queue)) {", "intp = QSIMPLEQ_FIRST(&vdev->pending_intp_queue);", "vfio_intp_inject_pending_lockheld(intp);", "QSIMPLEQ_REMOVE_HEAD(&vdev->pending_intp_queue, pqnext);", "}", "qemu_mutex_unlock(&vdev->intp_mutex);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ] ]
21,707
static void qxl_enter_vga_mode(PCIQXLDevice *d) { if (d->mode == QXL_MODE_VGA) { return; } trace_qxl_enter_vga_mode(d->id); #if SPICE_SERVER_VERSION >= 0x000c03 /* release 0.12.3 */ spice_qxl_driver_unload(&d->ssd.qxl); #endif graphic_console_set_hwops(d->ssd.dcl.con, d->vga.hw_ops, &d->vga); update_displaychangelistener(&d->ssd.dcl, GUI_REFRESH_INTERVAL_DEFAULT); qemu_spice_create_host_primary(&d->ssd); d->mode = QXL_MODE_VGA; vga_dirty_log_start(&d->vga); graphic_hw_update(d->vga.con); }
true
qemu
a703d3aef5991b72a5a45880e7491232b8032f09
static void qxl_enter_vga_mode(PCIQXLDevice *d) { if (d->mode == QXL_MODE_VGA) { return; } trace_qxl_enter_vga_mode(d->id); #if SPICE_SERVER_VERSION >= 0x000c03 spice_qxl_driver_unload(&d->ssd.qxl); #endif graphic_console_set_hwops(d->ssd.dcl.con, d->vga.hw_ops, &d->vga); update_displaychangelistener(&d->ssd.dcl, GUI_REFRESH_INTERVAL_DEFAULT); qemu_spice_create_host_primary(&d->ssd); d->mode = QXL_MODE_VGA; vga_dirty_log_start(&d->vga); graphic_hw_update(d->vga.con); }
{ "code": [], "line_no": [] }
static void FUNC_0(PCIQXLDevice *VAR_0) { if (VAR_0->mode == QXL_MODE_VGA) { return; } trace_qxl_enter_vga_mode(VAR_0->id); #if SPICE_SERVER_VERSION >= 0x000c03 spice_qxl_driver_unload(&VAR_0->ssd.qxl); #endif graphic_console_set_hwops(VAR_0->ssd.dcl.con, VAR_0->vga.hw_ops, &VAR_0->vga); update_displaychangelistener(&VAR_0->ssd.dcl, GUI_REFRESH_INTERVAL_DEFAULT); qemu_spice_create_host_primary(&VAR_0->ssd); VAR_0->mode = QXL_MODE_VGA; vga_dirty_log_start(&VAR_0->vga); graphic_hw_update(VAR_0->vga.con); }
[ "static void FUNC_0(PCIQXLDevice *VAR_0)\n{", "if (VAR_0->mode == QXL_MODE_VGA) {", "return;", "}", "trace_qxl_enter_vga_mode(VAR_0->id);", "#if SPICE_SERVER_VERSION >= 0x000c03\nspice_qxl_driver_unload(&VAR_0->ssd.qxl);", "#endif\ngraphic_console_set_hwops(VAR_0->ssd.dcl.con, VAR_0->vga.hw_ops, &VAR_0->vga);", "update_displaychangelistener(&VAR_0->ssd.dcl, GUI_REFRESH_INTERVAL_DEFAULT);", "qemu_spice_create_host_primary(&VAR_0->ssd);", "VAR_0->mode = QXL_MODE_VGA;", "vga_dirty_log_start(&VAR_0->vga);", "graphic_hw_update(VAR_0->vga.con);", "}" ]
[ 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 ], [ 28 ], [ 30 ], [ 32 ] ]
21,709
static int mov_read_smi(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; if ((uint64_t)atom.size > (1<<30)) return AVERROR_INVALIDDATA; // currently SVQ3 decoder expect full STSD header - so let's fake it // this should be fixed and just SMI header should be passed av_free(st->codec->extradata); st->codec->extradata = av_mallocz(atom.size + 0x5a + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = 0x5a + atom.size; memcpy(st->codec->extradata, "SVQ3", 4); // fake avio_read(pb, st->codec->extradata + 0x5a, atom.size); av_log(c->fc, AV_LOG_TRACE, "Reading SMI %"PRId64" %s\n", atom.size, st->codec->extradata + 0x5a); return 0; }
true
FFmpeg
5c720657c23afd798ae0db7c7362eb859a89ab3d
static int mov_read_smi(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; if ((uint64_t)atom.size > (1<<30)) return AVERROR_INVALIDDATA; av_free(st->codec->extradata); st->codec->extradata = av_mallocz(atom.size + 0x5a + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = 0x5a + atom.size; memcpy(st->codec->extradata, "SVQ3", 4); avio_read(pb, st->codec->extradata + 0x5a, atom.size); av_log(c->fc, AV_LOG_TRACE, "Reading SMI %"PRId64" %s\n", atom.size, st->codec->extradata + 0x5a); return 0; }
{ "code": [ " avio_read(pb, st->codec->extradata + 0x5a, atom.size);", " return AVERROR_INVALIDDATA;" ], "line_no": [ 39, 19 ] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; if ((uint64_t)VAR_2.size > (1<<30)) return AVERROR_INVALIDDATA; av_free(st->codec->extradata); st->codec->extradata = av_mallocz(VAR_2.size + 0x5a + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = 0x5a + VAR_2.size; memcpy(st->codec->extradata, "SVQ3", 4); avio_read(VAR_1, st->codec->extradata + 0x5a, VAR_2.size); av_log(VAR_0->fc, AV_LOG_TRACE, "Reading SMI %"PRId64" %s\n", VAR_2.size, st->codec->extradata + 0x5a); return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "if ((uint64_t)VAR_2.size > (1<<30))\nreturn AVERROR_INVALIDDATA;", "av_free(st->codec->extradata);", "st->codec->extradata = av_mallocz(VAR_2.size + 0x5a + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!st->codec->extradata)\nreturn AVERROR(ENOMEM);", "st->codec->extradata_size = 0x5a + VAR_2.size;", "memcpy(st->codec->extradata, \"SVQ3\", 4);", "avio_read(VAR_1, st->codec->extradata + 0x5a, VAR_2.size);", "av_log(VAR_0->fc, AV_LOG_TRACE, \"Reading SMI %\"PRId64\" %s\\n\", VAR_2.size, st->codec->extradata + 0x5a);", "return 0;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 17, 19 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
21,710
AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) { AVFilterFormats *ret; unsigned i, j, k = 0; ret = av_mallocz(sizeof(AVFilterFormats)); /* merge list of formats */ ret->formats = av_malloc(sizeof(*ret->formats) * FFMIN(a->format_count, b->format_count)); for(i = 0; i < a->format_count; i ++) for(j = 0; j < b->format_count; j ++) if(a->formats[i] == b->formats[j]) ret->formats[k++] = a->formats[i]; /* check that there was at least one common format */ if(!(ret->format_count = k)) { av_free(ret->formats); av_free(ret); return NULL; } /* merge and update all the references */ ret->refs = av_malloc(sizeof(AVFilterFormats**)*(a->refcount+b->refcount)); for(i = 0; i < a->refcount; i ++) { ret->refs[ret->refcount] = a->refs[i]; *ret->refs[ret->refcount++] = ret; } for(i = 0; i < b->refcount; i ++) { ret->refs[ret->refcount] = b->refs[i]; *ret->refs[ret->refcount++] = ret; } av_free(a->refs); av_free(a->formats); av_free(a); av_free(b->refs); av_free(b->formats); av_free(b); return ret; }
false
FFmpeg
37e0b997a8d6695abb0dd4bac886a86104d68a3c
AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) { AVFilterFormats *ret; unsigned i, j, k = 0; ret = av_mallocz(sizeof(AVFilterFormats)); ret->formats = av_malloc(sizeof(*ret->formats) * FFMIN(a->format_count, b->format_count)); for(i = 0; i < a->format_count; i ++) for(j = 0; j < b->format_count; j ++) if(a->formats[i] == b->formats[j]) ret->formats[k++] = a->formats[i]; if(!(ret->format_count = k)) { av_free(ret->formats); av_free(ret); return NULL; } ret->refs = av_malloc(sizeof(AVFilterFormats**)*(a->refcount+b->refcount)); for(i = 0; i < a->refcount; i ++) { ret->refs[ret->refcount] = a->refs[i]; *ret->refs[ret->refcount++] = ret; } for(i = 0; i < b->refcount; i ++) { ret->refs[ret->refcount] = b->refs[i]; *ret->refs[ret->refcount++] = ret; } av_free(a->refs); av_free(a->formats); av_free(a); av_free(b->refs); av_free(b->formats); av_free(b); return ret; }
{ "code": [], "line_no": [] }
AVFilterFormats *FUNC_0(AVFilterFormats *a, AVFilterFormats *b) { AVFilterFormats *ret; unsigned VAR_0, VAR_1, VAR_2 = 0; ret = av_mallocz(sizeof(AVFilterFormats)); ret->formats = av_malloc(sizeof(*ret->formats) * FFMIN(a->format_count, b->format_count)); for(VAR_0 = 0; VAR_0 < a->format_count; VAR_0 ++) for(VAR_1 = 0; VAR_1 < b->format_count; VAR_1 ++) if(a->formats[VAR_0] == b->formats[VAR_1]) ret->formats[VAR_2++] = a->formats[VAR_0]; if(!(ret->format_count = VAR_2)) { av_free(ret->formats); av_free(ret); return NULL; } ret->refs = av_malloc(sizeof(AVFilterFormats**)*(a->refcount+b->refcount)); for(VAR_0 = 0; VAR_0 < a->refcount; VAR_0 ++) { ret->refs[ret->refcount] = a->refs[VAR_0]; *ret->refs[ret->refcount++] = ret; } for(VAR_0 = 0; VAR_0 < b->refcount; VAR_0 ++) { ret->refs[ret->refcount] = b->refs[VAR_0]; *ret->refs[ret->refcount++] = ret; } av_free(a->refs); av_free(a->formats); av_free(a); av_free(b->refs); av_free(b->formats); av_free(b); return ret; }
[ "AVFilterFormats *FUNC_0(AVFilterFormats *a, AVFilterFormats *b)\n{", "AVFilterFormats *ret;", "unsigned VAR_0, VAR_1, VAR_2 = 0;", "ret = av_mallocz(sizeof(AVFilterFormats));", "ret->formats = av_malloc(sizeof(*ret->formats) * FFMIN(a->format_count,\nb->format_count));", "for(VAR_0 = 0; VAR_0 < a->format_count; VAR_0 ++)", "for(VAR_1 = 0; VAR_1 < b->format_count; VAR_1 ++)", "if(a->formats[VAR_0] == b->formats[VAR_1])\nret->formats[VAR_2++] = a->formats[VAR_0];", "if(!(ret->format_count = VAR_2)) {", "av_free(ret->formats);", "av_free(ret);", "return NULL;", "}", "ret->refs = av_malloc(sizeof(AVFilterFormats**)*(a->refcount+b->refcount));", "for(VAR_0 = 0; VAR_0 < a->refcount; VAR_0 ++) {", "ret->refs[ret->refcount] = a->refs[VAR_0];", "*ret->refs[ret->refcount++] = ret;", "}", "for(VAR_0 = 0; VAR_0 < b->refcount; VAR_0 ++) {", "ret->refs[ret->refcount] = b->refs[VAR_0];", "*ret->refs[ret->refcount++] = ret;", "}", "av_free(a->refs);", "av_free(a->formats);", "av_free(a);", "av_free(b->refs);", "av_free(b->formats);", "av_free(b);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ] ]
21,711
static void rv40_v_loop_filter(uint8_t *src, int stride, int dmode, int lim_q1, int lim_p1, int alpha, int beta, int beta2, int chroma, int edge){ rv40_adaptive_loop_filter(src, 1, stride, dmode, lim_q1, lim_p1, alpha, beta, beta2, chroma, edge); }
false
FFmpeg
d8edf1b515ae9fbcea2103305241d130c16e1003
static void rv40_v_loop_filter(uint8_t *src, int stride, int dmode, int lim_q1, int lim_p1, int alpha, int beta, int beta2, int chroma, int edge){ rv40_adaptive_loop_filter(src, 1, stride, dmode, lim_q1, lim_p1, alpha, beta, beta2, chroma, edge); }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8, int VAR_9){ rv40_adaptive_loop_filter(VAR_0, 1, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9); }
[ "static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4,\nint VAR_5, int VAR_6, int VAR_7, int VAR_8, int VAR_9){", "rv40_adaptive_loop_filter(VAR_0, 1, VAR_1, VAR_2, VAR_3, VAR_4,\nVAR_5, VAR_6, VAR_7, VAR_8, VAR_9);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ] ]
21,712
static void lfe_downsample(DCAEncContext *c, const int32_t *input) { /* FIXME: make 128x LFE downsampling possible */ const int lfech = lfe_index[c->channel_config]; int i, j, lfes; int32_t hist[512]; int32_t accum; int hist_start = 0; for (i = 0; i < 512; i++) hist[i] = c->history[i][c->channels - 1]; for (lfes = 0; lfes < DCA_LFE_SAMPLES; lfes++) { /* Calculate the convolution */ accum = 0; for (i = hist_start, j = 0; i < 512; i++, j++) accum += mul32(hist[i], lfe_fir_64i[j]); for (i = 0; i < hist_start; i++, j++) accum += mul32(hist[i], lfe_fir_64i[j]); c->downsampled_lfe[lfes] = accum; /* Copy in 64 new samples from input */ for (i = 0; i < 64; i++) hist[i + hist_start] = input[(lfes * 64 + i) * c->channels + lfech]; hist_start = (hist_start + 64) & 511; } }
false
FFmpeg
a6191d098a03f94685ae4c072bfdf10afcd86223
static void lfe_downsample(DCAEncContext *c, const int32_t *input) { const int lfech = lfe_index[c->channel_config]; int i, j, lfes; int32_t hist[512]; int32_t accum; int hist_start = 0; for (i = 0; i < 512; i++) hist[i] = c->history[i][c->channels - 1]; for (lfes = 0; lfes < DCA_LFE_SAMPLES; lfes++) { accum = 0; for (i = hist_start, j = 0; i < 512; i++, j++) accum += mul32(hist[i], lfe_fir_64i[j]); for (i = 0; i < hist_start; i++, j++) accum += mul32(hist[i], lfe_fir_64i[j]); c->downsampled_lfe[lfes] = accum; for (i = 0; i < 64; i++) hist[i + hist_start] = input[(lfes * 64 + i) * c->channels + lfech]; hist_start = (hist_start + 64) & 511; } }
{ "code": [], "line_no": [] }
static void FUNC_0(DCAEncContext *VAR_0, const int32_t *VAR_1) { const int VAR_2 = lfe_index[VAR_0->channel_config]; int VAR_3, VAR_4, VAR_5; int32_t hist[512]; int32_t accum; int VAR_6 = 0; for (VAR_3 = 0; VAR_3 < 512; VAR_3++) hist[VAR_3] = VAR_0->history[VAR_3][VAR_0->channels - 1]; for (VAR_5 = 0; VAR_5 < DCA_LFE_SAMPLES; VAR_5++) { accum = 0; for (VAR_3 = VAR_6, VAR_4 = 0; VAR_3 < 512; VAR_3++, VAR_4++) accum += mul32(hist[VAR_3], lfe_fir_64i[VAR_4]); for (VAR_3 = 0; VAR_3 < VAR_6; VAR_3++, VAR_4++) accum += mul32(hist[VAR_3], lfe_fir_64i[VAR_4]); VAR_0->downsampled_lfe[VAR_5] = accum; for (VAR_3 = 0; VAR_3 < 64; VAR_3++) hist[VAR_3 + VAR_6] = VAR_1[(VAR_5 * 64 + VAR_3) * VAR_0->channels + VAR_2]; VAR_6 = (VAR_6 + 64) & 511; } }
[ "static void FUNC_0(DCAEncContext *VAR_0, const int32_t *VAR_1)\n{", "const int VAR_2 = lfe_index[VAR_0->channel_config];", "int VAR_3, VAR_4, VAR_5;", "int32_t hist[512];", "int32_t accum;", "int VAR_6 = 0;", "for (VAR_3 = 0; VAR_3 < 512; VAR_3++)", "hist[VAR_3] = VAR_0->history[VAR_3][VAR_0->channels - 1];", "for (VAR_5 = 0; VAR_5 < DCA_LFE_SAMPLES; VAR_5++) {", "accum = 0;", "for (VAR_3 = VAR_6, VAR_4 = 0; VAR_3 < 512; VAR_3++, VAR_4++)", "accum += mul32(hist[VAR_3], lfe_fir_64i[VAR_4]);", "for (VAR_3 = 0; VAR_3 < VAR_6; VAR_3++, VAR_4++)", "accum += mul32(hist[VAR_3], lfe_fir_64i[VAR_4]);", "VAR_0->downsampled_lfe[VAR_5] = accum;", "for (VAR_3 = 0; VAR_3 < 64; VAR_3++)", "hist[VAR_3 + VAR_6] = VAR_1[(VAR_5 * 64 + VAR_3) * VAR_0->channels + VAR_2];", "VAR_6 = (VAR_6 + 64) & 511;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ] ]
21,713
static int indeo3_decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { Indeo3DecodeContext *s=avctx->priv_data; uint8_t *src, *dest; int y; iv_decode_frame(s, buf, buf_size); if(s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); s->frame.reference = 0; if(avctx->get_buffer(avctx, &s->frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } src = s->cur_frame->Ybuf; dest = s->frame.data[0]; for (y = 0; y < s->height; y++) { memcpy(dest, src, s->cur_frame->y_w); src += s->cur_frame->y_w; dest += s->frame.linesize[0]; } if (!(s->avctx->flags & CODEC_FLAG_GRAY)) { src = s->cur_frame->Ubuf; dest = s->frame.data[1]; for (y = 0; y < s->height / 4; y++) { memcpy(dest, src, s->cur_frame->uv_w); src += s->cur_frame->uv_w; dest += s->frame.linesize[1]; } src = s->cur_frame->Vbuf; dest = s->frame.data[2]; for (y = 0; y < s->height / 4; y++) { memcpy(dest, src, s->cur_frame->uv_w); src += s->cur_frame->uv_w; dest += s->frame.linesize[2]; } } *data_size=sizeof(AVFrame); *(AVFrame*)data= s->frame; return buf_size; }
false
FFmpeg
274aa1d02f12aba969b280139cf79907134dcd89
static int indeo3_decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { Indeo3DecodeContext *s=avctx->priv_data; uint8_t *src, *dest; int y; iv_decode_frame(s, buf, buf_size); if(s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); s->frame.reference = 0; if(avctx->get_buffer(avctx, &s->frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } src = s->cur_frame->Ybuf; dest = s->frame.data[0]; for (y = 0; y < s->height; y++) { memcpy(dest, src, s->cur_frame->y_w); src += s->cur_frame->y_w; dest += s->frame.linesize[0]; } if (!(s->avctx->flags & CODEC_FLAG_GRAY)) { src = s->cur_frame->Ubuf; dest = s->frame.data[1]; for (y = 0; y < s->height / 4; y++) { memcpy(dest, src, s->cur_frame->uv_w); src += s->cur_frame->uv_w; dest += s->frame.linesize[1]; } src = s->cur_frame->Vbuf; dest = s->frame.data[2]; for (y = 0; y < s->height / 4; y++) { memcpy(dest, src, s->cur_frame->uv_w); src += s->cur_frame->uv_w; dest += s->frame.linesize[2]; } } *data_size=sizeof(AVFrame); *(AVFrame*)data= s->frame; return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, const uint8_t *VAR_3, int VAR_4) { Indeo3DecodeContext *s=VAR_0->priv_data; uint8_t *src, *dest; int VAR_5; iv_decode_frame(s, VAR_3, VAR_4); if(s->frame.VAR_1[0]) VAR_0->release_buffer(VAR_0, &s->frame); s->frame.reference = 0; if(VAR_0->get_buffer(VAR_0, &s->frame) < 0) { av_log(s->VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } src = s->cur_frame->Ybuf; dest = s->frame.VAR_1[0]; for (VAR_5 = 0; VAR_5 < s->height; VAR_5++) { memcpy(dest, src, s->cur_frame->y_w); src += s->cur_frame->y_w; dest += s->frame.linesize[0]; } if (!(s->VAR_0->flags & CODEC_FLAG_GRAY)) { src = s->cur_frame->Ubuf; dest = s->frame.VAR_1[1]; for (VAR_5 = 0; VAR_5 < s->height / 4; VAR_5++) { memcpy(dest, src, s->cur_frame->uv_w); src += s->cur_frame->uv_w; dest += s->frame.linesize[1]; } src = s->cur_frame->Vbuf; dest = s->frame.VAR_1[2]; for (VAR_5 = 0; VAR_5 < s->height / 4; VAR_5++) { memcpy(dest, src, s->cur_frame->uv_w); src += s->cur_frame->uv_w; dest += s->frame.linesize[2]; } } *VAR_2=sizeof(AVFrame); *(AVFrame*)VAR_1= s->frame; return VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nconst uint8_t *VAR_3, int VAR_4)\n{", "Indeo3DecodeContext *s=VAR_0->priv_data;", "uint8_t *src, *dest;", "int VAR_5;", "iv_decode_frame(s, VAR_3, VAR_4);", "if(s->frame.VAR_1[0])\nVAR_0->release_buffer(VAR_0, &s->frame);", "s->frame.reference = 0;", "if(VAR_0->get_buffer(VAR_0, &s->frame) < 0) {", "av_log(s->VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return -1;", "}", "src = s->cur_frame->Ybuf;", "dest = s->frame.VAR_1[0];", "for (VAR_5 = 0; VAR_5 < s->height; VAR_5++) {", "memcpy(dest, src, s->cur_frame->y_w);", "src += s->cur_frame->y_w;", "dest += s->frame.linesize[0];", "}", "if (!(s->VAR_0->flags & CODEC_FLAG_GRAY))\n{", "src = s->cur_frame->Ubuf;", "dest = s->frame.VAR_1[1];", "for (VAR_5 = 0; VAR_5 < s->height / 4; VAR_5++) {", "memcpy(dest, src, s->cur_frame->uv_w);", "src += s->cur_frame->uv_w;", "dest += s->frame.linesize[1];", "}", "src = s->cur_frame->Vbuf;", "dest = s->frame.VAR_1[2];", "for (VAR_5 = 0; VAR_5 < s->height / 4; VAR_5++) {", "memcpy(dest, src, s->cur_frame->uv_w);", "src += s->cur_frame->uv_w;", "dest += s->frame.linesize[2];", "}", "}", "*VAR_2=sizeof(AVFrame);", "*(AVFrame*)VAR_1= s->frame;", "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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ] ]
21,714
static void filter_mb_edgech( H264Context *h, uint8_t *pix, int stride, int bS[4], int qp ) { int i, d; const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); const int alpha = alpha_table[index_a]; const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; const int pix_next = stride; for( i = 0; i < 4; i++ ) { if( bS[i] == 0 ) { pix += 2; continue; } /* 2px edge length (see deblocking_filter_edgecv) */ for( d = 0; d < 2; d++ ) { const uint8_t p0 = pix[-1*pix_next]; const uint8_t p1 = pix[-2*pix_next]; const uint8_t q0 = pix[0]; const uint8_t q1 = pix[1*pix_next]; if( abs( p0 - q0 ) >= alpha || abs( p1 - p0 ) >= beta || abs( q1 - q0 ) >= beta ) { pix++; continue; } if( bS[i] < 4 ) { int tc = tc0_table[index_a][bS[i] - 1] + 1; int i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); pix[-pix_next] = clip( p0 + i_delta, 0, 255 ); /* p0' */ pix[0] = clip( q0 - i_delta, 0, 255 ); /* q0' */ } else { pix[-pix_next] = ( 2*p1 + p0 + q1 + 2 ) >> 2; /* p0' */ pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; /* q0' */ } pix++; } } }
false
FFmpeg
3ebc7e04dea6072400d91c1c90eb3911754cee06
static void filter_mb_edgech( H264Context *h, uint8_t *pix, int stride, int bS[4], int qp ) { int i, d; const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); const int alpha = alpha_table[index_a]; const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; const int pix_next = stride; for( i = 0; i < 4; i++ ) { if( bS[i] == 0 ) { pix += 2; continue; } for( d = 0; d < 2; d++ ) { const uint8_t p0 = pix[-1*pix_next]; const uint8_t p1 = pix[-2*pix_next]; const uint8_t q0 = pix[0]; const uint8_t q1 = pix[1*pix_next]; if( abs( p0 - q0 ) >= alpha || abs( p1 - p0 ) >= beta || abs( q1 - q0 ) >= beta ) { pix++; continue; } if( bS[i] < 4 ) { int tc = tc0_table[index_a][bS[i] - 1] + 1; int i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); pix[-pix_next] = clip( p0 + i_delta, 0, 255 ); pix[0] = clip( q0 - i_delta, 0, 255 ); } else { pix[-pix_next] = ( 2*p1 + p0 + q1 + 2 ) >> 2; pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; } pix++; } } }
{ "code": [], "line_no": [] }
static void FUNC_0( H264Context *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3[4], int VAR_4 ) { int VAR_5, VAR_6; const int VAR_7 = clip( VAR_4 + VAR_0->slice_alpha_c0_offset, 0, 51 ); const int VAR_8 = alpha_table[VAR_7]; const int VAR_9 = beta_table[clip( VAR_4 + VAR_0->slice_beta_offset, 0, 51 )]; const int VAR_10 = VAR_2; for( VAR_5 = 0; VAR_5 < 4; VAR_5++ ) { if( VAR_3[VAR_5] == 0 ) { VAR_1 += 2; continue; } for( VAR_6 = 0; VAR_6 < 2; VAR_6++ ) { const uint8_t VAR_11 = VAR_1[-1*VAR_10]; const uint8_t VAR_12 = VAR_1[-2*VAR_10]; const uint8_t VAR_13 = VAR_1[0]; const uint8_t VAR_14 = VAR_1[1*VAR_10]; if( abs( VAR_11 - VAR_13 ) >= VAR_8 || abs( VAR_12 - VAR_11 ) >= VAR_9 || abs( VAR_14 - VAR_13 ) >= VAR_9 ) { VAR_1++; continue; } if( VAR_3[VAR_5] < 4 ) { int VAR_15 = tc0_table[VAR_7][VAR_3[VAR_5] - 1] + 1; int VAR_16 = clip( (((VAR_13 - VAR_11 ) << 2) + (VAR_12 - VAR_14) + 4) >> 3, -VAR_15, VAR_15 ); VAR_1[-VAR_10] = clip( VAR_11 + VAR_16, 0, 255 ); VAR_1[0] = clip( VAR_13 - VAR_16, 0, 255 ); } else { VAR_1[-VAR_10] = ( 2*VAR_12 + VAR_11 + VAR_14 + 2 ) >> 2; VAR_1[0] = ( 2*VAR_14 + VAR_13 + VAR_12 + 2 ) >> 2; } VAR_1++; } } }
[ "static void FUNC_0( H264Context *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3[4], int VAR_4 ) {", "int VAR_5, VAR_6;", "const int VAR_7 = clip( VAR_4 + VAR_0->slice_alpha_c0_offset, 0, 51 );", "const int VAR_8 = alpha_table[VAR_7];", "const int VAR_9 = beta_table[clip( VAR_4 + VAR_0->slice_beta_offset, 0, 51 )];", "const int VAR_10 = VAR_2;", "for( VAR_5 = 0; VAR_5 < 4; VAR_5++ )", "{", "if( VAR_3[VAR_5] == 0 ) {", "VAR_1 += 2;", "continue;", "}", "for( VAR_6 = 0; VAR_6 < 2; VAR_6++ ) {", "const uint8_t VAR_11 = VAR_1[-1*VAR_10];", "const uint8_t VAR_12 = VAR_1[-2*VAR_10];", "const uint8_t VAR_13 = VAR_1[0];", "const uint8_t VAR_14 = VAR_1[1*VAR_10];", "if( abs( VAR_11 - VAR_13 ) >= VAR_8 ||\nabs( VAR_12 - VAR_11 ) >= VAR_9 ||\nabs( VAR_14 - VAR_13 ) >= VAR_9 ) {", "VAR_1++;", "continue;", "}", "if( VAR_3[VAR_5] < 4 ) {", "int VAR_15 = tc0_table[VAR_7][VAR_3[VAR_5] - 1] + 1;", "int VAR_16 = clip( (((VAR_13 - VAR_11 ) << 2) + (VAR_12 - VAR_14) + 4) >> 3, -VAR_15, VAR_15 );", "VAR_1[-VAR_10] = clip( VAR_11 + VAR_16, 0, 255 );", "VAR_1[0] = clip( VAR_13 - VAR_16, 0, 255 );", "}", "else\n{", "VAR_1[-VAR_10] = ( 2*VAR_12 + VAR_11 + VAR_14 + 2 ) >> 2;", "VAR_1[0] = ( 2*VAR_14 + VAR_13 + VAR_12 + 2 ) >> 2;", "}", "VAR_1++;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ] ]
21,715
void aio_context_unref(AioContext *ctx) { g_source_unref(&ctx->source); }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
void aio_context_unref(AioContext *ctx) { g_source_unref(&ctx->source); }
{ "code": [], "line_no": [] }
void FUNC_0(AioContext *VAR_0) { g_source_unref(&VAR_0->source); }
[ "void FUNC_0(AioContext *VAR_0)\n{", "g_source_unref(&VAR_0->source);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
21,716
static void handle_hint(DisasContext *s, uint32_t insn, unsigned int op1, unsigned int op2, unsigned int crm) { unsigned int selector = crm << 3 | op2; if (op1 != 3) { unallocated_encoding(s); return; } switch (selector) { case 0: /* NOP */ return; case 3: /* WFI */ s->base.is_jmp = DISAS_WFI; return; case 1: /* YIELD */ if (!parallel_cpus) { s->base.is_jmp = DISAS_YIELD; } return; case 2: /* WFE */ if (!parallel_cpus) { s->base.is_jmp = DISAS_WFE; } return; case 4: /* SEV */ case 5: /* SEVL */ /* we treat all as NOP at least for now */ return; default: /* default specified as NOP equivalent */ return; } }
false
qemu
2399d4e7cec22ecf1c51062d2ebfd45220dbaace
static void handle_hint(DisasContext *s, uint32_t insn, unsigned int op1, unsigned int op2, unsigned int crm) { unsigned int selector = crm << 3 | op2; if (op1 != 3) { unallocated_encoding(s); return; } switch (selector) { case 0: return; case 3: s->base.is_jmp = DISAS_WFI; return; case 1: if (!parallel_cpus) { s->base.is_jmp = DISAS_YIELD; } return; case 2: if (!parallel_cpus) { s->base.is_jmp = DISAS_WFE; } return; case 4: case 5: return; default: return; } }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1, unsigned int VAR_2, unsigned int VAR_3, unsigned int VAR_4) { unsigned int VAR_5 = VAR_4 << 3 | VAR_3; if (VAR_2 != 3) { unallocated_encoding(VAR_0); return; } switch (VAR_5) { case 0: return; case 3: VAR_0->base.is_jmp = DISAS_WFI; return; case 1: if (!parallel_cpus) { VAR_0->base.is_jmp = DISAS_YIELD; } return; case 2: if (!parallel_cpus) { VAR_0->base.is_jmp = DISAS_WFE; } return; case 4: case 5: return; default: return; } }
[ "static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1,\nunsigned int VAR_2, unsigned int VAR_3, unsigned int VAR_4)\n{", "unsigned int VAR_5 = VAR_4 << 3 | VAR_3;", "if (VAR_2 != 3) {", "unallocated_encoding(VAR_0);", "return;", "}", "switch (VAR_5) {", "case 0:\nreturn;", "case 3:\nVAR_0->base.is_jmp = DISAS_WFI;", "return;", "case 1:\nif (!parallel_cpus) {", "VAR_0->base.is_jmp = DISAS_YIELD;", "}", "return;", "case 2:\nif (!parallel_cpus) {", "VAR_0->base.is_jmp = DISAS_WFE;", "}", "return;", "case 4:\ncase 5:\nreturn;", "default:\nreturn;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 59 ], [ 61, 65 ], [ 67 ], [ 69 ] ]
21,717
static int msrle_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MsrleContext *s = avctx->priv_data; int istride = FFALIGN(avctx->width*avctx->bits_per_coded_sample, 32) / 8; int ret; s->buf = buf; s->size = buf_size; if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (pal) { s->frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); } /* make the palette available */ memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE); } /* FIXME how to correctly detect RLE ??? */ if (avctx->height * istride == avpkt->size) { /* assume uncompressed */ int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8; uint8_t *ptr = s->frame->data[0]; uint8_t *buf = avpkt->data + (avctx->height-1)*istride; int i, j; for (i = 0; i < avctx->height; i++) { if (avctx->bits_per_coded_sample == 4) { for (j = 0; j < avctx->width - 1; j += 2) { ptr[j+0] = buf[j>>1] >> 4; ptr[j+1] = buf[j>>1] & 0xF; } if (avctx->width & 1) ptr[j+0] = buf[j>>1] >> 4; } else { memcpy(ptr, buf, linesize); } buf -= istride; ptr += s->frame->linesize[0]; } } else { bytestream2_init(&s->gb, buf, buf_size); ff_msrle_decode(avctx, (AVPicture*)s->frame, avctx->bits_per_coded_sample, &s->gb); } if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; /* report that the buffer was completely consumed */ return buf_size; }
false
FFmpeg
c919e1ca2ecfc47d796382973ba0e48b8f6f92a2
static int msrle_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MsrleContext *s = avctx->priv_data; int istride = FFALIGN(avctx->width*avctx->bits_per_coded_sample, 32) / 8; int ret; s->buf = buf; s->size = buf_size; if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (pal) { s->frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); } memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE); } if (avctx->height * istride == avpkt->size) { int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8; uint8_t *ptr = s->frame->data[0]; uint8_t *buf = avpkt->data + (avctx->height-1)*istride; int i, j; for (i = 0; i < avctx->height; i++) { if (avctx->bits_per_coded_sample == 4) { for (j = 0; j < avctx->width - 1; j += 2) { ptr[j+0] = buf[j>>1] >> 4; ptr[j+1] = buf[j>>1] & 0xF; } if (avctx->width & 1) ptr[j+0] = buf[j>>1] >> 4; } else { memcpy(ptr, buf, linesize); } buf -= istride; ptr += s->frame->linesize[0]; } } else { bytestream2_init(&s->gb, buf, buf_size); ff_msrle_decode(avctx, (AVPicture*)s->frame, avctx->bits_per_coded_sample, &s->gb); } if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; MsrleContext *s = VAR_0->priv_data; int VAR_6 = FFALIGN(VAR_0->width*VAR_0->bits_per_coded_sample, 32) / 8; int VAR_7; s->VAR_4 = VAR_4; s->size = VAR_5; if ((VAR_7 = ff_reget_buffer(VAR_0, s->frame)) < 0) return VAR_7; if (VAR_0->bits_per_coded_sample > 1 && VAR_0->bits_per_coded_sample <= 8) { const uint8_t *VAR_8 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, NULL); if (VAR_8) { s->frame->palette_has_changed = 1; memcpy(s->VAR_8, VAR_8, AVPALETTE_SIZE); } memcpy(s->frame->VAR_1[1], s->VAR_8, AVPALETTE_SIZE); } if (VAR_0->height * VAR_6 == VAR_3->size) { int VAR_9 = (VAR_0->width * VAR_0->bits_per_coded_sample + 7) / 8; uint8_t *ptr = s->frame->VAR_1[0]; uint8_t *VAR_4 = VAR_3->VAR_1 + (VAR_0->height-1)*VAR_6; int VAR_10, VAR_11; for (VAR_10 = 0; VAR_10 < VAR_0->height; VAR_10++) { if (VAR_0->bits_per_coded_sample == 4) { for (VAR_11 = 0; VAR_11 < VAR_0->width - 1; VAR_11 += 2) { ptr[VAR_11+0] = VAR_4[VAR_11>>1] >> 4; ptr[VAR_11+1] = VAR_4[VAR_11>>1] & 0xF; } if (VAR_0->width & 1) ptr[VAR_11+0] = VAR_4[VAR_11>>1] >> 4; } else { memcpy(ptr, VAR_4, VAR_9); } VAR_4 -= VAR_6; ptr += s->frame->VAR_9[0]; } } else { bytestream2_init(&s->gb, VAR_4, VAR_5); ff_msrle_decode(VAR_0, (AVPicture*)s->frame, VAR_0->bits_per_coded_sample, &s->gb); } if ((VAR_7 = av_frame_ref(VAR_1, s->frame)) < 0) return VAR_7; *VAR_2 = 1; return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "MsrleContext *s = VAR_0->priv_data;", "int VAR_6 = FFALIGN(VAR_0->width*VAR_0->bits_per_coded_sample, 32) / 8;", "int VAR_7;", "s->VAR_4 = VAR_4;", "s->size = VAR_5;", "if ((VAR_7 = ff_reget_buffer(VAR_0, s->frame)) < 0)\nreturn VAR_7;", "if (VAR_0->bits_per_coded_sample > 1 && VAR_0->bits_per_coded_sample <= 8) {", "const uint8_t *VAR_8 = av_packet_get_side_data(VAR_3, AV_PKT_DATA_PALETTE, NULL);", "if (VAR_8) {", "s->frame->palette_has_changed = 1;", "memcpy(s->VAR_8, VAR_8, AVPALETTE_SIZE);", "}", "memcpy(s->frame->VAR_1[1], s->VAR_8, AVPALETTE_SIZE);", "}", "if (VAR_0->height * VAR_6 == VAR_3->size) {", "int VAR_9 = (VAR_0->width * VAR_0->bits_per_coded_sample + 7) / 8;", "uint8_t *ptr = s->frame->VAR_1[0];", "uint8_t *VAR_4 = VAR_3->VAR_1 + (VAR_0->height-1)*VAR_6;", "int VAR_10, VAR_11;", "for (VAR_10 = 0; VAR_10 < VAR_0->height; VAR_10++) {", "if (VAR_0->bits_per_coded_sample == 4) {", "for (VAR_11 = 0; VAR_11 < VAR_0->width - 1; VAR_11 += 2) {", "ptr[VAR_11+0] = VAR_4[VAR_11>>1] >> 4;", "ptr[VAR_11+1] = VAR_4[VAR_11>>1] & 0xF;", "}", "if (VAR_0->width & 1)\nptr[VAR_11+0] = VAR_4[VAR_11>>1] >> 4;", "} else {", "memcpy(ptr, VAR_4, VAR_9);", "}", "VAR_4 -= VAR_6;", "ptr += s->frame->VAR_9[0];", "}", "} else {", "bytestream2_init(&s->gb, VAR_4, VAR_5);", "ff_msrle_decode(VAR_0, (AVPicture*)s->frame, VAR_0->bits_per_coded_sample, &s->gb);", "}", "if ((VAR_7 = av_frame_ref(VAR_1, s->frame)) < 0)\nreturn VAR_7;", "*VAR_2 = 1;", "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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107, 109 ], [ 113 ], [ 119 ], [ 121 ] ]
21,718
static void tcx_update_display(void *opaque) { TCXState *ts = opaque; ram_addr_t page, page_min, page_max; int y, y_start, dd, ds; uint8_t *d, *s; void (*f)(TCXState *s1, uint8_t *d, const uint8_t *s, int width); if (ts->ds->depth == 0) return; page = ts->vram_offset; y_start = -1; page_min = 0xffffffff; page_max = 0; d = ts->ds->data; s = ts->vram; dd = ts->ds->linesize; ds = 1024; switch (ts->ds->depth) { case 32: f = tcx_draw_line32; break; case 15: case 16: f = tcx_draw_line16; break; default: case 8: f = tcx_draw_line8; break; case 0: return; } for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE) { if (cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG)) { if (y_start < 0) y_start = y; if (page < page_min) page_min = page; if (page > page_max) page_max = page; f(ts, d, s, ts->width); d += dd; s += ds; f(ts, d, s, ts->width); d += dd; s += ds; f(ts, d, s, ts->width); d += dd; s += ds; f(ts, d, s, ts->width); d += dd; s += ds; } else { if (y_start >= 0) { /* flush to display */ dpy_update(ts->ds, 0, y_start, ts->width, y - y_start); y_start = -1; } d += dd * 4; s += ds * 4; } } if (y_start >= 0) { /* flush to display */ dpy_update(ts->ds, 0, y_start, ts->width, y - y_start); } /* reset modified pages */ if (page_min <= page_max) { cpu_physical_memory_reset_dirty(page_min, page_max + TARGET_PAGE_SIZE, VGA_DIRTY_FLAG); } }
false
qemu
b3ceef24f4fee8d5ed96b8c4a5d3e80c0a651f0b
static void tcx_update_display(void *opaque) { TCXState *ts = opaque; ram_addr_t page, page_min, page_max; int y, y_start, dd, ds; uint8_t *d, *s; void (*f)(TCXState *s1, uint8_t *d, const uint8_t *s, int width); if (ts->ds->depth == 0) return; page = ts->vram_offset; y_start = -1; page_min = 0xffffffff; page_max = 0; d = ts->ds->data; s = ts->vram; dd = ts->ds->linesize; ds = 1024; switch (ts->ds->depth) { case 32: f = tcx_draw_line32; break; case 15: case 16: f = tcx_draw_line16; break; default: case 8: f = tcx_draw_line8; break; case 0: return; } for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE) { if (cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG)) { if (y_start < 0) y_start = y; if (page < page_min) page_min = page; if (page > page_max) page_max = page; f(ts, d, s, ts->width); d += dd; s += ds; f(ts, d, s, ts->width); d += dd; s += ds; f(ts, d, s, ts->width); d += dd; s += ds; f(ts, d, s, ts->width); d += dd; s += ds; } else { if (y_start >= 0) { dpy_update(ts->ds, 0, y_start, ts->width, y - y_start); y_start = -1; } d += dd * 4; s += ds * 4; } } if (y_start >= 0) { dpy_update(ts->ds, 0, y_start, ts->width, y - y_start); } if (page_min <= page_max) { cpu_physical_memory_reset_dirty(page_min, page_max + TARGET_PAGE_SIZE, VGA_DIRTY_FLAG); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { TCXState *ts = VAR_0; ram_addr_t page, page_min, page_max; int VAR_1, VAR_2, VAR_3, VAR_4; uint8_t *VAR_7, *VAR_8; void (*VAR_5)(TCXState *VAR_6, uint8_t *VAR_7, const uint8_t *VAR_8, int VAR_9); if (ts->VAR_4->depth == 0) return; page = ts->vram_offset; VAR_2 = -1; page_min = 0xffffffff; page_max = 0; VAR_7 = ts->VAR_4->data; VAR_8 = ts->vram; VAR_3 = ts->VAR_4->linesize; VAR_4 = 1024; switch (ts->VAR_4->depth) { case 32: VAR_5 = tcx_draw_line32; break; case 15: case 16: VAR_5 = tcx_draw_line16; break; default: case 8: VAR_5 = tcx_draw_line8; break; case 0: return; } for(VAR_1 = 0; VAR_1 < ts->height; VAR_1 += 4, page += TARGET_PAGE_SIZE) { if (cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG)) { if (VAR_2 < 0) VAR_2 = VAR_1; if (page < page_min) page_min = page; if (page > page_max) page_max = page; VAR_5(ts, VAR_7, VAR_8, ts->VAR_9); VAR_7 += VAR_3; VAR_8 += VAR_4; VAR_5(ts, VAR_7, VAR_8, ts->VAR_9); VAR_7 += VAR_3; VAR_8 += VAR_4; VAR_5(ts, VAR_7, VAR_8, ts->VAR_9); VAR_7 += VAR_3; VAR_8 += VAR_4; VAR_5(ts, VAR_7, VAR_8, ts->VAR_9); VAR_7 += VAR_3; VAR_8 += VAR_4; } else { if (VAR_2 >= 0) { dpy_update(ts->VAR_4, 0, VAR_2, ts->VAR_9, VAR_1 - VAR_2); VAR_2 = -1; } VAR_7 += VAR_3 * 4; VAR_8 += VAR_4 * 4; } } if (VAR_2 >= 0) { dpy_update(ts->VAR_4, 0, VAR_2, ts->VAR_9, VAR_1 - VAR_2); } if (page_min <= page_max) { cpu_physical_memory_reset_dirty(page_min, page_max + TARGET_PAGE_SIZE, VGA_DIRTY_FLAG); } }
[ "static void FUNC_0(void *VAR_0)\n{", "TCXState *ts = VAR_0;", "ram_addr_t page, page_min, page_max;", "int VAR_1, VAR_2, VAR_3, VAR_4;", "uint8_t *VAR_7, *VAR_8;", "void (*VAR_5)(TCXState *VAR_6, uint8_t *VAR_7, const uint8_t *VAR_8, int VAR_9);", "if (ts->VAR_4->depth == 0)\nreturn;", "page = ts->vram_offset;", "VAR_2 = -1;", "page_min = 0xffffffff;", "page_max = 0;", "VAR_7 = ts->VAR_4->data;", "VAR_8 = ts->vram;", "VAR_3 = ts->VAR_4->linesize;", "VAR_4 = 1024;", "switch (ts->VAR_4->depth) {", "case 32:\nVAR_5 = tcx_draw_line32;", "break;", "case 15:\ncase 16:\nVAR_5 = tcx_draw_line16;", "break;", "default:\ncase 8:\nVAR_5 = tcx_draw_line8;", "break;", "case 0:\nreturn;", "}", "for(VAR_1 = 0; VAR_1 < ts->height; VAR_1 += 4, page += TARGET_PAGE_SIZE) {", "if (cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG)) {", "if (VAR_2 < 0)\nVAR_2 = VAR_1;", "if (page < page_min)\npage_min = page;", "if (page > page_max)\npage_max = page;", "VAR_5(ts, VAR_7, VAR_8, ts->VAR_9);", "VAR_7 += VAR_3;", "VAR_8 += VAR_4;", "VAR_5(ts, VAR_7, VAR_8, ts->VAR_9);", "VAR_7 += VAR_3;", "VAR_8 += VAR_4;", "VAR_5(ts, VAR_7, VAR_8, ts->VAR_9);", "VAR_7 += VAR_3;", "VAR_8 += VAR_4;", "VAR_5(ts, VAR_7, VAR_8, ts->VAR_9);", "VAR_7 += VAR_3;", "VAR_8 += VAR_4;", "} else {", "if (VAR_2 >= 0) {", "dpy_update(ts->VAR_4, 0, VAR_2,\nts->VAR_9, VAR_1 - VAR_2);", "VAR_2 = -1;", "}", "VAR_7 += VAR_3 * 4;", "VAR_8 += VAR_4 * 4;", "}", "}", "if (VAR_2 >= 0) {", "dpy_update(ts->VAR_4, 0, VAR_2,\nts->VAR_9, VAR_1 - VAR_2);", "}", "if (page_min <= page_max) {", "cpu_physical_memory_reset_dirty(page_min, page_max + TARGET_PAGE_SIZE,\nVGA_DIRTY_FLAG);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55, 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79, 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137, 139 ], [ 141 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ] ]
21,719
int vnc_zlib_send_framebuffer_update(VncState *vs, int x, int y, int w, int h) { int old_offset, new_offset, bytes_written; vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_ZLIB); // remember where we put in the follow-up size old_offset = vs->output.offset; vnc_write_s32(vs, 0); // compress the stream vnc_zlib_start(vs); vnc_raw_send_framebuffer_update(vs, x, y, w, h); bytes_written = vnc_zlib_stop(vs); if (bytes_written == -1) return 0; // hack in the size new_offset = vs->output.offset; vs->output.offset = old_offset; vnc_write_u32(vs, bytes_written); vs->output.offset = new_offset; return 1; }
false
qemu
245f7b51c0ea04fb2224b1127430a096c91aee70
int vnc_zlib_send_framebuffer_update(VncState *vs, int x, int y, int w, int h) { int old_offset, new_offset, bytes_written; vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_ZLIB); old_offset = vs->output.offset; vnc_write_s32(vs, 0); vnc_zlib_start(vs); vnc_raw_send_framebuffer_update(vs, x, y, w, h); bytes_written = vnc_zlib_stop(vs); if (bytes_written == -1) return 0; new_offset = vs->output.offset; vs->output.offset = old_offset; vnc_write_u32(vs, bytes_written); vs->output.offset = new_offset; return 1; }
{ "code": [], "line_no": [] }
int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4) { int VAR_5, VAR_6, VAR_7; vnc_framebuffer_update(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VNC_ENCODING_ZLIB); VAR_5 = VAR_0->output.offset; vnc_write_s32(VAR_0, 0); vnc_zlib_start(VAR_0); vnc_raw_send_framebuffer_update(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); VAR_7 = vnc_zlib_stop(VAR_0); if (VAR_7 == -1) return 0; VAR_6 = VAR_0->output.offset; VAR_0->output.offset = VAR_5; vnc_write_u32(VAR_0, VAR_7); VAR_0->output.offset = VAR_6; return 1; }
[ "int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6, VAR_7;", "vnc_framebuffer_update(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VNC_ENCODING_ZLIB);", "VAR_5 = VAR_0->output.offset;", "vnc_write_s32(VAR_0, 0);", "vnc_zlib_start(VAR_0);", "vnc_raw_send_framebuffer_update(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);", "VAR_7 = vnc_zlib_stop(VAR_0);", "if (VAR_7 == -1)\nreturn 0;", "VAR_6 = VAR_0->output.offset;", "VAR_0->output.offset = VAR_5;", "vnc_write_u32(VAR_0, VAR_7);", "VAR_0->output.offset = VAR_6;", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ] ]
21,720
static TCGv_i64 read_fp_dreg(DisasContext *s, int reg) { TCGv_i64 v = tcg_temp_new_i64(); tcg_gen_ld_i64(v, cpu_env, fp_reg_offset(reg, MO_64)); return v; }
false
qemu
90e496386fe7fd32c189561f846b7913f95b8cf4
static TCGv_i64 read_fp_dreg(DisasContext *s, int reg) { TCGv_i64 v = tcg_temp_new_i64(); tcg_gen_ld_i64(v, cpu_env, fp_reg_offset(reg, MO_64)); return v; }
{ "code": [], "line_no": [] }
static TCGv_i64 FUNC_0(DisasContext *s, int reg) { TCGv_i64 v = tcg_temp_new_i64(); tcg_gen_ld_i64(v, cpu_env, fp_reg_offset(reg, MO_64)); return v; }
[ "static TCGv_i64 FUNC_0(DisasContext *s, int reg)\n{", "TCGv_i64 v = tcg_temp_new_i64();", "tcg_gen_ld_i64(v, cpu_env, fp_reg_offset(reg, MO_64));", "return v;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ] ]
21,721
static int vfio_connect_container(VFIOGroup *group, AddressSpace *as) { VFIOContainer *container; int ret, fd; VFIOAddressSpace *space; space = vfio_get_address_space(as); QLIST_FOREACH(container, &space->containers, next) { if (!ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &container->fd)) { group->container = container; QLIST_INSERT_HEAD(&container->group_list, group, container_next); return 0; } } fd = qemu_open("/dev/vfio/vfio", O_RDWR); if (fd < 0) { error_report("vfio: failed to open /dev/vfio/vfio: %m"); ret = -errno; goto put_space_exit; } ret = ioctl(fd, VFIO_GET_API_VERSION); if (ret != VFIO_API_VERSION) { error_report("vfio: supported vfio version: %d, " "reported version: %d", VFIO_API_VERSION, ret); ret = -EINVAL; goto close_fd_exit; } container = g_malloc0(sizeof(*container)); container->space = space; container->fd = fd; if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU) || ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU)) { bool v2 = !!ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU); struct vfio_iommu_type1_info info; ret = ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &fd); if (ret) { error_report("vfio: failed to set group container: %m"); ret = -errno; goto free_container_exit; } container->iommu_type = v2 ? VFIO_TYPE1v2_IOMMU : VFIO_TYPE1_IOMMU; ret = ioctl(fd, VFIO_SET_IOMMU, container->iommu_type); if (ret) { error_report("vfio: failed to set iommu for container: %m"); ret = -errno; goto free_container_exit; } /* * FIXME: This assumes that a Type1 IOMMU can map any 64-bit * IOVA whatsoever. That's not actually true, but the current * kernel interface doesn't tell us what it can map, and the * existing Type1 IOMMUs generally support any IOVA we're * going to actually try in practice. */ info.argsz = sizeof(info); ret = ioctl(fd, VFIO_IOMMU_GET_INFO, &info); /* Ignore errors */ if (ret || !(info.flags & VFIO_IOMMU_INFO_PGSIZES)) { /* Assume 4k IOVA page size */ info.iova_pgsizes = 4096; } vfio_host_win_add(container, 0, (hwaddr)-1, info.iova_pgsizes); } else if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_IOMMU) || ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU)) { struct vfio_iommu_spapr_tce_info info; bool v2 = !!ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU); ret = ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &fd); if (ret) { error_report("vfio: failed to set group container: %m"); ret = -errno; goto free_container_exit; } container->iommu_type = v2 ? VFIO_SPAPR_TCE_v2_IOMMU : VFIO_SPAPR_TCE_IOMMU; ret = ioctl(fd, VFIO_SET_IOMMU, container->iommu_type); if (ret) { error_report("vfio: failed to set iommu for container: %m"); ret = -errno; goto free_container_exit; } /* * The host kernel code implementing VFIO_IOMMU_DISABLE is called * when container fd is closed so we do not call it explicitly * in this file. */ if (!v2) { ret = ioctl(fd, VFIO_IOMMU_ENABLE); if (ret) { error_report("vfio: failed to enable container: %m"); ret = -errno; goto free_container_exit; } } else { container->prereg_listener = vfio_prereg_listener; memory_listener_register(&container->prereg_listener, &address_space_memory); if (container->error) { memory_listener_unregister(&container->prereg_listener); error_report("vfio: RAM memory listener initialization failed for container"); goto free_container_exit; } } /* * This only considers the host IOMMU's 32-bit window. At * some point we need to add support for the optional 64-bit * window and dynamic windows */ info.argsz = sizeof(info); ret = ioctl(fd, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info); if (ret) { error_report("vfio: VFIO_IOMMU_SPAPR_TCE_GET_INFO failed: %m"); ret = -errno; if (v2) { memory_listener_unregister(&container->prereg_listener); } goto free_container_exit; } /* The default table uses 4K pages */ vfio_host_win_add(container, info.dma32_window_start, info.dma32_window_start + info.dma32_window_size - 1, 0x1000); } else { error_report("vfio: No available IOMMU models"); ret = -EINVAL; goto free_container_exit; } container->listener = vfio_memory_listener; memory_listener_register(&container->listener, container->space->as); if (container->error) { ret = container->error; error_report("vfio: memory listener initialization failed for container"); goto listener_release_exit; } container->initialized = true; QLIST_INIT(&container->group_list); QLIST_INSERT_HEAD(&space->containers, container, next); group->container = container; QLIST_INSERT_HEAD(&container->group_list, group, container_next); return 0; listener_release_exit: vfio_listener_release(container); free_container_exit: g_free(container); close_fd_exit: close(fd); put_space_exit: vfio_put_address_space(space); return ret; }
false
qemu
2e4109de8e589beecd69996ee14f24021b991c0d
static int vfio_connect_container(VFIOGroup *group, AddressSpace *as) { VFIOContainer *container; int ret, fd; VFIOAddressSpace *space; space = vfio_get_address_space(as); QLIST_FOREACH(container, &space->containers, next) { if (!ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &container->fd)) { group->container = container; QLIST_INSERT_HEAD(&container->group_list, group, container_next); return 0; } } fd = qemu_open("/dev/vfio/vfio", O_RDWR); if (fd < 0) { error_report("vfio: failed to open /dev/vfio/vfio: %m"); ret = -errno; goto put_space_exit; } ret = ioctl(fd, VFIO_GET_API_VERSION); if (ret != VFIO_API_VERSION) { error_report("vfio: supported vfio version: %d, " "reported version: %d", VFIO_API_VERSION, ret); ret = -EINVAL; goto close_fd_exit; } container = g_malloc0(sizeof(*container)); container->space = space; container->fd = fd; if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU) || ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU)) { bool v2 = !!ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU); struct vfio_iommu_type1_info info; ret = ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &fd); if (ret) { error_report("vfio: failed to set group container: %m"); ret = -errno; goto free_container_exit; } container->iommu_type = v2 ? VFIO_TYPE1v2_IOMMU : VFIO_TYPE1_IOMMU; ret = ioctl(fd, VFIO_SET_IOMMU, container->iommu_type); if (ret) { error_report("vfio: failed to set iommu for container: %m"); ret = -errno; goto free_container_exit; } info.argsz = sizeof(info); ret = ioctl(fd, VFIO_IOMMU_GET_INFO, &info); if (ret || !(info.flags & VFIO_IOMMU_INFO_PGSIZES)) { info.iova_pgsizes = 4096; } vfio_host_win_add(container, 0, (hwaddr)-1, info.iova_pgsizes); } else if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_IOMMU) || ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU)) { struct vfio_iommu_spapr_tce_info info; bool v2 = !!ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU); ret = ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &fd); if (ret) { error_report("vfio: failed to set group container: %m"); ret = -errno; goto free_container_exit; } container->iommu_type = v2 ? VFIO_SPAPR_TCE_v2_IOMMU : VFIO_SPAPR_TCE_IOMMU; ret = ioctl(fd, VFIO_SET_IOMMU, container->iommu_type); if (ret) { error_report("vfio: failed to set iommu for container: %m"); ret = -errno; goto free_container_exit; } if (!v2) { ret = ioctl(fd, VFIO_IOMMU_ENABLE); if (ret) { error_report("vfio: failed to enable container: %m"); ret = -errno; goto free_container_exit; } } else { container->prereg_listener = vfio_prereg_listener; memory_listener_register(&container->prereg_listener, &address_space_memory); if (container->error) { memory_listener_unregister(&container->prereg_listener); error_report("vfio: RAM memory listener initialization failed for container"); goto free_container_exit; } } info.argsz = sizeof(info); ret = ioctl(fd, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info); if (ret) { error_report("vfio: VFIO_IOMMU_SPAPR_TCE_GET_INFO failed: %m"); ret = -errno; if (v2) { memory_listener_unregister(&container->prereg_listener); } goto free_container_exit; } vfio_host_win_add(container, info.dma32_window_start, info.dma32_window_start + info.dma32_window_size - 1, 0x1000); } else { error_report("vfio: No available IOMMU models"); ret = -EINVAL; goto free_container_exit; } container->listener = vfio_memory_listener; memory_listener_register(&container->listener, container->space->as); if (container->error) { ret = container->error; error_report("vfio: memory listener initialization failed for container"); goto listener_release_exit; } container->initialized = true; QLIST_INIT(&container->group_list); QLIST_INSERT_HEAD(&space->containers, container, next); group->container = container; QLIST_INSERT_HEAD(&container->group_list, group, container_next); return 0; listener_release_exit: vfio_listener_release(container); free_container_exit: g_free(container); close_fd_exit: close(fd); put_space_exit: vfio_put_address_space(space); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(VFIOGroup *VAR_0, AddressSpace *VAR_1) { VFIOContainer *container; int VAR_2, VAR_3; VFIOAddressSpace *space; space = vfio_get_address_space(VAR_1); QLIST_FOREACH(container, &space->containers, next) { if (!ioctl(VAR_0->VAR_3, VFIO_GROUP_SET_CONTAINER, &container->VAR_3)) { VAR_0->container = container; QLIST_INSERT_HEAD(&container->group_list, VAR_0, container_next); return 0; } } VAR_3 = qemu_open("/dev/vfio/vfio", O_RDWR); if (VAR_3 < 0) { error_report("vfio: failed to open /dev/vfio/vfio: %m"); VAR_2 = -errno; goto put_space_exit; } VAR_2 = ioctl(VAR_3, VFIO_GET_API_VERSION); if (VAR_2 != VFIO_API_VERSION) { error_report("vfio: supported vfio version: %d, " "reported version: %d", VFIO_API_VERSION, VAR_2); VAR_2 = -EINVAL; goto close_fd_exit; } container = g_malloc0(sizeof(*container)); container->space = space; container->VAR_3 = VAR_3; if (ioctl(VAR_3, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU) || ioctl(VAR_3, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU)) { bool v2 = !!ioctl(VAR_3, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU); struct vfio_iommu_type1_info VAR_5; VAR_2 = ioctl(VAR_0->VAR_3, VFIO_GROUP_SET_CONTAINER, &VAR_3); if (VAR_2) { error_report("vfio: failed to set VAR_0 container: %m"); VAR_2 = -errno; goto free_container_exit; } container->iommu_type = v2 ? VFIO_TYPE1v2_IOMMU : VFIO_TYPE1_IOMMU; VAR_2 = ioctl(VAR_3, VFIO_SET_IOMMU, container->iommu_type); if (VAR_2) { error_report("vfio: failed to set iommu for container: %m"); VAR_2 = -errno; goto free_container_exit; } VAR_5.argsz = sizeof(VAR_5); VAR_2 = ioctl(VAR_3, VFIO_IOMMU_GET_INFO, &VAR_5); if (VAR_2 || !(VAR_5.flags & VFIO_IOMMU_INFO_PGSIZES)) { VAR_5.iova_pgsizes = 4096; } vfio_host_win_add(container, 0, (hwaddr)-1, VAR_5.iova_pgsizes); } else if (ioctl(VAR_3, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_IOMMU) || ioctl(VAR_3, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU)) { struct vfio_iommu_spapr_tce_info VAR_5; bool v2 = !!ioctl(VAR_3, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU); VAR_2 = ioctl(VAR_0->VAR_3, VFIO_GROUP_SET_CONTAINER, &VAR_3); if (VAR_2) { error_report("vfio: failed to set VAR_0 container: %m"); VAR_2 = -errno; goto free_container_exit; } container->iommu_type = v2 ? VFIO_SPAPR_TCE_v2_IOMMU : VFIO_SPAPR_TCE_IOMMU; VAR_2 = ioctl(VAR_3, VFIO_SET_IOMMU, container->iommu_type); if (VAR_2) { error_report("vfio: failed to set iommu for container: %m"); VAR_2 = -errno; goto free_container_exit; } if (!v2) { VAR_2 = ioctl(VAR_3, VFIO_IOMMU_ENABLE); if (VAR_2) { error_report("vfio: failed to enable container: %m"); VAR_2 = -errno; goto free_container_exit; } } else { container->prereg_listener = vfio_prereg_listener; memory_listener_register(&container->prereg_listener, &address_space_memory); if (container->error) { memory_listener_unregister(&container->prereg_listener); error_report("vfio: RAM memory listener initialization failed for container"); goto free_container_exit; } } VAR_5.argsz = sizeof(VAR_5); VAR_2 = ioctl(VAR_3, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &VAR_5); if (VAR_2) { error_report("vfio: VFIO_IOMMU_SPAPR_TCE_GET_INFO failed: %m"); VAR_2 = -errno; if (v2) { memory_listener_unregister(&container->prereg_listener); } goto free_container_exit; } vfio_host_win_add(container, VAR_5.dma32_window_start, VAR_5.dma32_window_start + VAR_5.dma32_window_size - 1, 0x1000); } else { error_report("vfio: No available IOMMU models"); VAR_2 = -EINVAL; goto free_container_exit; } container->listener = vfio_memory_listener; memory_listener_register(&container->listener, container->space->VAR_1); if (container->error) { VAR_2 = container->error; error_report("vfio: memory listener initialization failed for container"); goto listener_release_exit; } container->initialized = true; QLIST_INIT(&container->group_list); QLIST_INSERT_HEAD(&space->containers, container, next); VAR_0->container = container; QLIST_INSERT_HEAD(&container->group_list, VAR_0, container_next); return 0; listener_release_exit: vfio_listener_release(container); free_container_exit: g_free(container); close_fd_exit: close(VAR_3); put_space_exit: vfio_put_address_space(space); return VAR_2; }
[ "static int FUNC_0(VFIOGroup *VAR_0, AddressSpace *VAR_1)\n{", "VFIOContainer *container;", "int VAR_2, VAR_3;", "VFIOAddressSpace *space;", "space = vfio_get_address_space(VAR_1);", "QLIST_FOREACH(container, &space->containers, next) {", "if (!ioctl(VAR_0->VAR_3, VFIO_GROUP_SET_CONTAINER, &container->VAR_3)) {", "VAR_0->container = container;", "QLIST_INSERT_HEAD(&container->group_list, VAR_0, container_next);", "return 0;", "}", "}", "VAR_3 = qemu_open(\"/dev/vfio/vfio\", O_RDWR);", "if (VAR_3 < 0) {", "error_report(\"vfio: failed to open /dev/vfio/vfio: %m\");", "VAR_2 = -errno;", "goto put_space_exit;", "}", "VAR_2 = ioctl(VAR_3, VFIO_GET_API_VERSION);", "if (VAR_2 != VFIO_API_VERSION) {", "error_report(\"vfio: supported vfio version: %d, \"\n\"reported version: %d\", VFIO_API_VERSION, VAR_2);", "VAR_2 = -EINVAL;", "goto close_fd_exit;", "}", "container = g_malloc0(sizeof(*container));", "container->space = space;", "container->VAR_3 = VAR_3;", "if (ioctl(VAR_3, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU) ||\nioctl(VAR_3, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU)) {", "bool v2 = !!ioctl(VAR_3, VFIO_CHECK_EXTENSION, VFIO_TYPE1v2_IOMMU);", "struct vfio_iommu_type1_info VAR_5;", "VAR_2 = ioctl(VAR_0->VAR_3, VFIO_GROUP_SET_CONTAINER, &VAR_3);", "if (VAR_2) {", "error_report(\"vfio: failed to set VAR_0 container: %m\");", "VAR_2 = -errno;", "goto free_container_exit;", "}", "container->iommu_type = v2 ? VFIO_TYPE1v2_IOMMU : VFIO_TYPE1_IOMMU;", "VAR_2 = ioctl(VAR_3, VFIO_SET_IOMMU, container->iommu_type);", "if (VAR_2) {", "error_report(\"vfio: failed to set iommu for container: %m\");", "VAR_2 = -errno;", "goto free_container_exit;", "}", "VAR_5.argsz = sizeof(VAR_5);", "VAR_2 = ioctl(VAR_3, VFIO_IOMMU_GET_INFO, &VAR_5);", "if (VAR_2 || !(VAR_5.flags & VFIO_IOMMU_INFO_PGSIZES)) {", "VAR_5.iova_pgsizes = 4096;", "}", "vfio_host_win_add(container, 0, (hwaddr)-1, VAR_5.iova_pgsizes);", "} else if (ioctl(VAR_3, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_IOMMU) ||", "ioctl(VAR_3, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU)) {", "struct vfio_iommu_spapr_tce_info VAR_5;", "bool v2 = !!ioctl(VAR_3, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU);", "VAR_2 = ioctl(VAR_0->VAR_3, VFIO_GROUP_SET_CONTAINER, &VAR_3);", "if (VAR_2) {", "error_report(\"vfio: failed to set VAR_0 container: %m\");", "VAR_2 = -errno;", "goto free_container_exit;", "}", "container->iommu_type =\nv2 ? VFIO_SPAPR_TCE_v2_IOMMU : VFIO_SPAPR_TCE_IOMMU;", "VAR_2 = ioctl(VAR_3, VFIO_SET_IOMMU, container->iommu_type);", "if (VAR_2) {", "error_report(\"vfio: failed to set iommu for container: %m\");", "VAR_2 = -errno;", "goto free_container_exit;", "}", "if (!v2) {", "VAR_2 = ioctl(VAR_3, VFIO_IOMMU_ENABLE);", "if (VAR_2) {", "error_report(\"vfio: failed to enable container: %m\");", "VAR_2 = -errno;", "goto free_container_exit;", "}", "} else {", "container->prereg_listener = vfio_prereg_listener;", "memory_listener_register(&container->prereg_listener,\n&address_space_memory);", "if (container->error) {", "memory_listener_unregister(&container->prereg_listener);", "error_report(\"vfio: RAM memory listener initialization failed for container\");", "goto free_container_exit;", "}", "}", "VAR_5.argsz = sizeof(VAR_5);", "VAR_2 = ioctl(VAR_3, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &VAR_5);", "if (VAR_2) {", "error_report(\"vfio: VFIO_IOMMU_SPAPR_TCE_GET_INFO failed: %m\");", "VAR_2 = -errno;", "if (v2) {", "memory_listener_unregister(&container->prereg_listener);", "}", "goto free_container_exit;", "}", "vfio_host_win_add(container, VAR_5.dma32_window_start,\nVAR_5.dma32_window_start +\nVAR_5.dma32_window_size - 1,\n0x1000);", "} else {", "error_report(\"vfio: No available IOMMU models\");", "VAR_2 = -EINVAL;", "goto free_container_exit;", "}", "container->listener = vfio_memory_listener;", "memory_listener_register(&container->listener, container->space->VAR_1);", "if (container->error) {", "VAR_2 = container->error;", "error_report(\"vfio: memory listener initialization failed for container\");", "goto listener_release_exit;", "}", "container->initialized = true;", "QLIST_INIT(&container->group_list);", "QLIST_INSERT_HEAD(&space->containers, container, next);", "VAR_0->container = container;", "QLIST_INSERT_HEAD(&container->group_list, VAR_0, container_next);", "return 0;", "listener_release_exit:\nvfio_listener_release(container);", "free_container_exit:\ng_free(container);", "close_fd_exit:\nclose(VAR_3);", "put_space_exit:\nvfio_put_address_space(space);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 123 ], [ 125 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161, 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 261, 263, 265, 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 281 ], [ 285 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 301 ], [ 305 ], [ 307 ], [ 311 ], [ 313 ], [ 317 ], [ 319, 321 ], [ 325, 327 ], [ 331, 333 ], [ 337, 339 ], [ 343 ], [ 345 ] ]
21,722
static void pci_piix_init_ports(PCIIDEState *d) { int i; struct { int iobase; int iobase2; int isairq; } port_info[] = { {0x1f0, 0x3f6, 14}, {0x170, 0x376, 15}, }; for (i = 0; i < 2; i++) { ide_bus_new(&d->bus[i], &d->dev.qdev, i); ide_init_ioport(&d->bus[i], port_info[i].iobase, port_info[i].iobase2); ide_init2(&d->bus[i], isa_reserve_irq(port_info[i].isairq)); bmdma_init(&d->bus[i], &d->bmdma[i]); d->bmdma[i].bus = &d->bus[i]; qemu_add_vm_change_state_handler(d->bus[i].dma->ops->restart_cb, &d->bmdma[i].dma); } }
false
qemu
ee951a37d8873bff7aa58e23222dfd984111b6cb
static void pci_piix_init_ports(PCIIDEState *d) { int i; struct { int iobase; int iobase2; int isairq; } port_info[] = { {0x1f0, 0x3f6, 14}, {0x170, 0x376, 15}, }; for (i = 0; i < 2; i++) { ide_bus_new(&d->bus[i], &d->dev.qdev, i); ide_init_ioport(&d->bus[i], port_info[i].iobase, port_info[i].iobase2); ide_init2(&d->bus[i], isa_reserve_irq(port_info[i].isairq)); bmdma_init(&d->bus[i], &d->bmdma[i]); d->bmdma[i].bus = &d->bus[i]; qemu_add_vm_change_state_handler(d->bus[i].dma->ops->restart_cb, &d->bmdma[i].dma); } }
{ "code": [], "line_no": [] }
static void FUNC_0(PCIIDEState *VAR_0) { int VAR_1; struct { int iobase; int iobase2; int isairq; } VAR_2[] = { {0x1f0, 0x3f6, 14}, {0x170, 0x376, 15}, }; for (VAR_1 = 0; VAR_1 < 2; VAR_1++) { ide_bus_new(&VAR_0->bus[VAR_1], &VAR_0->dev.qdev, VAR_1); ide_init_ioport(&VAR_0->bus[VAR_1], VAR_2[VAR_1].iobase, VAR_2[VAR_1].iobase2); ide_init2(&VAR_0->bus[VAR_1], isa_reserve_irq(VAR_2[VAR_1].isairq)); bmdma_init(&VAR_0->bus[VAR_1], &VAR_0->bmdma[VAR_1]); VAR_0->bmdma[VAR_1].bus = &VAR_0->bus[VAR_1]; qemu_add_vm_change_state_handler(VAR_0->bus[VAR_1].dma->ops->restart_cb, &VAR_0->bmdma[VAR_1].dma); } }
[ "static void FUNC_0(PCIIDEState *VAR_0) {", "int VAR_1;", "struct {", "int iobase;", "int iobase2;", "int isairq;", "} VAR_2[] = {", "{0x1f0, 0x3f6, 14},", "{0x170, 0x376, 15},", "};", "for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {", "ide_bus_new(&VAR_0->bus[VAR_1], &VAR_0->dev.qdev, VAR_1);", "ide_init_ioport(&VAR_0->bus[VAR_1], VAR_2[VAR_1].iobase, VAR_2[VAR_1].iobase2);", "ide_init2(&VAR_0->bus[VAR_1], isa_reserve_irq(VAR_2[VAR_1].isairq));", "bmdma_init(&VAR_0->bus[VAR_1], &VAR_0->bmdma[VAR_1]);", "VAR_0->bmdma[VAR_1].bus = &VAR_0->bus[VAR_1];", "qemu_add_vm_change_state_handler(VAR_0->bus[VAR_1].dma->ops->restart_cb,\n&VAR_0->bmdma[VAR_1].dma);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ] ]
21,724
void load_seg(int seg_reg, int selector) { SegmentCache *sc; SegmentDescriptorTable *dt; int index; uint32_t e1, e2; uint8_t *ptr; env->segs[seg_reg] = selector; sc = &env->seg_cache[seg_reg]; if (env->eflags & VM_MASK) { sc->base = (void *)(selector << 4); sc->limit = 0xffff; sc->seg_32bit = 0; } else { if (selector & 0x4) dt = &env->ldt; else dt = &env->gdt; index = selector & ~7; if ((index + 7) > dt->limit) raise_exception_err(EXCP0D_GPF, selector); ptr = dt->base + index; e1 = ldl(ptr); e2 = ldl(ptr + 4); sc->base = (void *)((e1 >> 16) | ((e2 & 0xff) << 16) | (e2 & 0xff000000)); sc->limit = (e1 & 0xffff) | (e2 & 0x000f0000); if (e2 & (1 << 23)) sc->limit = (sc->limit << 12) | 0xfff; sc->seg_32bit = (e2 >> 22) & 1; #if 0 fprintf(logfile, "load_seg: sel=0x%04x base=0x%08lx limit=0x%08lx seg_32bit=%d\n", selector, (unsigned long)sc->base, sc->limit, sc->seg_32bit); #endif } }
false
qemu
3acace1333d6b75628fe6e6786ad3cd2db766f0e
void load_seg(int seg_reg, int selector) { SegmentCache *sc; SegmentDescriptorTable *dt; int index; uint32_t e1, e2; uint8_t *ptr; env->segs[seg_reg] = selector; sc = &env->seg_cache[seg_reg]; if (env->eflags & VM_MASK) { sc->base = (void *)(selector << 4); sc->limit = 0xffff; sc->seg_32bit = 0; } else { if (selector & 0x4) dt = &env->ldt; else dt = &env->gdt; index = selector & ~7; if ((index + 7) > dt->limit) raise_exception_err(EXCP0D_GPF, selector); ptr = dt->base + index; e1 = ldl(ptr); e2 = ldl(ptr + 4); sc->base = (void *)((e1 >> 16) | ((e2 & 0xff) << 16) | (e2 & 0xff000000)); sc->limit = (e1 & 0xffff) | (e2 & 0x000f0000); if (e2 & (1 << 23)) sc->limit = (sc->limit << 12) | 0xfff; sc->seg_32bit = (e2 >> 22) & 1; #if 0 fprintf(logfile, "load_seg: sel=0x%04x base=0x%08lx limit=0x%08lx seg_32bit=%d\n", selector, (unsigned long)sc->base, sc->limit, sc->seg_32bit); #endif } }
{ "code": [], "line_no": [] }
void FUNC_0(int VAR_0, int VAR_1) { SegmentCache *sc; SegmentDescriptorTable *dt; int VAR_2; uint32_t e1, e2; uint8_t *ptr; env->segs[VAR_0] = VAR_1; sc = &env->seg_cache[VAR_0]; if (env->eflags & VM_MASK) { sc->base = (void *)(VAR_1 << 4); sc->limit = 0xffff; sc->seg_32bit = 0; } else { if (VAR_1 & 0x4) dt = &env->ldt; else dt = &env->gdt; VAR_2 = VAR_1 & ~7; if ((VAR_2 + 7) > dt->limit) raise_exception_err(EXCP0D_GPF, VAR_1); ptr = dt->base + VAR_2; e1 = ldl(ptr); e2 = ldl(ptr + 4); sc->base = (void *)((e1 >> 16) | ((e2 & 0xff) << 16) | (e2 & 0xff000000)); sc->limit = (e1 & 0xffff) | (e2 & 0x000f0000); if (e2 & (1 << 23)) sc->limit = (sc->limit << 12) | 0xfff; sc->seg_32bit = (e2 >> 22) & 1; #if 0 fprintf(logfile, "FUNC_0: sel=0x%04x base=0x%08lx limit=0x%08lx seg_32bit=%d\n", VAR_1, (unsigned long)sc->base, sc->limit, sc->seg_32bit); #endif } }
[ "void FUNC_0(int VAR_0, int VAR_1)\n{", "SegmentCache *sc;", "SegmentDescriptorTable *dt;", "int VAR_2;", "uint32_t e1, e2;", "uint8_t *ptr;", "env->segs[VAR_0] = VAR_1;", "sc = &env->seg_cache[VAR_0];", "if (env->eflags & VM_MASK) {", "sc->base = (void *)(VAR_1 << 4);", "sc->limit = 0xffff;", "sc->seg_32bit = 0;", "} else {", "if (VAR_1 & 0x4)\ndt = &env->ldt;", "else\ndt = &env->gdt;", "VAR_2 = VAR_1 & ~7;", "if ((VAR_2 + 7) > dt->limit)\nraise_exception_err(EXCP0D_GPF, VAR_1);", "ptr = dt->base + VAR_2;", "e1 = ldl(ptr);", "e2 = ldl(ptr + 4);", "sc->base = (void *)((e1 >> 16) | ((e2 & 0xff) << 16) | (e2 & 0xff000000));", "sc->limit = (e1 & 0xffff) | (e2 & 0x000f0000);", "if (e2 & (1 << 23))\nsc->limit = (sc->limit << 12) | 0xfff;", "sc->seg_32bit = (e2 >> 22) & 1;", "#if 0\nfprintf(logfile, \"FUNC_0: sel=0x%04x base=0x%08lx limit=0x%08lx seg_32bit=%d\\n\",\nVAR_1, (unsigned long)sc->base, sc->limit, sc->seg_32bit);", "#endif\n}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61, 63, 65 ], [ 67, 69 ], [ 71 ] ]
21,725
static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, Error **errp) { const char *buf; int bdrv_flags = 0; int on_read_error, on_write_error; bool account_invalid, account_failed; const char *stats_intervals; BlockBackend *blk; BlockDriverState *bs; ThrottleConfig cfg; int snapshot = 0; Error *error = NULL; QemuOpts *opts; const char *id; bool has_driver_specific_opts; BlockdevDetectZeroesOptions detect_zeroes = BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF; const char *throttling_group = NULL; /* Check common options by copying from bs_opts to opts, all other options * stay in bs_opts for processing by bdrv_open(). */ id = qdict_get_try_str(bs_opts, "id"); opts = qemu_opts_create(&qemu_common_drive_opts, id, 1, &error); if (error) { error_propagate(errp, error); goto err_no_opts; } qemu_opts_absorb_qdict(opts, bs_opts, &error); if (error) { error_propagate(errp, error); goto early_err; } if (id) { qdict_del(bs_opts, "id"); } has_driver_specific_opts = !!qdict_size(bs_opts); /* extract parameters */ snapshot = qemu_opt_get_bool(opts, "snapshot", 0); account_invalid = qemu_opt_get_bool(opts, "stats-account-invalid", true); account_failed = qemu_opt_get_bool(opts, "stats-account-failed", true); stats_intervals = qemu_opt_get(opts, "stats-intervals"); extract_common_blockdev_options(opts, &bdrv_flags, &throttling_group, &cfg, &detect_zeroes, &error); if (error) { error_propagate(errp, error); goto early_err; } if ((buf = qemu_opt_get(opts, "format")) != NULL) { if (is_help_option(buf)) { error_printf("Supported formats:"); bdrv_iterate_format(bdrv_format_print, NULL); error_printf("\n"); goto early_err; } if (qdict_haskey(bs_opts, "driver")) { error_setg(errp, "Cannot specify both 'driver' and 'format'"); goto early_err; } qdict_put(bs_opts, "driver", qstring_from_str(buf)); } on_write_error = BLOCKDEV_ON_ERROR_ENOSPC; if ((buf = qemu_opt_get(opts, "werror")) != NULL) { on_write_error = parse_block_error_action(buf, 0, &error); if (error) { error_propagate(errp, error); goto early_err; } } on_read_error = BLOCKDEV_ON_ERROR_REPORT; if ((buf = qemu_opt_get(opts, "rerror")) != NULL) { on_read_error = parse_block_error_action(buf, 1, &error); if (error) { error_propagate(errp, error); goto early_err; } } if (snapshot) { /* always use cache=unsafe with snapshot */ bdrv_flags &= ~BDRV_O_CACHE_MASK; bdrv_flags |= (BDRV_O_SNAPSHOT|BDRV_O_CACHE_WB|BDRV_O_NO_FLUSH); } /* init */ if ((!file || !*file) && !has_driver_specific_opts) { BlockBackendRootState *blk_rs; blk = blk_new(qemu_opts_id(opts), errp); if (!blk) { goto early_err; } blk_rs = blk_get_root_state(blk); blk_rs->open_flags = bdrv_flags; blk_rs->read_only = !(bdrv_flags & BDRV_O_RDWR); blk_rs->detect_zeroes = detect_zeroes; if (throttle_enabled(&cfg)) { if (!throttling_group) { throttling_group = blk_name(blk); } blk_rs->throttle_group = g_strdup(throttling_group); blk_rs->throttle_state = throttle_group_incref(throttling_group); blk_rs->throttle_state->cfg = cfg; } QDECREF(bs_opts); } else { if (file && !*file) { file = NULL; } blk = blk_new_open(qemu_opts_id(opts), file, NULL, bs_opts, bdrv_flags, errp); if (!blk) { goto err_no_bs_opts; } bs = blk_bs(blk); bs->detect_zeroes = detect_zeroes; /* disk I/O throttling */ if (throttle_enabled(&cfg)) { if (!throttling_group) { throttling_group = blk_name(blk); } bdrv_io_limits_enable(bs, throttling_group); bdrv_set_io_limits(bs, &cfg); } if (bdrv_key_required(bs)) { autostart = 0; } block_acct_init(blk_get_stats(blk), account_invalid, account_failed); if (stats_intervals) { char **intervals = g_strsplit(stats_intervals, ":", 0); unsigned i; if (*stats_intervals == '\0') { error_setg(&error, "stats-intervals can't have an empty value"); } for (i = 0; !error && intervals[i] != NULL; i++) { unsigned long long val; if (parse_uint_full(intervals[i], &val, 10) == 0 && val > 0 && val <= UINT_MAX) { block_acct_add_interval(blk_get_stats(blk), val); } else { error_setg(&error, "Invalid interval length: '%s'", intervals[i]); } } g_strfreev(intervals); if (error) { error_propagate(errp, error); blk_unref(blk); blk = NULL; goto err_no_bs_opts; } } } blk_set_on_error(blk, on_read_error, on_write_error); err_no_bs_opts: qemu_opts_del(opts); return blk; early_err: qemu_opts_del(opts); err_no_opts: QDECREF(bs_opts); return NULL; }
false
qemu
40119effc5c36dbd0ca19ca85a5897d5b3d37d6d
static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, Error **errp) { const char *buf; int bdrv_flags = 0; int on_read_error, on_write_error; bool account_invalid, account_failed; const char *stats_intervals; BlockBackend *blk; BlockDriverState *bs; ThrottleConfig cfg; int snapshot = 0; Error *error = NULL; QemuOpts *opts; const char *id; bool has_driver_specific_opts; BlockdevDetectZeroesOptions detect_zeroes = BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF; const char *throttling_group = NULL; id = qdict_get_try_str(bs_opts, "id"); opts = qemu_opts_create(&qemu_common_drive_opts, id, 1, &error); if (error) { error_propagate(errp, error); goto err_no_opts; } qemu_opts_absorb_qdict(opts, bs_opts, &error); if (error) { error_propagate(errp, error); goto early_err; } if (id) { qdict_del(bs_opts, "id"); } has_driver_specific_opts = !!qdict_size(bs_opts); snapshot = qemu_opt_get_bool(opts, "snapshot", 0); account_invalid = qemu_opt_get_bool(opts, "stats-account-invalid", true); account_failed = qemu_opt_get_bool(opts, "stats-account-failed", true); stats_intervals = qemu_opt_get(opts, "stats-intervals"); extract_common_blockdev_options(opts, &bdrv_flags, &throttling_group, &cfg, &detect_zeroes, &error); if (error) { error_propagate(errp, error); goto early_err; } if ((buf = qemu_opt_get(opts, "format")) != NULL) { if (is_help_option(buf)) { error_printf("Supported formats:"); bdrv_iterate_format(bdrv_format_print, NULL); error_printf("\n"); goto early_err; } if (qdict_haskey(bs_opts, "driver")) { error_setg(errp, "Cannot specify both 'driver' and 'format'"); goto early_err; } qdict_put(bs_opts, "driver", qstring_from_str(buf)); } on_write_error = BLOCKDEV_ON_ERROR_ENOSPC; if ((buf = qemu_opt_get(opts, "werror")) != NULL) { on_write_error = parse_block_error_action(buf, 0, &error); if (error) { error_propagate(errp, error); goto early_err; } } on_read_error = BLOCKDEV_ON_ERROR_REPORT; if ((buf = qemu_opt_get(opts, "rerror")) != NULL) { on_read_error = parse_block_error_action(buf, 1, &error); if (error) { error_propagate(errp, error); goto early_err; } } if (snapshot) { bdrv_flags &= ~BDRV_O_CACHE_MASK; bdrv_flags |= (BDRV_O_SNAPSHOT|BDRV_O_CACHE_WB|BDRV_O_NO_FLUSH); } if ((!file || !*file) && !has_driver_specific_opts) { BlockBackendRootState *blk_rs; blk = blk_new(qemu_opts_id(opts), errp); if (!blk) { goto early_err; } blk_rs = blk_get_root_state(blk); blk_rs->open_flags = bdrv_flags; blk_rs->read_only = !(bdrv_flags & BDRV_O_RDWR); blk_rs->detect_zeroes = detect_zeroes; if (throttle_enabled(&cfg)) { if (!throttling_group) { throttling_group = blk_name(blk); } blk_rs->throttle_group = g_strdup(throttling_group); blk_rs->throttle_state = throttle_group_incref(throttling_group); blk_rs->throttle_state->cfg = cfg; } QDECREF(bs_opts); } else { if (file && !*file) { file = NULL; } blk = blk_new_open(qemu_opts_id(opts), file, NULL, bs_opts, bdrv_flags, errp); if (!blk) { goto err_no_bs_opts; } bs = blk_bs(blk); bs->detect_zeroes = detect_zeroes; if (throttle_enabled(&cfg)) { if (!throttling_group) { throttling_group = blk_name(blk); } bdrv_io_limits_enable(bs, throttling_group); bdrv_set_io_limits(bs, &cfg); } if (bdrv_key_required(bs)) { autostart = 0; } block_acct_init(blk_get_stats(blk), account_invalid, account_failed); if (stats_intervals) { char **intervals = g_strsplit(stats_intervals, ":", 0); unsigned i; if (*stats_intervals == '\0') { error_setg(&error, "stats-intervals can't have an empty value"); } for (i = 0; !error && intervals[i] != NULL; i++) { unsigned long long val; if (parse_uint_full(intervals[i], &val, 10) == 0 && val > 0 && val <= UINT_MAX) { block_acct_add_interval(blk_get_stats(blk), val); } else { error_setg(&error, "Invalid interval length: '%s'", intervals[i]); } } g_strfreev(intervals); if (error) { error_propagate(errp, error); blk_unref(blk); blk = NULL; goto err_no_bs_opts; } } } blk_set_on_error(blk, on_read_error, on_write_error); err_no_bs_opts: qemu_opts_del(opts); return blk; early_err: qemu_opts_del(opts); err_no_opts: QDECREF(bs_opts); return NULL; }
{ "code": [], "line_no": [] }
static BlockBackend *FUNC_0(const char *file, QDict *bs_opts, Error **errp) { const char *VAR_0; int VAR_1 = 0; int VAR_2, VAR_3; bool account_invalid, account_failed; const char *VAR_4; BlockBackend *blk; BlockDriverState *bs; ThrottleConfig cfg; int VAR_5 = 0; Error *error = NULL; QemuOpts *opts; const char *VAR_6; bool has_driver_specific_opts; BlockdevDetectZeroesOptions detect_zeroes = BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF; const char *VAR_7 = NULL; VAR_6 = qdict_get_try_str(bs_opts, "VAR_6"); opts = qemu_opts_create(&qemu_common_drive_opts, VAR_6, 1, &error); if (error) { error_propagate(errp, error); goto err_no_opts; } qemu_opts_absorb_qdict(opts, bs_opts, &error); if (error) { error_propagate(errp, error); goto early_err; } if (VAR_6) { qdict_del(bs_opts, "VAR_6"); } has_driver_specific_opts = !!qdict_size(bs_opts); VAR_5 = qemu_opt_get_bool(opts, "VAR_5", 0); account_invalid = qemu_opt_get_bool(opts, "stats-account-invalid", true); account_failed = qemu_opt_get_bool(opts, "stats-account-failed", true); VAR_4 = qemu_opt_get(opts, "stats-VAR_8"); extract_common_blockdev_options(opts, &VAR_1, &VAR_7, &cfg, &detect_zeroes, &error); if (error) { error_propagate(errp, error); goto early_err; } if ((VAR_0 = qemu_opt_get(opts, "format")) != NULL) { if (is_help_option(VAR_0)) { error_printf("Supported formats:"); bdrv_iterate_format(bdrv_format_print, NULL); error_printf("\n"); goto early_err; } if (qdict_haskey(bs_opts, "driver")) { error_setg(errp, "Cannot specify both 'driver' and 'format'"); goto early_err; } qdict_put(bs_opts, "driver", qstring_from_str(VAR_0)); } VAR_3 = BLOCKDEV_ON_ERROR_ENOSPC; if ((VAR_0 = qemu_opt_get(opts, "werror")) != NULL) { VAR_3 = parse_block_error_action(VAR_0, 0, &error); if (error) { error_propagate(errp, error); goto early_err; } } VAR_2 = BLOCKDEV_ON_ERROR_REPORT; if ((VAR_0 = qemu_opt_get(opts, "rerror")) != NULL) { VAR_2 = parse_block_error_action(VAR_0, 1, &error); if (error) { error_propagate(errp, error); goto early_err; } } if (VAR_5) { VAR_1 &= ~BDRV_O_CACHE_MASK; VAR_1 |= (BDRV_O_SNAPSHOT|BDRV_O_CACHE_WB|BDRV_O_NO_FLUSH); } if ((!file || !*file) && !has_driver_specific_opts) { BlockBackendRootState *blk_rs; blk = blk_new(qemu_opts_id(opts), errp); if (!blk) { goto early_err; } blk_rs = blk_get_root_state(blk); blk_rs->open_flags = VAR_1; blk_rs->read_only = !(VAR_1 & BDRV_O_RDWR); blk_rs->detect_zeroes = detect_zeroes; if (throttle_enabled(&cfg)) { if (!VAR_7) { VAR_7 = blk_name(blk); } blk_rs->throttle_group = g_strdup(VAR_7); blk_rs->throttle_state = throttle_group_incref(VAR_7); blk_rs->throttle_state->cfg = cfg; } QDECREF(bs_opts); } else { if (file && !*file) { file = NULL; } blk = blk_new_open(qemu_opts_id(opts), file, NULL, bs_opts, VAR_1, errp); if (!blk) { goto err_no_bs_opts; } bs = blk_bs(blk); bs->detect_zeroes = detect_zeroes; if (throttle_enabled(&cfg)) { if (!VAR_7) { VAR_7 = blk_name(blk); } bdrv_io_limits_enable(bs, VAR_7); bdrv_set_io_limits(bs, &cfg); } if (bdrv_key_required(bs)) { autostart = 0; } block_acct_init(blk_get_stats(blk), account_invalid, account_failed); if (VAR_4) { char **VAR_8 = g_strsplit(VAR_4, ":", 0); unsigned VAR_9; if (*VAR_4 == '\0') { error_setg(&error, "stats-VAR_8 can't have an empty value"); } for (VAR_9 = 0; !error && VAR_8[VAR_9] != NULL; VAR_9++) { unsigned long long val; if (parse_uint_full(VAR_8[VAR_9], &val, 10) == 0 && val > 0 && val <= UINT_MAX) { block_acct_add_interval(blk_get_stats(blk), val); } else { error_setg(&error, "Invalid interval length: '%s'", VAR_8[VAR_9]); } } g_strfreev(VAR_8); if (error) { error_propagate(errp, error); blk_unref(blk); blk = NULL; goto err_no_bs_opts; } } } blk_set_on_error(blk, VAR_2, VAR_3); err_no_bs_opts: qemu_opts_del(opts); return blk; early_err: qemu_opts_del(opts); err_no_opts: QDECREF(bs_opts); return NULL; }
[ "static BlockBackend *FUNC_0(const char *file, QDict *bs_opts,\nError **errp)\n{", "const char *VAR_0;", "int VAR_1 = 0;", "int VAR_2, VAR_3;", "bool account_invalid, account_failed;", "const char *VAR_4;", "BlockBackend *blk;", "BlockDriverState *bs;", "ThrottleConfig cfg;", "int VAR_5 = 0;", "Error *error = NULL;", "QemuOpts *opts;", "const char *VAR_6;", "bool has_driver_specific_opts;", "BlockdevDetectZeroesOptions detect_zeroes =\nBLOCKDEV_DETECT_ZEROES_OPTIONS_OFF;", "const char *VAR_7 = NULL;", "VAR_6 = qdict_get_try_str(bs_opts, \"VAR_6\");", "opts = qemu_opts_create(&qemu_common_drive_opts, VAR_6, 1, &error);", "if (error) {", "error_propagate(errp, error);", "goto err_no_opts;", "}", "qemu_opts_absorb_qdict(opts, bs_opts, &error);", "if (error) {", "error_propagate(errp, error);", "goto early_err;", "}", "if (VAR_6) {", "qdict_del(bs_opts, \"VAR_6\");", "}", "has_driver_specific_opts = !!qdict_size(bs_opts);", "VAR_5 = qemu_opt_get_bool(opts, \"VAR_5\", 0);", "account_invalid = qemu_opt_get_bool(opts, \"stats-account-invalid\", true);", "account_failed = qemu_opt_get_bool(opts, \"stats-account-failed\", true);", "VAR_4 = qemu_opt_get(opts, \"stats-VAR_8\");", "extract_common_blockdev_options(opts, &VAR_1, &VAR_7, &cfg,\n&detect_zeroes, &error);", "if (error) {", "error_propagate(errp, error);", "goto early_err;", "}", "if ((VAR_0 = qemu_opt_get(opts, \"format\")) != NULL) {", "if (is_help_option(VAR_0)) {", "error_printf(\"Supported formats:\");", "bdrv_iterate_format(bdrv_format_print, NULL);", "error_printf(\"\\n\");", "goto early_err;", "}", "if (qdict_haskey(bs_opts, \"driver\")) {", "error_setg(errp, \"Cannot specify both 'driver' and 'format'\");", "goto early_err;", "}", "qdict_put(bs_opts, \"driver\", qstring_from_str(VAR_0));", "}", "VAR_3 = BLOCKDEV_ON_ERROR_ENOSPC;", "if ((VAR_0 = qemu_opt_get(opts, \"werror\")) != NULL) {", "VAR_3 = parse_block_error_action(VAR_0, 0, &error);", "if (error) {", "error_propagate(errp, error);", "goto early_err;", "}", "}", "VAR_2 = BLOCKDEV_ON_ERROR_REPORT;", "if ((VAR_0 = qemu_opt_get(opts, \"rerror\")) != NULL) {", "VAR_2 = parse_block_error_action(VAR_0, 1, &error);", "if (error) {", "error_propagate(errp, error);", "goto early_err;", "}", "}", "if (VAR_5) {", "VAR_1 &= ~BDRV_O_CACHE_MASK;", "VAR_1 |= (BDRV_O_SNAPSHOT|BDRV_O_CACHE_WB|BDRV_O_NO_FLUSH);", "}", "if ((!file || !*file) && !has_driver_specific_opts) {", "BlockBackendRootState *blk_rs;", "blk = blk_new(qemu_opts_id(opts), errp);", "if (!blk) {", "goto early_err;", "}", "blk_rs = blk_get_root_state(blk);", "blk_rs->open_flags = VAR_1;", "blk_rs->read_only = !(VAR_1 & BDRV_O_RDWR);", "blk_rs->detect_zeroes = detect_zeroes;", "if (throttle_enabled(&cfg)) {", "if (!VAR_7) {", "VAR_7 = blk_name(blk);", "}", "blk_rs->throttle_group = g_strdup(VAR_7);", "blk_rs->throttle_state = throttle_group_incref(VAR_7);", "blk_rs->throttle_state->cfg = cfg;", "}", "QDECREF(bs_opts);", "} else {", "if (file && !*file) {", "file = NULL;", "}", "blk = blk_new_open(qemu_opts_id(opts), file, NULL, bs_opts, VAR_1,\nerrp);", "if (!blk) {", "goto err_no_bs_opts;", "}", "bs = blk_bs(blk);", "bs->detect_zeroes = detect_zeroes;", "if (throttle_enabled(&cfg)) {", "if (!VAR_7) {", "VAR_7 = blk_name(blk);", "}", "bdrv_io_limits_enable(bs, VAR_7);", "bdrv_set_io_limits(bs, &cfg);", "}", "if (bdrv_key_required(bs)) {", "autostart = 0;", "}", "block_acct_init(blk_get_stats(blk), account_invalid, account_failed);", "if (VAR_4) {", "char **VAR_8 = g_strsplit(VAR_4, \":\", 0);", "unsigned VAR_9;", "if (*VAR_4 == '\\0') {", "error_setg(&error, \"stats-VAR_8 can't have an empty value\");", "}", "for (VAR_9 = 0; !error && VAR_8[VAR_9] != NULL; VAR_9++) {", "unsigned long long val;", "if (parse_uint_full(VAR_8[VAR_9], &val, 10) == 0 &&\nval > 0 && val <= UINT_MAX) {", "block_acct_add_interval(blk_get_stats(blk), val);", "} else {", "error_setg(&error, \"Invalid interval length: '%s'\",\nVAR_8[VAR_9]);", "}", "}", "g_strfreev(VAR_8);", "if (error) {", "error_propagate(errp, error);", "blk_unref(blk);", "blk = NULL;", "goto err_no_bs_opts;", "}", "}", "}", "blk_set_on_error(blk, VAR_2, VAR_3);", "err_no_bs_opts:\nqemu_opts_del(opts);", "return blk;", "early_err:\nqemu_opts_del(opts);", "err_no_opts:\nQDECREF(bs_opts);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 85 ], [ 89 ], [ 91 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 263 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 285 ], [ 287 ], [ 289 ], [ 293 ], [ 297 ], [ 299 ], [ 301 ], [ 305 ], [ 307 ], [ 309 ], [ 313 ], [ 315 ], [ 317, 319 ], [ 321 ], [ 323 ], [ 325, 327 ], [ 329 ], [ 331 ], [ 335 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 357 ], [ 361, 363 ], [ 365 ], [ 369, 371 ], [ 373, 375 ], [ 377 ], [ 379 ] ]
21,727
av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx) { if (avctx->bits_per_raw_sample <= 8 && (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) { c->idct_put = ff_simple_idct_put_armv5te; c->idct_add = ff_simple_idct_add_armv5te; c->idct = ff_simple_idct_armv5te; c->idct_permutation_type = FF_NO_IDCT_PERM; } c->prefetch = ff_prefetch_arm; }
false
FFmpeg
70d54392f5015b9c6594fcae558f59f952501e3b
av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx) { if (avctx->bits_per_raw_sample <= 8 && (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) { c->idct_put = ff_simple_idct_put_armv5te; c->idct_add = ff_simple_idct_add_armv5te; c->idct = ff_simple_idct_armv5te; c->idct_permutation_type = FF_NO_IDCT_PERM; } c->prefetch = ff_prefetch_arm; }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(DSPContext *c, AVCodecContext *avctx) { if (avctx->bits_per_raw_sample <= 8 && (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) { c->idct_put = ff_simple_idct_put_armv5te; c->idct_add = ff_simple_idct_add_armv5te; c->idct = ff_simple_idct_armv5te; c->idct_permutation_type = FF_NO_IDCT_PERM; } c->prefetch = ff_prefetch_arm; }
[ "av_cold void FUNC_0(DSPContext *c, AVCodecContext *avctx)\n{", "if (avctx->bits_per_raw_sample <= 8 &&\n(avctx->idct_algo == FF_IDCT_AUTO ||\navctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) {", "c->idct_put = ff_simple_idct_put_armv5te;", "c->idct_add = ff_simple_idct_add_armv5te;", "c->idct = ff_simple_idct_armv5te;", "c->idct_permutation_type = FF_NO_IDCT_PERM;", "}", "c->prefetch = ff_prefetch_arm;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
21,728
static QObject *qmp_input_get_object(QmpInputVisitor *qiv, const char *name, bool consume, Error **errp) { StackObject *tos; QObject *qobj; QObject *ret; if (QSLIST_EMPTY(&qiv->stack)) { /* Starting at root, name is ignored. */ assert(qiv->root); return qiv->root; } /* We are in a container; find the next element. */ tos = QSLIST_FIRST(&qiv->stack); qobj = tos->obj; assert(qobj); if (qobject_type(qobj) == QTYPE_QDICT) { assert(name); ret = qdict_get(qobject_to_qdict(qobj), name); if (tos->h && consume && ret) { bool removed = g_hash_table_remove(tos->h, name); assert(removed); } if (!ret) { error_setg(errp, QERR_MISSING_PARAMETER, name); } } else { assert(qobject_type(qobj) == QTYPE_QLIST); assert(!name); ret = qlist_entry_obj(tos->entry); assert(ret); if (consume) { tos->entry = qlist_next(tos->entry); } } return ret; }
false
qemu
09e68369a88d7de0f988972bf28eec1b80cc47f9
static QObject *qmp_input_get_object(QmpInputVisitor *qiv, const char *name, bool consume, Error **errp) { StackObject *tos; QObject *qobj; QObject *ret; if (QSLIST_EMPTY(&qiv->stack)) { assert(qiv->root); return qiv->root; } tos = QSLIST_FIRST(&qiv->stack); qobj = tos->obj; assert(qobj); if (qobject_type(qobj) == QTYPE_QDICT) { assert(name); ret = qdict_get(qobject_to_qdict(qobj), name); if (tos->h && consume && ret) { bool removed = g_hash_table_remove(tos->h, name); assert(removed); } if (!ret) { error_setg(errp, QERR_MISSING_PARAMETER, name); } } else { assert(qobject_type(qobj) == QTYPE_QLIST); assert(!name); ret = qlist_entry_obj(tos->entry); assert(ret); if (consume) { tos->entry = qlist_next(tos->entry); } } return ret; }
{ "code": [], "line_no": [] }
static QObject *FUNC_0(QmpInputVisitor *qiv, const char *name, bool consume, Error **errp) { StackObject *tos; QObject *qobj; QObject *ret; if (QSLIST_EMPTY(&qiv->stack)) { assert(qiv->root); return qiv->root; } tos = QSLIST_FIRST(&qiv->stack); qobj = tos->obj; assert(qobj); if (qobject_type(qobj) == QTYPE_QDICT) { assert(name); ret = qdict_get(qobject_to_qdict(qobj), name); if (tos->h && consume && ret) { bool removed = g_hash_table_remove(tos->h, name); assert(removed); } if (!ret) { error_setg(errp, QERR_MISSING_PARAMETER, name); } } else { assert(qobject_type(qobj) == QTYPE_QLIST); assert(!name); ret = qlist_entry_obj(tos->entry); assert(ret); if (consume) { tos->entry = qlist_next(tos->entry); } } return ret; }
[ "static QObject *FUNC_0(QmpInputVisitor *qiv,\nconst char *name,\nbool consume, Error **errp)\n{", "StackObject *tos;", "QObject *qobj;", "QObject *ret;", "if (QSLIST_EMPTY(&qiv->stack)) {", "assert(qiv->root);", "return qiv->root;", "}", "tos = QSLIST_FIRST(&qiv->stack);", "qobj = tos->obj;", "assert(qobj);", "if (qobject_type(qobj) == QTYPE_QDICT) {", "assert(name);", "ret = qdict_get(qobject_to_qdict(qobj), name);", "if (tos->h && consume && ret) {", "bool removed = g_hash_table_remove(tos->h, name);", "assert(removed);", "}", "if (!ret) {", "error_setg(errp, QERR_MISSING_PARAMETER, name);", "}", "} else {", "assert(qobject_type(qobj) == QTYPE_QLIST);", "assert(!name);", "ret = qlist_entry_obj(tos->entry);", "assert(ret);", "if (consume) {", "tos->entry = qlist_next(tos->entry);", "}", "}", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ] ]
21,729
static void rtas_ibm_set_slot_reset(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { sPAPRPHBState *sphb; sPAPRPHBClass *spc; uint32_t option; uint64_t buid; int ret; if ((nargs != 4) || (nret != 1)) { goto param_error_exit; } buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); option = rtas_ld(args, 3); sphb = find_phb(spapr, buid); if (!sphb) { goto param_error_exit; } spc = SPAPR_PCI_HOST_BRIDGE_GET_CLASS(sphb); if (!spc->eeh_reset) { goto param_error_exit; } ret = spc->eeh_reset(sphb, option); rtas_st(rets, 0, ret); return; param_error_exit: rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); }
false
qemu
46c5874e9cd752ed8ded31af03472edd8fc3efc1
static void rtas_ibm_set_slot_reset(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { sPAPRPHBState *sphb; sPAPRPHBClass *spc; uint32_t option; uint64_t buid; int ret; if ((nargs != 4) || (nret != 1)) { goto param_error_exit; } buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); option = rtas_ld(args, 3); sphb = find_phb(spapr, buid); if (!sphb) { goto param_error_exit; } spc = SPAPR_PCI_HOST_BRIDGE_GET_CLASS(sphb); if (!spc->eeh_reset) { goto param_error_exit; } ret = spc->eeh_reset(sphb, option); rtas_st(rets, 0, ret); return; param_error_exit: rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); }
{ "code": [], "line_no": [] }
static void FUNC_0(PowerPCCPU *VAR_0, sPAPREnvironment *VAR_1, uint32_t VAR_2, uint32_t VAR_3, target_ulong VAR_4, uint32_t VAR_5, target_ulong VAR_6) { sPAPRPHBState *sphb; sPAPRPHBClass *spc; uint32_t option; uint64_t buid; int VAR_7; if ((VAR_3 != 4) || (VAR_5 != 1)) { goto param_error_exit; } buid = ((uint64_t)rtas_ld(VAR_4, 1) << 32) | rtas_ld(VAR_4, 2); option = rtas_ld(VAR_4, 3); sphb = find_phb(VAR_1, buid); if (!sphb) { goto param_error_exit; } spc = SPAPR_PCI_HOST_BRIDGE_GET_CLASS(sphb); if (!spc->eeh_reset) { goto param_error_exit; } VAR_7 = spc->eeh_reset(sphb, option); rtas_st(VAR_6, 0, VAR_7); return; param_error_exit: rtas_st(VAR_6, 0, RTAS_OUT_PARAM_ERROR); }
[ "static void FUNC_0(PowerPCCPU *VAR_0,\nsPAPREnvironment *VAR_1,\nuint32_t VAR_2, uint32_t VAR_3,\ntarget_ulong VAR_4, uint32_t VAR_5,\ntarget_ulong VAR_6)\n{", "sPAPRPHBState *sphb;", "sPAPRPHBClass *spc;", "uint32_t option;", "uint64_t buid;", "int VAR_7;", "if ((VAR_3 != 4) || (VAR_5 != 1)) {", "goto param_error_exit;", "}", "buid = ((uint64_t)rtas_ld(VAR_4, 1) << 32) | rtas_ld(VAR_4, 2);", "option = rtas_ld(VAR_4, 3);", "sphb = find_phb(VAR_1, buid);", "if (!sphb) {", "goto param_error_exit;", "}", "spc = SPAPR_PCI_HOST_BRIDGE_GET_CLASS(sphb);", "if (!spc->eeh_reset) {", "goto param_error_exit;", "}", "VAR_7 = spc->eeh_reset(sphb, option);", "rtas_st(VAR_6, 0, VAR_7);", "return;", "param_error_exit:\nrtas_st(VAR_6, 0, RTAS_OUT_PARAM_ERROR);", "}" ]
[ 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 69 ] ]
21,730
int pp_check(int key, int pp, int nx) { int access; /* Compute access rights */ /* When pp is 3/7, the result is undefined. Set it to noaccess */ access = 0; if (key == 0) { switch (pp) { case 0x0: case 0x1: case 0x2: access |= PAGE_WRITE; /* No break here */ case 0x3: case 0x6: access |= PAGE_READ; break; } } else { switch (pp) { case 0x0: case 0x6: access = 0; break; case 0x1: case 0x3: access = PAGE_READ; break; case 0x2: access = PAGE_READ | PAGE_WRITE; break; } } if (nx == 0) { access |= PAGE_EXEC; } return access; }
false
qemu
496272a7018ba01aa2b87a1a5ed866ff85133401
int pp_check(int key, int pp, int nx) { int access; access = 0; if (key == 0) { switch (pp) { case 0x0: case 0x1: case 0x2: access |= PAGE_WRITE; case 0x3: case 0x6: access |= PAGE_READ; break; } } else { switch (pp) { case 0x0: case 0x6: access = 0; break; case 0x1: case 0x3: access = PAGE_READ; break; case 0x2: access = PAGE_READ | PAGE_WRITE; break; } } if (nx == 0) { access |= PAGE_EXEC; } return access; }
{ "code": [], "line_no": [] }
int FUNC_0(int VAR_0, int VAR_1, int VAR_2) { int VAR_3; VAR_3 = 0; if (VAR_0 == 0) { switch (VAR_1) { case 0x0: case 0x1: case 0x2: VAR_3 |= PAGE_WRITE; case 0x3: case 0x6: VAR_3 |= PAGE_READ; break; } } else { switch (VAR_1) { case 0x0: case 0x6: VAR_3 = 0; break; case 0x1: case 0x3: VAR_3 = PAGE_READ; break; case 0x2: VAR_3 = PAGE_READ | PAGE_WRITE; break; } } if (VAR_2 == 0) { VAR_3 |= PAGE_EXEC; } return VAR_3; }
[ "int FUNC_0(int VAR_0, int VAR_1, int VAR_2)\n{", "int VAR_3;", "VAR_3 = 0;", "if (VAR_0 == 0) {", "switch (VAR_1) {", "case 0x0:\ncase 0x1:\ncase 0x2:\nVAR_3 |= PAGE_WRITE;", "case 0x3:\ncase 0x6:\nVAR_3 |= PAGE_READ;", "break;", "}", "} else {", "switch (VAR_1) {", "case 0x0:\ncase 0x6:\nVAR_3 = 0;", "break;", "case 0x1:\ncase 0x3:\nVAR_3 = PAGE_READ;", "break;", "case 0x2:\nVAR_3 = PAGE_READ | PAGE_WRITE;", "break;", "}", "}", "if (VAR_2 == 0) {", "VAR_3 |= PAGE_EXEC;", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21, 23, 25 ], [ 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45, 47 ], [ 49 ], [ 51, 53, 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ] ]
21,732
static bool check_section_footer(QEMUFile *f, SaveStateEntry *se) { uint8_t read_mark; uint32_t read_section_id; if (skip_section_footers) { /* No footer to check */ return true; } read_mark = qemu_get_byte(f); if (read_mark != QEMU_VM_SECTION_FOOTER) { error_report("Missing section footer for %s", se->idstr); return false; } read_section_id = qemu_get_be32(f); if (read_section_id != se->section_id) { error_report("Mismatched section id in footer for %s -" " read 0x%x expected 0x%x", se->idstr, read_section_id, se->section_id); return false; } /* All good */ return true; }
false
qemu
59f39a47411ab6007a592555dc639aa9753f8d23
static bool check_section_footer(QEMUFile *f, SaveStateEntry *se) { uint8_t read_mark; uint32_t read_section_id; if (skip_section_footers) { return true; } read_mark = qemu_get_byte(f); if (read_mark != QEMU_VM_SECTION_FOOTER) { error_report("Missing section footer for %s", se->idstr); return false; } read_section_id = qemu_get_be32(f); if (read_section_id != se->section_id) { error_report("Mismatched section id in footer for %s -" " read 0x%x expected 0x%x", se->idstr, read_section_id, se->section_id); return false; } return true; }
{ "code": [], "line_no": [] }
static bool FUNC_0(QEMUFile *f, SaveStateEntry *se) { uint8_t read_mark; uint32_t read_section_id; if (skip_section_footers) { return true; } read_mark = qemu_get_byte(f); if (read_mark != QEMU_VM_SECTION_FOOTER) { error_report("Missing section footer for %s", se->idstr); return false; } read_section_id = qemu_get_be32(f); if (read_section_id != se->section_id) { error_report("Mismatched section id in footer for %s -" " read 0x%x expected 0x%x", se->idstr, read_section_id, se->section_id); return false; } return true; }
[ "static bool FUNC_0(QEMUFile *f, SaveStateEntry *se)\n{", "uint8_t read_mark;", "uint32_t read_section_id;", "if (skip_section_footers) {", "return true;", "}", "read_mark = qemu_get_byte(f);", "if (read_mark != QEMU_VM_SECTION_FOOTER) {", "error_report(\"Missing section footer for %s\", se->idstr);", "return false;", "}", "read_section_id = qemu_get_be32(f);", "if (read_section_id != se->section_id) {", "error_report(\"Mismatched section id in footer for %s -\"\n\" read 0x%x expected 0x%x\",\nse->idstr, read_section_id, se->section_id);", "return false;", "}", "return true;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ] ]