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
118
int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec) { _Bool exp = 0; if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) return 0; if (lockmgr_cb) { if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) return -1; } if (atomic_fetch_add(&entangled_thread_counter, 1)) { av_log(log_ctx, AV_LOG_ERROR, "Insufficient thread locking. At least %d threads are " "calling avcodec_open2() at the same time right now.\n", atomic_load(&entangled_thread_counter)); if (!lockmgr_cb) av_log(log_ctx, AV_LOG_ERROR, "No lock manager is set, please see av_lockmgr_register()\n"); atomic_store(&ff_avcodec_locked, 1); ff_unlock_avcodec(codec); return AVERROR(EINVAL); } av_assert0(atomic_compare_exchange_strong(&ff_avcodec_locked, &exp, 1)); return 0; }
false
FFmpeg
fd542b6f2026f1aa163882ee0283958598a97c31
int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec) { _Bool exp = 0; if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) return 0; if (lockmgr_cb) { if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) return -1; } if (atomic_fetch_add(&entangled_thread_counter, 1)) { av_log(log_ctx, AV_LOG_ERROR, "Insufficient thread locking. At least %d threads are " "calling avcodec_open2() at the same time right now.\n", atomic_load(&entangled_thread_counter)); if (!lockmgr_cb) av_log(log_ctx, AV_LOG_ERROR, "No lock manager is set, please see av_lockmgr_register()\n"); atomic_store(&ff_avcodec_locked, 1); ff_unlock_avcodec(codec); return AVERROR(EINVAL); } av_assert0(atomic_compare_exchange_strong(&ff_avcodec_locked, &exp, 1)); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, const AVCodec *VAR_1) { _Bool VAR_2 = 0; if (VAR_1->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !VAR_1->init) return 0; if (lockmgr_cb) { if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) return -1; } if (atomic_fetch_add(&entangled_thread_counter, 1)) { av_log(VAR_0, AV_LOG_ERROR, "Insufficient thread locking. At least %d threads are " "calling avcodec_open2() at the same time right now.\n", atomic_load(&entangled_thread_counter)); if (!lockmgr_cb) av_log(VAR_0, AV_LOG_ERROR, "No lock manager is set, please see av_lockmgr_register()\n"); atomic_store(&ff_avcodec_locked, 1); ff_unlock_avcodec(VAR_1); return AVERROR(EINVAL); } av_assert0(atomic_compare_exchange_strong(&ff_avcodec_locked, &VAR_2, 1)); return 0; }
[ "int FUNC_0(AVCodecContext *VAR_0, const AVCodec *VAR_1)\n{", "_Bool VAR_2 = 0;", "if (VAR_1->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !VAR_1->init)\nreturn 0;", "if (lockmgr_cb) {", "if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))\nreturn -1;", "}", "if (atomic_fetch_add(&entangled_thread_counter, 1)) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Insufficient thread locking. At least %d threads are \"\n\"calling avcodec_open2() at the same time right now.\\n\",\natomic_load(&entangled_thread_counter));", "if (!lockmgr_cb)\nav_log(VAR_0, AV_LOG_ERROR, \"No lock manager is set, please see av_lockmgr_register()\\n\");", "atomic_store(&ff_avcodec_locked, 1);", "ff_unlock_avcodec(VAR_1);", "return AVERROR(EINVAL);", "}", "av_assert0(atomic_compare_exchange_strong(&ff_avcodec_locked, &VAR_2, 1));", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 23 ], [ 25, 27, 29, 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
119
void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride) { int i; pixel *dst = (pixel*)_dst; dctcoef *block = (dctcoef*)_block; stride >>= sizeof(pixel)-1; block[0] += 1 << 5; for(i=0; i<4; i++){ const int z0= block[i + 4*0] + block[i + 4*2]; const int z1= block[i + 4*0] - block[i + 4*2]; const int z2= (block[i + 4*1]>>1) - block[i + 4*3]; const int z3= block[i + 4*1] + (block[i + 4*3]>>1); block[i + 4*0]= z0 + z3; block[i + 4*1]= z1 + z2; block[i + 4*2]= z1 - z2; block[i + 4*3]= z0 - z3; } for(i=0; i<4; i++){ const int z0= block[0 + 4*i] + block[2 + 4*i]; const int z1= block[0 + 4*i] - block[2 + 4*i]; const int z2= (block[1 + 4*i]>>1) - block[3 + 4*i]; const int z3= block[1 + 4*i] + (block[3 + 4*i]>>1); dst[i + 0*stride]= av_clip_pixel(dst[i + 0*stride] + ((z0 + z3) >> 6)); dst[i + 1*stride]= av_clip_pixel(dst[i + 1*stride] + ((z1 + z2) >> 6)); dst[i + 2*stride]= av_clip_pixel(dst[i + 2*stride] + ((z1 - z2) >> 6)); dst[i + 3*stride]= av_clip_pixel(dst[i + 3*stride] + ((z0 - z3) >> 6)); } memset(block, 0, 16 * sizeof(dctcoef)); }
true
FFmpeg
4ea7744859dc3d214ef13e920f5d07b070920e3f
void FUNCC(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride) { int i; pixel *dst = (pixel*)_dst; dctcoef *block = (dctcoef*)_block; stride >>= sizeof(pixel)-1; block[0] += 1 << 5; for(i=0; i<4; i++){ const int z0= block[i + 4*0] + block[i + 4*2]; const int z1= block[i + 4*0] - block[i + 4*2]; const int z2= (block[i + 4*1]>>1) - block[i + 4*3]; const int z3= block[i + 4*1] + (block[i + 4*3]>>1); block[i + 4*0]= z0 + z3; block[i + 4*1]= z1 + z2; block[i + 4*2]= z1 - z2; block[i + 4*3]= z0 - z3; } for(i=0; i<4; i++){ const int z0= block[0 + 4*i] + block[2 + 4*i]; const int z1= block[0 + 4*i] - block[2 + 4*i]; const int z2= (block[1 + 4*i]>>1) - block[3 + 4*i]; const int z3= block[1 + 4*i] + (block[3 + 4*i]>>1); dst[i + 0*stride]= av_clip_pixel(dst[i + 0*stride] + ((z0 + z3) >> 6)); dst[i + 1*stride]= av_clip_pixel(dst[i + 1*stride] + ((z1 + z2) >> 6)); dst[i + 2*stride]= av_clip_pixel(dst[i + 2*stride] + ((z1 - z2) >> 6)); dst[i + 3*stride]= av_clip_pixel(dst[i + 3*stride] + ((z0 - z3) >> 6)); } memset(block, 0, 16 * sizeof(dctcoef)); }
{ "code": [ " const int z0= block[i + 4*0] + block[i + 4*2];", " const int z1= block[i + 4*0] - block[i + 4*2];", " const int z2= (block[i + 4*1]>>1) - block[i + 4*3];", " const int z3= block[i + 4*1] + (block[i + 4*3]>>1);", " const int z0= block[0 + 4*i] + block[2 + 4*i];", " const int z1= block[0 + 4*i] - block[2 + 4*i];", " const int z2= (block[1 + 4*i]>>1) - block[3 + 4*i];", " const int z3= block[1 + 4*i] + (block[3 + 4*i]>>1);", " dst[i + 0*stride]= av_clip_pixel(dst[i + 0*stride] + ((z0 + z3) >> 6));", " dst[i + 1*stride]= av_clip_pixel(dst[i + 1*stride] + ((z1 + z2) >> 6));", " dst[i + 2*stride]= av_clip_pixel(dst[i + 2*stride] + ((z1 - z2) >> 6));", " dst[i + 3*stride]= av_clip_pixel(dst[i + 3*stride] + ((z0 - z3) >> 6));" ], "line_no": [ 21, 23, 25, 27, 45, 47, 49, 51, 55, 57, 59, 61 ] }
void FUNC_0(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride) { int VAR_0; pixel *dst = (pixel*)_dst; dctcoef *block = (dctcoef*)_block; stride >>= sizeof(pixel)-1; block[0] += 1 << 5; for(VAR_0=0; VAR_0<4; VAR_0++){ const int VAR_5= block[VAR_0 + 4*0] + block[VAR_0 + 4*2]; const int VAR_5= block[VAR_0 + 4*0] - block[VAR_0 + 4*2]; const int VAR_5= (block[VAR_0 + 4*1]>>1) - block[VAR_0 + 4*3]; const int VAR_5= block[VAR_0 + 4*1] + (block[VAR_0 + 4*3]>>1); block[VAR_0 + 4*0]= VAR_5 + VAR_5; block[VAR_0 + 4*1]= VAR_5 + VAR_5; block[VAR_0 + 4*2]= VAR_5 - VAR_5; block[VAR_0 + 4*3]= VAR_5 - VAR_5; } for(VAR_0=0; VAR_0<4; VAR_0++){ const int VAR_5= block[0 + 4*VAR_0] + block[2 + 4*VAR_0]; const int VAR_5= block[0 + 4*VAR_0] - block[2 + 4*VAR_0]; const int VAR_5= (block[1 + 4*VAR_0]>>1) - block[3 + 4*VAR_0]; const int VAR_5= block[1 + 4*VAR_0] + (block[3 + 4*VAR_0]>>1); dst[VAR_0 + 0*stride]= av_clip_pixel(dst[VAR_0 + 0*stride] + ((VAR_5 + VAR_5) >> 6)); dst[VAR_0 + 1*stride]= av_clip_pixel(dst[VAR_0 + 1*stride] + ((VAR_5 + VAR_5) >> 6)); dst[VAR_0 + 2*stride]= av_clip_pixel(dst[VAR_0 + 2*stride] + ((VAR_5 - VAR_5) >> 6)); dst[VAR_0 + 3*stride]= av_clip_pixel(dst[VAR_0 + 3*stride] + ((VAR_5 - VAR_5) >> 6)); } memset(block, 0, 16 * sizeof(dctcoef)); }
[ "void FUNC_0(ff_h264_idct_add)(uint8_t *_dst, int16_t *_block, int stride)\n{", "int VAR_0;", "pixel *dst = (pixel*)_dst;", "dctcoef *block = (dctcoef*)_block;", "stride >>= sizeof(pixel)-1;", "block[0] += 1 << 5;", "for(VAR_0=0; VAR_0<4; VAR_0++){", "const int VAR_5= block[VAR_0 + 4*0] + block[VAR_0 + 4*2];", "const int VAR_5= block[VAR_0 + 4*0] - block[VAR_0 + 4*2];", "const int VAR_5= (block[VAR_0 + 4*1]>>1) - block[VAR_0 + 4*3];", "const int VAR_5= block[VAR_0 + 4*1] + (block[VAR_0 + 4*3]>>1);", "block[VAR_0 + 4*0]= VAR_5 + VAR_5;", "block[VAR_0 + 4*1]= VAR_5 + VAR_5;", "block[VAR_0 + 4*2]= VAR_5 - VAR_5;", "block[VAR_0 + 4*3]= VAR_5 - VAR_5;", "}", "for(VAR_0=0; VAR_0<4; VAR_0++){", "const int VAR_5= block[0 + 4*VAR_0] + block[2 + 4*VAR_0];", "const int VAR_5= block[0 + 4*VAR_0] - block[2 + 4*VAR_0];", "const int VAR_5= (block[1 + 4*VAR_0]>>1) - block[3 + 4*VAR_0];", "const int VAR_5= block[1 + 4*VAR_0] + (block[3 + 4*VAR_0]>>1);", "dst[VAR_0 + 0*stride]= av_clip_pixel(dst[VAR_0 + 0*stride] + ((VAR_5 + VAR_5) >> 6));", "dst[VAR_0 + 1*stride]= av_clip_pixel(dst[VAR_0 + 1*stride] + ((VAR_5 + VAR_5) >> 6));", "dst[VAR_0 + 2*stride]= av_clip_pixel(dst[VAR_0 + 2*stride] + ((VAR_5 - VAR_5) >> 6));", "dst[VAR_0 + 3*stride]= av_clip_pixel(dst[VAR_0 + 3*stride] + ((VAR_5 - VAR_5) >> 6));", "}", "memset(block, 0, 16 * sizeof(dctcoef));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ] ]
120
static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque, uint64_t flags) { RDMAControlHeader reg_resp = { .len = sizeof(RDMARegisterResult), .type = RDMA_CONTROL_REGISTER_RESULT, .repeat = 0, }; RDMAControlHeader unreg_resp = { .len = 0, .type = RDMA_CONTROL_UNREGISTER_FINISHED, .repeat = 0, }; RDMAControlHeader blocks = { .type = RDMA_CONTROL_RAM_BLOCKS_RESULT, .repeat = 1 }; QEMUFileRDMA *rfile = opaque; RDMAContext *rdma = rfile->rdma; RDMALocalBlocks *local = &rdma->local_ram_blocks; RDMAControlHeader head; RDMARegister *reg, *registers; RDMACompress *comp; RDMARegisterResult *reg_result; static RDMARegisterResult results[RDMA_CONTROL_MAX_COMMANDS_PER_MESSAGE]; RDMALocalBlock *block; void *host_addr; int ret = 0; int idx = 0; int count = 0; int i = 0; CHECK_ERROR_STATE(); do { DDDPRINTF("Waiting for next request %" PRIu64 "...\n", flags); ret = qemu_rdma_exchange_recv(rdma, &head, RDMA_CONTROL_NONE); if (ret < 0) { break; } if (head.repeat > RDMA_CONTROL_MAX_COMMANDS_PER_MESSAGE) { fprintf(stderr, "rdma: Too many requests in this message (%d)." "Bailing.\n", head.repeat); ret = -EIO; break; } switch (head.type) { case RDMA_CONTROL_COMPRESS: comp = (RDMACompress *) rdma->wr_data[idx].control_curr; network_to_compress(comp); DDPRINTF("Zapping zero chunk: %" PRId64 " bytes, index %d, offset %" PRId64 "\n", comp->length, comp->block_idx, comp->offset); block = &(rdma->local_ram_blocks.block[comp->block_idx]); host_addr = block->local_host_addr + (comp->offset - block->offset); ram_handle_compressed(host_addr, comp->value, comp->length); break; case RDMA_CONTROL_REGISTER_FINISHED: DDDPRINTF("Current registrations complete.\n"); goto out; case RDMA_CONTROL_RAM_BLOCKS_REQUEST: DPRINTF("Initial setup info requested.\n"); if (rdma->pin_all) { ret = qemu_rdma_reg_whole_ram_blocks(rdma); if (ret) { fprintf(stderr, "rdma migration: error dest " "registering ram blocks!\n"); goto out; } } /* * Dest uses this to prepare to transmit the RAMBlock descriptions * to the source VM after connection setup. * Both sides use the "remote" structure to communicate and update * their "local" descriptions with what was sent. */ for (i = 0; i < local->nb_blocks; i++) { rdma->block[i].remote_host_addr = (uint64_t)(local->block[i].local_host_addr); if (rdma->pin_all) { rdma->block[i].remote_rkey = local->block[i].mr->rkey; } rdma->block[i].offset = local->block[i].offset; rdma->block[i].length = local->block[i].length; remote_block_to_network(&rdma->block[i]); } blocks.len = rdma->local_ram_blocks.nb_blocks * sizeof(RDMARemoteBlock); ret = qemu_rdma_post_send_control(rdma, (uint8_t *) rdma->block, &blocks); if (ret < 0) { fprintf(stderr, "rdma migration: error sending remote info!\n"); goto out; } break; case RDMA_CONTROL_REGISTER_REQUEST: DDPRINTF("There are %d registration requests\n", head.repeat); reg_resp.repeat = head.repeat; registers = (RDMARegister *) rdma->wr_data[idx].control_curr; for (count = 0; count < head.repeat; count++) { uint64_t chunk; uint8_t *chunk_start, *chunk_end; reg = &registers[count]; network_to_register(reg); reg_result = &results[count]; DDPRINTF("Registration request (%d): index %d, current_addr %" PRIu64 " chunks: %" PRIu64 "\n", count, reg->current_index, reg->key.current_addr, reg->chunks); block = &(rdma->local_ram_blocks.block[reg->current_index]); if (block->is_ram_block) { host_addr = (block->local_host_addr + (reg->key.current_addr - block->offset)); chunk = ram_chunk_index(block->local_host_addr, (uint8_t *) host_addr); } else { chunk = reg->key.chunk; host_addr = block->local_host_addr + (reg->key.chunk * (1UL << RDMA_REG_CHUNK_SHIFT)); } chunk_start = ram_chunk_start(block, chunk); chunk_end = ram_chunk_end(block, chunk + reg->chunks); if (qemu_rdma_register_and_get_keys(rdma, block, (uint8_t *)host_addr, NULL, &reg_result->rkey, chunk, chunk_start, chunk_end)) { fprintf(stderr, "cannot get rkey!\n"); ret = -EINVAL; goto out; } reg_result->host_addr = (uint64_t) block->local_host_addr; DDPRINTF("Registered rkey for this request: %x\n", reg_result->rkey); result_to_network(reg_result); } ret = qemu_rdma_post_send_control(rdma, (uint8_t *) results, &reg_resp); if (ret < 0) { fprintf(stderr, "Failed to send control buffer!\n"); goto out; } break; case RDMA_CONTROL_UNREGISTER_REQUEST: DDPRINTF("There are %d unregistration requests\n", head.repeat); unreg_resp.repeat = head.repeat; registers = (RDMARegister *) rdma->wr_data[idx].control_curr; for (count = 0; count < head.repeat; count++) { reg = &registers[count]; network_to_register(reg); DDPRINTF("Unregistration request (%d): " " index %d, chunk %" PRIu64 "\n", count, reg->current_index, reg->key.chunk); block = &(rdma->local_ram_blocks.block[reg->current_index]); ret = ibv_dereg_mr(block->pmr[reg->key.chunk]); block->pmr[reg->key.chunk] = NULL; if (ret != 0) { perror("rdma unregistration chunk failed"); ret = -ret; goto out; } rdma->total_registrations--; DDPRINTF("Unregistered chunk %" PRIu64 " successfully.\n", reg->key.chunk); } ret = qemu_rdma_post_send_control(rdma, NULL, &unreg_resp); if (ret < 0) { fprintf(stderr, "Failed to send control buffer!\n"); goto out; } break; case RDMA_CONTROL_REGISTER_RESULT: fprintf(stderr, "Invalid RESULT message at dest.\n"); ret = -EIO; goto out; default: fprintf(stderr, "Unknown control message %s\n", control_desc[head.type]); ret = -EIO; goto out; } } while (1); out: if (ret < 0) { rdma->error_state = ret; } return ret; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque, uint64_t flags) { RDMAControlHeader reg_resp = { .len = sizeof(RDMARegisterResult), .type = RDMA_CONTROL_REGISTER_RESULT, .repeat = 0, }; RDMAControlHeader unreg_resp = { .len = 0, .type = RDMA_CONTROL_UNREGISTER_FINISHED, .repeat = 0, }; RDMAControlHeader blocks = { .type = RDMA_CONTROL_RAM_BLOCKS_RESULT, .repeat = 1 }; QEMUFileRDMA *rfile = opaque; RDMAContext *rdma = rfile->rdma; RDMALocalBlocks *local = &rdma->local_ram_blocks; RDMAControlHeader head; RDMARegister *reg, *registers; RDMACompress *comp; RDMARegisterResult *reg_result; static RDMARegisterResult results[RDMA_CONTROL_MAX_COMMANDS_PER_MESSAGE]; RDMALocalBlock *block; void *host_addr; int ret = 0; int idx = 0; int count = 0; int i = 0; CHECK_ERROR_STATE(); do { DDDPRINTF("Waiting for next request %" PRIu64 "...\n", flags); ret = qemu_rdma_exchange_recv(rdma, &head, RDMA_CONTROL_NONE); if (ret < 0) { break; } if (head.repeat > RDMA_CONTROL_MAX_COMMANDS_PER_MESSAGE) { fprintf(stderr, "rdma: Too many requests in this message (%d)." "Bailing.\n", head.repeat); ret = -EIO; break; } switch (head.type) { case RDMA_CONTROL_COMPRESS: comp = (RDMACompress *) rdma->wr_data[idx].control_curr; network_to_compress(comp); DDPRINTF("Zapping zero chunk: %" PRId64 " bytes, index %d, offset %" PRId64 "\n", comp->length, comp->block_idx, comp->offset); block = &(rdma->local_ram_blocks.block[comp->block_idx]); host_addr = block->local_host_addr + (comp->offset - block->offset); ram_handle_compressed(host_addr, comp->value, comp->length); break; case RDMA_CONTROL_REGISTER_FINISHED: DDDPRINTF("Current registrations complete.\n"); goto out; case RDMA_CONTROL_RAM_BLOCKS_REQUEST: DPRINTF("Initial setup info requested.\n"); if (rdma->pin_all) { ret = qemu_rdma_reg_whole_ram_blocks(rdma); if (ret) { fprintf(stderr, "rdma migration: error dest " "registering ram blocks!\n"); goto out; } } for (i = 0; i < local->nb_blocks; i++) { rdma->block[i].remote_host_addr = (uint64_t)(local->block[i].local_host_addr); if (rdma->pin_all) { rdma->block[i].remote_rkey = local->block[i].mr->rkey; } rdma->block[i].offset = local->block[i].offset; rdma->block[i].length = local->block[i].length; remote_block_to_network(&rdma->block[i]); } blocks.len = rdma->local_ram_blocks.nb_blocks * sizeof(RDMARemoteBlock); ret = qemu_rdma_post_send_control(rdma, (uint8_t *) rdma->block, &blocks); if (ret < 0) { fprintf(stderr, "rdma migration: error sending remote info!\n"); goto out; } break; case RDMA_CONTROL_REGISTER_REQUEST: DDPRINTF("There are %d registration requests\n", head.repeat); reg_resp.repeat = head.repeat; registers = (RDMARegister *) rdma->wr_data[idx].control_curr; for (count = 0; count < head.repeat; count++) { uint64_t chunk; uint8_t *chunk_start, *chunk_end; reg = &registers[count]; network_to_register(reg); reg_result = &results[count]; DDPRINTF("Registration request (%d): index %d, current_addr %" PRIu64 " chunks: %" PRIu64 "\n", count, reg->current_index, reg->key.current_addr, reg->chunks); block = &(rdma->local_ram_blocks.block[reg->current_index]); if (block->is_ram_block) { host_addr = (block->local_host_addr + (reg->key.current_addr - block->offset)); chunk = ram_chunk_index(block->local_host_addr, (uint8_t *) host_addr); } else { chunk = reg->key.chunk; host_addr = block->local_host_addr + (reg->key.chunk * (1UL << RDMA_REG_CHUNK_SHIFT)); } chunk_start = ram_chunk_start(block, chunk); chunk_end = ram_chunk_end(block, chunk + reg->chunks); if (qemu_rdma_register_and_get_keys(rdma, block, (uint8_t *)host_addr, NULL, &reg_result->rkey, chunk, chunk_start, chunk_end)) { fprintf(stderr, "cannot get rkey!\n"); ret = -EINVAL; goto out; } reg_result->host_addr = (uint64_t) block->local_host_addr; DDPRINTF("Registered rkey for this request: %x\n", reg_result->rkey); result_to_network(reg_result); } ret = qemu_rdma_post_send_control(rdma, (uint8_t *) results, &reg_resp); if (ret < 0) { fprintf(stderr, "Failed to send control buffer!\n"); goto out; } break; case RDMA_CONTROL_UNREGISTER_REQUEST: DDPRINTF("There are %d unregistration requests\n", head.repeat); unreg_resp.repeat = head.repeat; registers = (RDMARegister *) rdma->wr_data[idx].control_curr; for (count = 0; count < head.repeat; count++) { reg = &registers[count]; network_to_register(reg); DDPRINTF("Unregistration request (%d): " " index %d, chunk %" PRIu64 "\n", count, reg->current_index, reg->key.chunk); block = &(rdma->local_ram_blocks.block[reg->current_index]); ret = ibv_dereg_mr(block->pmr[reg->key.chunk]); block->pmr[reg->key.chunk] = NULL; if (ret != 0) { perror("rdma unregistration chunk failed"); ret = -ret; goto out; } rdma->total_registrations--; DDPRINTF("Unregistered chunk %" PRIu64 " successfully.\n", reg->key.chunk); } ret = qemu_rdma_post_send_control(rdma, NULL, &unreg_resp); if (ret < 0) { fprintf(stderr, "Failed to send control buffer!\n"); goto out; } break; case RDMA_CONTROL_REGISTER_RESULT: fprintf(stderr, "Invalid RESULT message at dest.\n"); ret = -EIO; goto out; default: fprintf(stderr, "Unknown control message %s\n", control_desc[head.type]); ret = -EIO; goto out; } } while (1); out: if (ret < 0) { rdma->error_state = ret; } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, uint64_t VAR_2) { RDMAControlHeader reg_resp = { .len = sizeof(RDMARegisterResult), .type = RDMA_CONTROL_REGISTER_RESULT, .repeat = 0, }; RDMAControlHeader unreg_resp = { .len = 0, .type = RDMA_CONTROL_UNREGISTER_FINISHED, .repeat = 0, }; RDMAControlHeader blocks = { .type = RDMA_CONTROL_RAM_BLOCKS_RESULT, .repeat = 1 }; QEMUFileRDMA *rfile = VAR_1; RDMAContext *rdma = rfile->rdma; RDMALocalBlocks *local = &rdma->local_ram_blocks; RDMAControlHeader head; RDMARegister *reg, *registers; RDMACompress *comp; RDMARegisterResult *reg_result; static RDMARegisterResult VAR_3[RDMA_CONTROL_MAX_COMMANDS_PER_MESSAGE]; RDMALocalBlock *block; void *VAR_4; int VAR_5 = 0; int VAR_6 = 0; int VAR_7 = 0; int VAR_8 = 0; CHECK_ERROR_STATE(); do { DDDPRINTF("Waiting for next request %" PRIu64 "...\n", VAR_2); VAR_5 = qemu_rdma_exchange_recv(rdma, &head, RDMA_CONTROL_NONE); if (VAR_5 < 0) { break; } if (head.repeat > RDMA_CONTROL_MAX_COMMANDS_PER_MESSAGE) { fprintf(stderr, "rdma: Too many requests in this message (%d)." "Bailing.\n", head.repeat); VAR_5 = -EIO; break; } switch (head.type) { case RDMA_CONTROL_COMPRESS: comp = (RDMACompress *) rdma->wr_data[VAR_6].control_curr; network_to_compress(comp); DDPRINTF("Zapping zero chunk: %" PRId64 " bytes, index %d, offset %" PRId64 "\n", comp->length, comp->block_idx, comp->offset); block = &(rdma->local_ram_blocks.block[comp->block_idx]); VAR_4 = block->local_host_addr + (comp->offset - block->offset); ram_handle_compressed(VAR_4, comp->value, comp->length); break; case RDMA_CONTROL_REGISTER_FINISHED: DDDPRINTF("Current registrations complete.\n"); goto out; case RDMA_CONTROL_RAM_BLOCKS_REQUEST: DPRINTF("Initial setup info requested.\n"); if (rdma->pin_all) { VAR_5 = qemu_rdma_reg_whole_ram_blocks(rdma); if (VAR_5) { fprintf(stderr, "rdma migration: error dest " "registering ram blocks!\n"); goto out; } } for (VAR_8 = 0; VAR_8 < local->nb_blocks; VAR_8++) { rdma->block[VAR_8].remote_host_addr = (uint64_t)(local->block[VAR_8].local_host_addr); if (rdma->pin_all) { rdma->block[VAR_8].remote_rkey = local->block[VAR_8].mr->rkey; } rdma->block[VAR_8].offset = local->block[VAR_8].offset; rdma->block[VAR_8].length = local->block[VAR_8].length; remote_block_to_network(&rdma->block[VAR_8]); } blocks.len = rdma->local_ram_blocks.nb_blocks * sizeof(RDMARemoteBlock); VAR_5 = qemu_rdma_post_send_control(rdma, (uint8_t *) rdma->block, &blocks); if (VAR_5 < 0) { fprintf(stderr, "rdma migration: error sending remote info!\n"); goto out; } break; case RDMA_CONTROL_REGISTER_REQUEST: DDPRINTF("There are %d registration requests\n", head.repeat); reg_resp.repeat = head.repeat; registers = (RDMARegister *) rdma->wr_data[VAR_6].control_curr; for (VAR_7 = 0; VAR_7 < head.repeat; VAR_7++) { uint64_t chunk; uint8_t *chunk_start, *chunk_end; reg = &registers[VAR_7]; network_to_register(reg); reg_result = &VAR_3[VAR_7]; DDPRINTF("Registration request (%d): index %d, current_addr %" PRIu64 " chunks: %" PRIu64 "\n", VAR_7, reg->current_index, reg->key.current_addr, reg->chunks); block = &(rdma->local_ram_blocks.block[reg->current_index]); if (block->is_ram_block) { VAR_4 = (block->local_host_addr + (reg->key.current_addr - block->offset)); chunk = ram_chunk_index(block->local_host_addr, (uint8_t *) VAR_4); } else { chunk = reg->key.chunk; VAR_4 = block->local_host_addr + (reg->key.chunk * (1UL << RDMA_REG_CHUNK_SHIFT)); } chunk_start = ram_chunk_start(block, chunk); chunk_end = ram_chunk_end(block, chunk + reg->chunks); if (qemu_rdma_register_and_get_keys(rdma, block, (uint8_t *)VAR_4, NULL, &reg_result->rkey, chunk, chunk_start, chunk_end)) { fprintf(stderr, "cannot get rkey!\n"); VAR_5 = -EINVAL; goto out; } reg_result->VAR_4 = (uint64_t) block->local_host_addr; DDPRINTF("Registered rkey for this request: %x\n", reg_result->rkey); result_to_network(reg_result); } VAR_5 = qemu_rdma_post_send_control(rdma, (uint8_t *) VAR_3, &reg_resp); if (VAR_5 < 0) { fprintf(stderr, "Failed to send control buffer!\n"); goto out; } break; case RDMA_CONTROL_UNREGISTER_REQUEST: DDPRINTF("There are %d unregistration requests\n", head.repeat); unreg_resp.repeat = head.repeat; registers = (RDMARegister *) rdma->wr_data[VAR_6].control_curr; for (VAR_7 = 0; VAR_7 < head.repeat; VAR_7++) { reg = &registers[VAR_7]; network_to_register(reg); DDPRINTF("Unregistration request (%d): " " index %d, chunk %" PRIu64 "\n", VAR_7, reg->current_index, reg->key.chunk); block = &(rdma->local_ram_blocks.block[reg->current_index]); VAR_5 = ibv_dereg_mr(block->pmr[reg->key.chunk]); block->pmr[reg->key.chunk] = NULL; if (VAR_5 != 0) { perror("rdma unregistration chunk failed"); VAR_5 = -VAR_5; goto out; } rdma->total_registrations--; DDPRINTF("Unregistered chunk %" PRIu64 " successfully.\n", reg->key.chunk); } VAR_5 = qemu_rdma_post_send_control(rdma, NULL, &unreg_resp); if (VAR_5 < 0) { fprintf(stderr, "Failed to send control buffer!\n"); goto out; } break; case RDMA_CONTROL_REGISTER_RESULT: fprintf(stderr, "Invalid RESULT message at dest.\n"); VAR_5 = -EIO; goto out; default: fprintf(stderr, "Unknown control message %s\n", control_desc[head.type]); VAR_5 = -EIO; goto out; } } while (1); out: if (VAR_5 < 0) { rdma->error_state = VAR_5; } return VAR_5; }
[ "static int FUNC_0(QEMUFile *VAR_0, void *VAR_1,\nuint64_t VAR_2)\n{", "RDMAControlHeader reg_resp = { .len = sizeof(RDMARegisterResult),", ".type = RDMA_CONTROL_REGISTER_RESULT,\n.repeat = 0,\n};", "RDMAControlHeader unreg_resp = { .len = 0,", ".type = RDMA_CONTROL_UNREGISTER_FINISHED,\n.repeat = 0,\n};", "RDMAControlHeader blocks = { .type = RDMA_CONTROL_RAM_BLOCKS_RESULT,", ".repeat = 1 };", "QEMUFileRDMA *rfile = VAR_1;", "RDMAContext *rdma = rfile->rdma;", "RDMALocalBlocks *local = &rdma->local_ram_blocks;", "RDMAControlHeader head;", "RDMARegister *reg, *registers;", "RDMACompress *comp;", "RDMARegisterResult *reg_result;", "static RDMARegisterResult VAR_3[RDMA_CONTROL_MAX_COMMANDS_PER_MESSAGE];", "RDMALocalBlock *block;", "void *VAR_4;", "int VAR_5 = 0;", "int VAR_6 = 0;", "int VAR_7 = 0;", "int VAR_8 = 0;", "CHECK_ERROR_STATE();", "do {", "DDDPRINTF(\"Waiting for next request %\" PRIu64 \"...\\n\", VAR_2);", "VAR_5 = qemu_rdma_exchange_recv(rdma, &head, RDMA_CONTROL_NONE);", "if (VAR_5 < 0) {", "break;", "}", "if (head.repeat > RDMA_CONTROL_MAX_COMMANDS_PER_MESSAGE) {", "fprintf(stderr, \"rdma: Too many requests in this message (%d).\"\n\"Bailing.\\n\", head.repeat);", "VAR_5 = -EIO;", "break;", "}", "switch (head.type) {", "case RDMA_CONTROL_COMPRESS:\ncomp = (RDMACompress *) rdma->wr_data[VAR_6].control_curr;", "network_to_compress(comp);", "DDPRINTF(\"Zapping zero chunk: %\" PRId64\n\" bytes, index %d, offset %\" PRId64 \"\\n\",\ncomp->length, comp->block_idx, comp->offset);", "block = &(rdma->local_ram_blocks.block[comp->block_idx]);", "VAR_4 = block->local_host_addr +\n(comp->offset - block->offset);", "ram_handle_compressed(VAR_4, comp->value, comp->length);", "break;", "case RDMA_CONTROL_REGISTER_FINISHED:\nDDDPRINTF(\"Current registrations complete.\\n\");", "goto out;", "case RDMA_CONTROL_RAM_BLOCKS_REQUEST:\nDPRINTF(\"Initial setup info requested.\\n\");", "if (rdma->pin_all) {", "VAR_5 = qemu_rdma_reg_whole_ram_blocks(rdma);", "if (VAR_5) {", "fprintf(stderr, \"rdma migration: error dest \"\n\"registering ram blocks!\\n\");", "goto out;", "}", "}", "for (VAR_8 = 0; VAR_8 < local->nb_blocks; VAR_8++) {", "rdma->block[VAR_8].remote_host_addr =\n(uint64_t)(local->block[VAR_8].local_host_addr);", "if (rdma->pin_all) {", "rdma->block[VAR_8].remote_rkey = local->block[VAR_8].mr->rkey;", "}", "rdma->block[VAR_8].offset = local->block[VAR_8].offset;", "rdma->block[VAR_8].length = local->block[VAR_8].length;", "remote_block_to_network(&rdma->block[VAR_8]);", "}", "blocks.len = rdma->local_ram_blocks.nb_blocks\n* sizeof(RDMARemoteBlock);", "VAR_5 = qemu_rdma_post_send_control(rdma,\n(uint8_t *) rdma->block, &blocks);", "if (VAR_5 < 0) {", "fprintf(stderr, \"rdma migration: error sending remote info!\\n\");", "goto out;", "}", "break;", "case RDMA_CONTROL_REGISTER_REQUEST:\nDDPRINTF(\"There are %d registration requests\\n\", head.repeat);", "reg_resp.repeat = head.repeat;", "registers = (RDMARegister *) rdma->wr_data[VAR_6].control_curr;", "for (VAR_7 = 0; VAR_7 < head.repeat; VAR_7++) {", "uint64_t chunk;", "uint8_t *chunk_start, *chunk_end;", "reg = &registers[VAR_7];", "network_to_register(reg);", "reg_result = &VAR_3[VAR_7];", "DDPRINTF(\"Registration request (%d): index %d, current_addr %\"\nPRIu64 \" chunks: %\" PRIu64 \"\\n\", VAR_7,\nreg->current_index, reg->key.current_addr, reg->chunks);", "block = &(rdma->local_ram_blocks.block[reg->current_index]);", "if (block->is_ram_block) {", "VAR_4 = (block->local_host_addr +\n(reg->key.current_addr - block->offset));", "chunk = ram_chunk_index(block->local_host_addr,\n(uint8_t *) VAR_4);", "} else {", "chunk = reg->key.chunk;", "VAR_4 = block->local_host_addr +\n(reg->key.chunk * (1UL << RDMA_REG_CHUNK_SHIFT));", "}", "chunk_start = ram_chunk_start(block, chunk);", "chunk_end = ram_chunk_end(block, chunk + reg->chunks);", "if (qemu_rdma_register_and_get_keys(rdma, block,\n(uint8_t *)VAR_4, NULL, &reg_result->rkey,\nchunk, chunk_start, chunk_end)) {", "fprintf(stderr, \"cannot get rkey!\\n\");", "VAR_5 = -EINVAL;", "goto out;", "}", "reg_result->VAR_4 = (uint64_t) block->local_host_addr;", "DDPRINTF(\"Registered rkey for this request: %x\\n\",\nreg_result->rkey);", "result_to_network(reg_result);", "}", "VAR_5 = qemu_rdma_post_send_control(rdma,\n(uint8_t *) VAR_3, &reg_resp);", "if (VAR_5 < 0) {", "fprintf(stderr, \"Failed to send control buffer!\\n\");", "goto out;", "}", "break;", "case RDMA_CONTROL_UNREGISTER_REQUEST:\nDDPRINTF(\"There are %d unregistration requests\\n\", head.repeat);", "unreg_resp.repeat = head.repeat;", "registers = (RDMARegister *) rdma->wr_data[VAR_6].control_curr;", "for (VAR_7 = 0; VAR_7 < head.repeat; VAR_7++) {", "reg = &registers[VAR_7];", "network_to_register(reg);", "DDPRINTF(\"Unregistration request (%d): \"\n\" index %d, chunk %\" PRIu64 \"\\n\",\nVAR_7, reg->current_index, reg->key.chunk);", "block = &(rdma->local_ram_blocks.block[reg->current_index]);", "VAR_5 = ibv_dereg_mr(block->pmr[reg->key.chunk]);", "block->pmr[reg->key.chunk] = NULL;", "if (VAR_5 != 0) {", "perror(\"rdma unregistration chunk failed\");", "VAR_5 = -VAR_5;", "goto out;", "}", "rdma->total_registrations--;", "DDPRINTF(\"Unregistered chunk %\" PRIu64 \" successfully.\\n\",\nreg->key.chunk);", "}", "VAR_5 = qemu_rdma_post_send_control(rdma, NULL, &unreg_resp);", "if (VAR_5 < 0) {", "fprintf(stderr, \"Failed to send control buffer!\\n\");", "goto out;", "}", "break;", "case RDMA_CONTROL_REGISTER_RESULT:\nfprintf(stderr, \"Invalid RESULT message at dest.\\n\");", "VAR_5 = -EIO;", "goto out;", "default:\nfprintf(stderr, \"Unknown control message %s\\n\",\ncontrol_desc[head.type]);", "VAR_5 = -EIO;", "goto out;", "}", "} while (1);", "out:\nif (VAR_5 < 0) {", "rdma->error_state = VAR_5;", "}", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 103, 105, 107 ], [ 109 ], [ 113, 115 ], [ 119 ], [ 121 ], [ 125, 127 ], [ 129 ], [ 133, 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 169 ], [ 171, 173 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ], [ 197, 199 ], [ 205, 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221 ], [ 223, 225 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ], [ 249 ], [ 253, 255, 257 ], [ 261 ], [ 263 ], [ 265, 267 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287, 289, 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 303 ], [ 307, 309 ], [ 313 ], [ 315 ], [ 319, 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335, 337 ], [ 339 ], [ 341 ], [ 345 ], [ 347 ], [ 349 ], [ 353, 355, 357 ], [ 361 ], [ 365 ], [ 367 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 383 ], [ 387, 389 ], [ 391 ], [ 395 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409, 411 ], [ 413 ], [ 415 ], [ 417, 419, 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431, 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ] ]
123
static int read_data(void *opaque, uint8_t *buf, int buf_size) { struct playlist *v = opaque; HLSContext *c = v->parent->priv_data; int ret, i; int just_opened = 0; restart: if (!v->needed) return AVERROR_EOF; if (!v->input) { int64_t reload_interval; struct segment *seg; /* Check that the playlist is still needed before opening a new * segment. */ if (v->ctx && v->ctx->nb_streams) { v->needed = 0; for (i = 0; i < v->n_main_streams; i++) { if (v->main_streams[i]->discard < AVDISCARD_ALL) { v->needed = 1; break; } } } if (!v->needed) { av_log(v->parent, AV_LOG_INFO, "No longer receiving playlist %d\n", v->index); return AVERROR_EOF; } /* If this is a live stream and the reload interval has elapsed since * the last playlist reload, reload the playlists now. */ reload_interval = default_reload_interval(v); reload: reload_count++; if (reload_count > c->max_reload) return AVERROR_EOF; if (!v->finished && av_gettime_relative() - v->last_load_time >= reload_interval) { if ((ret = parse_playlist(c, v->url, v, NULL)) < 0) { av_log(v->parent, AV_LOG_WARNING, "Failed to reload playlist %d\n", v->index); return ret; } /* If we need to reload the playlist again below (if * there's still no more segments), switch to a reload * interval of half the target duration. */ reload_interval = v->target_duration / 2; } if (v->cur_seq_no < v->start_seq_no) { av_log(NULL, AV_LOG_WARNING, "skipping %d segments ahead, expired from playlists\n", v->start_seq_no - v->cur_seq_no); v->cur_seq_no = v->start_seq_no; } if (v->cur_seq_no >= v->start_seq_no + v->n_segments) { if (v->finished) return AVERROR_EOF; while (av_gettime_relative() - v->last_load_time < reload_interval) { if (ff_check_interrupt(c->interrupt_callback)) return AVERROR_EXIT; av_usleep(100*1000); } /* Enough time has elapsed since the last reload */ goto reload; } seg = current_segment(v); /* load/update Media Initialization Section, if any */ ret = update_init_section(v, seg); if (ret) return ret; ret = open_input(c, v, seg); if (ret < 0) { if (ff_check_interrupt(c->interrupt_callback)) return AVERROR_EXIT; av_log(v->parent, AV_LOG_WARNING, "Failed to open segment of playlist %d\n", v->index); v->cur_seq_no += 1; goto reload; } just_opened = 1; } if (v->init_sec_buf_read_offset < v->init_sec_data_len) { /* Push init section out first before first actual segment */ int copy_size = FFMIN(v->init_sec_data_len - v->init_sec_buf_read_offset, buf_size); memcpy(buf, v->init_sec_buf, copy_size); v->init_sec_buf_read_offset += copy_size; return copy_size; } ret = read_from_url(v, current_segment(v), buf, buf_size, READ_NORMAL); if (ret > 0) { if (just_opened && v->is_id3_timestamped != 0) { /* Intercept ID3 tags here, elementary audio streams are required * to convey timestamps using them in the beginning of each segment. */ intercept_id3(v, buf, buf_size, &ret); } return ret; } ff_format_io_close(v->parent, &v->input); v->cur_seq_no++; c->cur_seq_no = v->cur_seq_no; goto restart; }
true
FFmpeg
7ec414892ddcad88313848494b6fc5f437c9ca4a
static int read_data(void *opaque, uint8_t *buf, int buf_size) { struct playlist *v = opaque; HLSContext *c = v->parent->priv_data; int ret, i; int just_opened = 0; restart: if (!v->needed) return AVERROR_EOF; if (!v->input) { int64_t reload_interval; struct segment *seg; if (v->ctx && v->ctx->nb_streams) { v->needed = 0; for (i = 0; i < v->n_main_streams; i++) { if (v->main_streams[i]->discard < AVDISCARD_ALL) { v->needed = 1; break; } } } if (!v->needed) { av_log(v->parent, AV_LOG_INFO, "No longer receiving playlist %d\n", v->index); return AVERROR_EOF; } reload_interval = default_reload_interval(v); reload: reload_count++; if (reload_count > c->max_reload) return AVERROR_EOF; if (!v->finished && av_gettime_relative() - v->last_load_time >= reload_interval) { if ((ret = parse_playlist(c, v->url, v, NULL)) < 0) { av_log(v->parent, AV_LOG_WARNING, "Failed to reload playlist %d\n", v->index); return ret; } reload_interval = v->target_duration / 2; } if (v->cur_seq_no < v->start_seq_no) { av_log(NULL, AV_LOG_WARNING, "skipping %d segments ahead, expired from playlists\n", v->start_seq_no - v->cur_seq_no); v->cur_seq_no = v->start_seq_no; } if (v->cur_seq_no >= v->start_seq_no + v->n_segments) { if (v->finished) return AVERROR_EOF; while (av_gettime_relative() - v->last_load_time < reload_interval) { if (ff_check_interrupt(c->interrupt_callback)) return AVERROR_EXIT; av_usleep(100*1000); } goto reload; } seg = current_segment(v); ret = update_init_section(v, seg); if (ret) return ret; ret = open_input(c, v, seg); if (ret < 0) { if (ff_check_interrupt(c->interrupt_callback)) return AVERROR_EXIT; av_log(v->parent, AV_LOG_WARNING, "Failed to open segment of playlist %d\n", v->index); v->cur_seq_no += 1; goto reload; } just_opened = 1; } if (v->init_sec_buf_read_offset < v->init_sec_data_len) { int copy_size = FFMIN(v->init_sec_data_len - v->init_sec_buf_read_offset, buf_size); memcpy(buf, v->init_sec_buf, copy_size); v->init_sec_buf_read_offset += copy_size; return copy_size; } ret = read_from_url(v, current_segment(v), buf, buf_size, READ_NORMAL); if (ret > 0) { if (just_opened && v->is_id3_timestamped != 0) { intercept_id3(v, buf, buf_size, &ret); } return ret; } ff_format_io_close(v->parent, &v->input); v->cur_seq_no++; c->cur_seq_no = v->cur_seq_no; goto restart; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, uint8_t *VAR_1, int VAR_2) { struct playlist *VAR_3 = VAR_0; HLSContext *c = VAR_3->parent->priv_data; int VAR_4, VAR_5; int VAR_6 = 0; restart: if (!VAR_3->needed) return AVERROR_EOF; if (!VAR_3->input) { int64_t reload_interval; struct segment *VAR_7; if (VAR_3->ctx && VAR_3->ctx->nb_streams) { VAR_3->needed = 0; for (VAR_5 = 0; VAR_5 < VAR_3->n_main_streams; VAR_5++) { if (VAR_3->main_streams[VAR_5]->discard < AVDISCARD_ALL) { VAR_3->needed = 1; break; } } } if (!VAR_3->needed) { av_log(VAR_3->parent, AV_LOG_INFO, "No longer receiving playlist %d\n", VAR_3->index); return AVERROR_EOF; } reload_interval = default_reload_interval(VAR_3); reload: reload_count++; if (reload_count > c->max_reload) return AVERROR_EOF; if (!VAR_3->finished && av_gettime_relative() - VAR_3->last_load_time >= reload_interval) { if ((VAR_4 = parse_playlist(c, VAR_3->url, VAR_3, NULL)) < 0) { av_log(VAR_3->parent, AV_LOG_WARNING, "Failed to reload playlist %d\n", VAR_3->index); return VAR_4; } reload_interval = VAR_3->target_duration / 2; } if (VAR_3->cur_seq_no < VAR_3->start_seq_no) { av_log(NULL, AV_LOG_WARNING, "skipping %d segments ahead, expired from playlists\n", VAR_3->start_seq_no - VAR_3->cur_seq_no); VAR_3->cur_seq_no = VAR_3->start_seq_no; } if (VAR_3->cur_seq_no >= VAR_3->start_seq_no + VAR_3->n_segments) { if (VAR_3->finished) return AVERROR_EOF; while (av_gettime_relative() - VAR_3->last_load_time < reload_interval) { if (ff_check_interrupt(c->interrupt_callback)) return AVERROR_EXIT; av_usleep(100*1000); } goto reload; } VAR_7 = current_segment(VAR_3); VAR_4 = update_init_section(VAR_3, VAR_7); if (VAR_4) return VAR_4; VAR_4 = open_input(c, VAR_3, VAR_7); if (VAR_4 < 0) { if (ff_check_interrupt(c->interrupt_callback)) return AVERROR_EXIT; av_log(VAR_3->parent, AV_LOG_WARNING, "Failed to open segment of playlist %d\n", VAR_3->index); VAR_3->cur_seq_no += 1; goto reload; } VAR_6 = 1; } if (VAR_3->init_sec_buf_read_offset < VAR_3->init_sec_data_len) { int VAR_8 = FFMIN(VAR_3->init_sec_data_len - VAR_3->init_sec_buf_read_offset, VAR_2); memcpy(VAR_1, VAR_3->init_sec_buf, VAR_8); VAR_3->init_sec_buf_read_offset += VAR_8; return VAR_8; } VAR_4 = read_from_url(VAR_3, current_segment(VAR_3), VAR_1, VAR_2, READ_NORMAL); if (VAR_4 > 0) { if (VAR_6 && VAR_3->is_id3_timestamped != 0) { intercept_id3(VAR_3, VAR_1, VAR_2, &VAR_4); } return VAR_4; } ff_format_io_close(VAR_3->parent, &VAR_3->input); VAR_3->cur_seq_no++; c->cur_seq_no = VAR_3->cur_seq_no; goto restart; }
[ "static int FUNC_0(void *VAR_0, uint8_t *VAR_1, int VAR_2)\n{", "struct playlist *VAR_3 = VAR_0;", "HLSContext *c = VAR_3->parent->priv_data;", "int VAR_4, VAR_5;", "int VAR_6 = 0;", "restart:\nif (!VAR_3->needed)\nreturn AVERROR_EOF;", "if (!VAR_3->input) {", "int64_t reload_interval;", "struct segment *VAR_7;", "if (VAR_3->ctx && VAR_3->ctx->nb_streams) {", "VAR_3->needed = 0;", "for (VAR_5 = 0; VAR_5 < VAR_3->n_main_streams; VAR_5++) {", "if (VAR_3->main_streams[VAR_5]->discard < AVDISCARD_ALL) {", "VAR_3->needed = 1;", "break;", "}", "}", "}", "if (!VAR_3->needed) {", "av_log(VAR_3->parent, AV_LOG_INFO, \"No longer receiving playlist %d\\n\",\nVAR_3->index);", "return AVERROR_EOF;", "}", "reload_interval = default_reload_interval(VAR_3);", "reload:\nreload_count++;", "if (reload_count > c->max_reload)\nreturn AVERROR_EOF;", "if (!VAR_3->finished &&\nav_gettime_relative() - VAR_3->last_load_time >= reload_interval) {", "if ((VAR_4 = parse_playlist(c, VAR_3->url, VAR_3, NULL)) < 0) {", "av_log(VAR_3->parent, AV_LOG_WARNING, \"Failed to reload playlist %d\\n\",\nVAR_3->index);", "return VAR_4;", "}", "reload_interval = VAR_3->target_duration / 2;", "}", "if (VAR_3->cur_seq_no < VAR_3->start_seq_no) {", "av_log(NULL, AV_LOG_WARNING,\n\"skipping %d segments ahead, expired from playlists\\n\",\nVAR_3->start_seq_no - VAR_3->cur_seq_no);", "VAR_3->cur_seq_no = VAR_3->start_seq_no;", "}", "if (VAR_3->cur_seq_no >= VAR_3->start_seq_no + VAR_3->n_segments) {", "if (VAR_3->finished)\nreturn AVERROR_EOF;", "while (av_gettime_relative() - VAR_3->last_load_time < reload_interval) {", "if (ff_check_interrupt(c->interrupt_callback))\nreturn AVERROR_EXIT;", "av_usleep(100*1000);", "}", "goto reload;", "}", "VAR_7 = current_segment(VAR_3);", "VAR_4 = update_init_section(VAR_3, VAR_7);", "if (VAR_4)\nreturn VAR_4;", "VAR_4 = open_input(c, VAR_3, VAR_7);", "if (VAR_4 < 0) {", "if (ff_check_interrupt(c->interrupt_callback))\nreturn AVERROR_EXIT;", "av_log(VAR_3->parent, AV_LOG_WARNING, \"Failed to open segment of playlist %d\\n\",\nVAR_3->index);", "VAR_3->cur_seq_no += 1;", "goto reload;", "}", "VAR_6 = 1;", "}", "if (VAR_3->init_sec_buf_read_offset < VAR_3->init_sec_data_len) {", "int VAR_8 = FFMIN(VAR_3->init_sec_data_len - VAR_3->init_sec_buf_read_offset, VAR_2);", "memcpy(VAR_1, VAR_3->init_sec_buf, VAR_8);", "VAR_3->init_sec_buf_read_offset += VAR_8;", "return VAR_8;", "}", "VAR_4 = read_from_url(VAR_3, current_segment(VAR_3), VAR_1, VAR_2, READ_NORMAL);", "if (VAR_4 > 0) {", "if (VAR_6 && VAR_3->is_id3_timestamped != 0) {", "intercept_id3(VAR_3, VAR_1, VAR_2, &VAR_4);", "}", "return VAR_4;", "}", "ff_format_io_close(VAR_3->parent, &VAR_3->input);", "VAR_3->cur_seq_no++;", "c->cur_seq_no = VAR_3->cur_seq_no;", "goto restart;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 16, 18, 20 ], [ 24 ], [ 26 ], [ 28 ], [ 36 ], [ 38 ], [ 40 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 50 ], [ 52 ], [ 54 ], [ 56, 58 ], [ 60 ], [ 62 ], [ 70 ], [ 74, 76 ], [ 78, 80 ], [ 82, 84 ], [ 86 ], [ 88, 90 ], [ 92 ], [ 94 ], [ 102 ], [ 104 ], [ 106 ], [ 108, 110, 112 ], [ 114 ], [ 116 ], [ 118 ], [ 120, 122 ], [ 124 ], [ 126, 128 ], [ 130 ], [ 132 ], [ 136 ], [ 138 ], [ 142 ], [ 148 ], [ 150, 152 ], [ 156 ], [ 158 ], [ 160, 162 ], [ 164, 166 ], [ 168 ], [ 170 ], [ 172 ], [ 174 ], [ 176 ], [ 180 ], [ 184 ], [ 186 ], [ 188 ], [ 190 ], [ 192 ], [ 196 ], [ 198 ], [ 200 ], [ 206 ], [ 208 ], [ 212 ], [ 214 ], [ 216 ], [ 218 ], [ 222 ], [ 226 ], [ 228 ] ]
124
static void put_swf_matrix(ByteIOContext *pb, int a, int b, int c, int d, int tx, int ty) { PutBitContext p; uint8_t buf[256]; init_put_bits(&p, buf, sizeof(buf)); put_bits(&p, 1, 1); /* a, d present */ put_bits(&p, 5, 20); /* nb bits */ put_bits(&p, 20, a); put_bits(&p, 20, d); put_bits(&p, 1, 1); /* b, c present */ put_bits(&p, 5, 20); /* nb bits */ put_bits(&p, 20, c); put_bits(&p, 20, b); put_bits(&p, 5, 20); /* nb bits */ put_bits(&p, 20, tx); put_bits(&p, 20, ty); flush_put_bits(&p); put_buffer(pb, buf, pbBufPtr(&p) - p.buf); }
true
FFmpeg
747a0554ea8ad09404c1f5b80239ebd8d71b291e
static void put_swf_matrix(ByteIOContext *pb, int a, int b, int c, int d, int tx, int ty) { PutBitContext p; uint8_t buf[256]; init_put_bits(&p, buf, sizeof(buf)); put_bits(&p, 1, 1); put_bits(&p, 5, 20); put_bits(&p, 20, a); put_bits(&p, 20, d); put_bits(&p, 1, 1); put_bits(&p, 5, 20); put_bits(&p, 20, c); put_bits(&p, 20, b); put_bits(&p, 5, 20); put_bits(&p, 20, tx); put_bits(&p, 20, ty); flush_put_bits(&p); put_buffer(pb, buf, pbBufPtr(&p) - p.buf); }
{ "code": [ " put_bits(&p, 20, a);", " put_bits(&p, 20, d);", " put_bits(&p, 20, c);", " put_bits(&p, 20, b);", " put_bits(&p, 20, tx);", " put_bits(&p, 20, ty);", " flush_put_bits(&p);" ], "line_no": [ 21, 23, 31, 33, 39, 41, 45 ] }
static void FUNC_0(ByteIOContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6) { PutBitContext p; uint8_t buf[256]; init_put_bits(&p, buf, sizeof(buf)); put_bits(&p, 1, 1); put_bits(&p, 5, 20); put_bits(&p, 20, VAR_1); put_bits(&p, 20, VAR_4); put_bits(&p, 1, 1); put_bits(&p, 5, 20); put_bits(&p, 20, VAR_3); put_bits(&p, 20, VAR_2); put_bits(&p, 5, 20); put_bits(&p, 20, VAR_5); put_bits(&p, 20, VAR_6); flush_put_bits(&p); put_buffer(VAR_0, buf, pbBufPtr(&p) - p.buf); }
[ "static void FUNC_0(ByteIOContext *VAR_0,\nint VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6)\n{", "PutBitContext p;", "uint8_t buf[256];", "init_put_bits(&p, buf, sizeof(buf));", "put_bits(&p, 1, 1);", "put_bits(&p, 5, 20);", "put_bits(&p, 20, VAR_1);", "put_bits(&p, 20, VAR_4);", "put_bits(&p, 1, 1);", "put_bits(&p, 5, 20);", "put_bits(&p, 20, VAR_3);", "put_bits(&p, 20, VAR_2);", "put_bits(&p, 5, 20);", "put_bits(&p, 20, VAR_5);", "put_bits(&p, 20, VAR_6);", "flush_put_bits(&p);", "put_buffer(VAR_0, buf, pbBufPtr(&p) - p.buf);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ] ]
126
int ff_nvdec_start_frame(AVCodecContext *avctx, AVFrame *frame) { NVDECContext *ctx = avctx->internal->hwaccel_priv_data; FrameDecodeData *fdd = (FrameDecodeData*)frame->private_ref->data; NVDECFrame *cf = NULL; int ret; ctx->bitstream_len = 0; ctx->nb_slices = 0; if (fdd->hwaccel_priv) return 0; cf = av_mallocz(sizeof(*cf)); if (!cf) return AVERROR(ENOMEM); cf->decoder_ref = av_buffer_ref(ctx->decoder_ref); if (!cf->decoder_ref) goto fail; cf->idx_ref = av_buffer_pool_get(ctx->decoder_pool); if (!cf->idx_ref) { av_log(avctx, AV_LOG_ERROR, "No decoder surfaces left\n"); ret = AVERROR(ENOMEM); goto fail; } cf->idx = *(unsigned int*)cf->idx_ref->data; fdd->hwaccel_priv = cf; fdd->hwaccel_priv_free = nvdec_fdd_priv_free; fdd->post_process = nvdec_retrieve_data; return 0; fail: nvdec_fdd_priv_free(cf); return ret; }
false
FFmpeg
8bcf5840ea2a6a92c75ab3219f89fe0b8a53cf50
int ff_nvdec_start_frame(AVCodecContext *avctx, AVFrame *frame) { NVDECContext *ctx = avctx->internal->hwaccel_priv_data; FrameDecodeData *fdd = (FrameDecodeData*)frame->private_ref->data; NVDECFrame *cf = NULL; int ret; ctx->bitstream_len = 0; ctx->nb_slices = 0; if (fdd->hwaccel_priv) return 0; cf = av_mallocz(sizeof(*cf)); if (!cf) return AVERROR(ENOMEM); cf->decoder_ref = av_buffer_ref(ctx->decoder_ref); if (!cf->decoder_ref) goto fail; cf->idx_ref = av_buffer_pool_get(ctx->decoder_pool); if (!cf->idx_ref) { av_log(avctx, AV_LOG_ERROR, "No decoder surfaces left\n"); ret = AVERROR(ENOMEM); goto fail; } cf->idx = *(unsigned int*)cf->idx_ref->data; fdd->hwaccel_priv = cf; fdd->hwaccel_priv_free = nvdec_fdd_priv_free; fdd->post_process = nvdec_retrieve_data; return 0; fail: nvdec_fdd_priv_free(cf); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1) { NVDECContext *ctx = VAR_0->internal->hwaccel_priv_data; FrameDecodeData *fdd = (FrameDecodeData*)VAR_1->private_ref->data; NVDECFrame *cf = NULL; int VAR_2; ctx->bitstream_len = 0; ctx->nb_slices = 0; if (fdd->hwaccel_priv) return 0; cf = av_mallocz(sizeof(*cf)); if (!cf) return AVERROR(ENOMEM); cf->decoder_ref = av_buffer_ref(ctx->decoder_ref); if (!cf->decoder_ref) goto fail; cf->idx_ref = av_buffer_pool_get(ctx->decoder_pool); if (!cf->idx_ref) { av_log(VAR_0, AV_LOG_ERROR, "No decoder surfaces left\n"); VAR_2 = AVERROR(ENOMEM); goto fail; } cf->idx = *(unsigned int*)cf->idx_ref->data; fdd->hwaccel_priv = cf; fdd->hwaccel_priv_free = nvdec_fdd_priv_free; fdd->post_process = nvdec_retrieve_data; return 0; fail: nvdec_fdd_priv_free(cf); return VAR_2; }
[ "int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1)\n{", "NVDECContext *ctx = VAR_0->internal->hwaccel_priv_data;", "FrameDecodeData *fdd = (FrameDecodeData*)VAR_1->private_ref->data;", "NVDECFrame *cf = NULL;", "int VAR_2;", "ctx->bitstream_len = 0;", "ctx->nb_slices = 0;", "if (fdd->hwaccel_priv)\nreturn 0;", "cf = av_mallocz(sizeof(*cf));", "if (!cf)\nreturn AVERROR(ENOMEM);", "cf->decoder_ref = av_buffer_ref(ctx->decoder_ref);", "if (!cf->decoder_ref)\ngoto fail;", "cf->idx_ref = av_buffer_pool_get(ctx->decoder_pool);", "if (!cf->idx_ref) {", "av_log(VAR_0, AV_LOG_ERROR, \"No decoder surfaces left\\n\");", "VAR_2 = AVERROR(ENOMEM);", "goto fail;", "}", "cf->idx = *(unsigned int*)cf->idx_ref->data;", "fdd->hwaccel_priv = cf;", "fdd->hwaccel_priv_free = nvdec_fdd_priv_free;", "fdd->post_process = nvdec_retrieve_data;", "return 0;", "fail:\nnvdec_fdd_priv_free(cf);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29, 31 ], [ 35 ], [ 37, 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 77 ] ]
128
static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { MOVFragment *frag = &c->fragment; AVStream *st = c->fc->streams[frag->track_id-1]; MOVStreamContext *sc = st->priv_data; uint64_t offset; int64_t dts; int data_offset = 0; unsigned entries, first_sample_flags = frag->flags; int flags, distance, i; if (sc->pseudo_stream_id+1 != frag->stsd_id) return 0; if (!st->nb_index_entries) return -1; get_byte(pb); /* version */ flags = get_be24(pb); entries = get_be32(pb); dprintf(c->fc, "flags 0x%x entries %d\n", flags, entries); if (flags & 0x001) data_offset = get_be32(pb); if (flags & 0x004) first_sample_flags = get_be32(pb); if (flags & 0x800) { if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data)) return -1; sc->ctts_data = av_realloc(sc->ctts_data, (entries+sc->ctts_count)*sizeof(*sc->ctts_data)); if (!sc->ctts_data) return AVERROR(ENOMEM); } dts = st->duration; offset = frag->base_data_offset + data_offset; distance = 0; dprintf(c->fc, "first sample flags 0x%x\n", first_sample_flags); for (i = 0; i < entries; i++) { unsigned sample_size = frag->size; int sample_flags = i ? frag->flags : first_sample_flags; unsigned sample_duration = frag->duration; int keyframe; if (flags & 0x100) sample_duration = get_be32(pb); if (flags & 0x200) sample_size = get_be32(pb); if (flags & 0x400) sample_flags = get_be32(pb); if (flags & 0x800) { sc->ctts_data[sc->ctts_count].count = 1; sc->ctts_data[sc->ctts_count].duration = get_be32(pb); sc->ctts_count++; } if ((keyframe = st->codec->codec_type == CODEC_TYPE_AUDIO || (flags & 0x004 && !i && !sample_flags) || sample_flags & 0x2000000)) distance = 0; av_add_index_entry(st, offset, dts, sample_size, distance, keyframe ? AVINDEX_KEYFRAME : 0); dprintf(c->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " "size %d, distance %d, keyframe %d\n", st->index, sc->sample_count+i, offset, dts, sample_size, distance, keyframe); distance++; assert(sample_duration % sc->time_rate == 0); dts += sample_duration / sc->time_rate; offset += sample_size; } frag->moof_offset = offset; sc->sample_count = st->nb_index_entries; st->duration = dts; return 0; }
false
FFmpeg
44e43aab036595a8f6d78c9306864d00f35ebbb1
static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { MOVFragment *frag = &c->fragment; AVStream *st = c->fc->streams[frag->track_id-1]; MOVStreamContext *sc = st->priv_data; uint64_t offset; int64_t dts; int data_offset = 0; unsigned entries, first_sample_flags = frag->flags; int flags, distance, i; if (sc->pseudo_stream_id+1 != frag->stsd_id) return 0; if (!st->nb_index_entries) return -1; get_byte(pb); flags = get_be24(pb); entries = get_be32(pb); dprintf(c->fc, "flags 0x%x entries %d\n", flags, entries); if (flags & 0x001) data_offset = get_be32(pb); if (flags & 0x004) first_sample_flags = get_be32(pb); if (flags & 0x800) { if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data)) return -1; sc->ctts_data = av_realloc(sc->ctts_data, (entries+sc->ctts_count)*sizeof(*sc->ctts_data)); if (!sc->ctts_data) return AVERROR(ENOMEM); } dts = st->duration; offset = frag->base_data_offset + data_offset; distance = 0; dprintf(c->fc, "first sample flags 0x%x\n", first_sample_flags); for (i = 0; i < entries; i++) { unsigned sample_size = frag->size; int sample_flags = i ? frag->flags : first_sample_flags; unsigned sample_duration = frag->duration; int keyframe; if (flags & 0x100) sample_duration = get_be32(pb); if (flags & 0x200) sample_size = get_be32(pb); if (flags & 0x400) sample_flags = get_be32(pb); if (flags & 0x800) { sc->ctts_data[sc->ctts_count].count = 1; sc->ctts_data[sc->ctts_count].duration = get_be32(pb); sc->ctts_count++; } if ((keyframe = st->codec->codec_type == CODEC_TYPE_AUDIO || (flags & 0x004 && !i && !sample_flags) || sample_flags & 0x2000000)) distance = 0; av_add_index_entry(st, offset, dts, sample_size, distance, keyframe ? AVINDEX_KEYFRAME : 0); dprintf(c->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " "size %d, distance %d, keyframe %d\n", st->index, sc->sample_count+i, offset, dts, sample_size, distance, keyframe); distance++; assert(sample_duration % sc->time_rate == 0); dts += sample_duration / sc->time_rate; offset += sample_size; } frag->moof_offset = offset; sc->sample_count = st->nb_index_entries; st->duration = dts; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2) { MOVFragment *frag = &VAR_0->fragment; AVStream *st = VAR_0->fc->streams[frag->track_id-1]; MOVStreamContext *sc = st->priv_data; uint64_t offset; int64_t dts; int VAR_3 = 0; unsigned VAR_4, VAR_5 = frag->VAR_6; int VAR_6, VAR_7, VAR_8; if (sc->pseudo_stream_id+1 != frag->stsd_id) return 0; if (!st->nb_index_entries) return -1; get_byte(VAR_1); VAR_6 = get_be24(VAR_1); VAR_4 = get_be32(VAR_1); dprintf(VAR_0->fc, "VAR_6 0x%x VAR_4 %d\n", VAR_6, VAR_4); if (VAR_6 & 0x001) VAR_3 = get_be32(VAR_1); if (VAR_6 & 0x004) VAR_5 = get_be32(VAR_1); if (VAR_6 & 0x800) { if ((uint64_t)VAR_4+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data)) return -1; sc->ctts_data = av_realloc(sc->ctts_data, (VAR_4+sc->ctts_count)*sizeof(*sc->ctts_data)); if (!sc->ctts_data) return AVERROR(ENOMEM); } dts = st->duration; offset = frag->base_data_offset + VAR_3; VAR_7 = 0; dprintf(VAR_0->fc, "first sample VAR_6 0x%x\n", VAR_5); for (VAR_8 = 0; VAR_8 < VAR_4; VAR_8++) { unsigned VAR_9 = frag->size; int VAR_10 = VAR_8 ? frag->VAR_6 : VAR_5; unsigned VAR_11 = frag->duration; int VAR_12; if (VAR_6 & 0x100) VAR_11 = get_be32(VAR_1); if (VAR_6 & 0x200) VAR_9 = get_be32(VAR_1); if (VAR_6 & 0x400) VAR_10 = get_be32(VAR_1); if (VAR_6 & 0x800) { sc->ctts_data[sc->ctts_count].count = 1; sc->ctts_data[sc->ctts_count].duration = get_be32(VAR_1); sc->ctts_count++; } if ((VAR_12 = st->codec->codec_type == CODEC_TYPE_AUDIO || (VAR_6 & 0x004 && !VAR_8 && !VAR_10) || VAR_10 & 0x2000000)) VAR_7 = 0; av_add_index_entry(st, offset, dts, VAR_9, VAR_7, VAR_12 ? AVINDEX_KEYFRAME : 0); dprintf(VAR_0->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " "size %d, VAR_7 %d, VAR_12 %d\n", st->index, sc->sample_count+VAR_8, offset, dts, VAR_9, VAR_7, VAR_12); VAR_7++; assert(VAR_11 % sc->time_rate == 0); dts += VAR_11 / sc->time_rate; offset += VAR_9; } frag->moof_offset = offset; sc->sample_count = st->nb_index_entries; st->duration = dts; return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2)\n{", "MOVFragment *frag = &VAR_0->fragment;", "AVStream *st = VAR_0->fc->streams[frag->track_id-1];", "MOVStreamContext *sc = st->priv_data;", "uint64_t offset;", "int64_t dts;", "int VAR_3 = 0;", "unsigned VAR_4, VAR_5 = frag->VAR_6;", "int VAR_6, VAR_7, VAR_8;", "if (sc->pseudo_stream_id+1 != frag->stsd_id)\nreturn 0;", "if (!st->nb_index_entries)\nreturn -1;", "get_byte(VAR_1);", "VAR_6 = get_be24(VAR_1);", "VAR_4 = get_be32(VAR_1);", "dprintf(VAR_0->fc, \"VAR_6 0x%x VAR_4 %d\\n\", VAR_6, VAR_4);", "if (VAR_6 & 0x001) VAR_3 = get_be32(VAR_1);", "if (VAR_6 & 0x004) VAR_5 = get_be32(VAR_1);", "if (VAR_6 & 0x800) {", "if ((uint64_t)VAR_4+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data))\nreturn -1;", "sc->ctts_data = av_realloc(sc->ctts_data,\n(VAR_4+sc->ctts_count)*sizeof(*sc->ctts_data));", "if (!sc->ctts_data)\nreturn AVERROR(ENOMEM);", "}", "dts = st->duration;", "offset = frag->base_data_offset + VAR_3;", "VAR_7 = 0;", "dprintf(VAR_0->fc, \"first sample VAR_6 0x%x\\n\", VAR_5);", "for (VAR_8 = 0; VAR_8 < VAR_4; VAR_8++) {", "unsigned VAR_9 = frag->size;", "int VAR_10 = VAR_8 ? frag->VAR_6 : VAR_5;", "unsigned VAR_11 = frag->duration;", "int VAR_12;", "if (VAR_6 & 0x100) VAR_11 = get_be32(VAR_1);", "if (VAR_6 & 0x200) VAR_9 = get_be32(VAR_1);", "if (VAR_6 & 0x400) VAR_10 = get_be32(VAR_1);", "if (VAR_6 & 0x800) {", "sc->ctts_data[sc->ctts_count].count = 1;", "sc->ctts_data[sc->ctts_count].duration = get_be32(VAR_1);", "sc->ctts_count++;", "}", "if ((VAR_12 = st->codec->codec_type == CODEC_TYPE_AUDIO ||\n(VAR_6 & 0x004 && !VAR_8 && !VAR_10) || VAR_10 & 0x2000000))\nVAR_7 = 0;", "av_add_index_entry(st, offset, dts, VAR_9, VAR_7,\nVAR_12 ? AVINDEX_KEYFRAME : 0);", "dprintf(VAR_0->fc, \"AVIndex stream %d, sample %d, offset %\"PRIx64\", dts %\"PRId64\", \"\n\"size %d, VAR_7 %d, VAR_12 %d\\n\", st->index, sc->sample_count+VAR_8,\noffset, dts, VAR_9, VAR_7, VAR_12);", "VAR_7++;", "assert(VAR_11 % sc->time_rate == 0);", "dts += VAR_11 / sc->time_rate;", "offset += VAR_9;", "}", "frag->moof_offset = offset;", "sc->sample_count = st->nb_index_entries;", "st->duration = dts;", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49, 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 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 ] ]
129
void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], int is_mpeg12) { const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; #if FF_API_XVMC FF_DISABLE_DEPRECATION_WARNINGS if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){ ff_xvmc_decode_mb(s);//xvmc uses pblocks return; } FF_ENABLE_DEPRECATION_WARNINGS #endif /* FF_API_XVMC */ if(s->avctx->debug&FF_DEBUG_DCT_COEFF) { /* print DCT coefficients */ int i,j; av_log(s->avctx, AV_LOG_DEBUG, "DCT coeffs of MB at %dx%d:\n", s->mb_x, s->mb_y); for(i=0; i<6; i++){ for(j=0; j<64; j++){ av_log(s->avctx, AV_LOG_DEBUG, "%5d", block[i][s->idsp.idct_permutation[j]]); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } } s->current_picture.qscale_table[mb_xy] = s->qscale; /* update DC predictors for P macroblocks */ if (!s->mb_intra) { if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) { if(s->mbintra_table[mb_xy]) ff_clean_intra_table_entries(s); } else { s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 128 << s->intra_dc_precision; } } else if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) s->mbintra_table[mb_xy]=1; if ((s->avctx->flags & AV_CODEC_FLAG_PSNR) || !(s->encoding && (s->intra_only || s->pict_type == AV_PICTURE_TYPE_B) && s->avctx->mb_decision != FF_MB_DECISION_RD)) { // FIXME precalc uint8_t *dest_y, *dest_cb, *dest_cr; int dct_linesize, dct_offset; op_pixels_func (*op_pix)[4]; qpel_mc_func (*op_qpix)[16]; const int linesize = s->current_picture.f->linesize[0]; //not s->linesize as this would be wrong for field pics const int uvlinesize = s->current_picture.f->linesize[1]; const int readable= s->pict_type != AV_PICTURE_TYPE_B || s->encoding || s->avctx->draw_horiz_band; const int block_size = 8; /* avoid copy if macroblock skipped in last frame too */ /* skip only during decoding as we might trash the buffers during encoding a bit */ if(!s->encoding){ uint8_t *mbskip_ptr = &s->mbskip_table[mb_xy]; if (s->mb_skipped) { s->mb_skipped= 0; assert(s->pict_type!=AV_PICTURE_TYPE_I); *mbskip_ptr = 1; } else if(!s->current_picture.reference) { *mbskip_ptr = 1; } else{ *mbskip_ptr = 0; /* not skipped */ } } dct_linesize = linesize << s->interlaced_dct; dct_offset = s->interlaced_dct ? linesize : linesize * block_size; if(readable){ dest_y= s->dest[0]; dest_cb= s->dest[1]; dest_cr= s->dest[2]; }else{ dest_y = s->sc.b_scratchpad; dest_cb= s->sc.b_scratchpad+16*linesize; dest_cr= s->sc.b_scratchpad+32*linesize; } if (!s->mb_intra) { /* motion handling */ /* decoding or more than one mb_type (MC was already done otherwise) */ if(!s->encoding){ if(HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_FRAME) { if (s->mv_dir & MV_DIR_FORWARD) { ff_thread_await_progress(&s->last_picture_ptr->tf, lowest_referenced_row(s, 0), 0); } if (s->mv_dir & MV_DIR_BACKWARD) { ff_thread_await_progress(&s->next_picture_ptr->tf, lowest_referenced_row(s, 1), 0); } } op_qpix= s->me.qpel_put; if ((!s->no_rounding) || s->pict_type==AV_PICTURE_TYPE_B){ op_pix = s->hdsp.put_pixels_tab; }else{ op_pix = s->hdsp.put_no_rnd_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f->data, op_pix, op_qpix); op_pix = s->hdsp.avg_pixels_tab; op_qpix= s->me.qpel_avg; } if (s->mv_dir & MV_DIR_BACKWARD) { ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f->data, op_pix, op_qpix); } } /* skip dequant / idct if we are really late ;) */ if(s->avctx->skip_idct){ if( (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || s->avctx->skip_idct >= AVDISCARD_ALL) goto skip_idct; } /* add dct residue */ if(s->encoding || !( s->msmpeg4_version || s->codec_id==AV_CODEC_ID_MPEG1VIDEO || s->codec_id==AV_CODEC_ID_MPEG2VIDEO || (s->codec_id==AV_CODEC_ID_MPEG4 && !s->mpeg_quant))){ add_dequant_dct(s, block[0], 0, dest_y , dct_linesize, s->qscale); add_dequant_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->qscale); add_dequant_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale); if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { if (s->chroma_y_shift){ add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); }else{ dct_linesize >>= 1; dct_offset >>=1; add_dequant_dct(s, block[4], 4, dest_cb, dct_linesize, s->chroma_qscale); add_dequant_dct(s, block[5], 5, dest_cr, dct_linesize, s->chroma_qscale); add_dequant_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale); add_dequant_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale); } } } else if(is_mpeg12 || (s->codec_id != AV_CODEC_ID_WMV2)){ add_dct(s, block[0], 0, dest_y , dct_linesize); add_dct(s, block[1], 1, dest_y + block_size, dct_linesize); add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize); add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize); if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { if(s->chroma_y_shift){//Chroma420 add_dct(s, block[4], 4, dest_cb, uvlinesize); add_dct(s, block[5], 5, dest_cr, uvlinesize); }else{ //chroma422 dct_linesize = uvlinesize << s->interlaced_dct; dct_offset = s->interlaced_dct ? uvlinesize : uvlinesize * 8; add_dct(s, block[4], 4, dest_cb, dct_linesize); add_dct(s, block[5], 5, dest_cr, dct_linesize); add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize); add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize); if(!s->chroma_x_shift){//Chroma444 add_dct(s, block[8], 8, dest_cb+8, dct_linesize); add_dct(s, block[9], 9, dest_cr+8, dct_linesize); add_dct(s, block[10], 10, dest_cb+8+dct_offset, dct_linesize); add_dct(s, block[11], 11, dest_cr+8+dct_offset, dct_linesize); } } }//fi gray } else if (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) { ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr); } } else { /* dct only in intra block */ if(s->encoding || !(s->codec_id==AV_CODEC_ID_MPEG1VIDEO || s->codec_id==AV_CODEC_ID_MPEG2VIDEO)){ put_dct(s, block[0], 0, dest_y , dct_linesize, s->qscale); put_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->qscale); put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale); if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { if(s->chroma_y_shift){ put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); }else{ dct_offset >>=1; dct_linesize >>=1; put_dct(s, block[4], 4, dest_cb, dct_linesize, s->chroma_qscale); put_dct(s, block[5], 5, dest_cr, dct_linesize, s->chroma_qscale); put_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale); put_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale); } } }else{ s->idsp.idct_put(dest_y, dct_linesize, block[0]); s->idsp.idct_put(dest_y + block_size, dct_linesize, block[1]); s->idsp.idct_put(dest_y + dct_offset, dct_linesize, block[2]); s->idsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]); if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { if(s->chroma_y_shift){ s->idsp.idct_put(dest_cb, uvlinesize, block[4]); s->idsp.idct_put(dest_cr, uvlinesize, block[5]); }else{ dct_linesize = uvlinesize << s->interlaced_dct; dct_offset = s->interlaced_dct ? uvlinesize : uvlinesize * 8; s->idsp.idct_put(dest_cb, dct_linesize, block[4]); s->idsp.idct_put(dest_cr, dct_linesize, block[5]); s->idsp.idct_put(dest_cb + dct_offset, dct_linesize, block[6]); s->idsp.idct_put(dest_cr + dct_offset, dct_linesize, block[7]); if(!s->chroma_x_shift){//Chroma444 s->idsp.idct_put(dest_cb + 8, dct_linesize, block[8]); s->idsp.idct_put(dest_cr + 8, dct_linesize, block[9]); s->idsp.idct_put(dest_cb + 8 + dct_offset, dct_linesize, block[10]); s->idsp.idct_put(dest_cr + 8 + dct_offset, dct_linesize, block[11]); } } }//gray } } skip_idct: if(!readable){ s->hdsp.put_pixels_tab[0][0](s->dest[0], dest_y , linesize,16); s->hdsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize,16 >> s->chroma_y_shift); s->hdsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[2], dest_cr, uvlinesize,16 >> s->chroma_y_shift); } } }
false
FFmpeg
dcc39ee10e82833ce24aa57926c00ffeb1948198
void mpv_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], int is_mpeg12) { const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; #if FF_API_XVMC FF_DISABLE_DEPRECATION_WARNINGS if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){ ff_xvmc_decode_mb(s); return; } FF_ENABLE_DEPRECATION_WARNINGS #endif if(s->avctx->debug&FF_DEBUG_DCT_COEFF) { int i,j; av_log(s->avctx, AV_LOG_DEBUG, "DCT coeffs of MB at %dx%d:\n", s->mb_x, s->mb_y); for(i=0; i<6; i++){ for(j=0; j<64; j++){ av_log(s->avctx, AV_LOG_DEBUG, "%5d", block[i][s->idsp.idct_permutation[j]]); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } } s->current_picture.qscale_table[mb_xy] = s->qscale; if (!s->mb_intra) { if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) { if(s->mbintra_table[mb_xy]) ff_clean_intra_table_entries(s); } else { s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 128 << s->intra_dc_precision; } } else if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) s->mbintra_table[mb_xy]=1; if ((s->avctx->flags & AV_CODEC_FLAG_PSNR) || !(s->encoding && (s->intra_only || s->pict_type == AV_PICTURE_TYPE_B) && s->avctx->mb_decision != FF_MB_DECISION_RD)) { uint8_t *dest_y, *dest_cb, *dest_cr; int dct_linesize, dct_offset; op_pixels_func (*op_pix)[4]; qpel_mc_func (*op_qpix)[16]; const int linesize = s->current_picture.f->linesize[0]; const int uvlinesize = s->current_picture.f->linesize[1]; const int readable= s->pict_type != AV_PICTURE_TYPE_B || s->encoding || s->avctx->draw_horiz_band; const int block_size = 8; if(!s->encoding){ uint8_t *mbskip_ptr = &s->mbskip_table[mb_xy]; if (s->mb_skipped) { s->mb_skipped= 0; assert(s->pict_type!=AV_PICTURE_TYPE_I); *mbskip_ptr = 1; } else if(!s->current_picture.reference) { *mbskip_ptr = 1; } else{ *mbskip_ptr = 0; } } dct_linesize = linesize << s->interlaced_dct; dct_offset = s->interlaced_dct ? linesize : linesize * block_size; if(readable){ dest_y= s->dest[0]; dest_cb= s->dest[1]; dest_cr= s->dest[2]; }else{ dest_y = s->sc.b_scratchpad; dest_cb= s->sc.b_scratchpad+16*linesize; dest_cr= s->sc.b_scratchpad+32*linesize; } if (!s->mb_intra) { if(!s->encoding){ if(HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_FRAME) { if (s->mv_dir & MV_DIR_FORWARD) { ff_thread_await_progress(&s->last_picture_ptr->tf, lowest_referenced_row(s, 0), 0); } if (s->mv_dir & MV_DIR_BACKWARD) { ff_thread_await_progress(&s->next_picture_ptr->tf, lowest_referenced_row(s, 1), 0); } } op_qpix= s->me.qpel_put; if ((!s->no_rounding) || s->pict_type==AV_PICTURE_TYPE_B){ op_pix = s->hdsp.put_pixels_tab; }else{ op_pix = s->hdsp.put_no_rnd_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f->data, op_pix, op_qpix); op_pix = s->hdsp.avg_pixels_tab; op_qpix= s->me.qpel_avg; } if (s->mv_dir & MV_DIR_BACKWARD) { ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f->data, op_pix, op_qpix); } } if(s->avctx->skip_idct){ if( (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || s->avctx->skip_idct >= AVDISCARD_ALL) goto skip_idct; } if(s->encoding || !( s->msmpeg4_version || s->codec_id==AV_CODEC_ID_MPEG1VIDEO || s->codec_id==AV_CODEC_ID_MPEG2VIDEO || (s->codec_id==AV_CODEC_ID_MPEG4 && !s->mpeg_quant))){ add_dequant_dct(s, block[0], 0, dest_y , dct_linesize, s->qscale); add_dequant_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->qscale); add_dequant_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale); if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { if (s->chroma_y_shift){ add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); }else{ dct_linesize >>= 1; dct_offset >>=1; add_dequant_dct(s, block[4], 4, dest_cb, dct_linesize, s->chroma_qscale); add_dequant_dct(s, block[5], 5, dest_cr, dct_linesize, s->chroma_qscale); add_dequant_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale); add_dequant_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale); } } } else if(is_mpeg12 || (s->codec_id != AV_CODEC_ID_WMV2)){ add_dct(s, block[0], 0, dest_y , dct_linesize); add_dct(s, block[1], 1, dest_y + block_size, dct_linesize); add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize); add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize); if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { if(s->chroma_y_shift){ add_dct(s, block[4], 4, dest_cb, uvlinesize); add_dct(s, block[5], 5, dest_cr, uvlinesize); }else{ dct_linesize = uvlinesize << s->interlaced_dct; dct_offset = s->interlaced_dct ? uvlinesize : uvlinesize * 8; add_dct(s, block[4], 4, dest_cb, dct_linesize); add_dct(s, block[5], 5, dest_cr, dct_linesize); add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize); add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize); if(!s->chroma_x_shift){ add_dct(s, block[8], 8, dest_cb+8, dct_linesize); add_dct(s, block[9], 9, dest_cr+8, dct_linesize); add_dct(s, block[10], 10, dest_cb+8+dct_offset, dct_linesize); add_dct(s, block[11], 11, dest_cr+8+dct_offset, dct_linesize); } } } } else if (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) { ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr); } } else { if(s->encoding || !(s->codec_id==AV_CODEC_ID_MPEG1VIDEO || s->codec_id==AV_CODEC_ID_MPEG2VIDEO)){ put_dct(s, block[0], 0, dest_y , dct_linesize, s->qscale); put_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->qscale); put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale); if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { if(s->chroma_y_shift){ put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); }else{ dct_offset >>=1; dct_linesize >>=1; put_dct(s, block[4], 4, dest_cb, dct_linesize, s->chroma_qscale); put_dct(s, block[5], 5, dest_cr, dct_linesize, s->chroma_qscale); put_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale); put_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale); } } }else{ s->idsp.idct_put(dest_y, dct_linesize, block[0]); s->idsp.idct_put(dest_y + block_size, dct_linesize, block[1]); s->idsp.idct_put(dest_y + dct_offset, dct_linesize, block[2]); s->idsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]); if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) { if(s->chroma_y_shift){ s->idsp.idct_put(dest_cb, uvlinesize, block[4]); s->idsp.idct_put(dest_cr, uvlinesize, block[5]); }else{ dct_linesize = uvlinesize << s->interlaced_dct; dct_offset = s->interlaced_dct ? uvlinesize : uvlinesize * 8; s->idsp.idct_put(dest_cb, dct_linesize, block[4]); s->idsp.idct_put(dest_cr, dct_linesize, block[5]); s->idsp.idct_put(dest_cb + dct_offset, dct_linesize, block[6]); s->idsp.idct_put(dest_cr + dct_offset, dct_linesize, block[7]); if(!s->chroma_x_shift){ s->idsp.idct_put(dest_cb + 8, dct_linesize, block[8]); s->idsp.idct_put(dest_cr + 8, dct_linesize, block[9]); s->idsp.idct_put(dest_cb + 8 + dct_offset, dct_linesize, block[10]); s->idsp.idct_put(dest_cr + 8 + dct_offset, dct_linesize, block[11]); } } } } } skip_idct: if(!readable){ s->hdsp.put_pixels_tab[0][0](s->dest[0], dest_y , linesize,16); s->hdsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize,16 >> s->chroma_y_shift); s->hdsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[2], dest_cr, uvlinesize,16 >> s->chroma_y_shift); } } }
{ "code": [], "line_no": [] }
void FUNC_0(MpegEncContext *VAR_0, int16_t VAR_1[12][64], int VAR_2) { const int VAR_3 = VAR_0->mb_y * VAR_0->mb_stride + VAR_0->mb_x; #if FF_API_XVMC FF_DISABLE_DEPRECATION_WARNINGS if(CONFIG_MPEG_XVMC_DECODER && VAR_0->avctx->xvmc_acceleration){ ff_xvmc_decode_mb(VAR_0); return; } FF_ENABLE_DEPRECATION_WARNINGS #endif if(VAR_0->avctx->debug&FF_DEBUG_DCT_COEFF) { int VAR_4,VAR_5; av_log(VAR_0->avctx, AV_LOG_DEBUG, "DCT coeffs of MB at %dx%d:\n", VAR_0->mb_x, VAR_0->mb_y); for(VAR_4=0; VAR_4<6; VAR_4++){ for(VAR_5=0; VAR_5<64; VAR_5++){ av_log(VAR_0->avctx, AV_LOG_DEBUG, "%5d", VAR_1[VAR_4][VAR_0->idsp.idct_permutation[VAR_5]]); } av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n"); } } VAR_0->current_picture.qscale_table[VAR_3] = VAR_0->qscale; if (!VAR_0->mb_intra) { if (!VAR_2 && (VAR_0->h263_pred || VAR_0->h263_aic)) { if(VAR_0->mbintra_table[VAR_3]) ff_clean_intra_table_entries(VAR_0); } else { VAR_0->last_dc[0] = VAR_0->last_dc[1] = VAR_0->last_dc[2] = 128 << VAR_0->intra_dc_precision; } } else if (!VAR_2 && (VAR_0->h263_pred || VAR_0->h263_aic)) VAR_0->mbintra_table[VAR_3]=1; if ((VAR_0->avctx->flags & AV_CODEC_FLAG_PSNR) || !(VAR_0->encoding && (VAR_0->intra_only || VAR_0->pict_type == AV_PICTURE_TYPE_B) && VAR_0->avctx->mb_decision != FF_MB_DECISION_RD)) { uint8_t *dest_y, *dest_cb, *dest_cr; int VAR_6, VAR_7; op_pixels_func (*op_pix)[4]; qpel_mc_func (*op_qpix)[16]; const int VAR_8 = VAR_0->current_picture.f->VAR_8[0]; const int VAR_9 = VAR_0->current_picture.f->VAR_8[1]; const int VAR_10= VAR_0->pict_type != AV_PICTURE_TYPE_B || VAR_0->encoding || VAR_0->avctx->draw_horiz_band; const int VAR_11 = 8; if(!VAR_0->encoding){ uint8_t *mbskip_ptr = &VAR_0->mbskip_table[VAR_3]; if (VAR_0->mb_skipped) { VAR_0->mb_skipped= 0; assert(VAR_0->pict_type!=AV_PICTURE_TYPE_I); *mbskip_ptr = 1; } else if(!VAR_0->current_picture.reference) { *mbskip_ptr = 1; } else{ *mbskip_ptr = 0; } } VAR_6 = VAR_8 << VAR_0->interlaced_dct; VAR_7 = VAR_0->interlaced_dct ? VAR_8 : VAR_8 * VAR_11; if(VAR_10){ dest_y= VAR_0->dest[0]; dest_cb= VAR_0->dest[1]; dest_cr= VAR_0->dest[2]; }else{ dest_y = VAR_0->sc.b_scratchpad; dest_cb= VAR_0->sc.b_scratchpad+16*VAR_8; dest_cr= VAR_0->sc.b_scratchpad+32*VAR_8; } if (!VAR_0->mb_intra) { if(!VAR_0->encoding){ if(HAVE_THREADS && VAR_0->avctx->active_thread_type&FF_THREAD_FRAME) { if (VAR_0->mv_dir & MV_DIR_FORWARD) { ff_thread_await_progress(&VAR_0->last_picture_ptr->tf, lowest_referenced_row(VAR_0, 0), 0); } if (VAR_0->mv_dir & MV_DIR_BACKWARD) { ff_thread_await_progress(&VAR_0->next_picture_ptr->tf, lowest_referenced_row(VAR_0, 1), 0); } } op_qpix= VAR_0->me.qpel_put; if ((!VAR_0->no_rounding) || VAR_0->pict_type==AV_PICTURE_TYPE_B){ op_pix = VAR_0->hdsp.put_pixels_tab; }else{ op_pix = VAR_0->hdsp.put_no_rnd_pixels_tab; } if (VAR_0->mv_dir & MV_DIR_FORWARD) { ff_mpv_motion(VAR_0, dest_y, dest_cb, dest_cr, 0, VAR_0->last_picture.f->data, op_pix, op_qpix); op_pix = VAR_0->hdsp.avg_pixels_tab; op_qpix= VAR_0->me.qpel_avg; } if (VAR_0->mv_dir & MV_DIR_BACKWARD) { ff_mpv_motion(VAR_0, dest_y, dest_cb, dest_cr, 1, VAR_0->next_picture.f->data, op_pix, op_qpix); } } if(VAR_0->avctx->skip_idct){ if( (VAR_0->avctx->skip_idct >= AVDISCARD_NONREF && VAR_0->pict_type == AV_PICTURE_TYPE_B) ||(VAR_0->avctx->skip_idct >= AVDISCARD_NONKEY && VAR_0->pict_type != AV_PICTURE_TYPE_I) || VAR_0->avctx->skip_idct >= AVDISCARD_ALL) goto skip_idct; } if(VAR_0->encoding || !( VAR_0->msmpeg4_version || VAR_0->codec_id==AV_CODEC_ID_MPEG1VIDEO || VAR_0->codec_id==AV_CODEC_ID_MPEG2VIDEO || (VAR_0->codec_id==AV_CODEC_ID_MPEG4 && !VAR_0->mpeg_quant))){ add_dequant_dct(VAR_0, VAR_1[0], 0, dest_y , VAR_6, VAR_0->qscale); add_dequant_dct(VAR_0, VAR_1[1], 1, dest_y + VAR_11, VAR_6, VAR_0->qscale); add_dequant_dct(VAR_0, VAR_1[2], 2, dest_y + VAR_7 , VAR_6, VAR_0->qscale); add_dequant_dct(VAR_0, VAR_1[3], 3, dest_y + VAR_7 + VAR_11, VAR_6, VAR_0->qscale); if (!CONFIG_GRAY || !(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) { if (VAR_0->chroma_y_shift){ add_dequant_dct(VAR_0, VAR_1[4], 4, dest_cb, VAR_9, VAR_0->chroma_qscale); add_dequant_dct(VAR_0, VAR_1[5], 5, dest_cr, VAR_9, VAR_0->chroma_qscale); }else{ VAR_6 >>= 1; VAR_7 >>=1; add_dequant_dct(VAR_0, VAR_1[4], 4, dest_cb, VAR_6, VAR_0->chroma_qscale); add_dequant_dct(VAR_0, VAR_1[5], 5, dest_cr, VAR_6, VAR_0->chroma_qscale); add_dequant_dct(VAR_0, VAR_1[6], 6, dest_cb + VAR_7, VAR_6, VAR_0->chroma_qscale); add_dequant_dct(VAR_0, VAR_1[7], 7, dest_cr + VAR_7, VAR_6, VAR_0->chroma_qscale); } } } else if(VAR_2 || (VAR_0->codec_id != AV_CODEC_ID_WMV2)){ add_dct(VAR_0, VAR_1[0], 0, dest_y , VAR_6); add_dct(VAR_0, VAR_1[1], 1, dest_y + VAR_11, VAR_6); add_dct(VAR_0, VAR_1[2], 2, dest_y + VAR_7 , VAR_6); add_dct(VAR_0, VAR_1[3], 3, dest_y + VAR_7 + VAR_11, VAR_6); if (!CONFIG_GRAY || !(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) { if(VAR_0->chroma_y_shift){ add_dct(VAR_0, VAR_1[4], 4, dest_cb, VAR_9); add_dct(VAR_0, VAR_1[5], 5, dest_cr, VAR_9); }else{ VAR_6 = VAR_9 << VAR_0->interlaced_dct; VAR_7 = VAR_0->interlaced_dct ? VAR_9 : VAR_9 * 8; add_dct(VAR_0, VAR_1[4], 4, dest_cb, VAR_6); add_dct(VAR_0, VAR_1[5], 5, dest_cr, VAR_6); add_dct(VAR_0, VAR_1[6], 6, dest_cb+VAR_7, VAR_6); add_dct(VAR_0, VAR_1[7], 7, dest_cr+VAR_7, VAR_6); if(!VAR_0->chroma_x_shift){ add_dct(VAR_0, VAR_1[8], 8, dest_cb+8, VAR_6); add_dct(VAR_0, VAR_1[9], 9, dest_cr+8, VAR_6); add_dct(VAR_0, VAR_1[10], 10, dest_cb+8+VAR_7, VAR_6); add_dct(VAR_0, VAR_1[11], 11, dest_cr+8+VAR_7, VAR_6); } } } } else if (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) { ff_wmv2_add_mb(VAR_0, VAR_1, dest_y, dest_cb, dest_cr); } } else { if(VAR_0->encoding || !(VAR_0->codec_id==AV_CODEC_ID_MPEG1VIDEO || VAR_0->codec_id==AV_CODEC_ID_MPEG2VIDEO)){ put_dct(VAR_0, VAR_1[0], 0, dest_y , VAR_6, VAR_0->qscale); put_dct(VAR_0, VAR_1[1], 1, dest_y + VAR_11, VAR_6, VAR_0->qscale); put_dct(VAR_0, VAR_1[2], 2, dest_y + VAR_7 , VAR_6, VAR_0->qscale); put_dct(VAR_0, VAR_1[3], 3, dest_y + VAR_7 + VAR_11, VAR_6, VAR_0->qscale); if (!CONFIG_GRAY || !(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) { if(VAR_0->chroma_y_shift){ put_dct(VAR_0, VAR_1[4], 4, dest_cb, VAR_9, VAR_0->chroma_qscale); put_dct(VAR_0, VAR_1[5], 5, dest_cr, VAR_9, VAR_0->chroma_qscale); }else{ VAR_7 >>=1; VAR_6 >>=1; put_dct(VAR_0, VAR_1[4], 4, dest_cb, VAR_6, VAR_0->chroma_qscale); put_dct(VAR_0, VAR_1[5], 5, dest_cr, VAR_6, VAR_0->chroma_qscale); put_dct(VAR_0, VAR_1[6], 6, dest_cb + VAR_7, VAR_6, VAR_0->chroma_qscale); put_dct(VAR_0, VAR_1[7], 7, dest_cr + VAR_7, VAR_6, VAR_0->chroma_qscale); } } }else{ VAR_0->idsp.idct_put(dest_y, VAR_6, VAR_1[0]); VAR_0->idsp.idct_put(dest_y + VAR_11, VAR_6, VAR_1[1]); VAR_0->idsp.idct_put(dest_y + VAR_7, VAR_6, VAR_1[2]); VAR_0->idsp.idct_put(dest_y + VAR_7 + VAR_11, VAR_6, VAR_1[3]); if (!CONFIG_GRAY || !(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) { if(VAR_0->chroma_y_shift){ VAR_0->idsp.idct_put(dest_cb, VAR_9, VAR_1[4]); VAR_0->idsp.idct_put(dest_cr, VAR_9, VAR_1[5]); }else{ VAR_6 = VAR_9 << VAR_0->interlaced_dct; VAR_7 = VAR_0->interlaced_dct ? VAR_9 : VAR_9 * 8; VAR_0->idsp.idct_put(dest_cb, VAR_6, VAR_1[4]); VAR_0->idsp.idct_put(dest_cr, VAR_6, VAR_1[5]); VAR_0->idsp.idct_put(dest_cb + VAR_7, VAR_6, VAR_1[6]); VAR_0->idsp.idct_put(dest_cr + VAR_7, VAR_6, VAR_1[7]); if(!VAR_0->chroma_x_shift){ VAR_0->idsp.idct_put(dest_cb + 8, VAR_6, VAR_1[8]); VAR_0->idsp.idct_put(dest_cr + 8, VAR_6, VAR_1[9]); VAR_0->idsp.idct_put(dest_cb + 8 + VAR_7, VAR_6, VAR_1[10]); VAR_0->idsp.idct_put(dest_cr + 8 + VAR_7, VAR_6, VAR_1[11]); } } } } } skip_idct: if(!VAR_10){ VAR_0->hdsp.put_pixels_tab[0][0](VAR_0->dest[0], dest_y , VAR_8,16); VAR_0->hdsp.put_pixels_tab[VAR_0->chroma_x_shift][0](VAR_0->dest[1], dest_cb, VAR_9,16 >> VAR_0->chroma_y_shift); VAR_0->hdsp.put_pixels_tab[VAR_0->chroma_x_shift][0](VAR_0->dest[2], dest_cr, VAR_9,16 >> VAR_0->chroma_y_shift); } } }
[ "void FUNC_0(MpegEncContext *VAR_0, int16_t VAR_1[12][64],\nint VAR_2)\n{", "const int VAR_3 = VAR_0->mb_y * VAR_0->mb_stride + VAR_0->mb_x;", "#if FF_API_XVMC\nFF_DISABLE_DEPRECATION_WARNINGS\nif(CONFIG_MPEG_XVMC_DECODER && VAR_0->avctx->xvmc_acceleration){", "ff_xvmc_decode_mb(VAR_0);", "return;", "}", "FF_ENABLE_DEPRECATION_WARNINGS\n#endif\nif(VAR_0->avctx->debug&FF_DEBUG_DCT_COEFF) {", "int VAR_4,VAR_5;", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"DCT coeffs of MB at %dx%d:\\n\", VAR_0->mb_x, VAR_0->mb_y);", "for(VAR_4=0; VAR_4<6; VAR_4++){", "for(VAR_5=0; VAR_5<64; VAR_5++){", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"%5d\",\nVAR_1[VAR_4][VAR_0->idsp.idct_permutation[VAR_5]]);", "}", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"\\n\");", "}", "}", "VAR_0->current_picture.qscale_table[VAR_3] = VAR_0->qscale;", "if (!VAR_0->mb_intra) {", "if (!VAR_2 && (VAR_0->h263_pred || VAR_0->h263_aic)) {", "if(VAR_0->mbintra_table[VAR_3])\nff_clean_intra_table_entries(VAR_0);", "} else {", "VAR_0->last_dc[0] =\nVAR_0->last_dc[1] =\nVAR_0->last_dc[2] = 128 << VAR_0->intra_dc_precision;", "}", "}", "else if (!VAR_2 && (VAR_0->h263_pred || VAR_0->h263_aic))\nVAR_0->mbintra_table[VAR_3]=1;", "if ((VAR_0->avctx->flags & AV_CODEC_FLAG_PSNR) ||\n!(VAR_0->encoding && (VAR_0->intra_only || VAR_0->pict_type == AV_PICTURE_TYPE_B) &&\nVAR_0->avctx->mb_decision != FF_MB_DECISION_RD)) {", "uint8_t *dest_y, *dest_cb, *dest_cr;", "int VAR_6, VAR_7;", "op_pixels_func (*op_pix)[4];", "qpel_mc_func (*op_qpix)[16];", "const int VAR_8 = VAR_0->current_picture.f->VAR_8[0];", "const int VAR_9 = VAR_0->current_picture.f->VAR_8[1];", "const int VAR_10= VAR_0->pict_type != AV_PICTURE_TYPE_B || VAR_0->encoding || VAR_0->avctx->draw_horiz_band;", "const int VAR_11 = 8;", "if(!VAR_0->encoding){", "uint8_t *mbskip_ptr = &VAR_0->mbskip_table[VAR_3];", "if (VAR_0->mb_skipped) {", "VAR_0->mb_skipped= 0;", "assert(VAR_0->pict_type!=AV_PICTURE_TYPE_I);", "*mbskip_ptr = 1;", "} else if(!VAR_0->current_picture.reference) {", "*mbskip_ptr = 1;", "} else{", "*mbskip_ptr = 0;", "}", "}", "VAR_6 = VAR_8 << VAR_0->interlaced_dct;", "VAR_7 = VAR_0->interlaced_dct ? VAR_8 : VAR_8 * VAR_11;", "if(VAR_10){", "dest_y= VAR_0->dest[0];", "dest_cb= VAR_0->dest[1];", "dest_cr= VAR_0->dest[2];", "}else{", "dest_y = VAR_0->sc.b_scratchpad;", "dest_cb= VAR_0->sc.b_scratchpad+16*VAR_8;", "dest_cr= VAR_0->sc.b_scratchpad+32*VAR_8;", "}", "if (!VAR_0->mb_intra) {", "if(!VAR_0->encoding){", "if(HAVE_THREADS && VAR_0->avctx->active_thread_type&FF_THREAD_FRAME) {", "if (VAR_0->mv_dir & MV_DIR_FORWARD) {", "ff_thread_await_progress(&VAR_0->last_picture_ptr->tf,\nlowest_referenced_row(VAR_0, 0),\n0);", "}", "if (VAR_0->mv_dir & MV_DIR_BACKWARD) {", "ff_thread_await_progress(&VAR_0->next_picture_ptr->tf,\nlowest_referenced_row(VAR_0, 1),\n0);", "}", "}", "op_qpix= VAR_0->me.qpel_put;", "if ((!VAR_0->no_rounding) || VAR_0->pict_type==AV_PICTURE_TYPE_B){", "op_pix = VAR_0->hdsp.put_pixels_tab;", "}else{", "op_pix = VAR_0->hdsp.put_no_rnd_pixels_tab;", "}", "if (VAR_0->mv_dir & MV_DIR_FORWARD) {", "ff_mpv_motion(VAR_0, dest_y, dest_cb, dest_cr, 0, VAR_0->last_picture.f->data, op_pix, op_qpix);", "op_pix = VAR_0->hdsp.avg_pixels_tab;", "op_qpix= VAR_0->me.qpel_avg;", "}", "if (VAR_0->mv_dir & MV_DIR_BACKWARD) {", "ff_mpv_motion(VAR_0, dest_y, dest_cb, dest_cr, 1, VAR_0->next_picture.f->data, op_pix, op_qpix);", "}", "}", "if(VAR_0->avctx->skip_idct){", "if( (VAR_0->avctx->skip_idct >= AVDISCARD_NONREF && VAR_0->pict_type == AV_PICTURE_TYPE_B)\n||(VAR_0->avctx->skip_idct >= AVDISCARD_NONKEY && VAR_0->pict_type != AV_PICTURE_TYPE_I)\n|| VAR_0->avctx->skip_idct >= AVDISCARD_ALL)\ngoto skip_idct;", "}", "if(VAR_0->encoding || !( VAR_0->msmpeg4_version || VAR_0->codec_id==AV_CODEC_ID_MPEG1VIDEO || VAR_0->codec_id==AV_CODEC_ID_MPEG2VIDEO\n|| (VAR_0->codec_id==AV_CODEC_ID_MPEG4 && !VAR_0->mpeg_quant))){", "add_dequant_dct(VAR_0, VAR_1[0], 0, dest_y , VAR_6, VAR_0->qscale);", "add_dequant_dct(VAR_0, VAR_1[1], 1, dest_y + VAR_11, VAR_6, VAR_0->qscale);", "add_dequant_dct(VAR_0, VAR_1[2], 2, dest_y + VAR_7 , VAR_6, VAR_0->qscale);", "add_dequant_dct(VAR_0, VAR_1[3], 3, dest_y + VAR_7 + VAR_11, VAR_6, VAR_0->qscale);", "if (!CONFIG_GRAY || !(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) {", "if (VAR_0->chroma_y_shift){", "add_dequant_dct(VAR_0, VAR_1[4], 4, dest_cb, VAR_9, VAR_0->chroma_qscale);", "add_dequant_dct(VAR_0, VAR_1[5], 5, dest_cr, VAR_9, VAR_0->chroma_qscale);", "}else{", "VAR_6 >>= 1;", "VAR_7 >>=1;", "add_dequant_dct(VAR_0, VAR_1[4], 4, dest_cb, VAR_6, VAR_0->chroma_qscale);", "add_dequant_dct(VAR_0, VAR_1[5], 5, dest_cr, VAR_6, VAR_0->chroma_qscale);", "add_dequant_dct(VAR_0, VAR_1[6], 6, dest_cb + VAR_7, VAR_6, VAR_0->chroma_qscale);", "add_dequant_dct(VAR_0, VAR_1[7], 7, dest_cr + VAR_7, VAR_6, VAR_0->chroma_qscale);", "}", "}", "} else if(VAR_2 || (VAR_0->codec_id != AV_CODEC_ID_WMV2)){", "add_dct(VAR_0, VAR_1[0], 0, dest_y , VAR_6);", "add_dct(VAR_0, VAR_1[1], 1, dest_y + VAR_11, VAR_6);", "add_dct(VAR_0, VAR_1[2], 2, dest_y + VAR_7 , VAR_6);", "add_dct(VAR_0, VAR_1[3], 3, dest_y + VAR_7 + VAR_11, VAR_6);", "if (!CONFIG_GRAY || !(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) {", "if(VAR_0->chroma_y_shift){", "add_dct(VAR_0, VAR_1[4], 4, dest_cb, VAR_9);", "add_dct(VAR_0, VAR_1[5], 5, dest_cr, VAR_9);", "}else{", "VAR_6 = VAR_9 << VAR_0->interlaced_dct;", "VAR_7 = VAR_0->interlaced_dct ? VAR_9 : VAR_9 * 8;", "add_dct(VAR_0, VAR_1[4], 4, dest_cb, VAR_6);", "add_dct(VAR_0, VAR_1[5], 5, dest_cr, VAR_6);", "add_dct(VAR_0, VAR_1[6], 6, dest_cb+VAR_7, VAR_6);", "add_dct(VAR_0, VAR_1[7], 7, dest_cr+VAR_7, VAR_6);", "if(!VAR_0->chroma_x_shift){", "add_dct(VAR_0, VAR_1[8], 8, dest_cb+8, VAR_6);", "add_dct(VAR_0, VAR_1[9], 9, dest_cr+8, VAR_6);", "add_dct(VAR_0, VAR_1[10], 10, dest_cb+8+VAR_7, VAR_6);", "add_dct(VAR_0, VAR_1[11], 11, dest_cr+8+VAR_7, VAR_6);", "}", "}", "}", "}", "else if (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) {", "ff_wmv2_add_mb(VAR_0, VAR_1, dest_y, dest_cb, dest_cr);", "}", "} else {", "if(VAR_0->encoding || !(VAR_0->codec_id==AV_CODEC_ID_MPEG1VIDEO || VAR_0->codec_id==AV_CODEC_ID_MPEG2VIDEO)){", "put_dct(VAR_0, VAR_1[0], 0, dest_y , VAR_6, VAR_0->qscale);", "put_dct(VAR_0, VAR_1[1], 1, dest_y + VAR_11, VAR_6, VAR_0->qscale);", "put_dct(VAR_0, VAR_1[2], 2, dest_y + VAR_7 , VAR_6, VAR_0->qscale);", "put_dct(VAR_0, VAR_1[3], 3, dest_y + VAR_7 + VAR_11, VAR_6, VAR_0->qscale);", "if (!CONFIG_GRAY || !(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) {", "if(VAR_0->chroma_y_shift){", "put_dct(VAR_0, VAR_1[4], 4, dest_cb, VAR_9, VAR_0->chroma_qscale);", "put_dct(VAR_0, VAR_1[5], 5, dest_cr, VAR_9, VAR_0->chroma_qscale);", "}else{", "VAR_7 >>=1;", "VAR_6 >>=1;", "put_dct(VAR_0, VAR_1[4], 4, dest_cb, VAR_6, VAR_0->chroma_qscale);", "put_dct(VAR_0, VAR_1[5], 5, dest_cr, VAR_6, VAR_0->chroma_qscale);", "put_dct(VAR_0, VAR_1[6], 6, dest_cb + VAR_7, VAR_6, VAR_0->chroma_qscale);", "put_dct(VAR_0, VAR_1[7], 7, dest_cr + VAR_7, VAR_6, VAR_0->chroma_qscale);", "}", "}", "}else{", "VAR_0->idsp.idct_put(dest_y, VAR_6, VAR_1[0]);", "VAR_0->idsp.idct_put(dest_y + VAR_11, VAR_6, VAR_1[1]);", "VAR_0->idsp.idct_put(dest_y + VAR_7, VAR_6, VAR_1[2]);", "VAR_0->idsp.idct_put(dest_y + VAR_7 + VAR_11, VAR_6, VAR_1[3]);", "if (!CONFIG_GRAY || !(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) {", "if(VAR_0->chroma_y_shift){", "VAR_0->idsp.idct_put(dest_cb, VAR_9, VAR_1[4]);", "VAR_0->idsp.idct_put(dest_cr, VAR_9, VAR_1[5]);", "}else{", "VAR_6 = VAR_9 << VAR_0->interlaced_dct;", "VAR_7 = VAR_0->interlaced_dct ? VAR_9 : VAR_9 * 8;", "VAR_0->idsp.idct_put(dest_cb, VAR_6, VAR_1[4]);", "VAR_0->idsp.idct_put(dest_cr, VAR_6, VAR_1[5]);", "VAR_0->idsp.idct_put(dest_cb + VAR_7, VAR_6, VAR_1[6]);", "VAR_0->idsp.idct_put(dest_cr + VAR_7, VAR_6, VAR_1[7]);", "if(!VAR_0->chroma_x_shift){", "VAR_0->idsp.idct_put(dest_cb + 8, VAR_6, VAR_1[8]);", "VAR_0->idsp.idct_put(dest_cr + 8, VAR_6, VAR_1[9]);", "VAR_0->idsp.idct_put(dest_cb + 8 + VAR_7, VAR_6, VAR_1[10]);", "VAR_0->idsp.idct_put(dest_cr + 8 + VAR_7, VAR_6, VAR_1[11]);", "}", "}", "}", "}", "}", "skip_idct:\nif(!VAR_10){", "VAR_0->hdsp.put_pixels_tab[0][0](VAR_0->dest[0], dest_y , VAR_8,16);", "VAR_0->hdsp.put_pixels_tab[VAR_0->chroma_x_shift][0](VAR_0->dest[1], dest_cb, VAR_9,16 >> VAR_0->chroma_y_shift);", "VAR_0->hdsp.put_pixels_tab[VAR_0->chroma_x_shift][0](VAR_0->dest[2], dest_cr, VAR_9,16 >> VAR_0->chroma_y_shift);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73, 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 87, 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 175 ], [ 179 ], [ 181 ], [ 183, 185, 187 ], [ 189 ], [ 191 ], [ 193, 195, 197 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 239 ], [ 241, 243, 245, 247 ], [ 249 ], [ 255, 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 319 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 423 ], [ 425 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457, 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ] ]
130
static void sha256_transform(uint32_t *state, const uint8_t buffer[64]) { unsigned int i, a, b, c, d, e, f, g, h; uint32_t block[64]; uint32_t T1; a = state[0]; b = state[1]; c = state[2]; d = state[3]; e = state[4]; f = state[5]; g = state[6]; h = state[7]; #if CONFIG_SMALL for (i = 0; i < 64; i++) { uint32_t T2; if (i < 16) T1 = blk0(i); else T1 = blk(i); T1 += h + Sigma1_256(e) + Ch(e, f, g) + K256[i]; T2 = Sigma0_256(a) + Maj(a, b, c); h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2; } #else for (i = 0; i < 16;) { ROUND256_0_TO_15(a, b, c, d, e, f, g, h); ROUND256_0_TO_15(h, a, b, c, d, e, f, g); ROUND256_0_TO_15(g, h, a, b, c, d, e, f); ROUND256_0_TO_15(f, g, h, a, b, c, d, e); ROUND256_0_TO_15(e, f, g, h, a, b, c, d); ROUND256_0_TO_15(d, e, f, g, h, a, b, c); ROUND256_0_TO_15(c, d, e, f, g, h, a, b); ROUND256_0_TO_15(b, c, d, e, f, g, h, a); } for (; i < 64;) { ROUND256_16_TO_63(a, b, c, d, e, f, g, h); ROUND256_16_TO_63(h, a, b, c, d, e, f, g); ROUND256_16_TO_63(g, h, a, b, c, d, e, f); ROUND256_16_TO_63(f, g, h, a, b, c, d, e); ROUND256_16_TO_63(e, f, g, h, a, b, c, d); ROUND256_16_TO_63(d, e, f, g, h, a, b, c); ROUND256_16_TO_63(c, d, e, f, g, h, a, b); ROUND256_16_TO_63(b, c, d, e, f, g, h, a); } #endif state[0] += a; state[1] += b; state[2] += c; state[3] += d; state[4] += e; state[5] += f; state[6] += g; state[7] += h; }
false
FFmpeg
4e4ae2f82caacd03fe936e5553c2e8f70ee109e9
static void sha256_transform(uint32_t *state, const uint8_t buffer[64]) { unsigned int i, a, b, c, d, e, f, g, h; uint32_t block[64]; uint32_t T1; a = state[0]; b = state[1]; c = state[2]; d = state[3]; e = state[4]; f = state[5]; g = state[6]; h = state[7]; #if CONFIG_SMALL for (i = 0; i < 64; i++) { uint32_t T2; if (i < 16) T1 = blk0(i); else T1 = blk(i); T1 += h + Sigma1_256(e) + Ch(e, f, g) + K256[i]; T2 = Sigma0_256(a) + Maj(a, b, c); h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2; } #else for (i = 0; i < 16;) { ROUND256_0_TO_15(a, b, c, d, e, f, g, h); ROUND256_0_TO_15(h, a, b, c, d, e, f, g); ROUND256_0_TO_15(g, h, a, b, c, d, e, f); ROUND256_0_TO_15(f, g, h, a, b, c, d, e); ROUND256_0_TO_15(e, f, g, h, a, b, c, d); ROUND256_0_TO_15(d, e, f, g, h, a, b, c); ROUND256_0_TO_15(c, d, e, f, g, h, a, b); ROUND256_0_TO_15(b, c, d, e, f, g, h, a); } for (; i < 64;) { ROUND256_16_TO_63(a, b, c, d, e, f, g, h); ROUND256_16_TO_63(h, a, b, c, d, e, f, g); ROUND256_16_TO_63(g, h, a, b, c, d, e, f); ROUND256_16_TO_63(f, g, h, a, b, c, d, e); ROUND256_16_TO_63(e, f, g, h, a, b, c, d); ROUND256_16_TO_63(d, e, f, g, h, a, b, c); ROUND256_16_TO_63(c, d, e, f, g, h, a, b); ROUND256_16_TO_63(b, c, d, e, f, g, h, a); } #endif state[0] += a; state[1] += b; state[2] += c; state[3] += d; state[4] += e; state[5] += f; state[6] += g; state[7] += h; }
{ "code": [], "line_no": [] }
static void FUNC_0(uint32_t *VAR_0, const uint8_t VAR_1[64]) { unsigned int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; uint32_t block[64]; uint32_t T1; VAR_3 = VAR_0[0]; VAR_4 = VAR_0[1]; VAR_5 = VAR_0[2]; VAR_6 = VAR_0[3]; VAR_7 = VAR_0[4]; VAR_8 = VAR_0[5]; VAR_9 = VAR_0[6]; VAR_10 = VAR_0[7]; #if CONFIG_SMALL for (VAR_2 = 0; VAR_2 < 64; VAR_2++) { uint32_t T2; if (VAR_2 < 16) T1 = blk0(VAR_2); else T1 = blk(VAR_2); T1 += VAR_10 + Sigma1_256(VAR_7) + Ch(VAR_7, VAR_8, VAR_9) + K256[VAR_2]; T2 = Sigma0_256(VAR_3) + Maj(VAR_3, VAR_4, VAR_5); VAR_10 = VAR_9; VAR_9 = VAR_8; VAR_8 = VAR_7; VAR_7 = VAR_6 + T1; VAR_6 = VAR_5; VAR_5 = VAR_4; VAR_4 = VAR_3; VAR_3 = T1 + T2; } #else for (VAR_2 = 0; VAR_2 < 16;) { ROUND256_0_TO_15(VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10); ROUND256_0_TO_15(VAR_10, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9); ROUND256_0_TO_15(VAR_9, VAR_10, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8); ROUND256_0_TO_15(VAR_8, VAR_9, VAR_10, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7); ROUND256_0_TO_15(VAR_7, VAR_8, VAR_9, VAR_10, VAR_3, VAR_4, VAR_5, VAR_6); ROUND256_0_TO_15(VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_3, VAR_4, VAR_5); ROUND256_0_TO_15(VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_3, VAR_4); ROUND256_0_TO_15(VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_3); } for (; VAR_2 < 64;) { ROUND256_16_TO_63(VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10); ROUND256_16_TO_63(VAR_10, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9); ROUND256_16_TO_63(VAR_9, VAR_10, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8); ROUND256_16_TO_63(VAR_8, VAR_9, VAR_10, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7); ROUND256_16_TO_63(VAR_7, VAR_8, VAR_9, VAR_10, VAR_3, VAR_4, VAR_5, VAR_6); ROUND256_16_TO_63(VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_3, VAR_4, VAR_5); ROUND256_16_TO_63(VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_3, VAR_4); ROUND256_16_TO_63(VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_3); } #endif VAR_0[0] += VAR_3; VAR_0[1] += VAR_4; VAR_0[2] += VAR_5; VAR_0[3] += VAR_6; VAR_0[4] += VAR_7; VAR_0[5] += VAR_8; VAR_0[6] += VAR_9; VAR_0[7] += VAR_10; }
[ "static void FUNC_0(uint32_t *VAR_0, const uint8_t VAR_1[64])\n{", "unsigned int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "uint32_t block[64];", "uint32_t T1;", "VAR_3 = VAR_0[0];", "VAR_4 = VAR_0[1];", "VAR_5 = VAR_0[2];", "VAR_6 = VAR_0[3];", "VAR_7 = VAR_0[4];", "VAR_8 = VAR_0[5];", "VAR_9 = VAR_0[6];", "VAR_10 = VAR_0[7];", "#if CONFIG_SMALL\nfor (VAR_2 = 0; VAR_2 < 64; VAR_2++) {", "uint32_t T2;", "if (VAR_2 < 16)\nT1 = blk0(VAR_2);", "else\nT1 = blk(VAR_2);", "T1 += VAR_10 + Sigma1_256(VAR_7) + Ch(VAR_7, VAR_8, VAR_9) + K256[VAR_2];", "T2 = Sigma0_256(VAR_3) + Maj(VAR_3, VAR_4, VAR_5);", "VAR_10 = VAR_9;", "VAR_9 = VAR_8;", "VAR_8 = VAR_7;", "VAR_7 = VAR_6 + T1;", "VAR_6 = VAR_5;", "VAR_5 = VAR_4;", "VAR_4 = VAR_3;", "VAR_3 = T1 + T2;", "}", "#else\nfor (VAR_2 = 0; VAR_2 < 16;) {", "ROUND256_0_TO_15(VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10);", "ROUND256_0_TO_15(VAR_10, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9);", "ROUND256_0_TO_15(VAR_9, VAR_10, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8);", "ROUND256_0_TO_15(VAR_8, VAR_9, VAR_10, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7);", "ROUND256_0_TO_15(VAR_7, VAR_8, VAR_9, VAR_10, VAR_3, VAR_4, VAR_5, VAR_6);", "ROUND256_0_TO_15(VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_3, VAR_4, VAR_5);", "ROUND256_0_TO_15(VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_3, VAR_4);", "ROUND256_0_TO_15(VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_3);", "}", "for (; VAR_2 < 64;) {", "ROUND256_16_TO_63(VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10);", "ROUND256_16_TO_63(VAR_10, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9);", "ROUND256_16_TO_63(VAR_9, VAR_10, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8);", "ROUND256_16_TO_63(VAR_8, VAR_9, VAR_10, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7);", "ROUND256_16_TO_63(VAR_7, VAR_8, VAR_9, VAR_10, VAR_3, VAR_4, VAR_5, VAR_6);", "ROUND256_16_TO_63(VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_3, VAR_4, VAR_5);", "ROUND256_16_TO_63(VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_3, VAR_4);", "ROUND256_16_TO_63(VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_3);", "}", "#endif\nVAR_0[0] += VAR_3;", "VAR_0[1] += VAR_4;", "VAR_0[2] += VAR_5;", "VAR_0[3] += VAR_6;", "VAR_0[4] += VAR_7;", "VAR_0[5] += VAR_8;", "VAR_0[6] += VAR_9;", "VAR_0[7] += VAR_10;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ] ]
131
static void device_finalize(Object *obj) { NamedGPIOList *ngl, *next; DeviceState *dev = DEVICE(obj); qemu_opts_del(dev->opts); QLIST_FOREACH_SAFE(ngl, &dev->gpios, node, next) { QLIST_REMOVE(ngl, node); qemu_free_irqs(ngl->in, ngl->num_in); g_free(ngl->name); g_free(ngl); /* ngl->out irqs are owned by the other end and should not be freed * here */ } }
true
qemu
abed886ec60cf239a03515cf0b30fb11fa964c44
static void device_finalize(Object *obj) { NamedGPIOList *ngl, *next; DeviceState *dev = DEVICE(obj); qemu_opts_del(dev->opts); QLIST_FOREACH_SAFE(ngl, &dev->gpios, node, next) { QLIST_REMOVE(ngl, node); qemu_free_irqs(ngl->in, ngl->num_in); g_free(ngl->name); g_free(ngl); } }
{ "code": [ " qemu_opts_del(dev->opts);" ], "line_no": [ 11 ] }
static void FUNC_0(Object *VAR_0) { NamedGPIOList *ngl, *next; DeviceState *dev = DEVICE(VAR_0); qemu_opts_del(dev->opts); QLIST_FOREACH_SAFE(ngl, &dev->gpios, node, next) { QLIST_REMOVE(ngl, node); qemu_free_irqs(ngl->in, ngl->num_in); g_free(ngl->name); g_free(ngl); } }
[ "static void FUNC_0(Object *VAR_0)\n{", "NamedGPIOList *ngl, *next;", "DeviceState *dev = DEVICE(VAR_0);", "qemu_opts_del(dev->opts);", "QLIST_FOREACH_SAFE(ngl, &dev->gpios, node, next) {", "QLIST_REMOVE(ngl, node);", "qemu_free_irqs(ngl->in, ngl->num_in);", "g_free(ngl->name);", "g_free(ngl);", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 31 ], [ 33 ] ]
132
static int vdi_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVVdiState *s = bs->opaque; VdiHeader header; size_t bmap_size; int ret; logout("\n"); ret = bdrv_read(bs->file, 0, (uint8_t *)&header, 1); if (ret < 0) { goto fail; } vdi_header_to_cpu(&header); #if defined(CONFIG_VDI_DEBUG) vdi_header_print(&header); #endif if (header.disk_size % SECTOR_SIZE != 0) { /* 'VBoxManage convertfromraw' can create images with odd disk sizes. We accept them but round the disk size to the next multiple of SECTOR_SIZE. */ logout("odd disk size %" PRIu64 " B, round up\n", header.disk_size); header.disk_size += SECTOR_SIZE - 1; header.disk_size &= ~(SECTOR_SIZE - 1); } if (header.signature != VDI_SIGNATURE) { error_setg(errp, "Image not in VDI format (bad signature %08x)", header.signature); ret = -EINVAL; goto fail; } else if (header.version != VDI_VERSION_1_1) { error_setg(errp, "unsupported VDI image (version %u.%u)", header.version >> 16, header.version & 0xffff); ret = -ENOTSUP; goto fail; } else if (header.offset_bmap % SECTOR_SIZE != 0) { /* We only support block maps which start on a sector boundary. */ error_setg(errp, "unsupported VDI image (unaligned block map offset " "0x%x)", header.offset_bmap); ret = -ENOTSUP; goto fail; } else if (header.offset_data % SECTOR_SIZE != 0) { /* We only support data blocks which start on a sector boundary. */ error_setg(errp, "unsupported VDI image (unaligned data offset 0x%x)", header.offset_data); ret = -ENOTSUP; goto fail; } else if (header.sector_size != SECTOR_SIZE) { error_setg(errp, "unsupported VDI image (sector size %u is not %u)", header.sector_size, SECTOR_SIZE); ret = -ENOTSUP; goto fail; } else if (header.block_size != 1 * MiB) { error_setg(errp, "unsupported VDI image (sector size %u is not %u)", header.block_size, 1 * MiB); ret = -ENOTSUP; goto fail; } else if (header.disk_size > (uint64_t)header.blocks_in_image * header.block_size) { error_setg(errp, "unsupported VDI image (disk size %" PRIu64 ", " "image bitmap has room for %" PRIu64 ")", header.disk_size, (uint64_t)header.blocks_in_image * header.block_size); ret = -ENOTSUP; goto fail; } else if (!uuid_is_null(header.uuid_link)) { error_setg(errp, "unsupported VDI image (non-NULL link UUID)"); ret = -ENOTSUP; goto fail; } else if (!uuid_is_null(header.uuid_parent)) { error_setg(errp, "unsupported VDI image (non-NULL parent UUID)"); ret = -ENOTSUP; goto fail; } bs->total_sectors = header.disk_size / SECTOR_SIZE; s->block_size = header.block_size; s->block_sectors = header.block_size / SECTOR_SIZE; s->bmap_sector = header.offset_bmap / SECTOR_SIZE; s->header = header; bmap_size = header.blocks_in_image * sizeof(uint32_t); bmap_size = (bmap_size + SECTOR_SIZE - 1) / SECTOR_SIZE; s->bmap = g_malloc(bmap_size * SECTOR_SIZE); ret = bdrv_read(bs->file, s->bmap_sector, (uint8_t *)s->bmap, bmap_size); if (ret < 0) { goto fail_free_bmap; } /* Disable migration when vdi images are used */ error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, "vdi", bs->device_name, "live migration"); migrate_add_blocker(s->migration_blocker); return 0; fail_free_bmap: g_free(s->bmap); fail: return ret; }
true
qemu
63fa06dc978f3669dbfd9443b33cde9e2a7f4b41
static int vdi_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVVdiState *s = bs->opaque; VdiHeader header; size_t bmap_size; int ret; logout("\n"); ret = bdrv_read(bs->file, 0, (uint8_t *)&header, 1); if (ret < 0) { goto fail; } vdi_header_to_cpu(&header); #if defined(CONFIG_VDI_DEBUG) vdi_header_print(&header); #endif if (header.disk_size % SECTOR_SIZE != 0) { logout("odd disk size %" PRIu64 " B, round up\n", header.disk_size); header.disk_size += SECTOR_SIZE - 1; header.disk_size &= ~(SECTOR_SIZE - 1); } if (header.signature != VDI_SIGNATURE) { error_setg(errp, "Image not in VDI format (bad signature %08x)", header.signature); ret = -EINVAL; goto fail; } else if (header.version != VDI_VERSION_1_1) { error_setg(errp, "unsupported VDI image (version %u.%u)", header.version >> 16, header.version & 0xffff); ret = -ENOTSUP; goto fail; } else if (header.offset_bmap % SECTOR_SIZE != 0) { error_setg(errp, "unsupported VDI image (unaligned block map offset " "0x%x)", header.offset_bmap); ret = -ENOTSUP; goto fail; } else if (header.offset_data % SECTOR_SIZE != 0) { error_setg(errp, "unsupported VDI image (unaligned data offset 0x%x)", header.offset_data); ret = -ENOTSUP; goto fail; } else if (header.sector_size != SECTOR_SIZE) { error_setg(errp, "unsupported VDI image (sector size %u is not %u)", header.sector_size, SECTOR_SIZE); ret = -ENOTSUP; goto fail; } else if (header.block_size != 1 * MiB) { error_setg(errp, "unsupported VDI image (sector size %u is not %u)", header.block_size, 1 * MiB); ret = -ENOTSUP; goto fail; } else if (header.disk_size > (uint64_t)header.blocks_in_image * header.block_size) { error_setg(errp, "unsupported VDI image (disk size %" PRIu64 ", " "image bitmap has room for %" PRIu64 ")", header.disk_size, (uint64_t)header.blocks_in_image * header.block_size); ret = -ENOTSUP; goto fail; } else if (!uuid_is_null(header.uuid_link)) { error_setg(errp, "unsupported VDI image (non-NULL link UUID)"); ret = -ENOTSUP; goto fail; } else if (!uuid_is_null(header.uuid_parent)) { error_setg(errp, "unsupported VDI image (non-NULL parent UUID)"); ret = -ENOTSUP; goto fail; } bs->total_sectors = header.disk_size / SECTOR_SIZE; s->block_size = header.block_size; s->block_sectors = header.block_size / SECTOR_SIZE; s->bmap_sector = header.offset_bmap / SECTOR_SIZE; s->header = header; bmap_size = header.blocks_in_image * sizeof(uint32_t); bmap_size = (bmap_size + SECTOR_SIZE - 1) / SECTOR_SIZE; s->bmap = g_malloc(bmap_size * SECTOR_SIZE); ret = bdrv_read(bs->file, s->bmap_sector, (uint8_t *)s->bmap, bmap_size); if (ret < 0) { goto fail_free_bmap; } error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, "vdi", bs->device_name, "live migration"); migrate_add_blocker(s->migration_blocker); return 0; fail_free_bmap: g_free(s->bmap); fail: return ret; }
{ "code": [ " } else if (header.block_size != 1 * MiB) {", " error_setg(errp, \"unsupported VDI image (sector size %u is not %u)\",", " header.block_size, 1 * MiB);" ], "line_no": [ 111, 103, 115 ] }
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2, Error **VAR_3) { BDRVVdiState *s = VAR_0->opaque; VdiHeader header; size_t bmap_size; int VAR_4; logout("\n"); VAR_4 = bdrv_read(VAR_0->file, 0, (uint8_t *)&header, 1); if (VAR_4 < 0) { goto fail; } vdi_header_to_cpu(&header); #if defined(CONFIG_VDI_DEBUG) vdi_header_print(&header); #endif if (header.disk_size % SECTOR_SIZE != 0) { logout("odd disk size %" PRIu64 " B, round up\n", header.disk_size); header.disk_size += SECTOR_SIZE - 1; header.disk_size &= ~(SECTOR_SIZE - 1); } if (header.signature != VDI_SIGNATURE) { error_setg(VAR_3, "Image not in VDI format (bad signature %08x)", header.signature); VAR_4 = -EINVAL; goto fail; } else if (header.version != VDI_VERSION_1_1) { error_setg(VAR_3, "unsupported VDI image (version %u.%u)", header.version >> 16, header.version & 0xffff); VAR_4 = -ENOTSUP; goto fail; } else if (header.offset_bmap % SECTOR_SIZE != 0) { error_setg(VAR_3, "unsupported VDI image (unaligned block map offset " "0x%x)", header.offset_bmap); VAR_4 = -ENOTSUP; goto fail; } else if (header.offset_data % SECTOR_SIZE != 0) { error_setg(VAR_3, "unsupported VDI image (unaligned data offset 0x%x)", header.offset_data); VAR_4 = -ENOTSUP; goto fail; } else if (header.sector_size != SECTOR_SIZE) { error_setg(VAR_3, "unsupported VDI image (sector size %u is not %u)", header.sector_size, SECTOR_SIZE); VAR_4 = -ENOTSUP; goto fail; } else if (header.block_size != 1 * MiB) { error_setg(VAR_3, "unsupported VDI image (sector size %u is not %u)", header.block_size, 1 * MiB); VAR_4 = -ENOTSUP; goto fail; } else if (header.disk_size > (uint64_t)header.blocks_in_image * header.block_size) { error_setg(VAR_3, "unsupported VDI image (disk size %" PRIu64 ", " "image bitmap has room for %" PRIu64 ")", header.disk_size, (uint64_t)header.blocks_in_image * header.block_size); VAR_4 = -ENOTSUP; goto fail; } else if (!uuid_is_null(header.uuid_link)) { error_setg(VAR_3, "unsupported VDI image (non-NULL link UUID)"); VAR_4 = -ENOTSUP; goto fail; } else if (!uuid_is_null(header.uuid_parent)) { error_setg(VAR_3, "unsupported VDI image (non-NULL parent UUID)"); VAR_4 = -ENOTSUP; goto fail; } VAR_0->total_sectors = header.disk_size / SECTOR_SIZE; s->block_size = header.block_size; s->block_sectors = header.block_size / SECTOR_SIZE; s->bmap_sector = header.offset_bmap / SECTOR_SIZE; s->header = header; bmap_size = header.blocks_in_image * sizeof(uint32_t); bmap_size = (bmap_size + SECTOR_SIZE - 1) / SECTOR_SIZE; s->bmap = g_malloc(bmap_size * SECTOR_SIZE); VAR_4 = bdrv_read(VAR_0->file, s->bmap_sector, (uint8_t *)s->bmap, bmap_size); if (VAR_4 < 0) { goto fail_free_bmap; } error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, "vdi", VAR_0->device_name, "live migration"); migrate_add_blocker(s->migration_blocker); return 0; fail_free_bmap: g_free(s->bmap); fail: return VAR_4; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{", "BDRVVdiState *s = VAR_0->opaque;", "VdiHeader header;", "size_t bmap_size;", "int VAR_4;", "logout(\"\\n\");", "VAR_4 = bdrv_read(VAR_0->file, 0, (uint8_t *)&header, 1);", "if (VAR_4 < 0) {", "goto fail;", "}", "vdi_header_to_cpu(&header);", "#if defined(CONFIG_VDI_DEBUG)\nvdi_header_print(&header);", "#endif\nif (header.disk_size % SECTOR_SIZE != 0) {", "logout(\"odd disk size %\" PRIu64 \" B, round up\\n\", header.disk_size);", "header.disk_size += SECTOR_SIZE - 1;", "header.disk_size &= ~(SECTOR_SIZE - 1);", "}", "if (header.signature != VDI_SIGNATURE) {", "error_setg(VAR_3, \"Image not in VDI format (bad signature %08x)\", header.signature);", "VAR_4 = -EINVAL;", "goto fail;", "} else if (header.version != VDI_VERSION_1_1) {", "error_setg(VAR_3, \"unsupported VDI image (version %u.%u)\",\nheader.version >> 16, header.version & 0xffff);", "VAR_4 = -ENOTSUP;", "goto fail;", "} else if (header.offset_bmap % SECTOR_SIZE != 0) {", "error_setg(VAR_3, \"unsupported VDI image (unaligned block map offset \"\n\"0x%x)\", header.offset_bmap);", "VAR_4 = -ENOTSUP;", "goto fail;", "} else if (header.offset_data % SECTOR_SIZE != 0) {", "error_setg(VAR_3, \"unsupported VDI image (unaligned data offset 0x%x)\",\nheader.offset_data);", "VAR_4 = -ENOTSUP;", "goto fail;", "} else if (header.sector_size != SECTOR_SIZE) {", "error_setg(VAR_3, \"unsupported VDI image (sector size %u is not %u)\",\nheader.sector_size, SECTOR_SIZE);", "VAR_4 = -ENOTSUP;", "goto fail;", "} else if (header.block_size != 1 * MiB) {", "error_setg(VAR_3, \"unsupported VDI image (sector size %u is not %u)\",\nheader.block_size, 1 * MiB);", "VAR_4 = -ENOTSUP;", "goto fail;", "} else if (header.disk_size >", "(uint64_t)header.blocks_in_image * header.block_size) {", "error_setg(VAR_3, \"unsupported VDI image (disk size %\" PRIu64 \", \"\n\"image bitmap has room for %\" PRIu64 \")\",\nheader.disk_size,\n(uint64_t)header.blocks_in_image * header.block_size);", "VAR_4 = -ENOTSUP;", "goto fail;", "} else if (!uuid_is_null(header.uuid_link)) {", "error_setg(VAR_3, \"unsupported VDI image (non-NULL link UUID)\");", "VAR_4 = -ENOTSUP;", "goto fail;", "} else if (!uuid_is_null(header.uuid_parent)) {", "error_setg(VAR_3, \"unsupported VDI image (non-NULL parent UUID)\");", "VAR_4 = -ENOTSUP;", "goto fail;", "}", "VAR_0->total_sectors = header.disk_size / SECTOR_SIZE;", "s->block_size = header.block_size;", "s->block_sectors = header.block_size / SECTOR_SIZE;", "s->bmap_sector = header.offset_bmap / SECTOR_SIZE;", "s->header = header;", "bmap_size = header.blocks_in_image * sizeof(uint32_t);", "bmap_size = (bmap_size + SECTOR_SIZE - 1) / SECTOR_SIZE;", "s->bmap = g_malloc(bmap_size * SECTOR_SIZE);", "VAR_4 = bdrv_read(VAR_0->file, s->bmap_sector, (uint8_t *)s->bmap, bmap_size);", "if (VAR_4 < 0) {", "goto fail_free_bmap;", "}", "error_set(&s->migration_blocker,\nQERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,\n\"vdi\", VAR_0->device_name, \"live migration\");", "migrate_add_blocker(s->migration_blocker);", "return 0;", "fail_free_bmap:\ng_free(s->bmap);", "fail:\nreturn 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, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 37, 41 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127, 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 189, 191, 193 ], [ 195 ], [ 199 ], [ 203, 205 ], [ 209, 211 ], [ 213 ] ]
133
static void i440fx_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->no_hotplug = 1; k->init = i440fx_initfn; k->config_write = i440fx_write_config; k->vendor_id = PCI_VENDOR_ID_INTEL; k->device_id = PCI_DEVICE_ID_INTEL_82441; k->revision = 0x02; k->class_id = PCI_CLASS_BRIDGE_HOST; dc->desc = "Host bridge"; dc->no_user = 1; dc->vmsd = &vmstate_i440fx; }
true
qemu
efec3dd631d94160288392721a5f9c39e50fb2bc
static void i440fx_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->no_hotplug = 1; k->init = i440fx_initfn; k->config_write = i440fx_write_config; k->vendor_id = PCI_VENDOR_ID_INTEL; k->device_id = PCI_DEVICE_ID_INTEL_82441; k->revision = 0x02; k->class_id = PCI_CLASS_BRIDGE_HOST; dc->desc = "Host bridge"; dc->no_user = 1; dc->vmsd = &vmstate_i440fx; }
{ "code": [ " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;" ], "line_no": [ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); PCIDeviceClass *k = PCI_DEVICE_CLASS(VAR_0); k->no_hotplug = 1; k->init = i440fx_initfn; k->config_write = i440fx_write_config; k->vendor_id = PCI_VENDOR_ID_INTEL; k->device_id = PCI_DEVICE_ID_INTEL_82441; k->revision = 0x02; k->class_id = PCI_CLASS_BRIDGE_HOST; dc->desc = "Host bridge"; dc->no_user = 1; dc->vmsd = &vmstate_i440fx; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "PCIDeviceClass *k = PCI_DEVICE_CLASS(VAR_0);", "k->no_hotplug = 1;", "k->init = i440fx_initfn;", "k->config_write = i440fx_write_config;", "k->vendor_id = PCI_VENDOR_ID_INTEL;", "k->device_id = PCI_DEVICE_ID_INTEL_82441;", "k->revision = 0x02;", "k->class_id = PCI_CLASS_BRIDGE_HOST;", "dc->desc = \"Host bridge\";", "dc->no_user = 1;", "dc->vmsd = &vmstate_i440fx;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
134
int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation) { const int isRgb = isBGR(c->dstFormat); const int bpp = fmt_depth(c->dstFormat); int i; uint8_t table_Y[1024]; uint32_t *table_32 = 0; uint16_t *table_16 = 0; uint8_t *table_8 = 0; uint8_t *table_332 = 0; uint8_t *table_121 = 0; uint8_t *table_1 = 0; int entry_size = 0; void *table_r = 0, *table_g = 0, *table_b = 0; void *table_start; int64_t crv = inv_table[0]; int64_t cbu = inv_table[1]; int64_t cgu = -inv_table[2]; int64_t cgv = -inv_table[3]; int64_t cy = 1<<16; int64_t oy = 0; //printf("%lld %lld %lld %lld %lld\n", cy, crv, cbu, cgu, cgv); if(!fullRange){ cy= (cy*255) / 219; oy= 16<<16; }else{ crv= (crv*224) / 255; cbu= (cbu*224) / 255; cgu= (cgu*224) / 255; cgv= (cgv*224) / 255; } cy = (cy *contrast )>>16; crv= (crv*contrast * saturation)>>32; cbu= (cbu*contrast * saturation)>>32; cgu= (cgu*contrast * saturation)>>32; cgv= (cgv*contrast * saturation)>>32; //printf("%lld %lld %lld %lld %lld\n", cy, crv, cbu, cgu, cgv); oy -= 256*brightness; for (i = 0; i < 1024; i++) { int j; j= (cy*(((i - 384)<<16) - oy) + (1<<31))>>32; j = (j < 0) ? 0 : ((j > 255) ? 255 : j); table_Y[i] = j; } switch (bpp) { case 32: table_start= table_32 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint32_t)); entry_size = sizeof (uint32_t); table_r = table_32 + 197; table_b = table_32 + 197 + 685; table_g = table_32 + 197 + 2*682; for (i = -197; i < 256+197; i++) ((uint32_t *)table_r)[i] = table_Y[i+384] << (isRgb ? 16 : 0); for (i = -132; i < 256+132; i++) ((uint32_t *)table_g)[i] = table_Y[i+384] << 8; for (i = -232; i < 256+232; i++) ((uint32_t *)table_b)[i] = table_Y[i+384] << (isRgb ? 0 : 16); break; case 24: table_start= table_8 = av_malloc ((256 + 2*232) * sizeof (uint8_t)); entry_size = sizeof (uint8_t); table_r = table_g = table_b = table_8 + 232; for (i = -232; i < 256+232; i++) ((uint8_t * )table_b)[i] = table_Y[i+384]; break; case 15: case 16: table_start= table_16 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint16_t)); entry_size = sizeof (uint16_t); table_r = table_16 + 197; table_b = table_16 + 197 + 685; table_g = table_16 + 197 + 2*682; for (i = -197; i < 256+197; i++) { int j = table_Y[i+384] >> 3; if (isRgb) j <<= ((bpp==16) ? 11 : 10); ((uint16_t *)table_r)[i] = j; } for (i = -132; i < 256+132; i++) { int j = table_Y[i+384] >> ((bpp==16) ? 2 : 3); ((uint16_t *)table_g)[i] = j << 5; } for (i = -232; i < 256+232; i++) { int j = table_Y[i+384] >> 3; if (!isRgb) j <<= ((bpp==16) ? 11 : 10); ((uint16_t *)table_b)[i] = j; } break; case 8: table_start= table_332 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t)); entry_size = sizeof (uint8_t); table_r = table_332 + 197; table_b = table_332 + 197 + 685; table_g = table_332 + 197 + 2*682; for (i = -197; i < 256+197; i++) { int j = (table_Y[i+384 - 16] + 18)/36; if (isRgb) j <<= 5; ((uint8_t *)table_r)[i] = j; } for (i = -132; i < 256+132; i++) { int j = (table_Y[i+384 - 16] + 18)/36; if (!isRgb) j <<= 1; ((uint8_t *)table_g)[i] = j << 2; } for (i = -232; i < 256+232; i++) { int j = (table_Y[i+384 - 37] + 43)/85; if (!isRgb) j <<= 6; ((uint8_t *)table_b)[i] = j; } break; case 4: case 4|128: table_start= table_121 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t)); entry_size = sizeof (uint8_t); table_r = table_121 + 197; table_b = table_121 + 197 + 685; table_g = table_121 + 197 + 2*682; for (i = -197; i < 256+197; i++) { int j = table_Y[i+384 - 110] >> 7; if (isRgb) j <<= 3; ((uint8_t *)table_r)[i] = j; } for (i = -132; i < 256+132; i++) { int j = (table_Y[i+384 - 37]+ 43)/85; ((uint8_t *)table_g)[i] = j << 1; } for (i = -232; i < 256+232; i++) { int j =table_Y[i+384 - 110] >> 7; if (!isRgb) j <<= 3; ((uint8_t *)table_b)[i] = j; } break; case 1: table_start= table_1 = av_malloc (256*2 * sizeof (uint8_t)); entry_size = sizeof (uint8_t); table_g = table_1; table_r = table_b = NULL; for (i = 0; i < 256+256; i++) { int j = table_Y[i + 384 - 110]>>7; ((uint8_t *)table_g)[i] = j; } break; default: table_start= NULL; av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp); //free mem? return -1; } for (i = 0; i < 256; i++) { c->table_rV[i] = (uint8_t *)table_r + entry_size * div_round (crv * (i-128), 76309); c->table_gU[i] = (uint8_t *)table_g + entry_size * div_round (cgu * (i-128), 76309); c->table_gV[i] = entry_size * div_round (cgv * (i-128), 76309); c->table_bU[i] = (uint8_t *)table_b + entry_size * div_round (cbu * (i-128), 76309); } av_free(c->yuvTable); c->yuvTable= table_start; return 0; }
true
FFmpeg
428098165de4c3edfe42c1b7f00627d287015863
int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation) { const int isRgb = isBGR(c->dstFormat); const int bpp = fmt_depth(c->dstFormat); int i; uint8_t table_Y[1024]; uint32_t *table_32 = 0; uint16_t *table_16 = 0; uint8_t *table_8 = 0; uint8_t *table_332 = 0; uint8_t *table_121 = 0; uint8_t *table_1 = 0; int entry_size = 0; void *table_r = 0, *table_g = 0, *table_b = 0; void *table_start; int64_t crv = inv_table[0]; int64_t cbu = inv_table[1]; int64_t cgu = -inv_table[2]; int64_t cgv = -inv_table[3]; int64_t cy = 1<<16; int64_t oy = 0; if(!fullRange){ cy= (cy*255) / 219; oy= 16<<16; }else{ crv= (crv*224) / 255; cbu= (cbu*224) / 255; cgu= (cgu*224) / 255; cgv= (cgv*224) / 255; } cy = (cy *contrast )>>16; crv= (crv*contrast * saturation)>>32; cbu= (cbu*contrast * saturation)>>32; cgu= (cgu*contrast * saturation)>>32; cgv= (cgv*contrast * saturation)>>32; oy -= 256*brightness; for (i = 0; i < 1024; i++) { int j; j= (cy*(((i - 384)<<16) - oy) + (1<<31))>>32; j = (j < 0) ? 0 : ((j > 255) ? 255 : j); table_Y[i] = j; } switch (bpp) { case 32: table_start= table_32 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint32_t)); entry_size = sizeof (uint32_t); table_r = table_32 + 197; table_b = table_32 + 197 + 685; table_g = table_32 + 197 + 2*682; for (i = -197; i < 256+197; i++) ((uint32_t *)table_r)[i] = table_Y[i+384] << (isRgb ? 16 : 0); for (i = -132; i < 256+132; i++) ((uint32_t *)table_g)[i] = table_Y[i+384] << 8; for (i = -232; i < 256+232; i++) ((uint32_t *)table_b)[i] = table_Y[i+384] << (isRgb ? 0 : 16); break; case 24: table_start= table_8 = av_malloc ((256 + 2*232) * sizeof (uint8_t)); entry_size = sizeof (uint8_t); table_r = table_g = table_b = table_8 + 232; for (i = -232; i < 256+232; i++) ((uint8_t * )table_b)[i] = table_Y[i+384]; break; case 15: case 16: table_start= table_16 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint16_t)); entry_size = sizeof (uint16_t); table_r = table_16 + 197; table_b = table_16 + 197 + 685; table_g = table_16 + 197 + 2*682; for (i = -197; i < 256+197; i++) { int j = table_Y[i+384] >> 3; if (isRgb) j <<= ((bpp==16) ? 11 : 10); ((uint16_t *)table_r)[i] = j; } for (i = -132; i < 256+132; i++) { int j = table_Y[i+384] >> ((bpp==16) ? 2 : 3); ((uint16_t *)table_g)[i] = j << 5; } for (i = -232; i < 256+232; i++) { int j = table_Y[i+384] >> 3; if (!isRgb) j <<= ((bpp==16) ? 11 : 10); ((uint16_t *)table_b)[i] = j; } break; case 8: table_start= table_332 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t)); entry_size = sizeof (uint8_t); table_r = table_332 + 197; table_b = table_332 + 197 + 685; table_g = table_332 + 197 + 2*682; for (i = -197; i < 256+197; i++) { int j = (table_Y[i+384 - 16] + 18)/36; if (isRgb) j <<= 5; ((uint8_t *)table_r)[i] = j; } for (i = -132; i < 256+132; i++) { int j = (table_Y[i+384 - 16] + 18)/36; if (!isRgb) j <<= 1; ((uint8_t *)table_g)[i] = j << 2; } for (i = -232; i < 256+232; i++) { int j = (table_Y[i+384 - 37] + 43)/85; if (!isRgb) j <<= 6; ((uint8_t *)table_b)[i] = j; } break; case 4: case 4|128: table_start= table_121 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t)); entry_size = sizeof (uint8_t); table_r = table_121 + 197; table_b = table_121 + 197 + 685; table_g = table_121 + 197 + 2*682; for (i = -197; i < 256+197; i++) { int j = table_Y[i+384 - 110] >> 7; if (isRgb) j <<= 3; ((uint8_t *)table_r)[i] = j; } for (i = -132; i < 256+132; i++) { int j = (table_Y[i+384 - 37]+ 43)/85; ((uint8_t *)table_g)[i] = j << 1; } for (i = -232; i < 256+232; i++) { int j =table_Y[i+384 - 110] >> 7; if (!isRgb) j <<= 3; ((uint8_t *)table_b)[i] = j; } break; case 1: table_start= table_1 = av_malloc (256*2 * sizeof (uint8_t)); entry_size = sizeof (uint8_t); table_g = table_1; table_r = table_b = NULL; for (i = 0; i < 256+256; i++) { int j = table_Y[i + 384 - 110]>>7; ((uint8_t *)table_g)[i] = j; } break; default: table_start= NULL; av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp); return -1; } for (i = 0; i < 256; i++) { c->table_rV[i] = (uint8_t *)table_r + entry_size * div_round (crv * (i-128), 76309); c->table_gU[i] = (uint8_t *)table_g + entry_size * div_round (cgu * (i-128), 76309); c->table_gV[i] = entry_size * div_round (cgv * (i-128), 76309); c->table_bU[i] = (uint8_t *)table_b + entry_size * div_round (cbu * (i-128), 76309); } av_free(c->yuvTable); c->yuvTable= table_start; return 0; }
{ "code": [ " if(!fullRange){", "\tcy= (cy*255) / 219;", "\toy= 16<<16;", "\tint j;", "\tj= (cy*(((i - 384)<<16) - oy) + (1<<31))>>32;", "\tj = (j < 0) ? 0 : ((j > 255) ? 255 : j);", "\ttable_Y[i] = j;", "\ttable_start= table_32 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint32_t));", "\tentry_size = sizeof (uint32_t);", "\ttable_r = table_32 + 197;", "\ttable_b = table_32 + 197 + 685;", "\ttable_g = table_32 + 197 + 2*682;", "\tfor (i = -197; i < 256+197; i++)", "\t ((uint32_t *)table_r)[i] = table_Y[i+384] << (isRgb ? 16 : 0);", "\tfor (i = -132; i < 256+132; i++)", "\t ((uint32_t *)table_g)[i] = table_Y[i+384] << 8;", "\tfor (i = -232; i < 256+232; i++)", "\t ((uint32_t *)table_b)[i] = table_Y[i+384] << (isRgb ? 0 : 16);", "\tbreak;", "\ttable_start= table_8 = av_malloc ((256 + 2*232) * sizeof (uint8_t));", "\tentry_size = sizeof (uint8_t);", "\ttable_r = table_g = table_b = table_8 + 232;", "\tfor (i = -232; i < 256+232; i++)", "\t ((uint8_t * )table_b)[i] = table_Y[i+384];", "\tbreak;", "\ttable_start= table_16 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint16_t));", "\tentry_size = sizeof (uint16_t);", "\ttable_r = table_16 + 197;", "\ttable_b = table_16 + 197 + 685;", "\ttable_g = table_16 + 197 + 2*682;", "\tfor (i = -197; i < 256+197; i++) {", "\t int j = table_Y[i+384] >> 3;", "\t if (isRgb)", "\t\tj <<= ((bpp==16) ? 11 : 10);", "\t ((uint16_t *)table_r)[i] = j;", "\tfor (i = -132; i < 256+132; i++) {", "\t int j = table_Y[i+384] >> ((bpp==16) ? 2 : 3);", "\t ((uint16_t *)table_g)[i] = j << 5;", "\tfor (i = -232; i < 256+232; i++) {", "\t int j = table_Y[i+384] >> 3;", "\t if (!isRgb)", "\t\tj <<= ((bpp==16) ? 11 : 10);", "\t ((uint16_t *)table_b)[i] = j;", "\tbreak;", "\ttable_start= table_332 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t));", "\tentry_size = sizeof (uint8_t);", "\ttable_r = table_332 + 197;", "\ttable_b = table_332 + 197 + 685;", "\ttable_g = table_332 + 197 + 2*682;", "\tfor (i = -197; i < 256+197; i++) {", "\t int j = (table_Y[i+384 - 16] + 18)/36;", "\t if (isRgb)", "\t\tj <<= 5;", "\t ((uint8_t *)table_r)[i] = j;", "\tfor (i = -132; i < 256+132; i++) {", "\t int j = (table_Y[i+384 - 16] + 18)/36;", "\t if (!isRgb)", "\t\tj <<= 1;", "\t ((uint8_t *)table_g)[i] = j << 2;", "\tfor (i = -232; i < 256+232; i++) {", "\t int j = (table_Y[i+384 - 37] + 43)/85;", "\t if (!isRgb)", "\t\tj <<= 6;", "\t ((uint8_t *)table_b)[i] = j;", "\tbreak;", "\ttable_start= table_121 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t));", "\tentry_size = sizeof (uint8_t);", "\ttable_r = table_121 + 197;", "\ttable_b = table_121 + 197 + 685;", "\ttable_g = table_121 + 197 + 2*682;", "\tfor (i = -197; i < 256+197; i++) {", "\t int j = table_Y[i+384 - 110] >> 7;", "\t if (isRgb)", "\t\tj <<= 3;", "\t ((uint8_t *)table_r)[i] = j;", "\tfor (i = -132; i < 256+132; i++) {", "\t int j = (table_Y[i+384 - 37]+ 43)/85;", "\t ((uint8_t *)table_g)[i] = j << 1;", "\tfor (i = -232; i < 256+232; i++) {", "\t int j =table_Y[i+384 - 110] >> 7;", "\t if (!isRgb)", "\t\tj <<= 3;", "\t ((uint8_t *)table_b)[i] = j;", "\tbreak;", "\ttable_start= table_1 = av_malloc (256*2 * sizeof (uint8_t));", "\tentry_size = sizeof (uint8_t);", "\ttable_g = table_1;", "\ttable_r = table_b = NULL;", "\tfor (i = 0; i < 256+256; i++) {", "\t int j = table_Y[i + 384 - 110]>>7;", "\t ((uint8_t *)table_g)[i] = j;", "\tbreak;", "\ttable_start= NULL;", "\tav_log(c, AV_LOG_ERROR, \"%ibpp not supported by yuv2rgb\\n\", bpp);", "\treturn -1;", "\tc->table_rV[i] = (uint8_t *)table_r + entry_size * div_round (crv * (i-128), 76309);", "\tc->table_gU[i] = (uint8_t *)table_g + entry_size * div_round (cgu * (i-128), 76309);", "\tc->table_gV[i] = entry_size * div_round (cgv * (i-128), 76309);", "\tc->table_bU[i] = (uint8_t *)table_b + entry_size * div_round (cbu * (i-128), 76309);" ], "line_no": [ 49, 51, 53, 87, 91, 93, 95, 105, 109, 111, 113, 115, 119, 121, 123, 125, 127, 129, 131, 137, 141, 143, 127, 149, 131, 159, 163, 165, 167, 169, 173, 175, 179, 181, 185, 189, 191, 195, 199, 175, 205, 181, 211, 131, 221, 141, 227, 229, 231, 173, 237, 179, 243, 247, 189, 237, 205, 259, 263, 199, 269, 205, 275, 279, 131, 289, 141, 295, 297, 299, 173, 305, 179, 311, 247, 189, 321, 325, 199, 331, 205, 311, 279, 131, 351, 141, 357, 359, 363, 365, 369, 131, 379, 381, 385, 393, 395, 397, 399 ] }
int FUNC_0 (SwsContext *VAR_0, const int VAR_1[4], int VAR_2, int VAR_3, int VAR_4, int VAR_5) { const int VAR_6 = isBGR(VAR_0->dstFormat); const int VAR_7 = fmt_depth(VAR_0->dstFormat); int VAR_8; uint8_t table_Y[1024]; uint32_t *table_32 = 0; uint16_t *table_16 = 0; uint8_t *table_8 = 0; uint8_t *table_332 = 0; uint8_t *table_121 = 0; uint8_t *table_1 = 0; int VAR_9 = 0; void *VAR_10 = 0, *VAR_11 = 0, *VAR_12 = 0; void *VAR_13; int64_t crv = VAR_1[0]; int64_t cbu = VAR_1[1]; int64_t cgu = -VAR_1[2]; int64_t cgv = -VAR_1[3]; int64_t cy = 1<<16; int64_t oy = 0; if(!VAR_2){ cy= (cy*255) / 219; oy= 16<<16; }else{ crv= (crv*224) / 255; cbu= (cbu*224) / 255; cgu= (cgu*224) / 255; cgv= (cgv*224) / 255; } cy = (cy *VAR_4 )>>16; crv= (crv*VAR_4 * VAR_5)>>32; cbu= (cbu*VAR_4 * VAR_5)>>32; cgu= (cgu*VAR_4 * VAR_5)>>32; cgv= (cgv*VAR_4 * VAR_5)>>32; oy -= 256*VAR_3; for (VAR_8 = 0; VAR_8 < 1024; VAR_8++) { int VAR_15; VAR_15= (cy*(((VAR_8 - 384)<<16) - oy) + (1<<31))>>32; VAR_15 = (VAR_15 < 0) ? 0 : ((VAR_15 > 255) ? 255 : VAR_15); table_Y[VAR_8] = VAR_15; } switch (VAR_7) { case 32: VAR_13= table_32 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint32_t)); VAR_9 = sizeof (uint32_t); VAR_10 = table_32 + 197; VAR_12 = table_32 + 197 + 685; VAR_11 = table_32 + 197 + 2*682; for (VAR_8 = -197; VAR_8 < 256+197; VAR_8++) ((uint32_t *)VAR_10)[VAR_8] = table_Y[VAR_8+384] << (VAR_6 ? 16 : 0); for (VAR_8 = -132; VAR_8 < 256+132; VAR_8++) ((uint32_t *)VAR_11)[VAR_8] = table_Y[VAR_8+384] << 8; for (VAR_8 = -232; VAR_8 < 256+232; VAR_8++) ((uint32_t *)VAR_12)[VAR_8] = table_Y[VAR_8+384] << (VAR_6 ? 0 : 16); break; case 24: VAR_13= table_8 = av_malloc ((256 + 2*232) * sizeof (uint8_t)); VAR_9 = sizeof (uint8_t); VAR_10 = VAR_11 = VAR_12 = table_8 + 232; for (VAR_8 = -232; VAR_8 < 256+232; VAR_8++) ((uint8_t * )VAR_12)[VAR_8] = table_Y[VAR_8+384]; break; case 15: case 16: VAR_13= table_16 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint16_t)); VAR_9 = sizeof (uint16_t); VAR_10 = table_16 + 197; VAR_12 = table_16 + 197 + 685; VAR_11 = table_16 + 197 + 2*682; for (VAR_8 = -197; VAR_8 < 256+197; VAR_8++) { int VAR_15 = table_Y[VAR_8+384] >> 3; if (VAR_6) VAR_15 <<= ((VAR_7==16) ? 11 : 10); ((uint16_t *)VAR_10)[VAR_8] = VAR_15; } for (VAR_8 = -132; VAR_8 < 256+132; VAR_8++) { int VAR_15 = table_Y[VAR_8+384] >> ((VAR_7==16) ? 2 : 3); ((uint16_t *)VAR_11)[VAR_8] = VAR_15 << 5; } for (VAR_8 = -232; VAR_8 < 256+232; VAR_8++) { int VAR_15 = table_Y[VAR_8+384] >> 3; if (!VAR_6) VAR_15 <<= ((VAR_7==16) ? 11 : 10); ((uint16_t *)VAR_12)[VAR_8] = VAR_15; } break; case 8: VAR_13= table_332 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t)); VAR_9 = sizeof (uint8_t); VAR_10 = table_332 + 197; VAR_12 = table_332 + 197 + 685; VAR_11 = table_332 + 197 + 2*682; for (VAR_8 = -197; VAR_8 < 256+197; VAR_8++) { int VAR_15 = (table_Y[VAR_8+384 - 16] + 18)/36; if (VAR_6) VAR_15 <<= 5; ((uint8_t *)VAR_10)[VAR_8] = VAR_15; } for (VAR_8 = -132; VAR_8 < 256+132; VAR_8++) { int VAR_15 = (table_Y[VAR_8+384 - 16] + 18)/36; if (!VAR_6) VAR_15 <<= 1; ((uint8_t *)VAR_11)[VAR_8] = VAR_15 << 2; } for (VAR_8 = -232; VAR_8 < 256+232; VAR_8++) { int VAR_15 = (table_Y[VAR_8+384 - 37] + 43)/85; if (!VAR_6) VAR_15 <<= 6; ((uint8_t *)VAR_12)[VAR_8] = VAR_15; } break; case 4: case 4|128: VAR_13= table_121 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t)); VAR_9 = sizeof (uint8_t); VAR_10 = table_121 + 197; VAR_12 = table_121 + 197 + 685; VAR_11 = table_121 + 197 + 2*682; for (VAR_8 = -197; VAR_8 < 256+197; VAR_8++) { int VAR_15 = table_Y[VAR_8+384 - 110] >> 7; if (VAR_6) VAR_15 <<= 3; ((uint8_t *)VAR_10)[VAR_8] = VAR_15; } for (VAR_8 = -132; VAR_8 < 256+132; VAR_8++) { int VAR_15 = (table_Y[VAR_8+384 - 37]+ 43)/85; ((uint8_t *)VAR_11)[VAR_8] = VAR_15 << 1; } for (VAR_8 = -232; VAR_8 < 256+232; VAR_8++) { int VAR_15 =table_Y[VAR_8+384 - 110] >> 7; if (!VAR_6) VAR_15 <<= 3; ((uint8_t *)VAR_12)[VAR_8] = VAR_15; } break; case 1: VAR_13= table_1 = av_malloc (256*2 * sizeof (uint8_t)); VAR_9 = sizeof (uint8_t); VAR_11 = table_1; VAR_10 = VAR_12 = NULL; for (VAR_8 = 0; VAR_8 < 256+256; VAR_8++) { int VAR_15 = table_Y[VAR_8 + 384 - 110]>>7; ((uint8_t *)VAR_11)[VAR_8] = VAR_15; } break; default: VAR_13= NULL; av_log(VAR_0, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", VAR_7); return -1; } for (VAR_8 = 0; VAR_8 < 256; VAR_8++) { VAR_0->table_rV[VAR_8] = (uint8_t *)VAR_10 + VAR_9 * div_round (crv * (VAR_8-128), 76309); VAR_0->table_gU[VAR_8] = (uint8_t *)VAR_11 + VAR_9 * div_round (cgu * (VAR_8-128), 76309); VAR_0->table_gV[VAR_8] = VAR_9 * div_round (cgv * (VAR_8-128), 76309); VAR_0->table_bU[VAR_8] = (uint8_t *)VAR_12 + VAR_9 * div_round (cbu * (VAR_8-128), 76309); } av_free(VAR_0->yuvTable); VAR_0->yuvTable= VAR_13; return 0; }
[ "int FUNC_0 (SwsContext *VAR_0, const int VAR_1[4], int VAR_2, int VAR_3, int VAR_4, int VAR_5)\n{", "const int VAR_6 = isBGR(VAR_0->dstFormat);", "const int VAR_7 = fmt_depth(VAR_0->dstFormat);", "int VAR_8;", "uint8_t table_Y[1024];", "uint32_t *table_32 = 0;", "uint16_t *table_16 = 0;", "uint8_t *table_8 = 0;", "uint8_t *table_332 = 0;", "uint8_t *table_121 = 0;", "uint8_t *table_1 = 0;", "int VAR_9 = 0;", "void *VAR_10 = 0, *VAR_11 = 0, *VAR_12 = 0;", "void *VAR_13;", "int64_t crv = VAR_1[0];", "int64_t cbu = VAR_1[1];", "int64_t cgu = -VAR_1[2];", "int64_t cgv = -VAR_1[3];", "int64_t cy = 1<<16;", "int64_t oy = 0;", "if(!VAR_2){", "cy= (cy*255) / 219;", "oy= 16<<16;", "}else{", "crv= (crv*224) / 255;", "cbu= (cbu*224) / 255;", "cgu= (cgu*224) / 255;", "cgv= (cgv*224) / 255;", "}", "cy = (cy *VAR_4 )>>16;", "crv= (crv*VAR_4 * VAR_5)>>32;", "cbu= (cbu*VAR_4 * VAR_5)>>32;", "cgu= (cgu*VAR_4 * VAR_5)>>32;", "cgv= (cgv*VAR_4 * VAR_5)>>32;", "oy -= 256*VAR_3;", "for (VAR_8 = 0; VAR_8 < 1024; VAR_8++) {", "int VAR_15;", "VAR_15= (cy*(((VAR_8 - 384)<<16) - oy) + (1<<31))>>32;", "VAR_15 = (VAR_15 < 0) ? 0 : ((VAR_15 > 255) ? 255 : VAR_15);", "table_Y[VAR_8] = VAR_15;", "}", "switch (VAR_7) {", "case 32:\nVAR_13= table_32 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint32_t));", "VAR_9 = sizeof (uint32_t);", "VAR_10 = table_32 + 197;", "VAR_12 = table_32 + 197 + 685;", "VAR_11 = table_32 + 197 + 2*682;", "for (VAR_8 = -197; VAR_8 < 256+197; VAR_8++)", "((uint32_t *)VAR_10)[VAR_8] = table_Y[VAR_8+384] << (VAR_6 ? 16 : 0);", "for (VAR_8 = -132; VAR_8 < 256+132; VAR_8++)", "((uint32_t *)VAR_11)[VAR_8] = table_Y[VAR_8+384] << 8;", "for (VAR_8 = -232; VAR_8 < 256+232; VAR_8++)", "((uint32_t *)VAR_12)[VAR_8] = table_Y[VAR_8+384] << (VAR_6 ? 0 : 16);", "break;", "case 24:\nVAR_13= table_8 = av_malloc ((256 + 2*232) * sizeof (uint8_t));", "VAR_9 = sizeof (uint8_t);", "VAR_10 = VAR_11 = VAR_12 = table_8 + 232;", "for (VAR_8 = -232; VAR_8 < 256+232; VAR_8++)", "((uint8_t * )VAR_12)[VAR_8] = table_Y[VAR_8+384];", "break;", "case 15:\ncase 16:\nVAR_13= table_16 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint16_t));", "VAR_9 = sizeof (uint16_t);", "VAR_10 = table_16 + 197;", "VAR_12 = table_16 + 197 + 685;", "VAR_11 = table_16 + 197 + 2*682;", "for (VAR_8 = -197; VAR_8 < 256+197; VAR_8++) {", "int VAR_15 = table_Y[VAR_8+384] >> 3;", "if (VAR_6)\nVAR_15 <<= ((VAR_7==16) ? 11 : 10);", "((uint16_t *)VAR_10)[VAR_8] = VAR_15;", "}", "for (VAR_8 = -132; VAR_8 < 256+132; VAR_8++) {", "int VAR_15 = table_Y[VAR_8+384] >> ((VAR_7==16) ? 2 : 3);", "((uint16_t *)VAR_11)[VAR_8] = VAR_15 << 5;", "}", "for (VAR_8 = -232; VAR_8 < 256+232; VAR_8++) {", "int VAR_15 = table_Y[VAR_8+384] >> 3;", "if (!VAR_6)\nVAR_15 <<= ((VAR_7==16) ? 11 : 10);", "((uint16_t *)VAR_12)[VAR_8] = VAR_15;", "}", "break;", "case 8:\nVAR_13= table_332 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t));", "VAR_9 = sizeof (uint8_t);", "VAR_10 = table_332 + 197;", "VAR_12 = table_332 + 197 + 685;", "VAR_11 = table_332 + 197 + 2*682;", "for (VAR_8 = -197; VAR_8 < 256+197; VAR_8++) {", "int VAR_15 = (table_Y[VAR_8+384 - 16] + 18)/36;", "if (VAR_6)\nVAR_15 <<= 5;", "((uint8_t *)VAR_10)[VAR_8] = VAR_15;", "}", "for (VAR_8 = -132; VAR_8 < 256+132; VAR_8++) {", "int VAR_15 = (table_Y[VAR_8+384 - 16] + 18)/36;", "if (!VAR_6)\nVAR_15 <<= 1;", "((uint8_t *)VAR_11)[VAR_8] = VAR_15 << 2;", "}", "for (VAR_8 = -232; VAR_8 < 256+232; VAR_8++) {", "int VAR_15 = (table_Y[VAR_8+384 - 37] + 43)/85;", "if (!VAR_6)\nVAR_15 <<= 6;", "((uint8_t *)VAR_12)[VAR_8] = VAR_15;", "}", "break;", "case 4:\ncase 4|128:\nVAR_13= table_121 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t));", "VAR_9 = sizeof (uint8_t);", "VAR_10 = table_121 + 197;", "VAR_12 = table_121 + 197 + 685;", "VAR_11 = table_121 + 197 + 2*682;", "for (VAR_8 = -197; VAR_8 < 256+197; VAR_8++) {", "int VAR_15 = table_Y[VAR_8+384 - 110] >> 7;", "if (VAR_6)\nVAR_15 <<= 3;", "((uint8_t *)VAR_10)[VAR_8] = VAR_15;", "}", "for (VAR_8 = -132; VAR_8 < 256+132; VAR_8++) {", "int VAR_15 = (table_Y[VAR_8+384 - 37]+ 43)/85;", "((uint8_t *)VAR_11)[VAR_8] = VAR_15 << 1;", "}", "for (VAR_8 = -232; VAR_8 < 256+232; VAR_8++) {", "int VAR_15 =table_Y[VAR_8+384 - 110] >> 7;", "if (!VAR_6)\nVAR_15 <<= 3;", "((uint8_t *)VAR_12)[VAR_8] = VAR_15;", "}", "break;", "case 1:\nVAR_13= table_1 = av_malloc (256*2 * sizeof (uint8_t));", "VAR_9 = sizeof (uint8_t);", "VAR_11 = table_1;", "VAR_10 = VAR_12 = NULL;", "for (VAR_8 = 0; VAR_8 < 256+256; VAR_8++) {", "int VAR_15 = table_Y[VAR_8 + 384 - 110]>>7;", "((uint8_t *)VAR_11)[VAR_8] = VAR_15;", "}", "break;", "default:\nVAR_13= NULL;", "av_log(VAR_0, AV_LOG_ERROR, \"%ibpp not supported by yuv2rgb\\n\", VAR_7);", "return -1;", "}", "for (VAR_8 = 0; VAR_8 < 256; VAR_8++) {", "VAR_0->table_rV[VAR_8] = (uint8_t *)VAR_10 + VAR_9 * div_round (crv * (VAR_8-128), 76309);", "VAR_0->table_gU[VAR_8] = (uint8_t *)VAR_11 + VAR_9 * div_round (cgu * (VAR_8-128), 76309);", "VAR_0->table_gV[VAR_8] = VAR_9 * div_round (cgv * (VAR_8-128), 76309);", "VAR_0->table_bU[VAR_8] = (uint8_t *)VAR_12 + VAR_9 * div_round (cbu * (VAR_8-128), 76309);", "}", "av_free(VAR_0->yuvTable);", "VAR_0->yuvTable= VAR_13;", "return 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 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 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103, 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135, 137 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 155, 157, 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 179, 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205, 207 ], [ 211 ], [ 213 ], [ 215 ], [ 219, 221 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ], [ 241, 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 257, 259 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 273, 275 ], [ 279 ], [ 281 ], [ 283 ], [ 285, 287, 289 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 303 ], [ 305 ], [ 309, 311 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 335, 337 ], [ 341 ], [ 343 ], [ 345 ], [ 349, 351 ], [ 355 ], [ 357 ], [ 359 ], [ 363 ], [ 365 ], [ 369 ], [ 371 ], [ 373 ], [ 377, 379 ], [ 381 ], [ 385 ], [ 387 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ] ]
135
target_ulong helper_udiv(target_ulong a, target_ulong b) { uint64_t x0; uint32_t x1; x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32); x1 = (b & 0xffffffff); if (x1 == 0) { raise_exception(TT_DIV_ZERO); } x0 = x0 / x1; if (x0 > 0xffffffff) { env->cc_src2 = 1; return 0xffffffff; } else { env->cc_src2 = 0; return x0; } }
true
qemu
0fcec41eec0432c77645b4a407d3a3e030c4abc4
target_ulong helper_udiv(target_ulong a, target_ulong b) { uint64_t x0; uint32_t x1; x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32); x1 = (b & 0xffffffff); if (x1 == 0) { raise_exception(TT_DIV_ZERO); } x0 = x0 / x1; if (x0 > 0xffffffff) { env->cc_src2 = 1; return 0xffffffff; } else { env->cc_src2 = 0; return x0; } }
{ "code": [ "target_ulong helper_udiv(target_ulong a, target_ulong b)", " env->cc_src2 = 1;", " return 0xffffffff;", " } else {", " env->cc_src2 = 0;", " return x0;", " env->cc_src2 = 1;", " } else {", " env->cc_src2 = 0;", " return x0;" ], "line_no": [ 1, 29, 31, 33, 35, 37, 29, 33, 35, 37 ] }
target_ulong FUNC_0(target_ulong a, target_ulong b) { uint64_t x0; uint32_t x1; x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32); x1 = (b & 0xffffffff); if (x1 == 0) { raise_exception(TT_DIV_ZERO); } x0 = x0 / x1; if (x0 > 0xffffffff) { env->cc_src2 = 1; return 0xffffffff; } else { env->cc_src2 = 0; return x0; } }
[ "target_ulong FUNC_0(target_ulong a, target_ulong b)\n{", "uint64_t x0;", "uint32_t x1;", "x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32);", "x1 = (b & 0xffffffff);", "if (x1 == 0) {", "raise_exception(TT_DIV_ZERO);", "}", "x0 = x0 / x1;", "if (x0 > 0xffffffff) {", "env->cc_src2 = 1;", "return 0xffffffff;", "} else {", "env->cc_src2 = 0;", "return x0;", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
136
static direntry_t *create_short_filename(BDRVVVFATState *s, const char *filename, unsigned int directory_start) { int i, j = 0; direntry_t *entry = array_get_next(&(s->directory)); const gchar *p, *last_dot = NULL; gunichar c; bool lossy_conversion = false; char tail[11]; if (!entry) { return NULL; } memset(entry->name, 0x20, sizeof(entry->name)); /* copy filename and search last dot */ for (p = filename; ; p = g_utf8_next_char(p)) { c = g_utf8_get_char(p); if (c == '\0') { break; } else if (c == '.') { if (j == 0) { /* '.' at start of filename */ lossy_conversion = true; } else { if (last_dot) { lossy_conversion = true; } last_dot = p; } } else if (!last_dot) { /* first part of the name; copy it */ uint8_t v = to_valid_short_char(c); if (j < 8 && v) { entry->name[j++] = v; } else { lossy_conversion = true; } } } /* copy extension (if any) */ if (last_dot) { j = 0; for (p = g_utf8_next_char(last_dot); ; p = g_utf8_next_char(p)) { c = g_utf8_get_char(p); if (c == '\0') { break; } else { /* extension; copy it */ uint8_t v = to_valid_short_char(c); if (j < 3 && v) { entry->name[8 + (j++)] = v; } else { lossy_conversion = true; } } } } if (entry->name[0] == DIR_KANJI) { entry->name[0] = DIR_KANJI_FAKE; } /* numeric-tail generation */ for (j = 0; j < 8; j++) { if (entry->name[j] == ' ') { break; } } for (i = lossy_conversion ? 1 : 0; i < 999999; i++) { direntry_t *entry1; if (i > 0) { int len = sprintf(tail, "~%d", i); memcpy(entry->name + MIN(j, 8 - len), tail, len); } for (entry1 = array_get(&(s->directory), directory_start); entry1 < entry; entry1++) { if (!is_long_name(entry1) && !memcmp(entry1->name, entry->name, 11)) { break; /* found dupe */ } } if (entry1 == entry) { /* no dupe found */ return entry; } } return NULL; }
true
qemu
7c8730d45f63b76588da5ea0d4eff73a0bcae188
static direntry_t *create_short_filename(BDRVVVFATState *s, const char *filename, unsigned int directory_start) { int i, j = 0; direntry_t *entry = array_get_next(&(s->directory)); const gchar *p, *last_dot = NULL; gunichar c; bool lossy_conversion = false; char tail[11]; if (!entry) { return NULL; } memset(entry->name, 0x20, sizeof(entry->name)); for (p = filename; ; p = g_utf8_next_char(p)) { c = g_utf8_get_char(p); if (c == '\0') { break; } else if (c == '.') { if (j == 0) { lossy_conversion = true; } else { if (last_dot) { lossy_conversion = true; } last_dot = p; } } else if (!last_dot) { uint8_t v = to_valid_short_char(c); if (j < 8 && v) { entry->name[j++] = v; } else { lossy_conversion = true; } } } if (last_dot) { j = 0; for (p = g_utf8_next_char(last_dot); ; p = g_utf8_next_char(p)) { c = g_utf8_get_char(p); if (c == '\0') { break; } else { uint8_t v = to_valid_short_char(c); if (j < 3 && v) { entry->name[8 + (j++)] = v; } else { lossy_conversion = true; } } } } if (entry->name[0] == DIR_KANJI) { entry->name[0] = DIR_KANJI_FAKE; } for (j = 0; j < 8; j++) { if (entry->name[j] == ' ') { break; } } for (i = lossy_conversion ? 1 : 0; i < 999999; i++) { direntry_t *entry1; if (i > 0) { int len = sprintf(tail, "~%d", i); memcpy(entry->name + MIN(j, 8 - len), tail, len); } for (entry1 = array_get(&(s->directory), directory_start); entry1 < entry; entry1++) { if (!is_long_name(entry1) && !memcmp(entry1->name, entry->name, 11)) { break; } } if (entry1 == entry) { return entry; } } return NULL; }
{ "code": [ " char tail[11];", " int len = sprintf(tail, \"~%d\", i);" ], "line_no": [ 19, 149 ] }
static direntry_t *FUNC_0(BDRVVVFATState *s, const char *filename, unsigned int directory_start) { int VAR_0, VAR_1 = 0; direntry_t *entry = array_get_next(&(s->directory)); const gchar *VAR_2, *last_dot = NULL; gunichar c; bool lossy_conversion = false; char VAR_3[11]; if (!entry) { return NULL; } memset(entry->name, 0x20, sizeof(entry->name)); for (VAR_2 = filename; ; VAR_2 = g_utf8_next_char(VAR_2)) { c = g_utf8_get_char(VAR_2); if (c == '\0') { break; } else if (c == '.') { if (VAR_1 == 0) { lossy_conversion = true; } else { if (last_dot) { lossy_conversion = true; } last_dot = VAR_2; } } else if (!last_dot) { uint8_t v = to_valid_short_char(c); if (VAR_1 < 8 && v) { entry->name[VAR_1++] = v; } else { lossy_conversion = true; } } } if (last_dot) { VAR_1 = 0; for (VAR_2 = g_utf8_next_char(last_dot); ; VAR_2 = g_utf8_next_char(VAR_2)) { c = g_utf8_get_char(VAR_2); if (c == '\0') { break; } else { uint8_t v = to_valid_short_char(c); if (VAR_1 < 3 && v) { entry->name[8 + (VAR_1++)] = v; } else { lossy_conversion = true; } } } } if (entry->name[0] == DIR_KANJI) { entry->name[0] = DIR_KANJI_FAKE; } for (VAR_1 = 0; VAR_1 < 8; VAR_1++) { if (entry->name[VAR_1] == ' ') { break; } } for (VAR_0 = lossy_conversion ? 1 : 0; VAR_0 < 999999; VAR_0++) { direntry_t *entry1; if (VAR_0 > 0) { int VAR_4 = sprintf(VAR_3, "~%d", VAR_0); memcpy(entry->name + MIN(VAR_1, 8 - VAR_4), VAR_3, VAR_4); } for (entry1 = array_get(&(s->directory), directory_start); entry1 < entry; entry1++) { if (!is_long_name(entry1) && !memcmp(entry1->name, entry->name, 11)) { break; } } if (entry1 == entry) { return entry; } } return NULL; }
[ "static direntry_t *FUNC_0(BDRVVVFATState *s,\nconst char *filename,\nunsigned int directory_start)\n{", "int VAR_0, VAR_1 = 0;", "direntry_t *entry = array_get_next(&(s->directory));", "const gchar *VAR_2, *last_dot = NULL;", "gunichar c;", "bool lossy_conversion = false;", "char VAR_3[11];", "if (!entry) {", "return NULL;", "}", "memset(entry->name, 0x20, sizeof(entry->name));", "for (VAR_2 = filename; ; VAR_2 = g_utf8_next_char(VAR_2)) {", "c = g_utf8_get_char(VAR_2);", "if (c == '\\0') {", "break;", "} else if (c == '.') {", "if (VAR_1 == 0) {", "lossy_conversion = true;", "} else {", "if (last_dot) {", "lossy_conversion = true;", "}", "last_dot = VAR_2;", "}", "} else if (!last_dot) {", "uint8_t v = to_valid_short_char(c);", "if (VAR_1 < 8 && v) {", "entry->name[VAR_1++] = v;", "} else {", "lossy_conversion = true;", "}", "}", "}", "if (last_dot) {", "VAR_1 = 0;", "for (VAR_2 = g_utf8_next_char(last_dot); ; VAR_2 = g_utf8_next_char(VAR_2)) {", "c = g_utf8_get_char(VAR_2);", "if (c == '\\0') {", "break;", "} else {", "uint8_t v = to_valid_short_char(c);", "if (VAR_1 < 3 && v) {", "entry->name[8 + (VAR_1++)] = v;", "} else {", "lossy_conversion = true;", "}", "}", "}", "}", "if (entry->name[0] == DIR_KANJI) {", "entry->name[0] = DIR_KANJI_FAKE;", "}", "for (VAR_1 = 0; VAR_1 < 8; VAR_1++) {", "if (entry->name[VAR_1] == ' ') {", "break;", "}", "}", "for (VAR_0 = lossy_conversion ? 1 : 0; VAR_0 < 999999; VAR_0++) {", "direntry_t *entry1;", "if (VAR_0 > 0) {", "int VAR_4 = sprintf(VAR_3, \"~%d\", VAR_0);", "memcpy(entry->name + MIN(VAR_1, 8 - VAR_4), VAR_3, VAR_4);", "}", "for (entry1 = array_get(&(s->directory), directory_start);", "entry1 < entry; entry1++) {", "if (!is_long_name(entry1) &&\n!memcmp(entry1->name, entry->name, 11)) {", "break;", "}", "}", "if (entry1 == entry) {", "return entry;", "}", "}", "return NULL;", "}" ]
[ 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, 1, 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 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ] ]
138
void ff_print_debug_info(MpegEncContext *s, Picture *p) { AVFrame *pict; if (s->avctx->hwaccel || !p || !p->mb_type) return; pict = &p->f; if (s->avctx->debug & (FF_DEBUG_SKIP | FF_DEBUG_QP | FF_DEBUG_MB_TYPE)) { int x,y; av_log(s->avctx,AV_LOG_DEBUG,"New frame, type: "); switch (pict->pict_type) { case AV_PICTURE_TYPE_I: av_log(s->avctx,AV_LOG_DEBUG,"I\n"); break; case AV_PICTURE_TYPE_P: av_log(s->avctx,AV_LOG_DEBUG,"P\n"); break; case AV_PICTURE_TYPE_B: av_log(s->avctx,AV_LOG_DEBUG,"B\n"); break; case AV_PICTURE_TYPE_S: av_log(s->avctx,AV_LOG_DEBUG,"S\n"); break; case AV_PICTURE_TYPE_SI: av_log(s->avctx,AV_LOG_DEBUG,"SI\n"); break; case AV_PICTURE_TYPE_SP: av_log(s->avctx,AV_LOG_DEBUG,"SP\n"); break; } for (y = 0; y < s->mb_height; y++) { for (x = 0; x < s->mb_width; x++) { if (s->avctx->debug & FF_DEBUG_SKIP) { int count = s->mbskip_table[x + y * s->mb_stride]; if (count > 9) count = 9; av_log(s->avctx, AV_LOG_DEBUG, "%1d", count); } if (s->avctx->debug & FF_DEBUG_QP) { av_log(s->avctx, AV_LOG_DEBUG, "%2d", p->qscale_table[x + y * s->mb_stride]); } if (s->avctx->debug & FF_DEBUG_MB_TYPE) { int mb_type = p->mb_type[x + y * s->mb_stride]; // Type & MV direction if (IS_PCM(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "P"); else if (IS_INTRA(mb_type) && IS_ACPRED(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "A"); else if (IS_INTRA4x4(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "i"); else if (IS_INTRA16x16(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "I"); else if (IS_DIRECT(mb_type) && IS_SKIP(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "d"); else if (IS_DIRECT(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "D"); else if (IS_GMC(mb_type) && IS_SKIP(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "g"); else if (IS_GMC(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "G"); else if (IS_SKIP(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "S"); else if (!USES_LIST(mb_type, 1)) av_log(s->avctx, AV_LOG_DEBUG, ">"); else if (!USES_LIST(mb_type, 0)) av_log(s->avctx, AV_LOG_DEBUG, "<"); else { assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1)); av_log(s->avctx, AV_LOG_DEBUG, "X"); } // segmentation if (IS_8X8(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "+"); else if (IS_16X8(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "-"); else if (IS_8X16(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "|"); else if (IS_INTRA(mb_type) || IS_16X16(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, " "); else av_log(s->avctx, AV_LOG_DEBUG, "?"); if (IS_INTERLACED(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "="); else av_log(s->avctx, AV_LOG_DEBUG, " "); } } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } } }
true
FFmpeg
f6774f905fb3cfdc319523ac640be30b14c1bc55
void ff_print_debug_info(MpegEncContext *s, Picture *p) { AVFrame *pict; if (s->avctx->hwaccel || !p || !p->mb_type) return; pict = &p->f; if (s->avctx->debug & (FF_DEBUG_SKIP | FF_DEBUG_QP | FF_DEBUG_MB_TYPE)) { int x,y; av_log(s->avctx,AV_LOG_DEBUG,"New frame, type: "); switch (pict->pict_type) { case AV_PICTURE_TYPE_I: av_log(s->avctx,AV_LOG_DEBUG,"I\n"); break; case AV_PICTURE_TYPE_P: av_log(s->avctx,AV_LOG_DEBUG,"P\n"); break; case AV_PICTURE_TYPE_B: av_log(s->avctx,AV_LOG_DEBUG,"B\n"); break; case AV_PICTURE_TYPE_S: av_log(s->avctx,AV_LOG_DEBUG,"S\n"); break; case AV_PICTURE_TYPE_SI: av_log(s->avctx,AV_LOG_DEBUG,"SI\n"); break; case AV_PICTURE_TYPE_SP: av_log(s->avctx,AV_LOG_DEBUG,"SP\n"); break; } for (y = 0; y < s->mb_height; y++) { for (x = 0; x < s->mb_width; x++) { if (s->avctx->debug & FF_DEBUG_SKIP) { int count = s->mbskip_table[x + y * s->mb_stride]; if (count > 9) count = 9; av_log(s->avctx, AV_LOG_DEBUG, "%1d", count); } if (s->avctx->debug & FF_DEBUG_QP) { av_log(s->avctx, AV_LOG_DEBUG, "%2d", p->qscale_table[x + y * s->mb_stride]); } if (s->avctx->debug & FF_DEBUG_MB_TYPE) { int mb_type = p->mb_type[x + y * s->mb_stride]; if (IS_PCM(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "P"); else if (IS_INTRA(mb_type) && IS_ACPRED(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "A"); else if (IS_INTRA4x4(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "i"); else if (IS_INTRA16x16(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "I"); else if (IS_DIRECT(mb_type) && IS_SKIP(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "d"); else if (IS_DIRECT(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "D"); else if (IS_GMC(mb_type) && IS_SKIP(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "g"); else if (IS_GMC(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "G"); else if (IS_SKIP(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "S"); else if (!USES_LIST(mb_type, 1)) av_log(s->avctx, AV_LOG_DEBUG, ">"); else if (!USES_LIST(mb_type, 0)) av_log(s->avctx, AV_LOG_DEBUG, "<"); else { assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1)); av_log(s->avctx, AV_LOG_DEBUG, "X"); } if (IS_8X8(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "+"); else if (IS_16X8(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "-"); else if (IS_8X16(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "|"); else if (IS_INTRA(mb_type) || IS_16X16(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, " "); else av_log(s->avctx, AV_LOG_DEBUG, "?"); if (IS_INTERLACED(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "="); else av_log(s->avctx, AV_LOG_DEBUG, " "); } } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } } }
{ "code": [ " pict = &p->f;" ], "line_no": [ 11 ] }
void FUNC_0(MpegEncContext *VAR_0, Picture *VAR_1) { AVFrame *pict; if (VAR_0->avctx->hwaccel || !VAR_1 || !VAR_1->mb_type) return; pict = &VAR_1->f; if (VAR_0->avctx->debug & (FF_DEBUG_SKIP | FF_DEBUG_QP | FF_DEBUG_MB_TYPE)) { int VAR_2,VAR_3; av_log(VAR_0->avctx,AV_LOG_DEBUG,"New frame, type: "); switch (pict->pict_type) { case AV_PICTURE_TYPE_I: av_log(VAR_0->avctx,AV_LOG_DEBUG,"I\n"); break; case AV_PICTURE_TYPE_P: av_log(VAR_0->avctx,AV_LOG_DEBUG,"P\n"); break; case AV_PICTURE_TYPE_B: av_log(VAR_0->avctx,AV_LOG_DEBUG,"B\n"); break; case AV_PICTURE_TYPE_S: av_log(VAR_0->avctx,AV_LOG_DEBUG,"S\n"); break; case AV_PICTURE_TYPE_SI: av_log(VAR_0->avctx,AV_LOG_DEBUG,"SI\n"); break; case AV_PICTURE_TYPE_SP: av_log(VAR_0->avctx,AV_LOG_DEBUG,"SP\n"); break; } for (VAR_3 = 0; VAR_3 < VAR_0->mb_height; VAR_3++) { for (VAR_2 = 0; VAR_2 < VAR_0->mb_width; VAR_2++) { if (VAR_0->avctx->debug & FF_DEBUG_SKIP) { int count = VAR_0->mbskip_table[VAR_2 + VAR_3 * VAR_0->mb_stride]; if (count > 9) count = 9; av_log(VAR_0->avctx, AV_LOG_DEBUG, "%1d", count); } if (VAR_0->avctx->debug & FF_DEBUG_QP) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "%2d", VAR_1->qscale_table[VAR_2 + VAR_3 * VAR_0->mb_stride]); } if (VAR_0->avctx->debug & FF_DEBUG_MB_TYPE) { int mb_type = VAR_1->mb_type[VAR_2 + VAR_3 * VAR_0->mb_stride]; if (IS_PCM(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "P"); else if (IS_INTRA(mb_type) && IS_ACPRED(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "A"); else if (IS_INTRA4x4(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "i"); else if (IS_INTRA16x16(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "I"); else if (IS_DIRECT(mb_type) && IS_SKIP(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "d"); else if (IS_DIRECT(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "D"); else if (IS_GMC(mb_type) && IS_SKIP(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "g"); else if (IS_GMC(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "G"); else if (IS_SKIP(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "S"); else if (!USES_LIST(mb_type, 1)) av_log(VAR_0->avctx, AV_LOG_DEBUG, ">"); else if (!USES_LIST(mb_type, 0)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "<"); else { assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1)); av_log(VAR_0->avctx, AV_LOG_DEBUG, "X"); } if (IS_8X8(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "+"); else if (IS_16X8(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "-"); else if (IS_8X16(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "|"); else if (IS_INTRA(mb_type) || IS_16X16(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, " "); else av_log(VAR_0->avctx, AV_LOG_DEBUG, "?"); if (IS_INTERLACED(mb_type)) av_log(VAR_0->avctx, AV_LOG_DEBUG, "="); else av_log(VAR_0->avctx, AV_LOG_DEBUG, " "); } } av_log(VAR_0->avctx, AV_LOG_DEBUG, "\n"); } } }
[ "void FUNC_0(MpegEncContext *VAR_0, Picture *VAR_1)\n{", "AVFrame *pict;", "if (VAR_0->avctx->hwaccel || !VAR_1 || !VAR_1->mb_type)\nreturn;", "pict = &VAR_1->f;", "if (VAR_0->avctx->debug & (FF_DEBUG_SKIP | FF_DEBUG_QP | FF_DEBUG_MB_TYPE)) {", "int VAR_2,VAR_3;", "av_log(VAR_0->avctx,AV_LOG_DEBUG,\"New frame, type: \");", "switch (pict->pict_type) {", "case AV_PICTURE_TYPE_I:\nav_log(VAR_0->avctx,AV_LOG_DEBUG,\"I\\n\");", "break;", "case AV_PICTURE_TYPE_P:\nav_log(VAR_0->avctx,AV_LOG_DEBUG,\"P\\n\");", "break;", "case AV_PICTURE_TYPE_B:\nav_log(VAR_0->avctx,AV_LOG_DEBUG,\"B\\n\");", "break;", "case AV_PICTURE_TYPE_S:\nav_log(VAR_0->avctx,AV_LOG_DEBUG,\"S\\n\");", "break;", "case AV_PICTURE_TYPE_SI:\nav_log(VAR_0->avctx,AV_LOG_DEBUG,\"SI\\n\");", "break;", "case AV_PICTURE_TYPE_SP:\nav_log(VAR_0->avctx,AV_LOG_DEBUG,\"SP\\n\");", "break;", "}", "for (VAR_3 = 0; VAR_3 < VAR_0->mb_height; VAR_3++) {", "for (VAR_2 = 0; VAR_2 < VAR_0->mb_width; VAR_2++) {", "if (VAR_0->avctx->debug & FF_DEBUG_SKIP) {", "int count = VAR_0->mbskip_table[VAR_2 + VAR_3 * VAR_0->mb_stride];", "if (count > 9)\ncount = 9;", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"%1d\", count);", "}", "if (VAR_0->avctx->debug & FF_DEBUG_QP) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"%2d\",\nVAR_1->qscale_table[VAR_2 + VAR_3 * VAR_0->mb_stride]);", "}", "if (VAR_0->avctx->debug & FF_DEBUG_MB_TYPE) {", "int mb_type = VAR_1->mb_type[VAR_2 + VAR_3 * VAR_0->mb_stride];", "if (IS_PCM(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"P\");", "else if (IS_INTRA(mb_type) && IS_ACPRED(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"A\");", "else if (IS_INTRA4x4(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"i\");", "else if (IS_INTRA16x16(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"I\");", "else if (IS_DIRECT(mb_type) && IS_SKIP(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"d\");", "else if (IS_DIRECT(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"D\");", "else if (IS_GMC(mb_type) && IS_SKIP(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"g\");", "else if (IS_GMC(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"G\");", "else if (IS_SKIP(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"S\");", "else if (!USES_LIST(mb_type, 1))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \">\");", "else if (!USES_LIST(mb_type, 0))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"<\");", "else {", "assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1));", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"X\");", "}", "if (IS_8X8(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"+\");", "else if (IS_16X8(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"-\");", "else if (IS_8X16(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"|\");", "else if (IS_INTRA(mb_type) || IS_16X16(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \" \");", "else\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"?\");", "if (IS_INTERLACED(mb_type))\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"=\");", "else\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \" \");", "}", "}", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"\\n\");", "}", "}", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 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 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93, 95 ], [ 97, 99 ], [ 101, 103 ], [ 105, 107 ], [ 109, 111 ], [ 113, 115 ], [ 117, 119 ], [ 121, 123 ], [ 125, 127 ], [ 129, 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 149, 151 ], [ 153, 155 ], [ 157, 159 ], [ 161, 163 ], [ 165, 167 ], [ 173, 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ] ]
139
static int xan_huffman_decode(unsigned char *dest, const unsigned char *src, int dest_len) { unsigned char byte = *src++; unsigned char ival = byte + 0x16; const unsigned char * ptr = src + byte*2; unsigned char val = ival; unsigned char *dest_end = dest + dest_len; GetBitContext gb; init_get_bits(&gb, ptr, 0); // FIXME: no src size available while ( val != 0x16 ) { val = src[val - 0x17 + get_bits1(&gb) * byte]; if ( val < 0x16 ) { if (dest + 1 > dest_end) return 0; *dest++ = val; val = ival; } } return 0; }
true
FFmpeg
b1e309865f6b4f67841c811faa5022e492095906
static int xan_huffman_decode(unsigned char *dest, const unsigned char *src, int dest_len) { unsigned char byte = *src++; unsigned char ival = byte + 0x16; const unsigned char * ptr = src + byte*2; unsigned char val = ival; unsigned char *dest_end = dest + dest_len; GetBitContext gb; init_get_bits(&gb, ptr, 0); while ( val != 0x16 ) { val = src[val - 0x17 + get_bits1(&gb) * byte]; if ( val < 0x16 ) { if (dest + 1 > dest_end) return 0; *dest++ = val; val = ival; } } return 0; }
{ "code": [ " if (dest + 1 > dest_end)" ], "line_no": [ 33 ] }
static int FUNC_0(unsigned char *VAR_0, const unsigned char *VAR_1, int VAR_2) { unsigned char VAR_3 = *VAR_1++; unsigned char VAR_4 = VAR_3 + 0x16; const unsigned char * VAR_5 = VAR_1 + VAR_3*2; unsigned char VAR_6 = VAR_4; unsigned char *VAR_7 = VAR_0 + VAR_2; GetBitContext gb; init_get_bits(&gb, VAR_5, 0); while ( VAR_6 != 0x16 ) { VAR_6 = VAR_1[VAR_6 - 0x17 + get_bits1(&gb) * VAR_3]; if ( VAR_6 < 0x16 ) { if (VAR_0 + 1 > VAR_7) return 0; *VAR_0++ = VAR_6; VAR_6 = VAR_4; } } return 0; }
[ "static int FUNC_0(unsigned char *VAR_0, const unsigned char *VAR_1,\nint VAR_2)\n{", "unsigned char VAR_3 = *VAR_1++;", "unsigned char VAR_4 = VAR_3 + 0x16;", "const unsigned char * VAR_5 = VAR_1 + VAR_3*2;", "unsigned char VAR_6 = VAR_4;", "unsigned char *VAR_7 = VAR_0 + VAR_2;", "GetBitContext gb;", "init_get_bits(&gb, VAR_5, 0);", "while ( VAR_6 != 0x16 ) {", "VAR_6 = VAR_1[VAR_6 - 0x17 + get_bits1(&gb) * VAR_3];", "if ( VAR_6 < 0x16 ) {", "if (VAR_0 + 1 > VAR_7)\nreturn 0;", "*VAR_0++ = VAR_6;", "VAR_6 = VAR_4;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
140
static int kvm_log_stop(CPUPhysMemoryClient *client, target_phys_addr_t phys_addr, ram_addr_t size) { return kvm_dirty_pages_log_change(phys_addr, size, false); }
true
qemu
a01672d3968cf91208666d371784110bfde9d4f8
static int kvm_log_stop(CPUPhysMemoryClient *client, target_phys_addr_t phys_addr, ram_addr_t size) { return kvm_dirty_pages_log_change(phys_addr, size, false); }
{ "code": [ "static int kvm_log_stop(CPUPhysMemoryClient *client,", " target_phys_addr_t phys_addr, ram_addr_t size)", " return kvm_dirty_pages_log_change(phys_addr, size, false);" ], "line_no": [ 1, 3, 7 ] }
static int FUNC_0(CPUPhysMemoryClient *VAR_0, target_phys_addr_t VAR_1, ram_addr_t VAR_2) { return kvm_dirty_pages_log_change(VAR_1, VAR_2, false); }
[ "static int FUNC_0(CPUPhysMemoryClient *VAR_0,\ntarget_phys_addr_t VAR_1, ram_addr_t VAR_2)\n{", "return kvm_dirty_pages_log_change(VAR_1, VAR_2, false);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
141
void MPV_common_end(MpegEncContext *s) { int i; if (s->motion_val) free(s->motion_val); if (s->h263_pred) { free(s->dc_val[0]); free(s->ac_val[0]); free(s->coded_block); free(s->mbintra_table); } if (s->mbskip_table) free(s->mbskip_table); for(i=0;i<3;i++) { free(s->last_picture_base[i]); free(s->next_picture_base[i]); if (s->has_b_frames) free(s->aux_picture_base[i]); } s->context_initialized = 0; }
true
FFmpeg
01dbbd0a9af53237cf7aac210370892208bfb957
void MPV_common_end(MpegEncContext *s) { int i; if (s->motion_val) free(s->motion_val); if (s->h263_pred) { free(s->dc_val[0]); free(s->ac_val[0]); free(s->coded_block); free(s->mbintra_table); } if (s->mbskip_table) free(s->mbskip_table); for(i=0;i<3;i++) { free(s->last_picture_base[i]); free(s->next_picture_base[i]); if (s->has_b_frames) free(s->aux_picture_base[i]); } s->context_initialized = 0; }
{ "code": [ " free(s->mbintra_table);", " free(s->mbintra_table);" ], "line_no": [ 21, 21 ] }
void FUNC_0(MpegEncContext *VAR_0) { int VAR_1; if (VAR_0->motion_val) free(VAR_0->motion_val); if (VAR_0->h263_pred) { free(VAR_0->dc_val[0]); free(VAR_0->ac_val[0]); free(VAR_0->coded_block); free(VAR_0->mbintra_table); } if (VAR_0->mbskip_table) free(VAR_0->mbskip_table); for(VAR_1=0;VAR_1<3;VAR_1++) { free(VAR_0->last_picture_base[VAR_1]); free(VAR_0->next_picture_base[VAR_1]); if (VAR_0->has_b_frames) free(VAR_0->aux_picture_base[VAR_1]); } VAR_0->context_initialized = 0; }
[ "void FUNC_0(MpegEncContext *VAR_0)\n{", "int VAR_1;", "if (VAR_0->motion_val)\nfree(VAR_0->motion_val);", "if (VAR_0->h263_pred) {", "free(VAR_0->dc_val[0]);", "free(VAR_0->ac_val[0]);", "free(VAR_0->coded_block);", "free(VAR_0->mbintra_table);", "}", "if (VAR_0->mbskip_table)\nfree(VAR_0->mbskip_table);", "for(VAR_1=0;VAR_1<3;VAR_1++) {", "free(VAR_0->last_picture_base[VAR_1]);", "free(VAR_0->next_picture_base[VAR_1]);", "if (VAR_0->has_b_frames)\nfree(VAR_0->aux_picture_base[VAR_1]);", "}", "VAR_0->context_initialized = 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 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 ] ]
142
static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options) { BDRVBlkdebugState *s = bs->opaque; QDict *opts; const QDictEntry *e; bool force_json = false; for (e = qdict_first(options); e; e = qdict_next(options, e)) { if (strcmp(qdict_entry_key(e), "config") && strcmp(qdict_entry_key(e), "x-image")) { force_json = true; break; } } if (force_json && !bs->file->bs->full_open_options) { /* The config file cannot be recreated, so creating a plain filename * is impossible */ return; } if (!force_json && bs->file->bs->exact_filename[0]) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "blkdebug:%s:%s", s->config_file ?: "", bs->file->bs->exact_filename); } opts = qdict_new(); qdict_put_str(opts, "driver", "blkdebug"); QINCREF(bs->file->bs->full_open_options); qdict_put(opts, "image", bs->file->bs->full_open_options); for (e = qdict_first(options); e; e = qdict_next(options, e)) { if (strcmp(qdict_entry_key(e), "x-image")) { qobject_incref(qdict_entry_value(e)); qdict_put_obj(opts, qdict_entry_key(e), qdict_entry_value(e)); } } bs->full_open_options = opts; }
true
qemu
de81d72d3d13a19edf4d461be3b0f5a877be0234
static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options) { BDRVBlkdebugState *s = bs->opaque; QDict *opts; const QDictEntry *e; bool force_json = false; for (e = qdict_first(options); e; e = qdict_next(options, e)) { if (strcmp(qdict_entry_key(e), "config") && strcmp(qdict_entry_key(e), "x-image")) { force_json = true; break; } } if (force_json && !bs->file->bs->full_open_options) { return; } if (!force_json && bs->file->bs->exact_filename[0]) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "blkdebug:%s:%s", s->config_file ?: "", bs->file->bs->exact_filename); } opts = qdict_new(); qdict_put_str(opts, "driver", "blkdebug"); QINCREF(bs->file->bs->full_open_options); qdict_put(opts, "image", bs->file->bs->full_open_options); for (e = qdict_first(options); e; e = qdict_next(options, e)) { if (strcmp(qdict_entry_key(e), "x-image")) { qobject_incref(qdict_entry_value(e)); qdict_put_obj(opts, qdict_entry_key(e), qdict_entry_value(e)); } } bs->full_open_options = opts; }
{ "code": [ " snprintf(bs->exact_filename, sizeof(bs->exact_filename),", " \"blkdebug:%s:%s\", s->config_file ?: \"\",", " bs->file->bs->exact_filename);" ], "line_no": [ 47, 49, 51 ] }
static void FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1) { BDRVBlkdebugState *s = VAR_0->opaque; QDict *opts; const QDictEntry *VAR_2; bool force_json = false; for (VAR_2 = qdict_first(VAR_1); VAR_2; VAR_2 = qdict_next(VAR_1, VAR_2)) { if (strcmp(qdict_entry_key(VAR_2), "config") && strcmp(qdict_entry_key(VAR_2), "x-image")) { force_json = true; break; } } if (force_json && !VAR_0->file->VAR_0->full_open_options) { return; } if (!force_json && VAR_0->file->VAR_0->exact_filename[0]) { snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename), "blkdebug:%s:%s", s->config_file ?: "", VAR_0->file->VAR_0->exact_filename); } opts = qdict_new(); qdict_put_str(opts, "driver", "blkdebug"); QINCREF(VAR_0->file->VAR_0->full_open_options); qdict_put(opts, "image", VAR_0->file->VAR_0->full_open_options); for (VAR_2 = qdict_first(VAR_1); VAR_2; VAR_2 = qdict_next(VAR_1, VAR_2)) { if (strcmp(qdict_entry_key(VAR_2), "x-image")) { qobject_incref(qdict_entry_value(VAR_2)); qdict_put_obj(opts, qdict_entry_key(VAR_2), qdict_entry_value(VAR_2)); } } VAR_0->full_open_options = opts; }
[ "static void FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1)\n{", "BDRVBlkdebugState *s = VAR_0->opaque;", "QDict *opts;", "const QDictEntry *VAR_2;", "bool force_json = false;", "for (VAR_2 = qdict_first(VAR_1); VAR_2; VAR_2 = qdict_next(VAR_1, VAR_2)) {", "if (strcmp(qdict_entry_key(VAR_2), \"config\") &&\nstrcmp(qdict_entry_key(VAR_2), \"x-image\"))\n{", "force_json = true;", "break;", "}", "}", "if (force_json && !VAR_0->file->VAR_0->full_open_options) {", "return;", "}", "if (!force_json && VAR_0->file->VAR_0->exact_filename[0]) {", "snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),\n\"blkdebug:%s:%s\", s->config_file ?: \"\",\nVAR_0->file->VAR_0->exact_filename);", "}", "opts = qdict_new();", "qdict_put_str(opts, \"driver\", \"blkdebug\");", "QINCREF(VAR_0->file->VAR_0->full_open_options);", "qdict_put(opts, \"image\", VAR_0->file->VAR_0->full_open_options);", "for (VAR_2 = qdict_first(VAR_1); VAR_2; VAR_2 = qdict_next(VAR_1, VAR_2)) {", "if (strcmp(qdict_entry_key(VAR_2), \"x-image\")) {", "qobject_incref(qdict_entry_value(VAR_2));", "qdict_put_obj(opts, qdict_entry_key(VAR_2), qdict_entry_value(VAR_2));", "}", "}", "VAR_0->full_open_options = opts;", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ] ]
144
static inline int usb_bt_fifo_dequeue(struct usb_hci_in_fifo_s *fifo, USBPacket *p) { int len; if (likely(!fifo->len)) return USB_RET_STALL; len = MIN(p->len, fifo->fifo[fifo->start].len); memcpy(p->data, fifo->fifo[fifo->start].data, len); if (len == p->len) { fifo->fifo[fifo->start].len -= len; fifo->fifo[fifo->start].data += len; } else { fifo->start ++; fifo->start &= CFIFO_LEN_MASK; fifo->len --; } fifo->dstart += len; fifo->dlen -= len; if (fifo->dstart >= fifo->dsize) { fifo->dstart = 0; fifo->dsize = DFIFO_LEN_MASK + 1; } return len; }
true
qemu
4f4321c11ff6e98583846bfd6f0e81954924b003
static inline int usb_bt_fifo_dequeue(struct usb_hci_in_fifo_s *fifo, USBPacket *p) { int len; if (likely(!fifo->len)) return USB_RET_STALL; len = MIN(p->len, fifo->fifo[fifo->start].len); memcpy(p->data, fifo->fifo[fifo->start].data, len); if (len == p->len) { fifo->fifo[fifo->start].len -= len; fifo->fifo[fifo->start].data += len; } else { fifo->start ++; fifo->start &= CFIFO_LEN_MASK; fifo->len --; } fifo->dstart += len; fifo->dlen -= len; if (fifo->dstart >= fifo->dsize) { fifo->dstart = 0; fifo->dsize = DFIFO_LEN_MASK + 1; } return len; }
{ "code": [ " len = MIN(p->len, fifo->fifo[fifo->start].len);", " memcpy(p->data, fifo->fifo[fifo->start].data, len);", " if (len == p->len) {", " int len;" ], "line_no": [ 17, 19, 21, 7 ] }
static inline int FUNC_0(struct usb_hci_in_fifo_s *VAR_0, USBPacket *VAR_1) { int VAR_2; if (likely(!VAR_0->VAR_2)) return USB_RET_STALL; VAR_2 = MIN(VAR_1->VAR_2, VAR_0->VAR_0[VAR_0->start].VAR_2); memcpy(VAR_1->data, VAR_0->VAR_0[VAR_0->start].data, VAR_2); if (VAR_2 == VAR_1->VAR_2) { VAR_0->VAR_0[VAR_0->start].VAR_2 -= VAR_2; VAR_0->VAR_0[VAR_0->start].data += VAR_2; } else { VAR_0->start ++; VAR_0->start &= CFIFO_LEN_MASK; VAR_0->VAR_2 --; } VAR_0->dstart += VAR_2; VAR_0->dlen -= VAR_2; if (VAR_0->dstart >= VAR_0->dsize) { VAR_0->dstart = 0; VAR_0->dsize = DFIFO_LEN_MASK + 1; } return VAR_2; }
[ "static inline int FUNC_0(struct usb_hci_in_fifo_s *VAR_0,\nUSBPacket *VAR_1)\n{", "int VAR_2;", "if (likely(!VAR_0->VAR_2))\nreturn USB_RET_STALL;", "VAR_2 = MIN(VAR_1->VAR_2, VAR_0->VAR_0[VAR_0->start].VAR_2);", "memcpy(VAR_1->data, VAR_0->VAR_0[VAR_0->start].data, VAR_2);", "if (VAR_2 == VAR_1->VAR_2) {", "VAR_0->VAR_0[VAR_0->start].VAR_2 -= VAR_2;", "VAR_0->VAR_0[VAR_0->start].data += VAR_2;", "} else {", "VAR_0->start ++;", "VAR_0->start &= CFIFO_LEN_MASK;", "VAR_0->VAR_2 --;", "}", "VAR_0->dstart += VAR_2;", "VAR_0->dlen -= VAR_2;", "if (VAR_0->dstart >= VAR_0->dsize) {", "VAR_0->dstart = 0;", "VAR_0->dsize = DFIFO_LEN_MASK + 1;", "}", "return VAR_2;", "}" ]
[ 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
145
static int block_load(QEMUFile *f, void *opaque, int version_id) { static int banner_printed; int len, flags; char device_name[256]; int64_t addr; BlockDriverState *bs; uint8_t *buf; do { addr = qemu_get_be64(f); flags = addr & ~BDRV_SECTOR_MASK; addr >>= BDRV_SECTOR_BITS; if (flags & BLK_MIG_FLAG_DEVICE_BLOCK) { int ret; /* get device name */ len = qemu_get_byte(f); qemu_get_buffer(f, (uint8_t *)device_name, len); device_name[len] = '\0'; bs = bdrv_find(device_name); if (!bs) { fprintf(stderr, "Error unknown block device %s\n", device_name); return -EINVAL; } buf = qemu_malloc(BLOCK_SIZE); qemu_get_buffer(f, buf, BLOCK_SIZE); ret = bdrv_write(bs, addr, buf, BDRV_SECTORS_PER_DIRTY_CHUNK); qemu_free(buf); if (ret < 0) { return ret; } } else if (flags & BLK_MIG_FLAG_PROGRESS) { if (!banner_printed) { printf("Receiving block device images\n"); banner_printed = 1; } printf("Completed %d %%%c", (int)addr, (addr == 100) ? '\n' : '\r'); fflush(stdout); } else if (!(flags & BLK_MIG_FLAG_EOS)) { fprintf(stderr, "Unknown flags\n"); return -EINVAL; } if (qemu_file_has_error(f)) { return -EIO; } } while (!(flags & BLK_MIG_FLAG_EOS)); return 0; }
true
qemu
77358b59f6f3ef571fb2262f5f6216e179d07ecb
static int block_load(QEMUFile *f, void *opaque, int version_id) { static int banner_printed; int len, flags; char device_name[256]; int64_t addr; BlockDriverState *bs; uint8_t *buf; do { addr = qemu_get_be64(f); flags = addr & ~BDRV_SECTOR_MASK; addr >>= BDRV_SECTOR_BITS; if (flags & BLK_MIG_FLAG_DEVICE_BLOCK) { int ret; len = qemu_get_byte(f); qemu_get_buffer(f, (uint8_t *)device_name, len); device_name[len] = '\0'; bs = bdrv_find(device_name); if (!bs) { fprintf(stderr, "Error unknown block device %s\n", device_name); return -EINVAL; } buf = qemu_malloc(BLOCK_SIZE); qemu_get_buffer(f, buf, BLOCK_SIZE); ret = bdrv_write(bs, addr, buf, BDRV_SECTORS_PER_DIRTY_CHUNK); qemu_free(buf); if (ret < 0) { return ret; } } else if (flags & BLK_MIG_FLAG_PROGRESS) { if (!banner_printed) { printf("Receiving block device images\n"); banner_printed = 1; } printf("Completed %d %%%c", (int)addr, (addr == 100) ? '\n' : '\r'); fflush(stdout); } else if (!(flags & BLK_MIG_FLAG_EOS)) { fprintf(stderr, "Unknown flags\n"); return -EINVAL; } if (qemu_file_has_error(f)) { return -EIO; } } while (!(flags & BLK_MIG_FLAG_EOS)); return 0; }
{ "code": [ " BlockDriverState *bs;", " ret = bdrv_write(bs, addr, buf, BDRV_SECTORS_PER_DIRTY_CHUNK);" ], "line_no": [ 13, 65 ] }
static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2) { static int VAR_3; int VAR_4, VAR_5; char VAR_6[256]; int64_t addr; BlockDriverState *bs; uint8_t *buf; do { addr = qemu_get_be64(VAR_0); VAR_5 = addr & ~BDRV_SECTOR_MASK; addr >>= BDRV_SECTOR_BITS; if (VAR_5 & BLK_MIG_FLAG_DEVICE_BLOCK) { int VAR_7; VAR_4 = qemu_get_byte(VAR_0); qemu_get_buffer(VAR_0, (uint8_t *)VAR_6, VAR_4); VAR_6[VAR_4] = '\0'; bs = bdrv_find(VAR_6); if (!bs) { fprintf(stderr, "Error unknown block device %s\n", VAR_6); return -EINVAL; } buf = qemu_malloc(BLOCK_SIZE); qemu_get_buffer(VAR_0, buf, BLOCK_SIZE); VAR_7 = bdrv_write(bs, addr, buf, BDRV_SECTORS_PER_DIRTY_CHUNK); qemu_free(buf); if (VAR_7 < 0) { return VAR_7; } } else if (VAR_5 & BLK_MIG_FLAG_PROGRESS) { if (!VAR_3) { printf("Receiving block device images\n"); VAR_3 = 1; } printf("Completed %d %%%c", (int)addr, (addr == 100) ? '\n' : '\r'); fflush(stdout); } else if (!(VAR_5 & BLK_MIG_FLAG_EOS)) { fprintf(stderr, "Unknown VAR_5\n"); return -EINVAL; } if (qemu_file_has_error(VAR_0)) { return -EIO; } } while (!(VAR_5 & BLK_MIG_FLAG_EOS)); return 0; }
[ "static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2)\n{", "static int VAR_3;", "int VAR_4, VAR_5;", "char VAR_6[256];", "int64_t addr;", "BlockDriverState *bs;", "uint8_t *buf;", "do {", "addr = qemu_get_be64(VAR_0);", "VAR_5 = addr & ~BDRV_SECTOR_MASK;", "addr >>= BDRV_SECTOR_BITS;", "if (VAR_5 & BLK_MIG_FLAG_DEVICE_BLOCK) {", "int VAR_7;", "VAR_4 = qemu_get_byte(VAR_0);", "qemu_get_buffer(VAR_0, (uint8_t *)VAR_6, VAR_4);", "VAR_6[VAR_4] = '\\0';", "bs = bdrv_find(VAR_6);", "if (!bs) {", "fprintf(stderr, \"Error unknown block device %s\\n\",\nVAR_6);", "return -EINVAL;", "}", "buf = qemu_malloc(BLOCK_SIZE);", "qemu_get_buffer(VAR_0, buf, BLOCK_SIZE);", "VAR_7 = bdrv_write(bs, addr, buf, BDRV_SECTORS_PER_DIRTY_CHUNK);", "qemu_free(buf);", "if (VAR_7 < 0) {", "return VAR_7;", "}", "} else if (VAR_5 & BLK_MIG_FLAG_PROGRESS) {", "if (!VAR_3) {", "printf(\"Receiving block device images\\n\");", "VAR_3 = 1;", "}", "printf(\"Completed %d %%%c\", (int)addr,\n(addr == 100) ? '\\n' : '\\r');", "fflush(stdout);", "} else if (!(VAR_5 & BLK_MIG_FLAG_EOS)) {", "fprintf(stderr, \"Unknown VAR_5\\n\");", "return -EINVAL;", "}", "if (qemu_file_has_error(VAR_0)) {", "return -EIO;", "}", "} while (!(VAR_5 & BLK_MIG_FLAG_EOS));", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ] ]
147
static int alsa_init_in (HWVoiceIn *hw, struct audsettings *as) { ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw; struct alsa_params_req req; struct alsa_params_obt obt; snd_pcm_t *handle; struct audsettings obt_as; req.fmt = aud_to_alsafmt (as->fmt, as->endianness); req.freq = as->freq; req.nchannels = as->nchannels; req.period_size = conf.period_size_in; req.buffer_size = conf.buffer_size_in; req.size_in_usec = conf.size_in_usec_in; req.override_mask = (conf.period_size_in_overridden ? 1 : 0) | (conf.buffer_size_in_overridden ? 2 : 0); if (alsa_open (1, &req, &obt, &handle)) { return -1; } obt_as.freq = obt.freq; obt_as.nchannels = obt.nchannels; obt_as.fmt = obt.fmt; obt_as.endianness = obt.endianness; audio_pcm_init_info (&hw->info, &obt_as); hw->samples = obt.samples; alsa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); if (!alsa->pcm_buf) { dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n", hw->samples, 1 << hw->info.shift); alsa_anal_close1 (&handle); return -1; } alsa->handle = handle; return 0; }
true
qemu
5706db1deb061ee9affdcea81e59c4c2cad7c41e
static int alsa_init_in (HWVoiceIn *hw, struct audsettings *as) { ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw; struct alsa_params_req req; struct alsa_params_obt obt; snd_pcm_t *handle; struct audsettings obt_as; req.fmt = aud_to_alsafmt (as->fmt, as->endianness); req.freq = as->freq; req.nchannels = as->nchannels; req.period_size = conf.period_size_in; req.buffer_size = conf.buffer_size_in; req.size_in_usec = conf.size_in_usec_in; req.override_mask = (conf.period_size_in_overridden ? 1 : 0) | (conf.buffer_size_in_overridden ? 2 : 0); if (alsa_open (1, &req, &obt, &handle)) { return -1; } obt_as.freq = obt.freq; obt_as.nchannels = obt.nchannels; obt_as.fmt = obt.fmt; obt_as.endianness = obt.endianness; audio_pcm_init_info (&hw->info, &obt_as); hw->samples = obt.samples; alsa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); if (!alsa->pcm_buf) { dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n", hw->samples, 1 << hw->info.shift); alsa_anal_close1 (&handle); return -1; } alsa->handle = handle; return 0; }
{ "code": [ "static int alsa_init_in (HWVoiceIn *hw, struct audsettings *as)" ], "line_no": [ 1 ] }
static int FUNC_0 (HWVoiceIn *VAR_0, struct audsettings *VAR_1) { ALSAVoiceIn *alsa = (ALSAVoiceIn *) VAR_0; struct alsa_params_req VAR_2; struct alsa_params_obt VAR_3; snd_pcm_t *handle; struct audsettings VAR_4; VAR_2.fmt = aud_to_alsafmt (VAR_1->fmt, VAR_1->endianness); VAR_2.freq = VAR_1->freq; VAR_2.nchannels = VAR_1->nchannels; VAR_2.period_size = conf.period_size_in; VAR_2.buffer_size = conf.buffer_size_in; VAR_2.size_in_usec = conf.size_in_usec_in; VAR_2.override_mask = (conf.period_size_in_overridden ? 1 : 0) | (conf.buffer_size_in_overridden ? 2 : 0); if (alsa_open (1, &VAR_2, &VAR_3, &handle)) { return -1; } VAR_4.freq = VAR_3.freq; VAR_4.nchannels = VAR_3.nchannels; VAR_4.fmt = VAR_3.fmt; VAR_4.endianness = VAR_3.endianness; audio_pcm_init_info (&VAR_0->info, &VAR_4); VAR_0->samples = VAR_3.samples; alsa->pcm_buf = audio_calloc (AUDIO_FUNC, VAR_0->samples, 1 << VAR_0->info.shift); if (!alsa->pcm_buf) { dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n", VAR_0->samples, 1 << VAR_0->info.shift); alsa_anal_close1 (&handle); return -1; } alsa->handle = handle; return 0; }
[ "static int FUNC_0 (HWVoiceIn *VAR_0, struct audsettings *VAR_1)\n{", "ALSAVoiceIn *alsa = (ALSAVoiceIn *) VAR_0;", "struct alsa_params_req VAR_2;", "struct alsa_params_obt VAR_3;", "snd_pcm_t *handle;", "struct audsettings VAR_4;", "VAR_2.fmt = aud_to_alsafmt (VAR_1->fmt, VAR_1->endianness);", "VAR_2.freq = VAR_1->freq;", "VAR_2.nchannels = VAR_1->nchannels;", "VAR_2.period_size = conf.period_size_in;", "VAR_2.buffer_size = conf.buffer_size_in;", "VAR_2.size_in_usec = conf.size_in_usec_in;", "VAR_2.override_mask =\n(conf.period_size_in_overridden ? 1 : 0) |\n(conf.buffer_size_in_overridden ? 2 : 0);", "if (alsa_open (1, &VAR_2, &VAR_3, &handle)) {", "return -1;", "}", "VAR_4.freq = VAR_3.freq;", "VAR_4.nchannels = VAR_3.nchannels;", "VAR_4.fmt = VAR_3.fmt;", "VAR_4.endianness = VAR_3.endianness;", "audio_pcm_init_info (&VAR_0->info, &VAR_4);", "VAR_0->samples = VAR_3.samples;", "alsa->pcm_buf = audio_calloc (AUDIO_FUNC, VAR_0->samples, 1 << VAR_0->info.shift);", "if (!alsa->pcm_buf) {", "dolog (\"Could not allocate ADC buffer (%d samples, each %d bytes)\\n\",\nVAR_0->samples, 1 << VAR_0->info.shift);", "alsa_anal_close1 (&handle);", "return -1;", "}", "alsa->handle = handle;", "return 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 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31, 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ] ]
148
static uint32_t m5206_mbar_readb(void *opaque, target_phys_addr_t offset) { m5206_mbar_state *s = (m5206_mbar_state *)opaque; offset &= 0x3ff; if (offset > 0x200) { hw_error("Bad MBAR read offset 0x%x", (int)offset); } if (m5206_mbar_width[offset >> 2] > 1) { uint16_t val; val = m5206_mbar_readw(opaque, offset & ~1); if ((offset & 1) == 0) { val >>= 8; } return val & 0xff; } return m5206_mbar_read(s, offset, 1); }
true
qemu
a32354e206895400d17c3de9a8df1de96d3df289
static uint32_t m5206_mbar_readb(void *opaque, target_phys_addr_t offset) { m5206_mbar_state *s = (m5206_mbar_state *)opaque; offset &= 0x3ff; if (offset > 0x200) { hw_error("Bad MBAR read offset 0x%x", (int)offset); } if (m5206_mbar_width[offset >> 2] > 1) { uint16_t val; val = m5206_mbar_readw(opaque, offset & ~1); if ((offset & 1) == 0) { val >>= 8; } return val & 0xff; } return m5206_mbar_read(s, offset, 1); }
{ "code": [ " if (offset > 0x200) {", " if (offset > 0x200) {", " if (offset > 0x200) {", " if (offset > 0x200) {", " if (offset > 0x200) {", " if (offset > 0x200) {" ], "line_no": [ 9, 9, 9, 9, 9, 9 ] }
static uint32_t FUNC_0(void *opaque, target_phys_addr_t offset) { m5206_mbar_state *s = (m5206_mbar_state *)opaque; offset &= 0x3ff; if (offset > 0x200) { hw_error("Bad MBAR read offset 0x%x", (int)offset); } if (m5206_mbar_width[offset >> 2] > 1) { uint16_t val; val = m5206_mbar_readw(opaque, offset & ~1); if ((offset & 1) == 0) { val >>= 8; } return val & 0xff; } return m5206_mbar_read(s, offset, 1); }
[ "static uint32_t FUNC_0(void *opaque, target_phys_addr_t offset)\n{", "m5206_mbar_state *s = (m5206_mbar_state *)opaque;", "offset &= 0x3ff;", "if (offset > 0x200) {", "hw_error(\"Bad MBAR read offset 0x%x\", (int)offset);", "}", "if (m5206_mbar_width[offset >> 2] > 1) {", "uint16_t val;", "val = m5206_mbar_readw(opaque, offset & ~1);", "if ((offset & 1) == 0) {", "val >>= 8;", "}", "return val & 0xff;", "}", "return m5206_mbar_read(s, offset, 1);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
150
static int vnc_zlib_stop(VncState *vs, int stream_id) { z_streamp zstream = &vs->zlib_stream[stream_id]; int previous_out; // switch back to normal output/zlib buffers vs->zlib = vs->output; vs->output = vs->zlib_tmp; // compress the zlib buffer // initialize the stream // XXX need one stream per session if (zstream->opaque != vs) { int err; VNC_DEBUG("VNC: initializing zlib stream %d\n", stream_id); VNC_DEBUG("VNC: opaque = %p | vs = %p\n", zstream->opaque, vs); zstream->zalloc = Z_NULL; zstream->zfree = Z_NULL; err = deflateInit2(zstream, vs->tight_compression, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY); if (err != Z_OK) { fprintf(stderr, "VNC: error initializing zlib\n"); return -1; } zstream->opaque = vs; } // XXX what to do if tight_compression changed in between? // reserve memory in output buffer buffer_reserve(&vs->output, vs->zlib.offset + 64); // set pointers zstream->next_in = vs->zlib.buffer; zstream->avail_in = vs->zlib.offset; zstream->next_out = vs->output.buffer + vs->output.offset; zstream->avail_out = vs->output.capacity - vs->output.offset; zstream->data_type = Z_BINARY; previous_out = zstream->total_out; // start encoding if (deflate(zstream, Z_SYNC_FLUSH) != Z_OK) { fprintf(stderr, "VNC: error during zlib compression\n"); return -1; } vs->output.offset = vs->output.capacity - zstream->avail_out; return zstream->total_out - previous_out; }
true
qemu
6c098407ef2c56cf6b42d6e3b545b26eaaff2edf
static int vnc_zlib_stop(VncState *vs, int stream_id) { z_streamp zstream = &vs->zlib_stream[stream_id]; int previous_out; vs->zlib = vs->output; vs->output = vs->zlib_tmp; if (zstream->opaque != vs) { int err; VNC_DEBUG("VNC: initializing zlib stream %d\n", stream_id); VNC_DEBUG("VNC: opaque = %p | vs = %p\n", zstream->opaque, vs); zstream->zalloc = Z_NULL; zstream->zfree = Z_NULL; err = deflateInit2(zstream, vs->tight_compression, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY); if (err != Z_OK) { fprintf(stderr, "VNC: error initializing zlib\n"); return -1; } zstream->opaque = vs; } buffer_reserve(&vs->output, vs->zlib.offset + 64); zstream->next_in = vs->zlib.buffer; zstream->avail_in = vs->zlib.offset; zstream->next_out = vs->output.buffer + vs->output.offset; zstream->avail_out = vs->output.capacity - vs->output.offset; zstream->data_type = Z_BINARY; previous_out = zstream->total_out; if (deflate(zstream, Z_SYNC_FLUSH) != Z_OK) { fprintf(stderr, "VNC: error during zlib compression\n"); return -1; } vs->output.offset = vs->output.capacity - zstream->avail_out; return zstream->total_out - previous_out; }
{ "code": [ " zstream->zalloc = Z_NULL;", " zstream->zfree = Z_NULL;" ], "line_no": [ 37, 39 ] }
static int FUNC_0(VncState *VAR_0, int VAR_1) { z_streamp zstream = &VAR_0->zlib_stream[VAR_1]; int VAR_2; VAR_0->zlib = VAR_0->output; VAR_0->output = VAR_0->zlib_tmp; if (zstream->opaque != VAR_0) { int VAR_3; VNC_DEBUG("VNC: initializing zlib stream %d\n", VAR_1); VNC_DEBUG("VNC: opaque = %p | VAR_0 = %p\n", zstream->opaque, VAR_0); zstream->zalloc = Z_NULL; zstream->zfree = Z_NULL; VAR_3 = deflateInit2(zstream, VAR_0->tight_compression, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY); if (VAR_3 != Z_OK) { fprintf(stderr, "VNC: error initializing zlib\n"); return -1; } zstream->opaque = VAR_0; } buffer_reserve(&VAR_0->output, VAR_0->zlib.offset + 64); zstream->next_in = VAR_0->zlib.buffer; zstream->avail_in = VAR_0->zlib.offset; zstream->next_out = VAR_0->output.buffer + VAR_0->output.offset; zstream->avail_out = VAR_0->output.capacity - VAR_0->output.offset; zstream->data_type = Z_BINARY; VAR_2 = zstream->total_out; if (deflate(zstream, Z_SYNC_FLUSH) != Z_OK) { fprintf(stderr, "VNC: error during zlib compression\n"); return -1; } VAR_0->output.offset = VAR_0->output.capacity - zstream->avail_out; return zstream->total_out - VAR_2; }
[ "static int FUNC_0(VncState *VAR_0, int VAR_1)\n{", "z_streamp zstream = &VAR_0->zlib_stream[VAR_1];", "int VAR_2;", "VAR_0->zlib = VAR_0->output;", "VAR_0->output = VAR_0->zlib_tmp;", "if (zstream->opaque != VAR_0) {", "int VAR_3;", "VNC_DEBUG(\"VNC: initializing zlib stream %d\\n\", VAR_1);", "VNC_DEBUG(\"VNC: opaque = %p | VAR_0 = %p\\n\", zstream->opaque, VAR_0);", "zstream->zalloc = Z_NULL;", "zstream->zfree = Z_NULL;", "VAR_3 = deflateInit2(zstream, VAR_0->tight_compression, Z_DEFLATED, MAX_WBITS,\nMAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);", "if (VAR_3 != Z_OK) {", "fprintf(stderr, \"VNC: error initializing zlib\\n\");", "return -1;", "}", "zstream->opaque = VAR_0;", "}", "buffer_reserve(&VAR_0->output, VAR_0->zlib.offset + 64);", "zstream->next_in = VAR_0->zlib.buffer;", "zstream->avail_in = VAR_0->zlib.offset;", "zstream->next_out = VAR_0->output.buffer + VAR_0->output.offset;", "zstream->avail_out = VAR_0->output.capacity - VAR_0->output.offset;", "zstream->data_type = Z_BINARY;", "VAR_2 = zstream->total_out;", "if (deflate(zstream, Z_SYNC_FLUSH) != Z_OK) {", "fprintf(stderr, \"VNC: error during zlib compression\\n\");", "return -1;", "}", "VAR_0->output.offset = VAR_0->output.capacity - zstream->avail_out;", "return zstream->total_out - VAR_2;", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 71 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ] ]
151
static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { FLACParseContext *fpc = s->priv_data; FLACHeaderMarker *curr; int nb_headers; const uint8_t *read_end = buf; const uint8_t *read_start = buf; if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { FLACFrameInfo fi; if (frame_header_is_valid(avctx, buf, &fi)) { s->duration = fi.blocksize; if (!avctx->sample_rate) avctx->sample_rate = fi.samplerate; if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS){ fpc->pc->pts = fi.frame_or_sample_num; if (!fi.is_var_size) fpc->pc->pts *= fi.blocksize; } } *poutbuf = buf; *poutbuf_size = buf_size; return buf_size; } fpc->avctx = avctx; if (fpc->best_header_valid) return get_best_header(fpc, poutbuf, poutbuf_size); /* If a best_header was found last call remove it with the buffer data. */ if (fpc->best_header && fpc->best_header->best_child) { FLACHeaderMarker *temp; FLACHeaderMarker *best_child = fpc->best_header->best_child; /* Remove headers in list until the end of the best_header. */ for (curr = fpc->headers; curr != best_child; curr = temp) { if (curr != fpc->best_header) { av_log(avctx, AV_LOG_DEBUG, "dropping low score %i frame header from offset %i to %i\n", curr->max_score, curr->offset, curr->next->offset); } temp = curr->next; av_freep(&curr->link_penalty); av_free(curr); } /* Release returned data from ring buffer. */ av_fifo_drain(fpc->fifo_buf, best_child->offset); /* Fix the offset for the headers remaining to match the new buffer. */ for (curr = best_child->next; curr; curr = curr->next) curr->offset -= best_child->offset; best_child->offset = 0; fpc->headers = best_child; if (fpc->nb_headers_buffered >= FLAC_MIN_HEADERS) { fpc->best_header = best_child; return get_best_header(fpc, poutbuf, poutbuf_size); } fpc->best_header = NULL; } else if (fpc->best_header) { /* No end frame no need to delete the buffer; probably eof */ FLACHeaderMarker *temp; for (curr = fpc->headers; curr != fpc->best_header; curr = temp) { temp = curr->next; av_freep(&curr->link_penalty); av_free(curr); } fpc->headers = fpc->best_header->next; av_freep(&fpc->best_header->link_penalty); av_freep(&fpc->best_header); } /* Find and score new headers. */ /* buf_size is to zero when padding, so check for this since we do */ /* not want to try to read more input once we have found the end. */ /* Note that as (non-modified) parameters, buf can be non-NULL, */ /* while buf_size is 0. */ while ((buf && buf_size && read_end < buf + buf_size && fpc->nb_headers_buffered < FLAC_MIN_HEADERS) || ((!buf || !buf_size) && !fpc->end_padded)) { int start_offset; /* Pad the end once if EOF, to check the final region for headers. */ if (!buf || !buf_size) { fpc->end_padded = 1; buf_size = MAX_FRAME_HEADER_SIZE; read_end = read_start + MAX_FRAME_HEADER_SIZE; } else { /* The maximum read size is the upper-bound of what the parser needs to have the required number of frames buffered */ int nb_desired = FLAC_MIN_HEADERS - fpc->nb_headers_buffered + 1; read_end = read_end + FFMIN(buf + buf_size - read_end, nb_desired * FLAC_AVG_FRAME_SIZE); } if (!av_fifo_space(fpc->fifo_buf) && av_fifo_size(fpc->fifo_buf) / FLAC_AVG_FRAME_SIZE > fpc->nb_headers_buffered * 20) { /* There is less than one valid flac header buffered for 20 headers * buffered. Therefore the fifo is most likely filled with invalid * data and the input is not a flac file. */ goto handle_error; } /* Fill the buffer. */ if ( av_fifo_space(fpc->fifo_buf) < read_end - read_start && av_fifo_realloc2(fpc->fifo_buf, (read_end - read_start) + 2*av_fifo_size(fpc->fifo_buf)) < 0) { av_log(avctx, AV_LOG_ERROR, "couldn't reallocate buffer of size %"PTRDIFF_SPECIFIER"\n", (read_end - read_start) + av_fifo_size(fpc->fifo_buf)); goto handle_error; } if (buf && buf_size) { av_fifo_generic_write(fpc->fifo_buf, (void*) read_start, read_end - read_start, NULL); } else { int8_t pad[MAX_FRAME_HEADER_SIZE] = { 0 }; av_fifo_generic_write(fpc->fifo_buf, (void*) pad, sizeof(pad), NULL); } /* Tag headers and update sequences. */ start_offset = av_fifo_size(fpc->fifo_buf) - ((read_end - read_start) + (MAX_FRAME_HEADER_SIZE - 1)); start_offset = FFMAX(0, start_offset); nb_headers = find_new_headers(fpc, start_offset); if (nb_headers < 0) { av_log(avctx, AV_LOG_ERROR, "find_new_headers couldn't allocate FLAC header\n"); goto handle_error; } fpc->nb_headers_buffered = nb_headers; /* Wait till FLAC_MIN_HEADERS to output a valid frame. */ if (!fpc->end_padded && fpc->nb_headers_buffered < FLAC_MIN_HEADERS) { if (buf && read_end < buf + buf_size) { read_start = read_end; continue; } else { goto handle_error; } } /* If headers found, update the scores since we have longer chains. */ if (fpc->end_padded || fpc->nb_headers_found) score_sequences(fpc); /* restore the state pre-padding */ if (fpc->end_padded) { int warp = fpc->fifo_buf->wptr - fpc->fifo_buf->buffer < MAX_FRAME_HEADER_SIZE; /* HACK: drain the tail of the fifo */ fpc->fifo_buf->wptr -= MAX_FRAME_HEADER_SIZE; fpc->fifo_buf->wndx -= MAX_FRAME_HEADER_SIZE; if (warp) { fpc->fifo_buf->wptr += fpc->fifo_buf->end - fpc->fifo_buf->buffer; } buf_size = 0; read_start = read_end = NULL; } } for (curr = fpc->headers; curr; curr = curr->next) { if (curr->max_score > 0 && (!fpc->best_header || curr->max_score > fpc->best_header->max_score)) { fpc->best_header = curr; } } if (fpc->best_header) { fpc->best_header_valid = 1; if (fpc->best_header->offset > 0) { /* Output a junk frame. */ av_log(avctx, AV_LOG_DEBUG, "Junk frame till offset %i\n", fpc->best_header->offset); /* Set duration to 0. It is unknown or invalid in a junk frame. */ s->duration = 0; *poutbuf_size = fpc->best_header->offset; *poutbuf = flac_fifo_read_wrap(fpc, 0, *poutbuf_size, &fpc->wrap_buf, &fpc->wrap_buf_allocated_size); return buf_size ? (read_end - buf) : (fpc->best_header->offset - av_fifo_size(fpc->fifo_buf)); } if (!buf_size) return get_best_header(fpc, poutbuf, poutbuf_size); } handle_error: *poutbuf = NULL; *poutbuf_size = 0; return buf_size ? read_end - buf : 0; }
true
FFmpeg
2475858889cde6221677473b663df6f985add33d
static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { FLACParseContext *fpc = s->priv_data; FLACHeaderMarker *curr; int nb_headers; const uint8_t *read_end = buf; const uint8_t *read_start = buf; if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { FLACFrameInfo fi; if (frame_header_is_valid(avctx, buf, &fi)) { s->duration = fi.blocksize; if (!avctx->sample_rate) avctx->sample_rate = fi.samplerate; if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS){ fpc->pc->pts = fi.frame_or_sample_num; if (!fi.is_var_size) fpc->pc->pts *= fi.blocksize; } } *poutbuf = buf; *poutbuf_size = buf_size; return buf_size; } fpc->avctx = avctx; if (fpc->best_header_valid) return get_best_header(fpc, poutbuf, poutbuf_size); if (fpc->best_header && fpc->best_header->best_child) { FLACHeaderMarker *temp; FLACHeaderMarker *best_child = fpc->best_header->best_child; for (curr = fpc->headers; curr != best_child; curr = temp) { if (curr != fpc->best_header) { av_log(avctx, AV_LOG_DEBUG, "dropping low score %i frame header from offset %i to %i\n", curr->max_score, curr->offset, curr->next->offset); } temp = curr->next; av_freep(&curr->link_penalty); av_free(curr); } av_fifo_drain(fpc->fifo_buf, best_child->offset); for (curr = best_child->next; curr; curr = curr->next) curr->offset -= best_child->offset; best_child->offset = 0; fpc->headers = best_child; if (fpc->nb_headers_buffered >= FLAC_MIN_HEADERS) { fpc->best_header = best_child; return get_best_header(fpc, poutbuf, poutbuf_size); } fpc->best_header = NULL; } else if (fpc->best_header) { FLACHeaderMarker *temp; for (curr = fpc->headers; curr != fpc->best_header; curr = temp) { temp = curr->next; av_freep(&curr->link_penalty); av_free(curr); } fpc->headers = fpc->best_header->next; av_freep(&fpc->best_header->link_penalty); av_freep(&fpc->best_header); } while ((buf && buf_size && read_end < buf + buf_size && fpc->nb_headers_buffered < FLAC_MIN_HEADERS) || ((!buf || !buf_size) && !fpc->end_padded)) { int start_offset; if (!buf || !buf_size) { fpc->end_padded = 1; buf_size = MAX_FRAME_HEADER_SIZE; read_end = read_start + MAX_FRAME_HEADER_SIZE; } else { int nb_desired = FLAC_MIN_HEADERS - fpc->nb_headers_buffered + 1; read_end = read_end + FFMIN(buf + buf_size - read_end, nb_desired * FLAC_AVG_FRAME_SIZE); } if (!av_fifo_space(fpc->fifo_buf) && av_fifo_size(fpc->fifo_buf) / FLAC_AVG_FRAME_SIZE > fpc->nb_headers_buffered * 20) { goto handle_error; } if ( av_fifo_space(fpc->fifo_buf) < read_end - read_start && av_fifo_realloc2(fpc->fifo_buf, (read_end - read_start) + 2*av_fifo_size(fpc->fifo_buf)) < 0) { av_log(avctx, AV_LOG_ERROR, "couldn't reallocate buffer of size %"PTRDIFF_SPECIFIER"\n", (read_end - read_start) + av_fifo_size(fpc->fifo_buf)); goto handle_error; } if (buf && buf_size) { av_fifo_generic_write(fpc->fifo_buf, (void*) read_start, read_end - read_start, NULL); } else { int8_t pad[MAX_FRAME_HEADER_SIZE] = { 0 }; av_fifo_generic_write(fpc->fifo_buf, (void*) pad, sizeof(pad), NULL); } start_offset = av_fifo_size(fpc->fifo_buf) - ((read_end - read_start) + (MAX_FRAME_HEADER_SIZE - 1)); start_offset = FFMAX(0, start_offset); nb_headers = find_new_headers(fpc, start_offset); if (nb_headers < 0) { av_log(avctx, AV_LOG_ERROR, "find_new_headers couldn't allocate FLAC header\n"); goto handle_error; } fpc->nb_headers_buffered = nb_headers; if (!fpc->end_padded && fpc->nb_headers_buffered < FLAC_MIN_HEADERS) { if (buf && read_end < buf + buf_size) { read_start = read_end; continue; } else { goto handle_error; } } if (fpc->end_padded || fpc->nb_headers_found) score_sequences(fpc); if (fpc->end_padded) { int warp = fpc->fifo_buf->wptr - fpc->fifo_buf->buffer < MAX_FRAME_HEADER_SIZE; fpc->fifo_buf->wptr -= MAX_FRAME_HEADER_SIZE; fpc->fifo_buf->wndx -= MAX_FRAME_HEADER_SIZE; if (warp) { fpc->fifo_buf->wptr += fpc->fifo_buf->end - fpc->fifo_buf->buffer; } buf_size = 0; read_start = read_end = NULL; } } for (curr = fpc->headers; curr; curr = curr->next) { if (curr->max_score > 0 && (!fpc->best_header || curr->max_score > fpc->best_header->max_score)) { fpc->best_header = curr; } } if (fpc->best_header) { fpc->best_header_valid = 1; if (fpc->best_header->offset > 0) { av_log(avctx, AV_LOG_DEBUG, "Junk frame till offset %i\n", fpc->best_header->offset); s->duration = 0; *poutbuf_size = fpc->best_header->offset; *poutbuf = flac_fifo_read_wrap(fpc, 0, *poutbuf_size, &fpc->wrap_buf, &fpc->wrap_buf_allocated_size); return buf_size ? (read_end - buf) : (fpc->best_header->offset - av_fifo_size(fpc->fifo_buf)); } if (!buf_size) return get_best_header(fpc, poutbuf, poutbuf_size); } handle_error: *poutbuf = NULL; *poutbuf_size = 0; return buf_size ? read_end - buf : 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1, const uint8_t **VAR_2, int *VAR_3, const uint8_t *VAR_4, int VAR_5) { FLACParseContext *fpc = VAR_0->priv_data; FLACHeaderMarker *curr; int VAR_6; const uint8_t *VAR_7 = VAR_4; const uint8_t *VAR_8 = VAR_4; if (VAR_0->flags & PARSER_FLAG_COMPLETE_FRAMES) { FLACFrameInfo fi; if (frame_header_is_valid(VAR_1, VAR_4, &fi)) { VAR_0->duration = fi.blocksize; if (!VAR_1->sample_rate) VAR_1->sample_rate = fi.samplerate; if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS){ fpc->pc->pts = fi.frame_or_sample_num; if (!fi.is_var_size) fpc->pc->pts *= fi.blocksize; } } *VAR_2 = VAR_4; *VAR_3 = VAR_5; return VAR_5; } fpc->VAR_1 = VAR_1; if (fpc->best_header_valid) return get_best_header(fpc, VAR_2, VAR_3); if (fpc->best_header && fpc->best_header->best_child) { FLACHeaderMarker *temp; FLACHeaderMarker *best_child = fpc->best_header->best_child; for (curr = fpc->headers; curr != best_child; curr = temp) { if (curr != fpc->best_header) { av_log(VAR_1, AV_LOG_DEBUG, "dropping low score %i frame header from offset %i to %i\n", curr->max_score, curr->offset, curr->next->offset); } temp = curr->next; av_freep(&curr->link_penalty); av_free(curr); } av_fifo_drain(fpc->fifo_buf, best_child->offset); for (curr = best_child->next; curr; curr = curr->next) curr->offset -= best_child->offset; best_child->offset = 0; fpc->headers = best_child; if (fpc->nb_headers_buffered >= FLAC_MIN_HEADERS) { fpc->best_header = best_child; return get_best_header(fpc, VAR_2, VAR_3); } fpc->best_header = NULL; } else if (fpc->best_header) { FLACHeaderMarker *temp; for (curr = fpc->headers; curr != fpc->best_header; curr = temp) { temp = curr->next; av_freep(&curr->link_penalty); av_free(curr); } fpc->headers = fpc->best_header->next; av_freep(&fpc->best_header->link_penalty); av_freep(&fpc->best_header); } while ((VAR_4 && VAR_5 && VAR_7 < VAR_4 + VAR_5 && fpc->nb_headers_buffered < FLAC_MIN_HEADERS) || ((!VAR_4 || !VAR_5) && !fpc->end_padded)) { int VAR_9; if (!VAR_4 || !VAR_5) { fpc->end_padded = 1; VAR_5 = MAX_FRAME_HEADER_SIZE; VAR_7 = VAR_8 + MAX_FRAME_HEADER_SIZE; } else { int VAR_10 = FLAC_MIN_HEADERS - fpc->nb_headers_buffered + 1; VAR_7 = VAR_7 + FFMIN(VAR_4 + VAR_5 - VAR_7, VAR_10 * FLAC_AVG_FRAME_SIZE); } if (!av_fifo_space(fpc->fifo_buf) && av_fifo_size(fpc->fifo_buf) / FLAC_AVG_FRAME_SIZE > fpc->nb_headers_buffered * 20) { goto handle_error; } if ( av_fifo_space(fpc->fifo_buf) < VAR_7 - VAR_8 && av_fifo_realloc2(fpc->fifo_buf, (VAR_7 - VAR_8) + 2*av_fifo_size(fpc->fifo_buf)) < 0) { av_log(VAR_1, AV_LOG_ERROR, "couldn't reallocate buffer of size %"PTRDIFF_SPECIFIER"\n", (VAR_7 - VAR_8) + av_fifo_size(fpc->fifo_buf)); goto handle_error; } if (VAR_4 && VAR_5) { av_fifo_generic_write(fpc->fifo_buf, (void*) VAR_8, VAR_7 - VAR_8, NULL); } else { int8_t pad[MAX_FRAME_HEADER_SIZE] = { 0 }; av_fifo_generic_write(fpc->fifo_buf, (void*) pad, sizeof(pad), NULL); } VAR_9 = av_fifo_size(fpc->fifo_buf) - ((VAR_7 - VAR_8) + (MAX_FRAME_HEADER_SIZE - 1)); VAR_9 = FFMAX(0, VAR_9); VAR_6 = find_new_headers(fpc, VAR_9); if (VAR_6 < 0) { av_log(VAR_1, AV_LOG_ERROR, "find_new_headers couldn't allocate FLAC header\n"); goto handle_error; } fpc->nb_headers_buffered = VAR_6; if (!fpc->end_padded && fpc->nb_headers_buffered < FLAC_MIN_HEADERS) { if (VAR_4 && VAR_7 < VAR_4 + VAR_5) { VAR_8 = VAR_7; continue; } else { goto handle_error; } } if (fpc->end_padded || fpc->nb_headers_found) score_sequences(fpc); if (fpc->end_padded) { int VAR_11 = fpc->fifo_buf->wptr - fpc->fifo_buf->buffer < MAX_FRAME_HEADER_SIZE; fpc->fifo_buf->wptr -= MAX_FRAME_HEADER_SIZE; fpc->fifo_buf->wndx -= MAX_FRAME_HEADER_SIZE; if (VAR_11) { fpc->fifo_buf->wptr += fpc->fifo_buf->end - fpc->fifo_buf->buffer; } VAR_5 = 0; VAR_8 = VAR_7 = NULL; } } for (curr = fpc->headers; curr; curr = curr->next) { if (curr->max_score > 0 && (!fpc->best_header || curr->max_score > fpc->best_header->max_score)) { fpc->best_header = curr; } } if (fpc->best_header) { fpc->best_header_valid = 1; if (fpc->best_header->offset > 0) { av_log(VAR_1, AV_LOG_DEBUG, "Junk frame till offset %i\n", fpc->best_header->offset); VAR_0->duration = 0; *VAR_3 = fpc->best_header->offset; *VAR_2 = flac_fifo_read_wrap(fpc, 0, *VAR_3, &fpc->wrap_buf, &fpc->wrap_buf_allocated_size); return VAR_5 ? (VAR_7 - VAR_4) : (fpc->best_header->offset - av_fifo_size(fpc->fifo_buf)); } if (!VAR_5) return get_best_header(fpc, VAR_2, VAR_3); } handle_error: *VAR_2 = NULL; *VAR_3 = 0; return VAR_5 ? VAR_7 - VAR_4 : 0; }
[ "static int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1,\nconst uint8_t **VAR_2, int *VAR_3,\nconst uint8_t *VAR_4, int VAR_5)\n{", "FLACParseContext *fpc = VAR_0->priv_data;", "FLACHeaderMarker *curr;", "int VAR_6;", "const uint8_t *VAR_7 = VAR_4;", "const uint8_t *VAR_8 = VAR_4;", "if (VAR_0->flags & PARSER_FLAG_COMPLETE_FRAMES) {", "FLACFrameInfo fi;", "if (frame_header_is_valid(VAR_1, VAR_4, &fi)) {", "VAR_0->duration = fi.blocksize;", "if (!VAR_1->sample_rate)\nVAR_1->sample_rate = fi.samplerate;", "if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS){", "fpc->pc->pts = fi.frame_or_sample_num;", "if (!fi.is_var_size)\nfpc->pc->pts *= fi.blocksize;", "}", "}", "*VAR_2 = VAR_4;", "*VAR_3 = VAR_5;", "return VAR_5;", "}", "fpc->VAR_1 = VAR_1;", "if (fpc->best_header_valid)\nreturn get_best_header(fpc, VAR_2, VAR_3);", "if (fpc->best_header && fpc->best_header->best_child) {", "FLACHeaderMarker *temp;", "FLACHeaderMarker *best_child = fpc->best_header->best_child;", "for (curr = fpc->headers; curr != best_child; curr = temp) {", "if (curr != fpc->best_header) {", "av_log(VAR_1, AV_LOG_DEBUG,\n\"dropping low score %i frame header from offset %i to %i\\n\",\ncurr->max_score, curr->offset, curr->next->offset);", "}", "temp = curr->next;", "av_freep(&curr->link_penalty);", "av_free(curr);", "}", "av_fifo_drain(fpc->fifo_buf, best_child->offset);", "for (curr = best_child->next; curr; curr = curr->next)", "curr->offset -= best_child->offset;", "best_child->offset = 0;", "fpc->headers = best_child;", "if (fpc->nb_headers_buffered >= FLAC_MIN_HEADERS) {", "fpc->best_header = best_child;", "return get_best_header(fpc, VAR_2, VAR_3);", "}", "fpc->best_header = NULL;", "} else if (fpc->best_header) {", "FLACHeaderMarker *temp;", "for (curr = fpc->headers; curr != fpc->best_header; curr = temp) {", "temp = curr->next;", "av_freep(&curr->link_penalty);", "av_free(curr);", "}", "fpc->headers = fpc->best_header->next;", "av_freep(&fpc->best_header->link_penalty);", "av_freep(&fpc->best_header);", "}", "while ((VAR_4 && VAR_5 && VAR_7 < VAR_4 + VAR_5 &&\nfpc->nb_headers_buffered < FLAC_MIN_HEADERS)\n|| ((!VAR_4 || !VAR_5) && !fpc->end_padded)) {", "int VAR_9;", "if (!VAR_4 || !VAR_5) {", "fpc->end_padded = 1;", "VAR_5 = MAX_FRAME_HEADER_SIZE;", "VAR_7 = VAR_8 + MAX_FRAME_HEADER_SIZE;", "} else {", "int VAR_10 = FLAC_MIN_HEADERS - fpc->nb_headers_buffered + 1;", "VAR_7 = VAR_7 + FFMIN(VAR_4 + VAR_5 - VAR_7,\nVAR_10 * FLAC_AVG_FRAME_SIZE);", "}", "if (!av_fifo_space(fpc->fifo_buf) &&\nav_fifo_size(fpc->fifo_buf) / FLAC_AVG_FRAME_SIZE >\nfpc->nb_headers_buffered * 20) {", "goto handle_error;", "}", "if ( av_fifo_space(fpc->fifo_buf) < VAR_7 - VAR_8\n&& av_fifo_realloc2(fpc->fifo_buf, (VAR_7 - VAR_8) + 2*av_fifo_size(fpc->fifo_buf)) < 0) {", "av_log(VAR_1, AV_LOG_ERROR,\n\"couldn't reallocate buffer of size %\"PTRDIFF_SPECIFIER\"\\n\",\n(VAR_7 - VAR_8) + av_fifo_size(fpc->fifo_buf));", "goto handle_error;", "}", "if (VAR_4 && VAR_5) {", "av_fifo_generic_write(fpc->fifo_buf, (void*) VAR_8,\nVAR_7 - VAR_8, NULL);", "} else {", "int8_t pad[MAX_FRAME_HEADER_SIZE] = { 0 };", "av_fifo_generic_write(fpc->fifo_buf, (void*) pad, sizeof(pad), NULL);", "}", "VAR_9 = av_fifo_size(fpc->fifo_buf) -\n((VAR_7 - VAR_8) + (MAX_FRAME_HEADER_SIZE - 1));", "VAR_9 = FFMAX(0, VAR_9);", "VAR_6 = find_new_headers(fpc, VAR_9);", "if (VAR_6 < 0) {", "av_log(VAR_1, AV_LOG_ERROR,\n\"find_new_headers couldn't allocate FLAC header\\n\");", "goto handle_error;", "}", "fpc->nb_headers_buffered = VAR_6;", "if (!fpc->end_padded && fpc->nb_headers_buffered < FLAC_MIN_HEADERS) {", "if (VAR_4 && VAR_7 < VAR_4 + VAR_5) {", "VAR_8 = VAR_7;", "continue;", "} else {", "goto handle_error;", "}", "}", "if (fpc->end_padded || fpc->nb_headers_found)\nscore_sequences(fpc);", "if (fpc->end_padded) {", "int VAR_11 = fpc->fifo_buf->wptr - fpc->fifo_buf->buffer < MAX_FRAME_HEADER_SIZE;", "fpc->fifo_buf->wptr -= MAX_FRAME_HEADER_SIZE;", "fpc->fifo_buf->wndx -= MAX_FRAME_HEADER_SIZE;", "if (VAR_11) {", "fpc->fifo_buf->wptr += fpc->fifo_buf->end -\nfpc->fifo_buf->buffer;", "}", "VAR_5 = 0;", "VAR_8 = VAR_7 = NULL;", "}", "}", "for (curr = fpc->headers; curr; curr = curr->next) {", "if (curr->max_score > 0 &&\n(!fpc->best_header || curr->max_score > fpc->best_header->max_score)) {", "fpc->best_header = curr;", "}", "}", "if (fpc->best_header) {", "fpc->best_header_valid = 1;", "if (fpc->best_header->offset > 0) {", "av_log(VAR_1, AV_LOG_DEBUG, \"Junk frame till offset %i\\n\",\nfpc->best_header->offset);", "VAR_0->duration = 0;", "*VAR_3 = fpc->best_header->offset;", "*VAR_2 = flac_fifo_read_wrap(fpc, 0, *VAR_3,\n&fpc->wrap_buf,\n&fpc->wrap_buf_allocated_size);", "return VAR_5 ? (VAR_7 - VAR_4) : (fpc->best_header->offset -\nav_fifo_size(fpc->fifo_buf));", "}", "if (!VAR_5)\nreturn get_best_header(fpc, VAR_2, VAR_3);", "}", "handle_error:\n*VAR_2 = NULL;", "*VAR_3 = 0;", "return VAR_5 ? VAR_7 - VAR_4 : 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 55 ], [ 57, 59 ], [ 65 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79, 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 94 ], [ 98 ], [ 104 ], [ 106 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 142 ], [ 144 ], [ 146 ], [ 148 ], [ 151 ], [ 165, 167, 169 ], [ 171 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 191 ], [ 193, 195 ], [ 197 ], [ 201, 203, 205 ], [ 213 ], [ 215 ], [ 221, 223 ], [ 225, 227, 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 255, 257 ], [ 259 ], [ 261 ], [ 265 ], [ 267, 269 ], [ 271 ], [ 273 ], [ 277 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 301, 303 ], [ 309 ], [ 311 ], [ 315 ], [ 317 ], [ 319 ], [ 321, 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 337 ], [ 339, 341 ], [ 343 ], [ 345 ], [ 347 ], [ 351 ], [ 353 ], [ 355 ], [ 359, 361 ], [ 367 ], [ 369 ], [ 371, 373, 375 ], [ 377, 379 ], [ 381 ], [ 383, 385 ], [ 387 ], [ 391, 393 ], [ 395 ], [ 397 ], [ 399 ] ]
152
int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, const void *symbols, int symbols_wrap, int symbols_size, int flags) { VLCcode *buf; int i, j, ret; vlc->bits = nb_bits; if(flags & INIT_VLC_USE_NEW_STATIC){ VLC dyn_vlc = *vlc; if (vlc->table_size) return 0; ret = ff_init_vlc_sparse(&dyn_vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, symbols, symbols_wrap, symbols_size, flags & ~INIT_VLC_USE_NEW_STATIC); av_assert0(ret >= 0); av_assert0(dyn_vlc.table_size <= vlc->table_allocated); if(dyn_vlc.table_size < vlc->table_allocated) av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", dyn_vlc.table_size, vlc->table_allocated); memcpy(vlc->table, dyn_vlc.table, dyn_vlc.table_size * sizeof(*vlc->table)); vlc->table_size = dyn_vlc.table_size; ff_free_vlc(&dyn_vlc); return 0; }else { vlc->table = NULL; vlc->table_allocated = 0; vlc->table_size = 0; } av_dlog(NULL, "build table nb_codes=%d\n", nb_codes); buf = av_malloc((nb_codes+1)*sizeof(VLCcode)); av_assert0(symbols_size <= 2 || !symbols); j = 0; #define COPY(condition)\ for (i = 0; i < nb_codes; i++) {\ GET_DATA(buf[j].bits, bits, i, bits_wrap, bits_size);\ if (!(condition))\ continue;\ if (buf[j].bits > 3*nb_bits || buf[j].bits>32) {\ av_log(NULL, AV_LOG_ERROR, "Too long VLC in init_vlc\n");\ return -1;\ }\ GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size);\ if (buf[j].code >= (1LL<<buf[j].bits)) {\ av_log(NULL, AV_LOG_ERROR, "Invalid code in init_vlc\n");\ return -1;\ }\ if (flags & INIT_VLC_LE)\ buf[j].code = bitswap_32(buf[j].code);\ else\ buf[j].code <<= 32 - buf[j].bits;\ if (symbols)\ GET_DATA(buf[j].symbol, symbols, i, symbols_wrap, symbols_size)\ else\ buf[j].symbol = i;\ j++;\ } COPY(buf[j].bits > nb_bits); // qsort is the slowest part of init_vlc, and could probably be improved or avoided qsort(buf, j, sizeof(VLCcode), compare_vlcspec); COPY(buf[j].bits && buf[j].bits <= nb_bits); nb_codes = j; ret = build_table(vlc, nb_bits, nb_codes, buf, flags); av_free(buf); if (ret < 0) { av_freep(&vlc->table); return -1; } return 0; }
true
FFmpeg
83330cf5fae65423c24c5a0fb3705675236d88ed
int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, const void *symbols, int symbols_wrap, int symbols_size, int flags) { VLCcode *buf; int i, j, ret; vlc->bits = nb_bits; if(flags & INIT_VLC_USE_NEW_STATIC){ VLC dyn_vlc = *vlc; if (vlc->table_size) return 0; ret = ff_init_vlc_sparse(&dyn_vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, symbols, symbols_wrap, symbols_size, flags & ~INIT_VLC_USE_NEW_STATIC); av_assert0(ret >= 0); av_assert0(dyn_vlc.table_size <= vlc->table_allocated); if(dyn_vlc.table_size < vlc->table_allocated) av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", dyn_vlc.table_size, vlc->table_allocated); memcpy(vlc->table, dyn_vlc.table, dyn_vlc.table_size * sizeof(*vlc->table)); vlc->table_size = dyn_vlc.table_size; ff_free_vlc(&dyn_vlc); return 0; }else { vlc->table = NULL; vlc->table_allocated = 0; vlc->table_size = 0; } av_dlog(NULL, "build table nb_codes=%d\n", nb_codes); buf = av_malloc((nb_codes+1)*sizeof(VLCcode)); av_assert0(symbols_size <= 2 || !symbols); j = 0; #define COPY(condition)\ for (i = 0; i < nb_codes; i++) {\ GET_DATA(buf[j].bits, bits, i, bits_wrap, bits_size);\ if (!(condition))\ continue;\ if (buf[j].bits > 3*nb_bits || buf[j].bits>32) {\ av_log(NULL, AV_LOG_ERROR, "Too long VLC in init_vlc\n");\ return -1;\ }\ GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size);\ if (buf[j].code >= (1LL<<buf[j].bits)) {\ av_log(NULL, AV_LOG_ERROR, "Invalid code in init_vlc\n");\ return -1;\ }\ if (flags & INIT_VLC_LE)\ buf[j].code = bitswap_32(buf[j].code);\ else\ buf[j].code <<= 32 - buf[j].bits;\ if (symbols)\ GET_DATA(buf[j].symbol, symbols, i, symbols_wrap, symbols_size)\ else\ buf[j].symbol = i;\ j++;\ } COPY(buf[j].bits > nb_bits); qsort(buf, j, sizeof(VLCcode), compare_vlcspec); COPY(buf[j].bits && buf[j].bits <= nb_bits); nb_codes = j; ret = build_table(vlc, nb_bits, nb_codes, buf, flags); av_free(buf); if (ret < 0) { av_freep(&vlc->table); return -1; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(VLC *VAR_0, int VAR_1, int VAR_2, const void *VAR_3, int VAR_4, int VAR_5, const void *VAR_6, int VAR_7, int VAR_8, const void *VAR_9, int VAR_10, int VAR_11, int VAR_12) { VLCcode *buf; int VAR_13, VAR_14, VAR_15; VAR_0->VAR_3 = VAR_1; if(VAR_12 & INIT_VLC_USE_NEW_STATIC){ VLC dyn_vlc = *VAR_0; if (VAR_0->table_size) return 0; VAR_15 = FUNC_0(&dyn_vlc, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12 & ~INIT_VLC_USE_NEW_STATIC); av_assert0(VAR_15 >= 0); av_assert0(dyn_vlc.table_size <= VAR_0->table_allocated); if(dyn_vlc.table_size < VAR_0->table_allocated) av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", dyn_vlc.table_size, VAR_0->table_allocated); memcpy(VAR_0->table, dyn_vlc.table, dyn_vlc.table_size * sizeof(*VAR_0->table)); VAR_0->table_size = dyn_vlc.table_size; ff_free_vlc(&dyn_vlc); return 0; }else { VAR_0->table = NULL; VAR_0->table_allocated = 0; VAR_0->table_size = 0; } av_dlog(NULL, "build table VAR_2=%d\n", VAR_2); buf = av_malloc((VAR_2+1)*sizeof(VLCcode)); av_assert0(VAR_11 <= 2 || !VAR_9); VAR_14 = 0; #define COPY(condition)\ for (VAR_13 = 0; VAR_13 < VAR_2; VAR_13++) {\ GET_DATA(buf[VAR_14].VAR_3, VAR_3, VAR_13, VAR_4, VAR_5);\ if (!(condition))\ continue;\ if (buf[VAR_14].VAR_3 > 3*VAR_1 || buf[VAR_14].VAR_3>32) {\ av_log(NULL, AV_LOG_ERROR, "Too long VLC in init_vlc\n");\ return -1;\ }\ GET_DATA(buf[VAR_14].code, VAR_6, VAR_13, VAR_7, VAR_8);\ if (buf[VAR_14].code >= (1LL<<buf[VAR_14].VAR_3)) {\ av_log(NULL, AV_LOG_ERROR, "Invalid code in init_vlc\n");\ return -1;\ }\ if (VAR_12 & INIT_VLC_LE)\ buf[VAR_14].code = bitswap_32(buf[VAR_14].code);\ else\ buf[VAR_14].code <<= 32 - buf[VAR_14].VAR_3;\ if (VAR_9)\ GET_DATA(buf[VAR_14].symbol, VAR_9, VAR_13, VAR_10, VAR_11)\ else\ buf[VAR_14].symbol = VAR_13;\ VAR_14++;\ } COPY(buf[VAR_14].VAR_3 > VAR_1); qsort(buf, VAR_14, sizeof(VLCcode), compare_vlcspec); COPY(buf[VAR_14].VAR_3 && buf[VAR_14].VAR_3 <= VAR_1); VAR_2 = VAR_14; VAR_15 = build_table(VAR_0, VAR_1, VAR_2, buf, VAR_12); av_free(buf); if (VAR_15 < 0) { av_freep(&VAR_0->table); return -1; } return 0; }
[ "int FUNC_0(VLC *VAR_0, int VAR_1, int VAR_2,\nconst void *VAR_3, int VAR_4, int VAR_5,\nconst void *VAR_6, int VAR_7, int VAR_8,\nconst void *VAR_9, int VAR_10, int VAR_11,\nint VAR_12)\n{", "VLCcode *buf;", "int VAR_13, VAR_14, VAR_15;", "VAR_0->VAR_3 = VAR_1;", "if(VAR_12 & INIT_VLC_USE_NEW_STATIC){", "VLC dyn_vlc = *VAR_0;", "if (VAR_0->table_size)\nreturn 0;", "VAR_15 = FUNC_0(&dyn_vlc, VAR_1, VAR_2,\nVAR_3, VAR_4, VAR_5,\nVAR_6, VAR_7, VAR_8,\nVAR_9, VAR_10, VAR_11,\nVAR_12 & ~INIT_VLC_USE_NEW_STATIC);", "av_assert0(VAR_15 >= 0);", "av_assert0(dyn_vlc.table_size <= VAR_0->table_allocated);", "if(dyn_vlc.table_size < VAR_0->table_allocated)\nav_log(NULL, AV_LOG_ERROR, \"needed %d had %d\\n\", dyn_vlc.table_size, VAR_0->table_allocated);", "memcpy(VAR_0->table, dyn_vlc.table, dyn_vlc.table_size * sizeof(*VAR_0->table));", "VAR_0->table_size = dyn_vlc.table_size;", "ff_free_vlc(&dyn_vlc);", "return 0;", "}else {", "VAR_0->table = NULL;", "VAR_0->table_allocated = 0;", "VAR_0->table_size = 0;", "}", "av_dlog(NULL, \"build table VAR_2=%d\\n\", VAR_2);", "buf = av_malloc((VAR_2+1)*sizeof(VLCcode));", "av_assert0(VAR_11 <= 2 || !VAR_9);", "VAR_14 = 0;", "#define COPY(condition)\\\nfor (VAR_13 = 0; VAR_13 < VAR_2; VAR_13++) {\\", "GET_DATA(buf[VAR_14].VAR_3, VAR_3, VAR_13, VAR_4, VAR_5);\\", "if (!(condition))\\\ncontinue;\\", "if (buf[VAR_14].VAR_3 > 3*VAR_1 || buf[VAR_14].VAR_3>32) {\\", "av_log(NULL, AV_LOG_ERROR, \"Too long VLC in init_vlc\\n\");\\", "return -1;\\", "}\\", "GET_DATA(buf[VAR_14].code, VAR_6, VAR_13, VAR_7, VAR_8);\\", "if (buf[VAR_14].code >= (1LL<<buf[VAR_14].VAR_3)) {\\", "av_log(NULL, AV_LOG_ERROR, \"Invalid code in init_vlc\\n\");\\", "return -1;\\", "}\\", "if (VAR_12 & INIT_VLC_LE)\\\nbuf[VAR_14].code = bitswap_32(buf[VAR_14].code);\\", "else\\\nbuf[VAR_14].code <<= 32 - buf[VAR_14].VAR_3;\\", "if (VAR_9)\\\nGET_DATA(buf[VAR_14].symbol, VAR_9, VAR_13, VAR_10, VAR_11)\\\nelse\\\nbuf[VAR_14].symbol = VAR_13;\\", "VAR_14++;\\", "}", "COPY(buf[VAR_14].VAR_3 > VAR_1);", "qsort(buf, VAR_14, sizeof(VLCcode), compare_vlcspec);", "COPY(buf[VAR_14].VAR_3 && buf[VAR_14].VAR_3 <= VAR_1);", "VAR_2 = VAR_14;", "VAR_15 = build_table(VAR_0, VAR_1, VAR_2, buf, VAR_12);", "av_free(buf);", "if (VAR_15 < 0) {", "av_freep(&VAR_0->table);", "return -1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 33, 35, 37, 39, 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 75 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 98 ], [ 100 ], [ 102 ], [ 104 ], [ 106 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117, 119 ], [ 121, 123, 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ] ]
153
static void idr(H264Context *h){ int i; ff_h264_remove_all_refs(h); h->prev_frame_num= 0; h->prev_frame_num_offset= 0; h->prev_poc_msb= h->prev_poc_lsb= 0; for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++) h->last_pocs[i] = INT_MIN; }
true
FFmpeg
babf4fe01a808327d53977ba319c113a930180b1
static void idr(H264Context *h){ int i; ff_h264_remove_all_refs(h); h->prev_frame_num= 0; h->prev_frame_num_offset= 0; h->prev_poc_msb= h->prev_poc_lsb= 0; for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++) h->last_pocs[i] = INT_MIN; }
{ "code": [ " h->prev_frame_num= 0;" ], "line_no": [ 7 ] }
static void FUNC_0(H264Context *VAR_0){ int VAR_1; ff_h264_remove_all_refs(VAR_0); VAR_0->prev_frame_num= 0; VAR_0->prev_frame_num_offset= 0; VAR_0->prev_poc_msb= VAR_0->prev_poc_lsb= 0; for (VAR_1 = 0; VAR_1 < MAX_DELAYED_PIC_COUNT; VAR_1++) VAR_0->last_pocs[VAR_1] = INT_MIN; }
[ "static void FUNC_0(H264Context *VAR_0){", "int VAR_1;", "ff_h264_remove_all_refs(VAR_0);", "VAR_0->prev_frame_num= 0;", "VAR_0->prev_frame_num_offset= 0;", "VAR_0->prev_poc_msb=\nVAR_0->prev_poc_lsb= 0;", "for (VAR_1 = 0; VAR_1 < MAX_DELAYED_PIC_COUNT; VAR_1++)", "VAR_0->last_pocs[VAR_1] = INT_MIN;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ] ]
154
static void cg3_initfn(Object *obj) { SysBusDevice *sbd = SYS_BUS_DEVICE(obj); CG3State *s = CG3(obj); memory_region_init_ram(&s->rom, NULL, "cg3.prom", FCODE_MAX_ROM_SIZE, &error_abort); memory_region_set_readonly(&s->rom, true); sysbus_init_mmio(sbd, &s->rom); memory_region_init_io(&s->reg, NULL, &cg3_reg_ops, s, "cg3.reg", CG3_REG_SIZE); sysbus_init_mmio(sbd, &s->reg); }
true
qemu
f8ed85ac992c48814d916d5df4d44f9a971c5de4
static void cg3_initfn(Object *obj) { SysBusDevice *sbd = SYS_BUS_DEVICE(obj); CG3State *s = CG3(obj); memory_region_init_ram(&s->rom, NULL, "cg3.prom", FCODE_MAX_ROM_SIZE, &error_abort); memory_region_set_readonly(&s->rom, true); sysbus_init_mmio(sbd, &s->rom); memory_region_init_io(&s->reg, NULL, &cg3_reg_ops, s, "cg3.reg", CG3_REG_SIZE); sysbus_init_mmio(sbd, &s->reg); }
{ "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": [ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13 ] }
static void FUNC_0(Object *VAR_0) { SysBusDevice *sbd = SYS_BUS_DEVICE(VAR_0); CG3State *s = CG3(VAR_0); memory_region_init_ram(&s->rom, NULL, "cg3.prom", FCODE_MAX_ROM_SIZE, &error_abort); memory_region_set_readonly(&s->rom, true); sysbus_init_mmio(sbd, &s->rom); memory_region_init_io(&s->reg, NULL, &cg3_reg_ops, s, "cg3.reg", CG3_REG_SIZE); sysbus_init_mmio(sbd, &s->reg); }
[ "static void FUNC_0(Object *VAR_0)\n{", "SysBusDevice *sbd = SYS_BUS_DEVICE(VAR_0);", "CG3State *s = CG3(VAR_0);", "memory_region_init_ram(&s->rom, NULL, \"cg3.prom\", FCODE_MAX_ROM_SIZE,\n&error_abort);", "memory_region_set_readonly(&s->rom, true);", "sysbus_init_mmio(sbd, &s->rom);", "memory_region_init_io(&s->reg, NULL, &cg3_reg_ops, s, \"cg3.reg\",\nCG3_REG_SIZE);", "sysbus_init_mmio(sbd, &s->reg);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 27 ] ]
156
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes) { int id, sr, ch, ba, tag, bps; id = avctx->codec_id; sr = avctx->sample_rate; ch = avctx->channels; ba = avctx->block_align; tag = avctx->codec_tag; bps = av_get_exact_bits_per_sample(avctx->codec_id); /* codecs with an exact constant bits per sample */ if (bps > 0 && ch > 0 && frame_bytes > 0) return (frame_bytes * 8) / (bps * ch); bps = avctx->bits_per_coded_sample; /* codecs with a fixed packet duration */ switch (id) { case CODEC_ID_ADPCM_ADX: return 32; case CODEC_ID_ADPCM_IMA_QT: return 64; case CODEC_ID_ADPCM_EA_XAS: return 128; case CODEC_ID_AMR_NB: case CODEC_ID_GSM: case CODEC_ID_QCELP: case CODEC_ID_RA_144: case CODEC_ID_RA_288: return 160; case CODEC_ID_IMC: return 256; case CODEC_ID_AMR_WB: case CODEC_ID_GSM_MS: return 320; case CODEC_ID_MP1: return 384; case CODEC_ID_ATRAC1: return 512; case CODEC_ID_ATRAC3: return 1024; case CODEC_ID_MP2: case CODEC_ID_MUSEPACK7: return 1152; case CODEC_ID_AC3: return 1536; } if (sr > 0) { /* calc from sample rate */ if (id == CODEC_ID_TTA) return 256 * sr / 245; if (ch > 0) { /* calc from sample rate and channels */ if (id == CODEC_ID_BINKAUDIO_DCT) return (480 << (sr / 22050)) / ch; } } if (ba > 0) { /* calc from block_align */ if (id == CODEC_ID_SIPR) { switch (ba) { case 20: return 160; case 19: return 144; case 29: return 288; case 37: return 480; } } } if (frame_bytes > 0) { /* calc from frame_bytes only */ if (id == CODEC_ID_TRUESPEECH) return 240 * (frame_bytes / 32); if (id == CODEC_ID_NELLYMOSER) return 256 * (frame_bytes / 64); if (bps > 0) { /* calc from frame_bytes and bits_per_coded_sample */ if (id == CODEC_ID_ADPCM_G726) return frame_bytes * 8 / bps; } if (ch > 0) { /* calc from frame_bytes and channels */ switch (id) { case CODEC_ID_ADPCM_4XM: case CODEC_ID_ADPCM_IMA_ISS: return (frame_bytes - 4 * ch) * 2 / ch; case CODEC_ID_ADPCM_IMA_SMJPEG: return (frame_bytes - 4) * 2 / ch; case CODEC_ID_ADPCM_IMA_AMV: return (frame_bytes - 8) * 2 / ch; case CODEC_ID_ADPCM_XA: return (frame_bytes / 128) * 224 / ch; case CODEC_ID_INTERPLAY_DPCM: return (frame_bytes - 6 - ch) / ch; case CODEC_ID_ROQ_DPCM: return (frame_bytes - 8) / ch; case CODEC_ID_XAN_DPCM: return (frame_bytes - 2 * ch) / ch; case CODEC_ID_MACE3: return 3 * frame_bytes / ch; case CODEC_ID_MACE6: return 6 * frame_bytes / ch; case CODEC_ID_PCM_LXF: return 2 * (frame_bytes / (5 * ch)); } if (tag) { /* calc from frame_bytes, channels, and codec_tag */ if (id == CODEC_ID_SOL_DPCM) { if (tag == 3) return frame_bytes / ch; else return frame_bytes * 2 / ch; } } if (ba > 0) { /* calc from frame_bytes, channels, and block_align */ int blocks = frame_bytes / ba; switch (avctx->codec_id) { case CODEC_ID_ADPCM_IMA_WAV: return blocks * (1 + (ba - 4 * ch) / (4 * ch) * 8); case CODEC_ID_ADPCM_IMA_DK3: return blocks * (((ba - 16) * 2 / 3 * 4) / ch); case CODEC_ID_ADPCM_IMA_DK4: return blocks * (1 + (ba - 4 * ch) * 2 / ch); case CODEC_ID_ADPCM_MS: return blocks * (2 + (ba - 7 * ch) * 2 / ch); } } if (bps > 0) { /* calc from frame_bytes, channels, and bits_per_coded_sample */ switch (avctx->codec_id) { case CODEC_ID_PCM_DVD: return 2 * (frame_bytes / ((bps * 2 / 8) * ch)); case CODEC_ID_PCM_BLURAY: return frame_bytes / ((FFALIGN(ch, 2) * bps) / 8); case CODEC_ID_S302M: return 2 * (frame_bytes / ((bps + 4) / 4)) / ch; } } } } return 0; }
true
FFmpeg
8ea5df4fac57acf8a6e8cf575502ccd3dd776f57
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes) { int id, sr, ch, ba, tag, bps; id = avctx->codec_id; sr = avctx->sample_rate; ch = avctx->channels; ba = avctx->block_align; tag = avctx->codec_tag; bps = av_get_exact_bits_per_sample(avctx->codec_id); if (bps > 0 && ch > 0 && frame_bytes > 0) return (frame_bytes * 8) / (bps * ch); bps = avctx->bits_per_coded_sample; switch (id) { case CODEC_ID_ADPCM_ADX: return 32; case CODEC_ID_ADPCM_IMA_QT: return 64; case CODEC_ID_ADPCM_EA_XAS: return 128; case CODEC_ID_AMR_NB: case CODEC_ID_GSM: case CODEC_ID_QCELP: case CODEC_ID_RA_144: case CODEC_ID_RA_288: return 160; case CODEC_ID_IMC: return 256; case CODEC_ID_AMR_WB: case CODEC_ID_GSM_MS: return 320; case CODEC_ID_MP1: return 384; case CODEC_ID_ATRAC1: return 512; case CODEC_ID_ATRAC3: return 1024; case CODEC_ID_MP2: case CODEC_ID_MUSEPACK7: return 1152; case CODEC_ID_AC3: return 1536; } if (sr > 0) { if (id == CODEC_ID_TTA) return 256 * sr / 245; if (ch > 0) { if (id == CODEC_ID_BINKAUDIO_DCT) return (480 << (sr / 22050)) / ch; } } if (ba > 0) { if (id == CODEC_ID_SIPR) { switch (ba) { case 20: return 160; case 19: return 144; case 29: return 288; case 37: return 480; } } } if (frame_bytes > 0) { if (id == CODEC_ID_TRUESPEECH) return 240 * (frame_bytes / 32); if (id == CODEC_ID_NELLYMOSER) return 256 * (frame_bytes / 64); if (bps > 0) { if (id == CODEC_ID_ADPCM_G726) return frame_bytes * 8 / bps; } if (ch > 0) { switch (id) { case CODEC_ID_ADPCM_4XM: case CODEC_ID_ADPCM_IMA_ISS: return (frame_bytes - 4 * ch) * 2 / ch; case CODEC_ID_ADPCM_IMA_SMJPEG: return (frame_bytes - 4) * 2 / ch; case CODEC_ID_ADPCM_IMA_AMV: return (frame_bytes - 8) * 2 / ch; case CODEC_ID_ADPCM_XA: return (frame_bytes / 128) * 224 / ch; case CODEC_ID_INTERPLAY_DPCM: return (frame_bytes - 6 - ch) / ch; case CODEC_ID_ROQ_DPCM: return (frame_bytes - 8) / ch; case CODEC_ID_XAN_DPCM: return (frame_bytes - 2 * ch) / ch; case CODEC_ID_MACE3: return 3 * frame_bytes / ch; case CODEC_ID_MACE6: return 6 * frame_bytes / ch; case CODEC_ID_PCM_LXF: return 2 * (frame_bytes / (5 * ch)); } if (tag) { if (id == CODEC_ID_SOL_DPCM) { if (tag == 3) return frame_bytes / ch; else return frame_bytes * 2 / ch; } } if (ba > 0) { int blocks = frame_bytes / ba; switch (avctx->codec_id) { case CODEC_ID_ADPCM_IMA_WAV: return blocks * (1 + (ba - 4 * ch) / (4 * ch) * 8); case CODEC_ID_ADPCM_IMA_DK3: return blocks * (((ba - 16) * 2 / 3 * 4) / ch); case CODEC_ID_ADPCM_IMA_DK4: return blocks * (1 + (ba - 4 * ch) * 2 / ch); case CODEC_ID_ADPCM_MS: return blocks * (2 + (ba - 7 * ch) * 2 / ch); } } if (bps > 0) { switch (avctx->codec_id) { case CODEC_ID_PCM_DVD: return 2 * (frame_bytes / ((bps * 2 / 8) * ch)); case CODEC_ID_PCM_BLURAY: return frame_bytes / ((FFALIGN(ch, 2) * bps) / 8); case CODEC_ID_S302M: return 2 * (frame_bytes / ((bps + 4) / 4)) / ch; } } } } return 0; }
{ "code": [ " if (bps > 0 && ch > 0 && frame_bytes > 0)", " return (frame_bytes * 8) / (bps * ch);" ], "line_no": [ 25, 27 ] }
int FUNC_0(AVCodecContext *VAR_0, int VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; VAR_2 = VAR_0->codec_id; VAR_3 = VAR_0->sample_rate; VAR_4 = VAR_0->channels; VAR_5 = VAR_0->block_align; VAR_6 = VAR_0->codec_tag; VAR_7 = av_get_exact_bits_per_sample(VAR_0->codec_id); if (VAR_7 > 0 && VAR_4 > 0 && VAR_1 > 0) return (VAR_1 * 8) / (VAR_7 * VAR_4); VAR_7 = VAR_0->bits_per_coded_sample; switch (VAR_2) { case CODEC_ID_ADPCM_ADX: return 32; case CODEC_ID_ADPCM_IMA_QT: return 64; case CODEC_ID_ADPCM_EA_XAS: return 128; case CODEC_ID_AMR_NB: case CODEC_ID_GSM: case CODEC_ID_QCELP: case CODEC_ID_RA_144: case CODEC_ID_RA_288: return 160; case CODEC_ID_IMC: return 256; case CODEC_ID_AMR_WB: case CODEC_ID_GSM_MS: return 320; case CODEC_ID_MP1: return 384; case CODEC_ID_ATRAC1: return 512; case CODEC_ID_ATRAC3: return 1024; case CODEC_ID_MP2: case CODEC_ID_MUSEPACK7: return 1152; case CODEC_ID_AC3: return 1536; } if (VAR_3 > 0) { if (VAR_2 == CODEC_ID_TTA) return 256 * VAR_3 / 245; if (VAR_4 > 0) { if (VAR_2 == CODEC_ID_BINKAUDIO_DCT) return (480 << (VAR_3 / 22050)) / VAR_4; } } if (VAR_5 > 0) { if (VAR_2 == CODEC_ID_SIPR) { switch (VAR_5) { case 20: return 160; case 19: return 144; case 29: return 288; case 37: return 480; } } } if (VAR_1 > 0) { if (VAR_2 == CODEC_ID_TRUESPEECH) return 240 * (VAR_1 / 32); if (VAR_2 == CODEC_ID_NELLYMOSER) return 256 * (VAR_1 / 64); if (VAR_7 > 0) { if (VAR_2 == CODEC_ID_ADPCM_G726) return VAR_1 * 8 / VAR_7; } if (VAR_4 > 0) { switch (VAR_2) { case CODEC_ID_ADPCM_4XM: case CODEC_ID_ADPCM_IMA_ISS: return (VAR_1 - 4 * VAR_4) * 2 / VAR_4; case CODEC_ID_ADPCM_IMA_SMJPEG: return (VAR_1 - 4) * 2 / VAR_4; case CODEC_ID_ADPCM_IMA_AMV: return (VAR_1 - 8) * 2 / VAR_4; case CODEC_ID_ADPCM_XA: return (VAR_1 / 128) * 224 / VAR_4; case CODEC_ID_INTERPLAY_DPCM: return (VAR_1 - 6 - VAR_4) / VAR_4; case CODEC_ID_ROQ_DPCM: return (VAR_1 - 8) / VAR_4; case CODEC_ID_XAN_DPCM: return (VAR_1 - 2 * VAR_4) / VAR_4; case CODEC_ID_MACE3: return 3 * VAR_1 / VAR_4; case CODEC_ID_MACE6: return 6 * VAR_1 / VAR_4; case CODEC_ID_PCM_LXF: return 2 * (VAR_1 / (5 * VAR_4)); } if (VAR_6) { if (VAR_2 == CODEC_ID_SOL_DPCM) { if (VAR_6 == 3) return VAR_1 / VAR_4; else return VAR_1 * 2 / VAR_4; } } if (VAR_5 > 0) { int VAR_8 = VAR_1 / VAR_5; switch (VAR_0->codec_id) { case CODEC_ID_ADPCM_IMA_WAV: return VAR_8 * (1 + (VAR_5 - 4 * VAR_4) / (4 * VAR_4) * 8); case CODEC_ID_ADPCM_IMA_DK3: return VAR_8 * (((VAR_5 - 16) * 2 / 3 * 4) / VAR_4); case CODEC_ID_ADPCM_IMA_DK4: return VAR_8 * (1 + (VAR_5 - 4 * VAR_4) * 2 / VAR_4); case CODEC_ID_ADPCM_MS: return VAR_8 * (2 + (VAR_5 - 7 * VAR_4) * 2 / VAR_4); } } if (VAR_7 > 0) { switch (VAR_0->codec_id) { case CODEC_ID_PCM_DVD: return 2 * (VAR_1 / ((VAR_7 * 2 / 8) * VAR_4)); case CODEC_ID_PCM_BLURAY: return VAR_1 / ((FFALIGN(VAR_4, 2) * VAR_7) / 8); case CODEC_ID_S302M: return 2 * (VAR_1 / ((VAR_7 + 4) / 4)) / VAR_4; } } } } return 0; }
[ "int FUNC_0(AVCodecContext *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;", "VAR_2 = VAR_0->codec_id;", "VAR_3 = VAR_0->sample_rate;", "VAR_4 = VAR_0->channels;", "VAR_5 = VAR_0->block_align;", "VAR_6 = VAR_0->codec_tag;", "VAR_7 = av_get_exact_bits_per_sample(VAR_0->codec_id);", "if (VAR_7 > 0 && VAR_4 > 0 && VAR_1 > 0)\nreturn (VAR_1 * 8) / (VAR_7 * VAR_4);", "VAR_7 = VAR_0->bits_per_coded_sample;", "switch (VAR_2) {", "case CODEC_ID_ADPCM_ADX: return 32;", "case CODEC_ID_ADPCM_IMA_QT: return 64;", "case CODEC_ID_ADPCM_EA_XAS: return 128;", "case CODEC_ID_AMR_NB:\ncase CODEC_ID_GSM:\ncase CODEC_ID_QCELP:\ncase CODEC_ID_RA_144:\ncase CODEC_ID_RA_288: return 160;", "case CODEC_ID_IMC: return 256;", "case CODEC_ID_AMR_WB:\ncase CODEC_ID_GSM_MS: return 320;", "case CODEC_ID_MP1: return 384;", "case CODEC_ID_ATRAC1: return 512;", "case CODEC_ID_ATRAC3: return 1024;", "case CODEC_ID_MP2:\ncase CODEC_ID_MUSEPACK7: return 1152;", "case CODEC_ID_AC3: return 1536;", "}", "if (VAR_3 > 0) {", "if (VAR_2 == CODEC_ID_TTA)\nreturn 256 * VAR_3 / 245;", "if (VAR_4 > 0) {", "if (VAR_2 == CODEC_ID_BINKAUDIO_DCT)\nreturn (480 << (VAR_3 / 22050)) / VAR_4;", "}", "}", "if (VAR_5 > 0) {", "if (VAR_2 == CODEC_ID_SIPR) {", "switch (VAR_5) {", "case 20: return 160;", "case 19: return 144;", "case 29: return 288;", "case 37: return 480;", "}", "}", "}", "if (VAR_1 > 0) {", "if (VAR_2 == CODEC_ID_TRUESPEECH)\nreturn 240 * (VAR_1 / 32);", "if (VAR_2 == CODEC_ID_NELLYMOSER)\nreturn 256 * (VAR_1 / 64);", "if (VAR_7 > 0) {", "if (VAR_2 == CODEC_ID_ADPCM_G726)\nreturn VAR_1 * 8 / VAR_7;", "}", "if (VAR_4 > 0) {", "switch (VAR_2) {", "case CODEC_ID_ADPCM_4XM:\ncase CODEC_ID_ADPCM_IMA_ISS:\nreturn (VAR_1 - 4 * VAR_4) * 2 / VAR_4;", "case CODEC_ID_ADPCM_IMA_SMJPEG:\nreturn (VAR_1 - 4) * 2 / VAR_4;", "case CODEC_ID_ADPCM_IMA_AMV:\nreturn (VAR_1 - 8) * 2 / VAR_4;", "case CODEC_ID_ADPCM_XA:\nreturn (VAR_1 / 128) * 224 / VAR_4;", "case CODEC_ID_INTERPLAY_DPCM:\nreturn (VAR_1 - 6 - VAR_4) / VAR_4;", "case CODEC_ID_ROQ_DPCM:\nreturn (VAR_1 - 8) / VAR_4;", "case CODEC_ID_XAN_DPCM:\nreturn (VAR_1 - 2 * VAR_4) / VAR_4;", "case CODEC_ID_MACE3:\nreturn 3 * VAR_1 / VAR_4;", "case CODEC_ID_MACE6:\nreturn 6 * VAR_1 / VAR_4;", "case CODEC_ID_PCM_LXF:\nreturn 2 * (VAR_1 / (5 * VAR_4));", "}", "if (VAR_6) {", "if (VAR_2 == CODEC_ID_SOL_DPCM) {", "if (VAR_6 == 3)\nreturn VAR_1 / VAR_4;", "else\nreturn VAR_1 * 2 / VAR_4;", "}", "}", "if (VAR_5 > 0) {", "int VAR_8 = VAR_1 / VAR_5;", "switch (VAR_0->codec_id) {", "case CODEC_ID_ADPCM_IMA_WAV:\nreturn VAR_8 * (1 + (VAR_5 - 4 * VAR_4) / (4 * VAR_4) * 8);", "case CODEC_ID_ADPCM_IMA_DK3:\nreturn VAR_8 * (((VAR_5 - 16) * 2 / 3 * 4) / VAR_4);", "case CODEC_ID_ADPCM_IMA_DK4:\nreturn VAR_8 * (1 + (VAR_5 - 4 * VAR_4) * 2 / VAR_4);", "case CODEC_ID_ADPCM_MS:\nreturn VAR_8 * (2 + (VAR_5 - 7 * VAR_4) * 2 / VAR_4);", "}", "}", "if (VAR_7 > 0) {", "switch (VAR_0->codec_id) {", "case CODEC_ID_PCM_DVD:\nreturn 2 * (VAR_1 / ((VAR_7 * 2 / 8) * VAR_4));", "case CODEC_ID_PCM_BLURAY:\nreturn VAR_1 / ((FFALIGN(VAR_4, 2) * VAR_7) / 8);", "case CODEC_ID_S302M:\nreturn 2 * (VAR_1 / ((VAR_7 + 4) / 4)) / VAR_4;", "}", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 25, 27 ], [ 29 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45, 47, 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 75 ], [ 79, 81 ], [ 85 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 127, 129 ], [ 131, 133 ], [ 137 ], [ 141, 143 ], [ 145 ], [ 149 ], [ 153 ], [ 155, 157, 159 ], [ 161, 163 ], [ 165, 167 ], [ 169, 171 ], [ 173, 175 ], [ 177, 179 ], [ 181, 183 ], [ 185, 187 ], [ 189, 191 ], [ 193, 195 ], [ 197 ], [ 201 ], [ 205 ], [ 207, 209 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 221 ], [ 225 ], [ 227 ], [ 229, 231 ], [ 233, 235 ], [ 237, 239 ], [ 241, 243 ], [ 245 ], [ 247 ], [ 251 ], [ 255 ], [ 257, 259 ], [ 261, 263 ], [ 265, 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 279 ], [ 281 ] ]
157
static void parse_context_init(SchroParseUnitContext *parse_ctx, const uint8_t *buf, int buf_size) { parse_ctx->buf = buf; parse_ctx->buf_size = buf_size; }
true
FFmpeg
220b24c7c97dc033ceab1510549f66d0e7b52ef1
static void parse_context_init(SchroParseUnitContext *parse_ctx, const uint8_t *buf, int buf_size) { parse_ctx->buf = buf; parse_ctx->buf_size = buf_size; }
{ "code": [ "static void parse_context_init(SchroParseUnitContext *parse_ctx,", " const uint8_t *buf, int buf_size)", " parse_ctx->buf = buf;", " parse_ctx->buf_size = buf_size;" ], "line_no": [ 1, 3, 7, 9 ] }
static void FUNC_0(SchroParseUnitContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { VAR_0->VAR_1 = VAR_1; VAR_0->VAR_2 = VAR_2; }
[ "static void FUNC_0(SchroParseUnitContext *VAR_0,\nconst uint8_t *VAR_1, int VAR_2)\n{", "VAR_0->VAR_1 = VAR_1;", "VAR_0->VAR_2 = VAR_2;", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
158
static int update_size(AVCodecContext *ctx, int w, int h) { VP9Context *s = ctx->priv_data; uint8_t *p; if (s->above_partition_ctx && w == ctx->width && h == ctx->height) return 0; ctx->width = w; ctx->height = h; s->sb_cols = (w + 63) >> 6; s->sb_rows = (h + 63) >> 6; s->cols = (w + 7) >> 3; s->rows = (h + 7) >> 3; #define assign(var, type, n) var = (type) p; p += s->sb_cols * n * sizeof(*var) av_free(s->above_partition_ctx); p = av_malloc(s->sb_cols * (240 + sizeof(*s->lflvl) + 16 * sizeof(*s->above_mv_ctx) + 64 * s->sb_rows * (1 + sizeof(*s->mv[0]) * 2))); if (!p) return AVERROR(ENOMEM); assign(s->above_partition_ctx, uint8_t *, 8); assign(s->above_skip_ctx, uint8_t *, 8); assign(s->above_txfm_ctx, uint8_t *, 8); assign(s->above_mode_ctx, uint8_t *, 16); assign(s->above_y_nnz_ctx, uint8_t *, 16); assign(s->above_uv_nnz_ctx[0], uint8_t *, 8); assign(s->above_uv_nnz_ctx[1], uint8_t *, 8); assign(s->intra_pred_data[0], uint8_t *, 64); assign(s->intra_pred_data[1], uint8_t *, 32); assign(s->intra_pred_data[2], uint8_t *, 32); assign(s->above_segpred_ctx, uint8_t *, 8); assign(s->above_intra_ctx, uint8_t *, 8); assign(s->above_comp_ctx, uint8_t *, 8); assign(s->above_ref_ctx, uint8_t *, 8); assign(s->above_filter_ctx, uint8_t *, 8); assign(s->lflvl, struct VP9Filter *, 1); assign(s->above_mv_ctx, VP56mv(*)[2], 16); assign(s->segmentation_map, uint8_t *, 64 * s->sb_rows); assign(s->mv[0], struct VP9mvrefPair *, 64 * s->sb_rows); assign(s->mv[1], struct VP9mvrefPair *, 64 * s->sb_rows); #undef assign return 0; }
true
FFmpeg
e1c7892013d2832df85dfef6368bd64e82547418
static int update_size(AVCodecContext *ctx, int w, int h) { VP9Context *s = ctx->priv_data; uint8_t *p; if (s->above_partition_ctx && w == ctx->width && h == ctx->height) return 0; ctx->width = w; ctx->height = h; s->sb_cols = (w + 63) >> 6; s->sb_rows = (h + 63) >> 6; s->cols = (w + 7) >> 3; s->rows = (h + 7) >> 3; #define assign(var, type, n) var = (type) p; p += s->sb_cols * n * sizeof(*var) av_free(s->above_partition_ctx); p = av_malloc(s->sb_cols * (240 + sizeof(*s->lflvl) + 16 * sizeof(*s->above_mv_ctx) + 64 * s->sb_rows * (1 + sizeof(*s->mv[0]) * 2))); if (!p) return AVERROR(ENOMEM); assign(s->above_partition_ctx, uint8_t *, 8); assign(s->above_skip_ctx, uint8_t *, 8); assign(s->above_txfm_ctx, uint8_t *, 8); assign(s->above_mode_ctx, uint8_t *, 16); assign(s->above_y_nnz_ctx, uint8_t *, 16); assign(s->above_uv_nnz_ctx[0], uint8_t *, 8); assign(s->above_uv_nnz_ctx[1], uint8_t *, 8); assign(s->intra_pred_data[0], uint8_t *, 64); assign(s->intra_pred_data[1], uint8_t *, 32); assign(s->intra_pred_data[2], uint8_t *, 32); assign(s->above_segpred_ctx, uint8_t *, 8); assign(s->above_intra_ctx, uint8_t *, 8); assign(s->above_comp_ctx, uint8_t *, 8); assign(s->above_ref_ctx, uint8_t *, 8); assign(s->above_filter_ctx, uint8_t *, 8); assign(s->lflvl, struct VP9Filter *, 1); assign(s->above_mv_ctx, VP56mv(*)[2], 16); assign(s->segmentation_map, uint8_t *, 64 * s->sb_rows); assign(s->mv[0], struct VP9mvrefPair *, 64 * s->sb_rows); assign(s->mv[1], struct VP9mvrefPair *, 64 * s->sb_rows); #undef assign return 0; }
{ "code": [ " av_free(s->above_partition_ctx);" ], "line_no": [ 33 ] }
static int FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2) { VP9Context *s = VAR_0->priv_data; uint8_t *p; if (s->above_partition_ctx && VAR_1 == VAR_0->width && VAR_2 == VAR_0->height) return 0; VAR_0->width = VAR_1; VAR_0->height = VAR_2; s->sb_cols = (VAR_1 + 63) >> 6; s->sb_rows = (VAR_2 + 63) >> 6; s->cols = (VAR_1 + 7) >> 3; s->rows = (VAR_2 + 7) >> 3; #define assign(var, type, n) var = (type) p; p += s->sb_cols * n * sizeof(*var) av_free(s->above_partition_ctx); p = av_malloc(s->sb_cols * (240 + sizeof(*s->lflvl) + 16 * sizeof(*s->above_mv_ctx) + 64 * s->sb_rows * (1 + sizeof(*s->mv[0]) * 2))); if (!p) return AVERROR(ENOMEM); assign(s->above_partition_ctx, uint8_t *, 8); assign(s->above_skip_ctx, uint8_t *, 8); assign(s->above_txfm_ctx, uint8_t *, 8); assign(s->above_mode_ctx, uint8_t *, 16); assign(s->above_y_nnz_ctx, uint8_t *, 16); assign(s->above_uv_nnz_ctx[0], uint8_t *, 8); assign(s->above_uv_nnz_ctx[1], uint8_t *, 8); assign(s->intra_pred_data[0], uint8_t *, 64); assign(s->intra_pred_data[1], uint8_t *, 32); assign(s->intra_pred_data[2], uint8_t *, 32); assign(s->above_segpred_ctx, uint8_t *, 8); assign(s->above_intra_ctx, uint8_t *, 8); assign(s->above_comp_ctx, uint8_t *, 8); assign(s->above_ref_ctx, uint8_t *, 8); assign(s->above_filter_ctx, uint8_t *, 8); assign(s->lflvl, struct VP9Filter *, 1); assign(s->above_mv_ctx, VP56mv(*)[2], 16); assign(s->segmentation_map, uint8_t *, 64 * s->sb_rows); assign(s->mv[0], struct VP9mvrefPair *, 64 * s->sb_rows); assign(s->mv[1], struct VP9mvrefPair *, 64 * s->sb_rows); #undef assign return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2)\n{", "VP9Context *s = VAR_0->priv_data;", "uint8_t *p;", "if (s->above_partition_ctx && VAR_1 == VAR_0->width && VAR_2 == VAR_0->height)\nreturn 0;", "VAR_0->width = VAR_1;", "VAR_0->height = VAR_2;", "s->sb_cols = (VAR_1 + 63) >> 6;", "s->sb_rows = (VAR_2 + 63) >> 6;", "s->cols = (VAR_1 + 7) >> 3;", "s->rows = (VAR_2 + 7) >> 3;", "#define assign(var, type, n) var = (type) p; p += s->sb_cols * n * sizeof(*var)", "av_free(s->above_partition_ctx);", "p = av_malloc(s->sb_cols * (240 + sizeof(*s->lflvl) + 16 * sizeof(*s->above_mv_ctx) +\n64 * s->sb_rows * (1 + sizeof(*s->mv[0]) * 2)));", "if (!p)\nreturn AVERROR(ENOMEM);", "assign(s->above_partition_ctx, uint8_t *, 8);", "assign(s->above_skip_ctx, uint8_t *, 8);", "assign(s->above_txfm_ctx, uint8_t *, 8);", "assign(s->above_mode_ctx, uint8_t *, 16);", "assign(s->above_y_nnz_ctx, uint8_t *, 16);", "assign(s->above_uv_nnz_ctx[0], uint8_t *, 8);", "assign(s->above_uv_nnz_ctx[1], uint8_t *, 8);", "assign(s->intra_pred_data[0], uint8_t *, 64);", "assign(s->intra_pred_data[1], uint8_t *, 32);", "assign(s->intra_pred_data[2], uint8_t *, 32);", "assign(s->above_segpred_ctx, uint8_t *, 8);", "assign(s->above_intra_ctx, uint8_t *, 8);", "assign(s->above_comp_ctx, uint8_t *, 8);", "assign(s->above_ref_ctx, uint8_t *, 8);", "assign(s->above_filter_ctx, uint8_t *, 8);", "assign(s->lflvl, struct VP9Filter *, 1);", "assign(s->above_mv_ctx, VP56mv(*)[2], 16);", "assign(s->segmentation_map, uint8_t *, 64 * s->sb_rows);", "assign(s->mv[0], struct VP9mvrefPair *, 64 * s->sb_rows);", "assign(s->mv[1], struct VP9mvrefPair *, 64 * s->sb_rows);", "#undef assign\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 87 ], [ 89 ] ]
159
static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) { SmackerContext *smk = s->priv_data; int flags; int ret; int i; int frame_size = 0; int palchange = 0; if (s->pb->eof_reached || smk->cur_frame >= smk->frames) return AVERROR_EOF; /* if we demuxed all streams, pass another frame */ if(smk->curstream < 0) { avio_seek(s->pb, smk->nextpos, 0); frame_size = smk->frm_size[smk->cur_frame] & (~3); flags = smk->frm_flags[smk->cur_frame]; /* handle palette change event */ if(flags & SMACKER_PAL){ int size, sz, t, off, j, pos; uint8_t *pal = smk->pal; uint8_t oldpal[768]; memcpy(oldpal, pal, 768); size = avio_r8(s->pb); size = size * 4 - 1; frame_size -= size; frame_size--; sz = 0; pos = avio_tell(s->pb) + size; while(sz < 256){ t = avio_r8(s->pb); if(t & 0x80){ /* skip palette entries */ sz += (t & 0x7F) + 1; pal += ((t & 0x7F) + 1) * 3; } else if(t & 0x40){ /* copy with offset */ off = avio_r8(s->pb); j = (t & 0x3F) + 1; if (off + j > 0x100) { av_log(s, AV_LOG_ERROR, "Invalid palette update, offset=%d length=%d extends beyond palette size\n", off, j); return AVERROR_INVALIDDATA; } off *= 3; while(j-- && sz < 256) { *pal++ = oldpal[off + 0]; *pal++ = oldpal[off + 1]; *pal++ = oldpal[off + 2]; sz++; off += 3; } } else { /* new entries */ *pal++ = smk_pal[t]; *pal++ = smk_pal[avio_r8(s->pb) & 0x3F]; *pal++ = smk_pal[avio_r8(s->pb) & 0x3F]; sz++; } } avio_seek(s->pb, pos, 0); palchange |= 1; } flags >>= 1; smk->curstream = -1; /* if audio chunks are present, put them to stack and retrieve later */ for(i = 0; i < 7; i++) { if(flags & 1) { uint32_t size; uint8_t *tmpbuf; size = avio_rl32(s->pb) - 4; if (!size || size > frame_size) { av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); return AVERROR_INVALIDDATA; } frame_size -= size; frame_size -= 4; smk->curstream++; tmpbuf = av_realloc(smk->bufs[smk->curstream], size); if (!tmpbuf) return AVERROR(ENOMEM); smk->bufs[smk->curstream] = tmpbuf; smk->buf_sizes[smk->curstream] = size; ret = avio_read(s->pb, smk->bufs[smk->curstream], size); if(ret != size) return AVERROR(EIO); smk->stream_id[smk->curstream] = smk->indexes[i]; } flags >>= 1; } if (frame_size < 0) return AVERROR_INVALIDDATA; if (av_new_packet(pkt, frame_size + 769)) return AVERROR(ENOMEM); if(smk->frm_size[smk->cur_frame] & 1) palchange |= 2; pkt->data[0] = palchange; memcpy(pkt->data + 1, smk->pal, 768); ret = avio_read(s->pb, pkt->data + 769, frame_size); if(ret != frame_size) return AVERROR(EIO); pkt->stream_index = smk->videoindex; pkt->pts = smk->cur_frame; pkt->size = ret + 769; smk->cur_frame++; smk->nextpos = avio_tell(s->pb); } else { if (smk->stream_id[smk->curstream] < 0) return AVERROR_INVALIDDATA; if (av_new_packet(pkt, smk->buf_sizes[smk->curstream])) return AVERROR(ENOMEM); memcpy(pkt->data, smk->bufs[smk->curstream], smk->buf_sizes[smk->curstream]); pkt->size = smk->buf_sizes[smk->curstream]; pkt->stream_index = smk->stream_id[smk->curstream]; pkt->pts = smk->aud_pts[smk->curstream]; smk->aud_pts[smk->curstream] += AV_RL32(pkt->data); smk->curstream--; } return 0; }
true
FFmpeg
710b0e27025948b7511821c2f888ff2d74a59e14
static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) { SmackerContext *smk = s->priv_data; int flags; int ret; int i; int frame_size = 0; int palchange = 0; if (s->pb->eof_reached || smk->cur_frame >= smk->frames) return AVERROR_EOF; if(smk->curstream < 0) { avio_seek(s->pb, smk->nextpos, 0); frame_size = smk->frm_size[smk->cur_frame] & (~3); flags = smk->frm_flags[smk->cur_frame]; if(flags & SMACKER_PAL){ int size, sz, t, off, j, pos; uint8_t *pal = smk->pal; uint8_t oldpal[768]; memcpy(oldpal, pal, 768); size = avio_r8(s->pb); size = size * 4 - 1; frame_size -= size; frame_size--; sz = 0; pos = avio_tell(s->pb) + size; while(sz < 256){ t = avio_r8(s->pb); if(t & 0x80){ sz += (t & 0x7F) + 1; pal += ((t & 0x7F) + 1) * 3; } else if(t & 0x40){ off = avio_r8(s->pb); j = (t & 0x3F) + 1; if (off + j > 0x100) { av_log(s, AV_LOG_ERROR, "Invalid palette update, offset=%d length=%d extends beyond palette size\n", off, j); return AVERROR_INVALIDDATA; } off *= 3; while(j-- && sz < 256) { *pal++ = oldpal[off + 0]; *pal++ = oldpal[off + 1]; *pal++ = oldpal[off + 2]; sz++; off += 3; } } else { *pal++ = smk_pal[t]; *pal++ = smk_pal[avio_r8(s->pb) & 0x3F]; *pal++ = smk_pal[avio_r8(s->pb) & 0x3F]; sz++; } } avio_seek(s->pb, pos, 0); palchange |= 1; } flags >>= 1; smk->curstream = -1; for(i = 0; i < 7; i++) { if(flags & 1) { uint32_t size; uint8_t *tmpbuf; size = avio_rl32(s->pb) - 4; if (!size || size > frame_size) { av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); return AVERROR_INVALIDDATA; } frame_size -= size; frame_size -= 4; smk->curstream++; tmpbuf = av_realloc(smk->bufs[smk->curstream], size); if (!tmpbuf) return AVERROR(ENOMEM); smk->bufs[smk->curstream] = tmpbuf; smk->buf_sizes[smk->curstream] = size; ret = avio_read(s->pb, smk->bufs[smk->curstream], size); if(ret != size) return AVERROR(EIO); smk->stream_id[smk->curstream] = smk->indexes[i]; } flags >>= 1; } if (frame_size < 0) return AVERROR_INVALIDDATA; if (av_new_packet(pkt, frame_size + 769)) return AVERROR(ENOMEM); if(smk->frm_size[smk->cur_frame] & 1) palchange |= 2; pkt->data[0] = palchange; memcpy(pkt->data + 1, smk->pal, 768); ret = avio_read(s->pb, pkt->data + 769, frame_size); if(ret != frame_size) return AVERROR(EIO); pkt->stream_index = smk->videoindex; pkt->pts = smk->cur_frame; pkt->size = ret + 769; smk->cur_frame++; smk->nextpos = avio_tell(s->pb); } else { if (smk->stream_id[smk->curstream] < 0) return AVERROR_INVALIDDATA; if (av_new_packet(pkt, smk->buf_sizes[smk->curstream])) return AVERROR(ENOMEM); memcpy(pkt->data, smk->bufs[smk->curstream], smk->buf_sizes[smk->curstream]); pkt->size = smk->buf_sizes[smk->curstream]; pkt->stream_index = smk->stream_id[smk->curstream]; pkt->pts = smk->aud_pts[smk->curstream]; smk->aud_pts[smk->curstream] += AV_RL32(pkt->data); smk->curstream--; } return 0; }
{ "code": [ " if (frame_size < 0)" ], "line_no": [ 181 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { SmackerContext *smk = VAR_0->priv_data; int VAR_2; int VAR_3; int VAR_4; int VAR_5 = 0; int VAR_6 = 0; if (VAR_0->pb->eof_reached || smk->cur_frame >= smk->frames) return AVERROR_EOF; if(smk->curstream < 0) { avio_seek(VAR_0->pb, smk->nextpos, 0); VAR_5 = smk->frm_size[smk->cur_frame] & (~3); VAR_2 = smk->frm_flags[smk->cur_frame]; if(VAR_2 & SMACKER_PAL){ int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12; uint8_t *pal = smk->pal; uint8_t oldpal[768]; memcpy(oldpal, pal, 768); VAR_7 = avio_r8(VAR_0->pb); VAR_7 = VAR_7 * 4 - 1; VAR_5 -= VAR_7; VAR_5--; VAR_8 = 0; VAR_12 = avio_tell(VAR_0->pb) + VAR_7; while(VAR_8 < 256){ VAR_9 = avio_r8(VAR_0->pb); if(VAR_9 & 0x80){ VAR_8 += (VAR_9 & 0x7F) + 1; pal += ((VAR_9 & 0x7F) + 1) * 3; } else if(VAR_9 & 0x40){ VAR_10 = avio_r8(VAR_0->pb); VAR_11 = (VAR_9 & 0x3F) + 1; if (VAR_10 + VAR_11 > 0x100) { av_log(VAR_0, AV_LOG_ERROR, "Invalid palette update, offset=%d length=%d extends beyond palette VAR_7\n", VAR_10, VAR_11); return AVERROR_INVALIDDATA; } VAR_10 *= 3; while(VAR_11-- && VAR_8 < 256) { *pal++ = oldpal[VAR_10 + 0]; *pal++ = oldpal[VAR_10 + 1]; *pal++ = oldpal[VAR_10 + 2]; VAR_8++; VAR_10 += 3; } } else { *pal++ = smk_pal[VAR_9]; *pal++ = smk_pal[avio_r8(VAR_0->pb) & 0x3F]; *pal++ = smk_pal[avio_r8(VAR_0->pb) & 0x3F]; VAR_8++; } } avio_seek(VAR_0->pb, VAR_12, 0); VAR_6 |= 1; } VAR_2 >>= 1; smk->curstream = -1; for(VAR_4 = 0; VAR_4 < 7; VAR_4++) { if(VAR_2 & 1) { uint32_t VAR_7; uint8_t *tmpbuf; VAR_7 = avio_rl32(VAR_0->pb) - 4; if (!VAR_7 || VAR_7 > VAR_5) { av_log(VAR_0, AV_LOG_ERROR, "Invalid audio part VAR_7\n"); return AVERROR_INVALIDDATA; } VAR_5 -= VAR_7; VAR_5 -= 4; smk->curstream++; tmpbuf = av_realloc(smk->bufs[smk->curstream], VAR_7); if (!tmpbuf) return AVERROR(ENOMEM); smk->bufs[smk->curstream] = tmpbuf; smk->buf_sizes[smk->curstream] = VAR_7; VAR_3 = avio_read(VAR_0->pb, smk->bufs[smk->curstream], VAR_7); if(VAR_3 != VAR_7) return AVERROR(EIO); smk->stream_id[smk->curstream] = smk->indexes[VAR_4]; } VAR_2 >>= 1; } if (VAR_5 < 0) return AVERROR_INVALIDDATA; if (av_new_packet(VAR_1, VAR_5 + 769)) return AVERROR(ENOMEM); if(smk->frm_size[smk->cur_frame] & 1) VAR_6 |= 2; VAR_1->data[0] = VAR_6; memcpy(VAR_1->data + 1, smk->pal, 768); VAR_3 = avio_read(VAR_0->pb, VAR_1->data + 769, VAR_5); if(VAR_3 != VAR_5) return AVERROR(EIO); VAR_1->stream_index = smk->videoindex; VAR_1->pts = smk->cur_frame; VAR_1->VAR_7 = VAR_3 + 769; smk->cur_frame++; smk->nextpos = avio_tell(VAR_0->pb); } else { if (smk->stream_id[smk->curstream] < 0) return AVERROR_INVALIDDATA; if (av_new_packet(VAR_1, smk->buf_sizes[smk->curstream])) return AVERROR(ENOMEM); memcpy(VAR_1->data, smk->bufs[smk->curstream], smk->buf_sizes[smk->curstream]); VAR_1->VAR_7 = smk->buf_sizes[smk->curstream]; VAR_1->stream_index = smk->stream_id[smk->curstream]; VAR_1->pts = smk->aud_pts[smk->curstream]; smk->aud_pts[smk->curstream] += AV_RL32(VAR_1->data); smk->curstream--; } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "SmackerContext *smk = VAR_0->priv_data;", "int VAR_2;", "int VAR_3;", "int VAR_4;", "int VAR_5 = 0;", "int VAR_6 = 0;", "if (VAR_0->pb->eof_reached || smk->cur_frame >= smk->frames)\nreturn AVERROR_EOF;", "if(smk->curstream < 0) {", "avio_seek(VAR_0->pb, smk->nextpos, 0);", "VAR_5 = smk->frm_size[smk->cur_frame] & (~3);", "VAR_2 = smk->frm_flags[smk->cur_frame];", "if(VAR_2 & SMACKER_PAL){", "int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12;", "uint8_t *pal = smk->pal;", "uint8_t oldpal[768];", "memcpy(oldpal, pal, 768);", "VAR_7 = avio_r8(VAR_0->pb);", "VAR_7 = VAR_7 * 4 - 1;", "VAR_5 -= VAR_7;", "VAR_5--;", "VAR_8 = 0;", "VAR_12 = avio_tell(VAR_0->pb) + VAR_7;", "while(VAR_8 < 256){", "VAR_9 = avio_r8(VAR_0->pb);", "if(VAR_9 & 0x80){", "VAR_8 += (VAR_9 & 0x7F) + 1;", "pal += ((VAR_9 & 0x7F) + 1) * 3;", "} else if(VAR_9 & 0x40){", "VAR_10 = avio_r8(VAR_0->pb);", "VAR_11 = (VAR_9 & 0x3F) + 1;", "if (VAR_10 + VAR_11 > 0x100) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Invalid palette update, offset=%d length=%d extends beyond palette VAR_7\\n\",\nVAR_10, VAR_11);", "return AVERROR_INVALIDDATA;", "}", "VAR_10 *= 3;", "while(VAR_11-- && VAR_8 < 256) {", "*pal++ = oldpal[VAR_10 + 0];", "*pal++ = oldpal[VAR_10 + 1];", "*pal++ = oldpal[VAR_10 + 2];", "VAR_8++;", "VAR_10 += 3;", "}", "} else {", "*pal++ = smk_pal[VAR_9];", "*pal++ = smk_pal[avio_r8(VAR_0->pb) & 0x3F];", "*pal++ = smk_pal[avio_r8(VAR_0->pb) & 0x3F];", "VAR_8++;", "}", "}", "avio_seek(VAR_0->pb, VAR_12, 0);", "VAR_6 |= 1;", "}", "VAR_2 >>= 1;", "smk->curstream = -1;", "for(VAR_4 = 0; VAR_4 < 7; VAR_4++) {", "if(VAR_2 & 1) {", "uint32_t VAR_7;", "uint8_t *tmpbuf;", "VAR_7 = avio_rl32(VAR_0->pb) - 4;", "if (!VAR_7 || VAR_7 > VAR_5) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid audio part VAR_7\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_5 -= VAR_7;", "VAR_5 -= 4;", "smk->curstream++;", "tmpbuf = av_realloc(smk->bufs[smk->curstream], VAR_7);", "if (!tmpbuf)\nreturn AVERROR(ENOMEM);", "smk->bufs[smk->curstream] = tmpbuf;", "smk->buf_sizes[smk->curstream] = VAR_7;", "VAR_3 = avio_read(VAR_0->pb, smk->bufs[smk->curstream], VAR_7);", "if(VAR_3 != VAR_7)\nreturn AVERROR(EIO);", "smk->stream_id[smk->curstream] = smk->indexes[VAR_4];", "}", "VAR_2 >>= 1;", "}", "if (VAR_5 < 0)\nreturn AVERROR_INVALIDDATA;", "if (av_new_packet(VAR_1, VAR_5 + 769))\nreturn AVERROR(ENOMEM);", "if(smk->frm_size[smk->cur_frame] & 1)\nVAR_6 |= 2;", "VAR_1->data[0] = VAR_6;", "memcpy(VAR_1->data + 1, smk->pal, 768);", "VAR_3 = avio_read(VAR_0->pb, VAR_1->data + 769, VAR_5);", "if(VAR_3 != VAR_5)\nreturn AVERROR(EIO);", "VAR_1->stream_index = smk->videoindex;", "VAR_1->pts = smk->cur_frame;", "VAR_1->VAR_7 = VAR_3 + 769;", "smk->cur_frame++;", "smk->nextpos = avio_tell(VAR_0->pb);", "} else {", "if (smk->stream_id[smk->curstream] < 0)\nreturn AVERROR_INVALIDDATA;", "if (av_new_packet(VAR_1, smk->buf_sizes[smk->curstream]))\nreturn AVERROR(ENOMEM);", "memcpy(VAR_1->data, smk->bufs[smk->curstream], smk->buf_sizes[smk->curstream]);", "VAR_1->VAR_7 = smk->buf_sizes[smk->curstream];", "VAR_1->stream_index = smk->stream_id[smk->curstream];", "VAR_1->pts = smk->aud_pts[smk->curstream];", "smk->aud_pts[smk->curstream] += AV_RL32(VAR_1->data);", "smk->curstream--;", "}", "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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 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 ], [ 239 ], [ 241 ] ]
160
static void wm8750_audio_out_cb(void *opaque, int free_b) { struct wm8750_s *s = (struct wm8750_s *) opaque; wm8750_out_flush(s); s->req_out = free_b; s->data_req(s->opaque, free_b >> 2, s->req_in >> 2); }
true
qemu
eb69b50ad9806c4a3b5900392a5acc9837cffd18
static void wm8750_audio_out_cb(void *opaque, int free_b) { struct wm8750_s *s = (struct wm8750_s *) opaque; wm8750_out_flush(s); s->req_out = free_b; s->data_req(s->opaque, free_b >> 2, s->req_in >> 2); }
{ "code": [ " wm8750_out_flush(s);" ], "line_no": [ 7 ] }
static void FUNC_0(void *VAR_0, int VAR_1) { struct wm8750_s *VAR_2 = (struct wm8750_s *) VAR_0; wm8750_out_flush(VAR_2); VAR_2->req_out = VAR_1; VAR_2->data_req(VAR_2->VAR_0, VAR_1 >> 2, VAR_2->req_in >> 2); }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "struct wm8750_s *VAR_2 = (struct wm8750_s *) VAR_0;", "wm8750_out_flush(VAR_2);", "VAR_2->req_out = VAR_1;", "VAR_2->data_req(VAR_2->VAR_0, VAR_1 >> 2, VAR_2->req_in >> 2);", "}" ]
[ 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ] ]
163
static void unix_process_msgfd(CharDriverState *chr, struct msghdr *msg) { TCPCharDriver *s = chr->opaque; struct cmsghdr *cmsg; for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { int fd; if (cmsg->cmsg_len != CMSG_LEN(sizeof(int)) || cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) continue; fd = *((int *)CMSG_DATA(cmsg)); if (fd < 0) continue; #ifndef MSG_CMSG_CLOEXEC qemu_set_cloexec(fd); #endif if (s->msgfd != -1) close(s->msgfd); s->msgfd = fd; } }
true
qemu
9b938c7262e403f5467110609cb20ef1ae6e9df2
static void unix_process_msgfd(CharDriverState *chr, struct msghdr *msg) { TCPCharDriver *s = chr->opaque; struct cmsghdr *cmsg; for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { int fd; if (cmsg->cmsg_len != CMSG_LEN(sizeof(int)) || cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) continue; fd = *((int *)CMSG_DATA(cmsg)); if (fd < 0) continue; #ifndef MSG_CMSG_CLOEXEC qemu_set_cloexec(fd); #endif if (s->msgfd != -1) close(s->msgfd); s->msgfd = fd; } }
{ "code": [], "line_no": [] }
static void FUNC_0(CharDriverState *VAR_0, struct msghdr *VAR_1) { TCPCharDriver *s = VAR_0->opaque; struct cmsghdr *VAR_2; for (VAR_2 = CMSG_FIRSTHDR(VAR_1); VAR_2; VAR_2 = CMSG_NXTHDR(VAR_1, VAR_2)) { int VAR_3; if (VAR_2->cmsg_len != CMSG_LEN(sizeof(int)) || VAR_2->cmsg_level != SOL_SOCKET || VAR_2->cmsg_type != SCM_RIGHTS) continue; VAR_3 = *((int *)CMSG_DATA(VAR_2)); if (VAR_3 < 0) continue; #ifndef MSG_CMSG_CLOEXEC qemu_set_cloexec(VAR_3); #endif if (s->msgfd != -1) close(s->msgfd); s->msgfd = VAR_3; } }
[ "static void FUNC_0(CharDriverState *VAR_0, struct msghdr *VAR_1)\n{", "TCPCharDriver *s = VAR_0->opaque;", "struct cmsghdr *VAR_2;", "for (VAR_2 = CMSG_FIRSTHDR(VAR_1); VAR_2; VAR_2 = CMSG_NXTHDR(VAR_1, VAR_2)) {", "int VAR_3;", "if (VAR_2->cmsg_len != CMSG_LEN(sizeof(int)) ||\nVAR_2->cmsg_level != SOL_SOCKET ||\nVAR_2->cmsg_type != SCM_RIGHTS)\ncontinue;", "VAR_3 = *((int *)CMSG_DATA(VAR_2));", "if (VAR_3 < 0)\ncontinue;", "#ifndef MSG_CMSG_CLOEXEC\nqemu_set_cloexec(VAR_3);", "#endif\nif (s->msgfd != -1)\nclose(s->msgfd);", "s->msgfd = VAR_3;", "}", "}" ]
[ 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 ] ]
165
void ga_channel_free(GAChannel *c) { if (c->method == GA_CHANNEL_UNIX_LISTEN && c->listen_channel) { ga_channel_listen_close(c); } if (c->client_channel) { ga_channel_client_close(c); } g_free(c); }
false
qemu
f06b2031a31cdd3acf6f61a977e505b8c6b58f73
void ga_channel_free(GAChannel *c) { if (c->method == GA_CHANNEL_UNIX_LISTEN && c->listen_channel) { ga_channel_listen_close(c); } if (c->client_channel) { ga_channel_client_close(c); } g_free(c); }
{ "code": [], "line_no": [] }
void FUNC_0(GAChannel *VAR_0) { if (VAR_0->method == GA_CHANNEL_UNIX_LISTEN && VAR_0->listen_channel) { ga_channel_listen_close(VAR_0); } if (VAR_0->client_channel) { ga_channel_client_close(VAR_0); } g_free(VAR_0); }
[ "void FUNC_0(GAChannel *VAR_0)\n{", "if (VAR_0->method == GA_CHANNEL_UNIX_LISTEN\n&& VAR_0->listen_channel) {", "ga_channel_listen_close(VAR_0);", "}", "if (VAR_0->client_channel) {", "ga_channel_client_close(VAR_0);", "}", "g_free(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
167
ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, MemoryRegion *mr, Error **errp) { RAMBlock *new_block; ram_addr_t addr; Error *local_err = NULL; size = TARGET_PAGE_ALIGN(size); new_block = g_malloc0(sizeof(*new_block)); new_block->mr = mr; new_block->used_length = size; new_block->max_length = max_size; new_block->fd = -1; new_block->host = host; if (host) { new_block->flags |= RAM_PREALLOC; } addr = ram_block_add(new_block, &local_err); if (local_err) { g_free(new_block); error_propagate(errp, local_err); return -1; } return addr; }
false
qemu
62be4e3a5041e84304aa23637da623a205c53ecc
ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, MemoryRegion *mr, Error **errp) { RAMBlock *new_block; ram_addr_t addr; Error *local_err = NULL; size = TARGET_PAGE_ALIGN(size); new_block = g_malloc0(sizeof(*new_block)); new_block->mr = mr; new_block->used_length = size; new_block->max_length = max_size; new_block->fd = -1; new_block->host = host; if (host) { new_block->flags |= RAM_PREALLOC; } addr = ram_block_add(new_block, &local_err); if (local_err) { g_free(new_block); error_propagate(errp, local_err); return -1; } return addr; }
{ "code": [], "line_no": [] }
ram_addr_t FUNC_0(ram_addr_t size, void *host, MemoryRegion *mr, Error **errp) { RAMBlock *new_block; ram_addr_t addr; Error *local_err = NULL; size = TARGET_PAGE_ALIGN(size); new_block = g_malloc0(sizeof(*new_block)); new_block->mr = mr; new_block->used_length = size; new_block->max_length = max_size; new_block->fd = -1; new_block->host = host; if (host) { new_block->flags |= RAM_PREALLOC; } addr = ram_block_add(new_block, &local_err); if (local_err) { g_free(new_block); error_propagate(errp, local_err); return -1; } return addr; }
[ "ram_addr_t FUNC_0(ram_addr_t size, void *host,\nMemoryRegion *mr, Error **errp)\n{", "RAMBlock *new_block;", "ram_addr_t addr;", "Error *local_err = NULL;", "size = TARGET_PAGE_ALIGN(size);", "new_block = g_malloc0(sizeof(*new_block));", "new_block->mr = mr;", "new_block->used_length = size;", "new_block->max_length = max_size;", "new_block->fd = -1;", "new_block->host = host;", "if (host) {", "new_block->flags |= RAM_PREALLOC;", "}", "addr = ram_block_add(new_block, &local_err);", "if (local_err) {", "g_free(new_block);", "error_propagate(errp, local_err);", "return -1;", "}", "return addr;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
168
void kvm_s390_io_interrupt(S390CPU *cpu, uint16_t subchannel_id, uint16_t subchannel_nr, uint32_t io_int_parm, uint32_t io_int_word) { uint32_t type; if (io_int_word & IO_INT_WORD_AI) { type = KVM_S390_INT_IO(1, 0, 0, 0); } else { type = ((subchannel_id & 0xff00) << 24) | ((subchannel_id & 0x00060) << 22) | (subchannel_nr << 16); } kvm_s390_interrupt_internal(cpu, type, ((uint32_t)subchannel_id << 16) | subchannel_nr, ((uint64_t)io_int_parm << 32) | io_int_word, 1); }
false
qemu
de13d2161473d02ae97ec0f8e4503147554892dd
void kvm_s390_io_interrupt(S390CPU *cpu, uint16_t subchannel_id, uint16_t subchannel_nr, uint32_t io_int_parm, uint32_t io_int_word) { uint32_t type; if (io_int_word & IO_INT_WORD_AI) { type = KVM_S390_INT_IO(1, 0, 0, 0); } else { type = ((subchannel_id & 0xff00) << 24) | ((subchannel_id & 0x00060) << 22) | (subchannel_nr << 16); } kvm_s390_interrupt_internal(cpu, type, ((uint32_t)subchannel_id << 16) | subchannel_nr, ((uint64_t)io_int_parm << 32) | io_int_word, 1); }
{ "code": [], "line_no": [] }
void FUNC_0(S390CPU *VAR_0, uint16_t VAR_1, uint16_t VAR_2, uint32_t VAR_3, uint32_t VAR_4) { uint32_t type; if (VAR_4 & IO_INT_WORD_AI) { type = KVM_S390_INT_IO(1, 0, 0, 0); } else { type = ((VAR_1 & 0xff00) << 24) | ((VAR_1 & 0x00060) << 22) | (VAR_2 << 16); } kvm_s390_interrupt_internal(VAR_0, type, ((uint32_t)VAR_1 << 16) | VAR_2, ((uint64_t)VAR_3 << 32) | VAR_4, 1); }
[ "void FUNC_0(S390CPU *VAR_0, uint16_t VAR_1,\nuint16_t VAR_2, uint32_t VAR_3,\nuint32_t VAR_4)\n{", "uint32_t type;", "if (VAR_4 & IO_INT_WORD_AI) {", "type = KVM_S390_INT_IO(1, 0, 0, 0);", "} else {", "type = ((VAR_1 & 0xff00) << 24) |\n((VAR_1 & 0x00060) << 22) | (VAR_2 << 16);", "}", "kvm_s390_interrupt_internal(VAR_0, type,\n((uint32_t)VAR_1 << 16) | VAR_2,\n((uint64_t)VAR_3 << 32) | VAR_4, 1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25, 27, 29 ], [ 31 ] ]
169
static void elcr_ioport_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { PICCommonState *s = opaque; s->elcr = val & s->elcr_mask; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void elcr_ioport_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { PICCommonState *s = opaque; s->elcr = val & s->elcr_mask; }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { PICCommonState *s = VAR_0; s->elcr = VAR_2 & s->elcr_mask; }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "PICCommonState *s = VAR_0;", "s->elcr = VAR_2 & s->elcr_mask;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
170
void nonono(const char* file, int line, const char* msg) { fprintf(stderr, "Nonono! %s:%d %s\n", file, line, msg); exit(-5); }
false
qemu
7a6ab45e19b615b9285b9cfa2bbc1fee012bc8d7
void nonono(const char* file, int line, const char* msg) { fprintf(stderr, "Nonono! %s:%d %s\n", file, line, msg); exit(-5); }
{ "code": [], "line_no": [] }
void FUNC_0(const char* VAR_0, int VAR_1, const char* VAR_2) { fprintf(stderr, "Nonono! %s:%d %s\n", VAR_0, VAR_1, VAR_2); exit(-5); }
[ "void FUNC_0(const char* VAR_0, int VAR_1, const char* VAR_2) {", "fprintf(stderr, \"Nonono! %s:%d %s\\n\", VAR_0, VAR_1, VAR_2);", "exit(-5);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ] ]
171
static void spitz_i2c_setup(PXA2xxState *cpu) { /* Attach the CPU on one end of our I2C bus. */ i2c_bus *bus = pxa2xx_i2c_bus(cpu->i2c[0]); #ifdef HAS_AUDIO DeviceState *wm; /* Attach a WM8750 to the bus */ wm = i2c_create_slave(bus, "wm8750", 0); spitz_wm8750_addr(wm, 0, 0); pxa2xx_gpio_out_set(cpu->gpio, SPITZ_GPIO_WM, qemu_allocate_irqs(spitz_wm8750_addr, wm, 1)[0]); /* .. and to the sound interface. */ cpu->i2s->opaque = wm; cpu->i2s->codec_out = wm8750_dac_dat; cpu->i2s->codec_in = wm8750_adc_dat; wm8750_data_req_set(wm, cpu->i2s->data_req, cpu->i2s); #endif }
false
qemu
738012bec4c67e697e766edadab3f522c552a04d
static void spitz_i2c_setup(PXA2xxState *cpu) { i2c_bus *bus = pxa2xx_i2c_bus(cpu->i2c[0]); #ifdef HAS_AUDIO DeviceState *wm; wm = i2c_create_slave(bus, "wm8750", 0); spitz_wm8750_addr(wm, 0, 0); pxa2xx_gpio_out_set(cpu->gpio, SPITZ_GPIO_WM, qemu_allocate_irqs(spitz_wm8750_addr, wm, 1)[0]); cpu->i2s->opaque = wm; cpu->i2s->codec_out = wm8750_dac_dat; cpu->i2s->codec_in = wm8750_adc_dat; wm8750_data_req_set(wm, cpu->i2s->data_req, cpu->i2s); #endif }
{ "code": [], "line_no": [] }
static void FUNC_0(PXA2xxState *VAR_0) { i2c_bus *bus = pxa2xx_i2c_bus(VAR_0->i2c[0]); #ifdef HAS_AUDIO DeviceState *wm; wm = i2c_create_slave(bus, "wm8750", 0); spitz_wm8750_addr(wm, 0, 0); pxa2xx_gpio_out_set(VAR_0->gpio, SPITZ_GPIO_WM, qemu_allocate_irqs(spitz_wm8750_addr, wm, 1)[0]); VAR_0->i2s->opaque = wm; VAR_0->i2s->codec_out = wm8750_dac_dat; VAR_0->i2s->codec_in = wm8750_adc_dat; wm8750_data_req_set(wm, VAR_0->i2s->data_req, VAR_0->i2s); #endif }
[ "static void FUNC_0(PXA2xxState *VAR_0)\n{", "i2c_bus *bus = pxa2xx_i2c_bus(VAR_0->i2c[0]);", "#ifdef HAS_AUDIO\nDeviceState *wm;", "wm = i2c_create_slave(bus, \"wm8750\", 0);", "spitz_wm8750_addr(wm, 0, 0);", "pxa2xx_gpio_out_set(VAR_0->gpio, SPITZ_GPIO_WM,\nqemu_allocate_irqs(spitz_wm8750_addr, wm, 1)[0]);", "VAR_0->i2s->opaque = wm;", "VAR_0->i2s->codec_out = wm8750_dac_dat;", "VAR_0->i2s->codec_in = wm8750_adc_dat;", "wm8750_data_req_set(wm, VAR_0->i2s->data_req, VAR_0->i2s);", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 11, 13 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ] ]
172
static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) { OutputStream *ost = ofilter->ost; AVCodecContext *codec = ost->st->codec; AVFilterContext *last_filter = out->filter_ctx; int pad_idx = out->pad_idx; char *sample_fmts, *sample_rates, *channel_layouts; char name[255]; int ret; snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("ffabuffersink"), name, NULL, NULL, fg->graph); if (ret < 0) return ret; #define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \ AVFilterContext *filt_ctx; \ \ av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \ "similarly to -af " filter_name "=%s.\n", arg); \ \ ret = avfilter_graph_create_filter(&filt_ctx, \ avfilter_get_by_name(filter_name), \ filter_name, arg, NULL, fg->graph); \ if (ret < 0) \ return ret; \ \ ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \ if (ret < 0) \ return ret; \ \ last_filter = filt_ctx; \ pad_idx = 0; \ } while (0) if (ost->audio_channels_mapped) { int i; AVBPrint pan_buf; av_bprint_init(&pan_buf, 256, 8192); av_bprintf(&pan_buf, "0x%"PRIx64, av_get_default_channel_layout(ost->audio_channels_mapped)); for (i = 0; i < ost->audio_channels_mapped; i++) if (ost->audio_channels_map[i] != -1) av_bprintf(&pan_buf, ":c%d=c%d", i, ost->audio_channels_map[i]); AUTO_INSERT_FILTER("-map_channel", "pan", pan_buf.str); av_bprint_finalize(&pan_buf, NULL); } if (codec->channels && !codec->channel_layout) codec->channel_layout = av_get_default_channel_layout(codec->channels); sample_fmts = choose_sample_fmts(ost); sample_rates = choose_sample_rates(ost); channel_layouts = choose_channel_layouts(ost); if (sample_fmts || sample_rates || channel_layouts) { AVFilterContext *format; char args[256]; int len = 0; if (sample_fmts) len += snprintf(args + len, sizeof(args) - len, "sample_fmts=%s:", sample_fmts); if (sample_rates) len += snprintf(args + len, sizeof(args) - len, "sample_rates=%s:", sample_rates); if (channel_layouts) len += snprintf(args + len, sizeof(args) - len, "channel_layouts=%s:", channel_layouts); args[len - 1] = 0; av_freep(&sample_fmts); av_freep(&sample_rates); av_freep(&channel_layouts); snprintf(name, sizeof(name), "audio format for output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&format, avfilter_get_by_name("aformat"), name, args, NULL, fg->graph); if (ret < 0) return ret; ret = avfilter_link(last_filter, pad_idx, format, 0); if (ret < 0) return ret; last_filter = format; pad_idx = 0; } if (audio_volume != 256 && 0) { char args[256]; snprintf(args, sizeof(args), "%f", audio_volume / 256.); AUTO_INSERT_FILTER("-vol", "volume", args); } if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0) return ret; return 0; }
false
FFmpeg
d7cb5a8daf73825d4ffa623be4c2b798c81f41a5
static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) { OutputStream *ost = ofilter->ost; AVCodecContext *codec = ost->st->codec; AVFilterContext *last_filter = out->filter_ctx; int pad_idx = out->pad_idx; char *sample_fmts, *sample_rates, *channel_layouts; char name[255]; int ret; snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("ffabuffersink"), name, NULL, NULL, fg->graph); if (ret < 0) return ret; #define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \ AVFilterContext *filt_ctx; \ \ av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \ "similarly to -af " filter_name "=%s.\n", arg); \ \ ret = avfilter_graph_create_filter(&filt_ctx, \ avfilter_get_by_name(filter_name), \ filter_name, arg, NULL, fg->graph); \ if (ret < 0) \ return ret; \ \ ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \ if (ret < 0) \ return ret; \ \ last_filter = filt_ctx; \ pad_idx = 0; \ } while (0) if (ost->audio_channels_mapped) { int i; AVBPrint pan_buf; av_bprint_init(&pan_buf, 256, 8192); av_bprintf(&pan_buf, "0x%"PRIx64, av_get_default_channel_layout(ost->audio_channels_mapped)); for (i = 0; i < ost->audio_channels_mapped; i++) if (ost->audio_channels_map[i] != -1) av_bprintf(&pan_buf, ":c%d=c%d", i, ost->audio_channels_map[i]); AUTO_INSERT_FILTER("-map_channel", "pan", pan_buf.str); av_bprint_finalize(&pan_buf, NULL); } if (codec->channels && !codec->channel_layout) codec->channel_layout = av_get_default_channel_layout(codec->channels); sample_fmts = choose_sample_fmts(ost); sample_rates = choose_sample_rates(ost); channel_layouts = choose_channel_layouts(ost); if (sample_fmts || sample_rates || channel_layouts) { AVFilterContext *format; char args[256]; int len = 0; if (sample_fmts) len += snprintf(args + len, sizeof(args) - len, "sample_fmts=%s:", sample_fmts); if (sample_rates) len += snprintf(args + len, sizeof(args) - len, "sample_rates=%s:", sample_rates); if (channel_layouts) len += snprintf(args + len, sizeof(args) - len, "channel_layouts=%s:", channel_layouts); args[len - 1] = 0; av_freep(&sample_fmts); av_freep(&sample_rates); av_freep(&channel_layouts); snprintf(name, sizeof(name), "audio format for output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&format, avfilter_get_by_name("aformat"), name, args, NULL, fg->graph); if (ret < 0) return ret; ret = avfilter_link(last_filter, pad_idx, format, 0); if (ret < 0) return ret; last_filter = format; pad_idx = 0; } if (audio_volume != 256 && 0) { char args[256]; snprintf(args, sizeof(args), "%f", audio_volume / 256.); AUTO_INSERT_FILTER("-vol", "volume", args); } if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0) return ret; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FilterGraph *VAR_0, OutputFilter *VAR_1, AVFilterInOut *VAR_2) { OutputStream *ost = VAR_1->ost; AVCodecContext *codec = ost->st->codec; AVFilterContext *last_filter = VAR_2->filter_ctx; int VAR_3 = VAR_2->VAR_3; char *VAR_4, *VAR_5, *VAR_6; char VAR_7[255]; int VAR_8; snprintf(VAR_7, sizeof(VAR_7), "output stream %d:%d", ost->file_index, ost->index); VAR_8 = avfilter_graph_create_filter(&VAR_1->filter, avfilter_get_by_name("ffabuffersink"), VAR_7, NULL, NULL, VAR_0->graph); if (VAR_8 < 0) return VAR_8; #define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \ AVFilterContext *filt_ctx; \ \ av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \ "similarly to -af " filter_name "=%s.\n", arg); \ \ VAR_8 = avfilter_graph_create_filter(&filt_ctx, \ avfilter_get_by_name(filter_name), \ filter_name, arg, NULL, VAR_0->graph); \ if (VAR_8 < 0) \ return VAR_8; \ \ VAR_8 = avfilter_link(last_filter, VAR_3, filt_ctx, 0); \ if (VAR_8 < 0) \ return VAR_8; \ \ last_filter = filt_ctx; \ VAR_3 = 0; \ } while (0) if (ost->audio_channels_mapped) { int i; AVBPrint pan_buf; av_bprint_init(&pan_buf, 256, 8192); av_bprintf(&pan_buf, "0x%"PRIx64, av_get_default_channel_layout(ost->audio_channels_mapped)); for (i = 0; i < ost->audio_channels_mapped; i++) if (ost->audio_channels_map[i] != -1) av_bprintf(&pan_buf, ":c%d=c%d", i, ost->audio_channels_map[i]); AUTO_INSERT_FILTER("-map_channel", "pan", pan_buf.str); av_bprint_finalize(&pan_buf, NULL); } if (codec->channels && !codec->channel_layout) codec->channel_layout = av_get_default_channel_layout(codec->channels); VAR_4 = choose_sample_fmts(ost); VAR_5 = choose_sample_rates(ost); VAR_6 = choose_channel_layouts(ost); if (VAR_4 || VAR_5 || VAR_6) { AVFilterContext *format; char args[256]; int len = 0; if (VAR_4) len += snprintf(args + len, sizeof(args) - len, "VAR_4=%s:", VAR_4); if (VAR_5) len += snprintf(args + len, sizeof(args) - len, "VAR_5=%s:", VAR_5); if (VAR_6) len += snprintf(args + len, sizeof(args) - len, "VAR_6=%s:", VAR_6); args[len - 1] = 0; av_freep(&VAR_4); av_freep(&VAR_5); av_freep(&VAR_6); snprintf(VAR_7, sizeof(VAR_7), "audio format for output stream %d:%d", ost->file_index, ost->index); VAR_8 = avfilter_graph_create_filter(&format, avfilter_get_by_name("aformat"), VAR_7, args, NULL, VAR_0->graph); if (VAR_8 < 0) return VAR_8; VAR_8 = avfilter_link(last_filter, VAR_3, format, 0); if (VAR_8 < 0) return VAR_8; last_filter = format; VAR_3 = 0; } if (audio_volume != 256 && 0) { char args[256]; snprintf(args, sizeof(args), "%f", audio_volume / 256.); AUTO_INSERT_FILTER("-vol", "volume", args); } if ((VAR_8 = avfilter_link(last_filter, VAR_3, VAR_1->filter, 0)) < 0) return VAR_8; return 0; }
[ "static int FUNC_0(FilterGraph *VAR_0, OutputFilter *VAR_1, AVFilterInOut *VAR_2)\n{", "OutputStream *ost = VAR_1->ost;", "AVCodecContext *codec = ost->st->codec;", "AVFilterContext *last_filter = VAR_2->filter_ctx;", "int VAR_3 = VAR_2->VAR_3;", "char *VAR_4, *VAR_5, *VAR_6;", "char VAR_7[255];", "int VAR_8;", "snprintf(VAR_7, sizeof(VAR_7), \"output stream %d:%d\", ost->file_index, ost->index);", "VAR_8 = avfilter_graph_create_filter(&VAR_1->filter,\navfilter_get_by_name(\"ffabuffersink\"),\nVAR_7, NULL, NULL, VAR_0->graph);", "if (VAR_8 < 0)\nreturn VAR_8;", "#define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \\", "AVFilterContext *filt_ctx; \\", "\\\nav_log(NULL, AV_LOG_INFO, opt_name \" is forwarded to lavfi \" \\\n\"similarly to -af \" filter_name \"=%s.\\n\", arg); \\", "\\\nVAR_8 = avfilter_graph_create_filter(&filt_ctx, \\\navfilter_get_by_name(filter_name), \\\nfilter_name, arg, NULL, VAR_0->graph); \\", "if (VAR_8 < 0) \\\nreturn VAR_8; \\", "\\\nVAR_8 = avfilter_link(last_filter, VAR_3, filt_ctx, 0); \\", "if (VAR_8 < 0) \\\nreturn VAR_8; \\", "\\\nlast_filter = filt_ctx; \\", "VAR_3 = 0; \\", "} while (0)", "if (ost->audio_channels_mapped) {", "int i;", "AVBPrint pan_buf;", "av_bprint_init(&pan_buf, 256, 8192);", "av_bprintf(&pan_buf, \"0x%\"PRIx64,\nav_get_default_channel_layout(ost->audio_channels_mapped));", "for (i = 0; i < ost->audio_channels_mapped; i++)", "if (ost->audio_channels_map[i] != -1)\nav_bprintf(&pan_buf, \":c%d=c%d\", i, ost->audio_channels_map[i]);", "AUTO_INSERT_FILTER(\"-map_channel\", \"pan\", pan_buf.str);", "av_bprint_finalize(&pan_buf, NULL);", "}", "if (codec->channels && !codec->channel_layout)\ncodec->channel_layout = av_get_default_channel_layout(codec->channels);", "VAR_4 = choose_sample_fmts(ost);", "VAR_5 = choose_sample_rates(ost);", "VAR_6 = choose_channel_layouts(ost);", "if (VAR_4 || VAR_5 || VAR_6) {", "AVFilterContext *format;", "char args[256];", "int len = 0;", "if (VAR_4)\nlen += snprintf(args + len, sizeof(args) - len, \"VAR_4=%s:\",\nVAR_4);", "if (VAR_5)\nlen += snprintf(args + len, sizeof(args) - len, \"VAR_5=%s:\",\nVAR_5);", "if (VAR_6)\nlen += snprintf(args + len, sizeof(args) - len, \"VAR_6=%s:\",\nVAR_6);", "args[len - 1] = 0;", "av_freep(&VAR_4);", "av_freep(&VAR_5);", "av_freep(&VAR_6);", "snprintf(VAR_7, sizeof(VAR_7), \"audio format for output stream %d:%d\",\nost->file_index, ost->index);", "VAR_8 = avfilter_graph_create_filter(&format,\navfilter_get_by_name(\"aformat\"),\nVAR_7, args, NULL, VAR_0->graph);", "if (VAR_8 < 0)\nreturn VAR_8;", "VAR_8 = avfilter_link(last_filter, VAR_3, format, 0);", "if (VAR_8 < 0)\nreturn VAR_8;", "last_filter = format;", "VAR_3 = 0;", "}", "if (audio_volume != 256 && 0) {", "char args[256];", "snprintf(args, sizeof(args), \"%f\", audio_volume / 256.);", "AUTO_INSERT_FILTER(\"-vol\", \"volume\", args);", "}", "if ((VAR_8 = avfilter_link(last_filter, VAR_3, VAR_1->filter, 0)) < 0)\nreturn 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25, 27, 29 ], [ 31, 33 ], [ 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 ], [ 95 ], [ 97 ], [ 99 ], [ 103, 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125, 127, 129 ], [ 131, 133, 135 ], [ 137, 139, 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 155, 157 ], [ 159, 161, 163 ], [ 165, 167 ], [ 171 ], [ 173, 175 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 201, 203 ], [ 207 ], [ 209 ] ]
173
void restore_boot_order(void *opaque) { char *normal_boot_order = opaque; static int first = 1; /* Restore boot order and remove ourselves after the first boot */ if (first) { first = 0; return; } qemu_boot_set(normal_boot_order); qemu_unregister_reset(restore_boot_order, normal_boot_order); g_free(normal_boot_order); }
false
qemu
f1839938b090b28537d9be2c1b255b834f3cfbb8
void restore_boot_order(void *opaque) { char *normal_boot_order = opaque; static int first = 1; if (first) { first = 0; return; } qemu_boot_set(normal_boot_order); qemu_unregister_reset(restore_boot_order, normal_boot_order); g_free(normal_boot_order); }
{ "code": [], "line_no": [] }
void FUNC_0(void *VAR_0) { char *VAR_1 = VAR_0; static int VAR_2 = 1; if (VAR_2) { VAR_2 = 0; return; } qemu_boot_set(VAR_1); qemu_unregister_reset(FUNC_0, VAR_1); g_free(VAR_1); }
[ "void FUNC_0(void *VAR_0)\n{", "char *VAR_1 = VAR_0;", "static int VAR_2 = 1;", "if (VAR_2) {", "VAR_2 = 0;", "return;", "}", "qemu_boot_set(VAR_1);", "qemu_unregister_reset(FUNC_0, VAR_1);", "g_free(VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ] ]
175
static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base) { VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, qdev); VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, qdev, base); VirtIOSerialBus *bus = DO_UPCAST(VirtIOSerialBus, qbus, qdev->parent_bus); int ret, max_nr_ports; bool plugging_port0; port->vser = bus->vser; port->bh = qemu_bh_new(flush_queued_data_bh, port); /* * Is the first console port we're seeing? If so, put it up at * location 0. This is done for backward compatibility (old * kernel, new qemu). */ plugging_port0 = port->is_console && !find_port_by_id(port->vser, 0); if (find_port_by_id(port->vser, port->id)) { error_report("virtio-serial-bus: A port already exists at id %u\n", port->id); return -1; } if (port->id == VIRTIO_CONSOLE_BAD_ID) { if (plugging_port0) { port->id = 0; } else { port->id = find_free_port_id(port->vser); if (port->id == VIRTIO_CONSOLE_BAD_ID) { error_report("virtio-serial-bus: Maximum port limit for this device reached\n"); return -1; } } } max_nr_ports = tswap32(port->vser->config.max_nr_ports); if (port->id >= max_nr_ports) { error_report("virtio-serial-bus: Out-of-range port id specified, max. allowed: %u\n", max_nr_ports - 1); return -1; } port->info = info; ret = info->init(port); if (ret) { return ret; } if (!use_multiport(port->vser)) { /* * Allow writes to guest in this case; we have no way of * knowing if a guest port is connected. */ port->guest_connected = true; } port->elem.out_num = 0; QTAILQ_INSERT_TAIL(&port->vser->ports, port, next); port->ivq = port->vser->ivqs[port->id]; port->ovq = port->vser->ovqs[port->id]; add_port(port->vser, port->id); /* Send an update to the guest about this new port added */ virtio_notify_config(&port->vser->vdev); return ret; }
false
qemu
2a3d57ce4278dfd898d8b5639ace21fa4a4fb9bd
static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base) { VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, qdev); VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, qdev, base); VirtIOSerialBus *bus = DO_UPCAST(VirtIOSerialBus, qbus, qdev->parent_bus); int ret, max_nr_ports; bool plugging_port0; port->vser = bus->vser; port->bh = qemu_bh_new(flush_queued_data_bh, port); plugging_port0 = port->is_console && !find_port_by_id(port->vser, 0); if (find_port_by_id(port->vser, port->id)) { error_report("virtio-serial-bus: A port already exists at id %u\n", port->id); return -1; } if (port->id == VIRTIO_CONSOLE_BAD_ID) { if (plugging_port0) { port->id = 0; } else { port->id = find_free_port_id(port->vser); if (port->id == VIRTIO_CONSOLE_BAD_ID) { error_report("virtio-serial-bus: Maximum port limit for this device reached\n"); return -1; } } } max_nr_ports = tswap32(port->vser->config.max_nr_ports); if (port->id >= max_nr_ports) { error_report("virtio-serial-bus: Out-of-range port id specified, max. allowed: %u\n", max_nr_ports - 1); return -1; } port->info = info; ret = info->init(port); if (ret) { return ret; } if (!use_multiport(port->vser)) { port->guest_connected = true; } port->elem.out_num = 0; QTAILQ_INSERT_TAIL(&port->vser->ports, port, next); port->ivq = port->vser->ivqs[port->id]; port->ovq = port->vser->ovqs[port->id]; add_port(port->vser, port->id); virtio_notify_config(&port->vser->vdev); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1) { VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, VAR_0); VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, VAR_0, VAR_1); VirtIOSerialBus *bus = DO_UPCAST(VirtIOSerialBus, qbus, VAR_0->parent_bus); int VAR_2, VAR_3; bool plugging_port0; port->vser = bus->vser; port->bh = qemu_bh_new(flush_queued_data_bh, port); plugging_port0 = port->is_console && !find_port_by_id(port->vser, 0); if (find_port_by_id(port->vser, port->id)) { error_report("virtio-serial-bus: A port already exists at id %u\n", port->id); return -1; } if (port->id == VIRTIO_CONSOLE_BAD_ID) { if (plugging_port0) { port->id = 0; } else { port->id = find_free_port_id(port->vser); if (port->id == VIRTIO_CONSOLE_BAD_ID) { error_report("virtio-serial-bus: Maximum port limit for this device reached\n"); return -1; } } } VAR_3 = tswap32(port->vser->config.VAR_3); if (port->id >= VAR_3) { error_report("virtio-serial-bus: Out-of-range port id specified, max. allowed: %u\n", VAR_3 - 1); return -1; } port->info = info; VAR_2 = info->init(port); if (VAR_2) { return VAR_2; } if (!use_multiport(port->vser)) { port->guest_connected = true; } port->elem.out_num = 0; QTAILQ_INSERT_TAIL(&port->vser->ports, port, next); port->ivq = port->vser->ivqs[port->id]; port->ovq = port->vser->ovqs[port->id]; add_port(port->vser, port->id); virtio_notify_config(&port->vser->vdev); return VAR_2; }
[ "static int FUNC_0(DeviceState *VAR_0, DeviceInfo *VAR_1)\n{", "VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, VAR_0);", "VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, VAR_0, VAR_1);", "VirtIOSerialBus *bus = DO_UPCAST(VirtIOSerialBus, qbus, VAR_0->parent_bus);", "int VAR_2, VAR_3;", "bool plugging_port0;", "port->vser = bus->vser;", "port->bh = qemu_bh_new(flush_queued_data_bh, port);", "plugging_port0 = port->is_console && !find_port_by_id(port->vser, 0);", "if (find_port_by_id(port->vser, port->id)) {", "error_report(\"virtio-serial-bus: A port already exists at id %u\\n\",\nport->id);", "return -1;", "}", "if (port->id == VIRTIO_CONSOLE_BAD_ID) {", "if (plugging_port0) {", "port->id = 0;", "} else {", "port->id = find_free_port_id(port->vser);", "if (port->id == VIRTIO_CONSOLE_BAD_ID) {", "error_report(\"virtio-serial-bus: Maximum port limit for this device reached\\n\");", "return -1;", "}", "}", "}", "VAR_3 = tswap32(port->vser->config.VAR_3);", "if (port->id >= VAR_3) {", "error_report(\"virtio-serial-bus: Out-of-range port id specified, max. allowed: %u\\n\",\nVAR_3 - 1);", "return -1;", "}", "port->info = info;", "VAR_2 = info->init(port);", "if (VAR_2) {", "return VAR_2;", "}", "if (!use_multiport(port->vser)) {", "port->guest_connected = true;", "}", "port->elem.out_num = 0;", "QTAILQ_INSERT_TAIL(&port->vser->ports, port, next);", "port->ivq = port->vser->ivqs[port->id];", "port->ovq = port->vser->ovqs[port->id];", "add_port(port->vser, port->id);", "virtio_notify_config(&port->vser->vdev);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 109 ], [ 111 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 133 ], [ 137 ], [ 139 ] ]
177
void block_job_pause(BlockJob *job) { job->paused = true; }
false
qemu
751ebd76e654bd1e65da08ecf694325282b4cfcc
void block_job_pause(BlockJob *job) { job->paused = true; }
{ "code": [], "line_no": [] }
void FUNC_0(BlockJob *VAR_0) { VAR_0->paused = true; }
[ "void FUNC_0(BlockJob *VAR_0)\n{", "VAR_0->paused = true;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
180
static void prop_get_fdt(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj); Error *err = NULL; int fdt_offset_next, fdt_offset, fdt_depth; void *fdt; if (!drc->fdt) { visit_type_null(v, NULL, errp); return; } fdt = drc->fdt; fdt_offset = drc->fdt_start_offset; fdt_depth = 0; do { const char *name = NULL; const struct fdt_property *prop = NULL; int prop_len = 0, name_len = 0; uint32_t tag; tag = fdt_next_tag(fdt, fdt_offset, &fdt_offset_next); switch (tag) { case FDT_BEGIN_NODE: fdt_depth++; name = fdt_get_name(fdt, fdt_offset, &name_len); visit_start_struct(v, name, NULL, 0, &err); if (err) { error_propagate(errp, err); return; } break; case FDT_END_NODE: /* shouldn't ever see an FDT_END_NODE before FDT_BEGIN_NODE */ g_assert(fdt_depth > 0); visit_check_struct(v, &err); visit_end_struct(v); if (err) { error_propagate(errp, err); return; } fdt_depth--; break; case FDT_PROP: { int i; prop = fdt_get_property_by_offset(fdt, fdt_offset, &prop_len); name = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); visit_start_list(v, name, &err); if (err) { error_propagate(errp, err); return; } for (i = 0; i < prop_len; i++) { visit_type_uint8(v, NULL, (uint8_t *)&prop->data[i], &err); if (err) { error_propagate(errp, err); return; } } visit_end_list(v); break; } default: error_setg(&error_abort, "device FDT in unexpected state: %d", tag); } fdt_offset = fdt_offset_next; } while (fdt_depth != 0); }
false
qemu
d9f62dde1303286b24ac8ce88be27e2b9b9c5f46
static void prop_get_fdt(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj); Error *err = NULL; int fdt_offset_next, fdt_offset, fdt_depth; void *fdt; if (!drc->fdt) { visit_type_null(v, NULL, errp); return; } fdt = drc->fdt; fdt_offset = drc->fdt_start_offset; fdt_depth = 0; do { const char *name = NULL; const struct fdt_property *prop = NULL; int prop_len = 0, name_len = 0; uint32_t tag; tag = fdt_next_tag(fdt, fdt_offset, &fdt_offset_next); switch (tag) { case FDT_BEGIN_NODE: fdt_depth++; name = fdt_get_name(fdt, fdt_offset, &name_len); visit_start_struct(v, name, NULL, 0, &err); if (err) { error_propagate(errp, err); return; } break; case FDT_END_NODE: g_assert(fdt_depth > 0); visit_check_struct(v, &err); visit_end_struct(v); if (err) { error_propagate(errp, err); return; } fdt_depth--; break; case FDT_PROP: { int i; prop = fdt_get_property_by_offset(fdt, fdt_offset, &prop_len); name = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); visit_start_list(v, name, &err); if (err) { error_propagate(errp, err); return; } for (i = 0; i < prop_len; i++) { visit_type_uint8(v, NULL, (uint8_t *)&prop->data[i], &err); if (err) { error_propagate(errp, err); return; } } visit_end_list(v); break; } default: error_setg(&error_abort, "device FDT in unexpected state: %d", tag); } fdt_offset = fdt_offset_next; } while (fdt_depth != 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0, Visitor *VAR_1, const char *VAR_9, void *VAR_3, Error **VAR_4) { sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(VAR_0); Error *err = NULL; int VAR_5, VAR_6, VAR_7; void *VAR_8; if (!drc->VAR_8) { visit_type_null(VAR_1, NULL, VAR_4); return; } VAR_8 = drc->VAR_8; VAR_6 = drc->fdt_start_offset; VAR_7 = 0; do { const char *VAR_9 = NULL; const struct fdt_property *VAR_9 = NULL; int VAR_10 = 0, VAR_11 = 0; uint32_t tag; tag = fdt_next_tag(VAR_8, VAR_6, &VAR_5); switch (tag) { case FDT_BEGIN_NODE: VAR_7++; VAR_9 = fdt_get_name(VAR_8, VAR_6, &VAR_11); visit_start_struct(VAR_1, VAR_9, NULL, 0, &err); if (err) { error_propagate(VAR_4, err); return; } break; case FDT_END_NODE: g_assert(VAR_7 > 0); visit_check_struct(VAR_1, &err); visit_end_struct(VAR_1); if (err) { error_propagate(VAR_4, err); return; } VAR_7--; break; case FDT_PROP: { int VAR_12; VAR_9 = fdt_get_property_by_offset(VAR_8, VAR_6, &VAR_10); VAR_9 = fdt_string(VAR_8, fdt32_to_cpu(VAR_9->nameoff)); visit_start_list(VAR_1, VAR_9, &err); if (err) { error_propagate(VAR_4, err); return; } for (VAR_12 = 0; VAR_12 < VAR_10; VAR_12++) { visit_type_uint8(VAR_1, NULL, (uint8_t *)&VAR_9->data[VAR_12], &err); if (err) { error_propagate(VAR_4, err); return; } } visit_end_list(VAR_1); break; } default: error_setg(&error_abort, "device FDT in unexpected state: %d", tag); } VAR_6 = VAR_5; } while (VAR_7 != 0); }
[ "static void FUNC_0(Object *VAR_0, Visitor *VAR_1, const char *VAR_9,\nvoid *VAR_3, Error **VAR_4)\n{", "sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(VAR_0);", "Error *err = NULL;", "int VAR_5, VAR_6, VAR_7;", "void *VAR_8;", "if (!drc->VAR_8) {", "visit_type_null(VAR_1, NULL, VAR_4);", "return;", "}", "VAR_8 = drc->VAR_8;", "VAR_6 = drc->fdt_start_offset;", "VAR_7 = 0;", "do {", "const char *VAR_9 = NULL;", "const struct fdt_property *VAR_9 = NULL;", "int VAR_10 = 0, VAR_11 = 0;", "uint32_t tag;", "tag = fdt_next_tag(VAR_8, VAR_6, &VAR_5);", "switch (tag) {", "case FDT_BEGIN_NODE:\nVAR_7++;", "VAR_9 = fdt_get_name(VAR_8, VAR_6, &VAR_11);", "visit_start_struct(VAR_1, VAR_9, NULL, 0, &err);", "if (err) {", "error_propagate(VAR_4, err);", "return;", "}", "break;", "case FDT_END_NODE:\ng_assert(VAR_7 > 0);", "visit_check_struct(VAR_1, &err);", "visit_end_struct(VAR_1);", "if (err) {", "error_propagate(VAR_4, err);", "return;", "}", "VAR_7--;", "break;", "case FDT_PROP: {", "int VAR_12;", "VAR_9 = fdt_get_property_by_offset(VAR_8, VAR_6, &VAR_10);", "VAR_9 = fdt_string(VAR_8, fdt32_to_cpu(VAR_9->nameoff));", "visit_start_list(VAR_1, VAR_9, &err);", "if (err) {", "error_propagate(VAR_4, err);", "return;", "}", "for (VAR_12 = 0; VAR_12 < VAR_10; VAR_12++) {", "visit_type_uint8(VAR_1, NULL, (uint8_t *)&VAR_9->data[VAR_12], &err);", "if (err) {", "error_propagate(VAR_4, err);", "return;", "}", "}", "visit_end_list(VAR_1);", "break;", "}", "default:\nerror_setg(&error_abort, \"device FDT in unexpected state: %d\", tag);", "}", "VAR_6 = VAR_5;", "} while (VAR_7 != 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 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 ] ]
181
int bdrv_pwrite(BlockDriverState *bs, int64_t offset, const void *buf, int bytes) { QEMUIOVector qiov; struct iovec iov = { .iov_base = (void *) buf, .iov_len = bytes, }; if (bytes < 0) { return -EINVAL; } qemu_iovec_init_external(&qiov, &iov, 1); return bdrv_pwritev(bs, offset, &qiov); }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
int bdrv_pwrite(BlockDriverState *bs, int64_t offset, const void *buf, int bytes) { QEMUIOVector qiov; struct iovec iov = { .iov_base = (void *) buf, .iov_len = bytes, }; if (bytes < 0) { return -EINVAL; } qemu_iovec_init_external(&qiov, &iov, 1); return bdrv_pwritev(bs, offset, &qiov); }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, const void *VAR_2, int VAR_3) { QEMUIOVector qiov; struct iovec VAR_4 = { .iov_base = (void *) VAR_2, .iov_len = VAR_3, }; if (VAR_3 < 0) { return -EINVAL; } qemu_iovec_init_external(&qiov, &VAR_4, 1); return bdrv_pwritev(VAR_0, VAR_1, &qiov); }
[ "int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nconst void *VAR_2, int VAR_3)\n{", "QEMUIOVector qiov;", "struct iovec VAR_4 = {", ".iov_base = (void *) VAR_2,\n.iov_len = VAR_3,\n};", "if (VAR_3 < 0) {", "return -EINVAL;", "}", "qemu_iovec_init_external(&qiov, &VAR_4, 1);", "return bdrv_pwritev(VAR_0, VAR_1, &qiov);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11, 13, 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ] ]
182
static int ppc_fixup_cpu(PowerPCCPU *cpu) { CPUPPCState *env = &cpu->env; /* TCG doesn't (yet) emulate some groups of instructions that * are implemented on some otherwise supported CPUs (e.g. VSX * and decimal floating point instructions on POWER7). We * remove unsupported instruction groups from the cpu state's * instruction masks and hope the guest can cope. For at * least the pseries machine, the unavailability of these * instructions can be advertised to the guest via the device * tree. */ if ((env->insns_flags & ~PPC_TCG_INSNS) || (env->insns_flags2 & ~PPC_TCG_INSNS2)) { fprintf(stderr, "Warning: Disabling some instructions which are not " "emulated by TCG (0x%" PRIx64 ", 0x%" PRIx64 ")\n", env->insns_flags & ~PPC_TCG_INSNS, env->insns_flags2 & ~PPC_TCG_INSNS2); } env->insns_flags &= PPC_TCG_INSNS; env->insns_flags2 &= PPC_TCG_INSNS2; return 0; }
false
qemu
8297be80f7cf71e09617669a8bd8b2836dcfd4c3
static int ppc_fixup_cpu(PowerPCCPU *cpu) { CPUPPCState *env = &cpu->env; if ((env->insns_flags & ~PPC_TCG_INSNS) || (env->insns_flags2 & ~PPC_TCG_INSNS2)) { fprintf(stderr, "Warning: Disabling some instructions which are not " "emulated by TCG (0x%" PRIx64 ", 0x%" PRIx64 ")\n", env->insns_flags & ~PPC_TCG_INSNS, env->insns_flags2 & ~PPC_TCG_INSNS2); } env->insns_flags &= PPC_TCG_INSNS; env->insns_flags2 &= PPC_TCG_INSNS2; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(PowerPCCPU *VAR_0) { CPUPPCState *env = &VAR_0->env; if ((env->insns_flags & ~PPC_TCG_INSNS) || (env->insns_flags2 & ~PPC_TCG_INSNS2)) { fprintf(stderr, "Warning: Disabling some instructions which are not " "emulated by TCG (0x%" PRIx64 ", 0x%" PRIx64 ")\n", env->insns_flags & ~PPC_TCG_INSNS, env->insns_flags2 & ~PPC_TCG_INSNS2); } env->insns_flags &= PPC_TCG_INSNS; env->insns_flags2 &= PPC_TCG_INSNS2; return 0; }
[ "static int FUNC_0(PowerPCCPU *VAR_0)\n{", "CPUPPCState *env = &VAR_0->env;", "if ((env->insns_flags & ~PPC_TCG_INSNS)\n|| (env->insns_flags2 & ~PPC_TCG_INSNS2)) {", "fprintf(stderr, \"Warning: Disabling some instructions which are not \"\n\"emulated by TCG (0x%\" PRIx64 \", 0x%\" PRIx64 \")\\n\",\nenv->insns_flags & ~PPC_TCG_INSNS,\nenv->insns_flags2 & ~PPC_TCG_INSNS2);", "}", "env->insns_flags &= PPC_TCG_INSNS;", "env->insns_flags2 &= PPC_TCG_INSNS2;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 25, 27 ], [ 29, 31, 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
184
void main_loop_wait(int timeout) { IOHandlerRecord *ioh; fd_set rfds, wfds, xfds; int ret, nfds; struct timeval tv; qemu_bh_update_timeout(&timeout); host_main_loop_wait(&timeout); /* poll any events */ /* XXX: separate device handlers from system ones */ nfds = -1; FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (ioh->deleted) continue; if (ioh->fd_read && (!ioh->fd_read_poll || ioh->fd_read_poll(ioh->opaque) != 0)) { FD_SET(ioh->fd, &rfds); if (ioh->fd > nfds) nfds = ioh->fd; } if (ioh->fd_write) { FD_SET(ioh->fd, &wfds); if (ioh->fd > nfds) nfds = ioh->fd; } } tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; slirp_select_fill(&nfds, &rfds, &wfds, &xfds); qemu_mutex_unlock_iothread(); ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv); qemu_mutex_lock_iothread(); if (ret > 0) { IOHandlerRecord **pioh; for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) { ioh->fd_read(ioh->opaque); } if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { ioh->fd_write(ioh->opaque); } } /* remove deleted IO handlers */ pioh = &first_io_handler; while (*pioh) { ioh = *pioh; if (ioh->deleted) { *pioh = ioh->next; qemu_free(ioh); } else pioh = &ioh->next; } } slirp_select_poll(&rfds, &wfds, &xfds, (ret < 0)); /* rearm timer, if not periodic */ if (alarm_timer->flags & ALARM_FLAG_EXPIRED) { alarm_timer->flags &= ~ALARM_FLAG_EXPIRED; qemu_rearm_alarm_timer(alarm_timer); } /* vm time timers */ if (vm_running) { if (!cur_cpu || likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER))) qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL], qemu_get_clock(vm_clock)); } /* real time timers */ qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME], qemu_get_clock(rt_clock)); /* Check bottom-halves last in case any of the earlier events triggered them. */ qemu_bh_poll(); }
false
qemu
0fdddf80a88ac2efe068990d1878f472bb6b95d9
void main_loop_wait(int timeout) { IOHandlerRecord *ioh; fd_set rfds, wfds, xfds; int ret, nfds; struct timeval tv; qemu_bh_update_timeout(&timeout); host_main_loop_wait(&timeout); nfds = -1; FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (ioh->deleted) continue; if (ioh->fd_read && (!ioh->fd_read_poll || ioh->fd_read_poll(ioh->opaque) != 0)) { FD_SET(ioh->fd, &rfds); if (ioh->fd > nfds) nfds = ioh->fd; } if (ioh->fd_write) { FD_SET(ioh->fd, &wfds); if (ioh->fd > nfds) nfds = ioh->fd; } } tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; slirp_select_fill(&nfds, &rfds, &wfds, &xfds); qemu_mutex_unlock_iothread(); ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv); qemu_mutex_lock_iothread(); if (ret > 0) { IOHandlerRecord **pioh; for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) { ioh->fd_read(ioh->opaque); } if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { ioh->fd_write(ioh->opaque); } } pioh = &first_io_handler; while (*pioh) { ioh = *pioh; if (ioh->deleted) { *pioh = ioh->next; qemu_free(ioh); } else pioh = &ioh->next; } } slirp_select_poll(&rfds, &wfds, &xfds, (ret < 0)); if (alarm_timer->flags & ALARM_FLAG_EXPIRED) { alarm_timer->flags &= ~ALARM_FLAG_EXPIRED; qemu_rearm_alarm_timer(alarm_timer); } if (vm_running) { if (!cur_cpu || likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER))) qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL], qemu_get_clock(vm_clock)); } qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME], qemu_get_clock(rt_clock)); qemu_bh_poll(); }
{ "code": [], "line_no": [] }
void FUNC_0(int VAR_0) { IOHandlerRecord *ioh; fd_set rfds, wfds, xfds; int VAR_1, VAR_2; struct timeval VAR_3; qemu_bh_update_timeout(&VAR_0); host_main_loop_wait(&VAR_0); VAR_2 = -1; FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (ioh->deleted) continue; if (ioh->fd_read && (!ioh->fd_read_poll || ioh->fd_read_poll(ioh->opaque) != 0)) { FD_SET(ioh->fd, &rfds); if (ioh->fd > VAR_2) VAR_2 = ioh->fd; } if (ioh->fd_write) { FD_SET(ioh->fd, &wfds); if (ioh->fd > VAR_2) VAR_2 = ioh->fd; } } VAR_3.tv_sec = VAR_0 / 1000; VAR_3.tv_usec = (VAR_0 % 1000) * 1000; slirp_select_fill(&VAR_2, &rfds, &wfds, &xfds); qemu_mutex_unlock_iothread(); VAR_1 = select(VAR_2 + 1, &rfds, &wfds, &xfds, &VAR_3); qemu_mutex_lock_iothread(); if (VAR_1 > 0) { IOHandlerRecord **pioh; for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) { ioh->fd_read(ioh->opaque); } if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { ioh->fd_write(ioh->opaque); } } pioh = &first_io_handler; while (*pioh) { ioh = *pioh; if (ioh->deleted) { *pioh = ioh->next; qemu_free(ioh); } else pioh = &ioh->next; } } slirp_select_poll(&rfds, &wfds, &xfds, (VAR_1 < 0)); if (alarm_timer->flags & ALARM_FLAG_EXPIRED) { alarm_timer->flags &= ~ALARM_FLAG_EXPIRED; qemu_rearm_alarm_timer(alarm_timer); } if (vm_running) { if (!cur_cpu || likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER))) qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL], qemu_get_clock(vm_clock)); } qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME], qemu_get_clock(rt_clock)); qemu_bh_poll(); }
[ "void FUNC_0(int VAR_0)\n{", "IOHandlerRecord *ioh;", "fd_set rfds, wfds, xfds;", "int VAR_1, VAR_2;", "struct timeval VAR_3;", "qemu_bh_update_timeout(&VAR_0);", "host_main_loop_wait(&VAR_0);", "VAR_2 = -1;", "FD_ZERO(&rfds);", "FD_ZERO(&wfds);", "FD_ZERO(&xfds);", "for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) {", "if (ioh->deleted)\ncontinue;", "if (ioh->fd_read &&\n(!ioh->fd_read_poll ||\nioh->fd_read_poll(ioh->opaque) != 0)) {", "FD_SET(ioh->fd, &rfds);", "if (ioh->fd > VAR_2)\nVAR_2 = ioh->fd;", "}", "if (ioh->fd_write) {", "FD_SET(ioh->fd, &wfds);", "if (ioh->fd > VAR_2)\nVAR_2 = ioh->fd;", "}", "}", "VAR_3.tv_sec = VAR_0 / 1000;", "VAR_3.tv_usec = (VAR_0 % 1000) * 1000;", "slirp_select_fill(&VAR_2, &rfds, &wfds, &xfds);", "qemu_mutex_unlock_iothread();", "VAR_1 = select(VAR_2 + 1, &rfds, &wfds, &xfds, &VAR_3);", "qemu_mutex_lock_iothread();", "if (VAR_1 > 0) {", "IOHandlerRecord **pioh;", "for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) {", "if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) {", "ioh->fd_read(ioh->opaque);", "}", "if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) {", "ioh->fd_write(ioh->opaque);", "}", "}", "pioh = &first_io_handler;", "while (*pioh) {", "ioh = *pioh;", "if (ioh->deleted) {", "*pioh = ioh->next;", "qemu_free(ioh);", "} else", "pioh = &ioh->next;", "}", "}", "slirp_select_poll(&rfds, &wfds, &xfds, (VAR_1 < 0));", "if (alarm_timer->flags & ALARM_FLAG_EXPIRED) {", "alarm_timer->flags &= ~ALARM_FLAG_EXPIRED;", "qemu_rearm_alarm_timer(alarm_timer);", "}", "if (vm_running) {", "if (!cur_cpu || likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER)))\nqemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL],\nqemu_get_clock(vm_clock));", "}", "qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME],\nqemu_get_clock(rt_clock));", "qemu_bh_poll();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41, 43, 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 151 ], [ 153, 155, 157 ], [ 159 ], [ 165, 167 ], [ 175 ], [ 179 ] ]
186
av_cold int ff_rate_control_init(MpegEncContext *s) { RateControlContext *rcc = &s->rc_context; int i, res; static const char * const const_names[] = { "PI", "E", "iTex", "pTex", "tex", "mv", "fCode", "iCount", "mcVar", "var", "isI", "isP", "isB", "avgQP", "qComp", #if 0 "lastIQP", "lastPQP", "lastBQP", "nextNonBQP", #endif "avgIITex", "avgPITex", "avgPPTex", "avgBPTex", "avgTex", NULL }; static double (* const func1[])(void *, double) = { (void *)bits2qp, (void *)qp2bits, NULL }; static const char * const func1_names[] = { "bits2qp", "qp2bits", NULL }; emms_c(); res = av_expr_parse(&rcc->rc_eq_eval, s->rc_eq ? s->rc_eq : "tex^qComp", const_names, func1_names, func1, NULL, NULL, 0, s->avctx); if (res < 0) { av_log(s->avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\"\n", s->rc_eq); return res; } for (i = 0; i < 5; i++) { rcc->pred[i].coeff = FF_QP2LAMBDA * 7.0; rcc->pred[i].count = 1.0; rcc->pred[i].decay = 0.4; rcc->i_cplx_sum [i] = rcc->p_cplx_sum [i] = rcc->mv_bits_sum[i] = rcc->qscale_sum [i] = rcc->frame_count[i] = 1; // 1 is better because of 1/0 and such rcc->last_qscale_for[i] = FF_QP2LAMBDA * 5; } rcc->buffer_index = s->avctx->rc_initial_buffer_occupancy; if (s->avctx->flags & CODEC_FLAG_PASS2) { int i; char *p; /* find number of pics */ p = s->avctx->stats_in; for (i = -1; p; i++) p = strchr(p + 1, ';'); i += s->max_b_frames; if (i <= 0 || i >= INT_MAX / sizeof(RateControlEntry)) return -1; rcc->entry = av_mallocz(i * sizeof(RateControlEntry)); rcc->num_entries = i; /* init all to skipped p frames * (with b frames we might have a not encoded frame at the end FIXME) */ for (i = 0; i < rcc->num_entries; i++) { RateControlEntry *rce = &rcc->entry[i]; rce->pict_type = rce->new_pict_type = AV_PICTURE_TYPE_P; rce->qscale = rce->new_qscale = FF_QP2LAMBDA * 2; rce->misc_bits = s->mb_num + 10; rce->mb_var_sum = s->mb_num * 100; } /* read stats */ p = s->avctx->stats_in; for (i = 0; i < rcc->num_entries - s->max_b_frames; i++) { RateControlEntry *rce; int picture_number; int e; char *next; next = strchr(p, ';'); if (next) { (*next) = 0; // sscanf in unbelievably slow on looong strings // FIXME copy / do not write next++; } e = sscanf(p, " in:%d ", &picture_number); assert(picture_number >= 0); assert(picture_number < rcc->num_entries); rce = &rcc->entry[picture_number]; e += sscanf(p, " in:%*d out:%*d type:%d q:%f itex:%d ptex:%d mv:%d misc:%d fcode:%d bcode:%d mc-var:%d var:%d icount:%d skipcount:%d hbits:%d", &rce->pict_type, &rce->qscale, &rce->i_tex_bits, &rce->p_tex_bits, &rce->mv_bits, &rce->misc_bits, &rce->f_code, &rce->b_code, &rce->mc_mb_var_sum, &rce->mb_var_sum, &rce->i_count, &rce->skip_count, &rce->header_bits); if (e != 14) { av_log(s->avctx, AV_LOG_ERROR, "statistics are damaged at line %d, parser out=%d\n", i, e); return -1; } p = next; } if (init_pass2(s) < 0) return -1; // FIXME maybe move to end if ((s->avctx->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) { #if CONFIG_LIBXVID return ff_xvid_rate_control_init(s); #else av_log(s->avctx, AV_LOG_ERROR, "Xvid ratecontrol requires libavcodec compiled with Xvid support.\n"); return -1; #endif } } if (!(s->avctx->flags & CODEC_FLAG_PASS2)) { rcc->short_term_qsum = 0.001; rcc->short_term_qcount = 0.001; rcc->pass1_rc_eq_output_sum = 0.001; rcc->pass1_wanted_bits = 0.001; if (s->avctx->qblur > 1.0) { av_log(s->avctx, AV_LOG_ERROR, "qblur too large\n"); return -1; } /* init stuff with the user specified complexity */ if (s->rc_initial_cplx) { for (i = 0; i < 60 * 30; i++) { double bits = s->rc_initial_cplx * (i / 10000.0 + 1.0) * s->mb_num; RateControlEntry rce; if (i % ((s->gop_size + 3) / 4) == 0) rce.pict_type = AV_PICTURE_TYPE_I; else if (i % (s->max_b_frames + 1)) rce.pict_type = AV_PICTURE_TYPE_B; else rce.pict_type = AV_PICTURE_TYPE_P; rce.new_pict_type = rce.pict_type; rce.mc_mb_var_sum = bits * s->mb_num / 100000; rce.mb_var_sum = s->mb_num; rce.qscale = FF_QP2LAMBDA * 2; rce.f_code = 2; rce.b_code = 1; rce.misc_bits = 1; if (s->pict_type == AV_PICTURE_TYPE_I) { rce.i_count = s->mb_num; rce.i_tex_bits = bits; rce.p_tex_bits = 0; rce.mv_bits = 0; } else { rce.i_count = 0; // FIXME we do know this approx rce.i_tex_bits = 0; rce.p_tex_bits = bits * 0.9; rce.mv_bits = bits * 0.1; } rcc->i_cplx_sum[rce.pict_type] += rce.i_tex_bits * rce.qscale; rcc->p_cplx_sum[rce.pict_type] += rce.p_tex_bits * rce.qscale; rcc->mv_bits_sum[rce.pict_type] += rce.mv_bits; rcc->frame_count[rce.pict_type]++; get_qscale(s, &rce, rcc->pass1_wanted_bits / rcc->pass1_rc_eq_output_sum, i); // FIXME misbehaves a little for variable fps rcc->pass1_wanted_bits += s->bit_rate / (1 / av_q2d(s->avctx->time_base)); } } } return 0; }
false
FFmpeg
42df71d9bbb1a5b4bce0bb34417692565c72d390
av_cold int ff_rate_control_init(MpegEncContext *s) { RateControlContext *rcc = &s->rc_context; int i, res; static const char * const const_names[] = { "PI", "E", "iTex", "pTex", "tex", "mv", "fCode", "iCount", "mcVar", "var", "isI", "isP", "isB", "avgQP", "qComp", #if 0 "lastIQP", "lastPQP", "lastBQP", "nextNonBQP", #endif "avgIITex", "avgPITex", "avgPPTex", "avgBPTex", "avgTex", NULL }; static double (* const func1[])(void *, double) = { (void *)bits2qp, (void *)qp2bits, NULL }; static const char * const func1_names[] = { "bits2qp", "qp2bits", NULL }; emms_c(); res = av_expr_parse(&rcc->rc_eq_eval, s->rc_eq ? s->rc_eq : "tex^qComp", const_names, func1_names, func1, NULL, NULL, 0, s->avctx); if (res < 0) { av_log(s->avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\"\n", s->rc_eq); return res; } for (i = 0; i < 5; i++) { rcc->pred[i].coeff = FF_QP2LAMBDA * 7.0; rcc->pred[i].count = 1.0; rcc->pred[i].decay = 0.4; rcc->i_cplx_sum [i] = rcc->p_cplx_sum [i] = rcc->mv_bits_sum[i] = rcc->qscale_sum [i] = rcc->frame_count[i] = 1; rcc->last_qscale_for[i] = FF_QP2LAMBDA * 5; } rcc->buffer_index = s->avctx->rc_initial_buffer_occupancy; if (s->avctx->flags & CODEC_FLAG_PASS2) { int i; char *p; p = s->avctx->stats_in; for (i = -1; p; i++) p = strchr(p + 1, ';'); i += s->max_b_frames; if (i <= 0 || i >= INT_MAX / sizeof(RateControlEntry)) return -1; rcc->entry = av_mallocz(i * sizeof(RateControlEntry)); rcc->num_entries = i; for (i = 0; i < rcc->num_entries; i++) { RateControlEntry *rce = &rcc->entry[i]; rce->pict_type = rce->new_pict_type = AV_PICTURE_TYPE_P; rce->qscale = rce->new_qscale = FF_QP2LAMBDA * 2; rce->misc_bits = s->mb_num + 10; rce->mb_var_sum = s->mb_num * 100; } p = s->avctx->stats_in; for (i = 0; i < rcc->num_entries - s->max_b_frames; i++) { RateControlEntry *rce; int picture_number; int e; char *next; next = strchr(p, ';'); if (next) { (*next) = 0; next++; } e = sscanf(p, " in:%d ", &picture_number); assert(picture_number >= 0); assert(picture_number < rcc->num_entries); rce = &rcc->entry[picture_number]; e += sscanf(p, " in:%*d out:%*d type:%d q:%f itex:%d ptex:%d mv:%d misc:%d fcode:%d bcode:%d mc-var:%d var:%d icount:%d skipcount:%d hbits:%d", &rce->pict_type, &rce->qscale, &rce->i_tex_bits, &rce->p_tex_bits, &rce->mv_bits, &rce->misc_bits, &rce->f_code, &rce->b_code, &rce->mc_mb_var_sum, &rce->mb_var_sum, &rce->i_count, &rce->skip_count, &rce->header_bits); if (e != 14) { av_log(s->avctx, AV_LOG_ERROR, "statistics are damaged at line %d, parser out=%d\n", i, e); return -1; } p = next; } if (init_pass2(s) < 0) return -1; if ((s->avctx->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) { #if CONFIG_LIBXVID return ff_xvid_rate_control_init(s); #else av_log(s->avctx, AV_LOG_ERROR, "Xvid ratecontrol requires libavcodec compiled with Xvid support.\n"); return -1; #endif } } if (!(s->avctx->flags & CODEC_FLAG_PASS2)) { rcc->short_term_qsum = 0.001; rcc->short_term_qcount = 0.001; rcc->pass1_rc_eq_output_sum = 0.001; rcc->pass1_wanted_bits = 0.001; if (s->avctx->qblur > 1.0) { av_log(s->avctx, AV_LOG_ERROR, "qblur too large\n"); return -1; } if (s->rc_initial_cplx) { for (i = 0; i < 60 * 30; i++) { double bits = s->rc_initial_cplx * (i / 10000.0 + 1.0) * s->mb_num; RateControlEntry rce; if (i % ((s->gop_size + 3) / 4) == 0) rce.pict_type = AV_PICTURE_TYPE_I; else if (i % (s->max_b_frames + 1)) rce.pict_type = AV_PICTURE_TYPE_B; else rce.pict_type = AV_PICTURE_TYPE_P; rce.new_pict_type = rce.pict_type; rce.mc_mb_var_sum = bits * s->mb_num / 100000; rce.mb_var_sum = s->mb_num; rce.qscale = FF_QP2LAMBDA * 2; rce.f_code = 2; rce.b_code = 1; rce.misc_bits = 1; if (s->pict_type == AV_PICTURE_TYPE_I) { rce.i_count = s->mb_num; rce.i_tex_bits = bits; rce.p_tex_bits = 0; rce.mv_bits = 0; } else { rce.i_count = 0; rce.i_tex_bits = 0; rce.p_tex_bits = bits * 0.9; rce.mv_bits = bits * 0.1; } rcc->i_cplx_sum[rce.pict_type] += rce.i_tex_bits * rce.qscale; rcc->p_cplx_sum[rce.pict_type] += rce.p_tex_bits * rce.qscale; rcc->mv_bits_sum[rce.pict_type] += rce.mv_bits; rcc->frame_count[rce.pict_type]++; get_qscale(s, &rce, rcc->pass1_wanted_bits / rcc->pass1_rc_eq_output_sum, i); rcc->pass1_wanted_bits += s->bit_rate / (1 / av_q2d(s->avctx->time_base)); } } } return 0; }
{ "code": [], "line_no": [] }
VAR_5av_coldVAR_5 VAR_5intVAR_5 VAR_5ff_rate_control_initVAR_5(VAR_5MpegEncContextVAR_5 *VAR_5sVAR_5) { VAR_5RateControlContextVAR_5 *VAR_5rccVAR_5 = &VAR_5sVAR_5->VAR_5rc_contextVAR_5; VAR_5intVAR_5 VAR_5VAR_6VAR_5, VAR_5VAR_1VAR_5; VAR_5staticVAR_5 VAR_5constVAR_5 VAR_5charVAR_5 * VAR_5constVAR_5 VAR_5VAR_2VAR_5[] = { "VAR_5PIVAR_5", "VAR_5EVAR_5", "VAR_5iTexVAR_5", "VAR_5pTexVAR_5", "VAR_5texVAR_5", "VAR_5mvVAR_5", "VAR_5fCodeVAR_5", "VAR_5iCountVAR_5", "VAR_5mcVarVAR_5", "VAR_5varVAR_5", "VAR_5isIVAR_5", "VAR_5isPVAR_5", "VAR_5isBVAR_5", "VAR_5avgQPVAR_5", "VAR_5qCompVAR_5", #VAR_5ifVAR_5 VAR_50VAR_5 "VAR_5lastIQPVAR_5", "VAR_5lastPQPVAR_5", "VAR_5lastBQPVAR_5", "VAR_5nextNonBQPVAR_5", #VAR_5endifVAR_5 "VAR_5avgIITexVAR_5", "VAR_5avgPITexVAR_5", "VAR_5avgPPTexVAR_5", "VAR_5avgBPTexVAR_5", "VAR_5avgTexVAR_5", VAR_5NULLVAR_5 }; VAR_5staticVAR_5 VAR_5doubleVAR_5 (* VAR_5constVAR_5 VAR_5VAR_3VAR_5[])(VAR_5voidVAR_5 *, VAR_5doubleVAR_5) = { (VAR_5voidVAR_5 *)VAR_5bits2qpVAR_5, (VAR_5voidVAR_5 *)VAR_5qp2bitsVAR_5, VAR_5NULLVAR_5 }; VAR_5staticVAR_5 VAR_5constVAR_5 VAR_5charVAR_5 * VAR_5constVAR_5 VAR_5func1_namesVAR_5[] = { "VAR_5bits2qpVAR_5", "VAR_5qp2bitsVAR_5", VAR_5NULLVAR_5 }; VAR_5emms_cVAR_5(); VAR_5VAR_1VAR_5 = VAR_5av_expr_parseVAR_5(&VAR_5rccVAR_5->VAR_5rc_eq_evalVAR_5, VAR_5sVAR_5->VAR_5rc_eqVAR_5 ? VAR_5sVAR_5->VAR_5rc_eqVAR_5 : "VAR_5texVAR_5^VAR_5qCompVAR_5", VAR_5VAR_2VAR_5, VAR_5func1_namesVAR_5, VAR_5VAR_3VAR_5, VAR_5NULLVAR_5, VAR_5NULLVAR_5, VAR_50VAR_5, VAR_5sVAR_5->VAR_5avctxVAR_5); VAR_5ifVAR_5 (VAR_5VAR_1VAR_5 < VAR_50VAR_5) { VAR_5av_logVAR_5(VAR_5sVAR_5->VAR_5avctxVAR_5, VAR_5AV_LOG_ERRORVAR_5, "VAR_5ErrorVAR_5 VAR_5parsingVAR_5 VAR_5rc_eqVAR_5 \"%VAR_5sVAR_5\"\VAR_5nVAR_5", VAR_5sVAR_5->VAR_5rc_eqVAR_5); VAR_5returnVAR_5 VAR_5VAR_1VAR_5; } VAR_5forVAR_5 (VAR_5VAR_6VAR_5 = VAR_50VAR_5; VAR_5VAR_6VAR_5 < VAR_55VAR_5; VAR_5VAR_6VAR_5++) { VAR_5rccVAR_5->VAR_5predVAR_5[VAR_5VAR_6VAR_5].VAR_5coeffVAR_5 = VAR_5FF_QP2LAMBDAVAR_5 * VAR_57VAR_5.VAR_50VAR_5; VAR_5rccVAR_5->VAR_5predVAR_5[VAR_5VAR_6VAR_5].VAR_5countVAR_5 = VAR_51VAR_5.VAR_50VAR_5; VAR_5rccVAR_5->VAR_5predVAR_5[VAR_5VAR_6VAR_5].VAR_5decayVAR_5 = VAR_50VAR_5.VAR_54VAR_5; VAR_5rccVAR_5->VAR_5i_cplx_sumVAR_5 [VAR_5VAR_6VAR_5] = VAR_5rccVAR_5->VAR_5p_cplx_sumVAR_5 [VAR_5VAR_6VAR_5] = VAR_5rccVAR_5->VAR_5mv_bits_sumVAR_5[VAR_5VAR_6VAR_5] = VAR_5rccVAR_5->VAR_5qscale_sumVAR_5 [VAR_5VAR_6VAR_5] = VAR_5rccVAR_5->VAR_5frame_countVAR_5[VAR_5VAR_6VAR_5] = VAR_51VAR_5; VAR_5rccVAR_5->VAR_5last_qscale_forVAR_5[VAR_5VAR_6VAR_5] = VAR_5FF_QP2LAMBDAVAR_5 * VAR_55VAR_5; } VAR_5rccVAR_5->VAR_5buffer_indexVAR_5 = VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5rc_initial_buffer_occupancyVAR_5; VAR_5ifVAR_5 (VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5flagsVAR_5 & VAR_5CODEC_FLAG_PASS2VAR_5) { VAR_5intVAR_5 VAR_5VAR_6VAR_5; VAR_5charVAR_5 *VAR_5pVAR_5; VAR_5pVAR_5 = VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5stats_inVAR_5; VAR_5forVAR_5 (VAR_5VAR_6VAR_5 = -VAR_51VAR_5; VAR_5pVAR_5; VAR_5VAR_6VAR_5++) VAR_5pVAR_5 = VAR_5strchrVAR_5(VAR_5pVAR_5 + VAR_51VAR_5, ';'); VAR_5VAR_6VAR_5 += VAR_5sVAR_5->VAR_5max_b_framesVAR_5; VAR_5ifVAR_5 (VAR_5VAR_6VAR_5 <= VAR_50VAR_5 || VAR_5VAR_6VAR_5 >= VAR_5INT_MAXVAR_5 / VAR_5sizeofVAR_5(VAR_5RateControlEntryVAR_5)) VAR_5returnVAR_5 -VAR_51VAR_5; VAR_5rccVAR_5->VAR_5entryVAR_5 = VAR_5av_malloczVAR_5(VAR_5VAR_6VAR_5 * VAR_5sizeofVAR_5(VAR_5RateControlEntryVAR_5)); VAR_5rccVAR_5->VAR_5num_entriesVAR_5 = VAR_5VAR_6VAR_5; VAR_5forVAR_5 (VAR_5VAR_6VAR_5 = VAR_50VAR_5; VAR_5VAR_6VAR_5 < VAR_5rccVAR_5->VAR_5num_entriesVAR_5; VAR_5VAR_6VAR_5++) { VAR_5RateControlEntryVAR_5 *VAR_5rceVAR_5 = &VAR_5rccVAR_5->VAR_5entryVAR_5[VAR_5VAR_6VAR_5]; VAR_5rceVAR_5->VAR_5pict_typeVAR_5 = VAR_5rceVAR_5->VAR_5new_pict_typeVAR_5 = VAR_5AV_PICTURE_TYPE_PVAR_5; VAR_5rceVAR_5->VAR_5qscaleVAR_5 = VAR_5rceVAR_5->VAR_5new_qscaleVAR_5 = VAR_5FF_QP2LAMBDAVAR_5 * VAR_52VAR_5; VAR_5rceVAR_5->VAR_5misc_bitsVAR_5 = VAR_5sVAR_5->VAR_5mb_numVAR_5 + VAR_510VAR_5; VAR_5rceVAR_5->VAR_5mb_var_sumVAR_5 = VAR_5sVAR_5->VAR_5mb_numVAR_5 * VAR_5100VAR_5; } VAR_5pVAR_5 = VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5stats_inVAR_5; VAR_5forVAR_5 (VAR_5VAR_6VAR_5 = VAR_50VAR_5; VAR_5VAR_6VAR_5 < VAR_5rccVAR_5->VAR_5num_entriesVAR_5 - VAR_5sVAR_5->VAR_5max_b_framesVAR_5; VAR_5VAR_6VAR_5++) { VAR_5RateControlEntryVAR_5 *VAR_5rceVAR_5; VAR_5intVAR_5 VAR_5picture_numberVAR_5; VAR_5intVAR_5 VAR_5eVAR_5; VAR_5charVAR_5 *VAR_5nextVAR_5; VAR_5nextVAR_5 = VAR_5strchrVAR_5(VAR_5pVAR_5, ';'); VAR_5ifVAR_5 (VAR_5nextVAR_5) { (*VAR_5nextVAR_5) = VAR_50VAR_5; VAR_5nextVAR_5++; } VAR_5eVAR_5 = VAR_5sscanfVAR_5(VAR_5pVAR_5, " VAR_5inVAR_5:%VAR_5dVAR_5 ", &VAR_5picture_numberVAR_5); VAR_5assertVAR_5(VAR_5picture_numberVAR_5 >= VAR_50VAR_5); VAR_5assertVAR_5(VAR_5picture_numberVAR_5 < VAR_5rccVAR_5->VAR_5num_entriesVAR_5); VAR_5rceVAR_5 = &VAR_5rccVAR_5->VAR_5entryVAR_5[VAR_5picture_numberVAR_5]; VAR_5eVAR_5 += VAR_5sscanfVAR_5(VAR_5pVAR_5, " VAR_5inVAR_5:%*VAR_5dVAR_5 VAR_5outVAR_5:%*VAR_5dVAR_5 VAR_5typeVAR_5:%VAR_5dVAR_5 VAR_5qVAR_5:%VAR_5fVAR_5 VAR_5itexVAR_5:%VAR_5dVAR_5 VAR_5ptexVAR_5:%VAR_5dVAR_5 VAR_5mvVAR_5:%VAR_5dVAR_5 VAR_5miscVAR_5:%VAR_5dVAR_5 VAR_5fcodeVAR_5:%VAR_5dVAR_5 VAR_5bcodeVAR_5:%VAR_5dVAR_5 VAR_5mcVAR_5-VAR_5varVAR_5:%VAR_5dVAR_5 VAR_5varVAR_5:%VAR_5dVAR_5 VAR_5icountVAR_5:%VAR_5dVAR_5 VAR_5skipcountVAR_5:%VAR_5dVAR_5 VAR_5hbitsVAR_5:%VAR_5dVAR_5", &VAR_5rceVAR_5->VAR_5pict_typeVAR_5, &VAR_5rceVAR_5->VAR_5qscaleVAR_5, &VAR_5rceVAR_5->VAR_5i_tex_bitsVAR_5, &VAR_5rceVAR_5->VAR_5p_tex_bitsVAR_5, &VAR_5rceVAR_5->VAR_5mv_bitsVAR_5, &VAR_5rceVAR_5->VAR_5misc_bitsVAR_5, &VAR_5rceVAR_5->VAR_5f_codeVAR_5, &VAR_5rceVAR_5->VAR_5b_codeVAR_5, &VAR_5rceVAR_5->VAR_5mc_mb_var_sumVAR_5, &VAR_5rceVAR_5->VAR_5mb_var_sumVAR_5, &VAR_5rceVAR_5->VAR_5i_countVAR_5, &VAR_5rceVAR_5->VAR_5skip_countVAR_5, &VAR_5rceVAR_5->VAR_5header_bitsVAR_5); VAR_5ifVAR_5 (VAR_5eVAR_5 != VAR_514VAR_5) { VAR_5av_logVAR_5(VAR_5sVAR_5->VAR_5avctxVAR_5, VAR_5AV_LOG_ERRORVAR_5, "VAR_5statisticsVAR_5 VAR_5areVAR_5 VAR_5damagedVAR_5 VAR_5atVAR_5 VAR_5lineVAR_5 %VAR_5dVAR_5, VAR_5parserVAR_5 VAR_5outVAR_5=%VAR_5dVAR_5\VAR_5nVAR_5", VAR_5VAR_6VAR_5, VAR_5eVAR_5); VAR_5returnVAR_5 -VAR_51VAR_5; } VAR_5pVAR_5 = VAR_5nextVAR_5; } VAR_5ifVAR_5 (VAR_5init_pass2VAR_5(VAR_5sVAR_5) < VAR_50VAR_5) VAR_5returnVAR_5 -VAR_51VAR_5; VAR_5ifVAR_5 ((VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5flagsVAR_5 & VAR_5CODEC_FLAG_PASS2VAR_5) && VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5rc_strategyVAR_5 == VAR_5FF_RC_STRATEGY_XVIDVAR_5) { #VAR_5ifVAR_5 VAR_5CONFIG_LIBXVIDVAR_5 VAR_5returnVAR_5 VAR_5ff_xvid_rate_control_initVAR_5(VAR_5sVAR_5); #VAR_5elseVAR_5 VAR_5av_logVAR_5(VAR_5sVAR_5->VAR_5avctxVAR_5, VAR_5AV_LOG_ERRORVAR_5, "VAR_5XvidVAR_5 VAR_5ratecontrolVAR_5 VAR_5requiresVAR_5 VAR_5libavcodecVAR_5 VAR_5compiledVAR_5 VAR_5withVAR_5 VAR_5XvidVAR_5 VAR_5supportVAR_5.\VAR_5nVAR_5"); VAR_5returnVAR_5 -VAR_51VAR_5; #VAR_5endifVAR_5 } } VAR_5ifVAR_5 (!(VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5flagsVAR_5 & VAR_5CODEC_FLAG_PASS2VAR_5)) { VAR_5rccVAR_5->VAR_5short_term_qsumVAR_5 = VAR_50VAR_5.VAR_5001VAR_5; VAR_5rccVAR_5->VAR_5short_term_qcountVAR_5 = VAR_50VAR_5.VAR_5001VAR_5; VAR_5rccVAR_5->VAR_5pass1_rc_eq_output_sumVAR_5 = VAR_50VAR_5.VAR_5001VAR_5; VAR_5rccVAR_5->VAR_5pass1_wanted_bitsVAR_5 = VAR_50VAR_5.VAR_5001VAR_5; VAR_5ifVAR_5 (VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5qblurVAR_5 > VAR_51VAR_5.VAR_50VAR_5) { VAR_5av_logVAR_5(VAR_5sVAR_5->VAR_5avctxVAR_5, VAR_5AV_LOG_ERRORVAR_5, "VAR_5qblurVAR_5 VAR_5tooVAR_5 VAR_5largeVAR_5\VAR_5nVAR_5"); VAR_5returnVAR_5 -VAR_51VAR_5; } VAR_5ifVAR_5 (VAR_5sVAR_5->VAR_5rc_initial_cplxVAR_5) { VAR_5forVAR_5 (VAR_5VAR_6VAR_5 = VAR_50VAR_5; VAR_5VAR_6VAR_5 < VAR_560VAR_5 * VAR_530VAR_5; VAR_5VAR_6VAR_5++) { VAR_5doubleVAR_5 VAR_5bitsVAR_5 = VAR_5sVAR_5->VAR_5rc_initial_cplxVAR_5 * (VAR_5VAR_6VAR_5 / VAR_510000VAR_5.VAR_50VAR_5 + VAR_51VAR_5.VAR_50VAR_5) * VAR_5sVAR_5->VAR_5mb_numVAR_5; VAR_5RateControlEntryVAR_5 VAR_5rceVAR_5; VAR_5ifVAR_5 (VAR_5VAR_6VAR_5 % ((VAR_5sVAR_5->VAR_5gop_sizeVAR_5 + VAR_53VAR_5) / VAR_54VAR_5) == VAR_50VAR_5) VAR_5rceVAR_5.VAR_5pict_typeVAR_5 = VAR_5AV_PICTURE_TYPE_IVAR_5; VAR_5elseVAR_5 VAR_5ifVAR_5 (VAR_5VAR_6VAR_5 % (VAR_5sVAR_5->VAR_5max_b_framesVAR_5 + VAR_51VAR_5)) VAR_5rceVAR_5.VAR_5pict_typeVAR_5 = VAR_5AV_PICTURE_TYPE_BVAR_5; VAR_5elseVAR_5 VAR_5rceVAR_5.VAR_5pict_typeVAR_5 = VAR_5AV_PICTURE_TYPE_PVAR_5; VAR_5rceVAR_5.VAR_5new_pict_typeVAR_5 = VAR_5rceVAR_5.VAR_5pict_typeVAR_5; VAR_5rceVAR_5.VAR_5mc_mb_var_sumVAR_5 = VAR_5bitsVAR_5 * VAR_5sVAR_5->VAR_5mb_numVAR_5 / VAR_5100000VAR_5; VAR_5rceVAR_5.VAR_5mb_var_sumVAR_5 = VAR_5sVAR_5->VAR_5mb_numVAR_5; VAR_5rceVAR_5.VAR_5qscaleVAR_5 = VAR_5FF_QP2LAMBDAVAR_5 * VAR_52VAR_5; VAR_5rceVAR_5.VAR_5f_codeVAR_5 = VAR_52VAR_5; VAR_5rceVAR_5.VAR_5b_codeVAR_5 = VAR_51VAR_5; VAR_5rceVAR_5.VAR_5misc_bitsVAR_5 = VAR_51VAR_5; VAR_5ifVAR_5 (VAR_5sVAR_5->VAR_5pict_typeVAR_5 == VAR_5AV_PICTURE_TYPE_IVAR_5) { VAR_5rceVAR_5.VAR_5i_countVAR_5 = VAR_5sVAR_5->VAR_5mb_numVAR_5; VAR_5rceVAR_5.VAR_5i_tex_bitsVAR_5 = VAR_5bitsVAR_5; VAR_5rceVAR_5.VAR_5p_tex_bitsVAR_5 = VAR_50VAR_5; VAR_5rceVAR_5.VAR_5mv_bitsVAR_5 = VAR_50VAR_5; } VAR_5elseVAR_5 { VAR_5rceVAR_5.VAR_5i_countVAR_5 = VAR_50VAR_5; VAR_5rceVAR_5.VAR_5i_tex_bitsVAR_5 = VAR_50VAR_5; VAR_5rceVAR_5.VAR_5p_tex_bitsVAR_5 = VAR_5bitsVAR_5 * VAR_50VAR_5.VAR_59VAR_5; VAR_5rceVAR_5.VAR_5mv_bitsVAR_5 = VAR_5bitsVAR_5 * VAR_50VAR_5.VAR_51VAR_5; } VAR_5rccVAR_5->VAR_5i_cplx_sumVAR_5[VAR_5rceVAR_5.VAR_5pict_typeVAR_5] += VAR_5rceVAR_5.VAR_5i_tex_bitsVAR_5 * VAR_5rceVAR_5.VAR_5qscaleVAR_5; VAR_5rccVAR_5->VAR_5p_cplx_sumVAR_5[VAR_5rceVAR_5.VAR_5pict_typeVAR_5] += VAR_5rceVAR_5.VAR_5p_tex_bitsVAR_5 * VAR_5rceVAR_5.VAR_5qscaleVAR_5; VAR_5rccVAR_5->VAR_5mv_bits_sumVAR_5[VAR_5rceVAR_5.VAR_5pict_typeVAR_5] += VAR_5rceVAR_5.VAR_5mv_bitsVAR_5; VAR_5rccVAR_5->VAR_5frame_countVAR_5[VAR_5rceVAR_5.VAR_5pict_typeVAR_5]++; VAR_5get_qscaleVAR_5(VAR_5sVAR_5, &VAR_5rceVAR_5, VAR_5rccVAR_5->VAR_5pass1_wanted_bitsVAR_5 / VAR_5rccVAR_5->VAR_5pass1_rc_eq_output_sumVAR_5, VAR_5VAR_6VAR_5); VAR_5rccVAR_5->VAR_5pass1_wanted_bitsVAR_5 += VAR_5sVAR_5->VAR_5bit_rateVAR_5 / (VAR_51VAR_5 / VAR_5av_q2dVAR_5(VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5time_baseVAR_5)); } } } VAR_5returnVAR_5 VAR_50VAR_5; }
[ "VAR_5av_coldVAR_5 VAR_5intVAR_5 VAR_5ff_rate_control_initVAR_5(VAR_5MpegEncContextVAR_5 *VAR_5sVAR_5)\n{", "VAR_5RateControlContextVAR_5 *VAR_5rccVAR_5 = &VAR_5sVAR_5->VAR_5rc_contextVAR_5;", "VAR_5intVAR_5 VAR_5VAR_6VAR_5, VAR_5VAR_1VAR_5;", "VAR_5staticVAR_5 VAR_5constVAR_5 VAR_5charVAR_5 * VAR_5constVAR_5 VAR_5VAR_2VAR_5[] = {", "\"VAR_5PIVAR_5\",\n\"VAR_5EVAR_5\",\n\"VAR_5iTexVAR_5\",\n\"VAR_5pTexVAR_5\",\n\"VAR_5texVAR_5\",\n\"VAR_5mvVAR_5\",\n\"VAR_5fCodeVAR_5\",\n\"VAR_5iCountVAR_5\",\n\"VAR_5mcVarVAR_5\",\n\"VAR_5varVAR_5\",\n\"VAR_5isIVAR_5\",\n\"VAR_5isPVAR_5\",\n\"VAR_5isBVAR_5\",\n\"VAR_5avgQPVAR_5\",\n\"VAR_5qCompVAR_5\",\n#VAR_5ifVAR_5 VAR_50VAR_5\n\"VAR_5lastIQPVAR_5\",\n\"VAR_5lastPQPVAR_5\",\n\"VAR_5lastBQPVAR_5\",\n\"VAR_5nextNonBQPVAR_5\",\n#VAR_5endifVAR_5\n\"VAR_5avgIITexVAR_5\",\n\"VAR_5avgPITexVAR_5\",\n\"VAR_5avgPPTexVAR_5\",\n\"VAR_5avgBPTexVAR_5\",\n\"VAR_5avgTexVAR_5\",\nVAR_5NULLVAR_5\n};", "VAR_5staticVAR_5 VAR_5doubleVAR_5 (* VAR_5constVAR_5 VAR_5VAR_3VAR_5[])(VAR_5voidVAR_5 *, VAR_5doubleVAR_5) = {", "(VAR_5voidVAR_5 *)VAR_5bits2qpVAR_5,\n(VAR_5voidVAR_5 *)VAR_5qp2bitsVAR_5,\nVAR_5NULLVAR_5\n};", "VAR_5staticVAR_5 VAR_5constVAR_5 VAR_5charVAR_5 * VAR_5constVAR_5 VAR_5func1_namesVAR_5[] = {", "\"VAR_5bits2qpVAR_5\",\n\"VAR_5qp2bitsVAR_5\",\nVAR_5NULLVAR_5\n};", "VAR_5emms_cVAR_5();", "VAR_5VAR_1VAR_5 = VAR_5av_expr_parseVAR_5(&VAR_5rccVAR_5->VAR_5rc_eq_evalVAR_5,\nVAR_5sVAR_5->VAR_5rc_eqVAR_5 ? VAR_5sVAR_5->VAR_5rc_eqVAR_5 : \"VAR_5texVAR_5^VAR_5qCompVAR_5\",\nVAR_5VAR_2VAR_5, VAR_5func1_namesVAR_5, VAR_5VAR_3VAR_5,\nVAR_5NULLVAR_5, VAR_5NULLVAR_5, VAR_50VAR_5, VAR_5sVAR_5->VAR_5avctxVAR_5);", "VAR_5ifVAR_5 (VAR_5VAR_1VAR_5 < VAR_50VAR_5) {", "VAR_5av_logVAR_5(VAR_5sVAR_5->VAR_5avctxVAR_5, VAR_5AV_LOG_ERRORVAR_5, \"VAR_5ErrorVAR_5 VAR_5parsingVAR_5 VAR_5rc_eqVAR_5 \\\"%VAR_5sVAR_5\\\"\\VAR_5nVAR_5\", VAR_5sVAR_5->VAR_5rc_eqVAR_5);", "VAR_5returnVAR_5 VAR_5VAR_1VAR_5;", "}", "VAR_5forVAR_5 (VAR_5VAR_6VAR_5 = VAR_50VAR_5; VAR_5VAR_6VAR_5 < VAR_55VAR_5; VAR_5VAR_6VAR_5++) {", "VAR_5rccVAR_5->VAR_5predVAR_5[VAR_5VAR_6VAR_5].VAR_5coeffVAR_5 = VAR_5FF_QP2LAMBDAVAR_5 * VAR_57VAR_5.VAR_50VAR_5;", "VAR_5rccVAR_5->VAR_5predVAR_5[VAR_5VAR_6VAR_5].VAR_5countVAR_5 = VAR_51VAR_5.VAR_50VAR_5;", "VAR_5rccVAR_5->VAR_5predVAR_5[VAR_5VAR_6VAR_5].VAR_5decayVAR_5 = VAR_50VAR_5.VAR_54VAR_5;", "VAR_5rccVAR_5->VAR_5i_cplx_sumVAR_5 [VAR_5VAR_6VAR_5] =\nVAR_5rccVAR_5->VAR_5p_cplx_sumVAR_5 [VAR_5VAR_6VAR_5] =\nVAR_5rccVAR_5->VAR_5mv_bits_sumVAR_5[VAR_5VAR_6VAR_5] =\nVAR_5rccVAR_5->VAR_5qscale_sumVAR_5 [VAR_5VAR_6VAR_5] =\nVAR_5rccVAR_5->VAR_5frame_countVAR_5[VAR_5VAR_6VAR_5] = VAR_51VAR_5;", "VAR_5rccVAR_5->VAR_5last_qscale_forVAR_5[VAR_5VAR_6VAR_5] = VAR_5FF_QP2LAMBDAVAR_5 * VAR_55VAR_5;", "}", "VAR_5rccVAR_5->VAR_5buffer_indexVAR_5 = VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5rc_initial_buffer_occupancyVAR_5;", "VAR_5ifVAR_5 (VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5flagsVAR_5 & VAR_5CODEC_FLAG_PASS2VAR_5) {", "VAR_5intVAR_5 VAR_5VAR_6VAR_5;", "VAR_5charVAR_5 *VAR_5pVAR_5;", "VAR_5pVAR_5 = VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5stats_inVAR_5;", "VAR_5forVAR_5 (VAR_5VAR_6VAR_5 = -VAR_51VAR_5; VAR_5pVAR_5; VAR_5VAR_6VAR_5++)", "VAR_5pVAR_5 = VAR_5strchrVAR_5(VAR_5pVAR_5 + VAR_51VAR_5, ';');", "VAR_5VAR_6VAR_5 += VAR_5sVAR_5->VAR_5max_b_framesVAR_5;", "VAR_5ifVAR_5 (VAR_5VAR_6VAR_5 <= VAR_50VAR_5 || VAR_5VAR_6VAR_5 >= VAR_5INT_MAXVAR_5 / VAR_5sizeofVAR_5(VAR_5RateControlEntryVAR_5))\nVAR_5returnVAR_5 -VAR_51VAR_5;", "VAR_5rccVAR_5->VAR_5entryVAR_5 = VAR_5av_malloczVAR_5(VAR_5VAR_6VAR_5 * VAR_5sizeofVAR_5(VAR_5RateControlEntryVAR_5));", "VAR_5rccVAR_5->VAR_5num_entriesVAR_5 = VAR_5VAR_6VAR_5;", "VAR_5forVAR_5 (VAR_5VAR_6VAR_5 = VAR_50VAR_5; VAR_5VAR_6VAR_5 < VAR_5rccVAR_5->VAR_5num_entriesVAR_5; VAR_5VAR_6VAR_5++) {", "VAR_5RateControlEntryVAR_5 *VAR_5rceVAR_5 = &VAR_5rccVAR_5->VAR_5entryVAR_5[VAR_5VAR_6VAR_5];", "VAR_5rceVAR_5->VAR_5pict_typeVAR_5 = VAR_5rceVAR_5->VAR_5new_pict_typeVAR_5 = VAR_5AV_PICTURE_TYPE_PVAR_5;", "VAR_5rceVAR_5->VAR_5qscaleVAR_5 = VAR_5rceVAR_5->VAR_5new_qscaleVAR_5 = VAR_5FF_QP2LAMBDAVAR_5 * VAR_52VAR_5;", "VAR_5rceVAR_5->VAR_5misc_bitsVAR_5 = VAR_5sVAR_5->VAR_5mb_numVAR_5 + VAR_510VAR_5;", "VAR_5rceVAR_5->VAR_5mb_var_sumVAR_5 = VAR_5sVAR_5->VAR_5mb_numVAR_5 * VAR_5100VAR_5;", "}", "VAR_5pVAR_5 = VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5stats_inVAR_5;", "VAR_5forVAR_5 (VAR_5VAR_6VAR_5 = VAR_50VAR_5; VAR_5VAR_6VAR_5 < VAR_5rccVAR_5->VAR_5num_entriesVAR_5 - VAR_5sVAR_5->VAR_5max_b_framesVAR_5; VAR_5VAR_6VAR_5++) {", "VAR_5RateControlEntryVAR_5 *VAR_5rceVAR_5;", "VAR_5intVAR_5 VAR_5picture_numberVAR_5;", "VAR_5intVAR_5 VAR_5eVAR_5;", "VAR_5charVAR_5 *VAR_5nextVAR_5;", "VAR_5nextVAR_5 = VAR_5strchrVAR_5(VAR_5pVAR_5, ';');", "VAR_5ifVAR_5 (VAR_5nextVAR_5) {", "(*VAR_5nextVAR_5) = VAR_50VAR_5;", "VAR_5nextVAR_5++;", "}", "VAR_5eVAR_5 = VAR_5sscanfVAR_5(VAR_5pVAR_5, \" VAR_5inVAR_5:%VAR_5dVAR_5 \", &VAR_5picture_numberVAR_5);", "VAR_5assertVAR_5(VAR_5picture_numberVAR_5 >= VAR_50VAR_5);", "VAR_5assertVAR_5(VAR_5picture_numberVAR_5 < VAR_5rccVAR_5->VAR_5num_entriesVAR_5);", "VAR_5rceVAR_5 = &VAR_5rccVAR_5->VAR_5entryVAR_5[VAR_5picture_numberVAR_5];", "VAR_5eVAR_5 += VAR_5sscanfVAR_5(VAR_5pVAR_5, \" VAR_5inVAR_5:%*VAR_5dVAR_5 VAR_5outVAR_5:%*VAR_5dVAR_5 VAR_5typeVAR_5:%VAR_5dVAR_5 VAR_5qVAR_5:%VAR_5fVAR_5 VAR_5itexVAR_5:%VAR_5dVAR_5 VAR_5ptexVAR_5:%VAR_5dVAR_5 VAR_5mvVAR_5:%VAR_5dVAR_5 VAR_5miscVAR_5:%VAR_5dVAR_5 VAR_5fcodeVAR_5:%VAR_5dVAR_5 VAR_5bcodeVAR_5:%VAR_5dVAR_5 VAR_5mcVAR_5-VAR_5varVAR_5:%VAR_5dVAR_5 VAR_5varVAR_5:%VAR_5dVAR_5 VAR_5icountVAR_5:%VAR_5dVAR_5 VAR_5skipcountVAR_5:%VAR_5dVAR_5 VAR_5hbitsVAR_5:%VAR_5dVAR_5\",\n&VAR_5rceVAR_5->VAR_5pict_typeVAR_5, &VAR_5rceVAR_5->VAR_5qscaleVAR_5, &VAR_5rceVAR_5->VAR_5i_tex_bitsVAR_5, &VAR_5rceVAR_5->VAR_5p_tex_bitsVAR_5,\n&VAR_5rceVAR_5->VAR_5mv_bitsVAR_5, &VAR_5rceVAR_5->VAR_5misc_bitsVAR_5,\n&VAR_5rceVAR_5->VAR_5f_codeVAR_5, &VAR_5rceVAR_5->VAR_5b_codeVAR_5,\n&VAR_5rceVAR_5->VAR_5mc_mb_var_sumVAR_5, &VAR_5rceVAR_5->VAR_5mb_var_sumVAR_5,\n&VAR_5rceVAR_5->VAR_5i_countVAR_5, &VAR_5rceVAR_5->VAR_5skip_countVAR_5, &VAR_5rceVAR_5->VAR_5header_bitsVAR_5);", "VAR_5ifVAR_5 (VAR_5eVAR_5 != VAR_514VAR_5) {", "VAR_5av_logVAR_5(VAR_5sVAR_5->VAR_5avctxVAR_5, VAR_5AV_LOG_ERRORVAR_5,\n\"VAR_5statisticsVAR_5 VAR_5areVAR_5 VAR_5damagedVAR_5 VAR_5atVAR_5 VAR_5lineVAR_5 %VAR_5dVAR_5, VAR_5parserVAR_5 VAR_5outVAR_5=%VAR_5dVAR_5\\VAR_5nVAR_5\",\nVAR_5VAR_6VAR_5, VAR_5eVAR_5);", "VAR_5returnVAR_5 -VAR_51VAR_5;", "}", "VAR_5pVAR_5 = VAR_5nextVAR_5;", "}", "VAR_5ifVAR_5 (VAR_5init_pass2VAR_5(VAR_5sVAR_5) < VAR_50VAR_5)\nVAR_5returnVAR_5 -VAR_51VAR_5;", "VAR_5ifVAR_5 ((VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5flagsVAR_5 & VAR_5CODEC_FLAG_PASS2VAR_5) && VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5rc_strategyVAR_5 == VAR_5FF_RC_STRATEGY_XVIDVAR_5) {", "#VAR_5ifVAR_5 VAR_5CONFIG_LIBXVIDVAR_5\nVAR_5returnVAR_5 VAR_5ff_xvid_rate_control_initVAR_5(VAR_5sVAR_5);", "#VAR_5elseVAR_5\nVAR_5av_logVAR_5(VAR_5sVAR_5->VAR_5avctxVAR_5, VAR_5AV_LOG_ERRORVAR_5,\n\"VAR_5XvidVAR_5 VAR_5ratecontrolVAR_5 VAR_5requiresVAR_5 VAR_5libavcodecVAR_5 VAR_5compiledVAR_5 VAR_5withVAR_5 VAR_5XvidVAR_5 VAR_5supportVAR_5.\\VAR_5nVAR_5\");", "VAR_5returnVAR_5 -VAR_51VAR_5;", "#VAR_5endifVAR_5\n}", "}", "VAR_5ifVAR_5 (!(VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5flagsVAR_5 & VAR_5CODEC_FLAG_PASS2VAR_5)) {", "VAR_5rccVAR_5->VAR_5short_term_qsumVAR_5 = VAR_50VAR_5.VAR_5001VAR_5;", "VAR_5rccVAR_5->VAR_5short_term_qcountVAR_5 = VAR_50VAR_5.VAR_5001VAR_5;", "VAR_5rccVAR_5->VAR_5pass1_rc_eq_output_sumVAR_5 = VAR_50VAR_5.VAR_5001VAR_5;", "VAR_5rccVAR_5->VAR_5pass1_wanted_bitsVAR_5 = VAR_50VAR_5.VAR_5001VAR_5;", "VAR_5ifVAR_5 (VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5qblurVAR_5 > VAR_51VAR_5.VAR_50VAR_5) {", "VAR_5av_logVAR_5(VAR_5sVAR_5->VAR_5avctxVAR_5, VAR_5AV_LOG_ERRORVAR_5, \"VAR_5qblurVAR_5 VAR_5tooVAR_5 VAR_5largeVAR_5\\VAR_5nVAR_5\");", "VAR_5returnVAR_5 -VAR_51VAR_5;", "}", "VAR_5ifVAR_5 (VAR_5sVAR_5->VAR_5rc_initial_cplxVAR_5) {", "VAR_5forVAR_5 (VAR_5VAR_6VAR_5 = VAR_50VAR_5; VAR_5VAR_6VAR_5 < VAR_560VAR_5 * VAR_530VAR_5; VAR_5VAR_6VAR_5++) {", "VAR_5doubleVAR_5 VAR_5bitsVAR_5 = VAR_5sVAR_5->VAR_5rc_initial_cplxVAR_5 * (VAR_5VAR_6VAR_5 / VAR_510000VAR_5.VAR_50VAR_5 + VAR_51VAR_5.VAR_50VAR_5) * VAR_5sVAR_5->VAR_5mb_numVAR_5;", "VAR_5RateControlEntryVAR_5 VAR_5rceVAR_5;", "VAR_5ifVAR_5 (VAR_5VAR_6VAR_5 % ((VAR_5sVAR_5->VAR_5gop_sizeVAR_5 + VAR_53VAR_5) / VAR_54VAR_5) == VAR_50VAR_5)\nVAR_5rceVAR_5.VAR_5pict_typeVAR_5 = VAR_5AV_PICTURE_TYPE_IVAR_5;", "VAR_5elseVAR_5 VAR_5ifVAR_5 (VAR_5VAR_6VAR_5 % (VAR_5sVAR_5->VAR_5max_b_framesVAR_5 + VAR_51VAR_5))\nVAR_5rceVAR_5.VAR_5pict_typeVAR_5 = VAR_5AV_PICTURE_TYPE_BVAR_5;", "VAR_5elseVAR_5\nVAR_5rceVAR_5.VAR_5pict_typeVAR_5 = VAR_5AV_PICTURE_TYPE_PVAR_5;", "VAR_5rceVAR_5.VAR_5new_pict_typeVAR_5 = VAR_5rceVAR_5.VAR_5pict_typeVAR_5;", "VAR_5rceVAR_5.VAR_5mc_mb_var_sumVAR_5 = VAR_5bitsVAR_5 * VAR_5sVAR_5->VAR_5mb_numVAR_5 / VAR_5100000VAR_5;", "VAR_5rceVAR_5.VAR_5mb_var_sumVAR_5 = VAR_5sVAR_5->VAR_5mb_numVAR_5;", "VAR_5rceVAR_5.VAR_5qscaleVAR_5 = VAR_5FF_QP2LAMBDAVAR_5 * VAR_52VAR_5;", "VAR_5rceVAR_5.VAR_5f_codeVAR_5 = VAR_52VAR_5;", "VAR_5rceVAR_5.VAR_5b_codeVAR_5 = VAR_51VAR_5;", "VAR_5rceVAR_5.VAR_5misc_bitsVAR_5 = VAR_51VAR_5;", "VAR_5ifVAR_5 (VAR_5sVAR_5->VAR_5pict_typeVAR_5 == VAR_5AV_PICTURE_TYPE_IVAR_5) {", "VAR_5rceVAR_5.VAR_5i_countVAR_5 = VAR_5sVAR_5->VAR_5mb_numVAR_5;", "VAR_5rceVAR_5.VAR_5i_tex_bitsVAR_5 = VAR_5bitsVAR_5;", "VAR_5rceVAR_5.VAR_5p_tex_bitsVAR_5 = VAR_50VAR_5;", "VAR_5rceVAR_5.VAR_5mv_bitsVAR_5 = VAR_50VAR_5;", "} VAR_5elseVAR_5 {", "VAR_5rceVAR_5.VAR_5i_countVAR_5 = VAR_50VAR_5;", "VAR_5rceVAR_5.VAR_5i_tex_bitsVAR_5 = VAR_50VAR_5;", "VAR_5rceVAR_5.VAR_5p_tex_bitsVAR_5 = VAR_5bitsVAR_5 * VAR_50VAR_5.VAR_59VAR_5;", "VAR_5rceVAR_5.VAR_5mv_bitsVAR_5 = VAR_5bitsVAR_5 * VAR_50VAR_5.VAR_51VAR_5;", "}", "VAR_5rccVAR_5->VAR_5i_cplx_sumVAR_5[VAR_5rceVAR_5.VAR_5pict_typeVAR_5] += VAR_5rceVAR_5.VAR_5i_tex_bitsVAR_5 * VAR_5rceVAR_5.VAR_5qscaleVAR_5;", "VAR_5rccVAR_5->VAR_5p_cplx_sumVAR_5[VAR_5rceVAR_5.VAR_5pict_typeVAR_5] += VAR_5rceVAR_5.VAR_5p_tex_bitsVAR_5 * VAR_5rceVAR_5.VAR_5qscaleVAR_5;", "VAR_5rccVAR_5->VAR_5mv_bits_sumVAR_5[VAR_5rceVAR_5.VAR_5pict_typeVAR_5] += VAR_5rceVAR_5.VAR_5mv_bitsVAR_5;", "VAR_5rccVAR_5->VAR_5frame_countVAR_5[VAR_5rceVAR_5.VAR_5pict_typeVAR_5]++;", "VAR_5get_qscaleVAR_5(VAR_5sVAR_5, &VAR_5rceVAR_5, VAR_5rccVAR_5->VAR_5pass1_wanted_bitsVAR_5 / VAR_5rccVAR_5->VAR_5pass1_rc_eq_output_sumVAR_5, VAR_5VAR_6VAR_5);", "VAR_5rccVAR_5->VAR_5pass1_wanted_bitsVAR_5 += VAR_5sVAR_5->VAR_5bit_rateVAR_5 / (VAR_51VAR_5 / VAR_5av_q2dVAR_5(VAR_5sVAR_5->VAR_5avctxVAR_5->VAR_5time_baseVAR_5));", "}", "}", "}", "VAR_5returnVAR_5 VAR_50VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 91, 93, 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119, 121, 123, 125, 127 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 219 ], [ 221 ], [ 223 ], [ 227, 229, 231, 233, 235, 237 ], [ 239 ], [ 241, 243, 245 ], [ 247 ], [ 249 ], [ 253 ], [ 255 ], [ 259, 261 ], [ 267 ], [ 269, 271 ], [ 273, 275, 277 ], [ 279 ], [ 281, 283 ], [ 285 ], [ 289 ], [ 291 ], [ 293 ], [ 297 ], [ 299 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 323, 325 ], [ 327, 329 ], [ 331, 333 ], [ 337 ], [ 339 ], [ 341 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 387 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 403 ], [ 405 ] ]
187
av_cold void ff_sws_init_swscale_x86(SwsContext *c) { int cpu_flags = av_get_cpu_flags(); #if HAVE_MMX_INLINE if (INLINE_MMX(cpu_flags)) sws_init_swscale_mmx(c); #endif #if HAVE_MMXEXT_INLINE if (INLINE_MMXEXT(cpu_flags)) sws_init_swscale_mmxext(c); #endif #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \ if (c->srcBpc == 8) { \ hscalefn = c->dstBpc <= 10 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \ ff_hscale8to19_ ## filtersize ## _ ## opt1; \ } else if (c->srcBpc == 9) { \ hscalefn = c->dstBpc <= 10 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \ ff_hscale9to19_ ## filtersize ## _ ## opt1; \ } else if (c->srcBpc == 10) { \ hscalefn = c->dstBpc <= 10 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \ ff_hscale10to19_ ## filtersize ## _ ## opt1; \ } else /* c->srcBpc == 16 */ { \ hscalefn = c->dstBpc <= 10 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \ ff_hscale16to19_ ## filtersize ## _ ## opt1; \ } \ } while (0) #define ASSIGN_MMX_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \ switch (filtersize) { \ case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \ case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \ default: ASSIGN_SCALE_FUNC2(hscalefn, X, opt1, opt2); break; \ } #define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \ switch(c->dstBpc){ \ case 16: do_16_case; break; \ case 10: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \ case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \ default: if (condition_8bit) vscalefn = ff_yuv2planeX_8_ ## opt; break; \ } #define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \ switch(c->dstBpc){ \ case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \ case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \ case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \ default: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \ } #define case_rgb(x, X, opt) \ case AV_PIX_FMT_ ## X: \ c->lumToYV12 = ff_ ## x ## ToY_ ## opt; \ if (!c->chrSrcHSubSample) \ c->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \ break #if ARCH_X86_32 if (EXTERNAL_MMX(cpu_flags)) { ASSIGN_MMX_SCALE_FUNC(c->hyScale, c->hLumFilterSize, mmx, mmx); ASSIGN_MMX_SCALE_FUNC(c->hcScale, c->hChrFilterSize, mmx, mmx); ASSIGN_VSCALE_FUNC(c->yuv2plane1, mmx, mmxext, cpu_flags & AV_CPU_FLAG_MMXEXT); switch (c->srcFormat) { case AV_PIX_FMT_YA8: c->lumToYV12 = ff_yuyvToY_mmx; if (c->alpPixBuf) c->alpToYV12 = ff_uyvyToY_mmx; break; case AV_PIX_FMT_YUYV422: c->lumToYV12 = ff_yuyvToY_mmx; c->chrToYV12 = ff_yuyvToUV_mmx; break; case AV_PIX_FMT_UYVY422: c->lumToYV12 = ff_uyvyToY_mmx; c->chrToYV12 = ff_uyvyToUV_mmx; break; case AV_PIX_FMT_NV12: c->chrToYV12 = ff_nv12ToUV_mmx; break; case AV_PIX_FMT_NV21: c->chrToYV12 = ff_nv21ToUV_mmx; break; case_rgb(rgb24, RGB24, mmx); case_rgb(bgr24, BGR24, mmx); case_rgb(bgra, BGRA, mmx); case_rgb(rgba, RGBA, mmx); case_rgb(abgr, ABGR, mmx); case_rgb(argb, ARGB, mmx); default: break; } } if (EXTERNAL_MMXEXT(cpu_flags)) { ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmxext, , 1); } #endif /* ARCH_X86_32 */ #define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \ switch (filtersize) { \ case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \ case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \ default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \ else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \ break; \ } if (EXTERNAL_SSE2(cpu_flags)) { ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2); ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2); ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, , HAVE_ALIGNED_STACK || ARCH_X86_64); ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2, sse2, 1); switch (c->srcFormat) { case AV_PIX_FMT_YA8: c->lumToYV12 = ff_yuyvToY_sse2; if (c->alpPixBuf) c->alpToYV12 = ff_uyvyToY_sse2; break; case AV_PIX_FMT_YUYV422: c->lumToYV12 = ff_yuyvToY_sse2; c->chrToYV12 = ff_yuyvToUV_sse2; break; case AV_PIX_FMT_UYVY422: c->lumToYV12 = ff_uyvyToY_sse2; c->chrToYV12 = ff_uyvyToUV_sse2; break; case AV_PIX_FMT_NV12: c->chrToYV12 = ff_nv12ToUV_sse2; break; case AV_PIX_FMT_NV21: c->chrToYV12 = ff_nv21ToUV_sse2; break; case_rgb(rgb24, RGB24, sse2); case_rgb(bgr24, BGR24, sse2); case_rgb(bgra, BGRA, sse2); case_rgb(rgba, RGBA, sse2); case_rgb(abgr, ABGR, sse2); case_rgb(argb, ARGB, sse2); default: break; } } if (EXTERNAL_SSSE3(cpu_flags)) { ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3); ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3); switch (c->srcFormat) { case_rgb(rgb24, RGB24, ssse3); case_rgb(bgr24, BGR24, ssse3); default: break; } } if (EXTERNAL_SSE4(cpu_flags)) { /* Xto15 don't need special sse4 functions */ ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3); ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3); ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4, if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4, HAVE_ALIGNED_STACK || ARCH_X86_64); if (c->dstBpc == 16 && !isBE(c->dstFormat)) c->yuv2plane1 = ff_yuv2plane1_16_sse4; } if (EXTERNAL_AVX(cpu_flags)) { ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, , HAVE_ALIGNED_STACK || ARCH_X86_64); ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1); switch (c->srcFormat) { case AV_PIX_FMT_YUYV422: c->chrToYV12 = ff_yuyvToUV_avx; break; case AV_PIX_FMT_UYVY422: c->chrToYV12 = ff_uyvyToUV_avx; break; case AV_PIX_FMT_NV12: c->chrToYV12 = ff_nv12ToUV_avx; break; case AV_PIX_FMT_NV21: c->chrToYV12 = ff_nv21ToUV_avx; break; case_rgb(rgb24, RGB24, avx); case_rgb(bgr24, BGR24, avx); case_rgb(bgra, BGRA, avx); case_rgb(rgba, RGBA, avx); case_rgb(abgr, ABGR, avx); case_rgb(argb, ARGB, avx); default: break; } } }
false
FFmpeg
e87a501e7d03ac68b58520108fe24ad9d0b36765
av_cold void ff_sws_init_swscale_x86(SwsContext *c) { int cpu_flags = av_get_cpu_flags(); #if HAVE_MMX_INLINE if (INLINE_MMX(cpu_flags)) sws_init_swscale_mmx(c); #endif #if HAVE_MMXEXT_INLINE if (INLINE_MMXEXT(cpu_flags)) sws_init_swscale_mmxext(c); #endif #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \ if (c->srcBpc == 8) { \ hscalefn = c->dstBpc <= 10 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \ ff_hscale8to19_ ## filtersize ## _ ## opt1; \ } else if (c->srcBpc == 9) { \ hscalefn = c->dstBpc <= 10 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \ ff_hscale9to19_ ## filtersize ## _ ## opt1; \ } else if (c->srcBpc == 10) { \ hscalefn = c->dstBpc <= 10 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \ ff_hscale10to19_ ## filtersize ## _ ## opt1; \ } else { \ hscalefn = c->dstBpc <= 10 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \ ff_hscale16to19_ ## filtersize ## _ ## opt1; \ } \ } while (0) #define ASSIGN_MMX_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \ switch (filtersize) { \ case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \ case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \ default: ASSIGN_SCALE_FUNC2(hscalefn, X, opt1, opt2); break; \ } #define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \ switch(c->dstBpc){ \ case 16: do_16_case; break; \ case 10: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \ case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \ default: if (condition_8bit) vscalefn = ff_yuv2planeX_8_ ## opt; break; \ } #define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \ switch(c->dstBpc){ \ case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \ case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \ case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \ default: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \ } #define case_rgb(x, X, opt) \ case AV_PIX_FMT_ ## X: \ c->lumToYV12 = ff_ ## x ## ToY_ ## opt; \ if (!c->chrSrcHSubSample) \ c->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \ break #if ARCH_X86_32 if (EXTERNAL_MMX(cpu_flags)) { ASSIGN_MMX_SCALE_FUNC(c->hyScale, c->hLumFilterSize, mmx, mmx); ASSIGN_MMX_SCALE_FUNC(c->hcScale, c->hChrFilterSize, mmx, mmx); ASSIGN_VSCALE_FUNC(c->yuv2plane1, mmx, mmxext, cpu_flags & AV_CPU_FLAG_MMXEXT); switch (c->srcFormat) { case AV_PIX_FMT_YA8: c->lumToYV12 = ff_yuyvToY_mmx; if (c->alpPixBuf) c->alpToYV12 = ff_uyvyToY_mmx; break; case AV_PIX_FMT_YUYV422: c->lumToYV12 = ff_yuyvToY_mmx; c->chrToYV12 = ff_yuyvToUV_mmx; break; case AV_PIX_FMT_UYVY422: c->lumToYV12 = ff_uyvyToY_mmx; c->chrToYV12 = ff_uyvyToUV_mmx; break; case AV_PIX_FMT_NV12: c->chrToYV12 = ff_nv12ToUV_mmx; break; case AV_PIX_FMT_NV21: c->chrToYV12 = ff_nv21ToUV_mmx; break; case_rgb(rgb24, RGB24, mmx); case_rgb(bgr24, BGR24, mmx); case_rgb(bgra, BGRA, mmx); case_rgb(rgba, RGBA, mmx); case_rgb(abgr, ABGR, mmx); case_rgb(argb, ARGB, mmx); default: break; } } if (EXTERNAL_MMXEXT(cpu_flags)) { ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmxext, , 1); } #endif #define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \ switch (filtersize) { \ case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \ case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \ default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \ else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \ break; \ } if (EXTERNAL_SSE2(cpu_flags)) { ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2); ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2); ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, , HAVE_ALIGNED_STACK || ARCH_X86_64); ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2, sse2, 1); switch (c->srcFormat) { case AV_PIX_FMT_YA8: c->lumToYV12 = ff_yuyvToY_sse2; if (c->alpPixBuf) c->alpToYV12 = ff_uyvyToY_sse2; break; case AV_PIX_FMT_YUYV422: c->lumToYV12 = ff_yuyvToY_sse2; c->chrToYV12 = ff_yuyvToUV_sse2; break; case AV_PIX_FMT_UYVY422: c->lumToYV12 = ff_uyvyToY_sse2; c->chrToYV12 = ff_uyvyToUV_sse2; break; case AV_PIX_FMT_NV12: c->chrToYV12 = ff_nv12ToUV_sse2; break; case AV_PIX_FMT_NV21: c->chrToYV12 = ff_nv21ToUV_sse2; break; case_rgb(rgb24, RGB24, sse2); case_rgb(bgr24, BGR24, sse2); case_rgb(bgra, BGRA, sse2); case_rgb(rgba, RGBA, sse2); case_rgb(abgr, ABGR, sse2); case_rgb(argb, ARGB, sse2); default: break; } } if (EXTERNAL_SSSE3(cpu_flags)) { ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3); ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3); switch (c->srcFormat) { case_rgb(rgb24, RGB24, ssse3); case_rgb(bgr24, BGR24, ssse3); default: break; } } if (EXTERNAL_SSE4(cpu_flags)) { ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3); ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3); ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4, if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4, HAVE_ALIGNED_STACK || ARCH_X86_64); if (c->dstBpc == 16 && !isBE(c->dstFormat)) c->yuv2plane1 = ff_yuv2plane1_16_sse4; } if (EXTERNAL_AVX(cpu_flags)) { ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, , HAVE_ALIGNED_STACK || ARCH_X86_64); ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1); switch (c->srcFormat) { case AV_PIX_FMT_YUYV422: c->chrToYV12 = ff_yuyvToUV_avx; break; case AV_PIX_FMT_UYVY422: c->chrToYV12 = ff_uyvyToUV_avx; break; case AV_PIX_FMT_NV12: c->chrToYV12 = ff_nv12ToUV_avx; break; case AV_PIX_FMT_NV21: c->chrToYV12 = ff_nv21ToUV_avx; break; case_rgb(rgb24, RGB24, avx); case_rgb(bgr24, BGR24, avx); case_rgb(bgra, BGRA, avx); case_rgb(rgba, RGBA, avx); case_rgb(abgr, ABGR, avx); case_rgb(argb, ARGB, avx); default: break; } } }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(SwsContext *c) { int VAR_0 = av_get_cpu_flags(); #if HAVE_MMX_INLINE if (INLINE_MMX(VAR_0)) sws_init_swscale_mmx(c); #endif #if HAVE_MMXEXT_INLINE if (INLINE_MMXEXT(VAR_0)) sws_init_swscale_mmxext(c); #endif #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \ if (c->srcBpc == 8) { \ hscalefn = c->dstBpc <= 10 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \ ff_hscale8to19_ ## filtersize ## _ ## opt1; \ } else if (c->srcBpc == 9) { \ hscalefn = c->dstBpc <= 10 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \ ff_hscale9to19_ ## filtersize ## _ ## opt1; \ } else if (c->srcBpc == 10) { \ hscalefn = c->dstBpc <= 10 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \ ff_hscale10to19_ ## filtersize ## _ ## opt1; \ } else { \ hscalefn = c->dstBpc <= 10 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \ ff_hscale16to19_ ## filtersize ## _ ## opt1; \ } \ } while (0) #define ASSIGN_MMX_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \ switch (filtersize) { \ case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \ case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \ default: ASSIGN_SCALE_FUNC2(hscalefn, X, opt1, opt2); break; \ } #define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \ switch(c->dstBpc){ \ case 16: do_16_case; break; \ case 10: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \ case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \ default: if (condition_8bit) vscalefn = ff_yuv2planeX_8_ ## opt; break; \ } #define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \ switch(c->dstBpc){ \ case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \ case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \ case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \ default: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \ } #define case_rgb(x, X, opt) \ case AV_PIX_FMT_ ## X: \ c->lumToYV12 = ff_ ## x ## ToY_ ## opt; \ if (!c->chrSrcHSubSample) \ c->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \ break #if ARCH_X86_32 if (EXTERNAL_MMX(VAR_0)) { ASSIGN_MMX_SCALE_FUNC(c->hyScale, c->hLumFilterSize, mmx, mmx); ASSIGN_MMX_SCALE_FUNC(c->hcScale, c->hChrFilterSize, mmx, mmx); ASSIGN_VSCALE_FUNC(c->yuv2plane1, mmx, mmxext, VAR_0 & AV_CPU_FLAG_MMXEXT); switch (c->srcFormat) { case AV_PIX_FMT_YA8: c->lumToYV12 = ff_yuyvToY_mmx; if (c->alpPixBuf) c->alpToYV12 = ff_uyvyToY_mmx; break; case AV_PIX_FMT_YUYV422: c->lumToYV12 = ff_yuyvToY_mmx; c->chrToYV12 = ff_yuyvToUV_mmx; break; case AV_PIX_FMT_UYVY422: c->lumToYV12 = ff_uyvyToY_mmx; c->chrToYV12 = ff_uyvyToUV_mmx; break; case AV_PIX_FMT_NV12: c->chrToYV12 = ff_nv12ToUV_mmx; break; case AV_PIX_FMT_NV21: c->chrToYV12 = ff_nv21ToUV_mmx; break; case_rgb(rgb24, RGB24, mmx); case_rgb(bgr24, BGR24, mmx); case_rgb(bgra, BGRA, mmx); case_rgb(rgba, RGBA, mmx); case_rgb(abgr, ABGR, mmx); case_rgb(argb, ARGB, mmx); default: break; } } if (EXTERNAL_MMXEXT(VAR_0)) { ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmxext, , 1); } #endif #define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \ switch (filtersize) { \ case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \ case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \ default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \ else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \ break; \ } if (EXTERNAL_SSE2(VAR_0)) { ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2); ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2); ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, , HAVE_ALIGNED_STACK || ARCH_X86_64); ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2, sse2, 1); switch (c->srcFormat) { case AV_PIX_FMT_YA8: c->lumToYV12 = ff_yuyvToY_sse2; if (c->alpPixBuf) c->alpToYV12 = ff_uyvyToY_sse2; break; case AV_PIX_FMT_YUYV422: c->lumToYV12 = ff_yuyvToY_sse2; c->chrToYV12 = ff_yuyvToUV_sse2; break; case AV_PIX_FMT_UYVY422: c->lumToYV12 = ff_uyvyToY_sse2; c->chrToYV12 = ff_uyvyToUV_sse2; break; case AV_PIX_FMT_NV12: c->chrToYV12 = ff_nv12ToUV_sse2; break; case AV_PIX_FMT_NV21: c->chrToYV12 = ff_nv21ToUV_sse2; break; case_rgb(rgb24, RGB24, sse2); case_rgb(bgr24, BGR24, sse2); case_rgb(bgra, BGRA, sse2); case_rgb(rgba, RGBA, sse2); case_rgb(abgr, ABGR, sse2); case_rgb(argb, ARGB, sse2); default: break; } } if (EXTERNAL_SSSE3(VAR_0)) { ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3); ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3); switch (c->srcFormat) { case_rgb(rgb24, RGB24, ssse3); case_rgb(bgr24, BGR24, ssse3); default: break; } } if (EXTERNAL_SSE4(VAR_0)) { ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3); ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3); ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4, if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4, HAVE_ALIGNED_STACK || ARCH_X86_64); if (c->dstBpc == 16 && !isBE(c->dstFormat)) c->yuv2plane1 = ff_yuv2plane1_16_sse4; } if (EXTERNAL_AVX(VAR_0)) { ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, , HAVE_ALIGNED_STACK || ARCH_X86_64); ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1); switch (c->srcFormat) { case AV_PIX_FMT_YUYV422: c->chrToYV12 = ff_yuyvToUV_avx; break; case AV_PIX_FMT_UYVY422: c->chrToYV12 = ff_uyvyToUV_avx; break; case AV_PIX_FMT_NV12: c->chrToYV12 = ff_nv12ToUV_avx; break; case AV_PIX_FMT_NV21: c->chrToYV12 = ff_nv21ToUV_avx; break; case_rgb(rgb24, RGB24, avx); case_rgb(bgr24, BGR24, avx); case_rgb(bgra, BGRA, avx); case_rgb(rgba, RGBA, avx); case_rgb(abgr, ABGR, avx); case_rgb(argb, ARGB, avx); default: break; } } }
[ "av_cold void FUNC_0(SwsContext *c)\n{", "int VAR_0 = av_get_cpu_flags();", "#if HAVE_MMX_INLINE\nif (INLINE_MMX(VAR_0))\nsws_init_swscale_mmx(c);", "#endif\n#if HAVE_MMXEXT_INLINE\nif (INLINE_MMXEXT(VAR_0))\nsws_init_swscale_mmxext(c);", "#endif\n#define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \\", "if (c->srcBpc == 8) { \\", "hscalefn = c->dstBpc <= 10 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \\\nff_hscale8to19_ ## filtersize ## _ ## opt1; \\", "} else if (c->srcBpc == 9) { \\", "hscalefn = c->dstBpc <= 10 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \\\nff_hscale9to19_ ## filtersize ## _ ## opt1; \\", "} else if (c->srcBpc == 10) { \\", "hscalefn = c->dstBpc <= 10 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \\\nff_hscale10to19_ ## filtersize ## _ ## opt1; \\", "} else { \\", "hscalefn = c->dstBpc <= 10 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \\\nff_hscale16to19_ ## filtersize ## _ ## opt1; \\", "} \\", "} while (0)", "#define ASSIGN_MMX_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \\\nswitch (filtersize) { \\", "case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \\", "case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \\", "default: ASSIGN_SCALE_FUNC2(hscalefn, X, opt1, opt2); break; \\", "}", "#define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \\\nswitch(c->dstBpc){ \\", "case 16: do_16_case; break; \\", "case 10: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \\", "case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \\", "default: if (condition_8bit) vscalefn = ff_yuv2planeX_8_ ## opt; break; \\", "}", "#define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \\\nswitch(c->dstBpc){ \\", "case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \\", "case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \\", "case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \\", "default: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \\", "}", "#define case_rgb(x, X, opt) \\\ncase AV_PIX_FMT_ ## X: \\\nc->lumToYV12 = ff_ ## x ## ToY_ ## opt; \\", "if (!c->chrSrcHSubSample) \\\nc->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \\", "break\n#if ARCH_X86_32\nif (EXTERNAL_MMX(VAR_0)) {", "ASSIGN_MMX_SCALE_FUNC(c->hyScale, c->hLumFilterSize, mmx, mmx);", "ASSIGN_MMX_SCALE_FUNC(c->hcScale, c->hChrFilterSize, mmx, mmx);", "ASSIGN_VSCALE_FUNC(c->yuv2plane1, mmx, mmxext, VAR_0 & AV_CPU_FLAG_MMXEXT);", "switch (c->srcFormat) {", "case AV_PIX_FMT_YA8:\nc->lumToYV12 = ff_yuyvToY_mmx;", "if (c->alpPixBuf)\nc->alpToYV12 = ff_uyvyToY_mmx;", "break;", "case AV_PIX_FMT_YUYV422:\nc->lumToYV12 = ff_yuyvToY_mmx;", "c->chrToYV12 = ff_yuyvToUV_mmx;", "break;", "case AV_PIX_FMT_UYVY422:\nc->lumToYV12 = ff_uyvyToY_mmx;", "c->chrToYV12 = ff_uyvyToUV_mmx;", "break;", "case AV_PIX_FMT_NV12:\nc->chrToYV12 = ff_nv12ToUV_mmx;", "break;", "case AV_PIX_FMT_NV21:\nc->chrToYV12 = ff_nv21ToUV_mmx;", "break;", "case_rgb(rgb24, RGB24, mmx);", "case_rgb(bgr24, BGR24, mmx);", "case_rgb(bgra, BGRA, mmx);", "case_rgb(rgba, RGBA, mmx);", "case_rgb(abgr, ABGR, mmx);", "case_rgb(argb, ARGB, mmx);", "default:\nbreak;", "}", "}", "if (EXTERNAL_MMXEXT(VAR_0)) {", "ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmxext, , 1);", "}", "#endif\n#define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \\\nswitch (filtersize) { \\", "case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \\", "case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \\", "default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \\", "else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \\", "break; \\", "}", "if (EXTERNAL_SSE2(VAR_0)) {", "ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2);", "ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);", "ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, ,\nHAVE_ALIGNED_STACK || ARCH_X86_64);", "ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2, sse2, 1);", "switch (c->srcFormat) {", "case AV_PIX_FMT_YA8:\nc->lumToYV12 = ff_yuyvToY_sse2;", "if (c->alpPixBuf)\nc->alpToYV12 = ff_uyvyToY_sse2;", "break;", "case AV_PIX_FMT_YUYV422:\nc->lumToYV12 = ff_yuyvToY_sse2;", "c->chrToYV12 = ff_yuyvToUV_sse2;", "break;", "case AV_PIX_FMT_UYVY422:\nc->lumToYV12 = ff_uyvyToY_sse2;", "c->chrToYV12 = ff_uyvyToUV_sse2;", "break;", "case AV_PIX_FMT_NV12:\nc->chrToYV12 = ff_nv12ToUV_sse2;", "break;", "case AV_PIX_FMT_NV21:\nc->chrToYV12 = ff_nv21ToUV_sse2;", "break;", "case_rgb(rgb24, RGB24, sse2);", "case_rgb(bgr24, BGR24, sse2);", "case_rgb(bgra, BGRA, sse2);", "case_rgb(rgba, RGBA, sse2);", "case_rgb(abgr, ABGR, sse2);", "case_rgb(argb, ARGB, sse2);", "default:\nbreak;", "}", "}", "if (EXTERNAL_SSSE3(VAR_0)) {", "ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3);", "ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3);", "switch (c->srcFormat) {", "case_rgb(rgb24, RGB24, ssse3);", "case_rgb(bgr24, BGR24, ssse3);", "default:\nbreak;", "}", "}", "if (EXTERNAL_SSE4(VAR_0)) {", "ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3);", "ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3);", "ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4,\nif (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4,\nHAVE_ALIGNED_STACK || ARCH_X86_64);", "if (c->dstBpc == 16 && !isBE(c->dstFormat))\nc->yuv2plane1 = ff_yuv2plane1_16_sse4;", "}", "if (EXTERNAL_AVX(VAR_0)) {", "ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, ,\nHAVE_ALIGNED_STACK || ARCH_X86_64);", "ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1);", "switch (c->srcFormat) {", "case AV_PIX_FMT_YUYV422:\nc->chrToYV12 = ff_yuyvToUV_avx;", "break;", "case AV_PIX_FMT_UYVY422:\nc->chrToYV12 = ff_uyvyToUV_avx;", "break;", "case AV_PIX_FMT_NV12:\nc->chrToYV12 = ff_nv12ToUV_avx;", "break;", "case AV_PIX_FMT_NV21:\nc->chrToYV12 = ff_nv21ToUV_avx;", "break;", "case_rgb(rgb24, RGB24, avx);", "case_rgb(bgr24, BGR24, avx);", "case_rgb(bgra, BGRA, avx);", "case_rgb(rgba, RGBA, avx);", "case_rgb(abgr, ABGR, avx);", "case_rgb(argb, ARGB, avx);", "default:\nbreak;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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 ], [ 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 ], [ 219 ], [ 221, 223 ], [ 225, 227 ], [ 229 ], [ 231, 233 ], [ 235 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 247, 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291, 293 ], [ 295 ], [ 297 ], [ 299 ], [ 303 ], [ 305 ], [ 307, 309, 311 ], [ 313, 315 ], [ 317 ], [ 321 ], [ 323, 325 ], [ 327 ], [ 331 ], [ 333, 335 ], [ 337 ], [ 339, 341 ], [ 343 ], [ 345, 347 ], [ 349 ], [ 351, 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369, 371 ], [ 373 ], [ 375 ], [ 377 ] ]
189
static void libopus_write_header(AVCodecContext *avctx, int stream_count, int coupled_stream_count, const uint8_t *channel_mapping) { uint8_t *p = avctx->extradata; int channels = avctx->channels; bytestream_put_buffer(&p, "OpusHead", 8); bytestream_put_byte(&p, 1); /* Version */ bytestream_put_byte(&p, channels); bytestream_put_le16(&p, avctx->delay); /* Lookahead samples at 48kHz */ bytestream_put_le32(&p, avctx->sample_rate); /* Original sample rate */ bytestream_put_le16(&p, 0); /* Gain of 0dB is recommended. */ /* Channel mapping */ if (channels > 2) { bytestream_put_byte(&p, channels <= 8 ? 1 : 255); bytestream_put_byte(&p, stream_count); bytestream_put_byte(&p, coupled_stream_count); bytestream_put_buffer(&p, channel_mapping, channels); } else { bytestream_put_byte(&p, 0); } }
false
FFmpeg
2df0c32ea12ddfa72ba88309812bfb13b674130f
static void libopus_write_header(AVCodecContext *avctx, int stream_count, int coupled_stream_count, const uint8_t *channel_mapping) { uint8_t *p = avctx->extradata; int channels = avctx->channels; bytestream_put_buffer(&p, "OpusHead", 8); bytestream_put_byte(&p, 1); bytestream_put_byte(&p, channels); bytestream_put_le16(&p, avctx->delay); bytestream_put_le32(&p, avctx->sample_rate); bytestream_put_le16(&p, 0); if (channels > 2) { bytestream_put_byte(&p, channels <= 8 ? 1 : 255); bytestream_put_byte(&p, stream_count); bytestream_put_byte(&p, coupled_stream_count); bytestream_put_buffer(&p, channel_mapping, channels); } else { bytestream_put_byte(&p, 0); } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2, const uint8_t *VAR_3) { uint8_t *p = VAR_0->extradata; int VAR_4 = VAR_0->VAR_4; bytestream_put_buffer(&p, "OpusHead", 8); bytestream_put_byte(&p, 1); bytestream_put_byte(&p, VAR_4); bytestream_put_le16(&p, VAR_0->delay); bytestream_put_le32(&p, VAR_0->sample_rate); bytestream_put_le16(&p, 0); if (VAR_4 > 2) { bytestream_put_byte(&p, VAR_4 <= 8 ? 1 : 255); bytestream_put_byte(&p, VAR_1); bytestream_put_byte(&p, VAR_2); bytestream_put_buffer(&p, VAR_3, VAR_4); } else { bytestream_put_byte(&p, 0); } }
[ "static void FUNC_0(AVCodecContext *VAR_0, int VAR_1,\nint VAR_2,\nconst uint8_t *VAR_3)\n{", "uint8_t *p = VAR_0->extradata;", "int VAR_4 = VAR_0->VAR_4;", "bytestream_put_buffer(&p, \"OpusHead\", 8);", "bytestream_put_byte(&p, 1);", "bytestream_put_byte(&p, VAR_4);", "bytestream_put_le16(&p, VAR_0->delay);", "bytestream_put_le32(&p, VAR_0->sample_rate);", "bytestream_put_le16(&p, 0);", "if (VAR_4 > 2) {", "bytestream_put_byte(&p, VAR_4 <= 8 ? 1 : 255);", "bytestream_put_byte(&p, VAR_1);", "bytestream_put_byte(&p, VAR_2);", "bytestream_put_buffer(&p, VAR_3, VAR_4);", "} else {", "bytestream_put_byte(&p, 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 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
190
static int mov_write_tmcd_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = avio_tell(pb); #if 1 int frame_duration = av_rescale(track->timescale, track->enc->time_base.num, track->enc->time_base.den); int nb_frames = ROUNDED_DIV(track->enc->time_base.den, track->enc->time_base.num); AVDictionaryEntry *t = NULL; if (nb_frames > 255) { av_log(NULL, AV_LOG_ERROR, "fps %d is too large\n", nb_frames); return AVERROR(EINVAL); } avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "tmcd"); /* Data format */ avio_wb32(pb, 0); /* Reserved */ avio_wb32(pb, 1); /* Data reference index */ avio_wb32(pb, 0); /* Flags */ avio_wb32(pb, track->timecode_flags); /* Flags (timecode) */ avio_wb32(pb, track->timescale); /* Timescale */ avio_wb32(pb, frame_duration); /* Frame duration */ avio_w8(pb, nb_frames); /* Number of frames */ avio_w8(pb, 0); /* Reserved */ if (track->st) t = av_dict_get(track->st->metadata, "reel_name", NULL, 0); if (t && utf8len(t->value)) mov_write_source_reference_tag(pb, track, t->value); else avio_wb16(pb, 0); /* zero size */ #else avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "tmcd"); /* Data format */ avio_wb32(pb, 0); /* Reserved */ avio_wb32(pb, 1); /* Data reference index */ if (track->enc->extradata_size) avio_write(pb, track->enc->extradata, track->enc->extradata_size); #endif return update_size(pb, pos); }
false
FFmpeg
b4dcd351ec50caaa484bc5c66b4a8d5557a0f1ea
static int mov_write_tmcd_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = avio_tell(pb); #if 1 int frame_duration = av_rescale(track->timescale, track->enc->time_base.num, track->enc->time_base.den); int nb_frames = ROUNDED_DIV(track->enc->time_base.den, track->enc->time_base.num); AVDictionaryEntry *t = NULL; if (nb_frames > 255) { av_log(NULL, AV_LOG_ERROR, "fps %d is too large\n", nb_frames); return AVERROR(EINVAL); } avio_wb32(pb, 0); ffio_wfourcc(pb, "tmcd"); avio_wb32(pb, 0); avio_wb32(pb, 1); avio_wb32(pb, 0); avio_wb32(pb, track->timecode_flags); avio_wb32(pb, track->timescale); avio_wb32(pb, frame_duration); avio_w8(pb, nb_frames); avio_w8(pb, 0); if (track->st) t = av_dict_get(track->st->metadata, "reel_name", NULL, 0); if (t && utf8len(t->value)) mov_write_source_reference_tag(pb, track, t->value); else avio_wb16(pb, 0); #else avio_wb32(pb, 0); ffio_wfourcc(pb, "tmcd"); avio_wb32(pb, 0); avio_wb32(pb, 1); if (track->enc->extradata_size) avio_write(pb, track->enc->extradata, track->enc->extradata_size); #endif return update_size(pb, pos); }
{ "code": [], "line_no": [] }
static int FUNC_0(AVIOContext *VAR_0, MOVTrack *VAR_1) { int64_t pos = avio_tell(VAR_0); #if 1 int VAR_2 = av_rescale(VAR_1->timescale, VAR_1->enc->time_base.num, VAR_1->enc->time_base.den); int VAR_3 = ROUNDED_DIV(VAR_1->enc->time_base.den, VAR_1->enc->time_base.num); AVDictionaryEntry *t = NULL; if (VAR_3 > 255) { av_log(NULL, AV_LOG_ERROR, "fps %d is too large\n", VAR_3); return AVERROR(EINVAL); } avio_wb32(VAR_0, 0); ffio_wfourcc(VAR_0, "tmcd"); avio_wb32(VAR_0, 0); avio_wb32(VAR_0, 1); avio_wb32(VAR_0, 0); avio_wb32(VAR_0, VAR_1->timecode_flags); avio_wb32(VAR_0, VAR_1->timescale); avio_wb32(VAR_0, VAR_2); avio_w8(VAR_0, VAR_3); avio_w8(VAR_0, 0); if (VAR_1->st) t = av_dict_get(VAR_1->st->metadata, "reel_name", NULL, 0); if (t && utf8len(t->value)) mov_write_source_reference_tag(VAR_0, VAR_1, t->value); else avio_wb16(VAR_0, 0); #else avio_wb32(VAR_0, 0); ffio_wfourcc(VAR_0, "tmcd"); avio_wb32(VAR_0, 0); avio_wb32(VAR_0, 1); if (VAR_1->enc->extradata_size) avio_write(VAR_0, VAR_1->enc->extradata, VAR_1->enc->extradata_size); #endif return update_size(VAR_0, pos); }
[ "static int FUNC_0(AVIOContext *VAR_0, MOVTrack *VAR_1)\n{", "int64_t pos = avio_tell(VAR_0);", "#if 1\nint VAR_2 = av_rescale(VAR_1->timescale, VAR_1->enc->time_base.num, VAR_1->enc->time_base.den);", "int VAR_3 = ROUNDED_DIV(VAR_1->enc->time_base.den, VAR_1->enc->time_base.num);", "AVDictionaryEntry *t = NULL;", "if (VAR_3 > 255) {", "av_log(NULL, AV_LOG_ERROR, \"fps %d is too large\\n\", VAR_3);", "return AVERROR(EINVAL);", "}", "avio_wb32(VAR_0, 0);", "ffio_wfourcc(VAR_0, \"tmcd\");", "avio_wb32(VAR_0, 0);", "avio_wb32(VAR_0, 1);", "avio_wb32(VAR_0, 0);", "avio_wb32(VAR_0, VAR_1->timecode_flags);", "avio_wb32(VAR_0, VAR_1->timescale);", "avio_wb32(VAR_0, VAR_2);", "avio_w8(VAR_0, VAR_3);", "avio_w8(VAR_0, 0);", "if (VAR_1->st)\nt = av_dict_get(VAR_1->st->metadata, \"reel_name\", NULL, 0);", "if (t && utf8len(t->value))\nmov_write_source_reference_tag(VAR_0, VAR_1, t->value);", "else\navio_wb16(VAR_0, 0);", "#else\navio_wb32(VAR_0, 0);", "ffio_wfourcc(VAR_0, \"tmcd\");", "avio_wb32(VAR_0, 0);", "avio_wb32(VAR_0, 1);", "if (VAR_1->enc->extradata_size)\navio_write(VAR_0, VAR_1->enc->extradata, VAR_1->enc->extradata_size);", "#endif\nreturn update_size(VAR_0, pos);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 55, 57 ], [ 59, 61 ], [ 63, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79, 81 ], [ 83 ] ]
191
static void dv_decode_ac(DVVideoDecodeContext *s, BlockInfo *mb, DCTELEM *block, int last_index) { int last_re_index; int shift_offset = mb->shift_offset; const UINT8 *scan_table = mb->scan_table; const UINT8 *shift_table = mb->shift_table; int pos = mb->pos; int level, pos1, sign, run; int partial_bit_count; OPEN_READER(re, &s->gb); #ifdef VLC_DEBUG printf("start\n"); #endif /* if we must parse a partial vlc, we do it here */ partial_bit_count = mb->partial_bit_count; if (partial_bit_count > 0) { UINT8 buf[4]; UINT32 v; int l, l1; GetBitContext gb1; /* build the dummy bit buffer */ l = 16 - partial_bit_count; UPDATE_CACHE(re, &s->gb); #ifdef VLC_DEBUG printf("show=%04x\n", SHOW_UBITS(re, &s->gb, 16)); #endif v = (mb->partial_bit_buffer << l) | SHOW_UBITS(re, &s->gb, l); buf[0] = v >> 8; buf[1] = v; #ifdef VLC_DEBUG printf("v=%04x cnt=%d %04x\n", v, partial_bit_count, (mb->partial_bit_buffer << l)); #endif /* try to read the codeword */ init_get_bits(&gb1, buf, 4); { OPEN_READER(re1, &gb1); UPDATE_CACHE(re1, &gb1); GET_RL_VLC(level, run, re1, &gb1, dv_rl_vlc[0], TEX_VLC_BITS, 2); l = re1_index; CLOSE_READER(re1, &gb1); } #ifdef VLC_DEBUG printf("****run=%d level=%d size=%d\n", run, level, l); #endif /* compute codeword length */ l1 = (level != 256 && level != 0); /* if too long, we cannot parse */ l -= partial_bit_count; if ((re_index + l + l1) > last_index) return; /* skip read bits */ last_re_index = 0; /* avoid warning */ re_index += l; /* by definition, if we can read the vlc, all partial bits will be read (otherwise we could have read the vlc before) */ mb->partial_bit_count = 0; UPDATE_CACHE(re, &s->gb); goto handle_vlc; } /* get the AC coefficients until last_index is reached */ for(;;) { UPDATE_CACHE(re, &s->gb); #ifdef VLC_DEBUG printf("%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, &s->gb, 16), re_index); #endif last_re_index = re_index; GET_RL_VLC(level, run, re, &s->gb, dv_rl_vlc[0], TEX_VLC_BITS, 2); handle_vlc: #ifdef VLC_DEBUG printf("run=%d level=%d\n", run, level); #endif if (level == 256) { if (re_index > last_index) { cannot_read: /* put position before read code */ re_index = last_re_index; mb->eob_reached = 0; break; } /* EOB */ mb->eob_reached = 1; break; } else if (level != 0) { if ((re_index + 1) > last_index) goto cannot_read; sign = SHOW_SBITS(re, &s->gb, 1); level = (level ^ sign) - sign; LAST_SKIP_BITS(re, &s->gb, 1); pos += run; /* error */ if (pos >= 64) { goto read_error; } pos1 = scan_table[pos]; level = level << (shift_table[pos1] + shift_offset); block[pos1] = level; // printf("run=%d level=%d shift=%d\n", run, level, shift_table[pos1]); } else { if (re_index > last_index) goto cannot_read; /* level is zero: means run without coding. No sign is coded */ pos += run; /* error */ if (pos >= 64) { read_error: #if defined(VLC_DEBUG) || 1 printf("error pos=%d\n", pos); #endif /* for errors, we consider the eob is reached */ mb->eob_reached = 1; break; } } } CLOSE_READER(re, &s->gb); mb->pos = pos; }
false
FFmpeg
68f593b48433842f3407586679fe07f3e5199ab9
static void dv_decode_ac(DVVideoDecodeContext *s, BlockInfo *mb, DCTELEM *block, int last_index) { int last_re_index; int shift_offset = mb->shift_offset; const UINT8 *scan_table = mb->scan_table; const UINT8 *shift_table = mb->shift_table; int pos = mb->pos; int level, pos1, sign, run; int partial_bit_count; OPEN_READER(re, &s->gb); #ifdef VLC_DEBUG printf("start\n"); #endif partial_bit_count = mb->partial_bit_count; if (partial_bit_count > 0) { UINT8 buf[4]; UINT32 v; int l, l1; GetBitContext gb1; l = 16 - partial_bit_count; UPDATE_CACHE(re, &s->gb); #ifdef VLC_DEBUG printf("show=%04x\n", SHOW_UBITS(re, &s->gb, 16)); #endif v = (mb->partial_bit_buffer << l) | SHOW_UBITS(re, &s->gb, l); buf[0] = v >> 8; buf[1] = v; #ifdef VLC_DEBUG printf("v=%04x cnt=%d %04x\n", v, partial_bit_count, (mb->partial_bit_buffer << l)); #endif init_get_bits(&gb1, buf, 4); { OPEN_READER(re1, &gb1); UPDATE_CACHE(re1, &gb1); GET_RL_VLC(level, run, re1, &gb1, dv_rl_vlc[0], TEX_VLC_BITS, 2); l = re1_index; CLOSE_READER(re1, &gb1); } #ifdef VLC_DEBUG printf("****run=%d level=%d size=%d\n", run, level, l); #endif l1 = (level != 256 && level != 0); l -= partial_bit_count; if ((re_index + l + l1) > last_index) return; last_re_index = 0; re_index += l; mb->partial_bit_count = 0; UPDATE_CACHE(re, &s->gb); goto handle_vlc; } for(;;) { UPDATE_CACHE(re, &s->gb); #ifdef VLC_DEBUG printf("%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, &s->gb, 16), re_index); #endif last_re_index = re_index; GET_RL_VLC(level, run, re, &s->gb, dv_rl_vlc[0], TEX_VLC_BITS, 2); handle_vlc: #ifdef VLC_DEBUG printf("run=%d level=%d\n", run, level); #endif if (level == 256) { if (re_index > last_index) { cannot_read: re_index = last_re_index; mb->eob_reached = 0; break; } mb->eob_reached = 1; break; } else if (level != 0) { if ((re_index + 1) > last_index) goto cannot_read; sign = SHOW_SBITS(re, &s->gb, 1); level = (level ^ sign) - sign; LAST_SKIP_BITS(re, &s->gb, 1); pos += run; if (pos >= 64) { goto read_error; } pos1 = scan_table[pos]; level = level << (shift_table[pos1] + shift_offset); block[pos1] = level; } else { if (re_index > last_index) goto cannot_read; pos += run; if (pos >= 64) { read_error: #if defined(VLC_DEBUG) || 1 printf("error pos=%d\n", pos); #endif mb->eob_reached = 1; break; } } } CLOSE_READER(re, &s->gb); mb->pos = pos; }
{ "code": [], "line_no": [] }
static void FUNC_0(DVVideoDecodeContext *VAR_0, BlockInfo *VAR_1, DCTELEM *VAR_2, int VAR_3) { int VAR_4; int VAR_5 = VAR_1->VAR_5; const UINT8 *VAR_6 = VAR_1->VAR_6; const UINT8 *VAR_7 = VAR_1->VAR_7; int VAR_8 = VAR_1->VAR_8; int VAR_9, VAR_10, VAR_11, VAR_12; int VAR_13; OPEN_READER(re, &VAR_0->gb); #ifdef VLC_DEBUG printf("start\n"); #endif VAR_13 = VAR_1->VAR_13; if (VAR_13 > 0) { UINT8 buf[4]; UINT32 v; int VAR_14, VAR_15; GetBitContext gb1; VAR_14 = 16 - VAR_13; UPDATE_CACHE(re, &VAR_0->gb); #ifdef VLC_DEBUG printf("show=%04x\n", SHOW_UBITS(re, &VAR_0->gb, 16)); #endif v = (VAR_1->partial_bit_buffer << VAR_14) | SHOW_UBITS(re, &VAR_0->gb, VAR_14); buf[0] = v >> 8; buf[1] = v; #ifdef VLC_DEBUG printf("v=%04x cnt=%d %04x\n", v, VAR_13, (VAR_1->partial_bit_buffer << VAR_14)); #endif init_get_bits(&gb1, buf, 4); { OPEN_READER(re1, &gb1); UPDATE_CACHE(re1, &gb1); GET_RL_VLC(VAR_9, VAR_12, re1, &gb1, dv_rl_vlc[0], TEX_VLC_BITS, 2); VAR_14 = re1_index; CLOSE_READER(re1, &gb1); } #ifdef VLC_DEBUG printf("****VAR_12=%d VAR_9=%d size=%d\n", VAR_12, VAR_9, VAR_14); #endif VAR_15 = (VAR_9 != 256 && VAR_9 != 0); VAR_14 -= VAR_13; if ((re_index + VAR_14 + VAR_15) > VAR_3) return; VAR_4 = 0; re_index += VAR_14; VAR_1->VAR_13 = 0; UPDATE_CACHE(re, &VAR_0->gb); goto handle_vlc; } for(;;) { UPDATE_CACHE(re, &VAR_0->gb); #ifdef VLC_DEBUG printf("%2d: bits=%04x index=%d\n", VAR_8, SHOW_UBITS(re, &VAR_0->gb, 16), re_index); #endif VAR_4 = re_index; GET_RL_VLC(VAR_9, VAR_12, re, &VAR_0->gb, dv_rl_vlc[0], TEX_VLC_BITS, 2); handle_vlc: #ifdef VLC_DEBUG printf("VAR_12=%d VAR_9=%d\n", VAR_12, VAR_9); #endif if (VAR_9 == 256) { if (re_index > VAR_3) { cannot_read: re_index = VAR_4; VAR_1->eob_reached = 0; break; } VAR_1->eob_reached = 1; break; } else if (VAR_9 != 0) { if ((re_index + 1) > VAR_3) goto cannot_read; VAR_11 = SHOW_SBITS(re, &VAR_0->gb, 1); VAR_9 = (VAR_9 ^ VAR_11) - VAR_11; LAST_SKIP_BITS(re, &VAR_0->gb, 1); VAR_8 += VAR_12; if (VAR_8 >= 64) { goto read_error; } VAR_10 = VAR_6[VAR_8]; VAR_9 = VAR_9 << (VAR_7[VAR_10] + VAR_5); VAR_2[VAR_10] = VAR_9; } else { if (re_index > VAR_3) goto cannot_read; VAR_8 += VAR_12; if (VAR_8 >= 64) { read_error: #if defined(VLC_DEBUG) || 1 printf("error VAR_8=%d\n", VAR_8); #endif VAR_1->eob_reached = 1; break; } } } CLOSE_READER(re, &VAR_0->gb); VAR_1->VAR_8 = VAR_8; }
[ "static void FUNC_0(DVVideoDecodeContext *VAR_0,\nBlockInfo *VAR_1, DCTELEM *VAR_2, int VAR_3)\n{", "int VAR_4;", "int VAR_5 = VAR_1->VAR_5;", "const UINT8 *VAR_6 = VAR_1->VAR_6;", "const UINT8 *VAR_7 = VAR_1->VAR_7;", "int VAR_8 = VAR_1->VAR_8;", "int VAR_9, VAR_10, VAR_11, VAR_12;", "int VAR_13;", "OPEN_READER(re, &VAR_0->gb);", "#ifdef VLC_DEBUG\nprintf(\"start\\n\");", "#endif\nVAR_13 = VAR_1->VAR_13;", "if (VAR_13 > 0) {", "UINT8 buf[4];", "UINT32 v;", "int VAR_14, VAR_15;", "GetBitContext gb1;", "VAR_14 = 16 - VAR_13;", "UPDATE_CACHE(re, &VAR_0->gb);", "#ifdef VLC_DEBUG\nprintf(\"show=%04x\\n\", SHOW_UBITS(re, &VAR_0->gb, 16));", "#endif\nv = (VAR_1->partial_bit_buffer << VAR_14) | SHOW_UBITS(re, &VAR_0->gb, VAR_14);", "buf[0] = v >> 8;", "buf[1] = v;", "#ifdef VLC_DEBUG\nprintf(\"v=%04x cnt=%d %04x\\n\",\nv, VAR_13, (VAR_1->partial_bit_buffer << VAR_14));", "#endif\ninit_get_bits(&gb1, buf, 4);", "{", "OPEN_READER(re1, &gb1);", "UPDATE_CACHE(re1, &gb1);", "GET_RL_VLC(VAR_9, VAR_12, re1, &gb1, dv_rl_vlc[0],\nTEX_VLC_BITS, 2);", "VAR_14 = re1_index;", "CLOSE_READER(re1, &gb1);", "}", "#ifdef VLC_DEBUG\nprintf(\"****VAR_12=%d VAR_9=%d size=%d\\n\", VAR_12, VAR_9, VAR_14);", "#endif\nVAR_15 = (VAR_9 != 256 && VAR_9 != 0);", "VAR_14 -= VAR_13;", "if ((re_index + VAR_14 + VAR_15) > VAR_3)\nreturn;", "VAR_4 = 0;", "re_index += VAR_14;", "VAR_1->VAR_13 = 0;", "UPDATE_CACHE(re, &VAR_0->gb);", "goto handle_vlc;", "}", "for(;;) {", "UPDATE_CACHE(re, &VAR_0->gb);", "#ifdef VLC_DEBUG\nprintf(\"%2d: bits=%04x index=%d\\n\",\nVAR_8, SHOW_UBITS(re, &VAR_0->gb, 16), re_index);", "#endif\nVAR_4 = re_index;", "GET_RL_VLC(VAR_9, VAR_12, re, &VAR_0->gb, dv_rl_vlc[0],\nTEX_VLC_BITS, 2);", "handle_vlc:\n#ifdef VLC_DEBUG\nprintf(\"VAR_12=%d VAR_9=%d\\n\", VAR_12, VAR_9);", "#endif\nif (VAR_9 == 256) {", "if (re_index > VAR_3) {", "cannot_read:\nre_index = VAR_4;", "VAR_1->eob_reached = 0;", "break;", "}", "VAR_1->eob_reached = 1;", "break;", "} else if (VAR_9 != 0) {", "if ((re_index + 1) > VAR_3)\ngoto cannot_read;", "VAR_11 = SHOW_SBITS(re, &VAR_0->gb, 1);", "VAR_9 = (VAR_9 ^ VAR_11) - VAR_11;", "LAST_SKIP_BITS(re, &VAR_0->gb, 1);", "VAR_8 += VAR_12;", "if (VAR_8 >= 64) {", "goto read_error;", "}", "VAR_10 = VAR_6[VAR_8];", "VAR_9 = VAR_9 << (VAR_7[VAR_10] + VAR_5);", "VAR_2[VAR_10] = VAR_9;", "} else {", "if (re_index > VAR_3)\ngoto cannot_read;", "VAR_8 += VAR_12;", "if (VAR_8 >= 64) {", "read_error:\n#if defined(VLC_DEBUG) || 1\nprintf(\"error VAR_8=%d\\n\", VAR_8);", "#endif\nVAR_1->eob_reached = 1;", "break;", "}", "}", "}", "CLOSE_READER(re, &VAR_0->gb);", "VAR_1->VAR_8 = 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27, 29 ], [ 31, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69, 71, 73 ], [ 75, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101, 105 ], [ 109 ], [ 111, 113 ], [ 117 ], [ 119 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 137 ], [ 139 ], [ 141, 143, 145 ], [ 147, 149 ], [ 151, 153 ], [ 155, 157, 159 ], [ 161, 163 ], [ 165 ], [ 167, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217, 219 ], [ 225 ], [ 229 ], [ 231, 233, 235 ], [ 237, 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ] ]
192
static int expand_rle_row16(SgiState *s, uint16_t *out_buf, int len, int pixelstride) { unsigned short pixel; unsigned char count; unsigned short *orig = out_buf; uint16_t *out_end = out_buf + len; while (out_buf < out_end) { if (bytestream2_get_bytes_left(&s->g) < 2) return AVERROR_INVALIDDATA; pixel = bytestream2_get_be16u(&s->g); if (!(count = (pixel & 0x7f))) break; /* Check for buffer overflow. */ if (pixelstride * (count - 1) >= len) { av_log(s->avctx, AV_LOG_ERROR, "Invalid pixel count.\n"); return AVERROR_INVALIDDATA; } if (pixel & 0x80) { while (count--) { pixel = bytestream2_get_ne16(&s->g); AV_WN16A(out_buf, pixel); out_buf += pixelstride; } } else { pixel = bytestream2_get_ne16(&s->g); while (count--) { AV_WN16A(out_buf, pixel); out_buf += pixelstride; } } } return (out_buf - orig) / pixelstride; }
false
FFmpeg
a050cf0c451bdf1c1bd512c4fce6b6f8a5e85102
static int expand_rle_row16(SgiState *s, uint16_t *out_buf, int len, int pixelstride) { unsigned short pixel; unsigned char count; unsigned short *orig = out_buf; uint16_t *out_end = out_buf + len; while (out_buf < out_end) { if (bytestream2_get_bytes_left(&s->g) < 2) return AVERROR_INVALIDDATA; pixel = bytestream2_get_be16u(&s->g); if (!(count = (pixel & 0x7f))) break; if (pixelstride * (count - 1) >= len) { av_log(s->avctx, AV_LOG_ERROR, "Invalid pixel count.\n"); return AVERROR_INVALIDDATA; } if (pixel & 0x80) { while (count--) { pixel = bytestream2_get_ne16(&s->g); AV_WN16A(out_buf, pixel); out_buf += pixelstride; } } else { pixel = bytestream2_get_ne16(&s->g); while (count--) { AV_WN16A(out_buf, pixel); out_buf += pixelstride; } } } return (out_buf - orig) / pixelstride; }
{ "code": [], "line_no": [] }
static int FUNC_0(SgiState *VAR_0, uint16_t *VAR_1, int VAR_2, int VAR_3) { unsigned short VAR_4; unsigned char VAR_5; unsigned short *VAR_6 = VAR_1; uint16_t *out_end = VAR_1 + VAR_2; while (VAR_1 < out_end) { if (bytestream2_get_bytes_left(&VAR_0->g) < 2) return AVERROR_INVALIDDATA; VAR_4 = bytestream2_get_be16u(&VAR_0->g); if (!(VAR_5 = (VAR_4 & 0x7f))) break; if (VAR_3 * (VAR_5 - 1) >= VAR_2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid VAR_4 VAR_5.\n"); return AVERROR_INVALIDDATA; } if (VAR_4 & 0x80) { while (VAR_5--) { VAR_4 = bytestream2_get_ne16(&VAR_0->g); AV_WN16A(VAR_1, VAR_4); VAR_1 += VAR_3; } } else { VAR_4 = bytestream2_get_ne16(&VAR_0->g); while (VAR_5--) { AV_WN16A(VAR_1, VAR_4); VAR_1 += VAR_3; } } } return (VAR_1 - VAR_6) / VAR_3; }
[ "static int FUNC_0(SgiState *VAR_0, uint16_t *VAR_1,\nint VAR_2, int VAR_3)\n{", "unsigned short VAR_4;", "unsigned char VAR_5;", "unsigned short *VAR_6 = VAR_1;", "uint16_t *out_end = VAR_1 + VAR_2;", "while (VAR_1 < out_end) {", "if (bytestream2_get_bytes_left(&VAR_0->g) < 2)\nreturn AVERROR_INVALIDDATA;", "VAR_4 = bytestream2_get_be16u(&VAR_0->g);", "if (!(VAR_5 = (VAR_4 & 0x7f)))\nbreak;", "if (VAR_3 * (VAR_5 - 1) >= VAR_2) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid VAR_4 VAR_5.\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (VAR_4 & 0x80) {", "while (VAR_5--) {", "VAR_4 = bytestream2_get_ne16(&VAR_0->g);", "AV_WN16A(VAR_1, VAR_4);", "VAR_1 += VAR_3;", "}", "} else {", "VAR_4 = bytestream2_get_ne16(&VAR_0->g);", "while (VAR_5--) {", "AV_WN16A(VAR_1, VAR_4);", "VAR_1 += VAR_3;", "}", "}", "}", "return (VAR_1 - VAR_6) / VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ] ]
193
void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx, void *retaddr) { TranslationBlock *tb; CPUState *saved_env; unsigned long pc; int ret; saved_env = env; ret = cpu_arm_handle_mmu_fault(env, addr, is_write, mmu_idx); if (unlikely(ret)) { if (retaddr) { /* now we have a real cpu fault */ pc = (unsigned long)retaddr; tb = tb_find_pc(pc); if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ cpu_restore_state(tb, env, pc); } } raise_exception(env->exception_index); } env = saved_env; }
true
qemu
6e19a1379d3d12c2d8f934aa8154037a609f4507
void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx, void *retaddr) { TranslationBlock *tb; CPUState *saved_env; unsigned long pc; int ret; saved_env = env; ret = cpu_arm_handle_mmu_fault(env, addr, is_write, mmu_idx); if (unlikely(ret)) { if (retaddr) { pc = (unsigned long)retaddr; tb = tb_find_pc(pc); if (tb) { cpu_restore_state(tb, env, pc); } } raise_exception(env->exception_index); } env = saved_env; }
{ "code": [], "line_no": [] }
void FUNC_0(CPUState *VAR_0, target_ulong VAR_1, int VAR_2, int VAR_3, void *VAR_4) { TranslationBlock *tb; CPUState *saved_env; unsigned long VAR_5; int VAR_6; saved_env = env; VAR_6 = cpu_arm_handle_mmu_fault(env, VAR_1, VAR_2, VAR_3); if (unlikely(VAR_6)) { if (VAR_4) { VAR_5 = (unsigned long)VAR_4; tb = tb_find_pc(VAR_5); if (tb) { cpu_restore_state(tb, env, VAR_5); } } raise_exception(env->exception_index); } env = saved_env; }
[ "void FUNC_0(CPUState *VAR_0, target_ulong VAR_1, int VAR_2, int VAR_3,\nvoid *VAR_4)\n{", "TranslationBlock *tb;", "CPUState *saved_env;", "unsigned long VAR_5;", "int VAR_6;", "saved_env = env;", "VAR_6 = cpu_arm_handle_mmu_fault(env, VAR_1, VAR_2, VAR_3);", "if (unlikely(VAR_6)) {", "if (VAR_4) {", "VAR_5 = (unsigned long)VAR_4;", "tb = tb_find_pc(VAR_5);", "if (tb) {", "cpu_restore_state(tb, env, VAR_5);", "}", "}", "raise_exception(env->exception_index);", "}", "env = saved_env;", "}" ]
[ 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 ], [ 20 ], [ 22 ], [ 24 ], [ 28 ], [ 30 ], [ 32 ], [ 38 ], [ 40 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 50 ] ]
194
static int webvtt_read_header(AVFormatContext *s) { WebVTTContext *webvtt = s->priv_data; AVBPrint header, cue; int res = 0; AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); avpriv_set_pts_info(st, 64, 1, 1000); st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id = AV_CODEC_ID_WEBVTT; st->disposition |= webvtt->kind; av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED); av_bprint_init(&cue, 0, AV_BPRINT_SIZE_UNLIMITED); for (;;) { int i; int64_t pos; AVPacket *sub; const char *p, *identifier, *settings; int identifier_len, settings_len; int64_t ts_start, ts_end; ff_subtitles_read_chunk(s->pb, &cue); if (!cue.len) break; p = identifier = cue.str; pos = avio_tell(s->pb); /* ignore header chunk */ if (!strncmp(p, "\xEF\xBB\xBFWEBVTT", 9) || !strncmp(p, "WEBVTT", 6)) continue; /* optional cue identifier (can be a number like in SRT or some kind of * chaptering id) */ for (i = 0; p[i] && p[i] != '\n' && p[i] != '\r'; i++) { if (!strncmp(p + i, "-->", 3)) { identifier = NULL; break; } } if (!identifier) identifier_len = 0; else { identifier_len = strcspn(p, "\r\n"); p += identifier_len; if (*p == '\r') p++; if (*p == '\n') p++; } /* cue timestamps */ if ((ts_start = read_ts(p)) == AV_NOPTS_VALUE) break; if (!(p = strstr(p, "-->"))) break; p += 3; do p++; while (*p == ' ' || *p == '\t'); if ((ts_end = read_ts(p)) == AV_NOPTS_VALUE) break; /* optional cue settings */ p += strcspn(p, "\n\t "); while (*p == '\t' || *p == ' ') p++; settings = p; settings_len = strcspn(p, "\r\n"); p += settings_len; if (*p == '\r') p++; if (*p == '\n') p++; /* create packet */ sub = ff_subtitles_queue_insert(&webvtt->q, p, strlen(p), 0); if (!sub) { res = AVERROR(ENOMEM); goto end; } sub->pos = pos; sub->pts = ts_start; sub->duration = ts_end - ts_start; #define SET_SIDE_DATA(name, type) do { \ if (name##_len) { \ uint8_t *buf = av_packet_new_side_data(sub, type, name##_len); \ if (!buf) { \ res = AVERROR(ENOMEM); \ goto end; \ } \ memcpy(buf, name, name##_len); \ } \ } while (0) SET_SIDE_DATA(identifier, AV_PKT_DATA_WEBVTT_IDENTIFIER); SET_SIDE_DATA(settings, AV_PKT_DATA_WEBVTT_SETTINGS); } ff_subtitles_queue_finalize(&webvtt->q); end: av_bprint_finalize(&cue, NULL); av_bprint_finalize(&header, NULL); return res; }
true
FFmpeg
b0517467c0b60b9e9e1a660859727e1f512c70d0
static int webvtt_read_header(AVFormatContext *s) { WebVTTContext *webvtt = s->priv_data; AVBPrint header, cue; int res = 0; AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); avpriv_set_pts_info(st, 64, 1, 1000); st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id = AV_CODEC_ID_WEBVTT; st->disposition |= webvtt->kind; av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED); av_bprint_init(&cue, 0, AV_BPRINT_SIZE_UNLIMITED); for (;;) { int i; int64_t pos; AVPacket *sub; const char *p, *identifier, *settings; int identifier_len, settings_len; int64_t ts_start, ts_end; ff_subtitles_read_chunk(s->pb, &cue); if (!cue.len) break; p = identifier = cue.str; pos = avio_tell(s->pb); if (!strncmp(p, "\xEF\xBB\xBFWEBVTT", 9) || !strncmp(p, "WEBVTT", 6)) continue; for (i = 0; p[i] && p[i] != '\n' && p[i] != '\r'; i++) { if (!strncmp(p + i, "-->", 3)) { identifier = NULL; break; } } if (!identifier) identifier_len = 0; else { identifier_len = strcspn(p, "\r\n"); p += identifier_len; if (*p == '\r') p++; if (*p == '\n') p++; } if ((ts_start = read_ts(p)) == AV_NOPTS_VALUE) break; if (!(p = strstr(p, "-->"))) break; p += 3; do p++; while (*p == ' ' || *p == '\t'); if ((ts_end = read_ts(p)) == AV_NOPTS_VALUE) break; p += strcspn(p, "\n\t "); while (*p == '\t' || *p == ' ') p++; settings = p; settings_len = strcspn(p, "\r\n"); p += settings_len; if (*p == '\r') p++; if (*p == '\n') p++; sub = ff_subtitles_queue_insert(&webvtt->q, p, strlen(p), 0); if (!sub) { res = AVERROR(ENOMEM); goto end; } sub->pos = pos; sub->pts = ts_start; sub->duration = ts_end - ts_start; #define SET_SIDE_DATA(name, type) do { \ if (name##_len) { \ uint8_t *buf = av_packet_new_side_data(sub, type, name##_len); \ if (!buf) { \ res = AVERROR(ENOMEM); \ goto end; \ } \ memcpy(buf, name, name##_len); \ } \ } while (0) SET_SIDE_DATA(identifier, AV_PKT_DATA_WEBVTT_IDENTIFIER); SET_SIDE_DATA(settings, AV_PKT_DATA_WEBVTT_SETTINGS); } ff_subtitles_queue_finalize(&webvtt->q); end: av_bprint_finalize(&cue, NULL); av_bprint_finalize(&header, NULL); return res; }
{ "code": [ " p += 3;" ], "line_no": [ 125 ] }
static int FUNC_0(AVFormatContext *VAR_0) { WebVTTContext *webvtt = VAR_0->priv_data; AVBPrint header, cue; int VAR_1 = 0; AVStream *st = avformat_new_stream(VAR_0, NULL); if (!st) return AVERROR(ENOMEM); avpriv_set_pts_info(st, 64, 1, 1000); st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id = AV_CODEC_ID_WEBVTT; st->disposition |= webvtt->kind; av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED); av_bprint_init(&cue, 0, AV_BPRINT_SIZE_UNLIMITED); for (;;) { int VAR_2; int64_t pos; AVPacket *sub; const char *VAR_3, *VAR_4, *VAR_5; int VAR_6, VAR_7; int64_t ts_start, ts_end; ff_subtitles_read_chunk(VAR_0->pb, &cue); if (!cue.len) break; VAR_3 = VAR_4 = cue.str; pos = avio_tell(VAR_0->pb); if (!strncmp(VAR_3, "\xEF\xBB\xBFWEBVTT", 9) || !strncmp(VAR_3, "WEBVTT", 6)) continue; for (VAR_2 = 0; VAR_3[VAR_2] && VAR_3[VAR_2] != '\n' && VAR_3[VAR_2] != '\r'; VAR_2++) { if (!strncmp(VAR_3 + VAR_2, "-->", 3)) { VAR_4 = NULL; break; } } if (!VAR_4) VAR_6 = 0; else { VAR_6 = strcspn(VAR_3, "\r\n"); VAR_3 += VAR_6; if (*VAR_3 == '\r') VAR_3++; if (*VAR_3 == '\n') VAR_3++; } if ((ts_start = read_ts(VAR_3)) == AV_NOPTS_VALUE) break; if (!(VAR_3 = strstr(VAR_3, "-->"))) break; VAR_3 += 3; do VAR_3++; while (*VAR_3 == ' ' || *VAR_3 == '\t'); if ((ts_end = read_ts(VAR_3)) == AV_NOPTS_VALUE) break; VAR_3 += strcspn(VAR_3, "\n\t "); while (*VAR_3 == '\t' || *VAR_3 == ' ') VAR_3++; VAR_5 = VAR_3; VAR_7 = strcspn(VAR_3, "\r\n"); VAR_3 += VAR_7; if (*VAR_3 == '\r') VAR_3++; if (*VAR_3 == '\n') VAR_3++; sub = ff_subtitles_queue_insert(&webvtt->q, VAR_3, strlen(VAR_3), 0); if (!sub) { VAR_1 = AVERROR(ENOMEM); goto end; } sub->pos = pos; sub->pts = ts_start; sub->duration = ts_end - ts_start; #define SET_SIDE_DATA(name, type) do { \ if (name##_len) { \ uint8_t *buf = av_packet_new_side_data(sub, type, name##_len); \ if (!buf) { \ VAR_1 = AVERROR(ENOMEM); \ goto end; \ } \ memcpy(buf, name, name##_len); \ } \ } while (0) SET_SIDE_DATA(VAR_4, AV_PKT_DATA_WEBVTT_IDENTIFIER); SET_SIDE_DATA(VAR_5, AV_PKT_DATA_WEBVTT_SETTINGS); } ff_subtitles_queue_finalize(&webvtt->q); end: av_bprint_finalize(&cue, NULL); av_bprint_finalize(&header, NULL); return VAR_1; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "WebVTTContext *webvtt = VAR_0->priv_data;", "AVBPrint header, cue;", "int VAR_1 = 0;", "AVStream *st = avformat_new_stream(VAR_0, NULL);", "if (!st)\nreturn AVERROR(ENOMEM);", "avpriv_set_pts_info(st, 64, 1, 1000);", "st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;", "st->codec->codec_id = AV_CODEC_ID_WEBVTT;", "st->disposition |= webvtt->kind;", "av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED);", "av_bprint_init(&cue, 0, AV_BPRINT_SIZE_UNLIMITED);", "for (;;) {", "int VAR_2;", "int64_t pos;", "AVPacket *sub;", "const char *VAR_3, *VAR_4, *VAR_5;", "int VAR_6, VAR_7;", "int64_t ts_start, ts_end;", "ff_subtitles_read_chunk(VAR_0->pb, &cue);", "if (!cue.len)\nbreak;", "VAR_3 = VAR_4 = cue.str;", "pos = avio_tell(VAR_0->pb);", "if (!strncmp(VAR_3, \"\\xEF\\xBB\\xBFWEBVTT\", 9) ||\n!strncmp(VAR_3, \"WEBVTT\", 6))\ncontinue;", "for (VAR_2 = 0; VAR_3[VAR_2] && VAR_3[VAR_2] != '\\n' && VAR_3[VAR_2] != '\\r'; VAR_2++) {", "if (!strncmp(VAR_3 + VAR_2, \"-->\", 3)) {", "VAR_4 = NULL;", "break;", "}", "}", "if (!VAR_4)\nVAR_6 = 0;", "else {", "VAR_6 = strcspn(VAR_3, \"\\r\\n\");", "VAR_3 += VAR_6;", "if (*VAR_3 == '\\r')\nVAR_3++;", "if (*VAR_3 == '\\n')\nVAR_3++;", "}", "if ((ts_start = read_ts(VAR_3)) == AV_NOPTS_VALUE)\nbreak;", "if (!(VAR_3 = strstr(VAR_3, \"-->\")))\nbreak;", "VAR_3 += 3;", "do VAR_3++; while (*VAR_3 == ' ' || *VAR_3 == '\\t');", "if ((ts_end = read_ts(VAR_3)) == AV_NOPTS_VALUE)\nbreak;", "VAR_3 += strcspn(VAR_3, \"\\n\\t \");", "while (*VAR_3 == '\\t' || *VAR_3 == ' ')\nVAR_3++;", "VAR_5 = VAR_3;", "VAR_7 = strcspn(VAR_3, \"\\r\\n\");", "VAR_3 += VAR_7;", "if (*VAR_3 == '\\r')\nVAR_3++;", "if (*VAR_3 == '\\n')\nVAR_3++;", "sub = ff_subtitles_queue_insert(&webvtt->q, VAR_3, strlen(VAR_3), 0);", "if (!sub) {", "VAR_1 = AVERROR(ENOMEM);", "goto end;", "}", "sub->pos = pos;", "sub->pts = ts_start;", "sub->duration = ts_end - ts_start;", "#define SET_SIDE_DATA(name, type) do { \\", "if (name##_len) { \\", "uint8_t *buf = av_packet_new_side_data(sub, type, name##_len); \\", "if (!buf) { \\", "VAR_1 = AVERROR(ENOMEM); \\", "goto end; \\", "} \\", "memcpy(buf, name, name##_len); \\", "} \\", "} while (0)", "SET_SIDE_DATA(VAR_4, AV_PKT_DATA_WEBVTT_IDENTIFIER);", "SET_SIDE_DATA(VAR_5, AV_PKT_DATA_WEBVTT_SETTINGS);", "}", "ff_subtitles_queue_finalize(&webvtt->q);", "end:\nav_bprint_finalize(&cue, NULL);", "av_bprint_finalize(&header, NULL);", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55, 57 ], [ 61 ], [ 63 ], [ 69, 71, 73 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107, 109 ], [ 111 ], [ 117, 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153, 155 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 213, 215 ], [ 217 ], [ 219 ], [ 221 ] ]
195
int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){ MpegEncContext * const s = &h->s; unsigned int pps_id= get_ue_golomb(&s->gb); PPS *pps; const int qp_bd_offset = 6*(h->sps.bit_depth_luma-8); int bits_left; if(pps_id >= MAX_PPS_COUNT) { av_log(h->s.avctx, AV_LOG_ERROR, "pps_id (%d) out of range\n", pps_id); return -1; } pps= av_mallocz(sizeof(PPS)); if(pps == NULL) return -1; pps->sps_id= get_ue_golomb_31(&s->gb); if((unsigned)pps->sps_id>=MAX_SPS_COUNT || h->sps_buffers[pps->sps_id] == NULL){ av_log(h->s.avctx, AV_LOG_ERROR, "sps_id out of range\n"); goto fail; } pps->cabac= get_bits1(&s->gb); pps->pic_order_present= get_bits1(&s->gb); pps->slice_group_count= get_ue_golomb(&s->gb) + 1; if(pps->slice_group_count > 1 ){ pps->mb_slice_group_map_type= get_ue_golomb(&s->gb); av_log(h->s.avctx, AV_LOG_ERROR, "FMO not supported\n"); switch(pps->mb_slice_group_map_type){ case 0: #if 0 | for( i = 0; i <= num_slice_groups_minus1; i++ ) | | | | run_length[ i ] |1 |ue(v) | #endif break; case 2: #if 0 | for( i = 0; i < num_slice_groups_minus1; i++ ) | | | |{ | | | | top_left_mb[ i ] |1 |ue(v) | | bottom_right_mb[ i ] |1 |ue(v) | | } | | | #endif break; case 3: case 4: case 5: #if 0 | slice_group_change_direction_flag |1 |u(1) | | slice_group_change_rate_minus1 |1 |ue(v) | #endif break; case 6: #if 0 | slice_group_id_cnt_minus1 |1 |ue(v) | | for( i = 0; i <= slice_group_id_cnt_minus1; i++ | | | |) | | | | slice_group_id[ i ] |1 |u(v) | #endif break; } } pps->ref_count[0]= get_ue_golomb(&s->gb) + 1; pps->ref_count[1]= get_ue_golomb(&s->gb) + 1; if(pps->ref_count[0]-1 > 32-1 || pps->ref_count[1]-1 > 32-1){ av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow (pps)\n"); goto fail; } pps->weighted_pred= get_bits1(&s->gb); pps->weighted_bipred_idc= get_bits(&s->gb, 2); pps->init_qp= get_se_golomb(&s->gb) + 26 + qp_bd_offset; pps->init_qs= get_se_golomb(&s->gb) + 26 + qp_bd_offset; pps->chroma_qp_index_offset[0]= get_se_golomb(&s->gb); pps->deblocking_filter_parameters_present= get_bits1(&s->gb); pps->constrained_intra_pred= get_bits1(&s->gb); pps->redundant_pic_cnt_present = get_bits1(&s->gb); pps->transform_8x8_mode= 0; h->dequant_coeff_pps= -1; //contents of sps/pps can change even if id doesn't, so reinit memcpy(pps->scaling_matrix4, h->sps_buffers[pps->sps_id]->scaling_matrix4, sizeof(pps->scaling_matrix4)); memcpy(pps->scaling_matrix8, h->sps_buffers[pps->sps_id]->scaling_matrix8, sizeof(pps->scaling_matrix8)); bits_left = bit_length - get_bits_count(&s->gb); if(bits_left > 0){ pps->transform_8x8_mode= get_bits1(&s->gb); decode_scaling_matrices(h, h->sps_buffers[pps->sps_id], pps, 0, pps->scaling_matrix4, pps->scaling_matrix8); pps->chroma_qp_index_offset[1]= get_se_golomb(&s->gb); //second_chroma_qp_index_offset } else { pps->chroma_qp_index_offset[1]= pps->chroma_qp_index_offset[0]; } build_qp_table(pps, 0, pps->chroma_qp_index_offset[0], h->sps.bit_depth_luma); build_qp_table(pps, 1, pps->chroma_qp_index_offset[1], h->sps.bit_depth_luma); if(pps->chroma_qp_index_offset[0] != pps->chroma_qp_index_offset[1]) pps->chroma_qp_diff= 1; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(h->s.avctx, AV_LOG_DEBUG, "pps:%u sps:%u %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d/%d %s %s %s %s\n", pps_id, pps->sps_id, pps->cabac ? "CABAC" : "CAVLC", pps->slice_group_count, pps->ref_count[0], pps->ref_count[1], pps->weighted_pred ? "weighted" : "", pps->init_qp, pps->init_qs, pps->chroma_qp_index_offset[0], pps->chroma_qp_index_offset[1], pps->deblocking_filter_parameters_present ? "LPAR" : "", pps->constrained_intra_pred ? "CONSTR" : "", pps->redundant_pic_cnt_present ? "REDU" : "", pps->transform_8x8_mode ? "8x8DCT" : "" ); } av_free(h->pps_buffers[pps_id]); h->pps_buffers[pps_id]= pps; return 0; fail: av_free(pps); return -1; }
false
FFmpeg
a7cfef2994d3ceeafb056050533addcd45c32b6a
int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){ MpegEncContext * const s = &h->s; unsigned int pps_id= get_ue_golomb(&s->gb); PPS *pps; const int qp_bd_offset = 6*(h->sps.bit_depth_luma-8); int bits_left; if(pps_id >= MAX_PPS_COUNT) { av_log(h->s.avctx, AV_LOG_ERROR, "pps_id (%d) out of range\n", pps_id); return -1; } pps= av_mallocz(sizeof(PPS)); if(pps == NULL) return -1; pps->sps_id= get_ue_golomb_31(&s->gb); if((unsigned)pps->sps_id>=MAX_SPS_COUNT || h->sps_buffers[pps->sps_id] == NULL){ av_log(h->s.avctx, AV_LOG_ERROR, "sps_id out of range\n"); goto fail; } pps->cabac= get_bits1(&s->gb); pps->pic_order_present= get_bits1(&s->gb); pps->slice_group_count= get_ue_golomb(&s->gb) + 1; if(pps->slice_group_count > 1 ){ pps->mb_slice_group_map_type= get_ue_golomb(&s->gb); av_log(h->s.avctx, AV_LOG_ERROR, "FMO not supported\n"); switch(pps->mb_slice_group_map_type){ case 0: #if 0 | for( i = 0; i <= num_slice_groups_minus1; i++ ) | | | | run_length[ i ] |1 |ue(v) | #endif break; case 2: #if 0 | for( i = 0; i < num_slice_groups_minus1; i++ ) | | | |{ | | | | top_left_mb[ i ] |1 |ue(v) | | bottom_right_mb[ i ] |1 |ue(v) | | } | | | #endif break; case 3: case 4: case 5: #if 0 | slice_group_change_direction_flag |1 |u(1) | | slice_group_change_rate_minus1 |1 |ue(v) | #endif break; case 6: #if 0 | slice_group_id_cnt_minus1 |1 |ue(v) | | for( i = 0; i <= slice_group_id_cnt_minus1; i++ | | | |) | | | | slice_group_id[ i ] |1 |u(v) | #endif break; } } pps->ref_count[0]= get_ue_golomb(&s->gb) + 1; pps->ref_count[1]= get_ue_golomb(&s->gb) + 1; if(pps->ref_count[0]-1 > 32-1 || pps->ref_count[1]-1 > 32-1){ av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow (pps)\n"); goto fail; } pps->weighted_pred= get_bits1(&s->gb); pps->weighted_bipred_idc= get_bits(&s->gb, 2); pps->init_qp= get_se_golomb(&s->gb) + 26 + qp_bd_offset; pps->init_qs= get_se_golomb(&s->gb) + 26 + qp_bd_offset; pps->chroma_qp_index_offset[0]= get_se_golomb(&s->gb); pps->deblocking_filter_parameters_present= get_bits1(&s->gb); pps->constrained_intra_pred= get_bits1(&s->gb); pps->redundant_pic_cnt_present = get_bits1(&s->gb); pps->transform_8x8_mode= 0; h->dequant_coeff_pps= -1; memcpy(pps->scaling_matrix4, h->sps_buffers[pps->sps_id]->scaling_matrix4, sizeof(pps->scaling_matrix4)); memcpy(pps->scaling_matrix8, h->sps_buffers[pps->sps_id]->scaling_matrix8, sizeof(pps->scaling_matrix8)); bits_left = bit_length - get_bits_count(&s->gb); if(bits_left > 0){ pps->transform_8x8_mode= get_bits1(&s->gb); decode_scaling_matrices(h, h->sps_buffers[pps->sps_id], pps, 0, pps->scaling_matrix4, pps->scaling_matrix8); pps->chroma_qp_index_offset[1]= get_se_golomb(&s->gb); } else { pps->chroma_qp_index_offset[1]= pps->chroma_qp_index_offset[0]; } build_qp_table(pps, 0, pps->chroma_qp_index_offset[0], h->sps.bit_depth_luma); build_qp_table(pps, 1, pps->chroma_qp_index_offset[1], h->sps.bit_depth_luma); if(pps->chroma_qp_index_offset[0] != pps->chroma_qp_index_offset[1]) pps->chroma_qp_diff= 1; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(h->s.avctx, AV_LOG_DEBUG, "pps:%u sps:%u %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d/%d %s %s %s %s\n", pps_id, pps->sps_id, pps->cabac ? "CABAC" : "CAVLC", pps->slice_group_count, pps->ref_count[0], pps->ref_count[1], pps->weighted_pred ? "weighted" : "", pps->init_qp, pps->init_qs, pps->chroma_qp_index_offset[0], pps->chroma_qp_index_offset[1], pps->deblocking_filter_parameters_present ? "LPAR" : "", pps->constrained_intra_pred ? "CONSTR" : "", pps->redundant_pic_cnt_present ? "REDU" : "", pps->transform_8x8_mode ? "8x8DCT" : "" ); } av_free(h->pps_buffers[pps_id]); h->pps_buffers[pps_id]= pps; return 0; fail: av_free(pps); return -1; }
{ "code": [], "line_no": [] }
int FUNC_0(H264Context *VAR_0, int VAR_1){ MpegEncContext * const s = &VAR_0->s; unsigned int VAR_2= get_ue_golomb(&s->gb); PPS *pps; const int VAR_3 = 6*(VAR_0->sps.bit_depth_luma-8); int VAR_4; if(VAR_2 >= MAX_PPS_COUNT) { av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_2 (%d) out of range\n", VAR_2); return -1; } pps= av_mallocz(sizeof(PPS)); if(pps == NULL) return -1; pps->sps_id= get_ue_golomb_31(&s->gb); if((unsigned)pps->sps_id>=MAX_SPS_COUNT || VAR_0->sps_buffers[pps->sps_id] == NULL){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "sps_id out of range\n"); goto fail; } pps->cabac= get_bits1(&s->gb); pps->pic_order_present= get_bits1(&s->gb); pps->slice_group_count= get_ue_golomb(&s->gb) + 1; if(pps->slice_group_count > 1 ){ pps->mb_slice_group_map_type= get_ue_golomb(&s->gb); av_log(VAR_0->s.avctx, AV_LOG_ERROR, "FMO not supported\n"); switch(pps->mb_slice_group_map_type){ case 0: #if 0 | for( i = 0; i <= num_slice_groups_minus1; i++ ) | | | | run_length[ i ] |1 |ue(v) | #endif break; case 2: #if 0 | for( i = 0; i < num_slice_groups_minus1; i++ ) | | | |{ | | | | top_left_mb[ i ] |1 |ue(v) | | bottom_right_mb[ i ] |1 |ue(v) | | } | | | #endif break; case 3: case 4: case 5: #if 0 | slice_group_change_direction_flag |1 |u(1) | | slice_group_change_rate_minus1 |1 |ue(v) | #endif break; case 6: #if 0 | slice_group_id_cnt_minus1 |1 |ue(v) | | for( i = 0; i <= slice_group_id_cnt_minus1; i++ | | | |) | | | | slice_group_id[ i ] |1 |u(v) | #endif break; } } pps->ref_count[0]= get_ue_golomb(&s->gb) + 1; pps->ref_count[1]= get_ue_golomb(&s->gb) + 1; if(pps->ref_count[0]-1 > 32-1 || pps->ref_count[1]-1 > 32-1){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "reference overflow (pps)\n"); goto fail; } pps->weighted_pred= get_bits1(&s->gb); pps->weighted_bipred_idc= get_bits(&s->gb, 2); pps->init_qp= get_se_golomb(&s->gb) + 26 + VAR_3; pps->init_qs= get_se_golomb(&s->gb) + 26 + VAR_3; pps->chroma_qp_index_offset[0]= get_se_golomb(&s->gb); pps->deblocking_filter_parameters_present= get_bits1(&s->gb); pps->constrained_intra_pred= get_bits1(&s->gb); pps->redundant_pic_cnt_present = get_bits1(&s->gb); pps->transform_8x8_mode= 0; VAR_0->dequant_coeff_pps= -1; memcpy(pps->scaling_matrix4, VAR_0->sps_buffers[pps->sps_id]->scaling_matrix4, sizeof(pps->scaling_matrix4)); memcpy(pps->scaling_matrix8, VAR_0->sps_buffers[pps->sps_id]->scaling_matrix8, sizeof(pps->scaling_matrix8)); VAR_4 = VAR_1 - get_bits_count(&s->gb); if(VAR_4 > 0){ pps->transform_8x8_mode= get_bits1(&s->gb); decode_scaling_matrices(VAR_0, VAR_0->sps_buffers[pps->sps_id], pps, 0, pps->scaling_matrix4, pps->scaling_matrix8); pps->chroma_qp_index_offset[1]= get_se_golomb(&s->gb); } else { pps->chroma_qp_index_offset[1]= pps->chroma_qp_index_offset[0]; } build_qp_table(pps, 0, pps->chroma_qp_index_offset[0], VAR_0->sps.bit_depth_luma); build_qp_table(pps, 1, pps->chroma_qp_index_offset[1], VAR_0->sps.bit_depth_luma); if(pps->chroma_qp_index_offset[0] != pps->chroma_qp_index_offset[1]) pps->chroma_qp_diff= 1; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(VAR_0->s.avctx, AV_LOG_DEBUG, "pps:%u sps:%u %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d/%d %s %s %s %s\n", VAR_2, pps->sps_id, pps->cabac ? "CABAC" : "CAVLC", pps->slice_group_count, pps->ref_count[0], pps->ref_count[1], pps->weighted_pred ? "weighted" : "", pps->init_qp, pps->init_qs, pps->chroma_qp_index_offset[0], pps->chroma_qp_index_offset[1], pps->deblocking_filter_parameters_present ? "LPAR" : "", pps->constrained_intra_pred ? "CONSTR" : "", pps->redundant_pic_cnt_present ? "REDU" : "", pps->transform_8x8_mode ? "8x8DCT" : "" ); } av_free(VAR_0->pps_buffers[VAR_2]); VAR_0->pps_buffers[VAR_2]= pps; return 0; fail: av_free(pps); return -1; }
[ "int FUNC_0(H264Context *VAR_0, int VAR_1){", "MpegEncContext * const s = &VAR_0->s;", "unsigned int VAR_2= get_ue_golomb(&s->gb);", "PPS *pps;", "const int VAR_3 = 6*(VAR_0->sps.bit_depth_luma-8);", "int VAR_4;", "if(VAR_2 >= MAX_PPS_COUNT) {", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_2 (%d) out of range\\n\", VAR_2);", "return -1;", "}", "pps= av_mallocz(sizeof(PPS));", "if(pps == NULL)\nreturn -1;", "pps->sps_id= get_ue_golomb_31(&s->gb);", "if((unsigned)pps->sps_id>=MAX_SPS_COUNT || VAR_0->sps_buffers[pps->sps_id] == NULL){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"sps_id out of range\\n\");", "goto fail;", "}", "pps->cabac= get_bits1(&s->gb);", "pps->pic_order_present= get_bits1(&s->gb);", "pps->slice_group_count= get_ue_golomb(&s->gb) + 1;", "if(pps->slice_group_count > 1 ){", "pps->mb_slice_group_map_type= get_ue_golomb(&s->gb);", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"FMO not supported\\n\");", "switch(pps->mb_slice_group_map_type){", "case 0:\n#if 0\n| for( i = 0; i <= num_slice_groups_minus1; i++ ) | | |", "| run_length[ i ] |1 |ue(v) |\n#endif\nbreak;", "case 2:\n#if 0\n| for( i = 0; i < num_slice_groups_minus1; i++ ) | | |", "|{ | | |", "| top_left_mb[ i ] |1 |ue(v) |\n| bottom_right_mb[ i ] |1 |ue(v) |\n| } | | |", "#endif\nbreak;", "case 3:\ncase 4:\ncase 5:\n#if 0\n| slice_group_change_direction_flag |1 |u(1) |\n| slice_group_change_rate_minus1 |1 |ue(v) |\n#endif\nbreak;", "case 6:\n#if 0\n| slice_group_id_cnt_minus1 |1 |ue(v) |\n| for( i = 0; i <= slice_group_id_cnt_minus1; i++ | | |", "|) | | |\n| slice_group_id[ i ] |1 |u(v) |\n#endif\nbreak;", "}", "}", "pps->ref_count[0]= get_ue_golomb(&s->gb) + 1;", "pps->ref_count[1]= get_ue_golomb(&s->gb) + 1;", "if(pps->ref_count[0]-1 > 32-1 || pps->ref_count[1]-1 > 32-1){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"reference overflow (pps)\\n\");", "goto fail;", "}", "pps->weighted_pred= get_bits1(&s->gb);", "pps->weighted_bipred_idc= get_bits(&s->gb, 2);", "pps->init_qp= get_se_golomb(&s->gb) + 26 + VAR_3;", "pps->init_qs= get_se_golomb(&s->gb) + 26 + VAR_3;", "pps->chroma_qp_index_offset[0]= get_se_golomb(&s->gb);", "pps->deblocking_filter_parameters_present= get_bits1(&s->gb);", "pps->constrained_intra_pred= get_bits1(&s->gb);", "pps->redundant_pic_cnt_present = get_bits1(&s->gb);", "pps->transform_8x8_mode= 0;", "VAR_0->dequant_coeff_pps= -1;", "memcpy(pps->scaling_matrix4, VAR_0->sps_buffers[pps->sps_id]->scaling_matrix4, sizeof(pps->scaling_matrix4));", "memcpy(pps->scaling_matrix8, VAR_0->sps_buffers[pps->sps_id]->scaling_matrix8, sizeof(pps->scaling_matrix8));", "VAR_4 = VAR_1 - get_bits_count(&s->gb);", "if(VAR_4 > 0){", "pps->transform_8x8_mode= get_bits1(&s->gb);", "decode_scaling_matrices(VAR_0, VAR_0->sps_buffers[pps->sps_id], pps, 0, pps->scaling_matrix4, pps->scaling_matrix8);", "pps->chroma_qp_index_offset[1]= get_se_golomb(&s->gb);", "} else {", "pps->chroma_qp_index_offset[1]= pps->chroma_qp_index_offset[0];", "}", "build_qp_table(pps, 0, pps->chroma_qp_index_offset[0], VAR_0->sps.bit_depth_luma);", "build_qp_table(pps, 1, pps->chroma_qp_index_offset[1], VAR_0->sps.bit_depth_luma);", "if(pps->chroma_qp_index_offset[0] != pps->chroma_qp_index_offset[1])\npps->chroma_qp_diff= 1;", "if(s->avctx->debug&FF_DEBUG_PICT_INFO){", "av_log(VAR_0->s.avctx, AV_LOG_DEBUG, \"pps:%u sps:%u %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d/%d %s %s %s %s\\n\",\nVAR_2, pps->sps_id,\npps->cabac ? \"CABAC\" : \"CAVLC\",\npps->slice_group_count,\npps->ref_count[0], pps->ref_count[1],\npps->weighted_pred ? \"weighted\" : \"\",\npps->init_qp, pps->init_qs, pps->chroma_qp_index_offset[0], pps->chroma_qp_index_offset[1],\npps->deblocking_filter_parameters_present ? \"LPAR\" : \"\",\npps->constrained_intra_pred ? \"CONSTR\" : \"\",\npps->redundant_pic_cnt_present ? \"REDU\" : \"\",\npps->transform_8x8_mode ? \"8x8DCT\" : \"\"\n);", "}", "av_free(VAR_0->pps_buffers[VAR_2]);", "VAR_0->pps_buffers[VAR_2]= pps;", "return 0;", "fail:\nav_free(pps);", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 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 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 193 ], [ 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229, 231 ], [ 233 ], [ 235 ] ]
196
static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){ AVFrame *pic=NULL; int i; const int encoding_delay= s->max_b_frames; int direct=1; if(pic_arg){ if(encoding_delay && !(s->flags&CODEC_FLAG_INPUT_PRESERVED)) direct=0; if(pic_arg->linesize[0] != s->linesize) direct=0; if(pic_arg->linesize[1] != s->uvlinesize) direct=0; if(pic_arg->linesize[2] != s->uvlinesize) direct=0; // printf("%d %d %d %d\n",pic_arg->linesize[0], pic_arg->linesize[1], s->linesize, s->uvlinesize); if(direct){ i= find_unused_picture(s, 1); pic= (AVFrame*)&s->picture[i]; pic->reference= 3; for(i=0; i<4; i++){ pic->data[i]= pic_arg->data[i]; pic->linesize[i]= pic_arg->linesize[i]; } alloc_picture(s, (Picture*)pic, 1); }else{ i= find_unused_picture(s, 0); pic= (AVFrame*)&s->picture[i]; pic->reference= 3; alloc_picture(s, (Picture*)pic, 0); for(i=0; i<4; i++){ /* the input will be 16 pixels to the right relative to the actual buffer start * and the current_pic, so the buffer can be reused, yes its not beatifull */ pic->data[i]+= 16; } if( pic->data[0] == pic_arg->data[0] && pic->data[1] == pic_arg->data[1] && pic->data[2] == pic_arg->data[2]){ // empty }else{ int h_chroma_shift, v_chroma_shift; avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); for(i=0; i<3; i++){ int src_stride= pic_arg->linesize[i]; int dst_stride= i ? s->uvlinesize : s->linesize; int h_shift= i ? h_chroma_shift : 0; int v_shift= i ? v_chroma_shift : 0; int w= s->width >>h_shift; int h= s->height>>v_shift; uint8_t *src= pic_arg->data[i]; uint8_t *dst= pic->data[i]; if(src_stride==dst_stride) memcpy(dst, src, src_stride*h); else{ while(h--){ memcpy(dst, src, w); dst += dst_stride; src += src_stride; } } } } } pic->quality= pic_arg->quality; pic->pict_type= pic_arg->pict_type; pic->pts = pic_arg->pts; if(s->input_picture[encoding_delay]) pic->display_picture_number= s->input_picture[encoding_delay]->display_picture_number + 1; } /* shift buffer entries */ for(i=1; i<MAX_PICTURE_COUNT /*s->encoding_delay+1*/; i++) s->input_picture[i-1]= s->input_picture[i]; s->input_picture[encoding_delay]= (Picture*)pic; return 0; }
true
FFmpeg
6571e41dcdee4655237bca0a3277df8976167aee
static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){ AVFrame *pic=NULL; int i; const int encoding_delay= s->max_b_frames; int direct=1; if(pic_arg){ if(encoding_delay && !(s->flags&CODEC_FLAG_INPUT_PRESERVED)) direct=0; if(pic_arg->linesize[0] != s->linesize) direct=0; if(pic_arg->linesize[1] != s->uvlinesize) direct=0; if(pic_arg->linesize[2] != s->uvlinesize) direct=0; if(direct){ i= find_unused_picture(s, 1); pic= (AVFrame*)&s->picture[i]; pic->reference= 3; for(i=0; i<4; i++){ pic->data[i]= pic_arg->data[i]; pic->linesize[i]= pic_arg->linesize[i]; } alloc_picture(s, (Picture*)pic, 1); }else{ i= find_unused_picture(s, 0); pic= (AVFrame*)&s->picture[i]; pic->reference= 3; alloc_picture(s, (Picture*)pic, 0); for(i=0; i<4; i++){ pic->data[i]+= 16; } if( pic->data[0] == pic_arg->data[0] && pic->data[1] == pic_arg->data[1] && pic->data[2] == pic_arg->data[2]){ }else{ int h_chroma_shift, v_chroma_shift; avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); for(i=0; i<3; i++){ int src_stride= pic_arg->linesize[i]; int dst_stride= i ? s->uvlinesize : s->linesize; int h_shift= i ? h_chroma_shift : 0; int v_shift= i ? v_chroma_shift : 0; int w= s->width >>h_shift; int h= s->height>>v_shift; uint8_t *src= pic_arg->data[i]; uint8_t *dst= pic->data[i]; if(src_stride==dst_stride) memcpy(dst, src, src_stride*h); else{ while(h--){ memcpy(dst, src, w); dst += dst_stride; src += src_stride; } } } } } pic->quality= pic_arg->quality; pic->pict_type= pic_arg->pict_type; pic->pts = pic_arg->pts; if(s->input_picture[encoding_delay]) pic->display_picture_number= s->input_picture[encoding_delay]->display_picture_number + 1; } for(i=1; i<MAX_PICTURE_COUNT ; i++) s->input_picture[i-1]= s->input_picture[i]; s->input_picture[encoding_delay]= (Picture*)pic; return 0; }
{ "code": [ " for(i=0; i<4; i++){", " pic->data[i]+= 16; ", " if( pic->data[0] == pic_arg->data[0] ", " && pic->data[1] == pic_arg->data[1]", " && pic->data[2] == pic_arg->data[2]){", " uint8_t *dst= pic->data[i];" ], "line_no": [ 41, 73, 79, 81, 83, 111 ] }
static int FUNC_0(MpegEncContext *VAR_0, AVFrame *VAR_1){ AVFrame *pic=NULL; int VAR_2; const int VAR_3= VAR_0->max_b_frames; int VAR_4=1; if(VAR_1){ if(VAR_3 && !(VAR_0->flags&CODEC_FLAG_INPUT_PRESERVED)) VAR_4=0; if(VAR_1->linesize[0] != VAR_0->linesize) VAR_4=0; if(VAR_1->linesize[1] != VAR_0->uvlinesize) VAR_4=0; if(VAR_1->linesize[2] != VAR_0->uvlinesize) VAR_4=0; if(VAR_4){ VAR_2= find_unused_picture(VAR_0, 1); pic= (AVFrame*)&VAR_0->picture[VAR_2]; pic->reference= 3; for(VAR_2=0; VAR_2<4; VAR_2++){ pic->data[VAR_2]= VAR_1->data[VAR_2]; pic->linesize[VAR_2]= VAR_1->linesize[VAR_2]; } alloc_picture(VAR_0, (Picture*)pic, 1); }else{ VAR_2= find_unused_picture(VAR_0, 0); pic= (AVFrame*)&VAR_0->picture[VAR_2]; pic->reference= 3; alloc_picture(VAR_0, (Picture*)pic, 0); for(VAR_2=0; VAR_2<4; VAR_2++){ pic->data[VAR_2]+= 16; } if( pic->data[0] == VAR_1->data[0] && pic->data[1] == VAR_1->data[1] && pic->data[2] == VAR_1->data[2]){ }else{ int VAR_5, VAR_6; avcodec_get_chroma_sub_sample(VAR_0->avctx->pix_fmt, &VAR_5, &VAR_6); for(VAR_2=0; VAR_2<3; VAR_2++){ int VAR_7= VAR_1->linesize[VAR_2]; int VAR_8= VAR_2 ? VAR_0->uvlinesize : VAR_0->linesize; int VAR_9= VAR_2 ? VAR_5 : 0; int VAR_10= VAR_2 ? VAR_6 : 0; int VAR_11= VAR_0->width >>VAR_9; int VAR_12= VAR_0->height>>VAR_10; uint8_t *src= VAR_1->data[VAR_2]; uint8_t *dst= pic->data[VAR_2]; if(VAR_7==VAR_8) memcpy(dst, src, VAR_7*VAR_12); else{ while(VAR_12--){ memcpy(dst, src, VAR_11); dst += VAR_8; src += VAR_7; } } } } } pic->quality= VAR_1->quality; pic->pict_type= VAR_1->pict_type; pic->pts = VAR_1->pts; if(VAR_0->input_picture[VAR_3]) pic->display_picture_number= VAR_0->input_picture[VAR_3]->display_picture_number + 1; } for(VAR_2=1; VAR_2<MAX_PICTURE_COUNT ; VAR_2++) VAR_0->input_picture[VAR_2-1]= VAR_0->input_picture[VAR_2]; VAR_0->input_picture[VAR_3]= (Picture*)pic; return 0; }
[ "static int FUNC_0(MpegEncContext *VAR_0, AVFrame *VAR_1){", "AVFrame *pic=NULL;", "int VAR_2;", "const int VAR_3= VAR_0->max_b_frames;", "int VAR_4=1;", "if(VAR_1){", "if(VAR_3 && !(VAR_0->flags&CODEC_FLAG_INPUT_PRESERVED)) VAR_4=0;", "if(VAR_1->linesize[0] != VAR_0->linesize) VAR_4=0;", "if(VAR_1->linesize[1] != VAR_0->uvlinesize) VAR_4=0;", "if(VAR_1->linesize[2] != VAR_0->uvlinesize) VAR_4=0;", "if(VAR_4){", "VAR_2= find_unused_picture(VAR_0, 1);", "pic= (AVFrame*)&VAR_0->picture[VAR_2];", "pic->reference= 3;", "for(VAR_2=0; VAR_2<4; VAR_2++){", "pic->data[VAR_2]= VAR_1->data[VAR_2];", "pic->linesize[VAR_2]= VAR_1->linesize[VAR_2];", "}", "alloc_picture(VAR_0, (Picture*)pic, 1);", "}else{", "VAR_2= find_unused_picture(VAR_0, 0);", "pic= (AVFrame*)&VAR_0->picture[VAR_2];", "pic->reference= 3;", "alloc_picture(VAR_0, (Picture*)pic, 0);", "for(VAR_2=0; VAR_2<4; VAR_2++){", "pic->data[VAR_2]+= 16;", "}", "if( pic->data[0] == VAR_1->data[0]\n&& pic->data[1] == VAR_1->data[1]\n&& pic->data[2] == VAR_1->data[2]){", "}else{", "int VAR_5, VAR_6;", "avcodec_get_chroma_sub_sample(VAR_0->avctx->pix_fmt, &VAR_5, &VAR_6);", "for(VAR_2=0; VAR_2<3; VAR_2++){", "int VAR_7= VAR_1->linesize[VAR_2];", "int VAR_8= VAR_2 ? VAR_0->uvlinesize : VAR_0->linesize;", "int VAR_9= VAR_2 ? VAR_5 : 0;", "int VAR_10= VAR_2 ? VAR_6 : 0;", "int VAR_11= VAR_0->width >>VAR_9;", "int VAR_12= VAR_0->height>>VAR_10;", "uint8_t *src= VAR_1->data[VAR_2];", "uint8_t *dst= pic->data[VAR_2];", "if(VAR_7==VAR_8)\nmemcpy(dst, src, VAR_7*VAR_12);", "else{", "while(VAR_12--){", "memcpy(dst, src, VAR_11);", "dst += VAR_8;", "src += VAR_7;", "}", "}", "}", "}", "}", "pic->quality= VAR_1->quality;", "pic->pict_type= VAR_1->pict_type;", "pic->pts = VAR_1->pts;", "if(VAR_0->input_picture[VAR_3])\npic->display_picture_number= VAR_0->input_picture[VAR_3]->display_picture_number + 1;", "}", "for(VAR_2=1; VAR_2<MAX_PICTURE_COUNT ; VAR_2++)", "VAR_0->input_picture[VAR_2-1]= VAR_0->input_picture[VAR_2];", "VAR_0->input_picture[VAR_3]= (Picture*)pic;", "return 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, 0, 1, 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 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 73 ], [ 75 ], [ 79, 81, 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147, 149 ], [ 153 ], [ 159 ], [ 161 ], [ 165 ], [ 169 ], [ 171 ] ]
197
int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame) { BufferSinkContext *s = ctx->priv; AVFilterLink *link = ctx->inputs[0]; int ret; if ((ret = ff_request_frame(link)) < 0) return ret; if (!s->cur_frame) return AVERROR(EINVAL); av_frame_move_ref(frame, s->cur_frame); av_frame_free(&s->cur_frame); return 0; }
true
FFmpeg
20c86571ccc71412781d4a4813e4693e0c42aec6
int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame) { BufferSinkContext *s = ctx->priv; AVFilterLink *link = ctx->inputs[0]; int ret; if ((ret = ff_request_frame(link)) < 0) return ret; if (!s->cur_frame) return AVERROR(EINVAL); av_frame_move_ref(frame, s->cur_frame); av_frame_free(&s->cur_frame); return 0; }
{ "code": [ "int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame)" ], "line_no": [ 1 ] }
int FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1) { BufferSinkContext *s = VAR_0->priv; AVFilterLink *link = VAR_0->inputs[0]; int VAR_2; if ((VAR_2 = ff_request_frame(link)) < 0) return VAR_2; if (!s->cur_frame) return AVERROR(EINVAL); av_frame_move_ref(VAR_1, s->cur_frame); av_frame_free(&s->cur_frame); return 0; }
[ "int FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1)\n{", "BufferSinkContext *s = VAR_0->priv;", "AVFilterLink *link = VAR_0->inputs[0];", "int VAR_2;", "if ((VAR_2 = ff_request_frame(link)) < 0)\nreturn VAR_2;", "if (!s->cur_frame)\nreturn AVERROR(EINVAL);", "av_frame_move_ref(VAR_1, s->cur_frame);", "av_frame_free(&s->cur_frame);", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ] ]
198
static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, MemTxAttrs attrs) { ARMCPU *cpu = s->cpu; switch (offset) { case 0x380 ... 0x3bf: /* NVIC_ITNS<n> */ { int startvec = 32 * (offset - 0x380) + NVIC_FIRST_IRQ; int i; if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { break; } for (i = 0; i < 32 && startvec + i < s->num_irq; i++) { s->itns[startvec + i] = (value >> i) & 1; } nvic_irq_update(s); break; } case 0xd04: /* Interrupt Control State (ICSR) */ if (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) { if (value & (1 << 31)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_NMI, false); } else if (value & (1 << 30) && arm_feature(&cpu->env, ARM_FEATURE_V8)) { /* PENDNMICLR didn't exist in v7M */ armv7m_nvic_clear_pending(s, ARMV7M_EXCP_NMI, false); } } if (value & (1 << 28)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_PENDSV, attrs.secure); } else if (value & (1 << 27)) { armv7m_nvic_clear_pending(s, ARMV7M_EXCP_PENDSV, attrs.secure); } if (value & (1 << 26)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_SYSTICK, attrs.secure); } else if (value & (1 << 25)) { armv7m_nvic_clear_pending(s, ARMV7M_EXCP_SYSTICK, attrs.secure); } break; case 0xd08: /* Vector Table Offset. */ cpu->env.v7m.vecbase[attrs.secure] = value & 0xffffff80; break; case 0xd0c: /* Application Interrupt/Reset Control (AIRCR) */ if ((value >> R_V7M_AIRCR_VECTKEY_SHIFT) == 0x05fa) { if (value & R_V7M_AIRCR_SYSRESETREQ_MASK) { if (attrs.secure || !(cpu->env.v7m.aircr & R_V7M_AIRCR_SYSRESETREQS_MASK)) { qemu_irq_pulse(s->sysresetreq); } } if (value & R_V7M_AIRCR_VECTCLRACTIVE_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTCLRACTIVE when not in DEBUG mode " "is UNPREDICTABLE\n"); } if (value & R_V7M_AIRCR_VECTRESET_MASK) { /* NB: this bit is RES0 in v8M */ qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTRESET when not in DEBUG mode " "is UNPREDICTABLE\n"); } s->prigroup[attrs.secure] = extract32(value, R_V7M_AIRCR_PRIGROUP_SHIFT, R_V7M_AIRCR_PRIGROUP_LENGTH); if (attrs.secure) { /* These bits are only writable by secure */ cpu->env.v7m.aircr = value & (R_V7M_AIRCR_SYSRESETREQS_MASK | R_V7M_AIRCR_BFHFNMINS_MASK | R_V7M_AIRCR_PRIS_MASK); /* BFHFNMINS changes the priority of Secure HardFault, and * allows a pending Non-secure HardFault to preempt (which * we implement by marking it enabled). */ if (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) { s->sec_vectors[ARMV7M_EXCP_HARD].prio = -3; s->vectors[ARMV7M_EXCP_HARD].enabled = 1; } else { s->sec_vectors[ARMV7M_EXCP_HARD].prio = -1; s->vectors[ARMV7M_EXCP_HARD].enabled = 0; } } nvic_irq_update(s); } break; case 0xd10: /* System Control. */ /* TODO: Implement control registers. */ qemu_log_mask(LOG_UNIMP, "NVIC: SCR unimplemented\n"); break; case 0xd14: /* Configuration Control. */ /* Enforce RAZ/WI on reserved and must-RAZ/WI bits */ value &= (R_V7M_CCR_STKALIGN_MASK | R_V7M_CCR_BFHFNMIGN_MASK | R_V7M_CCR_DIV_0_TRP_MASK | R_V7M_CCR_UNALIGN_TRP_MASK | R_V7M_CCR_USERSETMPEND_MASK | R_V7M_CCR_NONBASETHRDENA_MASK); if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { /* v8M makes NONBASETHRDENA and STKALIGN be RES1 */ value |= R_V7M_CCR_NONBASETHRDENA_MASK | R_V7M_CCR_STKALIGN_MASK; } if (attrs.secure) { /* the BFHFNMIGN bit is not banked; keep that in the NS copy */ cpu->env.v7m.ccr[M_REG_NS] = (cpu->env.v7m.ccr[M_REG_NS] & ~R_V7M_CCR_BFHFNMIGN_MASK) | (value & R_V7M_CCR_BFHFNMIGN_MASK); value &= ~R_V7M_CCR_BFHFNMIGN_MASK; } cpu->env.v7m.ccr[attrs.secure] = value; break; case 0xd24: /* System Handler Control and State (SHCSR) */ if (attrs.secure) { s->sec_vectors[ARMV7M_EXCP_MEM].active = (value & (1 << 0)) != 0; /* Secure HardFault active bit cannot be written */ s->sec_vectors[ARMV7M_EXCP_USAGE].active = (value & (1 << 3)) != 0; s->sec_vectors[ARMV7M_EXCP_SVC].active = (value & (1 << 7)) != 0; s->sec_vectors[ARMV7M_EXCP_PENDSV].active = (value & (1 << 10)) != 0; s->sec_vectors[ARMV7M_EXCP_SYSTICK].active = (value & (1 << 11)) != 0; s->sec_vectors[ARMV7M_EXCP_USAGE].pending = (value & (1 << 12)) != 0; s->sec_vectors[ARMV7M_EXCP_MEM].pending = (value & (1 << 13)) != 0; s->sec_vectors[ARMV7M_EXCP_SVC].pending = (value & (1 << 15)) != 0; s->sec_vectors[ARMV7M_EXCP_MEM].enabled = (value & (1 << 16)) != 0; s->sec_vectors[ARMV7M_EXCP_BUS].enabled = (value & (1 << 17)) != 0; s->sec_vectors[ARMV7M_EXCP_USAGE].enabled = (value & (1 << 18)) != 0; s->sec_vectors[ARMV7M_EXCP_HARD].pending = (value & (1 << 21)) != 0; /* SecureFault not banked, but RAZ/WI to NS */ s->vectors[ARMV7M_EXCP_SECURE].active = (value & (1 << 4)) != 0; s->vectors[ARMV7M_EXCP_SECURE].enabled = (value & (1 << 19)) != 0; s->vectors[ARMV7M_EXCP_SECURE].pending = (value & (1 << 20)) != 0; } else { s->vectors[ARMV7M_EXCP_MEM].active = (value & (1 << 0)) != 0; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { /* HARDFAULTPENDED is not present in v7M */ s->vectors[ARMV7M_EXCP_HARD].pending = (value & (1 << 21)) != 0; } s->vectors[ARMV7M_EXCP_USAGE].active = (value & (1 << 3)) != 0; s->vectors[ARMV7M_EXCP_SVC].active = (value & (1 << 7)) != 0; s->vectors[ARMV7M_EXCP_PENDSV].active = (value & (1 << 10)) != 0; s->vectors[ARMV7M_EXCP_SYSTICK].active = (value & (1 << 11)) != 0; s->vectors[ARMV7M_EXCP_USAGE].pending = (value & (1 << 12)) != 0; s->vectors[ARMV7M_EXCP_MEM].pending = (value & (1 << 13)) != 0; s->vectors[ARMV7M_EXCP_SVC].pending = (value & (1 << 15)) != 0; s->vectors[ARMV7M_EXCP_MEM].enabled = (value & (1 << 16)) != 0; s->vectors[ARMV7M_EXCP_USAGE].enabled = (value & (1 << 18)) != 0; } if (attrs.secure || (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) { s->vectors[ARMV7M_EXCP_BUS].active = (value & (1 << 1)) != 0; s->vectors[ARMV7M_EXCP_BUS].pending = (value & (1 << 14)) != 0; s->vectors[ARMV7M_EXCP_BUS].enabled = (value & (1 << 17)) != 0; } /* NMIACT can only be written if the write is of a zero, with * BFHFNMINS 1, and by the CPU in secure state via the NS alias. */ if (!attrs.secure && cpu->env.v7m.secure && (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) && (value & (1 << 5)) == 0) { s->vectors[ARMV7M_EXCP_NMI].active = 0; } /* HARDFAULTACT can only be written if the write is of a zero * to the non-secure HardFault state by the CPU in secure state. * The only case where we can be targeting the non-secure HF state * when in secure state is if this is a write via the NS alias * and BFHFNMINS is 1. */ if (!attrs.secure && cpu->env.v7m.secure && (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) && (value & (1 << 2)) == 0) { s->vectors[ARMV7M_EXCP_HARD].active = 0; } /* TODO: this is RAZ/WI from NS if DEMCR.SDME is set */ s->vectors[ARMV7M_EXCP_DEBUG].active = (value & (1 << 8)) != 0; nvic_irq_update(s); break; case 0xd28: /* Configurable Fault Status. */ cpu->env.v7m.cfsr[attrs.secure] &= ~value; /* W1C */ if (attrs.secure) { /* The BFSR bits [15:8] are shared between security states * and we store them in the NS copy. */ cpu->env.v7m.cfsr[M_REG_NS] &= ~(value & R_V7M_CFSR_BFSR_MASK); } break; case 0xd2c: /* Hard Fault Status. */ cpu->env.v7m.hfsr &= ~value; /* W1C */ break; case 0xd30: /* Debug Fault Status. */ cpu->env.v7m.dfsr &= ~value; /* W1C */ break; case 0xd34: /* Mem Manage Address. */ cpu->env.v7m.mmfar[attrs.secure] = value; return; case 0xd38: /* Bus Fault Address. */ cpu->env.v7m.bfar = value; return; case 0xd3c: /* Aux Fault Status. */ qemu_log_mask(LOG_UNIMP, "NVIC: Aux fault status registers unimplemented\n"); break; case 0xd90: /* MPU_TYPE */ return; /* RO */ case 0xd94: /* MPU_CTRL */ if ((value & (R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_ENABLE_MASK)) == R_V7M_MPU_CTRL_HFNMIENA_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "MPU_CTRL: HFNMIENA and !ENABLE is " "UNPREDICTABLE\n"); } cpu->env.v7m.mpu_ctrl[attrs.secure] = value & (R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_PRIVDEFENA_MASK); tlb_flush(CPU(cpu)); break; case 0xd98: /* MPU_RNR */ if (value >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU region out of range %" PRIu32 "/%" PRIu32 "\n", value, cpu->pmsav7_dregion); } else { cpu->env.pmsav7.rnr[attrs.secure] = value; } break; case 0xd9c: /* MPU_RBAR */ case 0xda4: /* MPU_RBAR_A1 */ case 0xdac: /* MPU_RBAR_A2 */ case 0xdb4: /* MPU_RBAR_A3 */ { int region; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { /* PMSAv8M handling of the aliases is different from v7M: * aliases A1, A2, A3 override the low two bits of the region * number in MPU_RNR, and there is no 'region' field in the * RBAR register. */ int aliasno = (offset - 0xd9c) / 8; /* 0..3 */ region = cpu->env.pmsav7.rnr[attrs.secure]; if (aliasno) { region = deposit32(region, 0, 2, aliasno); } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rbar[attrs.secure][region] = value; tlb_flush(CPU(cpu)); return; } if (value & (1 << 4)) { /* VALID bit means use the region number specified in this * value and also update MPU_RNR.REGION with that value. */ region = extract32(value, 0, 4); if (region >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU region out of range %u/%" PRIu32 "\n", region, cpu->pmsav7_dregion); return; } cpu->env.pmsav7.rnr[attrs.secure] = region; } else { region = cpu->env.pmsav7.rnr[attrs.secure]; } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drbar[region] = value & ~0x1f; tlb_flush(CPU(cpu)); break; } case 0xda0: /* MPU_RASR (v7M), MPU_RLAR (v8M) */ case 0xda8: /* MPU_RASR_A1 (v7M), MPU_RLAR_A1 (v8M) */ case 0xdb0: /* MPU_RASR_A2 (v7M), MPU_RLAR_A2 (v8M) */ case 0xdb8: /* MPU_RASR_A3 (v7M), MPU_RLAR_A3 (v8M) */ { int region = cpu->env.pmsav7.rnr[attrs.secure]; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { /* PMSAv8M handling of the aliases is different from v7M: * aliases A1, A2, A3 override the low two bits of the region * number in MPU_RNR. */ int aliasno = (offset - 0xd9c) / 8; /* 0..3 */ region = cpu->env.pmsav7.rnr[attrs.secure]; if (aliasno) { region = deposit32(region, 0, 2, aliasno); } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rlar[attrs.secure][region] = value; tlb_flush(CPU(cpu)); return; } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drsr[region] = value & 0xff3f; cpu->env.pmsav7.dracr[region] = (value >> 16) & 0x173f; tlb_flush(CPU(cpu)); break; } case 0xdc0: /* MPU_MAIR0 */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { /* Register is RES0 if no MPU regions are implemented */ cpu->env.pmsav8.mair0[attrs.secure] = value; } /* We don't need to do anything else because memory attributes * only affect cacheability, and we don't implement caching. */ break; case 0xdc4: /* MPU_MAIR1 */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { /* Register is RES0 if no MPU regions are implemented */ cpu->env.pmsav8.mair1[attrs.secure] = value; } /* We don't need to do anything else because memory attributes * only affect cacheability, and we don't implement caching. */ break; case 0xdd0: /* SAU_CTRL */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } cpu->env.sau.ctrl = value & 3; break; case 0xdd4: /* SAU_TYPE */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } break; case 0xdd8: /* SAU_RNR */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } if (value >= cpu->sau_sregion) { qemu_log_mask(LOG_GUEST_ERROR, "SAU region out of range %" PRIu32 "/%" PRIu32 "\n", value, cpu->sau_sregion); } else { cpu->env.sau.rnr = value; } break; case 0xddc: /* SAU_RBAR */ { int region = cpu->env.sau.rnr; if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } if (region >= cpu->sau_sregion) { return; } cpu->env.sau.rbar[region] = value & ~0x1f; tlb_flush(CPU(cpu)); break; } case 0xde0: /* SAU_RLAR */ { int region = cpu->env.sau.rnr; if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } if (region >= cpu->sau_sregion) { return; } cpu->env.sau.rlar[region] = value & ~0x1c; tlb_flush(CPU(cpu)); break; } case 0xde4: /* SFSR */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } cpu->env.v7m.sfsr &= ~value; /* W1C */ break; case 0xde8: /* SFAR */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } cpu->env.v7m.sfsr = value; break; case 0xf00: /* Software Triggered Interrupt Register */ { int excnum = (value & 0x1ff) + NVIC_FIRST_IRQ; if (excnum < s->num_irq) { armv7m_nvic_set_pending(s, excnum, false); } break; } default: bad_offset: qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad write offset 0x%x\n", offset); } }
true
qemu
cf5f7937b05c84d5565134f058c00cd48304a117
static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, MemTxAttrs attrs) { ARMCPU *cpu = s->cpu; switch (offset) { case 0x380 ... 0x3bf: { int startvec = 32 * (offset - 0x380) + NVIC_FIRST_IRQ; int i; if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { break; } for (i = 0; i < 32 && startvec + i < s->num_irq; i++) { s->itns[startvec + i] = (value >> i) & 1; } nvic_irq_update(s); break; } case 0xd04: if (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) { if (value & (1 << 31)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_NMI, false); } else if (value & (1 << 30) && arm_feature(&cpu->env, ARM_FEATURE_V8)) { armv7m_nvic_clear_pending(s, ARMV7M_EXCP_NMI, false); } } if (value & (1 << 28)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_PENDSV, attrs.secure); } else if (value & (1 << 27)) { armv7m_nvic_clear_pending(s, ARMV7M_EXCP_PENDSV, attrs.secure); } if (value & (1 << 26)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_SYSTICK, attrs.secure); } else if (value & (1 << 25)) { armv7m_nvic_clear_pending(s, ARMV7M_EXCP_SYSTICK, attrs.secure); } break; case 0xd08: cpu->env.v7m.vecbase[attrs.secure] = value & 0xffffff80; break; case 0xd0c: if ((value >> R_V7M_AIRCR_VECTKEY_SHIFT) == 0x05fa) { if (value & R_V7M_AIRCR_SYSRESETREQ_MASK) { if (attrs.secure || !(cpu->env.v7m.aircr & R_V7M_AIRCR_SYSRESETREQS_MASK)) { qemu_irq_pulse(s->sysresetreq); } } if (value & R_V7M_AIRCR_VECTCLRACTIVE_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTCLRACTIVE when not in DEBUG mode " "is UNPREDICTABLE\n"); } if (value & R_V7M_AIRCR_VECTRESET_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTRESET when not in DEBUG mode " "is UNPREDICTABLE\n"); } s->prigroup[attrs.secure] = extract32(value, R_V7M_AIRCR_PRIGROUP_SHIFT, R_V7M_AIRCR_PRIGROUP_LENGTH); if (attrs.secure) { cpu->env.v7m.aircr = value & (R_V7M_AIRCR_SYSRESETREQS_MASK | R_V7M_AIRCR_BFHFNMINS_MASK | R_V7M_AIRCR_PRIS_MASK); if (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) { s->sec_vectors[ARMV7M_EXCP_HARD].prio = -3; s->vectors[ARMV7M_EXCP_HARD].enabled = 1; } else { s->sec_vectors[ARMV7M_EXCP_HARD].prio = -1; s->vectors[ARMV7M_EXCP_HARD].enabled = 0; } } nvic_irq_update(s); } break; case 0xd10: qemu_log_mask(LOG_UNIMP, "NVIC: SCR unimplemented\n"); break; case 0xd14: value &= (R_V7M_CCR_STKALIGN_MASK | R_V7M_CCR_BFHFNMIGN_MASK | R_V7M_CCR_DIV_0_TRP_MASK | R_V7M_CCR_UNALIGN_TRP_MASK | R_V7M_CCR_USERSETMPEND_MASK | R_V7M_CCR_NONBASETHRDENA_MASK); if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { value |= R_V7M_CCR_NONBASETHRDENA_MASK | R_V7M_CCR_STKALIGN_MASK; } if (attrs.secure) { cpu->env.v7m.ccr[M_REG_NS] = (cpu->env.v7m.ccr[M_REG_NS] & ~R_V7M_CCR_BFHFNMIGN_MASK) | (value & R_V7M_CCR_BFHFNMIGN_MASK); value &= ~R_V7M_CCR_BFHFNMIGN_MASK; } cpu->env.v7m.ccr[attrs.secure] = value; break; case 0xd24: if (attrs.secure) { s->sec_vectors[ARMV7M_EXCP_MEM].active = (value & (1 << 0)) != 0; s->sec_vectors[ARMV7M_EXCP_USAGE].active = (value & (1 << 3)) != 0; s->sec_vectors[ARMV7M_EXCP_SVC].active = (value & (1 << 7)) != 0; s->sec_vectors[ARMV7M_EXCP_PENDSV].active = (value & (1 << 10)) != 0; s->sec_vectors[ARMV7M_EXCP_SYSTICK].active = (value & (1 << 11)) != 0; s->sec_vectors[ARMV7M_EXCP_USAGE].pending = (value & (1 << 12)) != 0; s->sec_vectors[ARMV7M_EXCP_MEM].pending = (value & (1 << 13)) != 0; s->sec_vectors[ARMV7M_EXCP_SVC].pending = (value & (1 << 15)) != 0; s->sec_vectors[ARMV7M_EXCP_MEM].enabled = (value & (1 << 16)) != 0; s->sec_vectors[ARMV7M_EXCP_BUS].enabled = (value & (1 << 17)) != 0; s->sec_vectors[ARMV7M_EXCP_USAGE].enabled = (value & (1 << 18)) != 0; s->sec_vectors[ARMV7M_EXCP_HARD].pending = (value & (1 << 21)) != 0; s->vectors[ARMV7M_EXCP_SECURE].active = (value & (1 << 4)) != 0; s->vectors[ARMV7M_EXCP_SECURE].enabled = (value & (1 << 19)) != 0; s->vectors[ARMV7M_EXCP_SECURE].pending = (value & (1 << 20)) != 0; } else { s->vectors[ARMV7M_EXCP_MEM].active = (value & (1 << 0)) != 0; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { s->vectors[ARMV7M_EXCP_HARD].pending = (value & (1 << 21)) != 0; } s->vectors[ARMV7M_EXCP_USAGE].active = (value & (1 << 3)) != 0; s->vectors[ARMV7M_EXCP_SVC].active = (value & (1 << 7)) != 0; s->vectors[ARMV7M_EXCP_PENDSV].active = (value & (1 << 10)) != 0; s->vectors[ARMV7M_EXCP_SYSTICK].active = (value & (1 << 11)) != 0; s->vectors[ARMV7M_EXCP_USAGE].pending = (value & (1 << 12)) != 0; s->vectors[ARMV7M_EXCP_MEM].pending = (value & (1 << 13)) != 0; s->vectors[ARMV7M_EXCP_SVC].pending = (value & (1 << 15)) != 0; s->vectors[ARMV7M_EXCP_MEM].enabled = (value & (1 << 16)) != 0; s->vectors[ARMV7M_EXCP_USAGE].enabled = (value & (1 << 18)) != 0; } if (attrs.secure || (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) { s->vectors[ARMV7M_EXCP_BUS].active = (value & (1 << 1)) != 0; s->vectors[ARMV7M_EXCP_BUS].pending = (value & (1 << 14)) != 0; s->vectors[ARMV7M_EXCP_BUS].enabled = (value & (1 << 17)) != 0; } if (!attrs.secure && cpu->env.v7m.secure && (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) && (value & (1 << 5)) == 0) { s->vectors[ARMV7M_EXCP_NMI].active = 0; } if (!attrs.secure && cpu->env.v7m.secure && (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) && (value & (1 << 2)) == 0) { s->vectors[ARMV7M_EXCP_HARD].active = 0; } s->vectors[ARMV7M_EXCP_DEBUG].active = (value & (1 << 8)) != 0; nvic_irq_update(s); break; case 0xd28: cpu->env.v7m.cfsr[attrs.secure] &= ~value; if (attrs.secure) { cpu->env.v7m.cfsr[M_REG_NS] &= ~(value & R_V7M_CFSR_BFSR_MASK); } break; case 0xd2c: cpu->env.v7m.hfsr &= ~value; break; case 0xd30: cpu->env.v7m.dfsr &= ~value; break; case 0xd34: cpu->env.v7m.mmfar[attrs.secure] = value; return; case 0xd38: cpu->env.v7m.bfar = value; return; case 0xd3c: qemu_log_mask(LOG_UNIMP, "NVIC: Aux fault status registers unimplemented\n"); break; case 0xd90: return; case 0xd94: if ((value & (R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_ENABLE_MASK)) == R_V7M_MPU_CTRL_HFNMIENA_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "MPU_CTRL: HFNMIENA and !ENABLE is " "UNPREDICTABLE\n"); } cpu->env.v7m.mpu_ctrl[attrs.secure] = value & (R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_PRIVDEFENA_MASK); tlb_flush(CPU(cpu)); break; case 0xd98: if (value >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU region out of range %" PRIu32 "/%" PRIu32 "\n", value, cpu->pmsav7_dregion); } else { cpu->env.pmsav7.rnr[attrs.secure] = value; } break; case 0xd9c: case 0xda4: case 0xdac: case 0xdb4: { int region; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { int aliasno = (offset - 0xd9c) / 8; region = cpu->env.pmsav7.rnr[attrs.secure]; if (aliasno) { region = deposit32(region, 0, 2, aliasno); } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rbar[attrs.secure][region] = value; tlb_flush(CPU(cpu)); return; } if (value & (1 << 4)) { region = extract32(value, 0, 4); if (region >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU region out of range %u/%" PRIu32 "\n", region, cpu->pmsav7_dregion); return; } cpu->env.pmsav7.rnr[attrs.secure] = region; } else { region = cpu->env.pmsav7.rnr[attrs.secure]; } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drbar[region] = value & ~0x1f; tlb_flush(CPU(cpu)); break; } case 0xda0: case 0xda8: case 0xdb0: case 0xdb8: { int region = cpu->env.pmsav7.rnr[attrs.secure]; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { int aliasno = (offset - 0xd9c) / 8; region = cpu->env.pmsav7.rnr[attrs.secure]; if (aliasno) { region = deposit32(region, 0, 2, aliasno); } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rlar[attrs.secure][region] = value; tlb_flush(CPU(cpu)); return; } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drsr[region] = value & 0xff3f; cpu->env.pmsav7.dracr[region] = (value >> 16) & 0x173f; tlb_flush(CPU(cpu)); break; } case 0xdc0: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { cpu->env.pmsav8.mair0[attrs.secure] = value; } break; case 0xdc4: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { cpu->env.pmsav8.mair1[attrs.secure] = value; } break; case 0xdd0: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } cpu->env.sau.ctrl = value & 3; break; case 0xdd4: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } break; case 0xdd8: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } if (value >= cpu->sau_sregion) { qemu_log_mask(LOG_GUEST_ERROR, "SAU region out of range %" PRIu32 "/%" PRIu32 "\n", value, cpu->sau_sregion); } else { cpu->env.sau.rnr = value; } break; case 0xddc: { int region = cpu->env.sau.rnr; if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } if (region >= cpu->sau_sregion) { return; } cpu->env.sau.rbar[region] = value & ~0x1f; tlb_flush(CPU(cpu)); break; } case 0xde0: { int region = cpu->env.sau.rnr; if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } if (region >= cpu->sau_sregion) { return; } cpu->env.sau.rlar[region] = value & ~0x1c; tlb_flush(CPU(cpu)); break; } case 0xde4: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } cpu->env.v7m.sfsr &= ~value; break; case 0xde8: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } cpu->env.v7m.sfsr = value; break; case 0xf00: { int excnum = (value & 0x1ff) + NVIC_FIRST_IRQ; if (excnum < s->num_irq) { armv7m_nvic_set_pending(s, excnum, false); } break; } default: bad_offset: qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad write offset 0x%x\n", offset); } }
{ "code": [ " int startvec = 32 * (offset - 0x380) + NVIC_FIRST_IRQ;", " int startvec = 32 * (offset - 0x380) + NVIC_FIRST_IRQ;" ], "line_no": [ 17, 17 ] }
static void FUNC_0(NVICState *VAR_0, uint32_t VAR_1, uint32_t VAR_2, MemTxAttrs VAR_3) { ARMCPU *cpu = VAR_0->cpu; switch (VAR_1) { case 0x380 ... 0x3bf: { int VAR_4 = 32 * (VAR_1 - 0x380) + NVIC_FIRST_IRQ; int VAR_5; if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!VAR_3.secure) { break; } for (VAR_5 = 0; VAR_5 < 32 && VAR_4 + VAR_5 < VAR_0->num_irq; VAR_5++) { VAR_0->itns[VAR_4 + VAR_5] = (VAR_2 >> VAR_5) & 1; } nvic_irq_update(VAR_0); break; } case 0xd04: if (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) { if (VAR_2 & (1 << 31)) { armv7m_nvic_set_pending(VAR_0, ARMV7M_EXCP_NMI, false); } else if (VAR_2 & (1 << 30) && arm_feature(&cpu->env, ARM_FEATURE_V8)) { armv7m_nvic_clear_pending(VAR_0, ARMV7M_EXCP_NMI, false); } } if (VAR_2 & (1 << 28)) { armv7m_nvic_set_pending(VAR_0, ARMV7M_EXCP_PENDSV, VAR_3.secure); } else if (VAR_2 & (1 << 27)) { armv7m_nvic_clear_pending(VAR_0, ARMV7M_EXCP_PENDSV, VAR_3.secure); } if (VAR_2 & (1 << 26)) { armv7m_nvic_set_pending(VAR_0, ARMV7M_EXCP_SYSTICK, VAR_3.secure); } else if (VAR_2 & (1 << 25)) { armv7m_nvic_clear_pending(VAR_0, ARMV7M_EXCP_SYSTICK, VAR_3.secure); } break; case 0xd08: cpu->env.v7m.vecbase[VAR_3.secure] = VAR_2 & 0xffffff80; break; case 0xd0c: if ((VAR_2 >> R_V7M_AIRCR_VECTKEY_SHIFT) == 0x05fa) { if (VAR_2 & R_V7M_AIRCR_SYSRESETREQ_MASK) { if (VAR_3.secure || !(cpu->env.v7m.aircr & R_V7M_AIRCR_SYSRESETREQS_MASK)) { qemu_irq_pulse(VAR_0->sysresetreq); } } if (VAR_2 & R_V7M_AIRCR_VECTCLRACTIVE_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTCLRACTIVE when not in DEBUG mode " "is UNPREDICTABLE\n"); } if (VAR_2 & R_V7M_AIRCR_VECTRESET_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTRESET when not in DEBUG mode " "is UNPREDICTABLE\n"); } VAR_0->prigroup[VAR_3.secure] = extract32(VAR_2, R_V7M_AIRCR_PRIGROUP_SHIFT, R_V7M_AIRCR_PRIGROUP_LENGTH); if (VAR_3.secure) { cpu->env.v7m.aircr = VAR_2 & (R_V7M_AIRCR_SYSRESETREQS_MASK | R_V7M_AIRCR_BFHFNMINS_MASK | R_V7M_AIRCR_PRIS_MASK); if (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) { VAR_0->sec_vectors[ARMV7M_EXCP_HARD].prio = -3; VAR_0->vectors[ARMV7M_EXCP_HARD].enabled = 1; } else { VAR_0->sec_vectors[ARMV7M_EXCP_HARD].prio = -1; VAR_0->vectors[ARMV7M_EXCP_HARD].enabled = 0; } } nvic_irq_update(VAR_0); } break; case 0xd10: qemu_log_mask(LOG_UNIMP, "NVIC: SCR unimplemented\n"); break; case 0xd14: VAR_2 &= (R_V7M_CCR_STKALIGN_MASK | R_V7M_CCR_BFHFNMIGN_MASK | R_V7M_CCR_DIV_0_TRP_MASK | R_V7M_CCR_UNALIGN_TRP_MASK | R_V7M_CCR_USERSETMPEND_MASK | R_V7M_CCR_NONBASETHRDENA_MASK); if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { VAR_2 |= R_V7M_CCR_NONBASETHRDENA_MASK | R_V7M_CCR_STKALIGN_MASK; } if (VAR_3.secure) { cpu->env.v7m.ccr[M_REG_NS] = (cpu->env.v7m.ccr[M_REG_NS] & ~R_V7M_CCR_BFHFNMIGN_MASK) | (VAR_2 & R_V7M_CCR_BFHFNMIGN_MASK); VAR_2 &= ~R_V7M_CCR_BFHFNMIGN_MASK; } cpu->env.v7m.ccr[VAR_3.secure] = VAR_2; break; case 0xd24: if (VAR_3.secure) { VAR_0->sec_vectors[ARMV7M_EXCP_MEM].active = (VAR_2 & (1 << 0)) != 0; VAR_0->sec_vectors[ARMV7M_EXCP_USAGE].active = (VAR_2 & (1 << 3)) != 0; VAR_0->sec_vectors[ARMV7M_EXCP_SVC].active = (VAR_2 & (1 << 7)) != 0; VAR_0->sec_vectors[ARMV7M_EXCP_PENDSV].active = (VAR_2 & (1 << 10)) != 0; VAR_0->sec_vectors[ARMV7M_EXCP_SYSTICK].active = (VAR_2 & (1 << 11)) != 0; VAR_0->sec_vectors[ARMV7M_EXCP_USAGE].pending = (VAR_2 & (1 << 12)) != 0; VAR_0->sec_vectors[ARMV7M_EXCP_MEM].pending = (VAR_2 & (1 << 13)) != 0; VAR_0->sec_vectors[ARMV7M_EXCP_SVC].pending = (VAR_2 & (1 << 15)) != 0; VAR_0->sec_vectors[ARMV7M_EXCP_MEM].enabled = (VAR_2 & (1 << 16)) != 0; VAR_0->sec_vectors[ARMV7M_EXCP_BUS].enabled = (VAR_2 & (1 << 17)) != 0; VAR_0->sec_vectors[ARMV7M_EXCP_USAGE].enabled = (VAR_2 & (1 << 18)) != 0; VAR_0->sec_vectors[ARMV7M_EXCP_HARD].pending = (VAR_2 & (1 << 21)) != 0; VAR_0->vectors[ARMV7M_EXCP_SECURE].active = (VAR_2 & (1 << 4)) != 0; VAR_0->vectors[ARMV7M_EXCP_SECURE].enabled = (VAR_2 & (1 << 19)) != 0; VAR_0->vectors[ARMV7M_EXCP_SECURE].pending = (VAR_2 & (1 << 20)) != 0; } else { VAR_0->vectors[ARMV7M_EXCP_MEM].active = (VAR_2 & (1 << 0)) != 0; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { VAR_0->vectors[ARMV7M_EXCP_HARD].pending = (VAR_2 & (1 << 21)) != 0; } VAR_0->vectors[ARMV7M_EXCP_USAGE].active = (VAR_2 & (1 << 3)) != 0; VAR_0->vectors[ARMV7M_EXCP_SVC].active = (VAR_2 & (1 << 7)) != 0; VAR_0->vectors[ARMV7M_EXCP_PENDSV].active = (VAR_2 & (1 << 10)) != 0; VAR_0->vectors[ARMV7M_EXCP_SYSTICK].active = (VAR_2 & (1 << 11)) != 0; VAR_0->vectors[ARMV7M_EXCP_USAGE].pending = (VAR_2 & (1 << 12)) != 0; VAR_0->vectors[ARMV7M_EXCP_MEM].pending = (VAR_2 & (1 << 13)) != 0; VAR_0->vectors[ARMV7M_EXCP_SVC].pending = (VAR_2 & (1 << 15)) != 0; VAR_0->vectors[ARMV7M_EXCP_MEM].enabled = (VAR_2 & (1 << 16)) != 0; VAR_0->vectors[ARMV7M_EXCP_USAGE].enabled = (VAR_2 & (1 << 18)) != 0; } if (VAR_3.secure || (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) { VAR_0->vectors[ARMV7M_EXCP_BUS].active = (VAR_2 & (1 << 1)) != 0; VAR_0->vectors[ARMV7M_EXCP_BUS].pending = (VAR_2 & (1 << 14)) != 0; VAR_0->vectors[ARMV7M_EXCP_BUS].enabled = (VAR_2 & (1 << 17)) != 0; } if (!VAR_3.secure && cpu->env.v7m.secure && (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) && (VAR_2 & (1 << 5)) == 0) { VAR_0->vectors[ARMV7M_EXCP_NMI].active = 0; } if (!VAR_3.secure && cpu->env.v7m.secure && (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) && (VAR_2 & (1 << 2)) == 0) { VAR_0->vectors[ARMV7M_EXCP_HARD].active = 0; } VAR_0->vectors[ARMV7M_EXCP_DEBUG].active = (VAR_2 & (1 << 8)) != 0; nvic_irq_update(VAR_0); break; case 0xd28: cpu->env.v7m.cfsr[VAR_3.secure] &= ~VAR_2; if (VAR_3.secure) { cpu->env.v7m.cfsr[M_REG_NS] &= ~(VAR_2 & R_V7M_CFSR_BFSR_MASK); } break; case 0xd2c: cpu->env.v7m.hfsr &= ~VAR_2; break; case 0xd30: cpu->env.v7m.dfsr &= ~VAR_2; break; case 0xd34: cpu->env.v7m.mmfar[VAR_3.secure] = VAR_2; return; case 0xd38: cpu->env.v7m.bfar = VAR_2; return; case 0xd3c: qemu_log_mask(LOG_UNIMP, "NVIC: Aux fault status registers unimplemented\n"); break; case 0xd90: return; case 0xd94: if ((VAR_2 & (R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_ENABLE_MASK)) == R_V7M_MPU_CTRL_HFNMIENA_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "MPU_CTRL: HFNMIENA and !ENABLE is " "UNPREDICTABLE\n"); } cpu->env.v7m.mpu_ctrl[VAR_3.secure] = VAR_2 & (R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_PRIVDEFENA_MASK); tlb_flush(CPU(cpu)); break; case 0xd98: if (VAR_2 >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU VAR_8 out of range %" PRIu32 "/%" PRIu32 "\n", VAR_2, cpu->pmsav7_dregion); } else { cpu->env.pmsav7.rnr[VAR_3.secure] = VAR_2; } break; case 0xd9c: case 0xda4: case 0xdac: case 0xdb4: { int VAR_8; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { int VAR_8 = (VAR_1 - 0xd9c) / 8; VAR_8 = cpu->env.pmsav7.rnr[VAR_3.secure]; if (VAR_8) { VAR_8 = deposit32(VAR_8, 0, 2, VAR_8); } if (VAR_8 >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rbar[VAR_3.secure][VAR_8] = VAR_2; tlb_flush(CPU(cpu)); return; } if (VAR_2 & (1 << 4)) { VAR_8 = extract32(VAR_2, 0, 4); if (VAR_8 >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU VAR_8 out of range %u/%" PRIu32 "\n", VAR_8, cpu->pmsav7_dregion); return; } cpu->env.pmsav7.rnr[VAR_3.secure] = VAR_8; } else { VAR_8 = cpu->env.pmsav7.rnr[VAR_3.secure]; } if (VAR_8 >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drbar[VAR_8] = VAR_2 & ~0x1f; tlb_flush(CPU(cpu)); break; } case 0xda0: case 0xda8: case 0xdb0: case 0xdb8: { int VAR_8 = cpu->env.pmsav7.rnr[VAR_3.secure]; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { int VAR_8 = (VAR_1 - 0xd9c) / 8; VAR_8 = cpu->env.pmsav7.rnr[VAR_3.secure]; if (VAR_8) { VAR_8 = deposit32(VAR_8, 0, 2, VAR_8); } if (VAR_8 >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rlar[VAR_3.secure][VAR_8] = VAR_2; tlb_flush(CPU(cpu)); return; } if (VAR_8 >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drsr[VAR_8] = VAR_2 & 0xff3f; cpu->env.pmsav7.dracr[VAR_8] = (VAR_2 >> 16) & 0x173f; tlb_flush(CPU(cpu)); break; } case 0xdc0: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { cpu->env.pmsav8.mair0[VAR_3.secure] = VAR_2; } break; case 0xdc4: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { cpu->env.pmsav8.mair1[VAR_3.secure] = VAR_2; } break; case 0xdd0: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!VAR_3.secure) { return; } cpu->env.sau.ctrl = VAR_2 & 3; break; case 0xdd4: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } break; case 0xdd8: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!VAR_3.secure) { return; } if (VAR_2 >= cpu->sau_sregion) { qemu_log_mask(LOG_GUEST_ERROR, "SAU VAR_8 out of range %" PRIu32 "/%" PRIu32 "\n", VAR_2, cpu->sau_sregion); } else { cpu->env.sau.rnr = VAR_2; } break; case 0xddc: { int VAR_8 = cpu->env.sau.rnr; if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!VAR_3.secure) { return; } if (VAR_8 >= cpu->sau_sregion) { return; } cpu->env.sau.rbar[VAR_8] = VAR_2 & ~0x1f; tlb_flush(CPU(cpu)); break; } case 0xde0: { int VAR_8 = cpu->env.sau.rnr; if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!VAR_3.secure) { return; } if (VAR_8 >= cpu->sau_sregion) { return; } cpu->env.sau.rlar[VAR_8] = VAR_2 & ~0x1c; tlb_flush(CPU(cpu)); break; } case 0xde4: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!VAR_3.secure) { return; } cpu->env.v7m.sfsr &= ~VAR_2; break; case 0xde8: if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!VAR_3.secure) { return; } cpu->env.v7m.sfsr = VAR_2; break; case 0xf00: { int VAR_8 = (VAR_2 & 0x1ff) + NVIC_FIRST_IRQ; if (VAR_8 < VAR_0->num_irq) { armv7m_nvic_set_pending(VAR_0, VAR_8, false); } break; } default: bad_offset: qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad write VAR_1 0x%x\n", VAR_1); } }
[ "static void FUNC_0(NVICState *VAR_0, uint32_t VAR_1, uint32_t VAR_2,\nMemTxAttrs VAR_3)\n{", "ARMCPU *cpu = VAR_0->cpu;", "switch (VAR_1) {", "case 0x380 ... 0x3bf:\n{", "int VAR_4 = 32 * (VAR_1 - 0x380) + NVIC_FIRST_IRQ;", "int VAR_5;", "if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "goto bad_offset;", "}", "if (!VAR_3.secure) {", "break;", "}", "for (VAR_5 = 0; VAR_5 < 32 && VAR_4 + VAR_5 < VAR_0->num_irq; VAR_5++) {", "VAR_0->itns[VAR_4 + VAR_5] = (VAR_2 >> VAR_5) & 1;", "}", "nvic_irq_update(VAR_0);", "break;", "}", "case 0xd04:\nif (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) {", "if (VAR_2 & (1 << 31)) {", "armv7m_nvic_set_pending(VAR_0, ARMV7M_EXCP_NMI, false);", "} else if (VAR_2 & (1 << 30) &&", "arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "armv7m_nvic_clear_pending(VAR_0, ARMV7M_EXCP_NMI, false);", "}", "}", "if (VAR_2 & (1 << 28)) {", "armv7m_nvic_set_pending(VAR_0, ARMV7M_EXCP_PENDSV, VAR_3.secure);", "} else if (VAR_2 & (1 << 27)) {", "armv7m_nvic_clear_pending(VAR_0, ARMV7M_EXCP_PENDSV, VAR_3.secure);", "}", "if (VAR_2 & (1 << 26)) {", "armv7m_nvic_set_pending(VAR_0, ARMV7M_EXCP_SYSTICK, VAR_3.secure);", "} else if (VAR_2 & (1 << 25)) {", "armv7m_nvic_clear_pending(VAR_0, ARMV7M_EXCP_SYSTICK, VAR_3.secure);", "}", "break;", "case 0xd08:\ncpu->env.v7m.vecbase[VAR_3.secure] = VAR_2 & 0xffffff80;", "break;", "case 0xd0c:\nif ((VAR_2 >> R_V7M_AIRCR_VECTKEY_SHIFT) == 0x05fa) {", "if (VAR_2 & R_V7M_AIRCR_SYSRESETREQ_MASK) {", "if (VAR_3.secure ||\n!(cpu->env.v7m.aircr & R_V7M_AIRCR_SYSRESETREQS_MASK)) {", "qemu_irq_pulse(VAR_0->sysresetreq);", "}", "}", "if (VAR_2 & R_V7M_AIRCR_VECTCLRACTIVE_MASK) {", "qemu_log_mask(LOG_GUEST_ERROR,\n\"Setting VECTCLRACTIVE when not in DEBUG mode \"\n\"is UNPREDICTABLE\\n\");", "}", "if (VAR_2 & R_V7M_AIRCR_VECTRESET_MASK) {", "qemu_log_mask(LOG_GUEST_ERROR,\n\"Setting VECTRESET when not in DEBUG mode \"\n\"is UNPREDICTABLE\\n\");", "}", "VAR_0->prigroup[VAR_3.secure] = extract32(VAR_2,\nR_V7M_AIRCR_PRIGROUP_SHIFT,\nR_V7M_AIRCR_PRIGROUP_LENGTH);", "if (VAR_3.secure) {", "cpu->env.v7m.aircr = VAR_2 &\n(R_V7M_AIRCR_SYSRESETREQS_MASK |\nR_V7M_AIRCR_BFHFNMINS_MASK |\nR_V7M_AIRCR_PRIS_MASK);", "if (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) {", "VAR_0->sec_vectors[ARMV7M_EXCP_HARD].prio = -3;", "VAR_0->vectors[ARMV7M_EXCP_HARD].enabled = 1;", "} else {", "VAR_0->sec_vectors[ARMV7M_EXCP_HARD].prio = -1;", "VAR_0->vectors[ARMV7M_EXCP_HARD].enabled = 0;", "}", "}", "nvic_irq_update(VAR_0);", "}", "break;", "case 0xd10:\nqemu_log_mask(LOG_UNIMP, \"NVIC: SCR unimplemented\\n\");", "break;", "case 0xd14:\nVAR_2 &= (R_V7M_CCR_STKALIGN_MASK |\nR_V7M_CCR_BFHFNMIGN_MASK |\nR_V7M_CCR_DIV_0_TRP_MASK |\nR_V7M_CCR_UNALIGN_TRP_MASK |\nR_V7M_CCR_USERSETMPEND_MASK |\nR_V7M_CCR_NONBASETHRDENA_MASK);", "if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "VAR_2 |= R_V7M_CCR_NONBASETHRDENA_MASK\n| R_V7M_CCR_STKALIGN_MASK;", "}", "if (VAR_3.secure) {", "cpu->env.v7m.ccr[M_REG_NS] =\n(cpu->env.v7m.ccr[M_REG_NS] & ~R_V7M_CCR_BFHFNMIGN_MASK)\n| (VAR_2 & R_V7M_CCR_BFHFNMIGN_MASK);", "VAR_2 &= ~R_V7M_CCR_BFHFNMIGN_MASK;", "}", "cpu->env.v7m.ccr[VAR_3.secure] = VAR_2;", "break;", "case 0xd24:\nif (VAR_3.secure) {", "VAR_0->sec_vectors[ARMV7M_EXCP_MEM].active = (VAR_2 & (1 << 0)) != 0;", "VAR_0->sec_vectors[ARMV7M_EXCP_USAGE].active = (VAR_2 & (1 << 3)) != 0;", "VAR_0->sec_vectors[ARMV7M_EXCP_SVC].active = (VAR_2 & (1 << 7)) != 0;", "VAR_0->sec_vectors[ARMV7M_EXCP_PENDSV].active =\n(VAR_2 & (1 << 10)) != 0;", "VAR_0->sec_vectors[ARMV7M_EXCP_SYSTICK].active =\n(VAR_2 & (1 << 11)) != 0;", "VAR_0->sec_vectors[ARMV7M_EXCP_USAGE].pending =\n(VAR_2 & (1 << 12)) != 0;", "VAR_0->sec_vectors[ARMV7M_EXCP_MEM].pending = (VAR_2 & (1 << 13)) != 0;", "VAR_0->sec_vectors[ARMV7M_EXCP_SVC].pending = (VAR_2 & (1 << 15)) != 0;", "VAR_0->sec_vectors[ARMV7M_EXCP_MEM].enabled = (VAR_2 & (1 << 16)) != 0;", "VAR_0->sec_vectors[ARMV7M_EXCP_BUS].enabled = (VAR_2 & (1 << 17)) != 0;", "VAR_0->sec_vectors[ARMV7M_EXCP_USAGE].enabled =\n(VAR_2 & (1 << 18)) != 0;", "VAR_0->sec_vectors[ARMV7M_EXCP_HARD].pending = (VAR_2 & (1 << 21)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_SECURE].active = (VAR_2 & (1 << 4)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_SECURE].enabled = (VAR_2 & (1 << 19)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_SECURE].pending = (VAR_2 & (1 << 20)) != 0;", "} else {", "VAR_0->vectors[ARMV7M_EXCP_MEM].active = (VAR_2 & (1 << 0)) != 0;", "if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "VAR_0->vectors[ARMV7M_EXCP_HARD].pending = (VAR_2 & (1 << 21)) != 0;", "}", "VAR_0->vectors[ARMV7M_EXCP_USAGE].active = (VAR_2 & (1 << 3)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_SVC].active = (VAR_2 & (1 << 7)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_PENDSV].active = (VAR_2 & (1 << 10)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_SYSTICK].active = (VAR_2 & (1 << 11)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_USAGE].pending = (VAR_2 & (1 << 12)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_MEM].pending = (VAR_2 & (1 << 13)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_SVC].pending = (VAR_2 & (1 << 15)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_MEM].enabled = (VAR_2 & (1 << 16)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_USAGE].enabled = (VAR_2 & (1 << 18)) != 0;", "}", "if (VAR_3.secure || (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) {", "VAR_0->vectors[ARMV7M_EXCP_BUS].active = (VAR_2 & (1 << 1)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_BUS].pending = (VAR_2 & (1 << 14)) != 0;", "VAR_0->vectors[ARMV7M_EXCP_BUS].enabled = (VAR_2 & (1 << 17)) != 0;", "}", "if (!VAR_3.secure && cpu->env.v7m.secure &&\n(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) &&\n(VAR_2 & (1 << 5)) == 0) {", "VAR_0->vectors[ARMV7M_EXCP_NMI].active = 0;", "}", "if (!VAR_3.secure && cpu->env.v7m.secure &&\n(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) &&\n(VAR_2 & (1 << 2)) == 0) {", "VAR_0->vectors[ARMV7M_EXCP_HARD].active = 0;", "}", "VAR_0->vectors[ARMV7M_EXCP_DEBUG].active = (VAR_2 & (1 << 8)) != 0;", "nvic_irq_update(VAR_0);", "break;", "case 0xd28:\ncpu->env.v7m.cfsr[VAR_3.secure] &= ~VAR_2;", "if (VAR_3.secure) {", "cpu->env.v7m.cfsr[M_REG_NS] &= ~(VAR_2 & R_V7M_CFSR_BFSR_MASK);", "}", "break;", "case 0xd2c:\ncpu->env.v7m.hfsr &= ~VAR_2;", "break;", "case 0xd30:\ncpu->env.v7m.dfsr &= ~VAR_2;", "break;", "case 0xd34:\ncpu->env.v7m.mmfar[VAR_3.secure] = VAR_2;", "return;", "case 0xd38:\ncpu->env.v7m.bfar = VAR_2;", "return;", "case 0xd3c:\nqemu_log_mask(LOG_UNIMP,\n\"NVIC: Aux fault status registers unimplemented\\n\");", "break;", "case 0xd90:\nreturn;", "case 0xd94:\nif ((VAR_2 &\n(R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_ENABLE_MASK))\n== R_V7M_MPU_CTRL_HFNMIENA_MASK) {", "qemu_log_mask(LOG_GUEST_ERROR, \"MPU_CTRL: HFNMIENA and !ENABLE is \"\n\"UNPREDICTABLE\\n\");", "}", "cpu->env.v7m.mpu_ctrl[VAR_3.secure]\n= VAR_2 & (R_V7M_MPU_CTRL_ENABLE_MASK |\nR_V7M_MPU_CTRL_HFNMIENA_MASK |\nR_V7M_MPU_CTRL_PRIVDEFENA_MASK);", "tlb_flush(CPU(cpu));", "break;", "case 0xd98:\nif (VAR_2 >= cpu->pmsav7_dregion) {", "qemu_log_mask(LOG_GUEST_ERROR, \"MPU VAR_8 out of range %\"\nPRIu32 \"/%\" PRIu32 \"\\n\",\nVAR_2, cpu->pmsav7_dregion);", "} else {", "cpu->env.pmsav7.rnr[VAR_3.secure] = VAR_2;", "}", "break;", "case 0xd9c:\ncase 0xda4:\ncase 0xdac:\ncase 0xdb4:\n{", "int VAR_8;", "if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "int VAR_8 = (VAR_1 - 0xd9c) / 8;", "VAR_8 = cpu->env.pmsav7.rnr[VAR_3.secure];", "if (VAR_8) {", "VAR_8 = deposit32(VAR_8, 0, 2, VAR_8);", "}", "if (VAR_8 >= cpu->pmsav7_dregion) {", "return;", "}", "cpu->env.pmsav8.rbar[VAR_3.secure][VAR_8] = VAR_2;", "tlb_flush(CPU(cpu));", "return;", "}", "if (VAR_2 & (1 << 4)) {", "VAR_8 = extract32(VAR_2, 0, 4);", "if (VAR_8 >= cpu->pmsav7_dregion) {", "qemu_log_mask(LOG_GUEST_ERROR,\n\"MPU VAR_8 out of range %u/%\" PRIu32 \"\\n\",\nVAR_8, cpu->pmsav7_dregion);", "return;", "}", "cpu->env.pmsav7.rnr[VAR_3.secure] = VAR_8;", "} else {", "VAR_8 = cpu->env.pmsav7.rnr[VAR_3.secure];", "}", "if (VAR_8 >= cpu->pmsav7_dregion) {", "return;", "}", "cpu->env.pmsav7.drbar[VAR_8] = VAR_2 & ~0x1f;", "tlb_flush(CPU(cpu));", "break;", "}", "case 0xda0:\ncase 0xda8:\ncase 0xdb0:\ncase 0xdb8:\n{", "int VAR_8 = cpu->env.pmsav7.rnr[VAR_3.secure];", "if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "int VAR_8 = (VAR_1 - 0xd9c) / 8;", "VAR_8 = cpu->env.pmsav7.rnr[VAR_3.secure];", "if (VAR_8) {", "VAR_8 = deposit32(VAR_8, 0, 2, VAR_8);", "}", "if (VAR_8 >= cpu->pmsav7_dregion) {", "return;", "}", "cpu->env.pmsav8.rlar[VAR_3.secure][VAR_8] = VAR_2;", "tlb_flush(CPU(cpu));", "return;", "}", "if (VAR_8 >= cpu->pmsav7_dregion) {", "return;", "}", "cpu->env.pmsav7.drsr[VAR_8] = VAR_2 & 0xff3f;", "cpu->env.pmsav7.dracr[VAR_8] = (VAR_2 >> 16) & 0x173f;", "tlb_flush(CPU(cpu));", "break;", "}", "case 0xdc0:\nif (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "goto bad_offset;", "}", "if (cpu->pmsav7_dregion) {", "cpu->env.pmsav8.mair0[VAR_3.secure] = VAR_2;", "}", "break;", "case 0xdc4:\nif (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "goto bad_offset;", "}", "if (cpu->pmsav7_dregion) {", "cpu->env.pmsav8.mair1[VAR_3.secure] = VAR_2;", "}", "break;", "case 0xdd0:\nif (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "goto bad_offset;", "}", "if (!VAR_3.secure) {", "return;", "}", "cpu->env.sau.ctrl = VAR_2 & 3;", "break;", "case 0xdd4:\nif (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "goto bad_offset;", "}", "break;", "case 0xdd8:\nif (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "goto bad_offset;", "}", "if (!VAR_3.secure) {", "return;", "}", "if (VAR_2 >= cpu->sau_sregion) {", "qemu_log_mask(LOG_GUEST_ERROR, \"SAU VAR_8 out of range %\"\nPRIu32 \"/%\" PRIu32 \"\\n\",\nVAR_2, cpu->sau_sregion);", "} else {", "cpu->env.sau.rnr = VAR_2;", "}", "break;", "case 0xddc:\n{", "int VAR_8 = cpu->env.sau.rnr;", "if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "goto bad_offset;", "}", "if (!VAR_3.secure) {", "return;", "}", "if (VAR_8 >= cpu->sau_sregion) {", "return;", "}", "cpu->env.sau.rbar[VAR_8] = VAR_2 & ~0x1f;", "tlb_flush(CPU(cpu));", "break;", "}", "case 0xde0:\n{", "int VAR_8 = cpu->env.sau.rnr;", "if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "goto bad_offset;", "}", "if (!VAR_3.secure) {", "return;", "}", "if (VAR_8 >= cpu->sau_sregion) {", "return;", "}", "cpu->env.sau.rlar[VAR_8] = VAR_2 & ~0x1c;", "tlb_flush(CPU(cpu));", "break;", "}", "case 0xde4:\nif (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "goto bad_offset;", "}", "if (!VAR_3.secure) {", "return;", "}", "cpu->env.v7m.sfsr &= ~VAR_2;", "break;", "case 0xde8:\nif (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {", "goto bad_offset;", "}", "if (!VAR_3.secure) {", "return;", "}", "cpu->env.v7m.sfsr = VAR_2;", "break;", "case 0xf00:\n{", "int VAR_8 = (VAR_2 & 0x1ff) + NVIC_FIRST_IRQ;", "if (VAR_8 < VAR_0->num_irq) {", "armv7m_nvic_set_pending(VAR_0, VAR_8, false);", "}", "break;", "}", "default:\nbad_offset:\nqemu_log_mask(LOG_GUEST_ERROR,\n\"NVIC: Bad write VAR_1 0x%x\\n\", VAR_1);", "}", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 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 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115, 117 ], [ 119 ], [ 121 ], [ 125, 127, 129 ], [ 131 ], [ 133, 135, 137 ], [ 139 ], [ 143, 145, 147, 149 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181, 185 ], [ 187 ], [ 189, 193, 195, 197, 199, 201, 203 ], [ 207 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 221, 223, 225 ], [ 227 ], [ 229 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241 ], [ 245 ], [ 247 ], [ 249, 251 ], [ 253, 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 331, 333, 335 ], [ 337 ], [ 339 ], [ 353, 355, 357 ], [ 359 ], [ 361 ], [ 367 ], [ 369 ], [ 371 ], [ 373, 375 ], [ 377 ], [ 385 ], [ 387 ], [ 389 ], [ 391, 393 ], [ 395 ], [ 397, 399 ], [ 401 ], [ 403, 405 ], [ 407 ], [ 409, 411 ], [ 413 ], [ 415, 417, 419 ], [ 421 ], [ 423, 425 ], [ 427, 429, 431, 433 ], [ 435, 437 ], [ 439 ], [ 441, 443, 445, 447 ], [ 449 ], [ 451 ], [ 453, 455 ], [ 457, 459, 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471, 473, 475, 477, 479 ], [ 481 ], [ 485 ], [ 497 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 525 ], [ 533 ], [ 535 ], [ 537, 539, 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 557 ], [ 559 ], [ 561 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573, 575, 577, 579, 581 ], [ 583 ], [ 587 ], [ 597 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 625 ], [ 627 ], [ 629 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643, 645 ], [ 647 ], [ 649 ], [ 651 ], [ 655 ], [ 657 ], [ 665 ], [ 667, 669 ], [ 671 ], [ 673 ], [ 675 ], [ 679 ], [ 681 ], [ 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 ], [ 757 ], [ 759 ], [ 761 ], [ 763 ], [ 765 ], [ 767 ], [ 769 ], [ 771 ], [ 773 ], [ 775 ], [ 777 ], [ 779 ], [ 781 ], [ 783, 785 ], [ 787 ], [ 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, 875 ], [ 877 ], [ 879 ] ]
199
static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba, target_ulong tce) { sPAPRTCE *tcep; if (ioba >= tcet->window_size) { hcall_dprintf("spapr_vio_put_tce on out-of-boards IOBA 0x" TARGET_FMT_lx "\n", ioba); return H_PARAMETER; } tcep = tcet->table + (ioba >> SPAPR_TCE_PAGE_SHIFT); tcep->tce = tce; return H_SUCCESS; }
true
qemu
b55519a0f29fca0ef7ebc5d87ee4bfa7304dc219
static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba, target_ulong tce) { sPAPRTCE *tcep; if (ioba >= tcet->window_size) { hcall_dprintf("spapr_vio_put_tce on out-of-boards IOBA 0x" TARGET_FMT_lx "\n", ioba); return H_PARAMETER; } tcep = tcet->table + (ioba >> SPAPR_TCE_PAGE_SHIFT); tcep->tce = tce; return H_SUCCESS; }
{ "code": [ " hcall_dprintf(\"spapr_vio_put_tce on out-of-boards IOBA 0x\"" ], "line_no": [ 13 ] }
static target_ulong FUNC_0(sPAPRTCETable *tcet, target_ulong ioba, target_ulong tce) { sPAPRTCE *tcep; if (ioba >= tcet->window_size) { hcall_dprintf("spapr_vio_put_tce on out-of-boards IOBA 0x" TARGET_FMT_lx "\n", ioba); return H_PARAMETER; } tcep = tcet->table + (ioba >> SPAPR_TCE_PAGE_SHIFT); tcep->tce = tce; return H_SUCCESS; }
[ "static target_ulong FUNC_0(sPAPRTCETable *tcet, target_ulong ioba,\ntarget_ulong tce)\n{", "sPAPRTCE *tcep;", "if (ioba >= tcet->window_size) {", "hcall_dprintf(\"spapr_vio_put_tce on out-of-boards IOBA 0x\"\nTARGET_FMT_lx \"\\n\", ioba);", "return H_PARAMETER;", "}", "tcep = tcet->table + (ioba >> SPAPR_TCE_PAGE_SHIFT);", "tcep->tce = tce;", "return H_SUCCESS;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ] ]
201
static void gen_lq(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else int ra, rd; TCGv EA; /* Restore CPU state */ if (unlikely(ctx->mem_idx == 0)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } ra = rA(ctx->opcode); rd = rD(ctx->opcode); if (unlikely((rd & 1) || rd == ra)) { gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); return; } if (unlikely(ctx->le_mode)) { /* Little-endian mode is not handled */ gen_exception_err(ctx, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_LE); return; } gen_set_access_type(ctx, ACCESS_INT); EA = tcg_temp_new(); gen_addr_imm_index(ctx, EA, 0x0F); gen_qemu_ld64(ctx, cpu_gpr[rd], EA); gen_addr_add(ctx, EA, EA, 8); gen_qemu_ld64(ctx, cpu_gpr[rd+1], EA); tcg_temp_free(EA); #endif }
true
qemu
e0498daab50d42f3948fc5607683c971fe9416fd
static void gen_lq(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else int ra, rd; TCGv EA; if (unlikely(ctx->mem_idx == 0)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } ra = rA(ctx->opcode); rd = rD(ctx->opcode); if (unlikely((rd & 1) || rd == ra)) { gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); return; } if (unlikely(ctx->le_mode)) { gen_exception_err(ctx, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_LE); return; } gen_set_access_type(ctx, ACCESS_INT); EA = tcg_temp_new(); gen_addr_imm_index(ctx, EA, 0x0F); gen_qemu_ld64(ctx, cpu_gpr[rd], EA); gen_addr_add(ctx, EA, EA, 8); gen_qemu_ld64(ctx, cpu_gpr[rd+1], EA); tcg_temp_free(EA); #endif }
{ "code": [ "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->mem_idx == 0)) {", " if (unlikely(ctx->le_mode)) {", " gen_exception_err(ctx, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_LE);", " gen_qemu_ld64(ctx, cpu_gpr[rd], EA);", " gen_addr_add(ctx, EA, EA, 8);", " gen_qemu_ld64(ctx, cpu_gpr[rd+1], EA);", "#endif" ], "line_no": [ 5, 7, 9, 19, 39, 43, 55, 57, 59, 63 ] }
static void FUNC_0(DisasContext *VAR_0) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); #else int VAR_1, VAR_2; TCGv EA; if (unlikely(VAR_0->mem_idx == 0)) { gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); return; } VAR_1 = rA(VAR_0->opcode); VAR_2 = rD(VAR_0->opcode); if (unlikely((VAR_2 & 1) || VAR_2 == VAR_1)) { gen_inval_exception(VAR_0, POWERPC_EXCP_INVAL_INVAL); return; } if (unlikely(VAR_0->le_mode)) { gen_exception_err(VAR_0, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_LE); return; } gen_set_access_type(VAR_0, ACCESS_INT); EA = tcg_temp_new(); gen_addr_imm_index(VAR_0, EA, 0x0F); gen_qemu_ld64(VAR_0, cpu_gpr[VAR_2], EA); gen_addr_add(VAR_0, EA, EA, 8); gen_qemu_ld64(VAR_0, cpu_gpr[VAR_2+1], EA); tcg_temp_free(EA); #endif }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "#if defined(CONFIG_USER_ONLY)\ngen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "#else\nint VAR_1, VAR_2;", "TCGv EA;", "if (unlikely(VAR_0->mem_idx == 0)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "return;", "}", "VAR_1 = rA(VAR_0->opcode);", "VAR_2 = rD(VAR_0->opcode);", "if (unlikely((VAR_2 & 1) || VAR_2 == VAR_1)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_INVAL_INVAL);", "return;", "}", "if (unlikely(VAR_0->le_mode)) {", "gen_exception_err(VAR_0, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_LE);", "return;", "}", "gen_set_access_type(VAR_0, ACCESS_INT);", "EA = tcg_temp_new();", "gen_addr_imm_index(VAR_0, EA, 0x0F);", "gen_qemu_ld64(VAR_0, cpu_gpr[VAR_2], EA);", "gen_addr_add(VAR_0, EA, EA, 8);", "gen_qemu_ld64(VAR_0, cpu_gpr[VAR_2+1], EA);", "tcg_temp_free(EA);", "#endif\n}" ]
[ 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ] ]
202
static uint32_t esp_mem_readb(void *opaque, target_phys_addr_t addr) { ESPState *s = opaque; uint32_t saddr; saddr = (addr >> s->it_shift) & (ESP_REGS - 1); DPRINTF("read reg[%d]: 0x%2.2x\n", saddr, s->rregs[saddr]); switch (saddr) { case ESP_FIFO: if (s->ti_size > 0) { s->ti_size--; if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) { /* Data in/out. */ fprintf(stderr, "esp: PIO data read not implemented\n"); s->rregs[ESP_FIFO] = 0; } else { s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++]; } esp_raise_irq(s); } if (s->ti_size == 0) { s->ti_rptr = 0; s->ti_wptr = 0; } break; case ESP_RINTR: // Clear interrupt/error status bits s->rregs[ESP_RSTAT] &= ~(STAT_GE | STAT_PE); esp_lower_irq(s); break; default: break; } return s->rregs[saddr]; }
true
qemu
8dea1dd406189dae6108104faf27f397835ae871
static uint32_t esp_mem_readb(void *opaque, target_phys_addr_t addr) { ESPState *s = opaque; uint32_t saddr; saddr = (addr >> s->it_shift) & (ESP_REGS - 1); DPRINTF("read reg[%d]: 0x%2.2x\n", saddr, s->rregs[saddr]); switch (saddr) { case ESP_FIFO: if (s->ti_size > 0) { s->ti_size--; if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) { fprintf(stderr, "esp: PIO data read not implemented\n"); s->rregs[ESP_FIFO] = 0; } else { s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++]; } esp_raise_irq(s); } if (s->ti_size == 0) { s->ti_rptr = 0; s->ti_wptr = 0; } break; case ESP_RINTR: s->rregs[ESP_RSTAT] &= ~(STAT_GE | STAT_PE); esp_lower_irq(s); break; default: break; } return s->rregs[saddr]; }
{ "code": [ " fprintf(stderr, \"esp: PIO data read not implemented\\n\");", " s->ti_size--;", " break;" ], "line_no": [ 27, 21, 49 ] }
static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr) { ESPState *s = opaque; uint32_t saddr; saddr = (addr >> s->it_shift) & (ESP_REGS - 1); DPRINTF("read reg[%d]: 0x%2.2x\n", saddr, s->rregs[saddr]); switch (saddr) { case ESP_FIFO: if (s->ti_size > 0) { s->ti_size--; if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) { fprintf(stderr, "esp: PIO data read not implemented\n"); s->rregs[ESP_FIFO] = 0; } else { s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++]; } esp_raise_irq(s); } if (s->ti_size == 0) { s->ti_rptr = 0; s->ti_wptr = 0; } break; case ESP_RINTR: s->rregs[ESP_RSTAT] &= ~(STAT_GE | STAT_PE); esp_lower_irq(s); break; default: break; } return s->rregs[saddr]; }
[ "static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr)\n{", "ESPState *s = opaque;", "uint32_t saddr;", "saddr = (addr >> s->it_shift) & (ESP_REGS - 1);", "DPRINTF(\"read reg[%d]: 0x%2.2x\\n\", saddr, s->rregs[saddr]);", "switch (saddr) {", "case ESP_FIFO:\nif (s->ti_size > 0) {", "s->ti_size--;", "if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) {", "fprintf(stderr, \"esp: PIO data read not implemented\\n\");", "s->rregs[ESP_FIFO] = 0;", "} else {", "s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++];", "}", "esp_raise_irq(s);", "}", "if (s->ti_size == 0) {", "s->ti_rptr = 0;", "s->ti_wptr = 0;", "}", "break;", "case ESP_RINTR:\ns->rregs[ESP_RSTAT] &= ~(STAT_GE | STAT_PE);", "esp_lower_irq(s);", "break;", "default:\nbreak;", "}", "return s->rregs[saddr];", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ] ]
203
int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect, int width, int height, enum PixelFormat pix_fmt, const char *sws_param) { BufferSourceContext *c = buffer_filter->priv; int ret; if (c->has_frame) { av_log(buffer_filter, AV_LOG_ERROR, "Buffering several frames is not supported. " "Please consume all available frames before adding a new one.\n" ); //return -1; } if(width != c->w || height != c->h || pix_fmt != c->pix_fmt){ AVFilterContext *scale= buffer_filter->outputs[0]->dst; AVFilterLink *link; av_log(buffer_filter, AV_LOG_INFO, "Changing filter graph input to accept %dx%d %d (%d %d)\n", width,height,pix_fmt, c->pix_fmt, scale->outputs[0]->format); if(!scale || strcmp(scale->filter->name,"scale")){ AVFilter *f= avfilter_get_by_name("scale"); av_log(buffer_filter, AV_LOG_INFO, "Inserting scaler filter\n"); if(avfilter_open(&scale, f, "Input equalizer") < 0) return -1; if((ret=avfilter_init_filter(scale, sws_param, NULL))<0){ avfilter_free(scale); return ret; } if((ret=avfilter_insert_filter(buffer_filter->outputs[0], scale, 0, 0))<0){ avfilter_free(scale); return ret; } scale->outputs[0]->format= c->pix_fmt; } c->pix_fmt= scale->inputs[0]->format= pix_fmt; c->w= scale->inputs[0]->w= width; c->h= scale->inputs[0]->h= height; link= scale->outputs[0]; if ((ret = link->srcpad->config_props(link)) < 0) return ret; } memcpy(c->frame.data , frame->data , sizeof(frame->data)); memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize)); c->frame.interlaced_frame= frame->interlaced_frame; c->frame.top_field_first = frame->top_field_first; c->frame.key_frame = frame->key_frame; c->frame.pict_type = frame->pict_type; c->pts = pts; c->pixel_aspect = pixel_aspect; c->has_frame = 1; return 0; }
true
FFmpeg
ad0193bf9cb258695a7f929954edd6e2e51de4d9
int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect, int width, int height, enum PixelFormat pix_fmt, const char *sws_param) { BufferSourceContext *c = buffer_filter->priv; int ret; if (c->has_frame) { av_log(buffer_filter, AV_LOG_ERROR, "Buffering several frames is not supported. " "Please consume all available frames before adding a new one.\n" ); } if(width != c->w || height != c->h || pix_fmt != c->pix_fmt){ AVFilterContext *scale= buffer_filter->outputs[0]->dst; AVFilterLink *link; av_log(buffer_filter, AV_LOG_INFO, "Changing filter graph input to accept %dx%d %d (%d %d)\n", width,height,pix_fmt, c->pix_fmt, scale->outputs[0]->format); if(!scale || strcmp(scale->filter->name,"scale")){ AVFilter *f= avfilter_get_by_name("scale"); av_log(buffer_filter, AV_LOG_INFO, "Inserting scaler filter\n"); if(avfilter_open(&scale, f, "Input equalizer") < 0) return -1; if((ret=avfilter_init_filter(scale, sws_param, NULL))<0){ avfilter_free(scale); return ret; } if((ret=avfilter_insert_filter(buffer_filter->outputs[0], scale, 0, 0))<0){ avfilter_free(scale); return ret; } scale->outputs[0]->format= c->pix_fmt; } c->pix_fmt= scale->inputs[0]->format= pix_fmt; c->w= scale->inputs[0]->w= width; c->h= scale->inputs[0]->h= height; link= scale->outputs[0]; if ((ret = link->srcpad->config_props(link)) < 0) return ret; } memcpy(c->frame.data , frame->data , sizeof(frame->data)); memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize)); c->frame.interlaced_frame= frame->interlaced_frame; c->frame.top_field_first = frame->top_field_first; c->frame.key_frame = frame->key_frame; c->frame.pict_type = frame->pict_type; c->pts = pts; c->pixel_aspect = pixel_aspect; c->has_frame = 1; return 0; }
{ "code": [ " width,height,pix_fmt, c->pix_fmt, scale->outputs[0]->format);" ], "line_no": [ 43 ] }
int FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1, int64_t VAR_2, AVRational VAR_3, int VAR_4, int VAR_5, enum PixelFormat VAR_6, const char *VAR_7) { BufferSourceContext *c = VAR_0->priv; int VAR_8; if (c->has_frame) { av_log(VAR_0, AV_LOG_ERROR, "Buffering several frames is not supported. " "Please consume all available frames before adding a new one.\n" ); } if(VAR_4 != c->w || VAR_5 != c->h || VAR_6 != c->VAR_6){ AVFilterContext *scale= VAR_0->outputs[0]->dst; AVFilterLink *link; av_log(VAR_0, AV_LOG_INFO, "Changing filter graph input to accept %dx%d %d (%d %d)\n", VAR_4,VAR_5,VAR_6, c->VAR_6, scale->outputs[0]->format); if(!scale || strcmp(scale->filter->name,"scale")){ AVFilter *f= avfilter_get_by_name("scale"); av_log(VAR_0, AV_LOG_INFO, "Inserting scaler filter\n"); if(avfilter_open(&scale, f, "Input equalizer") < 0) return -1; if((VAR_8=avfilter_init_filter(scale, VAR_7, NULL))<0){ avfilter_free(scale); return VAR_8; } if((VAR_8=avfilter_insert_filter(VAR_0->outputs[0], scale, 0, 0))<0){ avfilter_free(scale); return VAR_8; } scale->outputs[0]->format= c->VAR_6; } c->VAR_6= scale->inputs[0]->format= VAR_6; c->w= scale->inputs[0]->w= VAR_4; c->h= scale->inputs[0]->h= VAR_5; link= scale->outputs[0]; if ((VAR_8 = link->srcpad->config_props(link)) < 0) return VAR_8; } memcpy(c->VAR_1.data , VAR_1->data , sizeof(VAR_1->data)); memcpy(c->VAR_1.linesize, VAR_1->linesize, sizeof(VAR_1->linesize)); c->VAR_1.interlaced_frame= VAR_1->interlaced_frame; c->VAR_1.top_field_first = VAR_1->top_field_first; c->VAR_1.key_frame = VAR_1->key_frame; c->VAR_1.pict_type = VAR_1->pict_type; c->VAR_2 = VAR_2; c->VAR_3 = VAR_3; c->has_frame = 1; return 0; }
[ "int FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1,\nint64_t VAR_2, AVRational VAR_3, int VAR_4,\nint VAR_5, enum PixelFormat VAR_6,\nconst char *VAR_7)\n{", "BufferSourceContext *c = VAR_0->priv;", "int VAR_8;", "if (c->has_frame) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Buffering several frames is not supported. \"\n\"Please consume all available frames before adding a new one.\\n\"\n);", "}", "if(VAR_4 != c->w || VAR_5 != c->h || VAR_6 != c->VAR_6){", "AVFilterContext *scale= VAR_0->outputs[0]->dst;", "AVFilterLink *link;", "av_log(VAR_0, AV_LOG_INFO, \"Changing filter graph input to accept %dx%d %d (%d %d)\\n\",\nVAR_4,VAR_5,VAR_6, c->VAR_6, scale->outputs[0]->format);", "if(!scale || strcmp(scale->filter->name,\"scale\")){", "AVFilter *f= avfilter_get_by_name(\"scale\");", "av_log(VAR_0, AV_LOG_INFO, \"Inserting scaler filter\\n\");", "if(avfilter_open(&scale, f, \"Input equalizer\") < 0)\nreturn -1;", "if((VAR_8=avfilter_init_filter(scale, VAR_7, NULL))<0){", "avfilter_free(scale);", "return VAR_8;", "}", "if((VAR_8=avfilter_insert_filter(VAR_0->outputs[0], scale, 0, 0))<0){", "avfilter_free(scale);", "return VAR_8;", "}", "scale->outputs[0]->format= c->VAR_6;", "}", "c->VAR_6= scale->inputs[0]->format= VAR_6;", "c->w= scale->inputs[0]->w= VAR_4;", "c->h= scale->inputs[0]->h= VAR_5;", "link= scale->outputs[0];", "if ((VAR_8 = link->srcpad->config_props(link)) < 0)\nreturn VAR_8;", "}", "memcpy(c->VAR_1.data , VAR_1->data , sizeof(VAR_1->data));", "memcpy(c->VAR_1.linesize, VAR_1->linesize, sizeof(VAR_1->linesize));", "c->VAR_1.interlaced_frame= VAR_1->interlaced_frame;", "c->VAR_1.top_field_first = VAR_1->top_field_first;", "c->VAR_1.key_frame = VAR_1->key_frame;", "c->VAR_1.pict_type = VAR_1->pict_type;", "c->VAR_2 = VAR_2;", "c->VAR_3 = VAR_3;", "c->has_frame = 1;", "return 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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21, 23, 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55, 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ] ]
204
static void pcie_cap_slot_hotplug_common(PCIDevice *hotplug_dev, DeviceState *dev, uint8_t **exp_cap, Error **errp) { *exp_cap = hotplug_dev->config + hotplug_dev->exp.exp_cap; uint16_t sltsta = pci_get_word(*exp_cap + PCI_EXP_SLTSTA); PCIE_DEV_PRINTF(PCI_DEVICE(dev), "hotplug state: 0x%x\n", sltsta); if (sltsta & PCI_EXP_SLTSTA_EIS) { /* the slot is electromechanically locked. * This error is propagated up to qdev and then to HMP/QMP. */ error_setg_errno(errp, -EBUSY, "slot is electromechanically locked"); } }
true
qemu
6c150fbd341ac10b8559abcfd5915cfff17b70c6
static void pcie_cap_slot_hotplug_common(PCIDevice *hotplug_dev, DeviceState *dev, uint8_t **exp_cap, Error **errp) { *exp_cap = hotplug_dev->config + hotplug_dev->exp.exp_cap; uint16_t sltsta = pci_get_word(*exp_cap + PCI_EXP_SLTSTA); PCIE_DEV_PRINTF(PCI_DEVICE(dev), "hotplug state: 0x%x\n", sltsta); if (sltsta & PCI_EXP_SLTSTA_EIS) { error_setg_errno(errp, -EBUSY, "slot is electromechanically locked"); } }
{ "code": [ " error_setg_errno(errp, -EBUSY, \"slot is electromechanically locked\");" ], "line_no": [ 25 ] }
static void FUNC_0(PCIDevice *VAR_0, DeviceState *VAR_1, uint8_t **VAR_2, Error **VAR_3) { *VAR_2 = VAR_0->config + VAR_0->exp.VAR_2; uint16_t sltsta = pci_get_word(*VAR_2 + PCI_EXP_SLTSTA); PCIE_DEV_PRINTF(PCI_DEVICE(VAR_1), "hotplug state: 0x%x\n", sltsta); if (sltsta & PCI_EXP_SLTSTA_EIS) { error_setg_errno(VAR_3, -EBUSY, "slot is electromechanically locked"); } }
[ "static void FUNC_0(PCIDevice *VAR_0,\nDeviceState *VAR_1,\nuint8_t **VAR_2, Error **VAR_3)\n{", "*VAR_2 = VAR_0->config + VAR_0->exp.VAR_2;", "uint16_t sltsta = pci_get_word(*VAR_2 + PCI_EXP_SLTSTA);", "PCIE_DEV_PRINTF(PCI_DEVICE(VAR_1), \"hotplug state: 0x%x\\n\", sltsta);", "if (sltsta & PCI_EXP_SLTSTA_EIS) {", "error_setg_errno(VAR_3, -EBUSY, \"slot is electromechanically locked\");", "}", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 25 ], [ 27 ], [ 29 ] ]
205
void qmp_getfd(const char *fdname, Error **errp) { mon_fd_t *monfd; int fd; fd = qemu_chr_fe_get_msgfd(cur_mon->chr); if (fd == -1) { error_set(errp, QERR_FD_NOT_SUPPLIED); return; } if (qemu_isdigit(fdname[0])) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "fdname", "a name not starting with a digit"); return; } QLIST_FOREACH(monfd, &cur_mon->fds, next) { if (strcmp(monfd->name, fdname) != 0) { continue; } close(monfd->fd); monfd->fd = fd; return; } monfd = g_malloc0(sizeof(mon_fd_t)); monfd->name = g_strdup(fdname); monfd->fd = fd; QLIST_INSERT_HEAD(&cur_mon->fds, monfd, next); }
true
qemu
0b9f0e2fd7c5070fa06cd6bd5ec69055e3a7d2b1
void qmp_getfd(const char *fdname, Error **errp) { mon_fd_t *monfd; int fd; fd = qemu_chr_fe_get_msgfd(cur_mon->chr); if (fd == -1) { error_set(errp, QERR_FD_NOT_SUPPLIED); return; } if (qemu_isdigit(fdname[0])) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "fdname", "a name not starting with a digit"); return; } QLIST_FOREACH(monfd, &cur_mon->fds, next) { if (strcmp(monfd->name, fdname) != 0) { continue; } close(monfd->fd); monfd->fd = fd; return; } monfd = g_malloc0(sizeof(mon_fd_t)); monfd->name = g_strdup(fdname); monfd->fd = fd; QLIST_INSERT_HEAD(&cur_mon->fds, monfd, next); }
{ "code": [], "line_no": [] }
void FUNC_0(const char *VAR_0, Error **VAR_1) { mon_fd_t *monfd; int VAR_2; VAR_2 = qemu_chr_fe_get_msgfd(cur_mon->chr); if (VAR_2 == -1) { error_set(VAR_1, QERR_FD_NOT_SUPPLIED); return; } if (qemu_isdigit(VAR_0[0])) { error_set(VAR_1, QERR_INVALID_PARAMETER_VALUE, "VAR_0", "a name not starting with a digit"); return; } QLIST_FOREACH(monfd, &cur_mon->fds, next) { if (strcmp(monfd->name, VAR_0) != 0) { continue; } close(monfd->VAR_2); monfd->VAR_2 = VAR_2; return; } monfd = g_malloc0(sizeof(mon_fd_t)); monfd->name = g_strdup(VAR_0); monfd->VAR_2 = VAR_2; QLIST_INSERT_HEAD(&cur_mon->fds, monfd, next); }
[ "void FUNC_0(const char *VAR_0, Error **VAR_1)\n{", "mon_fd_t *monfd;", "int VAR_2;", "VAR_2 = qemu_chr_fe_get_msgfd(cur_mon->chr);", "if (VAR_2 == -1) {", "error_set(VAR_1, QERR_FD_NOT_SUPPLIED);", "return;", "}", "if (qemu_isdigit(VAR_0[0])) {", "error_set(VAR_1, QERR_INVALID_PARAMETER_VALUE, \"VAR_0\",\n\"a name not starting with a digit\");", "return;", "}", "QLIST_FOREACH(monfd, &cur_mon->fds, next) {", "if (strcmp(monfd->name, VAR_0) != 0) {", "continue;", "}", "close(monfd->VAR_2);", "monfd->VAR_2 = VAR_2;", "return;", "}", "monfd = g_malloc0(sizeof(mon_fd_t));", "monfd->name = g_strdup(VAR_0);", "monfd->VAR_2 = VAR_2;", "QLIST_INSERT_HEAD(&cur_mon->fds, monfd, next);", "}" ]
[ 0, 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 ], [ 23 ], [ 26, 28 ], [ 30 ], [ 32 ], [ 36 ], [ 38 ], [ 40 ], [ 42 ], [ 46 ], [ 48 ], [ 50 ], [ 52 ], [ 56 ], [ 58 ], [ 60 ], [ 64 ], [ 66 ] ]
206
static void qmp_deserialize(void **native_out, void *datap, VisitorFunc visit, Error **errp) { QmpSerializeData *d = datap; QString *output_json = qobject_to_json(qmp_output_get_qobject(d->qov)); QObject *obj = qobject_from_json(qstring_get_str(output_json)); QDECREF(output_json); d->qiv = qmp_input_visitor_new(obj); qobject_decref(obj); visit(qmp_input_get_visitor(d->qiv), native_out, errp); }
true
qemu
ad7f375df681503baa6ebef065818868e1216976
static void qmp_deserialize(void **native_out, void *datap, VisitorFunc visit, Error **errp) { QmpSerializeData *d = datap; QString *output_json = qobject_to_json(qmp_output_get_qobject(d->qov)); QObject *obj = qobject_from_json(qstring_get_str(output_json)); QDECREF(output_json); d->qiv = qmp_input_visitor_new(obj); qobject_decref(obj); visit(qmp_input_get_visitor(d->qiv), native_out, errp); }
{ "code": [ " QString *output_json = qobject_to_json(qmp_output_get_qobject(d->qov));", " QObject *obj = qobject_from_json(qstring_get_str(output_json));" ], "line_no": [ 9, 11 ] }
static void FUNC_0(void **VAR_0, void *VAR_1, VisitorFunc VAR_2, Error **VAR_3) { QmpSerializeData *d = VAR_1; QString *output_json = qobject_to_json(qmp_output_get_qobject(d->qov)); QObject *obj = qobject_from_json(qstring_get_str(output_json)); QDECREF(output_json); d->qiv = qmp_input_visitor_new(obj); qobject_decref(obj); VAR_2(qmp_input_get_visitor(d->qiv), VAR_0, VAR_3); }
[ "static void FUNC_0(void **VAR_0, void *VAR_1,\nVisitorFunc VAR_2, Error **VAR_3)\n{", "QmpSerializeData *d = VAR_1;", "QString *output_json = qobject_to_json(qmp_output_get_qobject(d->qov));", "QObject *obj = qobject_from_json(qstring_get_str(output_json));", "QDECREF(output_json);", "d->qiv = qmp_input_visitor_new(obj);", "qobject_decref(obj);", "VAR_2(qmp_input_get_visitor(d->qiv), VAR_0, VAR_3);", "}" ]
[ 0, 0, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
207
static bool coroutine_fn yield_and_check(BackupBlockJob *job) { if (block_job_is_cancelled(&job->common)) { return true; } /* we need to yield so that bdrv_drain_all() returns. * (without, VM does not reboot) */ if (job->common.speed) { uint64_t delay_ns = ratelimit_calculate_delay(&job->limit, job->sectors_read); job->sectors_read = 0; block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, delay_ns); } else { block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, 0); } if (block_job_is_cancelled(&job->common)) { return true; } return false; }
true
qemu
f3e4ce4af336f2ea306fa0f40ec1a5149864ca8c
static bool coroutine_fn yield_and_check(BackupBlockJob *job) { if (block_job_is_cancelled(&job->common)) { return true; } if (job->common.speed) { uint64_t delay_ns = ratelimit_calculate_delay(&job->limit, job->sectors_read); job->sectors_read = 0; block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, delay_ns); } else { block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, 0); } if (block_job_is_cancelled(&job->common)) { return true; } return false; }
{ "code": [ " job->sectors_read);" ], "line_no": [ 23 ] }
static bool VAR_0 yield_and_check(BackupBlockJob *job) { if (block_job_is_cancelled(&job->common)) { return true; } if (job->common.speed) { uint64_t delay_ns = ratelimit_calculate_delay(&job->limit, job->sectors_read); job->sectors_read = 0; block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, delay_ns); } else { block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, 0); } if (block_job_is_cancelled(&job->common)) { return true; } return false; }
[ "static bool VAR_0 yield_and_check(BackupBlockJob *job)\n{", "if (block_job_is_cancelled(&job->common)) {", "return true;", "}", "if (job->common.speed) {", "uint64_t delay_ns = ratelimit_calculate_delay(&job->limit,\njob->sectors_read);", "job->sectors_read = 0;", "block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, delay_ns);", "} else {", "block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, 0);", "}", "if (block_job_is_cancelled(&job->common)) {", "return true;", "}", "return false;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ] ]
208
static int virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req) { SCSIDevice *d = virtio_scsi_device_find(s, req->req.tmf.lun); SCSIRequest *r, *next; BusChild *kid; int target; int ret = 0; if (s->dataplane_started) { assert(blk_get_aio_context(d->conf.blk) == s->ctx); } /* Here VIRTIO_SCSI_S_OK means "FUNCTION COMPLETE". */ req->resp.tmf.response = VIRTIO_SCSI_S_OK; virtio_tswap32s(VIRTIO_DEVICE(s), &req->req.tmf.subtype); switch (req->req.tmf.subtype) { case VIRTIO_SCSI_T_TMF_ABORT_TASK: case VIRTIO_SCSI_T_TMF_QUERY_TASK: if (!d) { goto fail; } if (d->lun != virtio_scsi_get_lun(req->req.tmf.lun)) { goto incorrect_lun; } QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) { VirtIOSCSIReq *cmd_req = r->hba_private; if (cmd_req && cmd_req->req.cmd.tag == req->req.tmf.tag) { break; } } if (r) { /* * Assert that the request has not been completed yet, we * check for it in the loop above. */ assert(r->hba_private); if (req->req.tmf.subtype == VIRTIO_SCSI_T_TMF_QUERY_TASK) { /* "If the specified command is present in the task set, then * return a service response set to FUNCTION SUCCEEDED". */ req->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED; } else { VirtIOSCSICancelNotifier *notifier; req->remaining = 1; notifier = g_new(VirtIOSCSICancelNotifier, 1); notifier->tmf_req = req; notifier->notifier.notify = virtio_scsi_cancel_notify; scsi_req_cancel_async(r, &notifier->notifier); ret = -EINPROGRESS; } } break; case VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET: if (!d) { goto fail; } if (d->lun != virtio_scsi_get_lun(req->req.tmf.lun)) { goto incorrect_lun; } s->resetting++; qdev_reset_all(&d->qdev); s->resetting--; break; case VIRTIO_SCSI_T_TMF_ABORT_TASK_SET: case VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET: case VIRTIO_SCSI_T_TMF_QUERY_TASK_SET: if (!d) { goto fail; } if (d->lun != virtio_scsi_get_lun(req->req.tmf.lun)) { goto incorrect_lun; } /* Add 1 to "remaining" until virtio_scsi_do_tmf returns. * This way, if the bus starts calling back to the notifiers * even before we finish the loop, virtio_scsi_cancel_notify * will not complete the TMF too early. */ req->remaining = 1; QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) { if (r->hba_private) { if (req->req.tmf.subtype == VIRTIO_SCSI_T_TMF_QUERY_TASK_SET) { /* "If there is any command present in the task set, then * return a service response set to FUNCTION SUCCEEDED". */ req->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED; break; } else { VirtIOSCSICancelNotifier *notifier; req->remaining++; notifier = g_new(VirtIOSCSICancelNotifier, 1); notifier->notifier.notify = virtio_scsi_cancel_notify; notifier->tmf_req = req; scsi_req_cancel_async(r, &notifier->notifier); } } } if (--req->remaining > 0) { ret = -EINPROGRESS; } break; case VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET: target = req->req.tmf.lun[1]; s->resetting++; QTAILQ_FOREACH(kid, &s->bus.qbus.children, sibling) { d = DO_UPCAST(SCSIDevice, qdev, kid->child); if (d->channel == 0 && d->id == target) { qdev_reset_all(&d->qdev); } } s->resetting--; break; case VIRTIO_SCSI_T_TMF_CLEAR_ACA: default: req->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_REJECTED; break; } return ret; incorrect_lun: req->resp.tmf.response = VIRTIO_SCSI_S_INCORRECT_LUN; return ret; fail: req->resp.tmf.response = VIRTIO_SCSI_S_BAD_TARGET; return ret; }
true
qemu
3e32e8a96e6995cde3d8a13d68e31226ee83f290
static int virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req) { SCSIDevice *d = virtio_scsi_device_find(s, req->req.tmf.lun); SCSIRequest *r, *next; BusChild *kid; int target; int ret = 0; if (s->dataplane_started) { assert(blk_get_aio_context(d->conf.blk) == s->ctx); } req->resp.tmf.response = VIRTIO_SCSI_S_OK; virtio_tswap32s(VIRTIO_DEVICE(s), &req->req.tmf.subtype); switch (req->req.tmf.subtype) { case VIRTIO_SCSI_T_TMF_ABORT_TASK: case VIRTIO_SCSI_T_TMF_QUERY_TASK: if (!d) { goto fail; } if (d->lun != virtio_scsi_get_lun(req->req.tmf.lun)) { goto incorrect_lun; } QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) { VirtIOSCSIReq *cmd_req = r->hba_private; if (cmd_req && cmd_req->req.cmd.tag == req->req.tmf.tag) { break; } } if (r) { assert(r->hba_private); if (req->req.tmf.subtype == VIRTIO_SCSI_T_TMF_QUERY_TASK) { req->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED; } else { VirtIOSCSICancelNotifier *notifier; req->remaining = 1; notifier = g_new(VirtIOSCSICancelNotifier, 1); notifier->tmf_req = req; notifier->notifier.notify = virtio_scsi_cancel_notify; scsi_req_cancel_async(r, &notifier->notifier); ret = -EINPROGRESS; } } break; case VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET: if (!d) { goto fail; } if (d->lun != virtio_scsi_get_lun(req->req.tmf.lun)) { goto incorrect_lun; } s->resetting++; qdev_reset_all(&d->qdev); s->resetting--; break; case VIRTIO_SCSI_T_TMF_ABORT_TASK_SET: case VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET: case VIRTIO_SCSI_T_TMF_QUERY_TASK_SET: if (!d) { goto fail; } if (d->lun != virtio_scsi_get_lun(req->req.tmf.lun)) { goto incorrect_lun; } req->remaining = 1; QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) { if (r->hba_private) { if (req->req.tmf.subtype == VIRTIO_SCSI_T_TMF_QUERY_TASK_SET) { req->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED; break; } else { VirtIOSCSICancelNotifier *notifier; req->remaining++; notifier = g_new(VirtIOSCSICancelNotifier, 1); notifier->notifier.notify = virtio_scsi_cancel_notify; notifier->tmf_req = req; scsi_req_cancel_async(r, &notifier->notifier); } } } if (--req->remaining > 0) { ret = -EINPROGRESS; } break; case VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET: target = req->req.tmf.lun[1]; s->resetting++; QTAILQ_FOREACH(kid, &s->bus.qbus.children, sibling) { d = DO_UPCAST(SCSIDevice, qdev, kid->child); if (d->channel == 0 && d->id == target) { qdev_reset_all(&d->qdev); } } s->resetting--; break; case VIRTIO_SCSI_T_TMF_CLEAR_ACA: default: req->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_REJECTED; break; } return ret; incorrect_lun: req->resp.tmf.response = VIRTIO_SCSI_S_INCORRECT_LUN; return ret; fail: req->resp.tmf.response = VIRTIO_SCSI_S_BAD_TARGET; return ret; }
{ "code": [ " if (s->dataplane_started) {" ], "line_no": [ 17 ] }
static int FUNC_0(VirtIOSCSI *VAR_0, VirtIOSCSIReq *VAR_1) { SCSIDevice *d = virtio_scsi_device_find(VAR_0, VAR_1->VAR_1.tmf.lun); SCSIRequest *r, *next; BusChild *kid; int VAR_2; int VAR_3 = 0; if (VAR_0->dataplane_started) { assert(blk_get_aio_context(d->conf.blk) == VAR_0->ctx); } VAR_1->resp.tmf.response = VIRTIO_SCSI_S_OK; virtio_tswap32s(VIRTIO_DEVICE(VAR_0), &VAR_1->VAR_1.tmf.subtype); switch (VAR_1->VAR_1.tmf.subtype) { case VIRTIO_SCSI_T_TMF_ABORT_TASK: case VIRTIO_SCSI_T_TMF_QUERY_TASK: if (!d) { goto fail; } if (d->lun != virtio_scsi_get_lun(VAR_1->VAR_1.tmf.lun)) { goto incorrect_lun; } QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) { VirtIOSCSIReq *cmd_req = r->hba_private; if (cmd_req && cmd_req->VAR_1.cmd.tag == VAR_1->VAR_1.tmf.tag) { break; } } if (r) { assert(r->hba_private); if (VAR_1->VAR_1.tmf.subtype == VIRTIO_SCSI_T_TMF_QUERY_TASK) { VAR_1->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED; } else { VirtIOSCSICancelNotifier *notifier; VAR_1->remaining = 1; notifier = g_new(VirtIOSCSICancelNotifier, 1); notifier->tmf_req = VAR_1; notifier->notifier.notify = virtio_scsi_cancel_notify; scsi_req_cancel_async(r, &notifier->notifier); VAR_3 = -EINPROGRESS; } } break; case VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET: if (!d) { goto fail; } if (d->lun != virtio_scsi_get_lun(VAR_1->VAR_1.tmf.lun)) { goto incorrect_lun; } VAR_0->resetting++; qdev_reset_all(&d->qdev); VAR_0->resetting--; break; case VIRTIO_SCSI_T_TMF_ABORT_TASK_SET: case VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET: case VIRTIO_SCSI_T_TMF_QUERY_TASK_SET: if (!d) { goto fail; } if (d->lun != virtio_scsi_get_lun(VAR_1->VAR_1.tmf.lun)) { goto incorrect_lun; } VAR_1->remaining = 1; QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) { if (r->hba_private) { if (VAR_1->VAR_1.tmf.subtype == VIRTIO_SCSI_T_TMF_QUERY_TASK_SET) { VAR_1->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED; break; } else { VirtIOSCSICancelNotifier *notifier; VAR_1->remaining++; notifier = g_new(VirtIOSCSICancelNotifier, 1); notifier->notifier.notify = virtio_scsi_cancel_notify; notifier->tmf_req = VAR_1; scsi_req_cancel_async(r, &notifier->notifier); } } } if (--VAR_1->remaining > 0) { VAR_3 = -EINPROGRESS; } break; case VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET: VAR_2 = VAR_1->VAR_1.tmf.lun[1]; VAR_0->resetting++; QTAILQ_FOREACH(kid, &VAR_0->bus.qbus.children, sibling) { d = DO_UPCAST(SCSIDevice, qdev, kid->child); if (d->channel == 0 && d->id == VAR_2) { qdev_reset_all(&d->qdev); } } VAR_0->resetting--; break; case VIRTIO_SCSI_T_TMF_CLEAR_ACA: default: VAR_1->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_REJECTED; break; } return VAR_3; incorrect_lun: VAR_1->resp.tmf.response = VIRTIO_SCSI_S_INCORRECT_LUN; return VAR_3; fail: VAR_1->resp.tmf.response = VIRTIO_SCSI_S_BAD_TARGET; return VAR_3; }
[ "static int FUNC_0(VirtIOSCSI *VAR_0, VirtIOSCSIReq *VAR_1)\n{", "SCSIDevice *d = virtio_scsi_device_find(VAR_0, VAR_1->VAR_1.tmf.lun);", "SCSIRequest *r, *next;", "BusChild *kid;", "int VAR_2;", "int VAR_3 = 0;", "if (VAR_0->dataplane_started) {", "assert(blk_get_aio_context(d->conf.blk) == VAR_0->ctx);", "}", "VAR_1->resp.tmf.response = VIRTIO_SCSI_S_OK;", "virtio_tswap32s(VIRTIO_DEVICE(VAR_0), &VAR_1->VAR_1.tmf.subtype);", "switch (VAR_1->VAR_1.tmf.subtype) {", "case VIRTIO_SCSI_T_TMF_ABORT_TASK:\ncase VIRTIO_SCSI_T_TMF_QUERY_TASK:\nif (!d) {", "goto fail;", "}", "if (d->lun != virtio_scsi_get_lun(VAR_1->VAR_1.tmf.lun)) {", "goto incorrect_lun;", "}", "QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) {", "VirtIOSCSIReq *cmd_req = r->hba_private;", "if (cmd_req && cmd_req->VAR_1.cmd.tag == VAR_1->VAR_1.tmf.tag) {", "break;", "}", "}", "if (r) {", "assert(r->hba_private);", "if (VAR_1->VAR_1.tmf.subtype == VIRTIO_SCSI_T_TMF_QUERY_TASK) {", "VAR_1->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED;", "} else {", "VirtIOSCSICancelNotifier *notifier;", "VAR_1->remaining = 1;", "notifier = g_new(VirtIOSCSICancelNotifier, 1);", "notifier->tmf_req = VAR_1;", "notifier->notifier.notify = virtio_scsi_cancel_notify;", "scsi_req_cancel_async(r, &notifier->notifier);", "VAR_3 = -EINPROGRESS;", "}", "}", "break;", "case VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET:\nif (!d) {", "goto fail;", "}", "if (d->lun != virtio_scsi_get_lun(VAR_1->VAR_1.tmf.lun)) {", "goto incorrect_lun;", "}", "VAR_0->resetting++;", "qdev_reset_all(&d->qdev);", "VAR_0->resetting--;", "break;", "case VIRTIO_SCSI_T_TMF_ABORT_TASK_SET:\ncase VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET:\ncase VIRTIO_SCSI_T_TMF_QUERY_TASK_SET:\nif (!d) {", "goto fail;", "}", "if (d->lun != virtio_scsi_get_lun(VAR_1->VAR_1.tmf.lun)) {", "goto incorrect_lun;", "}", "VAR_1->remaining = 1;", "QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) {", "if (r->hba_private) {", "if (VAR_1->VAR_1.tmf.subtype == VIRTIO_SCSI_T_TMF_QUERY_TASK_SET) {", "VAR_1->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED;", "break;", "} else {", "VirtIOSCSICancelNotifier *notifier;", "VAR_1->remaining++;", "notifier = g_new(VirtIOSCSICancelNotifier, 1);", "notifier->notifier.notify = virtio_scsi_cancel_notify;", "notifier->tmf_req = VAR_1;", "scsi_req_cancel_async(r, &notifier->notifier);", "}", "}", "}", "if (--VAR_1->remaining > 0) {", "VAR_3 = -EINPROGRESS;", "}", "break;", "case VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET:\nVAR_2 = VAR_1->VAR_1.tmf.lun[1];", "VAR_0->resetting++;", "QTAILQ_FOREACH(kid, &VAR_0->bus.qbus.children, sibling) {", "d = DO_UPCAST(SCSIDevice, qdev, kid->child);", "if (d->channel == 0 && d->id == VAR_2) {", "qdev_reset_all(&d->qdev);", "}", "}", "VAR_0->resetting--;", "break;", "case VIRTIO_SCSI_T_TMF_CLEAR_ACA:\ndefault:\nVAR_1->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_REJECTED;", "break;", "}", "return VAR_3;", "incorrect_lun:\nVAR_1->resp.tmf.response = VIRTIO_SCSI_S_INCORRECT_LUN;", "return VAR_3;", "fail:\nVAR_1->resp.tmf.response = VIRTIO_SCSI_S_BAD_TARGET;", "return VAR_3;", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 71 ], [ 73 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133, 135, 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213, 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237, 239, 241 ], [ 243 ], [ 245 ], [ 249 ], [ 253, 255 ], [ 257 ], [ 261, 263 ], [ 265 ], [ 267 ] ]
209
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size) { if (h->flags & AVIO_FLAG_WRITE) return AVERROR(EIO); return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read); }
true
FFmpeg
26f6b8c571bcff7b325c7d6cc226c625dd465f8e
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size) { if (h->flags & AVIO_FLAG_WRITE) return AVERROR(EIO); return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read); }
{ "code": [ " if (h->flags & AVIO_FLAG_WRITE)", " if (h->flags & AVIO_FLAG_WRITE)" ], "line_no": [ 5, 5 ] }
int FUNC_0(URLContext *VAR_0, unsigned char *VAR_1, int VAR_2) { if (VAR_0->flags & AVIO_FLAG_WRITE) return AVERROR(EIO); return retry_transfer_wrapper(VAR_0, VAR_1, VAR_2, VAR_2, VAR_0->prot->url_read); }
[ "int FUNC_0(URLContext *VAR_0, unsigned char *VAR_1, int VAR_2)\n{", "if (VAR_0->flags & AVIO_FLAG_WRITE)\nreturn AVERROR(EIO);", "return retry_transfer_wrapper(VAR_0, VAR_1, VAR_2, VAR_2, VAR_0->prot->url_read);", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ] ]
210
int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries, uint8_t bar_nr) { int ret; char *name; uint32_t bar_size = 4096; uint32_t bar_pba_offset = bar_size / 2; uint32_t bar_pba_size = (nentries / 8 + 1) * 8; /* * Migration compatibility dictates that this remains a 4k * BAR with the vector table in the lower half and PBA in * the upper half for nentries which is lower or equal to 128. * No need to care about using more than 65 entries for legacy * machine types who has at most 64 queues. */ if (nentries * PCI_MSIX_ENTRY_SIZE > bar_pba_offset) { bar_pba_offset = nentries * PCI_MSIX_ENTRY_SIZE; } if (bar_pba_offset + bar_pba_size > 4096) { bar_size = bar_pba_offset + bar_pba_size; } if (bar_size & (bar_size - 1)) { bar_size = 1 << qemu_fls(bar_size); } name = g_strdup_printf("%s-msix", dev->name); memory_region_init(&dev->msix_exclusive_bar, OBJECT(dev), name, bar_size); g_free(name); ret = msix_init(dev, nentries, &dev->msix_exclusive_bar, bar_nr, 0, &dev->msix_exclusive_bar, bar_nr, bar_pba_offset, 0); if (ret) { return ret; } pci_register_bar(dev, bar_nr, PCI_BASE_ADDRESS_SPACE_MEMORY, &dev->msix_exclusive_bar); return 0; }
true
qemu
9bff5d8135fc3f37932d4177727d293aa93ce79b
int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries, uint8_t bar_nr) { int ret; char *name; uint32_t bar_size = 4096; uint32_t bar_pba_offset = bar_size / 2; uint32_t bar_pba_size = (nentries / 8 + 1) * 8; if (nentries * PCI_MSIX_ENTRY_SIZE > bar_pba_offset) { bar_pba_offset = nentries * PCI_MSIX_ENTRY_SIZE; } if (bar_pba_offset + bar_pba_size > 4096) { bar_size = bar_pba_offset + bar_pba_size; } if (bar_size & (bar_size - 1)) { bar_size = 1 << qemu_fls(bar_size); } name = g_strdup_printf("%s-msix", dev->name); memory_region_init(&dev->msix_exclusive_bar, OBJECT(dev), name, bar_size); g_free(name); ret = msix_init(dev, nentries, &dev->msix_exclusive_bar, bar_nr, 0, &dev->msix_exclusive_bar, bar_nr, bar_pba_offset, 0); if (ret) { return ret; } pci_register_bar(dev, bar_nr, PCI_BASE_ADDRESS_SPACE_MEMORY, &dev->msix_exclusive_bar); return 0; }
{ "code": [ " if (bar_size & (bar_size - 1)) {", " bar_size = 1 << qemu_fls(bar_size);" ], "line_no": [ 49, 51 ] }
int FUNC_0(PCIDevice *VAR_0, unsigned short VAR_1, uint8_t VAR_2) { int VAR_3; char *VAR_4; uint32_t bar_size = 4096; uint32_t bar_pba_offset = bar_size / 2; uint32_t bar_pba_size = (VAR_1 / 8 + 1) * 8; if (VAR_1 * PCI_MSIX_ENTRY_SIZE > bar_pba_offset) { bar_pba_offset = VAR_1 * PCI_MSIX_ENTRY_SIZE; } if (bar_pba_offset + bar_pba_size > 4096) { bar_size = bar_pba_offset + bar_pba_size; } if (bar_size & (bar_size - 1)) { bar_size = 1 << qemu_fls(bar_size); } VAR_4 = g_strdup_printf("%s-msix", VAR_0->VAR_4); memory_region_init(&VAR_0->msix_exclusive_bar, OBJECT(VAR_0), VAR_4, bar_size); g_free(VAR_4); VAR_3 = msix_init(VAR_0, VAR_1, &VAR_0->msix_exclusive_bar, VAR_2, 0, &VAR_0->msix_exclusive_bar, VAR_2, bar_pba_offset, 0); if (VAR_3) { return VAR_3; } pci_register_bar(VAR_0, VAR_2, PCI_BASE_ADDRESS_SPACE_MEMORY, &VAR_0->msix_exclusive_bar); return 0; }
[ "int FUNC_0(PCIDevice *VAR_0, unsigned short VAR_1,\nuint8_t VAR_2)\n{", "int VAR_3;", "char *VAR_4;", "uint32_t bar_size = 4096;", "uint32_t bar_pba_offset = bar_size / 2;", "uint32_t bar_pba_size = (VAR_1 / 8 + 1) * 8;", "if (VAR_1 * PCI_MSIX_ENTRY_SIZE > bar_pba_offset) {", "bar_pba_offset = VAR_1 * PCI_MSIX_ENTRY_SIZE;", "}", "if (bar_pba_offset + bar_pba_size > 4096) {", "bar_size = bar_pba_offset + bar_pba_size;", "}", "if (bar_size & (bar_size - 1)) {", "bar_size = 1 << qemu_fls(bar_size);", "}", "VAR_4 = g_strdup_printf(\"%s-msix\", VAR_0->VAR_4);", "memory_region_init(&VAR_0->msix_exclusive_bar, OBJECT(VAR_0), VAR_4, bar_size);", "g_free(VAR_4);", "VAR_3 = msix_init(VAR_0, VAR_1, &VAR_0->msix_exclusive_bar, VAR_2,\n0, &VAR_0->msix_exclusive_bar,\nVAR_2, bar_pba_offset,\n0);", "if (VAR_3) {", "return VAR_3;", "}", "pci_register_bar(VAR_0, VAR_2, PCI_BASE_ADDRESS_SPACE_MEMORY,\n&VAR_0->msix_exclusive_bar);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67, 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 87 ], [ 89 ] ]
211
void qemu_del_timer(QEMUTimer *ts) { }
false
qemu
cbcfa0418f0c196afa765f5c9837b9344d1adcf3
void qemu_del_timer(QEMUTimer *ts) { }
{ "code": [], "line_no": [] }
void FUNC_0(QEMUTimer *VAR_0) { }
[ "void FUNC_0(QEMUTimer *VAR_0)\n{", "}" ]
[ 0, 0 ]
[ [ 1, 3 ], [ 5 ] ]
212
static void restore_native_fp_frstor(CPUState *env) { int fptag, i, j; struct fpstate fp1, *fp = &fp1; fp->fpuc = env->fpuc; fp->fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11; fptag = 0; for (i=7; i>=0; i--) { fptag <<= 2; if (env->fptags[i]) { fptag |= 3; } else { /* the FPU automatically computes it */ } } fp->fptag = fptag; j = env->fpstt; for(i = 0;i < 8; i++) { memcpy(&fp->fpregs1[i * 10], &env->fpregs[j].d, 10); j = (j + 1) & 7; } asm volatile ("frstor %0" : "=m" (*fp)); }
false
qemu
4a1418e07bdcfaa3177739e04707ecaec75d89e1
static void restore_native_fp_frstor(CPUState *env) { int fptag, i, j; struct fpstate fp1, *fp = &fp1; fp->fpuc = env->fpuc; fp->fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11; fptag = 0; for (i=7; i>=0; i--) { fptag <<= 2; if (env->fptags[i]) { fptag |= 3; } else { } } fp->fptag = fptag; j = env->fpstt; for(i = 0;i < 8; i++) { memcpy(&fp->fpregs1[i * 10], &env->fpregs[j].d, 10); j = (j + 1) & 7; } asm volatile ("frstor %0" : "=m" (*fp)); }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUState *VAR_0) { int VAR_1, VAR_2, VAR_3; struct fpstate VAR_4, *VAR_5 = &VAR_4; VAR_5->fpuc = VAR_0->fpuc; VAR_5->fpus = (VAR_0->fpus & ~0x3800) | (VAR_0->fpstt & 0x7) << 11; VAR_1 = 0; for (VAR_2=7; VAR_2>=0; VAR_2--) { VAR_1 <<= 2; if (VAR_0->fptags[VAR_2]) { VAR_1 |= 3; } else { } } VAR_5->VAR_1 = VAR_1; VAR_3 = VAR_0->fpstt; for(VAR_2 = 0;VAR_2 < 8; VAR_2++) { memcpy(&VAR_5->fpregs1[VAR_2 * 10], &VAR_0->fpregs[VAR_3].d, 10); VAR_3 = (VAR_3 + 1) & 7; } asm volatile ("frstor %0" : "=m" (*VAR_5)); }
[ "static void FUNC_0(CPUState *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3;", "struct fpstate VAR_4, *VAR_5 = &VAR_4;", "VAR_5->fpuc = VAR_0->fpuc;", "VAR_5->fpus = (VAR_0->fpus & ~0x3800) | (VAR_0->fpstt & 0x7) << 11;", "VAR_1 = 0;", "for (VAR_2=7; VAR_2>=0; VAR_2--) {", "VAR_1 <<= 2;", "if (VAR_0->fptags[VAR_2]) {", "VAR_1 |= 3;", "} else {", "}", "}", "VAR_5->VAR_1 = VAR_1;", "VAR_3 = VAR_0->fpstt;", "for(VAR_2 = 0;VAR_2 < 8; VAR_2++) {", "memcpy(&VAR_5->fpregs1[VAR_2 * 10], &VAR_0->fpregs[VAR_3].d, 10);", "VAR_3 = (VAR_3 + 1) & 7;", "}", "asm volatile (\"frstor %0\" : \"=m\" (*VAR_5));", "}" ]
[ 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
213
static void cpu_exec_nocache(int max_cycles, TranslationBlock *orig_tb) { unsigned long next_tb; TranslationBlock *tb; /* Should never happen. We only end up here when an existing TB is too long. */ if (max_cycles > CF_COUNT_MASK) max_cycles = CF_COUNT_MASK; tb = tb_gen_code(env, orig_tb->pc, orig_tb->cs_base, orig_tb->flags, max_cycles); env->current_tb = tb; /* execute the generated code */ next_tb = tcg_qemu_tb_exec(tb->tc_ptr); env->current_tb = NULL; if ((next_tb & 3) == 2) { /* Restore PC. This may happen if async event occurs before the TB starts executing. */ cpu_pc_from_tb(env, tb); } tb_phys_invalidate(tb, -1); tb_free(tb); }
false
qemu
cea5f9a28faa528b6b1b117c9ab2d8828f473fef
static void cpu_exec_nocache(int max_cycles, TranslationBlock *orig_tb) { unsigned long next_tb; TranslationBlock *tb; if (max_cycles > CF_COUNT_MASK) max_cycles = CF_COUNT_MASK; tb = tb_gen_code(env, orig_tb->pc, orig_tb->cs_base, orig_tb->flags, max_cycles); env->current_tb = tb; next_tb = tcg_qemu_tb_exec(tb->tc_ptr); env->current_tb = NULL; if ((next_tb & 3) == 2) { cpu_pc_from_tb(env, tb); } tb_phys_invalidate(tb, -1); tb_free(tb); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, TranslationBlock *VAR_1) { unsigned long VAR_2; TranslationBlock *tb; if (VAR_0 > CF_COUNT_MASK) VAR_0 = CF_COUNT_MASK; tb = tb_gen_code(env, VAR_1->pc, VAR_1->cs_base, VAR_1->flags, VAR_0); env->current_tb = tb; VAR_2 = tcg_qemu_tb_exec(tb->tc_ptr); env->current_tb = NULL; if ((VAR_2 & 3) == 2) { cpu_pc_from_tb(env, tb); } tb_phys_invalidate(tb, -1); tb_free(tb); }
[ "static void FUNC_0(int VAR_0, TranslationBlock *VAR_1)\n{", "unsigned long VAR_2;", "TranslationBlock *tb;", "if (VAR_0 > CF_COUNT_MASK)\nVAR_0 = CF_COUNT_MASK;", "tb = tb_gen_code(env, VAR_1->pc, VAR_1->cs_base, VAR_1->flags,\nVAR_0);", "env->current_tb = tb;", "VAR_2 = tcg_qemu_tb_exec(tb->tc_ptr);", "env->current_tb = NULL;", "if ((VAR_2 & 3) == 2) {", "cpu_pc_from_tb(env, tb);", "}", "tb_phys_invalidate(tb, -1);", "tb_free(tb);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 15, 17 ], [ 21, 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
214
static char *regname(uint32_t addr) { static char buf[16]; if (addr < PCI_IO_SIZE) { const char *r = reg[addr / 4]; if (r != 0) { sprintf(buf, "%s+%u", r, addr % 4); } else { sprintf(buf, "0x%02x", addr); } } else { sprintf(buf, "??? 0x%08x", addr); } return buf; }
false
qemu
41cbc23c5ca37a8b841915d7d252a02106d58b1e
static char *regname(uint32_t addr) { static char buf[16]; if (addr < PCI_IO_SIZE) { const char *r = reg[addr / 4]; if (r != 0) { sprintf(buf, "%s+%u", r, addr % 4); } else { sprintf(buf, "0x%02x", addr); } } else { sprintf(buf, "??? 0x%08x", addr); } return buf; }
{ "code": [], "line_no": [] }
static char *FUNC_0(uint32_t VAR_0) { static char VAR_1[16]; if (VAR_0 < PCI_IO_SIZE) { const char *VAR_2 = reg[VAR_0 / 4]; if (VAR_2 != 0) { sprintf(VAR_1, "%s+%u", VAR_2, VAR_0 % 4); } else { sprintf(VAR_1, "0x%02x", VAR_0); } } else { sprintf(VAR_1, "??? 0x%08x", VAR_0); } return VAR_1; }
[ "static char *FUNC_0(uint32_t VAR_0)\n{", "static char VAR_1[16];", "if (VAR_0 < PCI_IO_SIZE) {", "const char *VAR_2 = reg[VAR_0 / 4];", "if (VAR_2 != 0) {", "sprintf(VAR_1, \"%s+%u\", VAR_2, VAR_0 % 4);", "} else {", "sprintf(VAR_1, \"0x%02x\", VAR_0);", "}", "} else {", "sprintf(VAR_1, \"??? 0x%08x\", VAR_0);", "}", "return VAR_1;", "}" ]
[ 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 ] ]
215
static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, bool is_scalar, bool is_u, bool is_q, int size, int rn, int rd) { bool is_double = (size == 3); TCGv_ptr fpst = get_fpstatus_ptr(); if (is_double) { TCGv_i64 tcg_op = tcg_temp_new_i64(); TCGv_i64 tcg_zero = tcg_const_i64(0); TCGv_i64 tcg_res = tcg_temp_new_i64(); NeonGenTwoDoubleOPFn *genfn; bool swap = false; int pass; switch (opcode) { case 0x2e: /* FCMLT (zero) */ swap = true; /* fallthrough */ case 0x2c: /* FCMGT (zero) */ genfn = gen_helper_neon_cgt_f64; break; case 0x2d: /* FCMEQ (zero) */ genfn = gen_helper_neon_ceq_f64; break; case 0x6d: /* FCMLE (zero) */ swap = true; /* fall through */ case 0x6c: /* FCMGE (zero) */ genfn = gen_helper_neon_cge_f64; break; default: g_assert_not_reached(); } for (pass = 0; pass < (is_scalar ? 1 : 2); pass++) { read_vec_element(s, tcg_op, rn, pass, MO_64); if (swap) { genfn(tcg_res, tcg_zero, tcg_op, fpst); } else { genfn(tcg_res, tcg_op, tcg_zero, fpst); } write_vec_element(s, tcg_res, rd, pass, MO_64); } if (is_scalar) { clear_vec_high(s, rd); } tcg_temp_free_i64(tcg_res); tcg_temp_free_i64(tcg_zero); tcg_temp_free_i64(tcg_op); } else { TCGv_i32 tcg_op = tcg_temp_new_i32(); TCGv_i32 tcg_zero = tcg_const_i32(0); TCGv_i32 tcg_res = tcg_temp_new_i32(); NeonGenTwoSingleOPFn *genfn; bool swap = false; int pass, maxpasses; switch (opcode) { case 0x2e: /* FCMLT (zero) */ swap = true; /* fall through */ case 0x2c: /* FCMGT (zero) */ genfn = gen_helper_neon_cgt_f32; break; case 0x2d: /* FCMEQ (zero) */ genfn = gen_helper_neon_ceq_f32; break; case 0x6d: /* FCMLE (zero) */ swap = true; /* fall through */ case 0x6c: /* FCMGE (zero) */ genfn = gen_helper_neon_cge_f32; break; default: g_assert_not_reached(); } if (is_scalar) { maxpasses = 1; } else { maxpasses = is_q ? 4 : 2; } for (pass = 0; pass < maxpasses; pass++) { read_vec_element_i32(s, tcg_op, rn, pass, MO_32); if (swap) { genfn(tcg_res, tcg_zero, tcg_op, fpst); } else { genfn(tcg_res, tcg_op, tcg_zero, fpst); } if (is_scalar) { write_fp_sreg(s, rd, tcg_res); } else { write_vec_element_i32(s, tcg_res, rd, pass, MO_32); } } tcg_temp_free_i32(tcg_res); tcg_temp_free_i32(tcg_zero); tcg_temp_free_i32(tcg_op); if (!is_q && !is_scalar) { clear_vec_high(s, rd); } } tcg_temp_free_ptr(fpst); }
false
qemu
8c6afa6ab158467d1938cc92022135bc7a872006
static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, bool is_scalar, bool is_u, bool is_q, int size, int rn, int rd) { bool is_double = (size == 3); TCGv_ptr fpst = get_fpstatus_ptr(); if (is_double) { TCGv_i64 tcg_op = tcg_temp_new_i64(); TCGv_i64 tcg_zero = tcg_const_i64(0); TCGv_i64 tcg_res = tcg_temp_new_i64(); NeonGenTwoDoubleOPFn *genfn; bool swap = false; int pass; switch (opcode) { case 0x2e: swap = true; case 0x2c: genfn = gen_helper_neon_cgt_f64; break; case 0x2d: genfn = gen_helper_neon_ceq_f64; break; case 0x6d: swap = true; case 0x6c: genfn = gen_helper_neon_cge_f64; break; default: g_assert_not_reached(); } for (pass = 0; pass < (is_scalar ? 1 : 2); pass++) { read_vec_element(s, tcg_op, rn, pass, MO_64); if (swap) { genfn(tcg_res, tcg_zero, tcg_op, fpst); } else { genfn(tcg_res, tcg_op, tcg_zero, fpst); } write_vec_element(s, tcg_res, rd, pass, MO_64); } if (is_scalar) { clear_vec_high(s, rd); } tcg_temp_free_i64(tcg_res); tcg_temp_free_i64(tcg_zero); tcg_temp_free_i64(tcg_op); } else { TCGv_i32 tcg_op = tcg_temp_new_i32(); TCGv_i32 tcg_zero = tcg_const_i32(0); TCGv_i32 tcg_res = tcg_temp_new_i32(); NeonGenTwoSingleOPFn *genfn; bool swap = false; int pass, maxpasses; switch (opcode) { case 0x2e: swap = true; case 0x2c: genfn = gen_helper_neon_cgt_f32; break; case 0x2d: genfn = gen_helper_neon_ceq_f32; break; case 0x6d: swap = true; case 0x6c: genfn = gen_helper_neon_cge_f32; break; default: g_assert_not_reached(); } if (is_scalar) { maxpasses = 1; } else { maxpasses = is_q ? 4 : 2; } for (pass = 0; pass < maxpasses; pass++) { read_vec_element_i32(s, tcg_op, rn, pass, MO_32); if (swap) { genfn(tcg_res, tcg_zero, tcg_op, fpst); } else { genfn(tcg_res, tcg_op, tcg_zero, fpst); } if (is_scalar) { write_fp_sreg(s, rd, tcg_res); } else { write_vec_element_i32(s, tcg_res, rd, pass, MO_32); } } tcg_temp_free_i32(tcg_res); tcg_temp_free_i32(tcg_zero); tcg_temp_free_i32(tcg_op); if (!is_q && !is_scalar) { clear_vec_high(s, rd); } } tcg_temp_free_ptr(fpst); }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0, int VAR_1, bool VAR_2, bool VAR_3, bool VAR_4, int VAR_5, int VAR_6, int VAR_7) { bool is_double = (VAR_5 == 3); TCGv_ptr fpst = get_fpstatus_ptr(); if (is_double) { TCGv_i64 tcg_op = tcg_temp_new_i64(); TCGv_i64 tcg_zero = tcg_const_i64(0); TCGv_i64 tcg_res = tcg_temp_new_i64(); NeonGenTwoDoubleOPFn *genfn; bool swap = false; int VAR_9; switch (VAR_1) { case 0x2e: swap = true; case 0x2c: genfn = gen_helper_neon_cgt_f64; break; case 0x2d: genfn = gen_helper_neon_ceq_f64; break; case 0x6d: swap = true; case 0x6c: genfn = gen_helper_neon_cge_f64; break; default: g_assert_not_reached(); } for (VAR_9 = 0; VAR_9 < (VAR_2 ? 1 : 2); VAR_9++) { read_vec_element(VAR_0, tcg_op, VAR_6, VAR_9, MO_64); if (swap) { genfn(tcg_res, tcg_zero, tcg_op, fpst); } else { genfn(tcg_res, tcg_op, tcg_zero, fpst); } write_vec_element(VAR_0, tcg_res, VAR_7, VAR_9, MO_64); } if (VAR_2) { clear_vec_high(VAR_0, VAR_7); } tcg_temp_free_i64(tcg_res); tcg_temp_free_i64(tcg_zero); tcg_temp_free_i64(tcg_op); } else { TCGv_i32 tcg_op = tcg_temp_new_i32(); TCGv_i32 tcg_zero = tcg_const_i32(0); TCGv_i32 tcg_res = tcg_temp_new_i32(); NeonGenTwoSingleOPFn *genfn; bool swap = false; int VAR_9, VAR_9; switch (VAR_1) { case 0x2e: swap = true; case 0x2c: genfn = gen_helper_neon_cgt_f32; break; case 0x2d: genfn = gen_helper_neon_ceq_f32; break; case 0x6d: swap = true; case 0x6c: genfn = gen_helper_neon_cge_f32; break; default: g_assert_not_reached(); } if (VAR_2) { VAR_9 = 1; } else { VAR_9 = VAR_4 ? 4 : 2; } for (VAR_9 = 0; VAR_9 < VAR_9; VAR_9++) { read_vec_element_i32(VAR_0, tcg_op, VAR_6, VAR_9, MO_32); if (swap) { genfn(tcg_res, tcg_zero, tcg_op, fpst); } else { genfn(tcg_res, tcg_op, tcg_zero, fpst); } if (VAR_2) { write_fp_sreg(VAR_0, VAR_7, tcg_res); } else { write_vec_element_i32(VAR_0, tcg_res, VAR_7, VAR_9, MO_32); } } tcg_temp_free_i32(tcg_res); tcg_temp_free_i32(tcg_zero); tcg_temp_free_i32(tcg_op); if (!VAR_4 && !VAR_2) { clear_vec_high(VAR_0, VAR_7); } } tcg_temp_free_ptr(fpst); }
[ "static void FUNC_0(DisasContext *VAR_0, int VAR_1,\nbool VAR_2, bool VAR_3, bool VAR_4,\nint VAR_5, int VAR_6, int VAR_7)\n{", "bool is_double = (VAR_5 == 3);", "TCGv_ptr fpst = get_fpstatus_ptr();", "if (is_double) {", "TCGv_i64 tcg_op = tcg_temp_new_i64();", "TCGv_i64 tcg_zero = tcg_const_i64(0);", "TCGv_i64 tcg_res = tcg_temp_new_i64();", "NeonGenTwoDoubleOPFn *genfn;", "bool swap = false;", "int VAR_9;", "switch (VAR_1) {", "case 0x2e:\nswap = true;", "case 0x2c:\ngenfn = gen_helper_neon_cgt_f64;", "break;", "case 0x2d:\ngenfn = gen_helper_neon_ceq_f64;", "break;", "case 0x6d:\nswap = true;", "case 0x6c:\ngenfn = gen_helper_neon_cge_f64;", "break;", "default:\ng_assert_not_reached();", "}", "for (VAR_9 = 0; VAR_9 < (VAR_2 ? 1 : 2); VAR_9++) {", "read_vec_element(VAR_0, tcg_op, VAR_6, VAR_9, MO_64);", "if (swap) {", "genfn(tcg_res, tcg_zero, tcg_op, fpst);", "} else {", "genfn(tcg_res, tcg_op, tcg_zero, fpst);", "}", "write_vec_element(VAR_0, tcg_res, VAR_7, VAR_9, MO_64);", "}", "if (VAR_2) {", "clear_vec_high(VAR_0, VAR_7);", "}", "tcg_temp_free_i64(tcg_res);", "tcg_temp_free_i64(tcg_zero);", "tcg_temp_free_i64(tcg_op);", "} else {", "TCGv_i32 tcg_op = tcg_temp_new_i32();", "TCGv_i32 tcg_zero = tcg_const_i32(0);", "TCGv_i32 tcg_res = tcg_temp_new_i32();", "NeonGenTwoSingleOPFn *genfn;", "bool swap = false;", "int VAR_9, VAR_9;", "switch (VAR_1) {", "case 0x2e:\nswap = true;", "case 0x2c:\ngenfn = gen_helper_neon_cgt_f32;", "break;", "case 0x2d:\ngenfn = gen_helper_neon_ceq_f32;", "break;", "case 0x6d:\nswap = true;", "case 0x6c:\ngenfn = gen_helper_neon_cge_f32;", "break;", "default:\ng_assert_not_reached();", "}", "if (VAR_2) {", "VAR_9 = 1;", "} else {", "VAR_9 = VAR_4 ? 4 : 2;", "}", "for (VAR_9 = 0; VAR_9 < VAR_9; VAR_9++) {", "read_vec_element_i32(VAR_0, tcg_op, VAR_6, VAR_9, MO_32);", "if (swap) {", "genfn(tcg_res, tcg_zero, tcg_op, fpst);", "} else {", "genfn(tcg_res, tcg_op, tcg_zero, fpst);", "}", "if (VAR_2) {", "write_fp_sreg(VAR_0, VAR_7, tcg_res);", "} else {", "write_vec_element_i32(VAR_0, tcg_res, VAR_7, VAR_9, MO_32);", "}", "}", "tcg_temp_free_i32(tcg_res);", "tcg_temp_free_i32(tcg_zero);", "tcg_temp_free_i32(tcg_op);", "if (!VAR_4 && !VAR_2) {", "clear_vec_high(VAR_0, VAR_7);", "}", "}", "tcg_temp_free_ptr(fpst);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121, 123 ], [ 127, 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139, 141 ], [ 145, 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ] ]
216
static int on2avc_decode_band_scales(On2AVCContext *c, GetBitContext *gb) { int w, w2, b, scale, first = 1; int band_off = 0; for (w = 0; w < c->num_windows; w++) { if (!c->grouping[w]) { memcpy(c->band_scales + band_off, c->band_scales + band_off - c->num_bands, c->num_bands * sizeof(*c->band_scales)); band_off += c->num_bands; continue; } for (b = 0; b < c->num_bands; b++) { if (!c->band_type[band_off]) { int all_zero = 1; for (w2 = w + 1; w2 < c->num_windows; w2++) { if (c->grouping[w2]) break; if (c->band_type[w2 * c->num_bands + b]) { all_zero = 0; break; } } if (all_zero) { c->band_scales[band_off++] = 0; continue; } } if (first) { scale = get_bits(gb, 7); first = 0; } else { scale += get_vlc2(gb, c->scale_diff.table, 9, 3) - 60; } if (scale < 0 || scale > 128) { av_log(c->avctx, AV_LOG_ERROR, "Invalid scale value %d\n", scale); return AVERROR_INVALIDDATA; } c->band_scales[band_off++] = c->scale_tab[scale]; } } return 0; }
false
FFmpeg
2fa6d21124bd2fc0b186290f5313179263bfcfb7
static int on2avc_decode_band_scales(On2AVCContext *c, GetBitContext *gb) { int w, w2, b, scale, first = 1; int band_off = 0; for (w = 0; w < c->num_windows; w++) { if (!c->grouping[w]) { memcpy(c->band_scales + band_off, c->band_scales + band_off - c->num_bands, c->num_bands * sizeof(*c->band_scales)); band_off += c->num_bands; continue; } for (b = 0; b < c->num_bands; b++) { if (!c->band_type[band_off]) { int all_zero = 1; for (w2 = w + 1; w2 < c->num_windows; w2++) { if (c->grouping[w2]) break; if (c->band_type[w2 * c->num_bands + b]) { all_zero = 0; break; } } if (all_zero) { c->band_scales[band_off++] = 0; continue; } } if (first) { scale = get_bits(gb, 7); first = 0; } else { scale += get_vlc2(gb, c->scale_diff.table, 9, 3) - 60; } if (scale < 0 || scale > 128) { av_log(c->avctx, AV_LOG_ERROR, "Invalid scale value %d\n", scale); return AVERROR_INVALIDDATA; } c->band_scales[band_off++] = c->scale_tab[scale]; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(On2AVCContext *VAR_0, GetBitContext *VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6 = 1; int VAR_7 = 0; for (VAR_2 = 0; VAR_2 < VAR_0->num_windows; VAR_2++) { if (!VAR_0->grouping[VAR_2]) { memcpy(VAR_0->band_scales + VAR_7, VAR_0->band_scales + VAR_7 - VAR_0->num_bands, VAR_0->num_bands * sizeof(*VAR_0->band_scales)); VAR_7 += VAR_0->num_bands; continue; } for (VAR_4 = 0; VAR_4 < VAR_0->num_bands; VAR_4++) { if (!VAR_0->band_type[VAR_7]) { int all_zero = 1; for (VAR_3 = VAR_2 + 1; VAR_3 < VAR_0->num_windows; VAR_3++) { if (VAR_0->grouping[VAR_3]) break; if (VAR_0->band_type[VAR_3 * VAR_0->num_bands + VAR_4]) { all_zero = 0; break; } } if (all_zero) { VAR_0->band_scales[VAR_7++] = 0; continue; } } if (VAR_6) { VAR_5 = get_bits(VAR_1, 7); VAR_6 = 0; } else { VAR_5 += get_vlc2(VAR_1, VAR_0->scale_diff.table, 9, 3) - 60; } if (VAR_5 < 0 || VAR_5 > 128) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid VAR_5 value %d\n", VAR_5); return AVERROR_INVALIDDATA; } VAR_0->band_scales[VAR_7++] = VAR_0->scale_tab[VAR_5]; } } return 0; }
[ "static int FUNC_0(On2AVCContext *VAR_0, GetBitContext *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6 = 1;", "int VAR_7 = 0;", "for (VAR_2 = 0; VAR_2 < VAR_0->num_windows; VAR_2++) {", "if (!VAR_0->grouping[VAR_2]) {", "memcpy(VAR_0->band_scales + VAR_7,\nVAR_0->band_scales + VAR_7 - VAR_0->num_bands,\nVAR_0->num_bands * sizeof(*VAR_0->band_scales));", "VAR_7 += VAR_0->num_bands;", "continue;", "}", "for (VAR_4 = 0; VAR_4 < VAR_0->num_bands; VAR_4++) {", "if (!VAR_0->band_type[VAR_7]) {", "int all_zero = 1;", "for (VAR_3 = VAR_2 + 1; VAR_3 < VAR_0->num_windows; VAR_3++) {", "if (VAR_0->grouping[VAR_3])\nbreak;", "if (VAR_0->band_type[VAR_3 * VAR_0->num_bands + VAR_4]) {", "all_zero = 0;", "break;", "}", "}", "if (all_zero) {", "VAR_0->band_scales[VAR_7++] = 0;", "continue;", "}", "}", "if (VAR_6) {", "VAR_5 = get_bits(VAR_1, 7);", "VAR_6 = 0;", "} else {", "VAR_5 += get_vlc2(VAR_1, VAR_0->scale_diff.table, 9, 3) - 60;", "}", "if (VAR_5 < 0 || VAR_5 > 128) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid VAR_5 value %d\\n\",\nVAR_5);", "return AVERROR_INVALIDDATA;", "}", "VAR_0->band_scales[VAR_7++] = VAR_0->scale_tab[VAR_5];", "}", "}", "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 ]
[ [ 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 ], [ 89 ], [ 91 ] ]
217
static inline void writer_print_rational(WriterContext *wctx, const char *key, AVRational q, char sep) { AVBPrint buf; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprintf(&buf, "%d%c%d", q.num, sep, q.den); wctx->writer->print_string(wctx, key, buf.str); wctx->nb_item++; }
false
FFmpeg
4b370d6126ab74c6112e2c1edfad3f48ebcf08ad
static inline void writer_print_rational(WriterContext *wctx, const char *key, AVRational q, char sep) { AVBPrint buf; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprintf(&buf, "%d%c%d", q.num, sep, q.den); wctx->writer->print_string(wctx, key, buf.str); wctx->nb_item++; }
{ "code": [], "line_no": [] }
static inline void FUNC_0(WriterContext *VAR_0, const char *VAR_1, AVRational VAR_2, char VAR_3) { AVBPrint buf; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprintf(&buf, "%d%c%d", VAR_2.num, VAR_3, VAR_2.den); VAR_0->writer->print_string(VAR_0, VAR_1, buf.str); VAR_0->nb_item++; }
[ "static inline void FUNC_0(WriterContext *VAR_0,\nconst char *VAR_1, AVRational VAR_2, char VAR_3)\n{", "AVBPrint buf;", "av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);", "av_bprintf(&buf, \"%d%c%d\", VAR_2.num, VAR_3, VAR_2.den);", "VAR_0->writer->print_string(VAR_0, VAR_1, buf.str);", "VAR_0->nb_item++;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
219
int cpu_watchpoint_insert(CPUState *env, target_ulong addr, target_ulong len, int flags, CPUWatchpoint **watchpoint) { target_ulong len_mask = ~(len - 1); CPUWatchpoint *wp; /* sanity checks: allow power-of-2 lengths, deny unaligned watchpoints */ if ((len != 1 && len != 2 && len != 4 && len != 8) || (addr & ~len_mask)) { fprintf(stderr, "qemu: tried to set invalid watchpoint at " TARGET_FMT_lx ", len=" TARGET_FMT_lu "\n", addr, len); return -EINVAL; } wp = qemu_malloc(sizeof(*wp)); wp->vaddr = addr; wp->len_mask = len_mask; wp->flags = flags; /* keep all GDB-injected watchpoints in front */ if (flags & BP_GDB) TAILQ_INSERT_HEAD(&env->watchpoints, wp, entry); else TAILQ_INSERT_TAIL(&env->watchpoints, wp, entry); tlb_flush_page(env, addr); if (watchpoint) *watchpoint = wp; return 0; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
int cpu_watchpoint_insert(CPUState *env, target_ulong addr, target_ulong len, int flags, CPUWatchpoint **watchpoint) { target_ulong len_mask = ~(len - 1); CPUWatchpoint *wp; if ((len != 1 && len != 2 && len != 4 && len != 8) || (addr & ~len_mask)) { fprintf(stderr, "qemu: tried to set invalid watchpoint at " TARGET_FMT_lx ", len=" TARGET_FMT_lu "\n", addr, len); return -EINVAL; } wp = qemu_malloc(sizeof(*wp)); wp->vaddr = addr; wp->len_mask = len_mask; wp->flags = flags; if (flags & BP_GDB) TAILQ_INSERT_HEAD(&env->watchpoints, wp, entry); else TAILQ_INSERT_TAIL(&env->watchpoints, wp, entry); tlb_flush_page(env, addr); if (watchpoint) *watchpoint = wp; return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(CPUState *VAR_0, target_ulong VAR_1, target_ulong VAR_2, int VAR_3, CPUWatchpoint **VAR_4) { target_ulong len_mask = ~(VAR_2 - 1); CPUWatchpoint *wp; if ((VAR_2 != 1 && VAR_2 != 2 && VAR_2 != 4 && VAR_2 != 8) || (VAR_1 & ~len_mask)) { fprintf(stderr, "qemu: tried to set invalid VAR_4 at " TARGET_FMT_lx ", VAR_2=" TARGET_FMT_lu "\n", VAR_1, VAR_2); return -EINVAL; } wp = qemu_malloc(sizeof(*wp)); wp->vaddr = VAR_1; wp->len_mask = len_mask; wp->VAR_3 = VAR_3; if (VAR_3 & BP_GDB) TAILQ_INSERT_HEAD(&VAR_0->watchpoints, wp, entry); else TAILQ_INSERT_TAIL(&VAR_0->watchpoints, wp, entry); tlb_flush_page(VAR_0, VAR_1); if (VAR_4) *VAR_4 = wp; return 0; }
[ "int FUNC_0(CPUState *VAR_0, target_ulong VAR_1, target_ulong VAR_2,\nint VAR_3, CPUWatchpoint **VAR_4)\n{", "target_ulong len_mask = ~(VAR_2 - 1);", "CPUWatchpoint *wp;", "if ((VAR_2 != 1 && VAR_2 != 2 && VAR_2 != 4 && VAR_2 != 8) || (VAR_1 & ~len_mask)) {", "fprintf(stderr, \"qemu: tried to set invalid VAR_4 at \"\nTARGET_FMT_lx \", VAR_2=\" TARGET_FMT_lu \"\\n\", VAR_1, VAR_2);", "return -EINVAL;", "}", "wp = qemu_malloc(sizeof(*wp));", "wp->vaddr = VAR_1;", "wp->len_mask = len_mask;", "wp->VAR_3 = VAR_3;", "if (VAR_3 & BP_GDB)\nTAILQ_INSERT_HEAD(&VAR_0->watchpoints, wp, entry);", "else\nTAILQ_INSERT_TAIL(&VAR_0->watchpoints, wp, entry);", "tlb_flush_page(VAR_0, VAR_1);", "if (VAR_4)\n*VAR_4 = wp;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 39, 41 ], [ 43, 45 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 59 ] ]
220
static off_t read_off(int fd, int64_t offset) { uint64_t buffer; if (pread(fd, &buffer, 8, offset) < 8) return 0; return be64_to_cpu(buffer); }
false
qemu
64a31d5c3d73396a88563d7a504654edc85aa854
static off_t read_off(int fd, int64_t offset) { uint64_t buffer; if (pread(fd, &buffer, 8, offset) < 8) return 0; return be64_to_cpu(buffer); }
{ "code": [], "line_no": [] }
static off_t FUNC_0(int fd, int64_t offset) { uint64_t buffer; if (pread(fd, &buffer, 8, offset) < 8) return 0; return be64_to_cpu(buffer); }
[ "static off_t FUNC_0(int fd, int64_t offset)\n{", "uint64_t buffer;", "if (pread(fd, &buffer, 8, offset) < 8)\nreturn 0;", "return be64_to_cpu(buffer);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ] ]
221
void pc_machine_done(Notifier *notifier, void *data) { PCMachineState *pcms = container_of(notifier, PCMachineState, machine_done); PCIBus *bus = pcms->bus; /* set the number of CPUs */ rtc_set_cpus_count(pcms->rtc, pcms->boot_cpus); if (bus) { int extra_hosts = 0; QLIST_FOREACH(bus, &bus->child, sibling) { /* look for expander root buses */ if (pci_bus_is_root(bus)) { extra_hosts++; } } if (extra_hosts && pcms->fw_cfg) { uint64_t *val = g_malloc(sizeof(*val)); *val = cpu_to_le64(extra_hosts); fw_cfg_add_file(pcms->fw_cfg, "etc/extra-pci-roots", val, sizeof(*val)); } } acpi_setup(); if (pcms->fw_cfg) { pc_build_smbios(pcms); pc_build_feature_control_file(pcms); /* update FW_CFG_NB_CPUS to account for -device added CPUs */ fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); } if (pcms->apic_id_limit > 255) { IntelIOMMUState *iommu = INTEL_IOMMU_DEVICE(x86_iommu_get_default()); if (!iommu || !iommu->x86_iommu.intr_supported || iommu->intr_eim != ON_OFF_AUTO_ON) { error_report("current -smp configuration requires " "Extended Interrupt Mode enabled. " "You can add an IOMMU using: " "-device intel-iommu,intremap=on,eim=on"); exit(EXIT_FAILURE); } } }
false
qemu
1a26f46692320f1981c95967e0d5af4443b5f0b1
void pc_machine_done(Notifier *notifier, void *data) { PCMachineState *pcms = container_of(notifier, PCMachineState, machine_done); PCIBus *bus = pcms->bus; rtc_set_cpus_count(pcms->rtc, pcms->boot_cpus); if (bus) { int extra_hosts = 0; QLIST_FOREACH(bus, &bus->child, sibling) { if (pci_bus_is_root(bus)) { extra_hosts++; } } if (extra_hosts && pcms->fw_cfg) { uint64_t *val = g_malloc(sizeof(*val)); *val = cpu_to_le64(extra_hosts); fw_cfg_add_file(pcms->fw_cfg, "etc/extra-pci-roots", val, sizeof(*val)); } } acpi_setup(); if (pcms->fw_cfg) { pc_build_smbios(pcms); pc_build_feature_control_file(pcms); fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); } if (pcms->apic_id_limit > 255) { IntelIOMMUState *iommu = INTEL_IOMMU_DEVICE(x86_iommu_get_default()); if (!iommu || !iommu->x86_iommu.intr_supported || iommu->intr_eim != ON_OFF_AUTO_ON) { error_report("current -smp configuration requires " "Extended Interrupt Mode enabled. " "You can add an IOMMU using: " "-device intel-iommu,intremap=on,eim=on"); exit(EXIT_FAILURE); } } }
{ "code": [], "line_no": [] }
void FUNC_0(Notifier *VAR_0, void *VAR_1) { PCMachineState *pcms = container_of(VAR_0, PCMachineState, machine_done); PCIBus *bus = pcms->bus; rtc_set_cpus_count(pcms->rtc, pcms->boot_cpus); if (bus) { int VAR_2 = 0; QLIST_FOREACH(bus, &bus->child, sibling) { if (pci_bus_is_root(bus)) { VAR_2++; } } if (VAR_2 && pcms->fw_cfg) { uint64_t *val = g_malloc(sizeof(*val)); *val = cpu_to_le64(VAR_2); fw_cfg_add_file(pcms->fw_cfg, "etc/extra-pci-roots", val, sizeof(*val)); } } acpi_setup(); if (pcms->fw_cfg) { pc_build_smbios(pcms); pc_build_feature_control_file(pcms); fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); } if (pcms->apic_id_limit > 255) { IntelIOMMUState *iommu = INTEL_IOMMU_DEVICE(x86_iommu_get_default()); if (!iommu || !iommu->x86_iommu.intr_supported || iommu->intr_eim != ON_OFF_AUTO_ON) { error_report("current -smp configuration requires " "Extended Interrupt Mode enabled. " "You can add an IOMMU using: " "-device intel-iommu,intremap=on,eim=on"); exit(EXIT_FAILURE); } } }
[ "void FUNC_0(Notifier *VAR_0, void *VAR_1)\n{", "PCMachineState *pcms = container_of(VAR_0,\nPCMachineState, machine_done);", "PCIBus *bus = pcms->bus;", "rtc_set_cpus_count(pcms->rtc, pcms->boot_cpus);", "if (bus) {", "int VAR_2 = 0;", "QLIST_FOREACH(bus, &bus->child, sibling) {", "if (pci_bus_is_root(bus)) {", "VAR_2++;", "}", "}", "if (VAR_2 && pcms->fw_cfg) {", "uint64_t *val = g_malloc(sizeof(*val));", "*val = cpu_to_le64(VAR_2);", "fw_cfg_add_file(pcms->fw_cfg,\n\"etc/extra-pci-roots\", val, sizeof(*val));", "}", "}", "acpi_setup();", "if (pcms->fw_cfg) {", "pc_build_smbios(pcms);", "pc_build_feature_control_file(pcms);", "fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus);", "}", "if (pcms->apic_id_limit > 255) {", "IntelIOMMUState *iommu = INTEL_IOMMU_DEVICE(x86_iommu_get_default());", "if (!iommu || !iommu->x86_iommu.intr_supported ||\niommu->intr_eim != ON_OFF_AUTO_ON) {", "error_report(\"current -smp configuration requires \"\n\"Extended Interrupt Mode enabled. \"\n\"You can add an IOMMU using: \"\n\"-device intel-iommu,intremap=on,eim=on\");", "exit(EXIT_FAILURE);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 75, 77 ], [ 79, 81, 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
222
static void spapr_machine_reset(void) { MachineState *machine = MACHINE(qdev_get_machine()); sPAPRMachineState *spapr = SPAPR_MACHINE(machine); PowerPCCPU *first_ppc_cpu; uint32_t rtas_limit; hwaddr rtas_addr, fdt_addr; void *fdt; int rc; /* Check for unknown sysbus devices */ foreach_dynamic_sysbus_device(find_unknown_sysbus_device, NULL); spapr_caps_reset(spapr); first_ppc_cpu = POWERPC_CPU(first_cpu); if (kvm_enabled() && kvmppc_has_cap_mmu_radix() && ppc_check_compat(first_ppc_cpu, CPU_POWERPC_LOGICAL_3_00, 0, spapr->max_compat_pvr)) { /* If using KVM with radix mode available, VCPUs can be started * without a HPT because KVM will start them in radix mode. * Set the GR bit in PATB so that we know there is no HPT. */ spapr->patb_entry = PATBE1_GR; } else { spapr_setup_hpt_and_vrma(spapr); } qemu_devices_reset(); /* DRC reset may cause a device to be unplugged. This will cause troubles * if this device is used by another device (eg, a running vhost backend * will crash QEMU if the DIMM holding the vring goes away). To avoid such * situations, we reset DRCs after all devices have been reset. */ object_child_foreach_recursive(object_get_root(), spapr_reset_drcs, NULL); spapr_clear_pending_events(spapr); /* * We place the device tree and RTAS just below either the top of the RMA, * or just below 2GB, whichever is lowere, so that it can be * processed with 32-bit real mode code if necessary */ rtas_limit = MIN(spapr->rma_size, RTAS_MAX_ADDR); rtas_addr = rtas_limit - RTAS_MAX_SIZE; fdt_addr = rtas_addr - FDT_MAX_SIZE; /* if this reset wasn't generated by CAS, we should reset our * negotiated options and start from scratch */ if (!spapr->cas_reboot) { spapr_ovec_cleanup(spapr->ov5_cas); spapr->ov5_cas = spapr_ovec_new(); ppc_set_compat(first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } fdt = spapr_build_fdt(spapr, rtas_addr, spapr->rtas_size); spapr_load_rtas(spapr, fdt, rtas_addr); rc = fdt_pack(fdt); /* Should only fail if we've built a corrupted tree */ assert(rc == 0); if (fdt_totalsize(fdt) > FDT_MAX_SIZE) { error_report("FDT too big ! 0x%x bytes (max is 0x%x)", fdt_totalsize(fdt), FDT_MAX_SIZE); exit(1); } /* Load the fdt */ qemu_fdt_dumpdtb(fdt, fdt_totalsize(fdt)); cpu_physical_memory_write(fdt_addr, fdt, fdt_totalsize(fdt)); g_free(fdt); /* Set up the entry state */ first_ppc_cpu->env.gpr[3] = fdt_addr; first_ppc_cpu->env.gpr[5] = 0; first_cpu->halted = 0; first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT; spapr->cas_reboot = false; }
false
qemu
9012a53f067a78022947e18050b145c34a3dc599
static void spapr_machine_reset(void) { MachineState *machine = MACHINE(qdev_get_machine()); sPAPRMachineState *spapr = SPAPR_MACHINE(machine); PowerPCCPU *first_ppc_cpu; uint32_t rtas_limit; hwaddr rtas_addr, fdt_addr; void *fdt; int rc; foreach_dynamic_sysbus_device(find_unknown_sysbus_device, NULL); spapr_caps_reset(spapr); first_ppc_cpu = POWERPC_CPU(first_cpu); if (kvm_enabled() && kvmppc_has_cap_mmu_radix() && ppc_check_compat(first_ppc_cpu, CPU_POWERPC_LOGICAL_3_00, 0, spapr->max_compat_pvr)) { spapr->patb_entry = PATBE1_GR; } else { spapr_setup_hpt_and_vrma(spapr); } qemu_devices_reset(); object_child_foreach_recursive(object_get_root(), spapr_reset_drcs, NULL); spapr_clear_pending_events(spapr); rtas_limit = MIN(spapr->rma_size, RTAS_MAX_ADDR); rtas_addr = rtas_limit - RTAS_MAX_SIZE; fdt_addr = rtas_addr - FDT_MAX_SIZE; if (!spapr->cas_reboot) { spapr_ovec_cleanup(spapr->ov5_cas); spapr->ov5_cas = spapr_ovec_new(); ppc_set_compat(first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } fdt = spapr_build_fdt(spapr, rtas_addr, spapr->rtas_size); spapr_load_rtas(spapr, fdt, rtas_addr); rc = fdt_pack(fdt); assert(rc == 0); if (fdt_totalsize(fdt) > FDT_MAX_SIZE) { error_report("FDT too big ! 0x%x bytes (max is 0x%x)", fdt_totalsize(fdt), FDT_MAX_SIZE); exit(1); } qemu_fdt_dumpdtb(fdt, fdt_totalsize(fdt)); cpu_physical_memory_write(fdt_addr, fdt, fdt_totalsize(fdt)); g_free(fdt); first_ppc_cpu->env.gpr[3] = fdt_addr; first_ppc_cpu->env.gpr[5] = 0; first_cpu->halted = 0; first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT; spapr->cas_reboot = false; }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { MachineState *machine = MACHINE(qdev_get_machine()); sPAPRMachineState *spapr = SPAPR_MACHINE(machine); PowerPCCPU *first_ppc_cpu; uint32_t rtas_limit; hwaddr rtas_addr, fdt_addr; void *VAR_0; int VAR_1; foreach_dynamic_sysbus_device(find_unknown_sysbus_device, NULL); spapr_caps_reset(spapr); first_ppc_cpu = POWERPC_CPU(first_cpu); if (kvm_enabled() && kvmppc_has_cap_mmu_radix() && ppc_check_compat(first_ppc_cpu, CPU_POWERPC_LOGICAL_3_00, 0, spapr->max_compat_pvr)) { spapr->patb_entry = PATBE1_GR; } else { spapr_setup_hpt_and_vrma(spapr); } qemu_devices_reset(); object_child_foreach_recursive(object_get_root(), spapr_reset_drcs, NULL); spapr_clear_pending_events(spapr); rtas_limit = MIN(spapr->rma_size, RTAS_MAX_ADDR); rtas_addr = rtas_limit - RTAS_MAX_SIZE; fdt_addr = rtas_addr - FDT_MAX_SIZE; if (!spapr->cas_reboot) { spapr_ovec_cleanup(spapr->ov5_cas); spapr->ov5_cas = spapr_ovec_new(); ppc_set_compat(first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } VAR_0 = spapr_build_fdt(spapr, rtas_addr, spapr->rtas_size); spapr_load_rtas(spapr, VAR_0, rtas_addr); VAR_1 = fdt_pack(VAR_0); assert(VAR_1 == 0); if (fdt_totalsize(VAR_0) > FDT_MAX_SIZE) { error_report("FDT too big ! 0x%x bytes (max is 0x%x)", fdt_totalsize(VAR_0), FDT_MAX_SIZE); exit(1); } qemu_fdt_dumpdtb(VAR_0, fdt_totalsize(VAR_0)); cpu_physical_memory_write(fdt_addr, VAR_0, fdt_totalsize(VAR_0)); g_free(VAR_0); first_ppc_cpu->env.gpr[3] = fdt_addr; first_ppc_cpu->env.gpr[5] = 0; first_cpu->halted = 0; first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT; spapr->cas_reboot = false; }
[ "static void FUNC_0(void)\n{", "MachineState *machine = MACHINE(qdev_get_machine());", "sPAPRMachineState *spapr = SPAPR_MACHINE(machine);", "PowerPCCPU *first_ppc_cpu;", "uint32_t rtas_limit;", "hwaddr rtas_addr, fdt_addr;", "void *VAR_0;", "int VAR_1;", "foreach_dynamic_sysbus_device(find_unknown_sysbus_device, NULL);", "spapr_caps_reset(spapr);", "first_ppc_cpu = POWERPC_CPU(first_cpu);", "if (kvm_enabled() && kvmppc_has_cap_mmu_radix() &&\nppc_check_compat(first_ppc_cpu, CPU_POWERPC_LOGICAL_3_00, 0,\nspapr->max_compat_pvr)) {", "spapr->patb_entry = PATBE1_GR;", "} else {", "spapr_setup_hpt_and_vrma(spapr);", "}", "qemu_devices_reset();", "object_child_foreach_recursive(object_get_root(), spapr_reset_drcs, NULL);", "spapr_clear_pending_events(spapr);", "rtas_limit = MIN(spapr->rma_size, RTAS_MAX_ADDR);", "rtas_addr = rtas_limit - RTAS_MAX_SIZE;", "fdt_addr = rtas_addr - FDT_MAX_SIZE;", "if (!spapr->cas_reboot) {", "spapr_ovec_cleanup(spapr->ov5_cas);", "spapr->ov5_cas = spapr_ovec_new();", "ppc_set_compat(first_ppc_cpu, spapr->max_compat_pvr, &error_fatal);", "}", "VAR_0 = spapr_build_fdt(spapr, rtas_addr, spapr->rtas_size);", "spapr_load_rtas(spapr, VAR_0, rtas_addr);", "VAR_1 = fdt_pack(VAR_0);", "assert(VAR_1 == 0);", "if (fdt_totalsize(VAR_0) > FDT_MAX_SIZE) {", "error_report(\"FDT too big ! 0x%x bytes (max is 0x%x)\",\nfdt_totalsize(VAR_0), FDT_MAX_SIZE);", "exit(1);", "}", "qemu_fdt_dumpdtb(VAR_0, fdt_totalsize(VAR_0));", "cpu_physical_memory_write(fdt_addr, VAR_0, fdt_totalsize(VAR_0));", "g_free(VAR_0);", "first_ppc_cpu->env.gpr[3] = fdt_addr;", "first_ppc_cpu->env.gpr[5] = 0;", "first_cpu->halted = 0;", "first_ppc_cpu->env.nip = SPAPR_ENTRY_POINT;", "spapr->cas_reboot = false;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 33, 35, 37 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 69 ], [ 73 ], [ 87 ], [ 89 ], [ 91 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 113 ], [ 117 ], [ 121 ], [ 127 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 145 ], [ 147 ], [ 149 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ] ]
223
bool replay_next_event_is(int event) { bool res = false; /* nothing to skip - not all instructions used */ if (replay_state.instructions_count != 0) { assert(replay_data_kind == EVENT_INSTRUCTION); return event == EVENT_INSTRUCTION; } while (true) { if (event == replay_data_kind) { res = true; } switch (replay_data_kind) { case EVENT_SHUTDOWN: replay_finish_event(); qemu_system_shutdown_request(); break; default: /* clock, time_t, checkpoint and other events */ return res; } } return res; }
false
qemu
f186d64d8fda4bb22c15beb8e45b7814fbd8b51e
bool replay_next_event_is(int event) { bool res = false; if (replay_state.instructions_count != 0) { assert(replay_data_kind == EVENT_INSTRUCTION); return event == EVENT_INSTRUCTION; } while (true) { if (event == replay_data_kind) { res = true; } switch (replay_data_kind) { case EVENT_SHUTDOWN: replay_finish_event(); qemu_system_shutdown_request(); break; default: return res; } } return res; }
{ "code": [], "line_no": [] }
bool FUNC_0(int event) { bool res = false; if (replay_state.instructions_count != 0) { assert(replay_data_kind == EVENT_INSTRUCTION); return event == EVENT_INSTRUCTION; } while (true) { if (event == replay_data_kind) { res = true; } switch (replay_data_kind) { case EVENT_SHUTDOWN: replay_finish_event(); qemu_system_shutdown_request(); break; default: return res; } } return res; }
[ "bool FUNC_0(int event)\n{", "bool res = false;", "if (replay_state.instructions_count != 0) {", "assert(replay_data_kind == EVENT_INSTRUCTION);", "return event == EVENT_INSTRUCTION;", "}", "while (true) {", "if (event == replay_data_kind) {", "res = true;", "}", "switch (replay_data_kind) {", "case EVENT_SHUTDOWN:\nreplay_finish_event();", "qemu_system_shutdown_request();", "break;", "default:\nreturn res;", "}", "}", "return res;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
224
void kvm_init_irq_routing(KVMState *s) { int gsi_count, i; gsi_count = kvm_check_extension(s, KVM_CAP_IRQ_ROUTING); if (gsi_count > 0) { unsigned int gsi_bits, i; /* Round up so we can search ints using ffs */ gsi_bits = ALIGN(gsi_count, 32); s->used_gsi_bitmap = g_malloc0(gsi_bits / 8); s->gsi_count = gsi_count; /* Mark any over-allocated bits as already in use */ for (i = gsi_count; i < gsi_bits; i++) { set_gsi(s, i); } } s->irq_routes = g_malloc0(sizeof(*s->irq_routes)); s->nr_allocated_irq_routes = 0; if (!s->direct_msi) { for (i = 0; i < KVM_MSI_HASHTAB_SIZE; i++) { QTAILQ_INIT(&s->msi_hashtab[i]); } } kvm_arch_init_irq_routing(s); }
false
qemu
00008418aa22700f6c49e794e79f53aeb157d10f
void kvm_init_irq_routing(KVMState *s) { int gsi_count, i; gsi_count = kvm_check_extension(s, KVM_CAP_IRQ_ROUTING); if (gsi_count > 0) { unsigned int gsi_bits, i; gsi_bits = ALIGN(gsi_count, 32); s->used_gsi_bitmap = g_malloc0(gsi_bits / 8); s->gsi_count = gsi_count; for (i = gsi_count; i < gsi_bits; i++) { set_gsi(s, i); } } s->irq_routes = g_malloc0(sizeof(*s->irq_routes)); s->nr_allocated_irq_routes = 0; if (!s->direct_msi) { for (i = 0; i < KVM_MSI_HASHTAB_SIZE; i++) { QTAILQ_INIT(&s->msi_hashtab[i]); } } kvm_arch_init_irq_routing(s); }
{ "code": [], "line_no": [] }
void FUNC_0(KVMState *VAR_0) { int VAR_1, VAR_4; VAR_1 = kvm_check_extension(VAR_0, KVM_CAP_IRQ_ROUTING); if (VAR_1 > 0) { unsigned int VAR_3, VAR_4; VAR_3 = ALIGN(VAR_1, 32); VAR_0->used_gsi_bitmap = g_malloc0(VAR_3 / 8); VAR_0->VAR_1 = VAR_1; for (VAR_4 = VAR_1; VAR_4 < VAR_3; VAR_4++) { set_gsi(VAR_0, VAR_4); } } VAR_0->irq_routes = g_malloc0(sizeof(*VAR_0->irq_routes)); VAR_0->nr_allocated_irq_routes = 0; if (!VAR_0->direct_msi) { for (VAR_4 = 0; VAR_4 < KVM_MSI_HASHTAB_SIZE; VAR_4++) { QTAILQ_INIT(&VAR_0->msi_hashtab[VAR_4]); } } kvm_arch_init_irq_routing(VAR_0); }
[ "void FUNC_0(KVMState *VAR_0)\n{", "int VAR_1, VAR_4;", "VAR_1 = kvm_check_extension(VAR_0, KVM_CAP_IRQ_ROUTING);", "if (VAR_1 > 0) {", "unsigned int VAR_3, VAR_4;", "VAR_3 = ALIGN(VAR_1, 32);", "VAR_0->used_gsi_bitmap = g_malloc0(VAR_3 / 8);", "VAR_0->VAR_1 = VAR_1;", "for (VAR_4 = VAR_1; VAR_4 < VAR_3; VAR_4++) {", "set_gsi(VAR_0, VAR_4);", "}", "}", "VAR_0->irq_routes = g_malloc0(sizeof(*VAR_0->irq_routes));", "VAR_0->nr_allocated_irq_routes = 0;", "if (!VAR_0->direct_msi) {", "for (VAR_4 = 0; VAR_4 < KVM_MSI_HASHTAB_SIZE; VAR_4++) {", "QTAILQ_INIT(&VAR_0->msi_hashtab[VAR_4]);", "}", "}", "kvm_arch_init_irq_routing(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ] ]
225
static uint16_t *phys_page_find_alloc(target_phys_addr_t index, int alloc) { PhysPageEntry *lp, *p; int i, j; lp = &phys_map; /* Level 1..N. */ for (i = P_L2_LEVELS - 1; i >= 0; i--) { if (lp->u.node == NULL) { if (!alloc) { return NULL; } lp->u.node = p = g_malloc0(sizeof(PhysPageEntry) * L2_SIZE); if (i == 0) { for (j = 0; j < L2_SIZE; j++) { p[j].u.leaf = phys_section_unassigned; } } } lp = &lp->u.node[(index >> (i * L2_BITS)) & (L2_SIZE - 1)]; } return &lp->u.leaf; }
false
qemu
d6f2ea22a05b429ba83248b80a625b6fe1d927f3
static uint16_t *phys_page_find_alloc(target_phys_addr_t index, int alloc) { PhysPageEntry *lp, *p; int i, j; lp = &phys_map; for (i = P_L2_LEVELS - 1; i >= 0; i--) { if (lp->u.node == NULL) { if (!alloc) { return NULL; } lp->u.node = p = g_malloc0(sizeof(PhysPageEntry) * L2_SIZE); if (i == 0) { for (j = 0; j < L2_SIZE; j++) { p[j].u.leaf = phys_section_unassigned; } } } lp = &lp->u.node[(index >> (i * L2_BITS)) & (L2_SIZE - 1)]; } return &lp->u.leaf; }
{ "code": [], "line_no": [] }
static uint16_t *FUNC_0(target_phys_addr_t index, int alloc) { PhysPageEntry *lp, *p; int VAR_0, VAR_1; lp = &phys_map; for (VAR_0 = P_L2_LEVELS - 1; VAR_0 >= 0; VAR_0--) { if (lp->u.node == NULL) { if (!alloc) { return NULL; } lp->u.node = p = g_malloc0(sizeof(PhysPageEntry) * L2_SIZE); if (VAR_0 == 0) { for (VAR_1 = 0; VAR_1 < L2_SIZE; VAR_1++) { p[VAR_1].u.leaf = phys_section_unassigned; } } } lp = &lp->u.node[(index >> (VAR_0 * L2_BITS)) & (L2_SIZE - 1)]; } return &lp->u.leaf; }
[ "static uint16_t *FUNC_0(target_phys_addr_t index, int alloc)\n{", "PhysPageEntry *lp, *p;", "int VAR_0, VAR_1;", "lp = &phys_map;", "for (VAR_0 = P_L2_LEVELS - 1; VAR_0 >= 0; VAR_0--) {", "if (lp->u.node == NULL) {", "if (!alloc) {", "return NULL;", "}", "lp->u.node = p = g_malloc0(sizeof(PhysPageEntry) * L2_SIZE);", "if (VAR_0 == 0) {", "for (VAR_1 = 0; VAR_1 < L2_SIZE; VAR_1++) {", "p[VAR_1].u.leaf = phys_section_unassigned;", "}", "}", "}", "lp = &lp->u.node[(index >> (VAR_0 * L2_BITS)) & (L2_SIZE - 1)];", "}", "return &lp->u.leaf;", "}" ]
[ 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
226
void qemu_cpu_kick(void *_env) { CPUState *env = _env; qemu_cond_broadcast(env->halt_cond); if (!env->thread_kicked) { qemu_cpu_kick_thread(env); env->thread_kicked = true; } }
false
qemu
eae74cf906942999bf70e94f034f95c7f831ec63
void qemu_cpu_kick(void *_env) { CPUState *env = _env; qemu_cond_broadcast(env->halt_cond); if (!env->thread_kicked) { qemu_cpu_kick_thread(env); env->thread_kicked = true; } }
{ "code": [], "line_no": [] }
void FUNC_0(void *VAR_0) { CPUState *env = VAR_0; qemu_cond_broadcast(env->halt_cond); if (!env->thread_kicked) { qemu_cpu_kick_thread(env); env->thread_kicked = true; } }
[ "void FUNC_0(void *VAR_0)\n{", "CPUState *env = VAR_0;", "qemu_cond_broadcast(env->halt_cond);", "if (!env->thread_kicked) {", "qemu_cpu_kick_thread(env);", "env->thread_kicked = true;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
228
static int http_proxy_open(URLContext *h, const char *uri, int flags) { HTTPContext *s = h->priv_data; char hostname[1024], hoststr[1024]; char auth[1024], pathbuf[1024], *path; char lower_url[100]; int port, ret = 0, attempts = 0; HTTPAuthType cur_auth_type; char *authstr; int new_loc; h->is_streamed = 1; av_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port, pathbuf, sizeof(pathbuf), uri); ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL); path = pathbuf; if (*path == '/') path++; ff_url_join(lower_url, sizeof(lower_url), "tcp", NULL, hostname, port, NULL); redo: ret = ffurl_open(&s->hd, lower_url, AVIO_FLAG_READ_WRITE, &h->interrupt_callback, NULL); if (ret < 0) return ret; authstr = ff_http_auth_create_response(&s->proxy_auth_state, auth, path, "CONNECT"); snprintf(s->buffer, sizeof(s->buffer), "CONNECT %s HTTP/1.1\r\n" "Host: %s\r\n" "Connection: close\r\n" "%s%s" "\r\n", path, hoststr, authstr ? "Proxy-" : "", authstr ? authstr : ""); av_freep(&authstr); if ((ret = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0) goto fail; s->buf_ptr = s->buffer; s->buf_end = s->buffer; s->line_count = 0; s->filesize = -1; cur_auth_type = s->proxy_auth_state.auth_type; /* Note: This uses buffering, potentially reading more than the * HTTP header. If tunneling a protocol where the server starts * the conversation, we might buffer part of that here, too. * Reading that requires using the proper ffurl_read() function * on this URLContext, not using the fd directly (as the tls * protocol does). This shouldn't be an issue for tls though, * since the client starts the conversation there, so there * is no extra data that we might buffer up here. */ ret = http_read_header(h, &new_loc); if (ret < 0) goto fail; attempts++; if (s->http_code == 407 && (cur_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) && s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 2) { ffurl_closep(&s->hd); goto redo; } if (s->http_code < 400) return 0; ret = AVERROR(EIO); fail: http_proxy_close(h); return ret; }
false
FFmpeg
dd1e6b2a139a9eea61aefe24fc3295499e70d04b
static int http_proxy_open(URLContext *h, const char *uri, int flags) { HTTPContext *s = h->priv_data; char hostname[1024], hoststr[1024]; char auth[1024], pathbuf[1024], *path; char lower_url[100]; int port, ret = 0, attempts = 0; HTTPAuthType cur_auth_type; char *authstr; int new_loc; h->is_streamed = 1; av_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port, pathbuf, sizeof(pathbuf), uri); ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL); path = pathbuf; if (*path == '/') path++; ff_url_join(lower_url, sizeof(lower_url), "tcp", NULL, hostname, port, NULL); redo: ret = ffurl_open(&s->hd, lower_url, AVIO_FLAG_READ_WRITE, &h->interrupt_callback, NULL); if (ret < 0) return ret; authstr = ff_http_auth_create_response(&s->proxy_auth_state, auth, path, "CONNECT"); snprintf(s->buffer, sizeof(s->buffer), "CONNECT %s HTTP/1.1\r\n" "Host: %s\r\n" "Connection: close\r\n" "%s%s" "\r\n", path, hoststr, authstr ? "Proxy-" : "", authstr ? authstr : ""); av_freep(&authstr); if ((ret = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0) goto fail; s->buf_ptr = s->buffer; s->buf_end = s->buffer; s->line_count = 0; s->filesize = -1; cur_auth_type = s->proxy_auth_state.auth_type; ret = http_read_header(h, &new_loc); if (ret < 0) goto fail; attempts++; if (s->http_code == 407 && (cur_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) && s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 2) { ffurl_closep(&s->hd); goto redo; } if (s->http_code < 400) return 0; ret = AVERROR(EIO); fail: http_proxy_close(h); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2) { HTTPContext *s = VAR_0->priv_data; char VAR_3[1024], VAR_4[1024]; char VAR_5[1024], VAR_6[1024], *VAR_7; char VAR_8[100]; int VAR_9, VAR_10 = 0, VAR_11 = 0; HTTPAuthType cur_auth_type; char *VAR_12; int VAR_13; VAR_0->is_streamed = 1; av_url_split(NULL, 0, VAR_5, sizeof(VAR_5), VAR_3, sizeof(VAR_3), &VAR_9, VAR_6, sizeof(VAR_6), VAR_1); ff_url_join(VAR_4, sizeof(VAR_4), NULL, NULL, VAR_3, VAR_9, NULL); VAR_7 = VAR_6; if (*VAR_7 == '/') VAR_7++; ff_url_join(VAR_8, sizeof(VAR_8), "tcp", NULL, VAR_3, VAR_9, NULL); redo: VAR_10 = ffurl_open(&s->hd, VAR_8, AVIO_FLAG_READ_WRITE, &VAR_0->interrupt_callback, NULL); if (VAR_10 < 0) return VAR_10; VAR_12 = ff_http_auth_create_response(&s->proxy_auth_state, VAR_5, VAR_7, "CONNECT"); snprintf(s->buffer, sizeof(s->buffer), "CONNECT %s HTTP/1.1\r\n" "Host: %s\r\n" "Connection: close\r\n" "%s%s" "\r\n", VAR_7, VAR_4, VAR_12 ? "Proxy-" : "", VAR_12 ? VAR_12 : ""); av_freep(&VAR_12); if ((VAR_10 = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0) goto fail; s->buf_ptr = s->buffer; s->buf_end = s->buffer; s->line_count = 0; s->filesize = -1; cur_auth_type = s->proxy_auth_state.auth_type; VAR_10 = http_read_header(VAR_0, &VAR_13); if (VAR_10 < 0) goto fail; VAR_11++; if (s->http_code == 407 && (cur_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) && s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && VAR_11 < 2) { ffurl_closep(&s->hd); goto redo; } if (s->http_code < 400) return 0; VAR_10 = AVERROR(EIO); fail: http_proxy_close(VAR_0); return VAR_10; }
[ "static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2)\n{", "HTTPContext *s = VAR_0->priv_data;", "char VAR_3[1024], VAR_4[1024];", "char VAR_5[1024], VAR_6[1024], *VAR_7;", "char VAR_8[100];", "int VAR_9, VAR_10 = 0, VAR_11 = 0;", "HTTPAuthType cur_auth_type;", "char *VAR_12;", "int VAR_13;", "VAR_0->is_streamed = 1;", "av_url_split(NULL, 0, VAR_5, sizeof(VAR_5), VAR_3, sizeof(VAR_3), &VAR_9,\nVAR_6, sizeof(VAR_6), VAR_1);", "ff_url_join(VAR_4, sizeof(VAR_4), NULL, NULL, VAR_3, VAR_9, NULL);", "VAR_7 = VAR_6;", "if (*VAR_7 == '/')\nVAR_7++;", "ff_url_join(VAR_8, sizeof(VAR_8), \"tcp\", NULL, VAR_3, VAR_9,\nNULL);", "redo:\nVAR_10 = ffurl_open(&s->hd, VAR_8, AVIO_FLAG_READ_WRITE,\n&VAR_0->interrupt_callback, NULL);", "if (VAR_10 < 0)\nreturn VAR_10;", "VAR_12 = ff_http_auth_create_response(&s->proxy_auth_state, VAR_5,\nVAR_7, \"CONNECT\");", "snprintf(s->buffer, sizeof(s->buffer),\n\"CONNECT %s HTTP/1.1\\r\\n\"\n\"Host: %s\\r\\n\"\n\"Connection: close\\r\\n\"\n\"%s%s\"\n\"\\r\\n\",\nVAR_7,\nVAR_4,\nVAR_12 ? \"Proxy-\" : \"\", VAR_12 ? VAR_12 : \"\");", "av_freep(&VAR_12);", "if ((VAR_10 = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0)\ngoto fail;", "s->buf_ptr = s->buffer;", "s->buf_end = s->buffer;", "s->line_count = 0;", "s->filesize = -1;", "cur_auth_type = s->proxy_auth_state.auth_type;", "VAR_10 = http_read_header(VAR_0, &VAR_13);", "if (VAR_10 < 0)\ngoto fail;", "VAR_11++;", "if (s->http_code == 407 &&\n(cur_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) &&\ns->proxy_auth_state.auth_type != HTTP_AUTH_NONE && VAR_11 < 2) {", "ffurl_closep(&s->hd);", "goto redo;", "}", "if (s->http_code < 400)\nreturn 0;", "VAR_10 = AVERROR(EIO);", "fail:\nhttp_proxy_close(VAR_0);", "return VAR_10;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 41, 43 ], [ 45, 47, 49 ], [ 51, 53 ], [ 57, 59 ], [ 61, 63, 65, 67, 69, 71, 73, 75, 77 ], [ 79 ], [ 83, 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 119 ], [ 121, 123 ], [ 127 ], [ 129, 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143, 145 ], [ 147 ], [ 151, 153 ], [ 155 ], [ 157 ] ]
229
static int get_physical_address_data(CPUState *env, target_phys_addr_t *physical, int *prot, target_ulong address, int rw, int is_user) { target_ulong mask; unsigned int i; if ((env->lsu & DMMU_E) == 0) { /* DMMU disabled */ *physical = address; *prot = PAGE_READ | PAGE_WRITE; return 0; } for (i = 0; i < 64; i++) { switch ((env->dtlb_tte[i] >> 61) & 3) { default: case 0x0: // 8k mask = 0xffffffffffffe000ULL; break; case 0x1: // 64k mask = 0xffffffffffff0000ULL; break; case 0x2: // 512k mask = 0xfffffffffff80000ULL; break; case 0x3: // 4M mask = 0xffffffffffc00000ULL; break; } // ctx match, vaddr match, valid? if (env->dmmuregs[1] == (env->dtlb_tag[i] & 0x1fff) && (address & mask) == (env->dtlb_tag[i] & mask) && (env->dtlb_tte[i] & 0x8000000000000000ULL)) { // access ok? if (((env->dtlb_tte[i] & 0x4) && is_user) || (!(env->dtlb_tte[i] & 0x2) && (rw == 1))) { if (env->dmmuregs[3]) /* Fault status register */ env->dmmuregs[3] = 2; /* overflow (not read before another fault) */ env->dmmuregs[3] |= (is_user << 3) | ((rw == 1) << 2) | 1; env->dmmuregs[4] = address; /* Fault address register */ env->exception_index = TT_DFAULT; #ifdef DEBUG_MMU printf("DFAULT at 0x%" PRIx64 "\n", address); #endif return 1; } *physical = ((env->dtlb_tte[i] & mask) | (address & ~mask)) & 0x1ffffffe000ULL; *prot = PAGE_READ; if (env->dtlb_tte[i] & 0x2) *prot |= PAGE_WRITE; return 0; } } #ifdef DEBUG_MMU printf("DMISS at 0x%" PRIx64 "\n", address); #endif env->dmmuregs[6] = (address & ~0x1fffULL) | (env->dmmuregs[1] & 0x1fff); env->exception_index = TT_DMISS; return 1; }
false
qemu
e8807b14cc8c12c0e14c08fa396d9da043b48209
static int get_physical_address_data(CPUState *env, target_phys_addr_t *physical, int *prot, target_ulong address, int rw, int is_user) { target_ulong mask; unsigned int i; if ((env->lsu & DMMU_E) == 0) { *physical = address; *prot = PAGE_READ | PAGE_WRITE; return 0; } for (i = 0; i < 64; i++) { switch ((env->dtlb_tte[i] >> 61) & 3) { default: case 0x0: mask = 0xffffffffffffe000ULL; break; case 0x1: mask = 0xffffffffffff0000ULL; break; case 0x2: mask = 0xfffffffffff80000ULL; break; case 0x3: mask = 0xffffffffffc00000ULL; break; } if (env->dmmuregs[1] == (env->dtlb_tag[i] & 0x1fff) && (address & mask) == (env->dtlb_tag[i] & mask) && (env->dtlb_tte[i] & 0x8000000000000000ULL)) { if (((env->dtlb_tte[i] & 0x4) && is_user) || (!(env->dtlb_tte[i] & 0x2) && (rw == 1))) { if (env->dmmuregs[3]) env->dmmuregs[3] = 2; env->dmmuregs[3] |= (is_user << 3) | ((rw == 1) << 2) | 1; env->dmmuregs[4] = address; env->exception_index = TT_DFAULT; #ifdef DEBUG_MMU printf("DFAULT at 0x%" PRIx64 "\n", address); #endif return 1; } *physical = ((env->dtlb_tte[i] & mask) | (address & ~mask)) & 0x1ffffffe000ULL; *prot = PAGE_READ; if (env->dtlb_tte[i] & 0x2) *prot |= PAGE_WRITE; return 0; } } #ifdef DEBUG_MMU printf("DMISS at 0x%" PRIx64 "\n", address); #endif env->dmmuregs[6] = (address & ~0x1fffULL) | (env->dmmuregs[1] & 0x1fff); env->exception_index = TT_DMISS; return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUState *VAR_0, target_phys_addr_t *VAR_1, int *VAR_2, target_ulong VAR_3, int VAR_4, int VAR_5) { target_ulong mask; unsigned int VAR_6; if ((VAR_0->lsu & DMMU_E) == 0) { *VAR_1 = VAR_3; *VAR_2 = PAGE_READ | PAGE_WRITE; return 0; } for (VAR_6 = 0; VAR_6 < 64; VAR_6++) { switch ((VAR_0->dtlb_tte[VAR_6] >> 61) & 3) { default: case 0x0: mask = 0xffffffffffffe000ULL; break; case 0x1: mask = 0xffffffffffff0000ULL; break; case 0x2: mask = 0xfffffffffff80000ULL; break; case 0x3: mask = 0xffffffffffc00000ULL; break; } if (VAR_0->dmmuregs[1] == (VAR_0->dtlb_tag[VAR_6] & 0x1fff) && (VAR_3 & mask) == (VAR_0->dtlb_tag[VAR_6] & mask) && (VAR_0->dtlb_tte[VAR_6] & 0x8000000000000000ULL)) { if (((VAR_0->dtlb_tte[VAR_6] & 0x4) && VAR_5) || (!(VAR_0->dtlb_tte[VAR_6] & 0x2) && (VAR_4 == 1))) { if (VAR_0->dmmuregs[3]) VAR_0->dmmuregs[3] = 2; VAR_0->dmmuregs[3] |= (VAR_5 << 3) | ((VAR_4 == 1) << 2) | 1; VAR_0->dmmuregs[4] = VAR_3; VAR_0->exception_index = TT_DFAULT; #ifdef DEBUG_MMU printf("DFAULT at 0x%" PRIx64 "\n", VAR_3); #endif return 1; } *VAR_1 = ((VAR_0->dtlb_tte[VAR_6] & mask) | (VAR_3 & ~mask)) & 0x1ffffffe000ULL; *VAR_2 = PAGE_READ; if (VAR_0->dtlb_tte[VAR_6] & 0x2) *VAR_2 |= PAGE_WRITE; return 0; } } #ifdef DEBUG_MMU printf("DMISS at 0x%" PRIx64 "\n", VAR_3); #endif VAR_0->dmmuregs[6] = (VAR_3 & ~0x1fffULL) | (VAR_0->dmmuregs[1] & 0x1fff); VAR_0->exception_index = TT_DMISS; return 1; }
[ "static int FUNC_0(CPUState *VAR_0,\ntarget_phys_addr_t *VAR_1, int *VAR_2,\ntarget_ulong VAR_3, int VAR_4, int VAR_5)\n{", "target_ulong mask;", "unsigned int VAR_6;", "if ((VAR_0->lsu & DMMU_E) == 0) {", "*VAR_1 = VAR_3;", "*VAR_2 = PAGE_READ | PAGE_WRITE;", "return 0;", "}", "for (VAR_6 = 0; VAR_6 < 64; VAR_6++) {", "switch ((VAR_0->dtlb_tte[VAR_6] >> 61) & 3) {", "default:\ncase 0x0:\nmask = 0xffffffffffffe000ULL;", "break;", "case 0x1:\nmask = 0xffffffffffff0000ULL;", "break;", "case 0x2:\nmask = 0xfffffffffff80000ULL;", "break;", "case 0x3:\nmask = 0xffffffffffc00000ULL;", "break;", "}", "if (VAR_0->dmmuregs[1] == (VAR_0->dtlb_tag[VAR_6] & 0x1fff) &&\n(VAR_3 & mask) == (VAR_0->dtlb_tag[VAR_6] & mask) &&\n(VAR_0->dtlb_tte[VAR_6] & 0x8000000000000000ULL)) {", "if (((VAR_0->dtlb_tte[VAR_6] & 0x4) && VAR_5) ||\n(!(VAR_0->dtlb_tte[VAR_6] & 0x2) && (VAR_4 == 1))) {", "if (VAR_0->dmmuregs[3])\nVAR_0->dmmuregs[3] = 2;", "VAR_0->dmmuregs[3] |= (VAR_5 << 3) | ((VAR_4 == 1) << 2) | 1;", "VAR_0->dmmuregs[4] = VAR_3;", "VAR_0->exception_index = TT_DFAULT;", "#ifdef DEBUG_MMU\nprintf(\"DFAULT at 0x%\" PRIx64 \"\\n\", VAR_3);", "#endif\nreturn 1;", "}", "*VAR_1 = ((VAR_0->dtlb_tte[VAR_6] & mask) | (VAR_3 & ~mask)) &\n0x1ffffffe000ULL;", "*VAR_2 = PAGE_READ;", "if (VAR_0->dtlb_tte[VAR_6] & 0x2)\n*VAR_2 |= PAGE_WRITE;", "return 0;", "}", "}", "#ifdef DEBUG_MMU\nprintf(\"DMISS at 0x%\" PRIx64 \"\\n\", VAR_3);", "#endif\nVAR_0->dmmuregs[6] = (VAR_3 & ~0x1fffULL) | (VAR_0->dmmuregs[1] & 0x1fff);", "VAR_0->exception_index = TT_DMISS;", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 61, 63, 65 ], [ 69, 71 ], [ 73, 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ] ]
230
static int local_create_mapped_attr_dir(FsContext *ctx, const char *path) { int err; char attr_dir[PATH_MAX]; char *tmp_path = g_strdup(path); snprintf(attr_dir, PATH_MAX, "%s/%s/%s", ctx->fs_root, dirname(tmp_path), VIRTFS_META_DIR); err = mkdir(attr_dir, 0700); if (err < 0 && errno == EEXIST) { err = 0; } g_free(tmp_path); return err; }
false
qemu
4fa4ce7107c6ec432f185307158c5df91ce54308
static int local_create_mapped_attr_dir(FsContext *ctx, const char *path) { int err; char attr_dir[PATH_MAX]; char *tmp_path = g_strdup(path); snprintf(attr_dir, PATH_MAX, "%s/%s/%s", ctx->fs_root, dirname(tmp_path), VIRTFS_META_DIR); err = mkdir(attr_dir, 0700); if (err < 0 && errno == EEXIST) { err = 0; } g_free(tmp_path); return err; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, const char *VAR_1) { int VAR_2; char VAR_3[PATH_MAX]; char *VAR_4 = g_strdup(VAR_1); snprintf(VAR_3, PATH_MAX, "%s/%s/%s", VAR_0->fs_root, dirname(VAR_4), VIRTFS_META_DIR); VAR_2 = mkdir(VAR_3, 0700); if (VAR_2 < 0 && errno == EEXIST) { VAR_2 = 0; } g_free(VAR_4); return VAR_2; }
[ "static int FUNC_0(FsContext *VAR_0, const char *VAR_1)\n{", "int VAR_2;", "char VAR_3[PATH_MAX];", "char *VAR_4 = g_strdup(VAR_1);", "snprintf(VAR_3, PATH_MAX, \"%s/%s/%s\",\nVAR_0->fs_root, dirname(VAR_4), VIRTFS_META_DIR);", "VAR_2 = mkdir(VAR_3, 0700);", "if (VAR_2 < 0 && errno == EEXIST) {", "VAR_2 = 0;", "}", "g_free(VAR_4);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
231
static inline void sync_jmpstate(DisasContext *dc) { if (dc->jmp == JMP_DIRECT) { dc->jmp = JMP_INDIRECT; tcg_gen_movi_tl(env_btaken, 1); tcg_gen_movi_tl(env_btarget, dc->jmp_pc); } }
false
qemu
23979dc5411befabe9049e37075b2b6320debc4e
static inline void sync_jmpstate(DisasContext *dc) { if (dc->jmp == JMP_DIRECT) { dc->jmp = JMP_INDIRECT; tcg_gen_movi_tl(env_btaken, 1); tcg_gen_movi_tl(env_btarget, dc->jmp_pc); } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(DisasContext *VAR_0) { if (VAR_0->jmp == JMP_DIRECT) { VAR_0->jmp = JMP_INDIRECT; tcg_gen_movi_tl(env_btaken, 1); tcg_gen_movi_tl(env_btarget, VAR_0->jmp_pc); } }
[ "static inline void FUNC_0(DisasContext *VAR_0)\n{", "if (VAR_0->jmp == JMP_DIRECT) {", "VAR_0->jmp = JMP_INDIRECT;", "tcg_gen_movi_tl(env_btaken, 1);", "tcg_gen_movi_tl(env_btarget, VAR_0->jmp_pc);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
232
void register_device_unmigratable(DeviceState *dev, const char *idstr, void *opaque) { SaveStateEntry *se; char id[256] = ""; if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) { char *path = dev->parent_bus->info->get_dev_path(dev); if (path) { pstrcpy(id, sizeof(id), path); pstrcat(id, sizeof(id), "/"); g_free(path); } } pstrcat(id, sizeof(id), idstr); QTAILQ_FOREACH(se, &savevm_handlers, entry) { if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) { se->no_migrate = 1; } } }
false
qemu
38e0735eb76a1479917ef3501a208d4f70998494
void register_device_unmigratable(DeviceState *dev, const char *idstr, void *opaque) { SaveStateEntry *se; char id[256] = ""; if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) { char *path = dev->parent_bus->info->get_dev_path(dev); if (path) { pstrcpy(id, sizeof(id), path); pstrcat(id, sizeof(id), "/"); g_free(path); } } pstrcat(id, sizeof(id), idstr); QTAILQ_FOREACH(se, &savevm_handlers, entry) { if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) { se->no_migrate = 1; } } }
{ "code": [], "line_no": [] }
void FUNC_0(DeviceState *VAR_0, const char *VAR_1, void *VAR_2) { SaveStateEntry *se; char VAR_3[256] = ""; if (VAR_0 && VAR_0->parent_bus && VAR_0->parent_bus->info->get_dev_path) { char *VAR_4 = VAR_0->parent_bus->info->get_dev_path(VAR_0); if (VAR_4) { pstrcpy(VAR_3, sizeof(VAR_3), VAR_4); pstrcat(VAR_3, sizeof(VAR_3), "/"); g_free(VAR_4); } } pstrcat(VAR_3, sizeof(VAR_3), VAR_1); QTAILQ_FOREACH(se, &savevm_handlers, entry) { if (strcmp(se->VAR_1, VAR_3) == 0 && se->VAR_2 == VAR_2) { se->no_migrate = 1; } } }
[ "void FUNC_0(DeviceState *VAR_0, const char *VAR_1,\nvoid *VAR_2)\n{", "SaveStateEntry *se;", "char VAR_3[256] = \"\";", "if (VAR_0 && VAR_0->parent_bus && VAR_0->parent_bus->info->get_dev_path) {", "char *VAR_4 = VAR_0->parent_bus->info->get_dev_path(VAR_0);", "if (VAR_4) {", "pstrcpy(VAR_3, sizeof(VAR_3), VAR_4);", "pstrcat(VAR_3, sizeof(VAR_3), \"/\");", "g_free(VAR_4);", "}", "}", "pstrcat(VAR_3, sizeof(VAR_3), VAR_1);", "QTAILQ_FOREACH(se, &savevm_handlers, entry) {", "if (strcmp(se->VAR_1, VAR_3) == 0 && se->VAR_2 == VAR_2) {", "se->no_migrate = 1;", "}", "}", "}" ]
[ 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
233
int css_do_rsch(SubchDev *sch) { SCSW *s = &sch->curr_status.scsw; PMCW *p = &sch->curr_status.pmcw; int ret; if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) { ret = -ENODEV; goto out; } if (s->ctrl & SCSW_STCTL_STATUS_PEND) { ret = -EINPROGRESS; goto out; } if (((s->ctrl & SCSW_CTRL_MASK_FCTL) != SCSW_FCTL_START_FUNC) || (s->ctrl & SCSW_ACTL_RESUME_PEND) || (!(s->ctrl & SCSW_ACTL_SUSP))) { ret = -EINVAL; goto out; } /* If monitoring is active, update counter. */ if (channel_subsys.chnmon_active) { css_update_chnmon(sch); } s->ctrl |= SCSW_ACTL_RESUME_PEND; do_subchannel_work(sch, NULL); ret = 0; out: return ret; }
false
qemu
c679e74d2e29fa08ede9121d59aee4e9675611d7
int css_do_rsch(SubchDev *sch) { SCSW *s = &sch->curr_status.scsw; PMCW *p = &sch->curr_status.pmcw; int ret; if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) { ret = -ENODEV; goto out; } if (s->ctrl & SCSW_STCTL_STATUS_PEND) { ret = -EINPROGRESS; goto out; } if (((s->ctrl & SCSW_CTRL_MASK_FCTL) != SCSW_FCTL_START_FUNC) || (s->ctrl & SCSW_ACTL_RESUME_PEND) || (!(s->ctrl & SCSW_ACTL_SUSP))) { ret = -EINVAL; goto out; } if (channel_subsys.chnmon_active) { css_update_chnmon(sch); } s->ctrl |= SCSW_ACTL_RESUME_PEND; do_subchannel_work(sch, NULL); ret = 0; out: return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(SubchDev *VAR_0) { SCSW *s = &VAR_0->curr_status.scsw; PMCW *p = &VAR_0->curr_status.pmcw; int VAR_1; if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) { VAR_1 = -ENODEV; goto out; } if (s->ctrl & SCSW_STCTL_STATUS_PEND) { VAR_1 = -EINPROGRESS; goto out; } if (((s->ctrl & SCSW_CTRL_MASK_FCTL) != SCSW_FCTL_START_FUNC) || (s->ctrl & SCSW_ACTL_RESUME_PEND) || (!(s->ctrl & SCSW_ACTL_SUSP))) { VAR_1 = -EINVAL; goto out; } if (channel_subsys.chnmon_active) { css_update_chnmon(VAR_0); } s->ctrl |= SCSW_ACTL_RESUME_PEND; do_subchannel_work(VAR_0, NULL); VAR_1 = 0; out: return VAR_1; }
[ "int FUNC_0(SubchDev *VAR_0)\n{", "SCSW *s = &VAR_0->curr_status.scsw;", "PMCW *p = &VAR_0->curr_status.pmcw;", "int VAR_1;", "if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) {", "VAR_1 = -ENODEV;", "goto out;", "}", "if (s->ctrl & SCSW_STCTL_STATUS_PEND) {", "VAR_1 = -EINPROGRESS;", "goto out;", "}", "if (((s->ctrl & SCSW_CTRL_MASK_FCTL) != SCSW_FCTL_START_FUNC) ||\n(s->ctrl & SCSW_ACTL_RESUME_PEND) ||\n(!(s->ctrl & SCSW_ACTL_SUSP))) {", "VAR_1 = -EINVAL;", "goto out;", "}", "if (channel_subsys.chnmon_active) {", "css_update_chnmon(VAR_0);", "}", "s->ctrl |= SCSW_ACTL_RESUME_PEND;", "do_subchannel_work(VAR_0, NULL);", "VAR_1 = 0;", "out:\nreturn VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 69 ] ]
234
CPUState *cpu_copy(CPUState *env) { CPUState *new_env = cpu_init(env->cpu_model_str); CPUState *next_cpu = new_env->next_cpu; int cpu_index = new_env->cpu_index; #if defined(TARGET_HAS_ICE) CPUBreakpoint *bp; CPUWatchpoint *wp; #endif memcpy(new_env, env, sizeof(CPUState)); /* Preserve chaining and index. */ new_env->next_cpu = next_cpu; new_env->cpu_index = cpu_index; /* Clone all break/watchpoints. Note: Once we support ptrace with hw-debug register access, make sure BP_CPU break/watchpoints are handled correctly on clone. */ TAILQ_INIT(&env->breakpoints); TAILQ_INIT(&env->watchpoints); #if defined(TARGET_HAS_ICE) TAILQ_FOREACH(bp, &env->breakpoints, entry) { cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL); } TAILQ_FOREACH(wp, &env->watchpoints, entry) { cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1, wp->flags, NULL); } #endif return new_env; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
CPUState *cpu_copy(CPUState *env) { CPUState *new_env = cpu_init(env->cpu_model_str); CPUState *next_cpu = new_env->next_cpu; int cpu_index = new_env->cpu_index; #if defined(TARGET_HAS_ICE) CPUBreakpoint *bp; CPUWatchpoint *wp; #endif memcpy(new_env, env, sizeof(CPUState)); new_env->next_cpu = next_cpu; new_env->cpu_index = cpu_index; TAILQ_INIT(&env->breakpoints); TAILQ_INIT(&env->watchpoints); #if defined(TARGET_HAS_ICE) TAILQ_FOREACH(bp, &env->breakpoints, entry) { cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL); } TAILQ_FOREACH(wp, &env->watchpoints, entry) { cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1, wp->flags, NULL); } #endif return new_env; }
{ "code": [], "line_no": [] }
CPUState *FUNC_0(CPUState *env) { CPUState *new_env = cpu_init(env->cpu_model_str); CPUState *next_cpu = new_env->next_cpu; int VAR_0 = new_env->VAR_0; #if defined(TARGET_HAS_ICE) CPUBreakpoint *bp; CPUWatchpoint *wp; #endif memcpy(new_env, env, sizeof(CPUState)); new_env->next_cpu = next_cpu; new_env->VAR_0 = VAR_0; TAILQ_INIT(&env->breakpoints); TAILQ_INIT(&env->watchpoints); #if defined(TARGET_HAS_ICE) TAILQ_FOREACH(bp, &env->breakpoints, entry) { cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL); } TAILQ_FOREACH(wp, &env->watchpoints, entry) { cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1, wp->flags, NULL); } #endif return new_env; }
[ "CPUState *FUNC_0(CPUState *env)\n{", "CPUState *new_env = cpu_init(env->cpu_model_str);", "CPUState *next_cpu = new_env->next_cpu;", "int VAR_0 = new_env->VAR_0;", "#if defined(TARGET_HAS_ICE)\nCPUBreakpoint *bp;", "CPUWatchpoint *wp;", "#endif\nmemcpy(new_env, env, sizeof(CPUState));", "new_env->next_cpu = next_cpu;", "new_env->VAR_0 = VAR_0;", "TAILQ_INIT(&env->breakpoints);", "TAILQ_INIT(&env->watchpoints);", "#if defined(TARGET_HAS_ICE)\nTAILQ_FOREACH(bp, &env->breakpoints, entry) {", "cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL);", "}", "TAILQ_FOREACH(wp, &env->watchpoints, entry) {", "cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1,\nwp->flags, NULL);", "}", "#endif\nreturn new_env;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17, 21 ], [ 27 ], [ 29 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59, 63 ], [ 65 ] ]
236
xilinx_axidma_data_stream_push(StreamSlave *obj, unsigned char *buf, size_t len, uint32_t *app) { XilinxAXIDMAStreamSlave *ds = XILINX_AXI_DMA_DATA_STREAM(obj); struct Stream *s = &ds->dma->streams[1]; size_t ret; if (!app) { hw_error("No stream app data!\n"); } ret = stream_process_s2mem(s, buf, len, app); stream_update_irq(s); return ret; }
false
qemu
42bb9c9178ae7ac4c439172b1ae99cc29188a5c6
xilinx_axidma_data_stream_push(StreamSlave *obj, unsigned char *buf, size_t len, uint32_t *app) { XilinxAXIDMAStreamSlave *ds = XILINX_AXI_DMA_DATA_STREAM(obj); struct Stream *s = &ds->dma->streams[1]; size_t ret; if (!app) { hw_error("No stream app data!\n"); } ret = stream_process_s2mem(s, buf, len, app); stream_update_irq(s); return ret; }
{ "code": [], "line_no": [] }
FUNC_0(StreamSlave *VAR_0, unsigned char *VAR_1, size_t VAR_2, uint32_t *VAR_3) { XilinxAXIDMAStreamSlave *ds = XILINX_AXI_DMA_DATA_STREAM(VAR_0); struct Stream *VAR_4 = &ds->dma->streams[1]; size_t ret; if (!VAR_3) { hw_error("No stream VAR_3 data!\n"); } ret = stream_process_s2mem(VAR_4, VAR_1, VAR_2, VAR_3); stream_update_irq(VAR_4); return ret; }
[ "FUNC_0(StreamSlave *VAR_0, unsigned char *VAR_1, size_t VAR_2,\nuint32_t *VAR_3)\n{", "XilinxAXIDMAStreamSlave *ds = XILINX_AXI_DMA_DATA_STREAM(VAR_0);", "struct Stream *VAR_4 = &ds->dma->streams[1];", "size_t ret;", "if (!VAR_3) {", "hw_error(\"No stream VAR_3 data!\\n\");", "}", "ret = stream_process_s2mem(VAR_4, VAR_1, VAR_2, VAR_3);", "stream_update_irq(VAR_4);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
237
void *av_realloc(void *ptr, unsigned int size) { #ifdef MEMALIGN_HACK int diff; #endif /* let's disallow possible ambiguous cases */ if(size > INT_MAX) return NULL; #ifdef MEMALIGN_HACK //FIXME this isn't aligned correctly, though it probably isn't needed if(!ptr) return av_malloc(size); diff= ((char*)ptr)[-1]; return realloc(ptr - diff, size + diff) + diff; #else return realloc(ptr, size); #endif }
false
FFmpeg
a9493601638b048c44751956d2360f215918800c
void *av_realloc(void *ptr, unsigned int size) { #ifdef MEMALIGN_HACK int diff; #endif if(size > INT_MAX) return NULL; #ifdef MEMALIGN_HACK if(!ptr) return av_malloc(size); diff= ((char*)ptr)[-1]; return realloc(ptr - diff, size + diff) + diff; #else return realloc(ptr, size); #endif }
{ "code": [], "line_no": [] }
void *FUNC_0(void *VAR_0, unsigned int VAR_1) { #ifdef MEMALIGN_HACK int diff; #endif if(VAR_1 > INT_MAX) return NULL; #ifdef MEMALIGN_HACK if(!VAR_0) return av_malloc(VAR_1); diff= ((char*)VAR_0)[-1]; return realloc(VAR_0 - diff, VAR_1 + diff) + diff; #else return realloc(VAR_0, VAR_1); #endif }
[ "void *FUNC_0(void *VAR_0, unsigned int VAR_1)\n{", "#ifdef MEMALIGN_HACK\nint diff;", "#endif\nif(VAR_1 > INT_MAX)\nreturn NULL;", "#ifdef MEMALIGN_HACK\nif(!VAR_0) return av_malloc(VAR_1);", "diff= ((char*)VAR_0)[-1];", "return realloc(VAR_0 - diff, VAR_1 + diff) + diff;", "#else\nreturn realloc(VAR_0, VAR_1);", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 15, 17 ], [ 21, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35, 37 ] ]
238
static int mmf_probe(AVProbeData *p) { /* check file header */ if (p->buf_size <= 32) return 0; if (p->buf[0] == 'M' && p->buf[1] == 'M' && p->buf[2] == 'M' && p->buf[3] == 'D' && p->buf[8] == 'C' && p->buf[9] == 'N' && p->buf[10] == 'T' && p->buf[11] == 'I') return AVPROBE_SCORE_MAX; else return 0; }
false
FFmpeg
87e8788680e16c51f6048af26f3f7830c35207a5
static int mmf_probe(AVProbeData *p) { if (p->buf_size <= 32) return 0; if (p->buf[0] == 'M' && p->buf[1] == 'M' && p->buf[2] == 'M' && p->buf[3] == 'D' && p->buf[8] == 'C' && p->buf[9] == 'N' && p->buf[10] == 'T' && p->buf[11] == 'I') return AVPROBE_SCORE_MAX; else return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVProbeData *VAR_0) { if (VAR_0->buf_size <= 32) return 0; if (VAR_0->buf[0] == 'M' && VAR_0->buf[1] == 'M' && VAR_0->buf[2] == 'M' && VAR_0->buf[3] == 'D' && VAR_0->buf[8] == 'C' && VAR_0->buf[9] == 'N' && VAR_0->buf[10] == 'T' && VAR_0->buf[11] == 'I') return AVPROBE_SCORE_MAX; else return 0; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "if (VAR_0->buf_size <= 32)\nreturn 0;", "if (VAR_0->buf[0] == 'M' && VAR_0->buf[1] == 'M' &&\nVAR_0->buf[2] == 'M' && VAR_0->buf[3] == 'D' &&\nVAR_0->buf[8] == 'C' && VAR_0->buf[9] == 'N' &&\nVAR_0->buf[10] == 'T' && VAR_0->buf[11] == 'I')\nreturn AVPROBE_SCORE_MAX;", "else\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7, 9 ], [ 11, 13, 15, 17, 19 ], [ 21, 23 ], [ 25 ] ]
239
static XICSState *try_create_xics(const char *type, int nr_servers, int nr_irqs) { DeviceState *dev; dev = qdev_create(NULL, type); qdev_prop_set_uint32(dev, "nr_servers", nr_servers); qdev_prop_set_uint32(dev, "nr_irqs", nr_irqs); if (qdev_init(dev) < 0) { return NULL; } return XICS_COMMON(dev); }
true
qemu
34f2af3d3edf9d57c27811d3780cbc0ece319625
static XICSState *try_create_xics(const char *type, int nr_servers, int nr_irqs) { DeviceState *dev; dev = qdev_create(NULL, type); qdev_prop_set_uint32(dev, "nr_servers", nr_servers); qdev_prop_set_uint32(dev, "nr_irqs", nr_irqs); if (qdev_init(dev) < 0) { return NULL; } return XICS_COMMON(dev); }
{ "code": [ " int nr_irqs)", " if (qdev_init(dev) < 0) {" ], "line_no": [ 3, 17 ] }
static XICSState *FUNC_0(const char *type, int nr_servers, int nr_irqs) { DeviceState *dev; dev = qdev_create(NULL, type); qdev_prop_set_uint32(dev, "nr_servers", nr_servers); qdev_prop_set_uint32(dev, "nr_irqs", nr_irqs); if (qdev_init(dev) < 0) { return NULL; } return XICS_COMMON(dev); }
[ "static XICSState *FUNC_0(const char *type, int nr_servers,\nint nr_irqs)\n{", "DeviceState *dev;", "dev = qdev_create(NULL, type);", "qdev_prop_set_uint32(dev, \"nr_servers\", nr_servers);", "qdev_prop_set_uint32(dev, \"nr_irqs\", nr_irqs);", "if (qdev_init(dev) < 0) {", "return NULL;", "}", "return XICS_COMMON(dev);", "}" ]
[ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
240
static VncServerInfo *vnc_server_info_get(VncDisplay *vd) { VncServerInfo *info; Error *err = NULL; info = g_malloc(sizeof(*info)); vnc_init_basic_info_from_server_addr(vd->lsock, qapi_VncServerInfo_base(info), &err); info->has_auth = true; info->auth = g_strdup(vnc_auth_name(vd)); if (err) { qapi_free_VncServerInfo(info); info = NULL; error_free(err); } return info; }
true
qemu
3e7f136d8b4383d99f1b034a045b73f9b12a4eae
static VncServerInfo *vnc_server_info_get(VncDisplay *vd) { VncServerInfo *info; Error *err = NULL; info = g_malloc(sizeof(*info)); vnc_init_basic_info_from_server_addr(vd->lsock, qapi_VncServerInfo_base(info), &err); info->has_auth = true; info->auth = g_strdup(vnc_auth_name(vd)); if (err) { qapi_free_VncServerInfo(info); info = NULL; error_free(err); } return info; }
{ "code": [ " info = g_malloc(sizeof(*info));" ], "line_no": [ 11 ] }
static VncServerInfo *FUNC_0(VncDisplay *vd) { VncServerInfo *info; Error *err = NULL; info = g_malloc(sizeof(*info)); vnc_init_basic_info_from_server_addr(vd->lsock, qapi_VncServerInfo_base(info), &err); info->has_auth = true; info->auth = g_strdup(vnc_auth_name(vd)); if (err) { qapi_free_VncServerInfo(info); info = NULL; error_free(err); } return info; }
[ "static VncServerInfo *FUNC_0(VncDisplay *vd)\n{", "VncServerInfo *info;", "Error *err = NULL;", "info = g_malloc(sizeof(*info));", "vnc_init_basic_info_from_server_addr(vd->lsock,\nqapi_VncServerInfo_base(info), &err);", "info->has_auth = true;", "info->auth = g_strdup(vnc_auth_name(vd));", "if (err) {", "qapi_free_VncServerInfo(info);", "info = NULL;", "error_free(err);", "}", "return info;", "}" ]
[ 0, 0, 0, 1, 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 ] ]
241
static int vm_request_pending(void) { return powerdown_requested || reset_requested || shutdown_requested || debug_requested || vmstop_requested; }
true
qemu
12d4536f7d911b6d87a766ad7300482ea663cea2
static int vm_request_pending(void) { return powerdown_requested || reset_requested || shutdown_requested || debug_requested || vmstop_requested; }
{ "code": [ "static int vm_request_pending(void)", " return powerdown_requested ||", " reset_requested ||", " shutdown_requested ||", " debug_requested ||", " vmstop_requested;" ], "line_no": [ 1, 5, 7, 9, 11, 13 ] }
static int FUNC_0(void) { return powerdown_requested || reset_requested || shutdown_requested || debug_requested || vmstop_requested; }
[ "static int FUNC_0(void)\n{", "return powerdown_requested ||\nreset_requested ||\nshutdown_requested ||\ndebug_requested ||\nvmstop_requested;", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5, 7, 9, 11, 13 ], [ 15 ] ]