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
20,622
int avfilter_default_query_formats(AVFilterContext *ctx) { enum AVMediaType type = ctx->inputs [0] ? ctx->inputs [0]->type : ctx->outputs[0] ? ctx->outputs[0]->type : AVMEDIA_TYPE_VIDEO; avfilter_set_common_formats(ctx, avfilter_all_formats(type)); return 0; }
true
FFmpeg
120119225a5363f89822addb472085631d2157bc
int avfilter_default_query_formats(AVFilterContext *ctx) { enum AVMediaType type = ctx->inputs [0] ? ctx->inputs [0]->type : ctx->outputs[0] ? ctx->outputs[0]->type : AVMEDIA_TYPE_VIDEO; avfilter_set_common_formats(ctx, avfilter_all_formats(type)); return 0; }
{ "code": [ " enum AVMediaType type = ctx->inputs [0] ? ctx->inputs [0]->type :", " ctx->outputs[0] ? ctx->outputs[0]->type :" ], "line_no": [ 5, 7 ] }
int FUNC_0(AVFilterContext *VAR_0) { enum AVMediaType VAR_1 = VAR_0->inputs [0] ? VAR_0->inputs [0]->VAR_1 : VAR_0->outputs[0] ? VAR_0->outputs[0]->VAR_1 : AVMEDIA_TYPE_VIDEO; avfilter_set_common_formats(VAR_0, avfilter_all_formats(VAR_1)); return 0; }
[ "int FUNC_0(AVFilterContext *VAR_0)\n{", "enum AVMediaType VAR_1 = VAR_0->inputs [0] ? VAR_0->inputs [0]->VAR_1 :\nVAR_0->outputs[0] ? VAR_0->outputs[0]->VAR_1 :\nAVMEDIA_TYPE_VIDEO;", "avfilter_set_common_formats(VAR_0, avfilter_all_formats(VAR_1));", "return 0;", "}" ]
[ 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9 ], [ 13 ], [ 15 ], [ 17 ] ]
20,624
static void vhost_log_sync(MemoryListener *listener, MemoryRegionSection *section) { struct vhost_dev *dev = container_of(listener, struct vhost_dev, memory_listener); hwaddr start_addr = section->offset_within_address_space; hwaddr end_addr = start_addr + section->size; vhost_sync_dirty_bitmap(dev, section, start_addr, end_addr); }
true
qemu
6b37a23df98faa26391a93373930bfb15b943e00
static void vhost_log_sync(MemoryListener *listener, MemoryRegionSection *section) { struct vhost_dev *dev = container_of(listener, struct vhost_dev, memory_listener); hwaddr start_addr = section->offset_within_address_space; hwaddr end_addr = start_addr + section->size; vhost_sync_dirty_bitmap(dev, section, start_addr, end_addr); }
{ "code": [ " hwaddr start_addr = section->offset_within_address_space;", " hwaddr end_addr = start_addr + section->size;", " vhost_sync_dirty_bitmap(dev, section, start_addr, end_addr);" ], "line_no": [ 11, 13, 17 ] }
static void FUNC_0(MemoryListener *VAR_0, MemoryRegionSection *VAR_1) { struct vhost_dev *VAR_2 = container_of(VAR_0, struct vhost_dev, memory_listener); hwaddr start_addr = VAR_1->offset_within_address_space; hwaddr end_addr = start_addr + VAR_1->size; vhost_sync_dirty_bitmap(VAR_2, VAR_1, start_addr, end_addr); }
[ "static void FUNC_0(MemoryListener *VAR_0,\nMemoryRegionSection *VAR_1)\n{", "struct vhost_dev *VAR_2 = container_of(VAR_0, struct vhost_dev,\nmemory_listener);", "hwaddr start_addr = VAR_1->offset_within_address_space;", "hwaddr end_addr = start_addr + VAR_1->size;", "vhost_sync_dirty_bitmap(VAR_2, VAR_1, start_addr, end_addr);", "}" ]
[ 0, 0, 1, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ] ]
20,625
static void put_codebook_header(PutBitContext * pb, codebook_t * cb) { int i; int ordered = 0; put_bits(pb, 24, 0x564342); //magic put_bits(pb, 16, cb->ndimentions); put_bits(pb, 24, cb->nentries); for (i = 1; i < cb->nentries; i++) if (cb->entries[i].len < cb->entries[i-1].len) break; if (i == cb->nentries) ordered = 1; put_bits(pb, 1, ordered); if (ordered) { int len = cb->entries[0].len; put_bits(pb, 5, len); i = 0; while (i < cb->nentries) { int j; for (j = 0; j+i < cb->nentries; j++) if (cb->entries[j+i].len != len) break; put_bits(pb, ilog(cb->nentries - i), j); i += j; len++; } } else { int sparse = 0; for (i = 0; i < cb->nentries; i++) if (!cb->entries[i].len) break; if (i != cb->nentries) sparse = 1; put_bits(pb, 1, sparse); for (i = 0; i < cb->nentries; i++) { if (sparse) put_bits(pb, 1, !!cb->entries[i].len); if (cb->entries[i].len) put_bits(pb, 5, cb->entries[i].len - 1); } } put_bits(pb, 4, cb->lookup); if (cb->lookup) { int tmp = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries); int bits = ilog(cb->quantlist[0]); for (i = 1; i < tmp; i++) bits = FFMAX(bits, ilog(cb->quantlist[i])); put_float(pb, cb->min); put_float(pb, cb->delta); put_bits(pb, 4, bits - 1); put_bits(pb, 1, cb->seq_p); for (i = 0; i < tmp; i++) put_bits(pb, bits, cb->quantlist[i]); } }
true
FFmpeg
0e6fd0f12f90ba6a2edf79a398186293f2ab6334
static void put_codebook_header(PutBitContext * pb, codebook_t * cb) { int i; int ordered = 0; put_bits(pb, 24, 0x564342); put_bits(pb, 16, cb->ndimentions); put_bits(pb, 24, cb->nentries); for (i = 1; i < cb->nentries; i++) if (cb->entries[i].len < cb->entries[i-1].len) break; if (i == cb->nentries) ordered = 1; put_bits(pb, 1, ordered); if (ordered) { int len = cb->entries[0].len; put_bits(pb, 5, len); i = 0; while (i < cb->nentries) { int j; for (j = 0; j+i < cb->nentries; j++) if (cb->entries[j+i].len != len) break; put_bits(pb, ilog(cb->nentries - i), j); i += j; len++; } } else { int sparse = 0; for (i = 0; i < cb->nentries; i++) if (!cb->entries[i].len) break; if (i != cb->nentries) sparse = 1; put_bits(pb, 1, sparse); for (i = 0; i < cb->nentries; i++) { if (sparse) put_bits(pb, 1, !!cb->entries[i].len); if (cb->entries[i].len) put_bits(pb, 5, cb->entries[i].len - 1); } } put_bits(pb, 4, cb->lookup); if (cb->lookup) { int tmp = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries); int bits = ilog(cb->quantlist[0]); for (i = 1; i < tmp; i++) bits = FFMAX(bits, ilog(cb->quantlist[i])); put_float(pb, cb->min); put_float(pb, cb->delta); put_bits(pb, 4, bits - 1); put_bits(pb, 1, cb->seq_p); for (i = 0; i < tmp; i++) put_bits(pb, bits, cb->quantlist[i]); } }
{ "code": [ " put_bits(pb, 5, len);" ], "line_no": [ 29 ] }
static void FUNC_0(PutBitContext * VAR_0, codebook_t * VAR_1) { int VAR_2; int VAR_3 = 0; put_bits(VAR_0, 24, 0x564342); put_bits(VAR_0, 16, VAR_1->ndimentions); put_bits(VAR_0, 24, VAR_1->nentries); for (VAR_2 = 1; VAR_2 < VAR_1->nentries; VAR_2++) if (VAR_1->entries[VAR_2].VAR_4 < VAR_1->entries[VAR_2-1].VAR_4) break; if (VAR_2 == VAR_1->nentries) VAR_3 = 1; put_bits(VAR_0, 1, VAR_3); if (VAR_3) { int VAR_4 = VAR_1->entries[0].VAR_4; put_bits(VAR_0, 5, VAR_4); VAR_2 = 0; while (VAR_2 < VAR_1->nentries) { int VAR_5; for (VAR_5 = 0; VAR_5+VAR_2 < VAR_1->nentries; VAR_5++) if (VAR_1->entries[VAR_5+VAR_2].VAR_4 != VAR_4) break; put_bits(VAR_0, ilog(VAR_1->nentries - VAR_2), VAR_5); VAR_2 += VAR_5; VAR_4++; } } else { int VAR_6 = 0; for (VAR_2 = 0; VAR_2 < VAR_1->nentries; VAR_2++) if (!VAR_1->entries[VAR_2].VAR_4) break; if (VAR_2 != VAR_1->nentries) VAR_6 = 1; put_bits(VAR_0, 1, VAR_6); for (VAR_2 = 0; VAR_2 < VAR_1->nentries; VAR_2++) { if (VAR_6) put_bits(VAR_0, 1, !!VAR_1->entries[VAR_2].VAR_4); if (VAR_1->entries[VAR_2].VAR_4) put_bits(VAR_0, 5, VAR_1->entries[VAR_2].VAR_4 - 1); } } put_bits(VAR_0, 4, VAR_1->lookup); if (VAR_1->lookup) { int VAR_7 = cb_lookup_vals(VAR_1->lookup, VAR_1->ndimentions, VAR_1->nentries); int VAR_8 = ilog(VAR_1->quantlist[0]); for (VAR_2 = 1; VAR_2 < VAR_7; VAR_2++) VAR_8 = FFMAX(VAR_8, ilog(VAR_1->quantlist[VAR_2])); put_float(VAR_0, VAR_1->min); put_float(VAR_0, VAR_1->delta); put_bits(VAR_0, 4, VAR_8 - 1); put_bits(VAR_0, 1, VAR_1->seq_p); for (VAR_2 = 0; VAR_2 < VAR_7; VAR_2++) put_bits(VAR_0, VAR_8, VAR_1->quantlist[VAR_2]); } }
[ "static void FUNC_0(PutBitContext * VAR_0, codebook_t * VAR_1) {", "int VAR_2;", "int VAR_3 = 0;", "put_bits(VAR_0, 24, 0x564342);", "put_bits(VAR_0, 16, VAR_1->ndimentions);", "put_bits(VAR_0, 24, VAR_1->nentries);", "for (VAR_2 = 1; VAR_2 < VAR_1->nentries; VAR_2++) if (VAR_1->entries[VAR_2].VAR_4 < VAR_1->entries[VAR_2-1].VAR_4) break;", "if (VAR_2 == VAR_1->nentries) VAR_3 = 1;", "put_bits(VAR_0, 1, VAR_3);", "if (VAR_3) {", "int VAR_4 = VAR_1->entries[0].VAR_4;", "put_bits(VAR_0, 5, VAR_4);", "VAR_2 = 0;", "while (VAR_2 < VAR_1->nentries) {", "int VAR_5;", "for (VAR_5 = 0; VAR_5+VAR_2 < VAR_1->nentries; VAR_5++) if (VAR_1->entries[VAR_5+VAR_2].VAR_4 != VAR_4) break;", "put_bits(VAR_0, ilog(VAR_1->nentries - VAR_2), VAR_5);", "VAR_2 += VAR_5;", "VAR_4++;", "}", "} else {", "int VAR_6 = 0;", "for (VAR_2 = 0; VAR_2 < VAR_1->nentries; VAR_2++) if (!VAR_1->entries[VAR_2].VAR_4) break;", "if (VAR_2 != VAR_1->nentries) VAR_6 = 1;", "put_bits(VAR_0, 1, VAR_6);", "for (VAR_2 = 0; VAR_2 < VAR_1->nentries; VAR_2++) {", "if (VAR_6) put_bits(VAR_0, 1, !!VAR_1->entries[VAR_2].VAR_4);", "if (VAR_1->entries[VAR_2].VAR_4) put_bits(VAR_0, 5, VAR_1->entries[VAR_2].VAR_4 - 1);", "}", "}", "put_bits(VAR_0, 4, VAR_1->lookup);", "if (VAR_1->lookup) {", "int VAR_7 = cb_lookup_vals(VAR_1->lookup, VAR_1->ndimentions, VAR_1->nentries);", "int VAR_8 = ilog(VAR_1->quantlist[0]);", "for (VAR_2 = 1; VAR_2 < VAR_7; VAR_2++) VAR_8 = FFMAX(VAR_8, ilog(VAR_1->quantlist[VAR_2]));", "put_float(VAR_0, VAR_1->min);", "put_float(VAR_0, VAR_1->delta);", "put_bits(VAR_0, 4, VAR_8 - 1);", "put_bits(VAR_0, 1, VAR_1->seq_p);", "for (VAR_2 = 0; VAR_2 < VAR_7; VAR_2++) put_bits(VAR_0, VAR_8, VAR_1->quantlist[VAR_2]);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ] ]
20,626
static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds, int is_async) { BlkMigBlock *blk; int64_t total_sectors = bmds->total_sectors; int64_t sector; int nr_sectors; int ret = -EIO; for (sector = bmds->cur_dirty; sector < bmds->total_sectors;) { blk_mig_lock(); if (bmds_aio_inflight(bmds, sector)) { blk_mig_unlock(); bdrv_drain_all(); } else { blk_mig_unlock(); } if (bdrv_get_dirty(bmds->bs, bmds->dirty_bitmap, sector)) { if (total_sectors - sector < BDRV_SECTORS_PER_DIRTY_CHUNK) { nr_sectors = total_sectors - sector; } else { nr_sectors = BDRV_SECTORS_PER_DIRTY_CHUNK; } blk = g_new(BlkMigBlock, 1); blk->buf = g_malloc(BLOCK_SIZE); blk->bmds = bmds; blk->sector = sector; blk->nr_sectors = nr_sectors; if (is_async) { blk->iov.iov_base = blk->buf; blk->iov.iov_len = nr_sectors * BDRV_SECTOR_SIZE; qemu_iovec_init_external(&blk->qiov, &blk->iov, 1); blk->aiocb = bdrv_aio_readv(bmds->bs, sector, &blk->qiov, nr_sectors, blk_mig_read_cb, blk); blk_mig_lock(); block_mig_state.submitted++; bmds_set_aio_inflight(bmds, sector, nr_sectors, 1); blk_mig_unlock(); } else { ret = bdrv_read(bmds->bs, sector, blk->buf, nr_sectors); if (ret < 0) { goto error; } blk_send(f, blk); g_free(blk->buf); g_free(blk); } bdrv_reset_dirty(bmds->bs, sector, nr_sectors); break; } sector += BDRV_SECTORS_PER_DIRTY_CHUNK; bmds->cur_dirty = sector; } return (bmds->cur_dirty >= bmds->total_sectors); error: DPRINTF("Error reading sector %" PRId64 "\n", sector); g_free(blk->buf); g_free(blk); return ret; }
true
qemu
c4237dfa635900e4d1cdc6038d5efe3507f45f0c
static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds, int is_async) { BlkMigBlock *blk; int64_t total_sectors = bmds->total_sectors; int64_t sector; int nr_sectors; int ret = -EIO; for (sector = bmds->cur_dirty; sector < bmds->total_sectors;) { blk_mig_lock(); if (bmds_aio_inflight(bmds, sector)) { blk_mig_unlock(); bdrv_drain_all(); } else { blk_mig_unlock(); } if (bdrv_get_dirty(bmds->bs, bmds->dirty_bitmap, sector)) { if (total_sectors - sector < BDRV_SECTORS_PER_DIRTY_CHUNK) { nr_sectors = total_sectors - sector; } else { nr_sectors = BDRV_SECTORS_PER_DIRTY_CHUNK; } blk = g_new(BlkMigBlock, 1); blk->buf = g_malloc(BLOCK_SIZE); blk->bmds = bmds; blk->sector = sector; blk->nr_sectors = nr_sectors; if (is_async) { blk->iov.iov_base = blk->buf; blk->iov.iov_len = nr_sectors * BDRV_SECTOR_SIZE; qemu_iovec_init_external(&blk->qiov, &blk->iov, 1); blk->aiocb = bdrv_aio_readv(bmds->bs, sector, &blk->qiov, nr_sectors, blk_mig_read_cb, blk); blk_mig_lock(); block_mig_state.submitted++; bmds_set_aio_inflight(bmds, sector, nr_sectors, 1); blk_mig_unlock(); } else { ret = bdrv_read(bmds->bs, sector, blk->buf, nr_sectors); if (ret < 0) { goto error; } blk_send(f, blk); g_free(blk->buf); g_free(blk); } bdrv_reset_dirty(bmds->bs, sector, nr_sectors); break; } sector += BDRV_SECTORS_PER_DIRTY_CHUNK; bmds->cur_dirty = sector; } return (bmds->cur_dirty >= bmds->total_sectors); error: DPRINTF("Error reading sector %" PRId64 "\n", sector); g_free(blk->buf); g_free(blk); return ret; }
{ "code": [ " bdrv_reset_dirty(bmds->bs, sector, nr_sectors);" ], "line_no": [ 107 ] }
static int FUNC_0(QEMUFile *VAR_0, BlkMigDevState *VAR_1, int VAR_2) { BlkMigBlock *blk; int64_t total_sectors = VAR_1->total_sectors; int64_t sector; int VAR_3; int VAR_4 = -EIO; for (sector = VAR_1->cur_dirty; sector < VAR_1->total_sectors;) { blk_mig_lock(); if (bmds_aio_inflight(VAR_1, sector)) { blk_mig_unlock(); bdrv_drain_all(); } else { blk_mig_unlock(); } if (bdrv_get_dirty(VAR_1->bs, VAR_1->dirty_bitmap, sector)) { if (total_sectors - sector < BDRV_SECTORS_PER_DIRTY_CHUNK) { VAR_3 = total_sectors - sector; } else { VAR_3 = BDRV_SECTORS_PER_DIRTY_CHUNK; } blk = g_new(BlkMigBlock, 1); blk->buf = g_malloc(BLOCK_SIZE); blk->VAR_1 = VAR_1; blk->sector = sector; blk->VAR_3 = VAR_3; if (VAR_2) { blk->iov.iov_base = blk->buf; blk->iov.iov_len = VAR_3 * BDRV_SECTOR_SIZE; qemu_iovec_init_external(&blk->qiov, &blk->iov, 1); blk->aiocb = bdrv_aio_readv(VAR_1->bs, sector, &blk->qiov, VAR_3, blk_mig_read_cb, blk); blk_mig_lock(); block_mig_state.submitted++; bmds_set_aio_inflight(VAR_1, sector, VAR_3, 1); blk_mig_unlock(); } else { VAR_4 = bdrv_read(VAR_1->bs, sector, blk->buf, VAR_3); if (VAR_4 < 0) { goto error; } blk_send(VAR_0, blk); g_free(blk->buf); g_free(blk); } bdrv_reset_dirty(VAR_1->bs, sector, VAR_3); break; } sector += BDRV_SECTORS_PER_DIRTY_CHUNK; VAR_1->cur_dirty = sector; } return (VAR_1->cur_dirty >= VAR_1->total_sectors); error: DPRINTF("Error reading sector %" PRId64 "\n", sector); g_free(blk->buf); g_free(blk); return VAR_4; }
[ "static int FUNC_0(QEMUFile *VAR_0, BlkMigDevState *VAR_1,\nint VAR_2)\n{", "BlkMigBlock *blk;", "int64_t total_sectors = VAR_1->total_sectors;", "int64_t sector;", "int VAR_3;", "int VAR_4 = -EIO;", "for (sector = VAR_1->cur_dirty; sector < VAR_1->total_sectors;) {", "blk_mig_lock();", "if (bmds_aio_inflight(VAR_1, sector)) {", "blk_mig_unlock();", "bdrv_drain_all();", "} else {", "blk_mig_unlock();", "}", "if (bdrv_get_dirty(VAR_1->bs, VAR_1->dirty_bitmap, sector)) {", "if (total_sectors - sector < BDRV_SECTORS_PER_DIRTY_CHUNK) {", "VAR_3 = total_sectors - sector;", "} else {", "VAR_3 = BDRV_SECTORS_PER_DIRTY_CHUNK;", "}", "blk = g_new(BlkMigBlock, 1);", "blk->buf = g_malloc(BLOCK_SIZE);", "blk->VAR_1 = VAR_1;", "blk->sector = sector;", "blk->VAR_3 = VAR_3;", "if (VAR_2) {", "blk->iov.iov_base = blk->buf;", "blk->iov.iov_len = VAR_3 * BDRV_SECTOR_SIZE;", "qemu_iovec_init_external(&blk->qiov, &blk->iov, 1);", "blk->aiocb = bdrv_aio_readv(VAR_1->bs, sector, &blk->qiov,\nVAR_3, blk_mig_read_cb, blk);", "blk_mig_lock();", "block_mig_state.submitted++;", "bmds_set_aio_inflight(VAR_1, sector, VAR_3, 1);", "blk_mig_unlock();", "} else {", "VAR_4 = bdrv_read(VAR_1->bs, sector, blk->buf, VAR_3);", "if (VAR_4 < 0) {", "goto error;", "}", "blk_send(VAR_0, blk);", "g_free(blk->buf);", "g_free(blk);", "}", "bdrv_reset_dirty(VAR_1->bs, sector, VAR_3);", "break;", "}", "sector += BDRV_SECTORS_PER_DIRTY_CHUNK;", "VAR_1->cur_dirty = sector;", "}", "return (VAR_1->cur_dirty >= VAR_1->total_sectors);", "error:\nDPRINTF(\"Error reading sector %\" PRId64 \"\\n\", sector);", "g_free(blk->buf);", "g_free(blk);", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ] ]
20,627
void qbus_free(BusState *bus) { DeviceState *dev; while ((dev = QLIST_FIRST(&bus->children)) != NULL) { qdev_free(dev); } if (bus->parent) { QLIST_REMOVE(bus, sibling); bus->parent->num_child_bus--; } if (bus->qdev_allocated) { qemu_free(bus); } }
true
qemu
e163ae7b8f80dc4eb38445956929409601a8321c
void qbus_free(BusState *bus) { DeviceState *dev; while ((dev = QLIST_FIRST(&bus->children)) != NULL) { qdev_free(dev); } if (bus->parent) { QLIST_REMOVE(bus, sibling); bus->parent->num_child_bus--; } if (bus->qdev_allocated) { qemu_free(bus); } }
{ "code": [], "line_no": [] }
void FUNC_0(BusState *VAR_0) { DeviceState *dev; while ((dev = QLIST_FIRST(&VAR_0->children)) != NULL) { qdev_free(dev); } if (VAR_0->parent) { QLIST_REMOVE(VAR_0, sibling); VAR_0->parent->num_child_bus--; } if (VAR_0->qdev_allocated) { qemu_free(VAR_0); } }
[ "void FUNC_0(BusState *VAR_0)\n{", "DeviceState *dev;", "while ((dev = QLIST_FIRST(&VAR_0->children)) != NULL) {", "qdev_free(dev);", "}", "if (VAR_0->parent) {", "QLIST_REMOVE(VAR_0, sibling);", "VAR_0->parent->num_child_bus--;", "}", "if (VAR_0->qdev_allocated) {", "qemu_free(VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 24 ], [ 26 ], [ 28 ], [ 30 ] ]
20,628
static void decode_v4_vector(CinepakEncContext *s, AVPicture *sub_pict, int *v4_vector, strip_info *info) { int i, x, y, entry_size = s->pix_fmt == AV_PIX_FMT_YUV420P ? 6 : 4; for(i = y = 0; y < 4; y += 2) { for(x = 0; x < 4; x += 2, i++) { sub_pict->data[0][x + y*sub_pict->linesize[0]] = info->v4_codebook[v4_vector[i]*entry_size]; sub_pict->data[0][x+1 + y*sub_pict->linesize[0]] = info->v4_codebook[v4_vector[i]*entry_size+1]; sub_pict->data[0][x + (y+1)*sub_pict->linesize[0]] = info->v4_codebook[v4_vector[i]*entry_size+2]; sub_pict->data[0][x+1 + (y+1)*sub_pict->linesize[0]] = info->v4_codebook[v4_vector[i]*entry_size+3]; if(s->pix_fmt == AV_PIX_FMT_YUV420P) { sub_pict->data[1][(x>>1) + (y>>1)*sub_pict->linesize[1]] = info->v4_codebook[v4_vector[i]*entry_size+4]; sub_pict->data[2][(x>>1) + (y>>1)*sub_pict->linesize[2]] = info->v4_codebook[v4_vector[i]*entry_size+5]; } } } }
true
FFmpeg
7da9f4523159670d577a2808d4481e64008a8894
static void decode_v4_vector(CinepakEncContext *s, AVPicture *sub_pict, int *v4_vector, strip_info *info) { int i, x, y, entry_size = s->pix_fmt == AV_PIX_FMT_YUV420P ? 6 : 4; for(i = y = 0; y < 4; y += 2) { for(x = 0; x < 4; x += 2, i++) { sub_pict->data[0][x + y*sub_pict->linesize[0]] = info->v4_codebook[v4_vector[i]*entry_size]; sub_pict->data[0][x+1 + y*sub_pict->linesize[0]] = info->v4_codebook[v4_vector[i]*entry_size+1]; sub_pict->data[0][x + (y+1)*sub_pict->linesize[0]] = info->v4_codebook[v4_vector[i]*entry_size+2]; sub_pict->data[0][x+1 + (y+1)*sub_pict->linesize[0]] = info->v4_codebook[v4_vector[i]*entry_size+3]; if(s->pix_fmt == AV_PIX_FMT_YUV420P) { sub_pict->data[1][(x>>1) + (y>>1)*sub_pict->linesize[1]] = info->v4_codebook[v4_vector[i]*entry_size+4]; sub_pict->data[2][(x>>1) + (y>>1)*sub_pict->linesize[2]] = info->v4_codebook[v4_vector[i]*entry_size+5]; } } } }
{ "code": [ " int i, x, y, entry_size = s->pix_fmt == AV_PIX_FMT_YUV420P ? 6 : 4;", " if(s->pix_fmt == AV_PIX_FMT_YUV420P) {" ], "line_no": [ 5, 23 ] }
static void FUNC_0(CinepakEncContext *VAR_0, AVPicture *VAR_1, int *VAR_2, strip_info *VAR_3) { int VAR_4, VAR_5, VAR_6, VAR_7 = VAR_0->pix_fmt == AV_PIX_FMT_YUV420P ? 6 : 4; for(VAR_4 = VAR_6 = 0; VAR_6 < 4; VAR_6 += 2) { for(VAR_5 = 0; VAR_5 < 4; VAR_5 += 2, VAR_4++) { VAR_1->data[0][VAR_5 + VAR_6*VAR_1->linesize[0]] = VAR_3->v4_codebook[VAR_2[VAR_4]*VAR_7]; VAR_1->data[0][VAR_5+1 + VAR_6*VAR_1->linesize[0]] = VAR_3->v4_codebook[VAR_2[VAR_4]*VAR_7+1]; VAR_1->data[0][VAR_5 + (VAR_6+1)*VAR_1->linesize[0]] = VAR_3->v4_codebook[VAR_2[VAR_4]*VAR_7+2]; VAR_1->data[0][VAR_5+1 + (VAR_6+1)*VAR_1->linesize[0]] = VAR_3->v4_codebook[VAR_2[VAR_4]*VAR_7+3]; if(VAR_0->pix_fmt == AV_PIX_FMT_YUV420P) { VAR_1->data[1][(VAR_5>>1) + (VAR_6>>1)*VAR_1->linesize[1]] = VAR_3->v4_codebook[VAR_2[VAR_4]*VAR_7+4]; VAR_1->data[2][(VAR_5>>1) + (VAR_6>>1)*VAR_1->linesize[2]] = VAR_3->v4_codebook[VAR_2[VAR_4]*VAR_7+5]; } } } }
[ "static void FUNC_0(CinepakEncContext *VAR_0, AVPicture *VAR_1, int *VAR_2, strip_info *VAR_3)\n{", "int VAR_4, VAR_5, VAR_6, VAR_7 = VAR_0->pix_fmt == AV_PIX_FMT_YUV420P ? 6 : 4;", "for(VAR_4 = VAR_6 = 0; VAR_6 < 4; VAR_6 += 2) {", "for(VAR_5 = 0; VAR_5 < 4; VAR_5 += 2, VAR_4++) {", "VAR_1->data[0][VAR_5 + VAR_6*VAR_1->linesize[0]] = VAR_3->v4_codebook[VAR_2[VAR_4]*VAR_7];", "VAR_1->data[0][VAR_5+1 + VAR_6*VAR_1->linesize[0]] = VAR_3->v4_codebook[VAR_2[VAR_4]*VAR_7+1];", "VAR_1->data[0][VAR_5 + (VAR_6+1)*VAR_1->linesize[0]] = VAR_3->v4_codebook[VAR_2[VAR_4]*VAR_7+2];", "VAR_1->data[0][VAR_5+1 + (VAR_6+1)*VAR_1->linesize[0]] = VAR_3->v4_codebook[VAR_2[VAR_4]*VAR_7+3];", "if(VAR_0->pix_fmt == AV_PIX_FMT_YUV420P) {", "VAR_1->data[1][(VAR_5>>1) + (VAR_6>>1)*VAR_1->linesize[1]] = VAR_3->v4_codebook[VAR_2[VAR_4]*VAR_7+4];", "VAR_1->data[2][(VAR_5>>1) + (VAR_6>>1)*VAR_1->linesize[2]] = VAR_3->v4_codebook[VAR_2[VAR_4]*VAR_7+5];", "}", "}", "}", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
20,629
static const TPMDriverOps *tpm_driver_find_by_type(enum TpmType type) { int i; for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) { if (be_drivers[i]->type == type) { return be_drivers[i]; } } return NULL; }
true
qemu
a9a72aeefbd3ef8bcbbeeccaf174ee10db2978ac
static const TPMDriverOps *tpm_driver_find_by_type(enum TpmType type) { int i; for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) { if (be_drivers[i]->type == type) { return be_drivers[i]; } } return NULL; }
{ "code": [ " int i;", " for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) {", " return be_drivers[i];", " return NULL;", " int i;", " for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) {", " int i;", " for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) {", " if (be_drivers[i]->type == type) {", " return be_drivers[i];", " return NULL;" ], "line_no": [ 5, 9, 13, 19, 5, 9, 5, 9, 11, 13, 19 ] }
static const TPMDriverOps *FUNC_0(enum TpmType type) { int VAR_0; for (VAR_0 = 0; VAR_0 < TPM_MAX_DRIVERS && be_drivers[VAR_0] != NULL; VAR_0++) { if (be_drivers[VAR_0]->type == type) { return be_drivers[VAR_0]; } } return NULL; }
[ "static const TPMDriverOps *FUNC_0(enum TpmType type)\n{", "int VAR_0;", "for (VAR_0 = 0; VAR_0 < TPM_MAX_DRIVERS && be_drivers[VAR_0] != NULL; VAR_0++) {", "if (be_drivers[VAR_0]->type == type) {", "return be_drivers[VAR_0];", "}", "}", "return NULL;", "}" ]
[ 0, 1, 1, 1, 1, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
20,630
static int fic_decode_block(FICContext *ctx, GetBitContext *gb, uint8_t *dst, int stride, int16_t *block, int *is_p) { int i, num_coeff; /* Is it a skip block? */ if (get_bits1(gb)) { *is_p = 1; return 0; } memset(block, 0, sizeof(*block) * 64); num_coeff = get_bits(gb, 7); if (num_coeff > 64) return AVERROR_INVALIDDATA; for (i = 0; i < num_coeff; i++) block[ff_zigzag_direct[i]] = get_se_golomb(gb) * ctx->qmat[ff_zigzag_direct[i]]; fic_idct_put(dst, stride, block); return 0; }
true
FFmpeg
548459080b1bd698a2e475e5d177b6e7d2538537
static int fic_decode_block(FICContext *ctx, GetBitContext *gb, uint8_t *dst, int stride, int16_t *block, int *is_p) { int i, num_coeff; if (get_bits1(gb)) { *is_p = 1; return 0; } memset(block, 0, sizeof(*block) * 64); num_coeff = get_bits(gb, 7); if (num_coeff > 64) return AVERROR_INVALIDDATA; for (i = 0; i < num_coeff; i++) block[ff_zigzag_direct[i]] = get_se_golomb(gb) * ctx->qmat[ff_zigzag_direct[i]]; fic_idct_put(dst, stride, block); return 0; }
{ "code": [ " for (i = 0; i < num_coeff; i++)", " block[ff_zigzag_direct[i]] = get_se_golomb(gb) *" ], "line_no": [ 35, 37 ] }
static int FUNC_0(FICContext *VAR_0, GetBitContext *VAR_1, uint8_t *VAR_2, int VAR_3, int16_t *VAR_4, int *VAR_5) { int VAR_6, VAR_7; if (get_bits1(VAR_1)) { *VAR_5 = 1; return 0; } memset(VAR_4, 0, sizeof(*VAR_4) * 64); VAR_7 = get_bits(VAR_1, 7); if (VAR_7 > 64) return AVERROR_INVALIDDATA; for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++) VAR_4[ff_zigzag_direct[VAR_6]] = get_se_golomb(VAR_1) * VAR_0->qmat[ff_zigzag_direct[VAR_6]]; fic_idct_put(VAR_2, VAR_3, VAR_4); return 0; }
[ "static int FUNC_0(FICContext *VAR_0, GetBitContext *VAR_1,\nuint8_t *VAR_2, int VAR_3, int16_t *VAR_4, int *VAR_5)\n{", "int VAR_6, VAR_7;", "if (get_bits1(VAR_1)) {", "*VAR_5 = 1;", "return 0;", "}", "memset(VAR_4, 0, sizeof(*VAR_4) * 64);", "VAR_7 = get_bits(VAR_1, 7);", "if (VAR_7 > 64)\nreturn AVERROR_INVALIDDATA;", "for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++)", "VAR_4[ff_zigzag_direct[VAR_6]] = get_se_golomb(VAR_1) *\nVAR_0->qmat[ff_zigzag_direct[VAR_6]];", "fic_idct_put(VAR_2, VAR_3, VAR_4);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 35 ], [ 37, 39 ], [ 43 ], [ 47 ], [ 49 ] ]
20,632
static inline void RENAME(yuv2yuv1)(int16_t *lumSrc, int16_t *chrSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW) { #ifdef HAVE_MMX if(uDest != NULL) { asm volatile( YSCALEYUV2YV121 :: "r" (chrSrc + chrDstW), "r" (uDest + chrDstW), "g" (-chrDstW) : "%"REG_a ); asm volatile( YSCALEYUV2YV121 :: "r" (chrSrc + 2048 + chrDstW), "r" (vDest + chrDstW), "g" (-chrDstW) : "%"REG_a ); } asm volatile( YSCALEYUV2YV121 :: "r" (lumSrc + dstW), "r" (dest + dstW), "g" (-dstW) : "%"REG_a ); #else int i; for(i=0; i<dstW; i++) { int val= lumSrc[i]>>7; if(val&256){ if(val<0) val=0; else val=255; } dest[i]= val; } if(uDest != NULL) for(i=0; i<chrDstW; i++) { int u=chrSrc[i]>>7; int v=chrSrc[i + 2048]>>7; if((u|v)&256){ if(u<0) u=0; else if (u>255) u=255; if(v<0) v=0; else if (v>255) v=255; } uDest[i]= u; vDest[i]= v; } #endif }
true
FFmpeg
2da0d70d5eebe42f9fcd27ee554419ebe2a5da06
static inline void RENAME(yuv2yuv1)(int16_t *lumSrc, int16_t *chrSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW) { #ifdef HAVE_MMX if(uDest != NULL) { asm volatile( YSCALEYUV2YV121 :: "r" (chrSrc + chrDstW), "r" (uDest + chrDstW), "g" (-chrDstW) : "%"REG_a ); asm volatile( YSCALEYUV2YV121 :: "r" (chrSrc + 2048 + chrDstW), "r" (vDest + chrDstW), "g" (-chrDstW) : "%"REG_a ); } asm volatile( YSCALEYUV2YV121 :: "r" (lumSrc + dstW), "r" (dest + dstW), "g" (-dstW) : "%"REG_a ); #else int i; for(i=0; i<dstW; i++) { int val= lumSrc[i]>>7; if(val&256){ if(val<0) val=0; else val=255; } dest[i]= val; } if(uDest != NULL) for(i=0; i<chrDstW; i++) { int u=chrSrc[i]>>7; int v=chrSrc[i + 2048]>>7; if((u|v)&256){ if(u<0) u=0; else if (u>255) u=255; if(v<0) v=0; else if (v>255) v=255; } uDest[i]= u; vDest[i]= v; } #endif }
{ "code": [ "\t\t\t\t uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW)", "\t\t\t\t uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW)", "\tif(uDest != NULL)", "\t\tasm volatile(", "\t\t\t\tYSCALEYUV2YV121", "\t\t\t\t:: \"r\" (chrSrc + chrDstW), \"r\" (uDest + chrDstW),", "\t\t\t\t\"g\" (-chrDstW)", "\t\t\t\t: \"%\"REG_a", "\t\t\t);", "\t\tasm volatile(", "\t\t\t\tYSCALEYUV2YV121", "\t\t\t\t:: \"r\" (chrSrc + 2048 + chrDstW), \"r\" (vDest + chrDstW),", "\t\t\t\t\"g\" (-chrDstW)", "\t\t\t\t: \"%\"REG_a", "\t\t\t);", "\tasm volatile(", "\t\tYSCALEYUV2YV121", "\t\t:: \"r\" (lumSrc + dstW), \"r\" (dest + dstW),", "\t\t\"g\" (-dstW)", "\t\t: \"%\"REG_a", "\t);", "\tint i;", "\tfor(i=0; i<dstW; i++)", "\t\tint val= lumSrc[i]>>7;", "\t\tif(val&256){", "\t\t\tif(val<0) val=0;", "\t\t\telse val=255;", "\t\tdest[i]= val;", "\tif(uDest != NULL)", "\t\tfor(i=0; i<chrDstW; i++)", "\t\t\tint u=chrSrc[i]>>7;", "\t\t\tint v=chrSrc[i + 2048]>>7;", "\t\t\tif((u|v)&256){", "\t\t\t\tif(u<0) u=0;", "\t\t\t\telse if (u>255) u=255;", "\t\t\t\tif(v<0) v=0;", "\t\t\t\telse if (v>255) v=255;", "\t\t\tuDest[i]= u;", "\t\t\tvDest[i]= v;", "\t\t\t);", "#endif", "#endif", "\t\t\t);", "#endif", "#endif", "#endif", "\tint i;", "\t\t\t);", "#endif", "\t\t\t);", "\t\t\t);", "\t\t\t);", "#endif", "\t\t\t);", "\t\t\t);", "#endif", "\t\t\t);", "#endif", "\t\t\t);", "\t\t\t);", "\tint i;", "\t\t\t);", "\t\t\t);", "#endif", "\t\t\t);", "#endif", "\t\t\t);", "\t\t\t);", "\t\t\t);", "\t\t\t);", "#endif", "\t\t\t);", "#endif", "\t\t\t);", "\t\t\t);", "#endif", "\tasm volatile(", "\t\t: \"%\"REG_a", "\t);", "\tint i;", "\tasm volatile(", "\t\t: \"%\"REG_a", "\t);", "\tint i;", "#endif", "\tasm volatile(", "\t\t: \"%\"REG_a", "\t);", "\tint i;", "\tasm volatile(", "\t\t: \"%\"REG_a", "\t);", "\tint i;", "#endif", "\tint i;", "\tint i;", "\tasm volatile(", "#endif", "#endif", "\t);", "\tint i;", "\tasm volatile(", "#endif", "#endif", "#endif", "#endif", "\t);", "\tint i;", "#endif", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\t\tasm volatile(", "#endif", "#endif", "\t\tasm volatile(", "#endif", "#endif", "\t\tasm volatile(", "\tint i;", "\tfor(i=0; i<dstW; i++)", "\tint i;", "\t\tasm volatile(", "#endif", "#endif", "#endif", "\tasm volatile(", "\tint i;", "\tint i;", "\t\tasm volatile(", "#endif", "#endif", "#endif", "\tasm volatile(", "\tint i;", "#endif" ], "line_no": [ 3, 3, 9, 13, 15, 17, 19, 21, 23, 13, 15, 31, 19, 21, 23, 43, 45, 47, 49, 51, 53, 57, 59, 63, 67, 69, 71, 77, 9, 85, 89, 91, 95, 97, 99, 101, 103, 109, 111, 23, 115, 115, 23, 115, 115, 115, 57, 23, 115, 23, 23, 23, 115, 23, 23, 115, 23, 115, 23, 23, 57, 23, 23, 115, 23, 115, 23, 23, 23, 23, 115, 23, 115, 23, 23, 115, 43, 51, 53, 57, 43, 51, 53, 57, 115, 43, 51, 53, 57, 43, 51, 53, 57, 115, 57, 57, 43, 115, 115, 53, 57, 43, 115, 115, 115, 115, 53, 57, 115, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 13, 115, 115, 13, 115, 115, 13, 57, 59, 57, 13, 115, 115, 115, 43, 57, 57, 13, 115, 115, 115, 43, 57, 115 ] }
static inline void FUNC_0(yuv2yuv1)(int16_t *lumSrc, int16_t *chrSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW) { #ifdef HAVE_MMX if(uDest != NULL) { asm volatile( YSCALEYUV2YV121 :: "r" (chrSrc + chrDstW), "r" (uDest + chrDstW), "g" (-chrDstW) : "%"REG_a ); asm volatile( YSCALEYUV2YV121 :: "r" (chrSrc + 2048 + chrDstW), "r" (vDest + chrDstW), "g" (-chrDstW) : "%"REG_a ); } asm volatile( YSCALEYUV2YV121 :: "r" (lumSrc + dstW), "r" (dest + dstW), "g" (-dstW) : "%"REG_a ); #else int VAR_0; for(VAR_0=0; VAR_0<dstW; VAR_0++) { int val= lumSrc[VAR_0]>>7; if(val&256){ if(val<0) val=0; else val=255; } dest[VAR_0]= val; } if(uDest != NULL) for(VAR_0=0; VAR_0<chrDstW; VAR_0++) { int u=chrSrc[VAR_0]>>7; int v=chrSrc[VAR_0 + 2048]>>7; if((u|v)&256){ if(u<0) u=0; else if (u>255) u=255; if(v<0) v=0; else if (v>255) v=255; } uDest[VAR_0]= u; vDest[VAR_0]= v; } #endif }
[ "static inline void FUNC_0(yuv2yuv1)(int16_t *lumSrc, int16_t *chrSrc,\nuint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW)\n{", "#ifdef HAVE_MMX\nif(uDest != NULL)\n{", "asm volatile(\nYSCALEYUV2YV121\n:: \"r\" (chrSrc + chrDstW), \"r\" (uDest + chrDstW),\n\"g\" (-chrDstW)\n: \"%\"REG_a\n);", "asm volatile(\nYSCALEYUV2YV121\n:: \"r\" (chrSrc + 2048 + chrDstW), \"r\" (vDest + chrDstW),\n\"g\" (-chrDstW)\n: \"%\"REG_a\n);", "}", "asm volatile(\nYSCALEYUV2YV121\n:: \"r\" (lumSrc + dstW), \"r\" (dest + dstW),\n\"g\" (-dstW)\n: \"%\"REG_a\n);", "#else\nint VAR_0;", "for(VAR_0=0; VAR_0<dstW; VAR_0++)", "{", "int val= lumSrc[VAR_0]>>7;", "if(val&256){", "if(val<0) val=0;", "else val=255;", "}", "dest[VAR_0]= val;", "}", "if(uDest != NULL)\nfor(VAR_0=0; VAR_0<chrDstW; VAR_0++)", "{", "int u=chrSrc[VAR_0]>>7;", "int v=chrSrc[VAR_0 + 2048]>>7;", "if((u|v)&256){", "if(u<0) u=0;", "else if (u>255) u=255;", "if(v<0) v=0;", "else if (v>255) v=255;", "}", "uDest[VAR_0]= u;", "vDest[VAR_0]= v;", "}", "#endif\n}" ]
[ 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1 ]
[ [ 1, 3, 5 ], [ 7, 9, 11 ], [ 13, 15, 17, 19, 21, 23 ], [ 27, 29, 31, 33, 35, 37 ], [ 39 ], [ 43, 45, 47, 49, 51, 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ] ]
20,633
static int xan_decode_frame_type0(AVCodecContext *avctx) { XanContext *s = avctx->priv_data; uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer; unsigned chroma_off, corr_off; int cur, last; int i, j; int ret; chroma_off = bytestream2_get_le32(&s->gb); corr_off = bytestream2_get_le32(&s->gb); if ((ret = xan_decode_chroma(avctx, chroma_off)) != 0) return ret; if (corr_off >= (s->gb.buffer_end - s->gb.buffer_start)) { av_log(avctx, AV_LOG_WARNING, "Ignoring invalid correction block position\n"); corr_off = 0; } bytestream2_seek(&s->gb, 12, SEEK_SET); ret = xan_unpack_luma(s, src, s->buffer_size >> 1); if (ret) { av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n"); return ret; } ybuf = s->y_buffer; last = *src++; ybuf[0] = last << 1; for (j = 1; j < avctx->width - 1; j += 2) { cur = (last + *src++) & 0x1F; ybuf[j] = last + cur; ybuf[j+1] = cur << 1; last = cur; } ybuf[j] = last << 1; prev_buf = ybuf; ybuf += avctx->width; for (i = 1; i < avctx->height; i++) { last = ((prev_buf[0] >> 1) + *src++) & 0x1F; ybuf[0] = last << 1; for (j = 1; j < avctx->width - 1; j += 2) { cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F; ybuf[j] = last + cur; ybuf[j+1] = cur << 1; last = cur; } ybuf[j] = last << 1; prev_buf = ybuf; ybuf += avctx->width; } if (corr_off) { int dec_size; bytestream2_seek(&s->gb, 8 + corr_off, SEEK_SET); dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size); if (dec_size < 0) dec_size = 0; for (i = 0; i < dec_size; i++) s->y_buffer[i*2+1] = (s->y_buffer[i*2+1] + (s->scratch_buffer[i] << 1)) & 0x3F; } src = s->y_buffer; ybuf = s->pic.data[0]; for (j = 0; j < avctx->height; j++) { for (i = 0; i < avctx->width; i++) ybuf[i] = (src[i] << 2) | (src[i] >> 3); src += avctx->width; ybuf += s->pic.linesize[0]; } return 0; }
true
FFmpeg
8a49d2bcbe7573bb4b765728b2578fac0d19763f
static int xan_decode_frame_type0(AVCodecContext *avctx) { XanContext *s = avctx->priv_data; uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer; unsigned chroma_off, corr_off; int cur, last; int i, j; int ret; chroma_off = bytestream2_get_le32(&s->gb); corr_off = bytestream2_get_le32(&s->gb); if ((ret = xan_decode_chroma(avctx, chroma_off)) != 0) return ret; if (corr_off >= (s->gb.buffer_end - s->gb.buffer_start)) { av_log(avctx, AV_LOG_WARNING, "Ignoring invalid correction block position\n"); corr_off = 0; } bytestream2_seek(&s->gb, 12, SEEK_SET); ret = xan_unpack_luma(s, src, s->buffer_size >> 1); if (ret) { av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n"); return ret; } ybuf = s->y_buffer; last = *src++; ybuf[0] = last << 1; for (j = 1; j < avctx->width - 1; j += 2) { cur = (last + *src++) & 0x1F; ybuf[j] = last + cur; ybuf[j+1] = cur << 1; last = cur; } ybuf[j] = last << 1; prev_buf = ybuf; ybuf += avctx->width; for (i = 1; i < avctx->height; i++) { last = ((prev_buf[0] >> 1) + *src++) & 0x1F; ybuf[0] = last << 1; for (j = 1; j < avctx->width - 1; j += 2) { cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F; ybuf[j] = last + cur; ybuf[j+1] = cur << 1; last = cur; } ybuf[j] = last << 1; prev_buf = ybuf; ybuf += avctx->width; } if (corr_off) { int dec_size; bytestream2_seek(&s->gb, 8 + corr_off, SEEK_SET); dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size); if (dec_size < 0) dec_size = 0; for (i = 0; i < dec_size; i++) s->y_buffer[i*2+1] = (s->y_buffer[i*2+1] + (s->scratch_buffer[i] << 1)) & 0x3F; } src = s->y_buffer; ybuf = s->pic.data[0]; for (j = 0; j < avctx->height; j++) { for (i = 0; i < avctx->width; i++) ybuf[i] = (src[i] << 2) | (src[i] >> 3); src += avctx->width; ybuf += s->pic.linesize[0]; } return 0; }
{ "code": [ " dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size);" ], "line_no": [ 115 ] }
static int FUNC_0(AVCodecContext *VAR_0) { XanContext *s = VAR_0->priv_data; uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer; unsigned VAR_1, VAR_2; int VAR_3, VAR_4; int VAR_5, VAR_6; int VAR_7; VAR_1 = bytestream2_get_le32(&s->gb); VAR_2 = bytestream2_get_le32(&s->gb); if ((VAR_7 = xan_decode_chroma(VAR_0, VAR_1)) != 0) return VAR_7; if (VAR_2 >= (s->gb.buffer_end - s->gb.buffer_start)) { av_log(VAR_0, AV_LOG_WARNING, "Ignoring invalid correction block position\n"); VAR_2 = 0; } bytestream2_seek(&s->gb, 12, SEEK_SET); VAR_7 = xan_unpack_luma(s, src, s->buffer_size >> 1); if (VAR_7) { av_log(VAR_0, AV_LOG_ERROR, "Luma decoding failed\n"); return VAR_7; } ybuf = s->y_buffer; VAR_4 = *src++; ybuf[0] = VAR_4 << 1; for (VAR_6 = 1; VAR_6 < VAR_0->width - 1; VAR_6 += 2) { VAR_3 = (VAR_4 + *src++) & 0x1F; ybuf[VAR_6] = VAR_4 + VAR_3; ybuf[VAR_6+1] = VAR_3 << 1; VAR_4 = VAR_3; } ybuf[VAR_6] = VAR_4 << 1; prev_buf = ybuf; ybuf += VAR_0->width; for (VAR_5 = 1; VAR_5 < VAR_0->height; VAR_5++) { VAR_4 = ((prev_buf[0] >> 1) + *src++) & 0x1F; ybuf[0] = VAR_4 << 1; for (VAR_6 = 1; VAR_6 < VAR_0->width - 1; VAR_6 += 2) { VAR_3 = ((prev_buf[VAR_6 + 1] >> 1) + *src++) & 0x1F; ybuf[VAR_6] = VAR_4 + VAR_3; ybuf[VAR_6+1] = VAR_3 << 1; VAR_4 = VAR_3; } ybuf[VAR_6] = VAR_4 << 1; prev_buf = ybuf; ybuf += VAR_0->width; } if (VAR_2) { int VAR_8; bytestream2_seek(&s->gb, 8 + VAR_2, SEEK_SET); VAR_8 = xan_unpack(s, s->scratch_buffer, s->buffer_size); if (VAR_8 < 0) VAR_8 = 0; for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++) s->y_buffer[VAR_5*2+1] = (s->y_buffer[VAR_5*2+1] + (s->scratch_buffer[VAR_5] << 1)) & 0x3F; } src = s->y_buffer; ybuf = s->pic.data[0]; for (VAR_6 = 0; VAR_6 < VAR_0->height; VAR_6++) { for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5++) ybuf[VAR_5] = (src[VAR_5] << 2) | (src[VAR_5] >> 3); src += VAR_0->width; ybuf += s->pic.linesize[0]; } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "XanContext *s = VAR_0->priv_data;", "uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer;", "unsigned VAR_1, VAR_2;", "int VAR_3, VAR_4;", "int VAR_5, VAR_6;", "int VAR_7;", "VAR_1 = bytestream2_get_le32(&s->gb);", "VAR_2 = bytestream2_get_le32(&s->gb);", "if ((VAR_7 = xan_decode_chroma(VAR_0, VAR_1)) != 0)\nreturn VAR_7;", "if (VAR_2 >= (s->gb.buffer_end - s->gb.buffer_start)) {", "av_log(VAR_0, AV_LOG_WARNING, \"Ignoring invalid correction block position\\n\");", "VAR_2 = 0;", "}", "bytestream2_seek(&s->gb, 12, SEEK_SET);", "VAR_7 = xan_unpack_luma(s, src, s->buffer_size >> 1);", "if (VAR_7) {", "av_log(VAR_0, AV_LOG_ERROR, \"Luma decoding failed\\n\");", "return VAR_7;", "}", "ybuf = s->y_buffer;", "VAR_4 = *src++;", "ybuf[0] = VAR_4 << 1;", "for (VAR_6 = 1; VAR_6 < VAR_0->width - 1; VAR_6 += 2) {", "VAR_3 = (VAR_4 + *src++) & 0x1F;", "ybuf[VAR_6] = VAR_4 + VAR_3;", "ybuf[VAR_6+1] = VAR_3 << 1;", "VAR_4 = VAR_3;", "}", "ybuf[VAR_6] = VAR_4 << 1;", "prev_buf = ybuf;", "ybuf += VAR_0->width;", "for (VAR_5 = 1; VAR_5 < VAR_0->height; VAR_5++) {", "VAR_4 = ((prev_buf[0] >> 1) + *src++) & 0x1F;", "ybuf[0] = VAR_4 << 1;", "for (VAR_6 = 1; VAR_6 < VAR_0->width - 1; VAR_6 += 2) {", "VAR_3 = ((prev_buf[VAR_6 + 1] >> 1) + *src++) & 0x1F;", "ybuf[VAR_6] = VAR_4 + VAR_3;", "ybuf[VAR_6+1] = VAR_3 << 1;", "VAR_4 = VAR_3;", "}", "ybuf[VAR_6] = VAR_4 << 1;", "prev_buf = ybuf;", "ybuf += VAR_0->width;", "}", "if (VAR_2) {", "int VAR_8;", "bytestream2_seek(&s->gb, 8 + VAR_2, SEEK_SET);", "VAR_8 = xan_unpack(s, s->scratch_buffer, s->buffer_size);", "if (VAR_8 < 0)\nVAR_8 = 0;", "for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++)", "s->y_buffer[VAR_5*2+1] = (s->y_buffer[VAR_5*2+1] + (s->scratch_buffer[VAR_5] << 1)) & 0x3F;", "}", "src = s->y_buffer;", "ybuf = s->pic.data[0];", "for (VAR_6 = 0; VAR_6 < VAR_0->height; VAR_6++) {", "for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5++)", "ybuf[VAR_5] = (src[VAR_5] << 2) | (src[VAR_5] >> 3);", "src += VAR_0->width;", "ybuf += s->pic.linesize[0];", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 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 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ] ]
20,634
static int raw_pread(BlockDriverState *bs, int64_t offset, uint8_t *buf, int count) { BDRVRawState *s = bs->opaque; int size, ret, shift, sum; sum = 0; if (s->aligned_buf != NULL) { if (offset & 0x1ff) { /* align offset on a 512 bytes boundary */ shift = offset & 0x1ff; size = (shift + count + 0x1ff) & ~0x1ff; if (size > ALIGNED_BUFFER_SIZE) size = ALIGNED_BUFFER_SIZE; ret = raw_pread_aligned(bs, offset - shift, s->aligned_buf, size); if (ret < 0) return ret; size = 512 - shift; if (size > count) size = count; memcpy(buf, s->aligned_buf + shift, size); buf += size; offset += size; count -= size; sum += size; if (count == 0) return sum; } if (count & 0x1ff || (uintptr_t) buf & 0x1ff) { /* read on aligned buffer */ while (count) { size = (count + 0x1ff) & ~0x1ff; if (size > ALIGNED_BUFFER_SIZE) size = ALIGNED_BUFFER_SIZE; ret = raw_pread_aligned(bs, offset, s->aligned_buf, size); if (ret < 0) return ret; size = ret; if (size > count) size = count; memcpy(buf, s->aligned_buf, size); buf += size; offset += size; count -= size; sum += size; } return sum; } } return raw_pread_aligned(bs, offset, buf, count) + sum; }
true
qemu
053965c7ff5b260672719884e644ce4117d01995
static int raw_pread(BlockDriverState *bs, int64_t offset, uint8_t *buf, int count) { BDRVRawState *s = bs->opaque; int size, ret, shift, sum; sum = 0; if (s->aligned_buf != NULL) { if (offset & 0x1ff) { shift = offset & 0x1ff; size = (shift + count + 0x1ff) & ~0x1ff; if (size > ALIGNED_BUFFER_SIZE) size = ALIGNED_BUFFER_SIZE; ret = raw_pread_aligned(bs, offset - shift, s->aligned_buf, size); if (ret < 0) return ret; size = 512 - shift; if (size > count) size = count; memcpy(buf, s->aligned_buf + shift, size); buf += size; offset += size; count -= size; sum += size; if (count == 0) return sum; } if (count & 0x1ff || (uintptr_t) buf & 0x1ff) { while (count) { size = (count + 0x1ff) & ~0x1ff; if (size > ALIGNED_BUFFER_SIZE) size = ALIGNED_BUFFER_SIZE; ret = raw_pread_aligned(bs, offset, s->aligned_buf, size); if (ret < 0) return ret; size = ret; if (size > count) size = count; memcpy(buf, s->aligned_buf, size); buf += size; offset += size; count -= size; sum += size; } return sum; } } return raw_pread_aligned(bs, offset, buf, count) + sum; }
{ "code": [ " if (ret < 0)" ], "line_no": [ 91 ] }
static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, uint8_t *VAR_2, int VAR_3) { BDRVRawState *s = VAR_0->opaque; int VAR_4, VAR_5, VAR_6, VAR_7; VAR_7 = 0; if (s->aligned_buf != NULL) { if (VAR_1 & 0x1ff) { VAR_6 = VAR_1 & 0x1ff; VAR_4 = (VAR_6 + VAR_3 + 0x1ff) & ~0x1ff; if (VAR_4 > ALIGNED_BUFFER_SIZE) VAR_4 = ALIGNED_BUFFER_SIZE; VAR_5 = raw_pread_aligned(VAR_0, VAR_1 - VAR_6, s->aligned_buf, VAR_4); if (VAR_5 < 0) return VAR_5; VAR_4 = 512 - VAR_6; if (VAR_4 > VAR_3) VAR_4 = VAR_3; memcpy(VAR_2, s->aligned_buf + VAR_6, VAR_4); VAR_2 += VAR_4; VAR_1 += VAR_4; VAR_3 -= VAR_4; VAR_7 += VAR_4; if (VAR_3 == 0) return VAR_7; } if (VAR_3 & 0x1ff || (uintptr_t) VAR_2 & 0x1ff) { while (VAR_3) { VAR_4 = (VAR_3 + 0x1ff) & ~0x1ff; if (VAR_4 > ALIGNED_BUFFER_SIZE) VAR_4 = ALIGNED_BUFFER_SIZE; VAR_5 = raw_pread_aligned(VAR_0, VAR_1, s->aligned_buf, VAR_4); if (VAR_5 < 0) return VAR_5; VAR_4 = VAR_5; if (VAR_4 > VAR_3) VAR_4 = VAR_3; memcpy(VAR_2, s->aligned_buf, VAR_4); VAR_2 += VAR_4; VAR_1 += VAR_4; VAR_3 -= VAR_4; VAR_7 += VAR_4; } return VAR_7; } } return raw_pread_aligned(VAR_0, VAR_1, VAR_2, VAR_3) + VAR_7; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nuint8_t *VAR_2, int VAR_3)\n{", "BDRVRawState *s = VAR_0->opaque;", "int VAR_4, VAR_5, VAR_6, VAR_7;", "VAR_7 = 0;", "if (s->aligned_buf != NULL) {", "if (VAR_1 & 0x1ff) {", "VAR_6 = VAR_1 & 0x1ff;", "VAR_4 = (VAR_6 + VAR_3 + 0x1ff) & ~0x1ff;", "if (VAR_4 > ALIGNED_BUFFER_SIZE)\nVAR_4 = ALIGNED_BUFFER_SIZE;", "VAR_5 = raw_pread_aligned(VAR_0, VAR_1 - VAR_6, s->aligned_buf, VAR_4);", "if (VAR_5 < 0)\nreturn VAR_5;", "VAR_4 = 512 - VAR_6;", "if (VAR_4 > VAR_3)\nVAR_4 = VAR_3;", "memcpy(VAR_2, s->aligned_buf + VAR_6, VAR_4);", "VAR_2 += VAR_4;", "VAR_1 += VAR_4;", "VAR_3 -= VAR_4;", "VAR_7 += VAR_4;", "if (VAR_3 == 0)\nreturn VAR_7;", "}", "if (VAR_3 & 0x1ff || (uintptr_t) VAR_2 & 0x1ff) {", "while (VAR_3) {", "VAR_4 = (VAR_3 + 0x1ff) & ~0x1ff;", "if (VAR_4 > ALIGNED_BUFFER_SIZE)\nVAR_4 = ALIGNED_BUFFER_SIZE;", "VAR_5 = raw_pread_aligned(VAR_0, VAR_1, s->aligned_buf, VAR_4);", "if (VAR_5 < 0)\nreturn VAR_5;", "VAR_4 = VAR_5;", "if (VAR_4 > VAR_3)\nVAR_4 = VAR_3;", "memcpy(VAR_2, s->aligned_buf, VAR_4);", "VAR_2 += VAR_4;", "VAR_1 += VAR_4;", "VAR_3 -= VAR_4;", "VAR_7 += VAR_4;", "}", "return VAR_7;", "}", "}", "return raw_pread_aligned(VAR_0, VAR_1, VAR_2, VAR_3) + 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 21 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 77 ], [ 81 ], [ 83, 85 ], [ 89 ], [ 91, 93 ], [ 97 ], [ 99, 101 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ] ]
20,635
static av_always_inline int normal_limit(uint8_t *p, ptrdiff_t stride, int E, int I) { LOAD_PIXELS return simple_limit(p, stride, E) && FFABS(p3 - p2) <= I && FFABS(p2 - p1) <= I && FFABS(p1 - p0) <= I && FFABS(q3 - q2) <= I && FFABS(q2 - q1) <= I && FFABS(q1 - q0) <= I; }
true
FFmpeg
ac4b32df71bd932838043a4838b86d11e169707f
static av_always_inline int normal_limit(uint8_t *p, ptrdiff_t stride, int E, int I) { LOAD_PIXELS return simple_limit(p, stride, E) && FFABS(p3 - p2) <= I && FFABS(p2 - p1) <= I && FFABS(p1 - p0) <= I && FFABS(q3 - q2) <= I && FFABS(q2 - q1) <= I && FFABS(q1 - q0) <= I; }
{ "code": [ "static av_always_inline int normal_limit(uint8_t *p, ptrdiff_t stride,", " int E, int I)", " LOAD_PIXELS", " return simple_limit(p, stride, E) &&", " FFABS(p3 - p2) <= I &&", " FFABS(p2 - p1) <= I &&", " FFABS(p1 - p0) <= I &&", " FFABS(q3 - q2) <= I &&", " FFABS(q2 - q1) <= I &&", " FFABS(q1 - q0) <= I;" ], "line_no": [ 1, 3, 7, 9, 11, 13, 15, 17, 19, 21 ] }
static av_always_inline int FUNC_0(uint8_t *p, ptrdiff_t stride, int E, int I) { LOAD_PIXELS return simple_limit(p, stride, E) && FFABS(p3 - p2) <= I && FFABS(p2 - p1) <= I && FFABS(p1 - p0) <= I && FFABS(q3 - q2) <= I && FFABS(q2 - q1) <= I && FFABS(q1 - q0) <= I; }
[ "static av_always_inline int FUNC_0(uint8_t *p, ptrdiff_t stride,\nint E, int I)\n{", "LOAD_PIXELS\nreturn simple_limit(p, stride, E) &&\nFFABS(p3 - p2) <= I &&\nFFABS(p2 - p1) <= I &&\nFFABS(p1 - p0) <= I &&\nFFABS(q3 - q2) <= I &&\nFFABS(q2 - q1) <= I &&\nFFABS(q1 - q0) <= I;", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7, 9, 11, 13, 15, 17, 19, 21 ], [ 23 ] ]
20,636
static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end) { int pal_start, pal_count, i, ret; if(buf_end - buf < 16) { av_log(s->avctx, AV_LOG_WARNING, "truncated header\n"); return AVERROR_INVALIDDATA; } s->width = AV_RL16(&buf[4]); s->height = AV_RL16(&buf[6]); ret = ff_set_dimensions(s->avctx, s->width, s->height); if (ret < 0) return ret; s->avctx->time_base.num = 1; s->avctx->time_base.den = AV_RL16(&buf[10]); pal_start = AV_RL16(&buf[12]); pal_count = AV_RL16(&buf[14]); buf += 16; for (i=pal_start; i<pal_start+pal_count && i<AVPALETTE_COUNT && buf_end - buf >= 3; i++) { s->palette[i] = AV_RB24(buf); buf += 3; } return 0; }
false
FFmpeg
24057c83207d6ea8bfd824155ac37be8a33dfd0c
static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end) { int pal_start, pal_count, i, ret; if(buf_end - buf < 16) { av_log(s->avctx, AV_LOG_WARNING, "truncated header\n"); return AVERROR_INVALIDDATA; } s->width = AV_RL16(&buf[4]); s->height = AV_RL16(&buf[6]); ret = ff_set_dimensions(s->avctx, s->width, s->height); if (ret < 0) return ret; s->avctx->time_base.num = 1; s->avctx->time_base.den = AV_RL16(&buf[10]); pal_start = AV_RL16(&buf[12]); pal_count = AV_RL16(&buf[14]); buf += 16; for (i=pal_start; i<pal_start+pal_count && i<AVPALETTE_COUNT && buf_end - buf >= 3; i++) { s->palette[i] = AV_RB24(buf); buf += 3; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(CmvContext *VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6; if(VAR_2 - VAR_1 < 16) { av_log(VAR_0->avctx, AV_LOG_WARNING, "truncated header\n"); return AVERROR_INVALIDDATA; } VAR_0->width = AV_RL16(&VAR_1[4]); VAR_0->height = AV_RL16(&VAR_1[6]); VAR_6 = ff_set_dimensions(VAR_0->avctx, VAR_0->width, VAR_0->height); if (VAR_6 < 0) return VAR_6; VAR_0->avctx->time_base.num = 1; VAR_0->avctx->time_base.den = AV_RL16(&VAR_1[10]); VAR_3 = AV_RL16(&VAR_1[12]); VAR_4 = AV_RL16(&VAR_1[14]); VAR_1 += 16; for (VAR_5=VAR_3; VAR_5<VAR_3+VAR_4 && VAR_5<AVPALETTE_COUNT && VAR_2 - VAR_1 >= 3; VAR_5++) { VAR_0->palette[VAR_5] = AV_RB24(VAR_1); VAR_1 += 3; } return 0; }
[ "static int FUNC_0(CmvContext *VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6;", "if(VAR_2 - VAR_1 < 16) {", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"truncated header\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_0->width = AV_RL16(&VAR_1[4]);", "VAR_0->height = AV_RL16(&VAR_1[6]);", "VAR_6 = ff_set_dimensions(VAR_0->avctx, VAR_0->width, VAR_0->height);", "if (VAR_6 < 0)\nreturn VAR_6;", "VAR_0->avctx->time_base.num = 1;", "VAR_0->avctx->time_base.den = AV_RL16(&VAR_1[10]);", "VAR_3 = AV_RL16(&VAR_1[12]);", "VAR_4 = AV_RL16(&VAR_1[14]);", "VAR_1 += 16;", "for (VAR_5=VAR_3; VAR_5<VAR_3+VAR_4 && VAR_5<AVPALETTE_COUNT && VAR_2 - VAR_1 >= 3; VAR_5++) {", "VAR_0->palette[VAR_5] = AV_RB24(VAR_1);", "VAR_1 += 3;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ] ]
20,637
void avformat_free_context(AVFormatContext *s) { int i; if (!s) return; av_opt_free(s); if (s->iformat && s->iformat->priv_class && s->priv_data) av_opt_free(s->priv_data); if (s->oformat && s->oformat->priv_class && s->priv_data) av_opt_free(s->priv_data); for (i = s->nb_streams - 1; i >= 0; i--) { ff_free_stream(s, s->streams[i]); } for (i = s->nb_programs - 1; i >= 0; i--) { av_dict_free(&s->programs[i]->metadata); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } av_freep(&s->programs); av_freep(&s->priv_data); while (s->nb_chapters--) { av_dict_free(&s->chapters[s->nb_chapters]->metadata); av_freep(&s->chapters[s->nb_chapters]); } av_freep(&s->chapters); av_dict_free(&s->metadata); av_freep(&s->streams); av_freep(&s->internal); av_free(s); }
true
FFmpeg
609d5db8035c868be034892a33762779a40ab8b9
void avformat_free_context(AVFormatContext *s) { int i; if (!s) return; av_opt_free(s); if (s->iformat && s->iformat->priv_class && s->priv_data) av_opt_free(s->priv_data); if (s->oformat && s->oformat->priv_class && s->priv_data) av_opt_free(s->priv_data); for (i = s->nb_streams - 1; i >= 0; i--) { ff_free_stream(s, s->streams[i]); } for (i = s->nb_programs - 1; i >= 0; i--) { av_dict_free(&s->programs[i]->metadata); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } av_freep(&s->programs); av_freep(&s->priv_data); while (s->nb_chapters--) { av_dict_free(&s->chapters[s->nb_chapters]->metadata); av_freep(&s->chapters[s->nb_chapters]); } av_freep(&s->chapters); av_dict_free(&s->metadata); av_freep(&s->streams); av_freep(&s->internal); av_free(s); }
{ "code": [], "line_no": [] }
void FUNC_0(AVFormatContext *VAR_0) { int VAR_1; if (!VAR_0) return; av_opt_free(VAR_0); if (VAR_0->iformat && VAR_0->iformat->priv_class && VAR_0->priv_data) av_opt_free(VAR_0->priv_data); if (VAR_0->oformat && VAR_0->oformat->priv_class && VAR_0->priv_data) av_opt_free(VAR_0->priv_data); for (VAR_1 = VAR_0->nb_streams - 1; VAR_1 >= 0; VAR_1--) { ff_free_stream(VAR_0, VAR_0->streams[VAR_1]); } for (VAR_1 = VAR_0->nb_programs - 1; VAR_1 >= 0; VAR_1--) { av_dict_free(&VAR_0->programs[VAR_1]->metadata); av_freep(&VAR_0->programs[VAR_1]->stream_index); av_freep(&VAR_0->programs[VAR_1]); } av_freep(&VAR_0->programs); av_freep(&VAR_0->priv_data); while (VAR_0->nb_chapters--) { av_dict_free(&VAR_0->chapters[VAR_0->nb_chapters]->metadata); av_freep(&VAR_0->chapters[VAR_0->nb_chapters]); } av_freep(&VAR_0->chapters); av_dict_free(&VAR_0->metadata); av_freep(&VAR_0->streams); av_freep(&VAR_0->internal); av_free(VAR_0); }
[ "void FUNC_0(AVFormatContext *VAR_0)\n{", "int VAR_1;", "if (!VAR_0)\nreturn;", "av_opt_free(VAR_0);", "if (VAR_0->iformat && VAR_0->iformat->priv_class && VAR_0->priv_data)\nav_opt_free(VAR_0->priv_data);", "if (VAR_0->oformat && VAR_0->oformat->priv_class && VAR_0->priv_data)\nav_opt_free(VAR_0->priv_data);", "for (VAR_1 = VAR_0->nb_streams - 1; VAR_1 >= 0; VAR_1--) {", "ff_free_stream(VAR_0, VAR_0->streams[VAR_1]);", "}", "for (VAR_1 = VAR_0->nb_programs - 1; VAR_1 >= 0; VAR_1--) {", "av_dict_free(&VAR_0->programs[VAR_1]->metadata);", "av_freep(&VAR_0->programs[VAR_1]->stream_index);", "av_freep(&VAR_0->programs[VAR_1]);", "}", "av_freep(&VAR_0->programs);", "av_freep(&VAR_0->priv_data);", "while (VAR_0->nb_chapters--) {", "av_dict_free(&VAR_0->chapters[VAR_0->nb_chapters]->metadata);", "av_freep(&VAR_0->chapters[VAR_0->nb_chapters]);", "}", "av_freep(&VAR_0->chapters);", "av_dict_free(&VAR_0->metadata);", "av_freep(&VAR_0->streams);", "av_freep(&VAR_0->internal);", "av_free(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15 ], [ 17, 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 64 ], [ 66 ] ]
20,639
static void get_sdr(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, uint8_t *rsp, unsigned int *rsp_len, unsigned int max_rsp_len) { unsigned int pos; uint16_t nextrec; struct ipmi_sdr_header *sdrh; IPMI_CHECK_CMD_LEN(8); if (cmd[6]) { IPMI_CHECK_RESERVATION(2, ibs->sdr.reservation); } pos = 0; if (sdr_find_entry(&ibs->sdr, cmd[4] | (cmd[5] << 8), &pos, &nextrec)) { rsp[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT; return; } sdrh = (struct ipmi_sdr_header *) &ibs->sdr.sdr[pos]; if (cmd[6] > ipmi_sdr_length(sdrh)) { rsp[2] = IPMI_CC_PARM_OUT_OF_RANGE; return; } IPMI_ADD_RSP_DATA(nextrec & 0xff); IPMI_ADD_RSP_DATA((nextrec >> 8) & 0xff); if (cmd[7] == 0xff) { cmd[7] = ipmi_sdr_length(sdrh) - cmd[6]; } if ((cmd[7] + *rsp_len) > max_rsp_len) { rsp[2] = IPMI_CC_CANNOT_RETURN_REQ_NUM_BYTES; return; } memcpy(rsp + *rsp_len, ibs->sdr.sdr + pos + cmd[6], cmd[7]); *rsp_len += cmd[7]; }
true
qemu
4f298a4b2957b7833bc607c951ca27c458d98d88
static void get_sdr(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, uint8_t *rsp, unsigned int *rsp_len, unsigned int max_rsp_len) { unsigned int pos; uint16_t nextrec; struct ipmi_sdr_header *sdrh; IPMI_CHECK_CMD_LEN(8); if (cmd[6]) { IPMI_CHECK_RESERVATION(2, ibs->sdr.reservation); } pos = 0; if (sdr_find_entry(&ibs->sdr, cmd[4] | (cmd[5] << 8), &pos, &nextrec)) { rsp[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT; return; } sdrh = (struct ipmi_sdr_header *) &ibs->sdr.sdr[pos]; if (cmd[6] > ipmi_sdr_length(sdrh)) { rsp[2] = IPMI_CC_PARM_OUT_OF_RANGE; return; } IPMI_ADD_RSP_DATA(nextrec & 0xff); IPMI_ADD_RSP_DATA((nextrec >> 8) & 0xff); if (cmd[7] == 0xff) { cmd[7] = ipmi_sdr_length(sdrh) - cmd[6]; } if ((cmd[7] + *rsp_len) > max_rsp_len) { rsp[2] = IPMI_CC_CANNOT_RETURN_REQ_NUM_BYTES; return; } memcpy(rsp + *rsp_len, ibs->sdr.sdr + pos + cmd[6], cmd[7]); *rsp_len += cmd[7]; }
{ "code": [ " IPMI_CHECK_CMD_LEN(8);", " IPMI_CHECK_CMD_LEN(8);", " IPMI_CHECK_CMD_LEN(8);", " IPMI_CHECK_CMD_LEN(8);", " IPMI_CHECK_CMD_LEN(8);" ], "line_no": [ 19, 19, 19, 19, 19 ] }
static void FUNC_0(IPMIBmcSim *VAR_0, uint8_t *VAR_1, unsigned int VAR_2, uint8_t *VAR_3, unsigned int *VAR_4, unsigned int VAR_5) { unsigned int VAR_6; uint16_t nextrec; struct ipmi_sdr_header *VAR_7; IPMI_CHECK_CMD_LEN(8); if (VAR_1[6]) { IPMI_CHECK_RESERVATION(2, VAR_0->sdr.reservation); } VAR_6 = 0; if (sdr_find_entry(&VAR_0->sdr, VAR_1[4] | (VAR_1[5] << 8), &VAR_6, &nextrec)) { VAR_3[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT; return; } VAR_7 = (struct ipmi_sdr_header *) &VAR_0->sdr.sdr[VAR_6]; if (VAR_1[6] > ipmi_sdr_length(VAR_7)) { VAR_3[2] = IPMI_CC_PARM_OUT_OF_RANGE; return; } IPMI_ADD_RSP_DATA(nextrec & 0xff); IPMI_ADD_RSP_DATA((nextrec >> 8) & 0xff); if (VAR_1[7] == 0xff) { VAR_1[7] = ipmi_sdr_length(VAR_7) - VAR_1[6]; } if ((VAR_1[7] + *VAR_4) > VAR_5) { VAR_3[2] = IPMI_CC_CANNOT_RETURN_REQ_NUM_BYTES; return; } memcpy(VAR_3 + *VAR_4, VAR_0->sdr.sdr + VAR_6 + VAR_1[6], VAR_1[7]); *VAR_4 += VAR_1[7]; }
[ "static void FUNC_0(IPMIBmcSim *VAR_0,\nuint8_t *VAR_1, unsigned int VAR_2,\nuint8_t *VAR_3, unsigned int *VAR_4,\nunsigned int VAR_5)\n{", "unsigned int VAR_6;", "uint16_t nextrec;", "struct ipmi_sdr_header *VAR_7;", "IPMI_CHECK_CMD_LEN(8);", "if (VAR_1[6]) {", "IPMI_CHECK_RESERVATION(2, VAR_0->sdr.reservation);", "}", "VAR_6 = 0;", "if (sdr_find_entry(&VAR_0->sdr, VAR_1[4] | (VAR_1[5] << 8),\n&VAR_6, &nextrec)) {", "VAR_3[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT;", "return;", "}", "VAR_7 = (struct ipmi_sdr_header *) &VAR_0->sdr.sdr[VAR_6];", "if (VAR_1[6] > ipmi_sdr_length(VAR_7)) {", "VAR_3[2] = IPMI_CC_PARM_OUT_OF_RANGE;", "return;", "}", "IPMI_ADD_RSP_DATA(nextrec & 0xff);", "IPMI_ADD_RSP_DATA((nextrec >> 8) & 0xff);", "if (VAR_1[7] == 0xff) {", "VAR_1[7] = ipmi_sdr_length(VAR_7) - VAR_1[6];", "}", "if ((VAR_1[7] + *VAR_4) > VAR_5) {", "VAR_3[2] = IPMI_CC_CANNOT_RETURN_REQ_NUM_BYTES;", "return;", "}", "memcpy(VAR_3 + *VAR_4, VAR_0->sdr.sdr + VAR_6 + VAR_1[6], VAR_1[7]);", "*VAR_4 += VAR_1[7];", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ] ]
20,640
static float get_band_cost_NONE_mips(struct AACEncContext *s, PutBitContext *pb, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits) { av_assert0(0); return 0; }
true
FFmpeg
01ecb7172b684f1c4b3e748f95c5a9a494ca36ec
static float get_band_cost_NONE_mips(struct AACEncContext *s, PutBitContext *pb, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits) { av_assert0(0); return 0; }
{ "code": [ " int *bits)", " int *bits)" ], "line_no": [ 9, 9 ] }
static float FUNC_0(struct AACEncContext *VAR_0, PutBitContext *VAR_1, const float *VAR_2, const float *VAR_3, int VAR_4, int VAR_5, int VAR_6, const float VAR_7, const float VAR_8, int *VAR_9) { av_assert0(0); return 0; }
[ "static float FUNC_0(struct AACEncContext *VAR_0,\nPutBitContext *VAR_1, const float *VAR_2,\nconst float *VAR_3, int VAR_4, int VAR_5,\nint VAR_6, const float VAR_7, const float VAR_8,\nint *VAR_9)\n{", "av_assert0(0);", "return 0;", "}" ]
[ 1, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ] ]
20,641
static int kvm_physical_sync_dirty_bitmap(MemoryRegionSection *section) { KVMState *s = kvm_state; unsigned long size, allocated_size = 0; KVMDirtyLog d; KVMSlot *mem; int ret = 0; hwaddr start_addr = section->offset_within_address_space; hwaddr end_addr = start_addr + int128_get64(section->size); d.dirty_bitmap = NULL; while (start_addr < end_addr) { mem = kvm_lookup_overlapping_slot(s, start_addr, end_addr); if (mem == NULL) { break; } /* XXX bad kernel interface alert * For dirty bitmap, kernel allocates array of size aligned to * bits-per-long. But for case when the kernel is 64bits and * the userspace is 32bits, userspace can't align to the same * bits-per-long, since sizeof(long) is different between kernel * and user space. This way, userspace will provide buffer which * may be 4 bytes less than the kernel will use, resulting in * userspace memory corruption (which is not detectable by valgrind * too, in most cases). * So for now, let's align to 64 instead of HOST_LONG_BITS here, in * a hope that sizeof(long) wont become >8 any time soon. */ size = ALIGN(((mem->memory_size) >> TARGET_PAGE_BITS), /*HOST_LONG_BITS*/ 64) / 8; if (!d.dirty_bitmap) { d.dirty_bitmap = g_malloc(size); } else if (size > allocated_size) { d.dirty_bitmap = g_realloc(d.dirty_bitmap, size); } allocated_size = size; memset(d.dirty_bitmap, 0, allocated_size); d.slot = mem->slot; if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) { DPRINTF("ioctl failed %d\n", errno); ret = -1; break; } kvm_get_dirty_pages_log_range(section, d.dirty_bitmap); start_addr = mem->start_addr + mem->memory_size; } g_free(d.dirty_bitmap); return ret; }
true
qemu
b533f658a98325d0e47b36113bd9f5bcc046fdae
static int kvm_physical_sync_dirty_bitmap(MemoryRegionSection *section) { KVMState *s = kvm_state; unsigned long size, allocated_size = 0; KVMDirtyLog d; KVMSlot *mem; int ret = 0; hwaddr start_addr = section->offset_within_address_space; hwaddr end_addr = start_addr + int128_get64(section->size); d.dirty_bitmap = NULL; while (start_addr < end_addr) { mem = kvm_lookup_overlapping_slot(s, start_addr, end_addr); if (mem == NULL) { break; } size = ALIGN(((mem->memory_size) >> TARGET_PAGE_BITS), 64) / 8; if (!d.dirty_bitmap) { d.dirty_bitmap = g_malloc(size); } else if (size > allocated_size) { d.dirty_bitmap = g_realloc(d.dirty_bitmap, size); } allocated_size = size; memset(d.dirty_bitmap, 0, allocated_size); d.slot = mem->slot; if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) { DPRINTF("ioctl failed %d\n", errno); ret = -1; break; } kvm_get_dirty_pages_log_range(section, d.dirty_bitmap); start_addr = mem->start_addr + mem->memory_size; } g_free(d.dirty_bitmap); return ret; }
{ "code": [ " if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {" ], "line_no": [ 83 ] }
static int FUNC_0(MemoryRegionSection *VAR_0) { KVMState *s = kvm_state; unsigned long VAR_1, VAR_2 = 0; KVMDirtyLog d; KVMSlot *mem; int VAR_3 = 0; hwaddr start_addr = VAR_0->offset_within_address_space; hwaddr end_addr = start_addr + int128_get64(VAR_0->VAR_1); d.dirty_bitmap = NULL; while (start_addr < end_addr) { mem = kvm_lookup_overlapping_slot(s, start_addr, end_addr); if (mem == NULL) { break; } VAR_1 = ALIGN(((mem->memory_size) >> TARGET_PAGE_BITS), 64) / 8; if (!d.dirty_bitmap) { d.dirty_bitmap = g_malloc(VAR_1); } else if (VAR_1 > VAR_2) { d.dirty_bitmap = g_realloc(d.dirty_bitmap, VAR_1); } VAR_2 = VAR_1; memset(d.dirty_bitmap, 0, VAR_2); d.slot = mem->slot; if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) { DPRINTF("ioctl failed %d\n", errno); VAR_3 = -1; break; } kvm_get_dirty_pages_log_range(VAR_0, d.dirty_bitmap); start_addr = mem->start_addr + mem->memory_size; } g_free(d.dirty_bitmap); return VAR_3; }
[ "static int FUNC_0(MemoryRegionSection *VAR_0)\n{", "KVMState *s = kvm_state;", "unsigned long VAR_1, VAR_2 = 0;", "KVMDirtyLog d;", "KVMSlot *mem;", "int VAR_3 = 0;", "hwaddr start_addr = VAR_0->offset_within_address_space;", "hwaddr end_addr = start_addr + int128_get64(VAR_0->VAR_1);", "d.dirty_bitmap = NULL;", "while (start_addr < end_addr) {", "mem = kvm_lookup_overlapping_slot(s, start_addr, end_addr);", "if (mem == NULL) {", "break;", "}", "VAR_1 = ALIGN(((mem->memory_size) >> TARGET_PAGE_BITS),\n64) / 8;", "if (!d.dirty_bitmap) {", "d.dirty_bitmap = g_malloc(VAR_1);", "} else if (VAR_1 > VAR_2) {", "d.dirty_bitmap = g_realloc(d.dirty_bitmap, VAR_1);", "}", "VAR_2 = VAR_1;", "memset(d.dirty_bitmap, 0, VAR_2);", "d.slot = mem->slot;", "if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {", "DPRINTF(\"ioctl failed %d\\n\", errno);", "VAR_3 = -1;", "break;", "}", "kvm_get_dirty_pages_log_range(VAR_0, d.dirty_bitmap);", "start_addr = mem->start_addr + mem->memory_size;", "}", "g_free(d.dirty_bitmap);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ] ]
20,645
av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc) { #undef FUNC #undef FUNCC #define FUNC(a, depth) a ## _ ## depth #define FUNCC(a, depth) a ## _ ## depth ## _c #define FUNCD(a) a ## _c #define H264_PRED(depth) \ if(codec_id != AV_CODEC_ID_RV40){\ if(codec_id == AV_CODEC_ID_VP8) {\ h->pred4x4[VERT_PRED ]= FUNCD(pred4x4_vertical_vp8);\ h->pred4x4[HOR_PRED ]= FUNCD(pred4x4_horizontal_vp8);\ } else {\ h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\ h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\ }\ h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\ if(codec_id == AV_CODEC_ID_SVQ3)\ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_svq3);\ else\ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred4x4_down_left , depth);\ h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\ h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\ h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\ if (codec_id == AV_CODEC_ID_VP8) {\ h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_vp8);\ } else\ h->pred4x4[VERT_LEFT_PRED ]= FUNCC(pred4x4_vertical_left , depth);\ h->pred4x4[HOR_UP_PRED ]= FUNCC(pred4x4_horizontal_up , depth);\ if(codec_id != AV_CODEC_ID_VP8) {\ h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\ h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\ h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\ } else {\ h->pred4x4[TM_VP8_PRED ]= FUNCD(pred4x4_tm_vp8);\ h->pred4x4[DC_127_PRED ]= FUNCC(pred4x4_127_dc , depth);\ h->pred4x4[DC_129_PRED ]= FUNCC(pred4x4_129_dc , depth);\ h->pred4x4[VERT_VP8_PRED ]= FUNCC(pred4x4_vertical , depth);\ h->pred4x4[HOR_VP8_PRED ]= FUNCC(pred4x4_horizontal , depth);\ }\ }else{\ h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\ h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\ h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_rv40);\ h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\ h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\ h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\ h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_rv40);\ h->pred4x4[HOR_UP_PRED ]= FUNCD(pred4x4_horizontal_up_rv40);\ h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\ h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\ h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\ h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_down_left_rv40_nodown);\ h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= FUNCD(pred4x4_horizontal_up_rv40_nodown);\ h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_vertical_left_rv40_nodown);\ }\ \ h->pred8x8l[VERT_PRED ]= FUNCC(pred8x8l_vertical , depth);\ h->pred8x8l[HOR_PRED ]= FUNCC(pred8x8l_horizontal , depth);\ h->pred8x8l[DC_PRED ]= FUNCC(pred8x8l_dc , depth);\ h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred8x8l_down_left , depth);\ h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred8x8l_down_right , depth);\ h->pred8x8l[VERT_RIGHT_PRED ]= FUNCC(pred8x8l_vertical_right , depth);\ h->pred8x8l[HOR_DOWN_PRED ]= FUNCC(pred8x8l_horizontal_down , depth);\ h->pred8x8l[VERT_LEFT_PRED ]= FUNCC(pred8x8l_vertical_left , depth);\ h->pred8x8l[HOR_UP_PRED ]= FUNCC(pred8x8l_horizontal_up , depth);\ h->pred8x8l[LEFT_DC_PRED ]= FUNCC(pred8x8l_left_dc , depth);\ h->pred8x8l[TOP_DC_PRED ]= FUNCC(pred8x8l_top_dc , depth);\ h->pred8x8l[DC_128_PRED ]= FUNCC(pred8x8l_128_dc , depth);\ \ if (chroma_format_idc <= 1) {\ h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x8_vertical , depth);\ h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x8_horizontal , depth);\ } else {\ h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x16_vertical , depth);\ h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x16_horizontal , depth);\ }\ if (codec_id != AV_CODEC_ID_VP8) {\ if (chroma_format_idc <= 1) {\ h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x8_plane , depth);\ } else {\ h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x16_plane , depth);\ }\ } else\ h->pred8x8[PLANE_PRED8x8]= FUNCD(pred8x8_tm_vp8);\ if(codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8){\ if (chroma_format_idc <= 1) {\ h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\ h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\ h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\ h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ } else {\ h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x16_dc , depth);\ h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc , depth);\ h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc , depth);\ h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l0t, depth);\ h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0lt, depth);\ h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l00, depth);\ h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0l0, depth);\ }\ }else{\ h->pred8x8[DC_PRED8x8 ]= FUNCD(pred8x8_dc_rv40);\ h->pred8x8[LEFT_DC_PRED8x8]= FUNCD(pred8x8_left_dc_rv40);\ h->pred8x8[TOP_DC_PRED8x8 ]= FUNCD(pred8x8_top_dc_rv40);\ if (codec_id == AV_CODEC_ID_VP8) {\ h->pred8x8[DC_127_PRED8x8]= FUNCC(pred8x8_127_dc , depth);\ h->pred8x8[DC_129_PRED8x8]= FUNCC(pred8x8_129_dc , depth);\ }\ }\ if (chroma_format_idc <= 1) {\ h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x8_128_dc , depth);\ } else {\ h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x16_128_dc , depth);\ }\ \ h->pred16x16[DC_PRED8x8 ]= FUNCC(pred16x16_dc , depth);\ h->pred16x16[VERT_PRED8x8 ]= FUNCC(pred16x16_vertical , depth);\ h->pred16x16[HOR_PRED8x8 ]= FUNCC(pred16x16_horizontal , depth);\ switch(codec_id){\ case AV_CODEC_ID_SVQ3:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_svq3);\ break;\ case AV_CODEC_ID_RV40:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_rv40);\ break;\ case AV_CODEC_ID_VP8:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_tm_vp8);\ h->pred16x16[DC_127_PRED8x8]= FUNCC(pred16x16_127_dc , depth);\ h->pred16x16[DC_129_PRED8x8]= FUNCC(pred16x16_129_dc , depth);\ break;\ default:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCC(pred16x16_plane , depth);\ break;\ }\ h->pred16x16[LEFT_DC_PRED8x8]= FUNCC(pred16x16_left_dc , depth);\ h->pred16x16[TOP_DC_PRED8x8 ]= FUNCC(pred16x16_top_dc , depth);\ h->pred16x16[DC_128_PRED8x8 ]= FUNCC(pred16x16_128_dc , depth);\ \ /* special lossless h/v prediction for h264 */ \ h->pred4x4_add [VERT_PRED ]= FUNCC(pred4x4_vertical_add , depth);\ h->pred4x4_add [ HOR_PRED ]= FUNCC(pred4x4_horizontal_add , depth);\ h->pred8x8l_add [VERT_PRED ]= FUNCC(pred8x8l_vertical_add , depth);\ h->pred8x8l_add [ HOR_PRED ]= FUNCC(pred8x8l_horizontal_add , depth);\ if (chroma_format_idc <= 1) {\ h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x8_vertical_add , depth);\ h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x8_horizontal_add , depth);\ } else {\ h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x16_vertical_add , depth);\ h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x16_horizontal_add , depth);\ }\ h->pred16x16_add[VERT_PRED8x8]= FUNCC(pred16x16_vertical_add , depth);\ h->pred16x16_add[ HOR_PRED8x8]= FUNCC(pred16x16_horizontal_add , depth);\ switch (bit_depth) { case 9: H264_PRED(9) break; case 10: H264_PRED(10) break; default: H264_PRED(8) break; } if (ARCH_ARM) ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc); if (ARCH_X86) ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc); }
true
FFmpeg
ac4b32df71bd932838043a4838b86d11e169707f
av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc) { #undef FUNC #undef FUNCC #define FUNC(a, depth) a ## _ ## depth #define FUNCC(a, depth) a ## _ ## depth ## _c #define FUNCD(a) a ## _c #define H264_PRED(depth) \ if(codec_id != AV_CODEC_ID_RV40){\ if(codec_id == AV_CODEC_ID_VP8) {\ h->pred4x4[VERT_PRED ]= FUNCD(pred4x4_vertical_vp8);\ h->pred4x4[HOR_PRED ]= FUNCD(pred4x4_horizontal_vp8);\ } else {\ h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\ h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\ }\ h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\ if(codec_id == AV_CODEC_ID_SVQ3)\ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_svq3);\ else\ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred4x4_down_left , depth);\ h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\ h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\ h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\ if (codec_id == AV_CODEC_ID_VP8) {\ h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_vp8);\ } else\ h->pred4x4[VERT_LEFT_PRED ]= FUNCC(pred4x4_vertical_left , depth);\ h->pred4x4[HOR_UP_PRED ]= FUNCC(pred4x4_horizontal_up , depth);\ if(codec_id != AV_CODEC_ID_VP8) {\ h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\ h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\ h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\ } else {\ h->pred4x4[TM_VP8_PRED ]= FUNCD(pred4x4_tm_vp8);\ h->pred4x4[DC_127_PRED ]= FUNCC(pred4x4_127_dc , depth);\ h->pred4x4[DC_129_PRED ]= FUNCC(pred4x4_129_dc , depth);\ h->pred4x4[VERT_VP8_PRED ]= FUNCC(pred4x4_vertical , depth);\ h->pred4x4[HOR_VP8_PRED ]= FUNCC(pred4x4_horizontal , depth);\ }\ }else{\ h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\ h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\ h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_rv40);\ h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\ h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\ h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\ h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_rv40);\ h->pred4x4[HOR_UP_PRED ]= FUNCD(pred4x4_horizontal_up_rv40);\ h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\ h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\ h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\ h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_down_left_rv40_nodown);\ h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= FUNCD(pred4x4_horizontal_up_rv40_nodown);\ h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_vertical_left_rv40_nodown);\ }\ \ h->pred8x8l[VERT_PRED ]= FUNCC(pred8x8l_vertical , depth);\ h->pred8x8l[HOR_PRED ]= FUNCC(pred8x8l_horizontal , depth);\ h->pred8x8l[DC_PRED ]= FUNCC(pred8x8l_dc , depth);\ h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred8x8l_down_left , depth);\ h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred8x8l_down_right , depth);\ h->pred8x8l[VERT_RIGHT_PRED ]= FUNCC(pred8x8l_vertical_right , depth);\ h->pred8x8l[HOR_DOWN_PRED ]= FUNCC(pred8x8l_horizontal_down , depth);\ h->pred8x8l[VERT_LEFT_PRED ]= FUNCC(pred8x8l_vertical_left , depth);\ h->pred8x8l[HOR_UP_PRED ]= FUNCC(pred8x8l_horizontal_up , depth);\ h->pred8x8l[LEFT_DC_PRED ]= FUNCC(pred8x8l_left_dc , depth);\ h->pred8x8l[TOP_DC_PRED ]= FUNCC(pred8x8l_top_dc , depth);\ h->pred8x8l[DC_128_PRED ]= FUNCC(pred8x8l_128_dc , depth);\ \ if (chroma_format_idc <= 1) {\ h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x8_vertical , depth);\ h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x8_horizontal , depth);\ } else {\ h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x16_vertical , depth);\ h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x16_horizontal , depth);\ }\ if (codec_id != AV_CODEC_ID_VP8) {\ if (chroma_format_idc <= 1) {\ h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x8_plane , depth);\ } else {\ h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x16_plane , depth);\ }\ } else\ h->pred8x8[PLANE_PRED8x8]= FUNCD(pred8x8_tm_vp8);\ if(codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8){\ if (chroma_format_idc <= 1) {\ h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\ h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\ h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\ h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ } else {\ h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x16_dc , depth);\ h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc , depth);\ h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc , depth);\ h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l0t, depth);\ h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0lt, depth);\ h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l00, depth);\ h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0l0, depth);\ }\ }else{\ h->pred8x8[DC_PRED8x8 ]= FUNCD(pred8x8_dc_rv40);\ h->pred8x8[LEFT_DC_PRED8x8]= FUNCD(pred8x8_left_dc_rv40);\ h->pred8x8[TOP_DC_PRED8x8 ]= FUNCD(pred8x8_top_dc_rv40);\ if (codec_id == AV_CODEC_ID_VP8) {\ h->pred8x8[DC_127_PRED8x8]= FUNCC(pred8x8_127_dc , depth);\ h->pred8x8[DC_129_PRED8x8]= FUNCC(pred8x8_129_dc , depth);\ }\ }\ if (chroma_format_idc <= 1) {\ h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x8_128_dc , depth);\ } else {\ h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x16_128_dc , depth);\ }\ \ h->pred16x16[DC_PRED8x8 ]= FUNCC(pred16x16_dc , depth);\ h->pred16x16[VERT_PRED8x8 ]= FUNCC(pred16x16_vertical , depth);\ h->pred16x16[HOR_PRED8x8 ]= FUNCC(pred16x16_horizontal , depth);\ switch(codec_id){\ case AV_CODEC_ID_SVQ3:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_svq3);\ break;\ case AV_CODEC_ID_RV40:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_rv40);\ break;\ case AV_CODEC_ID_VP8:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_tm_vp8);\ h->pred16x16[DC_127_PRED8x8]= FUNCC(pred16x16_127_dc , depth);\ h->pred16x16[DC_129_PRED8x8]= FUNCC(pred16x16_129_dc , depth);\ break;\ default:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCC(pred16x16_plane , depth);\ break;\ }\ h->pred16x16[LEFT_DC_PRED8x8]= FUNCC(pred16x16_left_dc , depth);\ h->pred16x16[TOP_DC_PRED8x8 ]= FUNCC(pred16x16_top_dc , depth);\ h->pred16x16[DC_128_PRED8x8 ]= FUNCC(pred16x16_128_dc , depth);\ \ \ h->pred4x4_add [VERT_PRED ]= FUNCC(pred4x4_vertical_add , depth);\ h->pred4x4_add [ HOR_PRED ]= FUNCC(pred4x4_horizontal_add , depth);\ h->pred8x8l_add [VERT_PRED ]= FUNCC(pred8x8l_vertical_add , depth);\ h->pred8x8l_add [ HOR_PRED ]= FUNCC(pred8x8l_horizontal_add , depth);\ if (chroma_format_idc <= 1) {\ h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x8_vertical_add , depth);\ h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x8_horizontal_add , depth);\ } else {\ h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x16_vertical_add , depth);\ h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x16_horizontal_add , depth);\ }\ h->pred16x16_add[VERT_PRED8x8]= FUNCC(pred16x16_vertical_add , depth);\ h->pred16x16_add[ HOR_PRED8x8]= FUNCC(pred16x16_horizontal_add , depth);\ switch (bit_depth) { case 9: H264_PRED(9) break; case 10: H264_PRED(10) break; default: H264_PRED(8) break; } if (ARCH_ARM) ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc); if (ARCH_X86) ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc); }
{ "code": [ " if(codec_id == AV_CODEC_ID_VP8) {\\", " if (codec_id == AV_CODEC_ID_VP8) {\\", " if(codec_id != AV_CODEC_ID_VP8) {\\", " h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\\", " if (codec_id != AV_CODEC_ID_VP8) {\\", " if(codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8){\\", " if (codec_id == AV_CODEC_ID_VP8) {\\", " break;" ], "line_no": [ 25, 55, 65, 71, 163, 179, 55, 327 ] }
av_cold void FUNC_0(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc) { #undef FUNC #undef FUNCC #define FUNC(a, depth) a ## _ ## depth #define FUNCC(a, depth) a ## _ ## depth ## _c #define FUNCD(a) a ## _c #define H264_PRED(depth) \ if(codec_id != AV_CODEC_ID_RV40){\ if(codec_id == AV_CODEC_ID_VP8) {\ h->pred4x4[VERT_PRED ]= FUNCD(pred4x4_vertical_vp8);\ h->pred4x4[HOR_PRED ]= FUNCD(pred4x4_horizontal_vp8);\ } else {\ h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\ h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\ }\ h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\ if(codec_id == AV_CODEC_ID_SVQ3)\ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_svq3);\ else\ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred4x4_down_left , depth);\ h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\ h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\ h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\ if (codec_id == AV_CODEC_ID_VP8) {\ h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_vp8);\ } else\ h->pred4x4[VERT_LEFT_PRED ]= FUNCC(pred4x4_vertical_left , depth);\ h->pred4x4[HOR_UP_PRED ]= FUNCC(pred4x4_horizontal_up , depth);\ if(codec_id != AV_CODEC_ID_VP8) {\ h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\ h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\ h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\ } else {\ h->pred4x4[TM_VP8_PRED ]= FUNCD(pred4x4_tm_vp8);\ h->pred4x4[DC_127_PRED ]= FUNCC(pred4x4_127_dc , depth);\ h->pred4x4[DC_129_PRED ]= FUNCC(pred4x4_129_dc , depth);\ h->pred4x4[VERT_VP8_PRED ]= FUNCC(pred4x4_vertical , depth);\ h->pred4x4[HOR_VP8_PRED ]= FUNCC(pred4x4_horizontal , depth);\ }\ }else{\ h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\ h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\ h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_rv40);\ h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\ h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\ h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\ h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_rv40);\ h->pred4x4[HOR_UP_PRED ]= FUNCD(pred4x4_horizontal_up_rv40);\ h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\ h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\ h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\ h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_down_left_rv40_nodown);\ h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= FUNCD(pred4x4_horizontal_up_rv40_nodown);\ h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_vertical_left_rv40_nodown);\ }\ \ h->pred8x8l[VERT_PRED ]= FUNCC(pred8x8l_vertical , depth);\ h->pred8x8l[HOR_PRED ]= FUNCC(pred8x8l_horizontal , depth);\ h->pred8x8l[DC_PRED ]= FUNCC(pred8x8l_dc , depth);\ h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred8x8l_down_left , depth);\ h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred8x8l_down_right , depth);\ h->pred8x8l[VERT_RIGHT_PRED ]= FUNCC(pred8x8l_vertical_right , depth);\ h->pred8x8l[HOR_DOWN_PRED ]= FUNCC(pred8x8l_horizontal_down , depth);\ h->pred8x8l[VERT_LEFT_PRED ]= FUNCC(pred8x8l_vertical_left , depth);\ h->pred8x8l[HOR_UP_PRED ]= FUNCC(pred8x8l_horizontal_up , depth);\ h->pred8x8l[LEFT_DC_PRED ]= FUNCC(pred8x8l_left_dc , depth);\ h->pred8x8l[TOP_DC_PRED ]= FUNCC(pred8x8l_top_dc , depth);\ h->pred8x8l[DC_128_PRED ]= FUNCC(pred8x8l_128_dc , depth);\ \ if (chroma_format_idc <= 1) {\ h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x8_vertical , depth);\ h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x8_horizontal , depth);\ } else {\ h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x16_vertical , depth);\ h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x16_horizontal , depth);\ }\ if (codec_id != AV_CODEC_ID_VP8) {\ if (chroma_format_idc <= 1) {\ h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x8_plane , depth);\ } else {\ h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x16_plane , depth);\ }\ } else\ h->pred8x8[PLANE_PRED8x8]= FUNCD(pred8x8_tm_vp8);\ if(codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8){\ if (chroma_format_idc <= 1) {\ h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\ h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\ h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\ h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ } else {\ h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x16_dc , depth);\ h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc , depth);\ h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc , depth);\ h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l0t, depth);\ h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0lt, depth);\ h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l00, depth);\ h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0l0, depth);\ }\ }else{\ h->pred8x8[DC_PRED8x8 ]= FUNCD(pred8x8_dc_rv40);\ h->pred8x8[LEFT_DC_PRED8x8]= FUNCD(pred8x8_left_dc_rv40);\ h->pred8x8[TOP_DC_PRED8x8 ]= FUNCD(pred8x8_top_dc_rv40);\ if (codec_id == AV_CODEC_ID_VP8) {\ h->pred8x8[DC_127_PRED8x8]= FUNCC(pred8x8_127_dc , depth);\ h->pred8x8[DC_129_PRED8x8]= FUNCC(pred8x8_129_dc , depth);\ }\ }\ if (chroma_format_idc <= 1) {\ h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x8_128_dc , depth);\ } else {\ h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x16_128_dc , depth);\ }\ \ h->pred16x16[DC_PRED8x8 ]= FUNCC(pred16x16_dc , depth);\ h->pred16x16[VERT_PRED8x8 ]= FUNCC(pred16x16_vertical , depth);\ h->pred16x16[HOR_PRED8x8 ]= FUNCC(pred16x16_horizontal , depth);\ switch(codec_id){\ case AV_CODEC_ID_SVQ3:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_svq3);\ break;\ case AV_CODEC_ID_RV40:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_rv40);\ break;\ case AV_CODEC_ID_VP8:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_tm_vp8);\ h->pred16x16[DC_127_PRED8x8]= FUNCC(pred16x16_127_dc , depth);\ h->pred16x16[DC_129_PRED8x8]= FUNCC(pred16x16_129_dc , depth);\ break;\ default:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCC(pred16x16_plane , depth);\ break;\ }\ h->pred16x16[LEFT_DC_PRED8x8]= FUNCC(pred16x16_left_dc , depth);\ h->pred16x16[TOP_DC_PRED8x8 ]= FUNCC(pred16x16_top_dc , depth);\ h->pred16x16[DC_128_PRED8x8 ]= FUNCC(pred16x16_128_dc , depth);\ \ \ h->pred4x4_add [VERT_PRED ]= FUNCC(pred4x4_vertical_add , depth);\ h->pred4x4_add [ HOR_PRED ]= FUNCC(pred4x4_horizontal_add , depth);\ h->pred8x8l_add [VERT_PRED ]= FUNCC(pred8x8l_vertical_add , depth);\ h->pred8x8l_add [ HOR_PRED ]= FUNCC(pred8x8l_horizontal_add , depth);\ if (chroma_format_idc <= 1) {\ h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x8_vertical_add , depth);\ h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x8_horizontal_add , depth);\ } else {\ h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x16_vertical_add , depth);\ h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x16_horizontal_add , depth);\ }\ h->pred16x16_add[VERT_PRED8x8]= FUNCC(pred16x16_vertical_add , depth);\ h->pred16x16_add[ HOR_PRED8x8]= FUNCC(pred16x16_horizontal_add , depth);\ switch (bit_depth) { case 9: H264_PRED(9) break; case 10: H264_PRED(10) break; default: H264_PRED(8) break; } if (ARCH_ARM) ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc); if (ARCH_X86) ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc); }
[ "av_cold void FUNC_0(H264PredContext *h, int codec_id,\nconst int bit_depth,\nconst int chroma_format_idc)\n{", "#undef FUNC\n#undef FUNCC\n#define FUNC(a, depth) a ## _ ## depth\n#define FUNCC(a, depth) a ## _ ## depth ## _c\n#define FUNCD(a) a ## _c\n#define H264_PRED(depth) \\\nif(codec_id != AV_CODEC_ID_RV40){\\", "if(codec_id == AV_CODEC_ID_VP8) {\\", "h->pred4x4[VERT_PRED ]= FUNCD(pred4x4_vertical_vp8);\\", "h->pred4x4[HOR_PRED ]= FUNCD(pred4x4_horizontal_vp8);\\", "} else {\\", "h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\\", "h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\\", "}\\", "h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\\", "if(codec_id == AV_CODEC_ID_SVQ3)\\\nh->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_svq3);\\", "else\\\nh->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred4x4_down_left , depth);\\", "h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\\", "h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\\", "h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\\", "if (codec_id == AV_CODEC_ID_VP8) {\\", "h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_vp8);\\", "} else\\", "h->pred4x4[VERT_LEFT_PRED ]= FUNCC(pred4x4_vertical_left , depth);\\", "h->pred4x4[HOR_UP_PRED ]= FUNCC(pred4x4_horizontal_up , depth);\\", "if(codec_id != AV_CODEC_ID_VP8) {\\", "h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\\", "h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\\", "h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\\", "} else {\\", "h->pred4x4[TM_VP8_PRED ]= FUNCD(pred4x4_tm_vp8);\\", "h->pred4x4[DC_127_PRED ]= FUNCC(pred4x4_127_dc , depth);\\", "h->pred4x4[DC_129_PRED ]= FUNCC(pred4x4_129_dc , depth);\\", "h->pred4x4[VERT_VP8_PRED ]= FUNCC(pred4x4_vertical , depth);\\", "h->pred4x4[HOR_VP8_PRED ]= FUNCC(pred4x4_horizontal , depth);\\", "}\\", "}else{\\", "h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\\", "h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\\", "h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\\", "h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_rv40);\\", "h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\\", "h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\\", "h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\\", "h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_rv40);\\", "h->pred4x4[HOR_UP_PRED ]= FUNCD(pred4x4_horizontal_up_rv40);\\", "h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\\", "h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\\", "h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\\", "h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_down_left_rv40_nodown);\\", "h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= FUNCD(pred4x4_horizontal_up_rv40_nodown);\\", "h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_vertical_left_rv40_nodown);\\", "}\\", "\\\nh->pred8x8l[VERT_PRED ]= FUNCC(pred8x8l_vertical , depth);\\", "h->pred8x8l[HOR_PRED ]= FUNCC(pred8x8l_horizontal , depth);\\", "h->pred8x8l[DC_PRED ]= FUNCC(pred8x8l_dc , depth);\\", "h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred8x8l_down_left , depth);\\", "h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred8x8l_down_right , depth);\\", "h->pred8x8l[VERT_RIGHT_PRED ]= FUNCC(pred8x8l_vertical_right , depth);\\", "h->pred8x8l[HOR_DOWN_PRED ]= FUNCC(pred8x8l_horizontal_down , depth);\\", "h->pred8x8l[VERT_LEFT_PRED ]= FUNCC(pred8x8l_vertical_left , depth);\\", "h->pred8x8l[HOR_UP_PRED ]= FUNCC(pred8x8l_horizontal_up , depth);\\", "h->pred8x8l[LEFT_DC_PRED ]= FUNCC(pred8x8l_left_dc , depth);\\", "h->pred8x8l[TOP_DC_PRED ]= FUNCC(pred8x8l_top_dc , depth);\\", "h->pred8x8l[DC_128_PRED ]= FUNCC(pred8x8l_128_dc , depth);\\", "\\\nif (chroma_format_idc <= 1) {\\", "h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x8_vertical , depth);\\", "h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x8_horizontal , depth);\\", "} else {\\", "h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x16_vertical , depth);\\", "h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x16_horizontal , depth);\\", "}\\", "if (codec_id != AV_CODEC_ID_VP8) {\\", "if (chroma_format_idc <= 1) {\\", "h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x8_plane , depth);\\", "} else {\\", "h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x16_plane , depth);\\", "}\\", "} else\\", "h->pred8x8[PLANE_PRED8x8]= FUNCD(pred8x8_tm_vp8);\\", "if(codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8){\\", "if (chroma_format_idc <= 1) {\\", "h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\\", "h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\\", "h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\\", "h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\\", "h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\\", "h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\\", "h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\\", "} else {\\", "h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x16_dc , depth);\\", "h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc , depth);\\", "h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc , depth);\\", "h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l0t, depth);\\", "h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0lt, depth);\\", "h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l00, depth);\\", "h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0l0, depth);\\", "}\\", "}else{\\", "h->pred8x8[DC_PRED8x8 ]= FUNCD(pred8x8_dc_rv40);\\", "h->pred8x8[LEFT_DC_PRED8x8]= FUNCD(pred8x8_left_dc_rv40);\\", "h->pred8x8[TOP_DC_PRED8x8 ]= FUNCD(pred8x8_top_dc_rv40);\\", "if (codec_id == AV_CODEC_ID_VP8) {\\", "h->pred8x8[DC_127_PRED8x8]= FUNCC(pred8x8_127_dc , depth);\\", "h->pred8x8[DC_129_PRED8x8]= FUNCC(pred8x8_129_dc , depth);\\", "}\\", "}\\", "if (chroma_format_idc <= 1) {\\", "h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x8_128_dc , depth);\\", "} else {\\", "h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x16_128_dc , depth);\\", "}\\", "\\\nh->pred16x16[DC_PRED8x8 ]= FUNCC(pred16x16_dc , depth);\\", "h->pred16x16[VERT_PRED8x8 ]= FUNCC(pred16x16_vertical , depth);\\", "h->pred16x16[HOR_PRED8x8 ]= FUNCC(pred16x16_horizontal , depth);\\", "switch(codec_id){\\", "case AV_CODEC_ID_SVQ3:\\\nh->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_svq3);\\", "break;\\", "case AV_CODEC_ID_RV40:\\\nh->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_rv40);\\", "break;\\", "case AV_CODEC_ID_VP8:\\\nh->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_tm_vp8);\\", "h->pred16x16[DC_127_PRED8x8]= FUNCC(pred16x16_127_dc , depth);\\", "h->pred16x16[DC_129_PRED8x8]= FUNCC(pred16x16_129_dc , depth);\\", "break;\\", "default:\\\nh->pred16x16[PLANE_PRED8x8 ]= FUNCC(pred16x16_plane , depth);\\", "break;\\", "}\\", "h->pred16x16[LEFT_DC_PRED8x8]= FUNCC(pred16x16_left_dc , depth);\\", "h->pred16x16[TOP_DC_PRED8x8 ]= FUNCC(pred16x16_top_dc , depth);\\", "h->pred16x16[DC_128_PRED8x8 ]= FUNCC(pred16x16_128_dc , depth);\\", "\\\n\\\nh->pred4x4_add [VERT_PRED ]= FUNCC(pred4x4_vertical_add , depth);\\", "h->pred4x4_add [ HOR_PRED ]= FUNCC(pred4x4_horizontal_add , depth);\\", "h->pred8x8l_add [VERT_PRED ]= FUNCC(pred8x8l_vertical_add , depth);\\", "h->pred8x8l_add [ HOR_PRED ]= FUNCC(pred8x8l_horizontal_add , depth);\\", "if (chroma_format_idc <= 1) {\\", "h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x8_vertical_add , depth);\\", "h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x8_horizontal_add , depth);\\", "} else {\\", "h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x16_vertical_add , depth);\\", "h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x16_horizontal_add , depth);\\", "}\\", "h->pred16x16_add[VERT_PRED8x8]= FUNCC(pred16x16_vertical_add , depth);\\", "h->pred16x16_add[ HOR_PRED8x8]= FUNCC(pred16x16_horizontal_add , depth);\\", "switch (bit_depth) {", "case 9:\nH264_PRED(9)\nbreak;", "case 10:\nH264_PRED(10)\nbreak;", "default:\nH264_PRED(8)\nbreak;", "}", "if (ARCH_ARM) ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc);", "if (ARCH_X86) ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc);", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3, 5, 7 ], [ 9, 11, 13, 15, 17, 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243, 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259, 261 ], [ 263 ], [ 265, 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275, 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289, 291, 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 321 ], [ 323, 325, 327 ], [ 329, 331, 333 ], [ 335, 337, 339 ], [ 341 ], [ 345 ], [ 347 ], [ 349 ] ]
20,646
sigterm_handler(int sig) { received_sigterm = sig; received_nb_signals++; term_exit_sigsafe(); if(received_nb_signals > 3) exit_program(123); }
true
FFmpeg
9dca02ee541120de2a96c387faed9a4e033a60fd
sigterm_handler(int sig) { received_sigterm = sig; received_nb_signals++; term_exit_sigsafe(); if(received_nb_signals > 3) exit_program(123); }
{ "code": [ " exit_program(123);" ], "line_no": [ 13 ] }
FUNC_0(int VAR_0) { received_sigterm = VAR_0; received_nb_signals++; term_exit_sigsafe(); if(received_nb_signals > 3) exit_program(123); }
[ "FUNC_0(int VAR_0)\n{", "received_sigterm = VAR_0;", "received_nb_signals++;", "term_exit_sigsafe();", "if(received_nb_signals > 3)\nexit_program(123);", "}" ]
[ 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15 ] ]
20,648
static void pci_idx(void) { QVirtioPCIDevice *dev; QPCIBus *bus; QVirtQueuePCI *vqpci; QGuestAllocator *alloc; QVirtioBlkReq req; void *addr; uint64_t req_addr; uint64_t capacity; uint32_t features; uint32_t free_head; uint8_t status; char *data; bus = pci_test_start(); alloc = pc_alloc_init(); dev = virtio_blk_pci_init(bus, PCI_SLOT); qpci_msix_enable(dev->pdev); qvirtio_pci_set_msix_configuration_vector(dev, alloc, 0); /* MSI-X is enabled */ addr = dev->addr + VIRTIO_PCI_CONFIG_OFF(true); capacity = qvirtio_config_readq(&qvirtio_pci, &dev->vdev, (uint64_t)(uintptr_t)addr); g_assert_cmpint(capacity, ==, TEST_IMAGE_SIZE / 512); features = qvirtio_get_features(&qvirtio_pci, &dev->vdev); features = features & ~(QVIRTIO_F_BAD_FEATURE | (1u << VIRTIO_RING_F_INDIRECT_DESC) | (1u << VIRTIO_F_NOTIFY_ON_EMPTY) | (1u << VIRTIO_BLK_F_SCSI)); qvirtio_set_features(&qvirtio_pci, &dev->vdev, features); vqpci = (QVirtQueuePCI *)qvirtqueue_setup(&qvirtio_pci, &dev->vdev, alloc, 0); qvirtqueue_pci_msix_setup(dev, vqpci, alloc, 1); qvirtio_set_driver_ok(&qvirtio_pci, &dev->vdev); /* Write request */ req.type = VIRTIO_BLK_T_OUT; req.ioprio = 1; req.sector = 0; req.data = g_malloc0(512); strcpy(req.data, "TEST"); req_addr = virtio_blk_request(alloc, &req, 512); g_free(req.data); free_head = qvirtqueue_add(&vqpci->vq, req_addr, 16, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head); qvirtio_wait_queue_isr(&qvirtio_pci, &dev->vdev, &vqpci->vq, QVIRTIO_BLK_TIMEOUT_US); /* Write request */ req.type = VIRTIO_BLK_T_OUT; req.ioprio = 1; req.sector = 1; req.data = g_malloc0(512); strcpy(req.data, "TEST"); req_addr = virtio_blk_request(alloc, &req, 512); g_free(req.data); /* Notify after processing the third request */ qvirtqueue_set_used_event(&vqpci->vq, 2); free_head = qvirtqueue_add(&vqpci->vq, req_addr, 16, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head); /* No notification expected */ status = qvirtio_wait_status_byte_no_isr(&qvirtio_pci, &dev->vdev, &vqpci->vq, req_addr + 528, QVIRTIO_BLK_TIMEOUT_US); g_assert_cmpint(status, ==, 0); guest_free(alloc, req_addr); /* Read request */ req.type = VIRTIO_BLK_T_IN; req.ioprio = 1; req.sector = 1; req.data = g_malloc0(512); req_addr = virtio_blk_request(alloc, &req, 512); g_free(req.data); free_head = qvirtqueue_add(&vqpci->vq, req_addr, 16, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, true, true); qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head); qvirtio_wait_queue_isr(&qvirtio_pci, &dev->vdev, &vqpci->vq, QVIRTIO_BLK_TIMEOUT_US); status = readb(req_addr + 528); g_assert_cmpint(status, ==, 0); data = g_malloc0(512); memread(req_addr + 16, data, 512); g_assert_cmpstr(data, ==, "TEST"); g_free(data); guest_free(alloc, req_addr); /* End test */ guest_free(alloc, vqpci->vq.desc); pc_alloc_uninit(alloc); qpci_msix_disable(dev->pdev); qvirtio_pci_device_disable(dev); g_free(dev); qpci_free_pc(bus); test_end(); }
true
qemu
f1d3b99154138741161fc52f5a8c373bf71613c6
static void pci_idx(void) { QVirtioPCIDevice *dev; QPCIBus *bus; QVirtQueuePCI *vqpci; QGuestAllocator *alloc; QVirtioBlkReq req; void *addr; uint64_t req_addr; uint64_t capacity; uint32_t features; uint32_t free_head; uint8_t status; char *data; bus = pci_test_start(); alloc = pc_alloc_init(); dev = virtio_blk_pci_init(bus, PCI_SLOT); qpci_msix_enable(dev->pdev); qvirtio_pci_set_msix_configuration_vector(dev, alloc, 0); addr = dev->addr + VIRTIO_PCI_CONFIG_OFF(true); capacity = qvirtio_config_readq(&qvirtio_pci, &dev->vdev, (uint64_t)(uintptr_t)addr); g_assert_cmpint(capacity, ==, TEST_IMAGE_SIZE / 512); features = qvirtio_get_features(&qvirtio_pci, &dev->vdev); features = features & ~(QVIRTIO_F_BAD_FEATURE | (1u << VIRTIO_RING_F_INDIRECT_DESC) | (1u << VIRTIO_F_NOTIFY_ON_EMPTY) | (1u << VIRTIO_BLK_F_SCSI)); qvirtio_set_features(&qvirtio_pci, &dev->vdev, features); vqpci = (QVirtQueuePCI *)qvirtqueue_setup(&qvirtio_pci, &dev->vdev, alloc, 0); qvirtqueue_pci_msix_setup(dev, vqpci, alloc, 1); qvirtio_set_driver_ok(&qvirtio_pci, &dev->vdev); req.type = VIRTIO_BLK_T_OUT; req.ioprio = 1; req.sector = 0; req.data = g_malloc0(512); strcpy(req.data, "TEST"); req_addr = virtio_blk_request(alloc, &req, 512); g_free(req.data); free_head = qvirtqueue_add(&vqpci->vq, req_addr, 16, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head); qvirtio_wait_queue_isr(&qvirtio_pci, &dev->vdev, &vqpci->vq, QVIRTIO_BLK_TIMEOUT_US); req.type = VIRTIO_BLK_T_OUT; req.ioprio = 1; req.sector = 1; req.data = g_malloc0(512); strcpy(req.data, "TEST"); req_addr = virtio_blk_request(alloc, &req, 512); g_free(req.data); qvirtqueue_set_used_event(&vqpci->vq, 2); free_head = qvirtqueue_add(&vqpci->vq, req_addr, 16, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head); status = qvirtio_wait_status_byte_no_isr(&qvirtio_pci, &dev->vdev, &vqpci->vq, req_addr + 528, QVIRTIO_BLK_TIMEOUT_US); g_assert_cmpint(status, ==, 0); guest_free(alloc, req_addr); req.type = VIRTIO_BLK_T_IN; req.ioprio = 1; req.sector = 1; req.data = g_malloc0(512); req_addr = virtio_blk_request(alloc, &req, 512); g_free(req.data); free_head = qvirtqueue_add(&vqpci->vq, req_addr, 16, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, true, true); qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head); qvirtio_wait_queue_isr(&qvirtio_pci, &dev->vdev, &vqpci->vq, QVIRTIO_BLK_TIMEOUT_US); status = readb(req_addr + 528); g_assert_cmpint(status, ==, 0); data = g_malloc0(512); memread(req_addr + 16, data, 512); g_assert_cmpstr(data, ==, "TEST"); g_free(data); guest_free(alloc, req_addr); guest_free(alloc, vqpci->vq.desc); pc_alloc_uninit(alloc); qpci_msix_disable(dev->pdev); qvirtio_pci_device_disable(dev); g_free(dev); qpci_free_pc(bus); test_end(); }
{ "code": [ " guest_free(alloc, vqpci->vq.desc);", " guest_free(alloc, vqpci->vq.desc);", " guest_free(alloc, vqpci->vq.desc);", " guest_free(alloc, vqpci->vq.desc);" ], "line_no": [ 237, 237, 237, 237 ] }
static void FUNC_0(void) { QVirtioPCIDevice *dev; QPCIBus *bus; QVirtQueuePCI *vqpci; QGuestAllocator *alloc; QVirtioBlkReq req; void *VAR_0; uint64_t req_addr; uint64_t capacity; uint32_t features; uint32_t free_head; uint8_t status; char *VAR_1; bus = pci_test_start(); alloc = pc_alloc_init(); dev = virtio_blk_pci_init(bus, PCI_SLOT); qpci_msix_enable(dev->pdev); qvirtio_pci_set_msix_configuration_vector(dev, alloc, 0); VAR_0 = dev->VAR_0 + VIRTIO_PCI_CONFIG_OFF(true); capacity = qvirtio_config_readq(&qvirtio_pci, &dev->vdev, (uint64_t)(uintptr_t)VAR_0); g_assert_cmpint(capacity, ==, TEST_IMAGE_SIZE / 512); features = qvirtio_get_features(&qvirtio_pci, &dev->vdev); features = features & ~(QVIRTIO_F_BAD_FEATURE | (1u << VIRTIO_RING_F_INDIRECT_DESC) | (1u << VIRTIO_F_NOTIFY_ON_EMPTY) | (1u << VIRTIO_BLK_F_SCSI)); qvirtio_set_features(&qvirtio_pci, &dev->vdev, features); vqpci = (QVirtQueuePCI *)qvirtqueue_setup(&qvirtio_pci, &dev->vdev, alloc, 0); qvirtqueue_pci_msix_setup(dev, vqpci, alloc, 1); qvirtio_set_driver_ok(&qvirtio_pci, &dev->vdev); req.type = VIRTIO_BLK_T_OUT; req.ioprio = 1; req.sector = 0; req.VAR_1 = g_malloc0(512); strcpy(req.VAR_1, "TEST"); req_addr = virtio_blk_request(alloc, &req, 512); g_free(req.VAR_1); free_head = qvirtqueue_add(&vqpci->vq, req_addr, 16, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head); qvirtio_wait_queue_isr(&qvirtio_pci, &dev->vdev, &vqpci->vq, QVIRTIO_BLK_TIMEOUT_US); req.type = VIRTIO_BLK_T_OUT; req.ioprio = 1; req.sector = 1; req.VAR_1 = g_malloc0(512); strcpy(req.VAR_1, "TEST"); req_addr = virtio_blk_request(alloc, &req, 512); g_free(req.VAR_1); qvirtqueue_set_used_event(&vqpci->vq, 2); free_head = qvirtqueue_add(&vqpci->vq, req_addr, 16, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head); status = qvirtio_wait_status_byte_no_isr(&qvirtio_pci, &dev->vdev, &vqpci->vq, req_addr + 528, QVIRTIO_BLK_TIMEOUT_US); g_assert_cmpint(status, ==, 0); guest_free(alloc, req_addr); req.type = VIRTIO_BLK_T_IN; req.ioprio = 1; req.sector = 1; req.VAR_1 = g_malloc0(512); req_addr = virtio_blk_request(alloc, &req, 512); g_free(req.VAR_1); free_head = qvirtqueue_add(&vqpci->vq, req_addr, 16, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, true, true); qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head); qvirtio_wait_queue_isr(&qvirtio_pci, &dev->vdev, &vqpci->vq, QVIRTIO_BLK_TIMEOUT_US); status = readb(req_addr + 528); g_assert_cmpint(status, ==, 0); VAR_1 = g_malloc0(512); memread(req_addr + 16, VAR_1, 512); g_assert_cmpstr(VAR_1, ==, "TEST"); g_free(VAR_1); guest_free(alloc, req_addr); guest_free(alloc, vqpci->vq.desc); pc_alloc_uninit(alloc); qpci_msix_disable(dev->pdev); qvirtio_pci_device_disable(dev); g_free(dev); qpci_free_pc(bus); test_end(); }
[ "static void FUNC_0(void)\n{", "QVirtioPCIDevice *dev;", "QPCIBus *bus;", "QVirtQueuePCI *vqpci;", "QGuestAllocator *alloc;", "QVirtioBlkReq req;", "void *VAR_0;", "uint64_t req_addr;", "uint64_t capacity;", "uint32_t features;", "uint32_t free_head;", "uint8_t status;", "char *VAR_1;", "bus = pci_test_start();", "alloc = pc_alloc_init();", "dev = virtio_blk_pci_init(bus, PCI_SLOT);", "qpci_msix_enable(dev->pdev);", "qvirtio_pci_set_msix_configuration_vector(dev, alloc, 0);", "VAR_0 = dev->VAR_0 + VIRTIO_PCI_CONFIG_OFF(true);", "capacity = qvirtio_config_readq(&qvirtio_pci, &dev->vdev,\n(uint64_t)(uintptr_t)VAR_0);", "g_assert_cmpint(capacity, ==, TEST_IMAGE_SIZE / 512);", "features = qvirtio_get_features(&qvirtio_pci, &dev->vdev);", "features = features & ~(QVIRTIO_F_BAD_FEATURE |\n(1u << VIRTIO_RING_F_INDIRECT_DESC) |\n(1u << VIRTIO_F_NOTIFY_ON_EMPTY) |\n(1u << VIRTIO_BLK_F_SCSI));", "qvirtio_set_features(&qvirtio_pci, &dev->vdev, features);", "vqpci = (QVirtQueuePCI *)qvirtqueue_setup(&qvirtio_pci, &dev->vdev,\nalloc, 0);", "qvirtqueue_pci_msix_setup(dev, vqpci, alloc, 1);", "qvirtio_set_driver_ok(&qvirtio_pci, &dev->vdev);", "req.type = VIRTIO_BLK_T_OUT;", "req.ioprio = 1;", "req.sector = 0;", "req.VAR_1 = g_malloc0(512);", "strcpy(req.VAR_1, \"TEST\");", "req_addr = virtio_blk_request(alloc, &req, 512);", "g_free(req.VAR_1);", "free_head = qvirtqueue_add(&vqpci->vq, req_addr, 16, false, true);", "qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, false, true);", "qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false);", "qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head);", "qvirtio_wait_queue_isr(&qvirtio_pci, &dev->vdev, &vqpci->vq,\nQVIRTIO_BLK_TIMEOUT_US);", "req.type = VIRTIO_BLK_T_OUT;", "req.ioprio = 1;", "req.sector = 1;", "req.VAR_1 = g_malloc0(512);", "strcpy(req.VAR_1, \"TEST\");", "req_addr = virtio_blk_request(alloc, &req, 512);", "g_free(req.VAR_1);", "qvirtqueue_set_used_event(&vqpci->vq, 2);", "free_head = qvirtqueue_add(&vqpci->vq, req_addr, 16, false, true);", "qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, false, true);", "qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false);", "qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head);", "status = qvirtio_wait_status_byte_no_isr(&qvirtio_pci, &dev->vdev,\n&vqpci->vq, req_addr + 528,\nQVIRTIO_BLK_TIMEOUT_US);", "g_assert_cmpint(status, ==, 0);", "guest_free(alloc, req_addr);", "req.type = VIRTIO_BLK_T_IN;", "req.ioprio = 1;", "req.sector = 1;", "req.VAR_1 = g_malloc0(512);", "req_addr = virtio_blk_request(alloc, &req, 512);", "g_free(req.VAR_1);", "free_head = qvirtqueue_add(&vqpci->vq, req_addr, 16, false, true);", "qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, true, true);", "qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false);", "qvirtqueue_kick(&qvirtio_pci, &dev->vdev, &vqpci->vq, free_head);", "qvirtio_wait_queue_isr(&qvirtio_pci, &dev->vdev, &vqpci->vq,\nQVIRTIO_BLK_TIMEOUT_US);", "status = readb(req_addr + 528);", "g_assert_cmpint(status, ==, 0);", "VAR_1 = g_malloc0(512);", "memread(req_addr + 16, VAR_1, 512);", "g_assert_cmpstr(VAR_1, ==, \"TEST\");", "g_free(VAR_1);", "guest_free(alloc, req_addr);", "guest_free(alloc, vqpci->vq.desc);", "pc_alloc_uninit(alloc);", "qpci_msix_disable(dev->pdev);", "qvirtio_pci_device_disable(dev);", "g_free(dev);", "qpci_free_pc(bus);", "test_end();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 61 ], [ 63, 65, 67, 69 ], [ 71 ], [ 75, 77 ], [ 79 ], [ 83 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119, 121 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 143 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 163, 165, 167 ], [ 169 ], [ 173 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 193 ], [ 197 ], [ 199 ], [ 201 ], [ 205 ], [ 209, 211 ], [ 215 ], [ 217 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ] ]
20,649
static void ref405ep_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; char *filename; ppc4xx_bd_info_t bd; CPUPPCState *env; qemu_irq *pic; MemoryRegion *bios; MemoryRegion *sram = g_new(MemoryRegion, 1); ram_addr_t bdloc; MemoryRegion *ram_memories = g_malloc(2 * sizeof(*ram_memories)); hwaddr ram_bases[2], ram_sizes[2]; target_ulong sram_size; long bios_size; //int phy_addr = 0; //static int phy_addr = 1; target_ulong kernel_base, initrd_base; long kernel_size, initrd_size; int linux_boot; int fl_idx, fl_sectors, len; DriveInfo *dinfo; MemoryRegion *sysmem = get_system_memory(); /* XXX: fix this */ memory_region_allocate_system_memory(&ram_memories[0], NULL, "ef405ep.ram", 0x08000000); ram_bases[0] = 0; ram_sizes[0] = 0x08000000; memory_region_init(&ram_memories[1], NULL, "ef405ep.ram1", 0); ram_bases[1] = 0x00000000; ram_sizes[1] = 0x00000000; ram_size = 128 * 1024 * 1024; #ifdef DEBUG_BOARD_INIT printf("%s: register cpu\n", __func__); #endif env = ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes, 33333333, &pic, kernel_filename == NULL ? 0 : 1); /* allocate SRAM */ sram_size = 512 * 1024; memory_region_init_ram(sram, NULL, "ef405ep.sram", sram_size, &error_abort); vmstate_register_ram_global(sram); memory_region_add_subregion(sysmem, 0xFFF00000, sram); /* allocate and load BIOS */ #ifdef DEBUG_BOARD_INIT printf("%s: register BIOS\n", __func__); #endif fl_idx = 0; #ifdef USE_FLASH_BIOS dinfo = drive_get(IF_PFLASH, 0, fl_idx); if (dinfo) { BlockBackend *blk = blk_by_legacy_dinfo(dinfo); bios_size = blk_getlength(blk); fl_sectors = (bios_size + 65535) >> 16; #ifdef DEBUG_BOARD_INIT printf("Register parallel flash %d size %lx" " at addr %lx '%s' %d\n", fl_idx, bios_size, -bios_size, blk_name(blk), fl_sectors); #endif pflash_cfi02_register((uint32_t)(-bios_size), NULL, "ef405ep.bios", bios_size, blk, 65536, fl_sectors, 1, 2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 1); fl_idx++; } else #endif { #ifdef DEBUG_BOARD_INIT printf("Load BIOS from file\n"); #endif bios = g_new(MemoryRegion, 1); memory_region_init_ram(bios, NULL, "ef405ep.bios", BIOS_SIZE, &error_abort); vmstate_register_ram_global(bios); if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_image(filename, memory_region_get_ram_ptr(bios)); g_free(filename); if (bios_size < 0 || bios_size > BIOS_SIZE) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } bios_size = (bios_size + 0xfff) & ~0xfff; memory_region_add_subregion(sysmem, (uint32_t)(-bios_size), bios); } else if (!qtest_enabled() || kernel_filename != NULL) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } else { /* Avoid an uninitialized variable warning */ bios_size = -1; } memory_region_set_readonly(bios, true); } /* Register FPGA */ #ifdef DEBUG_BOARD_INIT printf("%s: register FPGA\n", __func__); #endif ref405ep_fpga_init(sysmem, 0xF0300000); /* Register NVRAM */ #ifdef DEBUG_BOARD_INIT printf("%s: register NVRAM\n", __func__); #endif m48t59_init(NULL, 0xF0000000, 0, 8192, 1968, 8); /* Load kernel */ linux_boot = (kernel_filename != NULL); if (linux_boot) { #ifdef DEBUG_BOARD_INIT printf("%s: load kernel\n", __func__); #endif memset(&bd, 0, sizeof(bd)); bd.bi_memstart = 0x00000000; bd.bi_memsize = ram_size; bd.bi_flashstart = -bios_size; bd.bi_flashsize = -bios_size; bd.bi_flashoffset = 0; bd.bi_sramstart = 0xFFF00000; bd.bi_sramsize = sram_size; bd.bi_bootflags = 0; bd.bi_intfreq = 133333333; bd.bi_busfreq = 33333333; bd.bi_baudrate = 115200; bd.bi_s_version[0] = 'Q'; bd.bi_s_version[1] = 'M'; bd.bi_s_version[2] = 'U'; bd.bi_s_version[3] = '\0'; bd.bi_r_version[0] = 'Q'; bd.bi_r_version[1] = 'E'; bd.bi_r_version[2] = 'M'; bd.bi_r_version[3] = 'U'; bd.bi_r_version[4] = '\0'; bd.bi_procfreq = 133333333; bd.bi_plb_busfreq = 33333333; bd.bi_pci_busfreq = 33333333; bd.bi_opbfreq = 33333333; bdloc = ppc405_set_bootinfo(env, &bd, 0x00000001); env->gpr[3] = bdloc; kernel_base = KERNEL_LOAD_ADDR; /* now we can load the kernel */ kernel_size = load_image_targphys(kernel_filename, kernel_base, ram_size - kernel_base); if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } printf("Load kernel size %ld at " TARGET_FMT_lx, kernel_size, kernel_base); /* load initrd */ if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } else { initrd_base = 0; initrd_size = 0; } env->gpr[4] = initrd_base; env->gpr[5] = initrd_size; if (kernel_cmdline != NULL) { len = strlen(kernel_cmdline); bdloc -= ((len + 255) & ~255); cpu_physical_memory_write(bdloc, kernel_cmdline, len + 1); env->gpr[6] = bdloc; env->gpr[7] = bdloc + len; } else { env->gpr[6] = 0; env->gpr[7] = 0; } env->nip = KERNEL_LOAD_ADDR; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; bdloc = 0; } #ifdef DEBUG_BOARD_INIT printf("bdloc " RAM_ADDR_FMT "\n", bdloc); printf("%s: Done\n", __func__); #endif }
true
qemu
f8ed85ac992c48814d916d5df4d44f9a971c5de4
static void ref405ep_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; char *filename; ppc4xx_bd_info_t bd; CPUPPCState *env; qemu_irq *pic; MemoryRegion *bios; MemoryRegion *sram = g_new(MemoryRegion, 1); ram_addr_t bdloc; MemoryRegion *ram_memories = g_malloc(2 * sizeof(*ram_memories)); hwaddr ram_bases[2], ram_sizes[2]; target_ulong sram_size; long bios_size; target_ulong kernel_base, initrd_base; long kernel_size, initrd_size; int linux_boot; int fl_idx, fl_sectors, len; DriveInfo *dinfo; MemoryRegion *sysmem = get_system_memory(); memory_region_allocate_system_memory(&ram_memories[0], NULL, "ef405ep.ram", 0x08000000); ram_bases[0] = 0; ram_sizes[0] = 0x08000000; memory_region_init(&ram_memories[1], NULL, "ef405ep.ram1", 0); ram_bases[1] = 0x00000000; ram_sizes[1] = 0x00000000; ram_size = 128 * 1024 * 1024; #ifdef DEBUG_BOARD_INIT printf("%s: register cpu\n", __func__); #endif env = ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes, 33333333, &pic, kernel_filename == NULL ? 0 : 1); sram_size = 512 * 1024; memory_region_init_ram(sram, NULL, "ef405ep.sram", sram_size, &error_abort); vmstate_register_ram_global(sram); memory_region_add_subregion(sysmem, 0xFFF00000, sram); #ifdef DEBUG_BOARD_INIT printf("%s: register BIOS\n", __func__); #endif fl_idx = 0; #ifdef USE_FLASH_BIOS dinfo = drive_get(IF_PFLASH, 0, fl_idx); if (dinfo) { BlockBackend *blk = blk_by_legacy_dinfo(dinfo); bios_size = blk_getlength(blk); fl_sectors = (bios_size + 65535) >> 16; #ifdef DEBUG_BOARD_INIT printf("Register parallel flash %d size %lx" " at addr %lx '%s' %d\n", fl_idx, bios_size, -bios_size, blk_name(blk), fl_sectors); #endif pflash_cfi02_register((uint32_t)(-bios_size), NULL, "ef405ep.bios", bios_size, blk, 65536, fl_sectors, 1, 2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 1); fl_idx++; } else #endif { #ifdef DEBUG_BOARD_INIT printf("Load BIOS from file\n"); #endif bios = g_new(MemoryRegion, 1); memory_region_init_ram(bios, NULL, "ef405ep.bios", BIOS_SIZE, &error_abort); vmstate_register_ram_global(bios); if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_image(filename, memory_region_get_ram_ptr(bios)); g_free(filename); if (bios_size < 0 || bios_size > BIOS_SIZE) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } bios_size = (bios_size + 0xfff) & ~0xfff; memory_region_add_subregion(sysmem, (uint32_t)(-bios_size), bios); } else if (!qtest_enabled() || kernel_filename != NULL) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } else { bios_size = -1; } memory_region_set_readonly(bios, true); } #ifdef DEBUG_BOARD_INIT printf("%s: register FPGA\n", __func__); #endif ref405ep_fpga_init(sysmem, 0xF0300000); #ifdef DEBUG_BOARD_INIT printf("%s: register NVRAM\n", __func__); #endif m48t59_init(NULL, 0xF0000000, 0, 8192, 1968, 8); linux_boot = (kernel_filename != NULL); if (linux_boot) { #ifdef DEBUG_BOARD_INIT printf("%s: load kernel\n", __func__); #endif memset(&bd, 0, sizeof(bd)); bd.bi_memstart = 0x00000000; bd.bi_memsize = ram_size; bd.bi_flashstart = -bios_size; bd.bi_flashsize = -bios_size; bd.bi_flashoffset = 0; bd.bi_sramstart = 0xFFF00000; bd.bi_sramsize = sram_size; bd.bi_bootflags = 0; bd.bi_intfreq = 133333333; bd.bi_busfreq = 33333333; bd.bi_baudrate = 115200; bd.bi_s_version[0] = 'Q'; bd.bi_s_version[1] = 'M'; bd.bi_s_version[2] = 'U'; bd.bi_s_version[3] = '\0'; bd.bi_r_version[0] = 'Q'; bd.bi_r_version[1] = 'E'; bd.bi_r_version[2] = 'M'; bd.bi_r_version[3] = 'U'; bd.bi_r_version[4] = '\0'; bd.bi_procfreq = 133333333; bd.bi_plb_busfreq = 33333333; bd.bi_pci_busfreq = 33333333; bd.bi_opbfreq = 33333333; bdloc = ppc405_set_bootinfo(env, &bd, 0x00000001); env->gpr[3] = bdloc; kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_image_targphys(kernel_filename, kernel_base, ram_size - kernel_base); if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } printf("Load kernel size %ld at " TARGET_FMT_lx, kernel_size, kernel_base); if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } else { initrd_base = 0; initrd_size = 0; } env->gpr[4] = initrd_base; env->gpr[5] = initrd_size; if (kernel_cmdline != NULL) { len = strlen(kernel_cmdline); bdloc -= ((len + 255) & ~255); cpu_physical_memory_write(bdloc, kernel_cmdline, len + 1); env->gpr[6] = bdloc; env->gpr[7] = bdloc + len; } else { env->gpr[6] = 0; env->gpr[7] = 0; } env->nip = KERNEL_LOAD_ADDR; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; bdloc = 0; } #ifdef DEBUG_BOARD_INIT printf("bdloc " RAM_ADDR_FMT "\n", bdloc); printf("%s: Done\n", __func__); #endif }
{ "code": [ " &error_abort);", " &error_abort);", " &error_abort);", " memory_region_init_ram(sram, NULL, \"ef405ep.sram\", sram_size, &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);" ], "line_no": [ 155, 155, 155, 85, 155, 155, 155 ] }
static void FUNC_0(MachineState *VAR_0) { ram_addr_t ram_size = VAR_0->ram_size; const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; const char *VAR_3 = VAR_0->VAR_3; char *VAR_4; ppc4xx_bd_info_t bd; CPUPPCState *env; qemu_irq *pic; MemoryRegion *bios; MemoryRegion *sram = g_new(MemoryRegion, 1); ram_addr_t bdloc; MemoryRegion *ram_memories = g_malloc(2 * sizeof(*ram_memories)); hwaddr ram_bases[2], ram_sizes[2]; target_ulong sram_size; long VAR_5; target_ulong kernel_base, initrd_base; long VAR_6, VAR_7; int VAR_8; int VAR_9, VAR_10, VAR_11; DriveInfo *dinfo; MemoryRegion *sysmem = get_system_memory(); memory_region_allocate_system_memory(&ram_memories[0], NULL, "ef405ep.ram", 0x08000000); ram_bases[0] = 0; ram_sizes[0] = 0x08000000; memory_region_init(&ram_memories[1], NULL, "ef405ep.ram1", 0); ram_bases[1] = 0x00000000; ram_sizes[1] = 0x00000000; ram_size = 128 * 1024 * 1024; #ifdef DEBUG_BOARD_INIT printf("%s: register cpu\n", __func__); #endif env = ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes, 33333333, &pic, VAR_1 == NULL ? 0 : 1); sram_size = 512 * 1024; memory_region_init_ram(sram, NULL, "ef405ep.sram", sram_size, &error_abort); vmstate_register_ram_global(sram); memory_region_add_subregion(sysmem, 0xFFF00000, sram); #ifdef DEBUG_BOARD_INIT printf("%s: register BIOS\n", __func__); #endif VAR_9 = 0; #ifdef USE_FLASH_BIOS dinfo = drive_get(IF_PFLASH, 0, VAR_9); if (dinfo) { BlockBackend *blk = blk_by_legacy_dinfo(dinfo); VAR_5 = blk_getlength(blk); VAR_10 = (VAR_5 + 65535) >> 16; #ifdef DEBUG_BOARD_INIT printf("Register parallel flash %d size %lx" " at addr %lx '%s' %d\n", VAR_9, VAR_5, -VAR_5, blk_name(blk), VAR_10); #endif pflash_cfi02_register((uint32_t)(-VAR_5), NULL, "ef405ep.bios", VAR_5, blk, 65536, VAR_10, 1, 2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 1); VAR_9++; } else #endif { #ifdef DEBUG_BOARD_INIT printf("Load BIOS from file\n"); #endif bios = g_new(MemoryRegion, 1); memory_region_init_ram(bios, NULL, "ef405ep.bios", BIOS_SIZE, &error_abort); vmstate_register_ram_global(bios); if (bios_name == NULL) bios_name = BIOS_FILENAME; VAR_4 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (VAR_4) { VAR_5 = load_image(VAR_4, memory_region_get_ram_ptr(bios)); g_free(VAR_4); if (VAR_5 < 0 || VAR_5 > BIOS_SIZE) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } VAR_5 = (VAR_5 + 0xfff) & ~0xfff; memory_region_add_subregion(sysmem, (uint32_t)(-VAR_5), bios); } else if (!qtest_enabled() || VAR_1 != NULL) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } else { VAR_5 = -1; } memory_region_set_readonly(bios, true); } #ifdef DEBUG_BOARD_INIT printf("%s: register FPGA\n", __func__); #endif ref405ep_fpga_init(sysmem, 0xF0300000); #ifdef DEBUG_BOARD_INIT printf("%s: register NVRAM\n", __func__); #endif m48t59_init(NULL, 0xF0000000, 0, 8192, 1968, 8); VAR_8 = (VAR_1 != NULL); if (VAR_8) { #ifdef DEBUG_BOARD_INIT printf("%s: load kernel\n", __func__); #endif memset(&bd, 0, sizeof(bd)); bd.bi_memstart = 0x00000000; bd.bi_memsize = ram_size; bd.bi_flashstart = -VAR_5; bd.bi_flashsize = -VAR_5; bd.bi_flashoffset = 0; bd.bi_sramstart = 0xFFF00000; bd.bi_sramsize = sram_size; bd.bi_bootflags = 0; bd.bi_intfreq = 133333333; bd.bi_busfreq = 33333333; bd.bi_baudrate = 115200; bd.bi_s_version[0] = 'Q'; bd.bi_s_version[1] = 'M'; bd.bi_s_version[2] = 'U'; bd.bi_s_version[3] = '\0'; bd.bi_r_version[0] = 'Q'; bd.bi_r_version[1] = 'E'; bd.bi_r_version[2] = 'M'; bd.bi_r_version[3] = 'U'; bd.bi_r_version[4] = '\0'; bd.bi_procfreq = 133333333; bd.bi_plb_busfreq = 33333333; bd.bi_pci_busfreq = 33333333; bd.bi_opbfreq = 33333333; bdloc = ppc405_set_bootinfo(env, &bd, 0x00000001); env->gpr[3] = bdloc; kernel_base = KERNEL_LOAD_ADDR; VAR_6 = load_image_targphys(VAR_1, kernel_base, ram_size - kernel_base); if (VAR_6 < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", VAR_1); exit(1); } printf("Load kernel size %ld at " TARGET_FMT_lx, VAR_6, kernel_base); if (VAR_3) { initrd_base = INITRD_LOAD_ADDR; VAR_7 = load_image_targphys(VAR_3, initrd_base, ram_size - initrd_base); if (VAR_7 < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", VAR_3); exit(1); } } else { initrd_base = 0; VAR_7 = 0; } env->gpr[4] = initrd_base; env->gpr[5] = VAR_7; if (VAR_2 != NULL) { VAR_11 = strlen(VAR_2); bdloc -= ((VAR_11 + 255) & ~255); cpu_physical_memory_write(bdloc, VAR_2, VAR_11 + 1); env->gpr[6] = bdloc; env->gpr[7] = bdloc + VAR_11; } else { env->gpr[6] = 0; env->gpr[7] = 0; } env->nip = KERNEL_LOAD_ADDR; } else { kernel_base = 0; VAR_6 = 0; initrd_base = 0; VAR_7 = 0; bdloc = 0; } #ifdef DEBUG_BOARD_INIT printf("bdloc " RAM_ADDR_FMT "\n", bdloc); printf("%s: Done\n", __func__); #endif }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "ram_addr_t ram_size = VAR_0->ram_size;", "const char *VAR_1 = VAR_0->VAR_1;", "const char *VAR_2 = VAR_0->VAR_2;", "const char *VAR_3 = VAR_0->VAR_3;", "char *VAR_4;", "ppc4xx_bd_info_t bd;", "CPUPPCState *env;", "qemu_irq *pic;", "MemoryRegion *bios;", "MemoryRegion *sram = g_new(MemoryRegion, 1);", "ram_addr_t bdloc;", "MemoryRegion *ram_memories = g_malloc(2 * sizeof(*ram_memories));", "hwaddr ram_bases[2], ram_sizes[2];", "target_ulong sram_size;", "long VAR_5;", "target_ulong kernel_base, initrd_base;", "long VAR_6, VAR_7;", "int VAR_8;", "int VAR_9, VAR_10, VAR_11;", "DriveInfo *dinfo;", "MemoryRegion *sysmem = get_system_memory();", "memory_region_allocate_system_memory(&ram_memories[0], NULL, \"ef405ep.ram\",\n0x08000000);", "ram_bases[0] = 0;", "ram_sizes[0] = 0x08000000;", "memory_region_init(&ram_memories[1], NULL, \"ef405ep.ram1\", 0);", "ram_bases[1] = 0x00000000;", "ram_sizes[1] = 0x00000000;", "ram_size = 128 * 1024 * 1024;", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register cpu\\n\", __func__);", "#endif\nenv = ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes,\n33333333, &pic, VAR_1 == NULL ? 0 : 1);", "sram_size = 512 * 1024;", "memory_region_init_ram(sram, NULL, \"ef405ep.sram\", sram_size, &error_abort);", "vmstate_register_ram_global(sram);", "memory_region_add_subregion(sysmem, 0xFFF00000, sram);", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register BIOS\\n\", __func__);", "#endif\nVAR_9 = 0;", "#ifdef USE_FLASH_BIOS\ndinfo = drive_get(IF_PFLASH, 0, VAR_9);", "if (dinfo) {", "BlockBackend *blk = blk_by_legacy_dinfo(dinfo);", "VAR_5 = blk_getlength(blk);", "VAR_10 = (VAR_5 + 65535) >> 16;", "#ifdef DEBUG_BOARD_INIT\nprintf(\"Register parallel flash %d size %lx\"\n\" at addr %lx '%s' %d\\n\",\nVAR_9, VAR_5, -VAR_5,\nblk_name(blk), VAR_10);", "#endif\npflash_cfi02_register((uint32_t)(-VAR_5),\nNULL, \"ef405ep.bios\", VAR_5,\nblk, 65536, VAR_10, 1,\n2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,\n1);", "VAR_9++;", "} else", "#endif\n{", "#ifdef DEBUG_BOARD_INIT\nprintf(\"Load BIOS from file\\n\");", "#endif\nbios = g_new(MemoryRegion, 1);", "memory_region_init_ram(bios, NULL, \"ef405ep.bios\", BIOS_SIZE,\n&error_abort);", "vmstate_register_ram_global(bios);", "if (bios_name == NULL)\nbios_name = BIOS_FILENAME;", "VAR_4 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "if (VAR_4) {", "VAR_5 = load_image(VAR_4, memory_region_get_ram_ptr(bios));", "g_free(VAR_4);", "if (VAR_5 < 0 || VAR_5 > BIOS_SIZE) {", "error_report(\"Could not load PowerPC BIOS '%s'\", bios_name);", "exit(1);", "}", "VAR_5 = (VAR_5 + 0xfff) & ~0xfff;", "memory_region_add_subregion(sysmem, (uint32_t)(-VAR_5), bios);", "} else if (!qtest_enabled() || VAR_1 != NULL) {", "error_report(\"Could not load PowerPC BIOS '%s'\", bios_name);", "exit(1);", "} else {", "VAR_5 = -1;", "}", "memory_region_set_readonly(bios, true);", "}", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register FPGA\\n\", __func__);", "#endif\nref405ep_fpga_init(sysmem, 0xF0300000);", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: register NVRAM\\n\", __func__);", "#endif\nm48t59_init(NULL, 0xF0000000, 0, 8192, 1968, 8);", "VAR_8 = (VAR_1 != NULL);", "if (VAR_8) {", "#ifdef DEBUG_BOARD_INIT\nprintf(\"%s: load kernel\\n\", __func__);", "#endif\nmemset(&bd, 0, sizeof(bd));", "bd.bi_memstart = 0x00000000;", "bd.bi_memsize = ram_size;", "bd.bi_flashstart = -VAR_5;", "bd.bi_flashsize = -VAR_5;", "bd.bi_flashoffset = 0;", "bd.bi_sramstart = 0xFFF00000;", "bd.bi_sramsize = sram_size;", "bd.bi_bootflags = 0;", "bd.bi_intfreq = 133333333;", "bd.bi_busfreq = 33333333;", "bd.bi_baudrate = 115200;", "bd.bi_s_version[0] = 'Q';", "bd.bi_s_version[1] = 'M';", "bd.bi_s_version[2] = 'U';", "bd.bi_s_version[3] = '\\0';", "bd.bi_r_version[0] = 'Q';", "bd.bi_r_version[1] = 'E';", "bd.bi_r_version[2] = 'M';", "bd.bi_r_version[3] = 'U';", "bd.bi_r_version[4] = '\\0';", "bd.bi_procfreq = 133333333;", "bd.bi_plb_busfreq = 33333333;", "bd.bi_pci_busfreq = 33333333;", "bd.bi_opbfreq = 33333333;", "bdloc = ppc405_set_bootinfo(env, &bd, 0x00000001);", "env->gpr[3] = bdloc;", "kernel_base = KERNEL_LOAD_ADDR;", "VAR_6 = load_image_targphys(VAR_1, kernel_base,\nram_size - kernel_base);", "if (VAR_6 < 0) {", "fprintf(stderr, \"qemu: could not load kernel '%s'\\n\",\nVAR_1);", "exit(1);", "}", "printf(\"Load kernel size %ld at \" TARGET_FMT_lx,\nVAR_6, kernel_base);", "if (VAR_3) {", "initrd_base = INITRD_LOAD_ADDR;", "VAR_7 = load_image_targphys(VAR_3, initrd_base,\nram_size - initrd_base);", "if (VAR_7 < 0) {", "fprintf(stderr, \"qemu: could not load initial ram disk '%s'\\n\",\nVAR_3);", "exit(1);", "}", "} else {", "initrd_base = 0;", "VAR_7 = 0;", "}", "env->gpr[4] = initrd_base;", "env->gpr[5] = VAR_7;", "if (VAR_2 != NULL) {", "VAR_11 = strlen(VAR_2);", "bdloc -= ((VAR_11 + 255) & ~255);", "cpu_physical_memory_write(bdloc, VAR_2, VAR_11 + 1);", "env->gpr[6] = bdloc;", "env->gpr[7] = bdloc + VAR_11;", "} else {", "env->gpr[6] = 0;", "env->gpr[7] = 0;", "}", "env->nip = KERNEL_LOAD_ADDR;", "} else {", "kernel_base = 0;", "VAR_6 = 0;", "initrd_base = 0;", "VAR_7 = 0;", "bdloc = 0;", "}", "#ifdef DEBUG_BOARD_INIT\nprintf(\"bdloc \" RAM_ADDR_FMT \"\\n\", bdloc);", "printf(\"%s: Done\\n\", __func__);", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75, 77, 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93, 95 ], [ 97, 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115, 117, 119, 121, 123 ], [ 125, 127, 129, 131, 133, 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145, 147 ], [ 149, 151 ], [ 153, 155 ], [ 157 ], [ 161, 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205, 207 ], [ 209, 211 ], [ 215, 217 ], [ 219, 221 ], [ 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 ], [ 293, 295 ], [ 297 ], [ 299, 301 ], [ 303 ], [ 305 ], [ 307, 309 ], [ 313 ], [ 315 ], [ 317, 319 ], [ 321 ], [ 323, 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379, 381 ], [ 383 ], [ 385, 387 ] ]
20,650
int bdrv_check(BlockDriverState *bs) { if (bs->drv->bdrv_check == NULL) { return -ENOTSUP; } return bs->drv->bdrv_check(bs); }
true
qemu
e076f3383b08a563d76c8beb9a716788a3987df9
int bdrv_check(BlockDriverState *bs) { if (bs->drv->bdrv_check == NULL) { return -ENOTSUP; } return bs->drv->bdrv_check(bs); }
{ "code": [ "int bdrv_check(BlockDriverState *bs)", " return bs->drv->bdrv_check(bs);" ], "line_no": [ 1, 13 ] }
int FUNC_0(BlockDriverState *VAR_0) { if (VAR_0->drv->FUNC_0 == NULL) { return -ENOTSUP; } return VAR_0->drv->FUNC_0(VAR_0); }
[ "int FUNC_0(BlockDriverState *VAR_0)\n{", "if (VAR_0->drv->FUNC_0 == NULL) {", "return -ENOTSUP;", "}", "return VAR_0->drv->FUNC_0(VAR_0);", "}" ]
[ 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ] ]
20,651
static always_inline void gen_op_arith_add(DisasContext *ctx, TCGv ret, TCGv arg1, TCGv arg2, int add_ca, int compute_ca, int compute_ov) { TCGv t0, t1; if ((!compute_ca && !compute_ov) || (!TCGV_EQUAL(ret,arg1) && !TCGV_EQUAL(ret, arg2))) { t0 = ret; t0 = tcg_temp_local_new(); } if (add_ca) { t1 = tcg_temp_local_new(); tcg_gen_andi_tl(t1, cpu_xer, (1 << XER_CA)); tcg_gen_shri_tl(t1, t1, XER_CA); } if (compute_ca && compute_ov) { /* Start with XER CA and OV disabled, the most likely case */ tcg_gen_andi_tl(cpu_xer, cpu_xer, ~((1 << XER_CA) | (1 << XER_OV))); } else if (compute_ca) { /* Start with XER CA disabled, the most likely case */ tcg_gen_andi_tl(cpu_xer, cpu_xer, ~(1 << XER_CA)); } else if (compute_ov) { /* Start with XER OV disabled, the most likely case */ tcg_gen_andi_tl(cpu_xer, cpu_xer, ~(1 << XER_OV)); } tcg_gen_add_tl(t0, arg1, arg2); if (compute_ca) { gen_op_arith_compute_ca(ctx, t0, arg1, 0); } if (add_ca) { tcg_gen_add_tl(t0, t0, t1); gen_op_arith_compute_ca(ctx, t0, t1, 0); tcg_temp_free(t1); } if (compute_ov) { gen_op_arith_compute_ov(ctx, t0, arg1, arg2, 0); } if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, t0); if (!TCGV_EQUAL(t0, ret)) { tcg_gen_mov_tl(ret, t0); tcg_temp_free(t0); } }
true
qemu
d2e9fd8f703203c2eeeed120b1ef6c3a6574e0ab
static always_inline void gen_op_arith_add(DisasContext *ctx, TCGv ret, TCGv arg1, TCGv arg2, int add_ca, int compute_ca, int compute_ov) { TCGv t0, t1; if ((!compute_ca && !compute_ov) || (!TCGV_EQUAL(ret,arg1) && !TCGV_EQUAL(ret, arg2))) { t0 = ret; t0 = tcg_temp_local_new(); } if (add_ca) { t1 = tcg_temp_local_new(); tcg_gen_andi_tl(t1, cpu_xer, (1 << XER_CA)); tcg_gen_shri_tl(t1, t1, XER_CA); } if (compute_ca && compute_ov) { tcg_gen_andi_tl(cpu_xer, cpu_xer, ~((1 << XER_CA) | (1 << XER_OV))); } else if (compute_ca) { tcg_gen_andi_tl(cpu_xer, cpu_xer, ~(1 << XER_CA)); } else if (compute_ov) { tcg_gen_andi_tl(cpu_xer, cpu_xer, ~(1 << XER_OV)); } tcg_gen_add_tl(t0, arg1, arg2); if (compute_ca) { gen_op_arith_compute_ca(ctx, t0, arg1, 0); } if (add_ca) { tcg_gen_add_tl(t0, t0, t1); gen_op_arith_compute_ca(ctx, t0, t1, 0); tcg_temp_free(t1); } if (compute_ov) { gen_op_arith_compute_ov(ctx, t0, arg1, arg2, 0); } if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, t0); if (!TCGV_EQUAL(t0, ret)) { tcg_gen_mov_tl(ret, t0); tcg_temp_free(t0); } }
{ "code": [], "line_no": [] }
static always_inline void FUNC_0(DisasContext *ctx, TCGv ret, TCGv arg1, TCGv arg2, int add_ca, int compute_ca, int compute_ov) { TCGv t0, t1; if ((!compute_ca && !compute_ov) || (!TCGV_EQUAL(ret,arg1) && !TCGV_EQUAL(ret, arg2))) { t0 = ret; t0 = tcg_temp_local_new(); } if (add_ca) { t1 = tcg_temp_local_new(); tcg_gen_andi_tl(t1, cpu_xer, (1 << XER_CA)); tcg_gen_shri_tl(t1, t1, XER_CA); } if (compute_ca && compute_ov) { tcg_gen_andi_tl(cpu_xer, cpu_xer, ~((1 << XER_CA) | (1 << XER_OV))); } else if (compute_ca) { tcg_gen_andi_tl(cpu_xer, cpu_xer, ~(1 << XER_CA)); } else if (compute_ov) { tcg_gen_andi_tl(cpu_xer, cpu_xer, ~(1 << XER_OV)); } tcg_gen_add_tl(t0, arg1, arg2); if (compute_ca) { gen_op_arith_compute_ca(ctx, t0, arg1, 0); } if (add_ca) { tcg_gen_add_tl(t0, t0, t1); gen_op_arith_compute_ca(ctx, t0, t1, 0); tcg_temp_free(t1); } if (compute_ov) { gen_op_arith_compute_ov(ctx, t0, arg1, arg2, 0); } if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, t0); if (!TCGV_EQUAL(t0, ret)) { tcg_gen_mov_tl(ret, t0); tcg_temp_free(t0); } }
[ "static always_inline void FUNC_0(DisasContext *ctx, TCGv ret, TCGv arg1, TCGv arg2,\nint add_ca, int compute_ca, int compute_ov)\n{", "TCGv t0, t1;", "if ((!compute_ca && !compute_ov) ||\n(!TCGV_EQUAL(ret,arg1) && !TCGV_EQUAL(ret, arg2))) {", "t0 = ret;", "t0 = tcg_temp_local_new();", "}", "if (add_ca) {", "t1 = tcg_temp_local_new();", "tcg_gen_andi_tl(t1, cpu_xer, (1 << XER_CA));", "tcg_gen_shri_tl(t1, t1, XER_CA);", "}", "if (compute_ca && compute_ov) {", "tcg_gen_andi_tl(cpu_xer, cpu_xer, ~((1 << XER_CA) | (1 << XER_OV)));", "} else if (compute_ca) {", "tcg_gen_andi_tl(cpu_xer, cpu_xer, ~(1 << XER_CA));", "} else if (compute_ov) {", "tcg_gen_andi_tl(cpu_xer, cpu_xer, ~(1 << XER_OV));", "}", "tcg_gen_add_tl(t0, arg1, arg2);", "if (compute_ca) {", "gen_op_arith_compute_ca(ctx, t0, arg1, 0);", "}", "if (add_ca) {", "tcg_gen_add_tl(t0, t0, t1);", "gen_op_arith_compute_ca(ctx, t0, t1, 0);", "tcg_temp_free(t1);", "}", "if (compute_ov) {", "gen_op_arith_compute_ov(ctx, t0, arg1, arg2, 0);", "}", "if (unlikely(Rc(ctx->opcode) != 0))\ngen_set_Rc0(ctx, t0);", "if (!TCGV_EQUAL(t0, ret)) {", "tcg_gen_mov_tl(ret, t0);", "tcg_temp_free(t0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 18 ], [ 20 ], [ 24 ], [ 26 ], [ 28 ], [ 30 ], [ 34 ], [ 38 ], [ 42 ], [ 44 ], [ 48 ], [ 50 ], [ 54 ], [ 56 ], [ 60 ], [ 64 ], [ 66 ], [ 68 ], [ 70 ], [ 72 ], [ 74 ], [ 76 ], [ 78 ], [ 80 ], [ 82 ], [ 84 ], [ 88, 90 ], [ 94 ], [ 96 ], [ 98 ], [ 100 ], [ 102 ] ]
20,652
static void test_i440fx_pam(gconstpointer opaque) { const TestData *s = opaque; QPCIBus *bus; QPCIDevice *dev; int i; static struct { uint32_t start; uint32_t end; } pam_area[] = { { 0, 0 }, /* Reserved */ { 0xF0000, 0xFFFFF }, /* BIOS Area */ { 0xC0000, 0xC3FFF }, /* Option ROM */ { 0xC4000, 0xC7FFF }, /* Option ROM */ { 0xC8000, 0xCBFFF }, /* Option ROM */ { 0xCC000, 0xCFFFF }, /* Option ROM */ { 0xD0000, 0xD3FFF }, /* Option ROM */ { 0xD4000, 0xD7FFF }, /* Option ROM */ { 0xD8000, 0xDBFFF }, /* Option ROM */ { 0xDC000, 0xDFFFF }, /* Option ROM */ { 0xE0000, 0xE3FFF }, /* BIOS Extension */ { 0xE4000, 0xE7FFF }, /* BIOS Extension */ { 0xE8000, 0xEBFFF }, /* BIOS Extension */ { 0xEC000, 0xEFFFF }, /* BIOS Extension */ }; bus = test_start_get_bus(s); dev = qpci_device_find(bus, QPCI_DEVFN(0, 0)); g_assert(dev != NULL); for (i = 0; i < ARRAY_SIZE(pam_area); i++) { if (pam_area[i].start == pam_area[i].end) { continue; } g_test_message("Checking area 0x%05x..0x%05x", pam_area[i].start, pam_area[i].end); /* Switch to RE for the area */ pam_set(dev, i, PAM_RE); /* Verify the RAM is all zeros */ g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0)); /* Switch to WE for the area */ pam_set(dev, i, PAM_RE | PAM_WE); /* Write out a non-zero mask to the full area */ write_area(pam_area[i].start, pam_area[i].end, 0x42); #ifndef BROKEN /* QEMU only supports a limited form of PAM */ /* Switch to !RE for the area */ pam_set(dev, i, PAM_WE); /* Verify the area is not our mask */ g_assert(!verify_area(pam_area[i].start, pam_area[i].end, 0x42)); #endif /* Verify the area is our new mask */ g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0x42)); /* Write out a new mask */ write_area(pam_area[i].start, pam_area[i].end, 0x82); #ifndef BROKEN /* QEMU only supports a limited form of PAM */ /* Verify the area is not our mask */ g_assert(!verify_area(pam_area[i].start, pam_area[i].end, 0x82)); /* Switch to RE for the area */ pam_set(dev, i, PAM_RE | PAM_WE); #endif /* Verify the area is our new mask */ g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0x82)); /* Reset area */ pam_set(dev, i, 0); /* Verify the area is not our new mask */ g_assert(!verify_area(pam_area[i].start, pam_area[i].end, 0x82)); } qtest_end(); }
true
qemu
1bab33ab4ab4702f53012551cad333beb270f30d
static void test_i440fx_pam(gconstpointer opaque) { const TestData *s = opaque; QPCIBus *bus; QPCIDevice *dev; int i; static struct { uint32_t start; uint32_t end; } pam_area[] = { { 0, 0 }, { 0xF0000, 0xFFFFF }, { 0xC0000, 0xC3FFF }, { 0xC4000, 0xC7FFF }, { 0xC8000, 0xCBFFF }, { 0xCC000, 0xCFFFF }, { 0xD0000, 0xD3FFF }, { 0xD4000, 0xD7FFF }, { 0xD8000, 0xDBFFF }, { 0xDC000, 0xDFFFF }, { 0xE0000, 0xE3FFF }, { 0xE4000, 0xE7FFF }, { 0xE8000, 0xEBFFF }, { 0xEC000, 0xEFFFF }, }; bus = test_start_get_bus(s); dev = qpci_device_find(bus, QPCI_DEVFN(0, 0)); g_assert(dev != NULL); for (i = 0; i < ARRAY_SIZE(pam_area); i++) { if (pam_area[i].start == pam_area[i].end) { continue; } g_test_message("Checking area 0x%05x..0x%05x", pam_area[i].start, pam_area[i].end); pam_set(dev, i, PAM_RE); g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0)); pam_set(dev, i, PAM_RE | PAM_WE); write_area(pam_area[i].start, pam_area[i].end, 0x42); #ifndef BROKEN pam_set(dev, i, PAM_WE); g_assert(!verify_area(pam_area[i].start, pam_area[i].end, 0x42)); #endif g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0x42)); write_area(pam_area[i].start, pam_area[i].end, 0x82); #ifndef BROKEN g_assert(!verify_area(pam_area[i].start, pam_area[i].end, 0x82)); pam_set(dev, i, PAM_RE | PAM_WE); #endif g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0x82)); pam_set(dev, i, 0); g_assert(!verify_area(pam_area[i].start, pam_area[i].end, 0x82)); } qtest_end(); }
{ "code": [], "line_no": [] }
static void FUNC_0(gconstpointer VAR_0) { const TestData *VAR_1 = VAR_0; QPCIBus *bus; QPCIDevice *dev; int VAR_2; static struct { uint32_t start; uint32_t end; } VAR_3[] = { { 0, 0 }, { 0xF0000, 0xFFFFF }, { 0xC0000, 0xC3FFF }, { 0xC4000, 0xC7FFF }, { 0xC8000, 0xCBFFF }, { 0xCC000, 0xCFFFF }, { 0xD0000, 0xD3FFF }, { 0xD4000, 0xD7FFF }, { 0xD8000, 0xDBFFF }, { 0xDC000, 0xDFFFF }, { 0xE0000, 0xE3FFF }, { 0xE4000, 0xE7FFF }, { 0xE8000, 0xEBFFF }, { 0xEC000, 0xEFFFF }, }; bus = test_start_get_bus(VAR_1); dev = qpci_device_find(bus, QPCI_DEVFN(0, 0)); g_assert(dev != NULL); for (VAR_2 = 0; VAR_2 < ARRAY_SIZE(VAR_3); VAR_2++) { if (VAR_3[VAR_2].start == VAR_3[VAR_2].end) { continue; } g_test_message("Checking area 0x%05x..0x%05x", VAR_3[VAR_2].start, VAR_3[VAR_2].end); pam_set(dev, VAR_2, PAM_RE); g_assert(verify_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0)); pam_set(dev, VAR_2, PAM_RE | PAM_WE); write_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x42); #ifndef BROKEN pam_set(dev, VAR_2, PAM_WE); g_assert(!verify_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x42)); #endif g_assert(verify_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x42)); write_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x82); #ifndef BROKEN g_assert(!verify_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x82)); pam_set(dev, VAR_2, PAM_RE | PAM_WE); #endif g_assert(verify_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x82)); pam_set(dev, VAR_2, 0); g_assert(!verify_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x82)); } qtest_end(); }
[ "static void FUNC_0(gconstpointer VAR_0)\n{", "const TestData *VAR_1 = VAR_0;", "QPCIBus *bus;", "QPCIDevice *dev;", "int VAR_2;", "static struct {", "uint32_t start;", "uint32_t end;", "} VAR_3[] = {", "{ 0, 0 },", "{ 0xF0000, 0xFFFFF },", "{ 0xC0000, 0xC3FFF },", "{ 0xC4000, 0xC7FFF },", "{ 0xC8000, 0xCBFFF },", "{ 0xCC000, 0xCFFFF },", "{ 0xD0000, 0xD3FFF },", "{ 0xD4000, 0xD7FFF },", "{ 0xD8000, 0xDBFFF },", "{ 0xDC000, 0xDFFFF },", "{ 0xE0000, 0xE3FFF },", "{ 0xE4000, 0xE7FFF },", "{ 0xE8000, 0xEBFFF },", "{ 0xEC000, 0xEFFFF },", "};", "bus = test_start_get_bus(VAR_1);", "dev = qpci_device_find(bus, QPCI_DEVFN(0, 0));", "g_assert(dev != NULL);", "for (VAR_2 = 0; VAR_2 < ARRAY_SIZE(VAR_3); VAR_2++) {", "if (VAR_3[VAR_2].start == VAR_3[VAR_2].end) {", "continue;", "}", "g_test_message(\"Checking area 0x%05x..0x%05x\",\nVAR_3[VAR_2].start, VAR_3[VAR_2].end);", "pam_set(dev, VAR_2, PAM_RE);", "g_assert(verify_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0));", "pam_set(dev, VAR_2, PAM_RE | PAM_WE);", "write_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x42);", "#ifndef BROKEN\npam_set(dev, VAR_2, PAM_WE);", "g_assert(!verify_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x42));", "#endif\ng_assert(verify_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x42));", "write_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x82);", "#ifndef BROKEN\ng_assert(!verify_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x82));", "pam_set(dev, VAR_2, PAM_RE | PAM_WE);", "#endif\ng_assert(verify_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x82));", "pam_set(dev, VAR_2, 0);", "g_assert(!verify_area(VAR_3[VAR_2].start, VAR_3[VAR_2].end, 0x82));", "}", "qtest_end();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33, 34 ], [ 36 ], [ 38 ], [ 40 ], [ 42 ], [ 43, 46 ], [ 48 ], [ 49, 51 ], [ 53 ], [ 54, 57 ], [ 59 ], [ 60, 62 ], [ 64 ], [ 66 ], [ 67 ], [ 68 ], [ 69 ] ]
20,653
static uint64_t alloc_cluster_offset(BlockDriverState *bs, uint64_t offset, int n_start, int n_end, int *num) { BDRVQcowState *s = bs->opaque; int l2_index, ret; uint64_t l2_offset, *l2_table, cluster_offset; int nb_available, nb_clusters, i = 0; uint64_t start_sect; ret = get_cluster_table(bs, offset, &l2_table, &l2_offset, &l2_index); if (ret == 0) return 0; nb_clusters = size_to_clusters(s, n_end << 9); if (nb_clusters > s->l2_size - l2_index) nb_clusters = s->l2_size - l2_index; cluster_offset = be64_to_cpu(l2_table[l2_index]); /* We keep all QCOW_OFLAG_COPIED clusters */ if (cluster_offset & QCOW_OFLAG_COPIED) { nb_clusters = count_contiguous_clusters(nb_clusters, s->cluster_size, &l2_table[l2_index], 0); nb_available = nb_clusters << (s->cluster_bits - 9); if (nb_available > n_end) nb_available = n_end; cluster_offset &= ~QCOW_OFLAG_COPIED; goto out; } /* for the moment, multiple compressed clusters are not managed */ if (cluster_offset & QCOW_OFLAG_COMPRESSED) nb_clusters = 1; /* how many available clusters ? */ while (i < nb_clusters) { int j; i += count_contiguous_free_clusters(nb_clusters - i, &l2_table[l2_index + i]); cluster_offset = be64_to_cpu(l2_table[l2_index + i]); if ((cluster_offset & QCOW_OFLAG_COPIED) || (cluster_offset & QCOW_OFLAG_COMPRESSED)) break; j = count_contiguous_clusters(nb_clusters - i, s->cluster_size, &l2_table[l2_index + i], 0); if (j) free_any_clusters(bs, cluster_offset, j); i += j; if(be64_to_cpu(l2_table[l2_index + i])) break; } nb_clusters = i; /* allocate a new cluster */ cluster_offset = alloc_clusters(bs, nb_clusters * s->cluster_size); /* we must initialize the cluster content which won't be written */ nb_available = nb_clusters << (s->cluster_bits - 9); if (nb_available > n_end) nb_available = n_end; /* copy content of unmodified sectors */ start_sect = (offset & ~(s->cluster_size - 1)) >> 9; if (n_start) { ret = copy_sectors(bs, start_sect, cluster_offset, 0, n_start); if (ret < 0) return 0; } if (nb_available & (s->cluster_sectors - 1)) { uint64_t end = nb_available & ~(uint64_t)(s->cluster_sectors - 1); ret = copy_sectors(bs, start_sect + end, cluster_offset + (end << 9), nb_available - end, s->cluster_sectors); if (ret < 0) return 0; } /* update L2 table */ for (i = 0; i < nb_clusters; i++) l2_table[l2_index + i] = cpu_to_be64((cluster_offset + (i << s->cluster_bits)) | QCOW_OFLAG_COPIED); if (bdrv_pwrite(s->hd, l2_offset + l2_index * sizeof(uint64_t), l2_table + l2_index, nb_clusters * sizeof(uint64_t)) != nb_clusters * sizeof(uint64_t)) return 0; out: *num = nb_available - n_start; return cluster_offset; }
true
qemu
e976c6a1e40ad74d616a186d3b48b0ad8f5eb970
static uint64_t alloc_cluster_offset(BlockDriverState *bs, uint64_t offset, int n_start, int n_end, int *num) { BDRVQcowState *s = bs->opaque; int l2_index, ret; uint64_t l2_offset, *l2_table, cluster_offset; int nb_available, nb_clusters, i = 0; uint64_t start_sect; ret = get_cluster_table(bs, offset, &l2_table, &l2_offset, &l2_index); if (ret == 0) return 0; nb_clusters = size_to_clusters(s, n_end << 9); if (nb_clusters > s->l2_size - l2_index) nb_clusters = s->l2_size - l2_index; cluster_offset = be64_to_cpu(l2_table[l2_index]); if (cluster_offset & QCOW_OFLAG_COPIED) { nb_clusters = count_contiguous_clusters(nb_clusters, s->cluster_size, &l2_table[l2_index], 0); nb_available = nb_clusters << (s->cluster_bits - 9); if (nb_available > n_end) nb_available = n_end; cluster_offset &= ~QCOW_OFLAG_COPIED; goto out; } if (cluster_offset & QCOW_OFLAG_COMPRESSED) nb_clusters = 1; while (i < nb_clusters) { int j; i += count_contiguous_free_clusters(nb_clusters - i, &l2_table[l2_index + i]); cluster_offset = be64_to_cpu(l2_table[l2_index + i]); if ((cluster_offset & QCOW_OFLAG_COPIED) || (cluster_offset & QCOW_OFLAG_COMPRESSED)) break; j = count_contiguous_clusters(nb_clusters - i, s->cluster_size, &l2_table[l2_index + i], 0); if (j) free_any_clusters(bs, cluster_offset, j); i += j; if(be64_to_cpu(l2_table[l2_index + i])) break; } nb_clusters = i; cluster_offset = alloc_clusters(bs, nb_clusters * s->cluster_size); nb_available = nb_clusters << (s->cluster_bits - 9); if (nb_available > n_end) nb_available = n_end; start_sect = (offset & ~(s->cluster_size - 1)) >> 9; if (n_start) { ret = copy_sectors(bs, start_sect, cluster_offset, 0, n_start); if (ret < 0) return 0; } if (nb_available & (s->cluster_sectors - 1)) { uint64_t end = nb_available & ~(uint64_t)(s->cluster_sectors - 1); ret = copy_sectors(bs, start_sect + end, cluster_offset + (end << 9), nb_available - end, s->cluster_sectors); if (ret < 0) return 0; } for (i = 0; i < nb_clusters; i++) l2_table[l2_index + i] = cpu_to_be64((cluster_offset + (i << s->cluster_bits)) | QCOW_OFLAG_COPIED); if (bdrv_pwrite(s->hd, l2_offset + l2_index * sizeof(uint64_t), l2_table + l2_index, nb_clusters * sizeof(uint64_t)) != nb_clusters * sizeof(uint64_t)) return 0; out: *num = nb_available - n_start; return cluster_offset; }
{ "code": [ " int *num)", " int nb_available, nb_clusters, i = 0;", " uint64_t start_sect;", " if (nb_clusters > s->l2_size - l2_index)", " nb_clusters = s->l2_size - l2_index;", " nb_available = nb_clusters << (s->cluster_bits - 9);", " if (nb_available > n_end)", " nb_available = n_end;", " int j;", " j = count_contiguous_clusters(nb_clusters - i, s->cluster_size,", " if (j)", " free_any_clusters(bs, cluster_offset, j);", " i += j;", " nb_available = nb_clusters << (s->cluster_bits - 9);", " if (nb_available > n_end)", " nb_available = n_end;", " start_sect = (offset & ~(s->cluster_size - 1)) >> 9;", " if (n_start) {", " ret = copy_sectors(bs, start_sect, cluster_offset, 0, n_start);", " if (ret < 0)", " return 0;", " if (nb_available & (s->cluster_sectors - 1)) {", " uint64_t end = nb_available & ~(uint64_t)(s->cluster_sectors - 1);", " ret = copy_sectors(bs, start_sect + end,", " cluster_offset + (end << 9),", " nb_available - end,", " s->cluster_sectors);", " if (ret < 0)", " return 0;", " for (i = 0; i < nb_clusters; i++)", " l2_table[l2_index + i] = cpu_to_be64((cluster_offset +", " (i << s->cluster_bits)) |", " QCOW_OFLAG_COPIED);", " if (bdrv_pwrite(s->hd,", " l2_offset + l2_index * sizeof(uint64_t),", " l2_table + l2_index,", " nb_clusters * sizeof(uint64_t)) !=", " nb_clusters * sizeof(uint64_t))", " return 0;", " *num = nb_available - n_start;" ], "line_no": [ 7, 17, 19, 35, 37, 57, 59, 61, 91, 111, 117, 119, 123, 151, 153, 155, 163, 165, 167, 169, 171, 177, 179, 181, 183, 185, 187, 169, 171, 201, 203, 205, 207, 211, 213, 215, 217, 219, 27, 227 ] }
static uint64_t FUNC_0(BlockDriverState *bs, uint64_t offset, int n_start, int n_end, int *num) { BDRVQcowState *s = bs->opaque; int VAR_0, VAR_1; uint64_t l2_offset, *l2_table, cluster_offset; int VAR_2, VAR_3, VAR_4 = 0; uint64_t start_sect; VAR_1 = get_cluster_table(bs, offset, &l2_table, &l2_offset, &VAR_0); if (VAR_1 == 0) return 0; VAR_3 = size_to_clusters(s, n_end << 9); if (VAR_3 > s->l2_size - VAR_0) VAR_3 = s->l2_size - VAR_0; cluster_offset = be64_to_cpu(l2_table[VAR_0]); if (cluster_offset & QCOW_OFLAG_COPIED) { VAR_3 = count_contiguous_clusters(VAR_3, s->cluster_size, &l2_table[VAR_0], 0); VAR_2 = VAR_3 << (s->cluster_bits - 9); if (VAR_2 > n_end) VAR_2 = n_end; cluster_offset &= ~QCOW_OFLAG_COPIED; goto out; } if (cluster_offset & QCOW_OFLAG_COMPRESSED) VAR_3 = 1; while (VAR_4 < VAR_3) { int VAR_5; VAR_4 += count_contiguous_free_clusters(VAR_3 - VAR_4, &l2_table[VAR_0 + VAR_4]); cluster_offset = be64_to_cpu(l2_table[VAR_0 + VAR_4]); if ((cluster_offset & QCOW_OFLAG_COPIED) || (cluster_offset & QCOW_OFLAG_COMPRESSED)) break; VAR_5 = count_contiguous_clusters(VAR_3 - VAR_4, s->cluster_size, &l2_table[VAR_0 + VAR_4], 0); if (VAR_5) free_any_clusters(bs, cluster_offset, VAR_5); VAR_4 += VAR_5; if(be64_to_cpu(l2_table[VAR_0 + VAR_4])) break; } VAR_3 = VAR_4; cluster_offset = alloc_clusters(bs, VAR_3 * s->cluster_size); VAR_2 = VAR_3 << (s->cluster_bits - 9); if (VAR_2 > n_end) VAR_2 = n_end; start_sect = (offset & ~(s->cluster_size - 1)) >> 9; if (n_start) { VAR_1 = copy_sectors(bs, start_sect, cluster_offset, 0, n_start); if (VAR_1 < 0) return 0; } if (VAR_2 & (s->cluster_sectors - 1)) { uint64_t end = VAR_2 & ~(uint64_t)(s->cluster_sectors - 1); VAR_1 = copy_sectors(bs, start_sect + end, cluster_offset + (end << 9), VAR_2 - end, s->cluster_sectors); if (VAR_1 < 0) return 0; } for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) l2_table[VAR_0 + VAR_4] = cpu_to_be64((cluster_offset + (VAR_4 << s->cluster_bits)) | QCOW_OFLAG_COPIED); if (bdrv_pwrite(s->hd, l2_offset + VAR_0 * sizeof(uint64_t), l2_table + VAR_0, VAR_3 * sizeof(uint64_t)) != VAR_3 * sizeof(uint64_t)) return 0; out: *num = VAR_2 - n_start; return cluster_offset; }
[ "static uint64_t FUNC_0(BlockDriverState *bs,\nuint64_t offset,\nint n_start, int n_end,\nint *num)\n{", "BDRVQcowState *s = bs->opaque;", "int VAR_0, VAR_1;", "uint64_t l2_offset, *l2_table, cluster_offset;", "int VAR_2, VAR_3, VAR_4 = 0;", "uint64_t start_sect;", "VAR_1 = get_cluster_table(bs, offset, &l2_table, &l2_offset, &VAR_0);", "if (VAR_1 == 0)\nreturn 0;", "VAR_3 = size_to_clusters(s, n_end << 9);", "if (VAR_3 > s->l2_size - VAR_0)\nVAR_3 = s->l2_size - VAR_0;", "cluster_offset = be64_to_cpu(l2_table[VAR_0]);", "if (cluster_offset & QCOW_OFLAG_COPIED) {", "VAR_3 = count_contiguous_clusters(VAR_3, s->cluster_size,\n&l2_table[VAR_0], 0);", "VAR_2 = VAR_3 << (s->cluster_bits - 9);", "if (VAR_2 > n_end)\nVAR_2 = n_end;", "cluster_offset &= ~QCOW_OFLAG_COPIED;", "goto out;", "}", "if (cluster_offset & QCOW_OFLAG_COMPRESSED)\nVAR_3 = 1;", "while (VAR_4 < VAR_3) {", "int VAR_5;", "VAR_4 += count_contiguous_free_clusters(VAR_3 - VAR_4,\n&l2_table[VAR_0 + VAR_4]);", "cluster_offset = be64_to_cpu(l2_table[VAR_0 + VAR_4]);", "if ((cluster_offset & QCOW_OFLAG_COPIED) ||\n(cluster_offset & QCOW_OFLAG_COMPRESSED))\nbreak;", "VAR_5 = count_contiguous_clusters(VAR_3 - VAR_4, s->cluster_size,\n&l2_table[VAR_0 + VAR_4], 0);", "if (VAR_5)\nfree_any_clusters(bs, cluster_offset, VAR_5);", "VAR_4 += VAR_5;", "if(be64_to_cpu(l2_table[VAR_0 + VAR_4]))\nbreak;", "}", "VAR_3 = VAR_4;", "cluster_offset = alloc_clusters(bs, VAR_3 * s->cluster_size);", "VAR_2 = VAR_3 << (s->cluster_bits - 9);", "if (VAR_2 > n_end)\nVAR_2 = n_end;", "start_sect = (offset & ~(s->cluster_size - 1)) >> 9;", "if (n_start) {", "VAR_1 = copy_sectors(bs, start_sect, cluster_offset, 0, n_start);", "if (VAR_1 < 0)\nreturn 0;", "}", "if (VAR_2 & (s->cluster_sectors - 1)) {", "uint64_t end = VAR_2 & ~(uint64_t)(s->cluster_sectors - 1);", "VAR_1 = copy_sectors(bs, start_sect + end,\ncluster_offset + (end << 9),\nVAR_2 - end,\ns->cluster_sectors);", "if (VAR_1 < 0)\nreturn 0;", "}", "for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++)", "l2_table[VAR_0 + VAR_4] = cpu_to_be64((cluster_offset +\n(VAR_4 << s->cluster_bits)) |\nQCOW_OFLAG_COPIED);", "if (bdrv_pwrite(s->hd,\nl2_offset + VAR_0 * sizeof(uint64_t),\nl2_table + VAR_0,\nVAR_3 * sizeof(uint64_t)) !=\nVAR_3 * sizeof(uint64_t))\nreturn 0;", "out:\n*num = VAR_2 - n_start;", "return cluster_offset;", "}" ]
[ 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 35, 37 ], [ 41 ], [ 49 ], [ 51, 53 ], [ 57 ], [ 59, 61 ], [ 65 ], [ 69 ], [ 71 ], [ 79, 81 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 99 ], [ 103, 105, 107 ], [ 111, 113 ], [ 117, 119 ], [ 123 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 141 ], [ 151 ], [ 153, 155 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181, 183, 185, 187 ], [ 189, 191 ], [ 193 ], [ 201 ], [ 203, 205, 207 ], [ 211, 213, 215, 217, 219, 221 ], [ 225, 227 ], [ 231 ], [ 233 ] ]
20,654
void bdrv_io_limits_enable(BlockDriverState *bs) { assert(!bs->io_limits_enabled); throttle_init(&bs->throttle_state, bdrv_get_aio_context(bs), QEMU_CLOCK_VIRTUAL, bdrv_throttle_read_timer_cb, bdrv_throttle_write_timer_cb, bs); bs->io_limits_enabled = true; }
true
qemu
de50a20a4cc368d241d67c600f8c0f667186a8b5
void bdrv_io_limits_enable(BlockDriverState *bs) { assert(!bs->io_limits_enabled); throttle_init(&bs->throttle_state, bdrv_get_aio_context(bs), QEMU_CLOCK_VIRTUAL, bdrv_throttle_read_timer_cb, bdrv_throttle_write_timer_cb, bs); bs->io_limits_enabled = true; }
{ "code": [ " QEMU_CLOCK_VIRTUAL," ], "line_no": [ 11 ] }
void FUNC_0(BlockDriverState *VAR_0) { assert(!VAR_0->io_limits_enabled); throttle_init(&VAR_0->throttle_state, bdrv_get_aio_context(VAR_0), QEMU_CLOCK_VIRTUAL, bdrv_throttle_read_timer_cb, bdrv_throttle_write_timer_cb, VAR_0); VAR_0->io_limits_enabled = true; }
[ "void FUNC_0(BlockDriverState *VAR_0)\n{", "assert(!VAR_0->io_limits_enabled);", "throttle_init(&VAR_0->throttle_state,\nbdrv_get_aio_context(VAR_0),\nQEMU_CLOCK_VIRTUAL,\nbdrv_throttle_read_timer_cb,\nbdrv_throttle_write_timer_cb,\nVAR_0);", "VAR_0->io_limits_enabled = true;", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11, 13, 15, 17 ], [ 19 ], [ 21 ] ]
20,655
static int tta_read_packet(AVFormatContext *s, AVPacket *pkt) { TTAContext *c = s->priv_data; AVStream *st = s->streams[0]; int size, ret; // FIXME! if (c->currentframe > c->totalframes) return -1; size = st->index_entries[c->currentframe].size; ret = av_get_packet(s->pb, pkt, size); pkt->dts = st->index_entries[c->currentframe++].timestamp; return ret; }
true
FFmpeg
d8b33a99897f1faa8036fbdb6a6d48af9c10730f
static int tta_read_packet(AVFormatContext *s, AVPacket *pkt) { TTAContext *c = s->priv_data; AVStream *st = s->streams[0]; int size, ret; if (c->currentframe > c->totalframes) return -1; size = st->index_entries[c->currentframe].size; ret = av_get_packet(s->pb, pkt, size); pkt->dts = st->index_entries[c->currentframe++].timestamp; return ret; }
{ "code": [ " if (c->currentframe > c->totalframes)" ], "line_no": [ 15 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { TTAContext *c = VAR_0->priv_data; AVStream *st = VAR_0->streams[0]; int VAR_2, VAR_3; if (c->currentframe > c->totalframes) return -1; VAR_2 = st->index_entries[c->currentframe].VAR_2; VAR_3 = av_get_packet(VAR_0->pb, VAR_1, VAR_2); VAR_1->dts = st->index_entries[c->currentframe++].timestamp; return VAR_3; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "TTAContext *c = VAR_0->priv_data;", "AVStream *st = VAR_0->streams[0];", "int VAR_2, VAR_3;", "if (c->currentframe > c->totalframes)\nreturn -1;", "VAR_2 = st->index_entries[c->currentframe].VAR_2;", "VAR_3 = av_get_packet(VAR_0->pb, VAR_1, VAR_2);", "VAR_1->dts = st->index_entries[c->currentframe++].timestamp;", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15, 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
20,656
static void stream_seek(VideoState *is, int64_t pos, int rel) { is->seek_pos = pos; is->seek_req = 1; is->seek_flags = rel < 0 ? AVSEEK_FLAG_BACKWARD : 0; }
true
FFmpeg
687fae2b42f247e537afdb5b8d86e991d3fbb2db
static void stream_seek(VideoState *is, int64_t pos, int rel) { is->seek_pos = pos; is->seek_req = 1; is->seek_flags = rel < 0 ? AVSEEK_FLAG_BACKWARD : 0; }
{ "code": [ " is->seek_pos = pos;", " is->seek_req = 1;", " is->seek_flags = rel < 0 ? AVSEEK_FLAG_BACKWARD : 0;" ], "line_no": [ 5, 7, 9 ] }
static void FUNC_0(VideoState *VAR_0, int64_t VAR_1, int VAR_2) { VAR_0->seek_pos = VAR_1; VAR_0->seek_req = 1; VAR_0->seek_flags = VAR_2 < 0 ? AVSEEK_FLAG_BACKWARD : 0; }
[ "static void FUNC_0(VideoState *VAR_0, int64_t VAR_1, int VAR_2)\n{", "VAR_0->seek_pos = VAR_1;", "VAR_0->seek_req = 1;", "VAR_0->seek_flags = VAR_2 < 0 ? AVSEEK_FLAG_BACKWARD : 0;", "}" ]
[ 0, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
20,658
void ram_control_before_iterate(QEMUFile *f, uint64_t flags) { int ret = 0; if (f->ops->before_ram_iterate) { ret = f->ops->before_ram_iterate(f, f->opaque, flags); if (ret < 0) { qemu_file_set_error(f, ret); } } }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
void ram_control_before_iterate(QEMUFile *f, uint64_t flags) { int ret = 0; if (f->ops->before_ram_iterate) { ret = f->ops->before_ram_iterate(f, f->opaque, flags); if (ret < 0) { qemu_file_set_error(f, ret); } } }
{ "code": [], "line_no": [] }
void FUNC_0(QEMUFile *VAR_0, uint64_t VAR_1) { int VAR_2 = 0; if (VAR_0->ops->before_ram_iterate) { VAR_2 = VAR_0->ops->before_ram_iterate(VAR_0, VAR_0->opaque, VAR_1); if (VAR_2 < 0) { qemu_file_set_error(VAR_0, VAR_2); } } }
[ "void FUNC_0(QEMUFile *VAR_0, uint64_t VAR_1)\n{", "int VAR_2 = 0;", "if (VAR_0->ops->before_ram_iterate) {", "VAR_2 = VAR_0->ops->before_ram_iterate(VAR_0, VAR_0->opaque, VAR_1);", "if (VAR_2 < 0) {", "qemu_file_set_error(VAR_0, VAR_2);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
20,660
static void spapr_tce_reset(DeviceState *dev) { sPAPRTCETable *tcet = SPAPR_TCE_TABLE(dev); size_t table_size = tcet->nb_table * sizeof(uint64_t); memset(tcet->table, 0, table_size); }
true
qemu
57c0eb1e0d6d8f01550d10cf08747f25cd537777
static void spapr_tce_reset(DeviceState *dev) { sPAPRTCETable *tcet = SPAPR_TCE_TABLE(dev); size_t table_size = tcet->nb_table * sizeof(uint64_t); memset(tcet->table, 0, table_size); }
{ "code": [ " memset(tcet->table, 0, table_size);" ], "line_no": [ 11 ] }
static void FUNC_0(DeviceState *VAR_0) { sPAPRTCETable *tcet = SPAPR_TCE_TABLE(VAR_0); size_t table_size = tcet->nb_table * sizeof(uint64_t); memset(tcet->table, 0, table_size); }
[ "static void FUNC_0(DeviceState *VAR_0)\n{", "sPAPRTCETable *tcet = SPAPR_TCE_TABLE(VAR_0);", "size_t table_size = tcet->nb_table * sizeof(uint64_t);", "memset(tcet->table, 0, table_size);", "}" ]
[ 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ] ]
20,661
static int mjpeg_decode_app(MJpegDecodeContext *s) { int len, id, i; len = get_bits(&s->gb, 16); if (len < 5) return AVERROR_INVALIDDATA; if (8 * len > get_bits_left(&s->gb)) return AVERROR_INVALIDDATA; id = get_bits_long(&s->gb, 32); id = av_be2ne32(id); len -= 6; if (s->avctx->debug & FF_DEBUG_STARTCODE) av_log(s->avctx, AV_LOG_DEBUG, "APPx %8X\n", id); /* Buggy AVID, it puts EOI only at every 10th frame. */ /* Also, this fourcc is used by non-avid files too, it holds some information, but it's always present in AVID-created files. */ if (id == AV_RL32("AVI1")) { /* structure: 4bytes AVI1 1bytes polarity 1bytes always zero 4bytes field_size 4bytes field_size_less_padding */ s->buggy_avid = 1; i = get_bits(&s->gb, 8); len--; av_log(s->avctx, AV_LOG_DEBUG, "polarity %d\n", i); #if 0 skip_bits(&s->gb, 8); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); len -= 10; #endif goto out; } // len -= 2; if (id == AV_RL32("JFIF")) { int t_w, t_h, v1, v2; skip_bits(&s->gb, 8); /* the trailing zero-byte */ v1 = get_bits(&s->gb, 8); v2 = get_bits(&s->gb, 8); skip_bits(&s->gb, 8); s->avctx->sample_aspect_ratio.num = get_bits(&s->gb, 16); s->avctx->sample_aspect_ratio.den = get_bits(&s->gb, 16); if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "mjpeg: JFIF header found (version: %x.%x) SAR=%d/%d\n", v1, v2, s->avctx->sample_aspect_ratio.num, s->avctx->sample_aspect_ratio.den); t_w = get_bits(&s->gb, 8); t_h = get_bits(&s->gb, 8); if (t_w && t_h) { /* skip thumbnail */ if (len -10 - (t_w * t_h * 3) > 0) len -= t_w * t_h * 3; } len -= 10; goto out; } if (id == AV_RL32("Adob") && (get_bits(&s->gb, 8) == 'e')) { if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "mjpeg: Adobe header found\n"); skip_bits(&s->gb, 16); /* version */ skip_bits(&s->gb, 16); /* flags0 */ skip_bits(&s->gb, 16); /* flags1 */ skip_bits(&s->gb, 8); /* transform */ len -= 7; goto out; } if (id == AV_RL32("LJIF")) { if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "Pegasus lossless jpeg header found\n"); skip_bits(&s->gb, 16); /* version ? */ skip_bits(&s->gb, 16); /* unknwon always 0? */ skip_bits(&s->gb, 16); /* unknwon always 0? */ skip_bits(&s->gb, 16); /* unknwon always 0? */ switch (get_bits(&s->gb, 8)) { case 1: s->rgb = 1; s->pegasus_rct = 0; break; case 2: s->rgb = 1; s->pegasus_rct = 1; break; default: av_log(s->avctx, AV_LOG_ERROR, "unknown colorspace\n"); } len -= 9; goto out; } /* Apple MJPEG-A */ if ((s->start_code == APP1) && (len > (0x28 - 8))) { id = get_bits_long(&s->gb, 32); id = av_be2ne32(id); len -= 4; /* Apple MJPEG-A */ if (id == AV_RL32("mjpg")) { #if 0 skip_bits(&s->gb, 32); /* field size */ skip_bits(&s->gb, 32); /* pad field size */ skip_bits(&s->gb, 32); /* next off */ skip_bits(&s->gb, 32); /* quant off */ skip_bits(&s->gb, 32); /* huff off */ skip_bits(&s->gb, 32); /* image off */ skip_bits(&s->gb, 32); /* scan off */ skip_bits(&s->gb, 32); /* data off */ #endif if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "mjpeg: Apple MJPEG-A header found\n"); } } out: /* slow but needed for extreme adobe jpegs */ if (len < 0) av_log(s->avctx, AV_LOG_ERROR, "mjpeg: error, decode_app parser read over the end\n"); while (--len > 0) skip_bits(&s->gb, 8); return 0; }
false
FFmpeg
d885cc41e526284a1534e8c689175fe6ffba60e0
static int mjpeg_decode_app(MJpegDecodeContext *s) { int len, id, i; len = get_bits(&s->gb, 16); if (len < 5) return AVERROR_INVALIDDATA; if (8 * len > get_bits_left(&s->gb)) return AVERROR_INVALIDDATA; id = get_bits_long(&s->gb, 32); id = av_be2ne32(id); len -= 6; if (s->avctx->debug & FF_DEBUG_STARTCODE) av_log(s->avctx, AV_LOG_DEBUG, "APPx %8X\n", id); if (id == AV_RL32("AVI1")) { s->buggy_avid = 1; i = get_bits(&s->gb, 8); len--; av_log(s->avctx, AV_LOG_DEBUG, "polarity %d\n", i); #if 0 skip_bits(&s->gb, 8); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); len -= 10; #endif goto out; } if (id == AV_RL32("JFIF")) { int t_w, t_h, v1, v2; skip_bits(&s->gb, 8); v1 = get_bits(&s->gb, 8); v2 = get_bits(&s->gb, 8); skip_bits(&s->gb, 8); s->avctx->sample_aspect_ratio.num = get_bits(&s->gb, 16); s->avctx->sample_aspect_ratio.den = get_bits(&s->gb, 16); if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "mjpeg: JFIF header found (version: %x.%x) SAR=%d/%d\n", v1, v2, s->avctx->sample_aspect_ratio.num, s->avctx->sample_aspect_ratio.den); t_w = get_bits(&s->gb, 8); t_h = get_bits(&s->gb, 8); if (t_w && t_h) { if (len -10 - (t_w * t_h * 3) > 0) len -= t_w * t_h * 3; } len -= 10; goto out; } if (id == AV_RL32("Adob") && (get_bits(&s->gb, 8) == 'e')) { if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "mjpeg: Adobe header found\n"); skip_bits(&s->gb, 16); skip_bits(&s->gb, 16); skip_bits(&s->gb, 16); skip_bits(&s->gb, 8); len -= 7; goto out; } if (id == AV_RL32("LJIF")) { if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "Pegasus lossless jpeg header found\n"); skip_bits(&s->gb, 16); skip_bits(&s->gb, 16); skip_bits(&s->gb, 16); skip_bits(&s->gb, 16); switch (get_bits(&s->gb, 8)) { case 1: s->rgb = 1; s->pegasus_rct = 0; break; case 2: s->rgb = 1; s->pegasus_rct = 1; break; default: av_log(s->avctx, AV_LOG_ERROR, "unknown colorspace\n"); } len -= 9; goto out; } if ((s->start_code == APP1) && (len > (0x28 - 8))) { id = get_bits_long(&s->gb, 32); id = av_be2ne32(id); len -= 4; if (id == AV_RL32("mjpg")) { #if 0 skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); #endif if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "mjpeg: Apple MJPEG-A header found\n"); } } out: if (len < 0) av_log(s->avctx, AV_LOG_ERROR, "mjpeg: error, decode_app parser read over the end\n"); while (--len > 0) skip_bits(&s->gb, 8); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MJpegDecodeContext *VAR_0) { int VAR_1, VAR_2, VAR_3; VAR_1 = get_bits(&VAR_0->gb, 16); if (VAR_1 < 5) return AVERROR_INVALIDDATA; if (8 * VAR_1 > get_bits_left(&VAR_0->gb)) return AVERROR_INVALIDDATA; VAR_2 = get_bits_long(&VAR_0->gb, 32); VAR_2 = av_be2ne32(VAR_2); VAR_1 -= 6; if (VAR_0->avctx->debug & FF_DEBUG_STARTCODE) av_log(VAR_0->avctx, AV_LOG_DEBUG, "APPx %8X\n", VAR_2); if (VAR_2 == AV_RL32("AVI1")) { VAR_0->buggy_avid = 1; VAR_3 = get_bits(&VAR_0->gb, 8); VAR_1--; av_log(VAR_0->avctx, AV_LOG_DEBUG, "polarity %d\n", VAR_3); #if 0 skip_bits(&VAR_0->gb, 8); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); VAR_1 -= 10; #endif goto out; } if (VAR_2 == AV_RL32("JFIF")) { int VAR_4, VAR_5, VAR_6, VAR_7; skip_bits(&VAR_0->gb, 8); VAR_6 = get_bits(&VAR_0->gb, 8); VAR_7 = get_bits(&VAR_0->gb, 8); skip_bits(&VAR_0->gb, 8); VAR_0->avctx->sample_aspect_ratio.num = get_bits(&VAR_0->gb, 16); VAR_0->avctx->sample_aspect_ratio.den = get_bits(&VAR_0->gb, 16); if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) av_log(VAR_0->avctx, AV_LOG_INFO, "mjpeg: JFIF header found (version: %x.%x) SAR=%d/%d\n", VAR_6, VAR_7, VAR_0->avctx->sample_aspect_ratio.num, VAR_0->avctx->sample_aspect_ratio.den); VAR_4 = get_bits(&VAR_0->gb, 8); VAR_5 = get_bits(&VAR_0->gb, 8); if (VAR_4 && VAR_5) { if (VAR_1 -10 - (VAR_4 * VAR_5 * 3) > 0) VAR_1 -= VAR_4 * VAR_5 * 3; } VAR_1 -= 10; goto out; } if (VAR_2 == AV_RL32("Adob") && (get_bits(&VAR_0->gb, 8) == 'e')) { if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) av_log(VAR_0->avctx, AV_LOG_INFO, "mjpeg: Adobe header found\n"); skip_bits(&VAR_0->gb, 16); skip_bits(&VAR_0->gb, 16); skip_bits(&VAR_0->gb, 16); skip_bits(&VAR_0->gb, 8); VAR_1 -= 7; goto out; } if (VAR_2 == AV_RL32("LJIF")) { if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) av_log(VAR_0->avctx, AV_LOG_INFO, "Pegasus lossless jpeg header found\n"); skip_bits(&VAR_0->gb, 16); skip_bits(&VAR_0->gb, 16); skip_bits(&VAR_0->gb, 16); skip_bits(&VAR_0->gb, 16); switch (get_bits(&VAR_0->gb, 8)) { case 1: VAR_0->rgb = 1; VAR_0->pegasus_rct = 0; break; case 2: VAR_0->rgb = 1; VAR_0->pegasus_rct = 1; break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "unknown colorspace\n"); } VAR_1 -= 9; goto out; } if ((VAR_0->start_code == APP1) && (VAR_1 > (0x28 - 8))) { VAR_2 = get_bits_long(&VAR_0->gb, 32); VAR_2 = av_be2ne32(VAR_2); VAR_1 -= 4; if (VAR_2 == AV_RL32("mjpg")) { #if 0 skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); #endif if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) av_log(VAR_0->avctx, AV_LOG_INFO, "mjpeg: Apple MJPEG-A header found\n"); } } out: if (VAR_1 < 0) av_log(VAR_0->avctx, AV_LOG_ERROR, "mjpeg: error, decode_app parser read over the end\n"); while (--VAR_1 > 0) skip_bits(&VAR_0->gb, 8); return 0; }
[ "static int FUNC_0(MJpegDecodeContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3;", "VAR_1 = get_bits(&VAR_0->gb, 16);", "if (VAR_1 < 5)\nreturn AVERROR_INVALIDDATA;", "if (8 * VAR_1 > get_bits_left(&VAR_0->gb))\nreturn AVERROR_INVALIDDATA;", "VAR_2 = get_bits_long(&VAR_0->gb, 32);", "VAR_2 = av_be2ne32(VAR_2);", "VAR_1 -= 6;", "if (VAR_0->avctx->debug & FF_DEBUG_STARTCODE)\nav_log(VAR_0->avctx, AV_LOG_DEBUG, \"APPx %8X\\n\", VAR_2);", "if (VAR_2 == AV_RL32(\"AVI1\")) {", "VAR_0->buggy_avid = 1;", "VAR_3 = get_bits(&VAR_0->gb, 8); VAR_1--;", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"polarity %d\\n\", VAR_3);", "#if 0\nskip_bits(&VAR_0->gb, 8);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "VAR_1 -= 10;", "#endif\ngoto out;", "}", "if (VAR_2 == AV_RL32(\"JFIF\")) {", "int VAR_4, VAR_5, VAR_6, VAR_7;", "skip_bits(&VAR_0->gb, 8);", "VAR_6 = get_bits(&VAR_0->gb, 8);", "VAR_7 = get_bits(&VAR_0->gb, 8);", "skip_bits(&VAR_0->gb, 8);", "VAR_0->avctx->sample_aspect_ratio.num = get_bits(&VAR_0->gb, 16);", "VAR_0->avctx->sample_aspect_ratio.den = get_bits(&VAR_0->gb, 16);", "if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)\nav_log(VAR_0->avctx, AV_LOG_INFO,\n\"mjpeg: JFIF header found (version: %x.%x) SAR=%d/%d\\n\",\nVAR_6, VAR_7,\nVAR_0->avctx->sample_aspect_ratio.num,\nVAR_0->avctx->sample_aspect_ratio.den);", "VAR_4 = get_bits(&VAR_0->gb, 8);", "VAR_5 = get_bits(&VAR_0->gb, 8);", "if (VAR_4 && VAR_5) {", "if (VAR_1 -10 - (VAR_4 * VAR_5 * 3) > 0)\nVAR_1 -= VAR_4 * VAR_5 * 3;", "}", "VAR_1 -= 10;", "goto out;", "}", "if (VAR_2 == AV_RL32(\"Adob\") && (get_bits(&VAR_0->gb, 8) == 'e')) {", "if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)\nav_log(VAR_0->avctx, AV_LOG_INFO, \"mjpeg: Adobe header found\\n\");", "skip_bits(&VAR_0->gb, 16);", "skip_bits(&VAR_0->gb, 16);", "skip_bits(&VAR_0->gb, 16);", "skip_bits(&VAR_0->gb, 8);", "VAR_1 -= 7;", "goto out;", "}", "if (VAR_2 == AV_RL32(\"LJIF\")) {", "if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)\nav_log(VAR_0->avctx, AV_LOG_INFO,\n\"Pegasus lossless jpeg header found\\n\");", "skip_bits(&VAR_0->gb, 16);", "skip_bits(&VAR_0->gb, 16);", "skip_bits(&VAR_0->gb, 16);", "skip_bits(&VAR_0->gb, 16);", "switch (get_bits(&VAR_0->gb, 8)) {", "case 1:\nVAR_0->rgb = 1;", "VAR_0->pegasus_rct = 0;", "break;", "case 2:\nVAR_0->rgb = 1;", "VAR_0->pegasus_rct = 1;", "break;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"unknown colorspace\\n\");", "}", "VAR_1 -= 9;", "goto out;", "}", "if ((VAR_0->start_code == APP1) && (VAR_1 > (0x28 - 8))) {", "VAR_2 = get_bits_long(&VAR_0->gb, 32);", "VAR_2 = av_be2ne32(VAR_2);", "VAR_1 -= 4;", "if (VAR_2 == AV_RL32(\"mjpg\")) {", "#if 0\nskip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "#endif\nif (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)\nav_log(VAR_0->avctx, AV_LOG_INFO, \"mjpeg: Apple MJPEG-A header found\\n\");", "}", "}", "out:\nif (VAR_1 < 0)\nav_log(VAR_0->avctx, AV_LOG_ERROR,\n\"mjpeg: error, decode_app parser read over the end\\n\");", "while (--VAR_1 > 0)\nskip_bits(&VAR_0->gb, 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, 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 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 41 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 105, 107, 109, 111, 113, 115 ], [ 119 ], [ 121 ], [ 123 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165, 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243, 245, 247 ], [ 249 ], [ 251 ], [ 255, 259, 261, 263 ], [ 265, 267 ], [ 271 ], [ 273 ] ]
20,663
static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref, int width, int height) { DrawTextContext *dtext = ctx->priv; uint32_t code = 0, prev_code = 0; int x = 0, y = 0, i = 0, ret; int text_height; char *text = dtext->text; uint8_t *p; int str_w = 0, len; int y_min = 32000, y_max = -32000; FT_Vector delta; Glyph *glyph = NULL, *prev_glyph = NULL; Glyph dummy = { 0 }; time_t now = time(0); struct tm ltime; uint8_t *buf = dtext->expanded_text; int buf_size = dtext->expanded_text_size; if(dtext->basetime != AV_NOPTS_VALUE) now= picref->pts*av_q2d(ctx->inputs[0]->time_base) + dtext->basetime/1000000; if (!buf) { buf_size = 2*strlen(dtext->text)+1; buf = av_malloc(buf_size); } #if HAVE_LOCALTIME_R localtime_r(&now, &ltime); #else if(strchr(dtext->text, '%')) ltime= *localtime(&now); #endif do { *buf = 1; if (strftime(buf, buf_size, dtext->text, &ltime) != 0 || *buf == 0) break; buf_size *= 2; } while ((buf = av_realloc(buf, buf_size))); if (!buf) return AVERROR(ENOMEM); text = dtext->expanded_text = buf; dtext->expanded_text_size = buf_size; if ((len = strlen(text)) > dtext->nb_positions) { if (!(dtext->positions = av_realloc(dtext->positions, len*sizeof(*dtext->positions)))) return AVERROR(ENOMEM); dtext->nb_positions = len; } x = dtext->x; y = dtext->y; /* load and cache glyphs */ for (i = 0, p = text; *p; i++) { GET_UTF8(code, *p++, continue;); /* get glyph */ dummy.code = code; glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL); if (!glyph) load_glyph(ctx, &glyph, code); y_min = FFMIN(glyph->bbox.yMin, y_min); y_max = FFMAX(glyph->bbox.yMax, y_max); } text_height = y_max - y_min; /* compute and save position for each glyph */ glyph = NULL; for (i = 0, p = text; *p; i++) { GET_UTF8(code, *p++, continue;); /* skip the \n in the sequence \r\n */ if (prev_code == '\r' && code == '\n') continue; prev_code = code; if (is_newline(code)) { str_w = FFMAX(str_w, x - dtext->x); y += text_height; x = dtext->x; continue; } /* get glyph */ prev_glyph = glyph; dummy.code = code; glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL); /* kerning */ if (dtext->use_kerning && prev_glyph && glyph->code) { FT_Get_Kerning(dtext->face, prev_glyph->code, glyph->code, ft_kerning_default, &delta); x += delta.x >> 6; } if (x + glyph->bbox.xMax >= width) { str_w = FFMAX(str_w, x - dtext->x); y += text_height; x = dtext->x; } /* save position */ dtext->positions[i].x = x + glyph->bitmap_left; dtext->positions[i].y = y - glyph->bitmap_top + y_max; if (code == '\t') x = (x / dtext->tabsize + 1)*dtext->tabsize; else x += glyph->advance; } str_w = FFMIN(width - dtext->x - 1, FFMAX(str_w, x - dtext->x)); y = FFMIN(y + text_height, height - 1); /* draw box */ if (dtext->draw_box) drawbox(picref, dtext->x, dtext->y, str_w, y-dtext->y, dtext->box_line, dtext->pixel_step, dtext->boxcolor_rgba, dtext->hsub, dtext->vsub, dtext->is_packed_rgb, dtext->rgba_map); if (dtext->shadowx || dtext->shadowy) { if ((ret = draw_glyphs(dtext, picref, width, height, dtext->shadowcolor_rgba, dtext->shadowcolor, dtext->shadowx, dtext->shadowy)) < 0) return ret; } if ((ret = draw_glyphs(dtext, picref, width, height, dtext->fontcolor_rgba, dtext->fontcolor, 0, 0)) < 0) return ret; return 0; }
false
FFmpeg
163854bca0e0c1b43831de7463ffa3ff9e6595ca
static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref, int width, int height) { DrawTextContext *dtext = ctx->priv; uint32_t code = 0, prev_code = 0; int x = 0, y = 0, i = 0, ret; int text_height; char *text = dtext->text; uint8_t *p; int str_w = 0, len; int y_min = 32000, y_max = -32000; FT_Vector delta; Glyph *glyph = NULL, *prev_glyph = NULL; Glyph dummy = { 0 }; time_t now = time(0); struct tm ltime; uint8_t *buf = dtext->expanded_text; int buf_size = dtext->expanded_text_size; if(dtext->basetime != AV_NOPTS_VALUE) now= picref->pts*av_q2d(ctx->inputs[0]->time_base) + dtext->basetime/1000000; if (!buf) { buf_size = 2*strlen(dtext->text)+1; buf = av_malloc(buf_size); } #if HAVE_LOCALTIME_R localtime_r(&now, &ltime); #else if(strchr(dtext->text, '%')) ltime= *localtime(&now); #endif do { *buf = 1; if (strftime(buf, buf_size, dtext->text, &ltime) != 0 || *buf == 0) break; buf_size *= 2; } while ((buf = av_realloc(buf, buf_size))); if (!buf) return AVERROR(ENOMEM); text = dtext->expanded_text = buf; dtext->expanded_text_size = buf_size; if ((len = strlen(text)) > dtext->nb_positions) { if (!(dtext->positions = av_realloc(dtext->positions, len*sizeof(*dtext->positions)))) return AVERROR(ENOMEM); dtext->nb_positions = len; } x = dtext->x; y = dtext->y; for (i = 0, p = text; *p; i++) { GET_UTF8(code, *p++, continue;); dummy.code = code; glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL); if (!glyph) load_glyph(ctx, &glyph, code); y_min = FFMIN(glyph->bbox.yMin, y_min); y_max = FFMAX(glyph->bbox.yMax, y_max); } text_height = y_max - y_min; glyph = NULL; for (i = 0, p = text; *p; i++) { GET_UTF8(code, *p++, continue;); if (prev_code == '\r' && code == '\n') continue; prev_code = code; if (is_newline(code)) { str_w = FFMAX(str_w, x - dtext->x); y += text_height; x = dtext->x; continue; } prev_glyph = glyph; dummy.code = code; glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL); if (dtext->use_kerning && prev_glyph && glyph->code) { FT_Get_Kerning(dtext->face, prev_glyph->code, glyph->code, ft_kerning_default, &delta); x += delta.x >> 6; } if (x + glyph->bbox.xMax >= width) { str_w = FFMAX(str_w, x - dtext->x); y += text_height; x = dtext->x; } dtext->positions[i].x = x + glyph->bitmap_left; dtext->positions[i].y = y - glyph->bitmap_top + y_max; if (code == '\t') x = (x / dtext->tabsize + 1)*dtext->tabsize; else x += glyph->advance; } str_w = FFMIN(width - dtext->x - 1, FFMAX(str_w, x - dtext->x)); y = FFMIN(y + text_height, height - 1); if (dtext->draw_box) drawbox(picref, dtext->x, dtext->y, str_w, y-dtext->y, dtext->box_line, dtext->pixel_step, dtext->boxcolor_rgba, dtext->hsub, dtext->vsub, dtext->is_packed_rgb, dtext->rgba_map); if (dtext->shadowx || dtext->shadowy) { if ((ret = draw_glyphs(dtext, picref, width, height, dtext->shadowcolor_rgba, dtext->shadowcolor, dtext->shadowx, dtext->shadowy)) < 0) return ret; } if ((ret = draw_glyphs(dtext, picref, width, height, dtext->fontcolor_rgba, dtext->fontcolor, 0, 0)) < 0) return ret; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterContext *VAR_0, AVFilterBufferRef *VAR_1, int VAR_2, int VAR_3) { DrawTextContext *dtext = VAR_0->priv; uint32_t code = 0, prev_code = 0; int VAR_4 = 0, VAR_5 = 0, VAR_6 = 0, VAR_7; int VAR_8; char *VAR_9 = dtext->VAR_9; uint8_t *p; int VAR_10 = 0, VAR_11; int VAR_12 = 32000, VAR_13 = -32000; FT_Vector delta; Glyph *glyph = NULL, *prev_glyph = NULL; Glyph dummy = { 0 }; time_t now = time(0); struct tm VAR_14; uint8_t *buf = dtext->expanded_text; int VAR_15 = dtext->expanded_text_size; if(dtext->basetime != AV_NOPTS_VALUE) now= VAR_1->pts*av_q2d(VAR_0->inputs[0]->time_base) + dtext->basetime/1000000; if (!buf) { VAR_15 = 2*strlen(dtext->VAR_9)+1; buf = av_malloc(VAR_15); } #if HAVE_LOCALTIME_R localtime_r(&now, &VAR_14); #else if(strchr(dtext->VAR_9, '%')) VAR_14= *localtime(&now); #endif do { *buf = 1; if (strftime(buf, VAR_15, dtext->VAR_9, &VAR_14) != 0 || *buf == 0) break; VAR_15 *= 2; } while ((buf = av_realloc(buf, VAR_15))); if (!buf) return AVERROR(ENOMEM); VAR_9 = dtext->expanded_text = buf; dtext->expanded_text_size = VAR_15; if ((VAR_11 = strlen(VAR_9)) > dtext->nb_positions) { if (!(dtext->positions = av_realloc(dtext->positions, VAR_11*sizeof(*dtext->positions)))) return AVERROR(ENOMEM); dtext->nb_positions = VAR_11; } VAR_4 = dtext->VAR_4; VAR_5 = dtext->VAR_5; for (VAR_6 = 0, p = VAR_9; *p; VAR_6++) { GET_UTF8(code, *p++, continue;); dummy.code = code; glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL); if (!glyph) load_glyph(VAR_0, &glyph, code); VAR_12 = FFMIN(glyph->bbox.yMin, VAR_12); VAR_13 = FFMAX(glyph->bbox.yMax, VAR_13); } VAR_8 = VAR_13 - VAR_12; glyph = NULL; for (VAR_6 = 0, p = VAR_9; *p; VAR_6++) { GET_UTF8(code, *p++, continue;); if (prev_code == '\r' && code == '\n') continue; prev_code = code; if (is_newline(code)) { VAR_10 = FFMAX(VAR_10, VAR_4 - dtext->VAR_4); VAR_5 += VAR_8; VAR_4 = dtext->VAR_4; continue; } prev_glyph = glyph; dummy.code = code; glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL); if (dtext->use_kerning && prev_glyph && glyph->code) { FT_Get_Kerning(dtext->face, prev_glyph->code, glyph->code, ft_kerning_default, &delta); VAR_4 += delta.VAR_4 >> 6; } if (VAR_4 + glyph->bbox.xMax >= VAR_2) { VAR_10 = FFMAX(VAR_10, VAR_4 - dtext->VAR_4); VAR_5 += VAR_8; VAR_4 = dtext->VAR_4; } dtext->positions[VAR_6].VAR_4 = VAR_4 + glyph->bitmap_left; dtext->positions[VAR_6].VAR_5 = VAR_5 - glyph->bitmap_top + VAR_13; if (code == '\t') VAR_4 = (VAR_4 / dtext->tabsize + 1)*dtext->tabsize; else VAR_4 += glyph->advance; } VAR_10 = FFMIN(VAR_2 - dtext->VAR_4 - 1, FFMAX(VAR_10, VAR_4 - dtext->VAR_4)); VAR_5 = FFMIN(VAR_5 + VAR_8, VAR_3 - 1); if (dtext->draw_box) drawbox(VAR_1, dtext->VAR_4, dtext->VAR_5, VAR_10, VAR_5-dtext->VAR_5, dtext->box_line, dtext->pixel_step, dtext->boxcolor_rgba, dtext->hsub, dtext->vsub, dtext->is_packed_rgb, dtext->rgba_map); if (dtext->shadowx || dtext->shadowy) { if ((VAR_7 = draw_glyphs(dtext, VAR_1, VAR_2, VAR_3, dtext->shadowcolor_rgba, dtext->shadowcolor, dtext->shadowx, dtext->shadowy)) < 0) return VAR_7; } if ((VAR_7 = draw_glyphs(dtext, VAR_1, VAR_2, VAR_3, dtext->fontcolor_rgba, dtext->fontcolor, 0, 0)) < 0) return VAR_7; return 0; }
[ "static int FUNC_0(AVFilterContext *VAR_0, AVFilterBufferRef *VAR_1,\nint VAR_2, int VAR_3)\n{", "DrawTextContext *dtext = VAR_0->priv;", "uint32_t code = 0, prev_code = 0;", "int VAR_4 = 0, VAR_5 = 0, VAR_6 = 0, VAR_7;", "int VAR_8;", "char *VAR_9 = dtext->VAR_9;", "uint8_t *p;", "int VAR_10 = 0, VAR_11;", "int VAR_12 = 32000, VAR_13 = -32000;", "FT_Vector delta;", "Glyph *glyph = NULL, *prev_glyph = NULL;", "Glyph dummy = { 0 };", "time_t now = time(0);", "struct tm VAR_14;", "uint8_t *buf = dtext->expanded_text;", "int VAR_15 = dtext->expanded_text_size;", "if(dtext->basetime != AV_NOPTS_VALUE)\nnow= VAR_1->pts*av_q2d(VAR_0->inputs[0]->time_base) + dtext->basetime/1000000;", "if (!buf) {", "VAR_15 = 2*strlen(dtext->VAR_9)+1;", "buf = av_malloc(VAR_15);", "}", "#if HAVE_LOCALTIME_R\nlocaltime_r(&now, &VAR_14);", "#else\nif(strchr(dtext->VAR_9, '%'))\nVAR_14= *localtime(&now);", "#endif\ndo {", "*buf = 1;", "if (strftime(buf, VAR_15, dtext->VAR_9, &VAR_14) != 0 || *buf == 0)\nbreak;", "VAR_15 *= 2;", "} while ((buf = av_realloc(buf, VAR_15)));", "if (!buf)\nreturn AVERROR(ENOMEM);", "VAR_9 = dtext->expanded_text = buf;", "dtext->expanded_text_size = VAR_15;", "if ((VAR_11 = strlen(VAR_9)) > dtext->nb_positions) {", "if (!(dtext->positions =\nav_realloc(dtext->positions, VAR_11*sizeof(*dtext->positions))))\nreturn AVERROR(ENOMEM);", "dtext->nb_positions = VAR_11;", "}", "VAR_4 = dtext->VAR_4;", "VAR_5 = dtext->VAR_5;", "for (VAR_6 = 0, p = VAR_9; *p; VAR_6++) {", "GET_UTF8(code, *p++, continue;);", "dummy.code = code;", "glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL);", "if (!glyph)\nload_glyph(VAR_0, &glyph, code);", "VAR_12 = FFMIN(glyph->bbox.yMin, VAR_12);", "VAR_13 = FFMAX(glyph->bbox.yMax, VAR_13);", "}", "VAR_8 = VAR_13 - VAR_12;", "glyph = NULL;", "for (VAR_6 = 0, p = VAR_9; *p; VAR_6++) {", "GET_UTF8(code, *p++, continue;);", "if (prev_code == '\\r' && code == '\\n')\ncontinue;", "prev_code = code;", "if (is_newline(code)) {", "VAR_10 = FFMAX(VAR_10, VAR_4 - dtext->VAR_4);", "VAR_5 += VAR_8;", "VAR_4 = dtext->VAR_4;", "continue;", "}", "prev_glyph = glyph;", "dummy.code = code;", "glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL);", "if (dtext->use_kerning && prev_glyph && glyph->code) {", "FT_Get_Kerning(dtext->face, prev_glyph->code, glyph->code,\nft_kerning_default, &delta);", "VAR_4 += delta.VAR_4 >> 6;", "}", "if (VAR_4 + glyph->bbox.xMax >= VAR_2) {", "VAR_10 = FFMAX(VAR_10, VAR_4 - dtext->VAR_4);", "VAR_5 += VAR_8;", "VAR_4 = dtext->VAR_4;", "}", "dtext->positions[VAR_6].VAR_4 = VAR_4 + glyph->bitmap_left;", "dtext->positions[VAR_6].VAR_5 = VAR_5 - glyph->bitmap_top + VAR_13;", "if (code == '\\t') VAR_4 = (VAR_4 / dtext->tabsize + 1)*dtext->tabsize;", "else VAR_4 += glyph->advance;", "}", "VAR_10 = FFMIN(VAR_2 - dtext->VAR_4 - 1, FFMAX(VAR_10, VAR_4 - dtext->VAR_4));", "VAR_5 = FFMIN(VAR_5 + VAR_8, VAR_3 - 1);", "if (dtext->draw_box)\ndrawbox(VAR_1, dtext->VAR_4, dtext->VAR_5, VAR_10, VAR_5-dtext->VAR_5,\ndtext->box_line, dtext->pixel_step, dtext->boxcolor_rgba,\ndtext->hsub, dtext->vsub, dtext->is_packed_rgb, dtext->rgba_map);", "if (dtext->shadowx || dtext->shadowy) {", "if ((VAR_7 = draw_glyphs(dtext, VAR_1, VAR_2, VAR_3, dtext->shadowcolor_rgba,\ndtext->shadowcolor, dtext->shadowx, dtext->shadowy)) < 0)\nreturn VAR_7;", "}", "if ((VAR_7 = draw_glyphs(dtext, VAR_1, VAR_2, VAR_3, dtext->fontcolor_rgba,\ndtext->fontcolor, 0, 0)) < 0)\nreturn VAR_7;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61, 63, 65 ], [ 67, 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97, 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 115 ], [ 117 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 145 ], [ 147 ], [ 149 ], [ 155, 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 179 ], [ 181 ], [ 183 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 229 ], [ 235, 237, 239, 241 ], [ 245 ], [ 247, 249, 251 ], [ 253 ], [ 257, 259, 261 ], [ 265 ], [ 267 ] ]
20,664
void OPPROTO op_subfme_64 (void) { T0 = ~T0 + xer_ca - 1; if (likely((uint64_t)T0 != (uint64_t)-1)) xer_ca = 1; RETURN(); }
true
qemu
c3e10c7b4377c1cbc0a4fbc12312c2cf41c0cda7
void OPPROTO op_subfme_64 (void) { T0 = ~T0 + xer_ca - 1; if (likely((uint64_t)T0 != (uint64_t)-1)) xer_ca = 1; RETURN(); }
{ "code": [ " RETURN();", " RETURN();", " if (likely((uint64_t)T0 != (uint64_t)-1))", " RETURN();" ], "line_no": [ 11, 11, 7, 11 ] }
void VAR_0 op_subfme_64 (void) { T0 = ~T0 + xer_ca - 1; if (likely((uint64_t)T0 != (uint64_t)-1)) xer_ca = 1; RETURN(); }
[ "void VAR_0 op_subfme_64 (void)\n{", "T0 = ~T0 + xer_ca - 1;", "if (likely((uint64_t)T0 != (uint64_t)-1))\nxer_ca = 1;", "RETURN();", "}" ]
[ 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ] ]
20,665
void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd, int64_t bps_wr, int64_t iops, int64_t iops_rd, int64_t iops_wr, Error **errp) { ThrottleConfig cfg; BlockDriverState *bs; bs = bdrv_find(device); if (!bs) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); return; } memset(&cfg, 0, sizeof(cfg)); cfg.buckets[THROTTLE_BPS_TOTAL].avg = bps; cfg.buckets[THROTTLE_BPS_READ].avg = bps_rd; cfg.buckets[THROTTLE_BPS_WRITE].avg = bps_wr; cfg.buckets[THROTTLE_OPS_TOTAL].avg = iops; cfg.buckets[THROTTLE_OPS_READ].avg = iops_rd; cfg.buckets[THROTTLE_OPS_WRITE].avg = iops_wr; cfg.buckets[THROTTLE_BPS_TOTAL].max = 0; cfg.buckets[THROTTLE_BPS_READ].max = 0; cfg.buckets[THROTTLE_BPS_WRITE].max = 0; cfg.buckets[THROTTLE_OPS_TOTAL].max = 0; cfg.buckets[THROTTLE_OPS_READ].max = 0; cfg.buckets[THROTTLE_OPS_WRITE].max = 0; cfg.op_size = 0; if (!check_throttle_config(&cfg, errp)) { return; } if (!bs->io_limits_enabled && throttle_enabled(&cfg)) { bdrv_io_limits_enable(bs); } else if (bs->io_limits_enabled && !throttle_enabled(&cfg)) { bdrv_io_limits_disable(bs); } if (bs->io_limits_enabled) { bdrv_set_io_limits(bs, &cfg); } }
true
qemu
3e9fab690d59ac15956c3733fe0794ce1ae4c4af
void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd, int64_t bps_wr, int64_t iops, int64_t iops_rd, int64_t iops_wr, Error **errp) { ThrottleConfig cfg; BlockDriverState *bs; bs = bdrv_find(device); if (!bs) { error_set(errp, QERR_DEVICE_NOT_FOUND, device); return; } memset(&cfg, 0, sizeof(cfg)); cfg.buckets[THROTTLE_BPS_TOTAL].avg = bps; cfg.buckets[THROTTLE_BPS_READ].avg = bps_rd; cfg.buckets[THROTTLE_BPS_WRITE].avg = bps_wr; cfg.buckets[THROTTLE_OPS_TOTAL].avg = iops; cfg.buckets[THROTTLE_OPS_READ].avg = iops_rd; cfg.buckets[THROTTLE_OPS_WRITE].avg = iops_wr; cfg.buckets[THROTTLE_BPS_TOTAL].max = 0; cfg.buckets[THROTTLE_BPS_READ].max = 0; cfg.buckets[THROTTLE_BPS_WRITE].max = 0; cfg.buckets[THROTTLE_OPS_TOTAL].max = 0; cfg.buckets[THROTTLE_OPS_READ].max = 0; cfg.buckets[THROTTLE_OPS_WRITE].max = 0; cfg.op_size = 0; if (!check_throttle_config(&cfg, errp)) { return; } if (!bs->io_limits_enabled && throttle_enabled(&cfg)) { bdrv_io_limits_enable(bs); } else if (bs->io_limits_enabled && !throttle_enabled(&cfg)) { bdrv_io_limits_disable(bs); } if (bs->io_limits_enabled) { bdrv_set_io_limits(bs, &cfg); } }
{ "code": [ " cfg.buckets[THROTTLE_BPS_TOTAL].max = 0;", " cfg.buckets[THROTTLE_BPS_READ].max = 0;", " cfg.buckets[THROTTLE_BPS_WRITE].max = 0;", " cfg.buckets[THROTTLE_OPS_TOTAL].max = 0;", " cfg.buckets[THROTTLE_OPS_READ].max = 0;", " cfg.buckets[THROTTLE_OPS_WRITE].max = 0;", " int64_t bps_wr, int64_t iops, int64_t iops_rd,", " int64_t iops_wr, Error **errp)", " cfg.buckets[THROTTLE_BPS_TOTAL].max = 0;", " cfg.buckets[THROTTLE_BPS_READ].max = 0;", " cfg.buckets[THROTTLE_BPS_WRITE].max = 0;", " cfg.buckets[THROTTLE_OPS_TOTAL].max = 0;", " cfg.buckets[THROTTLE_OPS_READ].max = 0;", " cfg.buckets[THROTTLE_OPS_WRITE].max = 0;" ], "line_no": [ 45, 47, 49, 53, 55, 57, 3, 5, 45, 47, 49, 53, 55, 57 ] }
void FUNC_0(const char *VAR_0, int64_t VAR_1, int64_t VAR_2, int64_t VAR_3, int64_t VAR_4, int64_t VAR_5, int64_t VAR_6, Error **VAR_7) { ThrottleConfig cfg; BlockDriverState *bs; bs = bdrv_find(VAR_0); if (!bs) { error_set(VAR_7, QERR_DEVICE_NOT_FOUND, VAR_0); return; } memset(&cfg, 0, sizeof(cfg)); cfg.buckets[THROTTLE_BPS_TOTAL].avg = VAR_1; cfg.buckets[THROTTLE_BPS_READ].avg = VAR_2; cfg.buckets[THROTTLE_BPS_WRITE].avg = VAR_3; cfg.buckets[THROTTLE_OPS_TOTAL].avg = VAR_4; cfg.buckets[THROTTLE_OPS_READ].avg = VAR_5; cfg.buckets[THROTTLE_OPS_WRITE].avg = VAR_6; cfg.buckets[THROTTLE_BPS_TOTAL].max = 0; cfg.buckets[THROTTLE_BPS_READ].max = 0; cfg.buckets[THROTTLE_BPS_WRITE].max = 0; cfg.buckets[THROTTLE_OPS_TOTAL].max = 0; cfg.buckets[THROTTLE_OPS_READ].max = 0; cfg.buckets[THROTTLE_OPS_WRITE].max = 0; cfg.op_size = 0; if (!check_throttle_config(&cfg, VAR_7)) { return; } if (!bs->io_limits_enabled && throttle_enabled(&cfg)) { bdrv_io_limits_enable(bs); } else if (bs->io_limits_enabled && !throttle_enabled(&cfg)) { bdrv_io_limits_disable(bs); } if (bs->io_limits_enabled) { bdrv_set_io_limits(bs, &cfg); } }
[ "void FUNC_0(const char *VAR_0, int64_t VAR_1, int64_t VAR_2,\nint64_t VAR_3, int64_t VAR_4, int64_t VAR_5,\nint64_t VAR_6, Error **VAR_7)\n{", "ThrottleConfig cfg;", "BlockDriverState *bs;", "bs = bdrv_find(VAR_0);", "if (!bs) {", "error_set(VAR_7, QERR_DEVICE_NOT_FOUND, VAR_0);", "return;", "}", "memset(&cfg, 0, sizeof(cfg));", "cfg.buckets[THROTTLE_BPS_TOTAL].avg = VAR_1;", "cfg.buckets[THROTTLE_BPS_READ].avg = VAR_2;", "cfg.buckets[THROTTLE_BPS_WRITE].avg = VAR_3;", "cfg.buckets[THROTTLE_OPS_TOTAL].avg = VAR_4;", "cfg.buckets[THROTTLE_OPS_READ].avg = VAR_5;", "cfg.buckets[THROTTLE_OPS_WRITE].avg = VAR_6;", "cfg.buckets[THROTTLE_BPS_TOTAL].max = 0;", "cfg.buckets[THROTTLE_BPS_READ].max = 0;", "cfg.buckets[THROTTLE_BPS_WRITE].max = 0;", "cfg.buckets[THROTTLE_OPS_TOTAL].max = 0;", "cfg.buckets[THROTTLE_OPS_READ].max = 0;", "cfg.buckets[THROTTLE_OPS_WRITE].max = 0;", "cfg.op_size = 0;", "if (!check_throttle_config(&cfg, VAR_7)) {", "return;", "}", "if (!bs->io_limits_enabled && throttle_enabled(&cfg)) {", "bdrv_io_limits_enable(bs);", "} else if (bs->io_limits_enabled && !throttle_enabled(&cfg)) {", "bdrv_io_limits_disable(bs);", "}", "if (bs->io_limits_enabled) {", "bdrv_set_io_limits(bs, &cfg);", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ] ]
20,666
static inline void dxt3_block_internal(uint8_t *dst, ptrdiff_t stride, const uint8_t *block) { int x, y; uint32_t colors[4]; uint16_t color0 = AV_RL16(block + 8); uint16_t color1 = AV_RL16(block + 10); uint32_t code = AV_RL32(block + 12); extract_color(colors, color0, color1, 1, 0); for (y = 0; y < 4; y++) { const uint16_t alpha_code = AV_RL16(block + 2 * y); uint8_t alpha_values[4]; alpha_values[0] = ((alpha_code >> 0) & 0x0F) * 17; alpha_values[1] = ((alpha_code >> 4) & 0x0F) * 17; alpha_values[2] = ((alpha_code >> 8) & 0x0F) * 17; alpha_values[3] = ((alpha_code >> 12) & 0x0F) * 17; for (x = 0; x < 4; x++) { uint8_t alpha = alpha_values[x]; uint32_t pixel = colors[code & 3] | (alpha << 24); code >>= 2; AV_WL32(dst + x * 4, pixel); } dst += stride; } }
true
FFmpeg
f225003d17364cd38fd28f268ae2b29abd8e5024
static inline void dxt3_block_internal(uint8_t *dst, ptrdiff_t stride, const uint8_t *block) { int x, y; uint32_t colors[4]; uint16_t color0 = AV_RL16(block + 8); uint16_t color1 = AV_RL16(block + 10); uint32_t code = AV_RL32(block + 12); extract_color(colors, color0, color1, 1, 0); for (y = 0; y < 4; y++) { const uint16_t alpha_code = AV_RL16(block + 2 * y); uint8_t alpha_values[4]; alpha_values[0] = ((alpha_code >> 0) & 0x0F) * 17; alpha_values[1] = ((alpha_code >> 4) & 0x0F) * 17; alpha_values[2] = ((alpha_code >> 8) & 0x0F) * 17; alpha_values[3] = ((alpha_code >> 12) & 0x0F) * 17; for (x = 0; x < 4; x++) { uint8_t alpha = alpha_values[x]; uint32_t pixel = colors[code & 3] | (alpha << 24); code >>= 2; AV_WL32(dst + x * 4, pixel); } dst += stride; } }
{ "code": [ " uint32_t pixel = colors[code & 3] | (alpha << 24);" ], "line_no": [ 45 ] }
static inline void FUNC_0(uint8_t *VAR_0, ptrdiff_t VAR_1, const uint8_t *VAR_2) { int VAR_3, VAR_4; uint32_t colors[4]; uint16_t color0 = AV_RL16(VAR_2 + 8); uint16_t color1 = AV_RL16(VAR_2 + 10); uint32_t code = AV_RL32(VAR_2 + 12); extract_color(colors, color0, color1, 1, 0); for (VAR_4 = 0; VAR_4 < 4; VAR_4++) { const uint16_t VAR_5 = AV_RL16(VAR_2 + 2 * VAR_4); uint8_t alpha_values[4]; alpha_values[0] = ((VAR_5 >> 0) & 0x0F) * 17; alpha_values[1] = ((VAR_5 >> 4) & 0x0F) * 17; alpha_values[2] = ((VAR_5 >> 8) & 0x0F) * 17; alpha_values[3] = ((VAR_5 >> 12) & 0x0F) * 17; for (VAR_3 = 0; VAR_3 < 4; VAR_3++) { uint8_t alpha = alpha_values[VAR_3]; uint32_t pixel = colors[code & 3] | (alpha << 24); code >>= 2; AV_WL32(VAR_0 + VAR_3 * 4, pixel); } VAR_0 += VAR_1; } }
[ "static inline void FUNC_0(uint8_t *VAR_0, ptrdiff_t VAR_1,\nconst uint8_t *VAR_2)\n{", "int VAR_3, VAR_4;", "uint32_t colors[4];", "uint16_t color0 = AV_RL16(VAR_2 + 8);", "uint16_t color1 = AV_RL16(VAR_2 + 10);", "uint32_t code = AV_RL32(VAR_2 + 12);", "extract_color(colors, color0, color1, 1, 0);", "for (VAR_4 = 0; VAR_4 < 4; VAR_4++) {", "const uint16_t VAR_5 = AV_RL16(VAR_2 + 2 * VAR_4);", "uint8_t alpha_values[4];", "alpha_values[0] = ((VAR_5 >> 0) & 0x0F) * 17;", "alpha_values[1] = ((VAR_5 >> 4) & 0x0F) * 17;", "alpha_values[2] = ((VAR_5 >> 8) & 0x0F) * 17;", "alpha_values[3] = ((VAR_5 >> 12) & 0x0F) * 17;", "for (VAR_3 = 0; VAR_3 < 4; VAR_3++) {", "uint8_t alpha = alpha_values[VAR_3];", "uint32_t pixel = colors[code & 3] | (alpha << 24);", "code >>= 2;", "AV_WL32(VAR_0 + VAR_3 * 4, pixel);", "}", "VAR_0 += VAR_1;", "}", "}" ]
[ 0, 0, 0, 0, 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 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
20,667
void tcg_func_start(TCGContext *s) { tcg_pool_reset(s); s->nb_temps = s->nb_globals; /* No temps have been previously allocated for size or locality. */ memset(s->free_temps, 0, sizeof(s->free_temps)); s->nb_labels = 0; s->current_frame_offset = s->frame_start; #ifdef CONFIG_DEBUG_TCG s->goto_tb_issue_mask = 0; #endif s->gen_op_buf[0].next = 1; s->gen_op_buf[0].prev = 0; s->gen_next_op_idx = 1; }
true
qemu
15fa08f8451babc88d733bd411d4c94976f9d0f8
void tcg_func_start(TCGContext *s) { tcg_pool_reset(s); s->nb_temps = s->nb_globals; memset(s->free_temps, 0, sizeof(s->free_temps)); s->nb_labels = 0; s->current_frame_offset = s->frame_start; #ifdef CONFIG_DEBUG_TCG s->goto_tb_issue_mask = 0; #endif s->gen_op_buf[0].next = 1; s->gen_op_buf[0].prev = 0; s->gen_next_op_idx = 1; }
{ "code": [ "#endif", " s->gen_op_buf[0].next = 1;", " s->gen_op_buf[0].prev = 0;", " s->gen_next_op_idx = 1;" ], "line_no": [ 27, 31, 33, 35 ] }
void FUNC_0(TCGContext *VAR_0) { tcg_pool_reset(VAR_0); VAR_0->nb_temps = VAR_0->nb_globals; memset(VAR_0->free_temps, 0, sizeof(VAR_0->free_temps)); VAR_0->nb_labels = 0; VAR_0->current_frame_offset = VAR_0->frame_start; #ifdef CONFIG_DEBUG_TCG VAR_0->goto_tb_issue_mask = 0; #endif VAR_0->gen_op_buf[0].next = 1; VAR_0->gen_op_buf[0].prev = 0; VAR_0->gen_next_op_idx = 1; }
[ "void FUNC_0(TCGContext *VAR_0)\n{", "tcg_pool_reset(VAR_0);", "VAR_0->nb_temps = VAR_0->nb_globals;", "memset(VAR_0->free_temps, 0, sizeof(VAR_0->free_temps));", "VAR_0->nb_labels = 0;", "VAR_0->current_frame_offset = VAR_0->frame_start;", "#ifdef CONFIG_DEBUG_TCG\nVAR_0->goto_tb_issue_mask = 0;", "#endif\nVAR_0->gen_op_buf[0].next = 1;", "VAR_0->gen_op_buf[0].prev = 0;", "VAR_0->gen_next_op_idx = 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 27, 31 ], [ 33 ], [ 35 ], [ 37 ] ]
20,668
static int find_unused_picture(MpegEncContext *s, int shared) { int i; if (shared) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (s->picture[i].f.data[0] == NULL) return i; } } else { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (pic_is_unused(s, &s->picture[i])) return i; } } av_log(s->avctx, AV_LOG_FATAL, "Internal error, picture buffer overflow\n"); /* We could return -1, but the codec would crash trying to draw into a * non-existing frame anyway. This is safer than waiting for a random crash. * Also the return of this is never useful, an encoder must only allocate * as much as allowed in the specification. This has no relationship to how * much libavcodec could allocate (and MAX_PICTURE_COUNT is always large * enough for such valid streams). * Plus, a decoder has to check stream validity and remove frames if too * many reference frames are around. Waiting for "OOM" is not correct at * all. Similarly, missing reference frames have to be replaced by * interpolated/MC frames, anything else is a bug in the codec ... */ abort(); return -1; }
true
FFmpeg
9e73f6d1f9a242ea0b2fdb3bf22890d2a4422be0
static int find_unused_picture(MpegEncContext *s, int shared) { int i; if (shared) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (s->picture[i].f.data[0] == NULL) return i; } } else { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (pic_is_unused(s, &s->picture[i])) return i; } } av_log(s->avctx, AV_LOG_FATAL, "Internal error, picture buffer overflow\n"); abort(); return -1; }
{ "code": [ " if (s->picture[i].f.data[0] == NULL)" ], "line_no": [ 13 ] }
static int FUNC_0(MpegEncContext *VAR_0, int VAR_1) { int VAR_2; if (VAR_1) { for (VAR_2 = 0; VAR_2 < MAX_PICTURE_COUNT; VAR_2++) { if (VAR_0->picture[VAR_2].f.data[0] == NULL) return VAR_2; } } else { for (VAR_2 = 0; VAR_2 < MAX_PICTURE_COUNT; VAR_2++) { if (pic_is_unused(VAR_0, &VAR_0->picture[VAR_2])) return VAR_2; } } av_log(VAR_0->avctx, AV_LOG_FATAL, "Internal error, picture buffer overflow\n"); abort(); return -1; }
[ "static int FUNC_0(MpegEncContext *VAR_0, int VAR_1)\n{", "int VAR_2;", "if (VAR_1) {", "for (VAR_2 = 0; VAR_2 < MAX_PICTURE_COUNT; VAR_2++) {", "if (VAR_0->picture[VAR_2].f.data[0] == NULL)\nreturn VAR_2;", "}", "} else {", "for (VAR_2 = 0; VAR_2 < MAX_PICTURE_COUNT; VAR_2++) {", "if (pic_is_unused(VAR_0, &VAR_0->picture[VAR_2]))\nreturn VAR_2;", "}", "}", "av_log(VAR_0->avctx, AV_LOG_FATAL,\n\"Internal error, picture buffer overflow\\n\");", "abort();", "return -1;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 59 ], [ 61 ], [ 63 ] ]
20,669
static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *picture, int *got_packet) { int xerr, i, ret, user_packet = !!pkt->data; struct xvid_context *x = avctx->priv_data; AVFrame *p = avctx->coded_frame; int mb_width = (avctx->width + 15) / 16; int mb_height = (avctx->height + 15) / 16; char *tmp; xvid_enc_frame_t xvid_enc_frame = { 0 }; xvid_enc_stats_t xvid_enc_stats = { 0 }; if ((ret = ff_alloc_packet2(avctx, pkt, mb_width*mb_height*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0) return ret; /* Start setting up the frame */ xvid_enc_frame.version = XVID_VERSION; xvid_enc_stats.version = XVID_VERSION; /* Let Xvid know where to put the frame. */ xvid_enc_frame.bitstream = pkt->data; xvid_enc_frame.length = pkt->size; /* Initialize input image fields */ if (avctx->pix_fmt != AV_PIX_FMT_YUV420P) { av_log(avctx, AV_LOG_ERROR, "Xvid: Color spaces other than 420P not supported\n"); return AVERROR(EINVAL); } xvid_enc_frame.input.csp = XVID_CSP_PLANAR; /* YUV420P */ for (i = 0; i < 4; i++) { xvid_enc_frame.input.plane[i] = picture->data[i]; xvid_enc_frame.input.stride[i] = picture->linesize[i]; } /* Encoder Flags */ xvid_enc_frame.vop_flags = x->vop_flags; xvid_enc_frame.vol_flags = x->vol_flags; xvid_enc_frame.motion = x->me_flags; xvid_enc_frame.type = picture->pict_type == AV_PICTURE_TYPE_I ? XVID_TYPE_IVOP : picture->pict_type == AV_PICTURE_TYPE_P ? XVID_TYPE_PVOP : picture->pict_type == AV_PICTURE_TYPE_B ? XVID_TYPE_BVOP : XVID_TYPE_AUTO; /* Pixel aspect ratio setting */ if (avctx->sample_aspect_ratio.num < 0 || avctx->sample_aspect_ratio.num > 255 || avctx->sample_aspect_ratio.den < 0 || avctx->sample_aspect_ratio.den > 255) { av_log(avctx, AV_LOG_WARNING, "Invalid pixel aspect ratio %i/%i, limit is 255/255 reducing\n", avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den); av_reduce(&avctx->sample_aspect_ratio.num, &avctx->sample_aspect_ratio.den, avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den, 255); } xvid_enc_frame.par = XVID_PAR_EXT; xvid_enc_frame.par_width = avctx->sample_aspect_ratio.num; xvid_enc_frame.par_height = avctx->sample_aspect_ratio.den; /* Quant Setting */ if (x->qscale) xvid_enc_frame.quant = picture->quality / FF_QP2LAMBDA; else xvid_enc_frame.quant = 0; /* Matrices */ xvid_enc_frame.quant_intra_matrix = x->intra_matrix; xvid_enc_frame.quant_inter_matrix = x->inter_matrix; /* Encode */ xerr = xvid_encore(x->encoder_handle, XVID_ENC_ENCODE, &xvid_enc_frame, &xvid_enc_stats); /* Two-pass log buffer swapping */ avctx->stats_out = NULL; if (x->twopassbuffer) { tmp = x->old_twopassbuffer; x->old_twopassbuffer = x->twopassbuffer; x->twopassbuffer = tmp; x->twopassbuffer[0] = 0; if (x->old_twopassbuffer[0] != 0) { avctx->stats_out = x->old_twopassbuffer; } } if (xerr > 0) { *got_packet = 1; p->quality = xvid_enc_stats.quant * FF_QP2LAMBDA; if (xvid_enc_stats.type == XVID_TYPE_PVOP) p->pict_type = AV_PICTURE_TYPE_P; else if (xvid_enc_stats.type == XVID_TYPE_BVOP) p->pict_type = AV_PICTURE_TYPE_B; else if (xvid_enc_stats.type == XVID_TYPE_SVOP) p->pict_type = AV_PICTURE_TYPE_S; else p->pict_type = AV_PICTURE_TYPE_I; if (xvid_enc_frame.out_flags & XVID_KEYFRAME) { p->key_frame = 1; pkt->flags |= AV_PKT_FLAG_KEY; if (x->quicktime_format) return xvid_strip_vol_header(avctx, pkt, xvid_enc_stats.hlength, xerr); } else p->key_frame = 0; pkt->size = xerr; return 0; } else { if (!user_packet) av_free_packet(pkt); if (!xerr) return 0; av_log(avctx, AV_LOG_ERROR, "Xvid: Encoding Error Occurred: %i\n", xerr); return AVERROR_EXTERNAL; } }
true
FFmpeg
e00499eb4c80752b2c464f3a98bf0b6ce7b1e212
static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *picture, int *got_packet) { int xerr, i, ret, user_packet = !!pkt->data; struct xvid_context *x = avctx->priv_data; AVFrame *p = avctx->coded_frame; int mb_width = (avctx->width + 15) / 16; int mb_height = (avctx->height + 15) / 16; char *tmp; xvid_enc_frame_t xvid_enc_frame = { 0 }; xvid_enc_stats_t xvid_enc_stats = { 0 }; if ((ret = ff_alloc_packet2(avctx, pkt, mb_width*mb_height*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0) return ret; xvid_enc_frame.version = XVID_VERSION; xvid_enc_stats.version = XVID_VERSION; xvid_enc_frame.bitstream = pkt->data; xvid_enc_frame.length = pkt->size; if (avctx->pix_fmt != AV_PIX_FMT_YUV420P) { av_log(avctx, AV_LOG_ERROR, "Xvid: Color spaces other than 420P not supported\n"); return AVERROR(EINVAL); } xvid_enc_frame.input.csp = XVID_CSP_PLANAR; for (i = 0; i < 4; i++) { xvid_enc_frame.input.plane[i] = picture->data[i]; xvid_enc_frame.input.stride[i] = picture->linesize[i]; } xvid_enc_frame.vop_flags = x->vop_flags; xvid_enc_frame.vol_flags = x->vol_flags; xvid_enc_frame.motion = x->me_flags; xvid_enc_frame.type = picture->pict_type == AV_PICTURE_TYPE_I ? XVID_TYPE_IVOP : picture->pict_type == AV_PICTURE_TYPE_P ? XVID_TYPE_PVOP : picture->pict_type == AV_PICTURE_TYPE_B ? XVID_TYPE_BVOP : XVID_TYPE_AUTO; if (avctx->sample_aspect_ratio.num < 0 || avctx->sample_aspect_ratio.num > 255 || avctx->sample_aspect_ratio.den < 0 || avctx->sample_aspect_ratio.den > 255) { av_log(avctx, AV_LOG_WARNING, "Invalid pixel aspect ratio %i/%i, limit is 255/255 reducing\n", avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den); av_reduce(&avctx->sample_aspect_ratio.num, &avctx->sample_aspect_ratio.den, avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den, 255); } xvid_enc_frame.par = XVID_PAR_EXT; xvid_enc_frame.par_width = avctx->sample_aspect_ratio.num; xvid_enc_frame.par_height = avctx->sample_aspect_ratio.den; if (x->qscale) xvid_enc_frame.quant = picture->quality / FF_QP2LAMBDA; else xvid_enc_frame.quant = 0; xvid_enc_frame.quant_intra_matrix = x->intra_matrix; xvid_enc_frame.quant_inter_matrix = x->inter_matrix; xerr = xvid_encore(x->encoder_handle, XVID_ENC_ENCODE, &xvid_enc_frame, &xvid_enc_stats); avctx->stats_out = NULL; if (x->twopassbuffer) { tmp = x->old_twopassbuffer; x->old_twopassbuffer = x->twopassbuffer; x->twopassbuffer = tmp; x->twopassbuffer[0] = 0; if (x->old_twopassbuffer[0] != 0) { avctx->stats_out = x->old_twopassbuffer; } } if (xerr > 0) { *got_packet = 1; p->quality = xvid_enc_stats.quant * FF_QP2LAMBDA; if (xvid_enc_stats.type == XVID_TYPE_PVOP) p->pict_type = AV_PICTURE_TYPE_P; else if (xvid_enc_stats.type == XVID_TYPE_BVOP) p->pict_type = AV_PICTURE_TYPE_B; else if (xvid_enc_stats.type == XVID_TYPE_SVOP) p->pict_type = AV_PICTURE_TYPE_S; else p->pict_type = AV_PICTURE_TYPE_I; if (xvid_enc_frame.out_flags & XVID_KEYFRAME) { p->key_frame = 1; pkt->flags |= AV_PKT_FLAG_KEY; if (x->quicktime_format) return xvid_strip_vol_header(avctx, pkt, xvid_enc_stats.hlength, xerr); } else p->key_frame = 0; pkt->size = xerr; return 0; } else { if (!user_packet) av_free_packet(pkt); if (!xerr) return 0; av_log(avctx, AV_LOG_ERROR, "Xvid: Encoding Error Occurred: %i\n", xerr); return AVERROR_EXTERNAL; } }
{ "code": [ " if ((ret = ff_alloc_packet2(avctx, pkt, mb_width*mb_height*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0)" ], "line_no": [ 27 ] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { int VAR_4, VAR_5, VAR_6, VAR_7 = !!VAR_1->data; struct xvid_context *VAR_8 = VAR_0->priv_data; AVFrame *p = VAR_0->coded_frame; int VAR_9 = (VAR_0->width + 15) / 16; int VAR_10 = (VAR_0->height + 15) / 16; char *VAR_11; xvid_enc_frame_t xvid_enc_frame = { 0 }; xvid_enc_stats_t xvid_enc_stats = { 0 }; if ((VAR_6 = ff_alloc_packet2(VAR_0, VAR_1, VAR_9*VAR_10*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0) return VAR_6; xvid_enc_frame.version = XVID_VERSION; xvid_enc_stats.version = XVID_VERSION; xvid_enc_frame.bitstream = VAR_1->data; xvid_enc_frame.length = VAR_1->size; if (VAR_0->pix_fmt != AV_PIX_FMT_YUV420P) { av_log(VAR_0, AV_LOG_ERROR, "Xvid: Color spaces other than 420P not supported\n"); return AVERROR(EINVAL); } xvid_enc_frame.input.csp = XVID_CSP_PLANAR; for (VAR_5 = 0; VAR_5 < 4; VAR_5++) { xvid_enc_frame.input.plane[VAR_5] = VAR_2->data[VAR_5]; xvid_enc_frame.input.stride[VAR_5] = VAR_2->linesize[VAR_5]; } xvid_enc_frame.vop_flags = VAR_8->vop_flags; xvid_enc_frame.vol_flags = VAR_8->vol_flags; xvid_enc_frame.motion = VAR_8->me_flags; xvid_enc_frame.type = VAR_2->pict_type == AV_PICTURE_TYPE_I ? XVID_TYPE_IVOP : VAR_2->pict_type == AV_PICTURE_TYPE_P ? XVID_TYPE_PVOP : VAR_2->pict_type == AV_PICTURE_TYPE_B ? XVID_TYPE_BVOP : XVID_TYPE_AUTO; if (VAR_0->sample_aspect_ratio.num < 0 || VAR_0->sample_aspect_ratio.num > 255 || VAR_0->sample_aspect_ratio.den < 0 || VAR_0->sample_aspect_ratio.den > 255) { av_log(VAR_0, AV_LOG_WARNING, "Invalid pixel aspect ratio %VAR_5/%VAR_5, limit is 255/255 reducing\n", VAR_0->sample_aspect_ratio.num, VAR_0->sample_aspect_ratio.den); av_reduce(&VAR_0->sample_aspect_ratio.num, &VAR_0->sample_aspect_ratio.den, VAR_0->sample_aspect_ratio.num, VAR_0->sample_aspect_ratio.den, 255); } xvid_enc_frame.par = XVID_PAR_EXT; xvid_enc_frame.par_width = VAR_0->sample_aspect_ratio.num; xvid_enc_frame.par_height = VAR_0->sample_aspect_ratio.den; if (VAR_8->qscale) xvid_enc_frame.quant = VAR_2->quality / FF_QP2LAMBDA; else xvid_enc_frame.quant = 0; xvid_enc_frame.quant_intra_matrix = VAR_8->intra_matrix; xvid_enc_frame.quant_inter_matrix = VAR_8->inter_matrix; VAR_4 = xvid_encore(VAR_8->encoder_handle, XVID_ENC_ENCODE, &xvid_enc_frame, &xvid_enc_stats); VAR_0->stats_out = NULL; if (VAR_8->twopassbuffer) { VAR_11 = VAR_8->old_twopassbuffer; VAR_8->old_twopassbuffer = VAR_8->twopassbuffer; VAR_8->twopassbuffer = VAR_11; VAR_8->twopassbuffer[0] = 0; if (VAR_8->old_twopassbuffer[0] != 0) { VAR_0->stats_out = VAR_8->old_twopassbuffer; } } if (VAR_4 > 0) { *VAR_3 = 1; p->quality = xvid_enc_stats.quant * FF_QP2LAMBDA; if (xvid_enc_stats.type == XVID_TYPE_PVOP) p->pict_type = AV_PICTURE_TYPE_P; else if (xvid_enc_stats.type == XVID_TYPE_BVOP) p->pict_type = AV_PICTURE_TYPE_B; else if (xvid_enc_stats.type == XVID_TYPE_SVOP) p->pict_type = AV_PICTURE_TYPE_S; else p->pict_type = AV_PICTURE_TYPE_I; if (xvid_enc_frame.out_flags & XVID_KEYFRAME) { p->key_frame = 1; VAR_1->flags |= AV_PKT_FLAG_KEY; if (VAR_8->quicktime_format) return xvid_strip_vol_header(VAR_0, VAR_1, xvid_enc_stats.hlength, VAR_4); } else p->key_frame = 0; VAR_1->size = VAR_4; return 0; } else { if (!VAR_7) av_free_packet(VAR_1); if (!VAR_4) return 0; av_log(VAR_0, AV_LOG_ERROR, "Xvid: Encoding Error Occurred: %VAR_5\n", VAR_4); return AVERROR_EXTERNAL; } }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "int VAR_4, VAR_5, VAR_6, VAR_7 = !!VAR_1->data;", "struct xvid_context *VAR_8 = VAR_0->priv_data;", "AVFrame *p = VAR_0->coded_frame;", "int VAR_9 = (VAR_0->width + 15) / 16;", "int VAR_10 = (VAR_0->height + 15) / 16;", "char *VAR_11;", "xvid_enc_frame_t xvid_enc_frame = { 0 };", "xvid_enc_stats_t xvid_enc_stats = { 0 };", "if ((VAR_6 = ff_alloc_packet2(VAR_0, VAR_1, VAR_9*VAR_10*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0)\nreturn VAR_6;", "xvid_enc_frame.version = XVID_VERSION;", "xvid_enc_stats.version = XVID_VERSION;", "xvid_enc_frame.bitstream = VAR_1->data;", "xvid_enc_frame.length = VAR_1->size;", "if (VAR_0->pix_fmt != AV_PIX_FMT_YUV420P) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Xvid: Color spaces other than 420P not supported\\n\");", "return AVERROR(EINVAL);", "}", "xvid_enc_frame.input.csp = XVID_CSP_PLANAR;", "for (VAR_5 = 0; VAR_5 < 4; VAR_5++) {", "xvid_enc_frame.input.plane[VAR_5] = VAR_2->data[VAR_5];", "xvid_enc_frame.input.stride[VAR_5] = VAR_2->linesize[VAR_5];", "}", "xvid_enc_frame.vop_flags = VAR_8->vop_flags;", "xvid_enc_frame.vol_flags = VAR_8->vol_flags;", "xvid_enc_frame.motion = VAR_8->me_flags;", "xvid_enc_frame.type =\nVAR_2->pict_type == AV_PICTURE_TYPE_I ? XVID_TYPE_IVOP :\nVAR_2->pict_type == AV_PICTURE_TYPE_P ? XVID_TYPE_PVOP :\nVAR_2->pict_type == AV_PICTURE_TYPE_B ? XVID_TYPE_BVOP :\nXVID_TYPE_AUTO;", "if (VAR_0->sample_aspect_ratio.num < 0 || VAR_0->sample_aspect_ratio.num > 255 ||\nVAR_0->sample_aspect_ratio.den < 0 || VAR_0->sample_aspect_ratio.den > 255) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"Invalid pixel aspect ratio %VAR_5/%VAR_5, limit is 255/255 reducing\\n\",\nVAR_0->sample_aspect_ratio.num, VAR_0->sample_aspect_ratio.den);", "av_reduce(&VAR_0->sample_aspect_ratio.num, &VAR_0->sample_aspect_ratio.den,\nVAR_0->sample_aspect_ratio.num, VAR_0->sample_aspect_ratio.den, 255);", "}", "xvid_enc_frame.par = XVID_PAR_EXT;", "xvid_enc_frame.par_width = VAR_0->sample_aspect_ratio.num;", "xvid_enc_frame.par_height = VAR_0->sample_aspect_ratio.den;", "if (VAR_8->qscale)\nxvid_enc_frame.quant = VAR_2->quality / FF_QP2LAMBDA;", "else\nxvid_enc_frame.quant = 0;", "xvid_enc_frame.quant_intra_matrix = VAR_8->intra_matrix;", "xvid_enc_frame.quant_inter_matrix = VAR_8->inter_matrix;", "VAR_4 = xvid_encore(VAR_8->encoder_handle, XVID_ENC_ENCODE,\n&xvid_enc_frame, &xvid_enc_stats);", "VAR_0->stats_out = NULL;", "if (VAR_8->twopassbuffer) {", "VAR_11 = VAR_8->old_twopassbuffer;", "VAR_8->old_twopassbuffer = VAR_8->twopassbuffer;", "VAR_8->twopassbuffer = VAR_11;", "VAR_8->twopassbuffer[0] = 0;", "if (VAR_8->old_twopassbuffer[0] != 0) {", "VAR_0->stats_out = VAR_8->old_twopassbuffer;", "}", "}", "if (VAR_4 > 0) {", "*VAR_3 = 1;", "p->quality = xvid_enc_stats.quant * FF_QP2LAMBDA;", "if (xvid_enc_stats.type == XVID_TYPE_PVOP)\np->pict_type = AV_PICTURE_TYPE_P;", "else if (xvid_enc_stats.type == XVID_TYPE_BVOP)\np->pict_type = AV_PICTURE_TYPE_B;", "else if (xvid_enc_stats.type == XVID_TYPE_SVOP)\np->pict_type = AV_PICTURE_TYPE_S;", "else\np->pict_type = AV_PICTURE_TYPE_I;", "if (xvid_enc_frame.out_flags & XVID_KEYFRAME) {", "p->key_frame = 1;", "VAR_1->flags |= AV_PKT_FLAG_KEY;", "if (VAR_8->quicktime_format)\nreturn xvid_strip_vol_header(VAR_0, VAR_1,\nxvid_enc_stats.hlength, VAR_4);", "} else", "p->key_frame = 0;", "VAR_1->size = VAR_4;", "return 0;", "} else {", "if (!VAR_7)\nav_free_packet(VAR_1);", "if (!VAR_4)\nreturn 0;", "av_log(VAR_0, AV_LOG_ERROR,\n\"Xvid: Encoding Error Occurred: %VAR_5\\n\", VAR_4);", "return AVERROR_EXTERNAL;", "}", "}" ]
[ 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87, 89, 91, 93 ], [ 99, 101 ], [ 103, 105, 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 125, 127 ], [ 129, 131 ], [ 137 ], [ 139 ], [ 145, 147 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 181 ], [ 183, 185 ], [ 187, 189 ], [ 191, 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205, 207, 209 ], [ 211 ], [ 213 ], [ 217 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229, 231 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ] ]
20,671
static void fdctrl_write_data (fdctrl_t *fdctrl, uint32_t value) { fdrive_t *cur_drv; int pos; /* Reset mode */ if (!(fdctrl->dor & FD_DOR_nRESET)) { FLOPPY_DPRINTF("Floppy controller in RESET state !\n"); return; } if (!(fdctrl->msr & FD_MSR_RQM) || (fdctrl->msr & FD_MSR_DIO)) { FLOPPY_ERROR("controller not ready for writing\n"); return; } fdctrl->dsr &= ~FD_DSR_PWRDOWN; /* Is it write command time ? */ if (fdctrl->msr & FD_MSR_NONDMA) { /* FIFO data write */ fdctrl->fifo[fdctrl->data_pos++] = value; if (fdctrl->data_pos % FD_SECTOR_LEN == (FD_SECTOR_LEN - 1) || fdctrl->data_pos == fdctrl->data_len) { cur_drv = get_cur_drv(fdctrl); if (bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { FLOPPY_ERROR("writing sector %d\n", fd_sector(cur_drv)); return; } if (!fdctrl_seek_to_next_sect(fdctrl, cur_drv)) { FLOPPY_DPRINTF("error seeking to next sector %d\n", fd_sector(cur_drv)); return; } } /* Switch from transfer mode to status mode * then from status mode to command mode */ if (fdctrl->data_pos == fdctrl->data_len) fdctrl_stop_transfer(fdctrl, FD_SR0_SEEK, 0x00, 0x00); return; } if (fdctrl->data_pos == 0) { /* Command */ pos = command_to_handler[value & 0xff]; FLOPPY_DPRINTF("%s command\n", handlers[pos].name); fdctrl->data_len = handlers[pos].parameters + 1; } FLOPPY_DPRINTF("%s: %02x\n", __func__, value); fdctrl->fifo[fdctrl->data_pos++] = value; if (fdctrl->data_pos == fdctrl->data_len) { /* We now have all parameters * and will be able to treat the command */ if (fdctrl->data_state & FD_STATE_FORMAT) { fdctrl_format_sector(fdctrl); return; } pos = command_to_handler[fdctrl->fifo[0] & 0xff]; FLOPPY_DPRINTF("treat %s command\n", handlers[pos].name); (*handlers[pos].handler)(fdctrl, handlers[pos].direction); } }
true
qemu
b3bc154098f211db7014de151c79b4234ae5029b
static void fdctrl_write_data (fdctrl_t *fdctrl, uint32_t value) { fdrive_t *cur_drv; int pos; if (!(fdctrl->dor & FD_DOR_nRESET)) { FLOPPY_DPRINTF("Floppy controller in RESET state !\n"); return; } if (!(fdctrl->msr & FD_MSR_RQM) || (fdctrl->msr & FD_MSR_DIO)) { FLOPPY_ERROR("controller not ready for writing\n"); return; } fdctrl->dsr &= ~FD_DSR_PWRDOWN; if (fdctrl->msr & FD_MSR_NONDMA) { fdctrl->fifo[fdctrl->data_pos++] = value; if (fdctrl->data_pos % FD_SECTOR_LEN == (FD_SECTOR_LEN - 1) || fdctrl->data_pos == fdctrl->data_len) { cur_drv = get_cur_drv(fdctrl); if (bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1) < 0) { FLOPPY_ERROR("writing sector %d\n", fd_sector(cur_drv)); return; } if (!fdctrl_seek_to_next_sect(fdctrl, cur_drv)) { FLOPPY_DPRINTF("error seeking to next sector %d\n", fd_sector(cur_drv)); return; } } if (fdctrl->data_pos == fdctrl->data_len) fdctrl_stop_transfer(fdctrl, FD_SR0_SEEK, 0x00, 0x00); return; } if (fdctrl->data_pos == 0) { pos = command_to_handler[value & 0xff]; FLOPPY_DPRINTF("%s command\n", handlers[pos].name); fdctrl->data_len = handlers[pos].parameters + 1; } FLOPPY_DPRINTF("%s: %02x\n", __func__, value); fdctrl->fifo[fdctrl->data_pos++] = value; if (fdctrl->data_pos == fdctrl->data_len) { if (fdctrl->data_state & FD_STATE_FORMAT) { fdctrl_format_sector(fdctrl); return; } pos = command_to_handler[fdctrl->fifo[0] & 0xff]; FLOPPY_DPRINTF("treat %s command\n", handlers[pos].name); (*handlers[pos].handler)(fdctrl, handlers[pos].direction); } }
{ "code": [ " fdctrl->fifo[fdctrl->data_pos++] = value;", " if (fdctrl->data_pos % FD_SECTOR_LEN == (FD_SECTOR_LEN - 1) ||" ], "line_no": [ 37, 39 ] }
static void FUNC_0 (fdctrl_t *VAR_0, uint32_t VAR_1) { fdrive_t *cur_drv; int VAR_2; if (!(VAR_0->dor & FD_DOR_nRESET)) { FLOPPY_DPRINTF("Floppy controller in RESET state !\n"); return; } if (!(VAR_0->msr & FD_MSR_RQM) || (VAR_0->msr & FD_MSR_DIO)) { FLOPPY_ERROR("controller not ready for writing\n"); return; } VAR_0->dsr &= ~FD_DSR_PWRDOWN; if (VAR_0->msr & FD_MSR_NONDMA) { VAR_0->fifo[VAR_0->data_pos++] = VAR_1; if (VAR_0->data_pos % FD_SECTOR_LEN == (FD_SECTOR_LEN - 1) || VAR_0->data_pos == VAR_0->data_len) { cur_drv = get_cur_drv(VAR_0); if (bdrv_write(cur_drv->bs, fd_sector(cur_drv), VAR_0->fifo, 1) < 0) { FLOPPY_ERROR("writing sector %d\n", fd_sector(cur_drv)); return; } if (!fdctrl_seek_to_next_sect(VAR_0, cur_drv)) { FLOPPY_DPRINTF("error seeking to next sector %d\n", fd_sector(cur_drv)); return; } } if (VAR_0->data_pos == VAR_0->data_len) fdctrl_stop_transfer(VAR_0, FD_SR0_SEEK, 0x00, 0x00); return; } if (VAR_0->data_pos == 0) { VAR_2 = command_to_handler[VAR_1 & 0xff]; FLOPPY_DPRINTF("%s command\n", handlers[VAR_2].name); VAR_0->data_len = handlers[VAR_2].parameters + 1; } FLOPPY_DPRINTF("%s: %02x\n", __func__, VAR_1); VAR_0->fifo[VAR_0->data_pos++] = VAR_1; if (VAR_0->data_pos == VAR_0->data_len) { if (VAR_0->data_state & FD_STATE_FORMAT) { fdctrl_format_sector(VAR_0); return; } VAR_2 = command_to_handler[VAR_0->fifo[0] & 0xff]; FLOPPY_DPRINTF("treat %s command\n", handlers[VAR_2].name); (*handlers[VAR_2].handler)(VAR_0, handlers[VAR_2].direction); } }
[ "static void FUNC_0 (fdctrl_t *VAR_0, uint32_t VAR_1)\n{", "fdrive_t *cur_drv;", "int VAR_2;", "if (!(VAR_0->dor & FD_DOR_nRESET)) {", "FLOPPY_DPRINTF(\"Floppy controller in RESET state !\\n\");", "return;", "}", "if (!(VAR_0->msr & FD_MSR_RQM) || (VAR_0->msr & FD_MSR_DIO)) {", "FLOPPY_ERROR(\"controller not ready for writing\\n\");", "return;", "}", "VAR_0->dsr &= ~FD_DSR_PWRDOWN;", "if (VAR_0->msr & FD_MSR_NONDMA) {", "VAR_0->fifo[VAR_0->data_pos++] = VAR_1;", "if (VAR_0->data_pos % FD_SECTOR_LEN == (FD_SECTOR_LEN - 1) ||\nVAR_0->data_pos == VAR_0->data_len) {", "cur_drv = get_cur_drv(VAR_0);", "if (bdrv_write(cur_drv->bs, fd_sector(cur_drv), VAR_0->fifo, 1) < 0) {", "FLOPPY_ERROR(\"writing sector %d\\n\", fd_sector(cur_drv));", "return;", "}", "if (!fdctrl_seek_to_next_sect(VAR_0, cur_drv)) {", "FLOPPY_DPRINTF(\"error seeking to next sector %d\\n\",\nfd_sector(cur_drv));", "return;", "}", "}", "if (VAR_0->data_pos == VAR_0->data_len)\nfdctrl_stop_transfer(VAR_0, FD_SR0_SEEK, 0x00, 0x00);", "return;", "}", "if (VAR_0->data_pos == 0) {", "VAR_2 = command_to_handler[VAR_1 & 0xff];", "FLOPPY_DPRINTF(\"%s command\\n\", handlers[VAR_2].name);", "VAR_0->data_len = handlers[VAR_2].parameters + 1;", "}", "FLOPPY_DPRINTF(\"%s: %02x\\n\", __func__, VAR_1);", "VAR_0->fifo[VAR_0->data_pos++] = VAR_1;", "if (VAR_0->data_pos == VAR_0->data_len) {", "if (VAR_0->data_state & FD_STATE_FORMAT) {", "fdctrl_format_sector(VAR_0);", "return;", "}", "VAR_2 = command_to_handler[VAR_0->fifo[0] & 0xff];", "FLOPPY_DPRINTF(\"treat %s command\\n\", handlers[VAR_2].name);", "(*handlers[VAR_2].handler)(VAR_0, handlers[VAR_2].direction);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ] ]
20,672
void ff_avg_h264_qpel16_mc32_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_midh_qrt_and_aver_dst_16w_msa(src - (2 * stride) - 2, stride, dst, stride, 16, 1); }
false
FFmpeg
72dbc610be3272ba36603f78a39cc2d2d8fe0cc3
void ff_avg_h264_qpel16_mc32_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_midh_qrt_and_aver_dst_16w_msa(src - (2 * stride) - 2, stride, dst, stride, 16, 1); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, ptrdiff_t VAR_2) { avc_luma_midh_qrt_and_aver_dst_16w_msa(VAR_1 - (2 * VAR_2) - 2, VAR_2, VAR_0, VAR_2, 16, 1); }
[ "void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{", "avc_luma_midh_qrt_and_aver_dst_16w_msa(VAR_1 - (2 * VAR_2) - 2,\nVAR_2, VAR_0, VAR_2, 16, 1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ] ]
20,673
static int vhdx_create_new_region_table(BlockDriverState *bs, uint64_t image_size, uint32_t block_size, uint32_t sector_size, uint32_t log_size, bool use_zero_blocks, VHDXImageType type, uint64_t *metadata_offset) { int ret = 0; uint32_t offset = 0; void *buffer = NULL; uint64_t bat_file_offset; uint32_t bat_length; BDRVVHDXState *s = NULL; VHDXRegionTableHeader *region_table; VHDXRegionTableEntry *rt_bat; VHDXRegionTableEntry *rt_metadata; assert(metadata_offset != NULL); /* Populate enough of the BDRVVHDXState to be able to use the * pre-existing BAT calculation, translation, and update functions */ s = g_malloc0(sizeof(BDRVVHDXState)); s->chunk_ratio = (VHDX_MAX_SECTORS_PER_BLOCK) * (uint64_t) sector_size / (uint64_t) block_size; s->sectors_per_block = block_size / sector_size; s->virtual_disk_size = image_size; s->block_size = block_size; s->logical_sector_size = sector_size; vhdx_set_shift_bits(s); vhdx_calc_bat_entries(s); /* At this point the VHDX state is populated enough for creation */ /* a single buffer is used so we can calculate the checksum over the * entire 64KB block */ buffer = g_malloc0(VHDX_HEADER_BLOCK_SIZE); region_table = buffer; offset += sizeof(VHDXRegionTableHeader); rt_bat = buffer + offset; offset += sizeof(VHDXRegionTableEntry); rt_metadata = buffer + offset; region_table->signature = VHDX_REGION_SIGNATURE; region_table->entry_count = 2; /* BAT and Metadata */ rt_bat->guid = bat_guid; rt_bat->length = ROUND_UP(s->bat_entries * sizeof(VHDXBatEntry), MiB); rt_bat->file_offset = ROUND_UP(VHDX_HEADER_SECTION_END + log_size, MiB); s->bat_offset = rt_bat->file_offset; rt_metadata->guid = metadata_guid; rt_metadata->file_offset = ROUND_UP(rt_bat->file_offset + rt_bat->length, MiB); rt_metadata->length = 1 * MiB; /* min size, and more than enough */ *metadata_offset = rt_metadata->file_offset; bat_file_offset = rt_bat->file_offset; bat_length = rt_bat->length; vhdx_region_header_le_export(region_table); vhdx_region_entry_le_export(rt_bat); vhdx_region_entry_le_export(rt_metadata); vhdx_update_checksum(buffer, VHDX_HEADER_BLOCK_SIZE, offsetof(VHDXRegionTableHeader, checksum)); /* The region table gives us the data we need to create the BAT, * so do that now */ ret = vhdx_create_bat(bs, s, image_size, type, use_zero_blocks, bat_file_offset, bat_length); if (ret < 0) { goto exit; } /* Now write out the region headers to disk */ ret = bdrv_pwrite(bs, VHDX_REGION_TABLE_OFFSET, buffer, VHDX_HEADER_BLOCK_SIZE); if (ret < 0) { goto exit; } ret = bdrv_pwrite(bs, VHDX_REGION_TABLE2_OFFSET, buffer, VHDX_HEADER_BLOCK_SIZE); if (ret < 0) { goto exit; } exit: g_free(s); g_free(buffer); return ret; }
true
qemu
5839e53bbc0fec56021d758aab7610df421ed8c8
static int vhdx_create_new_region_table(BlockDriverState *bs, uint64_t image_size, uint32_t block_size, uint32_t sector_size, uint32_t log_size, bool use_zero_blocks, VHDXImageType type, uint64_t *metadata_offset) { int ret = 0; uint32_t offset = 0; void *buffer = NULL; uint64_t bat_file_offset; uint32_t bat_length; BDRVVHDXState *s = NULL; VHDXRegionTableHeader *region_table; VHDXRegionTableEntry *rt_bat; VHDXRegionTableEntry *rt_metadata; assert(metadata_offset != NULL); s = g_malloc0(sizeof(BDRVVHDXState)); s->chunk_ratio = (VHDX_MAX_SECTORS_PER_BLOCK) * (uint64_t) sector_size / (uint64_t) block_size; s->sectors_per_block = block_size / sector_size; s->virtual_disk_size = image_size; s->block_size = block_size; s->logical_sector_size = sector_size; vhdx_set_shift_bits(s); vhdx_calc_bat_entries(s); buffer = g_malloc0(VHDX_HEADER_BLOCK_SIZE); region_table = buffer; offset += sizeof(VHDXRegionTableHeader); rt_bat = buffer + offset; offset += sizeof(VHDXRegionTableEntry); rt_metadata = buffer + offset; region_table->signature = VHDX_REGION_SIGNATURE; region_table->entry_count = 2; rt_bat->guid = bat_guid; rt_bat->length = ROUND_UP(s->bat_entries * sizeof(VHDXBatEntry), MiB); rt_bat->file_offset = ROUND_UP(VHDX_HEADER_SECTION_END + log_size, MiB); s->bat_offset = rt_bat->file_offset; rt_metadata->guid = metadata_guid; rt_metadata->file_offset = ROUND_UP(rt_bat->file_offset + rt_bat->length, MiB); rt_metadata->length = 1 * MiB; *metadata_offset = rt_metadata->file_offset; bat_file_offset = rt_bat->file_offset; bat_length = rt_bat->length; vhdx_region_header_le_export(region_table); vhdx_region_entry_le_export(rt_bat); vhdx_region_entry_le_export(rt_metadata); vhdx_update_checksum(buffer, VHDX_HEADER_BLOCK_SIZE, offsetof(VHDXRegionTableHeader, checksum)); ret = vhdx_create_bat(bs, s, image_size, type, use_zero_blocks, bat_file_offset, bat_length); if (ret < 0) { goto exit; } ret = bdrv_pwrite(bs, VHDX_REGION_TABLE_OFFSET, buffer, VHDX_HEADER_BLOCK_SIZE); if (ret < 0) { goto exit; } ret = bdrv_pwrite(bs, VHDX_REGION_TABLE2_OFFSET, buffer, VHDX_HEADER_BLOCK_SIZE); if (ret < 0) { goto exit; } exit: g_free(s); g_free(buffer); return ret; }
{ "code": [ " s = g_malloc0(sizeof(BDRVVHDXState));" ], "line_no": [ 47 ] }
static int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint32_t VAR_2, uint32_t VAR_3, uint32_t VAR_4, bool VAR_5, VHDXImageType VAR_6, uint64_t *VAR_7) { int VAR_8 = 0; uint32_t offset = 0; void *VAR_9 = NULL; uint64_t bat_file_offset; uint32_t bat_length; BDRVVHDXState *s = NULL; VHDXRegionTableHeader *region_table; VHDXRegionTableEntry *rt_bat; VHDXRegionTableEntry *rt_metadata; assert(VAR_7 != NULL); s = g_malloc0(sizeof(BDRVVHDXState)); s->chunk_ratio = (VHDX_MAX_SECTORS_PER_BLOCK) * (uint64_t) VAR_3 / (uint64_t) VAR_2; s->sectors_per_block = VAR_2 / VAR_3; s->virtual_disk_size = VAR_1; s->VAR_2 = VAR_2; s->logical_sector_size = VAR_3; vhdx_set_shift_bits(s); vhdx_calc_bat_entries(s); VAR_9 = g_malloc0(VHDX_HEADER_BLOCK_SIZE); region_table = VAR_9; offset += sizeof(VHDXRegionTableHeader); rt_bat = VAR_9 + offset; offset += sizeof(VHDXRegionTableEntry); rt_metadata = VAR_9 + offset; region_table->signature = VHDX_REGION_SIGNATURE; region_table->entry_count = 2; rt_bat->guid = bat_guid; rt_bat->length = ROUND_UP(s->bat_entries * sizeof(VHDXBatEntry), MiB); rt_bat->file_offset = ROUND_UP(VHDX_HEADER_SECTION_END + VAR_4, MiB); s->bat_offset = rt_bat->file_offset; rt_metadata->guid = metadata_guid; rt_metadata->file_offset = ROUND_UP(rt_bat->file_offset + rt_bat->length, MiB); rt_metadata->length = 1 * MiB; *VAR_7 = rt_metadata->file_offset; bat_file_offset = rt_bat->file_offset; bat_length = rt_bat->length; vhdx_region_header_le_export(region_table); vhdx_region_entry_le_export(rt_bat); vhdx_region_entry_le_export(rt_metadata); vhdx_update_checksum(VAR_9, VHDX_HEADER_BLOCK_SIZE, offsetof(VHDXRegionTableHeader, checksum)); VAR_8 = vhdx_create_bat(VAR_0, s, VAR_1, VAR_6, VAR_5, bat_file_offset, bat_length); if (VAR_8 < 0) { goto exit; } VAR_8 = bdrv_pwrite(VAR_0, VHDX_REGION_TABLE_OFFSET, VAR_9, VHDX_HEADER_BLOCK_SIZE); if (VAR_8 < 0) { goto exit; } VAR_8 = bdrv_pwrite(VAR_0, VHDX_REGION_TABLE2_OFFSET, VAR_9, VHDX_HEADER_BLOCK_SIZE); if (VAR_8 < 0) { goto exit; } exit: g_free(s); g_free(VAR_9); return VAR_8; }
[ "static int FUNC_0(BlockDriverState *VAR_0,\nuint64_t VAR_1,\nuint32_t VAR_2,\nuint32_t VAR_3,\nuint32_t VAR_4,\nbool VAR_5,\nVHDXImageType VAR_6,\nuint64_t *VAR_7)\n{", "int VAR_8 = 0;", "uint32_t offset = 0;", "void *VAR_9 = NULL;", "uint64_t bat_file_offset;", "uint32_t bat_length;", "BDRVVHDXState *s = NULL;", "VHDXRegionTableHeader *region_table;", "VHDXRegionTableEntry *rt_bat;", "VHDXRegionTableEntry *rt_metadata;", "assert(VAR_7 != NULL);", "s = g_malloc0(sizeof(BDRVVHDXState));", "s->chunk_ratio = (VHDX_MAX_SECTORS_PER_BLOCK) *\n(uint64_t) VAR_3 / (uint64_t) VAR_2;", "s->sectors_per_block = VAR_2 / VAR_3;", "s->virtual_disk_size = VAR_1;", "s->VAR_2 = VAR_2;", "s->logical_sector_size = VAR_3;", "vhdx_set_shift_bits(s);", "vhdx_calc_bat_entries(s);", "VAR_9 = g_malloc0(VHDX_HEADER_BLOCK_SIZE);", "region_table = VAR_9;", "offset += sizeof(VHDXRegionTableHeader);", "rt_bat = VAR_9 + offset;", "offset += sizeof(VHDXRegionTableEntry);", "rt_metadata = VAR_9 + offset;", "region_table->signature = VHDX_REGION_SIGNATURE;", "region_table->entry_count = 2;", "rt_bat->guid = bat_guid;", "rt_bat->length = ROUND_UP(s->bat_entries * sizeof(VHDXBatEntry), MiB);", "rt_bat->file_offset = ROUND_UP(VHDX_HEADER_SECTION_END + VAR_4, MiB);", "s->bat_offset = rt_bat->file_offset;", "rt_metadata->guid = metadata_guid;", "rt_metadata->file_offset = ROUND_UP(rt_bat->file_offset + rt_bat->length,\nMiB);", "rt_metadata->length = 1 * MiB;", "*VAR_7 = rt_metadata->file_offset;", "bat_file_offset = rt_bat->file_offset;", "bat_length = rt_bat->length;", "vhdx_region_header_le_export(region_table);", "vhdx_region_entry_le_export(rt_bat);", "vhdx_region_entry_le_export(rt_metadata);", "vhdx_update_checksum(VAR_9, VHDX_HEADER_BLOCK_SIZE,\noffsetof(VHDXRegionTableHeader, checksum));", "VAR_8 = vhdx_create_bat(VAR_0, s, VAR_1, VAR_6, VAR_5,\nbat_file_offset, bat_length);", "if (VAR_8 < 0) {", "goto exit;", "}", "VAR_8 = bdrv_pwrite(VAR_0, VHDX_REGION_TABLE_OFFSET, VAR_9,\nVHDX_HEADER_BLOCK_SIZE);", "if (VAR_8 < 0) {", "goto exit;", "}", "VAR_8 = bdrv_pwrite(VAR_0, VHDX_REGION_TABLE2_OFFSET, VAR_9,\nVHDX_HEADER_BLOCK_SIZE);", "if (VAR_8 < 0) {", "goto exit;", "}", "exit:\ng_free(s);", "g_free(VAR_9);", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 47 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 139, 141 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ] ]
20,674
iscsi_unmap_cb(struct iscsi_context *iscsi, int status, void *command_data, void *opaque) { IscsiAIOCB *acb = opaque; if (acb->canceled != 0) { qemu_aio_release(acb); scsi_free_scsi_task(acb->task); acb->task = NULL; return; } acb->status = 0; if (status < 0) { error_report("Failed to unmap data on iSCSI lun. %s", iscsi_get_error(iscsi)); acb->status = -EIO; } iscsi_schedule_bh(acb); scsi_free_scsi_task(acb->task); acb->task = NULL; }
true
qemu
1bd075f29ea6d11853475c7c42734595720c3ac6
iscsi_unmap_cb(struct iscsi_context *iscsi, int status, void *command_data, void *opaque) { IscsiAIOCB *acb = opaque; if (acb->canceled != 0) { qemu_aio_release(acb); scsi_free_scsi_task(acb->task); acb->task = NULL; return; } acb->status = 0; if (status < 0) { error_report("Failed to unmap data on iSCSI lun. %s", iscsi_get_error(iscsi)); acb->status = -EIO; } iscsi_schedule_bh(acb); scsi_free_scsi_task(acb->task); acb->task = NULL; }
{ "code": [ " qemu_aio_release(acb);", " scsi_free_scsi_task(acb->task);", " acb->task = NULL;", " scsi_free_scsi_task(acb->task);", " acb->task = NULL;", " qemu_aio_release(acb);", " scsi_free_scsi_task(acb->task);", " acb->task = NULL;", " scsi_free_scsi_task(acb->task);", " acb->task = NULL;", " qemu_aio_release(acb);", " scsi_free_scsi_task(acb->task);", " acb->task = NULL;", " scsi_free_scsi_task(acb->task);", " acb->task = NULL;", " qemu_aio_release(acb);", " scsi_free_scsi_task(acb->task);", " acb->task = NULL;", " scsi_free_scsi_task(acb->task);", " acb->task = NULL;", " qemu_aio_release(acb);", " scsi_free_scsi_task(acb->task);", " acb->task = NULL;", " scsi_free_scsi_task(acb->task);", " acb->task = NULL;" ], "line_no": [ 13, 15, 17, 41, 43, 13, 15, 17, 41, 43, 13, 15, 17, 41, 43, 13, 15, 17, 41, 43, 13, 15, 17, 41, 43 ] }
FUNC_0(struct iscsi_context *VAR_0, int VAR_1, void *VAR_2, void *VAR_3) { IscsiAIOCB *acb = VAR_3; if (acb->canceled != 0) { qemu_aio_release(acb); scsi_free_scsi_task(acb->task); acb->task = NULL; return; } acb->VAR_1 = 0; if (VAR_1 < 0) { error_report("Failed to unmap data on iSCSI lun. %s", iscsi_get_error(VAR_0)); acb->VAR_1 = -EIO; } iscsi_schedule_bh(acb); scsi_free_scsi_task(acb->task); acb->task = NULL; }
[ "FUNC_0(struct iscsi_context *VAR_0, int VAR_1,\nvoid *VAR_2, void *VAR_3)\n{", "IscsiAIOCB *acb = VAR_3;", "if (acb->canceled != 0) {", "qemu_aio_release(acb);", "scsi_free_scsi_task(acb->task);", "acb->task = NULL;", "return;", "}", "acb->VAR_1 = 0;", "if (VAR_1 < 0) {", "error_report(\"Failed to unmap data on iSCSI lun. %s\",\niscsi_get_error(VAR_0));", "acb->VAR_1 = -EIO;", "}", "iscsi_schedule_bh(acb);", "scsi_free_scsi_task(acb->task);", "acb->task = NULL;", "}" ]
[ 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
20,675
static void gen_wsr_prid(DisasContext *dc, uint32_t sr, TCGv_i32 v) { }
true
qemu
53593e90d13264dc88b3281ddf75ceaa641df05a
static void gen_wsr_prid(DisasContext *dc, uint32_t sr, TCGv_i32 v) { }
{ "code": [ "static void gen_wsr_prid(DisasContext *dc, uint32_t sr, TCGv_i32 v)" ], "line_no": [ 1 ] }
static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1, TCGv_i32 VAR_2) { }
[ "static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1, TCGv_i32 VAR_2)\n{", "}" ]
[ 1, 0 ]
[ [ 1, 3 ], [ 5 ] ]
20,677
int ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number) { int time_incr; int time_div, time_mod; if (s->pict_type == AV_PICTURE_TYPE_I) { if (!(s->avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)) { if (s->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT) // HACK, the reference sw is buggy mpeg4_encode_visual_object_header(s); if (s->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT || picture_number == 0) // HACK, the reference sw is buggy mpeg4_encode_vol_header(s, 0, 0); } if (!(s->workaround_bugs & FF_BUG_MS)) mpeg4_encode_gop_header(s); } s->partitioned_frame = s->data_partitioning && s->pict_type != AV_PICTURE_TYPE_B; put_bits(&s->pb, 16, 0); /* vop header */ put_bits(&s->pb, 16, VOP_STARTCODE); /* vop header */ put_bits(&s->pb, 2, s->pict_type - 1); /* pict type: I = 0 , P = 1 */ time_div = FFUDIV(s->time, s->avctx->time_base.den); time_mod = FFUMOD(s->time, s->avctx->time_base.den); time_incr = time_div - s->last_time_base; av_assert0(time_incr >= 0); // This limits the frame duration to max 1 hour if (time_incr > 3600) { av_log(s->avctx, AV_LOG_ERROR, "time_incr %d too large\n", time_incr); return AVERROR(EINVAL); } while (time_incr--) put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 1); /* marker */ put_bits(&s->pb, s->time_increment_bits, time_mod); /* time increment */ put_bits(&s->pb, 1, 1); /* marker */ put_bits(&s->pb, 1, 1); /* vop coded */ if (s->pict_type == AV_PICTURE_TYPE_P) { put_bits(&s->pb, 1, s->no_rounding); /* rounding type */ } put_bits(&s->pb, 3, 0); /* intra dc VLC threshold */ if (!s->progressive_sequence) { put_bits(&s->pb, 1, s->current_picture_ptr->f->top_field_first); put_bits(&s->pb, 1, s->alternate_scan); } // FIXME sprite stuff put_bits(&s->pb, 5, s->qscale); if (s->pict_type != AV_PICTURE_TYPE_I) put_bits(&s->pb, 3, s->f_code); /* fcode_for */ if (s->pict_type == AV_PICTURE_TYPE_B) put_bits(&s->pb, 3, s->b_code); /* fcode_back */ return 0; }
true
FFmpeg
f502583663eb2cacfd7f5bb29b39420a970d4fb4
int ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number) { int time_incr; int time_div, time_mod; if (s->pict_type == AV_PICTURE_TYPE_I) { if (!(s->avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)) { if (s->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT) mpeg4_encode_visual_object_header(s); if (s->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT || picture_number == 0) mpeg4_encode_vol_header(s, 0, 0); } if (!(s->workaround_bugs & FF_BUG_MS)) mpeg4_encode_gop_header(s); } s->partitioned_frame = s->data_partitioning && s->pict_type != AV_PICTURE_TYPE_B; put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, VOP_STARTCODE); put_bits(&s->pb, 2, s->pict_type - 1); time_div = FFUDIV(s->time, s->avctx->time_base.den); time_mod = FFUMOD(s->time, s->avctx->time_base.den); time_incr = time_div - s->last_time_base; av_assert0(time_incr >= 0); if (time_incr > 3600) { av_log(s->avctx, AV_LOG_ERROR, "time_incr %d too large\n", time_incr); return AVERROR(EINVAL); } while (time_incr--) put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, 1); put_bits(&s->pb, s->time_increment_bits, time_mod); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 1); if (s->pict_type == AV_PICTURE_TYPE_P) { put_bits(&s->pb, 1, s->no_rounding); } put_bits(&s->pb, 3, 0); if (!s->progressive_sequence) { put_bits(&s->pb, 1, s->current_picture_ptr->f->top_field_first); put_bits(&s->pb, 1, s->alternate_scan); } put_bits(&s->pb, 5, s->qscale); if (s->pict_type != AV_PICTURE_TYPE_I) put_bits(&s->pb, 3, s->f_code); if (s->pict_type == AV_PICTURE_TYPE_B) put_bits(&s->pb, 3, s->b_code); return 0; }
{ "code": [ " int time_incr;", " int time_div, time_mod;", " av_assert0(time_incr >= 0);", " av_log(s->avctx, AV_LOG_ERROR, \"time_incr %d too large\\n\", time_incr);" ], "line_no": [ 5, 7, 51, 59 ] }
int FUNC_0(MpegEncContext *VAR_0, int VAR_1) { int VAR_2; int VAR_3, VAR_4; if (VAR_0->pict_type == AV_PICTURE_TYPE_I) { if (!(VAR_0->avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)) { if (VAR_0->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT) mpeg4_encode_visual_object_header(VAR_0); if (VAR_0->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT || VAR_1 == 0) mpeg4_encode_vol_header(VAR_0, 0, 0); } if (!(VAR_0->workaround_bugs & FF_BUG_MS)) mpeg4_encode_gop_header(VAR_0); } VAR_0->partitioned_frame = VAR_0->data_partitioning && VAR_0->pict_type != AV_PICTURE_TYPE_B; put_bits(&VAR_0->pb, 16, 0); put_bits(&VAR_0->pb, 16, VOP_STARTCODE); put_bits(&VAR_0->pb, 2, VAR_0->pict_type - 1); VAR_3 = FFUDIV(VAR_0->time, VAR_0->avctx->time_base.den); VAR_4 = FFUMOD(VAR_0->time, VAR_0->avctx->time_base.den); VAR_2 = VAR_3 - VAR_0->last_time_base; av_assert0(VAR_2 >= 0); if (VAR_2 > 3600) { av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_2 %d too large\n", VAR_2); return AVERROR(EINVAL); } while (VAR_2--) put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, 1, 0); put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, VAR_0->time_increment_bits, VAR_4); put_bits(&VAR_0->pb, 1, 1); put_bits(&VAR_0->pb, 1, 1); if (VAR_0->pict_type == AV_PICTURE_TYPE_P) { put_bits(&VAR_0->pb, 1, VAR_0->no_rounding); } put_bits(&VAR_0->pb, 3, 0); if (!VAR_0->progressive_sequence) { put_bits(&VAR_0->pb, 1, VAR_0->current_picture_ptr->f->top_field_first); put_bits(&VAR_0->pb, 1, VAR_0->alternate_scan); } put_bits(&VAR_0->pb, 5, VAR_0->qscale); if (VAR_0->pict_type != AV_PICTURE_TYPE_I) put_bits(&VAR_0->pb, 3, VAR_0->f_code); if (VAR_0->pict_type == AV_PICTURE_TYPE_B) put_bits(&VAR_0->pb, 3, VAR_0->b_code); return 0; }
[ "int FUNC_0(MpegEncContext *VAR_0, int VAR_1)\n{", "int VAR_2;", "int VAR_3, VAR_4;", "if (VAR_0->pict_type == AV_PICTURE_TYPE_I) {", "if (!(VAR_0->avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)) {", "if (VAR_0->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT)\nmpeg4_encode_visual_object_header(VAR_0);", "if (VAR_0->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT || VAR_1 == 0)\nmpeg4_encode_vol_header(VAR_0, 0, 0);", "}", "if (!(VAR_0->workaround_bugs & FF_BUG_MS))\nmpeg4_encode_gop_header(VAR_0);", "}", "VAR_0->partitioned_frame = VAR_0->data_partitioning && VAR_0->pict_type != AV_PICTURE_TYPE_B;", "put_bits(&VAR_0->pb, 16, 0);", "put_bits(&VAR_0->pb, 16, VOP_STARTCODE);", "put_bits(&VAR_0->pb, 2, VAR_0->pict_type - 1);", "VAR_3 = FFUDIV(VAR_0->time, VAR_0->avctx->time_base.den);", "VAR_4 = FFUMOD(VAR_0->time, VAR_0->avctx->time_base.den);", "VAR_2 = VAR_3 - VAR_0->last_time_base;", "av_assert0(VAR_2 >= 0);", "if (VAR_2 > 3600) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_2 %d too large\\n\", VAR_2);", "return AVERROR(EINVAL);", "}", "while (VAR_2--)\nput_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, 1, 0);", "put_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, VAR_0->time_increment_bits, VAR_4);", "put_bits(&VAR_0->pb, 1, 1);", "put_bits(&VAR_0->pb, 1, 1);", "if (VAR_0->pict_type == AV_PICTURE_TYPE_P) {", "put_bits(&VAR_0->pb, 1, VAR_0->no_rounding);", "}", "put_bits(&VAR_0->pb, 3, 0);", "if (!VAR_0->progressive_sequence) {", "put_bits(&VAR_0->pb, 1, VAR_0->current_picture_ptr->f->top_field_first);", "put_bits(&VAR_0->pb, 1, VAR_0->alternate_scan);", "}", "put_bits(&VAR_0->pb, 5, VAR_0->qscale);", "if (VAR_0->pict_type != AV_PICTURE_TYPE_I)\nput_bits(&VAR_0->pb, 3, VAR_0->f_code);", "if (VAR_0->pict_type == AV_PICTURE_TYPE_B)\nput_bits(&VAR_0->pb, 3, VAR_0->b_code);", "return 0;", "}" ]
[ 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 103 ], [ 107, 109 ], [ 111, 113 ], [ 117 ], [ 119 ] ]
20,678
static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){ int v; int i=0; uint8_t state[CONTEXT_SIZE]; memset(state, 128, sizeof(state)); for(v=0; i<128 ; v++){ int len= get_symbol(c, state, 0) + 1; if(len + i > 128) return -1; while(len--){ quant_table[i] = scale*v; i++; //printf("%2d ",v); //if(i%16==0) printf("\n"); } } for(i=1; i<128; i++){ quant_table[256-i]= -quant_table[i]; } quant_table[128]= -quant_table[127]; return 2*v - 1; }
true
FFmpeg
9ebe6e391071690dbee79a645c51b14bd55c2ff4
static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){ int v; int i=0; uint8_t state[CONTEXT_SIZE]; memset(state, 128, sizeof(state)); for(v=0; i<128 ; v++){ int len= get_symbol(c, state, 0) + 1; if(len + i > 128) return -1; while(len--){ quant_table[i] = scale*v; i++; } } for(i=1; i<128; i++){ quant_table[256-i]= -quant_table[i]; } quant_table[128]= -quant_table[127]; return 2*v - 1; }
{ "code": [ " int len= get_symbol(c, state, 0) + 1;", " if(len + i > 128) return -1;" ], "line_no": [ 17, 21 ] }
static int FUNC_0(RangeCoder *VAR_0, int16_t *VAR_1, int VAR_2){ int VAR_3; int VAR_4=0; uint8_t state[CONTEXT_SIZE]; memset(state, 128, sizeof(state)); for(VAR_3=0; VAR_4<128 ; VAR_3++){ int VAR_5= get_symbol(VAR_0, state, 0) + 1; if(VAR_5 + VAR_4 > 128) return -1; while(VAR_5--){ VAR_1[VAR_4] = VAR_2*VAR_3; VAR_4++; } } for(VAR_4=1; VAR_4<128; VAR_4++){ VAR_1[256-VAR_4]= -VAR_1[VAR_4]; } VAR_1[128]= -VAR_1[127]; return 2*VAR_3 - 1; }
[ "static int FUNC_0(RangeCoder *VAR_0, int16_t *VAR_1, int VAR_2){", "int VAR_3;", "int VAR_4=0;", "uint8_t state[CONTEXT_SIZE];", "memset(state, 128, sizeof(state));", "for(VAR_3=0; VAR_4<128 ; VAR_3++){", "int VAR_5= get_symbol(VAR_0, state, 0) + 1;", "if(VAR_5 + VAR_4 > 128) return -1;", "while(VAR_5--){", "VAR_1[VAR_4] = VAR_2*VAR_3;", "VAR_4++;", "}", "}", "for(VAR_4=1; VAR_4<128; VAR_4++){", "VAR_1[256-VAR_4]= -VAR_1[VAR_4];", "}", "VAR_1[128]= -VAR_1[127];", "return 2*VAR_3 - 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ] ]
20,679
static int parse_read_intervals(const char *intervals_spec) { int ret, n, i; char *p, *spec = av_strdup(intervals_spec); if (!spec) return AVERROR(ENOMEM); /* preparse specification, get number of intervals */ for (n = 0, p = spec; *p; p++) if (*p == ',') n++; n++; read_intervals = av_malloc(n * sizeof(*read_intervals)); if (!read_intervals) { ret = AVERROR(ENOMEM); goto end; } read_intervals_nb = n; /* parse intervals */ p = spec; for (i = 0; i < n; i++) { char *next = strchr(p, ','); if (next) *next++ = 0; read_intervals[i].id = i; ret = parse_read_interval(p, &read_intervals[i]); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Error parsing read interval #%d '%s'\n", i, p); goto end; } av_log(NULL, AV_LOG_VERBOSE, "Parsed log interval "); log_read_interval(&read_intervals[i], NULL, AV_LOG_VERBOSE); p = next; av_assert0(i <= read_intervals_nb); } av_assert0(i == read_intervals_nb); end: av_free(spec); return ret; }
false
FFmpeg
ddaf33f5bba59f013a4191a4b22ba83c420cce38
static int parse_read_intervals(const char *intervals_spec) { int ret, n, i; char *p, *spec = av_strdup(intervals_spec); if (!spec) return AVERROR(ENOMEM); for (n = 0, p = spec; *p; p++) if (*p == ',') n++; n++; read_intervals = av_malloc(n * sizeof(*read_intervals)); if (!read_intervals) { ret = AVERROR(ENOMEM); goto end; } read_intervals_nb = n; p = spec; for (i = 0; i < n; i++) { char *next = strchr(p, ','); if (next) *next++ = 0; read_intervals[i].id = i; ret = parse_read_interval(p, &read_intervals[i]); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Error parsing read interval #%d '%s'\n", i, p); goto end; } av_log(NULL, AV_LOG_VERBOSE, "Parsed log interval "); log_read_interval(&read_intervals[i], NULL, AV_LOG_VERBOSE); p = next; av_assert0(i <= read_intervals_nb); } av_assert0(i == read_intervals_nb); end: av_free(spec); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0) { int VAR_1, VAR_2, VAR_3; char *VAR_4, *VAR_5 = av_strdup(VAR_0); if (!VAR_5) return AVERROR(ENOMEM); for (VAR_2 = 0, VAR_4 = VAR_5; *VAR_4; VAR_4++) if (*VAR_4 == ',') VAR_2++; VAR_2++; read_intervals = av_malloc(VAR_2 * sizeof(*read_intervals)); if (!read_intervals) { VAR_1 = AVERROR(ENOMEM); goto end; } read_intervals_nb = VAR_2; VAR_4 = VAR_5; for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) { char *VAR_6 = strchr(VAR_4, ','); if (VAR_6) *VAR_6++ = 0; read_intervals[VAR_3].id = VAR_3; VAR_1 = parse_read_interval(VAR_4, &read_intervals[VAR_3]); if (VAR_1 < 0) { av_log(NULL, AV_LOG_ERROR, "Error parsing read interval #%d '%s'\VAR_2", VAR_3, VAR_4); goto end; } av_log(NULL, AV_LOG_VERBOSE, "Parsed log interval "); log_read_interval(&read_intervals[VAR_3], NULL, AV_LOG_VERBOSE); VAR_4 = VAR_6; av_assert0(VAR_3 <= read_intervals_nb); } av_assert0(VAR_3 == read_intervals_nb); end: av_free(VAR_5); return VAR_1; }
[ "static int FUNC_0(const char *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3;", "char *VAR_4, *VAR_5 = av_strdup(VAR_0);", "if (!VAR_5)\nreturn AVERROR(ENOMEM);", "for (VAR_2 = 0, VAR_4 = VAR_5; *VAR_4; VAR_4++)", "if (*VAR_4 == ',')\nVAR_2++;", "VAR_2++;", "read_intervals = av_malloc(VAR_2 * sizeof(*read_intervals));", "if (!read_intervals) {", "VAR_1 = AVERROR(ENOMEM);", "goto end;", "}", "read_intervals_nb = VAR_2;", "VAR_4 = VAR_5;", "for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) {", "char *VAR_6 = strchr(VAR_4, ',');", "if (VAR_6)\n*VAR_6++ = 0;", "read_intervals[VAR_3].id = VAR_3;", "VAR_1 = parse_read_interval(VAR_4, &read_intervals[VAR_3]);", "if (VAR_1 < 0) {", "av_log(NULL, AV_LOG_ERROR, \"Error parsing read interval #%d '%s'\\VAR_2\",\nVAR_3, VAR_4);", "goto end;", "}", "av_log(NULL, AV_LOG_VERBOSE, \"Parsed log interval \");", "log_read_interval(&read_intervals[VAR_3], NULL, AV_LOG_VERBOSE);", "VAR_4 = VAR_6;", "av_assert0(VAR_3 <= read_intervals_nb);", "}", "av_assert0(VAR_3 == read_intervals_nb);", "end:\nav_free(VAR_5);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 87 ], [ 89 ] ]
20,680
static void piix4_pm_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->no_hotplug = 1; k->init = piix4_pm_initfn; k->config_write = pm_write_config; k->vendor_id = PCI_VENDOR_ID_INTEL; k->device_id = PCI_DEVICE_ID_INTEL_82371AB_3; k->revision = 0x03; k->class_id = PCI_CLASS_BRIDGE_OTHER; dc->desc = "PM"; dc->no_user = 1; dc->vmsd = &vmstate_acpi; dc->props = piix4_pm_properties; }
true
qemu
efec3dd631d94160288392721a5f9c39e50fb2bc
static void piix4_pm_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->no_hotplug = 1; k->init = piix4_pm_initfn; k->config_write = pm_write_config; k->vendor_id = PCI_VENDOR_ID_INTEL; k->device_id = PCI_DEVICE_ID_INTEL_82371AB_3; k->revision = 0x03; k->class_id = PCI_CLASS_BRIDGE_OTHER; dc->desc = "PM"; dc->no_user = 1; dc->vmsd = &vmstate_acpi; dc->props = piix4_pm_properties; }
{ "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 = piix4_pm_initfn; k->config_write = pm_write_config; k->vendor_id = PCI_VENDOR_ID_INTEL; k->device_id = PCI_DEVICE_ID_INTEL_82371AB_3; k->revision = 0x03; k->class_id = PCI_CLASS_BRIDGE_OTHER; dc->desc = "PM"; dc->no_user = 1; dc->vmsd = &vmstate_acpi; dc->props = piix4_pm_properties; }
[ "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 = piix4_pm_initfn;", "k->config_write = pm_write_config;", "k->vendor_id = PCI_VENDOR_ID_INTEL;", "k->device_id = PCI_DEVICE_ID_INTEL_82371AB_3;", "k->revision = 0x03;", "k->class_id = PCI_CLASS_BRIDGE_OTHER;", "dc->desc = \"PM\";", "dc->no_user = 1;", "dc->vmsd = &vmstate_acpi;", "dc->props = piix4_pm_properties;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
20,681
static void setup_rt_frame_v1(int usig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUARMState *env) { struct rt_sigframe_v1 *frame; abi_ulong frame_addr = get_sigframe(ka, env, sizeof(*frame)); struct target_sigaltstack stack; int i; abi_ulong info_addr, uc_addr; if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) return /* 1 */; info_addr = frame_addr + offsetof(struct rt_sigframe_v1, info); __put_user(info_addr, &frame->pinfo); uc_addr = frame_addr + offsetof(struct rt_sigframe_v1, uc); __put_user(uc_addr, &frame->puc); copy_siginfo_to_user(&frame->info, info); /* Clear all the bits of the ucontext we don't use. */ memset(&frame->uc, 0, offsetof(struct target_ucontext_v1, tuc_mcontext)); memset(&stack, 0, sizeof(stack)); __put_user(target_sigaltstack_used.ss_sp, &stack.ss_sp); __put_user(target_sigaltstack_used.ss_size, &stack.ss_size); __put_user(sas_ss_flags(get_sp_from_cpustate(env)), &stack.ss_flags); memcpy(&frame->uc.tuc_stack, &stack, sizeof(stack)); setup_sigcontext(&frame->uc.tuc_mcontext, env, set->sig[0]); for(i = 0; i < TARGET_NSIG_WORDS; i++) { if (__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i])) goto end; } setup_return(env, ka, &frame->retcode, frame_addr, usig, frame_addr + offsetof(struct rt_sigframe_v1, retcode)); env->regs[1] = info_addr; env->regs[2] = uc_addr; end: unlock_user_struct(frame, frame_addr, 1); }
true
qemu
0188fadb7fe460d8c4c743372b1f7b25773e183e
static void setup_rt_frame_v1(int usig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUARMState *env) { struct rt_sigframe_v1 *frame; abi_ulong frame_addr = get_sigframe(ka, env, sizeof(*frame)); struct target_sigaltstack stack; int i; abi_ulong info_addr, uc_addr; if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) return ; info_addr = frame_addr + offsetof(struct rt_sigframe_v1, info); __put_user(info_addr, &frame->pinfo); uc_addr = frame_addr + offsetof(struct rt_sigframe_v1, uc); __put_user(uc_addr, &frame->puc); copy_siginfo_to_user(&frame->info, info); memset(&frame->uc, 0, offsetof(struct target_ucontext_v1, tuc_mcontext)); memset(&stack, 0, sizeof(stack)); __put_user(target_sigaltstack_used.ss_sp, &stack.ss_sp); __put_user(target_sigaltstack_used.ss_size, &stack.ss_size); __put_user(sas_ss_flags(get_sp_from_cpustate(env)), &stack.ss_flags); memcpy(&frame->uc.tuc_stack, &stack, sizeof(stack)); setup_sigcontext(&frame->uc.tuc_mcontext, env, set->sig[0]); for(i = 0; i < TARGET_NSIG_WORDS; i++) { if (__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i])) goto end; } setup_return(env, ka, &frame->retcode, frame_addr, usig, frame_addr + offsetof(struct rt_sigframe_v1, retcode)); env->regs[1] = info_addr; env->regs[2] = uc_addr; end: unlock_user_struct(frame, frame_addr, 1); }
{ "code": [ " for(i = 0; i < TARGET_NSIG_WORDS; i++) {", " if (__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]))", "\tunlock_user_struct(frame, frame_addr, 1);", " goto end;", "end:", " if (__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]))", " goto end;", "end:", "\tunlock_user_struct(frame, frame_addr, 1);" ], "line_no": [ 59, 61, 83, 63, 81, 61, 63, 81, 83 ] }
static void FUNC_0(int VAR_0, struct target_sigaction *VAR_1, target_siginfo_t *VAR_2, target_sigset_t *VAR_3, CPUARMState *VAR_4) { struct rt_sigframe_v1 *VAR_5; abi_ulong frame_addr = get_sigframe(VAR_1, VAR_4, sizeof(*VAR_5)); struct target_sigaltstack VAR_6; int VAR_7; abi_ulong info_addr, uc_addr; if (!lock_user_struct(VERIFY_WRITE, VAR_5, frame_addr, 0)) return ; info_addr = frame_addr + offsetof(struct rt_sigframe_v1, VAR_2); __put_user(info_addr, &VAR_5->pinfo); uc_addr = frame_addr + offsetof(struct rt_sigframe_v1, uc); __put_user(uc_addr, &VAR_5->puc); copy_siginfo_to_user(&VAR_5->VAR_2, VAR_2); memset(&VAR_5->uc, 0, offsetof(struct target_ucontext_v1, tuc_mcontext)); memset(&VAR_6, 0, sizeof(VAR_6)); __put_user(target_sigaltstack_used.ss_sp, &VAR_6.ss_sp); __put_user(target_sigaltstack_used.ss_size, &VAR_6.ss_size); __put_user(sas_ss_flags(get_sp_from_cpustate(VAR_4)), &VAR_6.ss_flags); memcpy(&VAR_5->uc.tuc_stack, &VAR_6, sizeof(VAR_6)); setup_sigcontext(&VAR_5->uc.tuc_mcontext, VAR_4, VAR_3->sig[0]); for(VAR_7 = 0; VAR_7 < TARGET_NSIG_WORDS; VAR_7++) { if (__put_user(VAR_3->sig[VAR_7], &VAR_5->uc.tuc_sigmask.sig[VAR_7])) goto end; } setup_return(VAR_4, VAR_1, &VAR_5->retcode, frame_addr, VAR_0, frame_addr + offsetof(struct rt_sigframe_v1, retcode)); VAR_4->regs[1] = info_addr; VAR_4->regs[2] = uc_addr; end: unlock_user_struct(VAR_5, frame_addr, 1); }
[ "static void FUNC_0(int VAR_0, struct target_sigaction *VAR_1,\ntarget_siginfo_t *VAR_2,\ntarget_sigset_t *VAR_3, CPUARMState *VAR_4)\n{", "struct rt_sigframe_v1 *VAR_5;", "abi_ulong frame_addr = get_sigframe(VAR_1, VAR_4, sizeof(*VAR_5));", "struct target_sigaltstack VAR_6;", "int VAR_7;", "abi_ulong info_addr, uc_addr;", "if (!lock_user_struct(VERIFY_WRITE, VAR_5, frame_addr, 0))\nreturn ;", "info_addr = frame_addr + offsetof(struct rt_sigframe_v1, VAR_2);", "__put_user(info_addr, &VAR_5->pinfo);", "uc_addr = frame_addr + offsetof(struct rt_sigframe_v1, uc);", "__put_user(uc_addr, &VAR_5->puc);", "copy_siginfo_to_user(&VAR_5->VAR_2, VAR_2);", "memset(&VAR_5->uc, 0, offsetof(struct target_ucontext_v1, tuc_mcontext));", "memset(&VAR_6, 0, sizeof(VAR_6));", "__put_user(target_sigaltstack_used.ss_sp, &VAR_6.ss_sp);", "__put_user(target_sigaltstack_used.ss_size, &VAR_6.ss_size);", "__put_user(sas_ss_flags(get_sp_from_cpustate(VAR_4)), &VAR_6.ss_flags);", "memcpy(&VAR_5->uc.tuc_stack, &VAR_6, sizeof(VAR_6));", "setup_sigcontext(&VAR_5->uc.tuc_mcontext, VAR_4, VAR_3->sig[0]);", "for(VAR_7 = 0; VAR_7 < TARGET_NSIG_WORDS; VAR_7++) {", "if (__put_user(VAR_3->sig[VAR_7], &VAR_5->uc.tuc_sigmask.sig[VAR_7]))\ngoto end;", "}", "setup_return(VAR_4, VAR_1, &VAR_5->retcode, frame_addr, VAR_0,\nframe_addr + offsetof(struct rt_sigframe_v1, retcode));", "VAR_4->regs[1] = info_addr;", "VAR_4->regs[2] = uc_addr;", "end:\nunlock_user_struct(VAR_5, frame_addr, 1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 69, 71 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 85 ] ]
20,682
static int alac_decode_frame(AVCodecContext *avctx, void *outbuffer, int *outputsize, AVPacket *avpkt) { const uint8_t *inbuffer = avpkt->data; int input_buffer_size = avpkt->size; ALACContext *alac = avctx->priv_data; int channels; unsigned int outputsamples; int hassize; unsigned int readsamplesize; int isnotcompressed; uint8_t interlacing_shift; uint8_t interlacing_leftweight; int i, ch; /* short-circuit null buffers */ if (!inbuffer || !input_buffer_size) return -1; init_get_bits(&alac->gb, inbuffer, input_buffer_size * 8); channels = get_bits(&alac->gb, 3) + 1; if (channels != avctx->channels) { av_log(avctx, AV_LOG_ERROR, "frame header channel count mismatch\n"); return AVERROR_INVALIDDATA; } /* 2^result = something to do with output waiting. * perhaps matters if we read > 1 frame in a pass? */ skip_bits(&alac->gb, 4); skip_bits(&alac->gb, 12); /* unknown, skip 12 bits */ /* the output sample size is stored soon */ hassize = get_bits1(&alac->gb); alac->extra_bits = get_bits(&alac->gb, 2) << 3; /* whether the frame is compressed */ isnotcompressed = get_bits1(&alac->gb); if (hassize) { /* now read the number of samples as a 32bit integer */ outputsamples = get_bits_long(&alac->gb, 32); if(outputsamples > alac->setinfo_max_samples_per_frame){ av_log(avctx, AV_LOG_ERROR, "outputsamples %d > %d\n", outputsamples, alac->setinfo_max_samples_per_frame); return -1; } } else outputsamples = alac->setinfo_max_samples_per_frame; alac->bytespersample = channels * av_get_bytes_per_sample(avctx->sample_fmt); if(outputsamples > *outputsize / alac->bytespersample){ av_log(avctx, AV_LOG_ERROR, "sample buffer too small\n"); return -1; } *outputsize = outputsamples * alac->bytespersample; readsamplesize = alac->setinfo_sample_size - alac->extra_bits + channels - 1; if (readsamplesize > MIN_CACHE_BITS) { av_log(avctx, AV_LOG_ERROR, "readsamplesize too big (%d)\n", readsamplesize); return -1; } if (!isnotcompressed) { /* so it is compressed */ int16_t predictor_coef_table[MAX_CHANNELS][32]; int predictor_coef_num[MAX_CHANNELS]; int prediction_type[MAX_CHANNELS]; int prediction_quantitization[MAX_CHANNELS]; int ricemodifier[MAX_CHANNELS]; interlacing_shift = get_bits(&alac->gb, 8); interlacing_leftweight = get_bits(&alac->gb, 8); for (ch = 0; ch < channels; ch++) { prediction_type[ch] = get_bits(&alac->gb, 4); prediction_quantitization[ch] = get_bits(&alac->gb, 4); ricemodifier[ch] = get_bits(&alac->gb, 3); predictor_coef_num[ch] = get_bits(&alac->gb, 5); /* read the predictor table */ for (i = 0; i < predictor_coef_num[ch]; i++) predictor_coef_table[ch][i] = (int16_t)get_bits(&alac->gb, 16); } if (alac->extra_bits) { for (i = 0; i < outputsamples; i++) { for (ch = 0; ch < channels; ch++) alac->extra_bits_buffer[ch][i] = get_bits(&alac->gb, alac->extra_bits); } } for (ch = 0; ch < channels; ch++) { bastardized_rice_decompress(alac, alac->predicterror_buffer[ch], outputsamples, readsamplesize, alac->setinfo_rice_initialhistory, alac->setinfo_rice_kmodifier, ricemodifier[ch] * alac->setinfo_rice_historymult / 4, (1 << alac->setinfo_rice_kmodifier) - 1); if (prediction_type[ch] == 0) { /* adaptive fir */ predictor_decompress_fir_adapt(alac->predicterror_buffer[ch], alac->outputsamples_buffer[ch], outputsamples, readsamplesize, predictor_coef_table[ch], predictor_coef_num[ch], prediction_quantitization[ch]); } else { av_log(avctx, AV_LOG_ERROR, "FIXME: unhandled prediction type: %i\n", prediction_type[ch]); /* I think the only other prediction type (or perhaps this is * just a boolean?) runs adaptive fir twice.. like: * predictor_decompress_fir_adapt(predictor_error, tempout, ...) * predictor_decompress_fir_adapt(predictor_error, outputsamples ...) * little strange.. */ } } } else { /* not compressed, easy case */ for (i = 0; i < outputsamples; i++) { for (ch = 0; ch < channels; ch++) { alac->outputsamples_buffer[ch][i] = get_sbits_long(&alac->gb, alac->setinfo_sample_size); } } alac->extra_bits = 0; interlacing_shift = 0; interlacing_leftweight = 0; } if (get_bits(&alac->gb, 3) != 7) av_log(avctx, AV_LOG_ERROR, "Error : Wrong End Of Frame\n"); if (channels == 2 && interlacing_leftweight) { decorrelate_stereo(alac->outputsamples_buffer, outputsamples, interlacing_shift, interlacing_leftweight); } if (alac->extra_bits) { append_extra_bits(alac->outputsamples_buffer, alac->extra_bits_buffer, alac->extra_bits, alac->numchannels, outputsamples); } switch(alac->setinfo_sample_size) { case 16: if (channels == 2) { interleave_stereo_16(alac->outputsamples_buffer, outbuffer, outputsamples); } else { for (i = 0; i < outputsamples; i++) { ((int16_t*)outbuffer)[i] = alac->outputsamples_buffer[0][i]; } } break; case 24: if (channels == 2) { interleave_stereo_24(alac->outputsamples_buffer, outbuffer, outputsamples); } else { for (i = 0; i < outputsamples; i++) ((int32_t *)outbuffer)[i] = alac->outputsamples_buffer[0][i] << 8; } break; } if (input_buffer_size * 8 - get_bits_count(&alac->gb) > 8) av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n", input_buffer_size * 8 - get_bits_count(&alac->gb)); return input_buffer_size; }
false
FFmpeg
30f3e7b524cc31155db7a1b0057f651312f6341e
static int alac_decode_frame(AVCodecContext *avctx, void *outbuffer, int *outputsize, AVPacket *avpkt) { const uint8_t *inbuffer = avpkt->data; int input_buffer_size = avpkt->size; ALACContext *alac = avctx->priv_data; int channels; unsigned int outputsamples; int hassize; unsigned int readsamplesize; int isnotcompressed; uint8_t interlacing_shift; uint8_t interlacing_leftweight; int i, ch; if (!inbuffer || !input_buffer_size) return -1; init_get_bits(&alac->gb, inbuffer, input_buffer_size * 8); channels = get_bits(&alac->gb, 3) + 1; if (channels != avctx->channels) { av_log(avctx, AV_LOG_ERROR, "frame header channel count mismatch\n"); return AVERROR_INVALIDDATA; } skip_bits(&alac->gb, 4); skip_bits(&alac->gb, 12); hassize = get_bits1(&alac->gb); alac->extra_bits = get_bits(&alac->gb, 2) << 3; isnotcompressed = get_bits1(&alac->gb); if (hassize) { outputsamples = get_bits_long(&alac->gb, 32); if(outputsamples > alac->setinfo_max_samples_per_frame){ av_log(avctx, AV_LOG_ERROR, "outputsamples %d > %d\n", outputsamples, alac->setinfo_max_samples_per_frame); return -1; } } else outputsamples = alac->setinfo_max_samples_per_frame; alac->bytespersample = channels * av_get_bytes_per_sample(avctx->sample_fmt); if(outputsamples > *outputsize / alac->bytespersample){ av_log(avctx, AV_LOG_ERROR, "sample buffer too small\n"); return -1; } *outputsize = outputsamples * alac->bytespersample; readsamplesize = alac->setinfo_sample_size - alac->extra_bits + channels - 1; if (readsamplesize > MIN_CACHE_BITS) { av_log(avctx, AV_LOG_ERROR, "readsamplesize too big (%d)\n", readsamplesize); return -1; } if (!isnotcompressed) { int16_t predictor_coef_table[MAX_CHANNELS][32]; int predictor_coef_num[MAX_CHANNELS]; int prediction_type[MAX_CHANNELS]; int prediction_quantitization[MAX_CHANNELS]; int ricemodifier[MAX_CHANNELS]; interlacing_shift = get_bits(&alac->gb, 8); interlacing_leftweight = get_bits(&alac->gb, 8); for (ch = 0; ch < channels; ch++) { prediction_type[ch] = get_bits(&alac->gb, 4); prediction_quantitization[ch] = get_bits(&alac->gb, 4); ricemodifier[ch] = get_bits(&alac->gb, 3); predictor_coef_num[ch] = get_bits(&alac->gb, 5); for (i = 0; i < predictor_coef_num[ch]; i++) predictor_coef_table[ch][i] = (int16_t)get_bits(&alac->gb, 16); } if (alac->extra_bits) { for (i = 0; i < outputsamples; i++) { for (ch = 0; ch < channels; ch++) alac->extra_bits_buffer[ch][i] = get_bits(&alac->gb, alac->extra_bits); } } for (ch = 0; ch < channels; ch++) { bastardized_rice_decompress(alac, alac->predicterror_buffer[ch], outputsamples, readsamplesize, alac->setinfo_rice_initialhistory, alac->setinfo_rice_kmodifier, ricemodifier[ch] * alac->setinfo_rice_historymult / 4, (1 << alac->setinfo_rice_kmodifier) - 1); if (prediction_type[ch] == 0) { predictor_decompress_fir_adapt(alac->predicterror_buffer[ch], alac->outputsamples_buffer[ch], outputsamples, readsamplesize, predictor_coef_table[ch], predictor_coef_num[ch], prediction_quantitization[ch]); } else { av_log(avctx, AV_LOG_ERROR, "FIXME: unhandled prediction type: %i\n", prediction_type[ch]); } } } else { for (i = 0; i < outputsamples; i++) { for (ch = 0; ch < channels; ch++) { alac->outputsamples_buffer[ch][i] = get_sbits_long(&alac->gb, alac->setinfo_sample_size); } } alac->extra_bits = 0; interlacing_shift = 0; interlacing_leftweight = 0; } if (get_bits(&alac->gb, 3) != 7) av_log(avctx, AV_LOG_ERROR, "Error : Wrong End Of Frame\n"); if (channels == 2 && interlacing_leftweight) { decorrelate_stereo(alac->outputsamples_buffer, outputsamples, interlacing_shift, interlacing_leftweight); } if (alac->extra_bits) { append_extra_bits(alac->outputsamples_buffer, alac->extra_bits_buffer, alac->extra_bits, alac->numchannels, outputsamples); } switch(alac->setinfo_sample_size) { case 16: if (channels == 2) { interleave_stereo_16(alac->outputsamples_buffer, outbuffer, outputsamples); } else { for (i = 0; i < outputsamples; i++) { ((int16_t*)outbuffer)[i] = alac->outputsamples_buffer[0][i]; } } break; case 24: if (channels == 2) { interleave_stereo_24(alac->outputsamples_buffer, outbuffer, outputsamples); } else { for (i = 0; i < outputsamples; i++) ((int32_t *)outbuffer)[i] = alac->outputsamples_buffer[0][i] << 8; } break; } if (input_buffer_size * 8 - get_bits_count(&alac->gb) > 8) av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n", input_buffer_size * 8 - get_bits_count(&alac->gb)); return input_buffer_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->data; int VAR_5 = VAR_3->size; ALACContext *alac = VAR_0->priv_data; int VAR_6; unsigned int VAR_7; int VAR_8; unsigned int VAR_9; int VAR_10; uint8_t interlacing_shift; uint8_t interlacing_leftweight; int VAR_11, VAR_12; if (!VAR_4 || !VAR_5) return -1; init_get_bits(&alac->gb, VAR_4, VAR_5 * 8); VAR_6 = get_bits(&alac->gb, 3) + 1; if (VAR_6 != VAR_0->VAR_6) { av_log(VAR_0, AV_LOG_ERROR, "frame header channel count mismatch\n"); return AVERROR_INVALIDDATA; } skip_bits(&alac->gb, 4); skip_bits(&alac->gb, 12); VAR_8 = get_bits1(&alac->gb); alac->extra_bits = get_bits(&alac->gb, 2) << 3; VAR_10 = get_bits1(&alac->gb); if (VAR_8) { VAR_7 = get_bits_long(&alac->gb, 32); if(VAR_7 > alac->setinfo_max_samples_per_frame){ av_log(VAR_0, AV_LOG_ERROR, "VAR_7 %d > %d\n", VAR_7, alac->setinfo_max_samples_per_frame); return -1; } } else VAR_7 = alac->setinfo_max_samples_per_frame; alac->bytespersample = VAR_6 * av_get_bytes_per_sample(VAR_0->sample_fmt); if(VAR_7 > *VAR_2 / alac->bytespersample){ av_log(VAR_0, AV_LOG_ERROR, "sample buffer too small\n"); return -1; } *VAR_2 = VAR_7 * alac->bytespersample; VAR_9 = alac->setinfo_sample_size - alac->extra_bits + VAR_6 - 1; if (VAR_9 > MIN_CACHE_BITS) { av_log(VAR_0, AV_LOG_ERROR, "VAR_9 too big (%d)\n", VAR_9); return -1; } if (!VAR_10) { int16_t predictor_coef_table[MAX_CHANNELS][32]; int VAR_13[MAX_CHANNELS]; int VAR_14[MAX_CHANNELS]; int VAR_15[MAX_CHANNELS]; int VAR_16[MAX_CHANNELS]; interlacing_shift = get_bits(&alac->gb, 8); interlacing_leftweight = get_bits(&alac->gb, 8); for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++) { VAR_14[VAR_12] = get_bits(&alac->gb, 4); VAR_15[VAR_12] = get_bits(&alac->gb, 4); VAR_16[VAR_12] = get_bits(&alac->gb, 3); VAR_13[VAR_12] = get_bits(&alac->gb, 5); for (VAR_11 = 0; VAR_11 < VAR_13[VAR_12]; VAR_11++) predictor_coef_table[VAR_12][VAR_11] = (int16_t)get_bits(&alac->gb, 16); } if (alac->extra_bits) { for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++) { for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++) alac->extra_bits_buffer[VAR_12][VAR_11] = get_bits(&alac->gb, alac->extra_bits); } } for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++) { bastardized_rice_decompress(alac, alac->predicterror_buffer[VAR_12], VAR_7, VAR_9, alac->setinfo_rice_initialhistory, alac->setinfo_rice_kmodifier, VAR_16[VAR_12] * alac->setinfo_rice_historymult / 4, (1 << alac->setinfo_rice_kmodifier) - 1); if (VAR_14[VAR_12] == 0) { predictor_decompress_fir_adapt(alac->predicterror_buffer[VAR_12], alac->outputsamples_buffer[VAR_12], VAR_7, VAR_9, predictor_coef_table[VAR_12], VAR_13[VAR_12], VAR_15[VAR_12]); } else { av_log(VAR_0, AV_LOG_ERROR, "FIXME: unhandled prediction type: %VAR_11\n", VAR_14[VAR_12]); } } } else { for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++) { for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++) { alac->outputsamples_buffer[VAR_12][VAR_11] = get_sbits_long(&alac->gb, alac->setinfo_sample_size); } } alac->extra_bits = 0; interlacing_shift = 0; interlacing_leftweight = 0; } if (get_bits(&alac->gb, 3) != 7) av_log(VAR_0, AV_LOG_ERROR, "Error : Wrong End Of Frame\n"); if (VAR_6 == 2 && interlacing_leftweight) { decorrelate_stereo(alac->outputsamples_buffer, VAR_7, interlacing_shift, interlacing_leftweight); } if (alac->extra_bits) { append_extra_bits(alac->outputsamples_buffer, alac->extra_bits_buffer, alac->extra_bits, alac->numchannels, VAR_7); } switch(alac->setinfo_sample_size) { case 16: if (VAR_6 == 2) { interleave_stereo_16(alac->outputsamples_buffer, VAR_1, VAR_7); } else { for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++) { ((int16_t*)VAR_1)[VAR_11] = alac->outputsamples_buffer[0][VAR_11]; } } break; case 24: if (VAR_6 == 2) { interleave_stereo_24(alac->outputsamples_buffer, VAR_1, VAR_7); } else { for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++) ((int32_t *)VAR_1)[VAR_11] = alac->outputsamples_buffer[0][VAR_11] << 8; } break; } if (VAR_5 * 8 - get_bits_count(&alac->gb) > 8) av_log(VAR_0, AV_LOG_ERROR, "Error : %d bits left\n", VAR_5 * 8 - get_bits_count(&alac->gb)); return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->data;", "int VAR_5 = VAR_3->size;", "ALACContext *alac = VAR_0->priv_data;", "int VAR_6;", "unsigned int VAR_7;", "int VAR_8;", "unsigned int VAR_9;", "int VAR_10;", "uint8_t interlacing_shift;", "uint8_t interlacing_leftweight;", "int VAR_11, VAR_12;", "if (!VAR_4 || !VAR_5)\nreturn -1;", "init_get_bits(&alac->gb, VAR_4, VAR_5 * 8);", "VAR_6 = get_bits(&alac->gb, 3) + 1;", "if (VAR_6 != VAR_0->VAR_6) {", "av_log(VAR_0, AV_LOG_ERROR, \"frame header channel count mismatch\\n\");", "return AVERROR_INVALIDDATA;", "}", "skip_bits(&alac->gb, 4);", "skip_bits(&alac->gb, 12);", "VAR_8 = get_bits1(&alac->gb);", "alac->extra_bits = get_bits(&alac->gb, 2) << 3;", "VAR_10 = get_bits1(&alac->gb);", "if (VAR_8) {", "VAR_7 = get_bits_long(&alac->gb, 32);", "if(VAR_7 > alac->setinfo_max_samples_per_frame){", "av_log(VAR_0, AV_LOG_ERROR, \"VAR_7 %d > %d\\n\", VAR_7, alac->setinfo_max_samples_per_frame);", "return -1;", "}", "} else", "VAR_7 = alac->setinfo_max_samples_per_frame;", "alac->bytespersample = VAR_6 * av_get_bytes_per_sample(VAR_0->sample_fmt);", "if(VAR_7 > *VAR_2 / alac->bytespersample){", "av_log(VAR_0, AV_LOG_ERROR, \"sample buffer too small\\n\");", "return -1;", "}", "*VAR_2 = VAR_7 * alac->bytespersample;", "VAR_9 = alac->setinfo_sample_size - alac->extra_bits + VAR_6 - 1;", "if (VAR_9 > MIN_CACHE_BITS) {", "av_log(VAR_0, AV_LOG_ERROR, \"VAR_9 too big (%d)\\n\", VAR_9);", "return -1;", "}", "if (!VAR_10) {", "int16_t predictor_coef_table[MAX_CHANNELS][32];", "int VAR_13[MAX_CHANNELS];", "int VAR_14[MAX_CHANNELS];", "int VAR_15[MAX_CHANNELS];", "int VAR_16[MAX_CHANNELS];", "interlacing_shift = get_bits(&alac->gb, 8);", "interlacing_leftweight = get_bits(&alac->gb, 8);", "for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++) {", "VAR_14[VAR_12] = get_bits(&alac->gb, 4);", "VAR_15[VAR_12] = get_bits(&alac->gb, 4);", "VAR_16[VAR_12] = get_bits(&alac->gb, 3);", "VAR_13[VAR_12] = get_bits(&alac->gb, 5);", "for (VAR_11 = 0; VAR_11 < VAR_13[VAR_12]; VAR_11++)", "predictor_coef_table[VAR_12][VAR_11] = (int16_t)get_bits(&alac->gb, 16);", "}", "if (alac->extra_bits) {", "for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++) {", "for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++)", "alac->extra_bits_buffer[VAR_12][VAR_11] = get_bits(&alac->gb, alac->extra_bits);", "}", "}", "for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++) {", "bastardized_rice_decompress(alac,\nalac->predicterror_buffer[VAR_12],\nVAR_7,\nVAR_9,\nalac->setinfo_rice_initialhistory,\nalac->setinfo_rice_kmodifier,\nVAR_16[VAR_12] * alac->setinfo_rice_historymult / 4,\n(1 << alac->setinfo_rice_kmodifier) - 1);", "if (VAR_14[VAR_12] == 0) {", "predictor_decompress_fir_adapt(alac->predicterror_buffer[VAR_12],\nalac->outputsamples_buffer[VAR_12],\nVAR_7,\nVAR_9,\npredictor_coef_table[VAR_12],\nVAR_13[VAR_12],\nVAR_15[VAR_12]);", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"FIXME: unhandled prediction type: %VAR_11\\n\", VAR_14[VAR_12]);", "}", "}", "} else {", "for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++) {", "for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++) {", "alac->outputsamples_buffer[VAR_12][VAR_11] = get_sbits_long(&alac->gb,\nalac->setinfo_sample_size);", "}", "}", "alac->extra_bits = 0;", "interlacing_shift = 0;", "interlacing_leftweight = 0;", "}", "if (get_bits(&alac->gb, 3) != 7)\nav_log(VAR_0, AV_LOG_ERROR, \"Error : Wrong End Of Frame\\n\");", "if (VAR_6 == 2 && interlacing_leftweight) {", "decorrelate_stereo(alac->outputsamples_buffer, VAR_7,\ninterlacing_shift, interlacing_leftweight);", "}", "if (alac->extra_bits) {", "append_extra_bits(alac->outputsamples_buffer, alac->extra_bits_buffer,\nalac->extra_bits, alac->numchannels, VAR_7);", "}", "switch(alac->setinfo_sample_size) {", "case 16:\nif (VAR_6 == 2) {", "interleave_stereo_16(alac->outputsamples_buffer, VAR_1,\nVAR_7);", "} else {", "for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++) {", "((int16_t*)VAR_1)[VAR_11] = alac->outputsamples_buffer[0][VAR_11];", "}", "}", "break;", "case 24:\nif (VAR_6 == 2) {", "interleave_stereo_24(alac->outputsamples_buffer, VAR_1,\nVAR_7);", "} else {", "for (VAR_11 = 0; VAR_11 < VAR_7; VAR_11++)", "((int32_t *)VAR_1)[VAR_11] = alac->outputsamples_buffer[0][VAR_11] << 8;", "}", "break;", "}", "if (VAR_5 * 8 - get_bits_count(&alac->gb) > 8)\nav_log(VAR_0, AV_LOG_ERROR, \"Error : %d bits left\\n\", VAR_5 * 8 - get_bits_count(&alac->gb));", "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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 37, 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 65 ], [ 69 ], [ 75 ], [ 79 ], [ 85 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199, 201, 203, 205, 207, 209, 211 ], [ 215 ], [ 219, 221, 223, 225, 227, 229, 231 ], [ 233 ], [ 235 ], [ 249 ], [ 251 ], [ 253 ], [ 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 283 ], [ 285, 287 ], [ 289 ], [ 293 ], [ 295, 297 ], [ 299 ], [ 303 ], [ 305, 307 ], [ 309, 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325, 327 ], [ 329, 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 347, 349 ], [ 353 ], [ 355 ] ]
20,683
static int do_co_pwrite_zeroes(BlockBackend *blk, int64_t offset, int64_t count, int flags, int64_t *total) { Coroutine *co; CoWriteZeroes data = { .blk = blk, .offset = offset, .count = count, .total = total, .flags = flags, .done = false, }; if (count >> BDRV_SECTOR_BITS > INT_MAX) { return -ERANGE; } co = qemu_coroutine_create(co_pwrite_zeroes_entry); qemu_coroutine_enter(co, &data); while (!data.done) { aio_poll(blk_get_aio_context(blk), true); } if (data.ret < 0) { return data.ret; } else { return 1; } }
true
qemu
0b8b8753e4d94901627b3e86431230f2319215c4
static int do_co_pwrite_zeroes(BlockBackend *blk, int64_t offset, int64_t count, int flags, int64_t *total) { Coroutine *co; CoWriteZeroes data = { .blk = blk, .offset = offset, .count = count, .total = total, .flags = flags, .done = false, }; if (count >> BDRV_SECTOR_BITS > INT_MAX) { return -ERANGE; } co = qemu_coroutine_create(co_pwrite_zeroes_entry); qemu_coroutine_enter(co, &data); while (!data.done) { aio_poll(blk_get_aio_context(blk), true); } if (data.ret < 0) { return data.ret; } else { return 1; } }
{ "code": [ " qemu_coroutine_enter(co, &data);", " qemu_coroutine_enter(co, &data);", " co = qemu_coroutine_create(co_pwrite_zeroes_entry);", " qemu_coroutine_enter(co, &data);", " qemu_coroutine_enter(co, &data);" ], "line_no": [ 37, 37, 35, 37, 37 ] }
static int FUNC_0(BlockBackend *VAR_0, int64_t VAR_1, int64_t VAR_2, int VAR_3, int64_t *VAR_4) { Coroutine *co; CoWriteZeroes data = { .VAR_0 = VAR_0, .VAR_1 = VAR_1, .VAR_2 = VAR_2, .VAR_4 = VAR_4, .VAR_3 = VAR_3, .done = false, }; if (VAR_2 >> BDRV_SECTOR_BITS > INT_MAX) { return -ERANGE; } co = qemu_coroutine_create(co_pwrite_zeroes_entry); qemu_coroutine_enter(co, &data); while (!data.done) { aio_poll(blk_get_aio_context(VAR_0), true); } if (data.ret < 0) { return data.ret; } else { return 1; } }
[ "static int FUNC_0(BlockBackend *VAR_0, int64_t VAR_1,\nint64_t VAR_2, int VAR_3, int64_t *VAR_4)\n{", "Coroutine *co;", "CoWriteZeroes data = {", ".VAR_0 = VAR_0,\n.VAR_1 = VAR_1,\n.VAR_2 = VAR_2,\n.VAR_4 = VAR_4,\n.VAR_3 = VAR_3,\n.done = false,\n};", "if (VAR_2 >> BDRV_SECTOR_BITS > INT_MAX) {", "return -ERANGE;", "}", "co = qemu_coroutine_create(co_pwrite_zeroes_entry);", "qemu_coroutine_enter(co, &data);", "while (!data.done) {", "aio_poll(blk_get_aio_context(VAR_0), true);", "}", "if (data.ret < 0) {", "return data.ret;", "} else {", "return 1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11, 13, 15, 17, 19, 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ] ]
20,684
static void idreg_init(target_phys_addr_t addr) { DeviceState *dev; SysBusDevice *s; dev = qdev_create(NULL, "macio_idreg"); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, addr); cpu_physical_memory_write_rom(addr, idreg_data, sizeof(idreg_data)); }
true
qemu
e23a1b33b53d25510320b26d9f154e19c6c99725
static void idreg_init(target_phys_addr_t addr) { DeviceState *dev; SysBusDevice *s; dev = qdev_create(NULL, "macio_idreg"); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, addr); cpu_physical_memory_write_rom(addr, idreg_data, sizeof(idreg_data)); }
{ "code": [ " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);" ], "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 ] }
static void FUNC_0(target_phys_addr_t VAR_0) { DeviceState *dev; SysBusDevice *s; dev = qdev_create(NULL, "macio_idreg"); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, VAR_0); cpu_physical_memory_write_rom(VAR_0, idreg_data, sizeof(idreg_data)); }
[ "static void FUNC_0(target_phys_addr_t VAR_0)\n{", "DeviceState *dev;", "SysBusDevice *s;", "dev = qdev_create(NULL, \"macio_idreg\");", "qdev_init(dev);", "s = sysbus_from_qdev(dev);", "sysbus_mmio_map(s, 0, VAR_0);", "cpu_physical_memory_write_rom(VAR_0, idreg_data, sizeof(idreg_data));", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ] ]
20,685
static void fdctrl_start_transfer (fdctrl_t *fdctrl, int direction) { fdrive_t *cur_drv; uint8_t kh, kt, ks; int did_seek; fdctrl->cur_drv = fdctrl->fifo[1] & 1; cur_drv = get_cur_drv(fdctrl); kt = fdctrl->fifo[2]; kh = fdctrl->fifo[3]; ks = fdctrl->fifo[4]; FLOPPY_DPRINTF("Start transfer at %d %d %02x %02x (%d)\n", fdctrl->cur_drv, kh, kt, ks, _fd_sector(kh, kt, ks, cur_drv->last_sect)); did_seek = 0; switch (fd_seek(cur_drv, kh, kt, ks, fdctrl->config & 0x40)) { case 2: /* sect too big */ fdctrl_stop_transfer(fdctrl, 0x40, 0x00, 0x00); fdctrl->fifo[3] = kt; fdctrl->fifo[4] = kh; fdctrl->fifo[5] = ks; return; case 3: /* track too big */ fdctrl_stop_transfer(fdctrl, 0x40, 0x80, 0x00); fdctrl->fifo[3] = kt; fdctrl->fifo[4] = kh; fdctrl->fifo[5] = ks; return; case 4: /* No seek enabled */ fdctrl_stop_transfer(fdctrl, 0x40, 0x00, 0x00); fdctrl->fifo[3] = kt; fdctrl->fifo[4] = kh; fdctrl->fifo[5] = ks; return; case 1: did_seek = 1; break; default: break; } /* Set the FIFO state */ fdctrl->data_dir = direction; fdctrl->data_pos = 0; FD_SET_STATE(fdctrl->data_state, FD_STATE_DATA); /* FIFO ready for data */ if (fdctrl->fifo[0] & 0x80) fdctrl->data_state |= FD_STATE_MULTI; else fdctrl->data_state &= ~FD_STATE_MULTI; if (did_seek) fdctrl->data_state |= FD_STATE_SEEK; else fdctrl->data_state &= ~FD_STATE_SEEK; if (fdctrl->fifo[5] == 00) { fdctrl->data_len = fdctrl->fifo[8]; } else { int tmp; fdctrl->data_len = 128 << fdctrl->fifo[5]; tmp = (cur_drv->last_sect - ks + 1); if (fdctrl->fifo[0] & 0x80) tmp += cur_drv->last_sect; fdctrl->data_len *= tmp; } fdctrl->eot = fdctrl->fifo[6]; if (fdctrl->dma_en) { int dma_mode; /* DMA transfer are enabled. Check if DMA channel is well programmed */ dma_mode = DMA_get_channel_mode(fdctrl->dma_chann); dma_mode = (dma_mode >> 2) & 3; FLOPPY_DPRINTF("dma_mode=%d direction=%d (%d - %d)\n", dma_mode, direction, (128 << fdctrl->fifo[5]) * (cur_drv->last_sect - ks + 1), fdctrl->data_len); if (((direction == FD_DIR_SCANE || direction == FD_DIR_SCANL || direction == FD_DIR_SCANH) && dma_mode == 0) || (direction == FD_DIR_WRITE && dma_mode == 2) || (direction == FD_DIR_READ && dma_mode == 1)) { /* No access is allowed until DMA transfer has completed */ fdctrl->state |= FD_CTRL_BUSY; /* Now, we just have to wait for the DMA controller to * recall us... */ DMA_hold_DREQ(fdctrl->dma_chann); DMA_schedule(fdctrl->dma_chann); return; } else { FLOPPY_ERROR("dma_mode=%d direction=%d\n", dma_mode, direction); } } FLOPPY_DPRINTF("start non-DMA transfer\n"); /* IO based transfer: calculate len */ fdctrl_raise_irq(fdctrl, 0x00); return; }
true
qemu
3bcb80f1af107c25bf8c255f3ca88ac467f27a1a
static void fdctrl_start_transfer (fdctrl_t *fdctrl, int direction) { fdrive_t *cur_drv; uint8_t kh, kt, ks; int did_seek; fdctrl->cur_drv = fdctrl->fifo[1] & 1; cur_drv = get_cur_drv(fdctrl); kt = fdctrl->fifo[2]; kh = fdctrl->fifo[3]; ks = fdctrl->fifo[4]; FLOPPY_DPRINTF("Start transfer at %d %d %02x %02x (%d)\n", fdctrl->cur_drv, kh, kt, ks, _fd_sector(kh, kt, ks, cur_drv->last_sect)); did_seek = 0; switch (fd_seek(cur_drv, kh, kt, ks, fdctrl->config & 0x40)) { case 2: fdctrl_stop_transfer(fdctrl, 0x40, 0x00, 0x00); fdctrl->fifo[3] = kt; fdctrl->fifo[4] = kh; fdctrl->fifo[5] = ks; return; case 3: fdctrl_stop_transfer(fdctrl, 0x40, 0x80, 0x00); fdctrl->fifo[3] = kt; fdctrl->fifo[4] = kh; fdctrl->fifo[5] = ks; return; case 4: fdctrl_stop_transfer(fdctrl, 0x40, 0x00, 0x00); fdctrl->fifo[3] = kt; fdctrl->fifo[4] = kh; fdctrl->fifo[5] = ks; return; case 1: did_seek = 1; break; default: break; } fdctrl->data_dir = direction; fdctrl->data_pos = 0; FD_SET_STATE(fdctrl->data_state, FD_STATE_DATA); if (fdctrl->fifo[0] & 0x80) fdctrl->data_state |= FD_STATE_MULTI; else fdctrl->data_state &= ~FD_STATE_MULTI; if (did_seek) fdctrl->data_state |= FD_STATE_SEEK; else fdctrl->data_state &= ~FD_STATE_SEEK; if (fdctrl->fifo[5] == 00) { fdctrl->data_len = fdctrl->fifo[8]; } else { int tmp; fdctrl->data_len = 128 << fdctrl->fifo[5]; tmp = (cur_drv->last_sect - ks + 1); if (fdctrl->fifo[0] & 0x80) tmp += cur_drv->last_sect; fdctrl->data_len *= tmp; } fdctrl->eot = fdctrl->fifo[6]; if (fdctrl->dma_en) { int dma_mode; dma_mode = DMA_get_channel_mode(fdctrl->dma_chann); dma_mode = (dma_mode >> 2) & 3; FLOPPY_DPRINTF("dma_mode=%d direction=%d (%d - %d)\n", dma_mode, direction, (128 << fdctrl->fifo[5]) * (cur_drv->last_sect - ks + 1), fdctrl->data_len); if (((direction == FD_DIR_SCANE || direction == FD_DIR_SCANL || direction == FD_DIR_SCANH) && dma_mode == 0) || (direction == FD_DIR_WRITE && dma_mode == 2) || (direction == FD_DIR_READ && dma_mode == 1)) { fdctrl->state |= FD_CTRL_BUSY; DMA_hold_DREQ(fdctrl->dma_chann); DMA_schedule(fdctrl->dma_chann); return; } else { FLOPPY_ERROR("dma_mode=%d direction=%d\n", dma_mode, direction); } } FLOPPY_DPRINTF("start non-DMA transfer\n"); fdctrl_raise_irq(fdctrl, 0x00); return; }
{ "code": [ " fdctrl->data_len = 128 << fdctrl->fifo[5];" ], "line_no": [ 119 ] }
static void FUNC_0 (fdctrl_t *VAR_0, int VAR_1) { fdrive_t *cur_drv; uint8_t kh, kt, ks; int VAR_2; VAR_0->cur_drv = VAR_0->fifo[1] & 1; cur_drv = get_cur_drv(VAR_0); kt = VAR_0->fifo[2]; kh = VAR_0->fifo[3]; ks = VAR_0->fifo[4]; FLOPPY_DPRINTF("Start transfer at %d %d %02x %02x (%d)\n", VAR_0->cur_drv, kh, kt, ks, _fd_sector(kh, kt, ks, cur_drv->last_sect)); VAR_2 = 0; switch (fd_seek(cur_drv, kh, kt, ks, VAR_0->config & 0x40)) { case 2: fdctrl_stop_transfer(VAR_0, 0x40, 0x00, 0x00); VAR_0->fifo[3] = kt; VAR_0->fifo[4] = kh; VAR_0->fifo[5] = ks; return; case 3: fdctrl_stop_transfer(VAR_0, 0x40, 0x80, 0x00); VAR_0->fifo[3] = kt; VAR_0->fifo[4] = kh; VAR_0->fifo[5] = ks; return; case 4: fdctrl_stop_transfer(VAR_0, 0x40, 0x00, 0x00); VAR_0->fifo[3] = kt; VAR_0->fifo[4] = kh; VAR_0->fifo[5] = ks; return; case 1: VAR_2 = 1; break; default: break; } VAR_0->data_dir = VAR_1; VAR_0->data_pos = 0; FD_SET_STATE(VAR_0->data_state, FD_STATE_DATA); if (VAR_0->fifo[0] & 0x80) VAR_0->data_state |= FD_STATE_MULTI; else VAR_0->data_state &= ~FD_STATE_MULTI; if (VAR_2) VAR_0->data_state |= FD_STATE_SEEK; else VAR_0->data_state &= ~FD_STATE_SEEK; if (VAR_0->fifo[5] == 00) { VAR_0->data_len = VAR_0->fifo[8]; } else { int VAR_3; VAR_0->data_len = 128 << VAR_0->fifo[5]; VAR_3 = (cur_drv->last_sect - ks + 1); if (VAR_0->fifo[0] & 0x80) VAR_3 += cur_drv->last_sect; VAR_0->data_len *= VAR_3; } VAR_0->eot = VAR_0->fifo[6]; if (VAR_0->dma_en) { int VAR_4; VAR_4 = DMA_get_channel_mode(VAR_0->dma_chann); VAR_4 = (VAR_4 >> 2) & 3; FLOPPY_DPRINTF("VAR_4=%d VAR_1=%d (%d - %d)\n", VAR_4, VAR_1, (128 << VAR_0->fifo[5]) * (cur_drv->last_sect - ks + 1), VAR_0->data_len); if (((VAR_1 == FD_DIR_SCANE || VAR_1 == FD_DIR_SCANL || VAR_1 == FD_DIR_SCANH) && VAR_4 == 0) || (VAR_1 == FD_DIR_WRITE && VAR_4 == 2) || (VAR_1 == FD_DIR_READ && VAR_4 == 1)) { VAR_0->state |= FD_CTRL_BUSY; DMA_hold_DREQ(VAR_0->dma_chann); DMA_schedule(VAR_0->dma_chann); return; } else { FLOPPY_ERROR("VAR_4=%d VAR_1=%d\n", VAR_4, VAR_1); } } FLOPPY_DPRINTF("start non-DMA transfer\n"); fdctrl_raise_irq(VAR_0, 0x00); return; }
[ "static void FUNC_0 (fdctrl_t *VAR_0, int VAR_1)\n{", "fdrive_t *cur_drv;", "uint8_t kh, kt, ks;", "int VAR_2;", "VAR_0->cur_drv = VAR_0->fifo[1] & 1;", "cur_drv = get_cur_drv(VAR_0);", "kt = VAR_0->fifo[2];", "kh = VAR_0->fifo[3];", "ks = VAR_0->fifo[4];", "FLOPPY_DPRINTF(\"Start transfer at %d %d %02x %02x (%d)\\n\",\nVAR_0->cur_drv, kh, kt, ks,\n_fd_sector(kh, kt, ks, cur_drv->last_sect));", "VAR_2 = 0;", "switch (fd_seek(cur_drv, kh, kt, ks, VAR_0->config & 0x40)) {", "case 2:\nfdctrl_stop_transfer(VAR_0, 0x40, 0x00, 0x00);", "VAR_0->fifo[3] = kt;", "VAR_0->fifo[4] = kh;", "VAR_0->fifo[5] = ks;", "return;", "case 3:\nfdctrl_stop_transfer(VAR_0, 0x40, 0x80, 0x00);", "VAR_0->fifo[3] = kt;", "VAR_0->fifo[4] = kh;", "VAR_0->fifo[5] = ks;", "return;", "case 4:\nfdctrl_stop_transfer(VAR_0, 0x40, 0x00, 0x00);", "VAR_0->fifo[3] = kt;", "VAR_0->fifo[4] = kh;", "VAR_0->fifo[5] = ks;", "return;", "case 1:\nVAR_2 = 1;", "break;", "default:\nbreak;", "}", "VAR_0->data_dir = VAR_1;", "VAR_0->data_pos = 0;", "FD_SET_STATE(VAR_0->data_state, FD_STATE_DATA);", "if (VAR_0->fifo[0] & 0x80)\nVAR_0->data_state |= FD_STATE_MULTI;", "else\nVAR_0->data_state &= ~FD_STATE_MULTI;", "if (VAR_2)\nVAR_0->data_state |= FD_STATE_SEEK;", "else\nVAR_0->data_state &= ~FD_STATE_SEEK;", "if (VAR_0->fifo[5] == 00) {", "VAR_0->data_len = VAR_0->fifo[8];", "} else {", "int VAR_3;", "VAR_0->data_len = 128 << VAR_0->fifo[5];", "VAR_3 = (cur_drv->last_sect - ks + 1);", "if (VAR_0->fifo[0] & 0x80)\nVAR_3 += cur_drv->last_sect;", "VAR_0->data_len *= VAR_3;", "}", "VAR_0->eot = VAR_0->fifo[6];", "if (VAR_0->dma_en) {", "int VAR_4;", "VAR_4 = DMA_get_channel_mode(VAR_0->dma_chann);", "VAR_4 = (VAR_4 >> 2) & 3;", "FLOPPY_DPRINTF(\"VAR_4=%d VAR_1=%d (%d - %d)\\n\",\nVAR_4, VAR_1,\n(128 << VAR_0->fifo[5]) *\n(cur_drv->last_sect - ks + 1), VAR_0->data_len);", "if (((VAR_1 == FD_DIR_SCANE || VAR_1 == FD_DIR_SCANL ||\nVAR_1 == FD_DIR_SCANH) && VAR_4 == 0) ||\n(VAR_1 == FD_DIR_WRITE && VAR_4 == 2) ||\n(VAR_1 == FD_DIR_READ && VAR_4 == 1)) {", "VAR_0->state |= FD_CTRL_BUSY;", "DMA_hold_DREQ(VAR_0->dma_chann);", "DMA_schedule(VAR_0->dma_chann);", "return;", "} else {", "FLOPPY_ERROR(\"VAR_4=%d VAR_1=%d\\n\", VAR_4, VAR_1);", "}", "}", "FLOPPY_DPRINTF(\"start non-DMA transfer\\n\");", "fdctrl_raise_irq(VAR_0, 0x00);", "return;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25, 27 ], [ 29 ], [ 31 ], [ 33, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99, 101 ], [ 103, 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143, 145, 147, 149 ], [ 151, 153, 155, 157 ], [ 161 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 191 ], [ 193 ] ]
20,686
int qemu_chr_open_msmouse(QemuOpts *opts, CharDriverState **_chr) { CharDriverState *chr; chr = g_malloc0(sizeof(CharDriverState)); chr->chr_write = msmouse_chr_write; chr->chr_close = msmouse_chr_close; qemu_add_mouse_event_handler(msmouse_event, chr, 0, "QEMU Microsoft Mouse"); *_chr = chr; return 0; }
true
qemu
1f51470d044852592922f91000e741c381582cdc
int qemu_chr_open_msmouse(QemuOpts *opts, CharDriverState **_chr) { CharDriverState *chr; chr = g_malloc0(sizeof(CharDriverState)); chr->chr_write = msmouse_chr_write; chr->chr_close = msmouse_chr_close; qemu_add_mouse_event_handler(msmouse_event, chr, 0, "QEMU Microsoft Mouse"); *_chr = chr; return 0; }
{ "code": [ " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", "int qemu_chr_open_msmouse(QemuOpts *opts, CharDriverState **_chr)", " *_chr = chr;", " return 0;", " return 0;", " return 0;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;" ], "line_no": [ 21, 23, 21, 23, 1, 21, 23, 23, 23, 23, 21, 23, 21, 23, 21, 23, 21, 23, 21, 23, 21, 23, 21, 23, 23, 21, 23, 21, 23, 21, 23, 21, 23 ] }
int FUNC_0(QemuOpts *VAR_0, CharDriverState **VAR_1) { CharDriverState *chr; chr = g_malloc0(sizeof(CharDriverState)); chr->chr_write = msmouse_chr_write; chr->chr_close = msmouse_chr_close; qemu_add_mouse_event_handler(msmouse_event, chr, 0, "QEMU Microsoft Mouse"); *VAR_1 = chr; return 0; }
[ "int FUNC_0(QemuOpts *VAR_0, CharDriverState **VAR_1)\n{", "CharDriverState *chr;", "chr = g_malloc0(sizeof(CharDriverState));", "chr->chr_write = msmouse_chr_write;", "chr->chr_close = msmouse_chr_close;", "qemu_add_mouse_event_handler(msmouse_event, chr, 0, \"QEMU Microsoft Mouse\");", "*VAR_1 = chr;", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ] ]
20,687
static char *var_read_string(AVIOContext *pb, int size) { int n; char *str = av_malloc(size + 1); if (!str) return NULL; n = avio_get_str(pb, size, str, size + 1); if (n < size) avio_skip(pb, size - n); return str; }
false
FFmpeg
86e574928536ee5249d9cf4da9f5d8714611d706
static char *var_read_string(AVIOContext *pb, int size) { int n; char *str = av_malloc(size + 1); if (!str) return NULL; n = avio_get_str(pb, size, str, size + 1); if (n < size) avio_skip(pb, size - n); return str; }
{ "code": [], "line_no": [] }
static char *FUNC_0(AVIOContext *VAR_0, int VAR_1) { int VAR_2; char *VAR_3 = av_malloc(VAR_1 + 1); if (!VAR_3) return NULL; VAR_2 = avio_get_str(VAR_0, VAR_1, VAR_3, VAR_1 + 1); if (VAR_2 < VAR_1) avio_skip(VAR_0, VAR_1 - VAR_2); return VAR_3; }
[ "static char *FUNC_0(AVIOContext *VAR_0, int VAR_1)\n{", "int VAR_2;", "char *VAR_3 = av_malloc(VAR_1 + 1);", "if (!VAR_3)\nreturn NULL;", "VAR_2 = avio_get_str(VAR_0, VAR_1, VAR_3, VAR_1 + 1);", "if (VAR_2 < VAR_1)\navio_skip(VAR_0, VAR_1 - VAR_2);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ] ]
20,688
static char *ctime1(char *buf2, int buf_size) { time_t ti; char *p; ti = time(NULL); p = ctime(&ti); av_strlcpy(buf2, p, buf_size); p = buf2 + strlen(p) - 1; if (*p == '\n') *p = '\0'; return buf2; }
false
FFmpeg
6c2dbff7f08ccbf69adb23ada48bb36ba796e772
static char *ctime1(char *buf2, int buf_size) { time_t ti; char *p; ti = time(NULL); p = ctime(&ti); av_strlcpy(buf2, p, buf_size); p = buf2 + strlen(p) - 1; if (*p == '\n') *p = '\0'; return buf2; }
{ "code": [], "line_no": [] }
static char *FUNC_0(char *VAR_0, int VAR_1) { time_t ti; char *VAR_2; ti = time(NULL); VAR_2 = ctime(&ti); av_strlcpy(VAR_0, VAR_2, VAR_1); VAR_2 = VAR_0 + strlen(VAR_2) - 1; if (*VAR_2 == '\n') *VAR_2 = '\0'; return VAR_0; }
[ "static char *FUNC_0(char *VAR_0, int VAR_1)\n{", "time_t ti;", "char *VAR_2;", "ti = time(NULL);", "VAR_2 = ctime(&ti);", "av_strlcpy(VAR_0, VAR_2, VAR_1);", "VAR_2 = VAR_0 + strlen(VAR_2) - 1;", "if (*VAR_2 == '\\n')\n*VAR_2 = '\\0';", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ] ]
20,689
void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16)[2][64], const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra) { FDCTDSPContext *fdsp = &s->fdsp; int qscale; int shift = 0; for (qscale = qmin; qscale <= qmax; qscale++) { int i; int qscale2; if (s->q_scale_type) qscale2 = ff_mpeg2_non_linear_qscale[qscale]; else qscale2 = qscale << 1; if (fdsp->fdct == ff_jpeg_fdct_islow_8 || #if CONFIG_FAANDCT fdsp->fdct == ff_faandct || #endif /* CONFIG_FAANDCT */ fdsp->fdct == ff_jpeg_fdct_islow_10) { for (i = 0; i < 64; i++) { const int j = s->idsp.idct_permutation[i]; int64_t den = (int64_t) qscale2 * quant_matrix[j]; /* 16 <= qscale * quant_matrix[i] <= 7905 * Assume x = ff_aanscales[i] * qscale * quant_matrix[i] * 19952 <= x <= 249205026 * (1 << 36) / 19952 >= (1 << 36) / (x) >= (1 << 36) / 249205026 * 3444240 >= (1 << 36) / (x) >= 275 */ qmat[qscale][i] = (int)((UINT64_C(2) << QMAT_SHIFT) / den); } } else if (fdsp->fdct == ff_fdct_ifast) { for (i = 0; i < 64; i++) { const int j = s->idsp.idct_permutation[i]; int64_t den = ff_aanscales[i] * (int64_t) qscale2 * quant_matrix[j]; /* 16 <= qscale * quant_matrix[i] <= 7905 * Assume x = ff_aanscales[i] * qscale * quant_matrix[i] * 19952 <= x <= 249205026 * (1 << 36) / 19952 >= (1 << 36) / (x) >= (1 << 36) / 249205026 * 3444240 >= (1 << 36) / (x) >= 275 */ qmat[qscale][i] = (int)((UINT64_C(2) << (QMAT_SHIFT + 14)) / den); } } else { for (i = 0; i < 64; i++) { const int j = s->idsp.idct_permutation[i]; int64_t den = (int64_t) qscale2 * quant_matrix[j]; /* We can safely suppose that 16 <= quant_matrix[i] <= 255 * Assume x = qscale * quant_matrix[i] * So 16 <= x <= 7905 * so (1 << 19) / 16 >= (1 << 19) / (x) >= (1 << 19) / 7905 * so 32768 >= (1 << 19) / (x) >= 67 */ qmat[qscale][i] = (int)((UINT64_C(2) << QMAT_SHIFT) / den); //qmat [qscale][i] = (1 << QMAT_SHIFT_MMX) / // (qscale * quant_matrix[i]); qmat16[qscale][0][i] = (2 << QMAT_SHIFT_MMX) / den; if (qmat16[qscale][0][i] == 0 || qmat16[qscale][0][i] == 128 * 256) qmat16[qscale][0][i] = 128 * 256 - 1; qmat16[qscale][1][i] = ROUNDED_DIV(bias << (16 - QUANT_BIAS_SHIFT), qmat16[qscale][0][i]); } } for (i = intra; i < 64; i++) { int64_t max = 8191; if (fdsp->fdct == ff_fdct_ifast) { max = (8191LL * ff_aanscales[i]) >> 14; } while (((max * qmat[qscale][i]) >> shift) > INT_MAX) { shift++; } } } if (shift) { av_log(NULL, AV_LOG_INFO, "Warning, QMAT_SHIFT is larger than %d, overflows possible\n", QMAT_SHIFT - shift); } }
true
FFmpeg
3be27e07d3c5239f6d53b86aebcd201f722df4d0
void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16)[2][64], const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra) { FDCTDSPContext *fdsp = &s->fdsp; int qscale; int shift = 0; for (qscale = qmin; qscale <= qmax; qscale++) { int i; int qscale2; if (s->q_scale_type) qscale2 = ff_mpeg2_non_linear_qscale[qscale]; else qscale2 = qscale << 1; if (fdsp->fdct == ff_jpeg_fdct_islow_8 || #if CONFIG_FAANDCT fdsp->fdct == ff_faandct || #endif fdsp->fdct == ff_jpeg_fdct_islow_10) { for (i = 0; i < 64; i++) { const int j = s->idsp.idct_permutation[i]; int64_t den = (int64_t) qscale2 * quant_matrix[j]; qmat[qscale][i] = (int)((UINT64_C(2) << QMAT_SHIFT) / den); } } else if (fdsp->fdct == ff_fdct_ifast) { for (i = 0; i < 64; i++) { const int j = s->idsp.idct_permutation[i]; int64_t den = ff_aanscales[i] * (int64_t) qscale2 * quant_matrix[j]; qmat[qscale][i] = (int)((UINT64_C(2) << (QMAT_SHIFT + 14)) / den); } } else { for (i = 0; i < 64; i++) { const int j = s->idsp.idct_permutation[i]; int64_t den = (int64_t) qscale2 * quant_matrix[j]; qmat[qscale][i] = (int)((UINT64_C(2) << QMAT_SHIFT) / den); qmat16[qscale][0][i] = (2 << QMAT_SHIFT_MMX) / den; if (qmat16[qscale][0][i] == 0 || qmat16[qscale][0][i] == 128 * 256) qmat16[qscale][0][i] = 128 * 256 - 1; qmat16[qscale][1][i] = ROUNDED_DIV(bias << (16 - QUANT_BIAS_SHIFT), qmat16[qscale][0][i]); } } for (i = intra; i < 64; i++) { int64_t max = 8191; if (fdsp->fdct == ff_fdct_ifast) { max = (8191LL * ff_aanscales[i]) >> 14; } while (((max * qmat[qscale][i]) >> shift) > INT_MAX) { shift++; } } } if (shift) { av_log(NULL, AV_LOG_INFO, "Warning, QMAT_SHIFT is larger than %d, overflows possible\n", QMAT_SHIFT - shift); } }
{ "code": [ " ROUNDED_DIV(bias << (16 - QUANT_BIAS_SHIFT)," ], "line_no": [ 125 ] }
void FUNC_0(MpegEncContext *VAR_0, int (*VAR_1)[64], VAR_2 (*qmat16)[2][64], const VAR_2 *VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7) { FDCTDSPContext *fdsp = &VAR_0->fdsp; int VAR_8; int VAR_9 = 0; for (VAR_8 = VAR_5; VAR_8 <= VAR_6; VAR_8++) { int VAR_10; int VAR_11; if (VAR_0->q_scale_type) VAR_11 = ff_mpeg2_non_linear_qscale[VAR_8]; else VAR_11 = VAR_8 << 1; if (fdsp->fdct == ff_jpeg_fdct_islow_8 || #if CONFIG_FAANDCT fdsp->fdct == ff_faandct || #endif fdsp->fdct == ff_jpeg_fdct_islow_10) { for (VAR_10 = 0; VAR_10 < 64; VAR_10++) { const int VAR_13 = VAR_0->idsp.idct_permutation[VAR_10]; int64_t den = (int64_t) VAR_11 * VAR_3[VAR_13]; VAR_1[VAR_8][VAR_10] = (int)((UINT64_C(2) << QMAT_SHIFT) / den); } } else if (fdsp->fdct == ff_fdct_ifast) { for (VAR_10 = 0; VAR_10 < 64; VAR_10++) { const int VAR_13 = VAR_0->idsp.idct_permutation[VAR_10]; int64_t den = ff_aanscales[VAR_10] * (int64_t) VAR_11 * VAR_3[VAR_13]; VAR_1[VAR_8][VAR_10] = (int)((UINT64_C(2) << (QMAT_SHIFT + 14)) / den); } } else { for (VAR_10 = 0; VAR_10 < 64; VAR_10++) { const int VAR_13 = VAR_0->idsp.idct_permutation[VAR_10]; int64_t den = (int64_t) VAR_11 * VAR_3[VAR_13]; VAR_1[VAR_8][VAR_10] = (int)((UINT64_C(2) << QMAT_SHIFT) / den); qmat16[VAR_8][0][VAR_10] = (2 << QMAT_SHIFT_MMX) / den; if (qmat16[VAR_8][0][VAR_10] == 0 || qmat16[VAR_8][0][VAR_10] == 128 * 256) qmat16[VAR_8][0][VAR_10] = 128 * 256 - 1; qmat16[VAR_8][1][VAR_10] = ROUNDED_DIV(VAR_4 << (16 - QUANT_BIAS_SHIFT), qmat16[VAR_8][0][VAR_10]); } } for (VAR_10 = VAR_7; VAR_10 < 64; VAR_10++) { int64_t max = 8191; if (fdsp->fdct == ff_fdct_ifast) { max = (8191LL * ff_aanscales[VAR_10]) >> 14; } while (((max * VAR_1[VAR_8][VAR_10]) >> VAR_9) > INT_MAX) { VAR_9++; } } } if (VAR_9) { av_log(NULL, AV_LOG_INFO, "Warning, QMAT_SHIFT is larger than %d, overflows possible\n", QMAT_SHIFT - VAR_9); } }
[ "void FUNC_0(MpegEncContext *VAR_0, int (*VAR_1)[64],\nVAR_2 (*qmat16)[2][64],\nconst VAR_2 *VAR_3,\nint VAR_4, int VAR_5, int VAR_6, int VAR_7)\n{", "FDCTDSPContext *fdsp = &VAR_0->fdsp;", "int VAR_8;", "int VAR_9 = 0;", "for (VAR_8 = VAR_5; VAR_8 <= VAR_6; VAR_8++) {", "int VAR_10;", "int VAR_11;", "if (VAR_0->q_scale_type) VAR_11 = ff_mpeg2_non_linear_qscale[VAR_8];", "else VAR_11 = VAR_8 << 1;", "if (fdsp->fdct == ff_jpeg_fdct_islow_8 ||\n#if CONFIG_FAANDCT\nfdsp->fdct == ff_faandct ||\n#endif\nfdsp->fdct == ff_jpeg_fdct_islow_10) {", "for (VAR_10 = 0; VAR_10 < 64; VAR_10++) {", "const int VAR_13 = VAR_0->idsp.idct_permutation[VAR_10];", "int64_t den = (int64_t) VAR_11 * VAR_3[VAR_13];", "VAR_1[VAR_8][VAR_10] = (int)((UINT64_C(2) << QMAT_SHIFT) / den);", "}", "} else if (fdsp->fdct == ff_fdct_ifast) {", "for (VAR_10 = 0; VAR_10 < 64; VAR_10++) {", "const int VAR_13 = VAR_0->idsp.idct_permutation[VAR_10];", "int64_t den = ff_aanscales[VAR_10] * (int64_t) VAR_11 * VAR_3[VAR_13];", "VAR_1[VAR_8][VAR_10] = (int)((UINT64_C(2) << (QMAT_SHIFT + 14)) / den);", "}", "} else {", "for (VAR_10 = 0; VAR_10 < 64; VAR_10++) {", "const int VAR_13 = VAR_0->idsp.idct_permutation[VAR_10];", "int64_t den = (int64_t) VAR_11 * VAR_3[VAR_13];", "VAR_1[VAR_8][VAR_10] = (int)((UINT64_C(2) << QMAT_SHIFT) / den);", "qmat16[VAR_8][0][VAR_10] = (2 << QMAT_SHIFT_MMX) / den;", "if (qmat16[VAR_8][0][VAR_10] == 0 ||\nqmat16[VAR_8][0][VAR_10] == 128 * 256)\nqmat16[VAR_8][0][VAR_10] = 128 * 256 - 1;", "qmat16[VAR_8][1][VAR_10] =\nROUNDED_DIV(VAR_4 << (16 - QUANT_BIAS_SHIFT),\nqmat16[VAR_8][0][VAR_10]);", "}", "}", "for (VAR_10 = VAR_7; VAR_10 < 64; VAR_10++) {", "int64_t max = 8191;", "if (fdsp->fdct == ff_fdct_ifast) {", "max = (8191LL * ff_aanscales[VAR_10]) >> 14;", "}", "while (((max * VAR_1[VAR_8][VAR_10]) >> VAR_9) > INT_MAX) {", "VAR_9++;", "}", "}", "}", "if (VAR_9) {", "av_log(NULL, AV_LOG_INFO,\n\"Warning, QMAT_SHIFT is larger than %d, overflows possible\\n\",\nQMAT_SHIFT - VAR_9);", "}", "}" ]
[ 0, 0, 0, 0, 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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33, 35, 37, 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 107 ], [ 113 ], [ 117, 119, 121 ], [ 123, 125, 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157, 159, 161 ], [ 163 ], [ 165 ] ]
20,690
static void __attribute__((constructor)) coroutine_init(void) { if (!g_thread_supported()) { g_thread_init(NULL); } coroutine_cond = g_cond_new(); }
true
qemu
42ed3727536ccf80c87942b3f04e7378fe90f107
static void __attribute__((constructor)) coroutine_init(void) { if (!g_thread_supported()) { g_thread_init(NULL); } coroutine_cond = g_cond_new(); }
{ "code": [], "line_no": [] }
static void __attribute__((constructor)) FUNC_0(void) { if (!g_thread_supported()) { g_thread_init(NULL); } coroutine_cond = g_cond_new(); }
[ "static void __attribute__((constructor)) FUNC_0(void)\n{", "if (!g_thread_supported()) {", "g_thread_init(NULL);", "}", "coroutine_cond = g_cond_new();", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 8 ], [ 14 ], [ 18 ], [ 20 ] ]
20,691
static void loadvm_postcopy_handle_run_bh(void *opaque) { Error *local_err = NULL; MigrationIncomingState *mis = opaque; /* TODO we should move all of this lot into postcopy_ram.c or a shared code * in migration.c */ cpu_synchronize_all_post_init(); qemu_announce_self(); /* Make sure all file formats flush their mutable metadata */ bdrv_invalidate_cache_all(&local_err); if (local_err) { error_report_err(local_err); } trace_loadvm_postcopy_handle_run_cpu_sync(); cpu_synchronize_all_post_init(); trace_loadvm_postcopy_handle_run_vmstart(); if (autostart) { /* Hold onto your hats, starting the CPU */ vm_start(); } else { /* leave it paused and let management decide when to start the CPU */ runstate_set(RUN_STATE_PAUSED); } qemu_bh_delete(mis->bh); }
true
qemu
864699227911909ef1e33ecf91bf3c900715a9b1
static void loadvm_postcopy_handle_run_bh(void *opaque) { Error *local_err = NULL; MigrationIncomingState *mis = opaque; cpu_synchronize_all_post_init(); qemu_announce_self(); bdrv_invalidate_cache_all(&local_err); if (local_err) { error_report_err(local_err); } trace_loadvm_postcopy_handle_run_cpu_sync(); cpu_synchronize_all_post_init(); trace_loadvm_postcopy_handle_run_vmstart(); if (autostart) { vm_start(); } else { runstate_set(RUN_STATE_PAUSED); } qemu_bh_delete(mis->bh); }
{ "code": [ " MigrationIncomingState *mis = opaque;", " qemu_bh_delete(mis->bh);" ], "line_no": [ 7, 63 ] }
static void FUNC_0(void *VAR_0) { Error *local_err = NULL; MigrationIncomingState *mis = VAR_0; cpu_synchronize_all_post_init(); qemu_announce_self(); bdrv_invalidate_cache_all(&local_err); if (local_err) { error_report_err(local_err); } trace_loadvm_postcopy_handle_run_cpu_sync(); cpu_synchronize_all_post_init(); trace_loadvm_postcopy_handle_run_vmstart(); if (autostart) { vm_start(); } else { runstate_set(RUN_STATE_PAUSED); } qemu_bh_delete(mis->bh); }
[ "static void FUNC_0(void *VAR_0)\n{", "Error *local_err = NULL;", "MigrationIncomingState *mis = VAR_0;", "cpu_synchronize_all_post_init();", "qemu_announce_self();", "bdrv_invalidate_cache_all(&local_err);", "if (local_err) {", "error_report_err(local_err);", "}", "trace_loadvm_postcopy_handle_run_cpu_sync();", "cpu_synchronize_all_post_init();", "trace_loadvm_postcopy_handle_run_vmstart();", "if (autostart) {", "vm_start();", "} else {", "runstate_set(RUN_STATE_PAUSED);", "}", "qemu_bh_delete(mis->bh);", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 17 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
20,693
static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque, int is_write) { BlockDriverAIOCBSync *acb; acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque); acb->is_write = is_write; acb->qiov = qiov; acb->bounce = qemu_blockalign(bs, qiov->size); acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_aio_bh_cb, acb); if (is_write) { qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); acb->ret = bs->drv->bdrv_write(bs, sector_num, acb->bounce, nb_sectors); } else { acb->ret = bs->drv->bdrv_read(bs, sector_num, acb->bounce, nb_sectors); } qemu_bh_schedule(acb->bh); return &acb->common; }
true
qemu
857d4f46c31d2f4d57d2f0fad9dfb584262bf9b9
static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque, int is_write) { BlockDriverAIOCBSync *acb; acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque); acb->is_write = is_write; acb->qiov = qiov; acb->bounce = qemu_blockalign(bs, qiov->size); acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_aio_bh_cb, acb); if (is_write) { qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); acb->ret = bs->drv->bdrv_write(bs, sector_num, acb->bounce, nb_sectors); } else { acb->ret = bs->drv->bdrv_read(bs, sector_num, acb->bounce, nb_sectors); } qemu_bh_schedule(acb->bh); return &acb->common; }
{ "code": [ " acb->bounce = qemu_blockalign(bs, qiov->size);", " if (is_write) {" ], "line_no": [ 29, 35 ] }
static BlockDriverAIOCB *FUNC_0(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque, int is_write) { BlockDriverAIOCBSync *acb; acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque); acb->is_write = is_write; acb->qiov = qiov; acb->bounce = qemu_blockalign(bs, qiov->size); acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_aio_bh_cb, acb); if (is_write) { qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); acb->ret = bs->drv->bdrv_write(bs, sector_num, acb->bounce, nb_sectors); } else { acb->ret = bs->drv->bdrv_read(bs, sector_num, acb->bounce, nb_sectors); } qemu_bh_schedule(acb->bh); return &acb->common; }
[ "static BlockDriverAIOCB *FUNC_0(BlockDriverState *bs,\nint64_t sector_num,\nQEMUIOVector *qiov,\nint nb_sectors,\nBlockDriverCompletionFunc *cb,\nvoid *opaque,\nint is_write)\n{", "BlockDriverAIOCBSync *acb;", "acb = qemu_aio_get(&bdrv_em_aiocb_info, bs, cb, opaque);", "acb->is_write = is_write;", "acb->qiov = qiov;", "acb->bounce = qemu_blockalign(bs, qiov->size);", "acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_aio_bh_cb, acb);", "if (is_write) {", "qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size);", "acb->ret = bs->drv->bdrv_write(bs, sector_num, acb->bounce, nb_sectors);", "} else {", "acb->ret = bs->drv->bdrv_read(bs, sector_num, acb->bounce, nb_sectors);", "}", "qemu_bh_schedule(acb->bh);", "return &acb->common;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ] ]
20,694
static int vnc_display_listen_addr(VncDisplay *vd, SocketAddress *addr, const char *name, QIOChannelSocket ***lsock, guint **lsock_tag, size_t *nlsock, Error **errp) { QIODNSResolver *resolver = qio_dns_resolver_get_instance(); SocketAddress **rawaddrs = NULL; size_t nrawaddrs = 0; Error *listenerr = NULL; bool listening = false; size_t i; if (qio_dns_resolver_lookup_sync(resolver, addr, &nrawaddrs, &rawaddrs, errp) < 0) { return -1; } for (i = 0; i < nrawaddrs; i++) { QIOChannelSocket *sioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(sioc), name); if (qio_channel_socket_listen_sync( sioc, rawaddrs[i], listenerr == NULL ? &listenerr : NULL) < 0) { continue; } listening = true; (*nlsock)++; *lsock = g_renew(QIOChannelSocket *, *lsock, *nlsock); *lsock_tag = g_renew(guint, *lsock_tag, *nlsock); (*lsock)[*nlsock - 1] = sioc; (*lsock_tag)[*nlsock - 1] = 0; } for (i = 0; i < nrawaddrs; i++) { qapi_free_SocketAddress(rawaddrs[i]); } g_free(rawaddrs); if (listenerr) { if (!listening) { error_propagate(errp, listenerr); return -1; } else { error_free(listenerr); } } for (i = 0; i < *nlsock; i++) { (*lsock_tag)[i] = qio_channel_add_watch( QIO_CHANNEL((*lsock)[i]), G_IO_IN, vnc_listen_io, vd, NULL); } return 0; }
true
qemu
7bc4f0846f5e15dad5a54490290241243b5a4416
static int vnc_display_listen_addr(VncDisplay *vd, SocketAddress *addr, const char *name, QIOChannelSocket ***lsock, guint **lsock_tag, size_t *nlsock, Error **errp) { QIODNSResolver *resolver = qio_dns_resolver_get_instance(); SocketAddress **rawaddrs = NULL; size_t nrawaddrs = 0; Error *listenerr = NULL; bool listening = false; size_t i; if (qio_dns_resolver_lookup_sync(resolver, addr, &nrawaddrs, &rawaddrs, errp) < 0) { return -1; } for (i = 0; i < nrawaddrs; i++) { QIOChannelSocket *sioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(sioc), name); if (qio_channel_socket_listen_sync( sioc, rawaddrs[i], listenerr == NULL ? &listenerr : NULL) < 0) { continue; } listening = true; (*nlsock)++; *lsock = g_renew(QIOChannelSocket *, *lsock, *nlsock); *lsock_tag = g_renew(guint, *lsock_tag, *nlsock); (*lsock)[*nlsock - 1] = sioc; (*lsock_tag)[*nlsock - 1] = 0; } for (i = 0; i < nrawaddrs; i++) { qapi_free_SocketAddress(rawaddrs[i]); } g_free(rawaddrs); if (listenerr) { if (!listening) { error_propagate(errp, listenerr); return -1; } else { error_free(listenerr); } } for (i = 0; i < *nlsock; i++) { (*lsock_tag)[i] = qio_channel_add_watch( QIO_CHANNEL((*lsock)[i]), G_IO_IN, vnc_listen_io, vd, NULL); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VncDisplay *VAR_0, SocketAddress *VAR_1, const char *VAR_2, QIOChannelSocket ***VAR_3, guint **VAR_4, size_t *VAR_5, Error **VAR_6) { QIODNSResolver *resolver = qio_dns_resolver_get_instance(); SocketAddress **rawaddrs = NULL; size_t nrawaddrs = 0; Error *listenerr = NULL; bool listening = false; size_t i; if (qio_dns_resolver_lookup_sync(resolver, VAR_1, &nrawaddrs, &rawaddrs, VAR_6) < 0) { return -1; } for (i = 0; i < nrawaddrs; i++) { QIOChannelSocket *sioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(sioc), VAR_2); if (qio_channel_socket_listen_sync( sioc, rawaddrs[i], listenerr == NULL ? &listenerr : NULL) < 0) { continue; } listening = true; (*VAR_5)++; *VAR_3 = g_renew(QIOChannelSocket *, *VAR_3, *VAR_5); *VAR_4 = g_renew(guint, *VAR_4, *VAR_5); (*VAR_3)[*VAR_5 - 1] = sioc; (*VAR_4)[*VAR_5 - 1] = 0; } for (i = 0; i < nrawaddrs; i++) { qapi_free_SocketAddress(rawaddrs[i]); } g_free(rawaddrs); if (listenerr) { if (!listening) { error_propagate(VAR_6, listenerr); return -1; } else { error_free(listenerr); } } for (i = 0; i < *VAR_5; i++) { (*VAR_4)[i] = qio_channel_add_watch( QIO_CHANNEL((*VAR_3)[i]), G_IO_IN, vnc_listen_io, VAR_0, NULL); } return 0; }
[ "static int FUNC_0(VncDisplay *VAR_0,\nSocketAddress *VAR_1,\nconst char *VAR_2,\nQIOChannelSocket ***VAR_3,\nguint **VAR_4,\nsize_t *VAR_5,\nError **VAR_6)\n{", "QIODNSResolver *resolver = qio_dns_resolver_get_instance();", "SocketAddress **rawaddrs = NULL;", "size_t nrawaddrs = 0;", "Error *listenerr = NULL;", "bool listening = false;", "size_t i;", "if (qio_dns_resolver_lookup_sync(resolver, VAR_1, &nrawaddrs,\n&rawaddrs, VAR_6) < 0) {", "return -1;", "}", "for (i = 0; i < nrawaddrs; i++) {", "QIOChannelSocket *sioc = qio_channel_socket_new();", "qio_channel_set_name(QIO_CHANNEL(sioc), VAR_2);", "if (qio_channel_socket_listen_sync(\nsioc, rawaddrs[i], listenerr == NULL ? &listenerr : NULL) < 0) {", "continue;", "}", "listening = true;", "(*VAR_5)++;", "*VAR_3 = g_renew(QIOChannelSocket *, *VAR_3, *VAR_5);", "*VAR_4 = g_renew(guint, *VAR_4, *VAR_5);", "(*VAR_3)[*VAR_5 - 1] = sioc;", "(*VAR_4)[*VAR_5 - 1] = 0;", "}", "for (i = 0; i < nrawaddrs; i++) {", "qapi_free_SocketAddress(rawaddrs[i]);", "}", "g_free(rawaddrs);", "if (listenerr) {", "if (!listening) {", "error_propagate(VAR_6, listenerr);", "return -1;", "} else {", "error_free(listenerr);", "}", "}", "for (i = 0; i < *VAR_5; i++) {", "(*VAR_4)[i] = qio_channel_add_watch(\nQIO_CHANNEL((*VAR_3)[i]),\nG_IO_IN, vnc_listen_io, VAR_0, NULL);", "}", "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 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49, 51 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 62 ], [ 64 ], [ 68 ], [ 70 ], [ 72 ], [ 76 ], [ 78 ], [ 80 ], [ 82 ], [ 86 ], [ 88 ], [ 90 ], [ 92 ], [ 94 ], [ 96 ], [ 98 ], [ 100 ], [ 104 ], [ 106, 108, 110 ], [ 112 ], [ 116 ], [ 118 ] ]
20,695
static av_cold int cook_decode_init(AVCodecContext *avctx) { COOKContext *q = avctx->priv_data; const uint8_t *edata_ptr = avctx->extradata; const uint8_t *edata_ptr_end = edata_ptr + avctx->extradata_size; int extradata_size = avctx->extradata_size; int s = 0; unsigned int channel_mask = 0; int samples_per_frame; int ret; q->avctx = avctx; /* Take care of the codec specific extradata. */ if (extradata_size < 8) { av_log(avctx, AV_LOG_ERROR, "Necessary extradata missing!\n"); return AVERROR_INVALIDDATA; } av_log(avctx, AV_LOG_DEBUG, "codecdata_length=%d\n", avctx->extradata_size); /* Take data from the AVCodecContext (RM container). */ if (!avctx->channels) { av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); return AVERROR_INVALIDDATA; } /* Initialize RNG. */ av_lfg_init(&q->random_state, 0); ff_audiodsp_init(&q->adsp); while (edata_ptr < edata_ptr_end) { /* 8 for mono, 16 for stereo, ? for multichannel Swap to right endianness so we don't need to care later on. */ if (extradata_size >= 8) { q->subpacket[s].cookversion = bytestream_get_be32(&edata_ptr); samples_per_frame = bytestream_get_be16(&edata_ptr); q->subpacket[s].subbands = bytestream_get_be16(&edata_ptr); extradata_size -= 8; } if (extradata_size >= 8) { bytestream_get_be32(&edata_ptr); // Unknown unused q->subpacket[s].js_subband_start = bytestream_get_be16(&edata_ptr); q->subpacket[s].js_vlc_bits = bytestream_get_be16(&edata_ptr); extradata_size -= 8; } /* Initialize extradata related variables. */ q->subpacket[s].samples_per_channel = samples_per_frame / avctx->channels; q->subpacket[s].bits_per_subpacket = avctx->block_align * 8; /* Initialize default data states. */ q->subpacket[s].log2_numvector_size = 5; q->subpacket[s].total_subbands = q->subpacket[s].subbands; q->subpacket[s].num_channels = 1; /* Initialize version-dependent variables */ av_log(avctx, AV_LOG_DEBUG, "subpacket[%i].cookversion=%x\n", s, q->subpacket[s].cookversion); q->subpacket[s].joint_stereo = 0; switch (q->subpacket[s].cookversion) { case MONO: if (avctx->channels != 1) { avpriv_request_sample(avctx, "Container channels != 1"); return AVERROR_PATCHWELCOME; } av_log(avctx, AV_LOG_DEBUG, "MONO\n"); break; case STEREO: if (avctx->channels != 1) { q->subpacket[s].bits_per_subpdiv = 1; q->subpacket[s].num_channels = 2; } av_log(avctx, AV_LOG_DEBUG, "STEREO\n"); break; case JOINT_STEREO: if (avctx->channels != 2) { avpriv_request_sample(avctx, "Container channels != 2"); return AVERROR_PATCHWELCOME; } av_log(avctx, AV_LOG_DEBUG, "JOINT_STEREO\n"); if (avctx->extradata_size >= 16) { q->subpacket[s].total_subbands = q->subpacket[s].subbands + q->subpacket[s].js_subband_start; q->subpacket[s].joint_stereo = 1; q->subpacket[s].num_channels = 2; } if (q->subpacket[s].samples_per_channel > 256) { q->subpacket[s].log2_numvector_size = 6; } if (q->subpacket[s].samples_per_channel > 512) { q->subpacket[s].log2_numvector_size = 7; } break; case MC_COOK: av_log(avctx, AV_LOG_DEBUG, "MULTI_CHANNEL\n"); if (extradata_size >= 4) channel_mask |= q->subpacket[s].channel_mask = bytestream_get_be32(&edata_ptr); if (av_get_channel_layout_nb_channels(q->subpacket[s].channel_mask) > 1) { q->subpacket[s].total_subbands = q->subpacket[s].subbands + q->subpacket[s].js_subband_start; q->subpacket[s].joint_stereo = 1; q->subpacket[s].num_channels = 2; q->subpacket[s].samples_per_channel = samples_per_frame >> 1; if (q->subpacket[s].samples_per_channel > 256) { q->subpacket[s].log2_numvector_size = 6; } if (q->subpacket[s].samples_per_channel > 512) { q->subpacket[s].log2_numvector_size = 7; } } else q->subpacket[s].samples_per_channel = samples_per_frame; break; default: avpriv_request_sample(avctx, "Cook version %d", q->subpacket[s].cookversion); return AVERROR_PATCHWELCOME; } if (s > 1 && q->subpacket[s].samples_per_channel != q->samples_per_channel) { av_log(avctx, AV_LOG_ERROR, "different number of samples per channel!\n"); return AVERROR_INVALIDDATA; } else q->samples_per_channel = q->subpacket[0].samples_per_channel; /* Initialize variable relations */ q->subpacket[s].numvector_size = (1 << q->subpacket[s].log2_numvector_size); /* Try to catch some obviously faulty streams, otherwise it might be exploitable */ if (q->subpacket[s].total_subbands > 53) { avpriv_request_sample(avctx, "total_subbands > 53"); return AVERROR_PATCHWELCOME; } if ((q->subpacket[s].js_vlc_bits > 6) || (q->subpacket[s].js_vlc_bits < 2 * q->subpacket[s].joint_stereo)) { av_log(avctx, AV_LOG_ERROR, "js_vlc_bits = %d, only >= %d and <= 6 allowed!\n", q->subpacket[s].js_vlc_bits, 2 * q->subpacket[s].joint_stereo); return AVERROR_INVALIDDATA; } if (q->subpacket[s].subbands > 50) { avpriv_request_sample(avctx, "subbands > 50"); return AVERROR_PATCHWELCOME; } q->subpacket[s].gains1.now = q->subpacket[s].gain_1; q->subpacket[s].gains1.previous = q->subpacket[s].gain_2; q->subpacket[s].gains2.now = q->subpacket[s].gain_3; q->subpacket[s].gains2.previous = q->subpacket[s].gain_4; q->num_subpackets++; s++; if (s > MAX_SUBPACKETS) { avpriv_request_sample(avctx, "subpackets > %d", MAX_SUBPACKETS); return AVERROR_PATCHWELCOME; } } /* Generate tables */ init_pow2table(); init_gain_table(q); init_cplscales_table(q); if ((ret = init_cook_vlc_tables(q))) return ret; if (avctx->block_align >= UINT_MAX / 2) return AVERROR(EINVAL); /* Pad the databuffer with: DECODE_BYTES_PAD1 or DECODE_BYTES_PAD2 for decode_bytes(), AV_INPUT_BUFFER_PADDING_SIZE, for the bitstreamreader. */ q->decoded_bytes_buffer = av_mallocz(avctx->block_align + DECODE_BYTES_PAD1(avctx->block_align) + AV_INPUT_BUFFER_PADDING_SIZE); if (!q->decoded_bytes_buffer) return AVERROR(ENOMEM); /* Initialize transform. */ if ((ret = init_cook_mlt(q))) return ret; /* Initialize COOK signal arithmetic handling */ if (1) { q->scalar_dequant = scalar_dequant_float; q->decouple = decouple_float; q->imlt_window = imlt_window_float; q->interpolate = interpolate_float; q->saturate_output = saturate_output_float; } /* Try to catch some obviously faulty streams, otherwise it might be exploitable */ if (q->samples_per_channel != 256 && q->samples_per_channel != 512 && q->samples_per_channel != 1024) { avpriv_request_sample(avctx, "samples_per_channel = %d", q->samples_per_channel); return AVERROR_PATCHWELCOME; } avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; if (channel_mask) avctx->channel_layout = channel_mask; else avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; #ifdef DEBUG dump_cook_context(q); #endif return 0; }
true
FFmpeg
409d1cd2c955485798f8b0b0147c2b899b9144ec
static av_cold int cook_decode_init(AVCodecContext *avctx) { COOKContext *q = avctx->priv_data; const uint8_t *edata_ptr = avctx->extradata; const uint8_t *edata_ptr_end = edata_ptr + avctx->extradata_size; int extradata_size = avctx->extradata_size; int s = 0; unsigned int channel_mask = 0; int samples_per_frame; int ret; q->avctx = avctx; if (extradata_size < 8) { av_log(avctx, AV_LOG_ERROR, "Necessary extradata missing!\n"); return AVERROR_INVALIDDATA; } av_log(avctx, AV_LOG_DEBUG, "codecdata_length=%d\n", avctx->extradata_size); if (!avctx->channels) { av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); return AVERROR_INVALIDDATA; } av_lfg_init(&q->random_state, 0); ff_audiodsp_init(&q->adsp); while (edata_ptr < edata_ptr_end) { if (extradata_size >= 8) { q->subpacket[s].cookversion = bytestream_get_be32(&edata_ptr); samples_per_frame = bytestream_get_be16(&edata_ptr); q->subpacket[s].subbands = bytestream_get_be16(&edata_ptr); extradata_size -= 8; } if (extradata_size >= 8) { bytestream_get_be32(&edata_ptr); q->subpacket[s].js_subband_start = bytestream_get_be16(&edata_ptr); q->subpacket[s].js_vlc_bits = bytestream_get_be16(&edata_ptr); extradata_size -= 8; } q->subpacket[s].samples_per_channel = samples_per_frame / avctx->channels; q->subpacket[s].bits_per_subpacket = avctx->block_align * 8; q->subpacket[s].log2_numvector_size = 5; q->subpacket[s].total_subbands = q->subpacket[s].subbands; q->subpacket[s].num_channels = 1; av_log(avctx, AV_LOG_DEBUG, "subpacket[%i].cookversion=%x\n", s, q->subpacket[s].cookversion); q->subpacket[s].joint_stereo = 0; switch (q->subpacket[s].cookversion) { case MONO: if (avctx->channels != 1) { avpriv_request_sample(avctx, "Container channels != 1"); return AVERROR_PATCHWELCOME; } av_log(avctx, AV_LOG_DEBUG, "MONO\n"); break; case STEREO: if (avctx->channels != 1) { q->subpacket[s].bits_per_subpdiv = 1; q->subpacket[s].num_channels = 2; } av_log(avctx, AV_LOG_DEBUG, "STEREO\n"); break; case JOINT_STEREO: if (avctx->channels != 2) { avpriv_request_sample(avctx, "Container channels != 2"); return AVERROR_PATCHWELCOME; } av_log(avctx, AV_LOG_DEBUG, "JOINT_STEREO\n"); if (avctx->extradata_size >= 16) { q->subpacket[s].total_subbands = q->subpacket[s].subbands + q->subpacket[s].js_subband_start; q->subpacket[s].joint_stereo = 1; q->subpacket[s].num_channels = 2; } if (q->subpacket[s].samples_per_channel > 256) { q->subpacket[s].log2_numvector_size = 6; } if (q->subpacket[s].samples_per_channel > 512) { q->subpacket[s].log2_numvector_size = 7; } break; case MC_COOK: av_log(avctx, AV_LOG_DEBUG, "MULTI_CHANNEL\n"); if (extradata_size >= 4) channel_mask |= q->subpacket[s].channel_mask = bytestream_get_be32(&edata_ptr); if (av_get_channel_layout_nb_channels(q->subpacket[s].channel_mask) > 1) { q->subpacket[s].total_subbands = q->subpacket[s].subbands + q->subpacket[s].js_subband_start; q->subpacket[s].joint_stereo = 1; q->subpacket[s].num_channels = 2; q->subpacket[s].samples_per_channel = samples_per_frame >> 1; if (q->subpacket[s].samples_per_channel > 256) { q->subpacket[s].log2_numvector_size = 6; } if (q->subpacket[s].samples_per_channel > 512) { q->subpacket[s].log2_numvector_size = 7; } } else q->subpacket[s].samples_per_channel = samples_per_frame; break; default: avpriv_request_sample(avctx, "Cook version %d", q->subpacket[s].cookversion); return AVERROR_PATCHWELCOME; } if (s > 1 && q->subpacket[s].samples_per_channel != q->samples_per_channel) { av_log(avctx, AV_LOG_ERROR, "different number of samples per channel!\n"); return AVERROR_INVALIDDATA; } else q->samples_per_channel = q->subpacket[0].samples_per_channel; q->subpacket[s].numvector_size = (1 << q->subpacket[s].log2_numvector_size); if (q->subpacket[s].total_subbands > 53) { avpriv_request_sample(avctx, "total_subbands > 53"); return AVERROR_PATCHWELCOME; } if ((q->subpacket[s].js_vlc_bits > 6) || (q->subpacket[s].js_vlc_bits < 2 * q->subpacket[s].joint_stereo)) { av_log(avctx, AV_LOG_ERROR, "js_vlc_bits = %d, only >= %d and <= 6 allowed!\n", q->subpacket[s].js_vlc_bits, 2 * q->subpacket[s].joint_stereo); return AVERROR_INVALIDDATA; } if (q->subpacket[s].subbands > 50) { avpriv_request_sample(avctx, "subbands > 50"); return AVERROR_PATCHWELCOME; } q->subpacket[s].gains1.now = q->subpacket[s].gain_1; q->subpacket[s].gains1.previous = q->subpacket[s].gain_2; q->subpacket[s].gains2.now = q->subpacket[s].gain_3; q->subpacket[s].gains2.previous = q->subpacket[s].gain_4; q->num_subpackets++; s++; if (s > MAX_SUBPACKETS) { avpriv_request_sample(avctx, "subpackets > %d", MAX_SUBPACKETS); return AVERROR_PATCHWELCOME; } } init_pow2table(); init_gain_table(q); init_cplscales_table(q); if ((ret = init_cook_vlc_tables(q))) return ret; if (avctx->block_align >= UINT_MAX / 2) return AVERROR(EINVAL); q->decoded_bytes_buffer = av_mallocz(avctx->block_align + DECODE_BYTES_PAD1(avctx->block_align) + AV_INPUT_BUFFER_PADDING_SIZE); if (!q->decoded_bytes_buffer) return AVERROR(ENOMEM); if ((ret = init_cook_mlt(q))) return ret; if (1) { q->scalar_dequant = scalar_dequant_float; q->decouple = decouple_float; q->imlt_window = imlt_window_float; q->interpolate = interpolate_float; q->saturate_output = saturate_output_float; } if (q->samples_per_channel != 256 && q->samples_per_channel != 512 && q->samples_per_channel != 1024) { avpriv_request_sample(avctx, "samples_per_channel = %d", q->samples_per_channel); return AVERROR_PATCHWELCOME; } avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; if (channel_mask) avctx->channel_layout = channel_mask; else avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; #ifdef DEBUG dump_cook_context(q); #endif return 0; }
{ "code": [ " const uint8_t *edata_ptr = avctx->extradata;", " const uint8_t *edata_ptr_end = edata_ptr + avctx->extradata_size;", " int extradata_size = avctx->extradata_size;", " if (extradata_size < 8) {", " while (edata_ptr < edata_ptr_end) {", " if (extradata_size >= 8) {", " q->subpacket[s].cookversion = bytestream_get_be32(&edata_ptr);", " samples_per_frame = bytestream_get_be16(&edata_ptr);", " q->subpacket[s].subbands = bytestream_get_be16(&edata_ptr);", " extradata_size -= 8;", " if (extradata_size >= 8) {", " q->subpacket[s].js_subband_start = bytestream_get_be16(&edata_ptr);", " q->subpacket[s].js_vlc_bits = bytestream_get_be16(&edata_ptr);", " extradata_size -= 8;", " if (extradata_size >= 4)", " channel_mask |= q->subpacket[s].channel_mask = bytestream_get_be32(&edata_ptr);" ], "line_no": [ 7, 9, 11, 27, 61, 67, 69, 71, 73, 75, 67, 83, 85, 75, 193, 195 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { COOKContext *q = avctx->priv_data; const uint8_t *VAR_0 = avctx->extradata; const uint8_t *VAR_1 = VAR_0 + avctx->VAR_2; int VAR_2 = avctx->VAR_2; int VAR_3 = 0; unsigned int VAR_4 = 0; int VAR_5; int VAR_6; q->avctx = avctx; if (VAR_2 < 8) { av_log(avctx, AV_LOG_ERROR, "Necessary extradata missing!\n"); return AVERROR_INVALIDDATA; } av_log(avctx, AV_LOG_DEBUG, "codecdata_length=%d\n", avctx->VAR_2); if (!avctx->channels) { av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); return AVERROR_INVALIDDATA; } av_lfg_init(&q->random_state, 0); ff_audiodsp_init(&q->adsp); while (VAR_0 < VAR_1) { if (VAR_2 >= 8) { q->subpacket[VAR_3].cookversion = bytestream_get_be32(&VAR_0); VAR_5 = bytestream_get_be16(&VAR_0); q->subpacket[VAR_3].subbands = bytestream_get_be16(&VAR_0); VAR_2 -= 8; } if (VAR_2 >= 8) { bytestream_get_be32(&VAR_0); q->subpacket[VAR_3].js_subband_start = bytestream_get_be16(&VAR_0); q->subpacket[VAR_3].js_vlc_bits = bytestream_get_be16(&VAR_0); VAR_2 -= 8; } q->subpacket[VAR_3].samples_per_channel = VAR_5 / avctx->channels; q->subpacket[VAR_3].bits_per_subpacket = avctx->block_align * 8; q->subpacket[VAR_3].log2_numvector_size = 5; q->subpacket[VAR_3].total_subbands = q->subpacket[VAR_3].subbands; q->subpacket[VAR_3].num_channels = 1; av_log(avctx, AV_LOG_DEBUG, "subpacket[%i].cookversion=%x\n", VAR_3, q->subpacket[VAR_3].cookversion); q->subpacket[VAR_3].joint_stereo = 0; switch (q->subpacket[VAR_3].cookversion) { case MONO: if (avctx->channels != 1) { avpriv_request_sample(avctx, "Container channels != 1"); return AVERROR_PATCHWELCOME; } av_log(avctx, AV_LOG_DEBUG, "MONO\n"); break; case STEREO: if (avctx->channels != 1) { q->subpacket[VAR_3].bits_per_subpdiv = 1; q->subpacket[VAR_3].num_channels = 2; } av_log(avctx, AV_LOG_DEBUG, "STEREO\n"); break; case JOINT_STEREO: if (avctx->channels != 2) { avpriv_request_sample(avctx, "Container channels != 2"); return AVERROR_PATCHWELCOME; } av_log(avctx, AV_LOG_DEBUG, "JOINT_STEREO\n"); if (avctx->VAR_2 >= 16) { q->subpacket[VAR_3].total_subbands = q->subpacket[VAR_3].subbands + q->subpacket[VAR_3].js_subband_start; q->subpacket[VAR_3].joint_stereo = 1; q->subpacket[VAR_3].num_channels = 2; } if (q->subpacket[VAR_3].samples_per_channel > 256) { q->subpacket[VAR_3].log2_numvector_size = 6; } if (q->subpacket[VAR_3].samples_per_channel > 512) { q->subpacket[VAR_3].log2_numvector_size = 7; } break; case MC_COOK: av_log(avctx, AV_LOG_DEBUG, "MULTI_CHANNEL\n"); if (VAR_2 >= 4) VAR_4 |= q->subpacket[VAR_3].VAR_4 = bytestream_get_be32(&VAR_0); if (av_get_channel_layout_nb_channels(q->subpacket[VAR_3].VAR_4) > 1) { q->subpacket[VAR_3].total_subbands = q->subpacket[VAR_3].subbands + q->subpacket[VAR_3].js_subband_start; q->subpacket[VAR_3].joint_stereo = 1; q->subpacket[VAR_3].num_channels = 2; q->subpacket[VAR_3].samples_per_channel = VAR_5 >> 1; if (q->subpacket[VAR_3].samples_per_channel > 256) { q->subpacket[VAR_3].log2_numvector_size = 6; } if (q->subpacket[VAR_3].samples_per_channel > 512) { q->subpacket[VAR_3].log2_numvector_size = 7; } } else q->subpacket[VAR_3].samples_per_channel = VAR_5; break; default: avpriv_request_sample(avctx, "Cook version %d", q->subpacket[VAR_3].cookversion); return AVERROR_PATCHWELCOME; } if (VAR_3 > 1 && q->subpacket[VAR_3].samples_per_channel != q->samples_per_channel) { av_log(avctx, AV_LOG_ERROR, "different number of samples per channel!\n"); return AVERROR_INVALIDDATA; } else q->samples_per_channel = q->subpacket[0].samples_per_channel; q->subpacket[VAR_3].numvector_size = (1 << q->subpacket[VAR_3].log2_numvector_size); if (q->subpacket[VAR_3].total_subbands > 53) { avpriv_request_sample(avctx, "total_subbands > 53"); return AVERROR_PATCHWELCOME; } if ((q->subpacket[VAR_3].js_vlc_bits > 6) || (q->subpacket[VAR_3].js_vlc_bits < 2 * q->subpacket[VAR_3].joint_stereo)) { av_log(avctx, AV_LOG_ERROR, "js_vlc_bits = %d, only >= %d and <= 6 allowed!\n", q->subpacket[VAR_3].js_vlc_bits, 2 * q->subpacket[VAR_3].joint_stereo); return AVERROR_INVALIDDATA; } if (q->subpacket[VAR_3].subbands > 50) { avpriv_request_sample(avctx, "subbands > 50"); return AVERROR_PATCHWELCOME; } q->subpacket[VAR_3].gains1.now = q->subpacket[VAR_3].gain_1; q->subpacket[VAR_3].gains1.previous = q->subpacket[VAR_3].gain_2; q->subpacket[VAR_3].gains2.now = q->subpacket[VAR_3].gain_3; q->subpacket[VAR_3].gains2.previous = q->subpacket[VAR_3].gain_4; q->num_subpackets++; VAR_3++; if (VAR_3 > MAX_SUBPACKETS) { avpriv_request_sample(avctx, "subpackets > %d", MAX_SUBPACKETS); return AVERROR_PATCHWELCOME; } } init_pow2table(); init_gain_table(q); init_cplscales_table(q); if ((VAR_6 = init_cook_vlc_tables(q))) return VAR_6; if (avctx->block_align >= UINT_MAX / 2) return AVERROR(EINVAL); q->decoded_bytes_buffer = av_mallocz(avctx->block_align + DECODE_BYTES_PAD1(avctx->block_align) + AV_INPUT_BUFFER_PADDING_SIZE); if (!q->decoded_bytes_buffer) return AVERROR(ENOMEM); if ((VAR_6 = init_cook_mlt(q))) return VAR_6; if (1) { q->scalar_dequant = scalar_dequant_float; q->decouple = decouple_float; q->imlt_window = imlt_window_float; q->interpolate = interpolate_float; q->saturate_output = saturate_output_float; } if (q->samples_per_channel != 256 && q->samples_per_channel != 512 && q->samples_per_channel != 1024) { avpriv_request_sample(avctx, "samples_per_channel = %d", q->samples_per_channel); return AVERROR_PATCHWELCOME; } avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; if (VAR_4) avctx->channel_layout = VAR_4; else avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; #ifdef DEBUG dump_cook_context(q); #endif return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "COOKContext *q = avctx->priv_data;", "const uint8_t *VAR_0 = avctx->extradata;", "const uint8_t *VAR_1 = VAR_0 + avctx->VAR_2;", "int VAR_2 = avctx->VAR_2;", "int VAR_3 = 0;", "unsigned int VAR_4 = 0;", "int VAR_5;", "int VAR_6;", "q->avctx = avctx;", "if (VAR_2 < 8) {", "av_log(avctx, AV_LOG_ERROR, \"Necessary extradata missing!\\n\");", "return AVERROR_INVALIDDATA;", "}", "av_log(avctx, AV_LOG_DEBUG, \"codecdata_length=%d\\n\", avctx->VAR_2);", "if (!avctx->channels) {", "av_log(avctx, AV_LOG_ERROR, \"Invalid number of channels\\n\");", "return AVERROR_INVALIDDATA;", "}", "av_lfg_init(&q->random_state, 0);", "ff_audiodsp_init(&q->adsp);", "while (VAR_0 < VAR_1) {", "if (VAR_2 >= 8) {", "q->subpacket[VAR_3].cookversion = bytestream_get_be32(&VAR_0);", "VAR_5 = bytestream_get_be16(&VAR_0);", "q->subpacket[VAR_3].subbands = bytestream_get_be16(&VAR_0);", "VAR_2 -= 8;", "}", "if (VAR_2 >= 8) {", "bytestream_get_be32(&VAR_0);", "q->subpacket[VAR_3].js_subband_start = bytestream_get_be16(&VAR_0);", "q->subpacket[VAR_3].js_vlc_bits = bytestream_get_be16(&VAR_0);", "VAR_2 -= 8;", "}", "q->subpacket[VAR_3].samples_per_channel = VAR_5 / avctx->channels;", "q->subpacket[VAR_3].bits_per_subpacket = avctx->block_align * 8;", "q->subpacket[VAR_3].log2_numvector_size = 5;", "q->subpacket[VAR_3].total_subbands = q->subpacket[VAR_3].subbands;", "q->subpacket[VAR_3].num_channels = 1;", "av_log(avctx, AV_LOG_DEBUG, \"subpacket[%i].cookversion=%x\\n\", VAR_3,\nq->subpacket[VAR_3].cookversion);", "q->subpacket[VAR_3].joint_stereo = 0;", "switch (q->subpacket[VAR_3].cookversion) {", "case MONO:\nif (avctx->channels != 1) {", "avpriv_request_sample(avctx, \"Container channels != 1\");", "return AVERROR_PATCHWELCOME;", "}", "av_log(avctx, AV_LOG_DEBUG, \"MONO\\n\");", "break;", "case STEREO:\nif (avctx->channels != 1) {", "q->subpacket[VAR_3].bits_per_subpdiv = 1;", "q->subpacket[VAR_3].num_channels = 2;", "}", "av_log(avctx, AV_LOG_DEBUG, \"STEREO\\n\");", "break;", "case JOINT_STEREO:\nif (avctx->channels != 2) {", "avpriv_request_sample(avctx, \"Container channels != 2\");", "return AVERROR_PATCHWELCOME;", "}", "av_log(avctx, AV_LOG_DEBUG, \"JOINT_STEREO\\n\");", "if (avctx->VAR_2 >= 16) {", "q->subpacket[VAR_3].total_subbands = q->subpacket[VAR_3].subbands +\nq->subpacket[VAR_3].js_subband_start;", "q->subpacket[VAR_3].joint_stereo = 1;", "q->subpacket[VAR_3].num_channels = 2;", "}", "if (q->subpacket[VAR_3].samples_per_channel > 256) {", "q->subpacket[VAR_3].log2_numvector_size = 6;", "}", "if (q->subpacket[VAR_3].samples_per_channel > 512) {", "q->subpacket[VAR_3].log2_numvector_size = 7;", "}", "break;", "case MC_COOK:\nav_log(avctx, AV_LOG_DEBUG, \"MULTI_CHANNEL\\n\");", "if (VAR_2 >= 4)\nVAR_4 |= q->subpacket[VAR_3].VAR_4 = bytestream_get_be32(&VAR_0);", "if (av_get_channel_layout_nb_channels(q->subpacket[VAR_3].VAR_4) > 1) {", "q->subpacket[VAR_3].total_subbands = q->subpacket[VAR_3].subbands +\nq->subpacket[VAR_3].js_subband_start;", "q->subpacket[VAR_3].joint_stereo = 1;", "q->subpacket[VAR_3].num_channels = 2;", "q->subpacket[VAR_3].samples_per_channel = VAR_5 >> 1;", "if (q->subpacket[VAR_3].samples_per_channel > 256) {", "q->subpacket[VAR_3].log2_numvector_size = 6;", "}", "if (q->subpacket[VAR_3].samples_per_channel > 512) {", "q->subpacket[VAR_3].log2_numvector_size = 7;", "}", "} else", "q->subpacket[VAR_3].samples_per_channel = VAR_5;", "break;", "default:\navpriv_request_sample(avctx, \"Cook version %d\",\nq->subpacket[VAR_3].cookversion);", "return AVERROR_PATCHWELCOME;", "}", "if (VAR_3 > 1 && q->subpacket[VAR_3].samples_per_channel != q->samples_per_channel) {", "av_log(avctx, AV_LOG_ERROR, \"different number of samples per channel!\\n\");", "return AVERROR_INVALIDDATA;", "} else", "q->samples_per_channel = q->subpacket[0].samples_per_channel;", "q->subpacket[VAR_3].numvector_size = (1 << q->subpacket[VAR_3].log2_numvector_size);", "if (q->subpacket[VAR_3].total_subbands > 53) {", "avpriv_request_sample(avctx, \"total_subbands > 53\");", "return AVERROR_PATCHWELCOME;", "}", "if ((q->subpacket[VAR_3].js_vlc_bits > 6) ||\n(q->subpacket[VAR_3].js_vlc_bits < 2 * q->subpacket[VAR_3].joint_stereo)) {", "av_log(avctx, AV_LOG_ERROR, \"js_vlc_bits = %d, only >= %d and <= 6 allowed!\\n\",\nq->subpacket[VAR_3].js_vlc_bits, 2 * q->subpacket[VAR_3].joint_stereo);", "return AVERROR_INVALIDDATA;", "}", "if (q->subpacket[VAR_3].subbands > 50) {", "avpriv_request_sample(avctx, \"subbands > 50\");", "return AVERROR_PATCHWELCOME;", "}", "q->subpacket[VAR_3].gains1.now = q->subpacket[VAR_3].gain_1;", "q->subpacket[VAR_3].gains1.previous = q->subpacket[VAR_3].gain_2;", "q->subpacket[VAR_3].gains2.now = q->subpacket[VAR_3].gain_3;", "q->subpacket[VAR_3].gains2.previous = q->subpacket[VAR_3].gain_4;", "q->num_subpackets++;", "VAR_3++;", "if (VAR_3 > MAX_SUBPACKETS) {", "avpriv_request_sample(avctx, \"subpackets > %d\", MAX_SUBPACKETS);", "return AVERROR_PATCHWELCOME;", "}", "}", "init_pow2table();", "init_gain_table(q);", "init_cplscales_table(q);", "if ((VAR_6 = init_cook_vlc_tables(q)))\nreturn VAR_6;", "if (avctx->block_align >= UINT_MAX / 2)\nreturn AVERROR(EINVAL);", "q->decoded_bytes_buffer =\nav_mallocz(avctx->block_align\n+ DECODE_BYTES_PAD1(avctx->block_align)\n+ AV_INPUT_BUFFER_PADDING_SIZE);", "if (!q->decoded_bytes_buffer)\nreturn AVERROR(ENOMEM);", "if ((VAR_6 = init_cook_mlt(q)))\nreturn VAR_6;", "if (1) {", "q->scalar_dequant = scalar_dequant_float;", "q->decouple = decouple_float;", "q->imlt_window = imlt_window_float;", "q->interpolate = interpolate_float;", "q->saturate_output = saturate_output_float;", "}", "if (q->samples_per_channel != 256 && q->samples_per_channel != 512 &&\nq->samples_per_channel != 1024) {", "avpriv_request_sample(avctx, \"samples_per_channel = %d\",\nq->samples_per_channel);", "return AVERROR_PATCHWELCOME;", "}", "avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;", "if (VAR_4)\navctx->channel_layout = VAR_4;", "else\navctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;", "#ifdef DEBUG\ndump_cook_context(q);", "#endif\nreturn 0;", "}" ]
[ 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 57 ], [ 61 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 95 ], [ 97 ], [ 103 ], [ 105 ], [ 107 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193, 195 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233, 235, 237 ], [ 239 ], [ 241 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 261 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 277, 279 ], [ 281, 283 ], [ 285 ], [ 287 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 333, 335 ], [ 341, 343 ], [ 353, 355, 357, 359 ], [ 361, 363 ], [ 369, 371 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 395, 397 ], [ 399, 401 ], [ 403 ], [ 405 ], [ 409 ], [ 411, 413 ], [ 415, 417 ], [ 421, 423 ], [ 425, 427 ], [ 429 ] ]
20,696
static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { int idx; CPUState *cs; CPUArchId *cpu_slot; X86CPUTopoInfo topo; X86CPU *cpu = X86_CPU(dev); PCMachineState *pcms = PC_MACHINE(hotplug_dev); /* if APIC ID is not set, set it based on socket/core/thread properties */ if (cpu->apic_id == UNASSIGNED_APIC_ID) { int max_socket = (max_cpus - 1) / smp_threads / smp_cores; if (cpu->socket_id < 0) { error_setg(errp, "CPU socket-id is not set"); } else if (cpu->socket_id > max_socket) { error_setg(errp, "Invalid CPU socket-id: %u must be in range 0:%u", cpu->socket_id, max_socket); if (cpu->core_id < 0) { error_setg(errp, "CPU core-id is not set"); } else if (cpu->core_id > (smp_cores - 1)) { error_setg(errp, "Invalid CPU core-id: %u must be in range 0:%u", cpu->core_id, smp_cores - 1); if (cpu->thread_id < 0) { error_setg(errp, "CPU thread-id is not set"); } else if (cpu->thread_id > (smp_threads - 1)) { error_setg(errp, "Invalid CPU thread-id: %u must be in range 0:%u", cpu->thread_id, smp_threads - 1); topo.pkg_id = cpu->socket_id; topo.core_id = cpu->core_id; topo.smt_id = cpu->thread_id; cpu->apic_id = apicid_from_topo_ids(smp_cores, smp_threads, &topo); cpu_slot = pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, &idx); if (!cpu_slot) { MachineState *ms = MACHINE(pcms); x86_topo_ids_from_apicid(cpu->apic_id, smp_cores, smp_threads, &topo); error_setg(errp, "Invalid CPU [socket: %u, core: %u, thread: %u] with" " APIC ID %" PRIu32 ", valid index range 0:%d", topo.pkg_id, topo.core_id, topo.smt_id, cpu->apic_id, ms->possible_cpus->len - 1); if (cpu_slot->cpu) { error_setg(errp, "CPU[%d] with APIC ID %" PRIu32 " exists", idx, cpu->apic_id); /* if 'address' properties socket-id/core-id/thread-id are not set, set them * so that machine_query_hotpluggable_cpus would show correct values */ /* TODO: move socket_id/core_id/thread_id checks into x86_cpu_realizefn() * once -smp refactoring is complete and there will be CPU private * CPUState::nr_cores and CPUState::nr_threads fields instead of globals */ x86_topo_ids_from_apicid(cpu->apic_id, smp_cores, smp_threads, &topo); if (cpu->socket_id != -1 && cpu->socket_id != topo.pkg_id) { error_setg(errp, "property socket-id: %u doesn't match set apic-id:" " 0x%x (socket-id: %u)", cpu->socket_id, cpu->apic_id, topo.pkg_id); cpu->socket_id = topo.pkg_id; if (cpu->core_id != -1 && cpu->core_id != topo.core_id) { error_setg(errp, "property core-id: %u doesn't match set apic-id:" " 0x%x (core-id: %u)", cpu->core_id, cpu->apic_id, topo.core_id); cpu->core_id = topo.core_id; if (cpu->thread_id != -1 && cpu->thread_id != topo.smt_id) { error_setg(errp, "property thread-id: %u doesn't match set apic-id:" " 0x%x (thread-id: %u)", cpu->thread_id, cpu->apic_id, topo.smt_id); cpu->thread_id = topo.smt_id; cs = CPU(cpu); cs->cpu_index = idx; numa_cpu_pre_plug(cpu_slot, dev, errp);
true
qemu
6970c5ff13a47df7ce41b901a4459c587a03d16b
static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { int idx; CPUState *cs; CPUArchId *cpu_slot; X86CPUTopoInfo topo; X86CPU *cpu = X86_CPU(dev); PCMachineState *pcms = PC_MACHINE(hotplug_dev); if (cpu->apic_id == UNASSIGNED_APIC_ID) { int max_socket = (max_cpus - 1) / smp_threads / smp_cores; if (cpu->socket_id < 0) { error_setg(errp, "CPU socket-id is not set"); } else if (cpu->socket_id > max_socket) { error_setg(errp, "Invalid CPU socket-id: %u must be in range 0:%u", cpu->socket_id, max_socket); if (cpu->core_id < 0) { error_setg(errp, "CPU core-id is not set"); } else if (cpu->core_id > (smp_cores - 1)) { error_setg(errp, "Invalid CPU core-id: %u must be in range 0:%u", cpu->core_id, smp_cores - 1); if (cpu->thread_id < 0) { error_setg(errp, "CPU thread-id is not set"); } else if (cpu->thread_id > (smp_threads - 1)) { error_setg(errp, "Invalid CPU thread-id: %u must be in range 0:%u", cpu->thread_id, smp_threads - 1); topo.pkg_id = cpu->socket_id; topo.core_id = cpu->core_id; topo.smt_id = cpu->thread_id; cpu->apic_id = apicid_from_topo_ids(smp_cores, smp_threads, &topo); cpu_slot = pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, &idx); if (!cpu_slot) { MachineState *ms = MACHINE(pcms); x86_topo_ids_from_apicid(cpu->apic_id, smp_cores, smp_threads, &topo); error_setg(errp, "Invalid CPU [socket: %u, core: %u, thread: %u] with" " APIC ID %" PRIu32 ", valid index range 0:%d", topo.pkg_id, topo.core_id, topo.smt_id, cpu->apic_id, ms->possible_cpus->len - 1); if (cpu_slot->cpu) { error_setg(errp, "CPU[%d] with APIC ID %" PRIu32 " exists", idx, cpu->apic_id); x86_topo_ids_from_apicid(cpu->apic_id, smp_cores, smp_threads, &topo); if (cpu->socket_id != -1 && cpu->socket_id != topo.pkg_id) { error_setg(errp, "property socket-id: %u doesn't match set apic-id:" " 0x%x (socket-id: %u)", cpu->socket_id, cpu->apic_id, topo.pkg_id); cpu->socket_id = topo.pkg_id; if (cpu->core_id != -1 && cpu->core_id != topo.core_id) { error_setg(errp, "property core-id: %u doesn't match set apic-id:" " 0x%x (core-id: %u)", cpu->core_id, cpu->apic_id, topo.core_id); cpu->core_id = topo.core_id; if (cpu->thread_id != -1 && cpu->thread_id != topo.smt_id) { error_setg(errp, "property thread-id: %u doesn't match set apic-id:" " 0x%x (thread-id: %u)", cpu->thread_id, cpu->apic_id, topo.smt_id); cpu->thread_id = topo.smt_id; cs = CPU(cpu); cs->cpu_index = idx; numa_cpu_pre_plug(cpu_slot, dev, errp);
{ "code": [], "line_no": [] }
static void FUNC_0(HotplugHandler *VAR_0, DeviceState *VAR_1, Error **VAR_2) { int VAR_3; CPUState *cs; CPUArchId *cpu_slot; X86CPUTopoInfo topo; X86CPU *cpu = X86_CPU(VAR_1); PCMachineState *pcms = PC_MACHINE(VAR_0); if (cpu->apic_id == UNASSIGNED_APIC_ID) { int VAR_4 = (max_cpus - 1) / smp_threads / smp_cores; if (cpu->socket_id < 0) { error_setg(VAR_2, "CPU socket-id is not set"); } else if (cpu->socket_id > VAR_4) { error_setg(VAR_2, "Invalid CPU socket-id: %u must be in range 0:%u", cpu->socket_id, VAR_4); if (cpu->core_id < 0) { error_setg(VAR_2, "CPU core-id is not set"); } else if (cpu->core_id > (smp_cores - 1)) { error_setg(VAR_2, "Invalid CPU core-id: %u must be in range 0:%u", cpu->core_id, smp_cores - 1); if (cpu->thread_id < 0) { error_setg(VAR_2, "CPU thread-id is not set"); } else if (cpu->thread_id > (smp_threads - 1)) { error_setg(VAR_2, "Invalid CPU thread-id: %u must be in range 0:%u", cpu->thread_id, smp_threads - 1); topo.pkg_id = cpu->socket_id; topo.core_id = cpu->core_id; topo.smt_id = cpu->thread_id; cpu->apic_id = apicid_from_topo_ids(smp_cores, smp_threads, &topo); cpu_slot = pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, &VAR_3); if (!cpu_slot) { MachineState *ms = MACHINE(pcms); x86_topo_ids_from_apicid(cpu->apic_id, smp_cores, smp_threads, &topo); error_setg(VAR_2, "Invalid CPU [socket: %u, core: %u, thread: %u] with" " APIC ID %" PRIu32 ", valid index range 0:%d", topo.pkg_id, topo.core_id, topo.smt_id, cpu->apic_id, ms->possible_cpus->len - 1); if (cpu_slot->cpu) { error_setg(VAR_2, "CPU[%d] with APIC ID %" PRIu32 " exists", VAR_3, cpu->apic_id); x86_topo_ids_from_apicid(cpu->apic_id, smp_cores, smp_threads, &topo); if (cpu->socket_id != -1 && cpu->socket_id != topo.pkg_id) { error_setg(VAR_2, "property socket-id: %u doesn't match set apic-id:" " 0x%x (socket-id: %u)", cpu->socket_id, cpu->apic_id, topo.pkg_id); cpu->socket_id = topo.pkg_id; if (cpu->core_id != -1 && cpu->core_id != topo.core_id) { error_setg(VAR_2, "property core-id: %u doesn't match set apic-id:" " 0x%x (core-id: %u)", cpu->core_id, cpu->apic_id, topo.core_id); cpu->core_id = topo.core_id; if (cpu->thread_id != -1 && cpu->thread_id != topo.smt_id) { error_setg(VAR_2, "property thread-id: %u doesn't match set apic-id:" " 0x%x (thread-id: %u)", cpu->thread_id, cpu->apic_id, topo.smt_id); cpu->thread_id = topo.smt_id; cs = CPU(cpu); cs->cpu_index = VAR_3; numa_cpu_pre_plug(cpu_slot, VAR_1, VAR_2);
[ "static void FUNC_0(HotplugHandler *VAR_0,\nDeviceState *VAR_1, Error **VAR_2)\n{", "int VAR_3;", "CPUState *cs;", "CPUArchId *cpu_slot;", "X86CPUTopoInfo topo;", "X86CPU *cpu = X86_CPU(VAR_1);", "PCMachineState *pcms = PC_MACHINE(VAR_0);", "if (cpu->apic_id == UNASSIGNED_APIC_ID) {", "int VAR_4 = (max_cpus - 1) / smp_threads / smp_cores;", "if (cpu->socket_id < 0) {", "error_setg(VAR_2, \"CPU socket-id is not set\");", "} else if (cpu->socket_id > VAR_4) {", "error_setg(VAR_2, \"Invalid CPU socket-id: %u must be in range 0:%u\",\ncpu->socket_id, VAR_4);", "if (cpu->core_id < 0) {", "error_setg(VAR_2, \"CPU core-id is not set\");", "} else if (cpu->core_id > (smp_cores - 1)) {", "error_setg(VAR_2, \"Invalid CPU core-id: %u must be in range 0:%u\",\ncpu->core_id, smp_cores - 1);", "if (cpu->thread_id < 0) {", "error_setg(VAR_2, \"CPU thread-id is not set\");", "} else if (cpu->thread_id > (smp_threads - 1)) {", "error_setg(VAR_2, \"Invalid CPU thread-id: %u must be in range 0:%u\",\ncpu->thread_id, smp_threads - 1);", "topo.pkg_id = cpu->socket_id;", "topo.core_id = cpu->core_id;", "topo.smt_id = cpu->thread_id;", "cpu->apic_id = apicid_from_topo_ids(smp_cores, smp_threads, &topo);", "cpu_slot = pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, &VAR_3);", "if (!cpu_slot) {", "MachineState *ms = MACHINE(pcms);", "x86_topo_ids_from_apicid(cpu->apic_id, smp_cores, smp_threads, &topo);", "error_setg(VAR_2, \"Invalid CPU [socket: %u, core: %u, thread: %u] with\"\n\" APIC ID %\" PRIu32 \", valid index range 0:%d\",\ntopo.pkg_id, topo.core_id, topo.smt_id, cpu->apic_id,\nms->possible_cpus->len - 1);", "if (cpu_slot->cpu) {", "error_setg(VAR_2, \"CPU[%d] with APIC ID %\" PRIu32 \" exists\",\nVAR_3, cpu->apic_id);", "x86_topo_ids_from_apicid(cpu->apic_id, smp_cores, smp_threads, &topo);", "if (cpu->socket_id != -1 && cpu->socket_id != topo.pkg_id) {", "error_setg(VAR_2, \"property socket-id: %u doesn't match set apic-id:\"\n\" 0x%x (socket-id: %u)\", cpu->socket_id, cpu->apic_id, topo.pkg_id);", "cpu->socket_id = topo.pkg_id;", "if (cpu->core_id != -1 && cpu->core_id != topo.core_id) {", "error_setg(VAR_2, \"property core-id: %u doesn't match set apic-id:\"\n\" 0x%x (core-id: %u)\", cpu->core_id, cpu->apic_id, topo.core_id);", "cpu->core_id = topo.core_id;", "if (cpu->thread_id != -1 && cpu->thread_id != topo.smt_id) {", "error_setg(VAR_2, \"property thread-id: %u doesn't match set apic-id:\"\n\" 0x%x (thread-id: %u)\", cpu->thread_id, cpu->apic_id, topo.smt_id);", "cpu->thread_id = topo.smt_id;", "cs = CPU(cpu);", "cs->cpu_index = VAR_3;", "numa_cpu_pre_plug(cpu_slot, VAR_1, 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, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16, 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21, 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26, 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36, 37, 38, 39 ], [ 40 ], [ 41, 42 ], [ 49 ], [ 50 ], [ 51, 52 ], [ 53 ], [ 54 ], [ 55, 56 ], [ 57 ], [ 58 ], [ 59, 60 ], [ 61 ], [ 62 ], [ 63 ], [ 64 ] ]
20,699
void cpu_reset(CPUARMState *env) { uint32_t id; id = env->cp15.c0_cpuid; memset(env, 0, offsetof(CPUARMState, breakpoints)); if (id) cpu_reset_model_id(env, id); #if defined (CONFIG_USER_ONLY) env->uncached_cpsr = ARM_CPU_MODE_USR; env->vfp.xregs[ARM_VFP_FPEXC] = 1 << 30; #else /* SVC mode with interrupts disabled. */ env->uncached_cpsr = ARM_CPU_MODE_SVC | CPSR_A | CPSR_F | CPSR_I; /* On ARMv7-M the CPSR_I is the value of the PRIMASK register, and is clear at reset. */ if (IS_M(env)) env->uncached_cpsr &= ~CPSR_I; env->vfp.xregs[ARM_VFP_FPEXC] = 0; env->cp15.c2_base_mask = 0xffffc000u; #endif env->regs[15] = 0; tlb_flush(env, 1);
true
qemu
eca1bdf415c454093dfc7eb983cd49287c043967
void cpu_reset(CPUARMState *env) { uint32_t id; id = env->cp15.c0_cpuid; memset(env, 0, offsetof(CPUARMState, breakpoints)); if (id) cpu_reset_model_id(env, id); #if defined (CONFIG_USER_ONLY) env->uncached_cpsr = ARM_CPU_MODE_USR; env->vfp.xregs[ARM_VFP_FPEXC] = 1 << 30; #else env->uncached_cpsr = ARM_CPU_MODE_SVC | CPSR_A | CPSR_F | CPSR_I; if (IS_M(env)) env->uncached_cpsr &= ~CPSR_I; env->vfp.xregs[ARM_VFP_FPEXC] = 0; env->cp15.c2_base_mask = 0xffffc000u; #endif env->regs[15] = 0; tlb_flush(env, 1);
{ "code": [], "line_no": [] }
void FUNC_0(CPUARMState *VAR_0) { uint32_t id; id = VAR_0->cp15.c0_cpuid; memset(VAR_0, 0, offsetof(CPUARMState, breakpoints)); if (id) cpu_reset_model_id(VAR_0, id); #if defined (CONFIG_USER_ONLY) VAR_0->uncached_cpsr = ARM_CPU_MODE_USR; VAR_0->vfp.xregs[ARM_VFP_FPEXC] = 1 << 30; #else VAR_0->uncached_cpsr = ARM_CPU_MODE_SVC | CPSR_A | CPSR_F | CPSR_I; if (IS_M(VAR_0)) VAR_0->uncached_cpsr &= ~CPSR_I; VAR_0->vfp.xregs[ARM_VFP_FPEXC] = 0; VAR_0->cp15.c2_base_mask = 0xffffc000u; #endif VAR_0->regs[15] = 0; tlb_flush(VAR_0, 1);
[ "void FUNC_0(CPUARMState *VAR_0)\n{", "uint32_t id;", "id = VAR_0->cp15.c0_cpuid;", "memset(VAR_0, 0, offsetof(CPUARMState, breakpoints));", "if (id)\ncpu_reset_model_id(VAR_0, id);", "#if defined (CONFIG_USER_ONLY)\nVAR_0->uncached_cpsr = ARM_CPU_MODE_USR;", "VAR_0->vfp.xregs[ARM_VFP_FPEXC] = 1 << 30;", "#else\nVAR_0->uncached_cpsr = ARM_CPU_MODE_SVC | CPSR_A | CPSR_F | CPSR_I;", "if (IS_M(VAR_0))\nVAR_0->uncached_cpsr &= ~CPSR_I;", "VAR_0->vfp.xregs[ARM_VFP_FPEXC] = 0;", "VAR_0->cp15.c2_base_mask = 0xffffc000u;", "#endif\nVAR_0->regs[15] = 0;", "tlb_flush(VAR_0, 1);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6, 7 ], [ 8, 9 ], [ 10 ], [ 11, 13 ], [ 16, 17 ], [ 18 ], [ 19 ], [ 20, 21 ], [ 22 ] ]
20,700
static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BlockDriver *drv = bs->drv; BdrvTrackedRequest req; int ret; if (!drv) { return -ENOMEDIUM; if (bdrv_check_request(bs, sector_num, nb_sectors)) { return -EIO; /* throttling disk read I/O */ if (bs->io_limits_enabled) { bdrv_io_limits_intercept(bs, false, nb_sectors); tracked_request_begin(&req, bs, sector_num, nb_sectors, false); ret = drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov); tracked_request_end(&req); return ret;
true
qemu
f4658285f99473367dbbc34ce6970ec4637c2388
static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BlockDriver *drv = bs->drv; BdrvTrackedRequest req; int ret; if (!drv) { return -ENOMEDIUM; if (bdrv_check_request(bs, sector_num, nb_sectors)) { return -EIO; if (bs->io_limits_enabled) { bdrv_io_limits_intercept(bs, false, nb_sectors); tracked_request_begin(&req, bs, sector_num, nb_sectors, false); ret = drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov); tracked_request_end(&req); return ret;
{ "code": [], "line_no": [] }
static int VAR_0 bdrv_co_do_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BlockDriver *drv = bs->drv; BdrvTrackedRequest req; int ret; if (!drv) { return -ENOMEDIUM; if (bdrv_check_request(bs, sector_num, nb_sectors)) { return -EIO; if (bs->io_limits_enabled) { bdrv_io_limits_intercept(bs, false, nb_sectors); tracked_request_begin(&req, bs, sector_num, nb_sectors, false); ret = drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov); tracked_request_end(&req); return ret;
[ "static int VAR_0 bdrv_co_do_readv(BlockDriverState *bs,\nint64_t sector_num, int nb_sectors, QEMUIOVector *qiov)\n{", "BlockDriver *drv = bs->drv;", "BdrvTrackedRequest req;", "int ret;", "if (!drv) {", "return -ENOMEDIUM;", "if (bdrv_check_request(bs, sector_num, nb_sectors)) {", "return -EIO;", "if (bs->io_limits_enabled) {", "bdrv_io_limits_intercept(bs, false, nb_sectors);", "tracked_request_begin(&req, bs, sector_num, nb_sectors, false);", "ret = drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov);", "tracked_request_end(&req);", "return ret;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ] ]
20,701
static inline void cris_ftag_i(unsigned int x) { register unsigned int v asm("$r10") = x; asm ("ftagi\t[%0]\n" : : "r" (v) ); }
true
qemu
21ce148c7ec71ee32834061355a5ecfd1a11f90f
static inline void cris_ftag_i(unsigned int x) { register unsigned int v asm("$r10") = x; asm ("ftagi\t[%0]\n" : : "r" (v) ); }
{ "code": [ "static inline void cris_ftag_i(unsigned int x)" ], "line_no": [ 1 ] }
static inline void FUNC_0(unsigned int VAR_0) { register unsigned int VAR_1 asm("$r10") = VAR_0; asm ("ftagi\t[%0]\n" : : "r" (VAR_1) ); }
[ "static inline void FUNC_0(unsigned int VAR_0)\n{", "register unsigned int VAR_1 asm(\"$r10\") = VAR_0;", "asm (\"ftagi\\t[%0]\\n\" : : \"r\" (VAR_1) );", "}" ]
[ 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
20,702
abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, int flags, int fd, abi_ulong offset) { abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len; mmap_lock(); #ifdef DEBUG_MMAP { printf("mmap: start=0x" TARGET_ABI_FMT_lx " len=0x" TARGET_ABI_FMT_lx " prot=%c%c%c flags=", start, len, prot & PROT_READ ? 'r' : '-', prot & PROT_WRITE ? 'w' : '-', prot & PROT_EXEC ? 'x' : '-'); if (flags & MAP_FIXED) printf("MAP_FIXED "); if (flags & MAP_ANONYMOUS) printf("MAP_ANON "); switch(flags & MAP_TYPE) { case MAP_PRIVATE: printf("MAP_PRIVATE "); break; case MAP_SHARED: printf("MAP_SHARED "); break; default: printf("[MAP_TYPE=0x%x] ", flags & MAP_TYPE); break; } printf("fd=%d offset=" TARGET_ABI_FMT_lx "\n", fd, offset); } #endif if (offset & ~TARGET_PAGE_MASK) { errno = EINVAL; goto fail; } len = TARGET_PAGE_ALIGN(len); if (len == 0) goto the_end; real_start = start & qemu_host_page_mask; host_offset = offset & qemu_host_page_mask; /* If the user is asking for the kernel to find a location, do that before we truncate the length for mapping files below. */ if (!(flags & MAP_FIXED)) { host_len = len + offset - host_offset; host_len = HOST_PAGE_ALIGN(host_len); start = mmap_find_vma(real_start, host_len); if (start == (abi_ulong)-1) { errno = ENOMEM; goto fail; } } /* When mapping files into a memory area larger than the file, accesses to pages beyond the file size will cause a SIGBUS. For example, if mmaping a file of 100 bytes on a host with 4K pages emulating a target with 8K pages, the target expects to be able to access the first 8K. But the host will trap us on any access beyond 4K. When emulating a target with a larger page-size than the hosts, we may need to truncate file maps at EOF and add extra anonymous pages up to the targets page boundary. */ if ((qemu_real_host_page_size < TARGET_PAGE_SIZE) && !(flags & MAP_ANONYMOUS)) { struct stat sb; if (fstat (fd, &sb) == -1) goto fail; /* Are we trying to create a map beyond EOF?. */ if (offset + len > sb.st_size) { /* If so, truncate the file map at eof aligned with the hosts real pagesize. Additional anonymous maps will be created beyond EOF. */ len = REAL_HOST_PAGE_ALIGN(sb.st_size - offset); } } if (!(flags & MAP_FIXED)) { unsigned long host_start; void *p; host_len = len + offset - host_offset; host_len = HOST_PAGE_ALIGN(host_len); /* Note: we prefer to control the mapping address. It is especially important if qemu_host_page_size > qemu_real_host_page_size */ p = mmap(g2h(start), host_len, prot, flags | MAP_FIXED | MAP_ANONYMOUS, -1, 0); if (p == MAP_FAILED) goto fail; /* update start so that it points to the file position at 'offset' */ host_start = (unsigned long)p; if (!(flags & MAP_ANONYMOUS)) { p = mmap(g2h(start), len, prot, flags | MAP_FIXED, fd, host_offset); if (p == MAP_FAILED) { munmap(g2h(start), host_len); goto fail; } host_start += offset - host_offset; } start = h2g(host_start); } else { if (start & ~TARGET_PAGE_MASK) { errno = EINVAL; goto fail; } end = start + len; real_end = HOST_PAGE_ALIGN(end); /* * Test if requested memory area fits target address space * It can fail only on 64-bit host with 32-bit target. * On any other target/host host mmap() handles this error correctly. */ if ((unsigned long)start + len - 1 > (abi_ulong) -1) { errno = EINVAL; goto fail; } /* worst case: we cannot map the file because the offset is not aligned, so we read it */ if (!(flags & MAP_ANONYMOUS) && (offset & ~qemu_host_page_mask) != (start & ~qemu_host_page_mask)) { /* msync() won't work here, so we return an error if write is possible while it is a shared mapping */ if ((flags & MAP_TYPE) == MAP_SHARED && (prot & PROT_WRITE)) { errno = EINVAL; goto fail; } retaddr = target_mmap(start, len, prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (retaddr == -1) goto fail; if (pread(fd, g2h(start), len, offset) == -1) goto fail; if (!(prot & PROT_WRITE)) { ret = target_mprotect(start, len, prot); assert(ret == 0); } goto the_end; } /* handle the start of the mapping */ if (start > real_start) { if (real_end == real_start + qemu_host_page_size) { /* one single host page */ ret = mmap_frag(real_start, start, end, prot, flags, fd, offset); if (ret == -1) goto fail; goto the_end1; } ret = mmap_frag(real_start, start, real_start + qemu_host_page_size, prot, flags, fd, offset); if (ret == -1) goto fail; real_start += qemu_host_page_size; } /* handle the end of the mapping */ if (end < real_end) { ret = mmap_frag(real_end - qemu_host_page_size, real_end - qemu_host_page_size, end, prot, flags, fd, offset + real_end - qemu_host_page_size - start); if (ret == -1) goto fail; real_end -= qemu_host_page_size; } /* map the middle (easier) */ if (real_start < real_end) { void *p; unsigned long offset1; if (flags & MAP_ANONYMOUS) offset1 = 0; else offset1 = offset + real_start - start; p = mmap(g2h(real_start), real_end - real_start, prot, flags, fd, offset1); if (p == MAP_FAILED) goto fail; } } the_end1: page_set_flags(start, start + len, prot | PAGE_VALID); the_end: #ifdef DEBUG_MMAP printf("ret=0x" TARGET_ABI_FMT_lx "\n", start); page_dump(stdout); printf("\n"); #endif tb_invalidate_phys_range(start, start + len); mmap_unlock(); return start; fail: mmap_unlock(); return -1; }
true
qemu
35f2fd04ce8bd3eaad4b7790abb19fa2a56d7314
abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, int flags, int fd, abi_ulong offset) { abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len; mmap_lock(); #ifdef DEBUG_MMAP { printf("mmap: start=0x" TARGET_ABI_FMT_lx " len=0x" TARGET_ABI_FMT_lx " prot=%c%c%c flags=", start, len, prot & PROT_READ ? 'r' : '-', prot & PROT_WRITE ? 'w' : '-', prot & PROT_EXEC ? 'x' : '-'); if (flags & MAP_FIXED) printf("MAP_FIXED "); if (flags & MAP_ANONYMOUS) printf("MAP_ANON "); switch(flags & MAP_TYPE) { case MAP_PRIVATE: printf("MAP_PRIVATE "); break; case MAP_SHARED: printf("MAP_SHARED "); break; default: printf("[MAP_TYPE=0x%x] ", flags & MAP_TYPE); break; } printf("fd=%d offset=" TARGET_ABI_FMT_lx "\n", fd, offset); } #endif if (offset & ~TARGET_PAGE_MASK) { errno = EINVAL; goto fail; } len = TARGET_PAGE_ALIGN(len); if (len == 0) goto the_end; real_start = start & qemu_host_page_mask; host_offset = offset & qemu_host_page_mask; if (!(flags & MAP_FIXED)) { host_len = len + offset - host_offset; host_len = HOST_PAGE_ALIGN(host_len); start = mmap_find_vma(real_start, host_len); if (start == (abi_ulong)-1) { errno = ENOMEM; goto fail; } } if ((qemu_real_host_page_size < TARGET_PAGE_SIZE) && !(flags & MAP_ANONYMOUS)) { struct stat sb; if (fstat (fd, &sb) == -1) goto fail; if (offset + len > sb.st_size) { len = REAL_HOST_PAGE_ALIGN(sb.st_size - offset); } } if (!(flags & MAP_FIXED)) { unsigned long host_start; void *p; host_len = len + offset - host_offset; host_len = HOST_PAGE_ALIGN(host_len); p = mmap(g2h(start), host_len, prot, flags | MAP_FIXED | MAP_ANONYMOUS, -1, 0); if (p == MAP_FAILED) goto fail; host_start = (unsigned long)p; if (!(flags & MAP_ANONYMOUS)) { p = mmap(g2h(start), len, prot, flags | MAP_FIXED, fd, host_offset); if (p == MAP_FAILED) { munmap(g2h(start), host_len); goto fail; } host_start += offset - host_offset; } start = h2g(host_start); } else { if (start & ~TARGET_PAGE_MASK) { errno = EINVAL; goto fail; } end = start + len; real_end = HOST_PAGE_ALIGN(end); if ((unsigned long)start + len - 1 > (abi_ulong) -1) { errno = EINVAL; goto fail; } if (!(flags & MAP_ANONYMOUS) && (offset & ~qemu_host_page_mask) != (start & ~qemu_host_page_mask)) { if ((flags & MAP_TYPE) == MAP_SHARED && (prot & PROT_WRITE)) { errno = EINVAL; goto fail; } retaddr = target_mmap(start, len, prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (retaddr == -1) goto fail; if (pread(fd, g2h(start), len, offset) == -1) goto fail; if (!(prot & PROT_WRITE)) { ret = target_mprotect(start, len, prot); assert(ret == 0); } goto the_end; } if (start > real_start) { if (real_end == real_start + qemu_host_page_size) { ret = mmap_frag(real_start, start, end, prot, flags, fd, offset); if (ret == -1) goto fail; goto the_end1; } ret = mmap_frag(real_start, start, real_start + qemu_host_page_size, prot, flags, fd, offset); if (ret == -1) goto fail; real_start += qemu_host_page_size; } if (end < real_end) { ret = mmap_frag(real_end - qemu_host_page_size, real_end - qemu_host_page_size, end, prot, flags, fd, offset + real_end - qemu_host_page_size - start); if (ret == -1) goto fail; real_end -= qemu_host_page_size; } if (real_start < real_end) { void *p; unsigned long offset1; if (flags & MAP_ANONYMOUS) offset1 = 0; else offset1 = offset + real_start - start; p = mmap(g2h(real_start), real_end - real_start, prot, flags, fd, offset1); if (p == MAP_FAILED) goto fail; } } the_end1: page_set_flags(start, start + len, prot | PAGE_VALID); the_end: #ifdef DEBUG_MMAP printf("ret=0x" TARGET_ABI_FMT_lx "\n", start); page_dump(stdout); printf("\n"); #endif tb_invalidate_phys_range(start, start + len); mmap_unlock(); return start; fail: mmap_unlock(); return -1; }
{ "code": [ " if ((qemu_real_host_page_size < TARGET_PAGE_SIZE)", " && !(flags & MAP_ANONYMOUS)) {", " struct stat sb;" ], "line_no": [ 137, 139, 141 ] }
abi_long FUNC_0(abi_ulong start, abi_ulong len, int prot, int flags, int fd, abi_ulong offset) { abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len; mmap_lock(); #ifdef DEBUG_MMAP { printf("mmap: start=0x" TARGET_ABI_FMT_lx " len=0x" TARGET_ABI_FMT_lx " prot=%c%c%c flags=", start, len, prot & PROT_READ ? 'r' : '-', prot & PROT_WRITE ? 'w' : '-', prot & PROT_EXEC ? 'x' : '-'); if (flags & MAP_FIXED) printf("MAP_FIXED "); if (flags & MAP_ANONYMOUS) printf("MAP_ANON "); switch(flags & MAP_TYPE) { case MAP_PRIVATE: printf("MAP_PRIVATE "); break; case MAP_SHARED: printf("MAP_SHARED "); break; default: printf("[MAP_TYPE=0x%x] ", flags & MAP_TYPE); break; } printf("fd=%d offset=" TARGET_ABI_FMT_lx "\n", fd, offset); } #endif if (offset & ~TARGET_PAGE_MASK) { errno = EINVAL; goto fail; } len = TARGET_PAGE_ALIGN(len); if (len == 0) goto the_end; real_start = start & qemu_host_page_mask; host_offset = offset & qemu_host_page_mask; if (!(flags & MAP_FIXED)) { host_len = len + offset - host_offset; host_len = HOST_PAGE_ALIGN(host_len); start = mmap_find_vma(real_start, host_len); if (start == (abi_ulong)-1) { errno = ENOMEM; goto fail; } } if ((qemu_real_host_page_size < TARGET_PAGE_SIZE) && !(flags & MAP_ANONYMOUS)) { struct stat VAR_0; if (fstat (fd, &VAR_0) == -1) goto fail; if (offset + len > VAR_0.st_size) { len = REAL_HOST_PAGE_ALIGN(VAR_0.st_size - offset); } } if (!(flags & MAP_FIXED)) { unsigned long VAR_1; void *VAR_3; host_len = len + offset - host_offset; host_len = HOST_PAGE_ALIGN(host_len); VAR_3 = mmap(g2h(start), host_len, prot, flags | MAP_FIXED | MAP_ANONYMOUS, -1, 0); if (VAR_3 == MAP_FAILED) goto fail; VAR_1 = (unsigned long)VAR_3; if (!(flags & MAP_ANONYMOUS)) { VAR_3 = mmap(g2h(start), len, prot, flags | MAP_FIXED, fd, host_offset); if (VAR_3 == MAP_FAILED) { munmap(g2h(start), host_len); goto fail; } VAR_1 += offset - host_offset; } start = h2g(VAR_1); } else { if (start & ~TARGET_PAGE_MASK) { errno = EINVAL; goto fail; } end = start + len; real_end = HOST_PAGE_ALIGN(end); if ((unsigned long)start + len - 1 > (abi_ulong) -1) { errno = EINVAL; goto fail; } if (!(flags & MAP_ANONYMOUS) && (offset & ~qemu_host_page_mask) != (start & ~qemu_host_page_mask)) { if ((flags & MAP_TYPE) == MAP_SHARED && (prot & PROT_WRITE)) { errno = EINVAL; goto fail; } retaddr = FUNC_0(start, len, prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (retaddr == -1) goto fail; if (pread(fd, g2h(start), len, offset) == -1) goto fail; if (!(prot & PROT_WRITE)) { ret = target_mprotect(start, len, prot); assert(ret == 0); } goto the_end; } if (start > real_start) { if (real_end == real_start + qemu_host_page_size) { ret = mmap_frag(real_start, start, end, prot, flags, fd, offset); if (ret == -1) goto fail; goto the_end1; } ret = mmap_frag(real_start, start, real_start + qemu_host_page_size, prot, flags, fd, offset); if (ret == -1) goto fail; real_start += qemu_host_page_size; } if (end < real_end) { ret = mmap_frag(real_end - qemu_host_page_size, real_end - qemu_host_page_size, end, prot, flags, fd, offset + real_end - qemu_host_page_size - start); if (ret == -1) goto fail; real_end -= qemu_host_page_size; } if (real_start < real_end) { void *VAR_3; unsigned long VAR_3; if (flags & MAP_ANONYMOUS) VAR_3 = 0; else VAR_3 = offset + real_start - start; VAR_3 = mmap(g2h(real_start), real_end - real_start, prot, flags, fd, VAR_3); if (VAR_3 == MAP_FAILED) goto fail; } } the_end1: page_set_flags(start, start + len, prot | PAGE_VALID); the_end: #ifdef DEBUG_MMAP printf("ret=0x" TARGET_ABI_FMT_lx "\n", start); page_dump(stdout); printf("\n"); #endif tb_invalidate_phys_range(start, start + len); mmap_unlock(); return start; fail: mmap_unlock(); return -1; }
[ "abi_long FUNC_0(abi_ulong start, abi_ulong len, int prot,\nint flags, int fd, abi_ulong offset)\n{", "abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len;", "mmap_lock();", "#ifdef DEBUG_MMAP\n{", "printf(\"mmap: start=0x\" TARGET_ABI_FMT_lx\n\" len=0x\" TARGET_ABI_FMT_lx \" prot=%c%c%c flags=\",\nstart, len,\nprot & PROT_READ ? 'r' : '-',\nprot & PROT_WRITE ? 'w' : '-',\nprot & PROT_EXEC ? 'x' : '-');", "if (flags & MAP_FIXED)\nprintf(\"MAP_FIXED \");", "if (flags & MAP_ANONYMOUS)\nprintf(\"MAP_ANON \");", "switch(flags & MAP_TYPE) {", "case MAP_PRIVATE:\nprintf(\"MAP_PRIVATE \");", "break;", "case MAP_SHARED:\nprintf(\"MAP_SHARED \");", "break;", "default:\nprintf(\"[MAP_TYPE=0x%x] \", flags & MAP_TYPE);", "break;", "}", "printf(\"fd=%d offset=\" TARGET_ABI_FMT_lx \"\\n\", fd, offset);", "}", "#endif\nif (offset & ~TARGET_PAGE_MASK) {", "errno = EINVAL;", "goto fail;", "}", "len = TARGET_PAGE_ALIGN(len);", "if (len == 0)\ngoto the_end;", "real_start = start & qemu_host_page_mask;", "host_offset = offset & qemu_host_page_mask;", "if (!(flags & MAP_FIXED)) {", "host_len = len + offset - host_offset;", "host_len = HOST_PAGE_ALIGN(host_len);", "start = mmap_find_vma(real_start, host_len);", "if (start == (abi_ulong)-1) {", "errno = ENOMEM;", "goto fail;", "}", "}", "if ((qemu_real_host_page_size < TARGET_PAGE_SIZE)\n&& !(flags & MAP_ANONYMOUS)) {", "struct stat VAR_0;", "if (fstat (fd, &VAR_0) == -1)\ngoto fail;", "if (offset + len > VAR_0.st_size) {", "len = REAL_HOST_PAGE_ALIGN(VAR_0.st_size - offset);", "}", "}", "if (!(flags & MAP_FIXED)) {", "unsigned long VAR_1;", "void *VAR_3;", "host_len = len + offset - host_offset;", "host_len = HOST_PAGE_ALIGN(host_len);", "VAR_3 = mmap(g2h(start), host_len, prot,\nflags | MAP_FIXED | MAP_ANONYMOUS, -1, 0);", "if (VAR_3 == MAP_FAILED)\ngoto fail;", "VAR_1 = (unsigned long)VAR_3;", "if (!(flags & MAP_ANONYMOUS)) {", "VAR_3 = mmap(g2h(start), len, prot,\nflags | MAP_FIXED, fd, host_offset);", "if (VAR_3 == MAP_FAILED) {", "munmap(g2h(start), host_len);", "goto fail;", "}", "VAR_1 += offset - host_offset;", "}", "start = h2g(VAR_1);", "} else {", "if (start & ~TARGET_PAGE_MASK) {", "errno = EINVAL;", "goto fail;", "}", "end = start + len;", "real_end = HOST_PAGE_ALIGN(end);", "if ((unsigned long)start + len - 1 > (abi_ulong) -1) {", "errno = EINVAL;", "goto fail;", "}", "if (!(flags & MAP_ANONYMOUS) &&\n(offset & ~qemu_host_page_mask) != (start & ~qemu_host_page_mask)) {", "if ((flags & MAP_TYPE) == MAP_SHARED &&\n(prot & PROT_WRITE)) {", "errno = EINVAL;", "goto fail;", "}", "retaddr = FUNC_0(start, len, prot | PROT_WRITE,\nMAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS,\n-1, 0);", "if (retaddr == -1)\ngoto fail;", "if (pread(fd, g2h(start), len, offset) == -1)\ngoto fail;", "if (!(prot & PROT_WRITE)) {", "ret = target_mprotect(start, len, prot);", "assert(ret == 0);", "}", "goto the_end;", "}", "if (start > real_start) {", "if (real_end == real_start + qemu_host_page_size) {", "ret = mmap_frag(real_start, start, end,\nprot, flags, fd, offset);", "if (ret == -1)\ngoto fail;", "goto the_end1;", "}", "ret = mmap_frag(real_start, start, real_start + qemu_host_page_size,\nprot, flags, fd, offset);", "if (ret == -1)\ngoto fail;", "real_start += qemu_host_page_size;", "}", "if (end < real_end) {", "ret = mmap_frag(real_end - qemu_host_page_size,\nreal_end - qemu_host_page_size, end,\nprot, flags, fd,\noffset + real_end - qemu_host_page_size - start);", "if (ret == -1)\ngoto fail;", "real_end -= qemu_host_page_size;", "}", "if (real_start < real_end) {", "void *VAR_3;", "unsigned long VAR_3;", "if (flags & MAP_ANONYMOUS)\nVAR_3 = 0;", "else\nVAR_3 = offset + real_start - start;", "VAR_3 = mmap(g2h(real_start), real_end - real_start,\nprot, flags, fd, VAR_3);", "if (VAR_3 == MAP_FAILED)\ngoto fail;", "}", "}", "the_end1:\npage_set_flags(start, start + len, prot | PAGE_VALID);", "the_end:\n#ifdef DEBUG_MMAP\nprintf(\"ret=0x\" TARGET_ABI_FMT_lx \"\\n\", start);", "page_dump(stdout);", "printf(\"\\n\");", "#endif\ntb_invalidate_phys_range(start, start + len);", "mmap_unlock();", "return start;", "fail:\nmmap_unlock();", "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, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 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, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 137, 139 ], [ 141 ], [ 145, 147 ], [ 153 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 189, 191 ], [ 193, 195 ], [ 199 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 261, 263 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279, 281, 283 ], [ 285, 287 ], [ 289, 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 309 ], [ 311 ], [ 315, 317 ], [ 319, 321 ], [ 323 ], [ 325 ], [ 327, 329 ], [ 331, 333 ], [ 335 ], [ 337 ], [ 341 ], [ 343, 345, 347, 349 ], [ 351, 353 ], [ 355 ], [ 357 ], [ 363 ], [ 365 ], [ 367 ], [ 369, 371 ], [ 373, 375 ], [ 377, 379 ], [ 381, 383 ], [ 385 ], [ 387 ], [ 389, 391 ], [ 393, 395, 397 ], [ 399 ], [ 401 ], [ 403, 405 ], [ 407 ], [ 409 ], [ 411, 413 ], [ 415 ], [ 417 ] ]
20,703
int kvm_arch_insert_sw_breakpoint(CPUState *cpu, struct kvm_sw_breakpoint *bp) { return -EINVAL; }
true
qemu
8a0548f94edecb96acb9b7fb9106ccc821c4996f
int kvm_arch_insert_sw_breakpoint(CPUState *cpu, struct kvm_sw_breakpoint *bp) { return -EINVAL; }
{ "code": [ "int kvm_arch_insert_sw_breakpoint(CPUState *cpu, struct kvm_sw_breakpoint *bp)", " return -EINVAL;", " return -EINVAL;" ], "line_no": [ 1, 5, 5 ] }
int FUNC_0(CPUState *VAR_0, struct kvm_sw_breakpoint *VAR_1) { return -EINVAL; }
[ "int FUNC_0(CPUState *VAR_0, struct kvm_sw_breakpoint *VAR_1)\n{", "return -EINVAL;", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
20,704
static bool remove_objects(BDRVSheepdogState *s) { int fd, i = 0, nr_objs = 0; Error *local_err = NULL; int ret = 0; bool result = true; SheepdogInode *inode = &s->inode; fd = connect_to_sdog(s, &local_err); if (fd < 0) { error_report_err(local_err); return false; } nr_objs = count_data_objs(inode); while (i < nr_objs) { int start_idx, nr_filled_idx; while (i < nr_objs && !inode->data_vdi_id[i]) { i++; } start_idx = i; nr_filled_idx = 0; while (i < nr_objs && nr_filled_idx < NR_BATCHED_DISCARD) { if (inode->data_vdi_id[i]) { inode->data_vdi_id[i] = 0; nr_filled_idx++; } i++; } ret = write_object(fd, s->bs, (char *)&inode->data_vdi_id[start_idx], vid_to_vdi_oid(s->inode.vdi_id), inode->nr_copies, (i - start_idx) * sizeof(uint32_t), offsetof(struct SheepdogInode, data_vdi_id[start_idx]), false, s->cache_flags); if (ret < 0) { error_report("failed to discard snapshot inode."); result = false; goto out; } } out: closesocket(fd); return result; }
true
qemu
e25cad6921ef78c8e2b7a4f59b03545bd675a9ad
static bool remove_objects(BDRVSheepdogState *s) { int fd, i = 0, nr_objs = 0; Error *local_err = NULL; int ret = 0; bool result = true; SheepdogInode *inode = &s->inode; fd = connect_to_sdog(s, &local_err); if (fd < 0) { error_report_err(local_err); return false; } nr_objs = count_data_objs(inode); while (i < nr_objs) { int start_idx, nr_filled_idx; while (i < nr_objs && !inode->data_vdi_id[i]) { i++; } start_idx = i; nr_filled_idx = 0; while (i < nr_objs && nr_filled_idx < NR_BATCHED_DISCARD) { if (inode->data_vdi_id[i]) { inode->data_vdi_id[i] = 0; nr_filled_idx++; } i++; } ret = write_object(fd, s->bs, (char *)&inode->data_vdi_id[start_idx], vid_to_vdi_oid(s->inode.vdi_id), inode->nr_copies, (i - start_idx) * sizeof(uint32_t), offsetof(struct SheepdogInode, data_vdi_id[start_idx]), false, s->cache_flags); if (ret < 0) { error_report("failed to discard snapshot inode."); result = false; goto out; } } out: closesocket(fd); return result; }
{ "code": [ "static bool remove_objects(BDRVSheepdogState *s)", " Error *local_err = NULL;", " int ret = 0;", " bool result = true;", " fd = connect_to_sdog(s, &local_err);", " error_report_err(local_err);", " return false;", " error_report(\"failed to discard snapshot inode.\");", " result = false;", " return result;", " Error *local_err = NULL;", " fd = connect_to_sdog(s, &local_err);", " error_report_err(local_err);" ], "line_no": [ 1, 7, 9, 11, 17, 21, 23, 83, 85, 99, 7, 17, 21 ] }
static bool FUNC_0(BDRVSheepdogState *s) { int VAR_0, VAR_1 = 0, VAR_2 = 0; Error *local_err = NULL; int VAR_3 = 0; bool result = true; SheepdogInode *inode = &s->inode; VAR_0 = connect_to_sdog(s, &local_err); if (VAR_0 < 0) { error_report_err(local_err); return false; } VAR_2 = count_data_objs(inode); while (VAR_1 < VAR_2) { int VAR_4, VAR_5; while (VAR_1 < VAR_2 && !inode->data_vdi_id[VAR_1]) { VAR_1++; } VAR_4 = VAR_1; VAR_5 = 0; while (VAR_1 < VAR_2 && VAR_5 < NR_BATCHED_DISCARD) { if (inode->data_vdi_id[VAR_1]) { inode->data_vdi_id[VAR_1] = 0; VAR_5++; } VAR_1++; } VAR_3 = write_object(VAR_0, s->bs, (char *)&inode->data_vdi_id[VAR_4], vid_to_vdi_oid(s->inode.vdi_id), inode->nr_copies, (VAR_1 - VAR_4) * sizeof(uint32_t), offsetof(struct SheepdogInode, data_vdi_id[VAR_4]), false, s->cache_flags); if (VAR_3 < 0) { error_report("failed to discard snapshot inode."); result = false; goto out; } } out: closesocket(VAR_0); return result; }
[ "static bool FUNC_0(BDRVSheepdogState *s)\n{", "int VAR_0, VAR_1 = 0, VAR_2 = 0;", "Error *local_err = NULL;", "int VAR_3 = 0;", "bool result = true;", "SheepdogInode *inode = &s->inode;", "VAR_0 = connect_to_sdog(s, &local_err);", "if (VAR_0 < 0) {", "error_report_err(local_err);", "return false;", "}", "VAR_2 = count_data_objs(inode);", "while (VAR_1 < VAR_2) {", "int VAR_4, VAR_5;", "while (VAR_1 < VAR_2 && !inode->data_vdi_id[VAR_1]) {", "VAR_1++;", "}", "VAR_4 = VAR_1;", "VAR_5 = 0;", "while (VAR_1 < VAR_2 && VAR_5 < NR_BATCHED_DISCARD) {", "if (inode->data_vdi_id[VAR_1]) {", "inode->data_vdi_id[VAR_1] = 0;", "VAR_5++;", "}", "VAR_1++;", "}", "VAR_3 = write_object(VAR_0, s->bs,\n(char *)&inode->data_vdi_id[VAR_4],\nvid_to_vdi_oid(s->inode.vdi_id), inode->nr_copies,\n(VAR_1 - VAR_4) * sizeof(uint32_t),\noffsetof(struct SheepdogInode,\ndata_vdi_id[VAR_4]),\nfalse, s->cache_flags);", "if (VAR_3 < 0) {", "error_report(\"failed to discard snapshot inode.\");", "result = false;", "goto out;", "}", "}", "out:\nclosesocket(VAR_0);", "return result;", "}" ]
[ 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67, 69, 71, 73, 75, 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95, 97 ], [ 99 ], [ 101 ] ]
20,705
static int vfio_populate_device(VFIODevice *vbasedev) { VFIOINTp *intp, *tmp; int i, ret = -1; VFIOPlatformDevice *vdev = container_of(vbasedev, VFIOPlatformDevice, vbasedev); if (!(vbasedev->flags & VFIO_DEVICE_FLAGS_PLATFORM)) { error_report("vfio: Um, this isn't a platform device"); return ret; } vdev->regions = g_new0(VFIORegion *, vbasedev->num_regions); for (i = 0; i < vbasedev->num_regions; i++) { struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) }; VFIORegion *ptr; vdev->regions[i] = g_malloc0(sizeof(VFIORegion)); ptr = vdev->regions[i]; reg_info.index = i; ret = ioctl(vbasedev->fd, VFIO_DEVICE_GET_REGION_INFO, &reg_info); if (ret) { error_report("vfio: Error getting region %d info: %m", i); goto reg_error; } ptr->flags = reg_info.flags; ptr->size = reg_info.size; ptr->fd_offset = reg_info.offset; ptr->nr = i; ptr->vbasedev = vbasedev; trace_vfio_platform_populate_regions(ptr->nr, (unsigned long)ptr->flags, (unsigned long)ptr->size, ptr->vbasedev->fd, (unsigned long)ptr->fd_offset); } vdev->mmap_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, vfio_intp_mmap_enable, vdev); QSIMPLEQ_INIT(&vdev->pending_intp_queue); for (i = 0; i < vbasedev->num_irqs; i++) { struct vfio_irq_info irq = { .argsz = sizeof(irq) }; irq.index = i; ret = ioctl(vbasedev->fd, VFIO_DEVICE_GET_IRQ_INFO, &irq); if (ret) { error_printf("vfio: error getting device %s irq info", vbasedev->name); goto irq_err; } else { trace_vfio_platform_populate_interrupts(irq.index, irq.count, irq.flags); intp = vfio_init_intp(vbasedev, irq); if (!intp) { error_report("vfio: Error installing IRQ %d up", i); goto irq_err; } } } return 0; irq_err: timer_del(vdev->mmap_timer); QLIST_FOREACH_SAFE(intp, &vdev->intp_list, next, tmp) { QLIST_REMOVE(intp, next); g_free(intp); } reg_error: for (i = 0; i < vbasedev->num_regions; i++) { g_free(vdev->regions[i]); } g_free(vdev->regions); return ret; }
true
qemu
bdd81addf4033ce26e6cd180b060f63095f3ded9
static int vfio_populate_device(VFIODevice *vbasedev) { VFIOINTp *intp, *tmp; int i, ret = -1; VFIOPlatformDevice *vdev = container_of(vbasedev, VFIOPlatformDevice, vbasedev); if (!(vbasedev->flags & VFIO_DEVICE_FLAGS_PLATFORM)) { error_report("vfio: Um, this isn't a platform device"); return ret; } vdev->regions = g_new0(VFIORegion *, vbasedev->num_regions); for (i = 0; i < vbasedev->num_regions; i++) { struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) }; VFIORegion *ptr; vdev->regions[i] = g_malloc0(sizeof(VFIORegion)); ptr = vdev->regions[i]; reg_info.index = i; ret = ioctl(vbasedev->fd, VFIO_DEVICE_GET_REGION_INFO, &reg_info); if (ret) { error_report("vfio: Error getting region %d info: %m", i); goto reg_error; } ptr->flags = reg_info.flags; ptr->size = reg_info.size; ptr->fd_offset = reg_info.offset; ptr->nr = i; ptr->vbasedev = vbasedev; trace_vfio_platform_populate_regions(ptr->nr, (unsigned long)ptr->flags, (unsigned long)ptr->size, ptr->vbasedev->fd, (unsigned long)ptr->fd_offset); } vdev->mmap_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, vfio_intp_mmap_enable, vdev); QSIMPLEQ_INIT(&vdev->pending_intp_queue); for (i = 0; i < vbasedev->num_irqs; i++) { struct vfio_irq_info irq = { .argsz = sizeof(irq) }; irq.index = i; ret = ioctl(vbasedev->fd, VFIO_DEVICE_GET_IRQ_INFO, &irq); if (ret) { error_printf("vfio: error getting device %s irq info", vbasedev->name); goto irq_err; } else { trace_vfio_platform_populate_interrupts(irq.index, irq.count, irq.flags); intp = vfio_init_intp(vbasedev, irq); if (!intp) { error_report("vfio: Error installing IRQ %d up", i); goto irq_err; } } } return 0; irq_err: timer_del(vdev->mmap_timer); QLIST_FOREACH_SAFE(intp, &vdev->intp_list, next, tmp) { QLIST_REMOVE(intp, next); g_free(intp); } reg_error: for (i = 0; i < vbasedev->num_regions; i++) { g_free(vdev->regions[i]); } g_free(vdev->regions); return ret; }
{ "code": [ " vdev->regions[i] = g_malloc0(sizeof(VFIORegion));" ], "line_no": [ 37 ] }
static int FUNC_0(VFIODevice *VAR_0) { VFIOINTp *intp, *tmp; int VAR_1, VAR_2 = -1; VFIOPlatformDevice *vdev = container_of(VAR_0, VFIOPlatformDevice, VAR_0); if (!(VAR_0->flags & VFIO_DEVICE_FLAGS_PLATFORM)) { error_report("vfio: Um, this isn't a platform device"); return VAR_2; } vdev->regions = g_new0(VFIORegion *, VAR_0->num_regions); for (VAR_1 = 0; VAR_1 < VAR_0->num_regions; VAR_1++) { struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) }; VFIORegion *ptr; vdev->regions[VAR_1] = g_malloc0(sizeof(VFIORegion)); ptr = vdev->regions[VAR_1]; reg_info.index = VAR_1; VAR_2 = ioctl(VAR_0->fd, VFIO_DEVICE_GET_REGION_INFO, &reg_info); if (VAR_2) { error_report("vfio: Error getting region %d info: %m", VAR_1); goto reg_error; } ptr->flags = reg_info.flags; ptr->size = reg_info.size; ptr->fd_offset = reg_info.offset; ptr->nr = VAR_1; ptr->VAR_0 = VAR_0; trace_vfio_platform_populate_regions(ptr->nr, (unsigned long)ptr->flags, (unsigned long)ptr->size, ptr->VAR_0->fd, (unsigned long)ptr->fd_offset); } vdev->mmap_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, vfio_intp_mmap_enable, vdev); QSIMPLEQ_INIT(&vdev->pending_intp_queue); for (VAR_1 = 0; VAR_1 < VAR_0->num_irqs; VAR_1++) { struct vfio_irq_info irq = { .argsz = sizeof(irq) }; irq.index = VAR_1; VAR_2 = ioctl(VAR_0->fd, VFIO_DEVICE_GET_IRQ_INFO, &irq); if (VAR_2) { error_printf("vfio: error getting device %s irq info", VAR_0->name); goto irq_err; } else { trace_vfio_platform_populate_interrupts(irq.index, irq.count, irq.flags); intp = vfio_init_intp(VAR_0, irq); if (!intp) { error_report("vfio: Error installing IRQ %d up", VAR_1); goto irq_err; } } } return 0; irq_err: timer_del(vdev->mmap_timer); QLIST_FOREACH_SAFE(intp, &vdev->intp_list, next, tmp) { QLIST_REMOVE(intp, next); g_free(intp); } reg_error: for (VAR_1 = 0; VAR_1 < VAR_0->num_regions; VAR_1++) { g_free(vdev->regions[VAR_1]); } g_free(vdev->regions); return VAR_2; }
[ "static int FUNC_0(VFIODevice *VAR_0)\n{", "VFIOINTp *intp, *tmp;", "int VAR_1, VAR_2 = -1;", "VFIOPlatformDevice *vdev =\ncontainer_of(VAR_0, VFIOPlatformDevice, VAR_0);", "if (!(VAR_0->flags & VFIO_DEVICE_FLAGS_PLATFORM)) {", "error_report(\"vfio: Um, this isn't a platform device\");", "return VAR_2;", "}", "vdev->regions = g_new0(VFIORegion *, VAR_0->num_regions);", "for (VAR_1 = 0; VAR_1 < VAR_0->num_regions; VAR_1++) {", "struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) };", "VFIORegion *ptr;", "vdev->regions[VAR_1] = g_malloc0(sizeof(VFIORegion));", "ptr = vdev->regions[VAR_1];", "reg_info.index = VAR_1;", "VAR_2 = ioctl(VAR_0->fd, VFIO_DEVICE_GET_REGION_INFO, &reg_info);", "if (VAR_2) {", "error_report(\"vfio: Error getting region %d info: %m\", VAR_1);", "goto reg_error;", "}", "ptr->flags = reg_info.flags;", "ptr->size = reg_info.size;", "ptr->fd_offset = reg_info.offset;", "ptr->nr = VAR_1;", "ptr->VAR_0 = VAR_0;", "trace_vfio_platform_populate_regions(ptr->nr,\n(unsigned long)ptr->flags,\n(unsigned long)ptr->size,\nptr->VAR_0->fd,\n(unsigned long)ptr->fd_offset);", "}", "vdev->mmap_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL,\nvfio_intp_mmap_enable, vdev);", "QSIMPLEQ_INIT(&vdev->pending_intp_queue);", "for (VAR_1 = 0; VAR_1 < VAR_0->num_irqs; VAR_1++) {", "struct vfio_irq_info irq = { .argsz = sizeof(irq) };", "irq.index = VAR_1;", "VAR_2 = ioctl(VAR_0->fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);", "if (VAR_2) {", "error_printf(\"vfio: error getting device %s irq info\",\nVAR_0->name);", "goto irq_err;", "} else {", "trace_vfio_platform_populate_interrupts(irq.index,\nirq.count,\nirq.flags);", "intp = vfio_init_intp(VAR_0, irq);", "if (!intp) {", "error_report(\"vfio: Error installing IRQ %d up\", VAR_1);", "goto irq_err;", "}", "}", "}", "return 0;", "irq_err:\ntimer_del(vdev->mmap_timer);", "QLIST_FOREACH_SAFE(intp, &vdev->intp_list, next, tmp) {", "QLIST_REMOVE(intp, next);", "g_free(intp);", "}", "reg_error:\nfor (VAR_1 = 0; VAR_1 < VAR_0->num_regions; VAR_1++) {", "g_free(vdev->regions[VAR_1]);", "}", "g_free(vdev->regions);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67, 69, 71, 73 ], [ 75 ], [ 79, 81 ], [ 85 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109, 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ] ]
20,706
static int execute_decode_slices(H264Context *h, int context_count) { MpegEncContext *const s = &h->s; AVCodecContext *const avctx = s->avctx; H264Context *hx; int i; if (s->avctx->hwaccel || s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) return 0; if (context_count == 1) { return decode_slice(avctx, &h); } else { for (i = 1; i < context_count; i++) { hx = h->thread_context[i]; hx->s.err_recognition = avctx->err_recognition; hx->s.error_count = 0; hx->x264_build = h->x264_build; } avctx->execute(avctx, decode_slice, h->thread_context, NULL, context_count, sizeof(void *)); /* pull back stuff from slices to master context */ hx = h->thread_context[context_count - 1]; s->mb_x = hx->s.mb_x; s->mb_y = hx->s.mb_y; s->droppable = hx->s.droppable; s->picture_structure = hx->s.picture_structure; for (i = 1; i < context_count; i++) h->s.error_count += h->thread_context[i]->s.error_count; } return 0; }
true
FFmpeg
cdc48860a8cbb0080acc0732b2e1c689cea03777
static int execute_decode_slices(H264Context *h, int context_count) { MpegEncContext *const s = &h->s; AVCodecContext *const avctx = s->avctx; H264Context *hx; int i; if (s->avctx->hwaccel || s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) return 0; if (context_count == 1) { return decode_slice(avctx, &h); } else { for (i = 1; i < context_count; i++) { hx = h->thread_context[i]; hx->s.err_recognition = avctx->err_recognition; hx->s.error_count = 0; hx->x264_build = h->x264_build; } avctx->execute(avctx, decode_slice, h->thread_context, NULL, context_count, sizeof(void *)); hx = h->thread_context[context_count - 1]; s->mb_x = hx->s.mb_x; s->mb_y = hx->s.mb_y; s->droppable = hx->s.droppable; s->picture_structure = hx->s.picture_structure; for (i = 1; i < context_count; i++) h->s.error_count += h->thread_context[i]->s.error_count; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(H264Context *VAR_0, int VAR_1) { MpegEncContext *const s = &VAR_0->s; AVCodecContext *const avctx = s->avctx; H264Context *hx; int VAR_2; if (s->avctx->hwaccel || s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) return 0; if (VAR_1 == 1) { return decode_slice(avctx, &VAR_0); } else { for (VAR_2 = 1; VAR_2 < VAR_1; VAR_2++) { hx = VAR_0->thread_context[VAR_2]; hx->s.err_recognition = avctx->err_recognition; hx->s.error_count = 0; hx->x264_build = VAR_0->x264_build; } avctx->execute(avctx, decode_slice, VAR_0->thread_context, NULL, VAR_1, sizeof(void *)); hx = VAR_0->thread_context[VAR_1 - 1]; s->mb_x = hx->s.mb_x; s->mb_y = hx->s.mb_y; s->droppable = hx->s.droppable; s->picture_structure = hx->s.picture_structure; for (VAR_2 = 1; VAR_2 < VAR_1; VAR_2++) VAR_0->s.error_count += VAR_0->thread_context[VAR_2]->s.error_count; } return 0; }
[ "static int FUNC_0(H264Context *VAR_0, int VAR_1)\n{", "MpegEncContext *const s = &VAR_0->s;", "AVCodecContext *const avctx = s->avctx;", "H264Context *hx;", "int VAR_2;", "if (s->avctx->hwaccel ||\ns->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)\nreturn 0;", "if (VAR_1 == 1) {", "return decode_slice(avctx, &VAR_0);", "} else {", "for (VAR_2 = 1; VAR_2 < VAR_1; VAR_2++) {", "hx = VAR_0->thread_context[VAR_2];", "hx->s.err_recognition = avctx->err_recognition;", "hx->s.error_count = 0;", "hx->x264_build = VAR_0->x264_build;", "}", "avctx->execute(avctx, decode_slice, VAR_0->thread_context,\nNULL, VAR_1, sizeof(void *));", "hx = VAR_0->thread_context[VAR_1 - 1];", "s->mb_x = hx->s.mb_x;", "s->mb_y = hx->s.mb_y;", "s->droppable = hx->s.droppable;", "s->picture_structure = hx->s.picture_structure;", "for (VAR_2 = 1; VAR_2 < VAR_1; VAR_2++)", "VAR_0->s.error_count += VAR_0->thread_context[VAR_2]->s.error_count;", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 28 ], [ 30 ], [ 32 ], [ 34 ], [ 36 ], [ 38 ], [ 42, 44 ], [ 50 ], [ 52 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 62 ], [ 64 ], [ 68 ], [ 70 ] ]
20,707
void pcmcia_socket_register(PCMCIASocket *socket) { struct pcmcia_socket_entry_s *entry; entry = g_malloc(sizeof(struct pcmcia_socket_entry_s)); entry->socket = socket; entry->next = pcmcia_sockets; pcmcia_sockets = entry; }
true
qemu
7797a73947d5c0e63dd5552b348cf66c384b4555
void pcmcia_socket_register(PCMCIASocket *socket) { struct pcmcia_socket_entry_s *entry; entry = g_malloc(sizeof(struct pcmcia_socket_entry_s)); entry->socket = socket; entry->next = pcmcia_sockets; pcmcia_sockets = entry; }
{ "code": [ "void pcmcia_socket_register(PCMCIASocket *socket)", " struct pcmcia_socket_entry_s *entry;", " entry = g_malloc(sizeof(struct pcmcia_socket_entry_s));", " entry->socket = socket;", " entry->next = pcmcia_sockets;", " pcmcia_sockets = entry;" ], "line_no": [ 1, 5, 9, 11, 13, 15 ] }
void FUNC_0(PCMCIASocket *VAR_0) { struct pcmcia_socket_entry_s *VAR_1; VAR_1 = g_malloc(sizeof(struct pcmcia_socket_entry_s)); VAR_1->VAR_0 = VAR_0; VAR_1->next = pcmcia_sockets; pcmcia_sockets = VAR_1; }
[ "void FUNC_0(PCMCIASocket *VAR_0)\n{", "struct pcmcia_socket_entry_s *VAR_1;", "VAR_1 = g_malloc(sizeof(struct pcmcia_socket_entry_s));", "VAR_1->VAR_0 = VAR_0;", "VAR_1->next = pcmcia_sockets;", "pcmcia_sockets = VAR_1;", "}" ]
[ 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
20,708
static void encode_subband(SnowContext *s, SubBand *b, DWTELEM *src, DWTELEM *parent, int stride, int orientation){ // encode_subband_qtree(s, b, src, parent, stride, orientation); // encode_subband_z0run(s, b, src, parent, stride, orientation); encode_subband_c0run(s, b, src, parent, stride, orientation); // encode_subband_dzr(s, b, src, parent, stride, orientation); }
true
FFmpeg
0ecca7a49f8e254c12a3a1de048d738bfbb614c6
static void encode_subband(SnowContext *s, SubBand *b, DWTELEM *src, DWTELEM *parent, int stride, int orientation){ encode_subband_c0run(s, b, src, parent, stride, orientation); }
{ "code": [ "static void encode_subband(SnowContext *s, SubBand *b, DWTELEM *src, DWTELEM *parent, int stride, int orientation){ ", " encode_subband_c0run(s, b, src, parent, stride, orientation);" ], "line_no": [ 1, 7 ] }
static void FUNC_0(SnowContext *VAR_0, SubBand *VAR_1, DWTELEM *VAR_2, DWTELEM *VAR_3, int VAR_4, int VAR_5){ encode_subband_c0run(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); }
[ "static void FUNC_0(SnowContext *VAR_0, SubBand *VAR_1, DWTELEM *VAR_2, DWTELEM *VAR_3, int VAR_4, int VAR_5){", "encode_subband_c0run(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5);", "}" ]
[ 1, 1, 0 ]
[ [ 1 ], [ 7 ], [ 11 ] ]
20,709
static void handle_s_without_atn(ESPState *s) { uint8_t buf[32]; int len; if (s->dma && !s->dma_enabled) { s->dma_cb = handle_s_without_atn; return; } len = get_cmd(s, buf); if (len) { do_busid_cmd(s, buf, 0); } }
true
qemu
6c1fef6b59563cc415f21e03f81539ed4b33ad90
static void handle_s_without_atn(ESPState *s) { uint8_t buf[32]; int len; if (s->dma && !s->dma_enabled) { s->dma_cb = handle_s_without_atn; return; } len = get_cmd(s, buf); if (len) { do_busid_cmd(s, buf, 0); } }
{ "code": [ " len = get_cmd(s, buf);", " len = get_cmd(s, buf);" ], "line_no": [ 19, 19 ] }
static void FUNC_0(ESPState *VAR_0) { uint8_t buf[32]; int VAR_1; if (VAR_0->dma && !VAR_0->dma_enabled) { VAR_0->dma_cb = FUNC_0; return; } VAR_1 = get_cmd(VAR_0, buf); if (VAR_1) { do_busid_cmd(VAR_0, buf, 0); } }
[ "static void FUNC_0(ESPState *VAR_0)\n{", "uint8_t buf[32];", "int VAR_1;", "if (VAR_0->dma && !VAR_0->dma_enabled) {", "VAR_0->dma_cb = FUNC_0;", "return;", "}", "VAR_1 = get_cmd(VAR_0, buf);", "if (VAR_1) {", "do_busid_cmd(VAR_0, buf, 0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
20,710
static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *dev, uint32_t node, Error **errp) { Error *local_err = NULL; sPAPRMachineState *ms = SPAPR_MACHINE(hotplug_dev); PCDIMMDevice *dimm = PC_DIMM(dev); PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); MemoryRegion *mr = ddc->get_memory_region(dimm); uint64_t align = memory_region_get_alignment(mr); uint64_t size = memory_region_size(mr); uint64_t addr; if (size % SPAPR_MEMORY_BLOCK_SIZE) { error_setg(&local_err, "Hotplugged memory size must be a multiple of " "%lld MB", SPAPR_MEMORY_BLOCK_SIZE/M_BYTE); goto out; } pc_dimm_memory_plug(dev, &ms->hotplug_memory, mr, align, &local_err); if (local_err) { goto out; } addr = object_property_get_int(OBJECT(dimm), PC_DIMM_ADDR_PROP, &local_err); if (local_err) { pc_dimm_memory_unplug(dev, &ms->hotplug_memory, mr); goto out; } spapr_add_lmbs(dev, addr, size, node, &error_abort); out: error_propagate(errp, local_err); }
true
qemu
79b78a6bd47722ce23bc74287cd6322756698f09
static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *dev, uint32_t node, Error **errp) { Error *local_err = NULL; sPAPRMachineState *ms = SPAPR_MACHINE(hotplug_dev); PCDIMMDevice *dimm = PC_DIMM(dev); PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); MemoryRegion *mr = ddc->get_memory_region(dimm); uint64_t align = memory_region_get_alignment(mr); uint64_t size = memory_region_size(mr); uint64_t addr; if (size % SPAPR_MEMORY_BLOCK_SIZE) { error_setg(&local_err, "Hotplugged memory size must be a multiple of " "%lld MB", SPAPR_MEMORY_BLOCK_SIZE/M_BYTE); goto out; } pc_dimm_memory_plug(dev, &ms->hotplug_memory, mr, align, &local_err); if (local_err) { goto out; } addr = object_property_get_int(OBJECT(dimm), PC_DIMM_ADDR_PROP, &local_err); if (local_err) { pc_dimm_memory_unplug(dev, &ms->hotplug_memory, mr); goto out; } spapr_add_lmbs(dev, addr, size, node, &error_abort); out: error_propagate(errp, local_err); }
{ "code": [ " spapr_add_lmbs(dev, addr, size, node, &error_abort);" ], "line_no": [ 59 ] }
static void FUNC_0(HotplugHandler *VAR_0, DeviceState *VAR_1, uint32_t VAR_2, Error **VAR_3) { Error *local_err = NULL; sPAPRMachineState *ms = SPAPR_MACHINE(VAR_0); PCDIMMDevice *dimm = PC_DIMM(VAR_1); PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); MemoryRegion *mr = ddc->get_memory_region(dimm); uint64_t align = memory_region_get_alignment(mr); uint64_t size = memory_region_size(mr); uint64_t addr; if (size % SPAPR_MEMORY_BLOCK_SIZE) { error_setg(&local_err, "Hotplugged memory size must be a multiple of " "%lld MB", SPAPR_MEMORY_BLOCK_SIZE/M_BYTE); goto out; } pc_dimm_memory_plug(VAR_1, &ms->hotplug_memory, mr, align, &local_err); if (local_err) { goto out; } addr = object_property_get_int(OBJECT(dimm), PC_DIMM_ADDR_PROP, &local_err); if (local_err) { pc_dimm_memory_unplug(VAR_1, &ms->hotplug_memory, mr); goto out; } spapr_add_lmbs(VAR_1, addr, size, VAR_2, &error_abort); out: error_propagate(VAR_3, local_err); }
[ "static void FUNC_0(HotplugHandler *VAR_0, DeviceState *VAR_1,\nuint32_t VAR_2, Error **VAR_3)\n{", "Error *local_err = NULL;", "sPAPRMachineState *ms = SPAPR_MACHINE(VAR_0);", "PCDIMMDevice *dimm = PC_DIMM(VAR_1);", "PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);", "MemoryRegion *mr = ddc->get_memory_region(dimm);", "uint64_t align = memory_region_get_alignment(mr);", "uint64_t size = memory_region_size(mr);", "uint64_t addr;", "if (size % SPAPR_MEMORY_BLOCK_SIZE) {", "error_setg(&local_err, \"Hotplugged memory size must be a multiple of \"\n\"%lld MB\", SPAPR_MEMORY_BLOCK_SIZE/M_BYTE);", "goto out;", "}", "pc_dimm_memory_plug(VAR_1, &ms->hotplug_memory, mr, align, &local_err);", "if (local_err) {", "goto out;", "}", "addr = object_property_get_int(OBJECT(dimm), PC_DIMM_ADDR_PROP, &local_err);", "if (local_err) {", "pc_dimm_memory_unplug(VAR_1, &ms->hotplug_memory, mr);", "goto out;", "}", "spapr_add_lmbs(VAR_1, addr, size, VAR_2, &error_abort);", "out:\nerror_propagate(VAR_3, local_err);", "}" ]
[ 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, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63, 65 ], [ 67 ] ]
20,711
static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet) { A64Context *c = avctx->priv_data; AVFrame *const p = (AVFrame *) & c->picture; int frame; int x, y; int b_height; int b_width; int req_size, ret; uint8_t *buf; int *charmap = c->mc_charmap; uint8_t *colram = c->mc_colram; uint8_t *charset = c->mc_charset; int *meta = c->mc_meta_charset; int *best_cb = c->mc_best_cb; int charset_size = 0x800 * (INTERLACED + 1); int colram_size = 0x100 * c->mc_use_5col; int screen_size; if(CROP_SCREENS) { b_height = FFMIN(avctx->height,C64YRES) >> 3; b_width = FFMIN(avctx->width ,C64XRES) >> 3; screen_size = b_width * b_height; } else { b_height = C64YRES >> 3; b_width = C64XRES >> 3; screen_size = 0x400; } /* no data, means end encoding asap */ if (!pict) { /* all done, end encoding */ if (!c->mc_lifetime) return 0; /* no more frames in queue, prepare to flush remaining frames */ if (!c->mc_frame_counter) { c->mc_lifetime = 0; } /* still frames in queue so limit lifetime to remaining frames */ else c->mc_lifetime = c->mc_frame_counter; /* still new data available */ } else { /* fill up mc_meta_charset with data until lifetime exceeds */ if (c->mc_frame_counter < c->mc_lifetime) { *p = *pict; p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; to_meta_with_crop(avctx, p, meta + 32000 * c->mc_frame_counter); c->mc_frame_counter++; if (c->next_pts == AV_NOPTS_VALUE) c->next_pts = pict->pts; /* lifetime is not reached so wait for next frame first */ return 0; } } /* lifetime reached so now convert X frames at once */ if (c->mc_frame_counter == c->mc_lifetime) { req_size = 0; /* any frames to encode? */ if (c->mc_lifetime) { req_size = charset_size + c->mc_lifetime*(screen_size + colram_size); if ((ret = ff_alloc_packet(pkt, req_size)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet of size %d.\n", req_size); return ret; } buf = pkt->data; /* calc optimal new charset + charmaps */ ff_init_elbg(meta, 32, 1000 * c->mc_lifetime, best_cb, CHARSET_CHARS, 50, charmap, &c->randctx); ff_do_elbg (meta, 32, 1000 * c->mc_lifetime, best_cb, CHARSET_CHARS, 50, charmap, &c->randctx); /* create colorram map and a c64 readable charset */ render_charset(avctx, charset, colram); /* copy charset to buf */ memcpy(buf, charset, charset_size); /* advance pointers */ buf += charset_size; charset += charset_size; } /* write x frames to buf */ for (frame = 0; frame < c->mc_lifetime; frame++) { /* copy charmap to buf. buf is uchar*, charmap is int*, so no memcpy here, sorry */ for (y = 0; y < b_height; y++) { for (x = 0; x < b_width; x++) { buf[y * b_width + x] = charmap[y * b_width + x]; } } /* advance pointers */ buf += screen_size; req_size += screen_size; /* compress and copy colram to buf */ if (c->mc_use_5col) { a64_compress_colram(buf, charmap, colram); /* advance pointers */ buf += colram_size; req_size += colram_size; } /* advance to next charmap */ charmap += 1000; } AV_WB32(avctx->extradata + 4, c->mc_frame_counter); AV_WB32(avctx->extradata + 8, charset_size); AV_WB32(avctx->extradata + 12, screen_size + colram_size); /* reset counter */ c->mc_frame_counter = 0; pkt->pts = pkt->dts = c->next_pts; c->next_pts = AV_NOPTS_VALUE; pkt->size = req_size; pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = !!req_size; } return 0; }
true
FFmpeg
3d3b603f7f834dad919a3334506a1e5414d7368a
static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet) { A64Context *c = avctx->priv_data; AVFrame *const p = (AVFrame *) & c->picture; int frame; int x, y; int b_height; int b_width; int req_size, ret; uint8_t *buf; int *charmap = c->mc_charmap; uint8_t *colram = c->mc_colram; uint8_t *charset = c->mc_charset; int *meta = c->mc_meta_charset; int *best_cb = c->mc_best_cb; int charset_size = 0x800 * (INTERLACED + 1); int colram_size = 0x100 * c->mc_use_5col; int screen_size; if(CROP_SCREENS) { b_height = FFMIN(avctx->height,C64YRES) >> 3; b_width = FFMIN(avctx->width ,C64XRES) >> 3; screen_size = b_width * b_height; } else { b_height = C64YRES >> 3; b_width = C64XRES >> 3; screen_size = 0x400; } if (!pict) { if (!c->mc_lifetime) return 0; if (!c->mc_frame_counter) { c->mc_lifetime = 0; } else c->mc_lifetime = c->mc_frame_counter; } else { if (c->mc_frame_counter < c->mc_lifetime) { *p = *pict; p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; to_meta_with_crop(avctx, p, meta + 32000 * c->mc_frame_counter); c->mc_frame_counter++; if (c->next_pts == AV_NOPTS_VALUE) c->next_pts = pict->pts; return 0; } } if (c->mc_frame_counter == c->mc_lifetime) { req_size = 0; if (c->mc_lifetime) { req_size = charset_size + c->mc_lifetime*(screen_size + colram_size); if ((ret = ff_alloc_packet(pkt, req_size)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet of size %d.\n", req_size); return ret; } buf = pkt->data; ff_init_elbg(meta, 32, 1000 * c->mc_lifetime, best_cb, CHARSET_CHARS, 50, charmap, &c->randctx); ff_do_elbg (meta, 32, 1000 * c->mc_lifetime, best_cb, CHARSET_CHARS, 50, charmap, &c->randctx); render_charset(avctx, charset, colram); memcpy(buf, charset, charset_size); buf += charset_size; charset += charset_size; } for (frame = 0; frame < c->mc_lifetime; frame++) { for (y = 0; y < b_height; y++) { for (x = 0; x < b_width; x++) { buf[y * b_width + x] = charmap[y * b_width + x]; } } buf += screen_size; req_size += screen_size; if (c->mc_use_5col) { a64_compress_colram(buf, charmap, colram); buf += colram_size; req_size += colram_size; } charmap += 1000; } AV_WB32(avctx->extradata + 4, c->mc_frame_counter); AV_WB32(avctx->extradata + 8, charset_size); AV_WB32(avctx->extradata + 12, screen_size + colram_size); c->mc_frame_counter = 0; pkt->pts = pkt->dts = c->next_pts; c->next_pts = AV_NOPTS_VALUE; pkt->size = req_size; pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = !!req_size; } return 0; }
{ "code": [ " uint8_t *buf;" ], "line_no": [ 25 ] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { A64Context *c = VAR_0->priv_data; AVFrame *const p = (AVFrame *) & c->picture; int VAR_4; int VAR_5, VAR_6; int VAR_7; int VAR_8; int VAR_9, VAR_10; uint8_t *buf; int *VAR_11 = c->mc_charmap; uint8_t *colram = c->mc_colram; uint8_t *charset = c->mc_charset; int *VAR_12 = c->mc_meta_charset; int *VAR_13 = c->mc_best_cb; int VAR_14 = 0x800 * (INTERLACED + 1); int VAR_15 = 0x100 * c->mc_use_5col; int VAR_16; if(CROP_SCREENS) { VAR_7 = FFMIN(VAR_0->height,C64YRES) >> 3; VAR_8 = FFMIN(VAR_0->width ,C64XRES) >> 3; VAR_16 = VAR_8 * VAR_7; } else { VAR_7 = C64YRES >> 3; VAR_8 = C64XRES >> 3; VAR_16 = 0x400; } if (!VAR_2) { if (!c->mc_lifetime) return 0; if (!c->mc_frame_counter) { c->mc_lifetime = 0; } else c->mc_lifetime = c->mc_frame_counter; } else { if (c->mc_frame_counter < c->mc_lifetime) { *p = *VAR_2; p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; to_meta_with_crop(VAR_0, p, VAR_12 + 32000 * c->mc_frame_counter); c->mc_frame_counter++; if (c->next_pts == AV_NOPTS_VALUE) c->next_pts = VAR_2->pts; return 0; } } if (c->mc_frame_counter == c->mc_lifetime) { VAR_9 = 0; if (c->mc_lifetime) { VAR_9 = VAR_14 + c->mc_lifetime*(VAR_16 + VAR_15); if ((VAR_10 = ff_alloc_packet(VAR_1, VAR_9)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Error getting output packet of size %d.\n", VAR_9); return VAR_10; } buf = VAR_1->data; ff_init_elbg(VAR_12, 32, 1000 * c->mc_lifetime, VAR_13, CHARSET_CHARS, 50, VAR_11, &c->randctx); ff_do_elbg (VAR_12, 32, 1000 * c->mc_lifetime, VAR_13, CHARSET_CHARS, 50, VAR_11, &c->randctx); render_charset(VAR_0, charset, colram); memcpy(buf, charset, VAR_14); buf += VAR_14; charset += VAR_14; } for (VAR_4 = 0; VAR_4 < c->mc_lifetime; VAR_4++) { for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++) { for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++) { buf[VAR_6 * VAR_8 + VAR_5] = VAR_11[VAR_6 * VAR_8 + VAR_5]; } } buf += VAR_16; VAR_9 += VAR_16; if (c->mc_use_5col) { a64_compress_colram(buf, VAR_11, colram); buf += VAR_15; VAR_9 += VAR_15; } VAR_11 += 1000; } AV_WB32(VAR_0->extradata + 4, c->mc_frame_counter); AV_WB32(VAR_0->extradata + 8, VAR_14); AV_WB32(VAR_0->extradata + 12, VAR_16 + VAR_15); c->mc_frame_counter = 0; VAR_1->pts = VAR_1->dts = c->next_pts; c->next_pts = AV_NOPTS_VALUE; VAR_1->size = VAR_9; VAR_1->flags |= AV_PKT_FLAG_KEY; *VAR_3 = !!VAR_9; } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "A64Context *c = VAR_0->priv_data;", "AVFrame *const p = (AVFrame *) & c->picture;", "int VAR_4;", "int VAR_5, VAR_6;", "int VAR_7;", "int VAR_8;", "int VAR_9, VAR_10;", "uint8_t *buf;", "int *VAR_11 = c->mc_charmap;", "uint8_t *colram = c->mc_colram;", "uint8_t *charset = c->mc_charset;", "int *VAR_12 = c->mc_meta_charset;", "int *VAR_13 = c->mc_best_cb;", "int VAR_14 = 0x800 * (INTERLACED + 1);", "int VAR_15 = 0x100 * c->mc_use_5col;", "int VAR_16;", "if(CROP_SCREENS) {", "VAR_7 = FFMIN(VAR_0->height,C64YRES) >> 3;", "VAR_8 = FFMIN(VAR_0->width ,C64XRES) >> 3;", "VAR_16 = VAR_8 * VAR_7;", "} else {", "VAR_7 = C64YRES >> 3;", "VAR_8 = C64XRES >> 3;", "VAR_16 = 0x400;", "}", "if (!VAR_2) {", "if (!c->mc_lifetime) return 0;", "if (!c->mc_frame_counter) {", "c->mc_lifetime = 0;", "}", "else c->mc_lifetime = c->mc_frame_counter;", "} else {", "if (c->mc_frame_counter < c->mc_lifetime) {", "*p = *VAR_2;", "p->pict_type = AV_PICTURE_TYPE_I;", "p->key_frame = 1;", "to_meta_with_crop(VAR_0, p, VAR_12 + 32000 * c->mc_frame_counter);", "c->mc_frame_counter++;", "if (c->next_pts == AV_NOPTS_VALUE)\nc->next_pts = VAR_2->pts;", "return 0;", "}", "}", "if (c->mc_frame_counter == c->mc_lifetime) {", "VAR_9 = 0;", "if (c->mc_lifetime) {", "VAR_9 = VAR_14 + c->mc_lifetime*(VAR_16 + VAR_15);", "if ((VAR_10 = ff_alloc_packet(VAR_1, VAR_9)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Error getting output packet of size %d.\\n\", VAR_9);", "return VAR_10;", "}", "buf = VAR_1->data;", "ff_init_elbg(VAR_12, 32, 1000 * c->mc_lifetime, VAR_13, CHARSET_CHARS, 50, VAR_11, &c->randctx);", "ff_do_elbg (VAR_12, 32, 1000 * c->mc_lifetime, VAR_13, CHARSET_CHARS, 50, VAR_11, &c->randctx);", "render_charset(VAR_0, charset, colram);", "memcpy(buf, charset, VAR_14);", "buf += VAR_14;", "charset += VAR_14;", "}", "for (VAR_4 = 0; VAR_4 < c->mc_lifetime; VAR_4++) {", "for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++) {", "for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++) {", "buf[VAR_6 * VAR_8 + VAR_5] = VAR_11[VAR_6 * VAR_8 + VAR_5];", "}", "}", "buf += VAR_16;", "VAR_9 += VAR_16;", "if (c->mc_use_5col) {", "a64_compress_colram(buf, VAR_11, colram);", "buf += VAR_15;", "VAR_9 += VAR_15;", "}", "VAR_11 += 1000;", "}", "AV_WB32(VAR_0->extradata + 4, c->mc_frame_counter);", "AV_WB32(VAR_0->extradata + 8, VAR_14);", "AV_WB32(VAR_0->extradata + 12, VAR_16 + VAR_15);", "c->mc_frame_counter = 0;", "VAR_1->pts = VAR_1->dts = c->next_pts;", "c->next_pts = AV_NOPTS_VALUE;", "VAR_1->size = VAR_9;", "VAR_1->flags |= AV_PKT_FLAG_KEY;", "*VAR_3 = !!VAR_9;", "}", "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, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 71 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 113 ], [ 115 ], [ 117 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 147 ], [ 149 ], [ 155 ], [ 161 ], [ 167 ], [ 169 ], [ 171 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ], [ 211 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 233 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ] ]
20,713
static av_always_inline void MPV_motion_internal(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t **ref_picture, op_pixels_func (*pix_op)[4], qpel_mc_func (*qpix_op)[16], int is_mpeg12) { int dxy, mx, my, src_x, src_y, motion_x, motion_y; int mb_x, mb_y, i; uint8_t *ptr, *dest; mb_x = s->mb_x; mb_y = s->mb_y; prefetch_motion(s, ref_picture, dir); if(!is_mpeg12 && s->obmc && s->pict_type != AV_PICTURE_TYPE_B){ LOCAL_ALIGNED_8(int16_t, mv_cache, [4], [4][2]); Picture *cur_frame = &s->current_picture; const int xy= s->mb_x + s->mb_y*s->mb_stride; const int mot_stride= s->b8_stride; const int mot_xy= mb_x*2 + mb_y*2*mot_stride; av_assert2(!s->mb_skipped); AV_COPY32(mv_cache[1][1], cur_frame->motion_val[0][mot_xy ]); AV_COPY32(mv_cache[1][2], cur_frame->motion_val[0][mot_xy + 1]); AV_COPY32(mv_cache[2][1], cur_frame->motion_val[0][mot_xy + mot_stride ]); AV_COPY32(mv_cache[2][2], cur_frame->motion_val[0][mot_xy + mot_stride + 1]); AV_COPY32(mv_cache[3][1], cur_frame->motion_val[0][mot_xy + mot_stride ]); AV_COPY32(mv_cache[3][2], cur_frame->motion_val[0][mot_xy + mot_stride + 1]); if (mb_y == 0 || IS_INTRA(cur_frame->mb_type[xy - s->mb_stride])) { AV_COPY32(mv_cache[0][1], mv_cache[1][1]); AV_COPY32(mv_cache[0][2], mv_cache[1][2]); }else{ AV_COPY32(mv_cache[0][1], cur_frame->motion_val[0][mot_xy - mot_stride ]); AV_COPY32(mv_cache[0][2], cur_frame->motion_val[0][mot_xy - mot_stride + 1]); } if (mb_x == 0 || IS_INTRA(cur_frame->mb_type[xy - 1])) { AV_COPY32(mv_cache[1][0], mv_cache[1][1]); AV_COPY32(mv_cache[2][0], mv_cache[2][1]); }else{ AV_COPY32(mv_cache[1][0], cur_frame->motion_val[0][mot_xy - 1]); AV_COPY32(mv_cache[2][0], cur_frame->motion_val[0][mot_xy - 1 + mot_stride]); } if (mb_x + 1 >= s->mb_width || IS_INTRA(cur_frame->mb_type[xy + 1])) { AV_COPY32(mv_cache[1][3], mv_cache[1][2]); AV_COPY32(mv_cache[2][3], mv_cache[2][2]); }else{ AV_COPY32(mv_cache[1][3], cur_frame->motion_val[0][mot_xy + 2]); AV_COPY32(mv_cache[2][3], cur_frame->motion_val[0][mot_xy + 2 + mot_stride]); } mx = 0; my = 0; for(i=0;i<4;i++) { const int x= (i&1)+1; const int y= (i>>1)+1; int16_t mv[5][2]= { {mv_cache[y][x ][0], mv_cache[y][x ][1]}, {mv_cache[y-1][x][0], mv_cache[y-1][x][1]}, {mv_cache[y][x-1][0], mv_cache[y][x-1][1]}, {mv_cache[y][x+1][0], mv_cache[y][x+1][1]}, {mv_cache[y+1][x][0], mv_cache[y+1][x][1]}}; //FIXME cleanup obmc_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize, ref_picture[0], mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8, pix_op[1], mv); mx += mv[0][0]; my += mv[0][1]; } if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)) chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my); return; } switch(s->mv_type) { case MV_TYPE_16X16: if(s->mcsel){ if(s->real_sprite_warping_points==1){ gmc1_motion(s, dest_y, dest_cb, dest_cr, ref_picture); }else{ gmc_motion(s, dest_y, dest_cb, dest_cr, ref_picture); } }else if(!is_mpeg12 && s->quarter_sample){ qpel_motion(s, dest_y, dest_cb, dest_cr, 0, 0, 0, ref_picture, pix_op, qpix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); } else if (!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) && s->mspel && s->codec_id == AV_CODEC_ID_WMV2) { ff_mspel_motion(s, dest_y, dest_cb, dest_cr, ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); }else { mpeg_motion(s, dest_y, dest_cb, dest_cr, 0, ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y); } break; case MV_TYPE_8X8: if (!is_mpeg12) { mx = 0; my = 0; if(s->quarter_sample){ for(i=0;i<4;i++) { motion_x = s->mv[dir][i][0]; motion_y = s->mv[dir][i][1]; dxy = ((motion_y & 3) << 2) | (motion_x & 3); src_x = mb_x * 16 + (motion_x >> 2) + (i & 1) * 8; src_y = mb_y * 16 + (motion_y >> 2) + (i >>1) * 8; /* WARNING: do no forget half pels */ src_x = av_clip(src_x, -16, s->width); if (src_x == s->width) dxy &= ~3; src_y = av_clip(src_y, -16, s->height); if (src_y == s->height) dxy &= ~12; ptr = ref_picture[0] + (src_y * s->linesize) + (src_x); if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&3) - 8, 0) || (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y&3) - 8, 0)){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->linesize, 9, 9, src_x, src_y, s->h_edge_pos, s->v_edge_pos); ptr= s->edge_emu_buffer; } } dest = dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize; qpix_op[1][dxy](dest, ptr, s->linesize); mx += s->mv[dir][i][0]/2; my += s->mv[dir][i][1]/2; } }else{ for(i=0;i<4;i++) { hpel_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize, ref_picture[0], mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8, pix_op[1], s->mv[dir][i][0], s->mv[dir][i][1]); mx += s->mv[dir][i][0]; my += s->mv[dir][i][1]; } } if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)) chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my); } break; case MV_TYPE_FIELD: if (s->picture_structure == PICT_FRAME) { if(!is_mpeg12 && s->quarter_sample){ for(i=0; i<2; i++){ qpel_motion(s, dest_y, dest_cb, dest_cr, 1, i, s->field_select[dir][i], ref_picture, pix_op, qpix_op, s->mv[dir][i][0], s->mv[dir][i][1], 8); } }else{ /* top field */ mpeg_motion_field(s, dest_y, dest_cb, dest_cr, 0, s->field_select[dir][0], ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 8, mb_y); /* bottom field */ mpeg_motion_field(s, dest_y, dest_cb, dest_cr, 1, s->field_select[dir][1], ref_picture, pix_op, s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y); } } else { if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field){ ref_picture = s->current_picture_ptr->f.data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, s->field_select[dir][0], ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y>>1); } break; case MV_TYPE_16X8: for(i=0; i<2; i++){ uint8_t ** ref2picture; if(s->picture_structure == s->field_select[dir][i] + 1 || s->pict_type == AV_PICTURE_TYPE_B || s->first_field){ ref2picture= ref_picture; }else{ ref2picture = s->current_picture_ptr->f.data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, s->field_select[dir][i], ref2picture, pix_op, s->mv[dir][i][0], s->mv[dir][i][1] + 16*i, 8, mb_y>>1); dest_y += 16*s->linesize; dest_cb+= (16>>s->chroma_y_shift)*s->uvlinesize; dest_cr+= (16>>s->chroma_y_shift)*s->uvlinesize; } break; case MV_TYPE_DMV: if(s->picture_structure == PICT_FRAME){ for(i=0; i<2; i++){ int j; for(j=0; j<2; j++){ mpeg_motion_field(s, dest_y, dest_cb, dest_cr, j, j^i, ref_picture, pix_op, s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], 8, mb_y); } pix_op = s->hdsp.avg_pixels_tab; } }else{ for(i=0; i<2; i++){ mpeg_motion(s, dest_y, dest_cb, dest_cr, s->picture_structure != i+1, ref_picture, pix_op, s->mv[dir][2*i][0],s->mv[dir][2*i][1],16, mb_y>>1); // after put we make avg of the same block pix_op=s->hdsp.avg_pixels_tab; //opposite parity is always in the same frame if this is second field if(!s->first_field){ ref_picture = s->current_picture_ptr->f.data; } } } break; default: av_assert2(0); } }
true
FFmpeg
23daee0dcc57b647b9d62d4c905e94acf0c6b8e0
static av_always_inline void MPV_motion_internal(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t **ref_picture, op_pixels_func (*pix_op)[4], qpel_mc_func (*qpix_op)[16], int is_mpeg12) { int dxy, mx, my, src_x, src_y, motion_x, motion_y; int mb_x, mb_y, i; uint8_t *ptr, *dest; mb_x = s->mb_x; mb_y = s->mb_y; prefetch_motion(s, ref_picture, dir); if(!is_mpeg12 && s->obmc && s->pict_type != AV_PICTURE_TYPE_B){ LOCAL_ALIGNED_8(int16_t, mv_cache, [4], [4][2]); Picture *cur_frame = &s->current_picture; const int xy= s->mb_x + s->mb_y*s->mb_stride; const int mot_stride= s->b8_stride; const int mot_xy= mb_x*2 + mb_y*2*mot_stride; av_assert2(!s->mb_skipped); AV_COPY32(mv_cache[1][1], cur_frame->motion_val[0][mot_xy ]); AV_COPY32(mv_cache[1][2], cur_frame->motion_val[0][mot_xy + 1]); AV_COPY32(mv_cache[2][1], cur_frame->motion_val[0][mot_xy + mot_stride ]); AV_COPY32(mv_cache[2][2], cur_frame->motion_val[0][mot_xy + mot_stride + 1]); AV_COPY32(mv_cache[3][1], cur_frame->motion_val[0][mot_xy + mot_stride ]); AV_COPY32(mv_cache[3][2], cur_frame->motion_val[0][mot_xy + mot_stride + 1]); if (mb_y == 0 || IS_INTRA(cur_frame->mb_type[xy - s->mb_stride])) { AV_COPY32(mv_cache[0][1], mv_cache[1][1]); AV_COPY32(mv_cache[0][2], mv_cache[1][2]); }else{ AV_COPY32(mv_cache[0][1], cur_frame->motion_val[0][mot_xy - mot_stride ]); AV_COPY32(mv_cache[0][2], cur_frame->motion_val[0][mot_xy - mot_stride + 1]); } if (mb_x == 0 || IS_INTRA(cur_frame->mb_type[xy - 1])) { AV_COPY32(mv_cache[1][0], mv_cache[1][1]); AV_COPY32(mv_cache[2][0], mv_cache[2][1]); }else{ AV_COPY32(mv_cache[1][0], cur_frame->motion_val[0][mot_xy - 1]); AV_COPY32(mv_cache[2][0], cur_frame->motion_val[0][mot_xy - 1 + mot_stride]); } if (mb_x + 1 >= s->mb_width || IS_INTRA(cur_frame->mb_type[xy + 1])) { AV_COPY32(mv_cache[1][3], mv_cache[1][2]); AV_COPY32(mv_cache[2][3], mv_cache[2][2]); }else{ AV_COPY32(mv_cache[1][3], cur_frame->motion_val[0][mot_xy + 2]); AV_COPY32(mv_cache[2][3], cur_frame->motion_val[0][mot_xy + 2 + mot_stride]); } mx = 0; my = 0; for(i=0;i<4;i++) { const int x= (i&1)+1; const int y= (i>>1)+1; int16_t mv[5][2]= { {mv_cache[y][x ][0], mv_cache[y][x ][1]}, {mv_cache[y-1][x][0], mv_cache[y-1][x][1]}, {mv_cache[y][x-1][0], mv_cache[y][x-1][1]}, {mv_cache[y][x+1][0], mv_cache[y][x+1][1]}, {mv_cache[y+1][x][0], mv_cache[y+1][x][1]}}; obmc_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize, ref_picture[0], mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8, pix_op[1], mv); mx += mv[0][0]; my += mv[0][1]; } if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)) chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my); return; } switch(s->mv_type) { case MV_TYPE_16X16: if(s->mcsel){ if(s->real_sprite_warping_points==1){ gmc1_motion(s, dest_y, dest_cb, dest_cr, ref_picture); }else{ gmc_motion(s, dest_y, dest_cb, dest_cr, ref_picture); } }else if(!is_mpeg12 && s->quarter_sample){ qpel_motion(s, dest_y, dest_cb, dest_cr, 0, 0, 0, ref_picture, pix_op, qpix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); } else if (!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) && s->mspel && s->codec_id == AV_CODEC_ID_WMV2) { ff_mspel_motion(s, dest_y, dest_cb, dest_cr, ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); }else { mpeg_motion(s, dest_y, dest_cb, dest_cr, 0, ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y); } break; case MV_TYPE_8X8: if (!is_mpeg12) { mx = 0; my = 0; if(s->quarter_sample){ for(i=0;i<4;i++) { motion_x = s->mv[dir][i][0]; motion_y = s->mv[dir][i][1]; dxy = ((motion_y & 3) << 2) | (motion_x & 3); src_x = mb_x * 16 + (motion_x >> 2) + (i & 1) * 8; src_y = mb_y * 16 + (motion_y >> 2) + (i >>1) * 8; src_x = av_clip(src_x, -16, s->width); if (src_x == s->width) dxy &= ~3; src_y = av_clip(src_y, -16, s->height); if (src_y == s->height) dxy &= ~12; ptr = ref_picture[0] + (src_y * s->linesize) + (src_x); if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&3) - 8, 0) || (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y&3) - 8, 0)){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->linesize, 9, 9, src_x, src_y, s->h_edge_pos, s->v_edge_pos); ptr= s->edge_emu_buffer; } } dest = dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize; qpix_op[1][dxy](dest, ptr, s->linesize); mx += s->mv[dir][i][0]/2; my += s->mv[dir][i][1]/2; } }else{ for(i=0;i<4;i++) { hpel_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize, ref_picture[0], mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8, pix_op[1], s->mv[dir][i][0], s->mv[dir][i][1]); mx += s->mv[dir][i][0]; my += s->mv[dir][i][1]; } } if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)) chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my); } break; case MV_TYPE_FIELD: if (s->picture_structure == PICT_FRAME) { if(!is_mpeg12 && s->quarter_sample){ for(i=0; i<2; i++){ qpel_motion(s, dest_y, dest_cb, dest_cr, 1, i, s->field_select[dir][i], ref_picture, pix_op, qpix_op, s->mv[dir][i][0], s->mv[dir][i][1], 8); } }else{ mpeg_motion_field(s, dest_y, dest_cb, dest_cr, 0, s->field_select[dir][0], ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 8, mb_y); mpeg_motion_field(s, dest_y, dest_cb, dest_cr, 1, s->field_select[dir][1], ref_picture, pix_op, s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y); } } else { if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field){ ref_picture = s->current_picture_ptr->f.data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, s->field_select[dir][0], ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y>>1); } break; case MV_TYPE_16X8: for(i=0; i<2; i++){ uint8_t ** ref2picture; if(s->picture_structure == s->field_select[dir][i] + 1 || s->pict_type == AV_PICTURE_TYPE_B || s->first_field){ ref2picture= ref_picture; }else{ ref2picture = s->current_picture_ptr->f.data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, s->field_select[dir][i], ref2picture, pix_op, s->mv[dir][i][0], s->mv[dir][i][1] + 16*i, 8, mb_y>>1); dest_y += 16*s->linesize; dest_cb+= (16>>s->chroma_y_shift)*s->uvlinesize; dest_cr+= (16>>s->chroma_y_shift)*s->uvlinesize; } break; case MV_TYPE_DMV: if(s->picture_structure == PICT_FRAME){ for(i=0; i<2; i++){ int j; for(j=0; j<2; j++){ mpeg_motion_field(s, dest_y, dest_cb, dest_cr, j, j^i, ref_picture, pix_op, s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], 8, mb_y); } pix_op = s->hdsp.avg_pixels_tab; } }else{ for(i=0; i<2; i++){ mpeg_motion(s, dest_y, dest_cb, dest_cr, s->picture_structure != i+1, ref_picture, pix_op, s->mv[dir][2*i][0],s->mv[dir][2*i][1],16, mb_y>>1); pix_op=s->hdsp.avg_pixels_tab; if(!s->first_field){ ref_picture = s->current_picture_ptr->f.data; } } } break; default: av_assert2(0); } }
{ "code": [ " if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field){" ], "line_no": [ 379 ] }
static av_always_inline void FUNC_0(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t **ref_picture, op_pixels_func (*pix_op)[4], qpel_mc_func (*qpix_op)[16], int is_mpeg12) { int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; int VAR_7, VAR_8, VAR_9; uint8_t *ptr, *dest; VAR_7 = s->VAR_7; VAR_8 = s->VAR_8; prefetch_motion(s, ref_picture, dir); if(!is_mpeg12 && s->obmc && s->pict_type != AV_PICTURE_TYPE_B){ LOCAL_ALIGNED_8(int16_t, mv_cache, [4], [4][2]); Picture *cur_frame = &s->current_picture; const int VAR_10= s->VAR_7 + s->VAR_8*s->mb_stride; const int VAR_11= s->b8_stride; const int VAR_12= VAR_7*2 + VAR_8*2*VAR_11; av_assert2(!s->mb_skipped); AV_COPY32(mv_cache[1][1], cur_frame->motion_val[0][VAR_12 ]); AV_COPY32(mv_cache[1][2], cur_frame->motion_val[0][VAR_12 + 1]); AV_COPY32(mv_cache[2][1], cur_frame->motion_val[0][VAR_12 + VAR_11 ]); AV_COPY32(mv_cache[2][2], cur_frame->motion_val[0][VAR_12 + VAR_11 + 1]); AV_COPY32(mv_cache[3][1], cur_frame->motion_val[0][VAR_12 + VAR_11 ]); AV_COPY32(mv_cache[3][2], cur_frame->motion_val[0][VAR_12 + VAR_11 + 1]); if (VAR_8 == 0 || IS_INTRA(cur_frame->mb_type[VAR_10 - s->mb_stride])) { AV_COPY32(mv_cache[0][1], mv_cache[1][1]); AV_COPY32(mv_cache[0][2], mv_cache[1][2]); }else{ AV_COPY32(mv_cache[0][1], cur_frame->motion_val[0][VAR_12 - VAR_11 ]); AV_COPY32(mv_cache[0][2], cur_frame->motion_val[0][VAR_12 - VAR_11 + 1]); } if (VAR_7 == 0 || IS_INTRA(cur_frame->mb_type[VAR_10 - 1])) { AV_COPY32(mv_cache[1][0], mv_cache[1][1]); AV_COPY32(mv_cache[2][0], mv_cache[2][1]); }else{ AV_COPY32(mv_cache[1][0], cur_frame->motion_val[0][VAR_12 - 1]); AV_COPY32(mv_cache[2][0], cur_frame->motion_val[0][VAR_12 - 1 + VAR_11]); } if (VAR_7 + 1 >= s->mb_width || IS_INTRA(cur_frame->mb_type[VAR_10 + 1])) { AV_COPY32(mv_cache[1][3], mv_cache[1][2]); AV_COPY32(mv_cache[2][3], mv_cache[2][2]); }else{ AV_COPY32(mv_cache[1][3], cur_frame->motion_val[0][VAR_12 + 2]); AV_COPY32(mv_cache[2][3], cur_frame->motion_val[0][VAR_12 + 2 + VAR_11]); } VAR_1 = 0; VAR_2 = 0; for(VAR_9=0;VAR_9<4;VAR_9++) { const int VAR_13= (VAR_9&1)+1; const int VAR_14= (VAR_9>>1)+1; int16_t mv[5][2]= { {mv_cache[VAR_14][VAR_13 ][0], mv_cache[VAR_14][VAR_13 ][1]}, {mv_cache[VAR_14-1][VAR_13][0], mv_cache[VAR_14-1][VAR_13][1]}, {mv_cache[VAR_14][VAR_13-1][0], mv_cache[VAR_14][VAR_13-1][1]}, {mv_cache[VAR_14][VAR_13+1][0], mv_cache[VAR_14][VAR_13+1][1]}, {mv_cache[VAR_14+1][VAR_13][0], mv_cache[VAR_14+1][VAR_13][1]}}; obmc_motion(s, dest_y + ((VAR_9 & 1) * 8) + (VAR_9 >> 1) * 8 * s->linesize, ref_picture[0], VAR_7 * 16 + (VAR_9 & 1) * 8, VAR_8 * 16 + (VAR_9 >>1) * 8, pix_op[1], mv); VAR_1 += mv[0][0]; VAR_2 += mv[0][1]; } if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)) chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], VAR_1, VAR_2); return; } switch(s->mv_type) { case MV_TYPE_16X16: if(s->mcsel){ if(s->real_sprite_warping_points==1){ gmc1_motion(s, dest_y, dest_cb, dest_cr, ref_picture); }else{ gmc_motion(s, dest_y, dest_cb, dest_cr, ref_picture); } }else if(!is_mpeg12 && s->quarter_sample){ qpel_motion(s, dest_y, dest_cb, dest_cr, 0, 0, 0, ref_picture, pix_op, qpix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); } else if (!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) && s->mspel && s->codec_id == AV_CODEC_ID_WMV2) { ff_mspel_motion(s, dest_y, dest_cb, dest_cr, ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); }else { mpeg_motion(s, dest_y, dest_cb, dest_cr, 0, ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16, VAR_8); } break; case MV_TYPE_8X8: if (!is_mpeg12) { VAR_1 = 0; VAR_2 = 0; if(s->quarter_sample){ for(VAR_9=0;VAR_9<4;VAR_9++) { VAR_5 = s->mv[dir][VAR_9][0]; VAR_6 = s->mv[dir][VAR_9][1]; VAR_0 = ((VAR_6 & 3) << 2) | (VAR_5 & 3); VAR_3 = VAR_7 * 16 + (VAR_5 >> 2) + (VAR_9 & 1) * 8; VAR_4 = VAR_8 * 16 + (VAR_6 >> 2) + (VAR_9 >>1) * 8; VAR_3 = av_clip(VAR_3, -16, s->width); if (VAR_3 == s->width) VAR_0 &= ~3; VAR_4 = av_clip(VAR_4, -16, s->height); if (VAR_4 == s->height) VAR_0 &= ~12; ptr = ref_picture[0] + (VAR_4 * s->linesize) + (VAR_3); if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)VAR_3 > FFMAX(s->h_edge_pos - (VAR_5&3) - 8, 0) || (unsigned)VAR_4 > FFMAX(s->v_edge_pos - (VAR_6&3) - 8, 0)){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->linesize, 9, 9, VAR_3, VAR_4, s->h_edge_pos, s->v_edge_pos); ptr= s->edge_emu_buffer; } } dest = dest_y + ((VAR_9 & 1) * 8) + (VAR_9 >> 1) * 8 * s->linesize; qpix_op[1][VAR_0](dest, ptr, s->linesize); VAR_1 += s->mv[dir][VAR_9][0]/2; VAR_2 += s->mv[dir][VAR_9][1]/2; } }else{ for(VAR_9=0;VAR_9<4;VAR_9++) { hpel_motion(s, dest_y + ((VAR_9 & 1) * 8) + (VAR_9 >> 1) * 8 * s->linesize, ref_picture[0], VAR_7 * 16 + (VAR_9 & 1) * 8, VAR_8 * 16 + (VAR_9 >>1) * 8, pix_op[1], s->mv[dir][VAR_9][0], s->mv[dir][VAR_9][1]); VAR_1 += s->mv[dir][VAR_9][0]; VAR_2 += s->mv[dir][VAR_9][1]; } } if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)) chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], VAR_1, VAR_2); } break; case MV_TYPE_FIELD: if (s->picture_structure == PICT_FRAME) { if(!is_mpeg12 && s->quarter_sample){ for(VAR_9=0; VAR_9<2; VAR_9++){ qpel_motion(s, dest_y, dest_cb, dest_cr, 1, VAR_9, s->field_select[dir][VAR_9], ref_picture, pix_op, qpix_op, s->mv[dir][VAR_9][0], s->mv[dir][VAR_9][1], 8); } }else{ mpeg_motion_field(s, dest_y, dest_cb, dest_cr, 0, s->field_select[dir][0], ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 8, VAR_8); mpeg_motion_field(s, dest_y, dest_cb, dest_cr, 1, s->field_select[dir][1], ref_picture, pix_op, s->mv[dir][1][0], s->mv[dir][1][1], 8, VAR_8); } } else { if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field){ ref_picture = s->current_picture_ptr->f.data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, s->field_select[dir][0], ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16, VAR_8>>1); } break; case MV_TYPE_16X8: for(VAR_9=0; VAR_9<2; VAR_9++){ uint8_t ** ref2picture; if(s->picture_structure == s->field_select[dir][VAR_9] + 1 || s->pict_type == AV_PICTURE_TYPE_B || s->first_field){ ref2picture= ref_picture; }else{ ref2picture = s->current_picture_ptr->f.data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, s->field_select[dir][VAR_9], ref2picture, pix_op, s->mv[dir][VAR_9][0], s->mv[dir][VAR_9][1] + 16*VAR_9, 8, VAR_8>>1); dest_y += 16*s->linesize; dest_cb+= (16>>s->chroma_y_shift)*s->uvlinesize; dest_cr+= (16>>s->chroma_y_shift)*s->uvlinesize; } break; case MV_TYPE_DMV: if(s->picture_structure == PICT_FRAME){ for(VAR_9=0; VAR_9<2; VAR_9++){ int VAR_15; for(VAR_15=0; VAR_15<2; VAR_15++){ mpeg_motion_field(s, dest_y, dest_cb, dest_cr, VAR_15, VAR_15^VAR_9, ref_picture, pix_op, s->mv[dir][2*VAR_9 + VAR_15][0], s->mv[dir][2*VAR_9 + VAR_15][1], 8, VAR_8); } pix_op = s->hdsp.avg_pixels_tab; } }else{ for(VAR_9=0; VAR_9<2; VAR_9++){ mpeg_motion(s, dest_y, dest_cb, dest_cr, s->picture_structure != VAR_9+1, ref_picture, pix_op, s->mv[dir][2*VAR_9][0],s->mv[dir][2*VAR_9][1],16, VAR_8>>1); pix_op=s->hdsp.avg_pixels_tab; if(!s->first_field){ ref_picture = s->current_picture_ptr->f.data; } } } break; default: av_assert2(0); } }
[ "static av_always_inline void FUNC_0(MpegEncContext *s,\nuint8_t *dest_y, uint8_t *dest_cb,\nuint8_t *dest_cr, int dir,\nuint8_t **ref_picture,\nop_pixels_func (*pix_op)[4],\nqpel_mc_func (*qpix_op)[16], int is_mpeg12)\n{", "int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;", "int VAR_7, VAR_8, VAR_9;", "uint8_t *ptr, *dest;", "VAR_7 = s->VAR_7;", "VAR_8 = s->VAR_8;", "prefetch_motion(s, ref_picture, dir);", "if(!is_mpeg12 && s->obmc && s->pict_type != AV_PICTURE_TYPE_B){", "LOCAL_ALIGNED_8(int16_t, mv_cache, [4], [4][2]);", "Picture *cur_frame = &s->current_picture;", "const int VAR_10= s->VAR_7 + s->VAR_8*s->mb_stride;", "const int VAR_11= s->b8_stride;", "const int VAR_12= VAR_7*2 + VAR_8*2*VAR_11;", "av_assert2(!s->mb_skipped);", "AV_COPY32(mv_cache[1][1], cur_frame->motion_val[0][VAR_12 ]);", "AV_COPY32(mv_cache[1][2], cur_frame->motion_val[0][VAR_12 + 1]);", "AV_COPY32(mv_cache[2][1], cur_frame->motion_val[0][VAR_12 + VAR_11 ]);", "AV_COPY32(mv_cache[2][2], cur_frame->motion_val[0][VAR_12 + VAR_11 + 1]);", "AV_COPY32(mv_cache[3][1], cur_frame->motion_val[0][VAR_12 + VAR_11 ]);", "AV_COPY32(mv_cache[3][2], cur_frame->motion_val[0][VAR_12 + VAR_11 + 1]);", "if (VAR_8 == 0 || IS_INTRA(cur_frame->mb_type[VAR_10 - s->mb_stride])) {", "AV_COPY32(mv_cache[0][1], mv_cache[1][1]);", "AV_COPY32(mv_cache[0][2], mv_cache[1][2]);", "}else{", "AV_COPY32(mv_cache[0][1], cur_frame->motion_val[0][VAR_12 - VAR_11 ]);", "AV_COPY32(mv_cache[0][2], cur_frame->motion_val[0][VAR_12 - VAR_11 + 1]);", "}", "if (VAR_7 == 0 || IS_INTRA(cur_frame->mb_type[VAR_10 - 1])) {", "AV_COPY32(mv_cache[1][0], mv_cache[1][1]);", "AV_COPY32(mv_cache[2][0], mv_cache[2][1]);", "}else{", "AV_COPY32(mv_cache[1][0], cur_frame->motion_val[0][VAR_12 - 1]);", "AV_COPY32(mv_cache[2][0], cur_frame->motion_val[0][VAR_12 - 1 + VAR_11]);", "}", "if (VAR_7 + 1 >= s->mb_width || IS_INTRA(cur_frame->mb_type[VAR_10 + 1])) {", "AV_COPY32(mv_cache[1][3], mv_cache[1][2]);", "AV_COPY32(mv_cache[2][3], mv_cache[2][2]);", "}else{", "AV_COPY32(mv_cache[1][3], cur_frame->motion_val[0][VAR_12 + 2]);", "AV_COPY32(mv_cache[2][3], cur_frame->motion_val[0][VAR_12 + 2 + VAR_11]);", "}", "VAR_1 = 0;", "VAR_2 = 0;", "for(VAR_9=0;VAR_9<4;VAR_9++) {", "const int VAR_13= (VAR_9&1)+1;", "const int VAR_14= (VAR_9>>1)+1;", "int16_t mv[5][2]= {", "{mv_cache[VAR_14][VAR_13 ][0], mv_cache[VAR_14][VAR_13 ][1]},", "{mv_cache[VAR_14-1][VAR_13][0], mv_cache[VAR_14-1][VAR_13][1]},", "{mv_cache[VAR_14][VAR_13-1][0], mv_cache[VAR_14][VAR_13-1][1]},", "{mv_cache[VAR_14][VAR_13+1][0], mv_cache[VAR_14][VAR_13+1][1]},", "{mv_cache[VAR_14+1][VAR_13][0], mv_cache[VAR_14+1][VAR_13][1]}};", "obmc_motion(s, dest_y + ((VAR_9 & 1) * 8) + (VAR_9 >> 1) * 8 * s->linesize,\nref_picture[0],\nVAR_7 * 16 + (VAR_9 & 1) * 8, VAR_8 * 16 + (VAR_9 >>1) * 8,\npix_op[1],\nmv);", "VAR_1 += mv[0][0];", "VAR_2 += mv[0][1];", "}", "if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY))\nchroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], VAR_1, VAR_2);", "return;", "}", "switch(s->mv_type) {", "case MV_TYPE_16X16:\nif(s->mcsel){", "if(s->real_sprite_warping_points==1){", "gmc1_motion(s, dest_y, dest_cb, dest_cr,\nref_picture);", "}else{", "gmc_motion(s, dest_y, dest_cb, dest_cr,\nref_picture);", "}", "}else if(!is_mpeg12 && s->quarter_sample){", "qpel_motion(s, dest_y, dest_cb, dest_cr,\n0, 0, 0,\nref_picture, pix_op, qpix_op,\ns->mv[dir][0][0], s->mv[dir][0][1], 16);", "} else if (!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) &&", "s->mspel && s->codec_id == AV_CODEC_ID_WMV2) {", "ff_mspel_motion(s, dest_y, dest_cb, dest_cr,\nref_picture, pix_op,\ns->mv[dir][0][0], s->mv[dir][0][1], 16);", "}else", "{", "mpeg_motion(s, dest_y, dest_cb, dest_cr, 0,\nref_picture, pix_op,\ns->mv[dir][0][0], s->mv[dir][0][1], 16, VAR_8);", "}", "break;", "case MV_TYPE_8X8:\nif (!is_mpeg12) {", "VAR_1 = 0;", "VAR_2 = 0;", "if(s->quarter_sample){", "for(VAR_9=0;VAR_9<4;VAR_9++) {", "VAR_5 = s->mv[dir][VAR_9][0];", "VAR_6 = s->mv[dir][VAR_9][1];", "VAR_0 = ((VAR_6 & 3) << 2) | (VAR_5 & 3);", "VAR_3 = VAR_7 * 16 + (VAR_5 >> 2) + (VAR_9 & 1) * 8;", "VAR_4 = VAR_8 * 16 + (VAR_6 >> 2) + (VAR_9 >>1) * 8;", "VAR_3 = av_clip(VAR_3, -16, s->width);", "if (VAR_3 == s->width)\nVAR_0 &= ~3;", "VAR_4 = av_clip(VAR_4, -16, s->height);", "if (VAR_4 == s->height)\nVAR_0 &= ~12;", "ptr = ref_picture[0] + (VAR_4 * s->linesize) + (VAR_3);", "if(s->flags&CODEC_FLAG_EMU_EDGE){", "if( (unsigned)VAR_3 > FFMAX(s->h_edge_pos - (VAR_5&3) - 8, 0)\n|| (unsigned)VAR_4 > FFMAX(s->v_edge_pos - (VAR_6&3) - 8, 0)){", "s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr,\ns->linesize, 9, 9,\nVAR_3, VAR_4,\ns->h_edge_pos, s->v_edge_pos);", "ptr= s->edge_emu_buffer;", "}", "}", "dest = dest_y + ((VAR_9 & 1) * 8) + (VAR_9 >> 1) * 8 * s->linesize;", "qpix_op[1][VAR_0](dest, ptr, s->linesize);", "VAR_1 += s->mv[dir][VAR_9][0]/2;", "VAR_2 += s->mv[dir][VAR_9][1]/2;", "}", "}else{", "for(VAR_9=0;VAR_9<4;VAR_9++) {", "hpel_motion(s, dest_y + ((VAR_9 & 1) * 8) + (VAR_9 >> 1) * 8 * s->linesize,\nref_picture[0],\nVAR_7 * 16 + (VAR_9 & 1) * 8, VAR_8 * 16 + (VAR_9 >>1) * 8,\npix_op[1],\ns->mv[dir][VAR_9][0], s->mv[dir][VAR_9][1]);", "VAR_1 += s->mv[dir][VAR_9][0];", "VAR_2 += s->mv[dir][VAR_9][1];", "}", "}", "if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY))\nchroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], VAR_1, VAR_2);", "}", "break;", "case MV_TYPE_FIELD:\nif (s->picture_structure == PICT_FRAME) {", "if(!is_mpeg12 && s->quarter_sample){", "for(VAR_9=0; VAR_9<2; VAR_9++){", "qpel_motion(s, dest_y, dest_cb, dest_cr,\n1, VAR_9, s->field_select[dir][VAR_9],\nref_picture, pix_op, qpix_op,\ns->mv[dir][VAR_9][0], s->mv[dir][VAR_9][1], 8);", "}", "}else{", "mpeg_motion_field(s, dest_y, dest_cb, dest_cr,\n0, s->field_select[dir][0],\nref_picture, pix_op,\ns->mv[dir][0][0], s->mv[dir][0][1], 8, VAR_8);", "mpeg_motion_field(s, dest_y, dest_cb, dest_cr,\n1, s->field_select[dir][1],\nref_picture, pix_op,\ns->mv[dir][1][0], s->mv[dir][1][1], 8, VAR_8);", "}", "} else {", "if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field){", "ref_picture = s->current_picture_ptr->f.data;", "}", "mpeg_motion(s, dest_y, dest_cb, dest_cr,\ns->field_select[dir][0],\nref_picture, pix_op,\ns->mv[dir][0][0], s->mv[dir][0][1], 16, VAR_8>>1);", "}", "break;", "case MV_TYPE_16X8:\nfor(VAR_9=0; VAR_9<2; VAR_9++){", "uint8_t ** ref2picture;", "if(s->picture_structure == s->field_select[dir][VAR_9] + 1\n|| s->pict_type == AV_PICTURE_TYPE_B || s->first_field){", "ref2picture= ref_picture;", "}else{", "ref2picture = s->current_picture_ptr->f.data;", "}", "mpeg_motion(s, dest_y, dest_cb, dest_cr,\ns->field_select[dir][VAR_9],\nref2picture, pix_op,\ns->mv[dir][VAR_9][0], s->mv[dir][VAR_9][1] + 16*VAR_9, 8, VAR_8>>1);", "dest_y += 16*s->linesize;", "dest_cb+= (16>>s->chroma_y_shift)*s->uvlinesize;", "dest_cr+= (16>>s->chroma_y_shift)*s->uvlinesize;", "}", "break;", "case MV_TYPE_DMV:\nif(s->picture_structure == PICT_FRAME){", "for(VAR_9=0; VAR_9<2; VAR_9++){", "int VAR_15;", "for(VAR_15=0; VAR_15<2; VAR_15++){", "mpeg_motion_field(s, dest_y, dest_cb, dest_cr,\nVAR_15, VAR_15^VAR_9, ref_picture, pix_op,\ns->mv[dir][2*VAR_9 + VAR_15][0],\ns->mv[dir][2*VAR_9 + VAR_15][1], 8, VAR_8);", "}", "pix_op = s->hdsp.avg_pixels_tab;", "}", "}else{", "for(VAR_9=0; VAR_9<2; VAR_9++){", "mpeg_motion(s, dest_y, dest_cb, dest_cr,\ns->picture_structure != VAR_9+1,\nref_picture, pix_op,\ns->mv[dir][2*VAR_9][0],s->mv[dir][2*VAR_9][1],16, VAR_8>>1);", "pix_op=s->hdsp.avg_pixels_tab;", "if(!s->first_field){", "ref_picture = s->current_picture_ptr->f.data;", "}", "}", "}", "break;", "default: av_assert2(0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141, 143, 145, 147, 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 165 ], [ 167 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193, 195, 197, 199 ], [ 201 ], [ 203 ], [ 205, 207, 209 ], [ 211 ], [ 213 ], [ 215, 217, 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ], [ 247 ], [ 253 ], [ 255, 257 ], [ 259 ], [ 261, 263 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275, 277, 279, 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305, 307, 309, 311, 313 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 327, 329 ], [ 331 ], [ 333 ], [ 335, 337 ], [ 339 ], [ 341 ], [ 343, 345, 347, 349 ], [ 351 ], [ 353 ], [ 357, 359, 361, 363 ], [ 367, 369, 371, 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 387, 389, 391, 393 ], [ 395 ], [ 397 ], [ 399, 401 ], [ 403 ], [ 407, 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 421, 423, 425, 427 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441, 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451, 453, 455, 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469, 471, 473, 475 ], [ 481 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ] ]
20,714
void ppc_store_sr (CPUPPCState *env, int srnum, target_ulong value) { LOG_MMU("%s: reg=%d " TARGET_FMT_lx " " TARGET_FMT_lx "\n", __func__, srnum, value, env->sr[srnum]); #if defined(TARGET_PPC64) if (env->mmu_model & POWERPC_MMU_64) { uint64_t rb = 0, rs = 0; /* ESID = srnum */ rb |= ((uint32_t)srnum & 0xf) << 28; /* Set the valid bit */ rb |= 1 << 27; /* Index = ESID */ rb |= (uint32_t)srnum; /* VSID = VSID */ rs |= (value & 0xfffffff) << 12; /* flags = flags */ rs |= ((value >> 27) & 0xf) << 9; ppc_store_slb(env, rb, rs); } else #endif if (env->sr[srnum] != value) { env->sr[srnum] = value; /* Invalidating 256MB of virtual memory in 4kB pages is way longer than flusing the whole TLB. */ #if !defined(FLUSH_ALL_TLBS) && 0 { target_ulong page, end; /* Invalidate 256 MB of virtual memory */ page = (16 << 20) * srnum; end = page + (16 << 20); for (; page != end; page += TARGET_PAGE_SIZE) tlb_flush_page(env, page); } #else tlb_flush(env, 1); #endif } }
true
qemu
decb471488dd9e7e7ab9957f120cb501c4489f63
void ppc_store_sr (CPUPPCState *env, int srnum, target_ulong value) { LOG_MMU("%s: reg=%d " TARGET_FMT_lx " " TARGET_FMT_lx "\n", __func__, srnum, value, env->sr[srnum]); #if defined(TARGET_PPC64) if (env->mmu_model & POWERPC_MMU_64) { uint64_t rb = 0, rs = 0; rb |= ((uint32_t)srnum & 0xf) << 28; rb |= 1 << 27; rb |= (uint32_t)srnum; rs |= (value & 0xfffffff) << 12; rs |= ((value >> 27) & 0xf) << 9; ppc_store_slb(env, rb, rs); } else #endif if (env->sr[srnum] != value) { env->sr[srnum] = value; #if !defined(FLUSH_ALL_TLBS) && 0 { target_ulong page, end; page = (16 << 20) * srnum; end = page + (16 << 20); for (; page != end; page += TARGET_PAGE_SIZE) tlb_flush_page(env, page); } #else tlb_flush(env, 1); #endif } }
{ "code": [ " rs |= ((value >> 27) & 0xf) << 9;" ], "line_no": [ 37 ] }
void FUNC_0 (CPUPPCState *VAR_0, int VAR_1, target_ulong VAR_2) { LOG_MMU("%s: reg=%d " TARGET_FMT_lx " " TARGET_FMT_lx "\n", __func__, VAR_1, VAR_2, VAR_0->sr[VAR_1]); #if defined(TARGET_PPC64) if (VAR_0->mmu_model & POWERPC_MMU_64) { uint64_t rb = 0, rs = 0; rb |= ((uint32_t)VAR_1 & 0xf) << 28; rb |= 1 << 27; rb |= (uint32_t)VAR_1; rs |= (VAR_2 & 0xfffffff) << 12; rs |= ((VAR_2 >> 27) & 0xf) << 9; ppc_store_slb(VAR_0, rb, rs); } else #endif if (VAR_0->sr[VAR_1] != VAR_2) { VAR_0->sr[VAR_1] = VAR_2; #if !defined(FLUSH_ALL_TLBS) && 0 { target_ulong page, end; page = (16 << 20) * VAR_1; end = page + (16 << 20); for (; page != end; page += TARGET_PAGE_SIZE) tlb_flush_page(VAR_0, page); } #else tlb_flush(VAR_0, 1); #endif } }
[ "void FUNC_0 (CPUPPCState *VAR_0, int VAR_1, target_ulong VAR_2)\n{", "LOG_MMU(\"%s: reg=%d \" TARGET_FMT_lx \" \" TARGET_FMT_lx \"\\n\", __func__,\nVAR_1, VAR_2, VAR_0->sr[VAR_1]);", "#if defined(TARGET_PPC64)\nif (VAR_0->mmu_model & POWERPC_MMU_64) {", "uint64_t rb = 0, rs = 0;", "rb |= ((uint32_t)VAR_1 & 0xf) << 28;", "rb |= 1 << 27;", "rb |= (uint32_t)VAR_1;", "rs |= (VAR_2 & 0xfffffff) << 12;", "rs |= ((VAR_2 >> 27) & 0xf) << 9;", "ppc_store_slb(VAR_0, rb, rs);", "} else", "#endif\nif (VAR_0->sr[VAR_1] != VAR_2) {", "VAR_0->sr[VAR_1] = VAR_2;", "#if !defined(FLUSH_ALL_TLBS) && 0\n{", "target_ulong page, end;", "page = (16 << 20) * VAR_1;", "end = page + (16 << 20);", "for (; page != end; page += TARGET_PAGE_SIZE)", "tlb_flush_page(VAR_0, page);", "}", "#else\ntlb_flush(VAR_0, 1);", "#endif\n}", "}" ]
[ 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 ], [ 19 ], [ 23 ], [ 27 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 55, 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77, 79 ], [ 81 ] ]
20,715
int ff_h264_decode_mb_cabac(H264Context *h) { MpegEncContext * const s = &h->s; int mb_xy; int mb_type, partition_count, cbp = 0; int dct8x8_allowed= h->pps.transform_8x8_mode; int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2; const int pixel_shift = h->pixel_shift; mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride; tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); if( h->slice_type_nos != AV_PICTURE_TYPE_I ) { int skip; /* a skipped mb needs the aff flag from the following mb */ if( FRAME_MBAFF && (s->mb_y&1)==1 && h->prev_mb_skipped ) skip = h->next_mb_skipped; else skip = decode_cabac_mb_skip( h, s->mb_x, s->mb_y ); /* read skip flags */ if( skip ) { if( FRAME_MBAFF && (s->mb_y&1)==0 ){ s->current_picture.f.mb_type[mb_xy] = MB_TYPE_SKIP; h->next_mb_skipped = decode_cabac_mb_skip( h, s->mb_x, s->mb_y+1 ); if(!h->next_mb_skipped) h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); } decode_mb_skip(h); h->cbp_table[mb_xy] = 0; h->chroma_pred_mode_table[mb_xy] = 0; h->last_qscale_diff = 0; return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); } h->prev_mb_skipped = 0; fill_decode_neighbors(h, -(MB_FIELD)); if( h->slice_type_nos == AV_PICTURE_TYPE_B ) { int ctx = 0; assert(h->slice_type_nos == AV_PICTURE_TYPE_B); if( !IS_DIRECT( h->left_type[LTOP]-1 ) ) ctx++; if( !IS_DIRECT( h->top_type-1 ) ) ctx++; if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+ctx] ) ){ mb_type= 0; /* B_Direct_16x16 */ }else if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+3] ) ) { mb_type= 1 + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); /* B_L[01]_16x16 */ }else{ int bits; bits = get_cabac_noinline( &h->cabac, &h->cabac_state[27+4] ) << 3; bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 2; bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 1; bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); if( bits < 8 ){ mb_type= bits + 3; /* B_Bi_16x16 through B_L1_L0_16x8 */ }else if( bits == 13 ){ mb_type= decode_cabac_intra_mb_type(h, 32, 0); goto decode_intra_mb; }else if( bits == 14 ){ mb_type= 11; /* B_L1_L0_8x16 */ }else if( bits == 15 ){ mb_type= 22; /* B_8x8 */ }else{ bits= ( bits<<1 ) + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); mb_type= bits - 4; /* B_L0_Bi_* through B_Bi_Bi_* */ } } partition_count= b_mb_type_info[mb_type].partition_count; mb_type= b_mb_type_info[mb_type].type; } else if( h->slice_type_nos == AV_PICTURE_TYPE_P ) { if( get_cabac_noinline( &h->cabac, &h->cabac_state[14] ) == 0 ) { /* P-type */ if( get_cabac_noinline( &h->cabac, &h->cabac_state[15] ) == 0 ) { /* P_L0_D16x16, P_8x8 */ mb_type= 3 * get_cabac_noinline( &h->cabac, &h->cabac_state[16] ); } else { /* P_L0_D8x16, P_L0_D16x8 */ mb_type= 2 - get_cabac_noinline( &h->cabac, &h->cabac_state[17] ); } partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; } else { mb_type= decode_cabac_intra_mb_type(h, 17, 0); goto decode_intra_mb; } } else { mb_type= decode_cabac_intra_mb_type(h, 3, 1); if(h->slice_type == AV_PICTURE_TYPE_SI && mb_type) mb_type--; assert(h->slice_type_nos == AV_PICTURE_TYPE_I); decode_intra_mb: partition_count = 0; cbp= i_mb_type_info[mb_type].cbp; h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode; mb_type= i_mb_type_info[mb_type].type; } if(MB_FIELD) mb_type |= MB_TYPE_INTERLACED; h->slice_table[ mb_xy ]= h->slice_num; if(IS_INTRA_PCM(mb_type)) { static const uint16_t mb_sizes[4] = {256,384,512,768}; const int mb_size = mb_sizes[h->sps.chroma_format_idc]*h->sps.bit_depth_luma >> 3; const uint8_t *ptr; // We assume these blocks are very rare so we do not optimize it. // FIXME The two following lines get the bitstream position in the cabac // decode, I think it should be done by a function in cabac.h (or cabac.c). ptr= h->cabac.bytestream; if(h->cabac.low&0x1) ptr--; if(CABAC_BITS==16){ if(h->cabac.low&0x1FF) ptr--; } // The pixels are stored in the same order as levels in h->mb array. memcpy(h->mb, ptr, mb_size); ptr+=mb_size; ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr); // All blocks are present h->cbp_table[mb_xy] = 0xf7ef; h->chroma_pred_mode_table[mb_xy] = 0; // In deblocking, the quantizer is 0 s->current_picture.f.qscale_table[mb_xy] = 0; // All coeffs are present memset(h->non_zero_count[mb_xy], 16, 48); s->current_picture.f.mb_type[mb_xy] = mb_type; h->last_qscale_diff = 0; return 0; } if(MB_MBAFF){ h->ref_count[0] <<= 1; h->ref_count[1] <<= 1; } fill_decode_caches(h, mb_type); if( IS_INTRA( mb_type ) ) { int i, pred_mode; if( IS_INTRA4x4( mb_type ) ) { if( dct8x8_allowed && get_cabac_noinline( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] ) ) { mb_type |= MB_TYPE_8x8DCT; for( i = 0; i < 16; i+=4 ) { int pred = pred_intra_mode( h, i ); int mode = decode_cabac_mb_intra4x4_pred_mode( h, pred ); fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); } } else { for( i = 0; i < 16; i++ ) { int pred = pred_intra_mode( h, i ); h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred ); //av_log( s->avctx, AV_LOG_ERROR, "i4x4 pred=%d mode=%d\n", pred, h->intra4x4_pred_mode_cache[ scan8[i] ] ); } } write_back_intra_pred_mode(h); if( ff_h264_check_intra4x4_pred_mode(h) < 0 ) return -1; } else { h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode( h, h->intra16x16_pred_mode, 0 ); if( h->intra16x16_pred_mode < 0 ) return -1; } if(decode_chroma){ h->chroma_pred_mode_table[mb_xy] = pred_mode = decode_cabac_mb_chroma_pre_mode( h ); pred_mode= ff_h264_check_intra_pred_mode( h, pred_mode, 1 ); if( pred_mode < 0 ) return -1; h->chroma_pred_mode= pred_mode; } else { h->chroma_pred_mode= DC_128_PRED8x8; } } else if( partition_count == 4 ) { int i, j, sub_partition_count[4], list, ref[2][4]; if( h->slice_type_nos == AV_PICTURE_TYPE_B ) { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h ); sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; } if( IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] | h->sub_mb_type[2] | h->sub_mb_type[3]) ) { ff_h264_pred_direct_motion(h, &mb_type); h->ref_cache[0][scan8[4]] = h->ref_cache[1][scan8[4]] = h->ref_cache[0][scan8[12]] = h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; for( i = 0; i < 4; i++ ) fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, (h->sub_mb_type[i]>>1)&0xFF, 1 ); } } else { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_p_mb_sub_type( h ); sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type; } } for( list = 0; list < h->list_count; list++ ) { for( i = 0; i < 4; i++ ) { if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ if( h->ref_count[list] > 1 ){ ref[list][i] = decode_cabac_mb_ref( h, list, 4*i ); if(ref[list][i] >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref[list][i], h->ref_count[list]); } }else ref[list][i] = 0; } else { ref[list][i] = -1; } h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); for(list=0; list<h->list_count; list++){ for(i=0; i<4; i++){ h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]; if(IS_DIRECT(h->sub_mb_type[i])){ fill_rectangle(h->mvd_cache[list][scan8[4*i]], 2, 2, 8, 0, 2); continue; } if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){ const int sub_mb_type= h->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mpx, mpy; int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; uint8_t (* mvd_cache)[2]= &h->mvd_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my); DECODE_CABAC_MB_MVD( h, list, index) tprintf(s->avctx, "final mv:%d %d\n", mx, my); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my; mvd_cache[ 1 ][0]= mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mpx; mvd_cache[ 1 ][1]= mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= mpy; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; mvd_cache[ 1 ][0]= mpx; mvd_cache[ 1 ][1]= mpy; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; mvd_cache[ 8 ][0]= mpx; mvd_cache[ 8 ][1]= mpy; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; mvd_cache[ 0 ][0]= mpx; mvd_cache[ 0 ][1]= mpy; } }else{ fill_rectangle(h->mv_cache [list][ scan8[4*i] ], 2, 2, 8, 0, 4); fill_rectangle(h->mvd_cache[list][ scan8[4*i] ], 2, 2, 8, 0, 2); } } } } else if( IS_DIRECT(mb_type) ) { ff_h264_pred_direct_motion(h, &mb_type); fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 2); fill_rectangle(h->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 2); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; } else { int list, i; if(IS_16X16(mb_type)){ for(list=0; list<h->list_count; list++){ if(IS_DIR(mb_type, 0, list)){ int ref; if(h->ref_count[list] > 1){ ref= decode_cabac_mb_ref(h, list, 0); if(ref >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]); } }else ref=0; fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, ref, 1); } } for(list=0; list<h->list_count; list++){ if(IS_DIR(mb_type, 0, list)){ int mx,my,mpx,mpy; pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my); DECODE_CABAC_MB_MVD( h, list, 0) tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack8to16(mpx,mpy), 2); fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4); } } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ int ref; if(h->ref_count[list] > 1){ ref= decode_cabac_mb_ref( h, list, 8*i ); if(ref >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]); } }else ref=0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ int mx,my,mpx,mpy; pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my); DECODE_CABAC_MB_MVD( h, list, 8*i) tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack8to16(mpx,mpy), 2); fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 2); fill_rectangle(h-> mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4); } } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ //FIXME optimize int ref; if(h->ref_count[list] > 1){ ref= decode_cabac_mb_ref( h, list, 4*i ); if(ref >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]); } }else ref=0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ int mx,my,mpx,mpy; pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my); DECODE_CABAC_MB_MVD( h, list, 4*i) tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack8to16(mpx,mpy), 2); fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 2); fill_rectangle(h-> mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4); } } } } } if( IS_INTER( mb_type ) ) { h->chroma_pred_mode_table[mb_xy] = 0; write_back_motion( h, mb_type ); } if( !IS_INTRA16x16( mb_type ) ) { cbp = decode_cabac_mb_cbp_luma( h ); if(decode_chroma) cbp |= decode_cabac_mb_cbp_chroma( h ) << 4; } h->cbp_table[mb_xy] = h->cbp = cbp; if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) { mb_type |= MB_TYPE_8x8DCT * get_cabac_noinline( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] ); } /* It would be better to do this in fill_decode_caches, but we don't know * the transform mode of the current macroblock there. */ if (CHROMA444 && IS_8x8DCT(mb_type)){ int i; uint8_t *nnz_cache = h->non_zero_count_cache; for (i = 0; i < 2; i++){ if (h->left_type[LEFT(i)] && !IS_8x8DCT(h->left_type[LEFT(i)])){ nnz_cache[3+8* 1 + 2*8*i]= nnz_cache[3+8* 2 + 2*8*i]= nnz_cache[3+8* 6 + 2*8*i]= nnz_cache[3+8* 7 + 2*8*i]= nnz_cache[3+8*11 + 2*8*i]= nnz_cache[3+8*12 + 2*8*i]= IS_INTRA(mb_type) ? 64 : 0; } } if (h->top_type && !IS_8x8DCT(h->top_type)){ uint32_t top_empty = CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040; AV_WN32A(&nnz_cache[4+8* 0], top_empty); AV_WN32A(&nnz_cache[4+8* 5], top_empty); AV_WN32A(&nnz_cache[4+8*10], top_empty); } } s->current_picture.f.mb_type[mb_xy] = mb_type; if( cbp || IS_INTRA16x16( mb_type ) ) { const uint8_t *scan, *scan8x8; const uint32_t *qmul; if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8 : h->field_scan8x8_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; } // decode_cabac_mb_dqp if(get_cabac_noinline( &h->cabac, &h->cabac_state[60 + (h->last_qscale_diff != 0)])){ int val = 1; int ctx= 2; const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8); while( get_cabac_noinline( &h->cabac, &h->cabac_state[60 + ctx] ) ) { ctx= 3; val++; if(val > 2*max_qp){ //prevent infinite loop av_log(h->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y); } } if( val&0x01 ) val= (val + 1)>>1 ; else val= -((val + 1)>>1); h->last_qscale_diff = val; s->qscale += val; if(((unsigned)s->qscale) > max_qp){ if(s->qscale<0) s->qscale+= max_qp+1; else s->qscale-= max_qp+1; } h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale); h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale); }else h->last_qscale_diff=0; decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 0); if(CHROMA444){ decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 1); decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 2); } else if (CHROMA422) { if( cbp&0x30 ){ int c; for( c = 0; c < 2; c++ ) { //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c ); decode_cabac_residual_dc_422(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX + c, chroma422_dc_scan, 8); } } if( cbp&0x20 ) { int c, i, i8x8; for( c = 0; c < 2; c++ ) { DCTELEM *mb = h->mb + (16*(16 + 16*c) << pixel_shift); qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]]; for (i8x8 = 0; i8x8 < 2; i8x8++) { for (i = 0; i < 4; i++) { const int index = 16 + 16 * c + 8*i8x8 + i; //av_log(s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16); decode_cabac_residual_nondc(h, mb, 4, index, scan + 1, qmul, 15); mb += 16<<pixel_shift; } } } } else { fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } else /* yuv420 */ { if( cbp&0x30 ){ int c; for( c = 0; c < 2; c++ ) { //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c ); decode_cabac_residual_dc(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4); } } if( cbp&0x20 ) { int c, i; for( c = 0; c < 2; c++ ) { qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]]; for( i = 0; i < 4; i++ ) { const int index = 16 + 16 * c + i; //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16 ); decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15); } } } else { fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } } else { fill_rectangle(&h->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); h->last_qscale_diff = 0; } s->current_picture.f.qscale_table[mb_xy] = s->qscale; write_back_non_zero_count(h); if(MB_MBAFF){ h->ref_count[0] >>= 1; h->ref_count[1] >>= 1; } return 0; }
true
FFmpeg
d1604b3de96575195b219028e2c4f08b2259aa7d
int ff_h264_decode_mb_cabac(H264Context *h) { MpegEncContext * const s = &h->s; int mb_xy; int mb_type, partition_count, cbp = 0; int dct8x8_allowed= h->pps.transform_8x8_mode; int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2; const int pixel_shift = h->pixel_shift; mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride; tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); if( h->slice_type_nos != AV_PICTURE_TYPE_I ) { int skip; if( FRAME_MBAFF && (s->mb_y&1)==1 && h->prev_mb_skipped ) skip = h->next_mb_skipped; else skip = decode_cabac_mb_skip( h, s->mb_x, s->mb_y ); if( skip ) { if( FRAME_MBAFF && (s->mb_y&1)==0 ){ s->current_picture.f.mb_type[mb_xy] = MB_TYPE_SKIP; h->next_mb_skipped = decode_cabac_mb_skip( h, s->mb_x, s->mb_y+1 ); if(!h->next_mb_skipped) h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); } decode_mb_skip(h); h->cbp_table[mb_xy] = 0; h->chroma_pred_mode_table[mb_xy] = 0; h->last_qscale_diff = 0; return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); } h->prev_mb_skipped = 0; fill_decode_neighbors(h, -(MB_FIELD)); if( h->slice_type_nos == AV_PICTURE_TYPE_B ) { int ctx = 0; assert(h->slice_type_nos == AV_PICTURE_TYPE_B); if( !IS_DIRECT( h->left_type[LTOP]-1 ) ) ctx++; if( !IS_DIRECT( h->top_type-1 ) ) ctx++; if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+ctx] ) ){ mb_type= 0; }else if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+3] ) ) { mb_type= 1 + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); }else{ int bits; bits = get_cabac_noinline( &h->cabac, &h->cabac_state[27+4] ) << 3; bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 2; bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 1; bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); if( bits < 8 ){ mb_type= bits + 3; }else if( bits == 13 ){ mb_type= decode_cabac_intra_mb_type(h, 32, 0); goto decode_intra_mb; }else if( bits == 14 ){ mb_type= 11; }else if( bits == 15 ){ mb_type= 22; }else{ bits= ( bits<<1 ) + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); mb_type= bits - 4; } } partition_count= b_mb_type_info[mb_type].partition_count; mb_type= b_mb_type_info[mb_type].type; } else if( h->slice_type_nos == AV_PICTURE_TYPE_P ) { if( get_cabac_noinline( &h->cabac, &h->cabac_state[14] ) == 0 ) { if( get_cabac_noinline( &h->cabac, &h->cabac_state[15] ) == 0 ) { mb_type= 3 * get_cabac_noinline( &h->cabac, &h->cabac_state[16] ); } else { mb_type= 2 - get_cabac_noinline( &h->cabac, &h->cabac_state[17] ); } partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; } else { mb_type= decode_cabac_intra_mb_type(h, 17, 0); goto decode_intra_mb; } } else { mb_type= decode_cabac_intra_mb_type(h, 3, 1); if(h->slice_type == AV_PICTURE_TYPE_SI && mb_type) mb_type--; assert(h->slice_type_nos == AV_PICTURE_TYPE_I); decode_intra_mb: partition_count = 0; cbp= i_mb_type_info[mb_type].cbp; h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode; mb_type= i_mb_type_info[mb_type].type; } if(MB_FIELD) mb_type |= MB_TYPE_INTERLACED; h->slice_table[ mb_xy ]= h->slice_num; if(IS_INTRA_PCM(mb_type)) { static const uint16_t mb_sizes[4] = {256,384,512,768}; const int mb_size = mb_sizes[h->sps.chroma_format_idc]*h->sps.bit_depth_luma >> 3; const uint8_t *ptr; ptr= h->cabac.bytestream; if(h->cabac.low&0x1) ptr--; if(CABAC_BITS==16){ if(h->cabac.low&0x1FF) ptr--; } memcpy(h->mb, ptr, mb_size); ptr+=mb_size; ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr); h->cbp_table[mb_xy] = 0xf7ef; h->chroma_pred_mode_table[mb_xy] = 0; s->current_picture.f.qscale_table[mb_xy] = 0; memset(h->non_zero_count[mb_xy], 16, 48); s->current_picture.f.mb_type[mb_xy] = mb_type; h->last_qscale_diff = 0; return 0; } if(MB_MBAFF){ h->ref_count[0] <<= 1; h->ref_count[1] <<= 1; } fill_decode_caches(h, mb_type); if( IS_INTRA( mb_type ) ) { int i, pred_mode; if( IS_INTRA4x4( mb_type ) ) { if( dct8x8_allowed && get_cabac_noinline( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] ) ) { mb_type |= MB_TYPE_8x8DCT; for( i = 0; i < 16; i+=4 ) { int pred = pred_intra_mode( h, i ); int mode = decode_cabac_mb_intra4x4_pred_mode( h, pred ); fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); } } else { for( i = 0; i < 16; i++ ) { int pred = pred_intra_mode( h, i ); h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred ); } } write_back_intra_pred_mode(h); if( ff_h264_check_intra4x4_pred_mode(h) < 0 ) return -1; } else { h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode( h, h->intra16x16_pred_mode, 0 ); if( h->intra16x16_pred_mode < 0 ) return -1; } if(decode_chroma){ h->chroma_pred_mode_table[mb_xy] = pred_mode = decode_cabac_mb_chroma_pre_mode( h ); pred_mode= ff_h264_check_intra_pred_mode( h, pred_mode, 1 ); if( pred_mode < 0 ) return -1; h->chroma_pred_mode= pred_mode; } else { h->chroma_pred_mode= DC_128_PRED8x8; } } else if( partition_count == 4 ) { int i, j, sub_partition_count[4], list, ref[2][4]; if( h->slice_type_nos == AV_PICTURE_TYPE_B ) { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h ); sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; } if( IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] | h->sub_mb_type[2] | h->sub_mb_type[3]) ) { ff_h264_pred_direct_motion(h, &mb_type); h->ref_cache[0][scan8[4]] = h->ref_cache[1][scan8[4]] = h->ref_cache[0][scan8[12]] = h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; for( i = 0; i < 4; i++ ) fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, (h->sub_mb_type[i]>>1)&0xFF, 1 ); } } else { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_p_mb_sub_type( h ); sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type; } } for( list = 0; list < h->list_count; list++ ) { for( i = 0; i < 4; i++ ) { if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ if( h->ref_count[list] > 1 ){ ref[list][i] = decode_cabac_mb_ref( h, list, 4*i ); if(ref[list][i] >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref[list][i], h->ref_count[list]); } }else ref[list][i] = 0; } else { ref[list][i] = -1; } h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); for(list=0; list<h->list_count; list++){ for(i=0; i<4; i++){ h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]; if(IS_DIRECT(h->sub_mb_type[i])){ fill_rectangle(h->mvd_cache[list][scan8[4*i]], 2, 2, 8, 0, 2); continue; } if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){ const int sub_mb_type= h->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mpx, mpy; int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; uint8_t (* mvd_cache)[2]= &h->mvd_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my); DECODE_CABAC_MB_MVD( h, list, index) tprintf(s->avctx, "final mv:%d %d\n", mx, my); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my; mvd_cache[ 1 ][0]= mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mpx; mvd_cache[ 1 ][1]= mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= mpy; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; mvd_cache[ 1 ][0]= mpx; mvd_cache[ 1 ][1]= mpy; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; mvd_cache[ 8 ][0]= mpx; mvd_cache[ 8 ][1]= mpy; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; mvd_cache[ 0 ][0]= mpx; mvd_cache[ 0 ][1]= mpy; } }else{ fill_rectangle(h->mv_cache [list][ scan8[4*i] ], 2, 2, 8, 0, 4); fill_rectangle(h->mvd_cache[list][ scan8[4*i] ], 2, 2, 8, 0, 2); } } } } else if( IS_DIRECT(mb_type) ) { ff_h264_pred_direct_motion(h, &mb_type); fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 2); fill_rectangle(h->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 2); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; } else { int list, i; if(IS_16X16(mb_type)){ for(list=0; list<h->list_count; list++){ if(IS_DIR(mb_type, 0, list)){ int ref; if(h->ref_count[list] > 1){ ref= decode_cabac_mb_ref(h, list, 0); if(ref >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]); } }else ref=0; fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, ref, 1); } } for(list=0; list<h->list_count; list++){ if(IS_DIR(mb_type, 0, list)){ int mx,my,mpx,mpy; pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my); DECODE_CABAC_MB_MVD( h, list, 0) tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack8to16(mpx,mpy), 2); fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4); } } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ int ref; if(h->ref_count[list] > 1){ ref= decode_cabac_mb_ref( h, list, 8*i ); if(ref >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]); } }else ref=0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ int mx,my,mpx,mpy; pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my); DECODE_CABAC_MB_MVD( h, list, 8*i) tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack8to16(mpx,mpy), 2); fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 2); fill_rectangle(h-> mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4); } } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ int ref; if(h->ref_count[list] > 1){ ref= decode_cabac_mb_ref( h, list, 4*i ); if(ref >= (unsigned)h->ref_count[list]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]); } }else ref=0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ int mx,my,mpx,mpy; pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my); DECODE_CABAC_MB_MVD( h, list, 4*i) tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack8to16(mpx,mpy), 2); fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 2); fill_rectangle(h-> mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4); } } } } } if( IS_INTER( mb_type ) ) { h->chroma_pred_mode_table[mb_xy] = 0; write_back_motion( h, mb_type ); } if( !IS_INTRA16x16( mb_type ) ) { cbp = decode_cabac_mb_cbp_luma( h ); if(decode_chroma) cbp |= decode_cabac_mb_cbp_chroma( h ) << 4; } h->cbp_table[mb_xy] = h->cbp = cbp; if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) { mb_type |= MB_TYPE_8x8DCT * get_cabac_noinline( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] ); } if (CHROMA444 && IS_8x8DCT(mb_type)){ int i; uint8_t *nnz_cache = h->non_zero_count_cache; for (i = 0; i < 2; i++){ if (h->left_type[LEFT(i)] && !IS_8x8DCT(h->left_type[LEFT(i)])){ nnz_cache[3+8* 1 + 2*8*i]= nnz_cache[3+8* 2 + 2*8*i]= nnz_cache[3+8* 6 + 2*8*i]= nnz_cache[3+8* 7 + 2*8*i]= nnz_cache[3+8*11 + 2*8*i]= nnz_cache[3+8*12 + 2*8*i]= IS_INTRA(mb_type) ? 64 : 0; } } if (h->top_type && !IS_8x8DCT(h->top_type)){ uint32_t top_empty = CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040; AV_WN32A(&nnz_cache[4+8* 0], top_empty); AV_WN32A(&nnz_cache[4+8* 5], top_empty); AV_WN32A(&nnz_cache[4+8*10], top_empty); } } s->current_picture.f.mb_type[mb_xy] = mb_type; if( cbp || IS_INTRA16x16( mb_type ) ) { const uint8_t *scan, *scan8x8; const uint32_t *qmul; if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8 : h->field_scan8x8_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; } if(get_cabac_noinline( &h->cabac, &h->cabac_state[60 + (h->last_qscale_diff != 0)])){ int val = 1; int ctx= 2; const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8); while( get_cabac_noinline( &h->cabac, &h->cabac_state[60 + ctx] ) ) { ctx= 3; val++; if(val > 2*max_qp){ av_log(h->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y); } } if( val&0x01 ) val= (val + 1)>>1 ; else val= -((val + 1)>>1); h->last_qscale_diff = val; s->qscale += val; if(((unsigned)s->qscale) > max_qp){ if(s->qscale<0) s->qscale+= max_qp+1; else s->qscale-= max_qp+1; } h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale); h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale); }else h->last_qscale_diff=0; decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 0); if(CHROMA444){ decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 1); decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 2); } else if (CHROMA422) { if( cbp&0x30 ){ int c; for( c = 0; c < 2; c++ ) { decode_cabac_residual_dc_422(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX + c, chroma422_dc_scan, 8); } } if( cbp&0x20 ) { int c, i, i8x8; for( c = 0; c < 2; c++ ) { DCTELEM *mb = h->mb + (16*(16 + 16*c) << pixel_shift); qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]]; for (i8x8 = 0; i8x8 < 2; i8x8++) { for (i = 0; i < 4; i++) { const int index = 16 + 16 * c + 8*i8x8 + i; decode_cabac_residual_nondc(h, mb, 4, index, scan + 1, qmul, 15); mb += 16<<pixel_shift; } } } } else { fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } else { if( cbp&0x30 ){ int c; for( c = 0; c < 2; c++ ) { decode_cabac_residual_dc(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4); } } if( cbp&0x20 ) { int c, i; for( c = 0; c < 2; c++ ) { qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]]; for( i = 0; i < 4; i++ ) { const int index = 16 + 16 * c + i; decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15); } } } else { fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } } else { fill_rectangle(&h->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); h->last_qscale_diff = 0; } s->current_picture.f.qscale_table[mb_xy] = s->qscale; write_back_non_zero_count(h); if(MB_MBAFF){ h->ref_count[0] >>= 1; h->ref_count[1] >>= 1; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(H264Context *VAR_0) { MpegEncContext * const s = &VAR_0->s; int VAR_1; int VAR_2, VAR_3, VAR_4 = 0; int VAR_5= VAR_0->pps.transform_8x8_mode; int VAR_6 = VAR_0->sps.chroma_format_idc == 1 || VAR_0->sps.chroma_format_idc == 2; const int VAR_7 = VAR_0->VAR_7; VAR_1 = VAR_0->VAR_1 = s->mb_x + s->mb_y*s->mb_stride; tprintf(s->avctx, "pic:%d mb:%d/%d\n", VAR_0->frame_num, s->mb_x, s->mb_y); if( VAR_0->slice_type_nos != AV_PICTURE_TYPE_I ) { int VAR_8; if( FRAME_MBAFF && (s->mb_y&1)==1 && VAR_0->prev_mb_skipped ) VAR_8 = VAR_0->next_mb_skipped; else VAR_8 = decode_cabac_mb_skip( VAR_0, s->mb_x, s->mb_y ); if( VAR_8 ) { if( FRAME_MBAFF && (s->mb_y&1)==0 ){ s->current_picture.f.VAR_2[VAR_1] = MB_TYPE_SKIP; VAR_0->next_mb_skipped = decode_cabac_mb_skip( VAR_0, s->mb_x, s->mb_y+1 ); if(!VAR_0->next_mb_skipped) VAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = decode_cabac_field_decoding_flag(VAR_0); } decode_mb_skip(VAR_0); VAR_0->cbp_table[VAR_1] = 0; VAR_0->chroma_pred_mode_table[VAR_1] = 0; VAR_0->last_qscale_diff = 0; return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) VAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = decode_cabac_field_decoding_flag(VAR_0); } VAR_0->prev_mb_skipped = 0; fill_decode_neighbors(VAR_0, -(MB_FIELD)); if( VAR_0->slice_type_nos == AV_PICTURE_TYPE_B ) { int VAR_25 = 0; assert(VAR_0->slice_type_nos == AV_PICTURE_TYPE_B); if( !IS_DIRECT( VAR_0->left_type[LTOP]-1 ) ) VAR_25++; if( !IS_DIRECT( VAR_0->top_type-1 ) ) VAR_25++; if( !get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+VAR_25] ) ){ VAR_2= 0; }else if( !get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+3] ) ) { VAR_2= 1 + get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ); }else{ int VAR_10; VAR_10 = get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+4] ) << 3; VAR_10+= get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ) << 2; VAR_10+= get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ) << 1; VAR_10+= get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ); if( VAR_10 < 8 ){ VAR_2= VAR_10 + 3; }else if( VAR_10 == 13 ){ VAR_2= decode_cabac_intra_mb_type(VAR_0, 32, 0); goto decode_intra_mb; }else if( VAR_10 == 14 ){ VAR_2= 11; }else if( VAR_10 == 15 ){ VAR_2= 22; }else{ VAR_10= ( VAR_10<<1 ) + get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ); VAR_2= VAR_10 - 4; } } VAR_3= b_mb_type_info[VAR_2].VAR_3; VAR_2= b_mb_type_info[VAR_2].type; } else if( VAR_0->slice_type_nos == AV_PICTURE_TYPE_P ) { if( get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[14] ) == 0 ) { if( get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[15] ) == 0 ) { VAR_2= 3 * get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[16] ); } else { VAR_2= 2 - get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[17] ); } VAR_3= p_mb_type_info[VAR_2].VAR_3; VAR_2= p_mb_type_info[VAR_2].type; } else { VAR_2= decode_cabac_intra_mb_type(VAR_0, 17, 0); goto decode_intra_mb; } } else { VAR_2= decode_cabac_intra_mb_type(VAR_0, 3, 1); if(VAR_0->slice_type == AV_PICTURE_TYPE_SI && VAR_2) VAR_2--; assert(VAR_0->slice_type_nos == AV_PICTURE_TYPE_I); decode_intra_mb: VAR_3 = 0; VAR_4= i_mb_type_info[VAR_2].VAR_4; VAR_0->intra16x16_pred_mode= i_mb_type_info[VAR_2].VAR_15; VAR_2= i_mb_type_info[VAR_2].type; } if(MB_FIELD) VAR_2 |= MB_TYPE_INTERLACED; VAR_0->slice_table[ VAR_1 ]= VAR_0->slice_num; if(IS_INTRA_PCM(VAR_2)) { static const uint16_t VAR_11[4] = {256,384,512,768}; const int VAR_12 = VAR_11[VAR_0->sps.chroma_format_idc]*VAR_0->sps.bit_depth_luma >> 3; const uint8_t *VAR_13; VAR_13= VAR_0->cabac.bytestream; if(VAR_0->cabac.low&0x1) VAR_13--; if(CABAC_BITS==16){ if(VAR_0->cabac.low&0x1FF) VAR_13--; } memcpy(VAR_0->mb, VAR_13, VAR_12); VAR_13+=VAR_12; ff_init_cabac_decoder(&VAR_0->cabac, VAR_13, VAR_0->cabac.bytestream_end - VAR_13); VAR_0->cbp_table[VAR_1] = 0xf7ef; VAR_0->chroma_pred_mode_table[VAR_1] = 0; s->current_picture.f.qscale_table[VAR_1] = 0; memset(VAR_0->non_zero_count[VAR_1], 16, 48); s->current_picture.f.VAR_2[VAR_1] = VAR_2; VAR_0->last_qscale_diff = 0; return 0; } if(MB_MBAFF){ VAR_0->ref_count[0] <<= 1; VAR_0->ref_count[1] <<= 1; } fill_decode_caches(VAR_0, VAR_2); if( IS_INTRA( VAR_2 ) ) { int VAR_29, VAR_15; if( IS_INTRA4x4( VAR_2 ) ) { if( VAR_5 && get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[399 + VAR_0->neighbor_transform_size] ) ) { VAR_2 |= MB_TYPE_8x8DCT; for( VAR_29 = 0; VAR_29 < 16; VAR_29+=4 ) { int VAR_18 = pred_intra_mode( VAR_0, VAR_29 ); int VAR_17 = decode_cabac_mb_intra4x4_pred_mode( VAR_0, VAR_18 ); fill_rectangle( &VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_29] ], 2, 2, 8, VAR_17, 1 ); } } else { for( VAR_29 = 0; VAR_29 < 16; VAR_29++ ) { int VAR_18 = pred_intra_mode( VAR_0, VAR_29 ); VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_29] ] = decode_cabac_mb_intra4x4_pred_mode( VAR_0, VAR_18 ); } } write_back_intra_pred_mode(VAR_0); if( ff_h264_check_intra4x4_pred_mode(VAR_0) < 0 ) return -1; } else { VAR_0->intra16x16_pred_mode= ff_h264_check_intra_pred_mode( VAR_0, VAR_0->intra16x16_pred_mode, 0 ); if( VAR_0->intra16x16_pred_mode < 0 ) return -1; } if(VAR_6){ VAR_0->chroma_pred_mode_table[VAR_1] = VAR_15 = decode_cabac_mb_chroma_pre_mode( VAR_0 ); VAR_15= ff_h264_check_intra_pred_mode( VAR_0, VAR_15, 1 ); if( VAR_15 < 0 ) return -1; VAR_0->chroma_pred_mode= VAR_15; } else { VAR_0->chroma_pred_mode= DC_128_PRED8x8; } } else if( VAR_3 == 4 ) { int VAR_29, VAR_18, VAR_19[4], VAR_22, VAR_21[2][4]; if( VAR_0->slice_type_nos == AV_PICTURE_TYPE_B ) { for( VAR_29 = 0; VAR_29 < 4; VAR_29++ ) { VAR_0->sub_mb_type[VAR_29] = decode_cabac_b_mb_sub_type( VAR_0 ); VAR_19[VAR_29]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_29] ].VAR_3; VAR_0->sub_mb_type[VAR_29]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_29] ].type; } if( IS_DIRECT(VAR_0->sub_mb_type[0] | VAR_0->sub_mb_type[1] | VAR_0->sub_mb_type[2] | VAR_0->sub_mb_type[3]) ) { ff_h264_pred_direct_motion(VAR_0, &VAR_2); VAR_0->ref_cache[0][scan8[4]] = VAR_0->ref_cache[1][scan8[4]] = VAR_0->ref_cache[0][scan8[12]] = VAR_0->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; for( VAR_29 = 0; VAR_29 < 4; VAR_29++ ) fill_rectangle( &VAR_0->direct_cache[scan8[4*VAR_29]], 2, 2, 8, (VAR_0->sub_mb_type[VAR_29]>>1)&0xFF, 1 ); } } else { for( VAR_29 = 0; VAR_29 < 4; VAR_29++ ) { VAR_0->sub_mb_type[VAR_29] = decode_cabac_p_mb_sub_type( VAR_0 ); VAR_19[VAR_29]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_29] ].VAR_3; VAR_0->sub_mb_type[VAR_29]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_29] ].type; } } for( VAR_22 = 0; VAR_22 < VAR_0->list_count; VAR_22++ ) { for( VAR_29 = 0; VAR_29 < 4; VAR_29++ ) { if(IS_DIRECT(VAR_0->sub_mb_type[VAR_29])) continue; if(IS_DIR(VAR_0->sub_mb_type[VAR_29], 0, VAR_22)){ if( VAR_0->ref_count[VAR_22] > 1 ){ VAR_21[VAR_22][VAR_29] = decode_cabac_mb_ref( VAR_0, VAR_22, 4*VAR_29 ); if(VAR_21[VAR_22][VAR_29] >= (unsigned)VAR_0->ref_count[VAR_22]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", VAR_21[VAR_22][VAR_29], VAR_0->ref_count[VAR_22]); } }else VAR_21[VAR_22][VAR_29] = 0; } else { VAR_21[VAR_22][VAR_29] = -1; } VAR_0->ref_cache[VAR_22][ scan8[4*VAR_29]+1 ]= VAR_0->ref_cache[VAR_22][ scan8[4*VAR_29]+8 ]=VAR_0->ref_cache[VAR_22][ scan8[4*VAR_29]+9 ]= VAR_21[VAR_22][VAR_29]; } } if(VAR_5) VAR_5 = get_dct8x8_allowed(VAR_0); for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){ for(VAR_29=0; VAR_29<4; VAR_29++){ VAR_0->ref_cache[VAR_22][ scan8[4*VAR_29] ]=VAR_0->ref_cache[VAR_22][ scan8[4*VAR_29]+1 ]; if(IS_DIRECT(VAR_0->sub_mb_type[VAR_29])){ fill_rectangle(VAR_0->mvd_cache[VAR_22][scan8[4*VAR_29]], 2, 2, 8, 0, 2); continue; } if(IS_DIR(VAR_0->sub_mb_type[VAR_29], 0, VAR_22) && !IS_DIRECT(VAR_0->sub_mb_type[VAR_29])){ const int sub_mb_type= VAR_0->sub_mb_type[VAR_29]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(VAR_18=0; VAR_18<VAR_19[VAR_29]; VAR_18++){ int mpx, mpy; int mx, my; const int VAR_29= 4*VAR_29 + block_width*VAR_18; int16_t (* mv_cache)[2]= &VAR_0->mv_cache[VAR_22][ scan8[VAR_29] ]; uint8_t (* mvd_cache)[2]= &VAR_0->mvd_cache[VAR_22][ scan8[VAR_29] ]; pred_motion(VAR_0, VAR_29, block_width, VAR_22, VAR_0->ref_cache[VAR_22][ scan8[VAR_29] ], &mx, &my); DECODE_CABAC_MB_MVD( VAR_0, VAR_22, VAR_29) tprintf(s->avctx, "final mv:%d %d\n", mx, my); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my; mvd_cache[ 1 ][0]= mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mpx; mvd_cache[ 1 ][1]= mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= mpy; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; mvd_cache[ 1 ][0]= mpx; mvd_cache[ 1 ][1]= mpy; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; mvd_cache[ 8 ][0]= mpx; mvd_cache[ 8 ][1]= mpy; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; mvd_cache[ 0 ][0]= mpx; mvd_cache[ 0 ][1]= mpy; } }else{ fill_rectangle(VAR_0->mv_cache [VAR_22][ scan8[4*VAR_29] ], 2, 2, 8, 0, 4); fill_rectangle(VAR_0->mvd_cache[VAR_22][ scan8[4*VAR_29] ], 2, 2, 8, 0, 2); } } } } else if( IS_DIRECT(VAR_2) ) { ff_h264_pred_direct_motion(VAR_0, &VAR_2); fill_rectangle(VAR_0->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 2); fill_rectangle(VAR_0->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 2); VAR_5 &= VAR_0->sps.direct_8x8_inference_flag; } else { int VAR_22, VAR_29; if(IS_16X16(VAR_2)){ for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){ if(IS_DIR(VAR_2, 0, VAR_22)){ int VAR_21; if(VAR_0->ref_count[VAR_22] > 1){ VAR_21= decode_cabac_mb_ref(VAR_0, VAR_22, 0); if(VAR_21 >= (unsigned)VAR_0->ref_count[VAR_22]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", VAR_21, VAR_0->ref_count[VAR_22]); } }else VAR_21=0; fill_rectangle(&VAR_0->ref_cache[VAR_22][ scan8[0] ], 4, 4, 8, VAR_21, 1); } } for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){ if(IS_DIR(VAR_2, 0, VAR_22)){ int mx,my,mpx,mpy; pred_motion(VAR_0, 0, 4, VAR_22, VAR_0->ref_cache[VAR_22][ scan8[0] ], &mx, &my); DECODE_CABAC_MB_MVD( VAR_0, VAR_22, 0) tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(VAR_0->mvd_cache[VAR_22][ scan8[0] ], 4, 4, 8, pack8to16(mpx,mpy), 2); fill_rectangle(VAR_0->mv_cache[VAR_22][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4); } } } else if(IS_16X8(VAR_2)){ for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){ for(VAR_29=0; VAR_29<2; VAR_29++){ if(IS_DIR(VAR_2, VAR_29, VAR_22)){ int VAR_21; if(VAR_0->ref_count[VAR_22] > 1){ VAR_21= decode_cabac_mb_ref( VAR_0, VAR_22, 8*VAR_29 ); if(VAR_21 >= (unsigned)VAR_0->ref_count[VAR_22]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", VAR_21, VAR_0->ref_count[VAR_22]); } }else VAR_21=0; fill_rectangle(&VAR_0->ref_cache[VAR_22][ scan8[0] + 16*VAR_29 ], 4, 2, 8, VAR_21, 1); }else fill_rectangle(&VAR_0->ref_cache[VAR_22][ scan8[0] + 16*VAR_29 ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1); } } for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){ for(VAR_29=0; VAR_29<2; VAR_29++){ if(IS_DIR(VAR_2, VAR_29, VAR_22)){ int mx,my,mpx,mpy; pred_16x8_motion(VAR_0, 8*VAR_29, VAR_22, VAR_0->ref_cache[VAR_22][scan8[0] + 16*VAR_29], &mx, &my); DECODE_CABAC_MB_MVD( VAR_0, VAR_22, 8*VAR_29) tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(VAR_0->mvd_cache[VAR_22][ scan8[0] + 16*VAR_29 ], 4, 2, 8, pack8to16(mpx,mpy), 2); fill_rectangle(VAR_0->mv_cache[VAR_22][ scan8[0] + 16*VAR_29 ], 4, 2, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(VAR_0->mvd_cache[VAR_22][ scan8[0] + 16*VAR_29 ], 4, 2, 8, 0, 2); fill_rectangle(VAR_0-> mv_cache[VAR_22][ scan8[0] + 16*VAR_29 ], 4, 2, 8, 0, 4); } } } }else{ assert(IS_8X16(VAR_2)); for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){ for(VAR_29=0; VAR_29<2; VAR_29++){ if(IS_DIR(VAR_2, VAR_29, VAR_22)){ int VAR_21; if(VAR_0->ref_count[VAR_22] > 1){ VAR_21= decode_cabac_mb_ref( VAR_0, VAR_22, 4*VAR_29 ); if(VAR_21 >= (unsigned)VAR_0->ref_count[VAR_22]){ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", VAR_21, VAR_0->ref_count[VAR_22]); } }else VAR_21=0; fill_rectangle(&VAR_0->ref_cache[VAR_22][ scan8[0] + 2*VAR_29 ], 2, 4, 8, VAR_21, 1); }else fill_rectangle(&VAR_0->ref_cache[VAR_22][ scan8[0] + 2*VAR_29 ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1); } } for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){ for(VAR_29=0; VAR_29<2; VAR_29++){ if(IS_DIR(VAR_2, VAR_29, VAR_22)){ int mx,my,mpx,mpy; pred_8x16_motion(VAR_0, VAR_29*4, VAR_22, VAR_0->ref_cache[VAR_22][ scan8[0] + 2*VAR_29 ], &mx, &my); DECODE_CABAC_MB_MVD( VAR_0, VAR_22, 4*VAR_29) tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(VAR_0->mvd_cache[VAR_22][ scan8[0] + 2*VAR_29 ], 2, 4, 8, pack8to16(mpx,mpy), 2); fill_rectangle(VAR_0->mv_cache[VAR_22][ scan8[0] + 2*VAR_29 ], 2, 4, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(VAR_0->mvd_cache[VAR_22][ scan8[0] + 2*VAR_29 ], 2, 4, 8, 0, 2); fill_rectangle(VAR_0-> mv_cache[VAR_22][ scan8[0] + 2*VAR_29 ], 2, 4, 8, 0, 4); } } } } } if( IS_INTER( VAR_2 ) ) { VAR_0->chroma_pred_mode_table[VAR_1] = 0; write_back_motion( VAR_0, VAR_2 ); } if( !IS_INTRA16x16( VAR_2 ) ) { VAR_4 = decode_cabac_mb_cbp_luma( VAR_0 ); if(VAR_6) VAR_4 |= decode_cabac_mb_cbp_chroma( VAR_0 ) << 4; } VAR_0->cbp_table[VAR_1] = VAR_0->VAR_4 = VAR_4; if( VAR_5 && (VAR_4&15) && !IS_INTRA( VAR_2 ) ) { VAR_2 |= MB_TYPE_8x8DCT * get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[399 + VAR_0->neighbor_transform_size] ); } if (CHROMA444 && IS_8x8DCT(VAR_2)){ int VAR_29; uint8_t *nnz_cache = VAR_0->non_zero_count_cache; for (VAR_29 = 0; VAR_29 < 2; VAR_29++){ if (VAR_0->left_type[LEFT(VAR_29)] && !IS_8x8DCT(VAR_0->left_type[LEFT(VAR_29)])){ nnz_cache[3+8* 1 + 2*8*VAR_29]= nnz_cache[3+8* 2 + 2*8*VAR_29]= nnz_cache[3+8* 6 + 2*8*VAR_29]= nnz_cache[3+8* 7 + 2*8*VAR_29]= nnz_cache[3+8*11 + 2*8*VAR_29]= nnz_cache[3+8*12 + 2*8*VAR_29]= IS_INTRA(VAR_2) ? 64 : 0; } } if (VAR_0->top_type && !IS_8x8DCT(VAR_0->top_type)){ uint32_t top_empty = CABAC && !IS_INTRA(VAR_2) ? 0 : 0x40404040; AV_WN32A(&nnz_cache[4+8* 0], top_empty); AV_WN32A(&nnz_cache[4+8* 5], top_empty); AV_WN32A(&nnz_cache[4+8*10], top_empty); } } s->current_picture.f.VAR_2[VAR_1] = VAR_2; if( VAR_4 || IS_INTRA16x16( VAR_2 ) ) { const uint8_t *VAR_22, *scan8x8; const uint32_t *VAR_23; if(IS_INTERLACED(VAR_2)){ scan8x8= s->qscale ? VAR_0->field_scan8x8 : VAR_0->field_scan8x8_q0; VAR_22= s->qscale ? VAR_0->field_scan : VAR_0->field_scan_q0; }else{ scan8x8= s->qscale ? VAR_0->zigzag_scan8x8 : VAR_0->zigzag_scan8x8_q0; VAR_22= s->qscale ? VAR_0->zigzag_scan : VAR_0->zigzag_scan_q0; } if(get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[60 + (VAR_0->last_qscale_diff != 0)])){ int VAR_24 = 1; int VAR_25= 2; const int VAR_25 = 51 + 6*(VAR_0->sps.bit_depth_luma-8); while( get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[60 + VAR_25] ) ) { VAR_25= 3; VAR_24++; if(VAR_24 > 2*VAR_25){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y); } } if( VAR_24&0x01 ) VAR_24= (VAR_24 + 1)>>1 ; else VAR_24= -((VAR_24 + 1)>>1); VAR_0->last_qscale_diff = VAR_24; s->qscale += VAR_24; if(((unsigned)s->qscale) > VAR_25){ if(s->qscale<0) s->qscale+= VAR_25+1; else s->qscale-= VAR_25+1; } VAR_0->chroma_qp[0] = get_chroma_qp(VAR_0, 0, s->qscale); VAR_0->chroma_qp[1] = get_chroma_qp(VAR_0, 1, s->qscale); }else VAR_0->last_qscale_diff=0; decode_cabac_luma_residual(VAR_0, VAR_22, scan8x8, VAR_7, VAR_2, VAR_4, 0); if(CHROMA444){ decode_cabac_luma_residual(VAR_0, VAR_22, scan8x8, VAR_7, VAR_2, VAR_4, 1); decode_cabac_luma_residual(VAR_0, VAR_22, scan8x8, VAR_7, VAR_2, VAR_4, 2); } else if (CHROMA422) { if( VAR_4&0x30 ){ int VAR_29; for( VAR_29 = 0; VAR_29 < 2; VAR_29++ ) { decode_cabac_residual_dc_422(VAR_0, VAR_0->mb + ((256 + 16*16*VAR_29) << VAR_7), 3, CHROMA_DC_BLOCK_INDEX + VAR_29, chroma422_dc_scan, 8); } } if( VAR_4&0x20 ) { int VAR_29, VAR_29, VAR_27; for( VAR_29 = 0; VAR_29 < 2; VAR_29++ ) { DCTELEM *mb = VAR_0->mb + (16*(16 + 16*VAR_29) << VAR_7); VAR_23 = VAR_0->dequant4_coeff[VAR_29+1+(IS_INTRA( VAR_2 ) ? 0:3)][VAR_0->chroma_qp[VAR_29]]; for (VAR_27 = 0; VAR_27 < 2; VAR_27++) { for (VAR_29 = 0; VAR_29 < 4; VAR_29++) { const int VAR_29 = 16 + 16 * VAR_29 + 8*VAR_27 + VAR_29; decode_cabac_residual_nondc(VAR_0, mb, 4, VAR_29, VAR_22 + 1, VAR_23, 15); mb += 16<<VAR_7; } } } } else { fill_rectangle(&VAR_0->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&VAR_0->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } else { if( VAR_4&0x30 ){ int VAR_29; for( VAR_29 = 0; VAR_29 < 2; VAR_29++ ) { decode_cabac_residual_dc(VAR_0, VAR_0->mb + ((256 + 16*16*VAR_29) << VAR_7), 3, CHROMA_DC_BLOCK_INDEX+VAR_29, chroma_dc_scan, 4); } } if( VAR_4&0x20 ) { int VAR_29, VAR_29; for( VAR_29 = 0; VAR_29 < 2; VAR_29++ ) { VAR_23 = VAR_0->dequant4_coeff[VAR_29+1+(IS_INTRA( VAR_2 ) ? 0:3)][VAR_0->chroma_qp[VAR_29]]; for( VAR_29 = 0; VAR_29 < 4; VAR_29++ ) { const int VAR_29 = 16 + 16 * VAR_29 + VAR_29; decode_cabac_residual_nondc(VAR_0, VAR_0->mb + (16*VAR_29 << VAR_7), 4, VAR_29, VAR_22 + 1, VAR_23, 15); } } } else { fill_rectangle(&VAR_0->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&VAR_0->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } } else { fill_rectangle(&VAR_0->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1); fill_rectangle(&VAR_0->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&VAR_0->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); VAR_0->last_qscale_diff = 0; } s->current_picture.f.qscale_table[VAR_1] = s->qscale; write_back_non_zero_count(VAR_0); if(MB_MBAFF){ VAR_0->ref_count[0] >>= 1; VAR_0->ref_count[1] >>= 1; } return 0; }
[ "int FUNC_0(H264Context *VAR_0) {", "MpegEncContext * const s = &VAR_0->s;", "int VAR_1;", "int VAR_2, VAR_3, VAR_4 = 0;", "int VAR_5= VAR_0->pps.transform_8x8_mode;", "int VAR_6 = VAR_0->sps.chroma_format_idc == 1 || VAR_0->sps.chroma_format_idc == 2;", "const int VAR_7 = VAR_0->VAR_7;", "VAR_1 = VAR_0->VAR_1 = s->mb_x + s->mb_y*s->mb_stride;", "tprintf(s->avctx, \"pic:%d mb:%d/%d\\n\", VAR_0->frame_num, s->mb_x, s->mb_y);", "if( VAR_0->slice_type_nos != AV_PICTURE_TYPE_I ) {", "int VAR_8;", "if( FRAME_MBAFF && (s->mb_y&1)==1 && VAR_0->prev_mb_skipped )\nVAR_8 = VAR_0->next_mb_skipped;", "else\nVAR_8 = decode_cabac_mb_skip( VAR_0, s->mb_x, s->mb_y );", "if( VAR_8 ) {", "if( FRAME_MBAFF && (s->mb_y&1)==0 ){", "s->current_picture.f.VAR_2[VAR_1] = MB_TYPE_SKIP;", "VAR_0->next_mb_skipped = decode_cabac_mb_skip( VAR_0, s->mb_x, s->mb_y+1 );", "if(!VAR_0->next_mb_skipped)\nVAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = decode_cabac_field_decoding_flag(VAR_0);", "}", "decode_mb_skip(VAR_0);", "VAR_0->cbp_table[VAR_1] = 0;", "VAR_0->chroma_pred_mode_table[VAR_1] = 0;", "VAR_0->last_qscale_diff = 0;", "return 0;", "}", "}", "if(FRAME_MBAFF){", "if( (s->mb_y&1) == 0 )\nVAR_0->mb_mbaff =\nVAR_0->mb_field_decoding_flag = decode_cabac_field_decoding_flag(VAR_0);", "}", "VAR_0->prev_mb_skipped = 0;", "fill_decode_neighbors(VAR_0, -(MB_FIELD));", "if( VAR_0->slice_type_nos == AV_PICTURE_TYPE_B ) {", "int VAR_25 = 0;", "assert(VAR_0->slice_type_nos == AV_PICTURE_TYPE_B);", "if( !IS_DIRECT( VAR_0->left_type[LTOP]-1 ) )\nVAR_25++;", "if( !IS_DIRECT( VAR_0->top_type-1 ) )\nVAR_25++;", "if( !get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+VAR_25] ) ){", "VAR_2= 0;", "}else if( !get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+3] ) ) {", "VAR_2= 1 + get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+5] );", "}else{", "int VAR_10;", "VAR_10 = get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+4] ) << 3;", "VAR_10+= get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ) << 2;", "VAR_10+= get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+5] ) << 1;", "VAR_10+= get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+5] );", "if( VAR_10 < 8 ){", "VAR_2= VAR_10 + 3;", "}else if( VAR_10 == 13 ){", "VAR_2= decode_cabac_intra_mb_type(VAR_0, 32, 0);", "goto decode_intra_mb;", "}else if( VAR_10 == 14 ){", "VAR_2= 11;", "}else if( VAR_10 == 15 ){", "VAR_2= 22;", "}else{", "VAR_10= ( VAR_10<<1 ) + get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[27+5] );", "VAR_2= VAR_10 - 4;", "}", "}", "VAR_3= b_mb_type_info[VAR_2].VAR_3;", "VAR_2= b_mb_type_info[VAR_2].type;", "} else if( VAR_0->slice_type_nos == AV_PICTURE_TYPE_P ) {", "if( get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[14] ) == 0 ) {", "if( get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[15] ) == 0 ) {", "VAR_2= 3 * get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[16] );", "} else {", "VAR_2= 2 - get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[17] );", "}", "VAR_3= p_mb_type_info[VAR_2].VAR_3;", "VAR_2= p_mb_type_info[VAR_2].type;", "} else {", "VAR_2= decode_cabac_intra_mb_type(VAR_0, 17, 0);", "goto decode_intra_mb;", "}", "} else {", "VAR_2= decode_cabac_intra_mb_type(VAR_0, 3, 1);", "if(VAR_0->slice_type == AV_PICTURE_TYPE_SI && VAR_2)\nVAR_2--;", "assert(VAR_0->slice_type_nos == AV_PICTURE_TYPE_I);", "decode_intra_mb:\nVAR_3 = 0;", "VAR_4= i_mb_type_info[VAR_2].VAR_4;", "VAR_0->intra16x16_pred_mode= i_mb_type_info[VAR_2].VAR_15;", "VAR_2= i_mb_type_info[VAR_2].type;", "}", "if(MB_FIELD)\nVAR_2 |= MB_TYPE_INTERLACED;", "VAR_0->slice_table[ VAR_1 ]= VAR_0->slice_num;", "if(IS_INTRA_PCM(VAR_2)) {", "static const uint16_t VAR_11[4] = {256,384,512,768};", "const int VAR_12 = VAR_11[VAR_0->sps.chroma_format_idc]*VAR_0->sps.bit_depth_luma >> 3;", "const uint8_t *VAR_13;", "VAR_13= VAR_0->cabac.bytestream;", "if(VAR_0->cabac.low&0x1) VAR_13--;", "if(CABAC_BITS==16){", "if(VAR_0->cabac.low&0x1FF) VAR_13--;", "}", "memcpy(VAR_0->mb, VAR_13, VAR_12); VAR_13+=VAR_12;", "ff_init_cabac_decoder(&VAR_0->cabac, VAR_13, VAR_0->cabac.bytestream_end - VAR_13);", "VAR_0->cbp_table[VAR_1] = 0xf7ef;", "VAR_0->chroma_pred_mode_table[VAR_1] = 0;", "s->current_picture.f.qscale_table[VAR_1] = 0;", "memset(VAR_0->non_zero_count[VAR_1], 16, 48);", "s->current_picture.f.VAR_2[VAR_1] = VAR_2;", "VAR_0->last_qscale_diff = 0;", "return 0;", "}", "if(MB_MBAFF){", "VAR_0->ref_count[0] <<= 1;", "VAR_0->ref_count[1] <<= 1;", "}", "fill_decode_caches(VAR_0, VAR_2);", "if( IS_INTRA( VAR_2 ) ) {", "int VAR_29, VAR_15;", "if( IS_INTRA4x4( VAR_2 ) ) {", "if( VAR_5 && get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[399 + VAR_0->neighbor_transform_size] ) ) {", "VAR_2 |= MB_TYPE_8x8DCT;", "for( VAR_29 = 0; VAR_29 < 16; VAR_29+=4 ) {", "int VAR_18 = pred_intra_mode( VAR_0, VAR_29 );", "int VAR_17 = decode_cabac_mb_intra4x4_pred_mode( VAR_0, VAR_18 );", "fill_rectangle( &VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_29] ], 2, 2, 8, VAR_17, 1 );", "}", "} else {", "for( VAR_29 = 0; VAR_29 < 16; VAR_29++ ) {", "int VAR_18 = pred_intra_mode( VAR_0, VAR_29 );", "VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_29] ] = decode_cabac_mb_intra4x4_pred_mode( VAR_0, VAR_18 );", "}", "}", "write_back_intra_pred_mode(VAR_0);", "if( ff_h264_check_intra4x4_pred_mode(VAR_0) < 0 ) return -1;", "} else {", "VAR_0->intra16x16_pred_mode= ff_h264_check_intra_pred_mode( VAR_0, VAR_0->intra16x16_pred_mode, 0 );", "if( VAR_0->intra16x16_pred_mode < 0 ) return -1;", "}", "if(VAR_6){", "VAR_0->chroma_pred_mode_table[VAR_1] =\nVAR_15 = decode_cabac_mb_chroma_pre_mode( VAR_0 );", "VAR_15= ff_h264_check_intra_pred_mode( VAR_0, VAR_15, 1 );", "if( VAR_15 < 0 ) return -1;", "VAR_0->chroma_pred_mode= VAR_15;", "} else {", "VAR_0->chroma_pred_mode= DC_128_PRED8x8;", "}", "} else if( VAR_3 == 4 ) {", "int VAR_29, VAR_18, VAR_19[4], VAR_22, VAR_21[2][4];", "if( VAR_0->slice_type_nos == AV_PICTURE_TYPE_B ) {", "for( VAR_29 = 0; VAR_29 < 4; VAR_29++ ) {", "VAR_0->sub_mb_type[VAR_29] = decode_cabac_b_mb_sub_type( VAR_0 );", "VAR_19[VAR_29]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_29] ].VAR_3;", "VAR_0->sub_mb_type[VAR_29]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_29] ].type;", "}", "if( IS_DIRECT(VAR_0->sub_mb_type[0] | VAR_0->sub_mb_type[1] |\nVAR_0->sub_mb_type[2] | VAR_0->sub_mb_type[3]) ) {", "ff_h264_pred_direct_motion(VAR_0, &VAR_2);", "VAR_0->ref_cache[0][scan8[4]] =\nVAR_0->ref_cache[1][scan8[4]] =\nVAR_0->ref_cache[0][scan8[12]] =\nVAR_0->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE;", "for( VAR_29 = 0; VAR_29 < 4; VAR_29++ )", "fill_rectangle( &VAR_0->direct_cache[scan8[4*VAR_29]], 2, 2, 8, (VAR_0->sub_mb_type[VAR_29]>>1)&0xFF, 1 );", "}", "} else {", "for( VAR_29 = 0; VAR_29 < 4; VAR_29++ ) {", "VAR_0->sub_mb_type[VAR_29] = decode_cabac_p_mb_sub_type( VAR_0 );", "VAR_19[VAR_29]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_29] ].VAR_3;", "VAR_0->sub_mb_type[VAR_29]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_29] ].type;", "}", "}", "for( VAR_22 = 0; VAR_22 < VAR_0->list_count; VAR_22++ ) {", "for( VAR_29 = 0; VAR_29 < 4; VAR_29++ ) {", "if(IS_DIRECT(VAR_0->sub_mb_type[VAR_29])) continue;", "if(IS_DIR(VAR_0->sub_mb_type[VAR_29], 0, VAR_22)){", "if( VAR_0->ref_count[VAR_22] > 1 ){", "VAR_21[VAR_22][VAR_29] = decode_cabac_mb_ref( VAR_0, VAR_22, 4*VAR_29 );", "if(VAR_21[VAR_22][VAR_29] >= (unsigned)VAR_0->ref_count[VAR_22]){", "av_log(s->avctx, AV_LOG_ERROR, \"Reference %d >= %d\\n\", VAR_21[VAR_22][VAR_29], VAR_0->ref_count[VAR_22]);", "}", "}else", "VAR_21[VAR_22][VAR_29] = 0;", "} else {", "VAR_21[VAR_22][VAR_29] = -1;", "}", "VAR_0->ref_cache[VAR_22][ scan8[4*VAR_29]+1 ]=\nVAR_0->ref_cache[VAR_22][ scan8[4*VAR_29]+8 ]=VAR_0->ref_cache[VAR_22][ scan8[4*VAR_29]+9 ]= VAR_21[VAR_22][VAR_29];", "}", "}", "if(VAR_5)\nVAR_5 = get_dct8x8_allowed(VAR_0);", "for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){", "for(VAR_29=0; VAR_29<4; VAR_29++){", "VAR_0->ref_cache[VAR_22][ scan8[4*VAR_29] ]=VAR_0->ref_cache[VAR_22][ scan8[4*VAR_29]+1 ];", "if(IS_DIRECT(VAR_0->sub_mb_type[VAR_29])){", "fill_rectangle(VAR_0->mvd_cache[VAR_22][scan8[4*VAR_29]], 2, 2, 8, 0, 2);", "continue;", "}", "if(IS_DIR(VAR_0->sub_mb_type[VAR_29], 0, VAR_22) && !IS_DIRECT(VAR_0->sub_mb_type[VAR_29])){", "const int sub_mb_type= VAR_0->sub_mb_type[VAR_29];", "const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1;", "for(VAR_18=0; VAR_18<VAR_19[VAR_29]; VAR_18++){", "int mpx, mpy;", "int mx, my;", "const int VAR_29= 4*VAR_29 + block_width*VAR_18;", "int16_t (* mv_cache)[2]= &VAR_0->mv_cache[VAR_22][ scan8[VAR_29] ];", "uint8_t (* mvd_cache)[2]= &VAR_0->mvd_cache[VAR_22][ scan8[VAR_29] ];", "pred_motion(VAR_0, VAR_29, block_width, VAR_22, VAR_0->ref_cache[VAR_22][ scan8[VAR_29] ], &mx, &my);", "DECODE_CABAC_MB_MVD( VAR_0, VAR_22, VAR_29)\ntprintf(s->avctx, \"final mv:%d %d\\n\", mx, my);", "if(IS_SUB_8X8(sub_mb_type)){", "mv_cache[ 1 ][0]=\nmv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx;", "mv_cache[ 1 ][1]=\nmv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my;", "mvd_cache[ 1 ][0]=\nmvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mpx;", "mvd_cache[ 1 ][1]=\nmvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= mpy;", "}else if(IS_SUB_8X4(sub_mb_type)){", "mv_cache[ 1 ][0]= mx;", "mv_cache[ 1 ][1]= my;", "mvd_cache[ 1 ][0]= mpx;", "mvd_cache[ 1 ][1]= mpy;", "}else if(IS_SUB_4X8(sub_mb_type)){", "mv_cache[ 8 ][0]= mx;", "mv_cache[ 8 ][1]= my;", "mvd_cache[ 8 ][0]= mpx;", "mvd_cache[ 8 ][1]= mpy;", "}", "mv_cache[ 0 ][0]= mx;", "mv_cache[ 0 ][1]= my;", "mvd_cache[ 0 ][0]= mpx;", "mvd_cache[ 0 ][1]= mpy;", "}", "}else{", "fill_rectangle(VAR_0->mv_cache [VAR_22][ scan8[4*VAR_29] ], 2, 2, 8, 0, 4);", "fill_rectangle(VAR_0->mvd_cache[VAR_22][ scan8[4*VAR_29] ], 2, 2, 8, 0, 2);", "}", "}", "}", "} else if( IS_DIRECT(VAR_2) ) {", "ff_h264_pred_direct_motion(VAR_0, &VAR_2);", "fill_rectangle(VAR_0->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 2);", "fill_rectangle(VAR_0->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 2);", "VAR_5 &= VAR_0->sps.direct_8x8_inference_flag;", "} else {", "int VAR_22, VAR_29;", "if(IS_16X16(VAR_2)){", "for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){", "if(IS_DIR(VAR_2, 0, VAR_22)){", "int VAR_21;", "if(VAR_0->ref_count[VAR_22] > 1){", "VAR_21= decode_cabac_mb_ref(VAR_0, VAR_22, 0);", "if(VAR_21 >= (unsigned)VAR_0->ref_count[VAR_22]){", "av_log(s->avctx, AV_LOG_ERROR, \"Reference %d >= %d\\n\", VAR_21, VAR_0->ref_count[VAR_22]);", "}", "}else", "VAR_21=0;", "fill_rectangle(&VAR_0->ref_cache[VAR_22][ scan8[0] ], 4, 4, 8, VAR_21, 1);", "}", "}", "for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){", "if(IS_DIR(VAR_2, 0, VAR_22)){", "int mx,my,mpx,mpy;", "pred_motion(VAR_0, 0, 4, VAR_22, VAR_0->ref_cache[VAR_22][ scan8[0] ], &mx, &my);", "DECODE_CABAC_MB_MVD( VAR_0, VAR_22, 0)\ntprintf(s->avctx, \"final mv:%d %d\\n\", mx, my);", "fill_rectangle(VAR_0->mvd_cache[VAR_22][ scan8[0] ], 4, 4, 8, pack8to16(mpx,mpy), 2);", "fill_rectangle(VAR_0->mv_cache[VAR_22][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4);", "}", "}", "}", "else if(IS_16X8(VAR_2)){", "for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){", "for(VAR_29=0; VAR_29<2; VAR_29++){", "if(IS_DIR(VAR_2, VAR_29, VAR_22)){", "int VAR_21;", "if(VAR_0->ref_count[VAR_22] > 1){", "VAR_21= decode_cabac_mb_ref( VAR_0, VAR_22, 8*VAR_29 );", "if(VAR_21 >= (unsigned)VAR_0->ref_count[VAR_22]){", "av_log(s->avctx, AV_LOG_ERROR, \"Reference %d >= %d\\n\", VAR_21, VAR_0->ref_count[VAR_22]);", "}", "}else", "VAR_21=0;", "fill_rectangle(&VAR_0->ref_cache[VAR_22][ scan8[0] + 16*VAR_29 ], 4, 2, 8, VAR_21, 1);", "}else", "fill_rectangle(&VAR_0->ref_cache[VAR_22][ scan8[0] + 16*VAR_29 ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1);", "}", "}", "for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){", "for(VAR_29=0; VAR_29<2; VAR_29++){", "if(IS_DIR(VAR_2, VAR_29, VAR_22)){", "int mx,my,mpx,mpy;", "pred_16x8_motion(VAR_0, 8*VAR_29, VAR_22, VAR_0->ref_cache[VAR_22][scan8[0] + 16*VAR_29], &mx, &my);", "DECODE_CABAC_MB_MVD( VAR_0, VAR_22, 8*VAR_29)\ntprintf(s->avctx, \"final mv:%d %d\\n\", mx, my);", "fill_rectangle(VAR_0->mvd_cache[VAR_22][ scan8[0] + 16*VAR_29 ], 4, 2, 8, pack8to16(mpx,mpy), 2);", "fill_rectangle(VAR_0->mv_cache[VAR_22][ scan8[0] + 16*VAR_29 ], 4, 2, 8, pack16to32(mx,my), 4);", "}else{", "fill_rectangle(VAR_0->mvd_cache[VAR_22][ scan8[0] + 16*VAR_29 ], 4, 2, 8, 0, 2);", "fill_rectangle(VAR_0-> mv_cache[VAR_22][ scan8[0] + 16*VAR_29 ], 4, 2, 8, 0, 4);", "}", "}", "}", "}else{", "assert(IS_8X16(VAR_2));", "for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){", "for(VAR_29=0; VAR_29<2; VAR_29++){", "if(IS_DIR(VAR_2, VAR_29, VAR_22)){", "int VAR_21;", "if(VAR_0->ref_count[VAR_22] > 1){", "VAR_21= decode_cabac_mb_ref( VAR_0, VAR_22, 4*VAR_29 );", "if(VAR_21 >= (unsigned)VAR_0->ref_count[VAR_22]){", "av_log(s->avctx, AV_LOG_ERROR, \"Reference %d >= %d\\n\", VAR_21, VAR_0->ref_count[VAR_22]);", "}", "}else", "VAR_21=0;", "fill_rectangle(&VAR_0->ref_cache[VAR_22][ scan8[0] + 2*VAR_29 ], 2, 4, 8, VAR_21, 1);", "}else", "fill_rectangle(&VAR_0->ref_cache[VAR_22][ scan8[0] + 2*VAR_29 ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1);", "}", "}", "for(VAR_22=0; VAR_22<VAR_0->list_count; VAR_22++){", "for(VAR_29=0; VAR_29<2; VAR_29++){", "if(IS_DIR(VAR_2, VAR_29, VAR_22)){", "int mx,my,mpx,mpy;", "pred_8x16_motion(VAR_0, VAR_29*4, VAR_22, VAR_0->ref_cache[VAR_22][ scan8[0] + 2*VAR_29 ], &mx, &my);", "DECODE_CABAC_MB_MVD( VAR_0, VAR_22, 4*VAR_29)\ntprintf(s->avctx, \"final mv:%d %d\\n\", mx, my);", "fill_rectangle(VAR_0->mvd_cache[VAR_22][ scan8[0] + 2*VAR_29 ], 2, 4, 8, pack8to16(mpx,mpy), 2);", "fill_rectangle(VAR_0->mv_cache[VAR_22][ scan8[0] + 2*VAR_29 ], 2, 4, 8, pack16to32(mx,my), 4);", "}else{", "fill_rectangle(VAR_0->mvd_cache[VAR_22][ scan8[0] + 2*VAR_29 ], 2, 4, 8, 0, 2);", "fill_rectangle(VAR_0-> mv_cache[VAR_22][ scan8[0] + 2*VAR_29 ], 2, 4, 8, 0, 4);", "}", "}", "}", "}", "}", "if( IS_INTER( VAR_2 ) ) {", "VAR_0->chroma_pred_mode_table[VAR_1] = 0;", "write_back_motion( VAR_0, VAR_2 );", "}", "if( !IS_INTRA16x16( VAR_2 ) ) {", "VAR_4 = decode_cabac_mb_cbp_luma( VAR_0 );", "if(VAR_6)\nVAR_4 |= decode_cabac_mb_cbp_chroma( VAR_0 ) << 4;", "}", "VAR_0->cbp_table[VAR_1] = VAR_0->VAR_4 = VAR_4;", "if( VAR_5 && (VAR_4&15) && !IS_INTRA( VAR_2 ) ) {", "VAR_2 |= MB_TYPE_8x8DCT * get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[399 + VAR_0->neighbor_transform_size] );", "}", "if (CHROMA444 && IS_8x8DCT(VAR_2)){", "int VAR_29;", "uint8_t *nnz_cache = VAR_0->non_zero_count_cache;", "for (VAR_29 = 0; VAR_29 < 2; VAR_29++){", "if (VAR_0->left_type[LEFT(VAR_29)] && !IS_8x8DCT(VAR_0->left_type[LEFT(VAR_29)])){", "nnz_cache[3+8* 1 + 2*8*VAR_29]=\nnnz_cache[3+8* 2 + 2*8*VAR_29]=\nnnz_cache[3+8* 6 + 2*8*VAR_29]=\nnnz_cache[3+8* 7 + 2*8*VAR_29]=\nnnz_cache[3+8*11 + 2*8*VAR_29]=\nnnz_cache[3+8*12 + 2*8*VAR_29]= IS_INTRA(VAR_2) ? 64 : 0;", "}", "}", "if (VAR_0->top_type && !IS_8x8DCT(VAR_0->top_type)){", "uint32_t top_empty = CABAC && !IS_INTRA(VAR_2) ? 0 : 0x40404040;", "AV_WN32A(&nnz_cache[4+8* 0], top_empty);", "AV_WN32A(&nnz_cache[4+8* 5], top_empty);", "AV_WN32A(&nnz_cache[4+8*10], top_empty);", "}", "}", "s->current_picture.f.VAR_2[VAR_1] = VAR_2;", "if( VAR_4 || IS_INTRA16x16( VAR_2 ) ) {", "const uint8_t *VAR_22, *scan8x8;", "const uint32_t *VAR_23;", "if(IS_INTERLACED(VAR_2)){", "scan8x8= s->qscale ? VAR_0->field_scan8x8 : VAR_0->field_scan8x8_q0;", "VAR_22= s->qscale ? VAR_0->field_scan : VAR_0->field_scan_q0;", "}else{", "scan8x8= s->qscale ? VAR_0->zigzag_scan8x8 : VAR_0->zigzag_scan8x8_q0;", "VAR_22= s->qscale ? VAR_0->zigzag_scan : VAR_0->zigzag_scan_q0;", "}", "if(get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[60 + (VAR_0->last_qscale_diff != 0)])){", "int VAR_24 = 1;", "int VAR_25= 2;", "const int VAR_25 = 51 + 6*(VAR_0->sps.bit_depth_luma-8);", "while( get_cabac_noinline( &VAR_0->cabac, &VAR_0->cabac_state[60 + VAR_25] ) ) {", "VAR_25= 3;", "VAR_24++;", "if(VAR_24 > 2*VAR_25){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"cabac decode of qscale diff failed at %d %d\\n\", s->mb_x, s->mb_y);", "}", "}", "if( VAR_24&0x01 )\nVAR_24= (VAR_24 + 1)>>1 ;", "else\nVAR_24= -((VAR_24 + 1)>>1);", "VAR_0->last_qscale_diff = VAR_24;", "s->qscale += VAR_24;", "if(((unsigned)s->qscale) > VAR_25){", "if(s->qscale<0) s->qscale+= VAR_25+1;", "else s->qscale-= VAR_25+1;", "}", "VAR_0->chroma_qp[0] = get_chroma_qp(VAR_0, 0, s->qscale);", "VAR_0->chroma_qp[1] = get_chroma_qp(VAR_0, 1, s->qscale);", "}else", "VAR_0->last_qscale_diff=0;", "decode_cabac_luma_residual(VAR_0, VAR_22, scan8x8, VAR_7, VAR_2, VAR_4, 0);", "if(CHROMA444){", "decode_cabac_luma_residual(VAR_0, VAR_22, scan8x8, VAR_7, VAR_2, VAR_4, 1);", "decode_cabac_luma_residual(VAR_0, VAR_22, scan8x8, VAR_7, VAR_2, VAR_4, 2);", "} else if (CHROMA422) {", "if( VAR_4&0x30 ){", "int VAR_29;", "for( VAR_29 = 0; VAR_29 < 2; VAR_29++ ) {", "decode_cabac_residual_dc_422(VAR_0, VAR_0->mb + ((256 + 16*16*VAR_29) << VAR_7), 3,\nCHROMA_DC_BLOCK_INDEX + VAR_29,\nchroma422_dc_scan, 8);", "}", "}", "if( VAR_4&0x20 ) {", "int VAR_29, VAR_29, VAR_27;", "for( VAR_29 = 0; VAR_29 < 2; VAR_29++ ) {", "DCTELEM *mb = VAR_0->mb + (16*(16 + 16*VAR_29) << VAR_7);", "VAR_23 = VAR_0->dequant4_coeff[VAR_29+1+(IS_INTRA( VAR_2 ) ? 0:3)][VAR_0->chroma_qp[VAR_29]];", "for (VAR_27 = 0; VAR_27 < 2; VAR_27++) {", "for (VAR_29 = 0; VAR_29 < 4; VAR_29++) {", "const int VAR_29 = 16 + 16 * VAR_29 + 8*VAR_27 + VAR_29;", "decode_cabac_residual_nondc(VAR_0, mb, 4, VAR_29, VAR_22 + 1, VAR_23, 15);", "mb += 16<<VAR_7;", "}", "}", "}", "} else {", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);", "}", "} else {", "if( VAR_4&0x30 ){", "int VAR_29;", "for( VAR_29 = 0; VAR_29 < 2; VAR_29++ ) {", "decode_cabac_residual_dc(VAR_0, VAR_0->mb + ((256 + 16*16*VAR_29) << VAR_7), 3, CHROMA_DC_BLOCK_INDEX+VAR_29, chroma_dc_scan, 4);", "}", "}", "if( VAR_4&0x20 ) {", "int VAR_29, VAR_29;", "for( VAR_29 = 0; VAR_29 < 2; VAR_29++ ) {", "VAR_23 = VAR_0->dequant4_coeff[VAR_29+1+(IS_INTRA( VAR_2 ) ? 0:3)][VAR_0->chroma_qp[VAR_29]];", "for( VAR_29 = 0; VAR_29 < 4; VAR_29++ ) {", "const int VAR_29 = 16 + 16 * VAR_29 + VAR_29;", "decode_cabac_residual_nondc(VAR_0, VAR_0->mb + (16*VAR_29 << VAR_7), 4, VAR_29, VAR_22 + 1, VAR_23, 15);", "}", "}", "} else {", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);", "}", "}", "} else {", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1);", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);", "VAR_0->last_qscale_diff = 0;", "}", "s->current_picture.f.qscale_table[VAR_1] = s->qscale;", "write_back_non_zero_count(VAR_0);", "if(MB_MBAFF){", "VAR_0->ref_count[0] >>= 1;", "VAR_0->ref_count[1] >>= 1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29, 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79, 81 ], [ 83 ], [ 87 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 103, 105 ], [ 107, 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219, 221 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 261 ], [ 265 ], [ 271 ], [ 273 ], [ 277 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 303 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357, 359 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393, 395 ], [ 397 ], [ 399, 401, 403, 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 446 ], [ 448 ], [ 450 ], [ 452 ], [ 454 ], [ 456 ], [ 458, 460 ], [ 462 ], [ 464 ], [ 468, 470 ], [ 474 ], [ 476 ], [ 478 ], [ 480 ], [ 482 ], [ 484 ], [ 486 ], [ 490 ], [ 492 ], [ 494 ], [ 496 ], [ 498 ], [ 500 ], [ 502 ], [ 504 ], [ 506 ], [ 508 ], [ 510, 512 ], [ 516 ], [ 518, 520 ], [ 522, 524 ], [ 528, 530 ], [ 532, 534 ], [ 536 ], [ 538 ], [ 540 ], [ 544 ], [ 546 ], [ 548 ], [ 550 ], [ 552 ], [ 556 ], [ 558 ], [ 560 ], [ 562 ], [ 564 ], [ 568 ], [ 570 ], [ 572 ], [ 574 ], [ 576 ], [ 578 ], [ 580 ], [ 582 ], [ 584 ], [ 586 ], [ 588 ], [ 590 ], [ 592 ], [ 594 ], [ 596 ], [ 598 ], [ 600 ], [ 602 ], [ 604 ], [ 606 ], [ 608 ], [ 610 ], [ 612 ], [ 614 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637, 639 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 669 ], [ 672 ], [ 674 ], [ 676 ], [ 678 ], [ 680 ], [ 682 ], [ 684 ], [ 686 ], [ 688 ], [ 690 ], [ 692 ], [ 694 ], [ 696 ], [ 698, 700 ], [ 704 ], [ 706 ], [ 708 ], [ 710 ], [ 712 ], [ 714 ], [ 716 ], [ 718 ], [ 720 ], [ 722 ], [ 724 ], [ 726 ], [ 728 ], [ 730 ], [ 732 ], [ 734 ], [ 736 ], [ 738 ], [ 741 ], [ 743 ], [ 745 ], [ 747 ], [ 749 ], [ 751 ], [ 753 ], [ 755 ], [ 757 ], [ 759 ], [ 761 ], [ 763 ], [ 765 ], [ 767, 771 ], [ 773 ], [ 775 ], [ 777 ], [ 779 ], [ 781 ], [ 783 ], [ 785 ], [ 787 ], [ 789 ], [ 791 ], [ 795 ], [ 797 ], [ 799 ], [ 801 ], [ 805 ], [ 807 ], [ 809, 811 ], [ 813 ], [ 817 ], [ 821 ], [ 823 ], [ 825 ], [ 833 ], [ 835 ], [ 837 ], [ 839 ], [ 841 ], [ 843, 845, 847, 849, 851, 853 ], [ 855 ], [ 857 ], [ 859 ], [ 861 ], [ 863 ], [ 865 ], [ 867 ], [ 869 ], [ 871 ], [ 873 ], [ 877 ], [ 879 ], [ 881 ], [ 885 ], [ 887 ], [ 889 ], [ 891 ], [ 893 ], [ 895 ], [ 897 ], [ 903 ], [ 905 ], [ 907 ], [ 909 ], [ 913 ], [ 915 ], [ 917 ], [ 919 ], [ 921 ], [ 924 ], [ 926 ], [ 930, 932 ], [ 934, 936 ], [ 938 ], [ 940 ], [ 942 ], [ 944 ], [ 946 ], [ 948 ], [ 950 ], [ 952 ], [ 954 ], [ 956 ], [ 960 ], [ 962 ], [ 964 ], [ 966 ], [ 968 ], [ 970 ], [ 972 ], [ 974 ], [ 978, 980, 982 ], [ 984 ], [ 986 ], [ 990 ], [ 992 ], [ 994 ], [ 996 ], [ 998 ], [ 1000 ], [ 1002 ], [ 1004 ], [ 1008 ], [ 1010 ], [ 1012 ], [ 1014 ], [ 1016 ], [ 1018 ], [ 1020 ], [ 1022 ], [ 1024 ], [ 1026 ], [ 1028 ], [ 1030 ], [ 1032 ], [ 1036 ], [ 1038 ], [ 1040 ], [ 1044 ], [ 1046 ], [ 1048 ], [ 1050 ], [ 1052 ], [ 1054 ], [ 1058 ], [ 1060 ], [ 1062 ], [ 1064 ], [ 1066 ], [ 1068 ], [ 1070 ], [ 1072 ], [ 1074 ], [ 1076 ], [ 1078 ], [ 1080 ], [ 1082 ], [ 1084 ], [ 1088 ], [ 1090 ], [ 1094 ], [ 1096 ], [ 1098 ], [ 1100 ], [ 1104 ], [ 1106 ] ]
20,717
static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, unsigned src_size) { const uint8_t *s = src; const uint8_t *end; #ifdef HAVE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; end = s + src_size; #ifdef HAVE_MMX mm_end = end - 15; #if 1 //is faster only if multiplies are reasonable fast (FIXME figure out on which cpus this is faster, on Athlon its slightly faster) asm volatile( "movq %3, %%mm5 \n\t" "movq %4, %%mm6 \n\t" "movq %5, %%mm7 \n\t" ".balign 16 \n\t" "1: \n\t" PREFETCH" 32(%1) \n\t" "movd (%1), %%mm0 \n\t" "movd 4(%1), %%mm3 \n\t" "punpckldq 8(%1), %%mm0 \n\t" "punpckldq 12(%1), %%mm3 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm3, %%mm4 \n\t" "pand %%mm6, %%mm0 \n\t" "pand %%mm6, %%mm3 \n\t" "pmaddwd %%mm7, %%mm0 \n\t" "pmaddwd %%mm7, %%mm3 \n\t" "pand %%mm5, %%mm1 \n\t" "pand %%mm5, %%mm4 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "psrld $6, %%mm0 \n\t" "pslld $10, %%mm3 \n\t" "por %%mm3, %%mm0 \n\t" MOVNTQ" %%mm0, (%0) \n\t" "add $16, %1 \n\t" "add $8, %0 \n\t" "cmp %2, %1 \n\t" " jb 1b \n\t" : "+r" (d), "+r"(s) : "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215) ); #else __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm __volatile( "movq %0, %%mm7\n\t" "movq %1, %%mm6\n\t" ::"m"(red_15mask),"m"(green_15mask)); while(s < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movd %1, %%mm0\n\t" "movd 4%1, %%mm3\n\t" "punpckldq 8%1, %%mm0\n\t" "punpckldq 12%1, %%mm3\n\t" "movq %%mm0, %%mm1\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm3, %%mm4\n\t" "movq %%mm3, %%mm5\n\t" "psrlq $3, %%mm0\n\t" "psrlq $3, %%mm3\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm3\n\t" "psrlq $6, %%mm1\n\t" "psrlq $6, %%mm4\n\t" "pand %%mm6, %%mm1\n\t" "pand %%mm6, %%mm4\n\t" "psrlq $9, %%mm2\n\t" "psrlq $9, %%mm5\n\t" "pand %%mm7, %%mm2\n\t" "pand %%mm7, %%mm5\n\t" "por %%mm1, %%mm0\n\t" "por %%mm4, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "por %%mm5, %%mm3\n\t" "psllq $16, %%mm3\n\t" "por %%mm3, %%mm0\n\t" MOVNTQ" %%mm0, %0\n\t" :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory"); d += 4; s += 16; } #endif __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(s < end) { // FIXME on bigendian const int src= *s; s += 4; *d++ = ((src&0xFF)>>3) + ((src&0xF800)>>6) + ((src&0xF80000)>>9); } }
true
FFmpeg
7f526efd17973ec6d2204f7a47b6923e2be31363
static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, unsigned src_size) { const uint8_t *s = src; const uint8_t *end; #ifdef HAVE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; end = s + src_size; #ifdef HAVE_MMX mm_end = end - 15; #if 1 asm volatile( "movq %3, %%mm5 \n\t" "movq %4, %%mm6 \n\t" "movq %5, %%mm7 \n\t" ".balign 16 \n\t" "1: \n\t" PREFETCH" 32(%1) \n\t" "movd (%1), %%mm0 \n\t" "movd 4(%1), %%mm3 \n\t" "punpckldq 8(%1), %%mm0 \n\t" "punpckldq 12(%1), %%mm3 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm3, %%mm4 \n\t" "pand %%mm6, %%mm0 \n\t" "pand %%mm6, %%mm3 \n\t" "pmaddwd %%mm7, %%mm0 \n\t" "pmaddwd %%mm7, %%mm3 \n\t" "pand %%mm5, %%mm1 \n\t" "pand %%mm5, %%mm4 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "psrld $6, %%mm0 \n\t" "pslld $10, %%mm3 \n\t" "por %%mm3, %%mm0 \n\t" MOVNTQ" %%mm0, (%0) \n\t" "add $16, %1 \n\t" "add $8, %0 \n\t" "cmp %2, %1 \n\t" " jb 1b \n\t" : "+r" (d), "+r"(s) : "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215) ); #else __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm __volatile( "movq %0, %%mm7\n\t" "movq %1, %%mm6\n\t" ::"m"(red_15mask),"m"(green_15mask)); while(s < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movd %1, %%mm0\n\t" "movd 4%1, %%mm3\n\t" "punpckldq 8%1, %%mm0\n\t" "punpckldq 12%1, %%mm3\n\t" "movq %%mm0, %%mm1\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm3, %%mm4\n\t" "movq %%mm3, %%mm5\n\t" "psrlq $3, %%mm0\n\t" "psrlq $3, %%mm3\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm3\n\t" "psrlq $6, %%mm1\n\t" "psrlq $6, %%mm4\n\t" "pand %%mm6, %%mm1\n\t" "pand %%mm6, %%mm4\n\t" "psrlq $9, %%mm2\n\t" "psrlq $9, %%mm5\n\t" "pand %%mm7, %%mm2\n\t" "pand %%mm7, %%mm5\n\t" "por %%mm1, %%mm0\n\t" "por %%mm4, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "por %%mm5, %%mm3\n\t" "psllq $16, %%mm3\n\t" "por %%mm3, %%mm0\n\t" MOVNTQ" %%mm0, %0\n\t" :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory"); d += 4; s += 16; } #endif __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(s < end) { const int src= *s; s += 4; *d++ = ((src&0xFF)>>3) + ((src&0xF800)>>6) + ((src&0xF80000)>>9); } }
{ "code": [ "static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, unsigned src_size)" ], "line_no": [ 1 ] }
static inline void FUNC_0(rgb32to15)(const uint8_t *VAR_2, uint8_t *dst, unsigned src_size) { const uint8_t *VAR_0 = VAR_2; const uint8_t *VAR_1; #ifdef HAVE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; VAR_1 = VAR_0 + src_size; #ifdef HAVE_MMX mm_end = VAR_1 - 15; #if 1 asm volatile( "movq %3, %%mm5 \n\t" "movq %4, %%mm6 \n\t" "movq %5, %%mm7 \n\t" ".balign 16 \n\t" "1: \n\t" PREFETCH" 32(%1) \n\t" "movd (%1), %%mm0 \n\t" "movd 4(%1), %%mm3 \n\t" "punpckldq 8(%1), %%mm0 \n\t" "punpckldq 12(%1), %%mm3 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm3, %%mm4 \n\t" "pand %%mm6, %%mm0 \n\t" "pand %%mm6, %%mm3 \n\t" "pmaddwd %%mm7, %%mm0 \n\t" "pmaddwd %%mm7, %%mm3 \n\t" "pand %%mm5, %%mm1 \n\t" "pand %%mm5, %%mm4 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "psrld $6, %%mm0 \n\t" "pslld $10, %%mm3 \n\t" "por %%mm3, %%mm0 \n\t" MOVNTQ" %%mm0, (%0) \n\t" "add $16, %1 \n\t" "add $8, %0 \n\t" "cmp %2, %1 \n\t" " jb 1b \n\t" : "+r" (d), "+r"(VAR_0) : "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215) ); #else __asm __volatile(PREFETCH" %0"::"m"(*VAR_2):"memory"); __asm __volatile( "movq %0, %%mm7\n\t" "movq %1, %%mm6\n\t" ::"m"(red_15mask),"m"(green_15mask)); while(VAR_0 < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movd %1, %%mm0\n\t" "movd 4%1, %%mm3\n\t" "punpckldq 8%1, %%mm0\n\t" "punpckldq 12%1, %%mm3\n\t" "movq %%mm0, %%mm1\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm3, %%mm4\n\t" "movq %%mm3, %%mm5\n\t" "psrlq $3, %%mm0\n\t" "psrlq $3, %%mm3\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm3\n\t" "psrlq $6, %%mm1\n\t" "psrlq $6, %%mm4\n\t" "pand %%mm6, %%mm1\n\t" "pand %%mm6, %%mm4\n\t" "psrlq $9, %%mm2\n\t" "psrlq $9, %%mm5\n\t" "pand %%mm7, %%mm2\n\t" "pand %%mm7, %%mm5\n\t" "por %%mm1, %%mm0\n\t" "por %%mm4, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "por %%mm5, %%mm3\n\t" "psllq $16, %%mm3\n\t" "por %%mm3, %%mm0\n\t" MOVNTQ" %%mm0, %0\n\t" :"=m"(*d):"m"(*VAR_0),"m"(blue_15mask):"memory"); d += 4; VAR_0 += 16; } #endif __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(VAR_0 < VAR_1) { const int VAR_2= *VAR_0; VAR_0 += 4; *d++ = ((VAR_2&0xFF)>>3) + ((VAR_2&0xF800)>>6) + ((VAR_2&0xF80000)>>9); } }
[ "static inline void FUNC_0(rgb32to15)(const uint8_t *VAR_2, uint8_t *dst, unsigned src_size)\n{", "const uint8_t *VAR_0 = VAR_2;", "const uint8_t *VAR_1;", "#ifdef HAVE_MMX\nconst uint8_t *mm_end;", "#endif\nuint16_t *d = (uint16_t *)dst;", "VAR_1 = VAR_0 + src_size;", "#ifdef HAVE_MMX\nmm_end = VAR_1 - 15;", "#if 1\nasm volatile(\n\"movq %3, %%mm5\t\t\t\\n\\t\"\n\"movq %4, %%mm6\t\t\t\\n\\t\"\n\"movq %5, %%mm7\t\t\t\\n\\t\"\n\".balign 16\t\t\t\\n\\t\"\n\"1:\t\t\t\t\\n\\t\"\nPREFETCH\" 32(%1)\t\t\\n\\t\"\n\"movd\t(%1), %%mm0\t\t\\n\\t\"\n\"movd\t4(%1), %%mm3\t\t\\n\\t\"\n\"punpckldq 8(%1), %%mm0\t\t\\n\\t\"\n\"punpckldq 12(%1), %%mm3\t\\n\\t\"\n\"movq %%mm0, %%mm1\t\t\\n\\t\"\n\"movq %%mm3, %%mm4\t\t\\n\\t\"\n\"pand %%mm6, %%mm0\t\t\\n\\t\"\n\"pand %%mm6, %%mm3\t\t\\n\\t\"\n\"pmaddwd %%mm7, %%mm0\t\t\\n\\t\"\n\"pmaddwd %%mm7, %%mm3\t\t\\n\\t\"\n\"pand %%mm5, %%mm1\t\t\\n\\t\"\n\"pand %%mm5, %%mm4\t\t\\n\\t\"\n\"por %%mm1, %%mm0\t\t\\n\\t\"\n\"por %%mm4, %%mm3\t\t\\n\\t\"\n\"psrld $6, %%mm0\t\t\\n\\t\"\n\"pslld $10, %%mm3\t\t\\n\\t\"\n\"por %%mm3, %%mm0\t\t\\n\\t\"\nMOVNTQ\"\t%%mm0, (%0)\t\t\\n\\t\"\n\"add $16, %1\t\t\t\\n\\t\"\n\"add $8, %0\t\t\t\\n\\t\"\n\"cmp %2, %1\t\t\t\\n\\t\"\n\" jb 1b\t\t\t\t\\n\\t\"\n: \"+r\" (d), \"+r\"(VAR_0)\n: \"r\" (mm_end), \"m\" (mask3215g), \"m\" (mask3216br), \"m\" (mul3215)\n);", "#else\n__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*VAR_2):\"memory\");", "__asm __volatile(\n\"movq\t%0, %%mm7\\n\\t\"\n\"movq\t%1, %%mm6\\n\\t\"\n::\"m\"(red_15mask),\"m\"(green_15mask));", "while(VAR_0 < mm_end)\n{", "__asm __volatile(\nPREFETCH\" 32%1\\n\\t\"\n\"movd\t%1, %%mm0\\n\\t\"\n\"movd\t4%1, %%mm3\\n\\t\"\n\"punpckldq 8%1, %%mm0\\n\\t\"\n\"punpckldq 12%1, %%mm3\\n\\t\"\n\"movq\t%%mm0, %%mm1\\n\\t\"\n\"movq\t%%mm0, %%mm2\\n\\t\"\n\"movq\t%%mm3, %%mm4\\n\\t\"\n\"movq\t%%mm3, %%mm5\\n\\t\"\n\"psrlq\t$3, %%mm0\\n\\t\"\n\"psrlq\t$3, %%mm3\\n\\t\"\n\"pand\t%2, %%mm0\\n\\t\"\n\"pand\t%2, %%mm3\\n\\t\"\n\"psrlq\t$6, %%mm1\\n\\t\"\n\"psrlq\t$6, %%mm4\\n\\t\"\n\"pand\t%%mm6, %%mm1\\n\\t\"\n\"pand\t%%mm6, %%mm4\\n\\t\"\n\"psrlq\t$9, %%mm2\\n\\t\"\n\"psrlq\t$9, %%mm5\\n\\t\"\n\"pand\t%%mm7, %%mm2\\n\\t\"\n\"pand\t%%mm7, %%mm5\\n\\t\"\n\"por\t%%mm1, %%mm0\\n\\t\"\n\"por\t%%mm4, %%mm3\\n\\t\"\n\"por\t%%mm2, %%mm0\\n\\t\"\n\"por\t%%mm5, %%mm3\\n\\t\"\n\"psllq\t$16, %%mm3\\n\\t\"\n\"por\t%%mm3, %%mm0\\n\\t\"\nMOVNTQ\"\t%%mm0, %0\\n\\t\"\n:\"=m\"(*d):\"m\"(*VAR_0),\"m\"(blue_15mask):\"memory\");", "d += 4;", "VAR_0 += 16;", "}", "#endif\n__asm __volatile(SFENCE:::\"memory\");", "__asm __volatile(EMMS:::\"memory\");", "#endif\nwhile(VAR_0 < VAR_1)\n{", "const int VAR_2= *VAR_0; VAR_0 += 4;", "*d++ = ((VAR_2&0xFF)>>3) + ((VAR_2&0xF800)>>6) + ((VAR_2&0xF80000)>>9);", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13, 15 ], [ 17 ], [ 19, 21 ], [ 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87 ], [ 89, 91 ], [ 93, 95, 97, 99 ], [ 101, 103 ], [ 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177, 179, 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ] ]
20,718
static int mov_write_trailer(AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; AVIOContext *pb = s->pb; int res = 0; int i; int64_t moov_pos = avio_tell(pb); if (!(mov->flags & FF_MOV_FLAG_FRAGMENT)) { /* Write size of mdat tag */ if (mov->mdat_size + 8 <= UINT32_MAX) { avio_seek(pb, mov->mdat_pos, SEEK_SET); avio_wb32(pb, mov->mdat_size + 8); } else { /* overwrite 'wide' placeholder atom */ avio_seek(pb, mov->mdat_pos - 8, SEEK_SET); /* special value: real atom size will be 64 bit value after * tag field */ avio_wb32(pb, 1); ffio_wfourcc(pb, "mdat"); avio_wb64(pb, mov->mdat_size + 16); } avio_seek(pb, mov->reserved_moov_size ? mov->reserved_moov_pos : moov_pos, SEEK_SET); mov_write_moov_tag(pb, mov, s); if(mov->reserved_moov_size){ int64_t size= mov->reserved_moov_size - (avio_tell(pb) - mov->reserved_moov_pos); if(size < 8){ av_log(s, AV_LOG_ERROR, "reserved_moov_size is too small, needed %"PRId64" additional\n", 8-size); return -1; } avio_wb32(pb, size); ffio_wfourcc(pb, "free"); for(i=0; i<size; i++) avio_w8(pb, 0); avio_seek(pb, moov_pos, SEEK_SET); } } else { mov_flush_fragment(s); mov_write_mfra_tag(pb, mov); } if (mov->chapter_track) av_freep(&mov->tracks[mov->chapter_track].enc); for (i=0; i<mov->nb_streams; i++) { if (mov->tracks[i].tag == MKTAG('r','t','p',' ')) ff_mov_close_hinting(&mov->tracks[i]); else if (mov->tracks[i].tag == MKTAG('t','m','c','d')) av_freep(&mov->tracks[i].enc); if (mov->flags & FF_MOV_FLAG_FRAGMENT && mov->tracks[i].vc1_info.struct_offset && s->pb->seekable) { int64_t off = avio_tell(pb); uint8_t buf[7]; if (mov_write_dvc1_structs(&mov->tracks[i], buf) >= 0) { avio_seek(pb, mov->tracks[i].vc1_info.struct_offset, SEEK_SET); avio_write(pb, buf, 7); avio_seek(pb, off, SEEK_SET); } } av_freep(&mov->tracks[i].cluster); av_freep(&mov->tracks[i].frag_info); if (mov->tracks[i].vos_len) av_free(mov->tracks[i].vos_data); } avio_flush(pb); av_freep(&mov->tracks); return res; }
true
FFmpeg
bc426827492f6c741608af37e2eaab6c8072815d
static int mov_write_trailer(AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; AVIOContext *pb = s->pb; int res = 0; int i; int64_t moov_pos = avio_tell(pb); if (!(mov->flags & FF_MOV_FLAG_FRAGMENT)) { if (mov->mdat_size + 8 <= UINT32_MAX) { avio_seek(pb, mov->mdat_pos, SEEK_SET); avio_wb32(pb, mov->mdat_size + 8); } else { avio_seek(pb, mov->mdat_pos - 8, SEEK_SET); avio_wb32(pb, 1); ffio_wfourcc(pb, "mdat"); avio_wb64(pb, mov->mdat_size + 16); } avio_seek(pb, mov->reserved_moov_size ? mov->reserved_moov_pos : moov_pos, SEEK_SET); mov_write_moov_tag(pb, mov, s); if(mov->reserved_moov_size){ int64_t size= mov->reserved_moov_size - (avio_tell(pb) - mov->reserved_moov_pos); if(size < 8){ av_log(s, AV_LOG_ERROR, "reserved_moov_size is too small, needed %"PRId64" additional\n", 8-size); return -1; } avio_wb32(pb, size); ffio_wfourcc(pb, "free"); for(i=0; i<size; i++) avio_w8(pb, 0); avio_seek(pb, moov_pos, SEEK_SET); } } else { mov_flush_fragment(s); mov_write_mfra_tag(pb, mov); } if (mov->chapter_track) av_freep(&mov->tracks[mov->chapter_track].enc); for (i=0; i<mov->nb_streams; i++) { if (mov->tracks[i].tag == MKTAG('r','t','p',' ')) ff_mov_close_hinting(&mov->tracks[i]); else if (mov->tracks[i].tag == MKTAG('t','m','c','d')) av_freep(&mov->tracks[i].enc); if (mov->flags & FF_MOV_FLAG_FRAGMENT && mov->tracks[i].vc1_info.struct_offset && s->pb->seekable) { int64_t off = avio_tell(pb); uint8_t buf[7]; if (mov_write_dvc1_structs(&mov->tracks[i], buf) >= 0) { avio_seek(pb, mov->tracks[i].vc1_info.struct_offset, SEEK_SET); avio_write(pb, buf, 7); avio_seek(pb, off, SEEK_SET); } } av_freep(&mov->tracks[i].cluster); av_freep(&mov->tracks[i].frag_info); if (mov->tracks[i].vos_len) av_free(mov->tracks[i].vos_data); } avio_flush(pb); av_freep(&mov->tracks); return res; }
{ "code": [ " else if (mov->tracks[i].tag == MKTAG('t','m','c','d'))" ], "line_no": [ 99 ] }
static int FUNC_0(AVFormatContext *VAR_0) { MOVMuxContext *mov = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; int VAR_1 = 0; int VAR_2; int64_t moov_pos = avio_tell(pb); if (!(mov->flags & FF_MOV_FLAG_FRAGMENT)) { if (mov->mdat_size + 8 <= UINT32_MAX) { avio_seek(pb, mov->mdat_pos, SEEK_SET); avio_wb32(pb, mov->mdat_size + 8); } else { avio_seek(pb, mov->mdat_pos - 8, SEEK_SET); avio_wb32(pb, 1); ffio_wfourcc(pb, "mdat"); avio_wb64(pb, mov->mdat_size + 16); } avio_seek(pb, mov->reserved_moov_size ? mov->reserved_moov_pos : moov_pos, SEEK_SET); mov_write_moov_tag(pb, mov, VAR_0); if(mov->reserved_moov_size){ int64_t size= mov->reserved_moov_size - (avio_tell(pb) - mov->reserved_moov_pos); if(size < 8){ av_log(VAR_0, AV_LOG_ERROR, "reserved_moov_size is too small, needed %"PRId64" additional\n", 8-size); return -1; } avio_wb32(pb, size); ffio_wfourcc(pb, "free"); for(VAR_2=0; VAR_2<size; VAR_2++) avio_w8(pb, 0); avio_seek(pb, moov_pos, SEEK_SET); } } else { mov_flush_fragment(VAR_0); mov_write_mfra_tag(pb, mov); } if (mov->chapter_track) av_freep(&mov->tracks[mov->chapter_track].enc); for (VAR_2=0; VAR_2<mov->nb_streams; VAR_2++) { if (mov->tracks[VAR_2].tag == MKTAG('r','t','p',' ')) ff_mov_close_hinting(&mov->tracks[VAR_2]); else if (mov->tracks[VAR_2].tag == MKTAG('t','m','c','d')) av_freep(&mov->tracks[VAR_2].enc); if (mov->flags & FF_MOV_FLAG_FRAGMENT && mov->tracks[VAR_2].vc1_info.struct_offset && VAR_0->pb->seekable) { int64_t off = avio_tell(pb); uint8_t buf[7]; if (mov_write_dvc1_structs(&mov->tracks[VAR_2], buf) >= 0) { avio_seek(pb, mov->tracks[VAR_2].vc1_info.struct_offset, SEEK_SET); avio_write(pb, buf, 7); avio_seek(pb, off, SEEK_SET); } } av_freep(&mov->tracks[VAR_2].cluster); av_freep(&mov->tracks[VAR_2].frag_info); if (mov->tracks[VAR_2].vos_len) av_free(mov->tracks[VAR_2].vos_data); } avio_flush(pb); av_freep(&mov->tracks); return VAR_1; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "MOVMuxContext *mov = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "int VAR_1 = 0;", "int VAR_2;", "int64_t moov_pos = avio_tell(pb);", "if (!(mov->flags & FF_MOV_FLAG_FRAGMENT)) {", "if (mov->mdat_size + 8 <= UINT32_MAX) {", "avio_seek(pb, mov->mdat_pos, SEEK_SET);", "avio_wb32(pb, mov->mdat_size + 8);", "} else {", "avio_seek(pb, mov->mdat_pos - 8, SEEK_SET);", "avio_wb32(pb, 1);", "ffio_wfourcc(pb, \"mdat\");", "avio_wb64(pb, mov->mdat_size + 16);", "}", "avio_seek(pb, mov->reserved_moov_size ? mov->reserved_moov_pos : moov_pos, SEEK_SET);", "mov_write_moov_tag(pb, mov, VAR_0);", "if(mov->reserved_moov_size){", "int64_t size= mov->reserved_moov_size - (avio_tell(pb) - mov->reserved_moov_pos);", "if(size < 8){", "av_log(VAR_0, AV_LOG_ERROR, \"reserved_moov_size is too small, needed %\"PRId64\" additional\\n\", 8-size);", "return -1;", "}", "avio_wb32(pb, size);", "ffio_wfourcc(pb, \"free\");", "for(VAR_2=0; VAR_2<size; VAR_2++)", "avio_w8(pb, 0);", "avio_seek(pb, moov_pos, SEEK_SET);", "}", "} else {", "mov_flush_fragment(VAR_0);", "mov_write_mfra_tag(pb, mov);", "}", "if (mov->chapter_track)\nav_freep(&mov->tracks[mov->chapter_track].enc);", "for (VAR_2=0; VAR_2<mov->nb_streams; VAR_2++) {", "if (mov->tracks[VAR_2].tag == MKTAG('r','t','p',' '))\nff_mov_close_hinting(&mov->tracks[VAR_2]);", "else if (mov->tracks[VAR_2].tag == MKTAG('t','m','c','d'))\nav_freep(&mov->tracks[VAR_2].enc);", "if (mov->flags & FF_MOV_FLAG_FRAGMENT &&\nmov->tracks[VAR_2].vc1_info.struct_offset && VAR_0->pb->seekable) {", "int64_t off = avio_tell(pb);", "uint8_t buf[7];", "if (mov_write_dvc1_structs(&mov->tracks[VAR_2], buf) >= 0) {", "avio_seek(pb, mov->tracks[VAR_2].vc1_info.struct_offset, SEEK_SET);", "avio_write(pb, buf, 7);", "avio_seek(pb, off, SEEK_SET);", "}", "}", "av_freep(&mov->tracks[VAR_2].cluster);", "av_freep(&mov->tracks[VAR_2].frag_info);", "if (mov->tracks[VAR_2].vos_len)\nav_free(mov->tracks[VAR_2].vos_data);", "}", "avio_flush(pb);", "av_freep(&mov->tracks);", "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, 1, 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 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 93 ], [ 95, 97 ], [ 99, 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129, 131 ], [ 135 ], [ 139 ], [ 143 ], [ 147 ], [ 149 ] ]
20,719
static void dvbsub_parse_region_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { DVBSubContext *ctx = avctx->priv_data; const uint8_t *buf_end = buf + buf_size; int region_id, object_id; int av_unused version; DVBSubRegion *region; DVBSubObject *object; DVBSubObjectDisplay *display; int fill; if (buf_size < 10) region_id = *buf++; region = get_region(ctx, region_id); if (!region) { region = av_mallocz(sizeof(DVBSubRegion)); region->id = region_id; region->version = -1; region->next = ctx->region_list; ctx->region_list = region; } version = ((*buf)>>4) & 15; fill = ((*buf++) >> 3) & 1; region->width = AV_RB16(buf); buf += 2; region->height = AV_RB16(buf); buf += 2; if (region->width * region->height != region->buf_size) { av_free(region->pbuf); region->buf_size = region->width * region->height; region->pbuf = av_malloc(region->buf_size); fill = 1; region->dirty = 0; } region->depth = 1 << (((*buf++) >> 2) & 7); if(region->depth<2 || region->depth>8){ av_log(avctx, AV_LOG_ERROR, "region depth %d is invalid\n", region->depth); region->depth= 4; } region->clut = *buf++; if (region->depth == 8) { region->bgcolor = *buf++; buf += 1; } else { buf += 1; if (region->depth == 4) region->bgcolor = (((*buf++) >> 4) & 15); else region->bgcolor = (((*buf++) >> 2) & 3); } av_dlog(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height); if (fill) { memset(region->pbuf, region->bgcolor, region->buf_size); av_dlog(avctx, "Fill region (%d)\n", region->bgcolor); } delete_region_display_list(ctx, region); while (buf + 5 < buf_end) { object_id = AV_RB16(buf); buf += 2; object = get_object(ctx, object_id); if (!object) { object = av_mallocz(sizeof(DVBSubObject)); object->id = object_id; object->next = ctx->object_list; ctx->object_list = object; } object->type = (*buf) >> 6; display = av_mallocz(sizeof(DVBSubObjectDisplay)); display->object_id = object_id; display->region_id = region_id; display->x_pos = AV_RB16(buf) & 0xfff; buf += 2; display->y_pos = AV_RB16(buf) & 0xfff; buf += 2; if ((object->type == 1 || object->type == 2) && buf+1 < buf_end) { display->fgcolor = *buf++; display->bgcolor = *buf++; } display->region_list_next = region->display_list; region->display_list = display; display->object_list_next = object->display_list; object->display_list = display; } }
true
FFmpeg
ebe3a41ea3b93579379b0460338ff511f9749602
static void dvbsub_parse_region_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { DVBSubContext *ctx = avctx->priv_data; const uint8_t *buf_end = buf + buf_size; int region_id, object_id; int av_unused version; DVBSubRegion *region; DVBSubObject *object; DVBSubObjectDisplay *display; int fill; if (buf_size < 10) region_id = *buf++; region = get_region(ctx, region_id); if (!region) { region = av_mallocz(sizeof(DVBSubRegion)); region->id = region_id; region->version = -1; region->next = ctx->region_list; ctx->region_list = region; } version = ((*buf)>>4) & 15; fill = ((*buf++) >> 3) & 1; region->width = AV_RB16(buf); buf += 2; region->height = AV_RB16(buf); buf += 2; if (region->width * region->height != region->buf_size) { av_free(region->pbuf); region->buf_size = region->width * region->height; region->pbuf = av_malloc(region->buf_size); fill = 1; region->dirty = 0; } region->depth = 1 << (((*buf++) >> 2) & 7); if(region->depth<2 || region->depth>8){ av_log(avctx, AV_LOG_ERROR, "region depth %d is invalid\n", region->depth); region->depth= 4; } region->clut = *buf++; if (region->depth == 8) { region->bgcolor = *buf++; buf += 1; } else { buf += 1; if (region->depth == 4) region->bgcolor = (((*buf++) >> 4) & 15); else region->bgcolor = (((*buf++) >> 2) & 3); } av_dlog(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height); if (fill) { memset(region->pbuf, region->bgcolor, region->buf_size); av_dlog(avctx, "Fill region (%d)\n", region->bgcolor); } delete_region_display_list(ctx, region); while (buf + 5 < buf_end) { object_id = AV_RB16(buf); buf += 2; object = get_object(ctx, object_id); if (!object) { object = av_mallocz(sizeof(DVBSubObject)); object->id = object_id; object->next = ctx->object_list; ctx->object_list = object; } object->type = (*buf) >> 6; display = av_mallocz(sizeof(DVBSubObjectDisplay)); display->object_id = object_id; display->region_id = region_id; display->x_pos = AV_RB16(buf) & 0xfff; buf += 2; display->y_pos = AV_RB16(buf) & 0xfff; buf += 2; if ((object->type == 1 || object->type == 2) && buf+1 < buf_end) { display->fgcolor = *buf++; display->bgcolor = *buf++; } display->region_list_next = region->display_list; region->display_list = display; display->object_list_next = object->display_list; object->display_list = display; } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVCodecContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { DVBSubContext *ctx = VAR_0->priv_data; const uint8_t *VAR_3 = VAR_1 + VAR_2; int VAR_4, VAR_5; int VAR_6 version; DVBSubRegion *region; DVBSubObject *object; DVBSubObjectDisplay *display; int VAR_7; if (VAR_2 < 10) VAR_4 = *VAR_1++; region = get_region(ctx, VAR_4); if (!region) { region = av_mallocz(sizeof(DVBSubRegion)); region->id = VAR_4; region->version = -1; region->next = ctx->region_list; ctx->region_list = region; } version = ((*VAR_1)>>4) & 15; VAR_7 = ((*VAR_1++) >> 3) & 1; region->width = AV_RB16(VAR_1); VAR_1 += 2; region->height = AV_RB16(VAR_1); VAR_1 += 2; if (region->width * region->height != region->VAR_2) { av_free(region->pbuf); region->VAR_2 = region->width * region->height; region->pbuf = av_malloc(region->VAR_2); VAR_7 = 1; region->dirty = 0; } region->depth = 1 << (((*VAR_1++) >> 2) & 7); if(region->depth<2 || region->depth>8){ av_log(VAR_0, AV_LOG_ERROR, "region depth %d is invalid\n", region->depth); region->depth= 4; } region->clut = *VAR_1++; if (region->depth == 8) { region->bgcolor = *VAR_1++; VAR_1 += 1; } else { VAR_1 += 1; if (region->depth == 4) region->bgcolor = (((*VAR_1++) >> 4) & 15); else region->bgcolor = (((*VAR_1++) >> 2) & 3); } av_dlog(VAR_0, "Region %d, (%dx%d)\n", VAR_4, region->width, region->height); if (VAR_7) { memset(region->pbuf, region->bgcolor, region->VAR_2); av_dlog(VAR_0, "Fill region (%d)\n", region->bgcolor); } delete_region_display_list(ctx, region); while (VAR_1 + 5 < VAR_3) { VAR_5 = AV_RB16(VAR_1); VAR_1 += 2; object = get_object(ctx, VAR_5); if (!object) { object = av_mallocz(sizeof(DVBSubObject)); object->id = VAR_5; object->next = ctx->object_list; ctx->object_list = object; } object->type = (*VAR_1) >> 6; display = av_mallocz(sizeof(DVBSubObjectDisplay)); display->VAR_5 = VAR_5; display->VAR_4 = VAR_4; display->x_pos = AV_RB16(VAR_1) & 0xfff; VAR_1 += 2; display->y_pos = AV_RB16(VAR_1) & 0xfff; VAR_1 += 2; if ((object->type == 1 || object->type == 2) && VAR_1+1 < VAR_3) { display->fgcolor = *VAR_1++; display->bgcolor = *VAR_1++; } display->region_list_next = region->display_list; region->display_list = display; display->object_list_next = object->display_list; object->display_list = display; } }
[ "static void FUNC_0(AVCodecContext *VAR_0,\nconst uint8_t *VAR_1, int VAR_2)\n{", "DVBSubContext *ctx = VAR_0->priv_data;", "const uint8_t *VAR_3 = VAR_1 + VAR_2;", "int VAR_4, VAR_5;", "int VAR_6 version;", "DVBSubRegion *region;", "DVBSubObject *object;", "DVBSubObjectDisplay *display;", "int VAR_7;", "if (VAR_2 < 10)\nVAR_4 = *VAR_1++;", "region = get_region(ctx, VAR_4);", "if (!region) {", "region = av_mallocz(sizeof(DVBSubRegion));", "region->id = VAR_4;", "region->version = -1;", "region->next = ctx->region_list;", "ctx->region_list = region;", "}", "version = ((*VAR_1)>>4) & 15;", "VAR_7 = ((*VAR_1++) >> 3) & 1;", "region->width = AV_RB16(VAR_1);", "VAR_1 += 2;", "region->height = AV_RB16(VAR_1);", "VAR_1 += 2;", "if (region->width * region->height != region->VAR_2) {", "av_free(region->pbuf);", "region->VAR_2 = region->width * region->height;", "region->pbuf = av_malloc(region->VAR_2);", "VAR_7 = 1;", "region->dirty = 0;", "}", "region->depth = 1 << (((*VAR_1++) >> 2) & 7);", "if(region->depth<2 || region->depth>8){", "av_log(VAR_0, AV_LOG_ERROR, \"region depth %d is invalid\\n\", region->depth);", "region->depth= 4;", "}", "region->clut = *VAR_1++;", "if (region->depth == 8) {", "region->bgcolor = *VAR_1++;", "VAR_1 += 1;", "} else {", "VAR_1 += 1;", "if (region->depth == 4)\nregion->bgcolor = (((*VAR_1++) >> 4) & 15);", "else\nregion->bgcolor = (((*VAR_1++) >> 2) & 3);", "}", "av_dlog(VAR_0, \"Region %d, (%dx%d)\\n\", VAR_4, region->width, region->height);", "if (VAR_7) {", "memset(region->pbuf, region->bgcolor, region->VAR_2);", "av_dlog(VAR_0, \"Fill region (%d)\\n\", region->bgcolor);", "}", "delete_region_display_list(ctx, region);", "while (VAR_1 + 5 < VAR_3) {", "VAR_5 = AV_RB16(VAR_1);", "VAR_1 += 2;", "object = get_object(ctx, VAR_5);", "if (!object) {", "object = av_mallocz(sizeof(DVBSubObject));", "object->id = VAR_5;", "object->next = ctx->object_list;", "ctx->object_list = object;", "}", "object->type = (*VAR_1) >> 6;", "display = av_mallocz(sizeof(DVBSubObjectDisplay));", "display->VAR_5 = VAR_5;", "display->VAR_4 = VAR_4;", "display->x_pos = AV_RB16(VAR_1) & 0xfff;", "VAR_1 += 2;", "display->y_pos = AV_RB16(VAR_1) & 0xfff;", "VAR_1 += 2;", "if ((object->type == 1 || object->type == 2) && VAR_1+1 < VAR_3) {", "display->fgcolor = *VAR_1++;", "display->bgcolor = *VAR_1++;", "}", "display->region_list_next = region->display_list;", "region->display_list = display;", "display->object_list_next = object->display_list;", "object->display_list = display;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27, 32 ], [ 36 ], [ 40 ], [ 42 ], [ 48 ], [ 50 ], [ 54 ], [ 56 ], [ 58 ], [ 62 ], [ 64 ], [ 68 ], [ 70 ], [ 72 ], [ 74 ], [ 78 ], [ 80 ], [ 84 ], [ 88 ], [ 92 ], [ 94 ], [ 96 ], [ 100 ], [ 102 ], [ 104 ], [ 106 ], [ 108 ], [ 110 ], [ 114 ], [ 116 ], [ 118 ], [ 120 ], [ 122 ], [ 126, 128 ], [ 130, 132 ], [ 134 ], [ 138 ], [ 142 ], [ 144 ], [ 146 ], [ 148 ], [ 152 ], [ 156 ], [ 158 ], [ 160 ], [ 164 ], [ 168 ], [ 170 ], [ 174 ], [ 176 ], [ 178 ], [ 180 ], [ 184 ], [ 188 ], [ 192 ], [ 194 ], [ 198 ], [ 200 ], [ 202 ], [ 204 ], [ 208 ], [ 210 ], [ 212 ], [ 214 ], [ 218 ], [ 220 ], [ 224 ], [ 226 ], [ 228 ], [ 230 ] ]
20,721
static int local_link(FsContext *ctx, V9fsPath *oldpath, V9fsPath *dirpath, const char *name) { int ret; V9fsString newpath; char *buffer, *buffer1; int serrno; v9fs_string_init(&newpath); v9fs_string_sprintf(&newpath, "%s/%s", dirpath->data, name); buffer = rpath(ctx, oldpath->data); buffer1 = rpath(ctx, newpath.data); ret = link(buffer, buffer1); g_free(buffer); if (ret < 0) { goto out; } /* now link the virtfs_metadata files */ if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { char *vbuffer, *vbuffer1; /* Link the .virtfs_metadata files. Create the metada directory */ ret = local_create_mapped_attr_dir(ctx, newpath.data); if (ret < 0) { goto err_out; } vbuffer = local_mapped_attr_path(ctx, oldpath->data); vbuffer1 = local_mapped_attr_path(ctx, newpath.data); ret = link(vbuffer, vbuffer1); g_free(vbuffer); g_free(vbuffer1); if (ret < 0 && errno != ENOENT) { goto err_out; } } goto out; err_out: serrno = errno; remove(buffer1); errno = serrno; out: g_free(buffer1); v9fs_string_free(&newpath); return ret; }
true
qemu
ad0b46e6ac769b187cb4dcf0065675ef8a198a5e
static int local_link(FsContext *ctx, V9fsPath *oldpath, V9fsPath *dirpath, const char *name) { int ret; V9fsString newpath; char *buffer, *buffer1; int serrno; v9fs_string_init(&newpath); v9fs_string_sprintf(&newpath, "%s/%s", dirpath->data, name); buffer = rpath(ctx, oldpath->data); buffer1 = rpath(ctx, newpath.data); ret = link(buffer, buffer1); g_free(buffer); if (ret < 0) { goto out; } if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { char *vbuffer, *vbuffer1; ret = local_create_mapped_attr_dir(ctx, newpath.data); if (ret < 0) { goto err_out; } vbuffer = local_mapped_attr_path(ctx, oldpath->data); vbuffer1 = local_mapped_attr_path(ctx, newpath.data); ret = link(vbuffer, vbuffer1); g_free(vbuffer); g_free(vbuffer1); if (ret < 0 && errno != ENOENT) { goto err_out; } } goto out; err_out: serrno = errno; remove(buffer1); errno = serrno; out: g_free(buffer1); v9fs_string_free(&newpath); return ret; }
{ "code": [ " int ret;", " V9fsString newpath;", " char *buffer, *buffer1;", " int serrno;", " v9fs_string_init(&newpath);", " v9fs_string_sprintf(&newpath, \"%s/%s\", dirpath->data, name);", " buffer = rpath(ctx, oldpath->data);", " buffer1 = rpath(ctx, newpath.data);", " ret = link(buffer, buffer1);", " g_free(buffer);", " if (ret < 0) {", " char *vbuffer, *vbuffer1;", " ret = local_create_mapped_attr_dir(ctx, newpath.data);", " if (ret < 0) {", " goto err_out;", " vbuffer = local_mapped_attr_path(ctx, oldpath->data);", " vbuffer1 = local_mapped_attr_path(ctx, newpath.data);", " ret = link(vbuffer, vbuffer1);", " g_free(vbuffer);", " g_free(vbuffer1);", " goto err_out;", " goto out;", "err_out:", " serrno = errno;", " remove(buffer1);", " errno = serrno;", " g_free(buffer1);", " v9fs_string_free(&newpath);" ], "line_no": [ 7, 9, 11, 13, 17, 19, 23, 25, 27, 29, 31, 43, 49, 51, 53, 57, 59, 61, 63, 65, 53, 75, 79, 81, 83, 85, 89, 91 ] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, V9fsPath *VAR_2, const char *VAR_3) { int VAR_4; V9fsString newpath; char *VAR_5, *VAR_6; int VAR_7; v9fs_string_init(&newpath); v9fs_string_sprintf(&newpath, "%s/%s", VAR_2->data, VAR_3); VAR_5 = rpath(VAR_0, VAR_1->data); VAR_6 = rpath(VAR_0, newpath.data); VAR_4 = link(VAR_5, VAR_6); g_free(VAR_5); if (VAR_4 < 0) { goto out; } if (VAR_0->export_flags & V9FS_SM_MAPPED_FILE) { char *VAR_8, *VAR_9; VAR_4 = local_create_mapped_attr_dir(VAR_0, newpath.data); if (VAR_4 < 0) { goto err_out; } VAR_8 = local_mapped_attr_path(VAR_0, VAR_1->data); VAR_9 = local_mapped_attr_path(VAR_0, newpath.data); VAR_4 = link(VAR_8, VAR_9); g_free(VAR_8); g_free(VAR_9); if (VAR_4 < 0 && errno != ENOENT) { goto err_out; } } goto out; err_out: VAR_7 = errno; remove(VAR_6); errno = VAR_7; out: g_free(VAR_6); v9fs_string_free(&newpath); return VAR_4; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,\nV9fsPath *VAR_2, const char *VAR_3)\n{", "int VAR_4;", "V9fsString newpath;", "char *VAR_5, *VAR_6;", "int VAR_7;", "v9fs_string_init(&newpath);", "v9fs_string_sprintf(&newpath, \"%s/%s\", VAR_2->data, VAR_3);", "VAR_5 = rpath(VAR_0, VAR_1->data);", "VAR_6 = rpath(VAR_0, newpath.data);", "VAR_4 = link(VAR_5, VAR_6);", "g_free(VAR_5);", "if (VAR_4 < 0) {", "goto out;", "}", "if (VAR_0->export_flags & V9FS_SM_MAPPED_FILE) {", "char *VAR_8, *VAR_9;", "VAR_4 = local_create_mapped_attr_dir(VAR_0, newpath.data);", "if (VAR_4 < 0) {", "goto err_out;", "}", "VAR_8 = local_mapped_attr_path(VAR_0, VAR_1->data);", "VAR_9 = local_mapped_attr_path(VAR_0, newpath.data);", "VAR_4 = link(VAR_8, VAR_9);", "g_free(VAR_8);", "g_free(VAR_9);", "if (VAR_4 < 0 && errno != ENOENT) {", "goto err_out;", "}", "}", "goto out;", "err_out:\nVAR_7 = errno;", "remove(VAR_6);", "errno = VAR_7;", "out:\ng_free(VAR_6);", "v9fs_string_free(&newpath);", "return VAR_4;", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ] ]
20,723
static int parse_str(StringInputVisitor *siv, const char *name, Error **errp) { char *str = (char *) siv->string; long long start, end; Range *cur; char *endptr; if (siv->ranges) { return 0; } do { errno = 0; start = strtoll(str, &endptr, 0); if (errno == 0 && endptr > str) { if (*endptr == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = start + 1; siv->ranges = g_list_insert_sorted_merged(siv->ranges, cur, range_compare); cur = NULL; str = NULL; } else if (*endptr == '-') { str = endptr + 1; errno = 0; end = strtoll(str, &endptr, 0); if (errno == 0 && endptr > str && start <= end && (start > INT64_MAX - 65536 || end < start + 65536)) { if (*endptr == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = end + 1; siv->ranges = g_list_insert_sorted_merged(siv->ranges, cur, range_compare); cur = NULL; str = NULL; } else if (*endptr == ',') { str = endptr + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = end + 1; siv->ranges = g_list_insert_sorted_merged(siv->ranges, cur, range_compare); cur = NULL; } else { goto error; } } else { goto error; } } else if (*endptr == ',') { str = endptr + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = start + 1; siv->ranges = g_list_insert_sorted_merged(siv->ranges, cur, range_compare); cur = NULL; } else { goto error; } } else { goto error; } } while (str); return 0; error: g_list_foreach(siv->ranges, free_range, NULL); g_list_free(siv->ranges); siv->ranges = NULL; error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "an int64 value or range"); return -1; }
true
qemu
7c47959d0cb05db43014141a156ada0b6d53a750
static int parse_str(StringInputVisitor *siv, const char *name, Error **errp) { char *str = (char *) siv->string; long long start, end; Range *cur; char *endptr; if (siv->ranges) { return 0; } do { errno = 0; start = strtoll(str, &endptr, 0); if (errno == 0 && endptr > str) { if (*endptr == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = start + 1; siv->ranges = g_list_insert_sorted_merged(siv->ranges, cur, range_compare); cur = NULL; str = NULL; } else if (*endptr == '-') { str = endptr + 1; errno = 0; end = strtoll(str, &endptr, 0); if (errno == 0 && endptr > str && start <= end && (start > INT64_MAX - 65536 || end < start + 65536)) { if (*endptr == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = end + 1; siv->ranges = g_list_insert_sorted_merged(siv->ranges, cur, range_compare); cur = NULL; str = NULL; } else if (*endptr == ',') { str = endptr + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = end + 1; siv->ranges = g_list_insert_sorted_merged(siv->ranges, cur, range_compare); cur = NULL; } else { goto error; } } else { goto error; } } else if (*endptr == ',') { str = endptr + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = start + 1; siv->ranges = g_list_insert_sorted_merged(siv->ranges, cur, range_compare); cur = NULL; } else { goto error; } } else { goto error; } } while (str); return 0; error: g_list_foreach(siv->ranges, free_range, NULL); g_list_free(siv->ranges); siv->ranges = NULL; error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "an int64 value or range"); return -1; }
{ "code": [ " return 0;", " siv->ranges = g_list_insert_sorted_merged(siv->ranges, cur,", " range_compare);", " siv->ranges =", " g_list_insert_sorted_merged(siv->ranges,", " cur,", " range_compare);", " siv->ranges =", " g_list_insert_sorted_merged(siv->ranges,", " cur,", " range_compare);", " siv->ranges = g_list_insert_sorted_merged(siv->ranges,", " cur,", " range_compare);" ], "line_no": [ 17, 39, 41, 69, 71, 73, 75, 69, 71, 73, 75, 123, 125, 41 ] }
static int FUNC_0(StringInputVisitor *VAR_0, const char *VAR_1, Error **VAR_2) { char *VAR_3 = (char *) VAR_0->string; long long VAR_4, VAR_5; Range *cur; char *VAR_6; if (VAR_0->ranges) { return 0; } do { errno = 0; VAR_4 = strtoll(VAR_3, &VAR_6, 0); if (errno == 0 && VAR_6 > VAR_3) { if (*VAR_6 == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = VAR_4; cur->VAR_5 = VAR_4 + 1; VAR_0->ranges = g_list_insert_sorted_merged(VAR_0->ranges, cur, range_compare); cur = NULL; VAR_3 = NULL; } else if (*VAR_6 == '-') { VAR_3 = VAR_6 + 1; errno = 0; VAR_5 = strtoll(VAR_3, &VAR_6, 0); if (errno == 0 && VAR_6 > VAR_3 && VAR_4 <= VAR_5 && (VAR_4 > INT64_MAX - 65536 || VAR_5 < VAR_4 + 65536)) { if (*VAR_6 == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = VAR_4; cur->VAR_5 = VAR_5 + 1; VAR_0->ranges = g_list_insert_sorted_merged(VAR_0->ranges, cur, range_compare); cur = NULL; VAR_3 = NULL; } else if (*VAR_6 == ',') { VAR_3 = VAR_6 + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = VAR_4; cur->VAR_5 = VAR_5 + 1; VAR_0->ranges = g_list_insert_sorted_merged(VAR_0->ranges, cur, range_compare); cur = NULL; } else { goto error; } } else { goto error; } } else if (*VAR_6 == ',') { VAR_3 = VAR_6 + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = VAR_4; cur->VAR_5 = VAR_4 + 1; VAR_0->ranges = g_list_insert_sorted_merged(VAR_0->ranges, cur, range_compare); cur = NULL; } else { goto error; } } else { goto error; } } while (VAR_3); return 0; error: g_list_foreach(VAR_0->ranges, free_range, NULL); g_list_free(VAR_0->ranges); VAR_0->ranges = NULL; error_setg(VAR_2, QERR_INVALID_PARAMETER_VALUE, VAR_1 ? VAR_1 : "null", "an int64 value or range"); return -1; }
[ "static int FUNC_0(StringInputVisitor *VAR_0, const char *VAR_1, Error **VAR_2)\n{", "char *VAR_3 = (char *) VAR_0->string;", "long long VAR_4, VAR_5;", "Range *cur;", "char *VAR_6;", "if (VAR_0->ranges) {", "return 0;", "}", "do {", "errno = 0;", "VAR_4 = strtoll(VAR_3, &VAR_6, 0);", "if (errno == 0 && VAR_6 > VAR_3) {", "if (*VAR_6 == '\\0') {", "cur = g_malloc0(sizeof(*cur));", "cur->begin = VAR_4;", "cur->VAR_5 = VAR_4 + 1;", "VAR_0->ranges = g_list_insert_sorted_merged(VAR_0->ranges, cur,\nrange_compare);", "cur = NULL;", "VAR_3 = NULL;", "} else if (*VAR_6 == '-') {", "VAR_3 = VAR_6 + 1;", "errno = 0;", "VAR_5 = strtoll(VAR_3, &VAR_6, 0);", "if (errno == 0 && VAR_6 > VAR_3 && VAR_4 <= VAR_5 &&\n(VAR_4 > INT64_MAX - 65536 ||\nVAR_5 < VAR_4 + 65536)) {", "if (*VAR_6 == '\\0') {", "cur = g_malloc0(sizeof(*cur));", "cur->begin = VAR_4;", "cur->VAR_5 = VAR_5 + 1;", "VAR_0->ranges =\ng_list_insert_sorted_merged(VAR_0->ranges,\ncur,\nrange_compare);", "cur = NULL;", "VAR_3 = NULL;", "} else if (*VAR_6 == ',') {", "VAR_3 = VAR_6 + 1;", "cur = g_malloc0(sizeof(*cur));", "cur->begin = VAR_4;", "cur->VAR_5 = VAR_5 + 1;", "VAR_0->ranges =\ng_list_insert_sorted_merged(VAR_0->ranges,\ncur,\nrange_compare);", "cur = NULL;", "} else {", "goto error;", "}", "} else {", "goto error;", "}", "} else if (*VAR_6 == ',') {", "VAR_3 = VAR_6 + 1;", "cur = g_malloc0(sizeof(*cur));", "cur->begin = VAR_4;", "cur->VAR_5 = VAR_4 + 1;", "VAR_0->ranges = g_list_insert_sorted_merged(VAR_0->ranges,\ncur,\nrange_compare);", "cur = NULL;", "} else {", "goto error;", "}", "} else {", "goto error;", "}", "} while (VAR_3);", "return 0;", "error:\ng_list_foreach(VAR_0->ranges, free_range, NULL);", "g_list_free(VAR_0->ranges);", "VAR_0->ranges = NULL;", "error_setg(VAR_2, QERR_INVALID_PARAMETER_VALUE, VAR_1 ? VAR_1 : \"null\",\n\"an int64 value or range\");", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71, 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93, 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ] ]
20,724
static av_cold int adpcm_encode_init(AVCodecContext *avctx) { ADPCMEncodeContext *s = avctx->priv_data; uint8_t *extradata; int i; if (avctx->channels > 2) return -1; /* only stereo or mono =) */ if (avctx->trellis && (unsigned)avctx->trellis > 16U) { av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n"); return -1; } if (avctx->trellis) { int frontier = 1 << avctx->trellis; int max_paths = frontier * FREEZE_INTERVAL; FF_ALLOC_OR_GOTO(avctx, s->paths, max_paths * sizeof(*s->paths), error); FF_ALLOC_OR_GOTO(avctx, s->node_buf, 2 * frontier * sizeof(*s->node_buf), error); FF_ALLOC_OR_GOTO(avctx, s->nodep_buf, 2 * frontier * sizeof(*s->nodep_buf), error); FF_ALLOC_OR_GOTO(avctx, s->trellis_hash, 65536 * sizeof(*s->trellis_hash), error); } avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id); switch (avctx->codec->id) { case CODEC_ID_ADPCM_IMA_WAV: /* each 16 bits sample gives one nibble and we have 4 bytes per channel overhead */ avctx->frame_size = (BLKSIZE - 4 * avctx->channels) * 8 / (4 * avctx->channels) + 1; /* seems frame_size isn't taken into account... have to buffer the samples :-( */ avctx->block_align = BLKSIZE; avctx->bits_per_coded_sample = 4; break; case CODEC_ID_ADPCM_IMA_QT: avctx->frame_size = 64; avctx->block_align = 34 * avctx->channels; break; case CODEC_ID_ADPCM_MS: /* each 16 bits sample gives one nibble and we have 7 bytes per channel overhead */ avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2; avctx->block_align = BLKSIZE; avctx->bits_per_coded_sample = 4; avctx->extradata_size = 32; extradata = avctx->extradata = av_malloc(avctx->extradata_size); if (!extradata) return AVERROR(ENOMEM); bytestream_put_le16(&extradata, avctx->frame_size); bytestream_put_le16(&extradata, 7); /* wNumCoef */ for (i = 0; i < 7; i++) { bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff1[i] * 4); bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff2[i] * 4); } break; case CODEC_ID_ADPCM_YAMAHA: avctx->frame_size = BLKSIZE * avctx->channels; avctx->block_align = BLKSIZE; break; case CODEC_ID_ADPCM_SWF: if (avctx->sample_rate != 11025 && avctx->sample_rate != 22050 && avctx->sample_rate != 44100) { av_log(avctx, AV_LOG_ERROR, "Sample rate must be 11025, " "22050 or 44100\n"); goto error; } avctx->frame_size = 512 * (avctx->sample_rate / 11025); break; default: goto error; } avctx->coded_frame = avcodec_alloc_frame(); avctx->coded_frame->key_frame= 1; return 0; error: av_freep(&s->paths); av_freep(&s->node_buf); av_freep(&s->nodep_buf); av_freep(&s->trellis_hash); return -1; }
false
FFmpeg
82c252972b494402818aa07df5bdbac16111c09d
static av_cold int adpcm_encode_init(AVCodecContext *avctx) { ADPCMEncodeContext *s = avctx->priv_data; uint8_t *extradata; int i; if (avctx->channels > 2) return -1; if (avctx->trellis && (unsigned)avctx->trellis > 16U) { av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n"); return -1; } if (avctx->trellis) { int frontier = 1 << avctx->trellis; int max_paths = frontier * FREEZE_INTERVAL; FF_ALLOC_OR_GOTO(avctx, s->paths, max_paths * sizeof(*s->paths), error); FF_ALLOC_OR_GOTO(avctx, s->node_buf, 2 * frontier * sizeof(*s->node_buf), error); FF_ALLOC_OR_GOTO(avctx, s->nodep_buf, 2 * frontier * sizeof(*s->nodep_buf), error); FF_ALLOC_OR_GOTO(avctx, s->trellis_hash, 65536 * sizeof(*s->trellis_hash), error); } avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id); switch (avctx->codec->id) { case CODEC_ID_ADPCM_IMA_WAV: avctx->frame_size = (BLKSIZE - 4 * avctx->channels) * 8 / (4 * avctx->channels) + 1; avctx->block_align = BLKSIZE; avctx->bits_per_coded_sample = 4; break; case CODEC_ID_ADPCM_IMA_QT: avctx->frame_size = 64; avctx->block_align = 34 * avctx->channels; break; case CODEC_ID_ADPCM_MS: avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2; avctx->block_align = BLKSIZE; avctx->bits_per_coded_sample = 4; avctx->extradata_size = 32; extradata = avctx->extradata = av_malloc(avctx->extradata_size); if (!extradata) return AVERROR(ENOMEM); bytestream_put_le16(&extradata, avctx->frame_size); bytestream_put_le16(&extradata, 7); for (i = 0; i < 7; i++) { bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff1[i] * 4); bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff2[i] * 4); } break; case CODEC_ID_ADPCM_YAMAHA: avctx->frame_size = BLKSIZE * avctx->channels; avctx->block_align = BLKSIZE; break; case CODEC_ID_ADPCM_SWF: if (avctx->sample_rate != 11025 && avctx->sample_rate != 22050 && avctx->sample_rate != 44100) { av_log(avctx, AV_LOG_ERROR, "Sample rate must be 11025, " "22050 or 44100\n"); goto error; } avctx->frame_size = 512 * (avctx->sample_rate / 11025); break; default: goto error; } avctx->coded_frame = avcodec_alloc_frame(); avctx->coded_frame->key_frame= 1; return 0; error: av_freep(&s->paths); av_freep(&s->node_buf); av_freep(&s->nodep_buf); av_freep(&s->trellis_hash); return -1; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { ADPCMEncodeContext *s = avctx->priv_data; uint8_t *extradata; int VAR_0; if (avctx->channels > 2) return -1; if (avctx->trellis && (unsigned)avctx->trellis > 16U) { av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n"); return -1; } if (avctx->trellis) { int VAR_1 = 1 << avctx->trellis; int VAR_2 = VAR_1 * FREEZE_INTERVAL; FF_ALLOC_OR_GOTO(avctx, s->paths, VAR_2 * sizeof(*s->paths), error); FF_ALLOC_OR_GOTO(avctx, s->node_buf, 2 * VAR_1 * sizeof(*s->node_buf), error); FF_ALLOC_OR_GOTO(avctx, s->nodep_buf, 2 * VAR_1 * sizeof(*s->nodep_buf), error); FF_ALLOC_OR_GOTO(avctx, s->trellis_hash, 65536 * sizeof(*s->trellis_hash), error); } avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id); switch (avctx->codec->id) { case CODEC_ID_ADPCM_IMA_WAV: avctx->frame_size = (BLKSIZE - 4 * avctx->channels) * 8 / (4 * avctx->channels) + 1; avctx->block_align = BLKSIZE; avctx->bits_per_coded_sample = 4; break; case CODEC_ID_ADPCM_IMA_QT: avctx->frame_size = 64; avctx->block_align = 34 * avctx->channels; break; case CODEC_ID_ADPCM_MS: avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2; avctx->block_align = BLKSIZE; avctx->bits_per_coded_sample = 4; avctx->extradata_size = 32; extradata = avctx->extradata = av_malloc(avctx->extradata_size); if (!extradata) return AVERROR(ENOMEM); bytestream_put_le16(&extradata, avctx->frame_size); bytestream_put_le16(&extradata, 7); for (VAR_0 = 0; VAR_0 < 7; VAR_0++) { bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff1[VAR_0] * 4); bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff2[VAR_0] * 4); } break; case CODEC_ID_ADPCM_YAMAHA: avctx->frame_size = BLKSIZE * avctx->channels; avctx->block_align = BLKSIZE; break; case CODEC_ID_ADPCM_SWF: if (avctx->sample_rate != 11025 && avctx->sample_rate != 22050 && avctx->sample_rate != 44100) { av_log(avctx, AV_LOG_ERROR, "Sample rate must be 11025, " "22050 or 44100\n"); goto error; } avctx->frame_size = 512 * (avctx->sample_rate / 11025); break; default: goto error; } avctx->coded_frame = avcodec_alloc_frame(); avctx->coded_frame->key_frame= 1; return 0; error: av_freep(&s->paths); av_freep(&s->node_buf); av_freep(&s->nodep_buf); av_freep(&s->trellis_hash); return -1; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "ADPCMEncodeContext *s = avctx->priv_data;", "uint8_t *extradata;", "int VAR_0;", "if (avctx->channels > 2)\nreturn -1;", "if (avctx->trellis && (unsigned)avctx->trellis > 16U) {", "av_log(avctx, AV_LOG_ERROR, \"invalid trellis size\\n\");", "return -1;", "}", "if (avctx->trellis) {", "int VAR_1 = 1 << avctx->trellis;", "int VAR_2 = VAR_1 * FREEZE_INTERVAL;", "FF_ALLOC_OR_GOTO(avctx, s->paths,\nVAR_2 * sizeof(*s->paths), error);", "FF_ALLOC_OR_GOTO(avctx, s->node_buf,\n2 * VAR_1 * sizeof(*s->node_buf), error);", "FF_ALLOC_OR_GOTO(avctx, s->nodep_buf,\n2 * VAR_1 * sizeof(*s->nodep_buf), error);", "FF_ALLOC_OR_GOTO(avctx, s->trellis_hash,\n65536 * sizeof(*s->trellis_hash), error);", "}", "avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);", "switch (avctx->codec->id) {", "case CODEC_ID_ADPCM_IMA_WAV:\navctx->frame_size = (BLKSIZE - 4 * avctx->channels) * 8 /\n(4 * avctx->channels) + 1;", "avctx->block_align = BLKSIZE;", "avctx->bits_per_coded_sample = 4;", "break;", "case CODEC_ID_ADPCM_IMA_QT:\navctx->frame_size = 64;", "avctx->block_align = 34 * avctx->channels;", "break;", "case CODEC_ID_ADPCM_MS:\navctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2;", "avctx->block_align = BLKSIZE;", "avctx->bits_per_coded_sample = 4;", "avctx->extradata_size = 32;", "extradata = avctx->extradata = av_malloc(avctx->extradata_size);", "if (!extradata)\nreturn AVERROR(ENOMEM);", "bytestream_put_le16(&extradata, avctx->frame_size);", "bytestream_put_le16(&extradata, 7);", "for (VAR_0 = 0; VAR_0 < 7; VAR_0++) {", "bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff1[VAR_0] * 4);", "bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff2[VAR_0] * 4);", "}", "break;", "case CODEC_ID_ADPCM_YAMAHA:\navctx->frame_size = BLKSIZE * avctx->channels;", "avctx->block_align = BLKSIZE;", "break;", "case CODEC_ID_ADPCM_SWF:\nif (avctx->sample_rate != 11025 &&\navctx->sample_rate != 22050 &&\navctx->sample_rate != 44100) {", "av_log(avctx, AV_LOG_ERROR, \"Sample rate must be 11025, \"\n\"22050 or 44100\\n\");", "goto error;", "}", "avctx->frame_size = 512 * (avctx->sample_rate / 11025);", "break;", "default:\ngoto error;", "}", "avctx->coded_frame = avcodec_alloc_frame();", "avctx->coded_frame->key_frame= 1;", "return 0;", "error:\nav_freep(&s->paths);", "av_freep(&s->node_buf);", "av_freep(&s->nodep_buf);", "av_freep(&s->trellis_hash);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 53 ], [ 57 ], [ 59, 65, 67 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87, 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 ], [ 159 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ] ]
20,727
void *etraxfs_dmac_init(target_phys_addr_t base, int nr_channels) { struct fs_dma_ctrl *ctrl = NULL; ctrl = g_malloc0(sizeof *ctrl); ctrl->bh = qemu_bh_new(DMA_run, ctrl); ctrl->nr_channels = nr_channels; ctrl->channels = g_malloc0(sizeof ctrl->channels[0] * nr_channels); memory_region_init_io(&ctrl->mmio, &dma_ops, ctrl, "etraxfs-dma", nr_channels * 0x2000); memory_region_add_subregion(get_system_memory(), base, &ctrl->mmio); return ctrl; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
void *etraxfs_dmac_init(target_phys_addr_t base, int nr_channels) { struct fs_dma_ctrl *ctrl = NULL; ctrl = g_malloc0(sizeof *ctrl); ctrl->bh = qemu_bh_new(DMA_run, ctrl); ctrl->nr_channels = nr_channels; ctrl->channels = g_malloc0(sizeof ctrl->channels[0] * nr_channels); memory_region_init_io(&ctrl->mmio, &dma_ops, ctrl, "etraxfs-dma", nr_channels * 0x2000); memory_region_add_subregion(get_system_memory(), base, &ctrl->mmio); return ctrl; }
{ "code": [], "line_no": [] }
void *FUNC_0(target_phys_addr_t VAR_0, int VAR_1) { struct fs_dma_ctrl *VAR_2 = NULL; VAR_2 = g_malloc0(sizeof *VAR_2); VAR_2->bh = qemu_bh_new(DMA_run, VAR_2); VAR_2->VAR_1 = VAR_1; VAR_2->channels = g_malloc0(sizeof VAR_2->channels[0] * VAR_1); memory_region_init_io(&VAR_2->mmio, &dma_ops, VAR_2, "etraxfs-dma", VAR_1 * 0x2000); memory_region_add_subregion(get_system_memory(), VAR_0, &VAR_2->mmio); return VAR_2; }
[ "void *FUNC_0(target_phys_addr_t VAR_0, int VAR_1)\n{", "struct fs_dma_ctrl *VAR_2 = NULL;", "VAR_2 = g_malloc0(sizeof *VAR_2);", "VAR_2->bh = qemu_bh_new(DMA_run, VAR_2);", "VAR_2->VAR_1 = VAR_1;", "VAR_2->channels = g_malloc0(sizeof VAR_2->channels[0] * VAR_1);", "memory_region_init_io(&VAR_2->mmio, &dma_ops, VAR_2, \"etraxfs-dma\",\nVAR_1 * 0x2000);", "memory_region_add_subregion(get_system_memory(), VAR_0, &VAR_2->mmio);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 27 ], [ 31 ], [ 33 ] ]
20,729
static inline void gen_cond_branch(DisasContext *dc, int cond) { int l1; l1 = gen_new_label(); tcg_gen_brcond_tl(cond, cpu_R[dc->r0], cpu_R[dc->r1], l1); gen_goto_tb(dc, 0, dc->pc + 4); gen_set_label(l1); gen_goto_tb(dc, 1, dc->pc + (sign_extend(dc->imm16 << 2, 16))); dc->is_jmp = DISAS_TB_JUMP; }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static inline void gen_cond_branch(DisasContext *dc, int cond) { int l1; l1 = gen_new_label(); tcg_gen_brcond_tl(cond, cpu_R[dc->r0], cpu_R[dc->r1], l1); gen_goto_tb(dc, 0, dc->pc + 4); gen_set_label(l1); gen_goto_tb(dc, 1, dc->pc + (sign_extend(dc->imm16 << 2, 16))); dc->is_jmp = DISAS_TB_JUMP; }
{ "code": [], "line_no": [] }
static inline void FUNC_0(DisasContext *VAR_0, int VAR_1) { int VAR_2; VAR_2 = gen_new_label(); tcg_gen_brcond_tl(VAR_1, cpu_R[VAR_0->r0], cpu_R[VAR_0->r1], VAR_2); gen_goto_tb(VAR_0, 0, VAR_0->pc + 4); gen_set_label(VAR_2); gen_goto_tb(VAR_0, 1, VAR_0->pc + (sign_extend(VAR_0->imm16 << 2, 16))); VAR_0->is_jmp = DISAS_TB_JUMP; }
[ "static inline void FUNC_0(DisasContext *VAR_0, int VAR_1)\n{", "int VAR_2;", "VAR_2 = gen_new_label();", "tcg_gen_brcond_tl(VAR_1, cpu_R[VAR_0->r0], cpu_R[VAR_0->r1], VAR_2);", "gen_goto_tb(VAR_0, 0, VAR_0->pc + 4);", "gen_set_label(VAR_2);", "gen_goto_tb(VAR_0, 1, VAR_0->pc + (sign_extend(VAR_0->imm16 << 2, 16)));", "VAR_0->is_jmp = DISAS_TB_JUMP;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
20,730
static void RENAME(sws_init_swScale)(SwsContext *c) { enum PixelFormat srcFormat = c->srcFormat; if (!(c->flags & SWS_BITEXACT)) { if (c->flags & SWS_ACCURATE_RND) { c->yuv2yuv1 = RENAME(yuv2yuv1_ar ); c->yuv2yuvX = RENAME(yuv2yuvX_ar ); switch (c->dstFormat) { case PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X_ar); break; case PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X_ar); break; case PIX_FMT_RGB555: c->yuv2packedX = RENAME(yuv2rgb555_X_ar); break; case PIX_FMT_RGB565: c->yuv2packedX = RENAME(yuv2rgb565_X_ar); break; case PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X_ar); break; default: break; } } else { c->yuv2yuv1 = RENAME(yuv2yuv1 ); c->yuv2yuvX = RENAME(yuv2yuvX ); switch (c->dstFormat) { case PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X); break; case PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X); break; case PIX_FMT_RGB555: c->yuv2packedX = RENAME(yuv2rgb555_X); break; case PIX_FMT_RGB565: c->yuv2packedX = RENAME(yuv2rgb565_X); break; case PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X); break; default: break; } } switch (c->dstFormat) { case PIX_FMT_RGB32: c->yuv2packed1 = RENAME(yuv2rgb32_1); c->yuv2packed2 = RENAME(yuv2rgb32_2); break; case PIX_FMT_BGR24: c->yuv2packed1 = RENAME(yuv2bgr24_1); c->yuv2packed2 = RENAME(yuv2bgr24_2); break; case PIX_FMT_RGB555: c->yuv2packed1 = RENAME(yuv2rgb555_1); c->yuv2packed2 = RENAME(yuv2rgb555_2); break; case PIX_FMT_RGB565: c->yuv2packed1 = RENAME(yuv2rgb565_1); c->yuv2packed2 = RENAME(yuv2rgb565_2); break; case PIX_FMT_YUYV422: c->yuv2packed1 = RENAME(yuv2yuyv422_1); c->yuv2packed2 = RENAME(yuv2yuyv422_2); break; default: break; } } #if !COMPILE_TEMPLATE_MMX2 c->hScale = RENAME(hScale ); #endif /* !COMPILE_TEMPLATE_MMX2 */ // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one). #if COMPILE_TEMPLATE_MMX2 if (c->flags & SWS_FAST_BILINEAR && c->canMMX2BeUsed) { c->hyscale_fast = RENAME(hyscale_fast); c->hcscale_fast = RENAME(hcscale_fast); } else { #endif /* COMPILE_TEMPLATE_MMX2 */ c->hyscale_fast = NULL; c->hcscale_fast = NULL; #if COMPILE_TEMPLATE_MMX2 } #endif /* COMPILE_TEMPLATE_MMX2 */ #if !COMPILE_TEMPLATE_MMX2 switch(srcFormat) { case PIX_FMT_YUYV422 : c->chrToYV12 = RENAME(yuy2ToUV); break; case PIX_FMT_UYVY422 : c->chrToYV12 = RENAME(uyvyToUV); break; case PIX_FMT_NV12 : c->chrToYV12 = RENAME(nv12ToUV); break; case PIX_FMT_NV21 : c->chrToYV12 = RENAME(nv21ToUV); break; case PIX_FMT_GRAY16LE : case PIX_FMT_YUV420P9LE: case PIX_FMT_YUV422P10LE: case PIX_FMT_YUV420P10LE: case PIX_FMT_YUV420P16LE: case PIX_FMT_YUV422P16LE: case PIX_FMT_YUV444P16LE: c->hScale16= RENAME(hScale16); break; } #endif /* !COMPILE_TEMPLATE_MMX2 */ if (!c->chrSrcHSubSample) { switch(srcFormat) { case PIX_FMT_BGR24 : c->chrToYV12 = RENAME(bgr24ToUV); break; case PIX_FMT_RGB24 : c->chrToYV12 = RENAME(rgb24ToUV); break; default: break; } } switch (srcFormat) { #if !COMPILE_TEMPLATE_MMX2 case PIX_FMT_YUYV422 : case PIX_FMT_Y400A : c->lumToYV12 = RENAME(yuy2ToY); break; case PIX_FMT_UYVY422 : c->lumToYV12 = RENAME(uyvyToY); break; #endif /* !COMPILE_TEMPLATE_MMX2 */ case PIX_FMT_BGR24 : c->lumToYV12 = RENAME(bgr24ToY); break; case PIX_FMT_RGB24 : c->lumToYV12 = RENAME(rgb24ToY); break; default: break; } #if !COMPILE_TEMPLATE_MMX2 if (c->alpPixBuf) { switch (srcFormat) { case PIX_FMT_Y400A : c->alpToYV12 = RENAME(yuy2ToY); break; default: break; } } #endif /* !COMPILE_TEMPLATE_MMX2 */ if(isAnyRGB(c->srcFormat)) c->hScale16= RENAME(hScale16); }
false
FFmpeg
ba91bf58cd8bab4de55ec31ffcdf6cc71f7e5e42
static void RENAME(sws_init_swScale)(SwsContext *c) { enum PixelFormat srcFormat = c->srcFormat; if (!(c->flags & SWS_BITEXACT)) { if (c->flags & SWS_ACCURATE_RND) { c->yuv2yuv1 = RENAME(yuv2yuv1_ar ); c->yuv2yuvX = RENAME(yuv2yuvX_ar ); switch (c->dstFormat) { case PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X_ar); break; case PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X_ar); break; case PIX_FMT_RGB555: c->yuv2packedX = RENAME(yuv2rgb555_X_ar); break; case PIX_FMT_RGB565: c->yuv2packedX = RENAME(yuv2rgb565_X_ar); break; case PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X_ar); break; default: break; } } else { c->yuv2yuv1 = RENAME(yuv2yuv1 ); c->yuv2yuvX = RENAME(yuv2yuvX ); switch (c->dstFormat) { case PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X); break; case PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X); break; case PIX_FMT_RGB555: c->yuv2packedX = RENAME(yuv2rgb555_X); break; case PIX_FMT_RGB565: c->yuv2packedX = RENAME(yuv2rgb565_X); break; case PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X); break; default: break; } } switch (c->dstFormat) { case PIX_FMT_RGB32: c->yuv2packed1 = RENAME(yuv2rgb32_1); c->yuv2packed2 = RENAME(yuv2rgb32_2); break; case PIX_FMT_BGR24: c->yuv2packed1 = RENAME(yuv2bgr24_1); c->yuv2packed2 = RENAME(yuv2bgr24_2); break; case PIX_FMT_RGB555: c->yuv2packed1 = RENAME(yuv2rgb555_1); c->yuv2packed2 = RENAME(yuv2rgb555_2); break; case PIX_FMT_RGB565: c->yuv2packed1 = RENAME(yuv2rgb565_1); c->yuv2packed2 = RENAME(yuv2rgb565_2); break; case PIX_FMT_YUYV422: c->yuv2packed1 = RENAME(yuv2yuyv422_1); c->yuv2packed2 = RENAME(yuv2yuyv422_2); break; default: break; } } #if !COMPILE_TEMPLATE_MMX2 c->hScale = RENAME(hScale ); #endif #if COMPILE_TEMPLATE_MMX2 if (c->flags & SWS_FAST_BILINEAR && c->canMMX2BeUsed) { c->hyscale_fast = RENAME(hyscale_fast); c->hcscale_fast = RENAME(hcscale_fast); } else { #endif c->hyscale_fast = NULL; c->hcscale_fast = NULL; #if COMPILE_TEMPLATE_MMX2 } #endif #if !COMPILE_TEMPLATE_MMX2 switch(srcFormat) { case PIX_FMT_YUYV422 : c->chrToYV12 = RENAME(yuy2ToUV); break; case PIX_FMT_UYVY422 : c->chrToYV12 = RENAME(uyvyToUV); break; case PIX_FMT_NV12 : c->chrToYV12 = RENAME(nv12ToUV); break; case PIX_FMT_NV21 : c->chrToYV12 = RENAME(nv21ToUV); break; case PIX_FMT_GRAY16LE : case PIX_FMT_YUV420P9LE: case PIX_FMT_YUV422P10LE: case PIX_FMT_YUV420P10LE: case PIX_FMT_YUV420P16LE: case PIX_FMT_YUV422P16LE: case PIX_FMT_YUV444P16LE: c->hScale16= RENAME(hScale16); break; } #endif if (!c->chrSrcHSubSample) { switch(srcFormat) { case PIX_FMT_BGR24 : c->chrToYV12 = RENAME(bgr24ToUV); break; case PIX_FMT_RGB24 : c->chrToYV12 = RENAME(rgb24ToUV); break; default: break; } } switch (srcFormat) { #if !COMPILE_TEMPLATE_MMX2 case PIX_FMT_YUYV422 : case PIX_FMT_Y400A : c->lumToYV12 = RENAME(yuy2ToY); break; case PIX_FMT_UYVY422 : c->lumToYV12 = RENAME(uyvyToY); break; #endif case PIX_FMT_BGR24 : c->lumToYV12 = RENAME(bgr24ToY); break; case PIX_FMT_RGB24 : c->lumToYV12 = RENAME(rgb24ToY); break; default: break; } #if !COMPILE_TEMPLATE_MMX2 if (c->alpPixBuf) { switch (srcFormat) { case PIX_FMT_Y400A : c->alpToYV12 = RENAME(yuy2ToY); break; default: break; } } #endif if(isAnyRGB(c->srcFormat)) c->hScale16= RENAME(hScale16); }
{ "code": [], "line_no": [] }
static void FUNC_0(sws_init_swScale)(SwsContext *c) { enum PixelFormat VAR_0 = c->VAR_0; if (!(c->flags & SWS_BITEXACT)) { if (c->flags & SWS_ACCURATE_RND) { c->yuv2yuv1 = FUNC_0(yuv2yuv1_ar ); c->yuv2yuvX = FUNC_0(yuv2yuvX_ar ); switch (c->dstFormat) { case PIX_FMT_RGB32: c->yuv2packedX = FUNC_0(yuv2rgb32_X_ar); break; case PIX_FMT_BGR24: c->yuv2packedX = FUNC_0(yuv2bgr24_X_ar); break; case PIX_FMT_RGB555: c->yuv2packedX = FUNC_0(yuv2rgb555_X_ar); break; case PIX_FMT_RGB565: c->yuv2packedX = FUNC_0(yuv2rgb565_X_ar); break; case PIX_FMT_YUYV422: c->yuv2packedX = FUNC_0(yuv2yuyv422_X_ar); break; default: break; } } else { c->yuv2yuv1 = FUNC_0(yuv2yuv1 ); c->yuv2yuvX = FUNC_0(yuv2yuvX ); switch (c->dstFormat) { case PIX_FMT_RGB32: c->yuv2packedX = FUNC_0(yuv2rgb32_X); break; case PIX_FMT_BGR24: c->yuv2packedX = FUNC_0(yuv2bgr24_X); break; case PIX_FMT_RGB555: c->yuv2packedX = FUNC_0(yuv2rgb555_X); break; case PIX_FMT_RGB565: c->yuv2packedX = FUNC_0(yuv2rgb565_X); break; case PIX_FMT_YUYV422: c->yuv2packedX = FUNC_0(yuv2yuyv422_X); break; default: break; } } switch (c->dstFormat) { case PIX_FMT_RGB32: c->yuv2packed1 = FUNC_0(yuv2rgb32_1); c->yuv2packed2 = FUNC_0(yuv2rgb32_2); break; case PIX_FMT_BGR24: c->yuv2packed1 = FUNC_0(yuv2bgr24_1); c->yuv2packed2 = FUNC_0(yuv2bgr24_2); break; case PIX_FMT_RGB555: c->yuv2packed1 = FUNC_0(yuv2rgb555_1); c->yuv2packed2 = FUNC_0(yuv2rgb555_2); break; case PIX_FMT_RGB565: c->yuv2packed1 = FUNC_0(yuv2rgb565_1); c->yuv2packed2 = FUNC_0(yuv2rgb565_2); break; case PIX_FMT_YUYV422: c->yuv2packed1 = FUNC_0(yuv2yuyv422_1); c->yuv2packed2 = FUNC_0(yuv2yuyv422_2); break; default: break; } } #if !COMPILE_TEMPLATE_MMX2 c->hScale = FUNC_0(hScale ); #endif #if COMPILE_TEMPLATE_MMX2 if (c->flags & SWS_FAST_BILINEAR && c->canMMX2BeUsed) { c->hyscale_fast = FUNC_0(hyscale_fast); c->hcscale_fast = FUNC_0(hcscale_fast); } else { #endif c->hyscale_fast = NULL; c->hcscale_fast = NULL; #if COMPILE_TEMPLATE_MMX2 } #endif #if !COMPILE_TEMPLATE_MMX2 switch(VAR_0) { case PIX_FMT_YUYV422 : c->chrToYV12 = FUNC_0(yuy2ToUV); break; case PIX_FMT_UYVY422 : c->chrToYV12 = FUNC_0(uyvyToUV); break; case PIX_FMT_NV12 : c->chrToYV12 = FUNC_0(nv12ToUV); break; case PIX_FMT_NV21 : c->chrToYV12 = FUNC_0(nv21ToUV); break; case PIX_FMT_GRAY16LE : case PIX_FMT_YUV420P9LE: case PIX_FMT_YUV422P10LE: case PIX_FMT_YUV420P10LE: case PIX_FMT_YUV420P16LE: case PIX_FMT_YUV422P16LE: case PIX_FMT_YUV444P16LE: c->hScale16= FUNC_0(hScale16); break; } #endif if (!c->chrSrcHSubSample) { switch(VAR_0) { case PIX_FMT_BGR24 : c->chrToYV12 = FUNC_0(bgr24ToUV); break; case PIX_FMT_RGB24 : c->chrToYV12 = FUNC_0(rgb24ToUV); break; default: break; } } switch (VAR_0) { #if !COMPILE_TEMPLATE_MMX2 case PIX_FMT_YUYV422 : case PIX_FMT_Y400A : c->lumToYV12 = FUNC_0(yuy2ToY); break; case PIX_FMT_UYVY422 : c->lumToYV12 = FUNC_0(uyvyToY); break; #endif case PIX_FMT_BGR24 : c->lumToYV12 = FUNC_0(bgr24ToY); break; case PIX_FMT_RGB24 : c->lumToYV12 = FUNC_0(rgb24ToY); break; default: break; } #if !COMPILE_TEMPLATE_MMX2 if (c->alpPixBuf) { switch (VAR_0) { case PIX_FMT_Y400A : c->alpToYV12 = FUNC_0(yuy2ToY); break; default: break; } } #endif if(isAnyRGB(c->VAR_0)) c->hScale16= FUNC_0(hScale16); }
[ "static void FUNC_0(sws_init_swScale)(SwsContext *c)\n{", "enum PixelFormat VAR_0 = c->VAR_0;", "if (!(c->flags & SWS_BITEXACT)) {", "if (c->flags & SWS_ACCURATE_RND) {", "c->yuv2yuv1 = FUNC_0(yuv2yuv1_ar );", "c->yuv2yuvX = FUNC_0(yuv2yuvX_ar );", "switch (c->dstFormat) {", "case PIX_FMT_RGB32: c->yuv2packedX = FUNC_0(yuv2rgb32_X_ar); break;", "case PIX_FMT_BGR24: c->yuv2packedX = FUNC_0(yuv2bgr24_X_ar); break;", "case PIX_FMT_RGB555: c->yuv2packedX = FUNC_0(yuv2rgb555_X_ar); break;", "case PIX_FMT_RGB565: c->yuv2packedX = FUNC_0(yuv2rgb565_X_ar); break;", "case PIX_FMT_YUYV422: c->yuv2packedX = FUNC_0(yuv2yuyv422_X_ar); break;", "default: break;", "}", "} else {", "c->yuv2yuv1 = FUNC_0(yuv2yuv1 );", "c->yuv2yuvX = FUNC_0(yuv2yuvX );", "switch (c->dstFormat) {", "case PIX_FMT_RGB32: c->yuv2packedX = FUNC_0(yuv2rgb32_X); break;", "case PIX_FMT_BGR24: c->yuv2packedX = FUNC_0(yuv2bgr24_X); break;", "case PIX_FMT_RGB555: c->yuv2packedX = FUNC_0(yuv2rgb555_X); break;", "case PIX_FMT_RGB565: c->yuv2packedX = FUNC_0(yuv2rgb565_X); break;", "case PIX_FMT_YUYV422: c->yuv2packedX = FUNC_0(yuv2yuyv422_X); break;", "default: break;", "}", "}", "switch (c->dstFormat) {", "case PIX_FMT_RGB32:\nc->yuv2packed1 = FUNC_0(yuv2rgb32_1);", "c->yuv2packed2 = FUNC_0(yuv2rgb32_2);", "break;", "case PIX_FMT_BGR24:\nc->yuv2packed1 = FUNC_0(yuv2bgr24_1);", "c->yuv2packed2 = FUNC_0(yuv2bgr24_2);", "break;", "case PIX_FMT_RGB555:\nc->yuv2packed1 = FUNC_0(yuv2rgb555_1);", "c->yuv2packed2 = FUNC_0(yuv2rgb555_2);", "break;", "case PIX_FMT_RGB565:\nc->yuv2packed1 = FUNC_0(yuv2rgb565_1);", "c->yuv2packed2 = FUNC_0(yuv2rgb565_2);", "break;", "case PIX_FMT_YUYV422:\nc->yuv2packed1 = FUNC_0(yuv2yuyv422_1);", "c->yuv2packed2 = FUNC_0(yuv2yuyv422_2);", "break;", "default:\nbreak;", "}", "}", "#if !COMPILE_TEMPLATE_MMX2\nc->hScale = FUNC_0(hScale );", "#endif\n#if COMPILE_TEMPLATE_MMX2\nif (c->flags & SWS_FAST_BILINEAR && c->canMMX2BeUsed)\n{", "c->hyscale_fast = FUNC_0(hyscale_fast);", "c->hcscale_fast = FUNC_0(hcscale_fast);", "} else {", "#endif\nc->hyscale_fast = NULL;", "c->hcscale_fast = NULL;", "#if COMPILE_TEMPLATE_MMX2\n}", "#endif\n#if !COMPILE_TEMPLATE_MMX2\nswitch(VAR_0) {", "case PIX_FMT_YUYV422 : c->chrToYV12 = FUNC_0(yuy2ToUV); break;", "case PIX_FMT_UYVY422 : c->chrToYV12 = FUNC_0(uyvyToUV); break;", "case PIX_FMT_NV12 : c->chrToYV12 = FUNC_0(nv12ToUV); break;", "case PIX_FMT_NV21 : c->chrToYV12 = FUNC_0(nv21ToUV); break;", "case PIX_FMT_GRAY16LE :\ncase PIX_FMT_YUV420P9LE:\ncase PIX_FMT_YUV422P10LE:\ncase PIX_FMT_YUV420P10LE:\ncase PIX_FMT_YUV420P16LE:\ncase PIX_FMT_YUV422P16LE:\ncase PIX_FMT_YUV444P16LE: c->hScale16= FUNC_0(hScale16); break;", "}", "#endif\nif (!c->chrSrcHSubSample) {", "switch(VAR_0) {", "case PIX_FMT_BGR24 : c->chrToYV12 = FUNC_0(bgr24ToUV); break;", "case PIX_FMT_RGB24 : c->chrToYV12 = FUNC_0(rgb24ToUV); break;", "default: break;", "}", "}", "switch (VAR_0) {", "#if !COMPILE_TEMPLATE_MMX2\ncase PIX_FMT_YUYV422 :\ncase PIX_FMT_Y400A :\nc->lumToYV12 = FUNC_0(yuy2ToY); break;", "case PIX_FMT_UYVY422 :\nc->lumToYV12 = FUNC_0(uyvyToY); break;", "#endif\ncase PIX_FMT_BGR24 : c->lumToYV12 = FUNC_0(bgr24ToY); break;", "case PIX_FMT_RGB24 : c->lumToYV12 = FUNC_0(rgb24ToY); break;", "default: break;", "}", "#if !COMPILE_TEMPLATE_MMX2\nif (c->alpPixBuf) {", "switch (VAR_0) {", "case PIX_FMT_Y400A : c->alpToYV12 = FUNC_0(yuy2ToY); break;", "default: break;", "}", "}", "#endif\nif(isAnyRGB(c->VAR_0))\nc->hScale16= FUNC_0(hScale16);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 109, 111 ], [ 113, 119, 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137, 139 ], [ 141, 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157, 159, 161, 163, 165, 167, 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193, 195, 197, 199 ], [ 201, 203 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229, 231, 233 ], [ 235 ] ]
20,731
static void tftp_handle_rrq(struct tftp_t *tp, int pktlen) { struct tftp_session *spt; int s, k, n; u_int8_t *src, *dst; s = tftp_session_allocate(tp); if (s < 0) { return; } spt = &tftp_sessions[s]; src = tp->x.tp_buf; dst = spt->filename; n = pktlen - ((uint8_t *)&tp->x.tp_buf[0] - (uint8_t *)tp); /* get name */ for (k = 0; k < n; k++) { if (k < TFTP_FILENAME_MAX) { dst[k] = src[k]; } else { return; } if (src[k] == '\0') { break; } } if (k >= n) { return; } k++; /* check mode */ if ((n - k) < 6) { return; } if (memcmp(&src[k], "octet\0", 6) != 0) { tftp_send_error(spt, 4, "Unsupported transfer mode", tp); return; } k += 6; /* skipping octet */ /* do sanity checks on the filename */ if ((spt->filename[0] != '/') || (spt->filename[strlen((char *)spt->filename) - 1] == '/') || strstr((char *)spt->filename, "/../")) { tftp_send_error(spt, 2, "Access violation", tp); return; } /* only allow exported prefixes */ if (!tftp_prefix) { tftp_send_error(spt, 2, "Access violation", tp); return; } /* check if the file exists */ if (tftp_read_data(spt, 0, spt->filename, 0) < 0) { tftp_send_error(spt, 1, "File not found", tp); return; } if (src[n - 1] != 0) { tftp_send_error(spt, 2, "Access violation", tp); return; } while (k < n) { const char *key, *value; key = (char *)src + k; k += strlen(key) + 1; if (k >= n) { tftp_send_error(spt, 2, "Access violation", tp); return; } value = (char *)src + k; k += strlen(value) + 1; if (strcmp(key, "tsize") == 0) { int tsize = atoi(value); struct stat stat_p; if (tsize == 0 && tftp_prefix) { char buffer[1024]; int len; len = snprintf(buffer, sizeof(buffer), "%s/%s", tftp_prefix, spt->filename); if (stat(buffer, &stat_p) == 0) tsize = stat_p.st_size; else { tftp_send_error(spt, 1, "File not found", tp); return; } } tftp_send_oack(spt, "tsize", tsize, tp); } } tftp_send_data(spt, 1, tp); }
false
qemu
f8e3cbd3b5d1c76ec295cfc8858fd696188c270d
static void tftp_handle_rrq(struct tftp_t *tp, int pktlen) { struct tftp_session *spt; int s, k, n; u_int8_t *src, *dst; s = tftp_session_allocate(tp); if (s < 0) { return; } spt = &tftp_sessions[s]; src = tp->x.tp_buf; dst = spt->filename; n = pktlen - ((uint8_t *)&tp->x.tp_buf[0] - (uint8_t *)tp); for (k = 0; k < n; k++) { if (k < TFTP_FILENAME_MAX) { dst[k] = src[k]; } else { return; } if (src[k] == '\0') { break; } } if (k >= n) { return; } k++; if ((n - k) < 6) { return; } if (memcmp(&src[k], "octet\0", 6) != 0) { tftp_send_error(spt, 4, "Unsupported transfer mode", tp); return; } k += 6; if ((spt->filename[0] != '/') || (spt->filename[strlen((char *)spt->filename) - 1] == '/') || strstr((char *)spt->filename, "/../")) { tftp_send_error(spt, 2, "Access violation", tp); return; } if (!tftp_prefix) { tftp_send_error(spt, 2, "Access violation", tp); return; } if (tftp_read_data(spt, 0, spt->filename, 0) < 0) { tftp_send_error(spt, 1, "File not found", tp); return; } if (src[n - 1] != 0) { tftp_send_error(spt, 2, "Access violation", tp); return; } while (k < n) { const char *key, *value; key = (char *)src + k; k += strlen(key) + 1; if (k >= n) { tftp_send_error(spt, 2, "Access violation", tp); return; } value = (char *)src + k; k += strlen(value) + 1; if (strcmp(key, "tsize") == 0) { int tsize = atoi(value); struct stat stat_p; if (tsize == 0 && tftp_prefix) { char buffer[1024]; int len; len = snprintf(buffer, sizeof(buffer), "%s/%s", tftp_prefix, spt->filename); if (stat(buffer, &stat_p) == 0) tsize = stat_p.st_size; else { tftp_send_error(spt, 1, "File not found", tp); return; } } tftp_send_oack(spt, "tsize", tsize, tp); } } tftp_send_data(spt, 1, tp); }
{ "code": [], "line_no": [] }
static void FUNC_0(struct tftp_t *VAR_0, int VAR_1) { struct tftp_session *VAR_2; int VAR_3, VAR_4, VAR_5; u_int8_t *src, *dst; VAR_3 = tftp_session_allocate(VAR_0); if (VAR_3 < 0) { return; } VAR_2 = &tftp_sessions[VAR_3]; src = VAR_0->x.tp_buf; dst = VAR_2->filename; VAR_5 = VAR_1 - ((uint8_t *)&VAR_0->x.tp_buf[0] - (uint8_t *)VAR_0); for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) { if (VAR_4 < TFTP_FILENAME_MAX) { dst[VAR_4] = src[VAR_4]; } else { return; } if (src[VAR_4] == '\0') { break; } } if (VAR_4 >= VAR_5) { return; } VAR_4++; if ((VAR_5 - VAR_4) < 6) { return; } if (memcmp(&src[VAR_4], "octet\0", 6) != 0) { tftp_send_error(VAR_2, 4, "Unsupported transfer mode", VAR_0); return; } VAR_4 += 6; if ((VAR_2->filename[0] != '/') || (VAR_2->filename[strlen((char *)VAR_2->filename) - 1] == '/') || strstr((char *)VAR_2->filename, "/../")) { tftp_send_error(VAR_2, 2, "Access violation", VAR_0); return; } if (!tftp_prefix) { tftp_send_error(VAR_2, 2, "Access violation", VAR_0); return; } if (tftp_read_data(VAR_2, 0, VAR_2->filename, 0) < 0) { tftp_send_error(VAR_2, 1, "File not found", VAR_0); return; } if (src[VAR_5 - 1] != 0) { tftp_send_error(VAR_2, 2, "Access violation", VAR_0); return; } while (VAR_4 < VAR_5) { const char *VAR_6, *VAR_7; VAR_6 = (char *)src + VAR_4; VAR_4 += strlen(VAR_6) + 1; if (VAR_4 >= VAR_5) { tftp_send_error(VAR_2, 2, "Access violation", VAR_0); return; } VAR_7 = (char *)src + VAR_4; VAR_4 += strlen(VAR_7) + 1; if (strcmp(VAR_6, "VAR_8") == 0) { int VAR_8 = atoi(VAR_7); struct stat VAR_9; if (VAR_8 == 0 && tftp_prefix) { char VAR_10[1024]; int VAR_11; VAR_11 = snprintf(VAR_10, sizeof(VAR_10), "%VAR_3/%VAR_3", tftp_prefix, VAR_2->filename); if (stat(VAR_10, &VAR_9) == 0) VAR_8 = VAR_9.st_size; else { tftp_send_error(VAR_2, 1, "File not found", VAR_0); return; } } tftp_send_oack(VAR_2, "VAR_8", VAR_8, VAR_0); } } tftp_send_data(VAR_2, 1, VAR_0); }
[ "static void FUNC_0(struct tftp_t *VAR_0, int VAR_1)\n{", "struct tftp_session *VAR_2;", "int VAR_3, VAR_4, VAR_5;", "u_int8_t *src, *dst;", "VAR_3 = tftp_session_allocate(VAR_0);", "if (VAR_3 < 0) {", "return;", "}", "VAR_2 = &tftp_sessions[VAR_3];", "src = VAR_0->x.tp_buf;", "dst = VAR_2->filename;", "VAR_5 = VAR_1 - ((uint8_t *)&VAR_0->x.tp_buf[0] - (uint8_t *)VAR_0);", "for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) {", "if (VAR_4 < TFTP_FILENAME_MAX) {", "dst[VAR_4] = src[VAR_4];", "}", "else {", "return;", "}", "if (src[VAR_4] == '\\0') {", "break;", "}", "}", "if (VAR_4 >= VAR_5) {", "return;", "}", "VAR_4++;", "if ((VAR_5 - VAR_4) < 6) {", "return;", "}", "if (memcmp(&src[VAR_4], \"octet\\0\", 6) != 0) {", "tftp_send_error(VAR_2, 4, \"Unsupported transfer mode\", VAR_0);", "return;", "}", "VAR_4 += 6;", "if ((VAR_2->filename[0] != '/')\n|| (VAR_2->filename[strlen((char *)VAR_2->filename) - 1] == '/')\n|| strstr((char *)VAR_2->filename, \"/../\")) {", "tftp_send_error(VAR_2, 2, \"Access violation\", VAR_0);", "return;", "}", "if (!tftp_prefix) {", "tftp_send_error(VAR_2, 2, \"Access violation\", VAR_0);", "return;", "}", "if (tftp_read_data(VAR_2, 0, VAR_2->filename, 0) < 0) {", "tftp_send_error(VAR_2, 1, \"File not found\", VAR_0);", "return;", "}", "if (src[VAR_5 - 1] != 0) {", "tftp_send_error(VAR_2, 2, \"Access violation\", VAR_0);", "return;", "}", "while (VAR_4 < VAR_5) {", "const char *VAR_6, *VAR_7;", "VAR_6 = (char *)src + VAR_4;", "VAR_4 += strlen(VAR_6) + 1;", "if (VAR_4 >= VAR_5) {", "tftp_send_error(VAR_2, 2, \"Access violation\", VAR_0);", "return;", "}", "VAR_7 = (char *)src + VAR_4;", "VAR_4 += strlen(VAR_7) + 1;", "if (strcmp(VAR_6, \"VAR_8\") == 0) {", "int VAR_8 = atoi(VAR_7);", "struct stat VAR_9;", "if (VAR_8 == 0 && tftp_prefix) {", "char VAR_10[1024];", "int VAR_11;", "VAR_11 = snprintf(VAR_10, sizeof(VAR_10), \"%VAR_3/%VAR_3\",\ntftp_prefix, VAR_2->filename);", "if (stat(VAR_10, &VAR_9) == 0)\nVAR_8 = VAR_9.st_size;", "else {", "tftp_send_error(VAR_2, 1, \"File not found\", VAR_0);", "return;", "}", "}", "tftp_send_oack(VAR_2, \"VAR_8\", VAR_8, VAR_0);", "}", "}", "tftp_send_data(VAR_2, 1, VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 107, 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 203, 205 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 235 ] ]
20,732
static int waveformat_to_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as) { if (wfx->wFormatTag != WAVE_FORMAT_PCM) { dolog ("Invalid wave format, tag is not PCM, but %d\n", wfx->wFormatTag); return -1; } if (!wfx->nSamplesPerSec) { dolog ("Invalid wave format, frequency is zero\n"); return -1; } as->freq = wfx->nSamplesPerSec; switch (wfx->nChannels) { case 1: as->nchannels = 1; break; case 2: as->nchannels = 2; break; default: dolog ( "Invalid wave format, number of channels is not 1 or 2, but %d\n", wfx->nChannels ); return -1; } switch (wfx->wBitsPerSample) { case 8: as->fmt = AUD_FMT_U8; break; case 16: as->fmt = AUD_FMT_S16; break; case 32: as->fmt = AUD_FMT_S32; break; default: dolog ("Invalid wave format, bits per sample is not " "8, 16 or 32, but %d\n", wfx->wBitsPerSample); return -1; } return 0; }
false
qemu
1ea879e5580f63414693655fcf0328559cdce138
static int waveformat_to_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as) { if (wfx->wFormatTag != WAVE_FORMAT_PCM) { dolog ("Invalid wave format, tag is not PCM, but %d\n", wfx->wFormatTag); return -1; } if (!wfx->nSamplesPerSec) { dolog ("Invalid wave format, frequency is zero\n"); return -1; } as->freq = wfx->nSamplesPerSec; switch (wfx->nChannels) { case 1: as->nchannels = 1; break; case 2: as->nchannels = 2; break; default: dolog ( "Invalid wave format, number of channels is not 1 or 2, but %d\n", wfx->nChannels ); return -1; } switch (wfx->wBitsPerSample) { case 8: as->fmt = AUD_FMT_U8; break; case 16: as->fmt = AUD_FMT_S16; break; case 32: as->fmt = AUD_FMT_S32; break; default: dolog ("Invalid wave format, bits per sample is not " "8, 16 or 32, but %d\n", wfx->wBitsPerSample); return -1; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0 (WAVEFORMATEX *VAR_0, audsettings_t *VAR_1) { if (VAR_0->wFormatTag != WAVE_FORMAT_PCM) { dolog ("Invalid wave format, tag is not PCM, but %d\n", VAR_0->wFormatTag); return -1; } if (!VAR_0->nSamplesPerSec) { dolog ("Invalid wave format, frequency is zero\n"); return -1; } VAR_1->freq = VAR_0->nSamplesPerSec; switch (VAR_0->nChannels) { case 1: VAR_1->nchannels = 1; break; case 2: VAR_1->nchannels = 2; break; default: dolog ( "Invalid wave format, number of channels is not 1 or 2, but %d\n", VAR_0->nChannels ); return -1; } switch (VAR_0->wBitsPerSample) { case 8: VAR_1->fmt = AUD_FMT_U8; break; case 16: VAR_1->fmt = AUD_FMT_S16; break; case 32: VAR_1->fmt = AUD_FMT_S32; break; default: dolog ("Invalid wave format, bits per sample is not " "8, 16 or 32, but %d\n", VAR_0->wBitsPerSample); return -1; } return 0; }
[ "static int FUNC_0 (WAVEFORMATEX *VAR_0, audsettings_t *VAR_1)\n{", "if (VAR_0->wFormatTag != WAVE_FORMAT_PCM) {", "dolog (\"Invalid wave format, tag is not PCM, but %d\\n\",\nVAR_0->wFormatTag);", "return -1;", "}", "if (!VAR_0->nSamplesPerSec) {", "dolog (\"Invalid wave format, frequency is zero\\n\");", "return -1;", "}", "VAR_1->freq = VAR_0->nSamplesPerSec;", "switch (VAR_0->nChannels) {", "case 1:\nVAR_1->nchannels = 1;", "break;", "case 2:\nVAR_1->nchannels = 2;", "break;", "default:\ndolog (\n\"Invalid wave format, number of channels is not 1 or 2, but %d\\n\",\nVAR_0->nChannels\n);", "return -1;", "}", "switch (VAR_0->wBitsPerSample) {", "case 8:\nVAR_1->fmt = AUD_FMT_U8;", "break;", "case 16:\nVAR_1->fmt = AUD_FMT_S16;", "break;", "case 32:\nVAR_1->fmt = AUD_FMT_S32;", "break;", "default:\ndolog (\"Invalid wave format, bits per sample is not \"\n\"8, 16 or 32, but %d\\n\",\nVAR_0->wBitsPerSample);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 47, 49, 51, 53, 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 81, 83 ], [ 85 ], [ 89, 91, 93, 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ] ]
20,733
void css_queue_crw(uint8_t rsc, uint8_t erc, int chain, uint16_t rsid) { CrwContainer *crw_cont; trace_css_crw(rsc, erc, rsid, chain ? "(chained)" : ""); /* TODO: Maybe use a static crw pool? */ crw_cont = g_try_malloc0(sizeof(CrwContainer)); if (!crw_cont) { channel_subsys.crws_lost = true; return; } crw_cont->crw.flags = (rsc << 8) | erc; if (chain) { crw_cont->crw.flags |= CRW_FLAGS_MASK_C; } crw_cont->crw.rsid = rsid; if (channel_subsys.crws_lost) { crw_cont->crw.flags |= CRW_FLAGS_MASK_R; channel_subsys.crws_lost = false; } QTAILQ_INSERT_TAIL(&channel_subsys.pending_crws, crw_cont, sibling); if (channel_subsys.do_crw_mchk) { channel_subsys.do_crw_mchk = false; /* Inject crw pending machine check. */ s390_crw_mchk(); } }
false
qemu
5c8d6f008c0555b54cf10550fa86199a2cfabbca
void css_queue_crw(uint8_t rsc, uint8_t erc, int chain, uint16_t rsid) { CrwContainer *crw_cont; trace_css_crw(rsc, erc, rsid, chain ? "(chained)" : ""); crw_cont = g_try_malloc0(sizeof(CrwContainer)); if (!crw_cont) { channel_subsys.crws_lost = true; return; } crw_cont->crw.flags = (rsc << 8) | erc; if (chain) { crw_cont->crw.flags |= CRW_FLAGS_MASK_C; } crw_cont->crw.rsid = rsid; if (channel_subsys.crws_lost) { crw_cont->crw.flags |= CRW_FLAGS_MASK_R; channel_subsys.crws_lost = false; } QTAILQ_INSERT_TAIL(&channel_subsys.pending_crws, crw_cont, sibling); if (channel_subsys.do_crw_mchk) { channel_subsys.do_crw_mchk = false; s390_crw_mchk(); } }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t VAR_0, uint8_t VAR_1, int VAR_2, uint16_t VAR_3) { CrwContainer *crw_cont; trace_css_crw(VAR_0, VAR_1, VAR_3, VAR_2 ? "(chained)" : ""); crw_cont = g_try_malloc0(sizeof(CrwContainer)); if (!crw_cont) { channel_subsys.crws_lost = true; return; } crw_cont->crw.flags = (VAR_0 << 8) | VAR_1; if (VAR_2) { crw_cont->crw.flags |= CRW_FLAGS_MASK_C; } crw_cont->crw.VAR_3 = VAR_3; if (channel_subsys.crws_lost) { crw_cont->crw.flags |= CRW_FLAGS_MASK_R; channel_subsys.crws_lost = false; } QTAILQ_INSERT_TAIL(&channel_subsys.pending_crws, crw_cont, sibling); if (channel_subsys.do_crw_mchk) { channel_subsys.do_crw_mchk = false; s390_crw_mchk(); } }
[ "void FUNC_0(uint8_t VAR_0, uint8_t VAR_1, int VAR_2, uint16_t VAR_3)\n{", "CrwContainer *crw_cont;", "trace_css_crw(VAR_0, VAR_1, VAR_3, VAR_2 ? \"(chained)\" : \"\");", "crw_cont = g_try_malloc0(sizeof(CrwContainer));", "if (!crw_cont) {", "channel_subsys.crws_lost = true;", "return;", "}", "crw_cont->crw.flags = (VAR_0 << 8) | VAR_1;", "if (VAR_2) {", "crw_cont->crw.flags |= CRW_FLAGS_MASK_C;", "}", "crw_cont->crw.VAR_3 = VAR_3;", "if (channel_subsys.crws_lost) {", "crw_cont->crw.flags |= CRW_FLAGS_MASK_R;", "channel_subsys.crws_lost = false;", "}", "QTAILQ_INSERT_TAIL(&channel_subsys.pending_crws, crw_cont, sibling);", "if (channel_subsys.do_crw_mchk) {", "channel_subsys.do_crw_mchk = false;", "s390_crw_mchk();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ] ]
20,734
static int buffered_get_fd(void *opaque) { QEMUFileBuffered *s = opaque; return qemu_get_fd(s->file); }
false
qemu
0d82d0e8b98cf0ea03a45f8542d835ebd3a84cd3
static int buffered_get_fd(void *opaque) { QEMUFileBuffered *s = opaque; return qemu_get_fd(s->file); }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0) { QEMUFileBuffered *s = VAR_0; return qemu_get_fd(s->file); }
[ "static int FUNC_0(void *VAR_0)\n{", "QEMUFileBuffered *s = VAR_0;", "return qemu_get_fd(s->file);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
20,735
size_t qemu_file_get_rate_limit(QEMUFile *f) { if (f->get_rate_limit) return f->get_rate_limit(f->opaque); return 0; }
false
qemu
3d002df33eb034757d98e1ae529318f57df78f91
size_t qemu_file_get_rate_limit(QEMUFile *f) { if (f->get_rate_limit) return f->get_rate_limit(f->opaque); return 0; }
{ "code": [], "line_no": [] }
size_t FUNC_0(QEMUFile *f) { if (f->get_rate_limit) return f->get_rate_limit(f->opaque); return 0; }
[ "size_t FUNC_0(QEMUFile *f)\n{", "if (f->get_rate_limit)\nreturn f->get_rate_limit(f->opaque);", "return 0;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11 ], [ 13 ] ]
20,736
static uint8_t *csrhci_out_packet(struct csrhci_s *s, int len) { int off = s->out_start + s->out_len; /* TODO: do the padding here, i.e. align len */ s->out_len += len; if (off < FIFO_LEN) { if (off + len > FIFO_LEN && (s->out_size = off + len) > FIFO_LEN * 2) { fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len); exit(-1); } return s->outfifo + off; } if (s->out_len > s->out_size) { fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len); exit(-1); } return s->outfifo + off - s->out_size; }
false
qemu
bf937a7965c1d1a6dce4f615d0ead2e2ab505004
static uint8_t *csrhci_out_packet(struct csrhci_s *s, int len) { int off = s->out_start + s->out_len; s->out_len += len; if (off < FIFO_LEN) { if (off + len > FIFO_LEN && (s->out_size = off + len) > FIFO_LEN * 2) { fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len); exit(-1); } return s->outfifo + off; } if (s->out_len > s->out_size) { fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len); exit(-1); } return s->outfifo + off - s->out_size; }
{ "code": [], "line_no": [] }
static uint8_t *FUNC_0(struct csrhci_s *s, int len) { int VAR_0 = s->out_start + s->out_len; s->out_len += len; if (VAR_0 < FIFO_LEN) { if (VAR_0 + len > FIFO_LEN && (s->out_size = VAR_0 + len) > FIFO_LEN * 2) { fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len); exit(-1); } return s->outfifo + VAR_0; } if (s->out_len > s->out_size) { fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len); exit(-1); } return s->outfifo + VAR_0 - s->out_size; }
[ "static uint8_t *FUNC_0(struct csrhci_s *s, int len)\n{", "int VAR_0 = s->out_start + s->out_len;", "s->out_len += len;", "if (VAR_0 < FIFO_LEN) {", "if (VAR_0 + len > FIFO_LEN && (s->out_size = VAR_0 + len) > FIFO_LEN * 2) {", "fprintf(stderr, \"%s: can't alloc %i bytes\\n\", __func__, len);", "exit(-1);", "}", "return s->outfifo + VAR_0;", "}", "if (s->out_len > s->out_size) {", "fprintf(stderr, \"%s: can't alloc %i bytes\\n\", __func__, len);", "exit(-1);", "}", "return s->outfifo + VAR_0 - s->out_size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ] ]
20,737
static void test_dummy_createcmdl(void) { QemuOpts *opts; DummyObject *dobj; Error *err = NULL; const char *params = TYPE_DUMMY \ ",id=dev0," \ "bv=yes,sv=Hiss hiss hiss,av=platypus"; qemu_add_opts(&qemu_object_opts); opts = qemu_opts_parse(&qemu_object_opts, params, true, &err); g_assert(err == NULL); g_assert(opts); dobj = DUMMY_OBJECT(user_creatable_add_opts(opts, &err)); g_assert(err == NULL); g_assert(dobj); g_assert_cmpstr(dobj->sv, ==, "Hiss hiss hiss"); g_assert(dobj->bv == true); g_assert(dobj->av == DUMMY_PLATYPUS); user_creatable_del("dev0", &err); g_assert(err == NULL); error_free(err); /* * cmdline-parsing via qemu_opts_parse() results in a QemuOpts entry * corresponding to the Object's ID to be added to the QemuOptsList * for objects. To avoid having this entry conflict with future * Objects using the same ID (which can happen in cases where * qemu_opts_parse() is used to parse the object params, such as * with hmp_object_add() at the time of this comment), we need to * check for this in user_creatable_del() and remove the QemuOpts if * it is present. * * FIXME: add an assert to verify that the QemuOpts is cleaned up * once the corresponding cleanup code is added. */ }
false
qemu
c645d5acee0ae022534cb609184277ec2b4a8577
static void test_dummy_createcmdl(void) { QemuOpts *opts; DummyObject *dobj; Error *err = NULL; const char *params = TYPE_DUMMY \ ",id=dev0," \ "bv=yes,sv=Hiss hiss hiss,av=platypus"; qemu_add_opts(&qemu_object_opts); opts = qemu_opts_parse(&qemu_object_opts, params, true, &err); g_assert(err == NULL); g_assert(opts); dobj = DUMMY_OBJECT(user_creatable_add_opts(opts, &err)); g_assert(err == NULL); g_assert(dobj); g_assert_cmpstr(dobj->sv, ==, "Hiss hiss hiss"); g_assert(dobj->bv == true); g_assert(dobj->av == DUMMY_PLATYPUS); user_creatable_del("dev0", &err); g_assert(err == NULL); error_free(err); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { QemuOpts *opts; DummyObject *dobj; Error *err = NULL; const char *VAR_0 = TYPE_DUMMY \ ",id=dev0," \ "bv=yes,sv=Hiss hiss hiss,av=platypus"; qemu_add_opts(&qemu_object_opts); opts = qemu_opts_parse(&qemu_object_opts, VAR_0, true, &err); g_assert(err == NULL); g_assert(opts); dobj = DUMMY_OBJECT(user_creatable_add_opts(opts, &err)); g_assert(err == NULL); g_assert(dobj); g_assert_cmpstr(dobj->sv, ==, "Hiss hiss hiss"); g_assert(dobj->bv == true); g_assert(dobj->av == DUMMY_PLATYPUS); user_creatable_del("dev0", &err); g_assert(err == NULL); error_free(err); }
[ "static void FUNC_0(void)\n{", "QemuOpts *opts;", "DummyObject *dobj;", "Error *err = NULL;", "const char *VAR_0 = TYPE_DUMMY \\\n\",id=dev0,\" \\\n\"bv=yes,sv=Hiss hiss hiss,av=platypus\";", "qemu_add_opts(&qemu_object_opts);", "opts = qemu_opts_parse(&qemu_object_opts, VAR_0, true, &err);", "g_assert(err == NULL);", "g_assert(opts);", "dobj = DUMMY_OBJECT(user_creatable_add_opts(opts, &err));", "g_assert(err == NULL);", "g_assert(dobj);", "g_assert_cmpstr(dobj->sv, ==, \"Hiss hiss hiss\");", "g_assert(dobj->bv == true);", "g_assert(dobj->av == DUMMY_PLATYPUS);", "user_creatable_del(\"dev0\", &err);", "g_assert(err == NULL);", "error_free(err);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13, 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 77 ] ]
20,739
static void musicpal_init(ram_addr_t ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env; qemu_irq *pic; int index; int iomemtype; unsigned long flash_size; if (!cpu_model) cpu_model = "arm926"; env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } pic = arm_pic_init_cpu(env); /* For now we use a fixed - the original - RAM size */ cpu_register_physical_memory(0, MP_RAM_DEFAULT_SIZE, qemu_ram_alloc(MP_RAM_DEFAULT_SIZE)); sram_off = qemu_ram_alloc(MP_SRAM_SIZE); cpu_register_physical_memory(MP_SRAM_BASE, MP_SRAM_SIZE, sram_off); /* Catch various stuff not handled by separate subsystems */ iomemtype = cpu_register_io_memory(0, musicpal_readfn, musicpal_writefn, env); cpu_register_physical_memory(0x80000000, 0x10000, iomemtype); pic = mv88w8618_pic_init(MP_PIC_BASE, pic[ARM_PIC_CPU_IRQ]); mv88w8618_pit_init(MP_PIT_BASE, pic, MP_TIMER1_IRQ); if (serial_hds[0]) serial_mm_init(MP_UART1_BASE, 2, pic[MP_UART1_IRQ], 1825000, serial_hds[0], 1); if (serial_hds[1]) serial_mm_init(MP_UART2_BASE, 2, pic[MP_UART2_IRQ], 1825000, serial_hds[1], 1); /* Register flash */ index = drive_get_index(IF_PFLASH, 0, 0); if (index != -1) { flash_size = bdrv_getlength(drives_table[index].bdrv); if (flash_size != 8*1024*1024 && flash_size != 16*1024*1024 && flash_size != 32*1024*1024) { fprintf(stderr, "Invalid flash image size\n"); exit(1); } /* * The original U-Boot accesses the flash at 0xFE000000 instead of * 0xFF800000 (if there is 8 MB flash). So remap flash access if the * image is smaller than 32 MB. */ pflash_cfi02_register(0-MP_FLASH_SIZE_MAX, qemu_ram_alloc(flash_size), drives_table[index].bdrv, 0x10000, (flash_size + 0xffff) >> 16, MP_FLASH_SIZE_MAX / flash_size, 2, 0x00BF, 0x236D, 0x0000, 0x0000, 0x5555, 0x2AAA); } mv88w8618_flashcfg_init(MP_FLASHCFG_BASE); musicpal_lcd_init(ds, MP_LCD_BASE); qemu_add_kbd_event_handler(musicpal_key_event, pic[MP_GPIO_IRQ]); /* * Wait a bit to catch menu button during U-Boot start-up * (to trigger emergency update). */ sleep(1); mv88w8618_eth_init(&nd_table[0], MP_ETH_BASE, pic[MP_ETH_IRQ]); mixer_i2c = musicpal_audio_init(MP_AUDIO_BASE, pic[MP_AUDIO_IRQ]); musicpal_binfo.ram_size = MP_RAM_DEFAULT_SIZE; musicpal_binfo.kernel_filename = kernel_filename; musicpal_binfo.kernel_cmdline = kernel_cmdline; musicpal_binfo.initrd_filename = initrd_filename; arm_load_kernel(env, &musicpal_binfo); }
false
qemu
c8256f9d23bba4fac3b0b6a9e6e3dc12362cbe0b
static void musicpal_init(ram_addr_t ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env; qemu_irq *pic; int index; int iomemtype; unsigned long flash_size; if (!cpu_model) cpu_model = "arm926"; env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } pic = arm_pic_init_cpu(env); cpu_register_physical_memory(0, MP_RAM_DEFAULT_SIZE, qemu_ram_alloc(MP_RAM_DEFAULT_SIZE)); sram_off = qemu_ram_alloc(MP_SRAM_SIZE); cpu_register_physical_memory(MP_SRAM_BASE, MP_SRAM_SIZE, sram_off); iomemtype = cpu_register_io_memory(0, musicpal_readfn, musicpal_writefn, env); cpu_register_physical_memory(0x80000000, 0x10000, iomemtype); pic = mv88w8618_pic_init(MP_PIC_BASE, pic[ARM_PIC_CPU_IRQ]); mv88w8618_pit_init(MP_PIT_BASE, pic, MP_TIMER1_IRQ); if (serial_hds[0]) serial_mm_init(MP_UART1_BASE, 2, pic[MP_UART1_IRQ], 1825000, serial_hds[0], 1); if (serial_hds[1]) serial_mm_init(MP_UART2_BASE, 2, pic[MP_UART2_IRQ], 1825000, serial_hds[1], 1); index = drive_get_index(IF_PFLASH, 0, 0); if (index != -1) { flash_size = bdrv_getlength(drives_table[index].bdrv); if (flash_size != 8*1024*1024 && flash_size != 16*1024*1024 && flash_size != 32*1024*1024) { fprintf(stderr, "Invalid flash image size\n"); exit(1); } pflash_cfi02_register(0-MP_FLASH_SIZE_MAX, qemu_ram_alloc(flash_size), drives_table[index].bdrv, 0x10000, (flash_size + 0xffff) >> 16, MP_FLASH_SIZE_MAX / flash_size, 2, 0x00BF, 0x236D, 0x0000, 0x0000, 0x5555, 0x2AAA); } mv88w8618_flashcfg_init(MP_FLASHCFG_BASE); musicpal_lcd_init(ds, MP_LCD_BASE); qemu_add_kbd_event_handler(musicpal_key_event, pic[MP_GPIO_IRQ]); sleep(1); mv88w8618_eth_init(&nd_table[0], MP_ETH_BASE, pic[MP_ETH_IRQ]); mixer_i2c = musicpal_audio_init(MP_AUDIO_BASE, pic[MP_AUDIO_IRQ]); musicpal_binfo.ram_size = MP_RAM_DEFAULT_SIZE; musicpal_binfo.kernel_filename = kernel_filename; musicpal_binfo.kernel_cmdline = kernel_cmdline; musicpal_binfo.initrd_filename = initrd_filename; arm_load_kernel(env, &musicpal_binfo); }
{ "code": [], "line_no": [] }
static void FUNC_0(ram_addr_t VAR_0, int VAR_1, const char *VAR_2, DisplayState *VAR_3, const char *VAR_4, const char *VAR_5, const char *VAR_6, const char *VAR_7) { CPUState *env; qemu_irq *pic; int VAR_8; int VAR_9; unsigned long VAR_10; if (!VAR_7) VAR_7 = "arm926"; env = cpu_init(VAR_7); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } pic = arm_pic_init_cpu(env); cpu_register_physical_memory(0, MP_RAM_DEFAULT_SIZE, qemu_ram_alloc(MP_RAM_DEFAULT_SIZE)); sram_off = qemu_ram_alloc(MP_SRAM_SIZE); cpu_register_physical_memory(MP_SRAM_BASE, MP_SRAM_SIZE, sram_off); VAR_9 = cpu_register_io_memory(0, musicpal_readfn, musicpal_writefn, env); cpu_register_physical_memory(0x80000000, 0x10000, VAR_9); pic = mv88w8618_pic_init(MP_PIC_BASE, pic[ARM_PIC_CPU_IRQ]); mv88w8618_pit_init(MP_PIT_BASE, pic, MP_TIMER1_IRQ); if (serial_hds[0]) serial_mm_init(MP_UART1_BASE, 2, pic[MP_UART1_IRQ], 1825000, serial_hds[0], 1); if (serial_hds[1]) serial_mm_init(MP_UART2_BASE, 2, pic[MP_UART2_IRQ], 1825000, serial_hds[1], 1); VAR_8 = drive_get_index(IF_PFLASH, 0, 0); if (VAR_8 != -1) { VAR_10 = bdrv_getlength(drives_table[VAR_8].bdrv); if (VAR_10 != 8*1024*1024 && VAR_10 != 16*1024*1024 && VAR_10 != 32*1024*1024) { fprintf(stderr, "Invalid flash image size\n"); exit(1); } pflash_cfi02_register(0-MP_FLASH_SIZE_MAX, qemu_ram_alloc(VAR_10), drives_table[VAR_8].bdrv, 0x10000, (VAR_10 + 0xffff) >> 16, MP_FLASH_SIZE_MAX / VAR_10, 2, 0x00BF, 0x236D, 0x0000, 0x0000, 0x5555, 0x2AAA); } mv88w8618_flashcfg_init(MP_FLASHCFG_BASE); musicpal_lcd_init(VAR_3, MP_LCD_BASE); qemu_add_kbd_event_handler(musicpal_key_event, pic[MP_GPIO_IRQ]); sleep(1); mv88w8618_eth_init(&nd_table[0], MP_ETH_BASE, pic[MP_ETH_IRQ]); mixer_i2c = musicpal_audio_init(MP_AUDIO_BASE, pic[MP_AUDIO_IRQ]); musicpal_binfo.VAR_0 = MP_RAM_DEFAULT_SIZE; musicpal_binfo.VAR_4 = VAR_4; musicpal_binfo.VAR_5 = VAR_5; musicpal_binfo.VAR_6 = VAR_6; arm_load_kernel(env, &musicpal_binfo); }
[ "static void FUNC_0(ram_addr_t VAR_0, int VAR_1,\nconst char *VAR_2, DisplayState *VAR_3,\nconst char *VAR_4, const char *VAR_5,\nconst char *VAR_6, const char *VAR_7)\n{", "CPUState *env;", "qemu_irq *pic;", "int VAR_8;", "int VAR_9;", "unsigned long VAR_10;", "if (!VAR_7)\nVAR_7 = \"arm926\";", "env = cpu_init(VAR_7);", "if (!env) {", "fprintf(stderr, \"Unable to find CPU definition\\n\");", "exit(1);", "}", "pic = arm_pic_init_cpu(env);", "cpu_register_physical_memory(0, MP_RAM_DEFAULT_SIZE,\nqemu_ram_alloc(MP_RAM_DEFAULT_SIZE));", "sram_off = qemu_ram_alloc(MP_SRAM_SIZE);", "cpu_register_physical_memory(MP_SRAM_BASE, MP_SRAM_SIZE, sram_off);", "VAR_9 = cpu_register_io_memory(0, musicpal_readfn,\nmusicpal_writefn, env);", "cpu_register_physical_memory(0x80000000, 0x10000, VAR_9);", "pic = mv88w8618_pic_init(MP_PIC_BASE, pic[ARM_PIC_CPU_IRQ]);", "mv88w8618_pit_init(MP_PIT_BASE, pic, MP_TIMER1_IRQ);", "if (serial_hds[0])\nserial_mm_init(MP_UART1_BASE, 2, pic[MP_UART1_IRQ], 1825000,\nserial_hds[0], 1);", "if (serial_hds[1])\nserial_mm_init(MP_UART2_BASE, 2, pic[MP_UART2_IRQ], 1825000,\nserial_hds[1], 1);", "VAR_8 = drive_get_index(IF_PFLASH, 0, 0);", "if (VAR_8 != -1) {", "VAR_10 = bdrv_getlength(drives_table[VAR_8].bdrv);", "if (VAR_10 != 8*1024*1024 && VAR_10 != 16*1024*1024 &&\nVAR_10 != 32*1024*1024) {", "fprintf(stderr, \"Invalid flash image size\\n\");", "exit(1);", "}", "pflash_cfi02_register(0-MP_FLASH_SIZE_MAX, qemu_ram_alloc(VAR_10),\ndrives_table[VAR_8].bdrv, 0x10000,\n(VAR_10 + 0xffff) >> 16,\nMP_FLASH_SIZE_MAX / VAR_10,\n2, 0x00BF, 0x236D, 0x0000, 0x0000,\n0x5555, 0x2AAA);", "}", "mv88w8618_flashcfg_init(MP_FLASHCFG_BASE);", "musicpal_lcd_init(VAR_3, MP_LCD_BASE);", "qemu_add_kbd_event_handler(musicpal_key_event, pic[MP_GPIO_IRQ]);", "sleep(1);", "mv88w8618_eth_init(&nd_table[0], MP_ETH_BASE, pic[MP_ETH_IRQ]);", "mixer_i2c = musicpal_audio_init(MP_AUDIO_BASE, pic[MP_AUDIO_IRQ]);", "musicpal_binfo.VAR_0 = MP_RAM_DEFAULT_SIZE;", "musicpal_binfo.VAR_4 = VAR_4;", "musicpal_binfo.VAR_5 = VAR_5;", "musicpal_binfo.VAR_6 = VAR_6;", "arm_load_kernel(env, &musicpal_binfo);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 59, 61 ], [ 63 ], [ 67 ], [ 69 ], [ 73, 75, 77 ], [ 79, 81, 83 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 117, 119, 121, 123, 125, 127 ], [ 129 ], [ 131 ], [ 135 ], [ 139 ], [ 151 ], [ 155 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ] ]
20,740
void helper_sysenter(CPUX86State *env) { if (env->sysenter_cs == 0) { raise_exception_err(env, EXCP0D_GPF, 0); } env->eflags &= ~(VM_MASK | IF_MASK | RF_MASK); cpu_x86_set_cpl(env, 0); #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { cpu_x86_load_seg_cache(env, R_CS, env->sysenter_cs & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK); } else #endif { cpu_x86_load_seg_cache(env, R_CS, env->sysenter_cs & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK); } cpu_x86_load_seg_cache(env, R_SS, (env->sysenter_cs + 8) & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_W_MASK | DESC_A_MASK); env->regs[R_ESP] = env->sysenter_esp; env->eip = env->sysenter_eip; }
false
qemu
7848c8d19f8556666df25044bbd5d8b29439c368
void helper_sysenter(CPUX86State *env) { if (env->sysenter_cs == 0) { raise_exception_err(env, EXCP0D_GPF, 0); } env->eflags &= ~(VM_MASK | IF_MASK | RF_MASK); cpu_x86_set_cpl(env, 0); #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { cpu_x86_load_seg_cache(env, R_CS, env->sysenter_cs & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK); } else #endif { cpu_x86_load_seg_cache(env, R_CS, env->sysenter_cs & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK); } cpu_x86_load_seg_cache(env, R_SS, (env->sysenter_cs + 8) & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_W_MASK | DESC_A_MASK); env->regs[R_ESP] = env->sysenter_esp; env->eip = env->sysenter_eip; }
{ "code": [], "line_no": [] }
void FUNC_0(CPUX86State *VAR_0) { if (VAR_0->sysenter_cs == 0) { raise_exception_err(VAR_0, EXCP0D_GPF, 0); } VAR_0->eflags &= ~(VM_MASK | IF_MASK | RF_MASK); cpu_x86_set_cpl(VAR_0, 0); #ifdef TARGET_X86_64 if (VAR_0->hflags & HF_LMA_MASK) { cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_0->sysenter_cs & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK); } else #endif { cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_0->sysenter_cs & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK); } cpu_x86_load_seg_cache(VAR_0, R_SS, (VAR_0->sysenter_cs + 8) & 0xfffc, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | DESC_W_MASK | DESC_A_MASK); VAR_0->regs[R_ESP] = VAR_0->sysenter_esp; VAR_0->eip = VAR_0->sysenter_eip; }
[ "void FUNC_0(CPUX86State *VAR_0)\n{", "if (VAR_0->sysenter_cs == 0) {", "raise_exception_err(VAR_0, EXCP0D_GPF, 0);", "}", "VAR_0->eflags &= ~(VM_MASK | IF_MASK | RF_MASK);", "cpu_x86_set_cpl(VAR_0, 0);", "#ifdef TARGET_X86_64\nif (VAR_0->hflags & HF_LMA_MASK) {", "cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_0->sysenter_cs & 0xfffc,\n0, 0xffffffff,\nDESC_G_MASK | DESC_B_MASK | DESC_P_MASK |\nDESC_S_MASK |\nDESC_CS_MASK | DESC_R_MASK | DESC_A_MASK |\nDESC_L_MASK);", "} else", "#endif\n{", "cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_0->sysenter_cs & 0xfffc,\n0, 0xffffffff,\nDESC_G_MASK | DESC_B_MASK | DESC_P_MASK |\nDESC_S_MASK |\nDESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);", "}", "cpu_x86_load_seg_cache(VAR_0, R_SS, (VAR_0->sysenter_cs + 8) & 0xfffc,\n0, 0xffffffff,\nDESC_G_MASK | DESC_B_MASK | DESC_P_MASK |\nDESC_S_MASK |\nDESC_W_MASK | DESC_A_MASK);", "VAR_0->regs[R_ESP] = VAR_0->sysenter_esp;", "VAR_0->eip = VAR_0->sysenter_eip;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21, 23, 25, 27, 29, 31 ], [ 33 ], [ 35, 37 ], [ 39, 41, 43, 45, 47 ], [ 49 ], [ 51, 53, 55, 57, 59 ], [ 61 ], [ 63 ], [ 65 ] ]
20,742
int bdrv_snapshot_load_tmp_by_id_or_name(BlockDriverState *bs, const char *id_or_name, Error **errp) { int ret; Error *local_err = NULL; ret = bdrv_snapshot_load_tmp(bs, id_or_name, NULL, &local_err); if (ret == -ENOENT || ret == -EINVAL) { error_free(local_err); local_err = NULL; ret = bdrv_snapshot_load_tmp(bs, NULL, id_or_name, &local_err); } if (local_err) { error_propagate(errp, local_err); } return ret; }
false
qemu
621ff94d5074d88253a5818c6b9c4db718fbfc65
int bdrv_snapshot_load_tmp_by_id_or_name(BlockDriverState *bs, const char *id_or_name, Error **errp) { int ret; Error *local_err = NULL; ret = bdrv_snapshot_load_tmp(bs, id_or_name, NULL, &local_err); if (ret == -ENOENT || ret == -EINVAL) { error_free(local_err); local_err = NULL; ret = bdrv_snapshot_load_tmp(bs, NULL, id_or_name, &local_err); } if (local_err) { error_propagate(errp, local_err); } return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, Error **VAR_2) { int VAR_3; Error *local_err = NULL; VAR_3 = bdrv_snapshot_load_tmp(VAR_0, VAR_1, NULL, &local_err); if (VAR_3 == -ENOENT || VAR_3 == -EINVAL) { error_free(local_err); local_err = NULL; VAR_3 = bdrv_snapshot_load_tmp(VAR_0, NULL, VAR_1, &local_err); } if (local_err) { error_propagate(VAR_2, local_err); } return VAR_3; }
[ "int FUNC_0(BlockDriverState *VAR_0,\nconst char *VAR_1,\nError **VAR_2)\n{", "int VAR_3;", "Error *local_err = NULL;", "VAR_3 = bdrv_snapshot_load_tmp(VAR_0, VAR_1, NULL, &local_err);", "if (VAR_3 == -ENOENT || VAR_3 == -EINVAL) {", "error_free(local_err);", "local_err = NULL;", "VAR_3 = bdrv_snapshot_load_tmp(VAR_0, NULL, VAR_1, &local_err);", "}", "if (local_err) {", "error_propagate(VAR_2, local_err);", "}", "return VAR_3;", "}" ]
[ 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 ], [ 33 ], [ 37 ], [ 39 ] ]
20,745
void vnc_init_state(VncState *vs) { vs->initialized = true; VncDisplay *vd = vs->vd; bool first_client = QTAILQ_EMPTY(&vd->clients); vs->last_x = -1; vs->last_y = -1; vs->as.freq = 44100; vs->as.nchannels = 2; vs->as.fmt = AUD_FMT_S16; vs->as.endianness = 0; qemu_mutex_init(&vs->output_mutex); vs->bh = qemu_bh_new(vnc_jobs_bh, vs); QTAILQ_INSERT_TAIL(&vd->clients, vs, next); if (first_client) { vnc_update_server_surface(vd); } graphic_hw_update(vd->dcl.con); vnc_write(vs, "RFB 003.008\n", 12); vnc_flush(vs); vnc_read_when(vs, protocol_version, 12); reset_keys(vs); if (vs->vd->lock_key_sync) vs->led = qemu_add_led_event_handler(kbd_leds, vs); vs->mouse_mode_notifier.notify = check_pointer_type_change; qemu_add_mouse_mode_change_notifier(&vs->mouse_mode_notifier); }
false
qemu
2df2041036ee63ff9116631c6214e3ffb5f4bf45
void vnc_init_state(VncState *vs) { vs->initialized = true; VncDisplay *vd = vs->vd; bool first_client = QTAILQ_EMPTY(&vd->clients); vs->last_x = -1; vs->last_y = -1; vs->as.freq = 44100; vs->as.nchannels = 2; vs->as.fmt = AUD_FMT_S16; vs->as.endianness = 0; qemu_mutex_init(&vs->output_mutex); vs->bh = qemu_bh_new(vnc_jobs_bh, vs); QTAILQ_INSERT_TAIL(&vd->clients, vs, next); if (first_client) { vnc_update_server_surface(vd); } graphic_hw_update(vd->dcl.con); vnc_write(vs, "RFB 003.008\n", 12); vnc_flush(vs); vnc_read_when(vs, protocol_version, 12); reset_keys(vs); if (vs->vd->lock_key_sync) vs->led = qemu_add_led_event_handler(kbd_leds, vs); vs->mouse_mode_notifier.notify = check_pointer_type_change; qemu_add_mouse_mode_change_notifier(&vs->mouse_mode_notifier); }
{ "code": [], "line_no": [] }
void FUNC_0(VncState *VAR_0) { VAR_0->initialized = true; VncDisplay *vd = VAR_0->vd; bool first_client = QTAILQ_EMPTY(&vd->clients); VAR_0->last_x = -1; VAR_0->last_y = -1; VAR_0->as.freq = 44100; VAR_0->as.nchannels = 2; VAR_0->as.fmt = AUD_FMT_S16; VAR_0->as.endianness = 0; qemu_mutex_init(&VAR_0->output_mutex); VAR_0->bh = qemu_bh_new(vnc_jobs_bh, VAR_0); QTAILQ_INSERT_TAIL(&vd->clients, VAR_0, next); if (first_client) { vnc_update_server_surface(vd); } graphic_hw_update(vd->dcl.con); vnc_write(VAR_0, "RFB 003.008\n", 12); vnc_flush(VAR_0); vnc_read_when(VAR_0, protocol_version, 12); reset_keys(VAR_0); if (VAR_0->vd->lock_key_sync) VAR_0->led = qemu_add_led_event_handler(kbd_leds, VAR_0); VAR_0->mouse_mode_notifier.notify = check_pointer_type_change; qemu_add_mouse_mode_change_notifier(&VAR_0->mouse_mode_notifier); }
[ "void FUNC_0(VncState *VAR_0)\n{", "VAR_0->initialized = true;", "VncDisplay *vd = VAR_0->vd;", "bool first_client = QTAILQ_EMPTY(&vd->clients);", "VAR_0->last_x = -1;", "VAR_0->last_y = -1;", "VAR_0->as.freq = 44100;", "VAR_0->as.nchannels = 2;", "VAR_0->as.fmt = AUD_FMT_S16;", "VAR_0->as.endianness = 0;", "qemu_mutex_init(&VAR_0->output_mutex);", "VAR_0->bh = qemu_bh_new(vnc_jobs_bh, VAR_0);", "QTAILQ_INSERT_TAIL(&vd->clients, VAR_0, next);", "if (first_client) {", "vnc_update_server_surface(vd);", "}", "graphic_hw_update(vd->dcl.con);", "vnc_write(VAR_0, \"RFB 003.008\\n\", 12);", "vnc_flush(VAR_0);", "vnc_read_when(VAR_0, protocol_version, 12);", "reset_keys(VAR_0);", "if (VAR_0->vd->lock_key_sync)\nVAR_0->led = qemu_add_led_event_handler(kbd_leds, VAR_0);", "VAR_0->mouse_mode_notifier.notify = check_pointer_type_change;", "qemu_add_mouse_mode_change_notifier(&VAR_0->mouse_mode_notifier);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 63 ], [ 65 ], [ 67 ] ]
20,746
void migrate_fd_error(MigrationState *s, const Error *error) { trace_migrate_fd_error(error ? error_get_pretty(error) : ""); assert(s->to_dst_file == NULL); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); if (!s->error) { s->error = error_copy(error); } notifier_list_notify(&migration_state_notifiers, s); }
false
qemu
25174055f428254427e7541139037eb9a34fc109
void migrate_fd_error(MigrationState *s, const Error *error) { trace_migrate_fd_error(error ? error_get_pretty(error) : ""); assert(s->to_dst_file == NULL); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); if (!s->error) { s->error = error_copy(error); } notifier_list_notify(&migration_state_notifiers, s); }
{ "code": [], "line_no": [] }
void FUNC_0(MigrationState *VAR_0, const Error *VAR_1) { trace_migrate_fd_error(VAR_1 ? error_get_pretty(VAR_1) : ""); assert(VAR_0->to_dst_file == NULL); migrate_set_state(&VAR_0->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); if (!VAR_0->VAR_1) { VAR_0->VAR_1 = error_copy(VAR_1); } notifier_list_notify(&migration_state_notifiers, VAR_0); }
[ "void FUNC_0(MigrationState *VAR_0, const Error *VAR_1)\n{", "trace_migrate_fd_error(VAR_1 ? error_get_pretty(VAR_1) : \"\");", "assert(VAR_0->to_dst_file == NULL);", "migrate_set_state(&VAR_0->state, MIGRATION_STATUS_SETUP,\nMIGRATION_STATUS_FAILED);", "if (!VAR_0->VAR_1) {", "VAR_0->VAR_1 = error_copy(VAR_1);", "}", "notifier_list_notify(&migration_state_notifiers, VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
20,747
get_field (const unsigned char *data, enum floatformat_byteorders order, unsigned int total_len, unsigned int start, unsigned int len) { unsigned long result; unsigned int cur_byte; int cur_bitshift; /* Start at the least significant part of the field. */ cur_byte = (start + len) / FLOATFORMAT_CHAR_BIT; if (order == floatformat_little) cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) - cur_byte - 1; cur_bitshift = ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT; result = *(data + cur_byte) >> (-cur_bitshift); cur_bitshift += FLOATFORMAT_CHAR_BIT; if (order == floatformat_little) ++cur_byte; else --cur_byte; /* Move towards the most significant part of the field. */ while ((unsigned int) cur_bitshift < len) { if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT) /* This is the last byte; zero out the bits which are not part of this field. */ result |= (*(data + cur_byte) & ((1 << (len - cur_bitshift)) - 1)) << cur_bitshift; else result |= *(data + cur_byte) << cur_bitshift; cur_bitshift += FLOATFORMAT_CHAR_BIT; if (order == floatformat_little) ++cur_byte; else --cur_byte; } return result; }
false
qemu
2e3883d03df167b15f2acc5345eb9a7e0150a062
get_field (const unsigned char *data, enum floatformat_byteorders order, unsigned int total_len, unsigned int start, unsigned int len) { unsigned long result; unsigned int cur_byte; int cur_bitshift; cur_byte = (start + len) / FLOATFORMAT_CHAR_BIT; if (order == floatformat_little) cur_byte = (total_len / FLOATFORMAT_CHAR_BIT) - cur_byte - 1; cur_bitshift = ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT; result = *(data + cur_byte) >> (-cur_bitshift); cur_bitshift += FLOATFORMAT_CHAR_BIT; if (order == floatformat_little) ++cur_byte; else --cur_byte; while ((unsigned int) cur_bitshift < len) { if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT) result |= (*(data + cur_byte) & ((1 << (len - cur_bitshift)) - 1)) << cur_bitshift; else result |= *(data + cur_byte) << cur_bitshift; cur_bitshift += FLOATFORMAT_CHAR_BIT; if (order == floatformat_little) ++cur_byte; else --cur_byte; } return result; }
{ "code": [], "line_no": [] }
FUNC_0 (const unsigned char *VAR_0, enum floatformat_byteorders VAR_1, unsigned int VAR_2, unsigned int VAR_3, unsigned int VAR_4) { unsigned long VAR_5; unsigned int VAR_6; int VAR_7; VAR_6 = (VAR_3 + VAR_4) / FLOATFORMAT_CHAR_BIT; if (VAR_1 == floatformat_little) VAR_6 = (VAR_2 / FLOATFORMAT_CHAR_BIT) - VAR_6 - 1; VAR_7 = ((VAR_3 + VAR_4) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT; VAR_5 = *(VAR_0 + VAR_6) >> (-VAR_7); VAR_7 += FLOATFORMAT_CHAR_BIT; if (VAR_1 == floatformat_little) ++VAR_6; else --VAR_6; while ((unsigned int) VAR_7 < VAR_4) { if (VAR_4 - VAR_7 < FLOATFORMAT_CHAR_BIT) VAR_5 |= (*(VAR_0 + VAR_6) & ((1 << (VAR_4 - VAR_7)) - 1)) << VAR_7; else VAR_5 |= *(VAR_0 + VAR_6) << VAR_7; VAR_7 += FLOATFORMAT_CHAR_BIT; if (VAR_1 == floatformat_little) ++VAR_6; else --VAR_6; } return VAR_5; }
[ "FUNC_0 (const unsigned char *VAR_0, enum floatformat_byteorders VAR_1,\nunsigned int VAR_2, unsigned int VAR_3, unsigned int VAR_4)\n{", "unsigned long VAR_5;", "unsigned int VAR_6;", "int VAR_7;", "VAR_6 = (VAR_3 + VAR_4) / FLOATFORMAT_CHAR_BIT;", "if (VAR_1 == floatformat_little)\nVAR_6 = (VAR_2 / FLOATFORMAT_CHAR_BIT) - VAR_6 - 1;", "VAR_7 =\n((VAR_3 + VAR_4) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT;", "VAR_5 = *(VAR_0 + VAR_6) >> (-VAR_7);", "VAR_7 += FLOATFORMAT_CHAR_BIT;", "if (VAR_1 == floatformat_little)\n++VAR_6;", "else\n--VAR_6;", "while ((unsigned int) VAR_7 < VAR_4)\n{", "if (VAR_4 - VAR_7 < FLOATFORMAT_CHAR_BIT)\nVAR_5 |=\n(*(VAR_0 + VAR_6) & ((1 << (VAR_4 - VAR_7)) - 1))\n<< VAR_7;", "else\nVAR_5 |= *(VAR_0 + VAR_6) << VAR_7;", "VAR_7 += FLOATFORMAT_CHAR_BIT;", "if (VAR_1 == floatformat_little)\n++VAR_6;", "else\n--VAR_6;", "}", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35, 37 ], [ 43, 45 ], [ 47, 53, 55, 57 ], [ 59, 61 ], [ 63 ], [ 65, 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ] ]