id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
listlengths
1
2.8k
label
listlengths
1
2.8k
line_no
listlengths
1
2.8k
11,452
void qemu_mutex_init(QemuMutex *mutex) { int err; pthread_mutexattr_t mutexattr; pthread_mutexattr_init(&mutexattr); pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_ERRORCHECK); err = pthread_mutex_init(&mutex->lock, &mutexattr); pthread_mutexattr_destroy(&mutexattr); if (err) error_exit(err, __func__); }
true
qemu
24fa90499f8b24bcba2960a3316d797f9b80b5e9
void qemu_mutex_init(QemuMutex *mutex) { int err; pthread_mutexattr_t mutexattr; pthread_mutexattr_init(&mutexattr); pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_ERRORCHECK); err = pthread_mutex_init(&mutex->lock, &mutexattr); pthread_mutexattr_destroy(&mutexattr); if (err) error_exit(err, __func__); }
{ "code": [ " pthread_mutexattr_t mutexattr;", " pthread_mutexattr_init(&mutexattr);", " pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_ERRORCHECK);", " err = pthread_mutex_init(&mutex->lock, &mutexattr);", " pthread_mutexattr_destroy(&mutexattr);" ], "line_no": [ 7, 11, 13, 15, 17 ] }
void FUNC_0(QemuMutex *VAR_0) { int VAR_1; pthread_mutexattr_t mutexattr; pthread_mutexattr_init(&mutexattr); pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_ERRORCHECK); VAR_1 = pthread_mutex_init(&VAR_0->lock, &mutexattr); pthread_mutexattr_destroy(&mutexattr); if (VAR_1) error_exit(VAR_1, __func__); }
[ "void FUNC_0(QemuMutex *VAR_0)\n{", "int VAR_1;", "pthread_mutexattr_t mutexattr;", "pthread_mutexattr_init(&mutexattr);", "pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_ERRORCHECK);", "VAR_1 = pthread_mutex_init(&VAR_0->lock, &mutexattr);", "pthread_mutexattr_destroy(&mutexattr);", "if (VAR_1)\nerror_exit(VAR_1, __func__);", "}" ]
[ 0, 0, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ] ]
11,453
static int old_codec47(SANMVideoContext *ctx, int top, int left, int width, int height) { int i, j, seq, compr, new_rot, tbl_pos, skip; int stride = ctx->pitch; uint8_t *dst = ((uint8_t*)ctx->frm0) + left + top * stride; uint8_t *prev1 = (uint8_t*)ctx->frm1; uint8_t *prev2 = (uint8_t*)ctx->frm2; uint32_t decoded_size; tbl_pos = bytestream2_tell(&ctx->gb); seq = bytestream2_get_le16(&ctx->gb); compr = bytestream2_get_byte(&ctx->gb); new_rot = bytestream2_get_byte(&ctx->gb); skip = bytestream2_get_byte(&ctx->gb); bytestream2_skip(&ctx->gb, 9); decoded_size = bytestream2_get_le32(&ctx->gb); bytestream2_skip(&ctx->gb, 8); if (skip & 1) bytestream2_skip(&ctx->gb, 0x8080); if (!seq) { ctx->prev_seq = -1; memset(prev1, 0, ctx->height * stride); memset(prev2, 0, ctx->height * stride); av_dlog(ctx->avctx, "compression %d\n", compr); switch (compr) { case 0: if (bytestream2_get_bytes_left(&ctx->gb) < width * height) return AVERROR_INVALIDDATA; for (j = 0; j < height; j++) { bytestream2_get_bufferu(&ctx->gb, dst, width); dst += stride; break; case 1: if (bytestream2_get_bytes_left(&ctx->gb) < ((width + 1) >> 1) * ((height + 1) >> 1)) return AVERROR_INVALIDDATA; for (j = 0; j < height; j += 2) { for (i = 0; i < width; i += 2) { dst[i] = dst[i + 1] = dst[stride + i] = dst[stride + i + 1] = bytestream2_get_byteu(&ctx->gb); dst += stride * 2; break; case 2: if (seq == ctx->prev_seq + 1) { for (j = 0; j < height; j += 8) { for (i = 0; i < width; i += 8) { if (process_block(ctx, dst + i, prev1 + i, prev2 + i, stride, tbl_pos + 8, 8)) return AVERROR_INVALIDDATA; dst += stride * 8; prev1 += stride * 8; prev2 += stride * 8; break; case 3: memcpy(ctx->frm0, ctx->frm2, ctx->pitch * ctx->height); break; case 4: memcpy(ctx->frm0, ctx->frm1, ctx->pitch * ctx->height); break; case 5: if (rle_decode(ctx, dst, decoded_size)) return AVERROR_INVALIDDATA; break; default: av_log(ctx->avctx, AV_LOG_ERROR, "subcodec 47 compression %d not implemented\n", compr); return AVERROR_PATCHWELCOME; if (seq == ctx->prev_seq + 1) ctx->rotate_code = new_rot; else ctx->rotate_code = 0; ctx->prev_seq = seq; return 0;
true
FFmpeg
7357ca900efcf829de4cce4cec6ddc286526d417
static int old_codec47(SANMVideoContext *ctx, int top, int left, int width, int height) { int i, j, seq, compr, new_rot, tbl_pos, skip; int stride = ctx->pitch; uint8_t *dst = ((uint8_t*)ctx->frm0) + left + top * stride; uint8_t *prev1 = (uint8_t*)ctx->frm1; uint8_t *prev2 = (uint8_t*)ctx->frm2; uint32_t decoded_size; tbl_pos = bytestream2_tell(&ctx->gb); seq = bytestream2_get_le16(&ctx->gb); compr = bytestream2_get_byte(&ctx->gb); new_rot = bytestream2_get_byte(&ctx->gb); skip = bytestream2_get_byte(&ctx->gb); bytestream2_skip(&ctx->gb, 9); decoded_size = bytestream2_get_le32(&ctx->gb); bytestream2_skip(&ctx->gb, 8); if (skip & 1) bytestream2_skip(&ctx->gb, 0x8080); if (!seq) { ctx->prev_seq = -1; memset(prev1, 0, ctx->height * stride); memset(prev2, 0, ctx->height * stride); av_dlog(ctx->avctx, "compression %d\n", compr); switch (compr) { case 0: if (bytestream2_get_bytes_left(&ctx->gb) < width * height) return AVERROR_INVALIDDATA; for (j = 0; j < height; j++) { bytestream2_get_bufferu(&ctx->gb, dst, width); dst += stride; break; case 1: if (bytestream2_get_bytes_left(&ctx->gb) < ((width + 1) >> 1) * ((height + 1) >> 1)) return AVERROR_INVALIDDATA; for (j = 0; j < height; j += 2) { for (i = 0; i < width; i += 2) { dst[i] = dst[i + 1] = dst[stride + i] = dst[stride + i + 1] = bytestream2_get_byteu(&ctx->gb); dst += stride * 2; break; case 2: if (seq == ctx->prev_seq + 1) { for (j = 0; j < height; j += 8) { for (i = 0; i < width; i += 8) { if (process_block(ctx, dst + i, prev1 + i, prev2 + i, stride, tbl_pos + 8, 8)) return AVERROR_INVALIDDATA; dst += stride * 8; prev1 += stride * 8; prev2 += stride * 8; break; case 3: memcpy(ctx->frm0, ctx->frm2, ctx->pitch * ctx->height); break; case 4: memcpy(ctx->frm0, ctx->frm1, ctx->pitch * ctx->height); break; case 5: if (rle_decode(ctx, dst, decoded_size)) return AVERROR_INVALIDDATA; break; default: av_log(ctx->avctx, AV_LOG_ERROR, "subcodec 47 compression %d not implemented\n", compr); return AVERROR_PATCHWELCOME; if (seq == ctx->prev_seq + 1) ctx->rotate_code = new_rot; else ctx->rotate_code = 0; ctx->prev_seq = seq; return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(SANMVideoContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4) { int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; int VAR_12 = VAR_0->pitch; uint8_t *dst = ((uint8_t*)VAR_0->frm0) + VAR_2 + VAR_1 * VAR_12; uint8_t *prev1 = (uint8_t*)VAR_0->frm1; uint8_t *prev2 = (uint8_t*)VAR_0->frm2; uint32_t decoded_size; VAR_10 = bytestream2_tell(&VAR_0->gb); VAR_7 = bytestream2_get_le16(&VAR_0->gb); VAR_8 = bytestream2_get_byte(&VAR_0->gb); VAR_9 = bytestream2_get_byte(&VAR_0->gb); VAR_11 = bytestream2_get_byte(&VAR_0->gb); bytestream2_skip(&VAR_0->gb, 9); decoded_size = bytestream2_get_le32(&VAR_0->gb); bytestream2_skip(&VAR_0->gb, 8); if (VAR_11 & 1) bytestream2_skip(&VAR_0->gb, 0x8080); if (!VAR_7) { VAR_0->prev_seq = -1; memset(prev1, 0, VAR_0->VAR_4 * VAR_12); memset(prev2, 0, VAR_0->VAR_4 * VAR_12); av_dlog(VAR_0->avctx, "compression %d\n", VAR_8); switch (VAR_8) { case 0: if (bytestream2_get_bytes_left(&VAR_0->gb) < VAR_3 * VAR_4) return AVERROR_INVALIDDATA; for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) { bytestream2_get_bufferu(&VAR_0->gb, dst, VAR_3); dst += VAR_12; break; case 1: if (bytestream2_get_bytes_left(&VAR_0->gb) < ((VAR_3 + 1) >> 1) * ((VAR_4 + 1) >> 1)) return AVERROR_INVALIDDATA; for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6 += 2) { for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5 += 2) { dst[VAR_5] = dst[VAR_5 + 1] = dst[VAR_12 + VAR_5] = dst[VAR_12 + VAR_5 + 1] = bytestream2_get_byteu(&VAR_0->gb); dst += VAR_12 * 2; break; case 2: if (VAR_7 == VAR_0->prev_seq + 1) { for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6 += 8) { for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5 += 8) { if (process_block(VAR_0, dst + VAR_5, prev1 + VAR_5, prev2 + VAR_5, VAR_12, VAR_10 + 8, 8)) return AVERROR_INVALIDDATA; dst += VAR_12 * 8; prev1 += VAR_12 * 8; prev2 += VAR_12 * 8; break; case 3: memcpy(VAR_0->frm0, VAR_0->frm2, VAR_0->pitch * VAR_0->VAR_4); break; case 4: memcpy(VAR_0->frm0, VAR_0->frm1, VAR_0->pitch * VAR_0->VAR_4); break; case 5: if (rle_decode(VAR_0, dst, decoded_size)) return AVERROR_INVALIDDATA; break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "subcodec 47 compression %d not implemented\n", VAR_8); return AVERROR_PATCHWELCOME; if (VAR_7 == VAR_0->prev_seq + 1) VAR_0->rotate_code = VAR_9; else VAR_0->rotate_code = 0; VAR_0->prev_seq = VAR_7; return 0;
[ "static int FUNC_0(SANMVideoContext *VAR_0, int VAR_1,\nint VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;", "int VAR_12 = VAR_0->pitch;", "uint8_t *dst = ((uint8_t*)VAR_0->frm0) + VAR_2 + VAR_1 * VAR_12;", "uint8_t *prev1 = (uint8_t*)VAR_0->frm1;", "uint8_t *prev2 = (uint8_t*)VAR_0->frm2;", "uint32_t decoded_size;", "VAR_10 = bytestream2_tell(&VAR_0->gb);", "VAR_7 = bytestream2_get_le16(&VAR_0->gb);", "VAR_8 = bytestream2_get_byte(&VAR_0->gb);", "VAR_9 = bytestream2_get_byte(&VAR_0->gb);", "VAR_11 = bytestream2_get_byte(&VAR_0->gb);", "bytestream2_skip(&VAR_0->gb, 9);", "decoded_size = bytestream2_get_le32(&VAR_0->gb);", "bytestream2_skip(&VAR_0->gb, 8);", "if (VAR_11 & 1)\nbytestream2_skip(&VAR_0->gb, 0x8080);", "if (!VAR_7) {", "VAR_0->prev_seq = -1;", "memset(prev1, 0, VAR_0->VAR_4 * VAR_12);", "memset(prev2, 0, VAR_0->VAR_4 * VAR_12);", "av_dlog(VAR_0->avctx, \"compression %d\\n\", VAR_8);", "switch (VAR_8) {", "case 0:\nif (bytestream2_get_bytes_left(&VAR_0->gb) < VAR_3 * VAR_4)\nreturn AVERROR_INVALIDDATA;", "for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) {", "bytestream2_get_bufferu(&VAR_0->gb, dst, VAR_3);", "dst += VAR_12;", "break;", "case 1:\nif (bytestream2_get_bytes_left(&VAR_0->gb) < ((VAR_3 + 1) >> 1) * ((VAR_4 + 1) >> 1))\nreturn AVERROR_INVALIDDATA;", "for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6 += 2) {", "for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5 += 2) {", "dst[VAR_5] = dst[VAR_5 + 1] =\ndst[VAR_12 + VAR_5] = dst[VAR_12 + VAR_5 + 1] = bytestream2_get_byteu(&VAR_0->gb);", "dst += VAR_12 * 2;", "break;", "case 2:\nif (VAR_7 == VAR_0->prev_seq + 1) {", "for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6 += 8) {", "for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5 += 8) {", "if (process_block(VAR_0, dst + VAR_5, prev1 + VAR_5, prev2 + VAR_5, VAR_12,\nVAR_10 + 8, 8))\nreturn AVERROR_INVALIDDATA;", "dst += VAR_12 * 8;", "prev1 += VAR_12 * 8;", "prev2 += VAR_12 * 8;", "break;", "case 3:\nmemcpy(VAR_0->frm0, VAR_0->frm2, VAR_0->pitch * VAR_0->VAR_4);", "break;", "case 4:\nmemcpy(VAR_0->frm0, VAR_0->frm1, VAR_0->pitch * VAR_0->VAR_4);", "break;", "case 5:\nif (rle_decode(VAR_0, dst, decoded_size))\nreturn AVERROR_INVALIDDATA;", "break;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR,\n\"subcodec 47 compression %d not implemented\\n\", VAR_8);", "return AVERROR_PATCHWELCOME;", "if (VAR_7 == VAR_0->prev_seq + 1)\nVAR_0->rotate_code = VAR_9;", "else\nVAR_0->rotate_code = 0;", "VAR_0->prev_seq = 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 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18, 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26, 27, 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33, 34, 35 ], [ 36 ], [ 37 ], [ 38, 39 ], [ 40 ], [ 41 ], [ 42, 43 ], [ 44 ], [ 45 ], [ 46, 47, 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53, 54 ], [ 55 ], [ 56, 57 ], [ 58 ], [ 59, 60, 61 ], [ 62 ], [ 63, 64, 65 ], [ 66 ], [ 67, 68 ], [ 69, 70 ], [ 71 ], [ 72 ] ]
11,454
static av_cold int cinvideo_decode_end(AVCodecContext *avctx) { CinVideoContext *cin = avctx->priv_data; int i; if (cin->frame.data[0]) avctx->release_buffer(avctx, &cin->frame); for (i = 0; i < 3; ++i) av_free(cin->bitmap_table[i]); return 0; }
true
FFmpeg
d8245c3bcdd162891825a52cf55e4e8173d85a18
static av_cold int cinvideo_decode_end(AVCodecContext *avctx) { CinVideoContext *cin = avctx->priv_data; int i; if (cin->frame.data[0]) avctx->release_buffer(avctx, &cin->frame); for (i = 0; i < 3; ++i) av_free(cin->bitmap_table[i]); return 0; }
{ "code": [ " int i;", " for (i = 0; i < 3; ++i)", " av_free(cin->bitmap_table[i]);" ], "line_no": [ 7, 17, 19 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { CinVideoContext *cin = avctx->priv_data; int VAR_0; if (cin->frame.data[0]) avctx->release_buffer(avctx, &cin->frame); for (VAR_0 = 0; VAR_0 < 3; ++VAR_0) av_free(cin->bitmap_table[VAR_0]); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "CinVideoContext *cin = avctx->priv_data;", "int VAR_0;", "if (cin->frame.data[0])\navctx->release_buffer(avctx, &cin->frame);", "for (VAR_0 = 0; VAR_0 < 3; ++VAR_0)", "av_free(cin->bitmap_table[VAR_0]);", "return 0;", "}" ]
[ 0, 0, 1, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
11,456
static int vhost_virtqueue_start(struct vhost_dev *dev, struct VirtIODevice *vdev, struct vhost_virtqueue *vq, unsigned idx) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); VirtioBusState *vbus = VIRTIO_BUS(qbus); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); hwaddr s, l, a; int r; int vhost_vq_index = dev->vhost_ops->vhost_get_vq_index(dev, idx); struct vhost_vring_file file = { .index = vhost_vq_index }; struct vhost_vring_state state = { .index = vhost_vq_index }; struct VirtQueue *vvq = virtio_get_queue(vdev, idx); vq->num = state.num = virtio_queue_get_num(vdev, idx); r = dev->vhost_ops->vhost_set_vring_num(dev, &state); if (r) { VHOST_OPS_DEBUG("vhost_set_vring_num failed"); return -errno; } state.num = virtio_queue_get_last_avail_idx(vdev, idx); r = dev->vhost_ops->vhost_set_vring_base(dev, &state); if (r) { VHOST_OPS_DEBUG("vhost_set_vring_base failed"); return -errno; } if (vhost_needs_vring_endian(vdev)) { r = vhost_virtqueue_set_vring_endian_legacy(dev, virtio_is_big_endian(vdev), vhost_vq_index); if (r) { return -errno; } } s = l = virtio_queue_get_desc_size(vdev, idx); a = virtio_queue_get_desc_addr(vdev, idx); vq->desc = cpu_physical_memory_map(a, &l, 0); if (!vq->desc || l != s) { r = -ENOMEM; goto fail_alloc_desc; } s = l = virtio_queue_get_avail_size(vdev, idx); a = virtio_queue_get_avail_addr(vdev, idx); vq->avail = cpu_physical_memory_map(a, &l, 0); if (!vq->avail || l != s) { r = -ENOMEM; goto fail_alloc_avail; } vq->used_size = s = l = virtio_queue_get_used_size(vdev, idx); vq->used_phys = a = virtio_queue_get_used_addr(vdev, idx); vq->used = cpu_physical_memory_map(a, &l, 1); if (!vq->used || l != s) { r = -ENOMEM; goto fail_alloc_used; } vq->ring_size = s = l = virtio_queue_get_ring_size(vdev, idx); vq->ring_phys = a = virtio_queue_get_ring_addr(vdev, idx); vq->ring = cpu_physical_memory_map(a, &l, 1); if (!vq->ring || l != s) { r = -ENOMEM; goto fail_alloc_ring; } r = vhost_virtqueue_set_addr(dev, vq, vhost_vq_index, dev->log_enabled); if (r < 0) { r = -errno; goto fail_alloc; } file.fd = event_notifier_get_fd(virtio_queue_get_host_notifier(vvq)); r = dev->vhost_ops->vhost_set_vring_kick(dev, &file); if (r) { VHOST_OPS_DEBUG("vhost_set_vring_kick failed"); r = -errno; goto fail_kick; } /* Clear and discard previous events if any. */ event_notifier_test_and_clear(&vq->masked_notifier); /* Init vring in unmasked state, unless guest_notifier_mask * will do it later. */ if (!vdev->use_guest_notifier_mask) { /* TODO: check and handle errors. */ vhost_virtqueue_mask(dev, vdev, idx, false); } if (k->query_guest_notifiers && k->query_guest_notifiers(qbus->parent) && virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR) { file.fd = -1; r = dev->vhost_ops->vhost_set_vring_call(dev, &file); if (r) { goto fail_vector; } } return 0; fail_vector: fail_kick: fail_alloc: cpu_physical_memory_unmap(vq->ring, virtio_queue_get_ring_size(vdev, idx), 0, 0); fail_alloc_ring: cpu_physical_memory_unmap(vq->used, virtio_queue_get_used_size(vdev, idx), 0, 0); fail_alloc_used: cpu_physical_memory_unmap(vq->avail, virtio_queue_get_avail_size(vdev, idx), 0, 0); fail_alloc_avail: cpu_physical_memory_unmap(vq->desc, virtio_queue_get_desc_size(vdev, idx), 0, 0); fail_alloc_desc: return r; }
true
qemu
f1f9e6c5961ffb36fd4a81cd7edcded7bfad2ab2
static int vhost_virtqueue_start(struct vhost_dev *dev, struct VirtIODevice *vdev, struct vhost_virtqueue *vq, unsigned idx) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); VirtioBusState *vbus = VIRTIO_BUS(qbus); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); hwaddr s, l, a; int r; int vhost_vq_index = dev->vhost_ops->vhost_get_vq_index(dev, idx); struct vhost_vring_file file = { .index = vhost_vq_index }; struct vhost_vring_state state = { .index = vhost_vq_index }; struct VirtQueue *vvq = virtio_get_queue(vdev, idx); vq->num = state.num = virtio_queue_get_num(vdev, idx); r = dev->vhost_ops->vhost_set_vring_num(dev, &state); if (r) { VHOST_OPS_DEBUG("vhost_set_vring_num failed"); return -errno; } state.num = virtio_queue_get_last_avail_idx(vdev, idx); r = dev->vhost_ops->vhost_set_vring_base(dev, &state); if (r) { VHOST_OPS_DEBUG("vhost_set_vring_base failed"); return -errno; } if (vhost_needs_vring_endian(vdev)) { r = vhost_virtqueue_set_vring_endian_legacy(dev, virtio_is_big_endian(vdev), vhost_vq_index); if (r) { return -errno; } } s = l = virtio_queue_get_desc_size(vdev, idx); a = virtio_queue_get_desc_addr(vdev, idx); vq->desc = cpu_physical_memory_map(a, &l, 0); if (!vq->desc || l != s) { r = -ENOMEM; goto fail_alloc_desc; } s = l = virtio_queue_get_avail_size(vdev, idx); a = virtio_queue_get_avail_addr(vdev, idx); vq->avail = cpu_physical_memory_map(a, &l, 0); if (!vq->avail || l != s) { r = -ENOMEM; goto fail_alloc_avail; } vq->used_size = s = l = virtio_queue_get_used_size(vdev, idx); vq->used_phys = a = virtio_queue_get_used_addr(vdev, idx); vq->used = cpu_physical_memory_map(a, &l, 1); if (!vq->used || l != s) { r = -ENOMEM; goto fail_alloc_used; } vq->ring_size = s = l = virtio_queue_get_ring_size(vdev, idx); vq->ring_phys = a = virtio_queue_get_ring_addr(vdev, idx); vq->ring = cpu_physical_memory_map(a, &l, 1); if (!vq->ring || l != s) { r = -ENOMEM; goto fail_alloc_ring; } r = vhost_virtqueue_set_addr(dev, vq, vhost_vq_index, dev->log_enabled); if (r < 0) { r = -errno; goto fail_alloc; } file.fd = event_notifier_get_fd(virtio_queue_get_host_notifier(vvq)); r = dev->vhost_ops->vhost_set_vring_kick(dev, &file); if (r) { VHOST_OPS_DEBUG("vhost_set_vring_kick failed"); r = -errno; goto fail_kick; } event_notifier_test_and_clear(&vq->masked_notifier); if (!vdev->use_guest_notifier_mask) { vhost_virtqueue_mask(dev, vdev, idx, false); } if (k->query_guest_notifiers && k->query_guest_notifiers(qbus->parent) && virtio_queue_vector(vdev, idx) == VIRTIO_NO_VECTOR) { file.fd = -1; r = dev->vhost_ops->vhost_set_vring_call(dev, &file); if (r) { goto fail_vector; } } return 0; fail_vector: fail_kick: fail_alloc: cpu_physical_memory_unmap(vq->ring, virtio_queue_get_ring_size(vdev, idx), 0, 0); fail_alloc_ring: cpu_physical_memory_unmap(vq->used, virtio_queue_get_used_size(vdev, idx), 0, 0); fail_alloc_used: cpu_physical_memory_unmap(vq->avail, virtio_queue_get_avail_size(vdev, idx), 0, 0); fail_alloc_avail: cpu_physical_memory_unmap(vq->desc, virtio_queue_get_desc_size(vdev, idx), 0, 0); fail_alloc_desc: return r; }
{ "code": [ " s = l = virtio_queue_get_desc_size(vdev, idx);", " a = virtio_queue_get_desc_addr(vdev, idx);", " s = l = virtio_queue_get_avail_size(vdev, idx);", " a = virtio_queue_get_avail_addr(vdev, idx);" ], "line_no": [ 87, 89, 101, 103 ] }
static int FUNC_0(struct vhost_dev *VAR_0, struct VirtIODevice *VAR_1, struct vhost_virtqueue *VAR_2, unsigned VAR_3) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(VAR_1))); VirtioBusState *vbus = VIRTIO_BUS(qbus); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); hwaddr s, l, a; int VAR_4; int VAR_5 = VAR_0->vhost_ops->vhost_get_vq_index(VAR_0, VAR_3); struct vhost_vring_file VAR_6 = { .index = VAR_5 }; struct vhost_vring_state VAR_7 = { .index = VAR_5 }; struct VirtQueue *VAR_8 = virtio_get_queue(VAR_1, VAR_3); VAR_2->num = VAR_7.num = virtio_queue_get_num(VAR_1, VAR_3); VAR_4 = VAR_0->vhost_ops->vhost_set_vring_num(VAR_0, &VAR_7); if (VAR_4) { VHOST_OPS_DEBUG("vhost_set_vring_num failed"); return -errno; } VAR_7.num = virtio_queue_get_last_avail_idx(VAR_1, VAR_3); VAR_4 = VAR_0->vhost_ops->vhost_set_vring_base(VAR_0, &VAR_7); if (VAR_4) { VHOST_OPS_DEBUG("vhost_set_vring_base failed"); return -errno; } if (vhost_needs_vring_endian(VAR_1)) { VAR_4 = vhost_virtqueue_set_vring_endian_legacy(VAR_0, virtio_is_big_endian(VAR_1), VAR_5); if (VAR_4) { return -errno; } } s = l = virtio_queue_get_desc_size(VAR_1, VAR_3); a = virtio_queue_get_desc_addr(VAR_1, VAR_3); VAR_2->desc = cpu_physical_memory_map(a, &l, 0); if (!VAR_2->desc || l != s) { VAR_4 = -ENOMEM; goto fail_alloc_desc; } s = l = virtio_queue_get_avail_size(VAR_1, VAR_3); a = virtio_queue_get_avail_addr(VAR_1, VAR_3); VAR_2->avail = cpu_physical_memory_map(a, &l, 0); if (!VAR_2->avail || l != s) { VAR_4 = -ENOMEM; goto fail_alloc_avail; } VAR_2->used_size = s = l = virtio_queue_get_used_size(VAR_1, VAR_3); VAR_2->used_phys = a = virtio_queue_get_used_addr(VAR_1, VAR_3); VAR_2->used = cpu_physical_memory_map(a, &l, 1); if (!VAR_2->used || l != s) { VAR_4 = -ENOMEM; goto fail_alloc_used; } VAR_2->ring_size = s = l = virtio_queue_get_ring_size(VAR_1, VAR_3); VAR_2->ring_phys = a = virtio_queue_get_ring_addr(VAR_1, VAR_3); VAR_2->ring = cpu_physical_memory_map(a, &l, 1); if (!VAR_2->ring || l != s) { VAR_4 = -ENOMEM; goto fail_alloc_ring; } VAR_4 = vhost_virtqueue_set_addr(VAR_0, VAR_2, VAR_5, VAR_0->log_enabled); if (VAR_4 < 0) { VAR_4 = -errno; goto fail_alloc; } VAR_6.fd = event_notifier_get_fd(virtio_queue_get_host_notifier(VAR_8)); VAR_4 = VAR_0->vhost_ops->vhost_set_vring_kick(VAR_0, &VAR_6); if (VAR_4) { VHOST_OPS_DEBUG("vhost_set_vring_kick failed"); VAR_4 = -errno; goto fail_kick; } event_notifier_test_and_clear(&VAR_2->masked_notifier); if (!VAR_1->use_guest_notifier_mask) { vhost_virtqueue_mask(VAR_0, VAR_1, VAR_3, false); } if (k->query_guest_notifiers && k->query_guest_notifiers(qbus->parent) && virtio_queue_vector(VAR_1, VAR_3) == VIRTIO_NO_VECTOR) { VAR_6.fd = -1; VAR_4 = VAR_0->vhost_ops->vhost_set_vring_call(VAR_0, &VAR_6); if (VAR_4) { goto fail_vector; } } return 0; fail_vector: fail_kick: fail_alloc: cpu_physical_memory_unmap(VAR_2->ring, virtio_queue_get_ring_size(VAR_1, VAR_3), 0, 0); fail_alloc_ring: cpu_physical_memory_unmap(VAR_2->used, virtio_queue_get_used_size(VAR_1, VAR_3), 0, 0); fail_alloc_used: cpu_physical_memory_unmap(VAR_2->avail, virtio_queue_get_avail_size(VAR_1, VAR_3), 0, 0); fail_alloc_avail: cpu_physical_memory_unmap(VAR_2->desc, virtio_queue_get_desc_size(VAR_1, VAR_3), 0, 0); fail_alloc_desc: return VAR_4; }
[ "static int FUNC_0(struct vhost_dev *VAR_0,\nstruct VirtIODevice *VAR_1,\nstruct vhost_virtqueue *VAR_2,\nunsigned VAR_3)\n{", "BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(VAR_1)));", "VirtioBusState *vbus = VIRTIO_BUS(qbus);", "VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);", "hwaddr s, l, a;", "int VAR_4;", "int VAR_5 = VAR_0->vhost_ops->vhost_get_vq_index(VAR_0, VAR_3);", "struct vhost_vring_file VAR_6 = {", ".index = VAR_5\n};", "struct vhost_vring_state VAR_7 = {", ".index = VAR_5\n};", "struct VirtQueue *VAR_8 = virtio_get_queue(VAR_1, VAR_3);", "VAR_2->num = VAR_7.num = virtio_queue_get_num(VAR_1, VAR_3);", "VAR_4 = VAR_0->vhost_ops->vhost_set_vring_num(VAR_0, &VAR_7);", "if (VAR_4) {", "VHOST_OPS_DEBUG(\"vhost_set_vring_num failed\");", "return -errno;", "}", "VAR_7.num = virtio_queue_get_last_avail_idx(VAR_1, VAR_3);", "VAR_4 = VAR_0->vhost_ops->vhost_set_vring_base(VAR_0, &VAR_7);", "if (VAR_4) {", "VHOST_OPS_DEBUG(\"vhost_set_vring_base failed\");", "return -errno;", "}", "if (vhost_needs_vring_endian(VAR_1)) {", "VAR_4 = vhost_virtqueue_set_vring_endian_legacy(VAR_0,\nvirtio_is_big_endian(VAR_1),\nVAR_5);", "if (VAR_4) {", "return -errno;", "}", "}", "s = l = virtio_queue_get_desc_size(VAR_1, VAR_3);", "a = virtio_queue_get_desc_addr(VAR_1, VAR_3);", "VAR_2->desc = cpu_physical_memory_map(a, &l, 0);", "if (!VAR_2->desc || l != s) {", "VAR_4 = -ENOMEM;", "goto fail_alloc_desc;", "}", "s = l = virtio_queue_get_avail_size(VAR_1, VAR_3);", "a = virtio_queue_get_avail_addr(VAR_1, VAR_3);", "VAR_2->avail = cpu_physical_memory_map(a, &l, 0);", "if (!VAR_2->avail || l != s) {", "VAR_4 = -ENOMEM;", "goto fail_alloc_avail;", "}", "VAR_2->used_size = s = l = virtio_queue_get_used_size(VAR_1, VAR_3);", "VAR_2->used_phys = a = virtio_queue_get_used_addr(VAR_1, VAR_3);", "VAR_2->used = cpu_physical_memory_map(a, &l, 1);", "if (!VAR_2->used || l != s) {", "VAR_4 = -ENOMEM;", "goto fail_alloc_used;", "}", "VAR_2->ring_size = s = l = virtio_queue_get_ring_size(VAR_1, VAR_3);", "VAR_2->ring_phys = a = virtio_queue_get_ring_addr(VAR_1, VAR_3);", "VAR_2->ring = cpu_physical_memory_map(a, &l, 1);", "if (!VAR_2->ring || l != s) {", "VAR_4 = -ENOMEM;", "goto fail_alloc_ring;", "}", "VAR_4 = vhost_virtqueue_set_addr(VAR_0, VAR_2, VAR_5, VAR_0->log_enabled);", "if (VAR_4 < 0) {", "VAR_4 = -errno;", "goto fail_alloc;", "}", "VAR_6.fd = event_notifier_get_fd(virtio_queue_get_host_notifier(VAR_8));", "VAR_4 = VAR_0->vhost_ops->vhost_set_vring_kick(VAR_0, &VAR_6);", "if (VAR_4) {", "VHOST_OPS_DEBUG(\"vhost_set_vring_kick failed\");", "VAR_4 = -errno;", "goto fail_kick;", "}", "event_notifier_test_and_clear(&VAR_2->masked_notifier);", "if (!VAR_1->use_guest_notifier_mask) {", "vhost_virtqueue_mask(VAR_0, VAR_1, VAR_3, false);", "}", "if (k->query_guest_notifiers &&\nk->query_guest_notifiers(qbus->parent) &&\nvirtio_queue_vector(VAR_1, VAR_3) == VIRTIO_NO_VECTOR) {", "VAR_6.fd = -1;", "VAR_4 = VAR_0->vhost_ops->vhost_set_vring_call(VAR_0, &VAR_6);", "if (VAR_4) {", "goto fail_vector;", "}", "}", "return 0;", "fail_vector:\nfail_kick:\nfail_alloc:\ncpu_physical_memory_unmap(VAR_2->ring, virtio_queue_get_ring_size(VAR_1, VAR_3),\n0, 0);", "fail_alloc_ring:\ncpu_physical_memory_unmap(VAR_2->used, virtio_queue_get_used_size(VAR_1, VAR_3),\n0, 0);", "fail_alloc_used:\ncpu_physical_memory_unmap(VAR_2->avail, virtio_queue_get_avail_size(VAR_1, VAR_3),\n0, 0);", "fail_alloc_avail:\ncpu_physical_memory_unmap(VAR_2->desc, virtio_queue_get_desc_size(VAR_1, VAR_3),\n0, 0);", "fail_alloc_desc:\nreturn VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71, 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 177 ], [ 187 ], [ 191 ], [ 193 ], [ 197, 199, 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 221, 223, 225, 227, 229 ], [ 231, 233, 235 ], [ 237, 239, 241 ], [ 243, 245, 247 ], [ 249, 251 ], [ 253 ] ]
11,458
int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode, const char *name, v9fs_synth_read read, v9fs_synth_write write, void *arg) { int ret; V9fsSynthNode *node, *tmp; if (!v9fs_synth_fs) { return EAGAIN; } if (!name || (strlen(name) >= NAME_MAX)) { return EINVAL; } if (!parent) { parent = &v9fs_synth_root; } qemu_mutex_lock(&v9fs_synth_mutex); QLIST_FOREACH(tmp, &parent->child, sibling) { if (!strcmp(tmp->name, name)) { ret = EEXIST; goto err_out; } } /* Add file type and remove write bits */ mode = ((mode & 0777) | S_IFREG); node = g_malloc0(sizeof(V9fsSynthNode)); node->attr = &node->actual_attr; node->attr->inode = v9fs_synth_node_count++; node->attr->nlink = 1; node->attr->read = read; node->attr->write = write; node->attr->mode = mode; node->private = arg; strncpy(node->name, name, sizeof(node->name)); QLIST_INSERT_HEAD_RCU(&parent->child, node, sibling); ret = 0; err_out: qemu_mutex_unlock(&v9fs_synth_mutex); return ret; }
true
qemu
a79b5f8b80890b402fdb0733b0a073695a7875b5
int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode, const char *name, v9fs_synth_read read, v9fs_synth_write write, void *arg) { int ret; V9fsSynthNode *node, *tmp; if (!v9fs_synth_fs) { return EAGAIN; } if (!name || (strlen(name) >= NAME_MAX)) { return EINVAL; } if (!parent) { parent = &v9fs_synth_root; } qemu_mutex_lock(&v9fs_synth_mutex); QLIST_FOREACH(tmp, &parent->child, sibling) { if (!strcmp(tmp->name, name)) { ret = EEXIST; goto err_out; } } mode = ((mode & 0777) | S_IFREG); node = g_malloc0(sizeof(V9fsSynthNode)); node->attr = &node->actual_attr; node->attr->inode = v9fs_synth_node_count++; node->attr->nlink = 1; node->attr->read = read; node->attr->write = write; node->attr->mode = mode; node->private = arg; strncpy(node->name, name, sizeof(node->name)); QLIST_INSERT_HEAD_RCU(&parent->child, node, sibling); ret = 0; err_out: qemu_mutex_unlock(&v9fs_synth_mutex); return ret; }
{ "code": [ " strncpy(node->name, name, sizeof(node->name));", " strncpy(node->name, name, sizeof(node->name));" ], "line_no": [ 69, 69 ] }
int FUNC_0(V9fsSynthNode *VAR_0, int VAR_1, const char *VAR_2, v9fs_synth_read VAR_3, v9fs_synth_write VAR_4, void *VAR_5) { int VAR_6; V9fsSynthNode *node, *tmp; if (!v9fs_synth_fs) { return EAGAIN; } if (!VAR_2 || (strlen(VAR_2) >= NAME_MAX)) { return EINVAL; } if (!VAR_0) { VAR_0 = &v9fs_synth_root; } qemu_mutex_lock(&v9fs_synth_mutex); QLIST_FOREACH(tmp, &VAR_0->child, sibling) { if (!strcmp(tmp->VAR_2, VAR_2)) { VAR_6 = EEXIST; goto err_out; } } VAR_1 = ((VAR_1 & 0777) | S_IFREG); node = g_malloc0(sizeof(V9fsSynthNode)); node->attr = &node->actual_attr; node->attr->inode = v9fs_synth_node_count++; node->attr->nlink = 1; node->attr->VAR_3 = VAR_3; node->attr->VAR_4 = VAR_4; node->attr->VAR_1 = VAR_1; node->private = VAR_5; strncpy(node->VAR_2, VAR_2, sizeof(node->VAR_2)); QLIST_INSERT_HEAD_RCU(&VAR_0->child, node, sibling); VAR_6 = 0; err_out: qemu_mutex_unlock(&v9fs_synth_mutex); return VAR_6; }
[ "int FUNC_0(V9fsSynthNode *VAR_0, int VAR_1,\nconst char *VAR_2, v9fs_synth_read VAR_3,\nv9fs_synth_write VAR_4, void *VAR_5)\n{", "int VAR_6;", "V9fsSynthNode *node, *tmp;", "if (!v9fs_synth_fs) {", "return EAGAIN;", "}", "if (!VAR_2 || (strlen(VAR_2) >= NAME_MAX)) {", "return EINVAL;", "}", "if (!VAR_0) {", "VAR_0 = &v9fs_synth_root;", "}", "qemu_mutex_lock(&v9fs_synth_mutex);", "QLIST_FOREACH(tmp, &VAR_0->child, sibling) {", "if (!strcmp(tmp->VAR_2, VAR_2)) {", "VAR_6 = EEXIST;", "goto err_out;", "}", "}", "VAR_1 = ((VAR_1 & 0777) | S_IFREG);", "node = g_malloc0(sizeof(V9fsSynthNode));", "node->attr = &node->actual_attr;", "node->attr->inode = v9fs_synth_node_count++;", "node->attr->nlink = 1;", "node->attr->VAR_3 = VAR_3;", "node->attr->VAR_4 = VAR_4;", "node->attr->VAR_1 = VAR_1;", "node->private = VAR_5;", "strncpy(node->VAR_2, VAR_2, sizeof(node->VAR_2));", "QLIST_INSERT_HEAD_RCU(&VAR_0->child, node, sibling);", "VAR_6 = 0;", "err_out:\nqemu_mutex_unlock(&v9fs_synth_mutex);", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ] ]
11,459
PPC_OP(extsb) { T0 = (int32_t)((int8_t)(Ts0)); RETURN(); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
PPC_OP(extsb) { T0 = (int32_t)((int8_t)(Ts0)); RETURN(); }
{ "code": [ " RETURN();", "PPC_OP(extsb)", " T0 = (int32_t)((int8_t)(Ts0));", " RETURN();" ], "line_no": [ 7, 1, 5, 7 ] }
FUNC_0(VAR_0) { T0 = (int32_t)((int8_t)(Ts0)); RETURN(); }
[ "FUNC_0(VAR_0)\n{", "T0 = (int32_t)((int8_t)(Ts0));", "RETURN();", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
11,460
static int qemu_rdma_broken_ipv6_kernel(Error **errp, struct ibv_context *verbs) { struct ibv_port_attr port_attr; /* This bug only exists in linux, to our knowledge. */ #ifdef CONFIG_LINUX /* * Verbs are only NULL if management has bound to '[::]'. * * Let's iterate through all the devices and see if there any pure IB * devices (non-ethernet). * * If not, then we can safely proceed with the migration. * Otherwise, there are no guarantees until the bug is fixed in linux. */ int num_devices, x; struct ibv_device ** dev_list = ibv_get_device_list(&num_devices); bool roce_found = false; bool ib_found = false; for (x = 0; x < num_devices; x++) { verbs = ibv_open_device(dev_list[x]); if (ibv_query_port(verbs, 1, &port_attr)) { ibv_close_device(verbs); ERROR(errp, "Could not query initial IB port"); if (port_attr.link_layer == IBV_LINK_LAYER_INFINIBAND) { ib_found = true; } else if (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET) { roce_found = true; ibv_close_device(verbs); if (roce_found) { if (ib_found) { fprintf(stderr, "WARN: migrations may fail:" " IPv6 over RoCE / iWARP in linux" " is broken. But since you appear to have a" " mixed RoCE / IB environment, be sure to only" " migrate over the IB fabric until the kernel " " fixes the bug.\n"); ERROR(errp, "You only have RoCE / iWARP devices in your systems" " and your management software has specified '[::]'" ", but IPv6 over RoCE / iWARP is not supported in Linux."); return -ENONET; return 0; /* * If we have a verbs context, that means that some other than '[::]' was * used by the management software for binding. In which case we can * actually warn the user about a potentially broken kernel. */ /* IB ports start with 1, not 0 */ if (ibv_query_port(verbs, 1, &port_attr)) { ERROR(errp, "Could not query initial IB port"); if (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET) { ERROR(errp, "Linux kernel's RoCE / iWARP does not support IPv6 " "(but patches on linux-rdma in progress)"); return -ENONET; #endif return 0;
true
qemu
5b61d5752156dcbbe2bf1366c877a676ed9f8f51
static int qemu_rdma_broken_ipv6_kernel(Error **errp, struct ibv_context *verbs) { struct ibv_port_attr port_attr; #ifdef CONFIG_LINUX int num_devices, x; struct ibv_device ** dev_list = ibv_get_device_list(&num_devices); bool roce_found = false; bool ib_found = false; for (x = 0; x < num_devices; x++) { verbs = ibv_open_device(dev_list[x]); if (ibv_query_port(verbs, 1, &port_attr)) { ibv_close_device(verbs); ERROR(errp, "Could not query initial IB port"); if (port_attr.link_layer == IBV_LINK_LAYER_INFINIBAND) { ib_found = true; } else if (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET) { roce_found = true; ibv_close_device(verbs); if (roce_found) { if (ib_found) { fprintf(stderr, "WARN: migrations may fail:" " IPv6 over RoCE / iWARP in linux" " is broken. But since you appear to have a" " mixed RoCE / IB environment, be sure to only" " migrate over the IB fabric until the kernel " " fixes the bug.\n"); ERROR(errp, "You only have RoCE / iWARP devices in your systems" " and your management software has specified '[::]'" ", but IPv6 over RoCE / iWARP is not supported in Linux."); return -ENONET; return 0; if (ibv_query_port(verbs, 1, &port_attr)) { ERROR(errp, "Could not query initial IB port"); if (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET) { ERROR(errp, "Linux kernel's RoCE / iWARP does not support IPv6 " "(but patches on linux-rdma in progress)"); return -ENONET; #endif return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(Error **VAR_0, struct ibv_context *VAR_1) { struct ibv_port_attr VAR_2; #ifdef CONFIG_LINUX int num_devices, x; struct ibv_device ** dev_list = ibv_get_device_list(&num_devices); bool roce_found = false; bool ib_found = false; for (x = 0; x < num_devices; x++) { VAR_1 = ibv_open_device(dev_list[x]); if (ibv_query_port(VAR_1, 1, &VAR_2)) { ibv_close_device(VAR_1); ERROR(VAR_0, "Could not query initial IB port"); if (VAR_2.link_layer == IBV_LINK_LAYER_INFINIBAND) { ib_found = true; } else if (VAR_2.link_layer == IBV_LINK_LAYER_ETHERNET) { roce_found = true; ibv_close_device(VAR_1); if (roce_found) { if (ib_found) { fprintf(stderr, "WARN: migrations may fail:" " IPv6 over RoCE / iWARP in linux" " is broken. But since you appear to have a" " mixed RoCE / IB environment, be sure to only" " migrate over the IB fabric until the kernel " " fixes the bug.\n"); ERROR(VAR_0, "You only have RoCE / iWARP devices in your systems" " and your management software has specified '[::]'" ", but IPv6 over RoCE / iWARP is not supported in Linux."); return -ENONET; return 0; if (ibv_query_port(VAR_1, 1, &VAR_2)) { ERROR(VAR_0, "Could not query initial IB port"); if (VAR_2.link_layer == IBV_LINK_LAYER_ETHERNET) { ERROR(VAR_0, "Linux kernel's RoCE / iWARP does not support IPv6 " "(but patches on linux-rdma in progress)"); return -ENONET; #endif return 0;
[ "static int FUNC_0(Error **VAR_0, struct ibv_context *VAR_1)\n{", "struct ibv_port_attr VAR_2;", "#ifdef CONFIG_LINUX\nint num_devices, x;", "struct ibv_device ** dev_list = ibv_get_device_list(&num_devices);", "bool roce_found = false;", "bool ib_found = false;", "for (x = 0; x < num_devices; x++) {", "VAR_1 = ibv_open_device(dev_list[x]);", "if (ibv_query_port(VAR_1, 1, &VAR_2)) {", "ibv_close_device(VAR_1);", "ERROR(VAR_0, \"Could not query initial IB port\");", "if (VAR_2.link_layer == IBV_LINK_LAYER_INFINIBAND) {", "ib_found = true;", "} else if (VAR_2.link_layer == IBV_LINK_LAYER_ETHERNET) {", "roce_found = true;", "ibv_close_device(VAR_1);", "if (roce_found) {", "if (ib_found) {", "fprintf(stderr, \"WARN: migrations may fail:\"\n\" IPv6 over RoCE / iWARP in linux\"\n\" is broken. But since you appear to have a\"\n\" mixed RoCE / IB environment, be sure to only\"\n\" migrate over the IB fabric until the kernel \"\n\" fixes the bug.\\n\");", "ERROR(VAR_0, \"You only have RoCE / iWARP devices in your systems\"\n\" and your management software has specified '[::]'\"\n\", but IPv6 over RoCE / iWARP is not supported in Linux.\");", "return -ENONET;", "return 0;", "if (ibv_query_port(VAR_1, 1, &VAR_2)) {", "ERROR(VAR_0, \"Could not query initial IB port\");", "if (VAR_2.link_layer == IBV_LINK_LAYER_ETHERNET) {", "ERROR(VAR_0, \"Linux kernel's RoCE / iWARP does not support IPv6 \"\n\"(but patches on linux-rdma in progress)\");", "return -ENONET;", "#endif\nreturn 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11, 34 ], [ 36 ], [ 38 ], [ 40 ], [ 44 ], [ 46 ], [ 57 ], [ 59 ], [ 61 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 78 ], [ 85 ], [ 87 ], [ 89, 91, 93, 95, 97, 99 ], [ 102, 104, 106 ], [ 108 ], [ 114 ], [ 133 ], [ 135 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 152, 156 ] ]
11,461
static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid, unsigned int epid, unsigned int streamid) { XHCIStreamContext *stctx; XHCIEPContext *epctx; XHCIRing *ring; USBEndpoint *ep = NULL; uint64_t mfindex; int length; int i; trace_usb_xhci_ep_kick(slotid, epid, streamid); assert(slotid >= 1 && slotid <= xhci->numslots); assert(epid >= 1 && epid <= 31); if (!xhci->slots[slotid-1].enabled) { fprintf(stderr, "xhci: xhci_kick_ep for disabled slot %d\n", slotid); return; } epctx = xhci->slots[slotid-1].eps[epid-1]; if (!epctx) { fprintf(stderr, "xhci: xhci_kick_ep for disabled endpoint %d,%d\n", epid, slotid); return; } if (epctx->retry) { XHCITransfer *xfer = epctx->retry; trace_usb_xhci_xfer_retry(xfer); assert(xfer->running_retry); if (xfer->iso_xfer) { /* retry delayed iso transfer */ mfindex = xhci_mfindex_get(xhci); xhci_check_iso_kick(xhci, xfer, epctx, mfindex); if (xfer->running_retry) { return; } if (xhci_setup_packet(xfer) < 0) { return; } usb_handle_packet(xfer->packet.ep->dev, &xfer->packet); assert(xfer->packet.status != USB_RET_NAK); xhci_complete_packet(xfer); } else { /* retry nak'ed transfer */ if (xhci_setup_packet(xfer) < 0) { return; } usb_handle_packet(xfer->packet.ep->dev, &xfer->packet); if (xfer->packet.status == USB_RET_NAK) { return; } xhci_complete_packet(xfer); } assert(!xfer->running_retry); epctx->retry = NULL; } if (epctx->state == EP_HALTED) { DPRINTF("xhci: ep halted, not running schedule\n"); return; } if (epctx->nr_pstreams) { uint32_t err; stctx = xhci_find_stream(epctx, streamid, &err); if (stctx == NULL) { return; } ring = &stctx->ring; xhci_set_ep_state(xhci, epctx, stctx, EP_RUNNING); } else { ring = &epctx->ring; streamid = 0; xhci_set_ep_state(xhci, epctx, NULL, EP_RUNNING); } assert(ring->dequeue != 0); while (1) { XHCITransfer *xfer = &epctx->transfers[epctx->next_xfer]; if (xfer->running_async || xfer->running_retry) { break; } length = xhci_ring_chain_length(xhci, ring); if (length < 0) { break; } else if (length == 0) { break; } if (xfer->trbs && xfer->trb_alloced < length) { xfer->trb_count = 0; xfer->trb_alloced = 0; g_free(xfer->trbs); xfer->trbs = NULL; } if (!xfer->trbs) { xfer->trbs = g_malloc(sizeof(XHCITRB) * length); xfer->trb_alloced = length; } xfer->trb_count = length; for (i = 0; i < length; i++) { assert(xhci_ring_fetch(xhci, ring, &xfer->trbs[i], NULL)); } xfer->xhci = xhci; xfer->epid = epid; xfer->slotid = slotid; xfer->streamid = streamid; if (epid == 1) { if (xhci_fire_ctl_transfer(xhci, xfer) >= 0) { epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE; ep = xfer->packet.ep; } else { fprintf(stderr, "xhci: error firing CTL transfer\n"); } } else { if (xhci_fire_transfer(xhci, xfer, epctx) >= 0) { epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE; ep = xfer->packet.ep; } else { if (!xfer->iso_xfer) { fprintf(stderr, "xhci: error firing data transfer\n"); } } } if (epctx->state == EP_HALTED) { break; } if (xfer->running_retry) { DPRINTF("xhci: xfer nacked, stopping schedule\n"); epctx->retry = xfer; break; } } if (ep) { usb_device_flush_ep_queue(ep->dev, ep); } }
true
qemu
4d7a81c06f5f17e019a2d3a18300500bd64f6f40
static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid, unsigned int epid, unsigned int streamid) { XHCIStreamContext *stctx; XHCIEPContext *epctx; XHCIRing *ring; USBEndpoint *ep = NULL; uint64_t mfindex; int length; int i; trace_usb_xhci_ep_kick(slotid, epid, streamid); assert(slotid >= 1 && slotid <= xhci->numslots); assert(epid >= 1 && epid <= 31); if (!xhci->slots[slotid-1].enabled) { fprintf(stderr, "xhci: xhci_kick_ep for disabled slot %d\n", slotid); return; } epctx = xhci->slots[slotid-1].eps[epid-1]; if (!epctx) { fprintf(stderr, "xhci: xhci_kick_ep for disabled endpoint %d,%d\n", epid, slotid); return; } if (epctx->retry) { XHCITransfer *xfer = epctx->retry; trace_usb_xhci_xfer_retry(xfer); assert(xfer->running_retry); if (xfer->iso_xfer) { mfindex = xhci_mfindex_get(xhci); xhci_check_iso_kick(xhci, xfer, epctx, mfindex); if (xfer->running_retry) { return; } if (xhci_setup_packet(xfer) < 0) { return; } usb_handle_packet(xfer->packet.ep->dev, &xfer->packet); assert(xfer->packet.status != USB_RET_NAK); xhci_complete_packet(xfer); } else { if (xhci_setup_packet(xfer) < 0) { return; } usb_handle_packet(xfer->packet.ep->dev, &xfer->packet); if (xfer->packet.status == USB_RET_NAK) { return; } xhci_complete_packet(xfer); } assert(!xfer->running_retry); epctx->retry = NULL; } if (epctx->state == EP_HALTED) { DPRINTF("xhci: ep halted, not running schedule\n"); return; } if (epctx->nr_pstreams) { uint32_t err; stctx = xhci_find_stream(epctx, streamid, &err); if (stctx == NULL) { return; } ring = &stctx->ring; xhci_set_ep_state(xhci, epctx, stctx, EP_RUNNING); } else { ring = &epctx->ring; streamid = 0; xhci_set_ep_state(xhci, epctx, NULL, EP_RUNNING); } assert(ring->dequeue != 0); while (1) { XHCITransfer *xfer = &epctx->transfers[epctx->next_xfer]; if (xfer->running_async || xfer->running_retry) { break; } length = xhci_ring_chain_length(xhci, ring); if (length < 0) { break; } else if (length == 0) { break; } if (xfer->trbs && xfer->trb_alloced < length) { xfer->trb_count = 0; xfer->trb_alloced = 0; g_free(xfer->trbs); xfer->trbs = NULL; } if (!xfer->trbs) { xfer->trbs = g_malloc(sizeof(XHCITRB) * length); xfer->trb_alloced = length; } xfer->trb_count = length; for (i = 0; i < length; i++) { assert(xhci_ring_fetch(xhci, ring, &xfer->trbs[i], NULL)); } xfer->xhci = xhci; xfer->epid = epid; xfer->slotid = slotid; xfer->streamid = streamid; if (epid == 1) { if (xhci_fire_ctl_transfer(xhci, xfer) >= 0) { epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE; ep = xfer->packet.ep; } else { fprintf(stderr, "xhci: error firing CTL transfer\n"); } } else { if (xhci_fire_transfer(xhci, xfer, epctx) >= 0) { epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE; ep = xfer->packet.ep; } else { if (!xfer->iso_xfer) { fprintf(stderr, "xhci: error firing data transfer\n"); } } } if (epctx->state == EP_HALTED) { break; } if (xfer->running_retry) { DPRINTF("xhci: xfer nacked, stopping schedule\n"); epctx->retry = xfer; break; } } if (ep) { usb_device_flush_ep_queue(ep->dev, ep); } }
{ "code": [ " if (xfer->iso_xfer) {", " xhci_check_iso_kick(xhci, xfer, epctx, mfindex);", " if (!xfer->iso_xfer) {" ], "line_no": [ 63, 69, 247 ] }
static void FUNC_0(XHCIState *VAR_0, unsigned int VAR_1, unsigned int VAR_2, unsigned int VAR_3) { XHCIStreamContext *stctx; XHCIEPContext *epctx; XHCIRing *ring; USBEndpoint *ep = NULL; uint64_t mfindex; int VAR_4; int VAR_5; trace_usb_xhci_ep_kick(VAR_1, VAR_2, VAR_3); assert(VAR_1 >= 1 && VAR_1 <= VAR_0->numslots); assert(VAR_2 >= 1 && VAR_2 <= 31); if (!VAR_0->slots[VAR_1-1].enabled) { fprintf(stderr, "VAR_0: FUNC_0 for disabled slot %d\n", VAR_1); return; } epctx = VAR_0->slots[VAR_1-1].eps[VAR_2-1]; if (!epctx) { fprintf(stderr, "VAR_0: FUNC_0 for disabled endpoint %d,%d\n", VAR_2, VAR_1); return; } if (epctx->retry) { XHCITransfer *xfer = epctx->retry; trace_usb_xhci_xfer_retry(xfer); assert(xfer->running_retry); if (xfer->iso_xfer) { mfindex = xhci_mfindex_get(VAR_0); xhci_check_iso_kick(VAR_0, xfer, epctx, mfindex); if (xfer->running_retry) { return; } if (xhci_setup_packet(xfer) < 0) { return; } usb_handle_packet(xfer->packet.ep->dev, &xfer->packet); assert(xfer->packet.status != USB_RET_NAK); xhci_complete_packet(xfer); } else { if (xhci_setup_packet(xfer) < 0) { return; } usb_handle_packet(xfer->packet.ep->dev, &xfer->packet); if (xfer->packet.status == USB_RET_NAK) { return; } xhci_complete_packet(xfer); } assert(!xfer->running_retry); epctx->retry = NULL; } if (epctx->state == EP_HALTED) { DPRINTF("VAR_0: ep halted, not running schedule\n"); return; } if (epctx->nr_pstreams) { uint32_t err; stctx = xhci_find_stream(epctx, VAR_3, &err); if (stctx == NULL) { return; } ring = &stctx->ring; xhci_set_ep_state(VAR_0, epctx, stctx, EP_RUNNING); } else { ring = &epctx->ring; VAR_3 = 0; xhci_set_ep_state(VAR_0, epctx, NULL, EP_RUNNING); } assert(ring->dequeue != 0); while (1) { XHCITransfer *xfer = &epctx->transfers[epctx->next_xfer]; if (xfer->running_async || xfer->running_retry) { break; } VAR_4 = xhci_ring_chain_length(VAR_0, ring); if (VAR_4 < 0) { break; } else if (VAR_4 == 0) { break; } if (xfer->trbs && xfer->trb_alloced < VAR_4) { xfer->trb_count = 0; xfer->trb_alloced = 0; g_free(xfer->trbs); xfer->trbs = NULL; } if (!xfer->trbs) { xfer->trbs = g_malloc(sizeof(XHCITRB) * VAR_4); xfer->trb_alloced = VAR_4; } xfer->trb_count = VAR_4; for (VAR_5 = 0; VAR_5 < VAR_4; VAR_5++) { assert(xhci_ring_fetch(VAR_0, ring, &xfer->trbs[VAR_5], NULL)); } xfer->VAR_0 = VAR_0; xfer->VAR_2 = VAR_2; xfer->VAR_1 = VAR_1; xfer->VAR_3 = VAR_3; if (VAR_2 == 1) { if (xhci_fire_ctl_transfer(VAR_0, xfer) >= 0) { epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE; ep = xfer->packet.ep; } else { fprintf(stderr, "VAR_0: error firing CTL transfer\n"); } } else { if (xhci_fire_transfer(VAR_0, xfer, epctx) >= 0) { epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE; ep = xfer->packet.ep; } else { if (!xfer->iso_xfer) { fprintf(stderr, "VAR_0: error firing data transfer\n"); } } } if (epctx->state == EP_HALTED) { break; } if (xfer->running_retry) { DPRINTF("VAR_0: xfer nacked, stopping schedule\n"); epctx->retry = xfer; break; } } if (ep) { usb_device_flush_ep_queue(ep->dev, ep); } }
[ "static void FUNC_0(XHCIState *VAR_0, unsigned int VAR_1,\nunsigned int VAR_2, unsigned int VAR_3)\n{", "XHCIStreamContext *stctx;", "XHCIEPContext *epctx;", "XHCIRing *ring;", "USBEndpoint *ep = NULL;", "uint64_t mfindex;", "int VAR_4;", "int VAR_5;", "trace_usb_xhci_ep_kick(VAR_1, VAR_2, VAR_3);", "assert(VAR_1 >= 1 && VAR_1 <= VAR_0->numslots);", "assert(VAR_2 >= 1 && VAR_2 <= 31);", "if (!VAR_0->slots[VAR_1-1].enabled) {", "fprintf(stderr, \"VAR_0: FUNC_0 for disabled slot %d\\n\", VAR_1);", "return;", "}", "epctx = VAR_0->slots[VAR_1-1].eps[VAR_2-1];", "if (!epctx) {", "fprintf(stderr, \"VAR_0: FUNC_0 for disabled endpoint %d,%d\\n\",\nVAR_2, VAR_1);", "return;", "}", "if (epctx->retry) {", "XHCITransfer *xfer = epctx->retry;", "trace_usb_xhci_xfer_retry(xfer);", "assert(xfer->running_retry);", "if (xfer->iso_xfer) {", "mfindex = xhci_mfindex_get(VAR_0);", "xhci_check_iso_kick(VAR_0, xfer, epctx, mfindex);", "if (xfer->running_retry) {", "return;", "}", "if (xhci_setup_packet(xfer) < 0) {", "return;", "}", "usb_handle_packet(xfer->packet.ep->dev, &xfer->packet);", "assert(xfer->packet.status != USB_RET_NAK);", "xhci_complete_packet(xfer);", "} else {", "if (xhci_setup_packet(xfer) < 0) {", "return;", "}", "usb_handle_packet(xfer->packet.ep->dev, &xfer->packet);", "if (xfer->packet.status == USB_RET_NAK) {", "return;", "}", "xhci_complete_packet(xfer);", "}", "assert(!xfer->running_retry);", "epctx->retry = NULL;", "}", "if (epctx->state == EP_HALTED) {", "DPRINTF(\"VAR_0: ep halted, not running schedule\\n\");", "return;", "}", "if (epctx->nr_pstreams) {", "uint32_t err;", "stctx = xhci_find_stream(epctx, VAR_3, &err);", "if (stctx == NULL) {", "return;", "}", "ring = &stctx->ring;", "xhci_set_ep_state(VAR_0, epctx, stctx, EP_RUNNING);", "} else {", "ring = &epctx->ring;", "VAR_3 = 0;", "xhci_set_ep_state(VAR_0, epctx, NULL, EP_RUNNING);", "}", "assert(ring->dequeue != 0);", "while (1) {", "XHCITransfer *xfer = &epctx->transfers[epctx->next_xfer];", "if (xfer->running_async || xfer->running_retry) {", "break;", "}", "VAR_4 = xhci_ring_chain_length(VAR_0, ring);", "if (VAR_4 < 0) {", "break;", "} else if (VAR_4 == 0) {", "break;", "}", "if (xfer->trbs && xfer->trb_alloced < VAR_4) {", "xfer->trb_count = 0;", "xfer->trb_alloced = 0;", "g_free(xfer->trbs);", "xfer->trbs = NULL;", "}", "if (!xfer->trbs) {", "xfer->trbs = g_malloc(sizeof(XHCITRB) * VAR_4);", "xfer->trb_alloced = VAR_4;", "}", "xfer->trb_count = VAR_4;", "for (VAR_5 = 0; VAR_5 < VAR_4; VAR_5++) {", "assert(xhci_ring_fetch(VAR_0, ring, &xfer->trbs[VAR_5], NULL));", "}", "xfer->VAR_0 = VAR_0;", "xfer->VAR_2 = VAR_2;", "xfer->VAR_1 = VAR_1;", "xfer->VAR_3 = VAR_3;", "if (VAR_2 == 1) {", "if (xhci_fire_ctl_transfer(VAR_0, xfer) >= 0) {", "epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE;", "ep = xfer->packet.ep;", "} else {", "fprintf(stderr, \"VAR_0: error firing CTL transfer\\n\");", "}", "} else {", "if (xhci_fire_transfer(VAR_0, xfer, epctx) >= 0) {", "epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE;", "ep = xfer->packet.ep;", "} else {", "if (!xfer->iso_xfer) {", "fprintf(stderr, \"VAR_0: error firing data transfer\\n\");", "}", "}", "}", "if (epctx->state == EP_HALTED) {", "break;", "}", "if (xfer->running_retry) {", "DPRINTF(\"VAR_0: xfer nacked, stopping schedule\\n\");", "epctx->retry = xfer;", "break;", "}", "}", "if (ep) {", "usb_device_flush_ep_queue(ep->dev, ep);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 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 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ] ]
11,462
static int rv10_decode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; static int done=0; MPV_decode_defaults(s); s->avctx= avctx; s->out_format = FMT_H263; s->codec_id= avctx->codec_id; s->width = avctx->width; s->height = avctx->height; switch(avctx->sub_id){ case 0x10000000: s->rv10_version= 0; s->h263_long_vectors=0; s->low_delay=1; break; case 0x10002000: s->rv10_version= 3; s->h263_long_vectors=1; s->low_delay=1; s->obmc=1; break; case 0x10003000: s->rv10_version= 3; s->h263_long_vectors=1; s->low_delay=1; break; case 0x10003001: s->rv10_version= 3; s->h263_long_vectors=0; s->low_delay=1; break; case 0x20001000: case 0x20100001: case 0x20101001: case 0x20103001: s->low_delay=1; break; case 0x20200002: case 0x20201002: case 0x30202002: case 0x30203002: s->low_delay=0; s->avctx->has_b_frames=1; break; default: av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id); } //av_log(avctx, AV_LOG_DEBUG, "ver:%X\n", avctx->sub_id); if (MPV_common_init(s) < 0) return -1; h263_decode_init_vlc(s); /* init rv vlc */ if (!done) { init_vlc(&rv_dc_lum, DC_VLC_BITS, 256, rv_lum_bits, 1, 1, rv_lum_code, 2, 2); init_vlc(&rv_dc_chrom, DC_VLC_BITS, 256, rv_chrom_bits, 1, 1, rv_chrom_code, 2, 2); done = 1; } avctx->pix_fmt = PIX_FMT_YUV420P; return 0; }
true
FFmpeg
073c2593c9f0aa4445a6fc1b9b24e6e52a8cc2c1
static int rv10_decode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; static int done=0; MPV_decode_defaults(s); s->avctx= avctx; s->out_format = FMT_H263; s->codec_id= avctx->codec_id; s->width = avctx->width; s->height = avctx->height; switch(avctx->sub_id){ case 0x10000000: s->rv10_version= 0; s->h263_long_vectors=0; s->low_delay=1; break; case 0x10002000: s->rv10_version= 3; s->h263_long_vectors=1; s->low_delay=1; s->obmc=1; break; case 0x10003000: s->rv10_version= 3; s->h263_long_vectors=1; s->low_delay=1; break; case 0x10003001: s->rv10_version= 3; s->h263_long_vectors=0; s->low_delay=1; break; case 0x20001000: case 0x20100001: case 0x20101001: case 0x20103001: s->low_delay=1; break; case 0x20200002: case 0x20201002: case 0x30202002: case 0x30203002: s->low_delay=0; s->avctx->has_b_frames=1; break; default: av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id); } if (MPV_common_init(s) < 0) return -1; h263_decode_init_vlc(s); if (!done) { init_vlc(&rv_dc_lum, DC_VLC_BITS, 256, rv_lum_bits, 1, 1, rv_lum_code, 2, 2); init_vlc(&rv_dc_chrom, DC_VLC_BITS, 256, rv_chrom_bits, 1, 1, rv_chrom_code, 2, 2); done = 1; } avctx->pix_fmt = PIX_FMT_YUV420P; return 0; }
{ "code": [ " if (!done) {", " done = 1;", " rv_lum_code, 2, 2);", " rv_chrom_code, 2, 2);" ], "line_no": [ 119, 133, 125, 131 ] }
static int FUNC_0(AVCodecContext *VAR_0) { MpegEncContext *s = VAR_0->priv_data; static int VAR_1=0; MPV_decode_defaults(s); s->VAR_0= VAR_0; s->out_format = FMT_H263; s->codec_id= VAR_0->codec_id; s->width = VAR_0->width; s->height = VAR_0->height; switch(VAR_0->sub_id){ case 0x10000000: s->rv10_version= 0; s->h263_long_vectors=0; s->low_delay=1; break; case 0x10002000: s->rv10_version= 3; s->h263_long_vectors=1; s->low_delay=1; s->obmc=1; break; case 0x10003000: s->rv10_version= 3; s->h263_long_vectors=1; s->low_delay=1; break; case 0x10003001: s->rv10_version= 3; s->h263_long_vectors=0; s->low_delay=1; break; case 0x20001000: case 0x20100001: case 0x20101001: case 0x20103001: s->low_delay=1; break; case 0x20200002: case 0x20201002: case 0x30202002: case 0x30203002: s->low_delay=0; s->VAR_0->has_b_frames=1; break; default: av_log(s->VAR_0, AV_LOG_ERROR, "unknown header %X\n", VAR_0->sub_id); } if (MPV_common_init(s) < 0) return -1; h263_decode_init_vlc(s); if (!VAR_1) { init_vlc(&rv_dc_lum, DC_VLC_BITS, 256, rv_lum_bits, 1, 1, rv_lum_code, 2, 2); init_vlc(&rv_dc_chrom, DC_VLC_BITS, 256, rv_chrom_bits, 1, 1, rv_chrom_code, 2, 2); VAR_1 = 1; } VAR_0->pix_fmt = PIX_FMT_YUV420P; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "MpegEncContext *s = VAR_0->priv_data;", "static int VAR_1=0;", "MPV_decode_defaults(s);", "s->VAR_0= VAR_0;", "s->out_format = FMT_H263;", "s->codec_id= VAR_0->codec_id;", "s->width = VAR_0->width;", "s->height = VAR_0->height;", "switch(VAR_0->sub_id){", "case 0x10000000:\ns->rv10_version= 0;", "s->h263_long_vectors=0;", "s->low_delay=1;", "break;", "case 0x10002000:\ns->rv10_version= 3;", "s->h263_long_vectors=1;", "s->low_delay=1;", "s->obmc=1;", "break;", "case 0x10003000:\ns->rv10_version= 3;", "s->h263_long_vectors=1;", "s->low_delay=1;", "break;", "case 0x10003001:\ns->rv10_version= 3;", "s->h263_long_vectors=0;", "s->low_delay=1;", "break;", "case 0x20001000:\ncase 0x20100001:\ncase 0x20101001:\ncase 0x20103001:\ns->low_delay=1;", "break;", "case 0x20200002:\ncase 0x20201002:\ncase 0x30202002:\ncase 0x30203002:\ns->low_delay=0;", "s->VAR_0->has_b_frames=1;", "break;", "default:\nav_log(s->VAR_0, AV_LOG_ERROR, \"unknown header %X\\n\", VAR_0->sub_id);", "}", "if (MPV_common_init(s) < 0)\nreturn -1;", "h263_decode_init_vlc(s);", "if (!VAR_1) {", "init_vlc(&rv_dc_lum, DC_VLC_BITS, 256,\nrv_lum_bits, 1, 1,\nrv_lum_code, 2, 2);", "init_vlc(&rv_dc_chrom, DC_VLC_BITS, 256,\nrv_chrom_bits, 1, 1,\nrv_chrom_code, 2, 2);", "VAR_1 = 1;", "}", "VAR_0->pix_fmt = PIX_FMT_YUV420P;", "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, 1, 1, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75, 77, 79, 81 ], [ 83 ], [ 85, 87, 89, 91, 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 107, 109 ], [ 113 ], [ 119 ], [ 121, 123, 125 ], [ 127, 129, 131 ], [ 133 ], [ 135 ], [ 139 ], [ 143 ], [ 145 ] ]
11,463
static uint64_t get_vb(ByteIOContext *bc){ uint64_t val=0; int i= get_v(bc); if(i>8) return UINT64_MAX; while(i--) val = (val<<8) + get_byte(bc); //av_log(NULL, AV_LOG_DEBUG, "get_vb()= %lld\n", val); return val; }
true
FFmpeg
568e18b15e2ddf494fd8926707d34ca08c8edce5
static uint64_t get_vb(ByteIOContext *bc){ uint64_t val=0; int i= get_v(bc); if(i>8) return UINT64_MAX; while(i--) val = (val<<8) + get_byte(bc); return val; }
{ "code": [ " int i= get_v(bc);" ], "line_no": [ 5 ] }
static uint64_t FUNC_0(ByteIOContext *bc){ uint64_t val=0; int VAR_0= get_v(bc); if(VAR_0>8) return UINT64_MAX; while(VAR_0--) val = (val<<8) + get_byte(bc); return val; }
[ "static uint64_t FUNC_0(ByteIOContext *bc){", "uint64_t val=0;", "int VAR_0= get_v(bc);", "if(VAR_0>8)\nreturn UINT64_MAX;", "while(VAR_0--)\nval = (val<<8) + get_byte(bc);", "return val;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 9, 11 ], [ 15, 17 ], [ 23 ], [ 25 ] ]
11,464
static void qvirtio_pci_virtqueue_kick(QVirtioDevice *d, QVirtQueue *vq) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; qpci_io_writew(dev->pdev, dev->addr + VIRTIO_PCI_QUEUE_NOTIFY, vq->index); }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
static void qvirtio_pci_virtqueue_kick(QVirtioDevice *d, QVirtQueue *vq) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d; qpci_io_writew(dev->pdev, dev->addr + VIRTIO_PCI_QUEUE_NOTIFY, vq->index); }
{ "code": [ " qpci_io_writew(dev->pdev, dev->addr + VIRTIO_PCI_QUEUE_NOTIFY, vq->index);" ], "line_no": [ 7 ] }
static void FUNC_0(QVirtioDevice *VAR_0, QVirtQueue *VAR_1) { QVirtioPCIDevice *dev = (QVirtioPCIDevice *)VAR_0; qpci_io_writew(dev->pdev, dev->addr + VIRTIO_PCI_QUEUE_NOTIFY, VAR_1->index); }
[ "static void FUNC_0(QVirtioDevice *VAR_0, QVirtQueue *VAR_1)\n{", "QVirtioPCIDevice *dev = (QVirtioPCIDevice *)VAR_0;", "qpci_io_writew(dev->pdev, dev->addr + VIRTIO_PCI_QUEUE_NOTIFY, VAR_1->index);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
11,465
static av_always_inline void decode_bgr_1(HYuvContext *s, int count, int decorrelate, int alpha) { int i; OPEN_READER(re, &s->gb); for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) { unsigned int index; int code, n; UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); n = s->vlc[4].table[index][1]; if (n>0) { code = s->vlc[4].table[index][0]; *(uint32_t*)&s->temp[0][4 * i] = s->pix_bgr_map[code]; LAST_SKIP_BITS(re, &s->gb, n); } else { int nb_bits; if(decorrelate) { VLC_INTERN(s->temp[0][4 * i + G], s->vlc[1].table, &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(code, s->vlc[0].table, &s->gb, re, VLC_BITS, 3); s->temp[0][4 * i + B] = code + s->temp[0][4 * i + G]; UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(code, s->vlc[2].table, &s->gb, re, VLC_BITS, 3); s->temp[0][4 * i + R] = code + s->temp[0][4 * i + G]; } else { VLC_INTERN(s->temp[0][4 * i + B], s->vlc[0].table, &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(s->temp[0][4 * i + G], s->vlc[1].table, &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(s->temp[0][4 * i + R], s->vlc[2].table, &s->gb, re, VLC_BITS, 3); } if (alpha) { UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(s->temp[0][4 * i + A], s->vlc[2].table, &s->gb, re, VLC_BITS, 3); } } } CLOSE_READER(re, &s->gb); }
true
FFmpeg
5439959ef013670d8974e88acb85bd03055a6229
static av_always_inline void decode_bgr_1(HYuvContext *s, int count, int decorrelate, int alpha) { int i; OPEN_READER(re, &s->gb); for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) { unsigned int index; int code, n; UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); n = s->vlc[4].table[index][1]; if (n>0) { code = s->vlc[4].table[index][0]; *(uint32_t*)&s->temp[0][4 * i] = s->pix_bgr_map[code]; LAST_SKIP_BITS(re, &s->gb, n); } else { int nb_bits; if(decorrelate) { VLC_INTERN(s->temp[0][4 * i + G], s->vlc[1].table, &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(code, s->vlc[0].table, &s->gb, re, VLC_BITS, 3); s->temp[0][4 * i + B] = code + s->temp[0][4 * i + G]; UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(code, s->vlc[2].table, &s->gb, re, VLC_BITS, 3); s->temp[0][4 * i + R] = code + s->temp[0][4 * i + G]; } else { VLC_INTERN(s->temp[0][4 * i + B], s->vlc[0].table, &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(s->temp[0][4 * i + G], s->vlc[1].table, &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(s->temp[0][4 * i + R], s->vlc[2].table, &s->gb, re, VLC_BITS, 3); } if (alpha) { UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(s->temp[0][4 * i + A], s->vlc[2].table, &s->gb, re, VLC_BITS, 3); } } } CLOSE_READER(re, &s->gb); }
{ "code": [], "line_no": [] }
static av_always_inline void FUNC_0(HYuvContext *s, int count, int decorrelate, int alpha) { int VAR_0; OPEN_READER(re, &s->gb); for (VAR_0 = 0; VAR_0 < count && get_bits_left(&s->gb) > 0; VAR_0++) { unsigned int index; int code, n; UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); n = s->vlc[4].table[index][1]; if (n>0) { code = s->vlc[4].table[index][0]; *(uint32_t*)&s->temp[0][4 * VAR_0] = s->pix_bgr_map[code]; LAST_SKIP_BITS(re, &s->gb, n); } else { int nb_bits; if(decorrelate) { VLC_INTERN(s->temp[0][4 * VAR_0 + G], s->vlc[1].table, &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(code, s->vlc[0].table, &s->gb, re, VLC_BITS, 3); s->temp[0][4 * VAR_0 + B] = code + s->temp[0][4 * VAR_0 + G]; UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(code, s->vlc[2].table, &s->gb, re, VLC_BITS, 3); s->temp[0][4 * VAR_0 + R] = code + s->temp[0][4 * VAR_0 + G]; } else { VLC_INTERN(s->temp[0][4 * VAR_0 + B], s->vlc[0].table, &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(s->temp[0][4 * VAR_0 + G], s->vlc[1].table, &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(s->temp[0][4 * VAR_0 + R], s->vlc[2].table, &s->gb, re, VLC_BITS, 3); } if (alpha) { UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(s->temp[0][4 * VAR_0 + A], s->vlc[2].table, &s->gb, re, VLC_BITS, 3); } } } CLOSE_READER(re, &s->gb); }
[ "static av_always_inline void FUNC_0(HYuvContext *s, int count,\nint decorrelate, int alpha)\n{", "int VAR_0;", "OPEN_READER(re, &s->gb);", "for (VAR_0 = 0; VAR_0 < count && get_bits_left(&s->gb) > 0; VAR_0++) {", "unsigned int index;", "int code, n;", "UPDATE_CACHE(re, &s->gb);", "index = SHOW_UBITS(re, &s->gb, VLC_BITS);", "n = s->vlc[4].table[index][1];", "if (n>0) {", "code = s->vlc[4].table[index][0];", "*(uint32_t*)&s->temp[0][4 * VAR_0] = s->pix_bgr_map[code];", "LAST_SKIP_BITS(re, &s->gb, n);", "} else {", "int nb_bits;", "if(decorrelate) {", "VLC_INTERN(s->temp[0][4 * VAR_0 + G], s->vlc[1].table,\n&s->gb, re, VLC_BITS, 3);", "UPDATE_CACHE(re, &s->gb);", "index = SHOW_UBITS(re, &s->gb, VLC_BITS);", "VLC_INTERN(code, s->vlc[0].table, &s->gb, re, VLC_BITS, 3);", "s->temp[0][4 * VAR_0 + B] = code + s->temp[0][4 * VAR_0 + G];", "UPDATE_CACHE(re, &s->gb);", "index = SHOW_UBITS(re, &s->gb, VLC_BITS);", "VLC_INTERN(code, s->vlc[2].table, &s->gb, re, VLC_BITS, 3);", "s->temp[0][4 * VAR_0 + R] = code + s->temp[0][4 * VAR_0 + G];", "} else {", "VLC_INTERN(s->temp[0][4 * VAR_0 + B], s->vlc[0].table,\n&s->gb, re, VLC_BITS, 3);", "UPDATE_CACHE(re, &s->gb);", "index = SHOW_UBITS(re, &s->gb, VLC_BITS);", "VLC_INTERN(s->temp[0][4 * VAR_0 + G], s->vlc[1].table,\n&s->gb, re, VLC_BITS, 3);", "UPDATE_CACHE(re, &s->gb);", "index = SHOW_UBITS(re, &s->gb, VLC_BITS);", "VLC_INTERN(s->temp[0][4 * VAR_0 + R], s->vlc[2].table,\n&s->gb, re, VLC_BITS, 3);", "}", "if (alpha) {", "UPDATE_CACHE(re, &s->gb);", "index = SHOW_UBITS(re, &s->gb, VLC_BITS);", "VLC_INTERN(s->temp[0][4 * VAR_0 + A], s->vlc[2].table,\n&s->gb, re, VLC_BITS, 3);", "}", "}", "}", "CLOSE_READER(re, &s->gb);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ] ]
11,466
static void virtio_balloon_receive_stats(VirtIODevice *vdev, VirtQueue *vq) { VirtIOBalloon *s = VIRTIO_BALLOON(vdev); VirtQueueElement *elem; VirtIOBalloonStat stat; size_t offset = 0; qemu_timeval tv; s->stats_vq_elem = elem = virtqueue_pop(vq, sizeof(VirtQueueElement)); if (!elem) { goto out; } /* Initialize the stats to get rid of any stale values. This is only * needed to handle the case where a guest supports fewer stats than it * used to (ie. it has booted into an old kernel). */ reset_stats(s); while (iov_to_buf(elem->out_sg, elem->out_num, offset, &stat, sizeof(stat)) == sizeof(stat)) { uint16_t tag = virtio_tswap16(vdev, stat.tag); uint64_t val = virtio_tswap64(vdev, stat.val); offset += sizeof(stat); if (tag < VIRTIO_BALLOON_S_NR) s->stats[tag] = val; } s->stats_vq_offset = offset; if (qemu_gettimeofday(&tv) < 0) { fprintf(stderr, "warning: %s: failed to get time of day\n", __func__); goto out; } s->stats_last_update = tv.tv_sec; out: if (balloon_stats_enabled(s)) { balloon_stats_change_timer(s, s->stats_poll_interval); } }
true
qemu
4eae2a657d1ff5ada56eb9b4966eae0eff333b0b
static void virtio_balloon_receive_stats(VirtIODevice *vdev, VirtQueue *vq) { VirtIOBalloon *s = VIRTIO_BALLOON(vdev); VirtQueueElement *elem; VirtIOBalloonStat stat; size_t offset = 0; qemu_timeval tv; s->stats_vq_elem = elem = virtqueue_pop(vq, sizeof(VirtQueueElement)); if (!elem) { goto out; } reset_stats(s); while (iov_to_buf(elem->out_sg, elem->out_num, offset, &stat, sizeof(stat)) == sizeof(stat)) { uint16_t tag = virtio_tswap16(vdev, stat.tag); uint64_t val = virtio_tswap64(vdev, stat.val); offset += sizeof(stat); if (tag < VIRTIO_BALLOON_S_NR) s->stats[tag] = val; } s->stats_vq_offset = offset; if (qemu_gettimeofday(&tv) < 0) { fprintf(stderr, "warning: %s: failed to get time of day\n", __func__); goto out; } s->stats_last_update = tv.tv_sec; out: if (balloon_stats_enabled(s)) { balloon_stats_change_timer(s, s->stats_poll_interval); } }
{ "code": [ " s->stats_vq_elem = elem = virtqueue_pop(vq, sizeof(VirtQueueElement));" ], "line_no": [ 17 ] }
static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1) { VirtIOBalloon *s = VIRTIO_BALLOON(VAR_0); VirtQueueElement *elem; VirtIOBalloonStat stat; size_t offset = 0; qemu_timeval tv; s->stats_vq_elem = elem = virtqueue_pop(VAR_1, sizeof(VirtQueueElement)); if (!elem) { goto out; } reset_stats(s); while (iov_to_buf(elem->out_sg, elem->out_num, offset, &stat, sizeof(stat)) == sizeof(stat)) { uint16_t tag = virtio_tswap16(VAR_0, stat.tag); uint64_t val = virtio_tswap64(VAR_0, stat.val); offset += sizeof(stat); if (tag < VIRTIO_BALLOON_S_NR) s->stats[tag] = val; } s->stats_vq_offset = offset; if (qemu_gettimeofday(&tv) < 0) { fprintf(stderr, "warning: %s: failed to get time of day\n", __func__); goto out; } s->stats_last_update = tv.tv_sec; out: if (balloon_stats_enabled(s)) { balloon_stats_change_timer(s, s->stats_poll_interval); } }
[ "static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1)\n{", "VirtIOBalloon *s = VIRTIO_BALLOON(VAR_0);", "VirtQueueElement *elem;", "VirtIOBalloonStat stat;", "size_t offset = 0;", "qemu_timeval tv;", "s->stats_vq_elem = elem = virtqueue_pop(VAR_1, sizeof(VirtQueueElement));", "if (!elem) {", "goto out;", "}", "reset_stats(s);", "while (iov_to_buf(elem->out_sg, elem->out_num, offset, &stat, sizeof(stat))\n== sizeof(stat)) {", "uint16_t tag = virtio_tswap16(VAR_0, stat.tag);", "uint64_t val = virtio_tswap64(VAR_0, stat.val);", "offset += sizeof(stat);", "if (tag < VIRTIO_BALLOON_S_NR)\ns->stats[tag] = val;", "}", "s->stats_vq_offset = offset;", "if (qemu_gettimeofday(&tv) < 0) {", "fprintf(stderr, \"warning: %s: failed to get time of day\\n\", __func__);", "goto out;", "}", "s->stats_last_update = tv.tv_sec;", "out:\nif (balloon_stats_enabled(s)) {", "balloon_stats_change_timer(s, s->stats_poll_interval);", "}", "}" ]
[ 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, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ] ]
11,467
static int vmdk_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors) { BDRVVmdkState *s = bs->opaque; VmdkExtent *extent = NULL; int n, ret; int64_t index_in_cluster; uint64_t cluster_offset; VmdkMetaData m_data; if (sector_num > bs->total_sectors) { fprintf(stderr, "(VMDK) Wrong offset: sector_num=0x%" PRIx64 " total_sectors=0x%" PRIx64 "\n", sector_num, bs->total_sectors); return -EIO; } while (nb_sectors > 0) { extent = find_extent(s, sector_num, extent); if (!extent) { return -EIO; } ret = get_cluster_offset( bs, extent, &m_data, sector_num << 9, !extent->compressed, &cluster_offset); if (extent->compressed) { if (ret == 0) { /* Refuse write to allocated cluster for streamOptimized */ fprintf(stderr, "VMDK: can't write to allocated cluster" " for streamOptimized\n"); return -EIO; } else { /* allocate */ ret = get_cluster_offset( bs, extent, &m_data, sector_num << 9, 1, &cluster_offset); } } if (ret) { return -EINVAL; } index_in_cluster = sector_num % extent->cluster_sectors; n = extent->cluster_sectors - index_in_cluster; if (n > nb_sectors) { n = nb_sectors; } ret = vmdk_write_extent(extent, cluster_offset, index_in_cluster * 512, buf, n, sector_num); if (ret) { return ret; } if (m_data.valid) { /* update L2 tables */ if (vmdk_L2update(extent, &m_data) == -1) { return -EIO; } } nb_sectors -= n; sector_num += n; buf += n * 512; /* update CID on the first write every time the virtual disk is * opened */ if (!s->cid_updated) { ret = vmdk_write_cid(bs, time(NULL)); if (ret < 0) { return ret; } s->cid_updated = true; } } return 0; }
true
qemu
b1649fae49a899a222c3ac53c5009dd6f23349e1
static int vmdk_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors) { BDRVVmdkState *s = bs->opaque; VmdkExtent *extent = NULL; int n, ret; int64_t index_in_cluster; uint64_t cluster_offset; VmdkMetaData m_data; if (sector_num > bs->total_sectors) { fprintf(stderr, "(VMDK) Wrong offset: sector_num=0x%" PRIx64 " total_sectors=0x%" PRIx64 "\n", sector_num, bs->total_sectors); return -EIO; } while (nb_sectors > 0) { extent = find_extent(s, sector_num, extent); if (!extent) { return -EIO; } ret = get_cluster_offset( bs, extent, &m_data, sector_num << 9, !extent->compressed, &cluster_offset); if (extent->compressed) { if (ret == 0) { fprintf(stderr, "VMDK: can't write to allocated cluster" " for streamOptimized\n"); return -EIO; } else { ret = get_cluster_offset( bs, extent, &m_data, sector_num << 9, 1, &cluster_offset); } } if (ret) { return -EINVAL; } index_in_cluster = sector_num % extent->cluster_sectors; n = extent->cluster_sectors - index_in_cluster; if (n > nb_sectors) { n = nb_sectors; } ret = vmdk_write_extent(extent, cluster_offset, index_in_cluster * 512, buf, n, sector_num); if (ret) { return ret; } if (m_data.valid) { if (vmdk_L2update(extent, &m_data) == -1) { return -EIO; } } nb_sectors -= n; sector_num += n; buf += n * 512; if (!s->cid_updated) { ret = vmdk_write_cid(bs, time(NULL)); if (ret < 0) { return ret; } s->cid_updated = true; } } return 0; }
{ "code": [ " index_in_cluster = sector_num % extent->cluster_sectors;", " index_in_cluster = sector_num % extent->cluster_sectors;" ], "line_no": [ 99, 99 ] }
static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, const uint8_t *VAR_2, int VAR_3) { BDRVVmdkState *s = VAR_0->opaque; VmdkExtent *extent = NULL; int VAR_4, VAR_5; int64_t index_in_cluster; uint64_t cluster_offset; VmdkMetaData m_data; if (VAR_1 > VAR_0->total_sectors) { fprintf(stderr, "(VMDK) Wrong offset: VAR_1=0x%" PRIx64 " total_sectors=0x%" PRIx64 "\VAR_4", VAR_1, VAR_0->total_sectors); return -EIO; } while (VAR_3 > 0) { extent = find_extent(s, VAR_1, extent); if (!extent) { return -EIO; } VAR_5 = get_cluster_offset( VAR_0, extent, &m_data, VAR_1 << 9, !extent->compressed, &cluster_offset); if (extent->compressed) { if (VAR_5 == 0) { fprintf(stderr, "VMDK: can't write to allocated cluster" " for streamOptimized\VAR_4"); return -EIO; } else { VAR_5 = get_cluster_offset( VAR_0, extent, &m_data, VAR_1 << 9, 1, &cluster_offset); } } if (VAR_5) { return -EINVAL; } index_in_cluster = VAR_1 % extent->cluster_sectors; VAR_4 = extent->cluster_sectors - index_in_cluster; if (VAR_4 > VAR_3) { VAR_4 = VAR_3; } VAR_5 = vmdk_write_extent(extent, cluster_offset, index_in_cluster * 512, VAR_2, VAR_4, VAR_1); if (VAR_5) { return VAR_5; } if (m_data.valid) { if (vmdk_L2update(extent, &m_data) == -1) { return -EIO; } } VAR_3 -= VAR_4; VAR_1 += VAR_4; VAR_2 += VAR_4 * 512; if (!s->cid_updated) { VAR_5 = vmdk_write_cid(VAR_0, time(NULL)); if (VAR_5 < 0) { return VAR_5; } s->cid_updated = true; } } return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nconst uint8_t *VAR_2, int VAR_3)\n{", "BDRVVmdkState *s = VAR_0->opaque;", "VmdkExtent *extent = NULL;", "int VAR_4, VAR_5;", "int64_t index_in_cluster;", "uint64_t cluster_offset;", "VmdkMetaData m_data;", "if (VAR_1 > VAR_0->total_sectors) {", "fprintf(stderr,\n\"(VMDK) Wrong offset: VAR_1=0x%\" PRIx64\n\" total_sectors=0x%\" PRIx64 \"\\VAR_4\",\nVAR_1, VAR_0->total_sectors);", "return -EIO;", "}", "while (VAR_3 > 0) {", "extent = find_extent(s, VAR_1, extent);", "if (!extent) {", "return -EIO;", "}", "VAR_5 = get_cluster_offset(\nVAR_0,\nextent,\n&m_data,\nVAR_1 << 9, !extent->compressed,\n&cluster_offset);", "if (extent->compressed) {", "if (VAR_5 == 0) {", "fprintf(stderr,\n\"VMDK: can't write to allocated cluster\"\n\" for streamOptimized\\VAR_4\");", "return -EIO;", "} else {", "VAR_5 = get_cluster_offset(\nVAR_0,\nextent,\n&m_data,\nVAR_1 << 9, 1,\n&cluster_offset);", "}", "}", "if (VAR_5) {", "return -EINVAL;", "}", "index_in_cluster = VAR_1 % extent->cluster_sectors;", "VAR_4 = extent->cluster_sectors - index_in_cluster;", "if (VAR_4 > VAR_3) {", "VAR_4 = VAR_3;", "}", "VAR_5 = vmdk_write_extent(extent,\ncluster_offset, index_in_cluster * 512,\nVAR_2, VAR_4, VAR_1);", "if (VAR_5) {", "return VAR_5;", "}", "if (m_data.valid) {", "if (vmdk_L2update(extent, &m_data) == -1) {", "return -EIO;", "}", "}", "VAR_3 -= VAR_4;", "VAR_1 += VAR_4;", "VAR_2 += VAR_4 * 512;", "if (!s->cid_updated) {", "VAR_5 = vmdk_write_cid(VAR_0, time(NULL));", "if (VAR_5 < 0) {", "return VAR_5;", "}", "s->cid_updated = true;", "}", "}", "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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25, 27, 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49, 51, 53, 55, 57 ], [ 59 ], [ 61 ], [ 65, 67, 69 ], [ 71 ], [ 73 ], [ 77, 79, 81, 83, 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111, 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ] ]
11,470
av_cold void ff_fft_init_mmx(FFTContext *s) { #if HAVE_YASM int has_vectors = av_get_cpu_flags(); #if ARCH_X86_32 if (has_vectors & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) { /* 3DNow! for K6-2/3 */ s->imdct_calc = ff_imdct_calc_3dnow; s->imdct_half = ff_imdct_half_3dnow; s->fft_calc = ff_fft_calc_3dnow; } if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) { /* 3DNowEx for K7 */ s->imdct_calc = ff_imdct_calc_3dnowext; s->imdct_half = ff_imdct_half_3dnowext; s->fft_calc = ff_fft_calc_3dnowext; } #endif if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) { /* SSE for P3/P4/K8 */ s->imdct_calc = ff_imdct_calc_sse; s->imdct_half = ff_imdct_half_sse; s->fft_permute = ff_fft_permute_sse; s->fft_calc = ff_fft_calc_sse; s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; } if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX && s->nbits >= 5) { /* AVX for SB */ s->imdct_half = ff_imdct_half_avx; s->fft_calc = ff_fft_calc_avx; s->fft_permutation = FF_FFT_PERM_AVX; } #endif }
false
FFmpeg
e0c6cce44729d94e2a5507a4b6d031f23e8bd7b6
av_cold void ff_fft_init_mmx(FFTContext *s) { #if HAVE_YASM int has_vectors = av_get_cpu_flags(); #if ARCH_X86_32 if (has_vectors & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) { s->imdct_calc = ff_imdct_calc_3dnow; s->imdct_half = ff_imdct_half_3dnow; s->fft_calc = ff_fft_calc_3dnow; } if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) { s->imdct_calc = ff_imdct_calc_3dnowext; s->imdct_half = ff_imdct_half_3dnowext; s->fft_calc = ff_fft_calc_3dnowext; } #endif if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) { s->imdct_calc = ff_imdct_calc_sse; s->imdct_half = ff_imdct_half_sse; s->fft_permute = ff_fft_permute_sse; s->fft_calc = ff_fft_calc_sse; s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; } if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX && s->nbits >= 5) { s->imdct_half = ff_imdct_half_avx; s->fft_calc = ff_fft_calc_avx; s->fft_permutation = FF_FFT_PERM_AVX; } #endif }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(FFTContext *s) { #if HAVE_YASM int has_vectors = av_get_cpu_flags(); #if ARCH_X86_32 if (has_vectors & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) { s->imdct_calc = ff_imdct_calc_3dnow; s->imdct_half = ff_imdct_half_3dnow; s->fft_calc = ff_fft_calc_3dnow; } if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) { s->imdct_calc = ff_imdct_calc_3dnowext; s->imdct_half = ff_imdct_half_3dnowext; s->fft_calc = ff_fft_calc_3dnowext; } #endif if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) { s->imdct_calc = ff_imdct_calc_sse; s->imdct_half = ff_imdct_half_sse; s->fft_permute = ff_fft_permute_sse; s->fft_calc = ff_fft_calc_sse; s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; } if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX && s->nbits >= 5) { s->imdct_half = ff_imdct_half_avx; s->fft_calc = ff_fft_calc_avx; s->fft_permutation = FF_FFT_PERM_AVX; } #endif }
[ "av_cold void FUNC_0(FFTContext *s)\n{", "#if HAVE_YASM\nint has_vectors = av_get_cpu_flags();", "#if ARCH_X86_32\nif (has_vectors & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {", "s->imdct_calc = ff_imdct_calc_3dnow;", "s->imdct_half = ff_imdct_half_3dnow;", "s->fft_calc = ff_fft_calc_3dnow;", "}", "if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) {", "s->imdct_calc = ff_imdct_calc_3dnowext;", "s->imdct_half = ff_imdct_half_3dnowext;", "s->fft_calc = ff_fft_calc_3dnowext;", "}", "#endif\nif (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) {", "s->imdct_calc = ff_imdct_calc_sse;", "s->imdct_half = ff_imdct_half_sse;", "s->fft_permute = ff_fft_permute_sse;", "s->fft_calc = ff_fft_calc_sse;", "s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;", "}", "if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX && s->nbits >= 5) {", "s->imdct_half = ff_imdct_half_avx;", "s->fft_calc = ff_fft_calc_avx;", "s->fft_permutation = FF_FFT_PERM_AVX;", "}", "#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 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ] ]
11,471
void put_no_rnd_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h) { POWERPC_TBL_DECLARE(altivec_put_no_rnd_pixels8_xy2_num, 1); #ifdef ALTIVEC_USE_REFERENCE_C_CODE int j; POWERPC_TBL_START_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); for (j = 0; j < 2; j++) { int i; const uint32_t a = (((const struct unaligned_32 *) (pixels))->l); const uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); uint32_t l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x01010101UL; uint32_t h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); uint32_t l1, h1; pixels += line_size; for (i = 0; i < h; i += 2) { uint32_t a = (((const struct unaligned_32 *) (pixels))->l); uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); l1 = (a & 0x03030303UL) + (b & 0x03030303UL); h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); *((uint32_t *) block) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); pixels += line_size; block += line_size; a = (((const struct unaligned_32 *) (pixels))->l); b = (((const struct unaligned_32 *) (pixels + 1))->l); l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x01010101UL; h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); *((uint32_t *) block) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); pixels += line_size; block += line_size; } pixels += 4 - line_size * (h + 1); block += 4 - line_size * h; } POWERPC_TBL_STOP_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); #else /* ALTIVEC_USE_REFERENCE_C_CODE */ register int i; register vector unsigned char pixelsv1, pixelsv2, pixelsavg; register vector unsigned char blockv, temp1, temp2; register vector unsigned short pixelssum1, pixelssum2, temp3; register const vector unsigned char vczero = (const vector unsigned char)vec_splat_u8(0); register const vector unsigned short vcone = (const vector unsigned short)vec_splat_u16(1); register const vector unsigned short vctwo = (const vector unsigned short)vec_splat_u16(2); temp1 = vec_ld(0, pixels); temp2 = vec_ld(16, pixels); pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels)); if ((((unsigned long)pixels) & 0x0000000F) == 0x0000000F) { pixelsv2 = temp2; } else { pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, pixels)); } pixelsv1 = vec_mergeh(vczero, pixelsv1); pixelsv2 = vec_mergeh(vczero, pixelsv2); pixelssum1 = vec_add((vector unsigned short)pixelsv1, (vector unsigned short)pixelsv2); pixelssum1 = vec_add(pixelssum1, vcone); POWERPC_TBL_START_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); for (i = 0; i < h ; i++) { int rightside = ((unsigned long)block & 0x0000000F); blockv = vec_ld(0, block); temp1 = vec_ld(line_size, pixels); temp2 = vec_ld(line_size + 16, pixels); pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(line_size, pixels)); if (((((unsigned long)pixels) + line_size) & 0x0000000F) == 0x0000000F) { pixelsv2 = temp2; } else { pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(line_size + 1, pixels)); } pixelsv1 = vec_mergeh(vczero, pixelsv1); pixelsv2 = vec_mergeh(vczero, pixelsv2); pixelssum2 = vec_add((vector unsigned short)pixelsv1, (vector unsigned short)pixelsv2); temp3 = vec_add(pixelssum1, pixelssum2); temp3 = vec_sra(temp3, vctwo); pixelssum1 = vec_add(pixelssum2, vcone); pixelsavg = vec_packsu(temp3, (vector unsigned short) vczero); if (rightside) { blockv = vec_perm(blockv, pixelsavg, vcprm(0, 1, s0, s1)); } else { blockv = vec_perm(blockv, pixelsavg, vcprm(s0, s1, 2, 3)); } vec_st(blockv, 0, block); block += line_size; pixels += line_size; } POWERPC_TBL_STOP_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); #endif /* ALTIVEC_USE_REFERENCE_C_CODE */ }
false
FFmpeg
e45a2872fafe631c14aee9f79d0963d68c4fc1fd
void put_no_rnd_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h) { POWERPC_TBL_DECLARE(altivec_put_no_rnd_pixels8_xy2_num, 1); #ifdef ALTIVEC_USE_REFERENCE_C_CODE int j; POWERPC_TBL_START_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); for (j = 0; j < 2; j++) { int i; const uint32_t a = (((const struct unaligned_32 *) (pixels))->l); const uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); uint32_t l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x01010101UL; uint32_t h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); uint32_t l1, h1; pixels += line_size; for (i = 0; i < h; i += 2) { uint32_t a = (((const struct unaligned_32 *) (pixels))->l); uint32_t b = (((const struct unaligned_32 *) (pixels + 1))->l); l1 = (a & 0x03030303UL) + (b & 0x03030303UL); h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); *((uint32_t *) block) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); pixels += line_size; block += line_size; a = (((const struct unaligned_32 *) (pixels))->l); b = (((const struct unaligned_32 *) (pixels + 1))->l); l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x01010101UL; h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); *((uint32_t *) block) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); pixels += line_size; block += line_size; } pixels += 4 - line_size * (h + 1); block += 4 - line_size * h; } POWERPC_TBL_STOP_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); #else register int i; register vector unsigned char pixelsv1, pixelsv2, pixelsavg; register vector unsigned char blockv, temp1, temp2; register vector unsigned short pixelssum1, pixelssum2, temp3; register const vector unsigned char vczero = (const vector unsigned char)vec_splat_u8(0); register const vector unsigned short vcone = (const vector unsigned short)vec_splat_u16(1); register const vector unsigned short vctwo = (const vector unsigned short)vec_splat_u16(2); temp1 = vec_ld(0, pixels); temp2 = vec_ld(16, pixels); pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels)); if ((((unsigned long)pixels) & 0x0000000F) == 0x0000000F) { pixelsv2 = temp2; } else { pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, pixels)); } pixelsv1 = vec_mergeh(vczero, pixelsv1); pixelsv2 = vec_mergeh(vczero, pixelsv2); pixelssum1 = vec_add((vector unsigned short)pixelsv1, (vector unsigned short)pixelsv2); pixelssum1 = vec_add(pixelssum1, vcone); POWERPC_TBL_START_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); for (i = 0; i < h ; i++) { int rightside = ((unsigned long)block & 0x0000000F); blockv = vec_ld(0, block); temp1 = vec_ld(line_size, pixels); temp2 = vec_ld(line_size + 16, pixels); pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(line_size, pixels)); if (((((unsigned long)pixels) + line_size) & 0x0000000F) == 0x0000000F) { pixelsv2 = temp2; } else { pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(line_size + 1, pixels)); } pixelsv1 = vec_mergeh(vczero, pixelsv1); pixelsv2 = vec_mergeh(vczero, pixelsv2); pixelssum2 = vec_add((vector unsigned short)pixelsv1, (vector unsigned short)pixelsv2); temp3 = vec_add(pixelssum1, pixelssum2); temp3 = vec_sra(temp3, vctwo); pixelssum1 = vec_add(pixelssum2, vcone); pixelsavg = vec_packsu(temp3, (vector unsigned short) vczero); if (rightside) { blockv = vec_perm(blockv, pixelsavg, vcprm(0, 1, s0, s1)); } else { blockv = vec_perm(blockv, pixelsavg, vcprm(s0, s1, 2, 3)); } vec_st(blockv, 0, block); block += line_size; pixels += line_size; } POWERPC_TBL_STOP_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); #endif }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3) { POWERPC_TBL_DECLARE(altivec_put_no_rnd_pixels8_xy2_num, 1); #ifdef ALTIVEC_USE_REFERENCE_C_CODE int j; POWERPC_TBL_START_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); for (j = 0; j < 2; j++) { int VAR_4; const uint32_t a = (((const struct unaligned_32 *) (VAR_1))->l); const uint32_t b = (((const struct unaligned_32 *) (VAR_1 + 1))->l); uint32_t l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x01010101UL; uint32_t h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); uint32_t l1, h1; VAR_1 += VAR_2; for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4 += 2) { uint32_t a = (((const struct unaligned_32 *) (VAR_1))->l); uint32_t b = (((const struct unaligned_32 *) (VAR_1 + 1))->l); l1 = (a & 0x03030303UL) + (b & 0x03030303UL); h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); *((uint32_t *) VAR_0) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); VAR_1 += VAR_2; VAR_0 += VAR_2; a = (((const struct unaligned_32 *) (VAR_1))->l); b = (((const struct unaligned_32 *) (VAR_1 + 1))->l); l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x01010101UL; h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2); *((uint32_t *) VAR_0) = h0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL); VAR_1 += VAR_2; VAR_0 += VAR_2; } VAR_1 += 4 - VAR_2 * (VAR_3 + 1); VAR_0 += 4 - VAR_2 * VAR_3; } POWERPC_TBL_STOP_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); #else register int VAR_4; register vector unsigned char VAR_5, pixelsv2, pixelsavg; register vector unsigned char VAR_6, temp1, temp2; register vector unsigned short VAR_7, pixelssum2, temp3; register const vector unsigned char VAR_8 = (const vector unsigned char)vec_splat_u8(0); register const vector unsigned short VAR_9 = (const vector unsigned short)vec_splat_u16(1); register const vector unsigned short VAR_10 = (const vector unsigned short)vec_splat_u16(2); temp1 = vec_ld(0, VAR_1); temp2 = vec_ld(16, VAR_1); VAR_5 = vec_perm(temp1, temp2, vec_lvsl(0, VAR_1)); if ((((unsigned long)VAR_1) & 0x0000000F) == 0x0000000F) { pixelsv2 = temp2; } else { pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, VAR_1)); } VAR_5 = vec_mergeh(VAR_8, VAR_5); pixelsv2 = vec_mergeh(VAR_8, pixelsv2); VAR_7 = vec_add((vector unsigned short)VAR_5, (vector unsigned short)pixelsv2); VAR_7 = vec_add(VAR_7, VAR_9); POWERPC_TBL_START_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); for (VAR_4 = 0; VAR_4 < VAR_3 ; VAR_4++) { int VAR_11 = ((unsigned long)VAR_0 & 0x0000000F); VAR_6 = vec_ld(0, VAR_0); temp1 = vec_ld(VAR_2, VAR_1); temp2 = vec_ld(VAR_2 + 16, VAR_1); VAR_5 = vec_perm(temp1, temp2, vec_lvsl(VAR_2, VAR_1)); if (((((unsigned long)VAR_1) + VAR_2) & 0x0000000F) == 0x0000000F) { pixelsv2 = temp2; } else { pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(VAR_2 + 1, VAR_1)); } VAR_5 = vec_mergeh(VAR_8, VAR_5); pixelsv2 = vec_mergeh(VAR_8, pixelsv2); pixelssum2 = vec_add((vector unsigned short)VAR_5, (vector unsigned short)pixelsv2); temp3 = vec_add(VAR_7, pixelssum2); temp3 = vec_sra(temp3, VAR_10); VAR_7 = vec_add(pixelssum2, VAR_9); pixelsavg = vec_packsu(temp3, (vector unsigned short) VAR_8); if (VAR_11) { VAR_6 = vec_perm(VAR_6, pixelsavg, vcprm(0, 1, s0, s1)); } else { VAR_6 = vec_perm(VAR_6, pixelsavg, vcprm(s0, s1, 2, 3)); } vec_st(VAR_6, 0, VAR_0); VAR_0 += VAR_2; VAR_1 += VAR_2; } POWERPC_TBL_STOP_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1); #endif }
[ "void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3)\n{", "POWERPC_TBL_DECLARE(altivec_put_no_rnd_pixels8_xy2_num, 1);", "#ifdef ALTIVEC_USE_REFERENCE_C_CODE\nint j;", "POWERPC_TBL_START_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1);", "for (j = 0; j < 2; j++) {", "int VAR_4;", "const uint32_t a = (((const struct unaligned_32 *) (VAR_1))->l);", "const uint32_t b =\n(((const struct unaligned_32 *) (VAR_1 + 1))->l);", "uint32_t l0 =\n(a & 0x03030303UL) + (b & 0x03030303UL) + 0x01010101UL;", "uint32_t h0 =\n((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2);", "uint32_t l1, h1;", "VAR_1 += VAR_2;", "for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4 += 2) {", "uint32_t a = (((const struct unaligned_32 *) (VAR_1))->l);", "uint32_t b = (((const struct unaligned_32 *) (VAR_1 + 1))->l);", "l1 = (a & 0x03030303UL) + (b & 0x03030303UL);", "h1 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2);", "*((uint32_t *) VAR_0) =\nh0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL);", "VAR_1 += VAR_2;", "VAR_0 += VAR_2;", "a = (((const struct unaligned_32 *) (VAR_1))->l);", "b = (((const struct unaligned_32 *) (VAR_1 + 1))->l);", "l0 = (a & 0x03030303UL) + (b & 0x03030303UL) + 0x01010101UL;", "h0 = ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2);", "*((uint32_t *) VAR_0) =\nh0 + h1 + (((l0 + l1) >> 2) & 0x0F0F0F0FUL);", "VAR_1 += VAR_2;", "VAR_0 += VAR_2;", "} VAR_1 += 4 - VAR_2 * (VAR_3 + 1);", "VAR_0 += 4 - VAR_2 * VAR_3;", "}", "POWERPC_TBL_STOP_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1);", "#else\nregister int VAR_4;", "register vector unsigned char\nVAR_5, pixelsv2,\npixelsavg;", "register vector unsigned char\nVAR_6, temp1, temp2;", "register vector unsigned short\nVAR_7, pixelssum2, temp3;", "register const vector unsigned char VAR_8 = (const vector unsigned char)vec_splat_u8(0);", "register const vector unsigned short VAR_9 = (const vector unsigned short)vec_splat_u16(1);", "register const vector unsigned short VAR_10 = (const vector unsigned short)vec_splat_u16(2);", "temp1 = vec_ld(0, VAR_1);", "temp2 = vec_ld(16, VAR_1);", "VAR_5 = vec_perm(temp1, temp2, vec_lvsl(0, VAR_1));", "if ((((unsigned long)VAR_1) & 0x0000000F) == 0x0000000F)\n{", "pixelsv2 = temp2;", "}", "else\n{", "pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, VAR_1));", "}", "VAR_5 = vec_mergeh(VAR_8, VAR_5);", "pixelsv2 = vec_mergeh(VAR_8, pixelsv2);", "VAR_7 = vec_add((vector unsigned short)VAR_5,\n(vector unsigned short)pixelsv2);", "VAR_7 = vec_add(VAR_7, VAR_9);", "POWERPC_TBL_START_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1);", "for (VAR_4 = 0; VAR_4 < VAR_3 ; VAR_4++) {", "int VAR_11 = ((unsigned long)VAR_0 & 0x0000000F);", "VAR_6 = vec_ld(0, VAR_0);", "temp1 = vec_ld(VAR_2, VAR_1);", "temp2 = vec_ld(VAR_2 + 16, VAR_1);", "VAR_5 = vec_perm(temp1, temp2, vec_lvsl(VAR_2, VAR_1));", "if (((((unsigned long)VAR_1) + VAR_2) & 0x0000000F) == 0x0000000F)\n{", "pixelsv2 = temp2;", "}", "else\n{", "pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(VAR_2 + 1, VAR_1));", "}", "VAR_5 = vec_mergeh(VAR_8, VAR_5);", "pixelsv2 = vec_mergeh(VAR_8, pixelsv2);", "pixelssum2 = vec_add((vector unsigned short)VAR_5,\n(vector unsigned short)pixelsv2);", "temp3 = vec_add(VAR_7, pixelssum2);", "temp3 = vec_sra(temp3, VAR_10);", "VAR_7 = vec_add(pixelssum2, VAR_9);", "pixelsavg = vec_packsu(temp3, (vector unsigned short) VAR_8);", "if (VAR_11)\n{", "VAR_6 = vec_perm(VAR_6, pixelsavg, vcprm(0, 1, s0, s1));", "}", "else\n{", "VAR_6 = vec_perm(VAR_6, pixelsavg, vcprm(s0, s1, 2, 3));", "}", "vec_st(VAR_6, 0, VAR_0);", "VAR_0 += VAR_2;", "VAR_1 += VAR_2;", "}", "POWERPC_TBL_STOP_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1);", "#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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81, 83 ], [ 85, 87, 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 207 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225, 227 ] ]
11,472
static void put_subframe_samples(DCAEncContext *c, int ss, int band, int ch) { if (c->abits[band][ch] <= 7) { int sum, i, j; for (i = 0; i < 8; i += 4) { sum = 0; for (j = 3; j >= 0; j--) { sum *= ff_dca_quant_levels[c->abits[band][ch]]; sum += c->quantized[ss * 8 + i + j][band][ch]; sum += (ff_dca_quant_levels[c->abits[band][ch]] - 1) / 2; } put_bits(&c->pb, bit_consumption[c->abits[band][ch]] / 4, sum); } } else { int i; for (i = 0; i < 8; i++) { int bits = bit_consumption[c->abits[band][ch]] / 16; put_sbits(&c->pb, bits, c->quantized[ss * 8 + i][band][ch]); } } }
false
FFmpeg
a6191d098a03f94685ae4c072bfdf10afcd86223
static void put_subframe_samples(DCAEncContext *c, int ss, int band, int ch) { if (c->abits[band][ch] <= 7) { int sum, i, j; for (i = 0; i < 8; i += 4) { sum = 0; for (j = 3; j >= 0; j--) { sum *= ff_dca_quant_levels[c->abits[band][ch]]; sum += c->quantized[ss * 8 + i + j][band][ch]; sum += (ff_dca_quant_levels[c->abits[band][ch]] - 1) / 2; } put_bits(&c->pb, bit_consumption[c->abits[band][ch]] / 4, sum); } } else { int i; for (i = 0; i < 8; i++) { int bits = bit_consumption[c->abits[band][ch]] / 16; put_sbits(&c->pb, bits, c->quantized[ss * 8 + i][band][ch]); } } }
{ "code": [], "line_no": [] }
static void FUNC_0(DCAEncContext *VAR_0, int VAR_1, int VAR_2, int VAR_3) { if (VAR_0->abits[VAR_2][VAR_3] <= 7) { int VAR_4, VAR_7, VAR_6; for (VAR_7 = 0; VAR_7 < 8; VAR_7 += 4) { VAR_4 = 0; for (VAR_6 = 3; VAR_6 >= 0; VAR_6--) { VAR_4 *= ff_dca_quant_levels[VAR_0->abits[VAR_2][VAR_3]]; VAR_4 += VAR_0->quantized[VAR_1 * 8 + VAR_7 + VAR_6][VAR_2][VAR_3]; VAR_4 += (ff_dca_quant_levels[VAR_0->abits[VAR_2][VAR_3]] - 1) / 2; } put_bits(&VAR_0->pb, bit_consumption[VAR_0->abits[VAR_2][VAR_3]] / 4, VAR_4); } } else { int VAR_7; for (VAR_7 = 0; VAR_7 < 8; VAR_7++) { int VAR_7 = bit_consumption[VAR_0->abits[VAR_2][VAR_3]] / 16; put_sbits(&VAR_0->pb, VAR_7, VAR_0->quantized[VAR_1 * 8 + VAR_7][VAR_2][VAR_3]); } } }
[ "static void FUNC_0(DCAEncContext *VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{", "if (VAR_0->abits[VAR_2][VAR_3] <= 7) {", "int VAR_4, VAR_7, VAR_6;", "for (VAR_7 = 0; VAR_7 < 8; VAR_7 += 4) {", "VAR_4 = 0;", "for (VAR_6 = 3; VAR_6 >= 0; VAR_6--) {", "VAR_4 *= ff_dca_quant_levels[VAR_0->abits[VAR_2][VAR_3]];", "VAR_4 += VAR_0->quantized[VAR_1 * 8 + VAR_7 + VAR_6][VAR_2][VAR_3];", "VAR_4 += (ff_dca_quant_levels[VAR_0->abits[VAR_2][VAR_3]] - 1) / 2;", "}", "put_bits(&VAR_0->pb, bit_consumption[VAR_0->abits[VAR_2][VAR_3]] / 4, VAR_4);", "}", "} else {", "int VAR_7;", "for (VAR_7 = 0; VAR_7 < 8; VAR_7++) {", "int VAR_7 = bit_consumption[VAR_0->abits[VAR_2][VAR_3]] / 16;", "put_sbits(&VAR_0->pb, VAR_7, VAR_0->quantized[VAR_1 * 8 + VAR_7][VAR_2][VAR_3]);", "}", "}", "}" ]
[ 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 ] ]
11,473
static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, SpectrumParameters *spectrum) { unsigned int temp, max_qmf_subbands = 0; unsigned int start_min, stop_min; int k; const int8_t *sbr_offset_ptr; int16_t stop_dk[13]; if (sbr->sample_rate < 32000) { temp = 3000; } else if (sbr->sample_rate < 64000) { temp = 4000; } else temp = 5000; start_min = ((temp << 7) + (sbr->sample_rate >> 1)) / sbr->sample_rate; stop_min = ((temp << 8) + (sbr->sample_rate >> 1)) / sbr->sample_rate; switch (sbr->sample_rate) { case 16000: sbr_offset_ptr = sbr_offset[0]; break; case 22050: sbr_offset_ptr = sbr_offset[1]; break; case 24000: sbr_offset_ptr = sbr_offset[2]; break; case 32000: sbr_offset_ptr = sbr_offset[3]; break; case 44100: case 48000: case 64000: sbr_offset_ptr = sbr_offset[4]; break; case 88200: case 96000: case 128000: case 176400: case 192000: sbr_offset_ptr = sbr_offset[5]; break; default: av_log(ac->avctx, AV_LOG_ERROR, "Unsupported sample rate for SBR: %d\n", sbr->sample_rate); return -1; } sbr->k[0] = start_min + sbr_offset_ptr[spectrum->bs_start_freq]; if (spectrum->bs_stop_freq < 14) { sbr->k[2] = stop_min; make_bands(stop_dk, stop_min, 64, 13); qsort(stop_dk, 13, sizeof(stop_dk[0]), qsort_comparison_function_int16); for (k = 0; k < spectrum->bs_stop_freq; k++) sbr->k[2] += stop_dk[k]; } else if (spectrum->bs_stop_freq == 14) { sbr->k[2] = 2*sbr->k[0]; } else if (spectrum->bs_stop_freq == 15) { sbr->k[2] = 3*sbr->k[0]; } else { av_log(ac->avctx, AV_LOG_ERROR, "Invalid bs_stop_freq: %d\n", spectrum->bs_stop_freq); return -1; } sbr->k[2] = FFMIN(64, sbr->k[2]); // Requirements (14496-3 sp04 p205) if (sbr->sample_rate <= 32000) { max_qmf_subbands = 48; } else if (sbr->sample_rate == 44100) { max_qmf_subbands = 35; } else if (sbr->sample_rate >= 48000) max_qmf_subbands = 32; if (sbr->k[2] - sbr->k[0] > max_qmf_subbands) { av_log(ac->avctx, AV_LOG_ERROR, "Invalid bitstream, too many QMF subbands: %d\n", sbr->k[2] - sbr->k[0]); return -1; } if (!spectrum->bs_freq_scale) { int dk, k2diff; dk = spectrum->bs_alter_scale + 1; sbr->n_master = ((sbr->k[2] - sbr->k[0] + (dk&2)) >> dk) << 1; if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) return -1; for (k = 1; k <= sbr->n_master; k++) sbr->f_master[k] = dk; k2diff = sbr->k[2] - sbr->k[0] - sbr->n_master * dk; if (k2diff < 0) { sbr->f_master[1]--; sbr->f_master[2]-= (k2diff < -1); } else if (k2diff) { sbr->f_master[sbr->n_master]++; } sbr->f_master[0] = sbr->k[0]; for (k = 1; k <= sbr->n_master; k++) sbr->f_master[k] += sbr->f_master[k - 1]; } else { int half_bands = 7 - spectrum->bs_freq_scale; // bs_freq_scale = {1,2,3} int two_regions, num_bands_0; int vdk0_max, vdk1_min; int16_t vk0[49]; if (49 * sbr->k[2] > 110 * sbr->k[0]) { two_regions = 1; sbr->k[1] = 2 * sbr->k[0]; } else { two_regions = 0; sbr->k[1] = sbr->k[2]; } num_bands_0 = lrintf(half_bands * log2f(sbr->k[1] / (float)sbr->k[0])) * 2; if (num_bands_0 <= 0) { // Requirements (14496-3 sp04 p205) av_log(ac->avctx, AV_LOG_ERROR, "Invalid num_bands_0: %d\n", num_bands_0); return -1; } vk0[0] = 0; make_bands(vk0+1, sbr->k[0], sbr->k[1], num_bands_0); qsort(vk0 + 1, num_bands_0, sizeof(vk0[1]), qsort_comparison_function_int16); vdk0_max = vk0[num_bands_0]; vk0[0] = sbr->k[0]; for (k = 1; k <= num_bands_0; k++) { if (vk0[k] <= 0) { // Requirements (14496-3 sp04 p205) av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", k, vk0[k]); return -1; } vk0[k] += vk0[k-1]; } if (two_regions) { int16_t vk1[49]; float invwarp = spectrum->bs_alter_scale ? 0.76923076923076923077f : 1.0f; // bs_alter_scale = {0,1} int num_bands_1 = lrintf(half_bands * invwarp * log2f(sbr->k[2] / (float)sbr->k[1])) * 2; make_bands(vk1+1, sbr->k[1], sbr->k[2], num_bands_1); vdk1_min = array_min_int16(vk1 + 1, num_bands_1); if (vdk1_min < vdk0_max) { int change; qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16); change = FFMIN(vdk0_max - vk1[1], (vk1[num_bands_1] - vk1[1]) >> 1); vk1[1] += change; vk1[num_bands_1] -= change; } qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16); vk1[0] = sbr->k[1]; for (k = 1; k <= num_bands_1; k++) { if (vk1[k] <= 0) { // Requirements (14496-3 sp04 p205) av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", k, vk1[k]); return -1; } vk1[k] += vk1[k-1]; } sbr->n_master = num_bands_0 + num_bands_1; if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) return -1; memcpy(&sbr->f_master[0], vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0])); memcpy(&sbr->f_master[num_bands_0 + 1], vk1 + 1, num_bands_1 * sizeof(sbr->f_master[0])); } else { sbr->n_master = num_bands_0; if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) return -1; memcpy(sbr->f_master, vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0])); } } return 0; }
false
FFmpeg
ba30b74686f0cb6c9dd465ac4820059c48bf9d08
static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, SpectrumParameters *spectrum) { unsigned int temp, max_qmf_subbands = 0; unsigned int start_min, stop_min; int k; const int8_t *sbr_offset_ptr; int16_t stop_dk[13]; if (sbr->sample_rate < 32000) { temp = 3000; } else if (sbr->sample_rate < 64000) { temp = 4000; } else temp = 5000; start_min = ((temp << 7) + (sbr->sample_rate >> 1)) / sbr->sample_rate; stop_min = ((temp << 8) + (sbr->sample_rate >> 1)) / sbr->sample_rate; switch (sbr->sample_rate) { case 16000: sbr_offset_ptr = sbr_offset[0]; break; case 22050: sbr_offset_ptr = sbr_offset[1]; break; case 24000: sbr_offset_ptr = sbr_offset[2]; break; case 32000: sbr_offset_ptr = sbr_offset[3]; break; case 44100: case 48000: case 64000: sbr_offset_ptr = sbr_offset[4]; break; case 88200: case 96000: case 128000: case 176400: case 192000: sbr_offset_ptr = sbr_offset[5]; break; default: av_log(ac->avctx, AV_LOG_ERROR, "Unsupported sample rate for SBR: %d\n", sbr->sample_rate); return -1; } sbr->k[0] = start_min + sbr_offset_ptr[spectrum->bs_start_freq]; if (spectrum->bs_stop_freq < 14) { sbr->k[2] = stop_min; make_bands(stop_dk, stop_min, 64, 13); qsort(stop_dk, 13, sizeof(stop_dk[0]), qsort_comparison_function_int16); for (k = 0; k < spectrum->bs_stop_freq; k++) sbr->k[2] += stop_dk[k]; } else if (spectrum->bs_stop_freq == 14) { sbr->k[2] = 2*sbr->k[0]; } else if (spectrum->bs_stop_freq == 15) { sbr->k[2] = 3*sbr->k[0]; } else { av_log(ac->avctx, AV_LOG_ERROR, "Invalid bs_stop_freq: %d\n", spectrum->bs_stop_freq); return -1; } sbr->k[2] = FFMIN(64, sbr->k[2]); if (sbr->sample_rate <= 32000) { max_qmf_subbands = 48; } else if (sbr->sample_rate == 44100) { max_qmf_subbands = 35; } else if (sbr->sample_rate >= 48000) max_qmf_subbands = 32; if (sbr->k[2] - sbr->k[0] > max_qmf_subbands) { av_log(ac->avctx, AV_LOG_ERROR, "Invalid bitstream, too many QMF subbands: %d\n", sbr->k[2] - sbr->k[0]); return -1; } if (!spectrum->bs_freq_scale) { int dk, k2diff; dk = spectrum->bs_alter_scale + 1; sbr->n_master = ((sbr->k[2] - sbr->k[0] + (dk&2)) >> dk) << 1; if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) return -1; for (k = 1; k <= sbr->n_master; k++) sbr->f_master[k] = dk; k2diff = sbr->k[2] - sbr->k[0] - sbr->n_master * dk; if (k2diff < 0) { sbr->f_master[1]--; sbr->f_master[2]-= (k2diff < -1); } else if (k2diff) { sbr->f_master[sbr->n_master]++; } sbr->f_master[0] = sbr->k[0]; for (k = 1; k <= sbr->n_master; k++) sbr->f_master[k] += sbr->f_master[k - 1]; } else { int half_bands = 7 - spectrum->bs_freq_scale; int two_regions, num_bands_0; int vdk0_max, vdk1_min; int16_t vk0[49]; if (49 * sbr->k[2] > 110 * sbr->k[0]) { two_regions = 1; sbr->k[1] = 2 * sbr->k[0]; } else { two_regions = 0; sbr->k[1] = sbr->k[2]; } num_bands_0 = lrintf(half_bands * log2f(sbr->k[1] / (float)sbr->k[0])) * 2; if (num_bands_0 <= 0) { av_log(ac->avctx, AV_LOG_ERROR, "Invalid num_bands_0: %d\n", num_bands_0); return -1; } vk0[0] = 0; make_bands(vk0+1, sbr->k[0], sbr->k[1], num_bands_0); qsort(vk0 + 1, num_bands_0, sizeof(vk0[1]), qsort_comparison_function_int16); vdk0_max = vk0[num_bands_0]; vk0[0] = sbr->k[0]; for (k = 1; k <= num_bands_0; k++) { if (vk0[k] <= 0) { av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", k, vk0[k]); return -1; } vk0[k] += vk0[k-1]; } if (two_regions) { int16_t vk1[49]; float invwarp = spectrum->bs_alter_scale ? 0.76923076923076923077f : 1.0f; int num_bands_1 = lrintf(half_bands * invwarp * log2f(sbr->k[2] / (float)sbr->k[1])) * 2; make_bands(vk1+1, sbr->k[1], sbr->k[2], num_bands_1); vdk1_min = array_min_int16(vk1 + 1, num_bands_1); if (vdk1_min < vdk0_max) { int change; qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16); change = FFMIN(vdk0_max - vk1[1], (vk1[num_bands_1] - vk1[1]) >> 1); vk1[1] += change; vk1[num_bands_1] -= change; } qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16); vk1[0] = sbr->k[1]; for (k = 1; k <= num_bands_1; k++) { if (vk1[k] <= 0) { av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", k, vk1[k]); return -1; } vk1[k] += vk1[k-1]; } sbr->n_master = num_bands_0 + num_bands_1; if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) return -1; memcpy(&sbr->f_master[0], vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0])); memcpy(&sbr->f_master[num_bands_0 + 1], vk1 + 1, num_bands_1 * sizeof(sbr->f_master[0])); } else { sbr->n_master = num_bands_0; if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) return -1; memcpy(sbr->f_master, vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0])); } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AACContext *VAR_0, SpectralBandReplication *VAR_1, SpectrumParameters *VAR_2) { unsigned int VAR_3, VAR_4 = 0; unsigned int VAR_5, VAR_6; int VAR_7; const int8_t *VAR_8; int16_t stop_dk[13]; if (VAR_1->sample_rate < 32000) { VAR_3 = 3000; } else if (VAR_1->sample_rate < 64000) { VAR_3 = 4000; } else VAR_3 = 5000; VAR_5 = ((VAR_3 << 7) + (VAR_1->sample_rate >> 1)) / VAR_1->sample_rate; VAR_6 = ((VAR_3 << 8) + (VAR_1->sample_rate >> 1)) / VAR_1->sample_rate; switch (VAR_1->sample_rate) { case 16000: VAR_8 = sbr_offset[0]; break; case 22050: VAR_8 = sbr_offset[1]; break; case 24000: VAR_8 = sbr_offset[2]; break; case 32000: VAR_8 = sbr_offset[3]; break; case 44100: case 48000: case 64000: VAR_8 = sbr_offset[4]; break; case 88200: case 96000: case 128000: case 176400: case 192000: VAR_8 = sbr_offset[5]; break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "Unsupported sample rate for SBR: %d\n", VAR_1->sample_rate); return -1; } VAR_1->VAR_7[0] = VAR_5 + VAR_8[VAR_2->bs_start_freq]; if (VAR_2->bs_stop_freq < 14) { VAR_1->VAR_7[2] = VAR_6; make_bands(stop_dk, VAR_6, 64, 13); qsort(stop_dk, 13, sizeof(stop_dk[0]), qsort_comparison_function_int16); for (VAR_7 = 0; VAR_7 < VAR_2->bs_stop_freq; VAR_7++) VAR_1->VAR_7[2] += stop_dk[VAR_7]; } else if (VAR_2->bs_stop_freq == 14) { VAR_1->VAR_7[2] = 2*VAR_1->VAR_7[0]; } else if (VAR_2->bs_stop_freq == 15) { VAR_1->VAR_7[2] = 3*VAR_1->VAR_7[0]; } else { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid bs_stop_freq: %d\n", VAR_2->bs_stop_freq); return -1; } VAR_1->VAR_7[2] = FFMIN(64, VAR_1->VAR_7[2]); if (VAR_1->sample_rate <= 32000) { VAR_4 = 48; } else if (VAR_1->sample_rate == 44100) { VAR_4 = 35; } else if (VAR_1->sample_rate >= 48000) VAR_4 = 32; if (VAR_1->VAR_7[2] - VAR_1->VAR_7[0] > VAR_4) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid bitstream, too many QMF subbands: %d\n", VAR_1->VAR_7[2] - VAR_1->VAR_7[0]); return -1; } if (!VAR_2->bs_freq_scale) { int VAR_9, VAR_10; VAR_9 = VAR_2->bs_alter_scale + 1; VAR_1->n_master = ((VAR_1->VAR_7[2] - VAR_1->VAR_7[0] + (VAR_9&2)) >> VAR_9) << 1; if (check_n_master(VAR_0->avctx, VAR_1->n_master, VAR_1->spectrum_params.bs_xover_band)) return -1; for (VAR_7 = 1; VAR_7 <= VAR_1->n_master; VAR_7++) VAR_1->f_master[VAR_7] = VAR_9; VAR_10 = VAR_1->VAR_7[2] - VAR_1->VAR_7[0] - VAR_1->n_master * VAR_9; if (VAR_10 < 0) { VAR_1->f_master[1]--; VAR_1->f_master[2]-= (VAR_10 < -1); } else if (VAR_10) { VAR_1->f_master[VAR_1->n_master]++; } VAR_1->f_master[0] = VAR_1->VAR_7[0]; for (VAR_7 = 1; VAR_7 <= VAR_1->n_master; VAR_7++) VAR_1->f_master[VAR_7] += VAR_1->f_master[VAR_7 - 1]; } else { int VAR_11 = 7 - VAR_2->bs_freq_scale; int VAR_12, VAR_13; int VAR_14, VAR_15; int16_t vk0[49]; if (49 * VAR_1->VAR_7[2] > 110 * VAR_1->VAR_7[0]) { VAR_12 = 1; VAR_1->VAR_7[1] = 2 * VAR_1->VAR_7[0]; } else { VAR_12 = 0; VAR_1->VAR_7[1] = VAR_1->VAR_7[2]; } VAR_13 = lrintf(VAR_11 * log2f(VAR_1->VAR_7[1] / (float)VAR_1->VAR_7[0])) * 2; if (VAR_13 <= 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid VAR_13: %d\n", VAR_13); return -1; } vk0[0] = 0; make_bands(vk0+1, VAR_1->VAR_7[0], VAR_1->VAR_7[1], VAR_13); qsort(vk0 + 1, VAR_13, sizeof(vk0[1]), qsort_comparison_function_int16); VAR_14 = vk0[VAR_13]; vk0[0] = VAR_1->VAR_7[0]; for (VAR_7 = 1; VAR_7 <= VAR_13; VAR_7++) { if (vk0[VAR_7] <= 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", VAR_7, vk0[VAR_7]); return -1; } vk0[VAR_7] += vk0[VAR_7-1]; } if (VAR_12) { int16_t vk1[49]; float VAR_16 = VAR_2->bs_alter_scale ? 0.76923076923076923077f : 1.0f; int VAR_17 = lrintf(VAR_11 * VAR_16 * log2f(VAR_1->VAR_7[2] / (float)VAR_1->VAR_7[1])) * 2; make_bands(vk1+1, VAR_1->VAR_7[1], VAR_1->VAR_7[2], VAR_17); VAR_15 = array_min_int16(vk1 + 1, VAR_17); if (VAR_15 < VAR_14) { int VAR_18; qsort(vk1 + 1, VAR_17, sizeof(vk1[1]), qsort_comparison_function_int16); VAR_18 = FFMIN(VAR_14 - vk1[1], (vk1[VAR_17] - vk1[1]) >> 1); vk1[1] += VAR_18; vk1[VAR_17] -= VAR_18; } qsort(vk1 + 1, VAR_17, sizeof(vk1[1]), qsort_comparison_function_int16); vk1[0] = VAR_1->VAR_7[1]; for (VAR_7 = 1; VAR_7 <= VAR_17; VAR_7++) { if (vk1[VAR_7] <= 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", VAR_7, vk1[VAR_7]); return -1; } vk1[VAR_7] += vk1[VAR_7-1]; } VAR_1->n_master = VAR_13 + VAR_17; if (check_n_master(VAR_0->avctx, VAR_1->n_master, VAR_1->spectrum_params.bs_xover_band)) return -1; memcpy(&VAR_1->f_master[0], vk0, (VAR_13 + 1) * sizeof(VAR_1->f_master[0])); memcpy(&VAR_1->f_master[VAR_13 + 1], vk1 + 1, VAR_17 * sizeof(VAR_1->f_master[0])); } else { VAR_1->n_master = VAR_13; if (check_n_master(VAR_0->avctx, VAR_1->n_master, VAR_1->spectrum_params.bs_xover_band)) return -1; memcpy(VAR_1->f_master, vk0, (VAR_13 + 1) * sizeof(VAR_1->f_master[0])); } } return 0; }
[ "static int FUNC_0(AACContext *VAR_0, SpectralBandReplication *VAR_1,\nSpectrumParameters *VAR_2)\n{", "unsigned int VAR_3, VAR_4 = 0;", "unsigned int VAR_5, VAR_6;", "int VAR_7;", "const int8_t *VAR_8;", "int16_t stop_dk[13];", "if (VAR_1->sample_rate < 32000) {", "VAR_3 = 3000;", "} else if (VAR_1->sample_rate < 64000) {", "VAR_3 = 4000;", "} else", "VAR_3 = 5000;", "VAR_5 = ((VAR_3 << 7) + (VAR_1->sample_rate >> 1)) / VAR_1->sample_rate;", "VAR_6 = ((VAR_3 << 8) + (VAR_1->sample_rate >> 1)) / VAR_1->sample_rate;", "switch (VAR_1->sample_rate) {", "case 16000:\nVAR_8 = sbr_offset[0];", "break;", "case 22050:\nVAR_8 = sbr_offset[1];", "break;", "case 24000:\nVAR_8 = sbr_offset[2];", "break;", "case 32000:\nVAR_8 = sbr_offset[3];", "break;", "case 44100: case 48000: case 64000:\nVAR_8 = sbr_offset[4];", "break;", "case 88200: case 96000: case 128000: case 176400: case 192000:\nVAR_8 = sbr_offset[5];", "break;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Unsupported sample rate for SBR: %d\\n\", VAR_1->sample_rate);", "return -1;", "}", "VAR_1->VAR_7[0] = VAR_5 + VAR_8[VAR_2->bs_start_freq];", "if (VAR_2->bs_stop_freq < 14) {", "VAR_1->VAR_7[2] = VAR_6;", "make_bands(stop_dk, VAR_6, 64, 13);", "qsort(stop_dk, 13, sizeof(stop_dk[0]), qsort_comparison_function_int16);", "for (VAR_7 = 0; VAR_7 < VAR_2->bs_stop_freq; VAR_7++)", "VAR_1->VAR_7[2] += stop_dk[VAR_7];", "} else if (VAR_2->bs_stop_freq == 14) {", "VAR_1->VAR_7[2] = 2*VAR_1->VAR_7[0];", "} else if (VAR_2->bs_stop_freq == 15) {", "VAR_1->VAR_7[2] = 3*VAR_1->VAR_7[0];", "} else {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Invalid bs_stop_freq: %d\\n\", VAR_2->bs_stop_freq);", "return -1;", "}", "VAR_1->VAR_7[2] = FFMIN(64, VAR_1->VAR_7[2]);", "if (VAR_1->sample_rate <= 32000) {", "VAR_4 = 48;", "} else if (VAR_1->sample_rate == 44100) {", "VAR_4 = 35;", "} else if (VAR_1->sample_rate >= 48000)", "VAR_4 = 32;", "if (VAR_1->VAR_7[2] - VAR_1->VAR_7[0] > VAR_4) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Invalid bitstream, too many QMF subbands: %d\\n\", VAR_1->VAR_7[2] - VAR_1->VAR_7[0]);", "return -1;", "}", "if (!VAR_2->bs_freq_scale) {", "int VAR_9, VAR_10;", "VAR_9 = VAR_2->bs_alter_scale + 1;", "VAR_1->n_master = ((VAR_1->VAR_7[2] - VAR_1->VAR_7[0] + (VAR_9&2)) >> VAR_9) << 1;", "if (check_n_master(VAR_0->avctx, VAR_1->n_master, VAR_1->spectrum_params.bs_xover_band))\nreturn -1;", "for (VAR_7 = 1; VAR_7 <= VAR_1->n_master; VAR_7++)", "VAR_1->f_master[VAR_7] = VAR_9;", "VAR_10 = VAR_1->VAR_7[2] - VAR_1->VAR_7[0] - VAR_1->n_master * VAR_9;", "if (VAR_10 < 0) {", "VAR_1->f_master[1]--;", "VAR_1->f_master[2]-= (VAR_10 < -1);", "} else if (VAR_10) {", "VAR_1->f_master[VAR_1->n_master]++;", "}", "VAR_1->f_master[0] = VAR_1->VAR_7[0];", "for (VAR_7 = 1; VAR_7 <= VAR_1->n_master; VAR_7++)", "VAR_1->f_master[VAR_7] += VAR_1->f_master[VAR_7 - 1];", "} else {", "int VAR_11 = 7 - VAR_2->bs_freq_scale;", "int VAR_12, VAR_13;", "int VAR_14, VAR_15;", "int16_t vk0[49];", "if (49 * VAR_1->VAR_7[2] > 110 * VAR_1->VAR_7[0]) {", "VAR_12 = 1;", "VAR_1->VAR_7[1] = 2 * VAR_1->VAR_7[0];", "} else {", "VAR_12 = 0;", "VAR_1->VAR_7[1] = VAR_1->VAR_7[2];", "}", "VAR_13 = lrintf(VAR_11 * log2f(VAR_1->VAR_7[1] / (float)VAR_1->VAR_7[0])) * 2;", "if (VAR_13 <= 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid VAR_13: %d\\n\", VAR_13);", "return -1;", "}", "vk0[0] = 0;", "make_bands(vk0+1, VAR_1->VAR_7[0], VAR_1->VAR_7[1], VAR_13);", "qsort(vk0 + 1, VAR_13, sizeof(vk0[1]), qsort_comparison_function_int16);", "VAR_14 = vk0[VAR_13];", "vk0[0] = VAR_1->VAR_7[0];", "for (VAR_7 = 1; VAR_7 <= VAR_13; VAR_7++) {", "if (vk0[VAR_7] <= 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid vDk0[%d]: %d\\n\", VAR_7, vk0[VAR_7]);", "return -1;", "}", "vk0[VAR_7] += vk0[VAR_7-1];", "}", "if (VAR_12) {", "int16_t vk1[49];", "float VAR_16 = VAR_2->bs_alter_scale ? 0.76923076923076923077f\n: 1.0f;", "int VAR_17 = lrintf(VAR_11 * VAR_16 *\nlog2f(VAR_1->VAR_7[2] / (float)VAR_1->VAR_7[1])) * 2;", "make_bands(vk1+1, VAR_1->VAR_7[1], VAR_1->VAR_7[2], VAR_17);", "VAR_15 = array_min_int16(vk1 + 1, VAR_17);", "if (VAR_15 < VAR_14) {", "int VAR_18;", "qsort(vk1 + 1, VAR_17, sizeof(vk1[1]), qsort_comparison_function_int16);", "VAR_18 = FFMIN(VAR_14 - vk1[1], (vk1[VAR_17] - vk1[1]) >> 1);", "vk1[1] += VAR_18;", "vk1[VAR_17] -= VAR_18;", "}", "qsort(vk1 + 1, VAR_17, sizeof(vk1[1]), qsort_comparison_function_int16);", "vk1[0] = VAR_1->VAR_7[1];", "for (VAR_7 = 1; VAR_7 <= VAR_17; VAR_7++) {", "if (vk1[VAR_7] <= 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid vDk1[%d]: %d\\n\", VAR_7, vk1[VAR_7]);", "return -1;", "}", "vk1[VAR_7] += vk1[VAR_7-1];", "}", "VAR_1->n_master = VAR_13 + VAR_17;", "if (check_n_master(VAR_0->avctx, VAR_1->n_master, VAR_1->spectrum_params.bs_xover_band))\nreturn -1;", "memcpy(&VAR_1->f_master[0], vk0,\n(VAR_13 + 1) * sizeof(VAR_1->f_master[0]));", "memcpy(&VAR_1->f_master[VAR_13 + 1], vk1 + 1,\nVAR_17 * sizeof(VAR_1->f_master[0]));", "} else {", "VAR_1->n_master = VAR_13;", "if (check_n_master(VAR_0->avctx, VAR_1->n_master, VAR_1->spectrum_params.bs_xover_band))\nreturn -1;", "memcpy(VAR_1->f_master, vk0, (VAR_13 + 1) * sizeof(VAR_1->f_master[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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77, 79, 81 ], [ 83 ], [ 85 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 229 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 243 ], [ 247 ], [ 251 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 275 ], [ 277 ], [ 279, 281 ], [ 283, 285 ], [ 289 ], [ 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 313 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 335 ], [ 337, 339 ], [ 341, 343 ], [ 345, 347 ], [ 351 ], [ 353 ], [ 355, 357 ], [ 359 ], [ 361 ], [ 363 ], [ 367 ], [ 369 ] ]
11,474
BlockDriverAIOCB *bdrv_aio_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { BlockDriver *drv = bs->drv; BlockDriverAIOCB *ret; if (!drv) return NULL; if (bs->read_only) return NULL; if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors)) return NULL; if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { memcpy(bs->boot_sector_data, buf, 512); } ret = drv->bdrv_aio_write(bs, sector_num, buf, nb_sectors, cb, opaque); if (ret) { /* Update stats even though technically transfer has not happened. */ bs->wr_bytes += (unsigned) nb_sectors * SECTOR_SIZE; bs->wr_ops ++; } return ret; }
true
qemu
b5eff355460643d09e533024360fe0522f368c07
BlockDriverAIOCB *bdrv_aio_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { BlockDriver *drv = bs->drv; BlockDriverAIOCB *ret; if (!drv) return NULL; if (bs->read_only) return NULL; if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors)) return NULL; if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { memcpy(bs->boot_sector_data, buf, 512); } ret = drv->bdrv_aio_write(bs, sector_num, buf, nb_sectors, cb, opaque); if (ret) { bs->wr_bytes += (unsigned) nb_sectors * SECTOR_SIZE; bs->wr_ops ++; } return ret; }
{ "code": [ " if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors))", " if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors))", " return NULL;", " if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors))", " return NULL;" ], "line_no": [ 23, 23, 17, 23, 17 ] }
BlockDriverAIOCB *FUNC_0(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { BlockDriver *drv = bs->drv; BlockDriverAIOCB *ret; if (!drv) return NULL; if (bs->read_only) return NULL; if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors)) return NULL; if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { memcpy(bs->boot_sector_data, buf, 512); } ret = drv->FUNC_0(bs, sector_num, buf, nb_sectors, cb, opaque); if (ret) { bs->wr_bytes += (unsigned) nb_sectors * SECTOR_SIZE; bs->wr_ops ++; } return ret; }
[ "BlockDriverAIOCB *FUNC_0(BlockDriverState *bs, int64_t sector_num,\nconst uint8_t *buf, int nb_sectors,\nBlockDriverCompletionFunc *cb, void *opaque)\n{", "BlockDriver *drv = bs->drv;", "BlockDriverAIOCB *ret;", "if (!drv)\nreturn NULL;", "if (bs->read_only)\nreturn NULL;", "if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors))\nreturn NULL;", "if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {", "memcpy(bs->boot_sector_data, buf, 512);", "}", "ret = drv->FUNC_0(bs, sector_num, buf, nb_sectors, cb, opaque);", "if (ret) {", "bs->wr_bytes += (unsigned) nb_sectors * SECTOR_SIZE;", "bs->wr_ops ++;", "}", "return ret;", "}" ]
[ 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ] ]
11,475
target_ulong helper_madd32_suov(CPUTriCoreState *env, target_ulong r1, target_ulong r2, target_ulong r3) { uint64_t t1 = extract64(r1, 0, 32); uint64_t t2 = extract64(r2, 0, 32); uint64_t t3 = extract64(r3, 0, 32); int64_t result; result = t2 + (t1 * t3); return suov32(env, result); }
true
qemu
85d604af5f96c32734af9974ec6ddb625b6716a2
target_ulong helper_madd32_suov(CPUTriCoreState *env, target_ulong r1, target_ulong r2, target_ulong r3) { uint64_t t1 = extract64(r1, 0, 32); uint64_t t2 = extract64(r2, 0, 32); uint64_t t3 = extract64(r3, 0, 32); int64_t result; result = t2 + (t1 * t3); return suov32(env, result); }
{ "code": [ " return suov32(env, result);", " return suov32(env, result);", " return suov32(env, result);", " return suov32(env, result);", " return suov32(env, result);" ], "line_no": [ 19, 19, 19, 19, 19 ] }
target_ulong FUNC_0(CPUTriCoreState *env, target_ulong r1, target_ulong r2, target_ulong r3) { uint64_t t1 = extract64(r1, 0, 32); uint64_t t2 = extract64(r2, 0, 32); uint64_t t3 = extract64(r3, 0, 32); int64_t result; result = t2 + (t1 * t3); return suov32(env, result); }
[ "target_ulong FUNC_0(CPUTriCoreState *env, target_ulong r1,\ntarget_ulong r2, target_ulong r3)\n{", "uint64_t t1 = extract64(r1, 0, 32);", "uint64_t t2 = extract64(r2, 0, 32);", "uint64_t t3 = extract64(r3, 0, 32);", "int64_t result;", "result = t2 + (t1 * t3);", "return suov32(env, result);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ] ]
11,476
void do_addmeo (void) { T1 = T0; T0 += xer_ca + (-1); if (likely(!((uint32_t)T1 & ((uint32_t)T1 ^ (uint32_t)T0) & (1UL << 31)))) { xer_ov = 0; } else { xer_ov = 1; xer_so = 1; } if (likely(T1 != 0)) xer_ca = 1; }
true
qemu
c3e10c7b4377c1cbc0a4fbc12312c2cf41c0cda7
void do_addmeo (void) { T1 = T0; T0 += xer_ca + (-1); if (likely(!((uint32_t)T1 & ((uint32_t)T1 ^ (uint32_t)T0) & (1UL << 31)))) { xer_ov = 0; } else { xer_ov = 1; xer_so = 1; } if (likely(T1 != 0)) xer_ca = 1; }
{ "code": [ " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " if (likely(!((uint32_t)T1 &", " ((uint32_t)T1 ^ (uint32_t)T0) & (1UL << 31)))) {", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;", " xer_ov = 0;", " } else {", " xer_ov = 1;", " xer_so = 1;" ], "line_no": [ 13, 15, 17, 19, 13, 15, 17, 19, 13, 15, 17, 19, 13, 15, 17, 19, 9, 11, 13, 15, 17, 19, 13, 15, 17, 19, 13, 15, 17, 19, 13, 15, 17, 19, 13, 15, 17, 19, 13, 15, 17, 19, 13, 15, 17, 19 ] }
void FUNC_0 (void) { T1 = T0; T0 += xer_ca + (-1); if (likely(!((uint32_t)T1 & ((uint32_t)T1 ^ (uint32_t)T0) & (1UL << 31)))) { xer_ov = 0; } else { xer_ov = 1; xer_so = 1; } if (likely(T1 != 0)) xer_ca = 1; }
[ "void FUNC_0 (void)\n{", "T1 = T0;", "T0 += xer_ca + (-1);", "if (likely(!((uint32_t)T1 &\n((uint32_t)T1 ^ (uint32_t)T0) & (1UL << 31)))) {", "xer_ov = 0;", "} else {", "xer_ov = 1;", "xer_so = 1;", "}", "if (likely(T1 != 0))\nxer_ca = 1;", "}" ]
[ 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ] ]
11,477
static void xtensa_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(dev); cs->gdb_num_regs = xcc->config->gdb_regmap.num_regs; xcc->parent_realize(dev, errp); }
true
qemu
14a10fc39923b3af07c8c46d22cb20843bee3a72
static void xtensa_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(dev); cs->gdb_num_regs = xcc->config->gdb_regmap.num_regs; xcc->parent_realize(dev, errp); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { CPUState *cs = CPU(VAR_0); XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(VAR_0); cs->gdb_num_regs = xcc->config->gdb_regmap.num_regs; xcc->parent_realize(VAR_0, VAR_1); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "CPUState *cs = CPU(VAR_0);", "XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(VAR_0);", "cs->gdb_num_regs = xcc->config->gdb_regmap.num_regs;", "xcc->parent_realize(VAR_0, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ] ]
11,478
static void mov_build_index(MOVContext *mov, AVStream *st) { MOVStreamContext *sc = st->priv_data; int64_t current_offset; int64_t current_dts = 0; unsigned int stts_index = 0; unsigned int stsc_index = 0; unsigned int stss_index = 0; unsigned int stps_index = 0; unsigned int i, j; uint64_t stream_size = 0; /* adjust first dts according to edit list */ if (sc->time_offset && mov->time_scale > 0) { if (sc->time_offset < 0) sc->time_offset = av_rescale(sc->time_offset, sc->time_scale, mov->time_scale); current_dts = -sc->time_offset; if (sc->ctts_data && sc->stts_data && sc->ctts_data[0].duration / sc->stts_data[0].duration > 16) { /* more than 16 frames delay, dts are likely wrong this happens with files created by iMovie */ sc->wrong_dts = 1; st->codec->has_b_frames = 1; } } /* only use old uncompressed audio chunk demuxing when stts specifies it */ if (!(st->codec->codec_type == AVMEDIA_TYPE_AUDIO && sc->stts_count == 1 && sc->stts_data[0].duration == 1)) { unsigned int current_sample = 0; unsigned int stts_sample = 0; unsigned int sample_size; unsigned int distance = 0; int key_off = sc->keyframes && sc->keyframes[0] == 1; current_dts -= sc->dts_shift; if (sc->sample_count >= UINT_MAX / sizeof(*st->index_entries)) return; st->index_entries = av_malloc(sc->sample_count*sizeof(*st->index_entries)); if (!st->index_entries) return; st->index_entries_allocated_size = sc->sample_count*sizeof(*st->index_entries); for (i = 0; i < sc->chunk_count; i++) { current_offset = sc->chunk_offsets[i]; while (stsc_index + 1 < sc->stsc_count && i + 1 == sc->stsc_data[stsc_index + 1].first) stsc_index++; for (j = 0; j < sc->stsc_data[stsc_index].count; j++) { int keyframe = 0; if (current_sample >= sc->sample_count) { av_log(mov->fc, AV_LOG_ERROR, "wrong sample count\n"); return; } if (!sc->keyframe_count || current_sample+key_off == sc->keyframes[stss_index]) { keyframe = 1; if (stss_index + 1 < sc->keyframe_count) stss_index++; } else if (sc->stps_count && current_sample+key_off == sc->stps_data[stps_index]) { keyframe = 1; if (stps_index + 1 < sc->stps_count) stps_index++; } if (keyframe) distance = 0; sample_size = sc->sample_size > 0 ? sc->sample_size : sc->sample_sizes[current_sample]; if (sc->pseudo_stream_id == -1 || sc->stsc_data[stsc_index].id - 1 == sc->pseudo_stream_id) { AVIndexEntry *e = &st->index_entries[st->nb_index_entries++]; e->pos = current_offset; e->timestamp = current_dts; e->size = sample_size; e->min_distance = distance; e->flags = keyframe ? AVINDEX_KEYFRAME : 0; av_dlog(mov->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " "size %d, distance %d, keyframe %d\n", st->index, current_sample, current_offset, current_dts, sample_size, distance, keyframe); } current_offset += sample_size; stream_size += sample_size; current_dts += sc->stts_data[stts_index].duration; distance++; stts_sample++; current_sample++; if (stts_index + 1 < sc->stts_count && stts_sample == sc->stts_data[stts_index].count) { stts_sample = 0; stts_index++; } } } if (st->duration > 0) st->codec->bit_rate = stream_size*8*sc->time_scale/st->duration; } else { unsigned chunk_samples, total = 0; // compute total chunk count for (i = 0; i < sc->stsc_count; i++) { unsigned count, chunk_count; chunk_samples = sc->stsc_data[i].count; if (sc->samples_per_frame && chunk_samples % sc->samples_per_frame) { av_log(mov->fc, AV_LOG_ERROR, "error unaligned chunk\n"); return; } if (sc->samples_per_frame >= 160) { // gsm count = chunk_samples / sc->samples_per_frame; } else if (sc->samples_per_frame > 1) { unsigned samples = (1024/sc->samples_per_frame)*sc->samples_per_frame; count = (chunk_samples+samples-1) / samples; } else { count = (chunk_samples+1023) / 1024; } if (i < sc->stsc_count - 1) chunk_count = sc->stsc_data[i+1].first - sc->stsc_data[i].first; else chunk_count = sc->chunk_count - (sc->stsc_data[i].first - 1); total += chunk_count * count; } av_dlog(mov->fc, "chunk count %d\n", total); if (total >= UINT_MAX / sizeof(*st->index_entries)) return; st->index_entries = av_malloc(total*sizeof(*st->index_entries)); if (!st->index_entries) return; st->index_entries_allocated_size = total*sizeof(*st->index_entries); // populate index for (i = 0; i < sc->chunk_count; i++) { current_offset = sc->chunk_offsets[i]; if (stsc_index + 1 < sc->stsc_count && i + 1 == sc->stsc_data[stsc_index + 1].first) stsc_index++; chunk_samples = sc->stsc_data[stsc_index].count; while (chunk_samples > 0) { AVIndexEntry *e; unsigned size, samples; if (sc->samples_per_frame >= 160) { // gsm samples = sc->samples_per_frame; size = sc->bytes_per_frame; } else { if (sc->samples_per_frame > 1) { samples = FFMIN((1024 / sc->samples_per_frame)* sc->samples_per_frame, chunk_samples); size = (samples / sc->samples_per_frame) * sc->bytes_per_frame; } else { samples = FFMIN(1024, chunk_samples); size = samples * sc->sample_size; } } if (st->nb_index_entries >= total) { av_log(mov->fc, AV_LOG_ERROR, "wrong chunk count %d\n", total); return; } e = &st->index_entries[st->nb_index_entries++]; e->pos = current_offset; e->timestamp = current_dts; e->size = size; e->min_distance = 0; e->flags = AVINDEX_KEYFRAME; av_dlog(mov->fc, "AVIndex stream %d, chunk %d, offset %"PRIx64", dts %"PRId64", " "size %d, duration %d\n", st->index, i, current_offset, current_dts, size, samples); current_offset += size; current_dts += samples; chunk_samples -= samples; } } } }
true
FFmpeg
69e7ad8dbc9896aff70f1f1125c726764f28455f
static void mov_build_index(MOVContext *mov, AVStream *st) { MOVStreamContext *sc = st->priv_data; int64_t current_offset; int64_t current_dts = 0; unsigned int stts_index = 0; unsigned int stsc_index = 0; unsigned int stss_index = 0; unsigned int stps_index = 0; unsigned int i, j; uint64_t stream_size = 0; if (sc->time_offset && mov->time_scale > 0) { if (sc->time_offset < 0) sc->time_offset = av_rescale(sc->time_offset, sc->time_scale, mov->time_scale); current_dts = -sc->time_offset; if (sc->ctts_data && sc->stts_data && sc->ctts_data[0].duration / sc->stts_data[0].duration > 16) { sc->wrong_dts = 1; st->codec->has_b_frames = 1; } } if (!(st->codec->codec_type == AVMEDIA_TYPE_AUDIO && sc->stts_count == 1 && sc->stts_data[0].duration == 1)) { unsigned int current_sample = 0; unsigned int stts_sample = 0; unsigned int sample_size; unsigned int distance = 0; int key_off = sc->keyframes && sc->keyframes[0] == 1; current_dts -= sc->dts_shift; if (sc->sample_count >= UINT_MAX / sizeof(*st->index_entries)) return; st->index_entries = av_malloc(sc->sample_count*sizeof(*st->index_entries)); if (!st->index_entries) return; st->index_entries_allocated_size = sc->sample_count*sizeof(*st->index_entries); for (i = 0; i < sc->chunk_count; i++) { current_offset = sc->chunk_offsets[i]; while (stsc_index + 1 < sc->stsc_count && i + 1 == sc->stsc_data[stsc_index + 1].first) stsc_index++; for (j = 0; j < sc->stsc_data[stsc_index].count; j++) { int keyframe = 0; if (current_sample >= sc->sample_count) { av_log(mov->fc, AV_LOG_ERROR, "wrong sample count\n"); return; } if (!sc->keyframe_count || current_sample+key_off == sc->keyframes[stss_index]) { keyframe = 1; if (stss_index + 1 < sc->keyframe_count) stss_index++; } else if (sc->stps_count && current_sample+key_off == sc->stps_data[stps_index]) { keyframe = 1; if (stps_index + 1 < sc->stps_count) stps_index++; } if (keyframe) distance = 0; sample_size = sc->sample_size > 0 ? sc->sample_size : sc->sample_sizes[current_sample]; if (sc->pseudo_stream_id == -1 || sc->stsc_data[stsc_index].id - 1 == sc->pseudo_stream_id) { AVIndexEntry *e = &st->index_entries[st->nb_index_entries++]; e->pos = current_offset; e->timestamp = current_dts; e->size = sample_size; e->min_distance = distance; e->flags = keyframe ? AVINDEX_KEYFRAME : 0; av_dlog(mov->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " "size %d, distance %d, keyframe %d\n", st->index, current_sample, current_offset, current_dts, sample_size, distance, keyframe); } current_offset += sample_size; stream_size += sample_size; current_dts += sc->stts_data[stts_index].duration; distance++; stts_sample++; current_sample++; if (stts_index + 1 < sc->stts_count && stts_sample == sc->stts_data[stts_index].count) { stts_sample = 0; stts_index++; } } } if (st->duration > 0) st->codec->bit_rate = stream_size*8*sc->time_scale/st->duration; } else { unsigned chunk_samples, total = 0; for (i = 0; i < sc->stsc_count; i++) { unsigned count, chunk_count; chunk_samples = sc->stsc_data[i].count; if (sc->samples_per_frame && chunk_samples % sc->samples_per_frame) { av_log(mov->fc, AV_LOG_ERROR, "error unaligned chunk\n"); return; } if (sc->samples_per_frame >= 160) { count = chunk_samples / sc->samples_per_frame; } else if (sc->samples_per_frame > 1) { unsigned samples = (1024/sc->samples_per_frame)*sc->samples_per_frame; count = (chunk_samples+samples-1) / samples; } else { count = (chunk_samples+1023) / 1024; } if (i < sc->stsc_count - 1) chunk_count = sc->stsc_data[i+1].first - sc->stsc_data[i].first; else chunk_count = sc->chunk_count - (sc->stsc_data[i].first - 1); total += chunk_count * count; } av_dlog(mov->fc, "chunk count %d\n", total); if (total >= UINT_MAX / sizeof(*st->index_entries)) return; st->index_entries = av_malloc(total*sizeof(*st->index_entries)); if (!st->index_entries) return; st->index_entries_allocated_size = total*sizeof(*st->index_entries); for (i = 0; i < sc->chunk_count; i++) { current_offset = sc->chunk_offsets[i]; if (stsc_index + 1 < sc->stsc_count && i + 1 == sc->stsc_data[stsc_index + 1].first) stsc_index++; chunk_samples = sc->stsc_data[stsc_index].count; while (chunk_samples > 0) { AVIndexEntry *e; unsigned size, samples; if (sc->samples_per_frame >= 160) { samples = sc->samples_per_frame; size = sc->bytes_per_frame; } else { if (sc->samples_per_frame > 1) { samples = FFMIN((1024 / sc->samples_per_frame)* sc->samples_per_frame, chunk_samples); size = (samples / sc->samples_per_frame) * sc->bytes_per_frame; } else { samples = FFMIN(1024, chunk_samples); size = samples * sc->sample_size; } } if (st->nb_index_entries >= total) { av_log(mov->fc, AV_LOG_ERROR, "wrong chunk count %d\n", total); return; } e = &st->index_entries[st->nb_index_entries++]; e->pos = current_offset; e->timestamp = current_dts; e->size = size; e->min_distance = 0; e->flags = AVINDEX_KEYFRAME; av_dlog(mov->fc, "AVIndex stream %d, chunk %d, offset %"PRIx64", dts %"PRId64", " "size %d, duration %d\n", st->index, i, current_offset, current_dts, size, samples); current_offset += size; current_dts += samples; chunk_samples -= samples; } } } }
{ "code": [ " if (sc->ctts_data && sc->stts_data &&" ], "line_no": [ 35 ] }
static void FUNC_0(MOVContext *VAR_0, AVStream *VAR_1) { MOVStreamContext *sc = VAR_1->priv_data; int64_t current_offset; int64_t current_dts = 0; unsigned int VAR_2 = 0; unsigned int VAR_3 = 0; unsigned int VAR_4 = 0; unsigned int VAR_5 = 0; unsigned int VAR_6, VAR_7; uint64_t stream_size = 0; if (sc->time_offset && VAR_0->time_scale > 0) { if (sc->time_offset < 0) sc->time_offset = av_rescale(sc->time_offset, sc->time_scale, VAR_0->time_scale); current_dts = -sc->time_offset; if (sc->ctts_data && sc->stts_data && sc->ctts_data[0].duration / sc->stts_data[0].duration > 16) { sc->wrong_dts = 1; VAR_1->codec->has_b_frames = 1; } } if (!(VAR_1->codec->codec_type == AVMEDIA_TYPE_AUDIO && sc->stts_count == 1 && sc->stts_data[0].duration == 1)) { unsigned int VAR_8 = 0; unsigned int VAR_9 = 0; unsigned int VAR_10; unsigned int VAR_11 = 0; int VAR_12 = sc->keyframes && sc->keyframes[0] == 1; current_dts -= sc->dts_shift; if (sc->sample_count >= UINT_MAX / sizeof(*VAR_1->index_entries)) return; VAR_1->index_entries = av_malloc(sc->sample_count*sizeof(*VAR_1->index_entries)); if (!VAR_1->index_entries) return; VAR_1->index_entries_allocated_size = sc->sample_count*sizeof(*VAR_1->index_entries); for (VAR_6 = 0; VAR_6 < sc->chunk_count; VAR_6++) { current_offset = sc->chunk_offsets[VAR_6]; while (VAR_3 + 1 < sc->stsc_count && VAR_6 + 1 == sc->stsc_data[VAR_3 + 1].first) VAR_3++; for (VAR_7 = 0; VAR_7 < sc->stsc_data[VAR_3].count; VAR_7++) { int keyframe = 0; if (VAR_8 >= sc->sample_count) { av_log(VAR_0->fc, AV_LOG_ERROR, "wrong sample count\n"); return; } if (!sc->keyframe_count || VAR_8+VAR_12 == sc->keyframes[VAR_4]) { keyframe = 1; if (VAR_4 + 1 < sc->keyframe_count) VAR_4++; } else if (sc->stps_count && VAR_8+VAR_12 == sc->stps_data[VAR_5]) { keyframe = 1; if (VAR_5 + 1 < sc->stps_count) VAR_5++; } if (keyframe) VAR_11 = 0; VAR_10 = sc->VAR_10 > 0 ? sc->VAR_10 : sc->sample_sizes[VAR_8]; if (sc->pseudo_stream_id == -1 || sc->stsc_data[VAR_3].id - 1 == sc->pseudo_stream_id) { AVIndexEntry *e = &VAR_1->index_entries[VAR_1->nb_index_entries++]; e->pos = current_offset; e->timestamp = current_dts; e->size = VAR_10; e->min_distance = VAR_11; e->flags = keyframe ? AVINDEX_KEYFRAME : 0; av_dlog(VAR_0->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " "size %d, VAR_11 %d, keyframe %d\n", VAR_1->index, VAR_8, current_offset, current_dts, VAR_10, VAR_11, keyframe); } current_offset += VAR_10; stream_size += VAR_10; current_dts += sc->stts_data[VAR_2].duration; VAR_11++; VAR_9++; VAR_8++; if (VAR_2 + 1 < sc->stts_count && VAR_9 == sc->stts_data[VAR_2].count) { VAR_9 = 0; VAR_2++; } } } if (VAR_1->duration > 0) VAR_1->codec->bit_rate = stream_size*8*sc->time_scale/VAR_1->duration; } else { unsigned VAR_13, VAR_14 = 0; for (VAR_6 = 0; VAR_6 < sc->stsc_count; VAR_6++) { unsigned count, chunk_count; VAR_13 = sc->stsc_data[VAR_6].count; if (sc->samples_per_frame && VAR_13 % sc->samples_per_frame) { av_log(VAR_0->fc, AV_LOG_ERROR, "error unaligned chunk\n"); return; } if (sc->samples_per_frame >= 160) { count = VAR_13 / sc->samples_per_frame; } else if (sc->samples_per_frame > 1) { unsigned samples = (1024/sc->samples_per_frame)*sc->samples_per_frame; count = (VAR_13+samples-1) / samples; } else { count = (VAR_13+1023) / 1024; } if (VAR_6 < sc->stsc_count - 1) chunk_count = sc->stsc_data[VAR_6+1].first - sc->stsc_data[VAR_6].first; else chunk_count = sc->chunk_count - (sc->stsc_data[VAR_6].first - 1); VAR_14 += chunk_count * count; } av_dlog(VAR_0->fc, "chunk count %d\n", VAR_14); if (VAR_14 >= UINT_MAX / sizeof(*VAR_1->index_entries)) return; VAR_1->index_entries = av_malloc(VAR_14*sizeof(*VAR_1->index_entries)); if (!VAR_1->index_entries) return; VAR_1->index_entries_allocated_size = VAR_14*sizeof(*VAR_1->index_entries); for (VAR_6 = 0; VAR_6 < sc->chunk_count; VAR_6++) { current_offset = sc->chunk_offsets[VAR_6]; if (VAR_3 + 1 < sc->stsc_count && VAR_6 + 1 == sc->stsc_data[VAR_3 + 1].first) VAR_3++; VAR_13 = sc->stsc_data[VAR_3].count; while (VAR_13 > 0) { AVIndexEntry *e; unsigned size, samples; if (sc->samples_per_frame >= 160) { samples = sc->samples_per_frame; size = sc->bytes_per_frame; } else { if (sc->samples_per_frame > 1) { samples = FFMIN((1024 / sc->samples_per_frame)* sc->samples_per_frame, VAR_13); size = (samples / sc->samples_per_frame) * sc->bytes_per_frame; } else { samples = FFMIN(1024, VAR_13); size = samples * sc->VAR_10; } } if (VAR_1->nb_index_entries >= VAR_14) { av_log(VAR_0->fc, AV_LOG_ERROR, "wrong chunk count %d\n", VAR_14); return; } e = &VAR_1->index_entries[VAR_1->nb_index_entries++]; e->pos = current_offset; e->timestamp = current_dts; e->size = size; e->min_distance = 0; e->flags = AVINDEX_KEYFRAME; av_dlog(VAR_0->fc, "AVIndex stream %d, chunk %d, offset %"PRIx64", dts %"PRId64", " "size %d, duration %d\n", VAR_1->index, VAR_6, current_offset, current_dts, size, samples); current_offset += size; current_dts += samples; VAR_13 -= samples; } } } }
[ "static void FUNC_0(MOVContext *VAR_0, AVStream *VAR_1)\n{", "MOVStreamContext *sc = VAR_1->priv_data;", "int64_t current_offset;", "int64_t current_dts = 0;", "unsigned int VAR_2 = 0;", "unsigned int VAR_3 = 0;", "unsigned int VAR_4 = 0;", "unsigned int VAR_5 = 0;", "unsigned int VAR_6, VAR_7;", "uint64_t stream_size = 0;", "if (sc->time_offset && VAR_0->time_scale > 0) {", "if (sc->time_offset < 0)\nsc->time_offset = av_rescale(sc->time_offset, sc->time_scale, VAR_0->time_scale);", "current_dts = -sc->time_offset;", "if (sc->ctts_data && sc->stts_data &&\nsc->ctts_data[0].duration / sc->stts_data[0].duration > 16) {", "sc->wrong_dts = 1;", "VAR_1->codec->has_b_frames = 1;", "}", "}", "if (!(VAR_1->codec->codec_type == AVMEDIA_TYPE_AUDIO &&\nsc->stts_count == 1 && sc->stts_data[0].duration == 1)) {", "unsigned int VAR_8 = 0;", "unsigned int VAR_9 = 0;", "unsigned int VAR_10;", "unsigned int VAR_11 = 0;", "int VAR_12 = sc->keyframes && sc->keyframes[0] == 1;", "current_dts -= sc->dts_shift;", "if (sc->sample_count >= UINT_MAX / sizeof(*VAR_1->index_entries))\nreturn;", "VAR_1->index_entries = av_malloc(sc->sample_count*sizeof(*VAR_1->index_entries));", "if (!VAR_1->index_entries)\nreturn;", "VAR_1->index_entries_allocated_size = sc->sample_count*sizeof(*VAR_1->index_entries);", "for (VAR_6 = 0; VAR_6 < sc->chunk_count; VAR_6++) {", "current_offset = sc->chunk_offsets[VAR_6];", "while (VAR_3 + 1 < sc->stsc_count &&\nVAR_6 + 1 == sc->stsc_data[VAR_3 + 1].first)\nVAR_3++;", "for (VAR_7 = 0; VAR_7 < sc->stsc_data[VAR_3].count; VAR_7++) {", "int keyframe = 0;", "if (VAR_8 >= sc->sample_count) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"wrong sample count\\n\");", "return;", "}", "if (!sc->keyframe_count || VAR_8+VAR_12 == sc->keyframes[VAR_4]) {", "keyframe = 1;", "if (VAR_4 + 1 < sc->keyframe_count)\nVAR_4++;", "} else if (sc->stps_count && VAR_8+VAR_12 == sc->stps_data[VAR_5]) {", "keyframe = 1;", "if (VAR_5 + 1 < sc->stps_count)\nVAR_5++;", "}", "if (keyframe)\nVAR_11 = 0;", "VAR_10 = sc->VAR_10 > 0 ? sc->VAR_10 : sc->sample_sizes[VAR_8];", "if (sc->pseudo_stream_id == -1 ||\nsc->stsc_data[VAR_3].id - 1 == sc->pseudo_stream_id) {", "AVIndexEntry *e = &VAR_1->index_entries[VAR_1->nb_index_entries++];", "e->pos = current_offset;", "e->timestamp = current_dts;", "e->size = VAR_10;", "e->min_distance = VAR_11;", "e->flags = keyframe ? AVINDEX_KEYFRAME : 0;", "av_dlog(VAR_0->fc, \"AVIndex stream %d, sample %d, offset %\"PRIx64\", dts %\"PRId64\", \"\n\"size %d, VAR_11 %d, keyframe %d\\n\", VAR_1->index, VAR_8,\ncurrent_offset, current_dts, VAR_10, VAR_11, keyframe);", "}", "current_offset += VAR_10;", "stream_size += VAR_10;", "current_dts += sc->stts_data[VAR_2].duration;", "VAR_11++;", "VAR_9++;", "VAR_8++;", "if (VAR_2 + 1 < sc->stts_count && VAR_9 == sc->stts_data[VAR_2].count) {", "VAR_9 = 0;", "VAR_2++;", "}", "}", "}", "if (VAR_1->duration > 0)\nVAR_1->codec->bit_rate = stream_size*8*sc->time_scale/VAR_1->duration;", "} else {", "unsigned VAR_13, VAR_14 = 0;", "for (VAR_6 = 0; VAR_6 < sc->stsc_count; VAR_6++) {", "unsigned count, chunk_count;", "VAR_13 = sc->stsc_data[VAR_6].count;", "if (sc->samples_per_frame && VAR_13 % sc->samples_per_frame) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"error unaligned chunk\\n\");", "return;", "}", "if (sc->samples_per_frame >= 160) {", "count = VAR_13 / sc->samples_per_frame;", "} else if (sc->samples_per_frame > 1) {", "unsigned samples = (1024/sc->samples_per_frame)*sc->samples_per_frame;", "count = (VAR_13+samples-1) / samples;", "} else {", "count = (VAR_13+1023) / 1024;", "}", "if (VAR_6 < sc->stsc_count - 1)\nchunk_count = sc->stsc_data[VAR_6+1].first - sc->stsc_data[VAR_6].first;", "else\nchunk_count = sc->chunk_count - (sc->stsc_data[VAR_6].first - 1);", "VAR_14 += chunk_count * count;", "}", "av_dlog(VAR_0->fc, \"chunk count %d\\n\", VAR_14);", "if (VAR_14 >= UINT_MAX / sizeof(*VAR_1->index_entries))\nreturn;", "VAR_1->index_entries = av_malloc(VAR_14*sizeof(*VAR_1->index_entries));", "if (!VAR_1->index_entries)\nreturn;", "VAR_1->index_entries_allocated_size = VAR_14*sizeof(*VAR_1->index_entries);", "for (VAR_6 = 0; VAR_6 < sc->chunk_count; VAR_6++) {", "current_offset = sc->chunk_offsets[VAR_6];", "if (VAR_3 + 1 < sc->stsc_count &&\nVAR_6 + 1 == sc->stsc_data[VAR_3 + 1].first)\nVAR_3++;", "VAR_13 = sc->stsc_data[VAR_3].count;", "while (VAR_13 > 0) {", "AVIndexEntry *e;", "unsigned size, samples;", "if (sc->samples_per_frame >= 160) {", "samples = sc->samples_per_frame;", "size = sc->bytes_per_frame;", "} else {", "if (sc->samples_per_frame > 1) {", "samples = FFMIN((1024 / sc->samples_per_frame)*\nsc->samples_per_frame, VAR_13);", "size = (samples / sc->samples_per_frame) * sc->bytes_per_frame;", "} else {", "samples = FFMIN(1024, VAR_13);", "size = samples * sc->VAR_10;", "}", "}", "if (VAR_1->nb_index_entries >= VAR_14) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"wrong chunk count %d\\n\", VAR_14);", "return;", "}", "e = &VAR_1->index_entries[VAR_1->nb_index_entries++];", "e->pos = current_offset;", "e->timestamp = current_dts;", "e->size = size;", "e->min_distance = 0;", "e->flags = AVINDEX_KEYFRAME;", "av_dlog(VAR_0->fc, \"AVIndex stream %d, chunk %d, offset %\"PRIx64\", dts %\"PRId64\", \"\n\"size %d, duration %d\\n\", VAR_1->index, VAR_6, current_offset, current_dts,\nsize, samples);", "current_offset += size;", "current_dts += samples;", "VAR_13 -= samples;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 75, 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93, 95, 97 ], [ 99 ], [ 101 ], [ 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 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235, 237 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 249 ], [ 251, 253 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 267 ], [ 269 ], [ 271, 273, 275 ], [ 277 ], [ 281 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299, 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337, 339, 341 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ] ]
11,479
int MPV_common_init(MpegEncContext *s) { int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y, threads; s->mb_height = (s->height + 15) / 16; if(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height)){ av_log(s->avctx, AV_LOG_ERROR, "too many threads\n"); return -1; } if((s->width || s->height) && avcodec_check_dimensions(s->avctx, s->width, s->height)) return -1; dsputil_init(&s->dsp, s->avctx); ff_dct_common_init(s); s->flags= s->avctx->flags; s->flags2= s->avctx->flags2; s->mb_width = (s->width + 15) / 16; s->mb_stride = s->mb_width + 1; s->b8_stride = s->mb_width*2 + 1; s->b4_stride = s->mb_width*4 + 1; mb_array_size= s->mb_height * s->mb_stride; mv_table_size= (s->mb_height+2) * s->mb_stride + 1; /* set chroma shifts */ avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,&(s->chroma_x_shift), &(s->chroma_y_shift) ); /* set default edge pos, will be overriden in decode_header if needed */ s->h_edge_pos= s->mb_width*16; s->v_edge_pos= s->mb_height*16; s->mb_num = s->mb_width * s->mb_height; s->block_wrap[0]= s->block_wrap[1]= s->block_wrap[2]= s->block_wrap[3]= s->b8_stride; s->block_wrap[4]= s->block_wrap[5]= s->mb_stride; y_size = s->b8_stride * (2 * s->mb_height + 1); c_size = s->mb_stride * (s->mb_height + 1); yc_size = y_size + 2 * c_size; /* convert fourcc to upper case */ s->codec_tag= toupper( s->avctx->codec_tag &0xFF) + (toupper((s->avctx->codec_tag>>8 )&0xFF)<<8 ) + (toupper((s->avctx->codec_tag>>16)&0xFF)<<16) + (toupper((s->avctx->codec_tag>>24)&0xFF)<<24); s->stream_codec_tag= toupper( s->avctx->stream_codec_tag &0xFF) + (toupper((s->avctx->stream_codec_tag>>8 )&0xFF)<<8 ) + (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16) + (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24); s->avctx->coded_frame= (AVFrame*)&s->current_picture; CHECKED_ALLOCZ(s->mb_index2xy, (s->mb_num+1)*sizeof(int)) //error ressilience code looks cleaner with this for(y=0; y<s->mb_height; y++){ for(x=0; x<s->mb_width; x++){ s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride; } } s->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width; //FIXME really needed? if (s->encoding) { /* Allocate MV tables */ CHECKED_ALLOCZ(s->p_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(s->b_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(s->b_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(s->b_bidir_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(s->b_bidir_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(s->b_direct_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1; s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1; s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1; s->b_bidir_forw_mv_table= s->b_bidir_forw_mv_table_base + s->mb_stride + 1; s->b_bidir_back_mv_table= s->b_bidir_back_mv_table_base + s->mb_stride + 1; s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1; if(s->msmpeg4_version){ CHECKED_ALLOCZ(s->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int)); } CHECKED_ALLOCZ(s->avctx->stats_out, 256); /* Allocate MB type table */ CHECKED_ALLOCZ(s->mb_type , mb_array_size * sizeof(uint16_t)) //needed for encoding CHECKED_ALLOCZ(s->lambda_table, mb_array_size * sizeof(int)) CHECKED_ALLOCZ(s->q_intra_matrix, 64*32 * sizeof(int)) CHECKED_ALLOCZ(s->q_inter_matrix, 64*32 * sizeof(int)) CHECKED_ALLOCZ(s->q_intra_matrix16, 64*32*2 * sizeof(uint16_t)) CHECKED_ALLOCZ(s->q_inter_matrix16, 64*32*2 * sizeof(uint16_t)) CHECKED_ALLOCZ(s->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*)) CHECKED_ALLOCZ(s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*)) if(s->avctx->noise_reduction){ CHECKED_ALLOCZ(s->dct_offset, 2 * 64 * sizeof(uint16_t)) } } CHECKED_ALLOCZ(s->picture, MAX_PICTURE_COUNT * sizeof(Picture)) CHECKED_ALLOCZ(s->error_status_table, mb_array_size*sizeof(uint8_t)) if(s->codec_id==CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)){ /* interlaced direct mode decoding tables */ for(i=0; i<2; i++){ int j, k; for(j=0; j<2; j++){ for(k=0; k<2; k++){ CHECKED_ALLOCZ(s->b_field_mv_table_base[i][j][k] , mv_table_size * 2 * sizeof(int16_t)) s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] + s->mb_stride + 1; } CHECKED_ALLOCZ(s->b_field_select_table[i][j] , mb_array_size * 2 * sizeof(uint8_t)) CHECKED_ALLOCZ(s->p_field_mv_table_base[i][j] , mv_table_size * 2 * sizeof(int16_t)) s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j] + s->mb_stride + 1; } CHECKED_ALLOCZ(s->p_field_select_table[i] , mb_array_size * 2 * sizeof(uint8_t)) } } if (s->out_format == FMT_H263) { /* ac values */ CHECKED_ALLOCZ(s->ac_val_base, yc_size * sizeof(int16_t) * 16); s->ac_val[0] = s->ac_val_base + s->b8_stride + 1; s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1; s->ac_val[2] = s->ac_val[1] + c_size; /* cbp values */ CHECKED_ALLOCZ(s->coded_block_base, y_size); s->coded_block= s->coded_block_base + s->b8_stride + 1; /* cbp, ac_pred, pred_dir */ CHECKED_ALLOCZ(s->cbp_table , mb_array_size * sizeof(uint8_t)) CHECKED_ALLOCZ(s->pred_dir_table, mb_array_size * sizeof(uint8_t)) } if (s->h263_pred || s->h263_plus || !s->encoding) { /* dc values */ //MN: we need these for error resilience of intra-frames CHECKED_ALLOCZ(s->dc_val_base, yc_size * sizeof(int16_t)); s->dc_val[0] = s->dc_val_base + s->b8_stride + 1; s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1; s->dc_val[2] = s->dc_val[1] + c_size; for(i=0;i<yc_size;i++) s->dc_val_base[i] = 1024; } /* which mb is a intra block */ CHECKED_ALLOCZ(s->mbintra_table, mb_array_size); memset(s->mbintra_table, 1, mb_array_size); /* init macroblock skip table */ CHECKED_ALLOCZ(s->mbskip_table, mb_array_size+2); //Note the +1 is for a quicker mpeg4 slice_end detection CHECKED_ALLOCZ(s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE); s->parse_context.state= -1; if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){ s->visualization_buffer[0] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); s->visualization_buffer[1] = av_malloc((s->mb_width*8 + EDGE_WIDTH) * s->mb_height*8 + EDGE_WIDTH); s->visualization_buffer[2] = av_malloc((s->mb_width*8 + EDGE_WIDTH) * s->mb_height*8 + EDGE_WIDTH); } s->context_initialized = 1; s->thread_context[0]= s; /* h264 does thread context setup itself, but it needs context[0] * to be fully initialized for the error resilience code */ threads = s->codec_id == CODEC_ID_H264 ? 1 : s->avctx->thread_count; for(i=1; i<threads; i++){ s->thread_context[i]= av_malloc(sizeof(MpegEncContext)); memcpy(s->thread_context[i], s, sizeof(MpegEncContext)); } for(i=0; i<threads; i++){ if(init_duplicate_context(s->thread_context[i], s) < 0) goto fail; s->thread_context[i]->start_mb_y= (s->mb_height*(i ) + s->avctx->thread_count/2) / s->avctx->thread_count; s->thread_context[i]->end_mb_y = (s->mb_height*(i+1) + s->avctx->thread_count/2) / s->avctx->thread_count; } return 0; fail: MPV_common_end(s); return -1; }
true
FFmpeg
79db7ac6ef235a06c3049d7792eda39da28ee3fd
int MPV_common_init(MpegEncContext *s) { int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y, threads; s->mb_height = (s->height + 15) / 16; if(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height)){ av_log(s->avctx, AV_LOG_ERROR, "too many threads\n"); return -1; } if((s->width || s->height) && avcodec_check_dimensions(s->avctx, s->width, s->height)) return -1; dsputil_init(&s->dsp, s->avctx); ff_dct_common_init(s); s->flags= s->avctx->flags; s->flags2= s->avctx->flags2; s->mb_width = (s->width + 15) / 16; s->mb_stride = s->mb_width + 1; s->b8_stride = s->mb_width*2 + 1; s->b4_stride = s->mb_width*4 + 1; mb_array_size= s->mb_height * s->mb_stride; mv_table_size= (s->mb_height+2) * s->mb_stride + 1; avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,&(s->chroma_x_shift), &(s->chroma_y_shift) ); s->h_edge_pos= s->mb_width*16; s->v_edge_pos= s->mb_height*16; s->mb_num = s->mb_width * s->mb_height; s->block_wrap[0]= s->block_wrap[1]= s->block_wrap[2]= s->block_wrap[3]= s->b8_stride; s->block_wrap[4]= s->block_wrap[5]= s->mb_stride; y_size = s->b8_stride * (2 * s->mb_height + 1); c_size = s->mb_stride * (s->mb_height + 1); yc_size = y_size + 2 * c_size; s->codec_tag= toupper( s->avctx->codec_tag &0xFF) + (toupper((s->avctx->codec_tag>>8 )&0xFF)<<8 ) + (toupper((s->avctx->codec_tag>>16)&0xFF)<<16) + (toupper((s->avctx->codec_tag>>24)&0xFF)<<24); s->stream_codec_tag= toupper( s->avctx->stream_codec_tag &0xFF) + (toupper((s->avctx->stream_codec_tag>>8 )&0xFF)<<8 ) + (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16) + (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24); s->avctx->coded_frame= (AVFrame*)&s->current_picture; CHECKED_ALLOCZ(s->mb_index2xy, (s->mb_num+1)*sizeof(int)) for(y=0; y<s->mb_height; y++){ for(x=0; x<s->mb_width; x++){ s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride; } } s->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width; if (s->encoding) { CHECKED_ALLOCZ(s->p_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(s->b_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(s->b_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(s->b_bidir_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(s->b_bidir_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(s->b_direct_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1; s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1; s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1; s->b_bidir_forw_mv_table= s->b_bidir_forw_mv_table_base + s->mb_stride + 1; s->b_bidir_back_mv_table= s->b_bidir_back_mv_table_base + s->mb_stride + 1; s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1; if(s->msmpeg4_version){ CHECKED_ALLOCZ(s->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int)); } CHECKED_ALLOCZ(s->avctx->stats_out, 256); CHECKED_ALLOCZ(s->mb_type , mb_array_size * sizeof(uint16_t)) CHECKED_ALLOCZ(s->lambda_table, mb_array_size * sizeof(int)) CHECKED_ALLOCZ(s->q_intra_matrix, 64*32 * sizeof(int)) CHECKED_ALLOCZ(s->q_inter_matrix, 64*32 * sizeof(int)) CHECKED_ALLOCZ(s->q_intra_matrix16, 64*32*2 * sizeof(uint16_t)) CHECKED_ALLOCZ(s->q_inter_matrix16, 64*32*2 * sizeof(uint16_t)) CHECKED_ALLOCZ(s->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*)) CHECKED_ALLOCZ(s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*)) if(s->avctx->noise_reduction){ CHECKED_ALLOCZ(s->dct_offset, 2 * 64 * sizeof(uint16_t)) } } CHECKED_ALLOCZ(s->picture, MAX_PICTURE_COUNT * sizeof(Picture)) CHECKED_ALLOCZ(s->error_status_table, mb_array_size*sizeof(uint8_t)) if(s->codec_id==CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)){ for(i=0; i<2; i++){ int j, k; for(j=0; j<2; j++){ for(k=0; k<2; k++){ CHECKED_ALLOCZ(s->b_field_mv_table_base[i][j][k] , mv_table_size * 2 * sizeof(int16_t)) s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] + s->mb_stride + 1; } CHECKED_ALLOCZ(s->b_field_select_table[i][j] , mb_array_size * 2 * sizeof(uint8_t)) CHECKED_ALLOCZ(s->p_field_mv_table_base[i][j] , mv_table_size * 2 * sizeof(int16_t)) s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j] + s->mb_stride + 1; } CHECKED_ALLOCZ(s->p_field_select_table[i] , mb_array_size * 2 * sizeof(uint8_t)) } } if (s->out_format == FMT_H263) { CHECKED_ALLOCZ(s->ac_val_base, yc_size * sizeof(int16_t) * 16); s->ac_val[0] = s->ac_val_base + s->b8_stride + 1; s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1; s->ac_val[2] = s->ac_val[1] + c_size; CHECKED_ALLOCZ(s->coded_block_base, y_size); s->coded_block= s->coded_block_base + s->b8_stride + 1; CHECKED_ALLOCZ(s->cbp_table , mb_array_size * sizeof(uint8_t)) CHECKED_ALLOCZ(s->pred_dir_table, mb_array_size * sizeof(uint8_t)) } if (s->h263_pred || s->h263_plus || !s->encoding) { CHECKED_ALLOCZ(s->dc_val_base, yc_size * sizeof(int16_t)); s->dc_val[0] = s->dc_val_base + s->b8_stride + 1; s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1; s->dc_val[2] = s->dc_val[1] + c_size; for(i=0;i<yc_size;i++) s->dc_val_base[i] = 1024; } CHECKED_ALLOCZ(s->mbintra_table, mb_array_size); memset(s->mbintra_table, 1, mb_array_size); CHECKED_ALLOCZ(s->mbskip_table, mb_array_size+2); CHECKED_ALLOCZ(s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE); s->parse_context.state= -1; if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){ s->visualization_buffer[0] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); s->visualization_buffer[1] = av_malloc((s->mb_width*8 + EDGE_WIDTH) * s->mb_height*8 + EDGE_WIDTH); s->visualization_buffer[2] = av_malloc((s->mb_width*8 + EDGE_WIDTH) * s->mb_height*8 + EDGE_WIDTH); } s->context_initialized = 1; s->thread_context[0]= s; threads = s->codec_id == CODEC_ID_H264 ? 1 : s->avctx->thread_count; for(i=1; i<threads; i++){ s->thread_context[i]= av_malloc(sizeof(MpegEncContext)); memcpy(s->thread_context[i], s, sizeof(MpegEncContext)); } for(i=0; i<threads; i++){ if(init_duplicate_context(s->thread_context[i], s) < 0) goto fail; s->thread_context[i]->start_mb_y= (s->mb_height*(i ) + s->avctx->thread_count/2) / s->avctx->thread_count; s->thread_context[i]->end_mb_y = (s->mb_height*(i+1) + s->avctx->thread_count/2) / s->avctx->thread_count; } return 0; fail: MPV_common_end(s); return -1; }
{ "code": [ " threads = s->codec_id == CODEC_ID_H264 ? 1 : s->avctx->thread_count;" ], "line_no": [ 347 ] }
int FUNC_0(MpegEncContext *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; VAR_0->mb_height = (VAR_0->height + 15) / 16; if(VAR_0->avctx->thread_count > MAX_THREADS || (VAR_0->avctx->thread_count > VAR_0->mb_height && VAR_0->mb_height)){ av_log(VAR_0->avctx, AV_LOG_ERROR, "too many VAR_9\n"); return -1; } if((VAR_0->width || VAR_0->height) && avcodec_check_dimensions(VAR_0->avctx, VAR_0->width, VAR_0->height)) return -1; dsputil_init(&VAR_0->dsp, VAR_0->avctx); ff_dct_common_init(VAR_0); VAR_0->flags= VAR_0->avctx->flags; VAR_0->flags2= VAR_0->avctx->flags2; VAR_0->mb_width = (VAR_0->width + 15) / 16; VAR_0->mb_stride = VAR_0->mb_width + 1; VAR_0->b8_stride = VAR_0->mb_width*2 + 1; VAR_0->b4_stride = VAR_0->mb_width*4 + 1; VAR_5= VAR_0->mb_height * VAR_0->mb_stride; VAR_6= (VAR_0->mb_height+2) * VAR_0->mb_stride + 1; avcodec_get_chroma_sub_sample(VAR_0->avctx->pix_fmt,&(VAR_0->chroma_x_shift), &(VAR_0->chroma_y_shift) ); VAR_0->h_edge_pos= VAR_0->mb_width*16; VAR_0->v_edge_pos= VAR_0->mb_height*16; VAR_0->mb_num = VAR_0->mb_width * VAR_0->mb_height; VAR_0->block_wrap[0]= VAR_0->block_wrap[1]= VAR_0->block_wrap[2]= VAR_0->block_wrap[3]= VAR_0->b8_stride; VAR_0->block_wrap[4]= VAR_0->block_wrap[5]= VAR_0->mb_stride; VAR_1 = VAR_0->b8_stride * (2 * VAR_0->mb_height + 1); VAR_2 = VAR_0->mb_stride * (VAR_0->mb_height + 1); VAR_3 = VAR_1 + 2 * VAR_2; VAR_0->codec_tag= toupper( VAR_0->avctx->codec_tag &0xFF) + (toupper((VAR_0->avctx->codec_tag>>8 )&0xFF)<<8 ) + (toupper((VAR_0->avctx->codec_tag>>16)&0xFF)<<16) + (toupper((VAR_0->avctx->codec_tag>>24)&0xFF)<<24); VAR_0->stream_codec_tag= toupper( VAR_0->avctx->stream_codec_tag &0xFF) + (toupper((VAR_0->avctx->stream_codec_tag>>8 )&0xFF)<<8 ) + (toupper((VAR_0->avctx->stream_codec_tag>>16)&0xFF)<<16) + (toupper((VAR_0->avctx->stream_codec_tag>>24)&0xFF)<<24); VAR_0->avctx->coded_frame= (AVFrame*)&VAR_0->current_picture; CHECKED_ALLOCZ(VAR_0->mb_index2xy, (VAR_0->mb_num+1)*sizeof(int)) for(VAR_8=0; VAR_8<VAR_0->mb_height; VAR_8++){ for(VAR_7=0; VAR_7<VAR_0->mb_width; VAR_7++){ VAR_0->mb_index2xy[ VAR_7 + VAR_8*VAR_0->mb_width ] = VAR_7 + VAR_8*VAR_0->mb_stride; } } VAR_0->mb_index2xy[ VAR_0->mb_height*VAR_0->mb_width ] = (VAR_0->mb_height-1)*VAR_0->mb_stride + VAR_0->mb_width; if (VAR_0->encoding) { CHECKED_ALLOCZ(VAR_0->p_mv_table_base , VAR_6 * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(VAR_0->b_forw_mv_table_base , VAR_6 * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(VAR_0->b_back_mv_table_base , VAR_6 * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(VAR_0->b_bidir_forw_mv_table_base , VAR_6 * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(VAR_0->b_bidir_back_mv_table_base , VAR_6 * 2 * sizeof(int16_t)) CHECKED_ALLOCZ(VAR_0->b_direct_mv_table_base , VAR_6 * 2 * sizeof(int16_t)) VAR_0->p_mv_table = VAR_0->p_mv_table_base + VAR_0->mb_stride + 1; VAR_0->b_forw_mv_table = VAR_0->b_forw_mv_table_base + VAR_0->mb_stride + 1; VAR_0->b_back_mv_table = VAR_0->b_back_mv_table_base + VAR_0->mb_stride + 1; VAR_0->b_bidir_forw_mv_table= VAR_0->b_bidir_forw_mv_table_base + VAR_0->mb_stride + 1; VAR_0->b_bidir_back_mv_table= VAR_0->b_bidir_back_mv_table_base + VAR_0->mb_stride + 1; VAR_0->b_direct_mv_table = VAR_0->b_direct_mv_table_base + VAR_0->mb_stride + 1; if(VAR_0->msmpeg4_version){ CHECKED_ALLOCZ(VAR_0->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int)); } CHECKED_ALLOCZ(VAR_0->avctx->stats_out, 256); CHECKED_ALLOCZ(VAR_0->mb_type , VAR_5 * sizeof(uint16_t)) CHECKED_ALLOCZ(VAR_0->lambda_table, VAR_5 * sizeof(int)) CHECKED_ALLOCZ(VAR_0->q_intra_matrix, 64*32 * sizeof(int)) CHECKED_ALLOCZ(VAR_0->q_inter_matrix, 64*32 * sizeof(int)) CHECKED_ALLOCZ(VAR_0->q_intra_matrix16, 64*32*2 * sizeof(uint16_t)) CHECKED_ALLOCZ(VAR_0->q_inter_matrix16, 64*32*2 * sizeof(uint16_t)) CHECKED_ALLOCZ(VAR_0->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*)) CHECKED_ALLOCZ(VAR_0->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*)) if(VAR_0->avctx->noise_reduction){ CHECKED_ALLOCZ(VAR_0->dct_offset, 2 * 64 * sizeof(uint16_t)) } } CHECKED_ALLOCZ(VAR_0->picture, MAX_PICTURE_COUNT * sizeof(Picture)) CHECKED_ALLOCZ(VAR_0->error_status_table, VAR_5*sizeof(uint8_t)) if(VAR_0->codec_id==CODEC_ID_MPEG4 || (VAR_0->flags & CODEC_FLAG_INTERLACED_ME)){ for(VAR_4=0; VAR_4<2; VAR_4++){ int j, k; for(j=0; j<2; j++){ for(k=0; k<2; k++){ CHECKED_ALLOCZ(VAR_0->b_field_mv_table_base[VAR_4][j][k] , VAR_6 * 2 * sizeof(int16_t)) VAR_0->b_field_mv_table[VAR_4][j][k] = VAR_0->b_field_mv_table_base[VAR_4][j][k] + VAR_0->mb_stride + 1; } CHECKED_ALLOCZ(VAR_0->b_field_select_table[VAR_4][j] , VAR_5 * 2 * sizeof(uint8_t)) CHECKED_ALLOCZ(VAR_0->p_field_mv_table_base[VAR_4][j] , VAR_6 * 2 * sizeof(int16_t)) VAR_0->p_field_mv_table[VAR_4][j] = VAR_0->p_field_mv_table_base[VAR_4][j] + VAR_0->mb_stride + 1; } CHECKED_ALLOCZ(VAR_0->p_field_select_table[VAR_4] , VAR_5 * 2 * sizeof(uint8_t)) } } if (VAR_0->out_format == FMT_H263) { CHECKED_ALLOCZ(VAR_0->ac_val_base, VAR_3 * sizeof(int16_t) * 16); VAR_0->ac_val[0] = VAR_0->ac_val_base + VAR_0->b8_stride + 1; VAR_0->ac_val[1] = VAR_0->ac_val_base + VAR_1 + VAR_0->mb_stride + 1; VAR_0->ac_val[2] = VAR_0->ac_val[1] + VAR_2; CHECKED_ALLOCZ(VAR_0->coded_block_base, VAR_1); VAR_0->coded_block= VAR_0->coded_block_base + VAR_0->b8_stride + 1; CHECKED_ALLOCZ(VAR_0->cbp_table , VAR_5 * sizeof(uint8_t)) CHECKED_ALLOCZ(VAR_0->pred_dir_table, VAR_5 * sizeof(uint8_t)) } if (VAR_0->h263_pred || VAR_0->h263_plus || !VAR_0->encoding) { CHECKED_ALLOCZ(VAR_0->dc_val_base, VAR_3 * sizeof(int16_t)); VAR_0->dc_val[0] = VAR_0->dc_val_base + VAR_0->b8_stride + 1; VAR_0->dc_val[1] = VAR_0->dc_val_base + VAR_1 + VAR_0->mb_stride + 1; VAR_0->dc_val[2] = VAR_0->dc_val[1] + VAR_2; for(VAR_4=0;VAR_4<VAR_3;VAR_4++) VAR_0->dc_val_base[VAR_4] = 1024; } CHECKED_ALLOCZ(VAR_0->mbintra_table, VAR_5); memset(VAR_0->mbintra_table, 1, VAR_5); CHECKED_ALLOCZ(VAR_0->mbskip_table, VAR_5+2); CHECKED_ALLOCZ(VAR_0->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE); VAR_0->parse_context.state= -1; if((VAR_0->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (VAR_0->avctx->debug_mv)){ VAR_0->visualization_buffer[0] = av_malloc((VAR_0->mb_width*16 + 2*EDGE_WIDTH) * VAR_0->mb_height*16 + 2*EDGE_WIDTH); VAR_0->visualization_buffer[1] = av_malloc((VAR_0->mb_width*8 + EDGE_WIDTH) * VAR_0->mb_height*8 + EDGE_WIDTH); VAR_0->visualization_buffer[2] = av_malloc((VAR_0->mb_width*8 + EDGE_WIDTH) * VAR_0->mb_height*8 + EDGE_WIDTH); } VAR_0->context_initialized = 1; VAR_0->thread_context[0]= VAR_0; VAR_9 = VAR_0->codec_id == CODEC_ID_H264 ? 1 : VAR_0->avctx->thread_count; for(VAR_4=1; VAR_4<VAR_9; VAR_4++){ VAR_0->thread_context[VAR_4]= av_malloc(sizeof(MpegEncContext)); memcpy(VAR_0->thread_context[VAR_4], VAR_0, sizeof(MpegEncContext)); } for(VAR_4=0; VAR_4<VAR_9; VAR_4++){ if(init_duplicate_context(VAR_0->thread_context[VAR_4], VAR_0) < 0) goto fail; VAR_0->thread_context[VAR_4]->start_mb_y= (VAR_0->mb_height*(VAR_4 ) + VAR_0->avctx->thread_count/2) / VAR_0->avctx->thread_count; VAR_0->thread_context[VAR_4]->end_mb_y = (VAR_0->mb_height*(VAR_4+1) + VAR_0->avctx->thread_count/2) / VAR_0->avctx->thread_count; } return 0; fail: MPV_common_end(VAR_0); return -1; }
[ "int FUNC_0(MpegEncContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "VAR_0->mb_height = (VAR_0->height + 15) / 16;", "if(VAR_0->avctx->thread_count > MAX_THREADS || (VAR_0->avctx->thread_count > VAR_0->mb_height && VAR_0->mb_height)){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"too many VAR_9\\n\");", "return -1;", "}", "if((VAR_0->width || VAR_0->height) && avcodec_check_dimensions(VAR_0->avctx, VAR_0->width, VAR_0->height))\nreturn -1;", "dsputil_init(&VAR_0->dsp, VAR_0->avctx);", "ff_dct_common_init(VAR_0);", "VAR_0->flags= VAR_0->avctx->flags;", "VAR_0->flags2= VAR_0->avctx->flags2;", "VAR_0->mb_width = (VAR_0->width + 15) / 16;", "VAR_0->mb_stride = VAR_0->mb_width + 1;", "VAR_0->b8_stride = VAR_0->mb_width*2 + 1;", "VAR_0->b4_stride = VAR_0->mb_width*4 + 1;", "VAR_5= VAR_0->mb_height * VAR_0->mb_stride;", "VAR_6= (VAR_0->mb_height+2) * VAR_0->mb_stride + 1;", "avcodec_get_chroma_sub_sample(VAR_0->avctx->pix_fmt,&(VAR_0->chroma_x_shift),\n&(VAR_0->chroma_y_shift) );", "VAR_0->h_edge_pos= VAR_0->mb_width*16;", "VAR_0->v_edge_pos= VAR_0->mb_height*16;", "VAR_0->mb_num = VAR_0->mb_width * VAR_0->mb_height;", "VAR_0->block_wrap[0]=\nVAR_0->block_wrap[1]=\nVAR_0->block_wrap[2]=\nVAR_0->block_wrap[3]= VAR_0->b8_stride;", "VAR_0->block_wrap[4]=\nVAR_0->block_wrap[5]= VAR_0->mb_stride;", "VAR_1 = VAR_0->b8_stride * (2 * VAR_0->mb_height + 1);", "VAR_2 = VAR_0->mb_stride * (VAR_0->mb_height + 1);", "VAR_3 = VAR_1 + 2 * VAR_2;", "VAR_0->codec_tag= toupper( VAR_0->avctx->codec_tag &0xFF)\n+ (toupper((VAR_0->avctx->codec_tag>>8 )&0xFF)<<8 )\n+ (toupper((VAR_0->avctx->codec_tag>>16)&0xFF)<<16)\n+ (toupper((VAR_0->avctx->codec_tag>>24)&0xFF)<<24);", "VAR_0->stream_codec_tag= toupper( VAR_0->avctx->stream_codec_tag &0xFF)\n+ (toupper((VAR_0->avctx->stream_codec_tag>>8 )&0xFF)<<8 )\n+ (toupper((VAR_0->avctx->stream_codec_tag>>16)&0xFF)<<16)\n+ (toupper((VAR_0->avctx->stream_codec_tag>>24)&0xFF)<<24);", "VAR_0->avctx->coded_frame= (AVFrame*)&VAR_0->current_picture;", "CHECKED_ALLOCZ(VAR_0->mb_index2xy, (VAR_0->mb_num+1)*sizeof(int))\nfor(VAR_8=0; VAR_8<VAR_0->mb_height; VAR_8++){", "for(VAR_7=0; VAR_7<VAR_0->mb_width; VAR_7++){", "VAR_0->mb_index2xy[ VAR_7 + VAR_8*VAR_0->mb_width ] = VAR_7 + VAR_8*VAR_0->mb_stride;", "}", "}", "VAR_0->mb_index2xy[ VAR_0->mb_height*VAR_0->mb_width ] = (VAR_0->mb_height-1)*VAR_0->mb_stride + VAR_0->mb_width;", "if (VAR_0->encoding) {", "CHECKED_ALLOCZ(VAR_0->p_mv_table_base , VAR_6 * 2 * sizeof(int16_t))\nCHECKED_ALLOCZ(VAR_0->b_forw_mv_table_base , VAR_6 * 2 * sizeof(int16_t))\nCHECKED_ALLOCZ(VAR_0->b_back_mv_table_base , VAR_6 * 2 * sizeof(int16_t))\nCHECKED_ALLOCZ(VAR_0->b_bidir_forw_mv_table_base , VAR_6 * 2 * sizeof(int16_t))\nCHECKED_ALLOCZ(VAR_0->b_bidir_back_mv_table_base , VAR_6 * 2 * sizeof(int16_t))\nCHECKED_ALLOCZ(VAR_0->b_direct_mv_table_base , VAR_6 * 2 * sizeof(int16_t))\nVAR_0->p_mv_table = VAR_0->p_mv_table_base + VAR_0->mb_stride + 1;", "VAR_0->b_forw_mv_table = VAR_0->b_forw_mv_table_base + VAR_0->mb_stride + 1;", "VAR_0->b_back_mv_table = VAR_0->b_back_mv_table_base + VAR_0->mb_stride + 1;", "VAR_0->b_bidir_forw_mv_table= VAR_0->b_bidir_forw_mv_table_base + VAR_0->mb_stride + 1;", "VAR_0->b_bidir_back_mv_table= VAR_0->b_bidir_back_mv_table_base + VAR_0->mb_stride + 1;", "VAR_0->b_direct_mv_table = VAR_0->b_direct_mv_table_base + VAR_0->mb_stride + 1;", "if(VAR_0->msmpeg4_version){", "CHECKED_ALLOCZ(VAR_0->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int));", "}", "CHECKED_ALLOCZ(VAR_0->avctx->stats_out, 256);", "CHECKED_ALLOCZ(VAR_0->mb_type , VAR_5 * sizeof(uint16_t))\nCHECKED_ALLOCZ(VAR_0->lambda_table, VAR_5 * sizeof(int))\nCHECKED_ALLOCZ(VAR_0->q_intra_matrix, 64*32 * sizeof(int))\nCHECKED_ALLOCZ(VAR_0->q_inter_matrix, 64*32 * sizeof(int))\nCHECKED_ALLOCZ(VAR_0->q_intra_matrix16, 64*32*2 * sizeof(uint16_t))\nCHECKED_ALLOCZ(VAR_0->q_inter_matrix16, 64*32*2 * sizeof(uint16_t))\nCHECKED_ALLOCZ(VAR_0->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*))\nCHECKED_ALLOCZ(VAR_0->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*))\nif(VAR_0->avctx->noise_reduction){", "CHECKED_ALLOCZ(VAR_0->dct_offset, 2 * 64 * sizeof(uint16_t))\n}", "}", "CHECKED_ALLOCZ(VAR_0->picture, MAX_PICTURE_COUNT * sizeof(Picture))\nCHECKED_ALLOCZ(VAR_0->error_status_table, VAR_5*sizeof(uint8_t))\nif(VAR_0->codec_id==CODEC_ID_MPEG4 || (VAR_0->flags & CODEC_FLAG_INTERLACED_ME)){", "for(VAR_4=0; VAR_4<2; VAR_4++){", "int j, k;", "for(j=0; j<2; j++){", "for(k=0; k<2; k++){", "CHECKED_ALLOCZ(VAR_0->b_field_mv_table_base[VAR_4][j][k] , VAR_6 * 2 * sizeof(int16_t))\nVAR_0->b_field_mv_table[VAR_4][j][k] = VAR_0->b_field_mv_table_base[VAR_4][j][k] + VAR_0->mb_stride + 1;", "}", "CHECKED_ALLOCZ(VAR_0->b_field_select_table[VAR_4][j] , VAR_5 * 2 * sizeof(uint8_t))\nCHECKED_ALLOCZ(VAR_0->p_field_mv_table_base[VAR_4][j] , VAR_6 * 2 * sizeof(int16_t))\nVAR_0->p_field_mv_table[VAR_4][j] = VAR_0->p_field_mv_table_base[VAR_4][j] + VAR_0->mb_stride + 1;", "}", "CHECKED_ALLOCZ(VAR_0->p_field_select_table[VAR_4] , VAR_5 * 2 * sizeof(uint8_t))\n}", "}", "if (VAR_0->out_format == FMT_H263) {", "CHECKED_ALLOCZ(VAR_0->ac_val_base, VAR_3 * sizeof(int16_t) * 16);", "VAR_0->ac_val[0] = VAR_0->ac_val_base + VAR_0->b8_stride + 1;", "VAR_0->ac_val[1] = VAR_0->ac_val_base + VAR_1 + VAR_0->mb_stride + 1;", "VAR_0->ac_val[2] = VAR_0->ac_val[1] + VAR_2;", "CHECKED_ALLOCZ(VAR_0->coded_block_base, VAR_1);", "VAR_0->coded_block= VAR_0->coded_block_base + VAR_0->b8_stride + 1;", "CHECKED_ALLOCZ(VAR_0->cbp_table , VAR_5 * sizeof(uint8_t))\nCHECKED_ALLOCZ(VAR_0->pred_dir_table, VAR_5 * sizeof(uint8_t))\n}", "if (VAR_0->h263_pred || VAR_0->h263_plus || !VAR_0->encoding) {", "CHECKED_ALLOCZ(VAR_0->dc_val_base, VAR_3 * sizeof(int16_t));", "VAR_0->dc_val[0] = VAR_0->dc_val_base + VAR_0->b8_stride + 1;", "VAR_0->dc_val[1] = VAR_0->dc_val_base + VAR_1 + VAR_0->mb_stride + 1;", "VAR_0->dc_val[2] = VAR_0->dc_val[1] + VAR_2;", "for(VAR_4=0;VAR_4<VAR_3;VAR_4++)", "VAR_0->dc_val_base[VAR_4] = 1024;", "}", "CHECKED_ALLOCZ(VAR_0->mbintra_table, VAR_5);", "memset(VAR_0->mbintra_table, 1, VAR_5);", "CHECKED_ALLOCZ(VAR_0->mbskip_table, VAR_5+2);", "CHECKED_ALLOCZ(VAR_0->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE);", "VAR_0->parse_context.state= -1;", "if((VAR_0->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (VAR_0->avctx->debug_mv)){", "VAR_0->visualization_buffer[0] = av_malloc((VAR_0->mb_width*16 + 2*EDGE_WIDTH) * VAR_0->mb_height*16 + 2*EDGE_WIDTH);", "VAR_0->visualization_buffer[1] = av_malloc((VAR_0->mb_width*8 + EDGE_WIDTH) * VAR_0->mb_height*8 + EDGE_WIDTH);", "VAR_0->visualization_buffer[2] = av_malloc((VAR_0->mb_width*8 + EDGE_WIDTH) * VAR_0->mb_height*8 + EDGE_WIDTH);", "}", "VAR_0->context_initialized = 1;", "VAR_0->thread_context[0]= VAR_0;", "VAR_9 = VAR_0->codec_id == CODEC_ID_H264 ? 1 : VAR_0->avctx->thread_count;", "for(VAR_4=1; VAR_4<VAR_9; VAR_4++){", "VAR_0->thread_context[VAR_4]= av_malloc(sizeof(MpegEncContext));", "memcpy(VAR_0->thread_context[VAR_4], VAR_0, sizeof(MpegEncContext));", "}", "for(VAR_4=0; VAR_4<VAR_9; VAR_4++){", "if(init_duplicate_context(VAR_0->thread_context[VAR_4], VAR_0) < 0)\ngoto fail;", "VAR_0->thread_context[VAR_4]->start_mb_y= (VAR_0->mb_height*(VAR_4 ) + VAR_0->avctx->thread_count/2) / VAR_0->avctx->thread_count;", "VAR_0->thread_context[VAR_4]->end_mb_y = (VAR_0->mb_height*(VAR_4+1) + VAR_0->avctx->thread_count/2) / VAR_0->avctx->thread_count;", "}", "return 0;", "fail:\nMPV_common_end(VAR_0);", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57, 59 ], [ 65 ], [ 67 ], [ 71 ], [ 75, 77, 79, 81 ], [ 83, 85 ], [ 89 ], [ 91 ], [ 93 ], [ 99, 101, 103, 105 ], [ 109, 111, 113, 115 ], [ 119 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 143, 145, 147, 149, 151, 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 181, 185, 189, 191, 193, 195, 197, 199, 203 ], [ 205, 207 ], [ 209 ], [ 211, 215, 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231, 233 ], [ 235 ], [ 237, 239, 241 ], [ 243 ], [ 245, 247 ], [ 249 ], [ 251 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 267 ], [ 269 ], [ 275, 277, 279 ], [ 283 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 307 ], [ 309 ], [ 315 ], [ 319 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 337 ], [ 341 ], [ 347 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 361 ], [ 363, 365 ], [ 367 ], [ 369 ], [ 371 ], [ 375 ], [ 377, 379 ], [ 381 ], [ 383 ] ]
11,480
static void read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd) { ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; GetBitContext *gb = &ctx->gb; *bd->raw_samples = 0; *bd->const_block = get_bits1(gb); // 1 = constant value, 0 = zero block (silence) bd->js_blocks = get_bits1(gb); // skip 5 reserved bits skip_bits(gb, 5); if (*bd->const_block) { unsigned int const_val_bits = sconf->floating ? 24 : avctx->bits_per_raw_sample; *bd->raw_samples = get_sbits_long(gb, const_val_bits); } // ensure constant block decoding by reusing this field *bd->const_block = 1; }
false
FFmpeg
0ceca269b66ec12a23bf0907bd2c220513cdbf16
static void read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd) { ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; GetBitContext *gb = &ctx->gb; *bd->raw_samples = 0; *bd->const_block = get_bits1(gb); bd->js_blocks = get_bits1(gb); skip_bits(gb, 5); if (*bd->const_block) { unsigned int const_val_bits = sconf->floating ? 24 : avctx->bits_per_raw_sample; *bd->raw_samples = get_sbits_long(gb, const_val_bits); } *bd->const_block = 1; }
{ "code": [], "line_no": [] }
static void FUNC_0(ALSDecContext *VAR_0, ALSBlockData *VAR_1) { ALSSpecificConfig *sconf = &VAR_0->sconf; AVCodecContext *avctx = VAR_0->avctx; GetBitContext *gb = &VAR_0->gb; *VAR_1->raw_samples = 0; *VAR_1->const_block = get_bits1(gb); VAR_1->js_blocks = get_bits1(gb); skip_bits(gb, 5); if (*VAR_1->const_block) { unsigned int VAR_2 = sconf->floating ? 24 : avctx->bits_per_raw_sample; *VAR_1->raw_samples = get_sbits_long(gb, VAR_2); } *VAR_1->const_block = 1; }
[ "static void FUNC_0(ALSDecContext *VAR_0, ALSBlockData *VAR_1)\n{", "ALSSpecificConfig *sconf = &VAR_0->sconf;", "AVCodecContext *avctx = VAR_0->avctx;", "GetBitContext *gb = &VAR_0->gb;", "*VAR_1->raw_samples = 0;", "*VAR_1->const_block = get_bits1(gb);", "VAR_1->js_blocks = get_bits1(gb);", "skip_bits(gb, 5);", "if (*VAR_1->const_block) {", "unsigned int VAR_2 = sconf->floating ? 24 : avctx->bits_per_raw_sample;", "*VAR_1->raw_samples = get_sbits_long(gb, VAR_2);", "}", "*VAR_1->const_block = 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ] ]
11,481
static int MP3lame_encode_frame(AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data) { Mp3AudioContext *s = avctx->priv_data; int len; int lame_result; /* lame 3.91 dies on '1-channel interleaved' data */ if(data){ if (s->stereo) { lame_result = lame_encode_buffer_interleaved( s->gfp, data, avctx->frame_size, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } else { lame_result = lame_encode_buffer( s->gfp, data, data, avctx->frame_size, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } }else{ lame_result= lame_encode_flush( s->gfp, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } if(lame_result==-1) { /* output buffer too small */ av_log(avctx, AV_LOG_ERROR, "lame: output buffer too small (buffer index: %d, free bytes: %d)\n", s->buffer_index, BUFFER_SIZE - s->buffer_index); return 0; } s->buffer_index += lame_result; if(s->buffer_index<4) return 0; len= mp3len(s->buffer, NULL, NULL); //av_log(avctx, AV_LOG_DEBUG, "in:%d packet-len:%d index:%d\n", avctx->frame_size, len, s->buffer_index); if(len <= s->buffer_index){ memcpy(frame, s->buffer, len); s->buffer_index -= len; memmove(s->buffer, s->buffer+len, s->buffer_index); //FIXME fix the audio codec API, so we do not need the memcpy() /*for(i=0; i<len; i++){ av_log(avctx, AV_LOG_DEBUG, "%2X ", frame[i]); }*/ return len; }else return 0; }
false
FFmpeg
2083648383d93917d482e69dd33e46cbd8404d31
static int MP3lame_encode_frame(AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data) { Mp3AudioContext *s = avctx->priv_data; int len; int lame_result; if(data){ if (s->stereo) { lame_result = lame_encode_buffer_interleaved( s->gfp, data, avctx->frame_size, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } else { lame_result = lame_encode_buffer( s->gfp, data, data, avctx->frame_size, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } }else{ lame_result= lame_encode_flush( s->gfp, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } if(lame_result==-1) { av_log(avctx, AV_LOG_ERROR, "lame: output buffer too small (buffer index: %d, free bytes: %d)\n", s->buffer_index, BUFFER_SIZE - s->buffer_index); return 0; } s->buffer_index += lame_result; if(s->buffer_index<4) return 0; len= mp3len(s->buffer, NULL, NULL); if(len <= s->buffer_index){ memcpy(frame, s->buffer, len); s->buffer_index -= len; memmove(s->buffer, s->buffer+len, s->buffer_index); return len; }else return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1, int VAR_2, void *VAR_3) { Mp3AudioContext *s = VAR_0->priv_data; int VAR_4; int VAR_5; if(VAR_3){ if (s->stereo) { VAR_5 = lame_encode_buffer_interleaved( s->gfp, VAR_3, VAR_0->frame_size, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } else { VAR_5 = lame_encode_buffer( s->gfp, VAR_3, VAR_3, VAR_0->frame_size, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } }else{ VAR_5= lame_encode_flush( s->gfp, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } if(VAR_5==-1) { av_log(VAR_0, AV_LOG_ERROR, "lame: output buffer too small (buffer index: %d, free bytes: %d)\n", s->buffer_index, BUFFER_SIZE - s->buffer_index); return 0; } s->buffer_index += VAR_5; if(s->buffer_index<4) return 0; VAR_4= mp3len(s->buffer, NULL, NULL); if(VAR_4 <= s->buffer_index){ memcpy(VAR_1, s->buffer, VAR_4); s->buffer_index -= VAR_4; memmove(s->buffer, s->buffer+VAR_4, s->buffer_index); return VAR_4; }else return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nunsigned char *VAR_1, int VAR_2, void *VAR_3)\n{", "Mp3AudioContext *s = VAR_0->priv_data;", "int VAR_4;", "int VAR_5;", "if(VAR_3){", "if (s->stereo) {", "VAR_5 = lame_encode_buffer_interleaved(\ns->gfp,\nVAR_3,\nVAR_0->frame_size,\ns->buffer + s->buffer_index,\nBUFFER_SIZE - s->buffer_index\n);", "} else {", "VAR_5 = lame_encode_buffer(\ns->gfp,\nVAR_3,\nVAR_3,\nVAR_0->frame_size,\ns->buffer + s->buffer_index,\nBUFFER_SIZE - s->buffer_index\n);", "}", "}else{", "VAR_5= lame_encode_flush(\ns->gfp,\ns->buffer + s->buffer_index,\nBUFFER_SIZE - s->buffer_index\n);", "}", "if(VAR_5==-1) {", "av_log(VAR_0, AV_LOG_ERROR, \"lame: output buffer too small (buffer index: %d, free bytes: %d)\\n\", s->buffer_index, BUFFER_SIZE - s->buffer_index);", "return 0;", "}", "s->buffer_index += VAR_5;", "if(s->buffer_index<4)\nreturn 0;", "VAR_4= mp3len(s->buffer, NULL, NULL);", "if(VAR_4 <= s->buffer_index){", "memcpy(VAR_1, s->buffer, VAR_4);", "s->buffer_index -= VAR_4;", "memmove(s->buffer, s->buffer+VAR_4, s->buffer_index);", "return VAR_4;", "}else", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 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 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 89, 91 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ] ]
11,482
static void lx_init(const LxBoardDesc *board, MachineState *machine) { #ifdef TARGET_WORDS_BIGENDIAN int be = 1; #else int be = 0; #endif MemoryRegion *system_memory = get_system_memory(); XtensaCPU *cpu = NULL; CPUXtensaState *env = NULL; MemoryRegion *ram, *rom, *system_io; DriveInfo *dinfo; pflash_t *flash = NULL; QemuOpts *machine_opts = qemu_get_machine_opts(); const char *cpu_model = machine->cpu_model; const char *kernel_filename = qemu_opt_get(machine_opts, "kernel"); const char *kernel_cmdline = qemu_opt_get(machine_opts, "append"); const char *dtb_filename = qemu_opt_get(machine_opts, "dtb"); const char *initrd_filename = qemu_opt_get(machine_opts, "initrd"); int n; if (!cpu_model) { cpu_model = XTENSA_DEFAULT_CPU_MODEL; } for (n = 0; n < smp_cpus; n++) { cpu = cpu_xtensa_init(cpu_model); if (cpu == NULL) { error_report("unable to find CPU definition '%s'", cpu_model); exit(EXIT_FAILURE); } env = &cpu->env; env->sregs[PRID] = n; qemu_register_reset(lx60_reset, cpu); /* Need MMU initialized prior to ELF loading, * so that ELF gets loaded into virtual addresses */ cpu_reset(CPU(cpu)); } ram = g_malloc(sizeof(*ram)); memory_region_init_ram(ram, NULL, "lx60.dram", machine->ram_size, &error_abort); vmstate_register_ram_global(ram); memory_region_add_subregion(system_memory, 0, ram); system_io = g_malloc(sizeof(*system_io)); memory_region_init_io(system_io, NULL, &lx60_io_ops, NULL, "lx60.io", 224 * 1024 * 1024); memory_region_add_subregion(system_memory, 0xf0000000, system_io); lx60_fpga_init(system_io, 0x0d020000); if (nd_table[0].used) { lx60_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000, xtensa_get_extint(env, 1), nd_table); } if (!serial_hds[0]) { serial_hds[0] = qemu_chr_new("serial0", "null", NULL); } serial_mm_init(system_io, 0x0d050020, 2, xtensa_get_extint(env, 0), 115200, serial_hds[0], DEVICE_NATIVE_ENDIAN); dinfo = drive_get(IF_PFLASH, 0, 0); if (dinfo) { flash = pflash_cfi01_register(board->flash_base, NULL, "lx60.io.flash", board->flash_size, blk_by_legacy_dinfo(dinfo), board->flash_sector_size, board->flash_size / board->flash_sector_size, 4, 0x0000, 0x0000, 0x0000, 0x0000, be); if (flash == NULL) { error_report("unable to mount pflash"); exit(EXIT_FAILURE); } } /* Use presence of kernel file name as 'boot from SRAM' switch. */ if (kernel_filename) { uint32_t entry_point = env->pc; size_t bp_size = 3 * get_tag_size(0); /* first/last and memory tags */ uint32_t tagptr = 0xfe000000 + board->sram_size; uint32_t cur_tagptr; BpMemInfo memory_location = { .type = tswap32(MEMORY_TYPE_CONVENTIONAL), .start = tswap32(0), .end = tswap32(machine->ram_size), }; uint32_t lowmem_end = machine->ram_size < 0x08000000 ? machine->ram_size : 0x08000000; uint32_t cur_lowmem = QEMU_ALIGN_UP(lowmem_end / 2, 4096); rom = g_malloc(sizeof(*rom)); memory_region_init_ram(rom, NULL, "lx60.sram", board->sram_size, &error_abort); vmstate_register_ram_global(rom); memory_region_add_subregion(system_memory, 0xfe000000, rom); if (kernel_cmdline) { bp_size += get_tag_size(strlen(kernel_cmdline) + 1); } if (dtb_filename) { bp_size += get_tag_size(sizeof(uint32_t)); } if (initrd_filename) { bp_size += get_tag_size(sizeof(BpMemInfo)); } /* Put kernel bootparameters to the end of that SRAM */ tagptr = (tagptr - bp_size) & ~0xff; cur_tagptr = put_tag(tagptr, BP_TAG_FIRST, 0, NULL); cur_tagptr = put_tag(cur_tagptr, BP_TAG_MEMORY, sizeof(memory_location), &memory_location); if (kernel_cmdline) { cur_tagptr = put_tag(cur_tagptr, BP_TAG_COMMAND_LINE, strlen(kernel_cmdline) + 1, kernel_cmdline); } if (dtb_filename) { int fdt_size; void *fdt = load_device_tree(dtb_filename, &fdt_size); uint32_t dtb_addr = tswap32(cur_lowmem); if (!fdt) { error_report("could not load DTB '%s'", dtb_filename); exit(EXIT_FAILURE); } cpu_physical_memory_write(cur_lowmem, fdt, fdt_size); cur_tagptr = put_tag(cur_tagptr, BP_TAG_FDT, sizeof(dtb_addr), &dtb_addr); cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + fdt_size, 4096); } if (initrd_filename) { BpMemInfo initrd_location = { 0 }; int initrd_size = load_ramdisk(initrd_filename, cur_lowmem, lowmem_end - cur_lowmem); if (initrd_size < 0) { initrd_size = load_image_targphys(initrd_filename, cur_lowmem, lowmem_end - cur_lowmem); } if (initrd_size < 0) { error_report("could not load initrd '%s'", initrd_filename); exit(EXIT_FAILURE); } initrd_location.start = tswap32(cur_lowmem); initrd_location.end = tswap32(cur_lowmem + initrd_size); cur_tagptr = put_tag(cur_tagptr, BP_TAG_INITRD, sizeof(initrd_location), &initrd_location); cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + initrd_size, 4096); } cur_tagptr = put_tag(cur_tagptr, BP_TAG_LAST, 0, NULL); env->regs[2] = tagptr; uint64_t elf_entry; uint64_t elf_lowaddr; int success = load_elf(kernel_filename, translate_phys_addr, cpu, &elf_entry, &elf_lowaddr, NULL, be, ELF_MACHINE, 0); if (success > 0) { entry_point = elf_entry; } else { hwaddr ep; int is_linux; success = load_uimage(kernel_filename, &ep, NULL, &is_linux, translate_phys_addr, cpu); if (success > 0 && is_linux) { entry_point = ep; } else { error_report("could not load kernel '%s'", kernel_filename); exit(EXIT_FAILURE); } } if (entry_point != env->pc) { static const uint8_t jx_a0[] = { #ifdef TARGET_WORDS_BIGENDIAN 0x0a, 0, 0, #else 0xa0, 0, 0, #endif }; env->regs[0] = entry_point; cpu_physical_memory_write(env->pc, jx_a0, sizeof(jx_a0)); } } else { if (flash) { MemoryRegion *flash_mr = pflash_cfi01_get_memory(flash); MemoryRegion *flash_io = g_malloc(sizeof(*flash_io)); memory_region_init_alias(flash_io, NULL, "lx60.flash", flash_mr, board->flash_boot_base, board->flash_size - board->flash_boot_base < 0x02000000 ? board->flash_size - board->flash_boot_base : 0x02000000); memory_region_add_subregion(system_memory, 0xfe000000, flash_io); } } }
true
qemu
f8ed85ac992c48814d916d5df4d44f9a971c5de4
static void lx_init(const LxBoardDesc *board, MachineState *machine) { #ifdef TARGET_WORDS_BIGENDIAN int be = 1; #else int be = 0; #endif MemoryRegion *system_memory = get_system_memory(); XtensaCPU *cpu = NULL; CPUXtensaState *env = NULL; MemoryRegion *ram, *rom, *system_io; DriveInfo *dinfo; pflash_t *flash = NULL; QemuOpts *machine_opts = qemu_get_machine_opts(); const char *cpu_model = machine->cpu_model; const char *kernel_filename = qemu_opt_get(machine_opts, "kernel"); const char *kernel_cmdline = qemu_opt_get(machine_opts, "append"); const char *dtb_filename = qemu_opt_get(machine_opts, "dtb"); const char *initrd_filename = qemu_opt_get(machine_opts, "initrd"); int n; if (!cpu_model) { cpu_model = XTENSA_DEFAULT_CPU_MODEL; } for (n = 0; n < smp_cpus; n++) { cpu = cpu_xtensa_init(cpu_model); if (cpu == NULL) { error_report("unable to find CPU definition '%s'", cpu_model); exit(EXIT_FAILURE); } env = &cpu->env; env->sregs[PRID] = n; qemu_register_reset(lx60_reset, cpu); cpu_reset(CPU(cpu)); } ram = g_malloc(sizeof(*ram)); memory_region_init_ram(ram, NULL, "lx60.dram", machine->ram_size, &error_abort); vmstate_register_ram_global(ram); memory_region_add_subregion(system_memory, 0, ram); system_io = g_malloc(sizeof(*system_io)); memory_region_init_io(system_io, NULL, &lx60_io_ops, NULL, "lx60.io", 224 * 1024 * 1024); memory_region_add_subregion(system_memory, 0xf0000000, system_io); lx60_fpga_init(system_io, 0x0d020000); if (nd_table[0].used) { lx60_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000, xtensa_get_extint(env, 1), nd_table); } if (!serial_hds[0]) { serial_hds[0] = qemu_chr_new("serial0", "null", NULL); } serial_mm_init(system_io, 0x0d050020, 2, xtensa_get_extint(env, 0), 115200, serial_hds[0], DEVICE_NATIVE_ENDIAN); dinfo = drive_get(IF_PFLASH, 0, 0); if (dinfo) { flash = pflash_cfi01_register(board->flash_base, NULL, "lx60.io.flash", board->flash_size, blk_by_legacy_dinfo(dinfo), board->flash_sector_size, board->flash_size / board->flash_sector_size, 4, 0x0000, 0x0000, 0x0000, 0x0000, be); if (flash == NULL) { error_report("unable to mount pflash"); exit(EXIT_FAILURE); } } if (kernel_filename) { uint32_t entry_point = env->pc; size_t bp_size = 3 * get_tag_size(0); uint32_t tagptr = 0xfe000000 + board->sram_size; uint32_t cur_tagptr; BpMemInfo memory_location = { .type = tswap32(MEMORY_TYPE_CONVENTIONAL), .start = tswap32(0), .end = tswap32(machine->ram_size), }; uint32_t lowmem_end = machine->ram_size < 0x08000000 ? machine->ram_size : 0x08000000; uint32_t cur_lowmem = QEMU_ALIGN_UP(lowmem_end / 2, 4096); rom = g_malloc(sizeof(*rom)); memory_region_init_ram(rom, NULL, "lx60.sram", board->sram_size, &error_abort); vmstate_register_ram_global(rom); memory_region_add_subregion(system_memory, 0xfe000000, rom); if (kernel_cmdline) { bp_size += get_tag_size(strlen(kernel_cmdline) + 1); } if (dtb_filename) { bp_size += get_tag_size(sizeof(uint32_t)); } if (initrd_filename) { bp_size += get_tag_size(sizeof(BpMemInfo)); } tagptr = (tagptr - bp_size) & ~0xff; cur_tagptr = put_tag(tagptr, BP_TAG_FIRST, 0, NULL); cur_tagptr = put_tag(cur_tagptr, BP_TAG_MEMORY, sizeof(memory_location), &memory_location); if (kernel_cmdline) { cur_tagptr = put_tag(cur_tagptr, BP_TAG_COMMAND_LINE, strlen(kernel_cmdline) + 1, kernel_cmdline); } if (dtb_filename) { int fdt_size; void *fdt = load_device_tree(dtb_filename, &fdt_size); uint32_t dtb_addr = tswap32(cur_lowmem); if (!fdt) { error_report("could not load DTB '%s'", dtb_filename); exit(EXIT_FAILURE); } cpu_physical_memory_write(cur_lowmem, fdt, fdt_size); cur_tagptr = put_tag(cur_tagptr, BP_TAG_FDT, sizeof(dtb_addr), &dtb_addr); cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + fdt_size, 4096); } if (initrd_filename) { BpMemInfo initrd_location = { 0 }; int initrd_size = load_ramdisk(initrd_filename, cur_lowmem, lowmem_end - cur_lowmem); if (initrd_size < 0) { initrd_size = load_image_targphys(initrd_filename, cur_lowmem, lowmem_end - cur_lowmem); } if (initrd_size < 0) { error_report("could not load initrd '%s'", initrd_filename); exit(EXIT_FAILURE); } initrd_location.start = tswap32(cur_lowmem); initrd_location.end = tswap32(cur_lowmem + initrd_size); cur_tagptr = put_tag(cur_tagptr, BP_TAG_INITRD, sizeof(initrd_location), &initrd_location); cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + initrd_size, 4096); } cur_tagptr = put_tag(cur_tagptr, BP_TAG_LAST, 0, NULL); env->regs[2] = tagptr; uint64_t elf_entry; uint64_t elf_lowaddr; int success = load_elf(kernel_filename, translate_phys_addr, cpu, &elf_entry, &elf_lowaddr, NULL, be, ELF_MACHINE, 0); if (success > 0) { entry_point = elf_entry; } else { hwaddr ep; int is_linux; success = load_uimage(kernel_filename, &ep, NULL, &is_linux, translate_phys_addr, cpu); if (success > 0 && is_linux) { entry_point = ep; } else { error_report("could not load kernel '%s'", kernel_filename); exit(EXIT_FAILURE); } } if (entry_point != env->pc) { static const uint8_t jx_a0[] = { #ifdef TARGET_WORDS_BIGENDIAN 0x0a, 0, 0, #else 0xa0, 0, 0, #endif }; env->regs[0] = entry_point; cpu_physical_memory_write(env->pc, jx_a0, sizeof(jx_a0)); } } else { if (flash) { MemoryRegion *flash_mr = pflash_cfi01_get_memory(flash); MemoryRegion *flash_io = g_malloc(sizeof(*flash_io)); memory_region_init_alias(flash_io, NULL, "lx60.flash", flash_mr, board->flash_boot_base, board->flash_size - board->flash_boot_base < 0x02000000 ? board->flash_size - board->flash_boot_base : 0x02000000); memory_region_add_subregion(system_memory, 0xfe000000, flash_io); } } }
{ "code": [ " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);" ], "line_no": [ 89, 89, 89, 89, 89, 89, 89, 89, 193, 89, 89, 89, 89, 193, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 193, 89, 89, 89, 193, 193, 89, 89, 89, 89, 89, 89, 89, 89, 193, 89 ] }
static void FUNC_0(const LxBoardDesc *VAR_0, MachineState *VAR_1) { #ifdef TARGET_WORDS_BIGENDIAN int VAR_2 = 1; #else int VAR_2 = 0; #endif MemoryRegion *system_memory = get_system_memory(); XtensaCPU *cpu = NULL; CPUXtensaState *env = NULL; MemoryRegion *ram, *rom, *system_io; DriveInfo *dinfo; pflash_t *flash = NULL; QemuOpts *machine_opts = qemu_get_machine_opts(); const char *VAR_3 = VAR_1->VAR_3; const char *VAR_4 = qemu_opt_get(machine_opts, "kernel"); const char *VAR_5 = qemu_opt_get(machine_opts, "append"); const char *VAR_6 = qemu_opt_get(machine_opts, "dtb"); const char *VAR_7 = qemu_opt_get(machine_opts, "initrd"); int VAR_8; if (!VAR_3) { VAR_3 = XTENSA_DEFAULT_CPU_MODEL; } for (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) { cpu = cpu_xtensa_init(VAR_3); if (cpu == NULL) { error_report("unable to find CPU definition '%s'", VAR_3); exit(EXIT_FAILURE); } env = &cpu->env; env->sregs[PRID] = VAR_8; qemu_register_reset(lx60_reset, cpu); cpu_reset(CPU(cpu)); } ram = g_malloc(sizeof(*ram)); memory_region_init_ram(ram, NULL, "lx60.dram", VAR_1->ram_size, &error_abort); vmstate_register_ram_global(ram); memory_region_add_subregion(system_memory, 0, ram); system_io = g_malloc(sizeof(*system_io)); memory_region_init_io(system_io, NULL, &lx60_io_ops, NULL, "lx60.io", 224 * 1024 * 1024); memory_region_add_subregion(system_memory, 0xf0000000, system_io); lx60_fpga_init(system_io, 0x0d020000); if (nd_table[0].used) { lx60_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000, xtensa_get_extint(env, 1), nd_table); } if (!serial_hds[0]) { serial_hds[0] = qemu_chr_new("serial0", "null", NULL); } serial_mm_init(system_io, 0x0d050020, 2, xtensa_get_extint(env, 0), 115200, serial_hds[0], DEVICE_NATIVE_ENDIAN); dinfo = drive_get(IF_PFLASH, 0, 0); if (dinfo) { flash = pflash_cfi01_register(VAR_0->flash_base, NULL, "lx60.io.flash", VAR_0->flash_size, blk_by_legacy_dinfo(dinfo), VAR_0->flash_sector_size, VAR_0->flash_size / VAR_0->flash_sector_size, 4, 0x0000, 0x0000, 0x0000, 0x0000, VAR_2); if (flash == NULL) { error_report("unable to mount pflash"); exit(EXIT_FAILURE); } } if (VAR_4) { uint32_t entry_point = env->pc; size_t bp_size = 3 * get_tag_size(0); uint32_t tagptr = 0xfe000000 + VAR_0->sram_size; uint32_t cur_tagptr; BpMemInfo memory_location = { .type = tswap32(MEMORY_TYPE_CONVENTIONAL), .start = tswap32(0), .end = tswap32(VAR_1->ram_size), }; uint32_t lowmem_end = VAR_1->ram_size < 0x08000000 ? VAR_1->ram_size : 0x08000000; uint32_t cur_lowmem = QEMU_ALIGN_UP(lowmem_end / 2, 4096); rom = g_malloc(sizeof(*rom)); memory_region_init_ram(rom, NULL, "lx60.sram", VAR_0->sram_size, &error_abort); vmstate_register_ram_global(rom); memory_region_add_subregion(system_memory, 0xfe000000, rom); if (VAR_5) { bp_size += get_tag_size(strlen(VAR_5) + 1); } if (VAR_6) { bp_size += get_tag_size(sizeof(uint32_t)); } if (VAR_7) { bp_size += get_tag_size(sizeof(BpMemInfo)); } tagptr = (tagptr - bp_size) & ~0xff; cur_tagptr = put_tag(tagptr, BP_TAG_FIRST, 0, NULL); cur_tagptr = put_tag(cur_tagptr, BP_TAG_MEMORY, sizeof(memory_location), &memory_location); if (VAR_5) { cur_tagptr = put_tag(cur_tagptr, BP_TAG_COMMAND_LINE, strlen(VAR_5) + 1, VAR_5); } if (VAR_6) { int VAR_9; void *VAR_10 = load_device_tree(VAR_6, &VAR_9); uint32_t dtb_addr = tswap32(cur_lowmem); if (!VAR_10) { error_report("could not load DTB '%s'", VAR_6); exit(EXIT_FAILURE); } cpu_physical_memory_write(cur_lowmem, VAR_10, VAR_9); cur_tagptr = put_tag(cur_tagptr, BP_TAG_FDT, sizeof(dtb_addr), &dtb_addr); cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + VAR_9, 4096); } if (VAR_7) { BpMemInfo initrd_location = { 0 }; int VAR_11 = load_ramdisk(VAR_7, cur_lowmem, lowmem_end - cur_lowmem); if (VAR_11 < 0) { VAR_11 = load_image_targphys(VAR_7, cur_lowmem, lowmem_end - cur_lowmem); } if (VAR_11 < 0) { error_report("could not load initrd '%s'", VAR_7); exit(EXIT_FAILURE); } initrd_location.start = tswap32(cur_lowmem); initrd_location.end = tswap32(cur_lowmem + VAR_11); cur_tagptr = put_tag(cur_tagptr, BP_TAG_INITRD, sizeof(initrd_location), &initrd_location); cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + VAR_11, 4096); } cur_tagptr = put_tag(cur_tagptr, BP_TAG_LAST, 0, NULL); env->regs[2] = tagptr; uint64_t elf_entry; uint64_t elf_lowaddr; int VAR_12 = load_elf(VAR_4, translate_phys_addr, cpu, &elf_entry, &elf_lowaddr, NULL, VAR_2, ELF_MACHINE, 0); if (VAR_12 > 0) { entry_point = elf_entry; } else { hwaddr ep; int VAR_13; VAR_12 = load_uimage(VAR_4, &ep, NULL, &VAR_13, translate_phys_addr, cpu); if (VAR_12 > 0 && VAR_13) { entry_point = ep; } else { error_report("could not load kernel '%s'", VAR_4); exit(EXIT_FAILURE); } } if (entry_point != env->pc) { static const uint8_t VAR_14[] = { #ifdef TARGET_WORDS_BIGENDIAN 0x0a, 0, 0, #else 0xa0, 0, 0, #endif }; env->regs[0] = entry_point; cpu_physical_memory_write(env->pc, VAR_14, sizeof(VAR_14)); } } else { if (flash) { MemoryRegion *flash_mr = pflash_cfi01_get_memory(flash); MemoryRegion *flash_io = g_malloc(sizeof(*flash_io)); memory_region_init_alias(flash_io, NULL, "lx60.flash", flash_mr, VAR_0->flash_boot_base, VAR_0->flash_size - VAR_0->flash_boot_base < 0x02000000 ? VAR_0->flash_size - VAR_0->flash_boot_base : 0x02000000); memory_region_add_subregion(system_memory, 0xfe000000, flash_io); } } }
[ "static void FUNC_0(const LxBoardDesc *VAR_0, MachineState *VAR_1)\n{", "#ifdef TARGET_WORDS_BIGENDIAN\nint VAR_2 = 1;", "#else\nint VAR_2 = 0;", "#endif\nMemoryRegion *system_memory = get_system_memory();", "XtensaCPU *cpu = NULL;", "CPUXtensaState *env = NULL;", "MemoryRegion *ram, *rom, *system_io;", "DriveInfo *dinfo;", "pflash_t *flash = NULL;", "QemuOpts *machine_opts = qemu_get_machine_opts();", "const char *VAR_3 = VAR_1->VAR_3;", "const char *VAR_4 = qemu_opt_get(machine_opts, \"kernel\");", "const char *VAR_5 = qemu_opt_get(machine_opts, \"append\");", "const char *VAR_6 = qemu_opt_get(machine_opts, \"dtb\");", "const char *VAR_7 = qemu_opt_get(machine_opts, \"initrd\");", "int VAR_8;", "if (!VAR_3) {", "VAR_3 = XTENSA_DEFAULT_CPU_MODEL;", "}", "for (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) {", "cpu = cpu_xtensa_init(VAR_3);", "if (cpu == NULL) {", "error_report(\"unable to find CPU definition '%s'\",\nVAR_3);", "exit(EXIT_FAILURE);", "}", "env = &cpu->env;", "env->sregs[PRID] = VAR_8;", "qemu_register_reset(lx60_reset, cpu);", "cpu_reset(CPU(cpu));", "}", "ram = g_malloc(sizeof(*ram));", "memory_region_init_ram(ram, NULL, \"lx60.dram\", VAR_1->ram_size,\n&error_abort);", "vmstate_register_ram_global(ram);", "memory_region_add_subregion(system_memory, 0, ram);", "system_io = g_malloc(sizeof(*system_io));", "memory_region_init_io(system_io, NULL, &lx60_io_ops, NULL, \"lx60.io\",\n224 * 1024 * 1024);", "memory_region_add_subregion(system_memory, 0xf0000000, system_io);", "lx60_fpga_init(system_io, 0x0d020000);", "if (nd_table[0].used) {", "lx60_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000,\nxtensa_get_extint(env, 1), nd_table);", "}", "if (!serial_hds[0]) {", "serial_hds[0] = qemu_chr_new(\"serial0\", \"null\", NULL);", "}", "serial_mm_init(system_io, 0x0d050020, 2, xtensa_get_extint(env, 0),\n115200, serial_hds[0], DEVICE_NATIVE_ENDIAN);", "dinfo = drive_get(IF_PFLASH, 0, 0);", "if (dinfo) {", "flash = pflash_cfi01_register(VAR_0->flash_base,\nNULL, \"lx60.io.flash\", VAR_0->flash_size,\nblk_by_legacy_dinfo(dinfo),\nVAR_0->flash_sector_size,\nVAR_0->flash_size / VAR_0->flash_sector_size,\n4, 0x0000, 0x0000, 0x0000, 0x0000, VAR_2);", "if (flash == NULL) {", "error_report(\"unable to mount pflash\");", "exit(EXIT_FAILURE);", "}", "}", "if (VAR_4) {", "uint32_t entry_point = env->pc;", "size_t bp_size = 3 * get_tag_size(0);", "uint32_t tagptr = 0xfe000000 + VAR_0->sram_size;", "uint32_t cur_tagptr;", "BpMemInfo memory_location = {", ".type = tswap32(MEMORY_TYPE_CONVENTIONAL),\n.start = tswap32(0),\n.end = tswap32(VAR_1->ram_size),\n};", "uint32_t lowmem_end = VAR_1->ram_size < 0x08000000 ?\nVAR_1->ram_size : 0x08000000;", "uint32_t cur_lowmem = QEMU_ALIGN_UP(lowmem_end / 2, 4096);", "rom = g_malloc(sizeof(*rom));", "memory_region_init_ram(rom, NULL, \"lx60.sram\", VAR_0->sram_size,\n&error_abort);", "vmstate_register_ram_global(rom);", "memory_region_add_subregion(system_memory, 0xfe000000, rom);", "if (VAR_5) {", "bp_size += get_tag_size(strlen(VAR_5) + 1);", "}", "if (VAR_6) {", "bp_size += get_tag_size(sizeof(uint32_t));", "}", "if (VAR_7) {", "bp_size += get_tag_size(sizeof(BpMemInfo));", "}", "tagptr = (tagptr - bp_size) & ~0xff;", "cur_tagptr = put_tag(tagptr, BP_TAG_FIRST, 0, NULL);", "cur_tagptr = put_tag(cur_tagptr, BP_TAG_MEMORY,\nsizeof(memory_location), &memory_location);", "if (VAR_5) {", "cur_tagptr = put_tag(cur_tagptr, BP_TAG_COMMAND_LINE,\nstrlen(VAR_5) + 1, VAR_5);", "}", "if (VAR_6) {", "int VAR_9;", "void *VAR_10 = load_device_tree(VAR_6, &VAR_9);", "uint32_t dtb_addr = tswap32(cur_lowmem);", "if (!VAR_10) {", "error_report(\"could not load DTB '%s'\", VAR_6);", "exit(EXIT_FAILURE);", "}", "cpu_physical_memory_write(cur_lowmem, VAR_10, VAR_9);", "cur_tagptr = put_tag(cur_tagptr, BP_TAG_FDT,\nsizeof(dtb_addr), &dtb_addr);", "cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + VAR_9, 4096);", "}", "if (VAR_7) {", "BpMemInfo initrd_location = { 0 };", "int VAR_11 = load_ramdisk(VAR_7, cur_lowmem,\nlowmem_end - cur_lowmem);", "if (VAR_11 < 0) {", "VAR_11 = load_image_targphys(VAR_7,\ncur_lowmem,\nlowmem_end - cur_lowmem);", "}", "if (VAR_11 < 0) {", "error_report(\"could not load initrd '%s'\", VAR_7);", "exit(EXIT_FAILURE);", "}", "initrd_location.start = tswap32(cur_lowmem);", "initrd_location.end = tswap32(cur_lowmem + VAR_11);", "cur_tagptr = put_tag(cur_tagptr, BP_TAG_INITRD,\nsizeof(initrd_location), &initrd_location);", "cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + VAR_11, 4096);", "}", "cur_tagptr = put_tag(cur_tagptr, BP_TAG_LAST, 0, NULL);", "env->regs[2] = tagptr;", "uint64_t elf_entry;", "uint64_t elf_lowaddr;", "int VAR_12 = load_elf(VAR_4, translate_phys_addr, cpu,\n&elf_entry, &elf_lowaddr, NULL, VAR_2, ELF_MACHINE, 0);", "if (VAR_12 > 0) {", "entry_point = elf_entry;", "} else {", "hwaddr ep;", "int VAR_13;", "VAR_12 = load_uimage(VAR_4, &ep, NULL, &VAR_13,\ntranslate_phys_addr, cpu);", "if (VAR_12 > 0 && VAR_13) {", "entry_point = ep;", "} else {", "error_report(\"could not load kernel '%s'\",\nVAR_4);", "exit(EXIT_FAILURE);", "}", "}", "if (entry_point != env->pc) {", "static const uint8_t VAR_14[] = {", "#ifdef TARGET_WORDS_BIGENDIAN\n0x0a, 0, 0,\n#else\n0xa0, 0, 0,\n#endif\n};", "env->regs[0] = entry_point;", "cpu_physical_memory_write(env->pc, VAR_14, sizeof(VAR_14));", "}", "} else {", "if (flash) {", "MemoryRegion *flash_mr = pflash_cfi01_get_memory(flash);", "MemoryRegion *flash_io = g_malloc(sizeof(*flash_io));", "memory_region_init_alias(flash_io, NULL, \"lx60.flash\",\nflash_mr, VAR_0->flash_boot_base,\nVAR_0->flash_size - VAR_0->flash_boot_base < 0x02000000 ?\nVAR_0->flash_size - VAR_0->flash_boot_base : 0x02000000);", "memory_region_add_subregion(system_memory, 0xfe000000,\nflash_io);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 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, 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, 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 79 ], [ 81 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 125, 127 ], [ 131 ], [ 133 ], [ 135, 137, 139, 141, 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175, 177, 179 ], [ 181, 183 ], [ 185 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 223 ], [ 225 ], [ 227, 229 ], [ 233 ], [ 235, 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 261 ], [ 263, 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275, 277 ], [ 281 ], [ 283, 285, 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303, 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 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 ], [ 387, 389, 391, 393 ], [ 395, 397 ], [ 399 ], [ 401 ], [ 403 ] ]
11,483
USBDevice *usb_bt_init(HCIInfo *hci) { USBDevice *dev; struct USBBtState *s; if (!hci) dev = usb_create_simple(NULL /* FIXME */, "usb-bt-dongle"); s = DO_UPCAST(struct USBBtState, dev, dev); s->dev.opaque = s; s->hci = hci; s->hci->opaque = s; s->hci->evt_recv = usb_bt_out_hci_packet_event; s->hci->acl_recv = usb_bt_out_hci_packet_acl; usb_bt_handle_reset(&s->dev); return dev;
true
qemu
2af2a1b8d05a1a64c5005ed930137632b9d5aa22
USBDevice *usb_bt_init(HCIInfo *hci) { USBDevice *dev; struct USBBtState *s; if (!hci) dev = usb_create_simple(NULL , "usb-bt-dongle"); s = DO_UPCAST(struct USBBtState, dev, dev); s->dev.opaque = s; s->hci = hci; s->hci->opaque = s; s->hci->evt_recv = usb_bt_out_hci_packet_event; s->hci->acl_recv = usb_bt_out_hci_packet_acl; usb_bt_handle_reset(&s->dev); return dev;
{ "code": [], "line_no": [] }
USBDevice *FUNC_0(HCIInfo *hci) { USBDevice *dev; struct USBBtState *VAR_0; if (!hci) dev = usb_create_simple(NULL , "usb-bt-dongle"); VAR_0 = DO_UPCAST(struct USBBtState, dev, dev); VAR_0->dev.opaque = VAR_0; VAR_0->hci = hci; VAR_0->hci->opaque = VAR_0; VAR_0->hci->evt_recv = usb_bt_out_hci_packet_event; VAR_0->hci->acl_recv = usb_bt_out_hci_packet_acl; usb_bt_handle_reset(&VAR_0->dev); return dev;
[ "USBDevice *FUNC_0(HCIInfo *hci)\n{", "USBDevice *dev;", "struct USBBtState *VAR_0;", "if (!hci)\ndev = usb_create_simple(NULL , \"usb-bt-dongle\");", "VAR_0 = DO_UPCAST(struct USBBtState, dev, dev);", "VAR_0->dev.opaque = VAR_0;", "VAR_0->hci = hci;", "VAR_0->hci->opaque = VAR_0;", "VAR_0->hci->evt_recv = usb_bt_out_hci_packet_event;", "VAR_0->hci->acl_recv = usb_bt_out_hci_packet_acl;", "usb_bt_handle_reset(&VAR_0->dev);", "return dev;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 14 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ] ]
11,484
static void term_up_char(void) { int idx; if (term_hist_entry == 0) return; if (term_hist_entry == -1) { /* Find latest entry */ for (idx = 0; idx < TERM_MAX_CMDS; idx++) { if (term_history[idx] == NULL) break; } term_hist_entry = idx; } term_hist_entry--; if (term_hist_entry >= 0) { strcpy(term_cmd_buf, term_history[term_hist_entry]); term_printf("\n"); term_print_cmdline(term_cmd_buf); term_cmd_buf_index = term_cmd_buf_size = strlen(term_cmd_buf); } }
true
qemu
95ce326e5b47b4b841849f8a2ac7b96d6e204dfb
static void term_up_char(void) { int idx; if (term_hist_entry == 0) return; if (term_hist_entry == -1) { for (idx = 0; idx < TERM_MAX_CMDS; idx++) { if (term_history[idx] == NULL) break; } term_hist_entry = idx; } term_hist_entry--; if (term_hist_entry >= 0) { strcpy(term_cmd_buf, term_history[term_hist_entry]); term_printf("\n"); term_print_cmdline(term_cmd_buf); term_cmd_buf_index = term_cmd_buf_size = strlen(term_cmd_buf); } }
{ "code": [ "\tstrcpy(term_cmd_buf, term_history[term_hist_entry]);", "\tstrcpy(term_cmd_buf, term_history[term_hist_entry]);" ], "line_no": [ 33, 33 ] }
static void FUNC_0(void) { int VAR_0; if (term_hist_entry == 0) return; if (term_hist_entry == -1) { for (VAR_0 = 0; VAR_0 < TERM_MAX_CMDS; VAR_0++) { if (term_history[VAR_0] == NULL) break; } term_hist_entry = VAR_0; } term_hist_entry--; if (term_hist_entry >= 0) { strcpy(term_cmd_buf, term_history[term_hist_entry]); term_printf("\n"); term_print_cmdline(term_cmd_buf); term_cmd_buf_index = term_cmd_buf_size = strlen(term_cmd_buf); } }
[ "static void FUNC_0(void)\n{", "int VAR_0;", "if (term_hist_entry == 0)\nreturn;", "if (term_hist_entry == -1) {", "for (VAR_0 = 0; VAR_0 < TERM_MAX_CMDS; VAR_0++) {", "if (term_history[VAR_0] == NULL)\nbreak;", "}", "term_hist_entry = VAR_0;", "}", "term_hist_entry--;", "if (term_hist_entry >= 0) {", "strcpy(term_cmd_buf, term_history[term_hist_entry]);", "term_printf(\"\\n\");", "term_print_cmdline(term_cmd_buf);", "term_cmd_buf_index = term_cmd_buf_size = strlen(term_cmd_buf);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
11,485
static int vf_open(vf_instance_t *vf, char *args) { vf->config=config; vf->query_format=query_format; vf->put_image=put_image; vf->uninit=uninit; vf->priv = calloc(1, sizeof (struct vf_priv_s)); vf->priv->skipline = 0; vf->priv->scalew = 1; vf->priv->scaleh = 2; if (args) sscanf(args, "%d:%d:%d", &vf->priv->skipline, &vf->priv->scalew, &vf->priv->scaleh); return 1; }
true
FFmpeg
2f11aa141a01f97c5d2a015bd9dbdb27314b79c4
static int vf_open(vf_instance_t *vf, char *args) { vf->config=config; vf->query_format=query_format; vf->put_image=put_image; vf->uninit=uninit; vf->priv = calloc(1, sizeof (struct vf_priv_s)); vf->priv->skipline = 0; vf->priv->scalew = 1; vf->priv->scaleh = 2; if (args) sscanf(args, "%d:%d:%d", &vf->priv->skipline, &vf->priv->scalew, &vf->priv->scaleh); return 1; }
{ "code": [ "static int vf_open(vf_instance_t *vf, char *args)", " vf->config=config;", " vf->query_format=query_format;", " vf->put_image=put_image;", " vf->uninit=uninit;", " vf->priv = calloc(1, sizeof (struct vf_priv_s));", " vf->priv->skipline = 0;", " vf->priv->scalew = 1;", " vf->priv->scaleh = 2;", " if (args) sscanf(args, \"%d:%d:%d\", &vf->priv->skipline, &vf->priv->scalew, &vf->priv->scaleh);", " return 1;" ], "line_no": [ 1, 5, 7, 9, 11, 15, 17, 19, 21, 23, 27 ] }
static int FUNC_0(vf_instance_t *VAR_0, char *VAR_1) { VAR_0->config=config; VAR_0->query_format=query_format; VAR_0->put_image=put_image; VAR_0->uninit=uninit; VAR_0->priv = calloc(1, sizeof (struct vf_priv_s)); VAR_0->priv->skipline = 0; VAR_0->priv->scalew = 1; VAR_0->priv->scaleh = 2; if (VAR_1) sscanf(VAR_1, "%d:%d:%d", &VAR_0->priv->skipline, &VAR_0->priv->scalew, &VAR_0->priv->scaleh); return 1; }
[ "static int FUNC_0(vf_instance_t *VAR_0, char *VAR_1)\n{", "VAR_0->config=config;", "VAR_0->query_format=query_format;", "VAR_0->put_image=put_image;", "VAR_0->uninit=uninit;", "VAR_0->priv = calloc(1, sizeof (struct vf_priv_s));", "VAR_0->priv->skipline = 0;", "VAR_0->priv->scalew = 1;", "VAR_0->priv->scaleh = 2;", "if (VAR_1) sscanf(VAR_1, \"%d:%d:%d\", &VAR_0->priv->skipline, &VAR_0->priv->scalew, &VAR_0->priv->scaleh);", "return 1;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
11,486
static void coroutine_fn v9fs_link(void *opaque) { V9fsPDU *pdu = opaque; int32_t dfid, oldfid; V9fsFidState *dfidp, *oldfidp; V9fsString name; size_t offset = 7; int err = 0; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, "dds", &dfid, &oldfid, &name); if (err < 0) { goto out_nofid; } trace_v9fs_link(pdu->tag, pdu->id, dfid, oldfid, name.data); if (name_is_illegal(name.data)) { err = -ENOENT; goto out_nofid; } if (!strcmp(".", name.data) || !strcmp("..", name.data)) { err = -EEXIST; goto out_nofid; } dfidp = get_fid(pdu, dfid); if (dfidp == NULL) { err = -ENOENT; goto out_nofid; } oldfidp = get_fid(pdu, oldfid); if (oldfidp == NULL) { err = -ENOENT; goto out; } err = v9fs_co_link(pdu, oldfidp, dfidp, &name); if (!err) { err = offset; } out: put_fid(pdu, dfidp); out_nofid: v9fs_string_free(&name); pdu_complete(pdu, err); }
true
qemu
4c1586787ff43c9acd18a56c12d720e3e6be9f7c
static void coroutine_fn v9fs_link(void *opaque) { V9fsPDU *pdu = opaque; int32_t dfid, oldfid; V9fsFidState *dfidp, *oldfidp; V9fsString name; size_t offset = 7; int err = 0; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, "dds", &dfid, &oldfid, &name); if (err < 0) { goto out_nofid; } trace_v9fs_link(pdu->tag, pdu->id, dfid, oldfid, name.data); if (name_is_illegal(name.data)) { err = -ENOENT; goto out_nofid; } if (!strcmp(".", name.data) || !strcmp("..", name.data)) { err = -EEXIST; goto out_nofid; } dfidp = get_fid(pdu, dfid); if (dfidp == NULL) { err = -ENOENT; goto out_nofid; } oldfidp = get_fid(pdu, oldfid); if (oldfidp == NULL) { err = -ENOENT; goto out; } err = v9fs_co_link(pdu, oldfidp, dfidp, &name); if (!err) { err = offset; } out: put_fid(pdu, dfidp); out_nofid: v9fs_string_free(&name); pdu_complete(pdu, err); }
{ "code": [], "line_no": [] }
static void VAR_0 v9fs_link(void *opaque) { V9fsPDU *pdu = opaque; int32_t dfid, oldfid; V9fsFidState *dfidp, *oldfidp; V9fsString name; size_t offset = 7; int err = 0; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, "dds", &dfid, &oldfid, &name); if (err < 0) { goto out_nofid; } trace_v9fs_link(pdu->tag, pdu->id, dfid, oldfid, name.data); if (name_is_illegal(name.data)) { err = -ENOENT; goto out_nofid; } if (!strcmp(".", name.data) || !strcmp("..", name.data)) { err = -EEXIST; goto out_nofid; } dfidp = get_fid(pdu, dfid); if (dfidp == NULL) { err = -ENOENT; goto out_nofid; } oldfidp = get_fid(pdu, oldfid); if (oldfidp == NULL) { err = -ENOENT; goto out; } err = v9fs_co_link(pdu, oldfidp, dfidp, &name); if (!err) { err = offset; } out: put_fid(pdu, dfidp); out_nofid: v9fs_string_free(&name); pdu_complete(pdu, err); }
[ "static void VAR_0 v9fs_link(void *opaque)\n{", "V9fsPDU *pdu = opaque;", "int32_t dfid, oldfid;", "V9fsFidState *dfidp, *oldfidp;", "V9fsString name;", "size_t offset = 7;", "int err = 0;", "v9fs_string_init(&name);", "err = pdu_unmarshal(pdu, offset, \"dds\", &dfid, &oldfid, &name);", "if (err < 0) {", "goto out_nofid;", "}", "trace_v9fs_link(pdu->tag, pdu->id, dfid, oldfid, name.data);", "if (name_is_illegal(name.data)) {", "err = -ENOENT;", "goto out_nofid;", "}", "if (!strcmp(\".\", name.data) || !strcmp(\"..\", name.data)) {", "err = -EEXIST;", "goto out_nofid;", "}", "dfidp = get_fid(pdu, dfid);", "if (dfidp == NULL) {", "err = -ENOENT;", "goto out_nofid;", "}", "oldfidp = get_fid(pdu, oldfid);", "if (oldfidp == NULL) {", "err = -ENOENT;", "goto out;", "}", "err = v9fs_co_link(pdu, oldfidp, dfidp, &name);", "if (!err) {", "err = offset;", "}", "out:\nput_fid(pdu, dfidp);", "out_nofid:\nv9fs_string_free(&name);", "pdu_complete(pdu, err);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 84, 86 ], [ 88, 90 ], [ 92 ], [ 94 ] ]
11,487
static void port92_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->no_user = 1; dc->realize = port92_realizefn; dc->reset = port92_reset; dc->vmsd = &vmstate_port92_isa; }
true
qemu
efec3dd631d94160288392721a5f9c39e50fb2bc
static void port92_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->no_user = 1; dc->realize = port92_realizefn; dc->reset = port92_reset; dc->vmsd = &vmstate_port92_isa; }
{ "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": [ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->no_user = 1; dc->realize = port92_realizefn; dc->reset = port92_reset; dc->vmsd = &vmstate_port92_isa; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->no_user = 1;", "dc->realize = port92_realizefn;", "dc->reset = port92_reset;", "dc->vmsd = &vmstate_port92_isa;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
11,489
static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ int y, h_size; if(c->srcFormat == PIX_FMT_YUV422P){ srcStride[1] *= 2; srcStride[2] *= 2; } h_size= (c->dstW+7)&~7; if(h_size*2 > FFABS(dstStride[0])) h_size-=8; __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ ); //printf("%X %X %X %X %X %X %X %X %X %X\n", (int)&c->redDither, (int)&b5Dither, (int)src[0], (int)src[1], (int)src[2], (int)dst[0], //srcStride[0],srcStride[1],srcStride[2],dstStride[0]); for (y= 0; y<srcSliceH; y++ ) { uint8_t *_image = dst[0] + (y+srcSliceY)*dstStride[0]; uint8_t *_py = src[0] + y*srcStride[0]; uint8_t *_pu = src[1] + (y>>1)*srcStride[1]; uint8_t *_pv = src[2] + (y>>1)*srcStride[2]; long index= -h_size/2; b5Dither= dither8[y&1]; g6Dither= dither4[y&1]; g5Dither= dither8[y&1]; r5Dither= dither8[(y+1)&1]; /* this mmx assembly code deals with SINGLE scan line at a time, it convert 8 pixels in each iteration */ __asm__ __volatile__ ( /* load data for start of next scan line */ "movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ "movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ "movq (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ // ".balign 16 \n\t" "1: \n\t" YUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm0 \n\t" "paddusb "MANGLE(g5Dither)", %%mm2 \n\t" "paddusb "MANGLE(r5Dither)", %%mm1 \n\t" #endif /* mask unneeded bits off */ "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */ "pand "MANGLE(mmx_redmask)", %%mm2;" /* g7g6g5g4 g3_0_0_0 g7g6g5g4 g3_0_0_0 */ "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */ "psrlw $3,%%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */ "psrlw $1,%%mm1;" /* 0_r7r6r5 r4r3_0_0 0_r7r6r5 r4r3_0_0 */ "pxor %%mm4, %%mm4;" /* zero mm4 */ "movq %%mm0, %%mm5;" /* Copy B7-B0 */ "movq %%mm2, %%mm7;" /* Copy G7-G0 */ /* convert rgb24 plane to rgb16 pack for pixel 0-3 */ "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3_0_0_0 */ "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */ "psllw $2, %%mm2;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */ "por %%mm2, %%mm0;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */ "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ MOVNTQ " %%mm0, (%1);" /* store pixel 0-3 */ /* convert rgb24 plane to rgb16 pack for pixel 0-3 */ "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 0_g7g6g5 g4g3_0_0 */ "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */ "psllw $2, %%mm7;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */ "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ "por %%mm7, %%mm5;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */ "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */ "add $16, %1 \n\t" "add $4, %0 \n\t" " js 1b \n\t" : "+r" (index), "+r" (_image) : "r" (_pu - index), "r" (_pv - index), "r"(&c->redDither), "r" (_py - 2*index) ); } __asm__ __volatile__ (EMMS); return srcSliceH; }
true
FFmpeg
428098165de4c3edfe42c1b7f00627d287015863
static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ int y, h_size; if(c->srcFormat == PIX_FMT_YUV422P){ srcStride[1] *= 2; srcStride[2] *= 2; } h_size= (c->dstW+7)&~7; if(h_size*2 > FFABS(dstStride[0])) h_size-=8; __asm__ __volatile__ ("pxor %mm4, %mm4;" ); for (y= 0; y<srcSliceH; y++ ) { uint8_t *_image = dst[0] + (y+srcSliceY)*dstStride[0]; uint8_t *_py = src[0] + y*srcStride[0]; uint8_t *_pu = src[1] + (y>>1)*srcStride[1]; uint8_t *_pv = src[2] + (y>>1)*srcStride[2]; long index= -h_size/2; b5Dither= dither8[y&1]; g6Dither= dither4[y&1]; g5Dither= dither8[y&1]; r5Dither= dither8[(y+1)&1]; __asm__ __volatile__ ( "movd (%2, %0), %%mm0;" "movd (%3, %0), %%mm1;" "movq (%5, %0, 2), %%mm6;" "1: \n\t" YUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm0 \n\t" "paddusb "MANGLE(g5Dither)", %%mm2 \n\t" "paddusb "MANGLE(r5Dither)", %%mm1 \n\t" #endif "pand "MANGLE(mmx_redmask)", %%mm0;" "pand "MANGLE(mmx_redmask)", %%mm2;" "pand "MANGLE(mmx_redmask)", %%mm1;" "psrlw $3,%%mm0;" "psrlw $1,%%mm1;" "pxor %%mm4, %%mm4;" "movq %%mm0, %%mm5;" "movq %%mm2, %%mm7;" "punpcklbw %%mm4, %%mm2;" "punpcklbw %%mm1, %%mm0;" "psllw $2, %%mm2;" "por %%mm2, %%mm0;" "movq 8 (%5, %0, 2), %%mm6;" MOVNTQ " %%mm0, (%1);" "punpckhbw %%mm4, %%mm7;" "punpckhbw %%mm1, %%mm5;" "psllw $2, %%mm7;" "movd 4 (%2, %0), %%mm0;" "por %%mm7, %%mm5;" "movd 4 (%3, %0), %%mm1;" MOVNTQ " %%mm5, 8 (%1);" "add $16, %1 \n\t" "add $4, %0 \n\t" " js 1b \n\t" : "+r" (index), "+r" (_image) : "r" (_pu - index), "r" (_pv - index), "r"(&c->redDither), "r" (_py - 2*index) ); } __asm__ __volatile__ (EMMS); return srcSliceH; }
{ "code": [ " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;", " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;", " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;", " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;", "\tuint8_t *_image = dst[0] + (y+srcSliceY)*dstStride[0];", "\tuint8_t *_py = src[0] + y*srcStride[0];", "\tuint8_t *_pu = src[1] + (y>>1)*srcStride[1];", "\tuint8_t *_pv = src[2] + (y>>1)*srcStride[2];", "\tlong index= -h_size/2;", "\tb5Dither= dither8[y&1];", "\tg6Dither= dither4[y&1];", "\tg5Dither= dither8[y&1];", "\tr5Dither= dither8[(y+1)&1];", "\t __asm__ __volatile__ (", "\t\t \"1:\t\t\t\t\\n\\t\"", "\t\t \"add $16, %1\t\t\t\\n\\t\"", "\t\t \"add $4, %0\t\t\t\\n\\t\"", "\t\t \" js 1b\t\t\t\t\\n\\t\"", "\t\t : \"+r\" (index), \"+r\" (_image)", "\t\t : \"r\" (_pu - index), \"r\" (_pv - index), \"r\"(&c->redDither), \"r\" (_py - 2*index)", "\t\t );", " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;", "\tuint8_t *_image = dst[0] + (y+srcSliceY)*dstStride[0];", "\tuint8_t *_py = src[0] + y*srcStride[0];", "\tuint8_t *_pu = src[1] + (y>>1)*srcStride[1];", "\tuint8_t *_pv = src[2] + (y>>1)*srcStride[2];", "\tlong index= -h_size/2;", "\tb5Dither= dither8[y&1];", "\tg6Dither= dither4[y&1];", "\tg5Dither= dither8[y&1];", "\tr5Dither= dither8[(y+1)&1];", "\t __asm__ __volatile__ (", "\t\t \"1:\t\t\t\t\\n\\t\"", "\t\t\t\"paddusb \"MANGLE(b5Dither)\", %%mm0\t\\n\\t\"", "\t\t\t\"paddusb \"MANGLE(g5Dither)\", %%mm2\t\\n\\t\"", "\t\t\t\"paddusb \"MANGLE(r5Dither)\", %%mm1\t\\n\\t\"", "\t\t \"add $16, %1\t\t\t\\n\\t\"", "\t\t \"add $4, %0\t\t\t\\n\\t\"", "\t\t \" js 1b\t\t\t\t\\n\\t\"", "\t\t : \"+r\" (index), \"+r\" (_image)", "\t\t : \"r\" (_pu - index), \"r\" (_pv - index), \"r\"(&c->redDither), \"r\" (_py - 2*index)", "\t\t );", " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;", "\tuint8_t *_image = dst[0] + (y+srcSliceY)*dstStride[0];", "\tuint8_t *_py = src[0] + y*srcStride[0];", "\tuint8_t *_pu = src[1] + (y>>1)*srcStride[1];", "\tuint8_t *_pv = src[2] + (y>>1)*srcStride[2];", "\tlong index= -h_size/2;", "\t __asm__ __volatile__ (", "\t\t \"1:\t\t\t\t\\n\\t\"", "\t\t \"add $4, %0\t\t\t\\n\\t\"", "\t\t \" js 1b\t\t\t\t\\n\\t\"", "\t\t : \"+r\" (index), \"+r\" (_image)", "\t\t : \"r\" (_pu - index), \"r\" (_pv - index), \"r\"(&c->redDither), \"r\" (_py - 2*index)", "\t\t );", " int srcSliceH, uint8_t* dst[], int dstStride[]){", "\tsrcStride[1] *= 2;", "\tsrcStride[2] *= 2;", "\tuint8_t *_image = dst[0] + (y+srcSliceY)*dstStride[0];", "\tuint8_t *_py = src[0] + y*srcStride[0];", "\tuint8_t *_pu = src[1] + (y>>1)*srcStride[1];", "\tuint8_t *_pv = src[2] + (y>>1)*srcStride[2];", "\tlong index= -h_size/2;", "\t __asm__ __volatile__ (", "\t\t \"1:\t\t\t\t\\n\\t\"", "\t\t \"add $4, %0\t\t\t\\n\\t\"", "\t\t \" js 1b\t\t\t\t\\n\\t\"", "\t\t : \"+r\" (index), \"+r\" (_image)", "\t\t : \"r\" (_pu - index), \"r\" (_pv - index), \"r\"(&c->redDither), \"r\" (_py - 2*index)", "\t\t );" ], "line_no": [ 3, 11, 13, 3, 11, 13, 3, 11, 13, 3, 11, 13, 33, 35, 37, 39, 41, 45, 47, 49, 51, 57, 69, 155, 157, 159, 161, 163, 165, 3, 11, 13, 33, 35, 37, 39, 41, 45, 47, 49, 51, 57, 69, 77, 79, 81, 155, 157, 159, 161, 163, 165, 3, 11, 13, 33, 35, 37, 39, 41, 57, 69, 157, 159, 161, 163, 165, 3, 11, 13, 33, 35, 37, 39, 41, 57, 69, 157, 159, 161, 163, 165 ] }
static inline int FUNC_0(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ int VAR_0, VAR_1; if(c->srcFormat == PIX_FMT_YUV422P){ srcStride[1] *= 2; srcStride[2] *= 2; } VAR_1= (c->dstW+7)&~7; if(VAR_1*2 > FFABS(dstStride[0])) VAR_1-=8; __asm__ __volatile__ ("pxor %mm4, %mm4;" ); for (VAR_0= 0; VAR_0<srcSliceH; VAR_0++ ) { uint8_t *_image = dst[0] + (VAR_0+srcSliceY)*dstStride[0]; uint8_t *_py = src[0] + VAR_0*srcStride[0]; uint8_t *_pu = src[1] + (VAR_0>>1)*srcStride[1]; uint8_t *_pv = src[2] + (VAR_0>>1)*srcStride[2]; long index= -VAR_1/2; b5Dither= dither8[VAR_0&1]; g6Dither= dither4[VAR_0&1]; g5Dither= dither8[VAR_0&1]; r5Dither= dither8[(VAR_0+1)&1]; __asm__ __volatile__ ( "movd (%2, %0), %%mm0;" "movd (%3, %0), %%mm1;" "movq (%5, %0, 2), %%mm6;" "1: \n\t" YUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm0 \n\t" "paddusb "MANGLE(g5Dither)", %%mm2 \n\t" "paddusb "MANGLE(r5Dither)", %%mm1 \n\t" #endif "pand "MANGLE(mmx_redmask)", %%mm0;" "pand "MANGLE(mmx_redmask)", %%mm2;" "pand "MANGLE(mmx_redmask)", %%mm1;" "psrlw $3,%%mm0;" "psrlw $1,%%mm1;" "pxor %%mm4, %%mm4;" "movq %%mm0, %%mm5;" "movq %%mm2, %%mm7;" "punpcklbw %%mm4, %%mm2;" "punpcklbw %%mm1, %%mm0;" "psllw $2, %%mm2;" "por %%mm2, %%mm0;" "movq 8 (%5, %0, 2), %%mm6;" MOVNTQ " %%mm0, (%1);" "punpckhbw %%mm4, %%mm7;" "punpckhbw %%mm1, %%mm5;" "psllw $2, %%mm7;" "movd 4 (%2, %0), %%mm0;" "por %%mm7, %%mm5;" "movd 4 (%3, %0), %%mm1;" MOVNTQ " %%mm5, 8 (%1);" "add $16, %1 \n\t" "add $4, %0 \n\t" " js 1b \n\t" : "+r" (index), "+r" (_image) : "r" (_pu - index), "r" (_pv - index), "r"(&c->redDither), "r" (_py - 2*index) ); } __asm__ __volatile__ (EMMS); return srcSliceH; }
[ "static inline int FUNC_0(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,\nint srcSliceH, uint8_t* dst[], int dstStride[]){", "int VAR_0, VAR_1;", "if(c->srcFormat == PIX_FMT_YUV422P){", "srcStride[1] *= 2;", "srcStride[2] *= 2;", "}", "VAR_1= (c->dstW+7)&~7;", "if(VAR_1*2 > FFABS(dstStride[0])) VAR_1-=8;", "__asm__ __volatile__ (\"pxor %mm4, %mm4;\" );", "for (VAR_0= 0; VAR_0<srcSliceH; VAR_0++ ) {", "uint8_t *_image = dst[0] + (VAR_0+srcSliceY)*dstStride[0];", "uint8_t *_py = src[0] + VAR_0*srcStride[0];", "uint8_t *_pu = src[1] + (VAR_0>>1)*srcStride[1];", "uint8_t *_pv = src[2] + (VAR_0>>1)*srcStride[2];", "long index= -VAR_1/2;", "b5Dither= dither8[VAR_0&1];", "g6Dither= dither4[VAR_0&1];", "g5Dither= dither8[VAR_0&1];", "r5Dither= dither8[(VAR_0+1)&1];", "__asm__ __volatile__ (\n\"movd (%2, %0), %%mm0;\"", "\"movd (%3, %0), %%mm1;\"", "\"movq (%5, %0, 2), %%mm6;\"", "\"1:\t\t\t\t\\n\\t\"\nYUV2RGB\n#ifdef DITHER1XBPP\n\"paddusb \"MANGLE(b5Dither)\", %%mm0\t\\n\\t\"\n\"paddusb \"MANGLE(g5Dither)\", %%mm2\t\\n\\t\"\n\"paddusb \"MANGLE(r5Dither)\", %%mm1\t\\n\\t\"\n#endif\n\"pand \"MANGLE(mmx_redmask)\", %%mm0;\"", "\"pand \"MANGLE(mmx_redmask)\", %%mm2;\"", "\"pand \"MANGLE(mmx_redmask)\", %%mm1;\"", "\"psrlw $3,%%mm0;\"", "\"psrlw $1,%%mm1;\"", "\"pxor %%mm4, %%mm4;\"", "\"movq %%mm0, %%mm5;\"", "\"movq %%mm2, %%mm7;\"", "\"punpcklbw %%mm4, %%mm2;\"", "\"punpcklbw %%mm1, %%mm0;\"", "\"psllw $2, %%mm2;\"", "\"por %%mm2, %%mm0;\"", "\"movq 8 (%5, %0, 2), %%mm6;\"", "MOVNTQ \" %%mm0, (%1);\"", "\"punpckhbw %%mm4, %%mm7;\"", "\"punpckhbw %%mm1, %%mm5;\"", "\"psllw $2, %%mm7;\"", "\"movd 4 (%2, %0), %%mm0;\"", "\"por %%mm7, %%mm5;\"", "\"movd 4 (%3, %0), %%mm1;\"", "MOVNTQ \" %%mm5, 8 (%1);\"", "\"add $16, %1\t\t\t\\n\\t\"\n\"add $4, %0\t\t\t\\n\\t\"\n\" js 1b\t\t\t\t\\n\\t\"\n: \"+r\" (index), \"+r\" (_image)\n: \"r\" (_pu - index), \"r\" (_pv - index), \"r\"(&c->redDither), \"r\" (_py - 2*index)\n);", "}", "__asm__ __volatile__ (EMMS);", "return srcSliceH;", "}" ]
[ 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57, 61 ], [ 63 ], [ 65 ], [ 69, 71, 75, 77, 79, 81, 83, 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 151 ], [ 155, 157, 159, 161, 163, 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ] ]
11,490
void OPPROTO op_subfco (void) { do_subfco(); RETURN(); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
void OPPROTO op_subfco (void) { do_subfco(); RETURN(); }
{ "code": [ " RETURN();", "void OPPROTO op_subfco (void)", " do_subfco();", " RETURN();" ], "line_no": [ 7, 1, 5, 7 ] }
void VAR_0 op_subfco (void) { do_subfco(); RETURN(); }
[ "void VAR_0 op_subfco (void)\n{", "do_subfco();", "RETURN();", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
11,491
void tcg_target_qemu_prologue(TCGContext *s) { /* stmdb sp!, { r9 - r11, lr } */ tcg_out32(s, (COND_AL << 28) | 0x092d4e00); tcg_out_bx(s, COND_AL, TCG_REG_R0); tb_ret_addr = s->code_ptr; /* ldmia sp!, { r9 - r11, pc } */ tcg_out32(s, (COND_AL << 28) | 0x08bd8e00); }
true
qemu
4e17eae9f2ee49833698aae2753c5bb041510870
void tcg_target_qemu_prologue(TCGContext *s) { tcg_out32(s, (COND_AL << 28) | 0x092d4e00); tcg_out_bx(s, COND_AL, TCG_REG_R0); tb_ret_addr = s->code_ptr; tcg_out32(s, (COND_AL << 28) | 0x08bd8e00); }
{ "code": [ " tcg_out32(s, (COND_AL << 28) | 0x092d4e00);", " tcg_out32(s, (COND_AL << 28) | 0x08bd8e00);" ], "line_no": [ 7, 19 ] }
void FUNC_0(TCGContext *VAR_0) { tcg_out32(VAR_0, (COND_AL << 28) | 0x092d4e00); tcg_out_bx(VAR_0, COND_AL, TCG_REG_R0); tb_ret_addr = VAR_0->code_ptr; tcg_out32(VAR_0, (COND_AL << 28) | 0x08bd8e00); }
[ "void FUNC_0(TCGContext *VAR_0)\n{", "tcg_out32(VAR_0, (COND_AL << 28) | 0x092d4e00);", "tcg_out_bx(VAR_0, COND_AL, TCG_REG_R0);", "tb_ret_addr = VAR_0->code_ptr;", "tcg_out32(VAR_0, (COND_AL << 28) | 0x08bd8e00);", "}" ]
[ 0, 1, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 7 ], [ 11 ], [ 13 ], [ 19 ], [ 21 ] ]
11,493
static int scsi_disk_emulate_mode_sense(SCSIRequest *req, uint8_t *outbuf) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); uint64_t nb_sectors; int page, dbd, buflen; uint8_t *p; uint8_t dev_specific_param; dbd = req->cmd.buf[1] & 0x8; page = req->cmd.buf[2] & 0x3f; DPRINTF("Mode Sense (page %d, len %zd)\n", page, req->cmd.xfer); memset(outbuf, 0, req->cmd.xfer); p = outbuf; if (bdrv_is_read_only(s->bs)) { dev_specific_param = 0x80; /* Readonly. */ } else { dev_specific_param = 0x00; } if (req->cmd.buf[0] == MODE_SENSE) { p[1] = 0; /* Default media type. */ p[2] = dev_specific_param; p[3] = 0; /* Block descriptor length. */ p += 4; } else { /* MODE_SENSE_10 */ p[2] = 0; /* Default media type. */ p[3] = dev_specific_param; p[6] = p[7] = 0; /* Block descriptor length. */ p += 8; } bdrv_get_geometry(s->bs, &nb_sectors); if ((~dbd) & nb_sectors) { if (req->cmd.buf[0] == MODE_SENSE) { outbuf[3] = 8; /* Block descriptor length */ } else { /* MODE_SENSE_10 */ outbuf[7] = 8; /* Block descriptor length */ } nb_sectors /= s->cluster_size; nb_sectors--; if (nb_sectors > 0xffffff) nb_sectors = 0xffffff; p[0] = 0; /* media density code */ p[1] = (nb_sectors >> 16) & 0xff; p[2] = (nb_sectors >> 8) & 0xff; p[3] = nb_sectors & 0xff; p[4] = 0; /* reserved */ p[5] = 0; /* bytes 5-7 are the sector size in bytes */ p[6] = s->cluster_size * 2; p[7] = 0; p += 8; } switch (page) { case 0x04: case 0x05: case 0x08: case 0x2a: p += mode_sense_page(req, page, p); break; case 0x3f: p += mode_sense_page(req, 0x08, p); p += mode_sense_page(req, 0x2a, p); break; } buflen = p - outbuf; /* * The mode data length field specifies the length in bytes of the * following data that is available to be transferred. The mode data * length does not include itself. */ if (req->cmd.buf[0] == MODE_SENSE) { outbuf[0] = buflen - 1; } else { /* MODE_SENSE_10 */ outbuf[0] = ((buflen - 2) >> 8) & 0xff; outbuf[1] = (buflen - 2) & 0xff; } if (buflen > req->cmd.xfer) buflen = req->cmd.xfer; return buflen; }
true
qemu
282ab04eb1e6f4faa6c5d2827e3209c4a1eec40e
static int scsi_disk_emulate_mode_sense(SCSIRequest *req, uint8_t *outbuf) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); uint64_t nb_sectors; int page, dbd, buflen; uint8_t *p; uint8_t dev_specific_param; dbd = req->cmd.buf[1] & 0x8; page = req->cmd.buf[2] & 0x3f; DPRINTF("Mode Sense (page %d, len %zd)\n", page, req->cmd.xfer); memset(outbuf, 0, req->cmd.xfer); p = outbuf; if (bdrv_is_read_only(s->bs)) { dev_specific_param = 0x80; } else { dev_specific_param = 0x00; } if (req->cmd.buf[0] == MODE_SENSE) { p[1] = 0; p[2] = dev_specific_param; p[3] = 0; p += 4; } else { p[2] = 0; p[3] = dev_specific_param; p[6] = p[7] = 0; p += 8; } bdrv_get_geometry(s->bs, &nb_sectors); if ((~dbd) & nb_sectors) { if (req->cmd.buf[0] == MODE_SENSE) { outbuf[3] = 8; } else { outbuf[7] = 8; } nb_sectors /= s->cluster_size; nb_sectors--; if (nb_sectors > 0xffffff) nb_sectors = 0xffffff; p[0] = 0; p[1] = (nb_sectors >> 16) & 0xff; p[2] = (nb_sectors >> 8) & 0xff; p[3] = nb_sectors & 0xff; p[4] = 0; p[5] = 0; p[6] = s->cluster_size * 2; p[7] = 0; p += 8; } switch (page) { case 0x04: case 0x05: case 0x08: case 0x2a: p += mode_sense_page(req, page, p); break; case 0x3f: p += mode_sense_page(req, 0x08, p); p += mode_sense_page(req, 0x2a, p); break; } buflen = p - outbuf; if (req->cmd.buf[0] == MODE_SENSE) { outbuf[0] = buflen - 1; } else { outbuf[0] = ((buflen - 2) >> 8) & 0xff; outbuf[1] = (buflen - 2) & 0xff; } if (buflen > req->cmd.xfer) buflen = req->cmd.xfer; return buflen; }
{ "code": [ " int page, dbd, buflen;", " DPRINTF(\"Mode Sense (page %d, len %zd)\\n\", page, req->cmd.xfer);", " p += mode_sense_page(req, page, p);", " p += mode_sense_page(req, 0x08, p);", " p += mode_sense_page(req, 0x2a, p);" ], "line_no": [ 9, 21, 119, 125, 127 ] }
static int FUNC_0(SCSIRequest *VAR_0, uint8_t *VAR_1) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, VAR_0->dev); uint64_t nb_sectors; int VAR_2, VAR_3, VAR_4; uint8_t *p; uint8_t dev_specific_param; VAR_3 = VAR_0->cmd.buf[1] & 0x8; VAR_2 = VAR_0->cmd.buf[2] & 0x3f; DPRINTF("Mode Sense (VAR_2 %d, len %zd)\n", VAR_2, VAR_0->cmd.xfer); memset(VAR_1, 0, VAR_0->cmd.xfer); p = VAR_1; if (bdrv_is_read_only(s->bs)) { dev_specific_param = 0x80; } else { dev_specific_param = 0x00; } if (VAR_0->cmd.buf[0] == MODE_SENSE) { p[1] = 0; p[2] = dev_specific_param; p[3] = 0; p += 4; } else { p[2] = 0; p[3] = dev_specific_param; p[6] = p[7] = 0; p += 8; } bdrv_get_geometry(s->bs, &nb_sectors); if ((~VAR_3) & nb_sectors) { if (VAR_0->cmd.buf[0] == MODE_SENSE) { VAR_1[3] = 8; } else { VAR_1[7] = 8; } nb_sectors /= s->cluster_size; nb_sectors--; if (nb_sectors > 0xffffff) nb_sectors = 0xffffff; p[0] = 0; p[1] = (nb_sectors >> 16) & 0xff; p[2] = (nb_sectors >> 8) & 0xff; p[3] = nb_sectors & 0xff; p[4] = 0; p[5] = 0; p[6] = s->cluster_size * 2; p[7] = 0; p += 8; } switch (VAR_2) { case 0x04: case 0x05: case 0x08: case 0x2a: p += mode_sense_page(VAR_0, VAR_2, p); break; case 0x3f: p += mode_sense_page(VAR_0, 0x08, p); p += mode_sense_page(VAR_0, 0x2a, p); break; } VAR_4 = p - VAR_1; if (VAR_0->cmd.buf[0] == MODE_SENSE) { VAR_1[0] = VAR_4 - 1; } else { VAR_1[0] = ((VAR_4 - 2) >> 8) & 0xff; VAR_1[1] = (VAR_4 - 2) & 0xff; } if (VAR_4 > VAR_0->cmd.xfer) VAR_4 = VAR_0->cmd.xfer; return VAR_4; }
[ "static int FUNC_0(SCSIRequest *VAR_0, uint8_t *VAR_1)\n{", "SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, VAR_0->dev);", "uint64_t nb_sectors;", "int VAR_2, VAR_3, VAR_4;", "uint8_t *p;", "uint8_t dev_specific_param;", "VAR_3 = VAR_0->cmd.buf[1] & 0x8;", "VAR_2 = VAR_0->cmd.buf[2] & 0x3f;", "DPRINTF(\"Mode Sense (VAR_2 %d, len %zd)\\n\", VAR_2, VAR_0->cmd.xfer);", "memset(VAR_1, 0, VAR_0->cmd.xfer);", "p = VAR_1;", "if (bdrv_is_read_only(s->bs)) {", "dev_specific_param = 0x80;", "} else {", "dev_specific_param = 0x00;", "}", "if (VAR_0->cmd.buf[0] == MODE_SENSE) {", "p[1] = 0;", "p[2] = dev_specific_param;", "p[3] = 0;", "p += 4;", "} else {", "p[2] = 0;", "p[3] = dev_specific_param;", "p[6] = p[7] = 0;", "p += 8;", "}", "bdrv_get_geometry(s->bs, &nb_sectors);", "if ((~VAR_3) & nb_sectors) {", "if (VAR_0->cmd.buf[0] == MODE_SENSE) {", "VAR_1[3] = 8;", "} else {", "VAR_1[7] = 8;", "}", "nb_sectors /= s->cluster_size;", "nb_sectors--;", "if (nb_sectors > 0xffffff)\nnb_sectors = 0xffffff;", "p[0] = 0;", "p[1] = (nb_sectors >> 16) & 0xff;", "p[2] = (nb_sectors >> 8) & 0xff;", "p[3] = nb_sectors & 0xff;", "p[4] = 0;", "p[5] = 0;", "p[6] = s->cluster_size * 2;", "p[7] = 0;", "p += 8;", "}", "switch (VAR_2) {", "case 0x04:\ncase 0x05:\ncase 0x08:\ncase 0x2a:\np += mode_sense_page(VAR_0, VAR_2, p);", "break;", "case 0x3f:\np += mode_sense_page(VAR_0, 0x08, p);", "p += mode_sense_page(VAR_0, 0x2a, p);", "break;", "}", "VAR_4 = p - VAR_1;", "if (VAR_0->cmd.buf[0] == MODE_SENSE) {", "VAR_1[0] = VAR_4 - 1;", "} else {", "VAR_1[0] = ((VAR_4 - 2) >> 8) & 0xff;", "VAR_1[1] = (VAR_4 - 2) & 0xff;", "}", "if (VAR_4 > VAR_0->cmd.xfer)\nVAR_4 = VAR_0->cmd.xfer;", "return VAR_4;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 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 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111, 113, 115, 117, 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ] ]
11,494
void qpci_msix_enable(QPCIDevice *dev) { uint8_t addr; uint16_t val; uint32_t table; uint8_t bir_table; uint8_t bir_pba; void *offset; addr = qpci_find_capability(dev, PCI_CAP_ID_MSIX); g_assert_cmphex(addr, !=, 0); val = qpci_config_readw(dev, addr + PCI_MSIX_FLAGS); qpci_config_writew(dev, addr + PCI_MSIX_FLAGS, val | PCI_MSIX_FLAGS_ENABLE); table = qpci_config_readl(dev, addr + PCI_MSIX_TABLE); bir_table = table & PCI_MSIX_FLAGS_BIRMASK; offset = qpci_iomap(dev, bir_table, NULL); dev->msix_table = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK); table = qpci_config_readl(dev, addr + PCI_MSIX_PBA); bir_pba = table & PCI_MSIX_FLAGS_BIRMASK; if (bir_pba != bir_table) { offset = qpci_iomap(dev, bir_pba, NULL); } dev->msix_pba = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK); g_assert(dev->msix_table != NULL); g_assert(dev->msix_pba != NULL); dev->msix_enabled = true; }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
void qpci_msix_enable(QPCIDevice *dev) { uint8_t addr; uint16_t val; uint32_t table; uint8_t bir_table; uint8_t bir_pba; void *offset; addr = qpci_find_capability(dev, PCI_CAP_ID_MSIX); g_assert_cmphex(addr, !=, 0); val = qpci_config_readw(dev, addr + PCI_MSIX_FLAGS); qpci_config_writew(dev, addr + PCI_MSIX_FLAGS, val | PCI_MSIX_FLAGS_ENABLE); table = qpci_config_readl(dev, addr + PCI_MSIX_TABLE); bir_table = table & PCI_MSIX_FLAGS_BIRMASK; offset = qpci_iomap(dev, bir_table, NULL); dev->msix_table = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK); table = qpci_config_readl(dev, addr + PCI_MSIX_PBA); bir_pba = table & PCI_MSIX_FLAGS_BIRMASK; if (bir_pba != bir_table) { offset = qpci_iomap(dev, bir_pba, NULL); } dev->msix_pba = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK); g_assert(dev->msix_table != NULL); g_assert(dev->msix_pba != NULL); dev->msix_enabled = true; }
{ "code": [ " void *offset;", " offset = qpci_iomap(dev, bir_table, NULL);", " dev->msix_table = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK);", " offset = qpci_iomap(dev, bir_pba, NULL);", " dev->msix_pba = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK);", " g_assert(dev->msix_table != NULL);", " g_assert(dev->msix_pba != NULL);" ], "line_no": [ 15, 35, 37, 47, 51, 55, 57 ] }
void FUNC_0(QPCIDevice *VAR_0) { uint8_t addr; uint16_t val; uint32_t table; uint8_t bir_table; uint8_t bir_pba; void *VAR_1; addr = qpci_find_capability(VAR_0, PCI_CAP_ID_MSIX); g_assert_cmphex(addr, !=, 0); val = qpci_config_readw(VAR_0, addr + PCI_MSIX_FLAGS); qpci_config_writew(VAR_0, addr + PCI_MSIX_FLAGS, val | PCI_MSIX_FLAGS_ENABLE); table = qpci_config_readl(VAR_0, addr + PCI_MSIX_TABLE); bir_table = table & PCI_MSIX_FLAGS_BIRMASK; VAR_1 = qpci_iomap(VAR_0, bir_table, NULL); VAR_0->msix_table = VAR_1 + (table & ~PCI_MSIX_FLAGS_BIRMASK); table = qpci_config_readl(VAR_0, addr + PCI_MSIX_PBA); bir_pba = table & PCI_MSIX_FLAGS_BIRMASK; if (bir_pba != bir_table) { VAR_1 = qpci_iomap(VAR_0, bir_pba, NULL); } VAR_0->msix_pba = VAR_1 + (table & ~PCI_MSIX_FLAGS_BIRMASK); g_assert(VAR_0->msix_table != NULL); g_assert(VAR_0->msix_pba != NULL); VAR_0->msix_enabled = true; }
[ "void FUNC_0(QPCIDevice *VAR_0)\n{", "uint8_t addr;", "uint16_t val;", "uint32_t table;", "uint8_t bir_table;", "uint8_t bir_pba;", "void *VAR_1;", "addr = qpci_find_capability(VAR_0, PCI_CAP_ID_MSIX);", "g_assert_cmphex(addr, !=, 0);", "val = qpci_config_readw(VAR_0, addr + PCI_MSIX_FLAGS);", "qpci_config_writew(VAR_0, addr + PCI_MSIX_FLAGS, val | PCI_MSIX_FLAGS_ENABLE);", "table = qpci_config_readl(VAR_0, addr + PCI_MSIX_TABLE);", "bir_table = table & PCI_MSIX_FLAGS_BIRMASK;", "VAR_1 = qpci_iomap(VAR_0, bir_table, NULL);", "VAR_0->msix_table = VAR_1 + (table & ~PCI_MSIX_FLAGS_BIRMASK);", "table = qpci_config_readl(VAR_0, addr + PCI_MSIX_PBA);", "bir_pba = table & PCI_MSIX_FLAGS_BIRMASK;", "if (bir_pba != bir_table) {", "VAR_1 = qpci_iomap(VAR_0, bir_pba, NULL);", "}", "VAR_0->msix_pba = VAR_1 + (table & ~PCI_MSIX_FLAGS_BIRMASK);", "g_assert(VAR_0->msix_table != NULL);", "g_assert(VAR_0->msix_pba != NULL);", "VAR_0->msix_enabled = true;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
11,495
av_cold void ff_lpc_end(LPCContext *s) { av_freep(&s->windowed_samples); }
true
FFmpeg
4b0e0f31bf0f618a634dcfdca45e72cdfb0b48b5
av_cold void ff_lpc_end(LPCContext *s) { av_freep(&s->windowed_samples); }
{ "code": [ " av_freep(&s->windowed_samples);" ], "line_no": [ 5 ] }
av_cold void FUNC_0(LPCContext *s) { av_freep(&s->windowed_samples); }
[ "av_cold void FUNC_0(LPCContext *s)\n{", "av_freep(&s->windowed_samples);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
11,496
static void *handle_apdu_thread(void* arg) { EmulatedState *card = arg; uint8_t recv_data[APDU_BUF_SIZE]; int recv_len; VReaderStatus reader_status; EmulEvent *event; while (1) { qemu_mutex_lock(&card->handle_apdu_mutex); qemu_cond_wait(&card->handle_apdu_cond, &card->handle_apdu_mutex); qemu_mutex_unlock(&card->handle_apdu_mutex); if (card->quit_apdu_thread) { card->quit_apdu_thread = 0; /* debugging */ break; } qemu_mutex_lock(&card->vreader_mutex); while (!QSIMPLEQ_EMPTY(&card->guest_apdu_list)) { event = QSIMPLEQ_FIRST(&card->guest_apdu_list); assert((unsigned long)event > 1000); QSIMPLEQ_REMOVE_HEAD(&card->guest_apdu_list, entry); if (event->p.data.type != EMUL_GUEST_APDU) { DPRINTF(card, 1, "unexpected message in handle_apdu_thread\n"); g_free(event); continue; } if (card->reader == NULL) { DPRINTF(card, 1, "reader is NULL\n"); g_free(event); continue; } recv_len = sizeof(recv_data); reader_status = vreader_xfr_bytes(card->reader, event->p.data.data, event->p.data.len, recv_data, &recv_len); DPRINTF(card, 2, "got back apdu of length %d\n", recv_len); if (reader_status == VREADER_OK) { emulated_push_response_apdu(card, recv_data, recv_len); } else { emulated_push_error(card, reader_status); } g_free(event); } qemu_mutex_unlock(&card->vreader_mutex); } qemu_mutex_lock(&card->apdu_thread_quit_mutex); qemu_cond_signal(&card->apdu_thread_quit_cond); qemu_mutex_unlock(&card->apdu_thread_quit_mutex); return NULL; }
true
qemu
da5361cc685c004d8bb4e7c5e7b3a52c7aca2c56
static void *handle_apdu_thread(void* arg) { EmulatedState *card = arg; uint8_t recv_data[APDU_BUF_SIZE]; int recv_len; VReaderStatus reader_status; EmulEvent *event; while (1) { qemu_mutex_lock(&card->handle_apdu_mutex); qemu_cond_wait(&card->handle_apdu_cond, &card->handle_apdu_mutex); qemu_mutex_unlock(&card->handle_apdu_mutex); if (card->quit_apdu_thread) { card->quit_apdu_thread = 0; break; } qemu_mutex_lock(&card->vreader_mutex); while (!QSIMPLEQ_EMPTY(&card->guest_apdu_list)) { event = QSIMPLEQ_FIRST(&card->guest_apdu_list); assert((unsigned long)event > 1000); QSIMPLEQ_REMOVE_HEAD(&card->guest_apdu_list, entry); if (event->p.data.type != EMUL_GUEST_APDU) { DPRINTF(card, 1, "unexpected message in handle_apdu_thread\n"); g_free(event); continue; } if (card->reader == NULL) { DPRINTF(card, 1, "reader is NULL\n"); g_free(event); continue; } recv_len = sizeof(recv_data); reader_status = vreader_xfr_bytes(card->reader, event->p.data.data, event->p.data.len, recv_data, &recv_len); DPRINTF(card, 2, "got back apdu of length %d\n", recv_len); if (reader_status == VREADER_OK) { emulated_push_response_apdu(card, recv_data, recv_len); } else { emulated_push_error(card, reader_status); } g_free(event); } qemu_mutex_unlock(&card->vreader_mutex); } qemu_mutex_lock(&card->apdu_thread_quit_mutex); qemu_cond_signal(&card->apdu_thread_quit_cond); qemu_mutex_unlock(&card->apdu_thread_quit_mutex); return NULL; }
{ "code": [ " qemu_mutex_lock(&card->apdu_thread_quit_mutex);", " qemu_cond_signal(&card->apdu_thread_quit_cond);", " qemu_mutex_unlock(&card->apdu_thread_quit_mutex);", " qemu_mutex_lock(&card->apdu_thread_quit_mutex);" ], "line_no": [ 91, 93, 95, 91 ] }
static void *FUNC_0(void* VAR_0) { EmulatedState *card = VAR_0; uint8_t recv_data[APDU_BUF_SIZE]; int VAR_1; VReaderStatus reader_status; EmulEvent *event; while (1) { qemu_mutex_lock(&card->handle_apdu_mutex); qemu_cond_wait(&card->handle_apdu_cond, &card->handle_apdu_mutex); qemu_mutex_unlock(&card->handle_apdu_mutex); if (card->quit_apdu_thread) { card->quit_apdu_thread = 0; break; } qemu_mutex_lock(&card->vreader_mutex); while (!QSIMPLEQ_EMPTY(&card->guest_apdu_list)) { event = QSIMPLEQ_FIRST(&card->guest_apdu_list); assert((unsigned long)event > 1000); QSIMPLEQ_REMOVE_HEAD(&card->guest_apdu_list, entry); if (event->p.data.type != EMUL_GUEST_APDU) { DPRINTF(card, 1, "unexpected message in FUNC_0\n"); g_free(event); continue; } if (card->reader == NULL) { DPRINTF(card, 1, "reader is NULL\n"); g_free(event); continue; } VAR_1 = sizeof(recv_data); reader_status = vreader_xfr_bytes(card->reader, event->p.data.data, event->p.data.len, recv_data, &VAR_1); DPRINTF(card, 2, "got back apdu of length %d\n", VAR_1); if (reader_status == VREADER_OK) { emulated_push_response_apdu(card, recv_data, VAR_1); } else { emulated_push_error(card, reader_status); } g_free(event); } qemu_mutex_unlock(&card->vreader_mutex); } qemu_mutex_lock(&card->apdu_thread_quit_mutex); qemu_cond_signal(&card->apdu_thread_quit_cond); qemu_mutex_unlock(&card->apdu_thread_quit_mutex); return NULL; }
[ "static void *FUNC_0(void* VAR_0)\n{", "EmulatedState *card = VAR_0;", "uint8_t recv_data[APDU_BUF_SIZE];", "int VAR_1;", "VReaderStatus reader_status;", "EmulEvent *event;", "while (1) {", "qemu_mutex_lock(&card->handle_apdu_mutex);", "qemu_cond_wait(&card->handle_apdu_cond, &card->handle_apdu_mutex);", "qemu_mutex_unlock(&card->handle_apdu_mutex);", "if (card->quit_apdu_thread) {", "card->quit_apdu_thread = 0;", "break;", "}", "qemu_mutex_lock(&card->vreader_mutex);", "while (!QSIMPLEQ_EMPTY(&card->guest_apdu_list)) {", "event = QSIMPLEQ_FIRST(&card->guest_apdu_list);", "assert((unsigned long)event > 1000);", "QSIMPLEQ_REMOVE_HEAD(&card->guest_apdu_list, entry);", "if (event->p.data.type != EMUL_GUEST_APDU) {", "DPRINTF(card, 1, \"unexpected message in FUNC_0\\n\");", "g_free(event);", "continue;", "}", "if (card->reader == NULL) {", "DPRINTF(card, 1, \"reader is NULL\\n\");", "g_free(event);", "continue;", "}", "VAR_1 = sizeof(recv_data);", "reader_status = vreader_xfr_bytes(card->reader,\nevent->p.data.data, event->p.data.len,\nrecv_data, &VAR_1);", "DPRINTF(card, 2, \"got back apdu of length %d\\n\", VAR_1);", "if (reader_status == VREADER_OK) {", "emulated_push_response_apdu(card, recv_data, VAR_1);", "} else {", "emulated_push_error(card, reader_status);", "}", "g_free(event);", "}", "qemu_mutex_unlock(&card->vreader_mutex);", "}", "qemu_mutex_lock(&card->apdu_thread_quit_mutex);", "qemu_cond_signal(&card->apdu_thread_quit_cond);", "qemu_mutex_unlock(&card->apdu_thread_quit_mutex);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ] ]
11,499
static void write_codec_attr(AVStream *st, VariantStream *vs) { int codec_strlen = strlen(vs->codec_attr); char attr[32]; if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) return; if (vs->attr_status == CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN) return; if (st->codecpar->codec_id == AV_CODEC_ID_H264) { uint8_t *data = st->codecpar->extradata; if ((data[0] | data[1] | data[2]) == 0 && data[3] == 1 && (data[4] & 0x1F) == 7) { snprintf(attr, sizeof(attr), "avc1.%02x%02x%02x", data[5], data[6], data[7]); } else { goto fail; } } else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) { snprintf(attr, sizeof(attr), "mp4a.40.33"); } else if (st->codecpar->codec_id == AV_CODEC_ID_MP3) { snprintf(attr, sizeof(attr), "mp4a.40.34"); } else if (st->codecpar->codec_id == AV_CODEC_ID_AAC) { /* TODO : For HE-AAC, HE-AACv2, the last digit needs to be set to 5 and 29 respectively */ snprintf(attr, sizeof(attr), "mp4a.40.2"); } else if (st->codecpar->codec_id == AV_CODEC_ID_AC3) { snprintf(attr, sizeof(attr), "ac-3"); } else if (st->codecpar->codec_id == AV_CODEC_ID_EAC3) { snprintf(attr, sizeof(attr), "ec-3"); } else { goto fail; } // Don't write the same attribute multiple times if (!av_stristr(vs->codec_attr, attr)) { snprintf(vs->codec_attr + codec_strlen, sizeof(vs->codec_attr) - codec_strlen, "%s%s", codec_strlen ? "," : "", attr); } return; fail: vs->codec_attr[0] = '\0'; vs->attr_status = CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN; return; }
false
FFmpeg
2472dbc7a770a908a2f511ec337ec392ca3e3afa
static void write_codec_attr(AVStream *st, VariantStream *vs) { int codec_strlen = strlen(vs->codec_attr); char attr[32]; if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) return; if (vs->attr_status == CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN) return; if (st->codecpar->codec_id == AV_CODEC_ID_H264) { uint8_t *data = st->codecpar->extradata; if ((data[0] | data[1] | data[2]) == 0 && data[3] == 1 && (data[4] & 0x1F) == 7) { snprintf(attr, sizeof(attr), "avc1.%02x%02x%02x", data[5], data[6], data[7]); } else { goto fail; } } else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) { snprintf(attr, sizeof(attr), "mp4a.40.33"); } else if (st->codecpar->codec_id == AV_CODEC_ID_MP3) { snprintf(attr, sizeof(attr), "mp4a.40.34"); } else if (st->codecpar->codec_id == AV_CODEC_ID_AAC) { snprintf(attr, sizeof(attr), "mp4a.40.2"); } else if (st->codecpar->codec_id == AV_CODEC_ID_AC3) { snprintf(attr, sizeof(attr), "ac-3"); } else if (st->codecpar->codec_id == AV_CODEC_ID_EAC3) { snprintf(attr, sizeof(attr), "ec-3"); } else { goto fail; } if (!av_stristr(vs->codec_attr, attr)) { snprintf(vs->codec_attr + codec_strlen, sizeof(vs->codec_attr) - codec_strlen, "%s%s", codec_strlen ? "," : "", attr); } return; fail: vs->codec_attr[0] = '\0'; vs->attr_status = CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN; return; }
{ "code": [], "line_no": [] }
static void FUNC_0(AVStream *VAR_0, VariantStream *VAR_1) { int VAR_2 = strlen(VAR_1->codec_attr); char VAR_3[32]; if (VAR_0->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) return; if (VAR_1->attr_status == CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN) return; if (VAR_0->codecpar->codec_id == AV_CODEC_ID_H264) { uint8_t *data = VAR_0->codecpar->extradata; if ((data[0] | data[1] | data[2]) == 0 && data[3] == 1 && (data[4] & 0x1F) == 7) { snprintf(VAR_3, sizeof(VAR_3), "avc1.%02x%02x%02x", data[5], data[6], data[7]); } else { goto fail; } } else if (VAR_0->codecpar->codec_id == AV_CODEC_ID_MP2) { snprintf(VAR_3, sizeof(VAR_3), "mp4a.40.33"); } else if (VAR_0->codecpar->codec_id == AV_CODEC_ID_MP3) { snprintf(VAR_3, sizeof(VAR_3), "mp4a.40.34"); } else if (VAR_0->codecpar->codec_id == AV_CODEC_ID_AAC) { snprintf(VAR_3, sizeof(VAR_3), "mp4a.40.2"); } else if (VAR_0->codecpar->codec_id == AV_CODEC_ID_AC3) { snprintf(VAR_3, sizeof(VAR_3), "ac-3"); } else if (VAR_0->codecpar->codec_id == AV_CODEC_ID_EAC3) { snprintf(VAR_3, sizeof(VAR_3), "ec-3"); } else { goto fail; } if (!av_stristr(VAR_1->codec_attr, VAR_3)) { snprintf(VAR_1->codec_attr + VAR_2, sizeof(VAR_1->codec_attr) - VAR_2, "%s%s", VAR_2 ? "," : "", VAR_3); } return; fail: VAR_1->codec_attr[0] = '\0'; VAR_1->attr_status = CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN; return; }
[ "static void FUNC_0(AVStream *VAR_0, VariantStream *VAR_1) {", "int VAR_2 = strlen(VAR_1->codec_attr);", "char VAR_3[32];", "if (VAR_0->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)\nreturn;", "if (VAR_1->attr_status == CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN)\nreturn;", "if (VAR_0->codecpar->codec_id == AV_CODEC_ID_H264) {", "uint8_t *data = VAR_0->codecpar->extradata;", "if ((data[0] | data[1] | data[2]) == 0 && data[3] == 1 && (data[4] & 0x1F) == 7) {", "snprintf(VAR_3, sizeof(VAR_3),\n\"avc1.%02x%02x%02x\", data[5], data[6], data[7]);", "} else {", "goto fail;", "}", "} else if (VAR_0->codecpar->codec_id == AV_CODEC_ID_MP2) {", "snprintf(VAR_3, sizeof(VAR_3), \"mp4a.40.33\");", "} else if (VAR_0->codecpar->codec_id == AV_CODEC_ID_MP3) {", "snprintf(VAR_3, sizeof(VAR_3), \"mp4a.40.34\");", "} else if (VAR_0->codecpar->codec_id == AV_CODEC_ID_AAC) {", "snprintf(VAR_3, sizeof(VAR_3), \"mp4a.40.2\");", "} else if (VAR_0->codecpar->codec_id == AV_CODEC_ID_AC3) {", "snprintf(VAR_3, sizeof(VAR_3), \"ac-3\");", "} else if (VAR_0->codecpar->codec_id == AV_CODEC_ID_EAC3) {", "snprintf(VAR_3, sizeof(VAR_3), \"ec-3\");", "} else {", "goto fail;", "}", "if (!av_stristr(VAR_1->codec_attr, VAR_3)) {", "snprintf(VAR_1->codec_attr + VAR_2,\nsizeof(VAR_1->codec_attr) - VAR_2,\n\"%s%s\", VAR_2 ? \",\" : \"\", VAR_3);", "}", "return;", "fail:\nVAR_1->codec_attr[0] = '\\0';", "VAR_1->attr_status = CODEC_ATTRIBUTE_WILL_NOT_BE_WRITTEN;", "return;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67, 69, 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ] ]
11,500
static inline void update_rice(APERice *rice, int x) { rice->ksum += ((x + 1) / 2) - ((rice->ksum + 16) >> 5); if (rice->k == 0) rice->k = 1; else if (rice->ksum < (1 << (rice->k + 4))) rice->k--; else if (rice->ksum >= (1 << (rice->k + 5))) rice->k++; }
false
FFmpeg
e774c41cab765f5d12ecfb31e5fa30df41230de0
static inline void update_rice(APERice *rice, int x) { rice->ksum += ((x + 1) / 2) - ((rice->ksum + 16) >> 5); if (rice->k == 0) rice->k = 1; else if (rice->ksum < (1 << (rice->k + 4))) rice->k--; else if (rice->ksum >= (1 << (rice->k + 5))) rice->k++; }
{ "code": [], "line_no": [] }
static inline void FUNC_0(APERice *VAR_0, int VAR_1) { VAR_0->ksum += ((VAR_1 + 1) / 2) - ((VAR_0->ksum + 16) >> 5); if (VAR_0->k == 0) VAR_0->k = 1; else if (VAR_0->ksum < (1 << (VAR_0->k + 4))) VAR_0->k--; else if (VAR_0->ksum >= (1 << (VAR_0->k + 5))) VAR_0->k++; }
[ "static inline void FUNC_0(APERice *VAR_0, int VAR_1)\n{", "VAR_0->ksum += ((VAR_1 + 1) / 2) - ((VAR_0->ksum + 16) >> 5);", "if (VAR_0->k == 0)\nVAR_0->k = 1;", "else if (VAR_0->ksum < (1 << (VAR_0->k + 4)))\nVAR_0->k--;", "else if (VAR_0->ksum >= (1 << (VAR_0->k + 5)))\nVAR_0->k++;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 17, 19 ], [ 21 ] ]
11,502
static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) { MpegTSWrite *ts = s->priv_data; uint8_t data[SECTION_LENGTH], *q, *desc_length_ptr, *program_info_length_ptr; int val, stream_type, i; q = data; put16(&q, 0xe000 | service->pcr_pid); program_info_length_ptr = q; q += 2; /* patched after */ /* put program info here */ val = 0xf000 | (q - program_info_length_ptr - 2); program_info_length_ptr[0] = val >> 8; program_info_length_ptr[1] = val; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MpegTSWriteStream *ts_st = st->priv_data; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); switch (st->codec->codec_id) { case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: stream_type = STREAM_TYPE_VIDEO_MPEG2; break; case AV_CODEC_ID_MPEG4: stream_type = STREAM_TYPE_VIDEO_MPEG4; break; case AV_CODEC_ID_H264: stream_type = STREAM_TYPE_VIDEO_H264; break; case AV_CODEC_ID_HEVC: stream_type = STREAM_TYPE_VIDEO_HEVC; break; case AV_CODEC_ID_CAVS: stream_type = STREAM_TYPE_VIDEO_CAVS; break; case AV_CODEC_ID_DIRAC: stream_type = STREAM_TYPE_VIDEO_DIRAC; break; case AV_CODEC_ID_MP2: case AV_CODEC_ID_MP3: stream_type = STREAM_TYPE_AUDIO_MPEG1; break; case AV_CODEC_ID_AAC: stream_type = (ts->flags & MPEGTS_FLAG_AAC_LATM) ? STREAM_TYPE_AUDIO_AAC_LATM : STREAM_TYPE_AUDIO_AAC; break; case AV_CODEC_ID_AAC_LATM: stream_type = STREAM_TYPE_AUDIO_AAC_LATM; break; case AV_CODEC_ID_AC3: stream_type = STREAM_TYPE_AUDIO_AC3; break; default: stream_type = STREAM_TYPE_PRIVATE_DATA; break; } *q++ = stream_type; put16(&q, 0xe000 | ts_st->pid); desc_length_ptr = q; q += 2; /* patched after */ /* write optional descriptors here */ switch (st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: if (lang) { char *p; char *next = lang->value; uint8_t *len_ptr; *q++ = 0x0a; /* ISO 639 language descriptor */ len_ptr = q++; *len_ptr = 0; for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) { next = strchr(p, ','); if (strlen(p) != 3 && (!next || next != p + 3)) continue; /* not a 3-letter code */ *q++ = *p++; *q++ = *p++; *q++ = *p++; if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) *q++ = 0x01; else if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) *q++ = 0x02; else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) *q++ = 0x03; else *q++ = 0; /* undefined type */ *len_ptr += 4; } if (*len_ptr == 0) q -= 2; /* no language codes were written */ } break; case AVMEDIA_TYPE_SUBTITLE: { const char *language; language = lang && strlen(lang->value) == 3 ? lang->value : "eng"; *q++ = 0x59; *q++ = 8; *q++ = language[0]; *q++ = language[1]; *q++ = language[2]; *q++ = 0x10; /* normal subtitles (0x20 = if hearing pb) */ if (st->codec->extradata_size == 4) { memcpy(q, st->codec->extradata, 4); q += 4; } else { put16(&q, 1); /* page id */ put16(&q, 1); /* ancillary page id */ } } break; case AVMEDIA_TYPE_VIDEO: if (stream_type == STREAM_TYPE_VIDEO_DIRAC) { *q++ = 0x05; /*MPEG-2 registration descriptor*/ *q++ = 4; *q++ = 'd'; *q++ = 'r'; *q++ = 'a'; *q++ = 'c'; } break; } val = 0xf000 | (q - desc_length_ptr - 2); desc_length_ptr[0] = val >> 8; desc_length_ptr[1] = val; } mpegts_write_section1(&service->pmt, PMT_TID, service->sid, 0, 0, 0, data, q - data); }
true
FFmpeg
e8049af1325dd59a51546c15b2e71a0f578e9d27
static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) { MpegTSWrite *ts = s->priv_data; uint8_t data[SECTION_LENGTH], *q, *desc_length_ptr, *program_info_length_ptr; int val, stream_type, i; q = data; put16(&q, 0xe000 | service->pcr_pid); program_info_length_ptr = q; q += 2; val = 0xf000 | (q - program_info_length_ptr - 2); program_info_length_ptr[0] = val >> 8; program_info_length_ptr[1] = val; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MpegTSWriteStream *ts_st = st->priv_data; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); switch (st->codec->codec_id) { case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: stream_type = STREAM_TYPE_VIDEO_MPEG2; break; case AV_CODEC_ID_MPEG4: stream_type = STREAM_TYPE_VIDEO_MPEG4; break; case AV_CODEC_ID_H264: stream_type = STREAM_TYPE_VIDEO_H264; break; case AV_CODEC_ID_HEVC: stream_type = STREAM_TYPE_VIDEO_HEVC; break; case AV_CODEC_ID_CAVS: stream_type = STREAM_TYPE_VIDEO_CAVS; break; case AV_CODEC_ID_DIRAC: stream_type = STREAM_TYPE_VIDEO_DIRAC; break; case AV_CODEC_ID_MP2: case AV_CODEC_ID_MP3: stream_type = STREAM_TYPE_AUDIO_MPEG1; break; case AV_CODEC_ID_AAC: stream_type = (ts->flags & MPEGTS_FLAG_AAC_LATM) ? STREAM_TYPE_AUDIO_AAC_LATM : STREAM_TYPE_AUDIO_AAC; break; case AV_CODEC_ID_AAC_LATM: stream_type = STREAM_TYPE_AUDIO_AAC_LATM; break; case AV_CODEC_ID_AC3: stream_type = STREAM_TYPE_AUDIO_AC3; break; default: stream_type = STREAM_TYPE_PRIVATE_DATA; break; } *q++ = stream_type; put16(&q, 0xe000 | ts_st->pid); desc_length_ptr = q; q += 2; switch (st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: if (lang) { char *p; char *next = lang->value; uint8_t *len_ptr; *q++ = 0x0a; len_ptr = q++; *len_ptr = 0; for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) { next = strchr(p, ','); if (strlen(p) != 3 && (!next || next != p + 3)) continue; *q++ = *p++; *q++ = *p++; *q++ = *p++; if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) *q++ = 0x01; else if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) *q++ = 0x02; else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) *q++ = 0x03; else *q++ = 0; *len_ptr += 4; } if (*len_ptr == 0) q -= 2; } break; case AVMEDIA_TYPE_SUBTITLE: { const char *language; language = lang && strlen(lang->value) == 3 ? lang->value : "eng"; *q++ = 0x59; *q++ = 8; *q++ = language[0]; *q++ = language[1]; *q++ = language[2]; *q++ = 0x10; if (st->codec->extradata_size == 4) { memcpy(q, st->codec->extradata, 4); q += 4; } else { put16(&q, 1); put16(&q, 1); } } break; case AVMEDIA_TYPE_VIDEO: if (stream_type == STREAM_TYPE_VIDEO_DIRAC) { *q++ = 0x05; *q++ = 4; *q++ = 'd'; *q++ = 'r'; *q++ = 'a'; *q++ = 'c'; } break; } val = 0xf000 | (q - desc_length_ptr - 2); desc_length_ptr[0] = val >> 8; desc_length_ptr[1] = val; } mpegts_write_section1(&service->pmt, PMT_TID, service->sid, 0, 0, 0, data, q - data); }
{ "code": [ " int val, stream_type, i;" ], "line_no": [ 9 ] }
static void FUNC_0(AVFormatContext *VAR_0, MpegTSService *VAR_1) { MpegTSWrite *ts = VAR_0->priv_data; uint8_t data[SECTION_LENGTH], *q, *desc_length_ptr, *program_info_length_ptr; int VAR_2, VAR_3, VAR_4; q = data; put16(&q, 0xe000 | VAR_1->pcr_pid); program_info_length_ptr = q; q += 2; VAR_2 = 0xf000 | (q - program_info_length_ptr - 2); program_info_length_ptr[0] = VAR_2 >> 8; program_info_length_ptr[1] = VAR_2; for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) { AVStream *st = VAR_0->streams[VAR_4]; MpegTSWriteStream *ts_st = st->priv_data; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); switch (st->codec->codec_id) { case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: VAR_3 = STREAM_TYPE_VIDEO_MPEG2; break; case AV_CODEC_ID_MPEG4: VAR_3 = STREAM_TYPE_VIDEO_MPEG4; break; case AV_CODEC_ID_H264: VAR_3 = STREAM_TYPE_VIDEO_H264; break; case AV_CODEC_ID_HEVC: VAR_3 = STREAM_TYPE_VIDEO_HEVC; break; case AV_CODEC_ID_CAVS: VAR_3 = STREAM_TYPE_VIDEO_CAVS; break; case AV_CODEC_ID_DIRAC: VAR_3 = STREAM_TYPE_VIDEO_DIRAC; break; case AV_CODEC_ID_MP2: case AV_CODEC_ID_MP3: VAR_3 = STREAM_TYPE_AUDIO_MPEG1; break; case AV_CODEC_ID_AAC: VAR_3 = (ts->flags & MPEGTS_FLAG_AAC_LATM) ? STREAM_TYPE_AUDIO_AAC_LATM : STREAM_TYPE_AUDIO_AAC; break; case AV_CODEC_ID_AAC_LATM: VAR_3 = STREAM_TYPE_AUDIO_AAC_LATM; break; case AV_CODEC_ID_AC3: VAR_3 = STREAM_TYPE_AUDIO_AC3; break; default: VAR_3 = STREAM_TYPE_PRIVATE_DATA; break; } *q++ = VAR_3; put16(&q, 0xe000 | ts_st->pid); desc_length_ptr = q; q += 2; switch (st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: if (lang) { char *p; char *next = lang->value; uint8_t *len_ptr; *q++ = 0x0a; len_ptr = q++; *len_ptr = 0; for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) { next = strchr(p, ','); if (strlen(p) != 3 && (!next || next != p + 3)) continue; *q++ = *p++; *q++ = *p++; *q++ = *p++; if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) *q++ = 0x01; else if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) *q++ = 0x02; else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) *q++ = 0x03; else *q++ = 0; *len_ptr += 4; } if (*len_ptr == 0) q -= 2; } break; case AVMEDIA_TYPE_SUBTITLE: { const char *language; language = lang && strlen(lang->value) == 3 ? lang->value : "eng"; *q++ = 0x59; *q++ = 8; *q++ = language[0]; *q++ = language[1]; *q++ = language[2]; *q++ = 0x10; if (st->codec->extradata_size == 4) { memcpy(q, st->codec->extradata, 4); q += 4; } else { put16(&q, 1); put16(&q, 1); } } break; case AVMEDIA_TYPE_VIDEO: if (VAR_3 == STREAM_TYPE_VIDEO_DIRAC) { *q++ = 0x05; *q++ = 4; *q++ = 'd'; *q++ = 'r'; *q++ = 'a'; *q++ = 'c'; } break; } VAR_2 = 0xf000 | (q - desc_length_ptr - 2); desc_length_ptr[0] = VAR_2 >> 8; desc_length_ptr[1] = VAR_2; } mpegts_write_section1(&VAR_1->pmt, PMT_TID, VAR_1->sid, 0, 0, 0, data, q - data); }
[ "static void FUNC_0(AVFormatContext *VAR_0, MpegTSService *VAR_1)\n{", "MpegTSWrite *ts = VAR_0->priv_data;", "uint8_t data[SECTION_LENGTH], *q, *desc_length_ptr, *program_info_length_ptr;", "int VAR_2, VAR_3, VAR_4;", "q = data;", "put16(&q, 0xe000 | VAR_1->pcr_pid);", "program_info_length_ptr = q;", "q += 2;", "VAR_2 = 0xf000 | (q - program_info_length_ptr - 2);", "program_info_length_ptr[0] = VAR_2 >> 8;", "program_info_length_ptr[1] = VAR_2;", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) {", "AVStream *st = VAR_0->streams[VAR_4];", "MpegTSWriteStream *ts_st = st->priv_data;", "AVDictionaryEntry *lang = av_dict_get(st->metadata, \"language\", NULL, 0);", "switch (st->codec->codec_id) {", "case AV_CODEC_ID_MPEG1VIDEO:\ncase AV_CODEC_ID_MPEG2VIDEO:\nVAR_3 = STREAM_TYPE_VIDEO_MPEG2;", "break;", "case AV_CODEC_ID_MPEG4:\nVAR_3 = STREAM_TYPE_VIDEO_MPEG4;", "break;", "case AV_CODEC_ID_H264:\nVAR_3 = STREAM_TYPE_VIDEO_H264;", "break;", "case AV_CODEC_ID_HEVC:\nVAR_3 = STREAM_TYPE_VIDEO_HEVC;", "break;", "case AV_CODEC_ID_CAVS:\nVAR_3 = STREAM_TYPE_VIDEO_CAVS;", "break;", "case AV_CODEC_ID_DIRAC:\nVAR_3 = STREAM_TYPE_VIDEO_DIRAC;", "break;", "case AV_CODEC_ID_MP2:\ncase AV_CODEC_ID_MP3:\nVAR_3 = STREAM_TYPE_AUDIO_MPEG1;", "break;", "case AV_CODEC_ID_AAC:\nVAR_3 = (ts->flags & MPEGTS_FLAG_AAC_LATM)\n? STREAM_TYPE_AUDIO_AAC_LATM\n: STREAM_TYPE_AUDIO_AAC;", "break;", "case AV_CODEC_ID_AAC_LATM:\nVAR_3 = STREAM_TYPE_AUDIO_AAC_LATM;", "break;", "case AV_CODEC_ID_AC3:\nVAR_3 = STREAM_TYPE_AUDIO_AC3;", "break;", "default:\nVAR_3 = STREAM_TYPE_PRIVATE_DATA;", "break;", "}", "*q++ = VAR_3;", "put16(&q, 0xe000 | ts_st->pid);", "desc_length_ptr = q;", "q += 2;", "switch (st->codec->codec_type) {", "case AVMEDIA_TYPE_AUDIO:\nif (lang) {", "char *p;", "char *next = lang->value;", "uint8_t *len_ptr;", "*q++ = 0x0a;", "len_ptr = q++;", "*len_ptr = 0;", "for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) {", "next = strchr(p, ',');", "if (strlen(p) != 3 && (!next || next != p + 3))\ncontinue;", "*q++ = *p++;", "*q++ = *p++;", "*q++ = *p++;", "if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS)\n*q++ = 0x01;", "else if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED)\n*q++ = 0x02;", "else if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED)\n*q++ = 0x03;", "else\n*q++ = 0;", "*len_ptr += 4;", "}", "if (*len_ptr == 0)\nq -= 2;", "}", "break;", "case AVMEDIA_TYPE_SUBTITLE:\n{", "const char *language;", "language = lang && strlen(lang->value) == 3 ? lang->value : \"eng\";", "*q++ = 0x59;", "*q++ = 8;", "*q++ = language[0];", "*q++ = language[1];", "*q++ = language[2];", "*q++ = 0x10;", "if (st->codec->extradata_size == 4) {", "memcpy(q, st->codec->extradata, 4);", "q += 4;", "} else {", "put16(&q, 1);", "put16(&q, 1);", "}", "}", "break;", "case AVMEDIA_TYPE_VIDEO:\nif (VAR_3 == STREAM_TYPE_VIDEO_DIRAC) {", "*q++ = 0x05;", "*q++ = 4;", "*q++ = 'd';", "*q++ = 'r';", "*q++ = 'a';", "*q++ = 'c';", "}", "break;", "}", "VAR_2 = 0xf000 | (q - desc_length_ptr - 2);", "desc_length_ptr[0] = VAR_2 >> 8;", "desc_length_ptr[1] = VAR_2;", "}", "mpegts_write_section1(&VAR_1->pmt, PMT_TID, VAR_1->sid, 0, 0, 0,\ndata, q - data);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85, 87, 89 ], [ 91 ], [ 93, 95, 97, 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161, 163 ], [ 167 ], [ 169 ], [ 171 ], [ 175, 177 ], [ 179, 181 ], [ 183, 185 ], [ 187, 189 ], [ 193 ], [ 195 ], [ 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 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 281 ] ]
11,503
static void vnc_init_basic_info_from_server_addr(QIOChannelSocket *ioc, VncBasicInfo *info, Error **errp) { SocketAddress *addr = NULL; addr = qio_channel_socket_get_local_address(ioc, errp); if (!addr) { vnc_init_basic_info(addr, info, errp); qapi_free_SocketAddress(addr);
true
qemu
624cdd46d7f67fa2d23e87ffe0a36a569edde11a
static void vnc_init_basic_info_from_server_addr(QIOChannelSocket *ioc, VncBasicInfo *info, Error **errp) { SocketAddress *addr = NULL; addr = qio_channel_socket_get_local_address(ioc, errp); if (!addr) { vnc_init_basic_info(addr, info, errp); qapi_free_SocketAddress(addr);
{ "code": [], "line_no": [] }
static void FUNC_0(QIOChannelSocket *VAR_0, VncBasicInfo *VAR_1, Error **VAR_2) { SocketAddress *addr = NULL; addr = qio_channel_socket_get_local_address(VAR_0, VAR_2); if (!addr) { vnc_init_basic_info(addr, VAR_1, VAR_2); qapi_free_SocketAddress(addr);
[ "static void FUNC_0(QIOChannelSocket *VAR_0,\nVncBasicInfo *VAR_1,\nError **VAR_2)\n{", "SocketAddress *addr = NULL;", "addr = qio_channel_socket_get_local_address(VAR_0, VAR_2);", "if (!addr) {", "vnc_init_basic_info(addr, VAR_1, VAR_2);", "qapi_free_SocketAddress(addr);" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ] ]
11,505
static void external_snapshot_prepare(BlkActionState *common, Error **errp) { int flags = 0; QDict *options = NULL; Error *local_err = NULL; /* Device and node name of the image to generate the snapshot from */ const char *device; const char *node_name; /* Reference to the new image (for 'blockdev-snapshot') */ const char *snapshot_ref; /* File name of the new image (for 'blockdev-snapshot-sync') */ const char *new_image_file; ExternalSnapshotState *state = DO_UPCAST(ExternalSnapshotState, common, common); TransactionAction *action = common->action; /* 'blockdev-snapshot' and 'blockdev-snapshot-sync' have similar * purpose but a different set of parameters */ switch (action->type) { case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT: { BlockdevSnapshot *s = action->u.blockdev_snapshot.data; device = s->node; node_name = s->node; new_image_file = NULL; snapshot_ref = s->overlay; } break; case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC: { BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync.data; device = s->has_device ? s->device : NULL; node_name = s->has_node_name ? s->node_name : NULL; new_image_file = s->snapshot_file; snapshot_ref = NULL; } break; default: g_assert_not_reached(); } /* start processing */ if (action_check_completion_mode(common, errp) < 0) { return; } state->old_bs = bdrv_lookup_bs(device, node_name, errp); if (!state->old_bs) { return; } /* Acquire AioContext now so any threads operating on old_bs stop */ state->aio_context = bdrv_get_aio_context(state->old_bs); aio_context_acquire(state->aio_context); bdrv_drained_begin(state->old_bs); if (!bdrv_is_inserted(state->old_bs)) { error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); return; } if (bdrv_op_is_blocked(state->old_bs, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, errp)) { return; } if (!bdrv_is_read_only(state->old_bs)) { if (bdrv_flush(state->old_bs)) { error_setg(errp, QERR_IO_ERROR); return; } } if (!bdrv_is_first_non_filter(state->old_bs)) { error_setg(errp, QERR_FEATURE_DISABLED, "snapshot"); return; } if (action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC) { BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync.data; const char *format = s->has_format ? s->format : "qcow2"; enum NewImageMode mode; const char *snapshot_node_name = s->has_snapshot_node_name ? s->snapshot_node_name : NULL; if (node_name && !snapshot_node_name) { error_setg(errp, "New snapshot node name missing"); return; } if (snapshot_node_name && bdrv_lookup_bs(snapshot_node_name, snapshot_node_name, NULL)) { error_setg(errp, "New snapshot node name already in use"); return; } flags = state->old_bs->open_flags; flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_COPY_ON_READ); /* create new image w/backing file */ mode = s->has_mode ? s->mode : NEW_IMAGE_MODE_ABSOLUTE_PATHS; if (mode != NEW_IMAGE_MODE_EXISTING) { int64_t size = bdrv_getlength(state->old_bs); if (size < 0) { error_setg_errno(errp, -size, "bdrv_getlength failed"); return; } bdrv_img_create(new_image_file, format, state->old_bs->filename, state->old_bs->drv->format_name, NULL, size, flags, false, &local_err); if (local_err) { error_propagate(errp, local_err); return; } } options = qdict_new(); if (s->has_snapshot_node_name) { qdict_put_str(options, "node-name", snapshot_node_name); } qdict_put_str(options, "driver", format); flags |= BDRV_O_NO_BACKING; } state->new_bs = bdrv_open(new_image_file, snapshot_ref, options, flags, errp); /* We will manually add the backing_hd field to the bs later */ if (!state->new_bs) { return; } if (bdrv_has_blk(state->new_bs)) { error_setg(errp, "The snapshot is already in use"); return; } if (bdrv_op_is_blocked(state->new_bs, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, errp)) { return; } if (state->new_bs->backing != NULL) { error_setg(errp, "The snapshot already has a backing image"); return; } if (!state->new_bs->drv->supports_backing) { error_setg(errp, "The snapshot does not support backing images"); return; } bdrv_set_aio_context(state->new_bs, state->aio_context); /* This removes our old bs and adds the new bs. This is an operation that * can fail, so we need to do it in .prepare; undoing it for abort is * always possible. */ bdrv_ref(state->new_bs); bdrv_append(state->new_bs, state->old_bs, &local_err); if (local_err) { error_propagate(errp, local_err); return; } state->overlay_appended = true; }
true
qemu
2a32c6e82ed24d837ce7af346ffc93113f0164b5
static void external_snapshot_prepare(BlkActionState *common, Error **errp) { int flags = 0; QDict *options = NULL; Error *local_err = NULL; const char *device; const char *node_name; const char *snapshot_ref; const char *new_image_file; ExternalSnapshotState *state = DO_UPCAST(ExternalSnapshotState, common, common); TransactionAction *action = common->action; switch (action->type) { case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT: { BlockdevSnapshot *s = action->u.blockdev_snapshot.data; device = s->node; node_name = s->node; new_image_file = NULL; snapshot_ref = s->overlay; } break; case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC: { BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync.data; device = s->has_device ? s->device : NULL; node_name = s->has_node_name ? s->node_name : NULL; new_image_file = s->snapshot_file; snapshot_ref = NULL; } break; default: g_assert_not_reached(); } if (action_check_completion_mode(common, errp) < 0) { return; } state->old_bs = bdrv_lookup_bs(device, node_name, errp); if (!state->old_bs) { return; } state->aio_context = bdrv_get_aio_context(state->old_bs); aio_context_acquire(state->aio_context); bdrv_drained_begin(state->old_bs); if (!bdrv_is_inserted(state->old_bs)) { error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); return; } if (bdrv_op_is_blocked(state->old_bs, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, errp)) { return; } if (!bdrv_is_read_only(state->old_bs)) { if (bdrv_flush(state->old_bs)) { error_setg(errp, QERR_IO_ERROR); return; } } if (!bdrv_is_first_non_filter(state->old_bs)) { error_setg(errp, QERR_FEATURE_DISABLED, "snapshot"); return; } if (action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC) { BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync.data; const char *format = s->has_format ? s->format : "qcow2"; enum NewImageMode mode; const char *snapshot_node_name = s->has_snapshot_node_name ? s->snapshot_node_name : NULL; if (node_name && !snapshot_node_name) { error_setg(errp, "New snapshot node name missing"); return; } if (snapshot_node_name && bdrv_lookup_bs(snapshot_node_name, snapshot_node_name, NULL)) { error_setg(errp, "New snapshot node name already in use"); return; } flags = state->old_bs->open_flags; flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_COPY_ON_READ); mode = s->has_mode ? s->mode : NEW_IMAGE_MODE_ABSOLUTE_PATHS; if (mode != NEW_IMAGE_MODE_EXISTING) { int64_t size = bdrv_getlength(state->old_bs); if (size < 0) { error_setg_errno(errp, -size, "bdrv_getlength failed"); return; } bdrv_img_create(new_image_file, format, state->old_bs->filename, state->old_bs->drv->format_name, NULL, size, flags, false, &local_err); if (local_err) { error_propagate(errp, local_err); return; } } options = qdict_new(); if (s->has_snapshot_node_name) { qdict_put_str(options, "node-name", snapshot_node_name); } qdict_put_str(options, "driver", format); flags |= BDRV_O_NO_BACKING; } state->new_bs = bdrv_open(new_image_file, snapshot_ref, options, flags, errp); if (!state->new_bs) { return; } if (bdrv_has_blk(state->new_bs)) { error_setg(errp, "The snapshot is already in use"); return; } if (bdrv_op_is_blocked(state->new_bs, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, errp)) { return; } if (state->new_bs->backing != NULL) { error_setg(errp, "The snapshot already has a backing image"); return; } if (!state->new_bs->drv->supports_backing) { error_setg(errp, "The snapshot does not support backing images"); return; } bdrv_set_aio_context(state->new_bs, state->aio_context); bdrv_ref(state->new_bs); bdrv_append(state->new_bs, state->old_bs, &local_err); if (local_err) { error_propagate(errp, local_err); return; } state->overlay_appended = true; }
{ "code": [ " flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_COPY_ON_READ);", " flags |= BDRV_O_NO_BACKING;" ], "line_no": [ 197, 249 ] }
static void FUNC_0(BlkActionState *VAR_0, Error **VAR_1) { int VAR_2 = 0; QDict *options = NULL; Error *local_err = NULL; const char *VAR_3; const char *VAR_4; const char *VAR_5; const char *VAR_6; ExternalSnapshotState *state = DO_UPCAST(ExternalSnapshotState, VAR_0, VAR_0); TransactionAction *action = VAR_0->action; switch (action->type) { case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT: { BlockdevSnapshot *s = action->u.blockdev_snapshot.data; VAR_3 = s->node; VAR_4 = s->node; VAR_6 = NULL; VAR_5 = s->overlay; } break; case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC: { BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync.data; VAR_3 = s->has_device ? s->VAR_3 : NULL; VAR_4 = s->has_node_name ? s->VAR_4 : NULL; VAR_6 = s->snapshot_file; VAR_5 = NULL; } break; default: g_assert_not_reached(); } if (action_check_completion_mode(VAR_0, VAR_1) < 0) { return; } state->old_bs = bdrv_lookup_bs(VAR_3, VAR_4, VAR_1); if (!state->old_bs) { return; } state->aio_context = bdrv_get_aio_context(state->old_bs); aio_context_acquire(state->aio_context); bdrv_drained_begin(state->old_bs); if (!bdrv_is_inserted(state->old_bs)) { error_setg(VAR_1, QERR_DEVICE_HAS_NO_MEDIUM, VAR_3); return; } if (bdrv_op_is_blocked(state->old_bs, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, VAR_1)) { return; } if (!bdrv_is_read_only(state->old_bs)) { if (bdrv_flush(state->old_bs)) { error_setg(VAR_1, QERR_IO_ERROR); return; } } if (!bdrv_is_first_non_filter(state->old_bs)) { error_setg(VAR_1, QERR_FEATURE_DISABLED, "snapshot"); return; } if (action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC) { BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync.data; const char *VAR_7 = s->has_format ? s->VAR_7 : "qcow2"; enum NewImageMode VAR_8; const char *VAR_9 = s->has_snapshot_node_name ? s->VAR_9 : NULL; if (VAR_4 && !VAR_9) { error_setg(VAR_1, "New snapshot node name missing"); return; } if (VAR_9 && bdrv_lookup_bs(VAR_9, VAR_9, NULL)) { error_setg(VAR_1, "New snapshot node name already in use"); return; } VAR_2 = state->old_bs->open_flags; VAR_2 &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_COPY_ON_READ); VAR_8 = s->has_mode ? s->VAR_8 : NEW_IMAGE_MODE_ABSOLUTE_PATHS; if (VAR_8 != NEW_IMAGE_MODE_EXISTING) { int64_t size = bdrv_getlength(state->old_bs); if (size < 0) { error_setg_errno(VAR_1, -size, "bdrv_getlength failed"); return; } bdrv_img_create(VAR_6, VAR_7, state->old_bs->filename, state->old_bs->drv->format_name, NULL, size, VAR_2, false, &local_err); if (local_err) { error_propagate(VAR_1, local_err); return; } } options = qdict_new(); if (s->has_snapshot_node_name) { qdict_put_str(options, "node-name", VAR_9); } qdict_put_str(options, "driver", VAR_7); VAR_2 |= BDRV_O_NO_BACKING; } state->new_bs = bdrv_open(VAR_6, VAR_5, options, VAR_2, VAR_1); if (!state->new_bs) { return; } if (bdrv_has_blk(state->new_bs)) { error_setg(VAR_1, "The snapshot is already in use"); return; } if (bdrv_op_is_blocked(state->new_bs, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, VAR_1)) { return; } if (state->new_bs->backing != NULL) { error_setg(VAR_1, "The snapshot already has a backing image"); return; } if (!state->new_bs->drv->supports_backing) { error_setg(VAR_1, "The snapshot does not support backing images"); return; } bdrv_set_aio_context(state->new_bs, state->aio_context); bdrv_ref(state->new_bs); bdrv_append(state->new_bs, state->old_bs, &local_err); if (local_err) { error_propagate(VAR_1, local_err); return; } state->overlay_appended = true; }
[ "static void FUNC_0(BlkActionState *VAR_0,\nError **VAR_1)\n{", "int VAR_2 = 0;", "QDict *options = NULL;", "Error *local_err = NULL;", "const char *VAR_3;", "const char *VAR_4;", "const char *VAR_5;", "const char *VAR_6;", "ExternalSnapshotState *state =\nDO_UPCAST(ExternalSnapshotState, VAR_0, VAR_0);", "TransactionAction *action = VAR_0->action;", "switch (action->type) {", "case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT:\n{", "BlockdevSnapshot *s = action->u.blockdev_snapshot.data;", "VAR_3 = s->node;", "VAR_4 = s->node;", "VAR_6 = NULL;", "VAR_5 = s->overlay;", "}", "break;", "case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC:\n{", "BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync.data;", "VAR_3 = s->has_device ? s->VAR_3 : NULL;", "VAR_4 = s->has_node_name ? s->VAR_4 : NULL;", "VAR_6 = s->snapshot_file;", "VAR_5 = NULL;", "}", "break;", "default:\ng_assert_not_reached();", "}", "if (action_check_completion_mode(VAR_0, VAR_1) < 0) {", "return;", "}", "state->old_bs = bdrv_lookup_bs(VAR_3, VAR_4, VAR_1);", "if (!state->old_bs) {", "return;", "}", "state->aio_context = bdrv_get_aio_context(state->old_bs);", "aio_context_acquire(state->aio_context);", "bdrv_drained_begin(state->old_bs);", "if (!bdrv_is_inserted(state->old_bs)) {", "error_setg(VAR_1, QERR_DEVICE_HAS_NO_MEDIUM, VAR_3);", "return;", "}", "if (bdrv_op_is_blocked(state->old_bs,\nBLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, VAR_1)) {", "return;", "}", "if (!bdrv_is_read_only(state->old_bs)) {", "if (bdrv_flush(state->old_bs)) {", "error_setg(VAR_1, QERR_IO_ERROR);", "return;", "}", "}", "if (!bdrv_is_first_non_filter(state->old_bs)) {", "error_setg(VAR_1, QERR_FEATURE_DISABLED, \"snapshot\");", "return;", "}", "if (action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC) {", "BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync.data;", "const char *VAR_7 = s->has_format ? s->VAR_7 : \"qcow2\";", "enum NewImageMode VAR_8;", "const char *VAR_9 =\ns->has_snapshot_node_name ? s->VAR_9 : NULL;", "if (VAR_4 && !VAR_9) {", "error_setg(VAR_1, \"New snapshot node name missing\");", "return;", "}", "if (VAR_9 &&\nbdrv_lookup_bs(VAR_9, VAR_9, NULL)) {", "error_setg(VAR_1, \"New snapshot node name already in use\");", "return;", "}", "VAR_2 = state->old_bs->open_flags;", "VAR_2 &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_COPY_ON_READ);", "VAR_8 = s->has_mode ? s->VAR_8 : NEW_IMAGE_MODE_ABSOLUTE_PATHS;", "if (VAR_8 != NEW_IMAGE_MODE_EXISTING) {", "int64_t size = bdrv_getlength(state->old_bs);", "if (size < 0) {", "error_setg_errno(VAR_1, -size, \"bdrv_getlength failed\");", "return;", "}", "bdrv_img_create(VAR_6, VAR_7,\nstate->old_bs->filename,\nstate->old_bs->drv->format_name,\nNULL, size, VAR_2, false, &local_err);", "if (local_err) {", "error_propagate(VAR_1, local_err);", "return;", "}", "}", "options = qdict_new();", "if (s->has_snapshot_node_name) {", "qdict_put_str(options, \"node-name\", VAR_9);", "}", "qdict_put_str(options, \"driver\", VAR_7);", "VAR_2 |= BDRV_O_NO_BACKING;", "}", "state->new_bs = bdrv_open(VAR_6, VAR_5, options, VAR_2,\nVAR_1);", "if (!state->new_bs) {", "return;", "}", "if (bdrv_has_blk(state->new_bs)) {", "error_setg(VAR_1, \"The snapshot is already in use\");", "return;", "}", "if (bdrv_op_is_blocked(state->new_bs, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT,\nVAR_1)) {", "return;", "}", "if (state->new_bs->backing != NULL) {", "error_setg(VAR_1, \"The snapshot already has a backing image\");", "return;", "}", "if (!state->new_bs->drv->supports_backing) {", "error_setg(VAR_1, \"The snapshot does not support backing images\");", "return;", "}", "bdrv_set_aio_context(state->new_bs, state->aio_context);", "bdrv_ref(state->new_bs);", "bdrv_append(state->new_bs, state->old_bs, &local_err);", "if (local_err) {", "error_propagate(VAR_1, local_err);", "return;", "}", "state->overlay_appended = true;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217, 219, 221, 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249 ], [ 251 ], [ 255, 257 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 279, 281 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 309 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ] ]
11,506
void qemu_system_reset(bool report) { MachineClass *mc; mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL; cpu_synchronize_all_states(); if (mc && mc->reset) { mc->reset(); } else { qemu_devices_reset(); } if (report) { qapi_event_send_reset(&error_abort); } cpu_synchronize_all_post_reset(); }
true
qemu
aedbe19297907143f17b733a7ff0e0534377bed1
void qemu_system_reset(bool report) { MachineClass *mc; mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL; cpu_synchronize_all_states(); if (mc && mc->reset) { mc->reset(); } else { qemu_devices_reset(); } if (report) { qapi_event_send_reset(&error_abort); } cpu_synchronize_all_post_reset(); }
{ "code": [ "void qemu_system_reset(bool report)", " if (report) {" ], "line_no": [ 1, 27 ] }
void FUNC_0(bool VAR_0) { MachineClass *mc; mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL; cpu_synchronize_all_states(); if (mc && mc->reset) { mc->reset(); } else { qemu_devices_reset(); } if (VAR_0) { qapi_event_send_reset(&error_abort); } cpu_synchronize_all_post_reset(); }
[ "void FUNC_0(bool VAR_0)\n{", "MachineClass *mc;", "mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL;", "cpu_synchronize_all_states();", "if (mc && mc->reset) {", "mc->reset();", "} else {", "qemu_devices_reset();", "}", "if (VAR_0) {", "qapi_event_send_reset(&error_abort);", "}", "cpu_synchronize_all_post_reset();", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
11,507
void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq, DBDMA_rw rw, DBDMA_flush flush, void *opaque) { DBDMAState *s = dbdma; DBDMA_channel *ch = &s->channels[nchan]; DBDMA_DPRINTF("DBDMA_register_channel 0x%x\n", nchan); ch->irq = irq; ch->channel = nchan; ch->rw = rw; ch->flush = flush; ch->io.opaque = opaque; ch->io.channel = ch; }
true
qemu
7f0d763ce60fd0563cb71c85ae0f86ee71b7edcc
void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq, DBDMA_rw rw, DBDMA_flush flush, void *opaque) { DBDMAState *s = dbdma; DBDMA_channel *ch = &s->channels[nchan]; DBDMA_DPRINTF("DBDMA_register_channel 0x%x\n", nchan); ch->irq = irq; ch->channel = nchan; ch->rw = rw; ch->flush = flush; ch->io.opaque = opaque; ch->io.channel = ch; }
{ "code": [ " ch->channel = nchan;" ], "line_no": [ 21 ] }
void FUNC_0(void *VAR_0, int VAR_1, qemu_irq VAR_2, DBDMA_rw VAR_3, DBDMA_flush VAR_4, void *VAR_5) { DBDMAState *s = VAR_0; DBDMA_channel *ch = &s->channels[VAR_1]; DBDMA_DPRINTF("FUNC_0 0x%x\n", VAR_1); ch->VAR_2 = VAR_2; ch->channel = VAR_1; ch->VAR_3 = VAR_3; ch->VAR_4 = VAR_4; ch->io.VAR_5 = VAR_5; ch->io.channel = ch; }
[ "void FUNC_0(void *VAR_0, int VAR_1, qemu_irq VAR_2,\nDBDMA_rw VAR_3, DBDMA_flush VAR_4,\nvoid *VAR_5)\n{", "DBDMAState *s = VAR_0;", "DBDMA_channel *ch = &s->channels[VAR_1];", "DBDMA_DPRINTF(\"FUNC_0 0x%x\\n\", VAR_1);", "ch->VAR_2 = VAR_2;", "ch->channel = VAR_1;", "ch->VAR_3 = VAR_3;", "ch->VAR_4 = VAR_4;", "ch->io.VAR_5 = VAR_5;", "ch->io.channel = ch;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
11,508
void vp78_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe, VP8Frame *prev_frame, int is_vp7) { VP8Context *s = avctx->priv_data; int mb_x, mb_y; s->mv_min.y = -MARGIN; s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (mb_y = 0; mb_y < s->mb_height; mb_y++) { VP8Macroblock *mb = s->macroblocks_base + ((s->mb_width + 1) * (mb_y + 1) + 1); int mb_xy = mb_y * s->mb_width; AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED * 0x01010101); s->mv_min.x = -MARGIN; s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN; for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) { if (mb_y == 0) AV_WN32A((mb - s->mb_width - 1)->intra4x4_pred_mode_top, DC_PRED * 0x01010101); decode_mb_mode(s, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy, prev_frame && prev_frame->seg_map ? prev_frame->seg_map->data + mb_xy : NULL, 1, is_vp7); s->mv_min.x -= 64; s->mv_max.x -= 64; } s->mv_min.y -= 64; s->mv_max.y -= 64; } }
true
FFmpeg
fed92adbb3fc6cbf735e3df9a2f7d0a2917fcfbd
void vp78_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe, VP8Frame *prev_frame, int is_vp7) { VP8Context *s = avctx->priv_data; int mb_x, mb_y; s->mv_min.y = -MARGIN; s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (mb_y = 0; mb_y < s->mb_height; mb_y++) { VP8Macroblock *mb = s->macroblocks_base + ((s->mb_width + 1) * (mb_y + 1) + 1); int mb_xy = mb_y * s->mb_width; AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED * 0x01010101); s->mv_min.x = -MARGIN; s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN; for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) { if (mb_y == 0) AV_WN32A((mb - s->mb_width - 1)->intra4x4_pred_mode_top, DC_PRED * 0x01010101); decode_mb_mode(s, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy, prev_frame && prev_frame->seg_map ? prev_frame->seg_map->data + mb_xy : NULL, 1, is_vp7); s->mv_min.x -= 64; s->mv_max.x -= 64; } s->mv_min.y -= 64; s->mv_max.y -= 64; } }
{ "code": [ " s->mv_min.y = -MARGIN;", " s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;", " s->mv_min.x = -MARGIN;", " s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;", " decode_mb_mode(s, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy,", " s->mv_min.x -= 64;", " s->mv_max.x -= 64;", " s->mv_min.y -= 64;", " s->mv_max.y -= 64;", " decode_mb_mode(s, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy,", " s->mv_min.y -= 64;", " s->mv_max.y -= 64;" ], "line_no": [ 13, 15, 31, 33, 43, 49, 51, 55, 57, 43, 55, 57 ] }
void FUNC_0(AVCodecContext *VAR_0, VP8Frame *VAR_1, VP8Frame *VAR_2, int VAR_3) { VP8Context *s = VAR_0->priv_data; int VAR_4, VAR_5; s->mv_min.y = -MARGIN; s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (VAR_5 = 0; VAR_5 < s->mb_height; VAR_5++) { VP8Macroblock *mb = s->macroblocks_base + ((s->mb_width + 1) * (VAR_5 + 1) + 1); int mb_xy = VAR_5 * s->mb_width; AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED * 0x01010101); s->mv_min.x = -MARGIN; s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN; for (VAR_4 = 0; VAR_4 < s->mb_width; VAR_4++, mb_xy++, mb++) { if (VAR_5 == 0) AV_WN32A((mb - s->mb_width - 1)->intra4x4_pred_mode_top, DC_PRED * 0x01010101); decode_mb_mode(s, mb, VAR_4, VAR_5, VAR_1->seg_map->data + mb_xy, VAR_2 && VAR_2->seg_map ? VAR_2->seg_map->data + mb_xy : NULL, 1, VAR_3); s->mv_min.x -= 64; s->mv_max.x -= 64; } s->mv_min.y -= 64; s->mv_max.y -= 64; } }
[ "void FUNC_0(AVCodecContext *VAR_0, VP8Frame *VAR_1,\nVP8Frame *VAR_2, int VAR_3)\n{", "VP8Context *s = VAR_0->priv_data;", "int VAR_4, VAR_5;", "s->mv_min.y = -MARGIN;", "s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;", "for (VAR_5 = 0; VAR_5 < s->mb_height; VAR_5++) {", "VP8Macroblock *mb = s->macroblocks_base +\n((s->mb_width + 1) * (VAR_5 + 1) + 1);", "int mb_xy = VAR_5 * s->mb_width;", "AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED * 0x01010101);", "s->mv_min.x = -MARGIN;", "s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;", "for (VAR_4 = 0; VAR_4 < s->mb_width; VAR_4++, mb_xy++, mb++) {", "if (VAR_5 == 0)\nAV_WN32A((mb - s->mb_width - 1)->intra4x4_pred_mode_top,\nDC_PRED * 0x01010101);", "decode_mb_mode(s, mb, VAR_4, VAR_5, VAR_1->seg_map->data + mb_xy,\nVAR_2 && VAR_2->seg_map ?\nVAR_2->seg_map->data + mb_xy : NULL, 1, VAR_3);", "s->mv_min.x -= 64;", "s->mv_max.x -= 64;", "}", "s->mv_min.y -= 64;", "s->mv_max.y -= 64;", "}", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39, 41 ], [ 43, 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
11,509
static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst, int size, int c, int a, int d, int width, ptrdiff_t stride) { PixletContext *ctx = avctx->priv_data; GetBitContext *b = &ctx->gbit; unsigned cnt1, shbits, rlen, nbits, length, i = 0, j = 0, k; int ret, escape, pfx, value, yflag, xflag, flag = 0; int64_t state = 3, tmp; if ((ret = init_get_bits8(b, src, bytestream2_get_bytes_left(&ctx->gb))) < 0) return ret; if ((a >= 0) + (a ^ (a >> 31)) - (a >> 31) != 1) { nbits = 33 - ff_clz((a >= 0) + (a ^ (a >> 31)) - (a >> 31) - 1); if (nbits > 16) return AVERROR_INVALIDDATA; } else { nbits = 1; } length = 25 - nbits; while (i < size) { if (state >> 8 != -3) { value = ff_clz((state >> 8) + 3) ^ 0x1F; } else { value = -1; } cnt1 = get_unary(b, 0, length); if (cnt1 >= length) { cnt1 = get_bits(b, nbits); } else { pfx = 14 + ((((uint64_t)(value - 14)) >> 32) & (value - 14)); cnt1 *= (1 << pfx) - 1; shbits = show_bits(b, pfx); if (shbits <= 1) { skip_bits(b, pfx - 1); } else { skip_bits(b, pfx); cnt1 += shbits - 1; } } xflag = flag + cnt1; yflag = xflag; if (flag + cnt1 == 0) { value = 0; } else { xflag &= 1u; tmp = c * ((yflag + 1) >> 1) + (c >> 1); value = xflag + (tmp ^ -xflag); } i++; dst[j++] = value; if (j == width) { j = 0; dst += stride; } state += d * yflag - (d * state >> 8); flag = 0; if (state * 4 > 0xFF || i >= size) continue; pfx = ((state + 8) >> 5) + (state ? ff_clz(state): 32) - 24; escape = av_mod_uintp2(16383, pfx); cnt1 = get_unary(b, 0, 8); if (cnt1 < 8) { if (pfx < 1 || pfx > 25) return AVERROR_INVALIDDATA; value = show_bits(b, pfx); if (value > 1) { skip_bits(b, pfx); rlen = value + escape * cnt1 - 1; } else { skip_bits(b, pfx - 1); rlen = escape * cnt1; } } else { if (get_bits1(b)) value = get_bits(b, 16); else value = get_bits(b, 8); rlen = value + 8 * escape; } if (rlen > 0xFFFF || i + rlen > size) return AVERROR_INVALIDDATA; i += rlen; for (k = 0; k < rlen; k++) { dst[j++] = 0; if (j == width) { j = 0; dst += stride; } } state = 0; flag = rlen < 0xFFFF ? 1 : 0; } align_get_bits(b); return get_bits_count(b) >> 3; }
true
FFmpeg
ab31b46b89362041a8e37cb0aac67cf3b53c2524
static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst, int size, int c, int a, int d, int width, ptrdiff_t stride) { PixletContext *ctx = avctx->priv_data; GetBitContext *b = &ctx->gbit; unsigned cnt1, shbits, rlen, nbits, length, i = 0, j = 0, k; int ret, escape, pfx, value, yflag, xflag, flag = 0; int64_t state = 3, tmp; if ((ret = init_get_bits8(b, src, bytestream2_get_bytes_left(&ctx->gb))) < 0) return ret; if ((a >= 0) + (a ^ (a >> 31)) - (a >> 31) != 1) { nbits = 33 - ff_clz((a >= 0) + (a ^ (a >> 31)) - (a >> 31) - 1); if (nbits > 16) return AVERROR_INVALIDDATA; } else { nbits = 1; } length = 25 - nbits; while (i < size) { if (state >> 8 != -3) { value = ff_clz((state >> 8) + 3) ^ 0x1F; } else { value = -1; } cnt1 = get_unary(b, 0, length); if (cnt1 >= length) { cnt1 = get_bits(b, nbits); } else { pfx = 14 + ((((uint64_t)(value - 14)) >> 32) & (value - 14)); cnt1 *= (1 << pfx) - 1; shbits = show_bits(b, pfx); if (shbits <= 1) { skip_bits(b, pfx - 1); } else { skip_bits(b, pfx); cnt1 += shbits - 1; } } xflag = flag + cnt1; yflag = xflag; if (flag + cnt1 == 0) { value = 0; } else { xflag &= 1u; tmp = c * ((yflag + 1) >> 1) + (c >> 1); value = xflag + (tmp ^ -xflag); } i++; dst[j++] = value; if (j == width) { j = 0; dst += stride; } state += d * yflag - (d * state >> 8); flag = 0; if (state * 4 > 0xFF || i >= size) continue; pfx = ((state + 8) >> 5) + (state ? ff_clz(state): 32) - 24; escape = av_mod_uintp2(16383, pfx); cnt1 = get_unary(b, 0, 8); if (cnt1 < 8) { if (pfx < 1 || pfx > 25) return AVERROR_INVALIDDATA; value = show_bits(b, pfx); if (value > 1) { skip_bits(b, pfx); rlen = value + escape * cnt1 - 1; } else { skip_bits(b, pfx - 1); rlen = escape * cnt1; } } else { if (get_bits1(b)) value = get_bits(b, 16); else value = get_bits(b, 8); rlen = value + 8 * escape; } if (rlen > 0xFFFF || i + rlen > size) return AVERROR_INVALIDDATA; i += rlen; for (k = 0; k < rlen; k++) { dst[j++] = 0; if (j == width) { j = 0; dst += stride; } } state = 0; flag = rlen < 0xFFFF ? 1 : 0; } align_get_bits(b); return get_bits_count(b) >> 3; }
{ "code": [ " tmp = c * ((yflag + 1) >> 1) + (c >> 1);", " state += d * yflag - (d * state >> 8);" ], "line_no": [ 107, 127 ] }
static int FUNC_0(AVCodecContext *VAR_0, uint8_t *VAR_1, int16_t *VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, ptrdiff_t VAR_8) { PixletContext *ctx = VAR_0->priv_data; GetBitContext *b = &ctx->gbit; unsigned VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14 = 0, VAR_15 = 0, VAR_16; int VAR_17, VAR_18, VAR_19, VAR_20, VAR_21, VAR_22, VAR_23 = 0; int64_t state = 3, tmp; if ((VAR_17 = init_get_bits8(b, VAR_1, bytestream2_get_bytes_left(&ctx->gb))) < 0) return VAR_17; if ((VAR_5 >= 0) + (VAR_5 ^ (VAR_5 >> 31)) - (VAR_5 >> 31) != 1) { VAR_12 = 33 - ff_clz((VAR_5 >= 0) + (VAR_5 ^ (VAR_5 >> 31)) - (VAR_5 >> 31) - 1); if (VAR_12 > 16) return AVERROR_INVALIDDATA; } else { VAR_12 = 1; } VAR_13 = 25 - VAR_12; while (VAR_14 < VAR_3) { if (state >> 8 != -3) { VAR_20 = ff_clz((state >> 8) + 3) ^ 0x1F; } else { VAR_20 = -1; } VAR_9 = get_unary(b, 0, VAR_13); if (VAR_9 >= VAR_13) { VAR_9 = get_bits(b, VAR_12); } else { VAR_19 = 14 + ((((uint64_t)(VAR_20 - 14)) >> 32) & (VAR_20 - 14)); VAR_9 *= (1 << VAR_19) - 1; VAR_10 = show_bits(b, VAR_19); if (VAR_10 <= 1) { skip_bits(b, VAR_19 - 1); } else { skip_bits(b, VAR_19); VAR_9 += VAR_10 - 1; } } VAR_22 = VAR_23 + VAR_9; VAR_21 = VAR_22; if (VAR_23 + VAR_9 == 0) { VAR_20 = 0; } else { VAR_22 &= 1u; tmp = VAR_4 * ((VAR_21 + 1) >> 1) + (VAR_4 >> 1); VAR_20 = VAR_22 + (tmp ^ -VAR_22); } VAR_14++; VAR_2[VAR_15++] = VAR_20; if (VAR_15 == VAR_7) { VAR_15 = 0; VAR_2 += VAR_8; } state += VAR_6 * VAR_21 - (VAR_6 * state >> 8); VAR_23 = 0; if (state * 4 > 0xFF || VAR_14 >= VAR_3) continue; VAR_19 = ((state + 8) >> 5) + (state ? ff_clz(state): 32) - 24; VAR_18 = av_mod_uintp2(16383, VAR_19); VAR_9 = get_unary(b, 0, 8); if (VAR_9 < 8) { if (VAR_19 < 1 || VAR_19 > 25) return AVERROR_INVALIDDATA; VAR_20 = show_bits(b, VAR_19); if (VAR_20 > 1) { skip_bits(b, VAR_19); VAR_11 = VAR_20 + VAR_18 * VAR_9 - 1; } else { skip_bits(b, VAR_19 - 1); VAR_11 = VAR_18 * VAR_9; } } else { if (get_bits1(b)) VAR_20 = get_bits(b, 16); else VAR_20 = get_bits(b, 8); VAR_11 = VAR_20 + 8 * VAR_18; } if (VAR_11 > 0xFFFF || VAR_14 + VAR_11 > VAR_3) return AVERROR_INVALIDDATA; VAR_14 += VAR_11; for (VAR_16 = 0; VAR_16 < VAR_11; VAR_16++) { VAR_2[VAR_15++] = 0; if (VAR_15 == VAR_7) { VAR_15 = 0; VAR_2 += VAR_8; } } state = 0; VAR_23 = VAR_11 < 0xFFFF ? 1 : 0; } align_get_bits(b); return get_bits_count(b) >> 3; }
[ "static int FUNC_0(AVCodecContext *VAR_0, uint8_t *VAR_1, int16_t *VAR_2, int VAR_3,\nint VAR_4, int VAR_5, int VAR_6,\nint VAR_7, ptrdiff_t VAR_8)\n{", "PixletContext *ctx = VAR_0->priv_data;", "GetBitContext *b = &ctx->gbit;", "unsigned VAR_9, VAR_10, VAR_11, VAR_12, VAR_13, VAR_14 = 0, VAR_15 = 0, VAR_16;", "int VAR_17, VAR_18, VAR_19, VAR_20, VAR_21, VAR_22, VAR_23 = 0;", "int64_t state = 3, tmp;", "if ((VAR_17 = init_get_bits8(b, VAR_1, bytestream2_get_bytes_left(&ctx->gb))) < 0)\nreturn VAR_17;", "if ((VAR_5 >= 0) + (VAR_5 ^ (VAR_5 >> 31)) - (VAR_5 >> 31) != 1) {", "VAR_12 = 33 - ff_clz((VAR_5 >= 0) + (VAR_5 ^ (VAR_5 >> 31)) - (VAR_5 >> 31) - 1);", "if (VAR_12 > 16)\nreturn AVERROR_INVALIDDATA;", "} else {", "VAR_12 = 1;", "}", "VAR_13 = 25 - VAR_12;", "while (VAR_14 < VAR_3) {", "if (state >> 8 != -3) {", "VAR_20 = ff_clz((state >> 8) + 3) ^ 0x1F;", "} else {", "VAR_20 = -1;", "}", "VAR_9 = get_unary(b, 0, VAR_13);", "if (VAR_9 >= VAR_13) {", "VAR_9 = get_bits(b, VAR_12);", "} else {", "VAR_19 = 14 + ((((uint64_t)(VAR_20 - 14)) >> 32) & (VAR_20 - 14));", "VAR_9 *= (1 << VAR_19) - 1;", "VAR_10 = show_bits(b, VAR_19);", "if (VAR_10 <= 1) {", "skip_bits(b, VAR_19 - 1);", "} else {", "skip_bits(b, VAR_19);", "VAR_9 += VAR_10 - 1;", "}", "}", "VAR_22 = VAR_23 + VAR_9;", "VAR_21 = VAR_22;", "if (VAR_23 + VAR_9 == 0) {", "VAR_20 = 0;", "} else {", "VAR_22 &= 1u;", "tmp = VAR_4 * ((VAR_21 + 1) >> 1) + (VAR_4 >> 1);", "VAR_20 = VAR_22 + (tmp ^ -VAR_22);", "}", "VAR_14++;", "VAR_2[VAR_15++] = VAR_20;", "if (VAR_15 == VAR_7) {", "VAR_15 = 0;", "VAR_2 += VAR_8;", "}", "state += VAR_6 * VAR_21 - (VAR_6 * state >> 8);", "VAR_23 = 0;", "if (state * 4 > 0xFF || VAR_14 >= VAR_3)\ncontinue;", "VAR_19 = ((state + 8) >> 5) + (state ? ff_clz(state): 32) - 24;", "VAR_18 = av_mod_uintp2(16383, VAR_19);", "VAR_9 = get_unary(b, 0, 8);", "if (VAR_9 < 8) {", "if (VAR_19 < 1 || VAR_19 > 25)\nreturn AVERROR_INVALIDDATA;", "VAR_20 = show_bits(b, VAR_19);", "if (VAR_20 > 1) {", "skip_bits(b, VAR_19);", "VAR_11 = VAR_20 + VAR_18 * VAR_9 - 1;", "} else {", "skip_bits(b, VAR_19 - 1);", "VAR_11 = VAR_18 * VAR_9;", "}", "} else {", "if (get_bits1(b))\nVAR_20 = get_bits(b, 16);", "else\nVAR_20 = get_bits(b, 8);", "VAR_11 = VAR_20 + 8 * VAR_18;", "}", "if (VAR_11 > 0xFFFF || VAR_14 + VAR_11 > VAR_3)\nreturn AVERROR_INVALIDDATA;", "VAR_14 += VAR_11;", "for (VAR_16 = 0; VAR_16 < VAR_11; VAR_16++) {", "VAR_2[VAR_15++] = 0;", "if (VAR_15 == VAR_7) {", "VAR_15 = 0;", "VAR_2 += VAR_8;", "}", "}", "state = 0;", "VAR_23 = VAR_11 < 0xFFFF ? 1 : 0;", "}", "align_get_bits(b);", "return get_bits_count(b) >> 3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 135, 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 175, 177 ], [ 181 ], [ 183 ], [ 187, 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211 ], [ 213 ], [ 215 ], [ 219 ], [ 221 ], [ 223 ] ]
11,510
static void vc1_decode_i_blocks_adv(VC1Context *v) { int k; MpegEncContext *s = &v->s; int cbp, val; uint8_t *coded_val; int mb_pos; int mquant = v->pq; int mqdiff; GetBitContext *gb = &s->gb; /* select codingmode used for VLC tables selection */ switch(v->y_ac_table_index){ case 0: v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; break; case 1: v->codingset = CS_HIGH_MOT_INTRA; break; case 2: v->codingset = CS_MID_RATE_INTRA; break; } switch(v->c_ac_table_index){ case 0: v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; break; case 1: v->codingset2 = CS_HIGH_MOT_INTER; break; case 2: v->codingset2 = CS_MID_RATE_INTER; break; } //do frame decode s->mb_x = s->mb_y = 0; s->mb_intra = 1; s->first_slice_line = 1; s->mb_y = s->start_mb_y; if (s->start_mb_y) { s->mb_x = 0; ff_init_block_index(s); memset(&s->coded_block[s->block_index[0]-s->b8_stride], 0, s->b8_stride * sizeof(*s->coded_block)); } for(; s->mb_y < s->end_mb_y; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); for(;s->mb_x < s->mb_width; s->mb_x++) { DCTELEM (*block)[64] = v->block[v->cur_blk_idx]; ff_update_block_index(s); s->dsp.clear_blocks(block[0]); mb_pos = s->mb_x + s->mb_y * s->mb_stride; s->current_picture.f.mb_type[mb_pos] = MB_TYPE_INTRA; s->current_picture.f.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.f.motion_val[1][s->block_index[0]][1] = 0; // do actual MB decoding and displaying cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2); if(v->acpred_is_raw) v->s.ac_pred = get_bits1(&v->s.gb); else v->s.ac_pred = v->acpred_plane[mb_pos]; if (v->condover == CONDOVER_SELECT && v->overflg_is_raw) v->over_flags_plane[mb_pos] = get_bits1(&v->s.gb); GET_MQUANT(); s->current_picture.f.qscale_table[mb_pos] = mquant; /* Set DC scale - y and c use the same */ s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; for(k = 0; k < 6; k++) { val = ((cbp >> (5 - k)) & 1); if (k < 4) { int pred = vc1_coded_block_pred(&v->s, k, &coded_val); val = val ^ pred; *coded_val = val; } cbp |= val << (5 - k); v->a_avail = !s->first_slice_line || (k==2 || k==3); v->c_avail = !!s->mb_x || (k==1 || k==3); vc1_decode_i_block_adv(v, block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant); if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(block[k]); } vc1_smooth_overlap_filter_iblk(v); vc1_put_signed_blocks_clamped(v); if(v->s.loop_filter) vc1_loop_filter_iblk_delayed(v, v->pq); if(get_bits_count(&s->gb) > v->bits) { ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits); return; } } if (!v->s.loop_filter) ff_draw_horiz_band(s, s->mb_y * 16, 16); else if (s->mb_y) ff_draw_horiz_band(s, (s->mb_y-1) * 16, 16); s->first_slice_line = 0; } /* raw bottom MB row */ s->mb_x = 0; ff_init_block_index(s); for(;s->mb_x < s->mb_width; s->mb_x++) { ff_update_block_index(s); vc1_put_signed_blocks_clamped(v); if(v->s.loop_filter) vc1_loop_filter_iblk_delayed(v, v->pq); } if (v->s.loop_filter) ff_draw_horiz_band(s, (s->mb_height-1)*16, 16); ff_er_add_slice(s, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, (AC_END|DC_END|MV_END)); }
true
FFmpeg
d4b9974465baf893e90527a366e7a7411ded1ef8
static void vc1_decode_i_blocks_adv(VC1Context *v) { int k; MpegEncContext *s = &v->s; int cbp, val; uint8_t *coded_val; int mb_pos; int mquant = v->pq; int mqdiff; GetBitContext *gb = &s->gb; switch(v->y_ac_table_index){ case 0: v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; break; case 1: v->codingset = CS_HIGH_MOT_INTRA; break; case 2: v->codingset = CS_MID_RATE_INTRA; break; } switch(v->c_ac_table_index){ case 0: v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; break; case 1: v->codingset2 = CS_HIGH_MOT_INTER; break; case 2: v->codingset2 = CS_MID_RATE_INTER; break; } s->mb_x = s->mb_y = 0; s->mb_intra = 1; s->first_slice_line = 1; s->mb_y = s->start_mb_y; if (s->start_mb_y) { s->mb_x = 0; ff_init_block_index(s); memset(&s->coded_block[s->block_index[0]-s->b8_stride], 0, s->b8_stride * sizeof(*s->coded_block)); } for(; s->mb_y < s->end_mb_y; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); for(;s->mb_x < s->mb_width; s->mb_x++) { DCTELEM (*block)[64] = v->block[v->cur_blk_idx]; ff_update_block_index(s); s->dsp.clear_blocks(block[0]); mb_pos = s->mb_x + s->mb_y * s->mb_stride; s->current_picture.f.mb_type[mb_pos] = MB_TYPE_INTRA; s->current_picture.f.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.f.motion_val[1][s->block_index[0]][1] = 0; cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2); if(v->acpred_is_raw) v->s.ac_pred = get_bits1(&v->s.gb); else v->s.ac_pred = v->acpred_plane[mb_pos]; if (v->condover == CONDOVER_SELECT && v->overflg_is_raw) v->over_flags_plane[mb_pos] = get_bits1(&v->s.gb); GET_MQUANT(); s->current_picture.f.qscale_table[mb_pos] = mquant; s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; for(k = 0; k < 6; k++) { val = ((cbp >> (5 - k)) & 1); if (k < 4) { int pred = vc1_coded_block_pred(&v->s, k, &coded_val); val = val ^ pred; *coded_val = val; } cbp |= val << (5 - k); v->a_avail = !s->first_slice_line || (k==2 || k==3); v->c_avail = !!s->mb_x || (k==1 || k==3); vc1_decode_i_block_adv(v, block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant); if (k > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(block[k]); } vc1_smooth_overlap_filter_iblk(v); vc1_put_signed_blocks_clamped(v); if(v->s.loop_filter) vc1_loop_filter_iblk_delayed(v, v->pq); if(get_bits_count(&s->gb) > v->bits) { ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits); return; } } if (!v->s.loop_filter) ff_draw_horiz_band(s, s->mb_y * 16, 16); else if (s->mb_y) ff_draw_horiz_band(s, (s->mb_y-1) * 16, 16); s->first_slice_line = 0; } s->mb_x = 0; ff_init_block_index(s); for(;s->mb_x < s->mb_width; s->mb_x++) { ff_update_block_index(s); vc1_put_signed_blocks_clamped(v); if(v->s.loop_filter) vc1_loop_filter_iblk_delayed(v, v->pq); } if (v->s.loop_filter) ff_draw_horiz_band(s, (s->mb_height-1)*16, 16); ff_er_add_slice(s, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, (AC_END|DC_END|MV_END)); }
{ "code": [ " s->b8_stride * sizeof(*s->coded_block));" ], "line_no": [ 91 ] }
static void FUNC_0(VC1Context *VAR_0) { int VAR_1; MpegEncContext *s = &VAR_0->s; int VAR_2, VAR_3; uint8_t *coded_val; int VAR_4; int VAR_5 = VAR_0->pq; int VAR_6; GetBitContext *gb = &s->gb; switch(VAR_0->y_ac_table_index){ case 0: VAR_0->codingset = (VAR_0->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA; break; case 1: VAR_0->codingset = CS_HIGH_MOT_INTRA; break; case 2: VAR_0->codingset = CS_MID_RATE_INTRA; break; } switch(VAR_0->c_ac_table_index){ case 0: VAR_0->codingset2 = (VAR_0->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER; break; case 1: VAR_0->codingset2 = CS_HIGH_MOT_INTER; break; case 2: VAR_0->codingset2 = CS_MID_RATE_INTER; break; } s->mb_x = s->mb_y = 0; s->mb_intra = 1; s->first_slice_line = 1; s->mb_y = s->start_mb_y; if (s->start_mb_y) { s->mb_x = 0; ff_init_block_index(s); memset(&s->coded_block[s->block_index[0]-s->b8_stride], 0, s->b8_stride * sizeof(*s->coded_block)); } for(; s->mb_y < s->end_mb_y; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); for(;s->mb_x < s->mb_width; s->mb_x++) { DCTELEM (*block)[64] = VAR_0->block[VAR_0->cur_blk_idx]; ff_update_block_index(s); s->dsp.clear_blocks(block[0]); VAR_4 = s->mb_x + s->mb_y * s->mb_stride; s->current_picture.f.mb_type[VAR_4] = MB_TYPE_INTRA; s->current_picture.f.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.f.motion_val[1][s->block_index[0]][1] = 0; VAR_2 = get_vlc2(&VAR_0->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2); if(VAR_0->acpred_is_raw) VAR_0->s.ac_pred = get_bits1(&VAR_0->s.gb); else VAR_0->s.ac_pred = VAR_0->acpred_plane[VAR_4]; if (VAR_0->condover == CONDOVER_SELECT && VAR_0->overflg_is_raw) VAR_0->over_flags_plane[VAR_4] = get_bits1(&VAR_0->s.gb); GET_MQUANT(); s->current_picture.f.qscale_table[VAR_4] = VAR_5; s->y_dc_scale = s->y_dc_scale_table[VAR_5]; s->c_dc_scale = s->c_dc_scale_table[VAR_5]; for(VAR_1 = 0; VAR_1 < 6; VAR_1++) { VAR_3 = ((VAR_2 >> (5 - VAR_1)) & 1); if (VAR_1 < 4) { int pred = vc1_coded_block_pred(&VAR_0->s, VAR_1, &coded_val); VAR_3 = VAR_3 ^ pred; *coded_val = VAR_3; } VAR_2 |= VAR_3 << (5 - VAR_1); VAR_0->a_avail = !s->first_slice_line || (VAR_1==2 || VAR_1==3); VAR_0->c_avail = !!s->mb_x || (VAR_1==1 || VAR_1==3); vc1_decode_i_block_adv(VAR_0, block[VAR_1], VAR_1, VAR_3, (VAR_1<4)? VAR_0->codingset : VAR_0->codingset2, VAR_5); if (VAR_1 > 3 && (s->flags & CODEC_FLAG_GRAY)) continue; VAR_0->vc1dsp.vc1_inv_trans_8x8(block[VAR_1]); } vc1_smooth_overlap_filter_iblk(VAR_0); vc1_put_signed_blocks_clamped(VAR_0); if(VAR_0->s.loop_filter) vc1_loop_filter_iblk_delayed(VAR_0, VAR_0->pq); if(get_bits_count(&s->gb) > VAR_0->bits) { ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)); av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), VAR_0->bits); return; } } if (!VAR_0->s.loop_filter) ff_draw_horiz_band(s, s->mb_y * 16, 16); else if (s->mb_y) ff_draw_horiz_band(s, (s->mb_y-1) * 16, 16); s->first_slice_line = 0; } s->mb_x = 0; ff_init_block_index(s); for(;s->mb_x < s->mb_width; s->mb_x++) { ff_update_block_index(s); vc1_put_signed_blocks_clamped(VAR_0); if(VAR_0->s.loop_filter) vc1_loop_filter_iblk_delayed(VAR_0, VAR_0->pq); } if (VAR_0->s.loop_filter) ff_draw_horiz_band(s, (s->mb_height-1)*16, 16); ff_er_add_slice(s, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, (AC_END|DC_END|MV_END)); }
[ "static void FUNC_0(VC1Context *VAR_0)\n{", "int VAR_1;", "MpegEncContext *s = &VAR_0->s;", "int VAR_2, VAR_3;", "uint8_t *coded_val;", "int VAR_4;", "int VAR_5 = VAR_0->pq;", "int VAR_6;", "GetBitContext *gb = &s->gb;", "switch(VAR_0->y_ac_table_index){", "case 0:\nVAR_0->codingset = (VAR_0->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA;", "break;", "case 1:\nVAR_0->codingset = CS_HIGH_MOT_INTRA;", "break;", "case 2:\nVAR_0->codingset = CS_MID_RATE_INTRA;", "break;", "}", "switch(VAR_0->c_ac_table_index){", "case 0:\nVAR_0->codingset2 = (VAR_0->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER;", "break;", "case 1:\nVAR_0->codingset2 = CS_HIGH_MOT_INTER;", "break;", "case 2:\nVAR_0->codingset2 = CS_MID_RATE_INTER;", "break;", "}", "s->mb_x = s->mb_y = 0;", "s->mb_intra = 1;", "s->first_slice_line = 1;", "s->mb_y = s->start_mb_y;", "if (s->start_mb_y) {", "s->mb_x = 0;", "ff_init_block_index(s);", "memset(&s->coded_block[s->block_index[0]-s->b8_stride], 0,\ns->b8_stride * sizeof(*s->coded_block));", "}", "for(; s->mb_y < s->end_mb_y; s->mb_y++) {", "s->mb_x = 0;", "ff_init_block_index(s);", "for(;s->mb_x < s->mb_width; s->mb_x++) {", "DCTELEM (*block)[64] = VAR_0->block[VAR_0->cur_blk_idx];", "ff_update_block_index(s);", "s->dsp.clear_blocks(block[0]);", "VAR_4 = s->mb_x + s->mb_y * s->mb_stride;", "s->current_picture.f.mb_type[VAR_4] = MB_TYPE_INTRA;", "s->current_picture.f.motion_val[1][s->block_index[0]][0] = 0;", "s->current_picture.f.motion_val[1][s->block_index[0]][1] = 0;", "VAR_2 = get_vlc2(&VAR_0->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);", "if(VAR_0->acpred_is_raw)\nVAR_0->s.ac_pred = get_bits1(&VAR_0->s.gb);", "else\nVAR_0->s.ac_pred = VAR_0->acpred_plane[VAR_4];", "if (VAR_0->condover == CONDOVER_SELECT && VAR_0->overflg_is_raw)\nVAR_0->over_flags_plane[VAR_4] = get_bits1(&VAR_0->s.gb);", "GET_MQUANT();", "s->current_picture.f.qscale_table[VAR_4] = VAR_5;", "s->y_dc_scale = s->y_dc_scale_table[VAR_5];", "s->c_dc_scale = s->c_dc_scale_table[VAR_5];", "for(VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "VAR_3 = ((VAR_2 >> (5 - VAR_1)) & 1);", "if (VAR_1 < 4) {", "int pred = vc1_coded_block_pred(&VAR_0->s, VAR_1, &coded_val);", "VAR_3 = VAR_3 ^ pred;", "*coded_val = VAR_3;", "}", "VAR_2 |= VAR_3 << (5 - VAR_1);", "VAR_0->a_avail = !s->first_slice_line || (VAR_1==2 || VAR_1==3);", "VAR_0->c_avail = !!s->mb_x || (VAR_1==1 || VAR_1==3);", "vc1_decode_i_block_adv(VAR_0, block[VAR_1], VAR_1, VAR_3, (VAR_1<4)? VAR_0->codingset : VAR_0->codingset2, VAR_5);", "if (VAR_1 > 3 && (s->flags & CODEC_FLAG_GRAY)) continue;", "VAR_0->vc1dsp.vc1_inv_trans_8x8(block[VAR_1]);", "}", "vc1_smooth_overlap_filter_iblk(VAR_0);", "vc1_put_signed_blocks_clamped(VAR_0);", "if(VAR_0->s.loop_filter) vc1_loop_filter_iblk_delayed(VAR_0, VAR_0->pq);", "if(get_bits_count(&s->gb) > VAR_0->bits) {", "ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));", "av_log(s->avctx, AV_LOG_ERROR, \"Bits overconsumption: %i > %i\\n\", get_bits_count(&s->gb), VAR_0->bits);", "return;", "}", "}", "if (!VAR_0->s.loop_filter)\nff_draw_horiz_band(s, s->mb_y * 16, 16);", "else if (s->mb_y)\nff_draw_horiz_band(s, (s->mb_y-1) * 16, 16);", "s->first_slice_line = 0;", "}", "s->mb_x = 0;", "ff_init_block_index(s);", "for(;s->mb_x < s->mb_width; s->mb_x++) {", "ff_update_block_index(s);", "vc1_put_signed_blocks_clamped(VAR_0);", "if(VAR_0->s.loop_filter) vc1_loop_filter_iblk_delayed(VAR_0, VAR_0->pq);", "}", "if (VAR_0->s.loop_filter)\nff_draw_horiz_band(s, (s->mb_height-1)*16, 16);", "ff_er_add_slice(s, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, (AC_END|DC_END|MV_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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 121 ], [ 123, 125 ], [ 127, 129 ], [ 133, 135 ], [ 139 ], [ 143 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211, 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241, 243 ], [ 245 ], [ 247 ] ]
11,511
static int rtp_mpegts_write_header(AVFormatContext *s) { struct MuxChain *chain = s->priv_data; AVFormatContext *mpegts_ctx = NULL, *rtp_ctx = NULL; AVOutputFormat *mpegts_format = av_guess_format("mpegts", NULL, NULL); AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); int i, ret = AVERROR(ENOMEM); AVStream *st; if (!mpegts_format || !rtp_format) return AVERROR(ENOSYS); mpegts_ctx = avformat_alloc_context(); if (!mpegts_ctx) return AVERROR(ENOMEM); mpegts_ctx->oformat = mpegts_format; mpegts_ctx->max_delay = s->max_delay; for (i = 0; i < s->nb_streams; i++) { AVStream* st = avformat_new_stream(mpegts_ctx, NULL); if (!st) st->time_base = s->streams[i]->time_base; st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; avcodec_parameters_copy(st->codecpar, s->streams[i]->codecpar); if ((ret = avio_open_dyn_buf(&mpegts_ctx->pb)) < 0) if ((ret = avformat_write_header(mpegts_ctx, NULL)) < 0) for (i = 0; i < s->nb_streams; i++) s->streams[i]->time_base = mpegts_ctx->streams[i]->time_base; chain->mpegts_ctx = mpegts_ctx; mpegts_ctx = NULL; rtp_ctx = avformat_alloc_context(); if (!rtp_ctx) { rtp_ctx->oformat = rtp_format; st = avformat_new_stream(rtp_ctx, NULL); st->time_base.num = 1; st->time_base.den = 90000; st->codecpar->codec_id = AV_CODEC_ID_MPEG2TS; rtp_ctx->pb = s->pb; if ((ret = avformat_write_header(rtp_ctx, NULL)) < 0) chain->rtp_ctx = rtp_ctx; return 0; fail: if (mpegts_ctx) { ffio_free_dyn_buf(&mpegts_ctx->pb); avformat_free_context(mpegts_ctx); if (rtp_ctx) avformat_free_context(rtp_ctx); rtp_mpegts_write_close(s); return ret;
true
FFmpeg
5b4baf1506277863e9c1fa4bd302a4653e859669
static int rtp_mpegts_write_header(AVFormatContext *s) { struct MuxChain *chain = s->priv_data; AVFormatContext *mpegts_ctx = NULL, *rtp_ctx = NULL; AVOutputFormat *mpegts_format = av_guess_format("mpegts", NULL, NULL); AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); int i, ret = AVERROR(ENOMEM); AVStream *st; if (!mpegts_format || !rtp_format) return AVERROR(ENOSYS); mpegts_ctx = avformat_alloc_context(); if (!mpegts_ctx) return AVERROR(ENOMEM); mpegts_ctx->oformat = mpegts_format; mpegts_ctx->max_delay = s->max_delay; for (i = 0; i < s->nb_streams; i++) { AVStream* st = avformat_new_stream(mpegts_ctx, NULL); if (!st) st->time_base = s->streams[i]->time_base; st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; avcodec_parameters_copy(st->codecpar, s->streams[i]->codecpar); if ((ret = avio_open_dyn_buf(&mpegts_ctx->pb)) < 0) if ((ret = avformat_write_header(mpegts_ctx, NULL)) < 0) for (i = 0; i < s->nb_streams; i++) s->streams[i]->time_base = mpegts_ctx->streams[i]->time_base; chain->mpegts_ctx = mpegts_ctx; mpegts_ctx = NULL; rtp_ctx = avformat_alloc_context(); if (!rtp_ctx) { rtp_ctx->oformat = rtp_format; st = avformat_new_stream(rtp_ctx, NULL); st->time_base.num = 1; st->time_base.den = 90000; st->codecpar->codec_id = AV_CODEC_ID_MPEG2TS; rtp_ctx->pb = s->pb; if ((ret = avformat_write_header(rtp_ctx, NULL)) < 0) chain->rtp_ctx = rtp_ctx; return 0; fail: if (mpegts_ctx) { ffio_free_dyn_buf(&mpegts_ctx->pb); avformat_free_context(mpegts_ctx); if (rtp_ctx) avformat_free_context(rtp_ctx); rtp_mpegts_write_close(s); return ret;
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { struct MuxChain *VAR_1 = VAR_0->priv_data; AVFormatContext *mpegts_ctx = NULL, *rtp_ctx = NULL; AVOutputFormat *mpegts_format = av_guess_format("mpegts", NULL, NULL); AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); int VAR_2, VAR_3 = AVERROR(ENOMEM); AVStream *st; if (!mpegts_format || !rtp_format) return AVERROR(ENOSYS); mpegts_ctx = avformat_alloc_context(); if (!mpegts_ctx) return AVERROR(ENOMEM); mpegts_ctx->oformat = mpegts_format; mpegts_ctx->max_delay = VAR_0->max_delay; for (VAR_2 = 0; VAR_2 < VAR_0->nb_streams; VAR_2++) { AVStream* st = avformat_new_stream(mpegts_ctx, NULL); if (!st) st->time_base = VAR_0->streams[VAR_2]->time_base; st->sample_aspect_ratio = VAR_0->streams[VAR_2]->sample_aspect_ratio; avcodec_parameters_copy(st->codecpar, VAR_0->streams[VAR_2]->codecpar); if ((VAR_3 = avio_open_dyn_buf(&mpegts_ctx->pb)) < 0) if ((VAR_3 = avformat_write_header(mpegts_ctx, NULL)) < 0) for (VAR_2 = 0; VAR_2 < VAR_0->nb_streams; VAR_2++) VAR_0->streams[VAR_2]->time_base = mpegts_ctx->streams[VAR_2]->time_base; VAR_1->mpegts_ctx = mpegts_ctx; mpegts_ctx = NULL; rtp_ctx = avformat_alloc_context(); if (!rtp_ctx) { rtp_ctx->oformat = rtp_format; st = avformat_new_stream(rtp_ctx, NULL); st->time_base.num = 1; st->time_base.den = 90000; st->codecpar->codec_id = AV_CODEC_ID_MPEG2TS; rtp_ctx->pb = VAR_0->pb; if ((VAR_3 = avformat_write_header(rtp_ctx, NULL)) < 0) VAR_1->rtp_ctx = rtp_ctx; return 0; fail: if (mpegts_ctx) { ffio_free_dyn_buf(&mpegts_ctx->pb); avformat_free_context(mpegts_ctx); if (rtp_ctx) avformat_free_context(rtp_ctx); rtp_mpegts_write_close(VAR_0); return VAR_3;
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "struct MuxChain *VAR_1 = VAR_0->priv_data;", "AVFormatContext *mpegts_ctx = NULL, *rtp_ctx = NULL;", "AVOutputFormat *mpegts_format = av_guess_format(\"mpegts\", NULL, NULL);", "AVOutputFormat *rtp_format = av_guess_format(\"rtp\", NULL, NULL);", "int VAR_2, VAR_3 = AVERROR(ENOMEM);", "AVStream *st;", "if (!mpegts_format || !rtp_format)\nreturn AVERROR(ENOSYS);", "mpegts_ctx = avformat_alloc_context();", "if (!mpegts_ctx)\nreturn AVERROR(ENOMEM);", "mpegts_ctx->oformat = mpegts_format;", "mpegts_ctx->max_delay = VAR_0->max_delay;", "for (VAR_2 = 0; VAR_2 < VAR_0->nb_streams; VAR_2++) {", "AVStream* st = avformat_new_stream(mpegts_ctx, NULL);", "if (!st)\nst->time_base = VAR_0->streams[VAR_2]->time_base;", "st->sample_aspect_ratio = VAR_0->streams[VAR_2]->sample_aspect_ratio;", "avcodec_parameters_copy(st->codecpar, VAR_0->streams[VAR_2]->codecpar);", "if ((VAR_3 = avio_open_dyn_buf(&mpegts_ctx->pb)) < 0)\nif ((VAR_3 = avformat_write_header(mpegts_ctx, NULL)) < 0)\nfor (VAR_2 = 0; VAR_2 < VAR_0->nb_streams; VAR_2++)", "VAR_0->streams[VAR_2]->time_base = mpegts_ctx->streams[VAR_2]->time_base;", "VAR_1->mpegts_ctx = mpegts_ctx;", "mpegts_ctx = NULL;", "rtp_ctx = avformat_alloc_context();", "if (!rtp_ctx) {", "rtp_ctx->oformat = rtp_format;", "st = avformat_new_stream(rtp_ctx, NULL);", "st->time_base.num = 1;", "st->time_base.den = 90000;", "st->codecpar->codec_id = AV_CODEC_ID_MPEG2TS;", "rtp_ctx->pb = VAR_0->pb;", "if ((VAR_3 = avformat_write_header(rtp_ctx, NULL)) < 0)\nVAR_1->rtp_ctx = rtp_ctx;", "return 0;", "fail:\nif (mpegts_ctx) {", "ffio_free_dyn_buf(&mpegts_ctx->pb);", "avformat_free_context(mpegts_ctx);", "if (rtp_ctx)\navformat_free_context(rtp_ctx);", "rtp_mpegts_write_close(VAR_0);", "return VAR_3;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 40 ], [ 42 ], [ 44 ], [ 47, 50, 53 ], [ 55 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 72 ], [ 74 ], [ 80 ], [ 82 ], [ 84 ], [ 86 ], [ 88, 91 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 108, 110 ], [ 112 ], [ 114 ] ]
11,512
void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine *co) { Coroutine *self = qemu_coroutine_self(); CoroutineAction ret; trace_qemu_aio_coroutine_enter(ctx, self, co, co->entry_arg); if (co->caller) { fprintf(stderr, "Co-routine re-entered recursively\n"); co->caller = self; co->ctx = ctx; /* Store co->ctx before anything that stores co. Matches * barrier in aio_co_wake and qemu_co_mutex_wake. */ smp_wmb(); ret = qemu_coroutine_switch(self, co, COROUTINE_ENTER); qemu_co_queue_run_restart(co); /* Beware, if ret == COROUTINE_YIELD and qemu_co_queue_run_restart() * has started any other coroutine, "co" might have been reentered * and even freed by now! So be careful and do not touch it. */ switch (ret) { case COROUTINE_YIELD: return; case COROUTINE_TERMINATE: assert(!co->locks_held); trace_qemu_coroutine_terminate(co); coroutine_delete(co); return; default:
true
qemu
6133b39f3c36623425a6ede9e89d93175fde15cd
void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine *co) { Coroutine *self = qemu_coroutine_self(); CoroutineAction ret; trace_qemu_aio_coroutine_enter(ctx, self, co, co->entry_arg); if (co->caller) { fprintf(stderr, "Co-routine re-entered recursively\n"); co->caller = self; co->ctx = ctx; smp_wmb(); ret = qemu_coroutine_switch(self, co, COROUTINE_ENTER); qemu_co_queue_run_restart(co); switch (ret) { case COROUTINE_YIELD: return; case COROUTINE_TERMINATE: assert(!co->locks_held); trace_qemu_coroutine_terminate(co); coroutine_delete(co); return; default:
{ "code": [], "line_no": [] }
void FUNC_0(AioContext *VAR_0, Coroutine *VAR_1) { Coroutine *self = qemu_coroutine_self(); CoroutineAction ret; trace_qemu_aio_coroutine_enter(VAR_0, self, VAR_1, VAR_1->entry_arg); if (VAR_1->caller) { fprintf(stderr, "Co-routine re-entered recursively\n"); VAR_1->caller = self; VAR_1->VAR_0 = VAR_0; smp_wmb(); ret = qemu_coroutine_switch(self, VAR_1, COROUTINE_ENTER); qemu_co_queue_run_restart(VAR_1); switch (ret) { case COROUTINE_YIELD: return; case COROUTINE_TERMINATE: assert(!VAR_1->locks_held); trace_qemu_coroutine_terminate(VAR_1); coroutine_delete(VAR_1); return; default:
[ "void FUNC_0(AioContext *VAR_0, Coroutine *VAR_1)\n{", "Coroutine *self = qemu_coroutine_self();", "CoroutineAction ret;", "trace_qemu_aio_coroutine_enter(VAR_0, self, VAR_1, VAR_1->entry_arg);", "if (VAR_1->caller) {", "fprintf(stderr, \"Co-routine re-entered recursively\\n\");", "VAR_1->caller = self;", "VAR_1->VAR_0 = VAR_0;", "smp_wmb();", "ret = qemu_coroutine_switch(self, VAR_1, COROUTINE_ENTER);", "qemu_co_queue_run_restart(VAR_1);", "switch (ret) {", "case COROUTINE_YIELD:\nreturn;", "case COROUTINE_TERMINATE:\nassert(!VAR_1->locks_held);", "trace_qemu_coroutine_terminate(VAR_1);", "coroutine_delete(VAR_1);", "return;" ]
[ 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 ], [ 13 ], [ 14 ], [ 15 ], [ 20 ], [ 21, 22 ], [ 23, 24 ], [ 25 ], [ 26 ], [ 27 ] ]
11,513
static sPAPRDIMMState *spapr_recover_pending_dimm_state(sPAPRMachineState *ms, PCDIMMDevice *dimm) { sPAPRDRConnector *drc; PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); MemoryRegion *mr = ddc->get_memory_region(dimm); uint64_t size = memory_region_size(mr); uint32_t nr_lmbs = size / SPAPR_MEMORY_BLOCK_SIZE; uint32_t avail_lmbs = 0; uint64_t addr_start, addr; int i; sPAPRDIMMState *ds; addr_start = object_property_get_int(OBJECT(dimm), PC_DIMM_ADDR_PROP, &error_abort); addr = addr_start; for (i = 0; i < nr_lmbs; i++) { drc = spapr_drc_by_id(TYPE_SPAPR_DRC_LMB, addr / SPAPR_MEMORY_BLOCK_SIZE); g_assert(drc); if (drc->indicator_state != SPAPR_DR_INDICATOR_STATE_INACTIVE) { avail_lmbs++; } addr += SPAPR_MEMORY_BLOCK_SIZE; } ds = g_malloc0(sizeof(sPAPRDIMMState)); ds->nr_lmbs = avail_lmbs; ds->dimm = dimm; spapr_pending_dimm_unplugs_add(ms, ds); return ds; }
true
qemu
454b580ae9ae3e7722f1cd5f6da7bb479f86bbd8
static sPAPRDIMMState *spapr_recover_pending_dimm_state(sPAPRMachineState *ms, PCDIMMDevice *dimm) { sPAPRDRConnector *drc; PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); MemoryRegion *mr = ddc->get_memory_region(dimm); uint64_t size = memory_region_size(mr); uint32_t nr_lmbs = size / SPAPR_MEMORY_BLOCK_SIZE; uint32_t avail_lmbs = 0; uint64_t addr_start, addr; int i; sPAPRDIMMState *ds; addr_start = object_property_get_int(OBJECT(dimm), PC_DIMM_ADDR_PROP, &error_abort); addr = addr_start; for (i = 0; i < nr_lmbs; i++) { drc = spapr_drc_by_id(TYPE_SPAPR_DRC_LMB, addr / SPAPR_MEMORY_BLOCK_SIZE); g_assert(drc); if (drc->indicator_state != SPAPR_DR_INDICATOR_STATE_INACTIVE) { avail_lmbs++; } addr += SPAPR_MEMORY_BLOCK_SIZE; } ds = g_malloc0(sizeof(sPAPRDIMMState)); ds->nr_lmbs = avail_lmbs; ds->dimm = dimm; spapr_pending_dimm_unplugs_add(ms, ds); return ds; }
{ "code": [ " if (drc->indicator_state != SPAPR_DR_INDICATOR_STATE_INACTIVE) {" ], "line_no": [ 43 ] }
static sPAPRDIMMState *FUNC_0(sPAPRMachineState *ms, PCDIMMDevice *dimm) { sPAPRDRConnector *drc; PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); MemoryRegion *mr = ddc->get_memory_region(dimm); uint64_t size = memory_region_size(mr); uint32_t nr_lmbs = size / SPAPR_MEMORY_BLOCK_SIZE; uint32_t avail_lmbs = 0; uint64_t addr_start, addr; int VAR_0; sPAPRDIMMState *ds; addr_start = object_property_get_int(OBJECT(dimm), PC_DIMM_ADDR_PROP, &error_abort); addr = addr_start; for (VAR_0 = 0; VAR_0 < nr_lmbs; VAR_0++) { drc = spapr_drc_by_id(TYPE_SPAPR_DRC_LMB, addr / SPAPR_MEMORY_BLOCK_SIZE); g_assert(drc); if (drc->indicator_state != SPAPR_DR_INDICATOR_STATE_INACTIVE) { avail_lmbs++; } addr += SPAPR_MEMORY_BLOCK_SIZE; } ds = g_malloc0(sizeof(sPAPRDIMMState)); ds->nr_lmbs = avail_lmbs; ds->dimm = dimm; spapr_pending_dimm_unplugs_add(ms, ds); return ds; }
[ "static sPAPRDIMMState *FUNC_0(sPAPRMachineState *ms,\nPCDIMMDevice *dimm)\n{", "sPAPRDRConnector *drc;", "PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);", "MemoryRegion *mr = ddc->get_memory_region(dimm);", "uint64_t size = memory_region_size(mr);", "uint32_t nr_lmbs = size / SPAPR_MEMORY_BLOCK_SIZE;", "uint32_t avail_lmbs = 0;", "uint64_t addr_start, addr;", "int VAR_0;", "sPAPRDIMMState *ds;", "addr_start = object_property_get_int(OBJECT(dimm), PC_DIMM_ADDR_PROP,\n&error_abort);", "addr = addr_start;", "for (VAR_0 = 0; VAR_0 < nr_lmbs; VAR_0++) {", "drc = spapr_drc_by_id(TYPE_SPAPR_DRC_LMB,\naddr / SPAPR_MEMORY_BLOCK_SIZE);", "g_assert(drc);", "if (drc->indicator_state != SPAPR_DR_INDICATOR_STATE_INACTIVE) {", "avail_lmbs++;", "}", "addr += SPAPR_MEMORY_BLOCK_SIZE;", "}", "ds = g_malloc0(sizeof(sPAPRDIMMState));", "ds->nr_lmbs = avail_lmbs;", "ds->dimm = dimm;", "spapr_pending_dimm_unplugs_add(ms, ds);", "return ds;", "}" ]
[ 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 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ] ]
11,514
static void term_print_cmdline (const char *cmdline) { term_show_prompt(); term_printf(cmdline); term_flush(); }
true
qemu
95ce326e5b47b4b841849f8a2ac7b96d6e204dfb
static void term_print_cmdline (const char *cmdline) { term_show_prompt(); term_printf(cmdline); term_flush(); }
{ "code": [ " term_printf(cmdline);" ], "line_no": [ 7 ] }
static void FUNC_0 (const char *VAR_0) { term_show_prompt(); term_printf(VAR_0); term_flush(); }
[ "static void FUNC_0 (const char *VAR_0)\n{", "term_show_prompt();", "term_printf(VAR_0);", "term_flush();", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
11,515
static void dvbsub_parse_clut_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { DVBSubContext *ctx = avctx->priv_data; const uint8_t *buf_end = buf + buf_size; int i, clut_id; int version; DVBSubCLUT *clut; int entry_id, depth , full_range; int y, cr, cb, alpha; int r, g, b, r_add, g_add, b_add; av_dlog(avctx, "DVB clut packet:\n"); for (i=0; i < buf_size; i++) { av_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) av_dlog(avctx, "\n"); } if (i % 16) av_dlog(avctx, "\n"); clut_id = *buf++; version = ((*buf)>>4)&15; buf += 1; clut = get_clut(ctx, clut_id); if (!clut) { clut = av_malloc(sizeof(DVBSubCLUT)); memcpy(clut, &default_clut, sizeof(DVBSubCLUT)); clut->id = clut_id; clut->version = -1; clut->next = ctx->clut_list; ctx->clut_list = clut; } if (clut->version != version) { clut->version = version; while (buf + 4 < buf_end) { entry_id = *buf++; depth = (*buf) & 0xe0; if (depth == 0) { av_log(avctx, AV_LOG_ERROR, "Invalid clut depth 0x%x!\n", *buf); return; } full_range = (*buf++) & 1; if (full_range) { y = *buf++; cr = *buf++; cb = *buf++; alpha = *buf++; } else { y = buf[0] & 0xfc; cr = (((buf[0] & 3) << 2) | ((buf[1] >> 6) & 3)) << 4; cb = (buf[1] << 2) & 0xf0; alpha = (buf[1] << 6) & 0xc0; buf += 2; } if (y == 0) alpha = 0xff; YUV_TO_RGB1_CCIR(cb, cr); YUV_TO_RGB2_CCIR(r, g, b, y); av_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha); if (depth & 0x80) clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha); else if (depth & 0x40) clut->clut16[entry_id] = RGBA(r,g,b,255 - alpha); else if (depth & 0x20) clut->clut256[entry_id] = RGBA(r,g,b,255 - alpha); } } }
true
FFmpeg
29f244e08ee0ef83098a65648b6880cb55a8c242
static void dvbsub_parse_clut_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { DVBSubContext *ctx = avctx->priv_data; const uint8_t *buf_end = buf + buf_size; int i, clut_id; int version; DVBSubCLUT *clut; int entry_id, depth , full_range; int y, cr, cb, alpha; int r, g, b, r_add, g_add, b_add; av_dlog(avctx, "DVB clut packet:\n"); for (i=0; i < buf_size; i++) { av_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) av_dlog(avctx, "\n"); } if (i % 16) av_dlog(avctx, "\n"); clut_id = *buf++; version = ((*buf)>>4)&15; buf += 1; clut = get_clut(ctx, clut_id); if (!clut) { clut = av_malloc(sizeof(DVBSubCLUT)); memcpy(clut, &default_clut, sizeof(DVBSubCLUT)); clut->id = clut_id; clut->version = -1; clut->next = ctx->clut_list; ctx->clut_list = clut; } if (clut->version != version) { clut->version = version; while (buf + 4 < buf_end) { entry_id = *buf++; depth = (*buf) & 0xe0; if (depth == 0) { av_log(avctx, AV_LOG_ERROR, "Invalid clut depth 0x%x!\n", *buf); return; } full_range = (*buf++) & 1; if (full_range) { y = *buf++; cr = *buf++; cb = *buf++; alpha = *buf++; } else { y = buf[0] & 0xfc; cr = (((buf[0] & 3) << 2) | ((buf[1] >> 6) & 3)) << 4; cb = (buf[1] << 2) & 0xf0; alpha = (buf[1] << 6) & 0xc0; buf += 2; } if (y == 0) alpha = 0xff; YUV_TO_RGB1_CCIR(cb, cr); YUV_TO_RGB2_CCIR(r, g, b, y); av_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha); if (depth & 0x80) clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha); else if (depth & 0x40) clut->clut16[entry_id] = RGBA(r,g,b,255 - alpha); else if (depth & 0x20) clut->clut256[entry_id] = RGBA(r,g,b,255 - alpha); } } }
{ "code": [ "static void dvbsub_parse_clut_segment(AVCodecContext *avctx," ], "line_no": [ 1 ] }
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; DVBSubCLUT *clut; int VAR_7, VAR_8 , VAR_9; int VAR_10, VAR_11, VAR_12, VAR_13; int VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19; av_dlog(VAR_0, "DVB clut packet:\n"); for (VAR_4=0; VAR_4 < VAR_2; VAR_4++) { av_dlog(VAR_0, "%02x ", VAR_1[VAR_4]); if (VAR_4 % 16 == 15) av_dlog(VAR_0, "\n"); } if (VAR_4 % 16) av_dlog(VAR_0, "\n"); VAR_5 = *VAR_1++; VAR_6 = ((*VAR_1)>>4)&15; VAR_1 += 1; clut = get_clut(ctx, VAR_5); if (!clut) { clut = av_malloc(sizeof(DVBSubCLUT)); memcpy(clut, &default_clut, sizeof(DVBSubCLUT)); clut->id = VAR_5; clut->VAR_6 = -1; clut->next = ctx->clut_list; ctx->clut_list = clut; } if (clut->VAR_6 != VAR_6) { clut->VAR_6 = VAR_6; while (VAR_1 + 4 < VAR_3) { VAR_7 = *VAR_1++; VAR_8 = (*VAR_1) & 0xe0; if (VAR_8 == 0) { av_log(VAR_0, AV_LOG_ERROR, "Invalid clut VAR_8 0x%x!\n", *VAR_1); return; } VAR_9 = (*VAR_1++) & 1; if (VAR_9) { VAR_10 = *VAR_1++; VAR_11 = *VAR_1++; VAR_12 = *VAR_1++; VAR_13 = *VAR_1++; } else { VAR_10 = VAR_1[0] & 0xfc; VAR_11 = (((VAR_1[0] & 3) << 2) | ((VAR_1[1] >> 6) & 3)) << 4; VAR_12 = (VAR_1[1] << 2) & 0xf0; VAR_13 = (VAR_1[1] << 6) & 0xc0; VAR_1 += 2; } if (VAR_10 == 0) VAR_13 = 0xff; YUV_TO_RGB1_CCIR(VAR_12, VAR_11); YUV_TO_RGB2_CCIR(VAR_14, VAR_15, VAR_16, VAR_10); av_dlog(VAR_0, "clut %d := (%d,%d,%d,%d)\n", VAR_7, VAR_14, VAR_15, VAR_16, VAR_13); if (VAR_8 & 0x80) clut->clut4[VAR_7] = RGBA(VAR_14,VAR_15,VAR_16,255 - VAR_13); else if (VAR_8 & 0x40) clut->clut16[VAR_7] = RGBA(VAR_14,VAR_15,VAR_16,255 - VAR_13); else if (VAR_8 & 0x20) clut->clut256[VAR_7] = RGBA(VAR_14,VAR_15,VAR_16,255 - VAR_13); } } }
[ "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;", "DVBSubCLUT *clut;", "int VAR_7, VAR_8 , VAR_9;", "int VAR_10, VAR_11, VAR_12, VAR_13;", "int VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19;", "av_dlog(VAR_0, \"DVB clut packet:\\n\");", "for (VAR_4=0; VAR_4 < VAR_2; VAR_4++) {", "av_dlog(VAR_0, \"%02x \", VAR_1[VAR_4]);", "if (VAR_4 % 16 == 15)\nav_dlog(VAR_0, \"\\n\");", "}", "if (VAR_4 % 16)\nav_dlog(VAR_0, \"\\n\");", "VAR_5 = *VAR_1++;", "VAR_6 = ((*VAR_1)>>4)&15;", "VAR_1 += 1;", "clut = get_clut(ctx, VAR_5);", "if (!clut) {", "clut = av_malloc(sizeof(DVBSubCLUT));", "memcpy(clut, &default_clut, sizeof(DVBSubCLUT));", "clut->id = VAR_5;", "clut->VAR_6 = -1;", "clut->next = ctx->clut_list;", "ctx->clut_list = clut;", "}", "if (clut->VAR_6 != VAR_6) {", "clut->VAR_6 = VAR_6;", "while (VAR_1 + 4 < VAR_3) {", "VAR_7 = *VAR_1++;", "VAR_8 = (*VAR_1) & 0xe0;", "if (VAR_8 == 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid clut VAR_8 0x%x!\\n\", *VAR_1);", "return;", "}", "VAR_9 = (*VAR_1++) & 1;", "if (VAR_9) {", "VAR_10 = *VAR_1++;", "VAR_11 = *VAR_1++;", "VAR_12 = *VAR_1++;", "VAR_13 = *VAR_1++;", "} else {", "VAR_10 = VAR_1[0] & 0xfc;", "VAR_11 = (((VAR_1[0] & 3) << 2) | ((VAR_1[1] >> 6) & 3)) << 4;", "VAR_12 = (VAR_1[1] << 2) & 0xf0;", "VAR_13 = (VAR_1[1] << 6) & 0xc0;", "VAR_1 += 2;", "}", "if (VAR_10 == 0)\nVAR_13 = 0xff;", "YUV_TO_RGB1_CCIR(VAR_12, VAR_11);", "YUV_TO_RGB2_CCIR(VAR_14, VAR_15, VAR_16, VAR_10);", "av_dlog(VAR_0, \"clut %d := (%d,%d,%d,%d)\\n\", VAR_7, VAR_14, VAR_15, VAR_16, VAR_13);", "if (VAR_8 & 0x80)\nclut->clut4[VAR_7] = RGBA(VAR_14,VAR_15,VAR_16,255 - VAR_13);", "else if (VAR_8 & 0x40)\nclut->clut16[VAR_7] = RGBA(VAR_14,VAR_15,VAR_16,255 - VAR_13);", "else if (VAR_8 & 0x20)\nclut->clut256[VAR_7] = RGBA(VAR_14,VAR_15,VAR_16,255 - VAR_13);", "}", "}", "}" ]
[ 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 145, 147 ], [ 151 ], [ 153 ], [ 157 ], [ 161, 163 ], [ 165, 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177 ] ]
11,518
static SCSIGenericReq *scsi_find_request(SCSIGenericState *s, uint32_t tag) { return DO_UPCAST(SCSIGenericReq, req, scsi_req_find(&s->qdev, tag)); }
true
qemu
5c6c0e513600ba57c3e73b7151d3c0664438f7b5
static SCSIGenericReq *scsi_find_request(SCSIGenericState *s, uint32_t tag) { return DO_UPCAST(SCSIGenericReq, req, scsi_req_find(&s->qdev, tag)); }
{ "code": [ "static SCSIGenericReq *scsi_find_request(SCSIGenericState *s, uint32_t tag)", " return DO_UPCAST(SCSIGenericReq, req, scsi_req_find(&s->qdev, tag));" ], "line_no": [ 1, 5 ] }
static SCSIGenericReq *FUNC_0(SCSIGenericState *s, uint32_t tag) { return DO_UPCAST(SCSIGenericReq, req, scsi_req_find(&s->qdev, tag)); }
[ "static SCSIGenericReq *FUNC_0(SCSIGenericState *s, uint32_t tag)\n{", "return DO_UPCAST(SCSIGenericReq, req, scsi_req_find(&s->qdev, tag));", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
11,519
static void do_safe_dpy_refresh(CPUState *cpu, run_on_cpu_data opaque) { DisplayChangeListener *dcl = opaque.host_ptr; dcl->ops->dpy_refresh(dcl); }
true
qemu
85390939190e4b7eeba57765e344947c328cd166
static void do_safe_dpy_refresh(CPUState *cpu, run_on_cpu_data opaque) { DisplayChangeListener *dcl = opaque.host_ptr; dcl->ops->dpy_refresh(dcl); }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUState *VAR_0, run_on_cpu_data VAR_1) { DisplayChangeListener *dcl = VAR_1.host_ptr; dcl->ops->dpy_refresh(dcl); }
[ "static void FUNC_0(CPUState *VAR_0, run_on_cpu_data VAR_1)\n{", "DisplayChangeListener *dcl = VAR_1.host_ptr;", "dcl->ops->dpy_refresh(dcl);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 8 ], [ 11 ] ]
11,520
void HELPER(exception_return)(CPUARMState *env) { int cur_el = arm_current_el(env); unsigned int spsr_idx = aarch64_banked_spsr_index(cur_el); uint32_t spsr = env->banked_spsr[spsr_idx]; int new_el; aarch64_save_sp(env, cur_el); env->exclusive_addr = -1; /* We must squash the PSTATE.SS bit to zero unless both of the * following hold: * 1. debug exceptions are currently disabled * 2. singlestep will be active in the EL we return to * We check 1 here and 2 after we've done the pstate/cpsr write() to * transition to the EL we're going to. */ if (arm_generate_debug_exceptions(env)) { spsr &= ~PSTATE_SS; } if (spsr & PSTATE_nRW) { /* TODO: We currently assume EL1/2/3 are running in AArch64. */ env->aarch64 = 0; new_el = 0; env->uncached_cpsr = 0x10; cpsr_write(env, spsr, ~0); if (!arm_singlestep_active(env)) { env->uncached_cpsr &= ~PSTATE_SS; } aarch64_sync_64_to_32(env); env->regs[15] = env->elr_el[1] & ~0x1; } else { new_el = extract32(spsr, 2, 2); if (new_el > cur_el || (new_el == 2 && !arm_feature(env, ARM_FEATURE_EL2))) { /* Disallow return to an EL which is unimplemented or higher * than the current one. */ goto illegal_return; } if (extract32(spsr, 1, 1)) { /* Return with reserved M[1] bit set */ goto illegal_return; } if (new_el == 0 && (spsr & PSTATE_SP)) { /* Return to EL0 with M[0] bit set */ goto illegal_return; } env->aarch64 = 1; pstate_write(env, spsr); if (!arm_singlestep_active(env)) { env->pstate &= ~PSTATE_SS; } aarch64_restore_sp(env, new_el); env->pc = env->elr_el[cur_el]; } return; illegal_return: /* Illegal return events of various kinds have architecturally * mandated behaviour: * restore NZCV and DAIF from SPSR_ELx * set PSTATE.IL * restore PC from ELR_ELx * no change to exception level, execution state or stack pointer */ env->pstate |= PSTATE_IL; env->pc = env->elr_el[cur_el]; spsr &= PSTATE_NZCV | PSTATE_DAIF; spsr |= pstate_read(env) & ~(PSTATE_NZCV | PSTATE_DAIF); pstate_write(env, spsr); if (!arm_singlestep_active(env)) { env->pstate &= ~PSTATE_SS; } }
true
qemu
3809951bf61605974b91578c582de4da28f8ed07
void HELPER(exception_return)(CPUARMState *env) { int cur_el = arm_current_el(env); unsigned int spsr_idx = aarch64_banked_spsr_index(cur_el); uint32_t spsr = env->banked_spsr[spsr_idx]; int new_el; aarch64_save_sp(env, cur_el); env->exclusive_addr = -1; if (arm_generate_debug_exceptions(env)) { spsr &= ~PSTATE_SS; } if (spsr & PSTATE_nRW) { env->aarch64 = 0; new_el = 0; env->uncached_cpsr = 0x10; cpsr_write(env, spsr, ~0); if (!arm_singlestep_active(env)) { env->uncached_cpsr &= ~PSTATE_SS; } aarch64_sync_64_to_32(env); env->regs[15] = env->elr_el[1] & ~0x1; } else { new_el = extract32(spsr, 2, 2); if (new_el > cur_el || (new_el == 2 && !arm_feature(env, ARM_FEATURE_EL2))) { goto illegal_return; } if (extract32(spsr, 1, 1)) { goto illegal_return; } if (new_el == 0 && (spsr & PSTATE_SP)) { goto illegal_return; } env->aarch64 = 1; pstate_write(env, spsr); if (!arm_singlestep_active(env)) { env->pstate &= ~PSTATE_SS; } aarch64_restore_sp(env, new_el); env->pc = env->elr_el[cur_el]; } return; illegal_return: env->pstate |= PSTATE_IL; env->pc = env->elr_el[cur_el]; spsr &= PSTATE_NZCV | PSTATE_DAIF; spsr |= pstate_read(env) & ~(PSTATE_NZCV | PSTATE_DAIF); pstate_write(env, spsr); if (!arm_singlestep_active(env)) { env->pstate &= ~PSTATE_SS; } }
{ "code": [ " if (spsr & PSTATE_nRW) {", " new_el = 0;", " env->uncached_cpsr = 0x10;", " env->regs[15] = env->elr_el[1] & ~0x1;", " new_el = extract32(spsr, 2, 2);", " if (new_el > cur_el", " || (new_el == 2 && !arm_feature(env, ARM_FEATURE_EL2))) {", " goto illegal_return;", " if (extract32(spsr, 1, 1)) {", " goto illegal_return;", " if (new_el == 0 && (spsr & PSTATE_SP)) {", " goto illegal_return;" ], "line_no": [ 45, 51, 53, 67, 71, 73, 75, 83, 87, 83, 95, 83 ] }
void FUNC_0(exception_return)(CPUARMState *env) { int VAR_0 = arm_current_el(env); unsigned int VAR_1 = aarch64_banked_spsr_index(VAR_0); uint32_t spsr = env->banked_spsr[VAR_1]; int VAR_2; aarch64_save_sp(env, VAR_0); env->exclusive_addr = -1; if (arm_generate_debug_exceptions(env)) { spsr &= ~PSTATE_SS; } if (spsr & PSTATE_nRW) { env->aarch64 = 0; VAR_2 = 0; env->uncached_cpsr = 0x10; cpsr_write(env, spsr, ~0); if (!arm_singlestep_active(env)) { env->uncached_cpsr &= ~PSTATE_SS; } aarch64_sync_64_to_32(env); env->regs[15] = env->elr_el[1] & ~0x1; } else { VAR_2 = extract32(spsr, 2, 2); if (VAR_2 > VAR_0 || (VAR_2 == 2 && !arm_feature(env, ARM_FEATURE_EL2))) { goto illegal_return; } if (extract32(spsr, 1, 1)) { goto illegal_return; } if (VAR_2 == 0 && (spsr & PSTATE_SP)) { goto illegal_return; } env->aarch64 = 1; pstate_write(env, spsr); if (!arm_singlestep_active(env)) { env->pstate &= ~PSTATE_SS; } aarch64_restore_sp(env, VAR_2); env->pc = env->elr_el[VAR_0]; } return; illegal_return: env->pstate |= PSTATE_IL; env->pc = env->elr_el[VAR_0]; spsr &= PSTATE_NZCV | PSTATE_DAIF; spsr |= pstate_read(env) & ~(PSTATE_NZCV | PSTATE_DAIF); pstate_write(env, spsr); if (!arm_singlestep_active(env)) { env->pstate &= ~PSTATE_SS; } }
[ "void FUNC_0(exception_return)(CPUARMState *env)\n{", "int VAR_0 = arm_current_el(env);", "unsigned int VAR_1 = aarch64_banked_spsr_index(VAR_0);", "uint32_t spsr = env->banked_spsr[VAR_1];", "int VAR_2;", "aarch64_save_sp(env, VAR_0);", "env->exclusive_addr = -1;", "if (arm_generate_debug_exceptions(env)) {", "spsr &= ~PSTATE_SS;", "}", "if (spsr & PSTATE_nRW) {", "env->aarch64 = 0;", "VAR_2 = 0;", "env->uncached_cpsr = 0x10;", "cpsr_write(env, spsr, ~0);", "if (!arm_singlestep_active(env)) {", "env->uncached_cpsr &= ~PSTATE_SS;", "}", "aarch64_sync_64_to_32(env);", "env->regs[15] = env->elr_el[1] & ~0x1;", "} else {", "VAR_2 = extract32(spsr, 2, 2);", "if (VAR_2 > VAR_0\n|| (VAR_2 == 2 && !arm_feature(env, ARM_FEATURE_EL2))) {", "goto illegal_return;", "}", "if (extract32(spsr, 1, 1)) {", "goto illegal_return;", "}", "if (VAR_2 == 0 && (spsr & PSTATE_SP)) {", "goto illegal_return;", "}", "env->aarch64 = 1;", "pstate_write(env, spsr);", "if (!arm_singlestep_active(env)) {", "env->pstate &= ~PSTATE_SS;", "}", "aarch64_restore_sp(env, VAR_2);", "env->pc = env->elr_el[VAR_0];", "}", "return;", "illegal_return:\nenv->pstate |= PSTATE_IL;", "env->pc = env->elr_el[VAR_0];", "spsr &= PSTATE_NZCV | PSTATE_DAIF;", "spsr |= pstate_read(env) & ~(PSTATE_NZCV | PSTATE_DAIF);", "pstate_write(env, spsr);", "if (!arm_singlestep_active(env)) {", "env->pstate &= ~PSTATE_SS;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 125, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ] ]
11,521
target_ulong helper_evpe(CPUMIPSState *env) { CPUMIPSState *other_cpu = first_cpu; target_ulong prev = env->mvp->CP0_MVPControl; do { if (other_cpu != env /* If the VPE is WFI, don't disturb its sleep. */ && !mips_vpe_is_wfi(other_cpu)) { /* Enable the VPE. */ other_cpu->mvp->CP0_MVPControl |= (1 << CP0MVPCo_EVP); mips_vpe_wake(other_cpu); /* And wake it up. */ } other_cpu = other_cpu->next_cpu; } while (other_cpu); return prev; }
true
qemu
81bad50ec40311797c38a7691844c7d2df9b3823
target_ulong helper_evpe(CPUMIPSState *env) { CPUMIPSState *other_cpu = first_cpu; target_ulong prev = env->mvp->CP0_MVPControl; do { if (other_cpu != env && !mips_vpe_is_wfi(other_cpu)) { other_cpu->mvp->CP0_MVPControl |= (1 << CP0MVPCo_EVP); mips_vpe_wake(other_cpu); } other_cpu = other_cpu->next_cpu; } while (other_cpu); return prev; }
{ "code": [ " CPUMIPSState *other_cpu = first_cpu;", " other_cpu = other_cpu->next_cpu;", " } while (other_cpu);", " CPUMIPSState *other_cpu = first_cpu;", " if (other_cpu != env", " && !mips_vpe_is_wfi(other_cpu)) {", " other_cpu->mvp->CP0_MVPControl |= (1 << CP0MVPCo_EVP);", " other_cpu = other_cpu->next_cpu;", " } while (other_cpu);" ], "line_no": [ 5, 27, 29, 5, 13, 17, 21, 27, 29 ] }
target_ulong FUNC_0(CPUMIPSState *env) { CPUMIPSState *other_cpu = first_cpu; target_ulong prev = env->mvp->CP0_MVPControl; do { if (other_cpu != env && !mips_vpe_is_wfi(other_cpu)) { other_cpu->mvp->CP0_MVPControl |= (1 << CP0MVPCo_EVP); mips_vpe_wake(other_cpu); } other_cpu = other_cpu->next_cpu; } while (other_cpu); return prev; }
[ "target_ulong FUNC_0(CPUMIPSState *env)\n{", "CPUMIPSState *other_cpu = first_cpu;", "target_ulong prev = env->mvp->CP0_MVPControl;", "do {", "if (other_cpu != env\n&& !mips_vpe_is_wfi(other_cpu)) {", "other_cpu->mvp->CP0_MVPControl |= (1 << CP0MVPCo_EVP);", "mips_vpe_wake(other_cpu);", "}", "other_cpu = other_cpu->next_cpu;", "} while (other_cpu);", "return prev;", "}" ]
[ 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
11,522
static void gen_tlbld_74xx(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } gen_helper_74xx_tlbd(cpu_env, cpu_gpr[rB(ctx->opcode)]); #endif }
true
qemu
9b2fadda3e0196ffd485adde4fe9cdd6fae35300
static void gen_tlbld_74xx(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } gen_helper_74xx_tlbd(cpu_env, cpu_gpr[rB(ctx->opcode)]); #endif }
{ "code": [ " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif" ], "line_no": [ 13, 7, 11, 13, 7, 11, 13, 7, 13, 5, 9, 11, 21, 5, 9, 11, 21, 21, 5, 9, 11, 7, 11, 13, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 7, 13, 21, 7, 11, 13, 21, 7, 13, 21, 7, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 11, 21, 11, 21, 11, 21, 11, 21, 5, 7, 9, 11, 13, 21, 7, 11, 13, 21, 5, 7, 9, 11, 13, 21, 5, 7, 9, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 5, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21 ] }
static void FUNC_0(DisasContext *VAR_0) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(VAR_0->pr)) { gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); return; } gen_helper_74xx_tlbd(cpu_env, cpu_gpr[rB(VAR_0->opcode)]); #endif }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "#if defined(CONFIG_USER_ONLY)\ngen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "#else\nif (unlikely(VAR_0->pr)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "return;", "}", "gen_helper_74xx_tlbd(cpu_env, cpu_gpr[rB(VAR_0->opcode)]);", "#endif\n}" ]
[ 0, 1, 1, 1, 0, 0, 0, 1 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ] ]
11,523
static void kvmclock_realize(DeviceState *dev, Error **errp) { KVMClockState *s = KVM_CLOCK(dev); kvm_update_clock(s); qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);
true
qemu
ca2edcd35cd1a8589dfa0533c19ff232fec7b4b5
static void kvmclock_realize(DeviceState *dev, Error **errp) { KVMClockState *s = KVM_CLOCK(dev); kvm_update_clock(s); qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { KVMClockState *s = KVM_CLOCK(VAR_0); kvm_update_clock(s); qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "KVMClockState *s = KVM_CLOCK(VAR_0);", "kvm_update_clock(s);", "qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);" ]
[ 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ] ]
11,525
static const uint8_t *pcx_rle_decode(const uint8_t *src, uint8_t *dst, unsigned int bytes_per_scanline, int compressed) { unsigned int i = 0; unsigned char run, value; if (compressed) { while (i < bytes_per_scanline) { run = 1; value = *src++; if (value >= 0xc0) { run = value & 0x3f; value = *src++; } while (i < bytes_per_scanline && run--) dst[i++] = value; } } else { memcpy(dst, src, bytes_per_scanline); src += bytes_per_scanline; } return src; }
true
FFmpeg
3abde1a3b49cf299f2aae4eaae6b6cb5270bdc22
static const uint8_t *pcx_rle_decode(const uint8_t *src, uint8_t *dst, unsigned int bytes_per_scanline, int compressed) { unsigned int i = 0; unsigned char run, value; if (compressed) { while (i < bytes_per_scanline) { run = 1; value = *src++; if (value >= 0xc0) { run = value & 0x3f; value = *src++; } while (i < bytes_per_scanline && run--) dst[i++] = value; } } else { memcpy(dst, src, bytes_per_scanline); src += bytes_per_scanline; } return src; }
{ "code": [ "static const uint8_t *pcx_rle_decode(const uint8_t *src, uint8_t *dst,", " while (i < bytes_per_scanline) {", " if (value >= 0xc0) {" ], "line_no": [ 1, 17, 23 ] }
static const uint8_t *FUNC_0(const uint8_t *src, uint8_t *dst, unsigned int bytes_per_scanline, int compressed) { unsigned int VAR_0 = 0; unsigned char VAR_1, VAR_2; if (compressed) { while (VAR_0 < bytes_per_scanline) { VAR_1 = 1; VAR_2 = *src++; if (VAR_2 >= 0xc0) { VAR_1 = VAR_2 & 0x3f; VAR_2 = *src++; } while (VAR_0 < bytes_per_scanline && VAR_1--) dst[VAR_0++] = VAR_2; } } else { memcpy(dst, src, bytes_per_scanline); src += bytes_per_scanline; } return src; }
[ "static const uint8_t *FUNC_0(const uint8_t *src, uint8_t *dst,\nunsigned int bytes_per_scanline,\nint compressed)\n{", "unsigned int VAR_0 = 0;", "unsigned char VAR_1, VAR_2;", "if (compressed) {", "while (VAR_0 < bytes_per_scanline) {", "VAR_1 = 1;", "VAR_2 = *src++;", "if (VAR_2 >= 0xc0) {", "VAR_1 = VAR_2 & 0x3f;", "VAR_2 = *src++;", "}", "while (VAR_0 < bytes_per_scanline && VAR_1--)\ndst[VAR_0++] = VAR_2;", "}", "} else {", "memcpy(dst, src, bytes_per_scanline);", "src += bytes_per_scanline;", "}", "return src;", "}" ]
[ 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
11,526
void checkasm_check_h264pred(void) { static const struct { void (*func)(H264PredContext*, uint8_t*, uint8_t*, int, int, int); const char *name; } tests[] = { { check_pred4x4, "pred4x4" }, { check_pred8x8, "pred8x8" }, { check_pred16x16, "pred16x16" }, { check_pred8x8l, "pred8x8l" }, }; DECLARE_ALIGNED(16, uint8_t, buf0)[BUF_SIZE]; DECLARE_ALIGNED(16, uint8_t, buf1)[BUF_SIZE]; H264PredContext h; int test, codec, chroma_format, bit_depth; for (test = 0; test < FF_ARRAY_ELEMS(tests); test++) { for (codec = 0; codec < 4; codec++) { int codec_id = codec_ids[codec]; for (bit_depth = 8; bit_depth <= (codec_id == AV_CODEC_ID_H264 ? 10 : 8); bit_depth++) for (chroma_format = 1; chroma_format <= (codec_id == AV_CODEC_ID_H264 ? 2 : 1); chroma_format++) { ff_h264_pred_init(&h, codec_id, bit_depth, chroma_format); tests[test].func(&h, buf0, buf1, codec, chroma_format, bit_depth); } } report("%s", tests[test].name); } }
false
FFmpeg
f467fc02b475cd45b68aa5fb5f7c78286110ba86
void checkasm_check_h264pred(void) { static const struct { void (*func)(H264PredContext*, uint8_t*, uint8_t*, int, int, int); const char *name; } tests[] = { { check_pred4x4, "pred4x4" }, { check_pred8x8, "pred8x8" }, { check_pred16x16, "pred16x16" }, { check_pred8x8l, "pred8x8l" }, }; DECLARE_ALIGNED(16, uint8_t, buf0)[BUF_SIZE]; DECLARE_ALIGNED(16, uint8_t, buf1)[BUF_SIZE]; H264PredContext h; int test, codec, chroma_format, bit_depth; for (test = 0; test < FF_ARRAY_ELEMS(tests); test++) { for (codec = 0; codec < 4; codec++) { int codec_id = codec_ids[codec]; for (bit_depth = 8; bit_depth <= (codec_id == AV_CODEC_ID_H264 ? 10 : 8); bit_depth++) for (chroma_format = 1; chroma_format <= (codec_id == AV_CODEC_ID_H264 ? 2 : 1); chroma_format++) { ff_h264_pred_init(&h, codec_id, bit_depth, chroma_format); tests[test].func(&h, buf0, buf1, codec, chroma_format, bit_depth); } } report("%s", tests[test].name); } }
{ "code": [], "line_no": [] }
VAR_2voidVAR_2 VAR_2checkasm_check_h264predVAR_2(VAR_2voidVAR_2) { VAR_2staticVAR_2 VAR_2constVAR_2 VAR_2structVAR_2 { VAR_2voidVAR_2 (*VAR_2funcVAR_2)(VAR_2H264PredContextVAR_2*, VAR_2uint8_tVAR_2*, VAR_2uint8_tVAR_2*, VAR_2intVAR_2, VAR_2intVAR_2, VAR_2intVAR_2); VAR_2constVAR_2 VAR_2charVAR_2 *VAR_2nameVAR_2; } VAR_2testsVAR_2[] = { { VAR_2check_pred4x4VAR_2, "VAR_2pred4x4VAR_2" }, { VAR_2check_pred8x8VAR_2, "VAR_2pred8x8VAR_2" }, { VAR_2check_pred16x16VAR_2, "VAR_2pred16x16VAR_2" }, { VAR_2check_pred8x8lVAR_2, "VAR_2pred8x8lVAR_2" }, }; VAR_2DECLARE_ALIGNEDVAR_2(VAR_216VAR_2, VAR_2uint8_tVAR_2, VAR_2buf0VAR_2)[VAR_2BUF_SIZEVAR_2]; VAR_2DECLARE_ALIGNEDVAR_2(VAR_216VAR_2, VAR_2uint8_tVAR_2, VAR_2buf1VAR_2)[VAR_2BUF_SIZEVAR_2]; VAR_2H264PredContextVAR_2 VAR_2hVAR_2; VAR_2intVAR_2 VAR_2testVAR_2, VAR_2codecVAR_2, VAR_2chroma_formatVAR_2, VAR_2bit_depthVAR_2; VAR_2forVAR_2 (VAR_2testVAR_2 = VAR_20VAR_2; VAR_2testVAR_2 < VAR_2FF_ARRAY_ELEMSVAR_2(VAR_2testsVAR_2); VAR_2testVAR_2++) { VAR_2forVAR_2 (VAR_2codecVAR_2 = VAR_20VAR_2; VAR_2codecVAR_2 < VAR_24VAR_2; VAR_2codecVAR_2++) { VAR_2intVAR_2 VAR_2codec_idVAR_2 = VAR_2codec_idsVAR_2[VAR_2codecVAR_2]; VAR_2forVAR_2 (VAR_2bit_depthVAR_2 = VAR_28VAR_2; VAR_2bit_depthVAR_2 <= (VAR_2codec_idVAR_2 == VAR_2AV_CODEC_ID_H264VAR_2 ? VAR_210VAR_2 : VAR_28VAR_2); VAR_2bit_depthVAR_2++) VAR_2forVAR_2 (VAR_2chroma_formatVAR_2 = VAR_21VAR_2; VAR_2chroma_formatVAR_2 <= (VAR_2codec_idVAR_2 == VAR_2AV_CODEC_ID_H264VAR_2 ? VAR_22VAR_2 : VAR_21VAR_2); VAR_2chroma_formatVAR_2++) { VAR_2ff_h264_pred_initVAR_2(&VAR_2hVAR_2, VAR_2codec_idVAR_2, VAR_2bit_depthVAR_2, VAR_2chroma_formatVAR_2); VAR_2testsVAR_2[VAR_2testVAR_2].VAR_2funcVAR_2(&VAR_2hVAR_2, VAR_2buf0VAR_2, VAR_2buf1VAR_2, VAR_2codecVAR_2, VAR_2chroma_formatVAR_2, VAR_2bit_depthVAR_2); } } VAR_2reportVAR_2("%VAR_2sVAR_2", VAR_2testsVAR_2[VAR_2testVAR_2].VAR_2nameVAR_2); } }
[ "VAR_2voidVAR_2 VAR_2checkasm_check_h264predVAR_2(VAR_2voidVAR_2)\n{", "VAR_2staticVAR_2 VAR_2constVAR_2 VAR_2structVAR_2 {", "VAR_2voidVAR_2 (*VAR_2funcVAR_2)(VAR_2H264PredContextVAR_2*, VAR_2uint8_tVAR_2*, VAR_2uint8_tVAR_2*, VAR_2intVAR_2, VAR_2intVAR_2, VAR_2intVAR_2);", "VAR_2constVAR_2 VAR_2charVAR_2 *VAR_2nameVAR_2;", "} VAR_2testsVAR_2[] = {", "{ VAR_2check_pred4x4VAR_2, \"VAR_2pred4x4VAR_2\" },", "{ VAR_2check_pred8x8VAR_2, \"VAR_2pred8x8VAR_2\" },", "{ VAR_2check_pred16x16VAR_2, \"VAR_2pred16x16VAR_2\" },", "{ VAR_2check_pred8x8lVAR_2, \"VAR_2pred8x8lVAR_2\" },", "};", "VAR_2DECLARE_ALIGNEDVAR_2(VAR_216VAR_2, VAR_2uint8_tVAR_2, VAR_2buf0VAR_2)[VAR_2BUF_SIZEVAR_2];", "VAR_2DECLARE_ALIGNEDVAR_2(VAR_216VAR_2, VAR_2uint8_tVAR_2, VAR_2buf1VAR_2)[VAR_2BUF_SIZEVAR_2];", "VAR_2H264PredContextVAR_2 VAR_2hVAR_2;", "VAR_2intVAR_2 VAR_2testVAR_2, VAR_2codecVAR_2, VAR_2chroma_formatVAR_2, VAR_2bit_depthVAR_2;", "VAR_2forVAR_2 (VAR_2testVAR_2 = VAR_20VAR_2; VAR_2testVAR_2 < VAR_2FF_ARRAY_ELEMSVAR_2(VAR_2testsVAR_2); VAR_2testVAR_2++) {", "VAR_2forVAR_2 (VAR_2codecVAR_2 = VAR_20VAR_2; VAR_2codecVAR_2 < VAR_24VAR_2; VAR_2codecVAR_2++) {", "VAR_2intVAR_2 VAR_2codec_idVAR_2 = VAR_2codec_idsVAR_2[VAR_2codecVAR_2];", "VAR_2forVAR_2 (VAR_2bit_depthVAR_2 = VAR_28VAR_2; VAR_2bit_depthVAR_2 <= (VAR_2codec_idVAR_2 == VAR_2AV_CODEC_ID_H264VAR_2 ? VAR_210VAR_2 : VAR_28VAR_2); VAR_2bit_depthVAR_2++)", "VAR_2forVAR_2 (VAR_2chroma_formatVAR_2 = VAR_21VAR_2; VAR_2chroma_formatVAR_2 <= (VAR_2codec_idVAR_2 == VAR_2AV_CODEC_ID_H264VAR_2 ? VAR_22VAR_2 : VAR_21VAR_2); VAR_2chroma_formatVAR_2++) {", "VAR_2ff_h264_pred_initVAR_2(&VAR_2hVAR_2, VAR_2codec_idVAR_2, VAR_2bit_depthVAR_2, VAR_2chroma_formatVAR_2);", "VAR_2testsVAR_2[VAR_2testVAR_2].VAR_2funcVAR_2(&VAR_2hVAR_2, VAR_2buf0VAR_2, VAR_2buf1VAR_2, VAR_2codecVAR_2, VAR_2chroma_formatVAR_2, VAR_2bit_depthVAR_2);", "}", "}", "VAR_2reportVAR_2(\"%VAR_2sVAR_2\", VAR_2testsVAR_2[VAR_2testVAR_2].VAR_2nameVAR_2);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
11,530
static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ entries = avio_rb32(pb); av_log(c->fc, AV_LOG_TRACE, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); if (!entries) return 0; if (entries >= UINT_MAX / sizeof(*sc->ctts_data)) return AVERROR_INVALIDDATA; av_freep(&sc->ctts_data); sc->ctts_data = av_realloc(NULL, entries * sizeof(*sc->ctts_data)); if (!sc->ctts_data) return AVERROR(ENOMEM); for (i = 0; i < entries && !pb->eof_reached; i++) { int count =avio_rb32(pb); int duration =avio_rb32(pb); sc->ctts_data[i].count = count; sc->ctts_data[i].duration= duration; av_log(c->fc, AV_LOG_TRACE, "count=%d, duration=%d\n", count, duration); if (FFABS(duration) > (1<<28) && i+2<entries) { av_log(c->fc, AV_LOG_WARNING, "CTTS invalid\n"); av_freep(&sc->ctts_data); sc->ctts_count = 0; return 0; } if (i+2<entries) mov_update_dts_shift(sc, duration); } sc->ctts_count = i; if (pb->eof_reached) return AVERROR_EOF; av_log(c->fc, AV_LOG_TRACE, "dts shift %d\n", sc->dts_shift); return 0; }
true
FFmpeg
053e80f6eaf8d87521fe58ea96886b6ee0bbe59d
static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); avio_rb24(pb); entries = avio_rb32(pb); av_log(c->fc, AV_LOG_TRACE, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); if (!entries) return 0; if (entries >= UINT_MAX / sizeof(*sc->ctts_data)) return AVERROR_INVALIDDATA; av_freep(&sc->ctts_data); sc->ctts_data = av_realloc(NULL, entries * sizeof(*sc->ctts_data)); if (!sc->ctts_data) return AVERROR(ENOMEM); for (i = 0; i < entries && !pb->eof_reached; i++) { int count =avio_rb32(pb); int duration =avio_rb32(pb); sc->ctts_data[i].count = count; sc->ctts_data[i].duration= duration; av_log(c->fc, AV_LOG_TRACE, "count=%d, duration=%d\n", count, duration); if (FFABS(duration) > (1<<28) && i+2<entries) { av_log(c->fc, AV_LOG_WARNING, "CTTS invalid\n"); av_freep(&sc->ctts_data); sc->ctts_count = 0; return 0; } if (i+2<entries) mov_update_dts_shift(sc, duration); } sc->ctts_count = i; if (pb->eof_reached) return AVERROR_EOF; av_log(c->fc, AV_LOG_TRACE, "dts shift %d\n", sc->dts_shift); return 0; }
{ "code": [ " if (FFABS(duration) > (1<<28) && i+2<entries) {" ], "line_no": [ 73 ] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st; MOVStreamContext *sc; unsigned int VAR_3, VAR_4; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; sc = st->priv_data; avio_r8(VAR_1); avio_rb24(VAR_1); VAR_4 = avio_rb32(VAR_1); av_log(VAR_0->fc, AV_LOG_TRACE, "track[%VAR_3].ctts.VAR_4 = %VAR_3\n", VAR_0->fc->nb_streams-1, VAR_4); if (!VAR_4) return 0; if (VAR_4 >= UINT_MAX / sizeof(*sc->ctts_data)) return AVERROR_INVALIDDATA; av_freep(&sc->ctts_data); sc->ctts_data = av_realloc(NULL, VAR_4 * sizeof(*sc->ctts_data)); if (!sc->ctts_data) return AVERROR(ENOMEM); for (VAR_3 = 0; VAR_3 < VAR_4 && !VAR_1->eof_reached; VAR_3++) { int count =avio_rb32(VAR_1); int duration =avio_rb32(VAR_1); sc->ctts_data[VAR_3].count = count; sc->ctts_data[VAR_3].duration= duration; av_log(VAR_0->fc, AV_LOG_TRACE, "count=%d, duration=%d\n", count, duration); if (FFABS(duration) > (1<<28) && VAR_3+2<VAR_4) { av_log(VAR_0->fc, AV_LOG_WARNING, "CTTS invalid\n"); av_freep(&sc->ctts_data); sc->ctts_count = 0; return 0; } if (VAR_3+2<VAR_4) mov_update_dts_shift(sc, duration); } sc->ctts_count = VAR_3; if (VAR_1->eof_reached) return AVERROR_EOF; av_log(VAR_0->fc, AV_LOG_TRACE, "dts shift %d\n", sc->dts_shift); return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st;", "MOVStreamContext *sc;", "unsigned int VAR_3, VAR_4;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "sc = st->priv_data;", "avio_r8(VAR_1);", "avio_rb24(VAR_1);", "VAR_4 = avio_rb32(VAR_1);", "av_log(VAR_0->fc, AV_LOG_TRACE, \"track[%VAR_3].ctts.VAR_4 = %VAR_3\\n\", VAR_0->fc->nb_streams-1, VAR_4);", "if (!VAR_4)\nreturn 0;", "if (VAR_4 >= UINT_MAX / sizeof(*sc->ctts_data))\nreturn AVERROR_INVALIDDATA;", "av_freep(&sc->ctts_data);", "sc->ctts_data = av_realloc(NULL, VAR_4 * sizeof(*sc->ctts_data));", "if (!sc->ctts_data)\nreturn AVERROR(ENOMEM);", "for (VAR_3 = 0; VAR_3 < VAR_4 && !VAR_1->eof_reached; VAR_3++) {", "int count =avio_rb32(VAR_1);", "int duration =avio_rb32(VAR_1);", "sc->ctts_data[VAR_3].count = count;", "sc->ctts_data[VAR_3].duration= duration;", "av_log(VAR_0->fc, AV_LOG_TRACE, \"count=%d, duration=%d\\n\",\ncount, duration);", "if (FFABS(duration) > (1<<28) && VAR_3+2<VAR_4) {", "av_log(VAR_0->fc, AV_LOG_WARNING, \"CTTS invalid\\n\");", "av_freep(&sc->ctts_data);", "sc->ctts_count = 0;", "return 0;", "}", "if (VAR_3+2<VAR_4)\nmov_update_dts_shift(sc, duration);", "}", "sc->ctts_count = VAR_3;", "if (VAR_1->eof_reached)\nreturn AVERROR_EOF;", "av_log(VAR_0->fc, AV_LOG_TRACE, \"dts shift %d\\n\", sc->dts_shift);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 91 ], [ 95 ], [ 99, 101 ], [ 105 ], [ 109 ], [ 111 ] ]
11,531
static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov, int iovcnt, unsigned flags) { uint8_t *buf = NULL; uint8_t *buffer; size_t offset; ssize_t ret; if (iovcnt == 1) { buffer = iov[0].iov_base; offset = iov[0].iov_len; } else { buf = g_new(uint8_t, NET_BUFSIZE); buffer = buf; offset = iov_to_buf(iov, iovcnt, 0, buf, NET_BUFSIZE); } if (flags & QEMU_NET_PACKET_FLAG_RAW && nc->info->receive_raw) { ret = nc->info->receive_raw(nc, buffer, offset); } else { ret = nc->info->receive(nc, buffer, offset); } g_free(buf); return ret; }
true
qemu
47f9f15831faa549504ab9b035aaea44a02e5f95
static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov, int iovcnt, unsigned flags) { uint8_t *buf = NULL; uint8_t *buffer; size_t offset; ssize_t ret; if (iovcnt == 1) { buffer = iov[0].iov_base; offset = iov[0].iov_len; } else { buf = g_new(uint8_t, NET_BUFSIZE); buffer = buf; offset = iov_to_buf(iov, iovcnt, 0, buf, NET_BUFSIZE); } if (flags & QEMU_NET_PACKET_FLAG_RAW && nc->info->receive_raw) { ret = nc->info->receive_raw(nc, buffer, offset); } else { ret = nc->info->receive(nc, buffer, offset); } g_free(buf); return ret; }
{ "code": [ " buf = g_new(uint8_t, NET_BUFSIZE);", " offset = iov_to_buf(iov, iovcnt, 0, buf, NET_BUFSIZE);" ], "line_no": [ 25, 29 ] }
static ssize_t FUNC_0(NetClientState *nc, const struct iovec *iov, int iovcnt, unsigned flags) { uint8_t *buf = NULL; uint8_t *buffer; size_t offset; ssize_t ret; if (iovcnt == 1) { buffer = iov[0].iov_base; offset = iov[0].iov_len; } else { buf = g_new(uint8_t, NET_BUFSIZE); buffer = buf; offset = iov_to_buf(iov, iovcnt, 0, buf, NET_BUFSIZE); } if (flags & QEMU_NET_PACKET_FLAG_RAW && nc->info->receive_raw) { ret = nc->info->receive_raw(nc, buffer, offset); } else { ret = nc->info->receive(nc, buffer, offset); } g_free(buf); return ret; }
[ "static ssize_t FUNC_0(NetClientState *nc, const struct iovec *iov,\nint iovcnt, unsigned flags)\n{", "uint8_t *buf = NULL;", "uint8_t *buffer;", "size_t offset;", "ssize_t ret;", "if (iovcnt == 1) {", "buffer = iov[0].iov_base;", "offset = iov[0].iov_len;", "} else {", "buf = g_new(uint8_t, NET_BUFSIZE);", "buffer = buf;", "offset = iov_to_buf(iov, iovcnt, 0, buf, NET_BUFSIZE);", "}", "if (flags & QEMU_NET_PACKET_FLAG_RAW && nc->info->receive_raw) {", "ret = nc->info->receive_raw(nc, buffer, offset);", "} else {", "ret = nc->info->receive(nc, buffer, offset);", "}", "g_free(buf);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ] ]
11,532
qemu_irq *arm_gic_init(uint32_t base, qemu_irq parent_irq) { gic_state *s; qemu_irq *qi; int iomemtype; s = (gic_state *)qemu_mallocz(sizeof(gic_state)); if (!s) return NULL; qi = qemu_allocate_irqs(gic_set_irq, s, GIC_NIRQ); s->parent_irq = parent_irq; if (base != 0xffffffff) { iomemtype = cpu_register_io_memory(0, gic_cpu_readfn, gic_cpu_writefn, s); cpu_register_physical_memory(base, 0x00000fff, iomemtype); iomemtype = cpu_register_io_memory(0, gic_dist_readfn, gic_dist_writefn, s); cpu_register_physical_memory(base + 0x1000, 0x00000fff, iomemtype); s->base = base; } else { s->base = 0; } gic_reset(s); return qi; }
true
qemu
187337f8b0ec0813dd3876d1efe37d415fb81c2e
qemu_irq *arm_gic_init(uint32_t base, qemu_irq parent_irq) { gic_state *s; qemu_irq *qi; int iomemtype; s = (gic_state *)qemu_mallocz(sizeof(gic_state)); if (!s) return NULL; qi = qemu_allocate_irqs(gic_set_irq, s, GIC_NIRQ); s->parent_irq = parent_irq; if (base != 0xffffffff) { iomemtype = cpu_register_io_memory(0, gic_cpu_readfn, gic_cpu_writefn, s); cpu_register_physical_memory(base, 0x00000fff, iomemtype); iomemtype = cpu_register_io_memory(0, gic_dist_readfn, gic_dist_writefn, s); cpu_register_physical_memory(base + 0x1000, 0x00000fff, iomemtype); s->base = base; } else { s->base = 0; } gic_reset(s); return qi; }
{ "code": [ " cpu_register_physical_memory(base, 0x00000fff, iomemtype);", " cpu_register_physical_memory(base + 0x1000, 0x00000fff, iomemtype);" ], "line_no": [ 29, 35 ] }
qemu_irq *FUNC_0(uint32_t base, qemu_irq parent_irq) { gic_state *s; qemu_irq *qi; int VAR_0; s = (gic_state *)qemu_mallocz(sizeof(gic_state)); if (!s) return NULL; qi = qemu_allocate_irqs(gic_set_irq, s, GIC_NIRQ); s->parent_irq = parent_irq; if (base != 0xffffffff) { VAR_0 = cpu_register_io_memory(0, gic_cpu_readfn, gic_cpu_writefn, s); cpu_register_physical_memory(base, 0x00000fff, VAR_0); VAR_0 = cpu_register_io_memory(0, gic_dist_readfn, gic_dist_writefn, s); cpu_register_physical_memory(base + 0x1000, 0x00000fff, VAR_0); s->base = base; } else { s->base = 0; } gic_reset(s); return qi; }
[ "qemu_irq *FUNC_0(uint32_t base, qemu_irq parent_irq)\n{", "gic_state *s;", "qemu_irq *qi;", "int VAR_0;", "s = (gic_state *)qemu_mallocz(sizeof(gic_state));", "if (!s)\nreturn NULL;", "qi = qemu_allocate_irqs(gic_set_irq, s, GIC_NIRQ);", "s->parent_irq = parent_irq;", "if (base != 0xffffffff) {", "VAR_0 = cpu_register_io_memory(0, gic_cpu_readfn,\ngic_cpu_writefn, s);", "cpu_register_physical_memory(base, 0x00000fff, VAR_0);", "VAR_0 = cpu_register_io_memory(0, gic_dist_readfn,\ngic_dist_writefn, s);", "cpu_register_physical_memory(base + 0x1000, 0x00000fff, VAR_0);", "s->base = base;", "} else {", "s->base = 0;", "}", "gic_reset(s);", "return qi;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
11,533
static int qcow_create2(const char *filename, int64_t total_size, const char *backing_file, const char *backing_format, int flags, size_t cluster_size, int prealloc) { int fd, header_size, backing_filename_len, l1_size, i, shift, l2_bits; int ref_clusters, backing_format_len = 0; int rounded_ext_bf_len = 0; QCowHeader header; uint64_t tmp, offset; QCowCreateState s1, *s = &s1; QCowExtension ext_bf = {0, 0}; int ret; memset(s, 0, sizeof(*s)); fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); if (fd < 0) return -1; memset(&header, 0, sizeof(header)); header.magic = cpu_to_be32(QCOW_MAGIC); header.version = cpu_to_be32(QCOW_VERSION); header.size = cpu_to_be64(total_size * 512); header_size = sizeof(header); backing_filename_len = 0; if (backing_file) { if (backing_format) { ext_bf.magic = QCOW_EXT_MAGIC_BACKING_FORMAT; backing_format_len = strlen(backing_format); ext_bf.len = backing_format_len; rounded_ext_bf_len = (sizeof(ext_bf) + ext_bf.len + 7) & ~7; header_size += rounded_ext_bf_len; } header.backing_file_offset = cpu_to_be64(header_size); backing_filename_len = strlen(backing_file); header.backing_file_size = cpu_to_be32(backing_filename_len); header_size += backing_filename_len; } /* Cluster size */ s->cluster_bits = get_bits_from_size(cluster_size); if (s->cluster_bits < MIN_CLUSTER_BITS || s->cluster_bits > MAX_CLUSTER_BITS) { fprintf(stderr, "Cluster size must be a power of two between " "%d and %dk\n", 1 << MIN_CLUSTER_BITS, 1 << (MAX_CLUSTER_BITS - 10)); return -EINVAL; } s->cluster_size = 1 << s->cluster_bits; header.cluster_bits = cpu_to_be32(s->cluster_bits); header_size = (header_size + 7) & ~7; if (flags & BLOCK_FLAG_ENCRYPT) { header.crypt_method = cpu_to_be32(QCOW_CRYPT_AES); } else { header.crypt_method = cpu_to_be32(QCOW_CRYPT_NONE); } l2_bits = s->cluster_bits - 3; shift = s->cluster_bits + l2_bits; l1_size = (((total_size * 512) + (1LL << shift) - 1) >> shift); offset = align_offset(header_size, s->cluster_size); s->l1_table_offset = offset; header.l1_table_offset = cpu_to_be64(s->l1_table_offset); header.l1_size = cpu_to_be32(l1_size); offset += align_offset(l1_size * sizeof(uint64_t), s->cluster_size); s->refcount_table = qemu_mallocz(s->cluster_size); s->refcount_table_offset = offset; header.refcount_table_offset = cpu_to_be64(offset); header.refcount_table_clusters = cpu_to_be32(1); offset += s->cluster_size; s->refcount_block_offset = offset; /* count how many refcount blocks needed */ tmp = offset >> s->cluster_bits; ref_clusters = (tmp >> (s->cluster_bits - REFCOUNT_SHIFT)) + 1; for (i=0; i < ref_clusters; i++) { s->refcount_table[i] = cpu_to_be64(offset); offset += s->cluster_size; } s->refcount_block = qemu_mallocz(ref_clusters * s->cluster_size); /* update refcounts */ qcow2_create_refcount_update(s, 0, header_size); qcow2_create_refcount_update(s, s->l1_table_offset, l1_size * sizeof(uint64_t)); qcow2_create_refcount_update(s, s->refcount_table_offset, s->cluster_size); qcow2_create_refcount_update(s, s->refcount_block_offset, ref_clusters * s->cluster_size); /* write all the data */ ret = qemu_write_full(fd, &header, sizeof(header)); if (ret != sizeof(header)) { ret = -1; goto exit; } if (backing_file) { if (backing_format_len) { char zero[16]; int padding = rounded_ext_bf_len - (ext_bf.len + sizeof(ext_bf)); memset(zero, 0, sizeof(zero)); cpu_to_be32s(&ext_bf.magic); cpu_to_be32s(&ext_bf.len); ret = qemu_write_full(fd, &ext_bf, sizeof(ext_bf)); if (ret != sizeof(ext_bf)) { ret = -1; goto exit; } ret = qemu_write_full(fd, backing_format, backing_format_len); if (ret != backing_format_len) { ret = -1; goto exit; } if (padding > 0) { ret = qemu_write_full(fd, zero, padding); if (ret != padding) { ret = -1; goto exit; } } } ret = qemu_write_full(fd, backing_file, backing_filename_len); if (ret != backing_filename_len) { ret = -1; goto exit; } } lseek(fd, s->l1_table_offset, SEEK_SET); tmp = 0; for(i = 0;i < l1_size; i++) { ret = qemu_write_full(fd, &tmp, sizeof(tmp)); if (ret != sizeof(tmp)) { ret = -1; goto exit; } } lseek(fd, s->refcount_table_offset, SEEK_SET); ret = qemu_write_full(fd, s->refcount_table, s->cluster_size); if (ret != s->cluster_size) { ret = -1; goto exit; } lseek(fd, s->refcount_block_offset, SEEK_SET); ret = qemu_write_full(fd, s->refcount_block, ref_clusters * s->cluster_size); if (ret != s->cluster_size) { ret = -1; goto exit; } ret = 0; exit: qemu_free(s->refcount_table); qemu_free(s->refcount_block); close(fd); /* Preallocate metadata */ if (prealloc) { BlockDriverState *bs; bs = bdrv_new(""); bdrv_open(bs, filename, BDRV_O_CACHE_WB | BDRV_O_RDWR); preallocate(bs); bdrv_close(bs); } return ret; }
true
qemu
6f745bdaac26bcbdd7e2ffa2a6ea29aabbbc54e1
static int qcow_create2(const char *filename, int64_t total_size, const char *backing_file, const char *backing_format, int flags, size_t cluster_size, int prealloc) { int fd, header_size, backing_filename_len, l1_size, i, shift, l2_bits; int ref_clusters, backing_format_len = 0; int rounded_ext_bf_len = 0; QCowHeader header; uint64_t tmp, offset; QCowCreateState s1, *s = &s1; QCowExtension ext_bf = {0, 0}; int ret; memset(s, 0, sizeof(*s)); fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); if (fd < 0) return -1; memset(&header, 0, sizeof(header)); header.magic = cpu_to_be32(QCOW_MAGIC); header.version = cpu_to_be32(QCOW_VERSION); header.size = cpu_to_be64(total_size * 512); header_size = sizeof(header); backing_filename_len = 0; if (backing_file) { if (backing_format) { ext_bf.magic = QCOW_EXT_MAGIC_BACKING_FORMAT; backing_format_len = strlen(backing_format); ext_bf.len = backing_format_len; rounded_ext_bf_len = (sizeof(ext_bf) + ext_bf.len + 7) & ~7; header_size += rounded_ext_bf_len; } header.backing_file_offset = cpu_to_be64(header_size); backing_filename_len = strlen(backing_file); header.backing_file_size = cpu_to_be32(backing_filename_len); header_size += backing_filename_len; } s->cluster_bits = get_bits_from_size(cluster_size); if (s->cluster_bits < MIN_CLUSTER_BITS || s->cluster_bits > MAX_CLUSTER_BITS) { fprintf(stderr, "Cluster size must be a power of two between " "%d and %dk\n", 1 << MIN_CLUSTER_BITS, 1 << (MAX_CLUSTER_BITS - 10)); return -EINVAL; } s->cluster_size = 1 << s->cluster_bits; header.cluster_bits = cpu_to_be32(s->cluster_bits); header_size = (header_size + 7) & ~7; if (flags & BLOCK_FLAG_ENCRYPT) { header.crypt_method = cpu_to_be32(QCOW_CRYPT_AES); } else { header.crypt_method = cpu_to_be32(QCOW_CRYPT_NONE); } l2_bits = s->cluster_bits - 3; shift = s->cluster_bits + l2_bits; l1_size = (((total_size * 512) + (1LL << shift) - 1) >> shift); offset = align_offset(header_size, s->cluster_size); s->l1_table_offset = offset; header.l1_table_offset = cpu_to_be64(s->l1_table_offset); header.l1_size = cpu_to_be32(l1_size); offset += align_offset(l1_size * sizeof(uint64_t), s->cluster_size); s->refcount_table = qemu_mallocz(s->cluster_size); s->refcount_table_offset = offset; header.refcount_table_offset = cpu_to_be64(offset); header.refcount_table_clusters = cpu_to_be32(1); offset += s->cluster_size; s->refcount_block_offset = offset; tmp = offset >> s->cluster_bits; ref_clusters = (tmp >> (s->cluster_bits - REFCOUNT_SHIFT)) + 1; for (i=0; i < ref_clusters; i++) { s->refcount_table[i] = cpu_to_be64(offset); offset += s->cluster_size; } s->refcount_block = qemu_mallocz(ref_clusters * s->cluster_size); qcow2_create_refcount_update(s, 0, header_size); qcow2_create_refcount_update(s, s->l1_table_offset, l1_size * sizeof(uint64_t)); qcow2_create_refcount_update(s, s->refcount_table_offset, s->cluster_size); qcow2_create_refcount_update(s, s->refcount_block_offset, ref_clusters * s->cluster_size); ret = qemu_write_full(fd, &header, sizeof(header)); if (ret != sizeof(header)) { ret = -1; goto exit; } if (backing_file) { if (backing_format_len) { char zero[16]; int padding = rounded_ext_bf_len - (ext_bf.len + sizeof(ext_bf)); memset(zero, 0, sizeof(zero)); cpu_to_be32s(&ext_bf.magic); cpu_to_be32s(&ext_bf.len); ret = qemu_write_full(fd, &ext_bf, sizeof(ext_bf)); if (ret != sizeof(ext_bf)) { ret = -1; goto exit; } ret = qemu_write_full(fd, backing_format, backing_format_len); if (ret != backing_format_len) { ret = -1; goto exit; } if (padding > 0) { ret = qemu_write_full(fd, zero, padding); if (ret != padding) { ret = -1; goto exit; } } } ret = qemu_write_full(fd, backing_file, backing_filename_len); if (ret != backing_filename_len) { ret = -1; goto exit; } } lseek(fd, s->l1_table_offset, SEEK_SET); tmp = 0; for(i = 0;i < l1_size; i++) { ret = qemu_write_full(fd, &tmp, sizeof(tmp)); if (ret != sizeof(tmp)) { ret = -1; goto exit; } } lseek(fd, s->refcount_table_offset, SEEK_SET); ret = qemu_write_full(fd, s->refcount_table, s->cluster_size); if (ret != s->cluster_size) { ret = -1; goto exit; } lseek(fd, s->refcount_block_offset, SEEK_SET); ret = qemu_write_full(fd, s->refcount_block, ref_clusters * s->cluster_size); if (ret != s->cluster_size) { ret = -1; goto exit; } ret = 0; exit: qemu_free(s->refcount_table); qemu_free(s->refcount_block); close(fd); if (prealloc) { BlockDriverState *bs; bs = bdrv_new(""); bdrv_open(bs, filename, BDRV_O_CACHE_WB | BDRV_O_RDWR); preallocate(bs); bdrv_close(bs); } return ret; }
{ "code": [ " if (ret != s->cluster_size) {", " if (prealloc) {" ], "line_no": [ 287, 327 ] }
static int FUNC_0(const char *VAR_0, int64_t VAR_1, const char *VAR_2, const char *VAR_3, int VAR_4, size_t VAR_5, int VAR_6) { int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13; int VAR_14, VAR_15 = 0; int VAR_16 = 0; QCowHeader header; uint64_t tmp, offset; QCowCreateState s1, *s = &s1; QCowExtension ext_bf = {0, 0}; int VAR_17; memset(s, 0, sizeof(*s)); VAR_7 = open(VAR_0, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); if (VAR_7 < 0) return -1; memset(&header, 0, sizeof(header)); header.magic = cpu_to_be32(QCOW_MAGIC); header.version = cpu_to_be32(QCOW_VERSION); header.size = cpu_to_be64(VAR_1 * 512); VAR_8 = sizeof(header); VAR_9 = 0; if (VAR_2) { if (VAR_3) { ext_bf.magic = QCOW_EXT_MAGIC_BACKING_FORMAT; VAR_15 = strlen(VAR_3); ext_bf.len = VAR_15; VAR_16 = (sizeof(ext_bf) + ext_bf.len + 7) & ~7; VAR_8 += VAR_16; } header.backing_file_offset = cpu_to_be64(VAR_8); VAR_9 = strlen(VAR_2); header.backing_file_size = cpu_to_be32(VAR_9); VAR_8 += VAR_9; } s->cluster_bits = get_bits_from_size(VAR_5); if (s->cluster_bits < MIN_CLUSTER_BITS || s->cluster_bits > MAX_CLUSTER_BITS) { fprintf(stderr, "Cluster size must be a power of two between " "%d and %dk\n", 1 << MIN_CLUSTER_BITS, 1 << (MAX_CLUSTER_BITS - 10)); return -EINVAL; } s->VAR_5 = 1 << s->cluster_bits; header.cluster_bits = cpu_to_be32(s->cluster_bits); VAR_8 = (VAR_8 + 7) & ~7; if (VAR_4 & BLOCK_FLAG_ENCRYPT) { header.crypt_method = cpu_to_be32(QCOW_CRYPT_AES); } else { header.crypt_method = cpu_to_be32(QCOW_CRYPT_NONE); } VAR_13 = s->cluster_bits - 3; VAR_12 = s->cluster_bits + VAR_13; VAR_10 = (((VAR_1 * 512) + (1LL << VAR_12) - 1) >> VAR_12); offset = align_offset(VAR_8, s->VAR_5); s->l1_table_offset = offset; header.l1_table_offset = cpu_to_be64(s->l1_table_offset); header.VAR_10 = cpu_to_be32(VAR_10); offset += align_offset(VAR_10 * sizeof(uint64_t), s->VAR_5); s->refcount_table = qemu_mallocz(s->VAR_5); s->refcount_table_offset = offset; header.refcount_table_offset = cpu_to_be64(offset); header.refcount_table_clusters = cpu_to_be32(1); offset += s->VAR_5; s->refcount_block_offset = offset; tmp = offset >> s->cluster_bits; VAR_14 = (tmp >> (s->cluster_bits - REFCOUNT_SHIFT)) + 1; for (VAR_11=0; VAR_11 < VAR_14; VAR_11++) { s->refcount_table[VAR_11] = cpu_to_be64(offset); offset += s->VAR_5; } s->refcount_block = qemu_mallocz(VAR_14 * s->VAR_5); qcow2_create_refcount_update(s, 0, VAR_8); qcow2_create_refcount_update(s, s->l1_table_offset, VAR_10 * sizeof(uint64_t)); qcow2_create_refcount_update(s, s->refcount_table_offset, s->VAR_5); qcow2_create_refcount_update(s, s->refcount_block_offset, VAR_14 * s->VAR_5); VAR_17 = qemu_write_full(VAR_7, &header, sizeof(header)); if (VAR_17 != sizeof(header)) { VAR_17 = -1; goto exit; } if (VAR_2) { if (VAR_15) { char VAR_18[16]; int VAR_19 = VAR_16 - (ext_bf.len + sizeof(ext_bf)); memset(VAR_18, 0, sizeof(VAR_18)); cpu_to_be32s(&ext_bf.magic); cpu_to_be32s(&ext_bf.len); VAR_17 = qemu_write_full(VAR_7, &ext_bf, sizeof(ext_bf)); if (VAR_17 != sizeof(ext_bf)) { VAR_17 = -1; goto exit; } VAR_17 = qemu_write_full(VAR_7, VAR_3, VAR_15); if (VAR_17 != VAR_15) { VAR_17 = -1; goto exit; } if (VAR_19 > 0) { VAR_17 = qemu_write_full(VAR_7, VAR_18, VAR_19); if (VAR_17 != VAR_19) { VAR_17 = -1; goto exit; } } } VAR_17 = qemu_write_full(VAR_7, VAR_2, VAR_9); if (VAR_17 != VAR_9) { VAR_17 = -1; goto exit; } } lseek(VAR_7, s->l1_table_offset, SEEK_SET); tmp = 0; for(VAR_11 = 0;VAR_11 < VAR_10; VAR_11++) { VAR_17 = qemu_write_full(VAR_7, &tmp, sizeof(tmp)); if (VAR_17 != sizeof(tmp)) { VAR_17 = -1; goto exit; } } lseek(VAR_7, s->refcount_table_offset, SEEK_SET); VAR_17 = qemu_write_full(VAR_7, s->refcount_table, s->VAR_5); if (VAR_17 != s->VAR_5) { VAR_17 = -1; goto exit; } lseek(VAR_7, s->refcount_block_offset, SEEK_SET); VAR_17 = qemu_write_full(VAR_7, s->refcount_block, VAR_14 * s->VAR_5); if (VAR_17 != s->VAR_5) { VAR_17 = -1; goto exit; } VAR_17 = 0; exit: qemu_free(s->refcount_table); qemu_free(s->refcount_block); close(VAR_7); if (VAR_6) { BlockDriverState *bs; bs = bdrv_new(""); bdrv_open(bs, VAR_0, BDRV_O_CACHE_WB | BDRV_O_RDWR); preallocate(bs); bdrv_close(bs); } return VAR_17; }
[ "static int FUNC_0(const char *VAR_0, int64_t VAR_1,\nconst char *VAR_2, const char *VAR_3,\nint VAR_4, size_t VAR_5, int VAR_6)\n{", "int VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_13;", "int VAR_14, VAR_15 = 0;", "int VAR_16 = 0;", "QCowHeader header;", "uint64_t tmp, offset;", "QCowCreateState s1, *s = &s1;", "QCowExtension ext_bf = {0, 0};", "int VAR_17;", "memset(s, 0, sizeof(*s));", "VAR_7 = open(VAR_0, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);", "if (VAR_7 < 0)\nreturn -1;", "memset(&header, 0, sizeof(header));", "header.magic = cpu_to_be32(QCOW_MAGIC);", "header.version = cpu_to_be32(QCOW_VERSION);", "header.size = cpu_to_be64(VAR_1 * 512);", "VAR_8 = sizeof(header);", "VAR_9 = 0;", "if (VAR_2) {", "if (VAR_3) {", "ext_bf.magic = QCOW_EXT_MAGIC_BACKING_FORMAT;", "VAR_15 = strlen(VAR_3);", "ext_bf.len = VAR_15;", "VAR_16 = (sizeof(ext_bf) + ext_bf.len + 7) & ~7;", "VAR_8 += VAR_16;", "}", "header.backing_file_offset = cpu_to_be64(VAR_8);", "VAR_9 = strlen(VAR_2);", "header.backing_file_size = cpu_to_be32(VAR_9);", "VAR_8 += VAR_9;", "}", "s->cluster_bits = get_bits_from_size(VAR_5);", "if (s->cluster_bits < MIN_CLUSTER_BITS ||\ns->cluster_bits > MAX_CLUSTER_BITS)\n{", "fprintf(stderr, \"Cluster size must be a power of two between \"\n\"%d and %dk\\n\",\n1 << MIN_CLUSTER_BITS,\n1 << (MAX_CLUSTER_BITS - 10));", "return -EINVAL;", "}", "s->VAR_5 = 1 << s->cluster_bits;", "header.cluster_bits = cpu_to_be32(s->cluster_bits);", "VAR_8 = (VAR_8 + 7) & ~7;", "if (VAR_4 & BLOCK_FLAG_ENCRYPT) {", "header.crypt_method = cpu_to_be32(QCOW_CRYPT_AES);", "} else {", "header.crypt_method = cpu_to_be32(QCOW_CRYPT_NONE);", "}", "VAR_13 = s->cluster_bits - 3;", "VAR_12 = s->cluster_bits + VAR_13;", "VAR_10 = (((VAR_1 * 512) + (1LL << VAR_12) - 1) >> VAR_12);", "offset = align_offset(VAR_8, s->VAR_5);", "s->l1_table_offset = offset;", "header.l1_table_offset = cpu_to_be64(s->l1_table_offset);", "header.VAR_10 = cpu_to_be32(VAR_10);", "offset += align_offset(VAR_10 * sizeof(uint64_t), s->VAR_5);", "s->refcount_table = qemu_mallocz(s->VAR_5);", "s->refcount_table_offset = offset;", "header.refcount_table_offset = cpu_to_be64(offset);", "header.refcount_table_clusters = cpu_to_be32(1);", "offset += s->VAR_5;", "s->refcount_block_offset = offset;", "tmp = offset >> s->cluster_bits;", "VAR_14 = (tmp >> (s->cluster_bits - REFCOUNT_SHIFT)) + 1;", "for (VAR_11=0; VAR_11 < VAR_14; VAR_11++) {", "s->refcount_table[VAR_11] = cpu_to_be64(offset);", "offset += s->VAR_5;", "}", "s->refcount_block = qemu_mallocz(VAR_14 * s->VAR_5);", "qcow2_create_refcount_update(s, 0, VAR_8);", "qcow2_create_refcount_update(s, s->l1_table_offset,\nVAR_10 * sizeof(uint64_t));", "qcow2_create_refcount_update(s, s->refcount_table_offset, s->VAR_5);", "qcow2_create_refcount_update(s, s->refcount_block_offset,\nVAR_14 * s->VAR_5);", "VAR_17 = qemu_write_full(VAR_7, &header, sizeof(header));", "if (VAR_17 != sizeof(header)) {", "VAR_17 = -1;", "goto exit;", "}", "if (VAR_2) {", "if (VAR_15) {", "char VAR_18[16];", "int VAR_19 = VAR_16 - (ext_bf.len + sizeof(ext_bf));", "memset(VAR_18, 0, sizeof(VAR_18));", "cpu_to_be32s(&ext_bf.magic);", "cpu_to_be32s(&ext_bf.len);", "VAR_17 = qemu_write_full(VAR_7, &ext_bf, sizeof(ext_bf));", "if (VAR_17 != sizeof(ext_bf)) {", "VAR_17 = -1;", "goto exit;", "}", "VAR_17 = qemu_write_full(VAR_7, VAR_3, VAR_15);", "if (VAR_17 != VAR_15) {", "VAR_17 = -1;", "goto exit;", "}", "if (VAR_19 > 0) {", "VAR_17 = qemu_write_full(VAR_7, VAR_18, VAR_19);", "if (VAR_17 != VAR_19) {", "VAR_17 = -1;", "goto exit;", "}", "}", "}", "VAR_17 = qemu_write_full(VAR_7, VAR_2, VAR_9);", "if (VAR_17 != VAR_9) {", "VAR_17 = -1;", "goto exit;", "}", "}", "lseek(VAR_7, s->l1_table_offset, SEEK_SET);", "tmp = 0;", "for(VAR_11 = 0;VAR_11 < VAR_10; VAR_11++) {", "VAR_17 = qemu_write_full(VAR_7, &tmp, sizeof(tmp));", "if (VAR_17 != sizeof(tmp)) {", "VAR_17 = -1;", "goto exit;", "}", "}", "lseek(VAR_7, s->refcount_table_offset, SEEK_SET);", "VAR_17 = qemu_write_full(VAR_7, s->refcount_table, s->VAR_5);", "if (VAR_17 != s->VAR_5) {", "VAR_17 = -1;", "goto exit;", "}", "lseek(VAR_7, s->refcount_block_offset, SEEK_SET);", "VAR_17 = qemu_write_full(VAR_7, s->refcount_block,\nVAR_14 * s->VAR_5);", "if (VAR_17 != s->VAR_5) {", "VAR_17 = -1;", "goto exit;", "}", "VAR_17 = 0;", "exit:\nqemu_free(s->refcount_table);", "qemu_free(s->refcount_block);", "close(VAR_7);", "if (VAR_6) {", "BlockDriverState *bs;", "bs = bdrv_new(\"\");", "bdrv_open(bs, VAR_0, BDRV_O_CACHE_WB | BDRV_O_RDWR);", "preallocate(bs);", "bdrv_close(bs);", "}", "return VAR_17;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 81 ], [ 83, 85, 87 ], [ 89, 91, 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183, 185 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 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 ], [ 297 ], [ 299, 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 313 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 343 ], [ 345 ] ]
11,534
static void chroma_4mv_motion(MpegEncContext *s, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture, op_pixels_func *pix_op, int mx, int my) { int dxy, emu=0, src_x, src_y, offset; uint8_t *ptr; /* In case of 8X8, we construct a single chroma motion vector with a special rounding */ mx= ff_h263_round_chroma(mx); my= ff_h263_round_chroma(my); dxy = ((my & 1) << 1) | (mx & 1); mx >>= 1; my >>= 1; src_x = s->mb_x * 8 + mx; src_y = s->mb_y * 8 + my; src_x = av_clip(src_x, -8, (s->width >> 1)); if (src_x == (s->width >> 1)) dxy &= ~1; src_y = av_clip(src_y, -8, (s->height >> 1)); if (src_y == (s->height >> 1)) dxy &= ~2; offset = src_y * s->uvlinesize + src_x; ptr = ref_picture[1] + offset; if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x > FFMAX((s->h_edge_pos>>1) - (dxy &1) - 8, 0) || (unsigned)src_y > FFMAX((s->v_edge_pos>>1) - (dxy>>1) - 8, 0)){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; emu=1; } } pix_op[dxy](dest_cb, ptr, s->uvlinesize, 8); ptr = ref_picture[2] + offset; if(emu){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; } pix_op[dxy](dest_cr, ptr, s->uvlinesize, 8); }
true
FFmpeg
c341f734e5f9d6af4a8fdcceb6f5d12de6395c76
static void chroma_4mv_motion(MpegEncContext *s, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture, op_pixels_func *pix_op, int mx, int my) { int dxy, emu=0, src_x, src_y, offset; uint8_t *ptr; mx= ff_h263_round_chroma(mx); my= ff_h263_round_chroma(my); dxy = ((my & 1) << 1) | (mx & 1); mx >>= 1; my >>= 1; src_x = s->mb_x * 8 + mx; src_y = s->mb_y * 8 + my; src_x = av_clip(src_x, -8, (s->width >> 1)); if (src_x == (s->width >> 1)) dxy &= ~1; src_y = av_clip(src_y, -8, (s->height >> 1)); if (src_y == (s->height >> 1)) dxy &= ~2; offset = src_y * s->uvlinesize + src_x; ptr = ref_picture[1] + offset; if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x > FFMAX((s->h_edge_pos>>1) - (dxy &1) - 8, 0) || (unsigned)src_y > FFMAX((s->v_edge_pos>>1) - (dxy>>1) - 8, 0)){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; emu=1; } } pix_op[dxy](dest_cb, ptr, s->uvlinesize, 8); ptr = ref_picture[2] + offset; if(emu){ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr= s->edge_emu_buffer; } pix_op[dxy](dest_cr, ptr, s->uvlinesize, 8); }
{ "code": [ " int dxy, emu=0, src_x, src_y, offset;" ], "line_no": [ 13 ] }
static void FUNC_0(MpegEncContext *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, uint8_t **VAR_3, op_pixels_func *VAR_4, int VAR_5, int VAR_6) { int VAR_7, VAR_8=0, VAR_9, VAR_10, VAR_11; uint8_t *ptr; VAR_5= ff_h263_round_chroma(VAR_5); VAR_6= ff_h263_round_chroma(VAR_6); VAR_7 = ((VAR_6 & 1) << 1) | (VAR_5 & 1); VAR_5 >>= 1; VAR_6 >>= 1; VAR_9 = VAR_0->mb_x * 8 + VAR_5; VAR_10 = VAR_0->mb_y * 8 + VAR_6; VAR_9 = av_clip(VAR_9, -8, (VAR_0->width >> 1)); if (VAR_9 == (VAR_0->width >> 1)) VAR_7 &= ~1; VAR_10 = av_clip(VAR_10, -8, (VAR_0->height >> 1)); if (VAR_10 == (VAR_0->height >> 1)) VAR_7 &= ~2; VAR_11 = VAR_10 * VAR_0->uvlinesize + VAR_9; ptr = VAR_3[1] + VAR_11; if(VAR_0->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)VAR_9 > FFMAX((VAR_0->h_edge_pos>>1) - (VAR_7 &1) - 8, 0) || (unsigned)VAR_10 > FFMAX((VAR_0->v_edge_pos>>1) - (VAR_7>>1) - 8, 0)){ VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_0->uvlinesize, 9, 9, VAR_9, VAR_10, VAR_0->h_edge_pos>>1, VAR_0->v_edge_pos>>1); ptr= VAR_0->edge_emu_buffer; VAR_8=1; } } VAR_4[VAR_7](VAR_1, ptr, VAR_0->uvlinesize, 8); ptr = VAR_3[2] + VAR_11; if(VAR_8){ VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_0->uvlinesize, 9, 9, VAR_9, VAR_10, VAR_0->h_edge_pos>>1, VAR_0->v_edge_pos>>1); ptr= VAR_0->edge_emu_buffer; } VAR_4[VAR_7](VAR_2, ptr, VAR_0->uvlinesize, 8); }
[ "static void FUNC_0(MpegEncContext *VAR_0,\nuint8_t *VAR_1, uint8_t *VAR_2,\nuint8_t **VAR_3,\nop_pixels_func *VAR_4,\nint VAR_5, int VAR_6)\n{", "int VAR_7, VAR_8=0, VAR_9, VAR_10, VAR_11;", "uint8_t *ptr;", "VAR_5= ff_h263_round_chroma(VAR_5);", "VAR_6= ff_h263_round_chroma(VAR_6);", "VAR_7 = ((VAR_6 & 1) << 1) | (VAR_5 & 1);", "VAR_5 >>= 1;", "VAR_6 >>= 1;", "VAR_9 = VAR_0->mb_x * 8 + VAR_5;", "VAR_10 = VAR_0->mb_y * 8 + VAR_6;", "VAR_9 = av_clip(VAR_9, -8, (VAR_0->width >> 1));", "if (VAR_9 == (VAR_0->width >> 1))\nVAR_7 &= ~1;", "VAR_10 = av_clip(VAR_10, -8, (VAR_0->height >> 1));", "if (VAR_10 == (VAR_0->height >> 1))\nVAR_7 &= ~2;", "VAR_11 = VAR_10 * VAR_0->uvlinesize + VAR_9;", "ptr = VAR_3[1] + VAR_11;", "if(VAR_0->flags&CODEC_FLAG_EMU_EDGE){", "if( (unsigned)VAR_9 > FFMAX((VAR_0->h_edge_pos>>1) - (VAR_7 &1) - 8, 0)\n|| (unsigned)VAR_10 > FFMAX((VAR_0->v_edge_pos>>1) - (VAR_7>>1) - 8, 0)){", "VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_0->uvlinesize,\n9, 9, VAR_9, VAR_10,\nVAR_0->h_edge_pos>>1, VAR_0->v_edge_pos>>1);", "ptr= VAR_0->edge_emu_buffer;", "VAR_8=1;", "}", "}", "VAR_4[VAR_7](VAR_1, ptr, VAR_0->uvlinesize, 8);", "ptr = VAR_3[2] + VAR_11;", "if(VAR_8){", "VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_0->uvlinesize,\n9, 9, VAR_9, VAR_10,\nVAR_0->h_edge_pos>>1, VAR_0->v_edge_pos>>1);", "ptr= VAR_0->edge_emu_buffer;", "}", "VAR_4[VAR_7](VAR_2, ptr, VAR_0->uvlinesize, 8);", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49, 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65, 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87, 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ] ]
11,536
static void super2xsai(AVFilterContext *ctx, uint8_t *src, int src_linesize, uint8_t *dst, int dst_linesize, int width, int height) { Super2xSaIContext *sai = ctx->priv; unsigned int x, y; uint32_t color[4][4]; unsigned char *src_line[4]; const int bpp = sai->bpp; const uint32_t hi_pixel_mask = sai->hi_pixel_mask; const uint32_t lo_pixel_mask = sai->lo_pixel_mask; const uint32_t q_hi_pixel_mask = sai->q_hi_pixel_mask; const uint32_t q_lo_pixel_mask = sai->q_lo_pixel_mask; /* Point to the first 4 lines, first line is duplicated */ src_line[0] = src; src_line[1] = src; src_line[2] = src + src_linesize*FFMIN(1, height-1); src_line[3] = src + src_linesize*FFMIN(2, height-1); #define READ_COLOR4(dst, src_line, off) dst = *((const uint32_t *)src_line + off) #define READ_COLOR3(dst, src_line, off) dst = AV_RL24 (src_line + 3*off) #define READ_COLOR2(dst, src_line, off) dst = *((const uint16_t *)src_line + off) /* Initialise the color matrix for this row. */ switch (bpp) { case 4: READ_COLOR4(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR4(color[0][2], src_line[0], 1); READ_COLOR4(color[0][3], src_line[0], 2); READ_COLOR4(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR4(color[1][2], src_line[1], 1); READ_COLOR4(color[1][3], src_line[1], 2); READ_COLOR4(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR4(color[2][2], src_line[2], 1); READ_COLOR4(color[2][3], src_line[2], 2); READ_COLOR4(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR4(color[3][2], src_line[3], 1); READ_COLOR4(color[3][3], src_line[3], 2); break; case 3: READ_COLOR3(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR3(color[0][2], src_line[0], 1); READ_COLOR3(color[0][3], src_line[0], 2); READ_COLOR3(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR3(color[1][2], src_line[1], 1); READ_COLOR3(color[1][3], src_line[1], 2); READ_COLOR3(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR3(color[2][2], src_line[2], 1); READ_COLOR3(color[2][3], src_line[2], 2); READ_COLOR3(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR3(color[3][2], src_line[3], 1); READ_COLOR3(color[3][3], src_line[3], 2); break; default: READ_COLOR2(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR2(color[0][2], src_line[0], 1); READ_COLOR2(color[0][3], src_line[0], 2); READ_COLOR2(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR2(color[1][2], src_line[1], 1); READ_COLOR2(color[1][3], src_line[1], 2); READ_COLOR2(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR2(color[2][2], src_line[2], 1); READ_COLOR2(color[2][3], src_line[2], 2); READ_COLOR2(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR2(color[3][2], src_line[3], 1); READ_COLOR2(color[3][3], src_line[3], 2); } for (y = 0; y < height; y++) { uint8_t *dst_line[2]; dst_line[0] = dst + dst_linesize*2*y; dst_line[1] = dst + dst_linesize*(2*y+1); for (x = 0; x < width; x++) { uint32_t product1a, product1b, product2a, product2b; //--------------------------------------- B0 B1 B2 B3 0 1 2 3 // 4 5* 6 S2 -> 4 5* 6 7 // 1 2 3 S1 8 9 10 11 // A0 A1 A2 A3 12 13 14 15 //-------------------------------------- if (color[2][1] == color[1][2] && color[1][1] != color[2][2]) { product2b = color[2][1]; product1b = product2b; } else if (color[1][1] == color[2][2] && color[2][1] != color[1][2]) { product2b = color[1][1]; product1b = product2b; } else if (color[1][1] == color[2][2] && color[2][1] == color[1][2]) { int r = 0; r += GET_RESULT(color[1][2], color[1][1], color[1][0], color[3][1]); r += GET_RESULT(color[1][2], color[1][1], color[2][0], color[0][1]); r += GET_RESULT(color[1][2], color[1][1], color[3][2], color[2][3]); r += GET_RESULT(color[1][2], color[1][1], color[0][2], color[1][3]); if (r > 0) product1b = color[1][2]; else if (r < 0) product1b = color[1][1]; else product1b = INTERPOLATE(color[1][1], color[1][2]); product2b = product1b; } else { if (color[1][2] == color[2][2] && color[2][2] == color[3][1] && color[2][1] != color[3][2] && color[2][2] != color[3][0]) product2b = Q_INTERPOLATE(color[2][2], color[2][2], color[2][2], color[2][1]); else if (color[1][1] == color[2][1] && color[2][1] == color[3][2] && color[3][1] != color[2][2] && color[2][1] != color[3][3]) product2b = Q_INTERPOLATE(color[2][1], color[2][1], color[2][1], color[2][2]); else product2b = INTERPOLATE(color[2][1], color[2][2]); if (color[1][2] == color[2][2] && color[1][2] == color[0][1] && color[1][1] != color[0][2] && color[1][2] != color[0][0]) product1b = Q_INTERPOLATE(color[1][2], color[1][2], color[1][2], color[1][1]); else if (color[1][1] == color[2][1] && color[1][1] == color[0][2] && color[0][1] != color[1][2] && color[1][1] != color[0][3]) product1b = Q_INTERPOLATE(color[1][2], color[1][1], color[1][1], color[1][1]); else product1b = INTERPOLATE(color[1][1], color[1][2]); } if (color[1][1] == color[2][2] && color[2][1] != color[1][2] && color[1][0] == color[1][1] && color[1][1] != color[3][2]) product2a = INTERPOLATE(color[2][1], color[1][1]); else if (color[1][1] == color[2][0] && color[1][2] == color[1][1] && color[1][0] != color[2][1] && color[1][1] != color[3][0]) product2a = INTERPOLATE(color[2][1], color[1][1]); else product2a = color[2][1]; if (color[2][1] == color[1][2] && color[1][1] != color[2][2] && color[2][0] == color[2][1] && color[2][1] != color[0][2]) product1a = INTERPOLATE(color[2][1], color[1][1]); else if (color[1][0] == color[2][1] && color[2][2] == color[2][1] && color[2][0] != color[1][1] && color[2][1] != color[0][0]) product1a = INTERPOLATE(color[2][1], color[1][1]); else product1a = color[1][1]; /* Set the calculated pixels */ switch (bpp) { case 4: AV_WN32A(dst_line[0] + x * 8, product1a); AV_WN32A(dst_line[0] + x * 8 + 4, product1b); AV_WN32A(dst_line[1] + x * 8, product2a); AV_WN32A(dst_line[1] + x * 8 + 4, product2b); break; case 3: AV_WL24(dst_line[0] + x * 6, product1a); AV_WL24(dst_line[0] + x * 6 + 3, product1b); AV_WL24(dst_line[1] + x * 6, product2a); AV_WL24(dst_line[1] + x * 6 + 3, product2b); break; default: // bpp = 2 AV_WN32A(dst_line[0] + x * 4, product1a | (product1b << 16)); AV_WN32A(dst_line[1] + x * 4, product2a | (product2b << 16)); } /* Move color matrix forward */ color[0][0] = color[0][1]; color[0][1] = color[0][2]; color[0][2] = color[0][3]; color[1][0] = color[1][1]; color[1][1] = color[1][2]; color[1][2] = color[1][3]; color[2][0] = color[2][1]; color[2][1] = color[2][2]; color[2][2] = color[2][3]; color[3][0] = color[3][1]; color[3][1] = color[3][2]; color[3][2] = color[3][3]; if (x < width - 3) { x += 3; switch (bpp) { case 4: READ_COLOR4(color[0][3], src_line[0], x); READ_COLOR4(color[1][3], src_line[1], x); READ_COLOR4(color[2][3], src_line[2], x); READ_COLOR4(color[3][3], src_line[3], x); break; case 3: READ_COLOR3(color[0][3], src_line[0], x); READ_COLOR3(color[1][3], src_line[1], x); READ_COLOR3(color[2][3], src_line[2], x); READ_COLOR3(color[3][3], src_line[3], x); break; default: /* case 2 */ READ_COLOR2(color[0][3], src_line[0], x); READ_COLOR2(color[1][3], src_line[1], x); READ_COLOR2(color[2][3], src_line[2], x); READ_COLOR2(color[3][3], src_line[3], x); } x -= 3; } } /* We're done with one line, so we shift the source lines up */ src_line[0] = src_line[1]; src_line[1] = src_line[2]; src_line[2] = src_line[3]; /* Read next line */ src_line[3] = src_line[2]; if (y < height - 3) src_line[3] += src_linesize; switch (bpp) { case 4: READ_COLOR4(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR4(color[0][2], src_line[0], 1); READ_COLOR4(color[0][3], src_line[0], 2); READ_COLOR4(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR4(color[1][2], src_line[1], 1); READ_COLOR4(color[1][3], src_line[1], 2); READ_COLOR4(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR4(color[2][2], src_line[2], 1); READ_COLOR4(color[2][3], src_line[2], 2); READ_COLOR4(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR4(color[3][2], src_line[3], 1); READ_COLOR4(color[3][3], src_line[3], 2); break; case 3: READ_COLOR3(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR3(color[0][2], src_line[0], 1); READ_COLOR3(color[0][3], src_line[0], 2); READ_COLOR3(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR3(color[1][2], src_line[1], 1); READ_COLOR3(color[1][3], src_line[1], 2); READ_COLOR3(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR3(color[2][2], src_line[2], 1); READ_COLOR3(color[2][3], src_line[2], 2); READ_COLOR3(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR3(color[3][2], src_line[3], 1); READ_COLOR3(color[3][3], src_line[3], 2); break; default: READ_COLOR2(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR2(color[0][2], src_line[0], 1); READ_COLOR2(color[0][3], src_line[0], 2); READ_COLOR2(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR2(color[1][2], src_line[1], 1); READ_COLOR2(color[1][3], src_line[1], 2); READ_COLOR2(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR2(color[2][2], src_line[2], 1); READ_COLOR2(color[2][3], src_line[2], 2); READ_COLOR2(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR2(color[3][2], src_line[3], 1); READ_COLOR2(color[3][3], src_line[3], 2); } } // y loop }
false
FFmpeg
b2bcbcd99967c7cb9f17ae07c48c32baf8855e40
static void super2xsai(AVFilterContext *ctx, uint8_t *src, int src_linesize, uint8_t *dst, int dst_linesize, int width, int height) { Super2xSaIContext *sai = ctx->priv; unsigned int x, y; uint32_t color[4][4]; unsigned char *src_line[4]; const int bpp = sai->bpp; const uint32_t hi_pixel_mask = sai->hi_pixel_mask; const uint32_t lo_pixel_mask = sai->lo_pixel_mask; const uint32_t q_hi_pixel_mask = sai->q_hi_pixel_mask; const uint32_t q_lo_pixel_mask = sai->q_lo_pixel_mask; src_line[0] = src; src_line[1] = src; src_line[2] = src + src_linesize*FFMIN(1, height-1); src_line[3] = src + src_linesize*FFMIN(2, height-1); #define READ_COLOR4(dst, src_line, off) dst = *((const uint32_t *)src_line + off) #define READ_COLOR3(dst, src_line, off) dst = AV_RL24 (src_line + 3*off) #define READ_COLOR2(dst, src_line, off) dst = *((const uint16_t *)src_line + off) switch (bpp) { case 4: READ_COLOR4(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR4(color[0][2], src_line[0], 1); READ_COLOR4(color[0][3], src_line[0], 2); READ_COLOR4(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR4(color[1][2], src_line[1], 1); READ_COLOR4(color[1][3], src_line[1], 2); READ_COLOR4(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR4(color[2][2], src_line[2], 1); READ_COLOR4(color[2][3], src_line[2], 2); READ_COLOR4(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR4(color[3][2], src_line[3], 1); READ_COLOR4(color[3][3], src_line[3], 2); break; case 3: READ_COLOR3(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR3(color[0][2], src_line[0], 1); READ_COLOR3(color[0][3], src_line[0], 2); READ_COLOR3(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR3(color[1][2], src_line[1], 1); READ_COLOR3(color[1][3], src_line[1], 2); READ_COLOR3(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR3(color[2][2], src_line[2], 1); READ_COLOR3(color[2][3], src_line[2], 2); READ_COLOR3(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR3(color[3][2], src_line[3], 1); READ_COLOR3(color[3][3], src_line[3], 2); break; default: READ_COLOR2(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR2(color[0][2], src_line[0], 1); READ_COLOR2(color[0][3], src_line[0], 2); READ_COLOR2(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR2(color[1][2], src_line[1], 1); READ_COLOR2(color[1][3], src_line[1], 2); READ_COLOR2(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR2(color[2][2], src_line[2], 1); READ_COLOR2(color[2][3], src_line[2], 2); READ_COLOR2(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR2(color[3][2], src_line[3], 1); READ_COLOR2(color[3][3], src_line[3], 2); } for (y = 0; y < height; y++) { uint8_t *dst_line[2]; dst_line[0] = dst + dst_linesize*2*y; dst_line[1] = dst + dst_linesize*(2*y+1); for (x = 0; x < width; x++) { uint32_t product1a, product1b, product2a, product2b; if (color[2][1] == color[1][2] && color[1][1] != color[2][2]) { product2b = color[2][1]; product1b = product2b; } else if (color[1][1] == color[2][2] && color[2][1] != color[1][2]) { product2b = color[1][1]; product1b = product2b; } else if (color[1][1] == color[2][2] && color[2][1] == color[1][2]) { int r = 0; r += GET_RESULT(color[1][2], color[1][1], color[1][0], color[3][1]); r += GET_RESULT(color[1][2], color[1][1], color[2][0], color[0][1]); r += GET_RESULT(color[1][2], color[1][1], color[3][2], color[2][3]); r += GET_RESULT(color[1][2], color[1][1], color[0][2], color[1][3]); if (r > 0) product1b = color[1][2]; else if (r < 0) product1b = color[1][1]; else product1b = INTERPOLATE(color[1][1], color[1][2]); product2b = product1b; } else { if (color[1][2] == color[2][2] && color[2][2] == color[3][1] && color[2][1] != color[3][2] && color[2][2] != color[3][0]) product2b = Q_INTERPOLATE(color[2][2], color[2][2], color[2][2], color[2][1]); else if (color[1][1] == color[2][1] && color[2][1] == color[3][2] && color[3][1] != color[2][2] && color[2][1] != color[3][3]) product2b = Q_INTERPOLATE(color[2][1], color[2][1], color[2][1], color[2][2]); else product2b = INTERPOLATE(color[2][1], color[2][2]); if (color[1][2] == color[2][2] && color[1][2] == color[0][1] && color[1][1] != color[0][2] && color[1][2] != color[0][0]) product1b = Q_INTERPOLATE(color[1][2], color[1][2], color[1][2], color[1][1]); else if (color[1][1] == color[2][1] && color[1][1] == color[0][2] && color[0][1] != color[1][2] && color[1][1] != color[0][3]) product1b = Q_INTERPOLATE(color[1][2], color[1][1], color[1][1], color[1][1]); else product1b = INTERPOLATE(color[1][1], color[1][2]); } if (color[1][1] == color[2][2] && color[2][1] != color[1][2] && color[1][0] == color[1][1] && color[1][1] != color[3][2]) product2a = INTERPOLATE(color[2][1], color[1][1]); else if (color[1][1] == color[2][0] && color[1][2] == color[1][1] && color[1][0] != color[2][1] && color[1][1] != color[3][0]) product2a = INTERPOLATE(color[2][1], color[1][1]); else product2a = color[2][1]; if (color[2][1] == color[1][2] && color[1][1] != color[2][2] && color[2][0] == color[2][1] && color[2][1] != color[0][2]) product1a = INTERPOLATE(color[2][1], color[1][1]); else if (color[1][0] == color[2][1] && color[2][2] == color[2][1] && color[2][0] != color[1][1] && color[2][1] != color[0][0]) product1a = INTERPOLATE(color[2][1], color[1][1]); else product1a = color[1][1]; switch (bpp) { case 4: AV_WN32A(dst_line[0] + x * 8, product1a); AV_WN32A(dst_line[0] + x * 8 + 4, product1b); AV_WN32A(dst_line[1] + x * 8, product2a); AV_WN32A(dst_line[1] + x * 8 + 4, product2b); break; case 3: AV_WL24(dst_line[0] + x * 6, product1a); AV_WL24(dst_line[0] + x * 6 + 3, product1b); AV_WL24(dst_line[1] + x * 6, product2a); AV_WL24(dst_line[1] + x * 6 + 3, product2b); break; default: AV_WN32A(dst_line[0] + x * 4, product1a | (product1b << 16)); AV_WN32A(dst_line[1] + x * 4, product2a | (product2b << 16)); } color[0][0] = color[0][1]; color[0][1] = color[0][2]; color[0][2] = color[0][3]; color[1][0] = color[1][1]; color[1][1] = color[1][2]; color[1][2] = color[1][3]; color[2][0] = color[2][1]; color[2][1] = color[2][2]; color[2][2] = color[2][3]; color[3][0] = color[3][1]; color[3][1] = color[3][2]; color[3][2] = color[3][3]; if (x < width - 3) { x += 3; switch (bpp) { case 4: READ_COLOR4(color[0][3], src_line[0], x); READ_COLOR4(color[1][3], src_line[1], x); READ_COLOR4(color[2][3], src_line[2], x); READ_COLOR4(color[3][3], src_line[3], x); break; case 3: READ_COLOR3(color[0][3], src_line[0], x); READ_COLOR3(color[1][3], src_line[1], x); READ_COLOR3(color[2][3], src_line[2], x); READ_COLOR3(color[3][3], src_line[3], x); break; default: READ_COLOR2(color[0][3], src_line[0], x); READ_COLOR2(color[1][3], src_line[1], x); READ_COLOR2(color[2][3], src_line[2], x); READ_COLOR2(color[3][3], src_line[3], x); } x -= 3; } } src_line[0] = src_line[1]; src_line[1] = src_line[2]; src_line[2] = src_line[3]; src_line[3] = src_line[2]; if (y < height - 3) src_line[3] += src_linesize; switch (bpp) { case 4: READ_COLOR4(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR4(color[0][2], src_line[0], 1); READ_COLOR4(color[0][3], src_line[0], 2); READ_COLOR4(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR4(color[1][2], src_line[1], 1); READ_COLOR4(color[1][3], src_line[1], 2); READ_COLOR4(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR4(color[2][2], src_line[2], 1); READ_COLOR4(color[2][3], src_line[2], 2); READ_COLOR4(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR4(color[3][2], src_line[3], 1); READ_COLOR4(color[3][3], src_line[3], 2); break; case 3: READ_COLOR3(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR3(color[0][2], src_line[0], 1); READ_COLOR3(color[0][3], src_line[0], 2); READ_COLOR3(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR3(color[1][2], src_line[1], 1); READ_COLOR3(color[1][3], src_line[1], 2); READ_COLOR3(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR3(color[2][2], src_line[2], 1); READ_COLOR3(color[2][3], src_line[2], 2); READ_COLOR3(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR3(color[3][2], src_line[3], 1); READ_COLOR3(color[3][3], src_line[3], 2); break; default: READ_COLOR2(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR2(color[0][2], src_line[0], 1); READ_COLOR2(color[0][3], src_line[0], 2); READ_COLOR2(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR2(color[1][2], src_line[1], 1); READ_COLOR2(color[1][3], src_line[1], 2); READ_COLOR2(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR2(color[2][2], src_line[2], 1); READ_COLOR2(color[2][3], src_line[2], 2); READ_COLOR2(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR2(color[3][2], src_line[3], 1); READ_COLOR2(color[3][3], src_line[3], 2); } } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFilterContext *VAR_0, uint8_t *VAR_1, int VAR_2, uint8_t *VAR_3, int VAR_4, int VAR_5, int VAR_6) { Super2xSaIContext *sai = VAR_0->priv; unsigned int VAR_7, VAR_8; uint32_t color[4][4]; unsigned char *VAR_9[4]; const int VAR_10 = sai->VAR_10; const uint32_t VAR_11 = sai->VAR_11; const uint32_t VAR_12 = sai->VAR_12; const uint32_t VAR_13 = sai->VAR_13; const uint32_t VAR_14 = sai->VAR_14; VAR_9[0] = VAR_1; VAR_9[1] = VAR_1; VAR_9[2] = VAR_1 + VAR_2*FFMIN(1, VAR_6-1); VAR_9[3] = VAR_1 + VAR_2*FFMIN(2, VAR_6-1); #define READ_COLOR4(VAR_3, VAR_9, off) VAR_3 = *((const uint32_t *)VAR_9 + off) #define READ_COLOR3(VAR_3, VAR_9, off) VAR_3 = AV_RL24 (VAR_9 + 3*off) #define READ_COLOR2(VAR_3, VAR_9, off) VAR_3 = *((const uint16_t *)VAR_9 + off) switch (VAR_10) { case 4: READ_COLOR4(color[0][0], VAR_9[0], 0); color[0][1] = color[0][0]; READ_COLOR4(color[0][2], VAR_9[0], 1); READ_COLOR4(color[0][3], VAR_9[0], 2); READ_COLOR4(color[1][0], VAR_9[1], 0); color[1][1] = color[1][0]; READ_COLOR4(color[1][2], VAR_9[1], 1); READ_COLOR4(color[1][3], VAR_9[1], 2); READ_COLOR4(color[2][0], VAR_9[2], 0); color[2][1] = color[2][0]; READ_COLOR4(color[2][2], VAR_9[2], 1); READ_COLOR4(color[2][3], VAR_9[2], 2); READ_COLOR4(color[3][0], VAR_9[3], 0); color[3][1] = color[3][0]; READ_COLOR4(color[3][2], VAR_9[3], 1); READ_COLOR4(color[3][3], VAR_9[3], 2); break; case 3: READ_COLOR3(color[0][0], VAR_9[0], 0); color[0][1] = color[0][0]; READ_COLOR3(color[0][2], VAR_9[0], 1); READ_COLOR3(color[0][3], VAR_9[0], 2); READ_COLOR3(color[1][0], VAR_9[1], 0); color[1][1] = color[1][0]; READ_COLOR3(color[1][2], VAR_9[1], 1); READ_COLOR3(color[1][3], VAR_9[1], 2); READ_COLOR3(color[2][0], VAR_9[2], 0); color[2][1] = color[2][0]; READ_COLOR3(color[2][2], VAR_9[2], 1); READ_COLOR3(color[2][3], VAR_9[2], 2); READ_COLOR3(color[3][0], VAR_9[3], 0); color[3][1] = color[3][0]; READ_COLOR3(color[3][2], VAR_9[3], 1); READ_COLOR3(color[3][3], VAR_9[3], 2); break; default: READ_COLOR2(color[0][0], VAR_9[0], 0); color[0][1] = color[0][0]; READ_COLOR2(color[0][2], VAR_9[0], 1); READ_COLOR2(color[0][3], VAR_9[0], 2); READ_COLOR2(color[1][0], VAR_9[1], 0); color[1][1] = color[1][0]; READ_COLOR2(color[1][2], VAR_9[1], 1); READ_COLOR2(color[1][3], VAR_9[1], 2); READ_COLOR2(color[2][0], VAR_9[2], 0); color[2][1] = color[2][0]; READ_COLOR2(color[2][2], VAR_9[2], 1); READ_COLOR2(color[2][3], VAR_9[2], 2); READ_COLOR2(color[3][0], VAR_9[3], 0); color[3][1] = color[3][0]; READ_COLOR2(color[3][2], VAR_9[3], 1); READ_COLOR2(color[3][3], VAR_9[3], 2); } for (VAR_8 = 0; VAR_8 < VAR_6; VAR_8++) { uint8_t *dst_line[2]; dst_line[0] = VAR_3 + VAR_4*2*VAR_8; dst_line[1] = VAR_3 + VAR_4*(2*VAR_8+1); for (VAR_7 = 0; VAR_7 < VAR_5; VAR_7++) { uint32_t product1a, product1b, product2a, product2b; if (color[2][1] == color[1][2] && color[1][1] != color[2][2]) { product2b = color[2][1]; product1b = product2b; } else if (color[1][1] == color[2][2] && color[2][1] != color[1][2]) { product2b = color[1][1]; product1b = product2b; } else if (color[1][1] == color[2][2] && color[2][1] == color[1][2]) { int VAR_15 = 0; VAR_15 += GET_RESULT(color[1][2], color[1][1], color[1][0], color[3][1]); VAR_15 += GET_RESULT(color[1][2], color[1][1], color[2][0], color[0][1]); VAR_15 += GET_RESULT(color[1][2], color[1][1], color[3][2], color[2][3]); VAR_15 += GET_RESULT(color[1][2], color[1][1], color[0][2], color[1][3]); if (VAR_15 > 0) product1b = color[1][2]; else if (VAR_15 < 0) product1b = color[1][1]; else product1b = INTERPOLATE(color[1][1], color[1][2]); product2b = product1b; } else { if (color[1][2] == color[2][2] && color[2][2] == color[3][1] && color[2][1] != color[3][2] && color[2][2] != color[3][0]) product2b = Q_INTERPOLATE(color[2][2], color[2][2], color[2][2], color[2][1]); else if (color[1][1] == color[2][1] && color[2][1] == color[3][2] && color[3][1] != color[2][2] && color[2][1] != color[3][3]) product2b = Q_INTERPOLATE(color[2][1], color[2][1], color[2][1], color[2][2]); else product2b = INTERPOLATE(color[2][1], color[2][2]); if (color[1][2] == color[2][2] && color[1][2] == color[0][1] && color[1][1] != color[0][2] && color[1][2] != color[0][0]) product1b = Q_INTERPOLATE(color[1][2], color[1][2], color[1][2], color[1][1]); else if (color[1][1] == color[2][1] && color[1][1] == color[0][2] && color[0][1] != color[1][2] && color[1][1] != color[0][3]) product1b = Q_INTERPOLATE(color[1][2], color[1][1], color[1][1], color[1][1]); else product1b = INTERPOLATE(color[1][1], color[1][2]); } if (color[1][1] == color[2][2] && color[2][1] != color[1][2] && color[1][0] == color[1][1] && color[1][1] != color[3][2]) product2a = INTERPOLATE(color[2][1], color[1][1]); else if (color[1][1] == color[2][0] && color[1][2] == color[1][1] && color[1][0] != color[2][1] && color[1][1] != color[3][0]) product2a = INTERPOLATE(color[2][1], color[1][1]); else product2a = color[2][1]; if (color[2][1] == color[1][2] && color[1][1] != color[2][2] && color[2][0] == color[2][1] && color[2][1] != color[0][2]) product1a = INTERPOLATE(color[2][1], color[1][1]); else if (color[1][0] == color[2][1] && color[2][2] == color[2][1] && color[2][0] != color[1][1] && color[2][1] != color[0][0]) product1a = INTERPOLATE(color[2][1], color[1][1]); else product1a = color[1][1]; switch (VAR_10) { case 4: AV_WN32A(dst_line[0] + VAR_7 * 8, product1a); AV_WN32A(dst_line[0] + VAR_7 * 8 + 4, product1b); AV_WN32A(dst_line[1] + VAR_7 * 8, product2a); AV_WN32A(dst_line[1] + VAR_7 * 8 + 4, product2b); break; case 3: AV_WL24(dst_line[0] + VAR_7 * 6, product1a); AV_WL24(dst_line[0] + VAR_7 * 6 + 3, product1b); AV_WL24(dst_line[1] + VAR_7 * 6, product2a); AV_WL24(dst_line[1] + VAR_7 * 6 + 3, product2b); break; default: AV_WN32A(dst_line[0] + VAR_7 * 4, product1a | (product1b << 16)); AV_WN32A(dst_line[1] + VAR_7 * 4, product2a | (product2b << 16)); } color[0][0] = color[0][1]; color[0][1] = color[0][2]; color[0][2] = color[0][3]; color[1][0] = color[1][1]; color[1][1] = color[1][2]; color[1][2] = color[1][3]; color[2][0] = color[2][1]; color[2][1] = color[2][2]; color[2][2] = color[2][3]; color[3][0] = color[3][1]; color[3][1] = color[3][2]; color[3][2] = color[3][3]; if (VAR_7 < VAR_5 - 3) { VAR_7 += 3; switch (VAR_10) { case 4: READ_COLOR4(color[0][3], VAR_9[0], VAR_7); READ_COLOR4(color[1][3], VAR_9[1], VAR_7); READ_COLOR4(color[2][3], VAR_9[2], VAR_7); READ_COLOR4(color[3][3], VAR_9[3], VAR_7); break; case 3: READ_COLOR3(color[0][3], VAR_9[0], VAR_7); READ_COLOR3(color[1][3], VAR_9[1], VAR_7); READ_COLOR3(color[2][3], VAR_9[2], VAR_7); READ_COLOR3(color[3][3], VAR_9[3], VAR_7); break; default: READ_COLOR2(color[0][3], VAR_9[0], VAR_7); READ_COLOR2(color[1][3], VAR_9[1], VAR_7); READ_COLOR2(color[2][3], VAR_9[2], VAR_7); READ_COLOR2(color[3][3], VAR_9[3], VAR_7); } VAR_7 -= 3; } } VAR_9[0] = VAR_9[1]; VAR_9[1] = VAR_9[2]; VAR_9[2] = VAR_9[3]; VAR_9[3] = VAR_9[2]; if (VAR_8 < VAR_6 - 3) VAR_9[3] += VAR_2; switch (VAR_10) { case 4: READ_COLOR4(color[0][0], VAR_9[0], 0); color[0][1] = color[0][0]; READ_COLOR4(color[0][2], VAR_9[0], 1); READ_COLOR4(color[0][3], VAR_9[0], 2); READ_COLOR4(color[1][0], VAR_9[1], 0); color[1][1] = color[1][0]; READ_COLOR4(color[1][2], VAR_9[1], 1); READ_COLOR4(color[1][3], VAR_9[1], 2); READ_COLOR4(color[2][0], VAR_9[2], 0); color[2][1] = color[2][0]; READ_COLOR4(color[2][2], VAR_9[2], 1); READ_COLOR4(color[2][3], VAR_9[2], 2); READ_COLOR4(color[3][0], VAR_9[3], 0); color[3][1] = color[3][0]; READ_COLOR4(color[3][2], VAR_9[3], 1); READ_COLOR4(color[3][3], VAR_9[3], 2); break; case 3: READ_COLOR3(color[0][0], VAR_9[0], 0); color[0][1] = color[0][0]; READ_COLOR3(color[0][2], VAR_9[0], 1); READ_COLOR3(color[0][3], VAR_9[0], 2); READ_COLOR3(color[1][0], VAR_9[1], 0); color[1][1] = color[1][0]; READ_COLOR3(color[1][2], VAR_9[1], 1); READ_COLOR3(color[1][3], VAR_9[1], 2); READ_COLOR3(color[2][0], VAR_9[2], 0); color[2][1] = color[2][0]; READ_COLOR3(color[2][2], VAR_9[2], 1); READ_COLOR3(color[2][3], VAR_9[2], 2); READ_COLOR3(color[3][0], VAR_9[3], 0); color[3][1] = color[3][0]; READ_COLOR3(color[3][2], VAR_9[3], 1); READ_COLOR3(color[3][3], VAR_9[3], 2); break; default: READ_COLOR2(color[0][0], VAR_9[0], 0); color[0][1] = color[0][0]; READ_COLOR2(color[0][2], VAR_9[0], 1); READ_COLOR2(color[0][3], VAR_9[0], 2); READ_COLOR2(color[1][0], VAR_9[1], 0); color[1][1] = color[1][0]; READ_COLOR2(color[1][2], VAR_9[1], 1); READ_COLOR2(color[1][3], VAR_9[1], 2); READ_COLOR2(color[2][0], VAR_9[2], 0); color[2][1] = color[2][0]; READ_COLOR2(color[2][2], VAR_9[2], 1); READ_COLOR2(color[2][3], VAR_9[2], 2); READ_COLOR2(color[3][0], VAR_9[3], 0); color[3][1] = color[3][0]; READ_COLOR2(color[3][2], VAR_9[3], 1); READ_COLOR2(color[3][3], VAR_9[3], 2); } } }
[ "static void FUNC_0(AVFilterContext *VAR_0,\nuint8_t *VAR_1, int VAR_2,\nuint8_t *VAR_3, int VAR_4,\nint VAR_5, int VAR_6)\n{", "Super2xSaIContext *sai = VAR_0->priv;", "unsigned int VAR_7, VAR_8;", "uint32_t color[4][4];", "unsigned char *VAR_9[4];", "const int VAR_10 = sai->VAR_10;", "const uint32_t VAR_11 = sai->VAR_11;", "const uint32_t VAR_12 = sai->VAR_12;", "const uint32_t VAR_13 = sai->VAR_13;", "const uint32_t VAR_14 = sai->VAR_14;", "VAR_9[0] = VAR_1;", "VAR_9[1] = VAR_1;", "VAR_9[2] = VAR_1 + VAR_2*FFMIN(1, VAR_6-1);", "VAR_9[3] = VAR_1 + VAR_2*FFMIN(2, VAR_6-1);", "#define READ_COLOR4(VAR_3, VAR_9, off) VAR_3 = *((const uint32_t *)VAR_9 + off)\n#define READ_COLOR3(VAR_3, VAR_9, off) VAR_3 = AV_RL24 (VAR_9 + 3*off)\n#define READ_COLOR2(VAR_3, VAR_9, off) VAR_3 = *((const uint16_t *)VAR_9 + off)\nswitch (VAR_10) {", "case 4:\nREAD_COLOR4(color[0][0], VAR_9[0], 0); color[0][1] = color[0][0]; READ_COLOR4(color[0][2], VAR_9[0], 1); READ_COLOR4(color[0][3], VAR_9[0], 2);", "READ_COLOR4(color[1][0], VAR_9[1], 0); color[1][1] = color[1][0]; READ_COLOR4(color[1][2], VAR_9[1], 1); READ_COLOR4(color[1][3], VAR_9[1], 2);", "READ_COLOR4(color[2][0], VAR_9[2], 0); color[2][1] = color[2][0]; READ_COLOR4(color[2][2], VAR_9[2], 1); READ_COLOR4(color[2][3], VAR_9[2], 2);", "READ_COLOR4(color[3][0], VAR_9[3], 0); color[3][1] = color[3][0]; READ_COLOR4(color[3][2], VAR_9[3], 1); READ_COLOR4(color[3][3], VAR_9[3], 2);", "break;", "case 3:\nREAD_COLOR3(color[0][0], VAR_9[0], 0); color[0][1] = color[0][0]; READ_COLOR3(color[0][2], VAR_9[0], 1); READ_COLOR3(color[0][3], VAR_9[0], 2);", "READ_COLOR3(color[1][0], VAR_9[1], 0); color[1][1] = color[1][0]; READ_COLOR3(color[1][2], VAR_9[1], 1); READ_COLOR3(color[1][3], VAR_9[1], 2);", "READ_COLOR3(color[2][0], VAR_9[2], 0); color[2][1] = color[2][0]; READ_COLOR3(color[2][2], VAR_9[2], 1); READ_COLOR3(color[2][3], VAR_9[2], 2);", "READ_COLOR3(color[3][0], VAR_9[3], 0); color[3][1] = color[3][0]; READ_COLOR3(color[3][2], VAR_9[3], 1); READ_COLOR3(color[3][3], VAR_9[3], 2);", "break;", "default:\nREAD_COLOR2(color[0][0], VAR_9[0], 0); color[0][1] = color[0][0]; READ_COLOR2(color[0][2], VAR_9[0], 1); READ_COLOR2(color[0][3], VAR_9[0], 2);", "READ_COLOR2(color[1][0], VAR_9[1], 0); color[1][1] = color[1][0]; READ_COLOR2(color[1][2], VAR_9[1], 1); READ_COLOR2(color[1][3], VAR_9[1], 2);", "READ_COLOR2(color[2][0], VAR_9[2], 0); color[2][1] = color[2][0]; READ_COLOR2(color[2][2], VAR_9[2], 1); READ_COLOR2(color[2][3], VAR_9[2], 2);", "READ_COLOR2(color[3][0], VAR_9[3], 0); color[3][1] = color[3][0]; READ_COLOR2(color[3][2], VAR_9[3], 1); READ_COLOR2(color[3][3], VAR_9[3], 2);", "}", "for (VAR_8 = 0; VAR_8 < VAR_6; VAR_8++) {", "uint8_t *dst_line[2];", "dst_line[0] = VAR_3 + VAR_4*2*VAR_8;", "dst_line[1] = VAR_3 + VAR_4*(2*VAR_8+1);", "for (VAR_7 = 0; VAR_7 < VAR_5; VAR_7++) {", "uint32_t product1a, product1b, product2a, product2b;", "if (color[2][1] == color[1][2] && color[1][1] != color[2][2]) {", "product2b = color[2][1];", "product1b = product2b;", "} else if (color[1][1] == color[2][2] && color[2][1] != color[1][2]) {", "product2b = color[1][1];", "product1b = product2b;", "} else if (color[1][1] == color[2][2] && color[2][1] == color[1][2]) {", "int VAR_15 = 0;", "VAR_15 += GET_RESULT(color[1][2], color[1][1], color[1][0], color[3][1]);", "VAR_15 += GET_RESULT(color[1][2], color[1][1], color[2][0], color[0][1]);", "VAR_15 += GET_RESULT(color[1][2], color[1][1], color[3][2], color[2][3]);", "VAR_15 += GET_RESULT(color[1][2], color[1][1], color[0][2], color[1][3]);", "if (VAR_15 > 0)\nproduct1b = color[1][2];", "else if (VAR_15 < 0)\nproduct1b = color[1][1];", "else\nproduct1b = INTERPOLATE(color[1][1], color[1][2]);", "product2b = product1b;", "} else {", "if (color[1][2] == color[2][2] && color[2][2] == color[3][1] && color[2][1] != color[3][2] && color[2][2] != color[3][0])\nproduct2b = Q_INTERPOLATE(color[2][2], color[2][2], color[2][2], color[2][1]);", "else if (color[1][1] == color[2][1] && color[2][1] == color[3][2] && color[3][1] != color[2][2] && color[2][1] != color[3][3])\nproduct2b = Q_INTERPOLATE(color[2][1], color[2][1], color[2][1], color[2][2]);", "else\nproduct2b = INTERPOLATE(color[2][1], color[2][2]);", "if (color[1][2] == color[2][2] && color[1][2] == color[0][1] && color[1][1] != color[0][2] && color[1][2] != color[0][0])\nproduct1b = Q_INTERPOLATE(color[1][2], color[1][2], color[1][2], color[1][1]);", "else if (color[1][1] == color[2][1] && color[1][1] == color[0][2] && color[0][1] != color[1][2] && color[1][1] != color[0][3])\nproduct1b = Q_INTERPOLATE(color[1][2], color[1][1], color[1][1], color[1][1]);", "else\nproduct1b = INTERPOLATE(color[1][1], color[1][2]);", "}", "if (color[1][1] == color[2][2] && color[2][1] != color[1][2] && color[1][0] == color[1][1] && color[1][1] != color[3][2])\nproduct2a = INTERPOLATE(color[2][1], color[1][1]);", "else if (color[1][1] == color[2][0] && color[1][2] == color[1][1] && color[1][0] != color[2][1] && color[1][1] != color[3][0])\nproduct2a = INTERPOLATE(color[2][1], color[1][1]);", "else\nproduct2a = color[2][1];", "if (color[2][1] == color[1][2] && color[1][1] != color[2][2] && color[2][0] == color[2][1] && color[2][1] != color[0][2])\nproduct1a = INTERPOLATE(color[2][1], color[1][1]);", "else if (color[1][0] == color[2][1] && color[2][2] == color[2][1] && color[2][0] != color[1][1] && color[2][1] != color[0][0])\nproduct1a = INTERPOLATE(color[2][1], color[1][1]);", "else\nproduct1a = color[1][1];", "switch (VAR_10) {", "case 4:\nAV_WN32A(dst_line[0] + VAR_7 * 8, product1a);", "AV_WN32A(dst_line[0] + VAR_7 * 8 + 4, product1b);", "AV_WN32A(dst_line[1] + VAR_7 * 8, product2a);", "AV_WN32A(dst_line[1] + VAR_7 * 8 + 4, product2b);", "break;", "case 3:\nAV_WL24(dst_line[0] + VAR_7 * 6, product1a);", "AV_WL24(dst_line[0] + VAR_7 * 6 + 3, product1b);", "AV_WL24(dst_line[1] + VAR_7 * 6, product2a);", "AV_WL24(dst_line[1] + VAR_7 * 6 + 3, product2b);", "break;", "default:\nAV_WN32A(dst_line[0] + VAR_7 * 4, product1a | (product1b << 16));", "AV_WN32A(dst_line[1] + VAR_7 * 4, product2a | (product2b << 16));", "}", "color[0][0] = color[0][1]; color[0][1] = color[0][2]; color[0][2] = color[0][3];", "color[1][0] = color[1][1]; color[1][1] = color[1][2]; color[1][2] = color[1][3];", "color[2][0] = color[2][1]; color[2][1] = color[2][2]; color[2][2] = color[2][3];", "color[3][0] = color[3][1]; color[3][1] = color[3][2]; color[3][2] = color[3][3];", "if (VAR_7 < VAR_5 - 3) {", "VAR_7 += 3;", "switch (VAR_10) {", "case 4:\nREAD_COLOR4(color[0][3], VAR_9[0], VAR_7);", "READ_COLOR4(color[1][3], VAR_9[1], VAR_7);", "READ_COLOR4(color[2][3], VAR_9[2], VAR_7);", "READ_COLOR4(color[3][3], VAR_9[3], VAR_7);", "break;", "case 3:\nREAD_COLOR3(color[0][3], VAR_9[0], VAR_7);", "READ_COLOR3(color[1][3], VAR_9[1], VAR_7);", "READ_COLOR3(color[2][3], VAR_9[2], VAR_7);", "READ_COLOR3(color[3][3], VAR_9[3], VAR_7);", "break;", "default:\nREAD_COLOR2(color[0][3], VAR_9[0], VAR_7);", "READ_COLOR2(color[1][3], VAR_9[1], VAR_7);", "READ_COLOR2(color[2][3], VAR_9[2], VAR_7);", "READ_COLOR2(color[3][3], VAR_9[3], VAR_7);", "}", "VAR_7 -= 3;", "}", "}", "VAR_9[0] = VAR_9[1];", "VAR_9[1] = VAR_9[2];", "VAR_9[2] = VAR_9[3];", "VAR_9[3] = VAR_9[2];", "if (VAR_8 < VAR_6 - 3)\nVAR_9[3] += VAR_2;", "switch (VAR_10) {", "case 4:\nREAD_COLOR4(color[0][0], VAR_9[0], 0); color[0][1] = color[0][0]; READ_COLOR4(color[0][2], VAR_9[0], 1); READ_COLOR4(color[0][3], VAR_9[0], 2);", "READ_COLOR4(color[1][0], VAR_9[1], 0); color[1][1] = color[1][0]; READ_COLOR4(color[1][2], VAR_9[1], 1); READ_COLOR4(color[1][3], VAR_9[1], 2);", "READ_COLOR4(color[2][0], VAR_9[2], 0); color[2][1] = color[2][0]; READ_COLOR4(color[2][2], VAR_9[2], 1); READ_COLOR4(color[2][3], VAR_9[2], 2);", "READ_COLOR4(color[3][0], VAR_9[3], 0); color[3][1] = color[3][0]; READ_COLOR4(color[3][2], VAR_9[3], 1); READ_COLOR4(color[3][3], VAR_9[3], 2);", "break;", "case 3:\nREAD_COLOR3(color[0][0], VAR_9[0], 0); color[0][1] = color[0][0]; READ_COLOR3(color[0][2], VAR_9[0], 1); READ_COLOR3(color[0][3], VAR_9[0], 2);", "READ_COLOR3(color[1][0], VAR_9[1], 0); color[1][1] = color[1][0]; READ_COLOR3(color[1][2], VAR_9[1], 1); READ_COLOR3(color[1][3], VAR_9[1], 2);", "READ_COLOR3(color[2][0], VAR_9[2], 0); color[2][1] = color[2][0]; READ_COLOR3(color[2][2], VAR_9[2], 1); READ_COLOR3(color[2][3], VAR_9[2], 2);", "READ_COLOR3(color[3][0], VAR_9[3], 0); color[3][1] = color[3][0]; READ_COLOR3(color[3][2], VAR_9[3], 1); READ_COLOR3(color[3][3], VAR_9[3], 2);", "break;", "default:\nREAD_COLOR2(color[0][0], VAR_9[0], 0); color[0][1] = color[0][0]; READ_COLOR2(color[0][2], VAR_9[0], 1); READ_COLOR2(color[0][3], VAR_9[0], 2);", "READ_COLOR2(color[1][0], VAR_9[1], 0); color[1][1] = color[1][0]; READ_COLOR2(color[1][2], VAR_9[1], 1); READ_COLOR2(color[1][3], VAR_9[1], 2);", "READ_COLOR2(color[2][0], VAR_9[2], 0); color[2][1] = color[2][0]; READ_COLOR2(color[2][2], VAR_9[2], 1); READ_COLOR2(color[2][3], VAR_9[2], 2);", "READ_COLOR2(color[3][0], VAR_9[3], 0); color[3][1] = color[3][0]; READ_COLOR2(color[3][2], VAR_9[3], 1); READ_COLOR2(color[3][3], VAR_9[3], 2);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45, 47, 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149, 151 ], [ 153, 155 ], [ 157, 159 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171, 173 ], [ 175, 177 ], [ 181, 183 ], [ 185, 187 ], [ 189, 191 ], [ 193 ], [ 197, 199 ], [ 201, 203 ], [ 205, 207 ], [ 211, 213 ], [ 215, 217 ], [ 219, 221 ], [ 227 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241, 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 275 ], [ 277 ], [ 279 ], [ 281, 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293, 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305, 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 327 ], [ 329 ], [ 331 ], [ 337 ], [ 339, 341 ], [ 345 ], [ 347, 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359, 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371, 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ] ]
11,537
static inline int pic_is_unused(MpegEncContext *s, Picture *pic) { if (pic->f->buf[0] == NULL) return 1; if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF)) return 1; return 0; }
false
FFmpeg
f929ab0569ff31ed5a59b0b0adb7ce09df3fca39
static inline int pic_is_unused(MpegEncContext *s, Picture *pic) { if (pic->f->buf[0] == NULL) return 1; if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF)) return 1; return 0; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(MpegEncContext *VAR_0, Picture *VAR_1) { if (VAR_1->f->buf[0] == NULL) return 1; if (VAR_1->needs_realloc && !(VAR_1->reference & DELAYED_PIC_REF)) return 1; return 0; }
[ "static inline int FUNC_0(MpegEncContext *VAR_0, Picture *VAR_1)\n{", "if (VAR_1->f->buf[0] == NULL)\nreturn 1;", "if (VAR_1->needs_realloc && !(VAR_1->reference & DELAYED_PIC_REF))\nreturn 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ] ]
11,538
static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb, void *dst, const int type) { int i, j, count = 0; int last, t; int A, S, T; int pos = s->pos; uint32_t crc = s->sc.crc; uint32_t crc_extra_bits = s->extra_sc.crc; int16_t *dst16 = dst; int32_t *dst32 = dst; float *dstfl = dst; s->one = s->zero = s->zeroes = 0; do { T = wv_get_value(s, gb, 0, &last); S = 0; if (last) break; for (i = 0; i < s->terms; i++) { t = s->decorr[i].value; if (t > 8) { if (t & 1) A = 2 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]; else A = (3 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]) >> 1; s->decorr[i].samplesA[1] = s->decorr[i].samplesA[0]; j = 0; } else { A = s->decorr[i].samplesA[pos]; j = (pos + t) & 7; if (type != AV_SAMPLE_FMT_S16P) S = T + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10); else S = T + ((s->decorr[i].weightA * A + 512) >> 10); if (A && T) s->decorr[i].weightA -= ((((T ^ A) >> 30) & 2) - 1) * s->decorr[i].delta; s->decorr[i].samplesA[j] = T = S; pos = (pos + 1) & 7; crc = crc * 3 + S; if (type == AV_SAMPLE_FMT_FLTP) { *dstfl++ = wv_get_value_float(s, &crc_extra_bits, S); } else if (type == AV_SAMPLE_FMT_S32P) { *dst32++ = wv_get_value_integer(s, &crc_extra_bits, S); } else { *dst16++ = wv_get_value_integer(s, &crc_extra_bits, S); count++; } while (!last && count < s->samples); wv_reset_saved_context(s); if (s->avctx->err_recognition & AV_EF_CRCCHECK) { int ret = wv_check_crc(s, crc, crc_extra_bits); if (ret < 0 && s->avctx->err_recognition & AV_EF_EXPLODE) return ret; return 0;
true
FFmpeg
866c44d4b0f90d448cffbe9d4422a2dec7df698b
static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb, void *dst, const int type) { int i, j, count = 0; int last, t; int A, S, T; int pos = s->pos; uint32_t crc = s->sc.crc; uint32_t crc_extra_bits = s->extra_sc.crc; int16_t *dst16 = dst; int32_t *dst32 = dst; float *dstfl = dst; s->one = s->zero = s->zeroes = 0; do { T = wv_get_value(s, gb, 0, &last); S = 0; if (last) break; for (i = 0; i < s->terms; i++) { t = s->decorr[i].value; if (t > 8) { if (t & 1) A = 2 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]; else A = (3 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]) >> 1; s->decorr[i].samplesA[1] = s->decorr[i].samplesA[0]; j = 0; } else { A = s->decorr[i].samplesA[pos]; j = (pos + t) & 7; if (type != AV_SAMPLE_FMT_S16P) S = T + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10); else S = T + ((s->decorr[i].weightA * A + 512) >> 10); if (A && T) s->decorr[i].weightA -= ((((T ^ A) >> 30) & 2) - 1) * s->decorr[i].delta; s->decorr[i].samplesA[j] = T = S; pos = (pos + 1) & 7; crc = crc * 3 + S; if (type == AV_SAMPLE_FMT_FLTP) { *dstfl++ = wv_get_value_float(s, &crc_extra_bits, S); } else if (type == AV_SAMPLE_FMT_S32P) { *dst32++ = wv_get_value_integer(s, &crc_extra_bits, S); } else { *dst16++ = wv_get_value_integer(s, &crc_extra_bits, S); count++; } while (!last && count < s->samples); wv_reset_saved_context(s); if (s->avctx->err_recognition & AV_EF_CRCCHECK) { int ret = wv_check_crc(s, crc, crc_extra_bits); if (ret < 0 && s->avctx->err_recognition & AV_EF_EXPLODE) return ret; return 0;
{ "code": [], "line_no": [] }
static inline int FUNC_0(WavpackFrameContext *VAR_0, GetBitContext *VAR_1, void *VAR_2, const int VAR_3) { int VAR_4, VAR_5, VAR_6 = 0; int VAR_7, VAR_8; int VAR_9, VAR_10, VAR_11; int VAR_12 = VAR_0->VAR_12; uint32_t crc = VAR_0->sc.crc; uint32_t crc_extra_bits = VAR_0->extra_sc.crc; int16_t *dst16 = VAR_2; int32_t *dst32 = VAR_2; float *VAR_13 = VAR_2; VAR_0->one = VAR_0->zero = VAR_0->zeroes = 0; do { VAR_11 = wv_get_value(VAR_0, VAR_1, 0, &VAR_7); VAR_10 = 0; if (VAR_7) break; for (VAR_4 = 0; VAR_4 < VAR_0->terms; VAR_4++) { VAR_8 = VAR_0->decorr[VAR_4].value; if (VAR_8 > 8) { if (VAR_8 & 1) VAR_9 = 2 * VAR_0->decorr[VAR_4].samplesA[0] - VAR_0->decorr[VAR_4].samplesA[1]; else VAR_9 = (3 * VAR_0->decorr[VAR_4].samplesA[0] - VAR_0->decorr[VAR_4].samplesA[1]) >> 1; VAR_0->decorr[VAR_4].samplesA[1] = VAR_0->decorr[VAR_4].samplesA[0]; VAR_5 = 0; } else { VAR_9 = VAR_0->decorr[VAR_4].samplesA[VAR_12]; VAR_5 = (VAR_12 + VAR_8) & 7; if (VAR_3 != AV_SAMPLE_FMT_S16P) VAR_10 = VAR_11 + ((VAR_0->decorr[VAR_4].weightA * (int64_t)VAR_9 + 512) >> 10); else VAR_10 = VAR_11 + ((VAR_0->decorr[VAR_4].weightA * VAR_9 + 512) >> 10); if (VAR_9 && VAR_11) VAR_0->decorr[VAR_4].weightA -= ((((VAR_11 ^ VAR_9) >> 30) & 2) - 1) * VAR_0->decorr[VAR_4].delta; VAR_0->decorr[VAR_4].samplesA[VAR_5] = VAR_11 = VAR_10; VAR_12 = (VAR_12 + 1) & 7; crc = crc * 3 + VAR_10; if (VAR_3 == AV_SAMPLE_FMT_FLTP) { *VAR_13++ = wv_get_value_float(VAR_0, &crc_extra_bits, VAR_10); } else if (VAR_3 == AV_SAMPLE_FMT_S32P) { *dst32++ = wv_get_value_integer(VAR_0, &crc_extra_bits, VAR_10); } else { *dst16++ = wv_get_value_integer(VAR_0, &crc_extra_bits, VAR_10); VAR_6++; } while (!VAR_7 && VAR_6 < VAR_0->samples); wv_reset_saved_context(VAR_0); if (VAR_0->avctx->err_recognition & AV_EF_CRCCHECK) { int ret = wv_check_crc(VAR_0, crc, crc_extra_bits); if (ret < 0 && VAR_0->avctx->err_recognition & AV_EF_EXPLODE) return ret; return 0;
[ "static inline int FUNC_0(WavpackFrameContext *VAR_0, GetBitContext *VAR_1,\nvoid *VAR_2, const int VAR_3)\n{", "int VAR_4, VAR_5, VAR_6 = 0;", "int VAR_7, VAR_8;", "int VAR_9, VAR_10, VAR_11;", "int VAR_12 = VAR_0->VAR_12;", "uint32_t crc = VAR_0->sc.crc;", "uint32_t crc_extra_bits = VAR_0->extra_sc.crc;", "int16_t *dst16 = VAR_2;", "int32_t *dst32 = VAR_2;", "float *VAR_13 = VAR_2;", "VAR_0->one = VAR_0->zero = VAR_0->zeroes = 0;", "do {", "VAR_11 = wv_get_value(VAR_0, VAR_1, 0, &VAR_7);", "VAR_10 = 0;", "if (VAR_7)\nbreak;", "for (VAR_4 = 0; VAR_4 < VAR_0->terms; VAR_4++) {", "VAR_8 = VAR_0->decorr[VAR_4].value;", "if (VAR_8 > 8) {", "if (VAR_8 & 1)\nVAR_9 = 2 * VAR_0->decorr[VAR_4].samplesA[0] - VAR_0->decorr[VAR_4].samplesA[1];", "else\nVAR_9 = (3 * VAR_0->decorr[VAR_4].samplesA[0] - VAR_0->decorr[VAR_4].samplesA[1]) >> 1;", "VAR_0->decorr[VAR_4].samplesA[1] = VAR_0->decorr[VAR_4].samplesA[0];", "VAR_5 = 0;", "} else {", "VAR_9 = VAR_0->decorr[VAR_4].samplesA[VAR_12];", "VAR_5 = (VAR_12 + VAR_8) & 7;", "if (VAR_3 != AV_SAMPLE_FMT_S16P)\nVAR_10 = VAR_11 + ((VAR_0->decorr[VAR_4].weightA * (int64_t)VAR_9 + 512) >> 10);", "else\nVAR_10 = VAR_11 + ((VAR_0->decorr[VAR_4].weightA * VAR_9 + 512) >> 10);", "if (VAR_9 && VAR_11)\nVAR_0->decorr[VAR_4].weightA -= ((((VAR_11 ^ VAR_9) >> 30) & 2) - 1) * VAR_0->decorr[VAR_4].delta;", "VAR_0->decorr[VAR_4].samplesA[VAR_5] = VAR_11 = VAR_10;", "VAR_12 = (VAR_12 + 1) & 7;", "crc = crc * 3 + VAR_10;", "if (VAR_3 == AV_SAMPLE_FMT_FLTP) {", "*VAR_13++ = wv_get_value_float(VAR_0, &crc_extra_bits, VAR_10);", "} else if (VAR_3 == AV_SAMPLE_FMT_S32P) {", "*dst32++ = wv_get_value_integer(VAR_0, &crc_extra_bits, VAR_10);", "} else {", "*dst16++ = wv_get_value_integer(VAR_0, &crc_extra_bits, VAR_10);", "VAR_6++;", "} while (!VAR_7 && VAR_6 < VAR_0->samples);", "wv_reset_saved_context(VAR_0);", "if (VAR_0->avctx->err_recognition & AV_EF_CRCCHECK) {", "int ret = wv_check_crc(VAR_0, crc, crc_extra_bits);", "if (ret < 0 && VAR_0->avctx->err_recognition & AV_EF_EXPLODE)\nreturn ret;", "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 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17, 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22, 23 ], [ 24, 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31, 32 ], [ 33, 34 ], [ 35, 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51, 52 ], [ 53 ] ]
11,539
void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC, enum cavs_mv_pred mode, enum cavs_block size, int ref) { cavs_vector *mvP = &h->mv[nP]; cavs_vector *mvA = &h->mv[nP-1]; cavs_vector *mvB = &h->mv[nP-4]; cavs_vector *mvC = &h->mv[nC]; const cavs_vector *mvP2 = NULL; mvP->ref = ref; mvP->dist = h->dist[mvP->ref]; if (mvC->ref == NOT_AVAIL || (nP == MV_FWD_X3) || (nP == MV_BWD_X3 )) mvC = &h->mv[nP - 5]; // set to top-left (mvD) if (mode == MV_PRED_PSKIP && (mvA->ref == NOT_AVAIL || mvB->ref == NOT_AVAIL || (mvA->x | mvA->y | mvA->ref) == 0 || (mvB->x | mvB->y | mvB->ref) == 0)) { mvP2 = &un_mv; /* if there is only one suitable candidate, take it */ } else if (mvA->ref >= 0 && mvB->ref < 0 && mvC->ref < 0) { mvP2 = mvA; } else if (mvA->ref < 0 && mvB->ref >= 0 && mvC->ref < 0) { mvP2 = mvB; } else if (mvA->ref < 0 && mvB->ref < 0 && mvC->ref >= 0) { mvP2 = mvC; } else if (mode == MV_PRED_LEFT && mvA->ref == ref) { mvP2 = mvA; } else if (mode == MV_PRED_TOP && mvB->ref == ref) { mvP2 = mvB; } else if (mode == MV_PRED_TOPRIGHT && mvC->ref == ref) { mvP2 = mvC; } if (mvP2) { mvP->x = mvP2->x; mvP->y = mvP2->y; } else mv_pred_median(h, mvP, mvA, mvB, mvC); if (mode < MV_PRED_PSKIP) { mvP->x += get_se_golomb(&h->gb); mvP->y += get_se_golomb(&h->gb); } set_mvs(mvP, size); }
true
FFmpeg
5871adc90f8c1037535563e33ebeaf032bb4d5d6
void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC, enum cavs_mv_pred mode, enum cavs_block size, int ref) { cavs_vector *mvP = &h->mv[nP]; cavs_vector *mvA = &h->mv[nP-1]; cavs_vector *mvB = &h->mv[nP-4]; cavs_vector *mvC = &h->mv[nC]; const cavs_vector *mvP2 = NULL; mvP->ref = ref; mvP->dist = h->dist[mvP->ref]; if (mvC->ref == NOT_AVAIL || (nP == MV_FWD_X3) || (nP == MV_BWD_X3 )) mvC = &h->mv[nP - 5]; if (mode == MV_PRED_PSKIP && (mvA->ref == NOT_AVAIL || mvB->ref == NOT_AVAIL || (mvA->x | mvA->y | mvA->ref) == 0 || (mvB->x | mvB->y | mvB->ref) == 0)) { mvP2 = &un_mv; } else if (mvA->ref >= 0 && mvB->ref < 0 && mvC->ref < 0) { mvP2 = mvA; } else if (mvA->ref < 0 && mvB->ref >= 0 && mvC->ref < 0) { mvP2 = mvB; } else if (mvA->ref < 0 && mvB->ref < 0 && mvC->ref >= 0) { mvP2 = mvC; } else if (mode == MV_PRED_LEFT && mvA->ref == ref) { mvP2 = mvA; } else if (mode == MV_PRED_TOP && mvB->ref == ref) { mvP2 = mvB; } else if (mode == MV_PRED_TOPRIGHT && mvC->ref == ref) { mvP2 = mvC; } if (mvP2) { mvP->x = mvP2->x; mvP->y = mvP2->y; } else mv_pred_median(h, mvP, mvA, mvB, mvC); if (mode < MV_PRED_PSKIP) { mvP->x += get_se_golomb(&h->gb); mvP->y += get_se_golomb(&h->gb); } set_mvs(mvP, size); }
{ "code": [ " mvP->x += get_se_golomb(&h->gb);", " mvP->y += get_se_golomb(&h->gb);" ], "line_no": [ 81, 83 ] }
void FUNC_0(AVSContext *VAR_0, enum cavs_mv_loc VAR_1, enum cavs_mv_loc VAR_2, enum cavs_mv_pred VAR_3, enum cavs_block VAR_4, int VAR_5) { cavs_vector *mvP = &VAR_0->mv[VAR_1]; cavs_vector *mvA = &VAR_0->mv[VAR_1-1]; cavs_vector *mvB = &VAR_0->mv[VAR_1-4]; cavs_vector *mvC = &VAR_0->mv[VAR_2]; const cavs_vector *VAR_6 = NULL; mvP->VAR_5 = VAR_5; mvP->dist = VAR_0->dist[mvP->VAR_5]; if (mvC->VAR_5 == NOT_AVAIL || (VAR_1 == MV_FWD_X3) || (VAR_1 == MV_BWD_X3 )) mvC = &VAR_0->mv[VAR_1 - 5]; if (VAR_3 == MV_PRED_PSKIP && (mvA->VAR_5 == NOT_AVAIL || mvB->VAR_5 == NOT_AVAIL || (mvA->x | mvA->y | mvA->VAR_5) == 0 || (mvB->x | mvB->y | mvB->VAR_5) == 0)) { VAR_6 = &un_mv; } else if (mvA->VAR_5 >= 0 && mvB->VAR_5 < 0 && mvC->VAR_5 < 0) { VAR_6 = mvA; } else if (mvA->VAR_5 < 0 && mvB->VAR_5 >= 0 && mvC->VAR_5 < 0) { VAR_6 = mvB; } else if (mvA->VAR_5 < 0 && mvB->VAR_5 < 0 && mvC->VAR_5 >= 0) { VAR_6 = mvC; } else if (VAR_3 == MV_PRED_LEFT && mvA->VAR_5 == VAR_5) { VAR_6 = mvA; } else if (VAR_3 == MV_PRED_TOP && mvB->VAR_5 == VAR_5) { VAR_6 = mvB; } else if (VAR_3 == MV_PRED_TOPRIGHT && mvC->VAR_5 == VAR_5) { VAR_6 = mvC; } if (VAR_6) { mvP->x = VAR_6->x; mvP->y = VAR_6->y; } else mv_pred_median(VAR_0, mvP, mvA, mvB, mvC); if (VAR_3 < MV_PRED_PSKIP) { mvP->x += get_se_golomb(&VAR_0->gb); mvP->y += get_se_golomb(&VAR_0->gb); } set_mvs(mvP, VAR_4); }
[ "void FUNC_0(AVSContext *VAR_0, enum cavs_mv_loc VAR_1, enum cavs_mv_loc VAR_2,\nenum cavs_mv_pred VAR_3, enum cavs_block VAR_4, int VAR_5)\n{", "cavs_vector *mvP = &VAR_0->mv[VAR_1];", "cavs_vector *mvA = &VAR_0->mv[VAR_1-1];", "cavs_vector *mvB = &VAR_0->mv[VAR_1-4];", "cavs_vector *mvC = &VAR_0->mv[VAR_2];", "const cavs_vector *VAR_6 = NULL;", "mvP->VAR_5 = VAR_5;", "mvP->dist = VAR_0->dist[mvP->VAR_5];", "if (mvC->VAR_5 == NOT_AVAIL || (VAR_1 == MV_FWD_X3) || (VAR_1 == MV_BWD_X3 ))\nmvC = &VAR_0->mv[VAR_1 - 5];", "if (VAR_3 == MV_PRED_PSKIP &&\n(mvA->VAR_5 == NOT_AVAIL ||\nmvB->VAR_5 == NOT_AVAIL ||\n(mvA->x | mvA->y | mvA->VAR_5) == 0 ||\n(mvB->x | mvB->y | mvB->VAR_5) == 0)) {", "VAR_6 = &un_mv;", "} else if (mvA->VAR_5 >= 0 && mvB->VAR_5 < 0 && mvC->VAR_5 < 0) {", "VAR_6 = mvA;", "} else if (mvA->VAR_5 < 0 && mvB->VAR_5 >= 0 && mvC->VAR_5 < 0) {", "VAR_6 = mvB;", "} else if (mvA->VAR_5 < 0 && mvB->VAR_5 < 0 && mvC->VAR_5 >= 0) {", "VAR_6 = mvC;", "} else if (VAR_3 == MV_PRED_LEFT && mvA->VAR_5 == VAR_5) {", "VAR_6 = mvA;", "} else if (VAR_3 == MV_PRED_TOP && mvB->VAR_5 == VAR_5) {", "VAR_6 = mvB;", "} else if (VAR_3 == MV_PRED_TOPRIGHT && mvC->VAR_5 == VAR_5) {", "VAR_6 = mvC;", "}", "if (VAR_6) {", "mvP->x = VAR_6->x;", "mvP->y = VAR_6->y;", "} else", "mv_pred_median(VAR_0, mvP, mvA, mvB, mvC);", "if (VAR_3 < MV_PRED_PSKIP) {", "mvP->x += get_se_golomb(&VAR_0->gb);", "mvP->y += get_se_golomb(&VAR_0->gb);", "}", "set_mvs(mvP, 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, 1, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27, 29, 31, 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ] ]
11,540
static int usbredir_handle_iso_data(USBRedirDevice *dev, USBPacket *p, uint8_t ep) { int status, len; if (!dev->endpoint[EP2I(ep)].iso_started && !dev->endpoint[EP2I(ep)].iso_error) { struct usb_redir_start_iso_stream_header start_iso = { .endpoint = ep, /* TODO maybe do something with these depending on ep interval? */ .pkts_per_urb = 32, .no_urbs = 3, }; /* No id, we look at the ep when receiving a status back */ usbredirparser_send_start_iso_stream(dev->parser, 0, &start_iso); usbredirparser_do_write(dev->parser); DPRINTF("iso stream started ep %02X\n", ep); dev->endpoint[EP2I(ep)].iso_started = 1; } if (ep & USB_DIR_IN) { struct buf_packet *isop; isop = QTAILQ_FIRST(&dev->endpoint[EP2I(ep)].bufpq); if (isop == NULL) { DPRINTF2("iso-token-in ep %02X, no isop\n", ep); /* Check iso_error for stream errors, otherwise its an underrun */ status = dev->endpoint[EP2I(ep)].iso_error; dev->endpoint[EP2I(ep)].iso_error = 0; return usbredir_handle_status(dev, status, 0); } DPRINTF2("iso-token-in ep %02X status %d len %d\n", ep, isop->status, isop->len); status = isop->status; if (status != usb_redir_success) { bufp_free(dev, isop, ep); return usbredir_handle_status(dev, status, 0); } len = isop->len; if (len > p->len) { ERROR("received iso data is larger then packet ep %02X\n", ep); bufp_free(dev, isop, ep); return USB_RET_NAK; } memcpy(p->data, isop->data, len); bufp_free(dev, isop, ep); return len; } else { /* If the stream was not started because of a pending error don't send the packet to the usb-host */ if (dev->endpoint[EP2I(ep)].iso_started) { struct usb_redir_iso_packet_header iso_packet = { .endpoint = ep, .length = p->len }; /* No id, we look at the ep when receiving a status back */ usbredirparser_send_iso_packet(dev->parser, 0, &iso_packet, p->data, p->len); usbredirparser_do_write(dev->parser); } status = dev->endpoint[EP2I(ep)].iso_error; dev->endpoint[EP2I(ep)].iso_error = 0; DPRINTF2("iso-token-out ep %02X status %d len %d\n", ep, status, p->len); return usbredir_handle_status(dev, status, p->len); } }
true
qemu
4f4321c11ff6e98583846bfd6f0e81954924b003
static int usbredir_handle_iso_data(USBRedirDevice *dev, USBPacket *p, uint8_t ep) { int status, len; if (!dev->endpoint[EP2I(ep)].iso_started && !dev->endpoint[EP2I(ep)].iso_error) { struct usb_redir_start_iso_stream_header start_iso = { .endpoint = ep, .pkts_per_urb = 32, .no_urbs = 3, }; usbredirparser_send_start_iso_stream(dev->parser, 0, &start_iso); usbredirparser_do_write(dev->parser); DPRINTF("iso stream started ep %02X\n", ep); dev->endpoint[EP2I(ep)].iso_started = 1; } if (ep & USB_DIR_IN) { struct buf_packet *isop; isop = QTAILQ_FIRST(&dev->endpoint[EP2I(ep)].bufpq); if (isop == NULL) { DPRINTF2("iso-token-in ep %02X, no isop\n", ep); status = dev->endpoint[EP2I(ep)].iso_error; dev->endpoint[EP2I(ep)].iso_error = 0; return usbredir_handle_status(dev, status, 0); } DPRINTF2("iso-token-in ep %02X status %d len %d\n", ep, isop->status, isop->len); status = isop->status; if (status != usb_redir_success) { bufp_free(dev, isop, ep); return usbredir_handle_status(dev, status, 0); } len = isop->len; if (len > p->len) { ERROR("received iso data is larger then packet ep %02X\n", ep); bufp_free(dev, isop, ep); return USB_RET_NAK; } memcpy(p->data, isop->data, len); bufp_free(dev, isop, ep); return len; } else { if (dev->endpoint[EP2I(ep)].iso_started) { struct usb_redir_iso_packet_header iso_packet = { .endpoint = ep, .length = p->len }; usbredirparser_send_iso_packet(dev->parser, 0, &iso_packet, p->data, p->len); usbredirparser_do_write(dev->parser); } status = dev->endpoint[EP2I(ep)].iso_error; dev->endpoint[EP2I(ep)].iso_error = 0; DPRINTF2("iso-token-out ep %02X status %d len %d\n", ep, status, p->len); return usbredir_handle_status(dev, status, p->len); } }
{ "code": [ " if (len > p->len) {", " memcpy(p->data, isop->data, len);", " .length = p->len", " p->data, p->len);", " DPRINTF2(\"iso-token-out ep %02X status %d len %d\\n\", ep, status,", " p->len);", " return usbredir_handle_status(dev, status, p->len);", " if (len > p->len) {" ], "line_no": [ 83, 93, 111, 119, 129, 131, 133, 83 ] }
static int FUNC_0(USBRedirDevice *VAR_0, USBPacket *VAR_1, uint8_t VAR_2) { int VAR_3, VAR_4; if (!VAR_0->endpoint[EP2I(VAR_2)].iso_started && !VAR_0->endpoint[EP2I(VAR_2)].iso_error) { struct usb_redir_start_iso_stream_header VAR_5 = { .endpoint = VAR_2, .pkts_per_urb = 32, .no_urbs = 3, }; usbredirparser_send_start_iso_stream(VAR_0->parser, 0, &VAR_5); usbredirparser_do_write(VAR_0->parser); DPRINTF("iso stream started VAR_2 %02X\n", VAR_2); VAR_0->endpoint[EP2I(VAR_2)].iso_started = 1; } if (VAR_2 & USB_DIR_IN) { struct buf_packet *VAR_6; VAR_6 = QTAILQ_FIRST(&VAR_0->endpoint[EP2I(VAR_2)].bufpq); if (VAR_6 == NULL) { DPRINTF2("iso-token-in VAR_2 %02X, no VAR_6\n", VAR_2); VAR_3 = VAR_0->endpoint[EP2I(VAR_2)].iso_error; VAR_0->endpoint[EP2I(VAR_2)].iso_error = 0; return usbredir_handle_status(VAR_0, VAR_3, 0); } DPRINTF2("iso-token-in VAR_2 %02X VAR_3 %d VAR_4 %d\n", VAR_2, VAR_6->VAR_3, VAR_6->VAR_4); VAR_3 = VAR_6->VAR_3; if (VAR_3 != usb_redir_success) { bufp_free(VAR_0, VAR_6, VAR_2); return usbredir_handle_status(VAR_0, VAR_3, 0); } VAR_4 = VAR_6->VAR_4; if (VAR_4 > VAR_1->VAR_4) { ERROR("received iso data is larger then packet VAR_2 %02X\n", VAR_2); bufp_free(VAR_0, VAR_6, VAR_2); return USB_RET_NAK; } memcpy(VAR_1->data, VAR_6->data, VAR_4); bufp_free(VAR_0, VAR_6, VAR_2); return VAR_4; } else { if (VAR_0->endpoint[EP2I(VAR_2)].iso_started) { struct usb_redir_iso_packet_header VAR_7 = { .endpoint = VAR_2, .length = VAR_1->VAR_4 }; usbredirparser_send_iso_packet(VAR_0->parser, 0, &VAR_7, VAR_1->data, VAR_1->VAR_4); usbredirparser_do_write(VAR_0->parser); } VAR_3 = VAR_0->endpoint[EP2I(VAR_2)].iso_error; VAR_0->endpoint[EP2I(VAR_2)].iso_error = 0; DPRINTF2("iso-token-out VAR_2 %02X VAR_3 %d VAR_4 %d\n", VAR_2, VAR_3, VAR_1->VAR_4); return usbredir_handle_status(VAR_0, VAR_3, VAR_1->VAR_4); } }
[ "static int FUNC_0(USBRedirDevice *VAR_0, USBPacket *VAR_1,\nuint8_t VAR_2)\n{", "int VAR_3, VAR_4;", "if (!VAR_0->endpoint[EP2I(VAR_2)].iso_started &&\n!VAR_0->endpoint[EP2I(VAR_2)].iso_error) {", "struct usb_redir_start_iso_stream_header VAR_5 = {", ".endpoint = VAR_2,\n.pkts_per_urb = 32,\n.no_urbs = 3,\n};", "usbredirparser_send_start_iso_stream(VAR_0->parser, 0, &VAR_5);", "usbredirparser_do_write(VAR_0->parser);", "DPRINTF(\"iso stream started VAR_2 %02X\\n\", VAR_2);", "VAR_0->endpoint[EP2I(VAR_2)].iso_started = 1;", "}", "if (VAR_2 & USB_DIR_IN) {", "struct buf_packet *VAR_6;", "VAR_6 = QTAILQ_FIRST(&VAR_0->endpoint[EP2I(VAR_2)].bufpq);", "if (VAR_6 == NULL) {", "DPRINTF2(\"iso-token-in VAR_2 %02X, no VAR_6\\n\", VAR_2);", "VAR_3 = VAR_0->endpoint[EP2I(VAR_2)].iso_error;", "VAR_0->endpoint[EP2I(VAR_2)].iso_error = 0;", "return usbredir_handle_status(VAR_0, VAR_3, 0);", "}", "DPRINTF2(\"iso-token-in VAR_2 %02X VAR_3 %d VAR_4 %d\\n\", VAR_2, VAR_6->VAR_3,\nVAR_6->VAR_4);", "VAR_3 = VAR_6->VAR_3;", "if (VAR_3 != usb_redir_success) {", "bufp_free(VAR_0, VAR_6, VAR_2);", "return usbredir_handle_status(VAR_0, VAR_3, 0);", "}", "VAR_4 = VAR_6->VAR_4;", "if (VAR_4 > VAR_1->VAR_4) {", "ERROR(\"received iso data is larger then packet VAR_2 %02X\\n\", VAR_2);", "bufp_free(VAR_0, VAR_6, VAR_2);", "return USB_RET_NAK;", "}", "memcpy(VAR_1->data, VAR_6->data, VAR_4);", "bufp_free(VAR_0, VAR_6, VAR_2);", "return VAR_4;", "} else {", "if (VAR_0->endpoint[EP2I(VAR_2)].iso_started) {", "struct usb_redir_iso_packet_header VAR_7 = {", ".endpoint = VAR_2,\n.length = VAR_1->VAR_4\n};", "usbredirparser_send_iso_packet(VAR_0->parser, 0, &VAR_7,\nVAR_1->data, VAR_1->VAR_4);", "usbredirparser_do_write(VAR_0->parser);", "}", "VAR_3 = VAR_0->endpoint[EP2I(VAR_2)].iso_error;", "VAR_0->endpoint[EP2I(VAR_2)].iso_error = 0;", "DPRINTF2(\"iso-token-out VAR_2 %02X VAR_3 %d VAR_4 %d\\n\", VAR_2, VAR_3,\nVAR_1->VAR_4);", "return usbredir_handle_status(VAR_0, VAR_3, VAR_1->VAR_4);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17, 21, 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 105 ], [ 107 ], [ 109, 111, 113 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ] ]
11,541
static inline void vmsvga_check_size(struct vmsvga_state_s *s) { DisplaySurface *surface = qemu_console_surface(s->vga.con); if (s->new_width != surface_width(surface) || s->new_height != surface_height(surface)) { qemu_console_resize(s->vga.con, s->new_width, s->new_height); s->invalidated = 1; } }
true
qemu
eb2f9b024d68884a3b25e63e4dbf90b67f8da236
static inline void vmsvga_check_size(struct vmsvga_state_s *s) { DisplaySurface *surface = qemu_console_surface(s->vga.con); if (s->new_width != surface_width(surface) || s->new_height != surface_height(surface)) { qemu_console_resize(s->vga.con, s->new_width, s->new_height); s->invalidated = 1; } }
{ "code": [ " s->new_height != surface_height(surface)) {", " qemu_console_resize(s->vga.con, s->new_width, s->new_height);" ], "line_no": [ 11, 13 ] }
static inline void FUNC_0(struct vmsvga_state_s *VAR_0) { DisplaySurface *surface = qemu_console_surface(VAR_0->vga.con); if (VAR_0->new_width != surface_width(surface) || VAR_0->new_height != surface_height(surface)) { qemu_console_resize(VAR_0->vga.con, VAR_0->new_width, VAR_0->new_height); VAR_0->invalidated = 1; } }
[ "static inline void FUNC_0(struct vmsvga_state_s *VAR_0)\n{", "DisplaySurface *surface = qemu_console_surface(VAR_0->vga.con);", "if (VAR_0->new_width != surface_width(surface) ||\nVAR_0->new_height != surface_height(surface)) {", "qemu_console_resize(VAR_0->vga.con, VAR_0->new_width, VAR_0->new_height);", "VAR_0->invalidated = 1;", "}", "}" ]
[ 0, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
11,542
void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space, MemoryRegion *address_space_io, bool init_vga_ports) { MemoryRegion *vga_io_memory; const MemoryRegionPortio *vga_ports, *vbe_ports; PortioList *vga_port_list = g_new(PortioList, 1); PortioList *vbe_port_list = g_new(PortioList, 1); qemu_register_reset(vga_reset, s); s->bank_offset = 0; s->legacy_address_space = address_space; vga_io_memory = vga_init_io(s, obj, &vga_ports, &vbe_ports); memory_region_add_subregion_overlap(address_space, isa_mem_base + 0x000a0000, vga_io_memory, 1); memory_region_set_coalescing(vga_io_memory); if (init_vga_ports) { portio_list_init(vga_port_list, obj, vga_ports, s, "vga"); portio_list_set_flush_coalesced(vga_port_list); portio_list_add(vga_port_list, address_space_io, 0x3b0); } if (vbe_ports) { portio_list_init(vbe_port_list, obj, vbe_ports, s, "vbe"); portio_list_add(vbe_port_list, address_space_io, 0x1ce); } }
true
qemu
848696bf353750899832c51005f1bd3540da5c29
void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space, MemoryRegion *address_space_io, bool init_vga_ports) { MemoryRegion *vga_io_memory; const MemoryRegionPortio *vga_ports, *vbe_ports; PortioList *vga_port_list = g_new(PortioList, 1); PortioList *vbe_port_list = g_new(PortioList, 1); qemu_register_reset(vga_reset, s); s->bank_offset = 0; s->legacy_address_space = address_space; vga_io_memory = vga_init_io(s, obj, &vga_ports, &vbe_ports); memory_region_add_subregion_overlap(address_space, isa_mem_base + 0x000a0000, vga_io_memory, 1); memory_region_set_coalescing(vga_io_memory); if (init_vga_ports) { portio_list_init(vga_port_list, obj, vga_ports, s, "vga"); portio_list_set_flush_coalesced(vga_port_list); portio_list_add(vga_port_list, address_space_io, 0x3b0); } if (vbe_ports) { portio_list_init(vbe_port_list, obj, vbe_ports, s, "vbe"); portio_list_add(vbe_port_list, address_space_io, 0x1ce); } }
{ "code": [ " PortioList *vga_port_list = g_new(PortioList, 1);", " PortioList *vbe_port_list = g_new(PortioList, 1);", " portio_list_init(vga_port_list, obj, vga_ports, s, \"vga\");", " portio_list_set_flush_coalesced(vga_port_list);", " portio_list_add(vga_port_list, address_space_io, 0x3b0);", " portio_list_init(vbe_port_list, obj, vbe_ports, s, \"vbe\");", " portio_list_add(vbe_port_list, address_space_io, 0x1ce);" ], "line_no": [ 11, 13, 43, 45, 47, 53, 55 ] }
void FUNC_0(VGACommonState *VAR_0, Object *VAR_1, MemoryRegion *VAR_2, MemoryRegion *VAR_3, bool VAR_4) { MemoryRegion *vga_io_memory; const MemoryRegionPortio *VAR_5, *vbe_ports; PortioList *vga_port_list = g_new(PortioList, 1); PortioList *vbe_port_list = g_new(PortioList, 1); qemu_register_reset(vga_reset, VAR_0); VAR_0->bank_offset = 0; VAR_0->legacy_address_space = VAR_2; vga_io_memory = vga_init_io(VAR_0, VAR_1, &VAR_5, &vbe_ports); memory_region_add_subregion_overlap(VAR_2, isa_mem_base + 0x000a0000, vga_io_memory, 1); memory_region_set_coalescing(vga_io_memory); if (VAR_4) { portio_list_init(vga_port_list, VAR_1, VAR_5, VAR_0, "vga"); portio_list_set_flush_coalesced(vga_port_list); portio_list_add(vga_port_list, VAR_3, 0x3b0); } if (vbe_ports) { portio_list_init(vbe_port_list, VAR_1, vbe_ports, VAR_0, "vbe"); portio_list_add(vbe_port_list, VAR_3, 0x1ce); } }
[ "void FUNC_0(VGACommonState *VAR_0, Object *VAR_1, MemoryRegion *VAR_2,\nMemoryRegion *VAR_3, bool VAR_4)\n{", "MemoryRegion *vga_io_memory;", "const MemoryRegionPortio *VAR_5, *vbe_ports;", "PortioList *vga_port_list = g_new(PortioList, 1);", "PortioList *vbe_port_list = g_new(PortioList, 1);", "qemu_register_reset(vga_reset, VAR_0);", "VAR_0->bank_offset = 0;", "VAR_0->legacy_address_space = VAR_2;", "vga_io_memory = vga_init_io(VAR_0, VAR_1, &VAR_5, &vbe_ports);", "memory_region_add_subregion_overlap(VAR_2,\nisa_mem_base + 0x000a0000,\nvga_io_memory,\n1);", "memory_region_set_coalescing(vga_io_memory);", "if (VAR_4) {", "portio_list_init(vga_port_list, VAR_1, VAR_5, VAR_0, \"vga\");", "portio_list_set_flush_coalesced(vga_port_list);", "portio_list_add(vga_port_list, VAR_3, 0x3b0);", "}", "if (vbe_ports) {", "portio_list_init(vbe_port_list, VAR_1, vbe_ports, VAR_0, \"vbe\");", "portio_list_add(vbe_port_list, VAR_3, 0x1ce);", "}", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 25 ], [ 29 ], [ 31, 33, 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
11,544
static void msix_mmio_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { PCIDevice *dev = opaque; unsigned int offset = addr & (MSIX_PAGE_SIZE - 1) & ~0x3; int vector = offset / PCI_MSIX_ENTRY_SIZE; /* MSI-X page includes a read-only PBA and a writeable Vector Control. */ if (vector >= dev->msix_entries_nr) { return; } pci_set_long(dev->msix_table_page + offset, val); msix_handle_mask_update(dev, vector); }
true
qemu
ae392c416c69a020226c768d9c3af08b29dd6d96
static void msix_mmio_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { PCIDevice *dev = opaque; unsigned int offset = addr & (MSIX_PAGE_SIZE - 1) & ~0x3; int vector = offset / PCI_MSIX_ENTRY_SIZE; if (vector >= dev->msix_entries_nr) { return; } pci_set_long(dev->msix_table_page + offset, val); msix_handle_mask_update(dev, vector); }
{ "code": [ " msix_handle_mask_update(dev, vector);" ], "line_no": [ 27 ] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { PCIDevice *dev = VAR_0; unsigned int VAR_4 = VAR_1 & (MSIX_PAGE_SIZE - 1) & ~0x3; int VAR_5 = VAR_4 / PCI_MSIX_ENTRY_SIZE; if (VAR_5 >= dev->msix_entries_nr) { return; } pci_set_long(dev->msix_table_page + VAR_4, VAR_2); msix_handle_mask_update(dev, VAR_5); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "PCIDevice *dev = VAR_0;", "unsigned int VAR_4 = VAR_1 & (MSIX_PAGE_SIZE - 1) & ~0x3;", "int VAR_5 = VAR_4 / PCI_MSIX_ENTRY_SIZE;", "if (VAR_5 >= dev->msix_entries_nr) {", "return;", "}", "pci_set_long(dev->msix_table_page + VAR_4, VAR_2);", "msix_handle_mask_update(dev, VAR_5);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ] ]
11,545
static void qemu_laio_completion_cb(EventNotifier *e) { struct qemu_laio_state *s = container_of(e, struct qemu_laio_state, e); while (event_notifier_test_and_clear(&s->e)) { struct io_event events[MAX_EVENTS]; struct timespec ts = { 0 }; int nevents, i; do { nevents = io_getevents(s->ctx, MAX_EVENTS, MAX_EVENTS, events, &ts); } while (nevents == -EINTR); for (i = 0; i < nevents; i++) { struct iocb *iocb = events[i].obj; struct qemu_laiocb *laiocb = container_of(iocb, struct qemu_laiocb, iocb); laiocb->ret = io_event_ret(&events[i]); qemu_laio_process_completion(s, laiocb); } } }
true
qemu
2cdff7f620ebd3b5246cf0c0d1f6fa0eededa4ca
static void qemu_laio_completion_cb(EventNotifier *e) { struct qemu_laio_state *s = container_of(e, struct qemu_laio_state, e); while (event_notifier_test_and_clear(&s->e)) { struct io_event events[MAX_EVENTS]; struct timespec ts = { 0 }; int nevents, i; do { nevents = io_getevents(s->ctx, MAX_EVENTS, MAX_EVENTS, events, &ts); } while (nevents == -EINTR); for (i = 0; i < nevents; i++) { struct iocb *iocb = events[i].obj; struct qemu_laiocb *laiocb = container_of(iocb, struct qemu_laiocb, iocb); laiocb->ret = io_event_ret(&events[i]); qemu_laio_process_completion(s, laiocb); } } }
{ "code": [ "static void qemu_laio_completion_cb(EventNotifier *e)", " struct qemu_laio_state *s = container_of(e, struct qemu_laio_state, e);", " while (event_notifier_test_and_clear(&s->e)) {", " struct io_event events[MAX_EVENTS];", " struct timespec ts = { 0 };", " int nevents, i;", " nevents = io_getevents(s->ctx, MAX_EVENTS, MAX_EVENTS, events, &ts);", " } while (nevents == -EINTR);", " for (i = 0; i < nevents; i++) {", " struct iocb *iocb = events[i].obj;", " struct qemu_laiocb *laiocb =", " container_of(iocb, struct qemu_laiocb, iocb);", " laiocb->ret = io_event_ret(&events[i]);", " qemu_laio_process_completion(s, laiocb);" ], "line_no": [ 1, 5, 9, 11, 13, 15, 21, 23, 27, 29, 31, 33, 37, 39 ] }
static void FUNC_0(EventNotifier *VAR_0) { struct qemu_laio_state *VAR_1 = container_of(VAR_0, struct qemu_laio_state, VAR_0); while (event_notifier_test_and_clear(&VAR_1->VAR_0)) { struct io_event VAR_2[MAX_EVENTS]; struct timespec VAR_3 = { 0 }; int VAR_4, VAR_5; do { VAR_4 = io_getevents(VAR_1->ctx, MAX_EVENTS, MAX_EVENTS, VAR_2, &VAR_3); } while (VAR_4 == -EINTR); for (VAR_5 = 0; VAR_5 < VAR_4; VAR_5++) { struct VAR_6 *VAR_6 = VAR_2[VAR_5].obj; struct qemu_laiocb *VAR_7 = container_of(VAR_6, struct qemu_laiocb, VAR_6); VAR_7->ret = io_event_ret(&VAR_2[VAR_5]); qemu_laio_process_completion(VAR_1, VAR_7); } } }
[ "static void FUNC_0(EventNotifier *VAR_0)\n{", "struct qemu_laio_state *VAR_1 = container_of(VAR_0, struct qemu_laio_state, VAR_0);", "while (event_notifier_test_and_clear(&VAR_1->VAR_0)) {", "struct io_event VAR_2[MAX_EVENTS];", "struct timespec VAR_3 = { 0 };", "int VAR_4, VAR_5;", "do {", "VAR_4 = io_getevents(VAR_1->ctx, MAX_EVENTS, MAX_EVENTS, VAR_2, &VAR_3);", "} while (VAR_4 == -EINTR);", "for (VAR_5 = 0; VAR_5 < VAR_4; VAR_5++) {", "struct VAR_6 *VAR_6 = VAR_2[VAR_5].obj;", "struct qemu_laiocb *VAR_7 =\ncontainer_of(VAR_6, struct qemu_laiocb, VAR_6);", "VAR_7->ret = io_event_ret(&VAR_2[VAR_5]);", "qemu_laio_process_completion(VAR_1, VAR_7);", "}", "}", "}" ]
[ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
11,547
static void spapr_rng_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->realize = spapr_rng_realize; set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->props = spapr_rng_properties; }
true
qemu
3d0db3e74d818ba43c62cdfb3220e551f4f5ae37
static void spapr_rng_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->realize = spapr_rng_realize; set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->props = spapr_rng_properties; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->realize = spapr_rng_realize; set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->props = spapr_rng_properties; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->realize = spapr_rng_realize;", "set_bit(DEVICE_CATEGORY_MISC, dc->categories);", "dc->props = spapr_rng_properties;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 16 ] ]
11,548
static void process_incoming_migration_co(void *opaque) { QEMUFile *f = opaque; MigrationIncomingState *mis = migration_incoming_get_current(); PostcopyState ps; int ret; mis->from_src_file = f; mis->largest_page_size = qemu_ram_pagesize_largest(); postcopy_state_set(POSTCOPY_INCOMING_NONE); migrate_set_state(&mis->state, MIGRATION_STATUS_NONE, MIGRATION_STATUS_ACTIVE); ret = qemu_loadvm_state(f); ps = postcopy_state_get(); trace_process_incoming_migration_co_end(ret, ps); if (ps != POSTCOPY_INCOMING_NONE) { if (ps == POSTCOPY_INCOMING_ADVISE) { /* * Where a migration had postcopy enabled (and thus went to advise) * but managed to complete within the precopy period, we can use * the normal exit. */ postcopy_ram_incoming_cleanup(mis); } else if (ret >= 0) { /* * Postcopy was started, cleanup should happen at the end of the * postcopy thread. */ trace_process_incoming_migration_co_postcopy_end_main(); return; } /* Else if something went wrong then just fall out of the normal exit */ } /* we get COLO info, and know if we are in COLO mode */ if (!ret && migration_incoming_enable_colo()) { mis->migration_incoming_co = qemu_coroutine_self(); qemu_thread_create(&mis->colo_incoming_thread, "COLO incoming", colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE); mis->have_colo_incoming_thread = true; qemu_coroutine_yield(); /* Wait checkpoint incoming thread exit before free resource */ qemu_thread_join(&mis->colo_incoming_thread); } qemu_fclose(f); free_xbzrle_decoded_buf(); if (ret < 0) { migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); error_report("load of migration failed: %s", strerror(-ret)); migrate_decompress_threads_join(); exit(EXIT_FAILURE); } mis->bh = qemu_bh_new(process_incoming_migration_bh, mis); qemu_bh_schedule(mis->bh); }
true
qemu
e8199e4895d34136735dea7e628d0de1a5afb630
static void process_incoming_migration_co(void *opaque) { QEMUFile *f = opaque; MigrationIncomingState *mis = migration_incoming_get_current(); PostcopyState ps; int ret; mis->from_src_file = f; mis->largest_page_size = qemu_ram_pagesize_largest(); postcopy_state_set(POSTCOPY_INCOMING_NONE); migrate_set_state(&mis->state, MIGRATION_STATUS_NONE, MIGRATION_STATUS_ACTIVE); ret = qemu_loadvm_state(f); ps = postcopy_state_get(); trace_process_incoming_migration_co_end(ret, ps); if (ps != POSTCOPY_INCOMING_NONE) { if (ps == POSTCOPY_INCOMING_ADVISE) { postcopy_ram_incoming_cleanup(mis); } else if (ret >= 0) { trace_process_incoming_migration_co_postcopy_end_main(); return; } } if (!ret && migration_incoming_enable_colo()) { mis->migration_incoming_co = qemu_coroutine_self(); qemu_thread_create(&mis->colo_incoming_thread, "COLO incoming", colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE); mis->have_colo_incoming_thread = true; qemu_coroutine_yield(); qemu_thread_join(&mis->colo_incoming_thread); } qemu_fclose(f); free_xbzrle_decoded_buf(); if (ret < 0) { migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); error_report("load of migration failed: %s", strerror(-ret)); migrate_decompress_threads_join(); exit(EXIT_FAILURE); } mis->bh = qemu_bh_new(process_incoming_migration_bh, mis); qemu_bh_schedule(mis->bh); }
{ "code": [ " qemu_fclose(f);", " free_xbzrle_decoded_buf();" ], "line_no": [ 95, 97 ] }
static void FUNC_0(void *VAR_0) { QEMUFile *f = VAR_0; MigrationIncomingState *mis = migration_incoming_get_current(); PostcopyState ps; int VAR_1; mis->from_src_file = f; mis->largest_page_size = qemu_ram_pagesize_largest(); postcopy_state_set(POSTCOPY_INCOMING_NONE); migrate_set_state(&mis->state, MIGRATION_STATUS_NONE, MIGRATION_STATUS_ACTIVE); VAR_1 = qemu_loadvm_state(f); ps = postcopy_state_get(); trace_process_incoming_migration_co_end(VAR_1, ps); if (ps != POSTCOPY_INCOMING_NONE) { if (ps == POSTCOPY_INCOMING_ADVISE) { postcopy_ram_incoming_cleanup(mis); } else if (VAR_1 >= 0) { trace_process_incoming_migration_co_postcopy_end_main(); return; } } if (!VAR_1 && migration_incoming_enable_colo()) { mis->migration_incoming_co = qemu_coroutine_self(); qemu_thread_create(&mis->colo_incoming_thread, "COLO incoming", colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE); mis->have_colo_incoming_thread = true; qemu_coroutine_yield(); qemu_thread_join(&mis->colo_incoming_thread); } qemu_fclose(f); free_xbzrle_decoded_buf(); if (VAR_1 < 0) { migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); error_report("load of migration failed: %s", strerror(-VAR_1)); migrate_decompress_threads_join(); exit(EXIT_FAILURE); } mis->bh = qemu_bh_new(process_incoming_migration_bh, mis); qemu_bh_schedule(mis->bh); }
[ "static void FUNC_0(void *VAR_0)\n{", "QEMUFile *f = VAR_0;", "MigrationIncomingState *mis = migration_incoming_get_current();", "PostcopyState ps;", "int VAR_1;", "mis->from_src_file = f;", "mis->largest_page_size = qemu_ram_pagesize_largest();", "postcopy_state_set(POSTCOPY_INCOMING_NONE);", "migrate_set_state(&mis->state, MIGRATION_STATUS_NONE,\nMIGRATION_STATUS_ACTIVE);", "VAR_1 = qemu_loadvm_state(f);", "ps = postcopy_state_get();", "trace_process_incoming_migration_co_end(VAR_1, ps);", "if (ps != POSTCOPY_INCOMING_NONE) {", "if (ps == POSTCOPY_INCOMING_ADVISE) {", "postcopy_ram_incoming_cleanup(mis);", "} else if (VAR_1 >= 0) {", "trace_process_incoming_migration_co_postcopy_end_main();", "return;", "}", "}", "if (!VAR_1 && migration_incoming_enable_colo()) {", "mis->migration_incoming_co = qemu_coroutine_self();", "qemu_thread_create(&mis->colo_incoming_thread, \"COLO incoming\",\ncolo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE);", "mis->have_colo_incoming_thread = true;", "qemu_coroutine_yield();", "qemu_thread_join(&mis->colo_incoming_thread);", "}", "qemu_fclose(f);", "free_xbzrle_decoded_buf();", "if (VAR_1 < 0) {", "migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,\nMIGRATION_STATUS_FAILED);", "error_report(\"load of migration failed: %s\", strerror(-VAR_1));", "migrate_decompress_threads_join();", "exit(EXIT_FAILURE);", "}", "mis->bh = qemu_bh_new(process_incoming_migration_bh, mis);", "qemu_bh_schedule(mis->bh);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 47 ], [ 49 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ] ]
11,550
static int ast_read_packet(AVFormatContext *s, AVPacket *pkt) { uint32_t type, size; int64_t pos; int ret; if (avio_feof(s->pb)) return AVERROR_EOF; pos = avio_tell(s->pb); type = avio_rl32(s->pb); size = avio_rb32(s->pb); if (size > INT_MAX / s->streams[0]->codecpar->channels) return AVERROR_INVALIDDATA; size *= s->streams[0]->codecpar->channels; if ((ret = avio_skip(s->pb, 24)) < 0) // padding return ret; if (type == MKTAG('B','L','C','K')) { ret = av_get_packet(s->pb, pkt, size); pkt->stream_index = 0; pkt->pos = pos; } else { av_log(s, AV_LOG_ERROR, "unknown chunk %x\n", type); avio_skip(s->pb, size); ret = AVERROR_INVALIDDATA; } return ret; }
true
FFmpeg
9959a52b14bcfa3e5baeb3fc8a86c04bbc0d3d5d
static int ast_read_packet(AVFormatContext *s, AVPacket *pkt) { uint32_t type, size; int64_t pos; int ret; if (avio_feof(s->pb)) return AVERROR_EOF; pos = avio_tell(s->pb); type = avio_rl32(s->pb); size = avio_rb32(s->pb); if (size > INT_MAX / s->streams[0]->codecpar->channels) return AVERROR_INVALIDDATA; size *= s->streams[0]->codecpar->channels; if ((ret = avio_skip(s->pb, 24)) < 0) return ret; if (type == MKTAG('B','L','C','K')) { ret = av_get_packet(s->pb, pkt, size); pkt->stream_index = 0; pkt->pos = pos; } else { av_log(s, AV_LOG_ERROR, "unknown chunk %x\n", type); avio_skip(s->pb, size); ret = AVERROR_INVALIDDATA; } return ret; }
{ "code": [ " if (size > INT_MAX / s->streams[0]->codecpar->channels)" ], "line_no": [ 25 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { uint32_t type, size; int64_t pos; int VAR_2; if (avio_feof(VAR_0->pb)) return AVERROR_EOF; pos = avio_tell(VAR_0->pb); type = avio_rl32(VAR_0->pb); size = avio_rb32(VAR_0->pb); if (size > INT_MAX / VAR_0->streams[0]->codecpar->channels) return AVERROR_INVALIDDATA; size *= VAR_0->streams[0]->codecpar->channels; if ((VAR_2 = avio_skip(VAR_0->pb, 24)) < 0) return VAR_2; if (type == MKTAG('B','L','C','K')) { VAR_2 = av_get_packet(VAR_0->pb, VAR_1, size); VAR_1->stream_index = 0; VAR_1->pos = pos; } else { av_log(VAR_0, AV_LOG_ERROR, "unknown chunk %x\n", type); avio_skip(VAR_0->pb, size); VAR_2 = AVERROR_INVALIDDATA; } return VAR_2; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "uint32_t type, size;", "int64_t pos;", "int VAR_2;", "if (avio_feof(VAR_0->pb))\nreturn AVERROR_EOF;", "pos = avio_tell(VAR_0->pb);", "type = avio_rl32(VAR_0->pb);", "size = avio_rb32(VAR_0->pb);", "if (size > INT_MAX / VAR_0->streams[0]->codecpar->channels)\nreturn AVERROR_INVALIDDATA;", "size *= VAR_0->streams[0]->codecpar->channels;", "if ((VAR_2 = avio_skip(VAR_0->pb, 24)) < 0)\nreturn VAR_2;", "if (type == MKTAG('B','L','C','K')) {", "VAR_2 = av_get_packet(VAR_0->pb, VAR_1, size);", "VAR_1->stream_index = 0;", "VAR_1->pos = pos;", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"unknown chunk %x\\n\", type);", "avio_skip(VAR_0->pb, size);", "VAR_2 = AVERROR_INVALIDDATA;", "}", "return VAR_2;", "}" ]
[ 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, 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ] ]
11,551
static void do_apply_filter(APEContext *ctx, int version, APEFilter *f, int32_t *data, int count, int order, int fracbits) { int res; int absres; while (count--) { /* round fixedpoint scalar product */ res = ctx->adsp.scalarproduct_and_madd_int16(f->coeffs, f->delay - order, f->adaptcoeffs - order, order, APESIGN(*data)); res = (res + (1 << (fracbits - 1))) >> fracbits; res += *data; *data++ = res; /* Update the output history */ *f->delay++ = av_clip_int16(res); if (version < 3980) { /* Version ??? to < 3.98 files (untested) */ f->adaptcoeffs[0] = (res == 0) ? 0 : ((res >> 28) & 8) - 4; f->adaptcoeffs[-4] >>= 1; f->adaptcoeffs[-8] >>= 1; } else { /* Version 3.98 and later files */ /* Update the adaption coefficients */ absres = FFABS(res); if (absres) *f->adaptcoeffs = ((res & (-1<<31)) ^ (-1<<30)) >> (25 + (absres <= f->avg*3) + (absres <= f->avg*4/3)); else *f->adaptcoeffs = 0; f->avg += (absres - f->avg) / 16; f->adaptcoeffs[-1] >>= 1; f->adaptcoeffs[-2] >>= 1; f->adaptcoeffs[-8] >>= 1; } f->adaptcoeffs++; /* Have we filled the history buffer? */ if (f->delay == f->historybuffer + HISTORY_SIZE + (order * 2)) { memmove(f->historybuffer, f->delay - (order * 2), (order * 2) * sizeof(*f->historybuffer)); f->delay = f->historybuffer + order * 2; f->adaptcoeffs = f->historybuffer + order; } } }
true
FFmpeg
f3fdef108eb06b1e71b29152bf6822519e787efe
static void do_apply_filter(APEContext *ctx, int version, APEFilter *f, int32_t *data, int count, int order, int fracbits) { int res; int absres; while (count--) { res = ctx->adsp.scalarproduct_and_madd_int16(f->coeffs, f->delay - order, f->adaptcoeffs - order, order, APESIGN(*data)); res = (res + (1 << (fracbits - 1))) >> fracbits; res += *data; *data++ = res; *f->delay++ = av_clip_int16(res); if (version < 3980) { f->adaptcoeffs[0] = (res == 0) ? 0 : ((res >> 28) & 8) - 4; f->adaptcoeffs[-4] >>= 1; f->adaptcoeffs[-8] >>= 1; } else { absres = FFABS(res); if (absres) *f->adaptcoeffs = ((res & (-1<<31)) ^ (-1<<30)) >> (25 + (absres <= f->avg*3) + (absres <= f->avg*4/3)); else *f->adaptcoeffs = 0; f->avg += (absres - f->avg) / 16; f->adaptcoeffs[-1] >>= 1; f->adaptcoeffs[-2] >>= 1; f->adaptcoeffs[-8] >>= 1; } f->adaptcoeffs++; if (f->delay == f->historybuffer + HISTORY_SIZE + (order * 2)) { memmove(f->historybuffer, f->delay - (order * 2), (order * 2) * sizeof(*f->historybuffer)); f->delay = f->historybuffer + order * 2; f->adaptcoeffs = f->historybuffer + order; } } }
{ "code": [ " *f->adaptcoeffs = ((res & (-1<<31)) ^ (-1<<30)) >>" ], "line_no": [ 61 ] }
static void FUNC_0(APEContext *VAR_0, int VAR_1, APEFilter *VAR_2, int32_t *VAR_3, int VAR_4, int VAR_5, int VAR_6) { int VAR_7; int VAR_8; while (VAR_4--) { VAR_7 = VAR_0->adsp.scalarproduct_and_madd_int16(VAR_2->coeffs, VAR_2->delay - VAR_5, VAR_2->adaptcoeffs - VAR_5, VAR_5, APESIGN(*VAR_3)); VAR_7 = (VAR_7 + (1 << (VAR_6 - 1))) >> VAR_6; VAR_7 += *VAR_3; *VAR_3++ = VAR_7; *VAR_2->delay++ = av_clip_int16(VAR_7); if (VAR_1 < 3980) { VAR_2->adaptcoeffs[0] = (VAR_7 == 0) ? 0 : ((VAR_7 >> 28) & 8) - 4; VAR_2->adaptcoeffs[-4] >>= 1; VAR_2->adaptcoeffs[-8] >>= 1; } else { VAR_8 = FFABS(VAR_7); if (VAR_8) *VAR_2->adaptcoeffs = ((VAR_7 & (-1<<31)) ^ (-1<<30)) >> (25 + (VAR_8 <= VAR_2->avg*3) + (VAR_8 <= VAR_2->avg*4/3)); else *VAR_2->adaptcoeffs = 0; VAR_2->avg += (VAR_8 - VAR_2->avg) / 16; VAR_2->adaptcoeffs[-1] >>= 1; VAR_2->adaptcoeffs[-2] >>= 1; VAR_2->adaptcoeffs[-8] >>= 1; } VAR_2->adaptcoeffs++; if (VAR_2->delay == VAR_2->historybuffer + HISTORY_SIZE + (VAR_5 * 2)) { memmove(VAR_2->historybuffer, VAR_2->delay - (VAR_5 * 2), (VAR_5 * 2) * sizeof(*VAR_2->historybuffer)); VAR_2->delay = VAR_2->historybuffer + VAR_5 * 2; VAR_2->adaptcoeffs = VAR_2->historybuffer + VAR_5; } } }
[ "static void FUNC_0(APEContext *VAR_0, int VAR_1, APEFilter *VAR_2,\nint32_t *VAR_3, int VAR_4, int VAR_5, int VAR_6)\n{", "int VAR_7;", "int VAR_8;", "while (VAR_4--) {", "VAR_7 = VAR_0->adsp.scalarproduct_and_madd_int16(VAR_2->coeffs,\nVAR_2->delay - VAR_5,\nVAR_2->adaptcoeffs - VAR_5,\nVAR_5, APESIGN(*VAR_3));", "VAR_7 = (VAR_7 + (1 << (VAR_6 - 1))) >> VAR_6;", "VAR_7 += *VAR_3;", "*VAR_3++ = VAR_7;", "*VAR_2->delay++ = av_clip_int16(VAR_7);", "if (VAR_1 < 3980) {", "VAR_2->adaptcoeffs[0] = (VAR_7 == 0) ? 0 : ((VAR_7 >> 28) & 8) - 4;", "VAR_2->adaptcoeffs[-4] >>= 1;", "VAR_2->adaptcoeffs[-8] >>= 1;", "} else {", "VAR_8 = FFABS(VAR_7);", "if (VAR_8)\n*VAR_2->adaptcoeffs = ((VAR_7 & (-1<<31)) ^ (-1<<30)) >>\n(25 + (VAR_8 <= VAR_2->avg*3) + (VAR_8 <= VAR_2->avg*4/3));", "else\n*VAR_2->adaptcoeffs = 0;", "VAR_2->avg += (VAR_8 - VAR_2->avg) / 16;", "VAR_2->adaptcoeffs[-1] >>= 1;", "VAR_2->adaptcoeffs[-2] >>= 1;", "VAR_2->adaptcoeffs[-8] >>= 1;", "}", "VAR_2->adaptcoeffs++;", "if (VAR_2->delay == VAR_2->historybuffer + HISTORY_SIZE + (VAR_5 * 2)) {", "memmove(VAR_2->historybuffer, VAR_2->delay - (VAR_5 * 2),\n(VAR_5 * 2) * sizeof(*VAR_2->historybuffer));", "VAR_2->delay = VAR_2->historybuffer + VAR_5 * 2;", "VAR_2->adaptcoeffs = VAR_2->historybuffer + VAR_5;", "}", "}", "}" ]
[ 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 ], [ 13 ], [ 17, 19, 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 35 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 57 ], [ 59, 61, 63 ], [ 65, 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ] ]
11,552
static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type) { const int mb_xy = h->mb_xy; int top_xy, left_xy[LEFT_MBS]; int top_type, left_type[LEFT_MBS]; uint8_t *nnz; uint8_t *nnz_cache; top_xy = mb_xy - (h->mb_stride << MB_FIELD(h)); /* Wow, what a mess, why didn't they simplify the interlacing & intra * stuff, I can't imagine that these complex rules are worth it. */ left_xy[LBOT] = left_xy[LTOP] = mb_xy - 1; if (FRAME_MBAFF(h)) { const int left_mb_field_flag = IS_INTERLACED(h->cur_pic.mb_type[mb_xy - 1]); const int curr_mb_field_flag = IS_INTERLACED(mb_type); if (h->mb_y & 1) { if (left_mb_field_flag != curr_mb_field_flag) left_xy[LTOP] -= h->mb_stride; } else { if (curr_mb_field_flag) top_xy += h->mb_stride & (((h->cur_pic.mb_type[top_xy] >> 7) & 1) - 1); if (left_mb_field_flag != curr_mb_field_flag) left_xy[LBOT] += h->mb_stride; } } sl->top_mb_xy = top_xy; sl->left_mb_xy[LTOP] = left_xy[LTOP]; sl->left_mb_xy[LBOT] = left_xy[LBOT]; { /* For sufficiently low qp, filtering wouldn't do anything. * This is a conservative estimate: could also check beta_offset * and more accurate chroma_qp. */ int qp_thresh = sl->qp_thresh; // FIXME strictly we should store qp_thresh for each mb of a slice int qp = h->cur_pic.qscale_table[mb_xy]; if (qp <= qp_thresh && (left_xy[LTOP] < 0 || ((qp + h->cur_pic.qscale_table[left_xy[LTOP]] + 1) >> 1) <= qp_thresh) && (top_xy < 0 || ((qp + h->cur_pic.qscale_table[top_xy] + 1) >> 1) <= qp_thresh)) { if (!FRAME_MBAFF(h)) return 1; if ((left_xy[LTOP] < 0 || ((qp + h->cur_pic.qscale_table[left_xy[LBOT]] + 1) >> 1) <= qp_thresh) && (top_xy < h->mb_stride || ((qp + h->cur_pic.qscale_table[top_xy - h->mb_stride] + 1) >> 1) <= qp_thresh)) return 1; } } top_type = h->cur_pic.mb_type[top_xy]; left_type[LTOP] = h->cur_pic.mb_type[left_xy[LTOP]]; left_type[LBOT] = h->cur_pic.mb_type[left_xy[LBOT]]; if (h->deblocking_filter == 2) { if (h->slice_table[top_xy] != sl->slice_num) top_type = 0; if (h->slice_table[left_xy[LBOT]] != sl->slice_num) left_type[LTOP] = left_type[LBOT] = 0; } else { if (h->slice_table[top_xy] == 0xFFFF) top_type = 0; if (h->slice_table[left_xy[LBOT]] == 0xFFFF) left_type[LTOP] = left_type[LBOT] = 0; } sl->top_type = top_type; sl->left_type[LTOP] = left_type[LTOP]; sl->left_type[LBOT] = left_type[LBOT]; if (IS_INTRA(mb_type)) return 0; fill_filter_caches_inter(h, sl, mb_type, top_xy, left_xy, top_type, left_type, mb_xy, 0); if (sl->list_count == 2) fill_filter_caches_inter(h, sl, mb_type, top_xy, left_xy, top_type, left_type, mb_xy, 1); nnz = h->non_zero_count[mb_xy]; nnz_cache = sl->non_zero_count_cache; AV_COPY32(&nnz_cache[4 + 8 * 1], &nnz[0]); AV_COPY32(&nnz_cache[4 + 8 * 2], &nnz[4]); AV_COPY32(&nnz_cache[4 + 8 * 3], &nnz[8]); AV_COPY32(&nnz_cache[4 + 8 * 4], &nnz[12]); sl->cbp = h->cbp_table[mb_xy]; if (top_type) { nnz = h->non_zero_count[top_xy]; AV_COPY32(&nnz_cache[4 + 8 * 0], &nnz[3 * 4]); } if (left_type[LTOP]) { nnz = h->non_zero_count[left_xy[LTOP]]; nnz_cache[3 + 8 * 1] = nnz[3 + 0 * 4]; nnz_cache[3 + 8 * 2] = nnz[3 + 1 * 4]; nnz_cache[3 + 8 * 3] = nnz[3 + 2 * 4]; nnz_cache[3 + 8 * 4] = nnz[3 + 3 * 4]; } /* CAVLC 8x8dct requires NNZ values for residual decoding that differ * from what the loop filter needs */ if (!CABAC(h) && h->pps.transform_8x8_mode) { if (IS_8x8DCT(top_type)) { nnz_cache[4 + 8 * 0] = nnz_cache[5 + 8 * 0] = (h->cbp_table[top_xy] & 0x4000) >> 12; nnz_cache[6 + 8 * 0] = nnz_cache[7 + 8 * 0] = (h->cbp_table[top_xy] & 0x8000) >> 12; } if (IS_8x8DCT(left_type[LTOP])) { nnz_cache[3 + 8 * 1] = nnz_cache[3 + 8 * 2] = (h->cbp_table[left_xy[LTOP]] & 0x2000) >> 12; // FIXME check MBAFF } if (IS_8x8DCT(left_type[LBOT])) { nnz_cache[3 + 8 * 3] = nnz_cache[3 + 8 * 4] = (h->cbp_table[left_xy[LBOT]] & 0x8000) >> 12; // FIXME check MBAFF } if (IS_8x8DCT(mb_type)) { nnz_cache[scan8[0]] = nnz_cache[scan8[1]] = nnz_cache[scan8[2]] = nnz_cache[scan8[3]] = (sl->cbp & 0x1000) >> 12; nnz_cache[scan8[0 + 4]] = nnz_cache[scan8[1 + 4]] = nnz_cache[scan8[2 + 4]] = nnz_cache[scan8[3 + 4]] = (sl->cbp & 0x2000) >> 12; nnz_cache[scan8[0 + 8]] = nnz_cache[scan8[1 + 8]] = nnz_cache[scan8[2 + 8]] = nnz_cache[scan8[3 + 8]] = (sl->cbp & 0x4000) >> 12; nnz_cache[scan8[0 + 12]] = nnz_cache[scan8[1 + 12]] = nnz_cache[scan8[2 + 12]] = nnz_cache[scan8[3 + 12]] = (sl->cbp & 0x8000) >> 12; } } return 0; }
false
FFmpeg
e6c90ce94f1b07f50cea2babf7471af455cca0ff
static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type) { const int mb_xy = h->mb_xy; int top_xy, left_xy[LEFT_MBS]; int top_type, left_type[LEFT_MBS]; uint8_t *nnz; uint8_t *nnz_cache; top_xy = mb_xy - (h->mb_stride << MB_FIELD(h)); left_xy[LBOT] = left_xy[LTOP] = mb_xy - 1; if (FRAME_MBAFF(h)) { const int left_mb_field_flag = IS_INTERLACED(h->cur_pic.mb_type[mb_xy - 1]); const int curr_mb_field_flag = IS_INTERLACED(mb_type); if (h->mb_y & 1) { if (left_mb_field_flag != curr_mb_field_flag) left_xy[LTOP] -= h->mb_stride; } else { if (curr_mb_field_flag) top_xy += h->mb_stride & (((h->cur_pic.mb_type[top_xy] >> 7) & 1) - 1); if (left_mb_field_flag != curr_mb_field_flag) left_xy[LBOT] += h->mb_stride; } } sl->top_mb_xy = top_xy; sl->left_mb_xy[LTOP] = left_xy[LTOP]; sl->left_mb_xy[LBOT] = left_xy[LBOT]; { int qp_thresh = sl->qp_thresh; int qp = h->cur_pic.qscale_table[mb_xy]; if (qp <= qp_thresh && (left_xy[LTOP] < 0 || ((qp + h->cur_pic.qscale_table[left_xy[LTOP]] + 1) >> 1) <= qp_thresh) && (top_xy < 0 || ((qp + h->cur_pic.qscale_table[top_xy] + 1) >> 1) <= qp_thresh)) { if (!FRAME_MBAFF(h)) return 1; if ((left_xy[LTOP] < 0 || ((qp + h->cur_pic.qscale_table[left_xy[LBOT]] + 1) >> 1) <= qp_thresh) && (top_xy < h->mb_stride || ((qp + h->cur_pic.qscale_table[top_xy - h->mb_stride] + 1) >> 1) <= qp_thresh)) return 1; } } top_type = h->cur_pic.mb_type[top_xy]; left_type[LTOP] = h->cur_pic.mb_type[left_xy[LTOP]]; left_type[LBOT] = h->cur_pic.mb_type[left_xy[LBOT]]; if (h->deblocking_filter == 2) { if (h->slice_table[top_xy] != sl->slice_num) top_type = 0; if (h->slice_table[left_xy[LBOT]] != sl->slice_num) left_type[LTOP] = left_type[LBOT] = 0; } else { if (h->slice_table[top_xy] == 0xFFFF) top_type = 0; if (h->slice_table[left_xy[LBOT]] == 0xFFFF) left_type[LTOP] = left_type[LBOT] = 0; } sl->top_type = top_type; sl->left_type[LTOP] = left_type[LTOP]; sl->left_type[LBOT] = left_type[LBOT]; if (IS_INTRA(mb_type)) return 0; fill_filter_caches_inter(h, sl, mb_type, top_xy, left_xy, top_type, left_type, mb_xy, 0); if (sl->list_count == 2) fill_filter_caches_inter(h, sl, mb_type, top_xy, left_xy, top_type, left_type, mb_xy, 1); nnz = h->non_zero_count[mb_xy]; nnz_cache = sl->non_zero_count_cache; AV_COPY32(&nnz_cache[4 + 8 * 1], &nnz[0]); AV_COPY32(&nnz_cache[4 + 8 * 2], &nnz[4]); AV_COPY32(&nnz_cache[4 + 8 * 3], &nnz[8]); AV_COPY32(&nnz_cache[4 + 8 * 4], &nnz[12]); sl->cbp = h->cbp_table[mb_xy]; if (top_type) { nnz = h->non_zero_count[top_xy]; AV_COPY32(&nnz_cache[4 + 8 * 0], &nnz[3 * 4]); } if (left_type[LTOP]) { nnz = h->non_zero_count[left_xy[LTOP]]; nnz_cache[3 + 8 * 1] = nnz[3 + 0 * 4]; nnz_cache[3 + 8 * 2] = nnz[3 + 1 * 4]; nnz_cache[3 + 8 * 3] = nnz[3 + 2 * 4]; nnz_cache[3 + 8 * 4] = nnz[3 + 3 * 4]; } if (!CABAC(h) && h->pps.transform_8x8_mode) { if (IS_8x8DCT(top_type)) { nnz_cache[4 + 8 * 0] = nnz_cache[5 + 8 * 0] = (h->cbp_table[top_xy] & 0x4000) >> 12; nnz_cache[6 + 8 * 0] = nnz_cache[7 + 8 * 0] = (h->cbp_table[top_xy] & 0x8000) >> 12; } if (IS_8x8DCT(left_type[LTOP])) { nnz_cache[3 + 8 * 1] = nnz_cache[3 + 8 * 2] = (h->cbp_table[left_xy[LTOP]] & 0x2000) >> 12; } if (IS_8x8DCT(left_type[LBOT])) { nnz_cache[3 + 8 * 3] = nnz_cache[3 + 8 * 4] = (h->cbp_table[left_xy[LBOT]] & 0x8000) >> 12; } if (IS_8x8DCT(mb_type)) { nnz_cache[scan8[0]] = nnz_cache[scan8[1]] = nnz_cache[scan8[2]] = nnz_cache[scan8[3]] = (sl->cbp & 0x1000) >> 12; nnz_cache[scan8[0 + 4]] = nnz_cache[scan8[1 + 4]] = nnz_cache[scan8[2 + 4]] = nnz_cache[scan8[3 + 4]] = (sl->cbp & 0x2000) >> 12; nnz_cache[scan8[0 + 8]] = nnz_cache[scan8[1 + 8]] = nnz_cache[scan8[2 + 8]] = nnz_cache[scan8[3 + 8]] = (sl->cbp & 0x4000) >> 12; nnz_cache[scan8[0 + 12]] = nnz_cache[scan8[1 + 12]] = nnz_cache[scan8[2 + 12]] = nnz_cache[scan8[3 + 12]] = (sl->cbp & 0x8000) >> 12; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(H264Context *VAR_0, H264SliceContext *VAR_1, int VAR_2) { const int VAR_3 = VAR_0->VAR_3; int VAR_4, left_xy[LEFT_MBS]; int VAR_5, left_type[LEFT_MBS]; uint8_t *nnz; uint8_t *nnz_cache; VAR_4 = VAR_3 - (VAR_0->mb_stride << MB_FIELD(VAR_0)); left_xy[LBOT] = left_xy[LTOP] = VAR_3 - 1; if (FRAME_MBAFF(VAR_0)) { const int VAR_6 = IS_INTERLACED(VAR_0->cur_pic.VAR_2[VAR_3 - 1]); const int VAR_7 = IS_INTERLACED(VAR_2); if (VAR_0->mb_y & 1) { if (VAR_6 != VAR_7) left_xy[LTOP] -= VAR_0->mb_stride; } else { if (VAR_7) VAR_4 += VAR_0->mb_stride & (((VAR_0->cur_pic.VAR_2[VAR_4] >> 7) & 1) - 1); if (VAR_6 != VAR_7) left_xy[LBOT] += VAR_0->mb_stride; } } VAR_1->top_mb_xy = VAR_4; VAR_1->left_mb_xy[LTOP] = left_xy[LTOP]; VAR_1->left_mb_xy[LBOT] = left_xy[LBOT]; { int VAR_8 = VAR_1->VAR_8; int VAR_9 = VAR_0->cur_pic.qscale_table[VAR_3]; if (VAR_9 <= VAR_8 && (left_xy[LTOP] < 0 || ((VAR_9 + VAR_0->cur_pic.qscale_table[left_xy[LTOP]] + 1) >> 1) <= VAR_8) && (VAR_4 < 0 || ((VAR_9 + VAR_0->cur_pic.qscale_table[VAR_4] + 1) >> 1) <= VAR_8)) { if (!FRAME_MBAFF(VAR_0)) return 1; if ((left_xy[LTOP] < 0 || ((VAR_9 + VAR_0->cur_pic.qscale_table[left_xy[LBOT]] + 1) >> 1) <= VAR_8) && (VAR_4 < VAR_0->mb_stride || ((VAR_9 + VAR_0->cur_pic.qscale_table[VAR_4 - VAR_0->mb_stride] + 1) >> 1) <= VAR_8)) return 1; } } VAR_5 = VAR_0->cur_pic.VAR_2[VAR_4]; left_type[LTOP] = VAR_0->cur_pic.VAR_2[left_xy[LTOP]]; left_type[LBOT] = VAR_0->cur_pic.VAR_2[left_xy[LBOT]]; if (VAR_0->deblocking_filter == 2) { if (VAR_0->slice_table[VAR_4] != VAR_1->slice_num) VAR_5 = 0; if (VAR_0->slice_table[left_xy[LBOT]] != VAR_1->slice_num) left_type[LTOP] = left_type[LBOT] = 0; } else { if (VAR_0->slice_table[VAR_4] == 0xFFFF) VAR_5 = 0; if (VAR_0->slice_table[left_xy[LBOT]] == 0xFFFF) left_type[LTOP] = left_type[LBOT] = 0; } VAR_1->VAR_5 = VAR_5; VAR_1->left_type[LTOP] = left_type[LTOP]; VAR_1->left_type[LBOT] = left_type[LBOT]; if (IS_INTRA(VAR_2)) return 0; fill_filter_caches_inter(VAR_0, VAR_1, VAR_2, VAR_4, left_xy, VAR_5, left_type, VAR_3, 0); if (VAR_1->list_count == 2) fill_filter_caches_inter(VAR_0, VAR_1, VAR_2, VAR_4, left_xy, VAR_5, left_type, VAR_3, 1); nnz = VAR_0->non_zero_count[VAR_3]; nnz_cache = VAR_1->non_zero_count_cache; AV_COPY32(&nnz_cache[4 + 8 * 1], &nnz[0]); AV_COPY32(&nnz_cache[4 + 8 * 2], &nnz[4]); AV_COPY32(&nnz_cache[4 + 8 * 3], &nnz[8]); AV_COPY32(&nnz_cache[4 + 8 * 4], &nnz[12]); VAR_1->cbp = VAR_0->cbp_table[VAR_3]; if (VAR_5) { nnz = VAR_0->non_zero_count[VAR_4]; AV_COPY32(&nnz_cache[4 + 8 * 0], &nnz[3 * 4]); } if (left_type[LTOP]) { nnz = VAR_0->non_zero_count[left_xy[LTOP]]; nnz_cache[3 + 8 * 1] = nnz[3 + 0 * 4]; nnz_cache[3 + 8 * 2] = nnz[3 + 1 * 4]; nnz_cache[3 + 8 * 3] = nnz[3 + 2 * 4]; nnz_cache[3 + 8 * 4] = nnz[3 + 3 * 4]; } if (!CABAC(VAR_0) && VAR_0->pps.transform_8x8_mode) { if (IS_8x8DCT(VAR_5)) { nnz_cache[4 + 8 * 0] = nnz_cache[5 + 8 * 0] = (VAR_0->cbp_table[VAR_4] & 0x4000) >> 12; nnz_cache[6 + 8 * 0] = nnz_cache[7 + 8 * 0] = (VAR_0->cbp_table[VAR_4] & 0x8000) >> 12; } if (IS_8x8DCT(left_type[LTOP])) { nnz_cache[3 + 8 * 1] = nnz_cache[3 + 8 * 2] = (VAR_0->cbp_table[left_xy[LTOP]] & 0x2000) >> 12; } if (IS_8x8DCT(left_type[LBOT])) { nnz_cache[3 + 8 * 3] = nnz_cache[3 + 8 * 4] = (VAR_0->cbp_table[left_xy[LBOT]] & 0x8000) >> 12; } if (IS_8x8DCT(VAR_2)) { nnz_cache[scan8[0]] = nnz_cache[scan8[1]] = nnz_cache[scan8[2]] = nnz_cache[scan8[3]] = (VAR_1->cbp & 0x1000) >> 12; nnz_cache[scan8[0 + 4]] = nnz_cache[scan8[1 + 4]] = nnz_cache[scan8[2 + 4]] = nnz_cache[scan8[3 + 4]] = (VAR_1->cbp & 0x2000) >> 12; nnz_cache[scan8[0 + 8]] = nnz_cache[scan8[1 + 8]] = nnz_cache[scan8[2 + 8]] = nnz_cache[scan8[3 + 8]] = (VAR_1->cbp & 0x4000) >> 12; nnz_cache[scan8[0 + 12]] = nnz_cache[scan8[1 + 12]] = nnz_cache[scan8[2 + 12]] = nnz_cache[scan8[3 + 12]] = (VAR_1->cbp & 0x8000) >> 12; } } return 0; }
[ "static int FUNC_0(H264Context *VAR_0, H264SliceContext *VAR_1, int VAR_2)\n{", "const int VAR_3 = VAR_0->VAR_3;", "int VAR_4, left_xy[LEFT_MBS];", "int VAR_5, left_type[LEFT_MBS];", "uint8_t *nnz;", "uint8_t *nnz_cache;", "VAR_4 = VAR_3 - (VAR_0->mb_stride << MB_FIELD(VAR_0));", "left_xy[LBOT] = left_xy[LTOP] = VAR_3 - 1;", "if (FRAME_MBAFF(VAR_0)) {", "const int VAR_6 = IS_INTERLACED(VAR_0->cur_pic.VAR_2[VAR_3 - 1]);", "const int VAR_7 = IS_INTERLACED(VAR_2);", "if (VAR_0->mb_y & 1) {", "if (VAR_6 != VAR_7)\nleft_xy[LTOP] -= VAR_0->mb_stride;", "} else {", "if (VAR_7)\nVAR_4 += VAR_0->mb_stride &\n(((VAR_0->cur_pic.VAR_2[VAR_4] >> 7) & 1) - 1);", "if (VAR_6 != VAR_7)\nleft_xy[LBOT] += VAR_0->mb_stride;", "}", "}", "VAR_1->top_mb_xy = VAR_4;", "VAR_1->left_mb_xy[LTOP] = left_xy[LTOP];", "VAR_1->left_mb_xy[LBOT] = left_xy[LBOT];", "{", "int VAR_8 = VAR_1->VAR_8;", "int VAR_9 = VAR_0->cur_pic.qscale_table[VAR_3];", "if (VAR_9 <= VAR_8 &&\n(left_xy[LTOP] < 0 ||\n((VAR_9 + VAR_0->cur_pic.qscale_table[left_xy[LTOP]] + 1) >> 1) <= VAR_8) &&\n(VAR_4 < 0 ||\n((VAR_9 + VAR_0->cur_pic.qscale_table[VAR_4] + 1) >> 1) <= VAR_8)) {", "if (!FRAME_MBAFF(VAR_0))\nreturn 1;", "if ((left_xy[LTOP] < 0 ||\n((VAR_9 + VAR_0->cur_pic.qscale_table[left_xy[LBOT]] + 1) >> 1) <= VAR_8) &&\n(VAR_4 < VAR_0->mb_stride ||\n((VAR_9 + VAR_0->cur_pic.qscale_table[VAR_4 - VAR_0->mb_stride] + 1) >> 1) <= VAR_8))\nreturn 1;", "}", "}", "VAR_5 = VAR_0->cur_pic.VAR_2[VAR_4];", "left_type[LTOP] = VAR_0->cur_pic.VAR_2[left_xy[LTOP]];", "left_type[LBOT] = VAR_0->cur_pic.VAR_2[left_xy[LBOT]];", "if (VAR_0->deblocking_filter == 2) {", "if (VAR_0->slice_table[VAR_4] != VAR_1->slice_num)\nVAR_5 = 0;", "if (VAR_0->slice_table[left_xy[LBOT]] != VAR_1->slice_num)\nleft_type[LTOP] = left_type[LBOT] = 0;", "} else {", "if (VAR_0->slice_table[VAR_4] == 0xFFFF)\nVAR_5 = 0;", "if (VAR_0->slice_table[left_xy[LBOT]] == 0xFFFF)\nleft_type[LTOP] = left_type[LBOT] = 0;", "}", "VAR_1->VAR_5 = VAR_5;", "VAR_1->left_type[LTOP] = left_type[LTOP];", "VAR_1->left_type[LBOT] = left_type[LBOT];", "if (IS_INTRA(VAR_2))\nreturn 0;", "fill_filter_caches_inter(VAR_0, VAR_1, VAR_2, VAR_4, left_xy,\nVAR_5, left_type, VAR_3, 0);", "if (VAR_1->list_count == 2)\nfill_filter_caches_inter(VAR_0, VAR_1, VAR_2, VAR_4, left_xy,\nVAR_5, left_type, VAR_3, 1);", "nnz = VAR_0->non_zero_count[VAR_3];", "nnz_cache = VAR_1->non_zero_count_cache;", "AV_COPY32(&nnz_cache[4 + 8 * 1], &nnz[0]);", "AV_COPY32(&nnz_cache[4 + 8 * 2], &nnz[4]);", "AV_COPY32(&nnz_cache[4 + 8 * 3], &nnz[8]);", "AV_COPY32(&nnz_cache[4 + 8 * 4], &nnz[12]);", "VAR_1->cbp = VAR_0->cbp_table[VAR_3];", "if (VAR_5) {", "nnz = VAR_0->non_zero_count[VAR_4];", "AV_COPY32(&nnz_cache[4 + 8 * 0], &nnz[3 * 4]);", "}", "if (left_type[LTOP]) {", "nnz = VAR_0->non_zero_count[left_xy[LTOP]];", "nnz_cache[3 + 8 * 1] = nnz[3 + 0 * 4];", "nnz_cache[3 + 8 * 2] = nnz[3 + 1 * 4];", "nnz_cache[3 + 8 * 3] = nnz[3 + 2 * 4];", "nnz_cache[3 + 8 * 4] = nnz[3 + 3 * 4];", "}", "if (!CABAC(VAR_0) && VAR_0->pps.transform_8x8_mode) {", "if (IS_8x8DCT(VAR_5)) {", "nnz_cache[4 + 8 * 0] =\nnnz_cache[5 + 8 * 0] = (VAR_0->cbp_table[VAR_4] & 0x4000) >> 12;", "nnz_cache[6 + 8 * 0] =\nnnz_cache[7 + 8 * 0] = (VAR_0->cbp_table[VAR_4] & 0x8000) >> 12;", "}", "if (IS_8x8DCT(left_type[LTOP])) {", "nnz_cache[3 + 8 * 1] =\nnnz_cache[3 + 8 * 2] = (VAR_0->cbp_table[left_xy[LTOP]] & 0x2000) >> 12;", "}", "if (IS_8x8DCT(left_type[LBOT])) {", "nnz_cache[3 + 8 * 3] =\nnnz_cache[3 + 8 * 4] = (VAR_0->cbp_table[left_xy[LBOT]] & 0x8000) >> 12;", "}", "if (IS_8x8DCT(VAR_2)) {", "nnz_cache[scan8[0]] =\nnnz_cache[scan8[1]] =\nnnz_cache[scan8[2]] =\nnnz_cache[scan8[3]] = (VAR_1->cbp & 0x1000) >> 12;", "nnz_cache[scan8[0 + 4]] =\nnnz_cache[scan8[1 + 4]] =\nnnz_cache[scan8[2 + 4]] =\nnnz_cache[scan8[3 + 4]] = (VAR_1->cbp & 0x2000) >> 12;", "nnz_cache[scan8[0 + 8]] =\nnnz_cache[scan8[1 + 8]] =\nnnz_cache[scan8[2 + 8]] =\nnnz_cache[scan8[3 + 8]] = (VAR_1->cbp & 0x4000) >> 12;", "nnz_cache[scan8[0 + 12]] =\nnnz_cache[scan8[1 + 12]] =\nnnz_cache[scan8[2 + 12]] =\nnnz_cache[scan8[3 + 12]] = (VAR_1->cbp & 0x8000) >> 12;", "}", "}", "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 ], [ 17 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43, 45, 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 73 ], [ 75 ], [ 77, 79, 81, 83, 85 ], [ 87, 89 ], [ 91, 93, 95, 97, 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119, 121 ], [ 123 ], [ 125, 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143, 145 ], [ 149, 151 ], [ 153, 155, 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 207 ], [ 209 ], [ 211, 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 223, 225 ], [ 227 ], [ 229 ], [ 231, 233 ], [ 235 ], [ 239 ], [ 241, 243, 245, 247 ], [ 251, 253, 255, 257 ], [ 261, 263, 265, 267 ], [ 271, 273, 275, 277 ], [ 279 ], [ 281 ], [ 285 ], [ 287 ] ]
11,554
av_cold void ff_init_lls_x86(LLSModel *m) { int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_SSE2(cpu_flags)) { m->update_lls = ff_update_lls_sse2; if (m->indep_count >= 4) m->evaluate_lls = ff_evaluate_lls_sse2; } if (EXTERNAL_AVX(cpu_flags)) { m->update_lls = ff_update_lls_avx; } }
false
FFmpeg
d68c05380cebf563915412182643a8be04ef890b
av_cold void ff_init_lls_x86(LLSModel *m) { int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_SSE2(cpu_flags)) { m->update_lls = ff_update_lls_sse2; if (m->indep_count >= 4) m->evaluate_lls = ff_evaluate_lls_sse2; } if (EXTERNAL_AVX(cpu_flags)) { m->update_lls = ff_update_lls_avx; } }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(LLSModel *m) { int VAR_0 = av_get_cpu_flags(); if (EXTERNAL_SSE2(VAR_0)) { m->update_lls = ff_update_lls_sse2; if (m->indep_count >= 4) m->evaluate_lls = ff_evaluate_lls_sse2; } if (EXTERNAL_AVX(VAR_0)) { m->update_lls = ff_update_lls_avx; } }
[ "av_cold void FUNC_0(LLSModel *m)\n{", "int VAR_0 = av_get_cpu_flags();", "if (EXTERNAL_SSE2(VAR_0)) {", "m->update_lls = ff_update_lls_sse2;", "if (m->indep_count >= 4)\nm->evaluate_lls = ff_evaluate_lls_sse2;", "}", "if (EXTERNAL_AVX(VAR_0)) {", "m->update_lls = ff_update_lls_avx;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
11,555
static inline void RENAME(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW) { #ifdef HAVE_MMX if (c->flags & SWS_ACCURATE_RND){ if (uDest){ YSCALEYUV2YV12X_ACCURATE( 0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X_ACCURATE(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } YSCALEYUV2YV12X_ACCURATE(0, LUM_MMX_FILTER_OFFSET, dest, dstW) }else{ if (uDest){ YSCALEYUV2YV12X( 0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } YSCALEYUV2YV12X(0, LUM_MMX_FILTER_OFFSET, dest, dstW) } #else #ifdef HAVE_ALTIVEC yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, uDest, vDest, dstW, chrDstW); #else //HAVE_ALTIVEC yuv2yuvXinC(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, uDest, vDest, dstW, chrDstW); #endif //!HAVE_ALTIVEC #endif /* HAVE_MMX */ }
true
FFmpeg
8b2fce0d3f5a56c40c28899c9237210ca8f9cf75
static inline void RENAME(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW) { #ifdef HAVE_MMX if (c->flags & SWS_ACCURATE_RND){ if (uDest){ YSCALEYUV2YV12X_ACCURATE( 0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X_ACCURATE(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } YSCALEYUV2YV12X_ACCURATE(0, LUM_MMX_FILTER_OFFSET, dest, dstW) }else{ if (uDest){ YSCALEYUV2YV12X( 0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } YSCALEYUV2YV12X(0, LUM_MMX_FILTER_OFFSET, dest, dstW) } #else #ifdef HAVE_ALTIVEC yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, uDest, vDest, dstW, chrDstW); #else yuv2yuvXinC(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, uDest, vDest, dstW, chrDstW); #endif #endif }
{ "code": [ " YSCALEYUV2YV12X_ACCURATE( 0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW)", " YSCALEYUV2YV12X_ACCURATE(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW)", " YSCALEYUV2YV12X_ACCURATE(0, LUM_MMX_FILTER_OFFSET, dest, dstW)", " YSCALEYUV2YV12X( 0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW)", " YSCALEYUV2YV12X(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW)", " YSCALEYUV2YV12X(0, LUM_MMX_FILTER_OFFSET, dest, dstW)" ], "line_no": [ 15, 17, 23, 29, 31, 37 ] }
static inline void FUNC_0(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW) { #ifdef HAVE_MMX if (c->flags & SWS_ACCURATE_RND){ if (uDest){ YSCALEYUV2YV12X_ACCURATE( 0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X_ACCURATE(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } YSCALEYUV2YV12X_ACCURATE(0, LUM_MMX_FILTER_OFFSET, dest, dstW) }else{ if (uDest){ YSCALEYUV2YV12X( 0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } YSCALEYUV2YV12X(0, LUM_MMX_FILTER_OFFSET, dest, dstW) } #else #ifdef HAVE_ALTIVEC yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, uDest, vDest, dstW, chrDstW); #else yuv2yuvXinC(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, uDest, vDest, dstW, chrDstW); #endif #endif }
[ "static inline void FUNC_0(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,\nint16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,\nuint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW)\n{", "#ifdef HAVE_MMX\nif (c->flags & SWS_ACCURATE_RND){", "if (uDest){", "YSCALEYUV2YV12X_ACCURATE( 0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW)\nYSCALEYUV2YV12X_ACCURATE(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW)\n}", "YSCALEYUV2YV12X_ACCURATE(0, LUM_MMX_FILTER_OFFSET, dest, dstW)\n}else{", "if (uDest){", "YSCALEYUV2YV12X( 0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW)\nYSCALEYUV2YV12X(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW)\n}", "YSCALEYUV2YV12X(0, LUM_MMX_FILTER_OFFSET, dest, dstW)\n}", "#else\n#ifdef HAVE_ALTIVEC\nyuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize,\nchrFilter, chrSrc, chrFilterSize,\ndest, uDest, vDest, dstW, chrDstW);", "#else\nyuv2yuvXinC(lumFilter, lumSrc, lumFilterSize,\nchrFilter, chrSrc, chrFilterSize,\ndest, uDest, vDest, dstW, chrDstW);", "#endif\n#endif\n}" ]
[ 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 13 ], [ 15, 17, 19 ], [ 23, 25 ], [ 27 ], [ 29, 31, 33 ], [ 37, 39 ], [ 41, 43, 45, 47, 49 ], [ 51, 53, 55, 57 ], [ 59, 61, 63 ] ]
11,556
static void vmxnet3_update_rx_mode(VMXNET3State *s) { s->rx_mode = VMXNET3_READ_DRV_SHARED32(s->drv_shmem, devRead.rxFilterConf.rxMode); VMW_CFPRN("RX mode: 0x%08X", s->rx_mode); }
true
qemu
c508277335e3b6b20cf18e6ea3a35c1fa835c64a
static void vmxnet3_update_rx_mode(VMXNET3State *s) { s->rx_mode = VMXNET3_READ_DRV_SHARED32(s->drv_shmem, devRead.rxFilterConf.rxMode); VMW_CFPRN("RX mode: 0x%08X", s->rx_mode); }
{ "code": [ " s->rx_mode = VMXNET3_READ_DRV_SHARED32(s->drv_shmem," ], "line_no": [ 5 ] }
static void FUNC_0(VMXNET3State *VAR_0) { VAR_0->rx_mode = VMXNET3_READ_DRV_SHARED32(VAR_0->drv_shmem, devRead.rxFilterConf.rxMode); VMW_CFPRN("RX mode: 0x%08X", VAR_0->rx_mode); }
[ "static void FUNC_0(VMXNET3State *VAR_0)\n{", "VAR_0->rx_mode = VMXNET3_READ_DRV_SHARED32(VAR_0->drv_shmem,\ndevRead.rxFilterConf.rxMode);", "VMW_CFPRN(\"RX mode: 0x%08X\", VAR_0->rx_mode);", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ] ]
11,557
static int qemu_peek_byte(QEMUFile *f) { if (f->is_write) { abort(); } if (f->buf_index >= f->buf_size) { qemu_fill_buffer(f); if (f->buf_index >= f->buf_size) { return 0; } } return f->buf[f->buf_index]; }
true
qemu
c63807244fb55071675907460a0ecf228c1766c8
static int qemu_peek_byte(QEMUFile *f) { if (f->is_write) { abort(); } if (f->buf_index >= f->buf_size) { qemu_fill_buffer(f); if (f->buf_index >= f->buf_size) { return 0; } } return f->buf[f->buf_index]; }
{ "code": [ "static int qemu_peek_byte(QEMUFile *f)", " if (f->buf_index >= f->buf_size) {", " if (f->buf_index >= f->buf_size) {", " return f->buf[f->buf_index];" ], "line_no": [ 1, 13, 17, 25 ] }
static int FUNC_0(QEMUFile *VAR_0) { if (VAR_0->is_write) { abort(); } if (VAR_0->buf_index >= VAR_0->buf_size) { qemu_fill_buffer(VAR_0); if (VAR_0->buf_index >= VAR_0->buf_size) { return 0; } } return VAR_0->buf[VAR_0->buf_index]; }
[ "static int FUNC_0(QEMUFile *VAR_0)\n{", "if (VAR_0->is_write) {", "abort();", "}", "if (VAR_0->buf_index >= VAR_0->buf_size) {", "qemu_fill_buffer(VAR_0);", "if (VAR_0->buf_index >= VAR_0->buf_size) {", "return 0;", "}", "}", "return VAR_0->buf[VAR_0->buf_index];", "}" ]
[ 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
11,558
static int virtio_ccw_set_vqs(SubchDev *sch, uint64_t addr, uint32_t align, uint16_t index, uint16_t num) { VirtIODevice *vdev = virtio_ccw_get_vdev(sch); if (index > VIRTIO_PCI_QUEUE_MAX) { return -EINVAL; } /* Current code in virtio.c relies on 4K alignment. */ if (addr && (align != 4096)) { return -EINVAL; } if (!vdev) { return -EINVAL; } virtio_queue_set_addr(vdev, index, addr); if (!addr) { virtio_queue_set_vector(vdev, index, 0); } else { /* Fail if we don't have a big enough queue. */ /* TODO: Add interface to handle vring.num changing */ if (virtio_queue_get_num(vdev, index) > num) { return -EINVAL; } virtio_queue_set_vector(vdev, index, index); } /* tell notify handler in case of config change */ vdev->config_vector = VIRTIO_PCI_QUEUE_MAX; return 0; }
true
qemu
590fe5722b522e492a9c78adadae4def35b137dd
static int virtio_ccw_set_vqs(SubchDev *sch, uint64_t addr, uint32_t align, uint16_t index, uint16_t num) { VirtIODevice *vdev = virtio_ccw_get_vdev(sch); if (index > VIRTIO_PCI_QUEUE_MAX) { return -EINVAL; } if (addr && (align != 4096)) { return -EINVAL; } if (!vdev) { return -EINVAL; } virtio_queue_set_addr(vdev, index, addr); if (!addr) { virtio_queue_set_vector(vdev, index, 0); } else { if (virtio_queue_get_num(vdev, index) > num) { return -EINVAL; } virtio_queue_set_vector(vdev, index, index); } vdev->config_vector = VIRTIO_PCI_QUEUE_MAX; return 0; }
{ "code": [ " if (index > VIRTIO_PCI_QUEUE_MAX) {" ], "line_no": [ 11 ] }
static int FUNC_0(SubchDev *VAR_0, uint64_t VAR_1, uint32_t VAR_2, uint16_t VAR_3, uint16_t VAR_4) { VirtIODevice *vdev = virtio_ccw_get_vdev(VAR_0); if (VAR_3 > VIRTIO_PCI_QUEUE_MAX) { return -EINVAL; } if (VAR_1 && (VAR_2 != 4096)) { return -EINVAL; } if (!vdev) { return -EINVAL; } virtio_queue_set_addr(vdev, VAR_3, VAR_1); if (!VAR_1) { virtio_queue_set_vector(vdev, VAR_3, 0); } else { if (virtio_queue_get_num(vdev, VAR_3) > VAR_4) { return -EINVAL; } virtio_queue_set_vector(vdev, VAR_3, VAR_3); } vdev->config_vector = VIRTIO_PCI_QUEUE_MAX; return 0; }
[ "static int FUNC_0(SubchDev *VAR_0, uint64_t VAR_1, uint32_t VAR_2,\nuint16_t VAR_3, uint16_t VAR_4)\n{", "VirtIODevice *vdev = virtio_ccw_get_vdev(VAR_0);", "if (VAR_3 > VIRTIO_PCI_QUEUE_MAX) {", "return -EINVAL;", "}", "if (VAR_1 && (VAR_2 != 4096)) {", "return -EINVAL;", "}", "if (!vdev) {", "return -EINVAL;", "}", "virtio_queue_set_addr(vdev, VAR_3, VAR_1);", "if (!VAR_1) {", "virtio_queue_set_vector(vdev, VAR_3, 0);", "} else {", "if (virtio_queue_get_num(vdev, VAR_3) > VAR_4) {", "return -EINVAL;", "}", "virtio_queue_set_vector(vdev, VAR_3, VAR_3);", "}", "vdev->config_vector = VIRTIO_PCI_QUEUE_MAX;", "return 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, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ] ]
11,559
static bool cuda_cmd_set_time(CUDAState *s, const uint8_t *in_data, int in_len, uint8_t *out_data, int *out_len) { uint32_t ti; if (in_len != 4) { return false; } ti = (((uint32_t)in_data[1]) << 24) + (((uint32_t)in_data[2]) << 16) + (((uint32_t)in_data[3]) << 8) + in_data[4]; s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / NANOSECONDS_PER_SECOND); return true; }
true
qemu
ed3d807b0a577c4f825b25f3281fe54ce89202db
static bool cuda_cmd_set_time(CUDAState *s, const uint8_t *in_data, int in_len, uint8_t *out_data, int *out_len) { uint32_t ti; if (in_len != 4) { return false; } ti = (((uint32_t)in_data[1]) << 24) + (((uint32_t)in_data[2]) << 16) + (((uint32_t)in_data[3]) << 8) + in_data[4]; s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / NANOSECONDS_PER_SECOND); return true; }
{ "code": [ " ti = (((uint32_t)in_data[1]) << 24) + (((uint32_t)in_data[2]) << 16)", " + (((uint32_t)in_data[3]) << 8) + in_data[4];" ], "line_no": [ 21, 23 ] }
static bool FUNC_0(CUDAState *s, const uint8_t *in_data, int in_len, uint8_t *out_data, int *out_len) { uint32_t ti; if (in_len != 4) { return false; } ti = (((uint32_t)in_data[1]) << 24) + (((uint32_t)in_data[2]) << 16) + (((uint32_t)in_data[3]) << 8) + in_data[4]; s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / NANOSECONDS_PER_SECOND); return true; }
[ "static bool FUNC_0(CUDAState *s,\nconst uint8_t *in_data, int in_len,\nuint8_t *out_data, int *out_len)\n{", "uint32_t ti;", "if (in_len != 4) {", "return false;", "}", "ti = (((uint32_t)in_data[1]) << 24) + (((uint32_t)in_data[2]) << 16)\n+ (((uint32_t)in_data[3]) << 8) + in_data[4];", "s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)\n/ NANOSECONDS_PER_SECOND);", "return true;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25, 27 ], [ 29 ], [ 31 ] ]
11,560
static void vscsi_send_request_sense(VSCSIState *s, vscsi_req *req) { SCSIDevice *sdev = req->sdev; uint8_t *cdb = req->iu.srp.cmd.cdb; int n; cdb[0] = 3; cdb[1] = 0; cdb[2] = 0; cdb[3] = 0; cdb[4] = 96; cdb[5] = 0; req->sensing = 1; n = sdev->info->send_command(sdev, req->qtag, cdb, req->lun); dprintf("VSCSI: Queued request sense tag 0x%x\n", req->qtag); if (n < 0) { fprintf(stderr, "VSCSI: REQUEST_SENSE wants write data !?!?!?\n"); sdev->info->cancel_io(sdev, req->qtag); vscsi_makeup_sense(s, req, HARDWARE_ERROR, 0, 0); vscsi_send_rsp(s, req, CHECK_CONDITION, 0, 0); vscsi_put_req(s, req); return; } else if (n == 0) { return; } sdev->info->read_data(sdev, req->qtag); }
true
qemu
5c6c0e513600ba57c3e73b7151d3c0664438f7b5
static void vscsi_send_request_sense(VSCSIState *s, vscsi_req *req) { SCSIDevice *sdev = req->sdev; uint8_t *cdb = req->iu.srp.cmd.cdb; int n; cdb[0] = 3; cdb[1] = 0; cdb[2] = 0; cdb[3] = 0; cdb[4] = 96; cdb[5] = 0; req->sensing = 1; n = sdev->info->send_command(sdev, req->qtag, cdb, req->lun); dprintf("VSCSI: Queued request sense tag 0x%x\n", req->qtag); if (n < 0) { fprintf(stderr, "VSCSI: REQUEST_SENSE wants write data !?!?!?\n"); sdev->info->cancel_io(sdev, req->qtag); vscsi_makeup_sense(s, req, HARDWARE_ERROR, 0, 0); vscsi_send_rsp(s, req, CHECK_CONDITION, 0, 0); vscsi_put_req(s, req); return; } else if (n == 0) { return; } sdev->info->read_data(sdev, req->qtag); }
{ "code": [ " n = sdev->info->send_command(sdev, req->qtag, cdb, req->lun);", " sdev->info->cancel_io(sdev, req->qtag);", " sdev->info->read_data(sdev, req->qtag);", " sdev->info->cancel_io(sdev, req->qtag);" ], "line_no": [ 27, 35, 51, 35 ] }
static void FUNC_0(VSCSIState *VAR_0, vscsi_req *VAR_1) { SCSIDevice *sdev = VAR_1->sdev; uint8_t *cdb = VAR_1->iu.srp.cmd.cdb; int VAR_2; cdb[0] = 3; cdb[1] = 0; cdb[2] = 0; cdb[3] = 0; cdb[4] = 96; cdb[5] = 0; VAR_1->sensing = 1; VAR_2 = sdev->info->send_command(sdev, VAR_1->qtag, cdb, VAR_1->lun); dprintf("VSCSI: Queued request sense tag 0x%x\VAR_2", VAR_1->qtag); if (VAR_2 < 0) { fprintf(stderr, "VSCSI: REQUEST_SENSE wants write data !?!?!?\VAR_2"); sdev->info->cancel_io(sdev, VAR_1->qtag); vscsi_makeup_sense(VAR_0, VAR_1, HARDWARE_ERROR, 0, 0); vscsi_send_rsp(VAR_0, VAR_1, CHECK_CONDITION, 0, 0); vscsi_put_req(VAR_0, VAR_1); return; } else if (VAR_2 == 0) { return; } sdev->info->read_data(sdev, VAR_1->qtag); }
[ "static void FUNC_0(VSCSIState *VAR_0, vscsi_req *VAR_1)\n{", "SCSIDevice *sdev = VAR_1->sdev;", "uint8_t *cdb = VAR_1->iu.srp.cmd.cdb;", "int VAR_2;", "cdb[0] = 3;", "cdb[1] = 0;", "cdb[2] = 0;", "cdb[3] = 0;", "cdb[4] = 96;", "cdb[5] = 0;", "VAR_1->sensing = 1;", "VAR_2 = sdev->info->send_command(sdev, VAR_1->qtag, cdb, VAR_1->lun);", "dprintf(\"VSCSI: Queued request sense tag 0x%x\\VAR_2\", VAR_1->qtag);", "if (VAR_2 < 0) {", "fprintf(stderr, \"VSCSI: REQUEST_SENSE wants write data !?!?!?\\VAR_2\");", "sdev->info->cancel_io(sdev, VAR_1->qtag);", "vscsi_makeup_sense(VAR_0, VAR_1, HARDWARE_ERROR, 0, 0);", "vscsi_send_rsp(VAR_0, VAR_1, CHECK_CONDITION, 0, 0);", "vscsi_put_req(VAR_0, VAR_1);", "return;", "} else if (VAR_2 == 0) {", "return;", "}", "sdev->info->read_data(sdev, VAR_1->qtag);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
11,561
static inline void RENAME(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride) { //FIXME interpolate chroma RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2); }
true
FFmpeg
6e42e6c4b410dbef8b593c2d796a5dad95f89ee4
static inline void RENAME(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride) { RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2); }
{ "code": [ "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height,", "\tlong lumStride, long chromStride, long dstStride)", "\tlong width, long height,", "\tlong width, long height,", "\tlong lumStride, long chromStride, long dstStride)", "\tRENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);", "\tlong width, long height,", "\tlong lumStride, long chromStride, long dstStride)", "\tlong width, long height,", "\tlong width, long height,", "\tlong width, long height," ], "line_no": [ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 3, 5, 11, 3, 5, 3, 3, 3 ] }
static inline void FUNC_0(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride) { FUNC_0(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2); }
[ "static inline void FUNC_0(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,\nlong width, long height,\nlong lumStride, long chromStride, long dstStride)\n{", "FUNC_0(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3, 5, 7 ], [ 11 ], [ 13 ] ]
11,562
static uint64_t pmsav5_data_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) { return simple_mpu_ap_bits(env->cp15.c5_data); }
true
qemu
7e09797c299712cafa7bc05dd57c1b13afcc6039
static uint64_t pmsav5_data_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) { return simple_mpu_ap_bits(env->cp15.c5_data); }
{ "code": [ " return simple_mpu_ap_bits(env->cp15.c5_data);" ], "line_no": [ 5 ] }
static uint64_t FUNC_0(CPUARMState *env, const ARMCPRegInfo *ri) { return simple_mpu_ap_bits(env->cp15.c5_data); }
[ "static uint64_t FUNC_0(CPUARMState *env, const ARMCPRegInfo *ri)\n{", "return simple_mpu_ap_bits(env->cp15.c5_data);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
11,563
static void flat(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset, int column) { const int plane = s->desc->comp[component].plane; const int mirror = s->mirror; const int c0_linesize = in->linesize[ plane + 0 ]; const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; const int d0_linesize = out->linesize[ plane + 0 ]; const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; const int max = 255 - intensity; const int src_h = in->height; const int src_w = in->width; int x, y; if (column) { const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); for (x = 0; x < src_w; x++) { const uint8_t *c0_data = in->data[plane + 0]; const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d0_data = out->data[plane] + offset * d0_linesize; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset * d1_linesize; uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data); uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); for (y = 0; y < src_h; y++) { const int c0 = c0_data[x] + 256; const int c1 = FFABS(c1_data[x] - 128) + FFABS(c2_data[x] - 128); uint8_t *target; int p; target = d0 + x + d0_signed_linesize * c0; update(target, max, intensity); for (p = c0 - c1; p < c0 + c1; p++) { target = d1 + x + d1_signed_linesize * p; update(target, max, 1); } c0_data += c0_linesize; c1_data += c1_linesize; c2_data += c2_linesize; d0_data += d0_linesize; d1_data += d1_linesize; } } } else { const uint8_t *c0_data = in->data[plane]; const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d0_data = out->data[plane] + offset; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset; if (mirror) { d0_data += s->size - 1; d1_data += s->size - 1; } for (y = 0; y < src_h; y++) { for (x = 0; x < src_w; x++) { int c0 = c0_data[x] + 256; const int c1 = FFABS(c1_data[x] - 128) + FFABS(c2_data[x] - 128); uint8_t *target; int p; if (mirror) target = d0_data - c0; else target = d0_data + c0; update(target, max, intensity); for (p = c0 - c1; p < c0 + c1; p++) { if (mirror) target = d1_data - p; else target = d1_data + p; update(target, max, 1); } } c0_data += c0_linesize; c1_data += c1_linesize; c2_data += c2_linesize; d0_data += d0_linesize; d1_data += d1_linesize; } } envelope(s, out, plane, plane); envelope(s, out, plane, (plane + 1) % s->ncomp); }
false
FFmpeg
5b349c8d7cc5dd26b3fbbce6e3883ce02861eeb7
static void flat(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset, int column) { const int plane = s->desc->comp[component].plane; const int mirror = s->mirror; const int c0_linesize = in->linesize[ plane + 0 ]; const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; const int d0_linesize = out->linesize[ plane + 0 ]; const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; const int max = 255 - intensity; const int src_h = in->height; const int src_w = in->width; int x, y; if (column) { const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); for (x = 0; x < src_w; x++) { const uint8_t *c0_data = in->data[plane + 0]; const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d0_data = out->data[plane] + offset * d0_linesize; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset * d1_linesize; uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data); uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); for (y = 0; y < src_h; y++) { const int c0 = c0_data[x] + 256; const int c1 = FFABS(c1_data[x] - 128) + FFABS(c2_data[x] - 128); uint8_t *target; int p; target = d0 + x + d0_signed_linesize * c0; update(target, max, intensity); for (p = c0 - c1; p < c0 + c1; p++) { target = d1 + x + d1_signed_linesize * p; update(target, max, 1); } c0_data += c0_linesize; c1_data += c1_linesize; c2_data += c2_linesize; d0_data += d0_linesize; d1_data += d1_linesize; } } } else { const uint8_t *c0_data = in->data[plane]; const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d0_data = out->data[plane] + offset; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset; if (mirror) { d0_data += s->size - 1; d1_data += s->size - 1; } for (y = 0; y < src_h; y++) { for (x = 0; x < src_w; x++) { int c0 = c0_data[x] + 256; const int c1 = FFABS(c1_data[x] - 128) + FFABS(c2_data[x] - 128); uint8_t *target; int p; if (mirror) target = d0_data - c0; else target = d0_data + c0; update(target, max, intensity); for (p = c0 - c1; p < c0 + c1; p++) { if (mirror) target = d1_data - p; else target = d1_data + p; update(target, max, 1); } } c0_data += c0_linesize; c1_data += c1_linesize; c2_data += c2_linesize; d0_data += d0_linesize; d1_data += d1_linesize; } } envelope(s, out, plane, plane); envelope(s, out, plane, (plane + 1) % s->ncomp); }
{ "code": [], "line_no": [] }
static void FUNC_0(WaveformContext *VAR_0, AVFrame *VAR_1, AVFrame *VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6) { const int VAR_7 = VAR_0->desc->comp[VAR_3].VAR_7; const int VAR_8 = VAR_0->VAR_8; const int VAR_9 = VAR_1->linesize[ VAR_7 + 0 ]; const int VAR_10 = VAR_1->linesize[(VAR_7 + 1) % VAR_0->ncomp]; const int VAR_11 = VAR_1->linesize[(VAR_7 + 2) % VAR_0->ncomp]; const int VAR_12 = VAR_2->linesize[ VAR_7 + 0 ]; const int VAR_13 = VAR_2->linesize[(VAR_7 + 1) % VAR_0->ncomp]; const int VAR_14 = 255 - VAR_4; const int VAR_15 = VAR_1->height; const int VAR_16 = VAR_1->width; int VAR_17, VAR_18; if (VAR_6) { const int VAR_19 = VAR_12 * (VAR_8 == 1 ? -1 : 1); const int VAR_20 = VAR_13 * (VAR_8 == 1 ? -1 : 1); for (VAR_17 = 0; VAR_17 < VAR_16; VAR_17++) { const uint8_t *VAR_27 = VAR_1->data[VAR_7 + 0]; const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp]; const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp]; uint8_t *d0_data = VAR_2->data[VAR_7] + VAR_5 * VAR_12; uint8_t *d1_data = VAR_2->data[(VAR_7 + 1) % VAR_0->ncomp] + VAR_5 * VAR_13; uint8_t * const d0_bottom_line = d0_data + VAR_12 * (VAR_0->size - 1); uint8_t * const d0 = (VAR_8 ? d0_bottom_line : d0_data); uint8_t * const d1_bottom_line = d1_data + VAR_13 * (VAR_0->size - 1); uint8_t * const d1 = (VAR_8 ? d1_bottom_line : d1_data); for (VAR_18 = 0; VAR_18 < VAR_15; VAR_18++) { const int VAR_27 = VAR_27[VAR_17] + 256; const int VAR_27 = FFABS(VAR_27[VAR_17] - 128) + FFABS(VAR_27[VAR_17] - 128); uint8_t *target; int VAR_27; target = d0 + VAR_17 + VAR_19 * VAR_27; update(target, VAR_14, VAR_4); for (VAR_27 = VAR_27 - VAR_27; VAR_27 < VAR_27 + VAR_27; VAR_27++) { target = d1 + VAR_17 + VAR_20 * VAR_27; update(target, VAR_14, 1); } VAR_27 += VAR_9; VAR_27 += VAR_10; VAR_27 += VAR_11; d0_data += VAR_12; d1_data += VAR_13; } } } else { const uint8_t *VAR_27 = VAR_1->data[VAR_7]; const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp]; const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp]; uint8_t *d0_data = VAR_2->data[VAR_7] + VAR_5; uint8_t *d1_data = VAR_2->data[(VAR_7 + 1) % VAR_0->ncomp] + VAR_5; if (VAR_8) { d0_data += VAR_0->size - 1; d1_data += VAR_0->size - 1; } for (VAR_18 = 0; VAR_18 < VAR_15; VAR_18++) { for (VAR_17 = 0; VAR_17 < VAR_16; VAR_17++) { int VAR_27 = VAR_27[VAR_17] + 256; const int VAR_27 = FFABS(VAR_27[VAR_17] - 128) + FFABS(VAR_27[VAR_17] - 128); uint8_t *target; int VAR_27; if (VAR_8) target = d0_data - VAR_27; else target = d0_data + VAR_27; update(target, VAR_14, VAR_4); for (VAR_27 = VAR_27 - VAR_27; VAR_27 < VAR_27 + VAR_27; VAR_27++) { if (VAR_8) target = d1_data - VAR_27; else target = d1_data + VAR_27; update(target, VAR_14, 1); } } VAR_27 += VAR_9; VAR_27 += VAR_10; VAR_27 += VAR_11; d0_data += VAR_12; d1_data += VAR_13; } } envelope(VAR_0, VAR_2, VAR_7, VAR_7); envelope(VAR_0, VAR_2, VAR_7, (VAR_7 + 1) % VAR_0->ncomp); }
[ "static void FUNC_0(WaveformContext *VAR_0, AVFrame *VAR_1, AVFrame *VAR_2,\nint VAR_3, int VAR_4, int VAR_5, int VAR_6)\n{", "const int VAR_7 = VAR_0->desc->comp[VAR_3].VAR_7;", "const int VAR_8 = VAR_0->VAR_8;", "const int VAR_9 = VAR_1->linesize[ VAR_7 + 0 ];", "const int VAR_10 = VAR_1->linesize[(VAR_7 + 1) % VAR_0->ncomp];", "const int VAR_11 = VAR_1->linesize[(VAR_7 + 2) % VAR_0->ncomp];", "const int VAR_12 = VAR_2->linesize[ VAR_7 + 0 ];", "const int VAR_13 = VAR_2->linesize[(VAR_7 + 1) % VAR_0->ncomp];", "const int VAR_14 = 255 - VAR_4;", "const int VAR_15 = VAR_1->height;", "const int VAR_16 = VAR_1->width;", "int VAR_17, VAR_18;", "if (VAR_6) {", "const int VAR_19 = VAR_12 * (VAR_8 == 1 ? -1 : 1);", "const int VAR_20 = VAR_13 * (VAR_8 == 1 ? -1 : 1);", "for (VAR_17 = 0; VAR_17 < VAR_16; VAR_17++) {", "const uint8_t *VAR_27 = VAR_1->data[VAR_7 + 0];", "const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp];", "const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp];", "uint8_t *d0_data = VAR_2->data[VAR_7] + VAR_5 * VAR_12;", "uint8_t *d1_data = VAR_2->data[(VAR_7 + 1) % VAR_0->ncomp] + VAR_5 * VAR_13;", "uint8_t * const d0_bottom_line = d0_data + VAR_12 * (VAR_0->size - 1);", "uint8_t * const d0 = (VAR_8 ? d0_bottom_line : d0_data);", "uint8_t * const d1_bottom_line = d1_data + VAR_13 * (VAR_0->size - 1);", "uint8_t * const d1 = (VAR_8 ? d1_bottom_line : d1_data);", "for (VAR_18 = 0; VAR_18 < VAR_15; VAR_18++) {", "const int VAR_27 = VAR_27[VAR_17] + 256;", "const int VAR_27 = FFABS(VAR_27[VAR_17] - 128) + FFABS(VAR_27[VAR_17] - 128);", "uint8_t *target;", "int VAR_27;", "target = d0 + VAR_17 + VAR_19 * VAR_27;", "update(target, VAR_14, VAR_4);", "for (VAR_27 = VAR_27 - VAR_27; VAR_27 < VAR_27 + VAR_27; VAR_27++) {", "target = d1 + VAR_17 + VAR_20 * VAR_27;", "update(target, VAR_14, 1);", "}", "VAR_27 += VAR_9;", "VAR_27 += VAR_10;", "VAR_27 += VAR_11;", "d0_data += VAR_12;", "d1_data += VAR_13;", "}", "}", "} else {", "const uint8_t *VAR_27 = VAR_1->data[VAR_7];", "const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp];", "const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp];", "uint8_t *d0_data = VAR_2->data[VAR_7] + VAR_5;", "uint8_t *d1_data = VAR_2->data[(VAR_7 + 1) % VAR_0->ncomp] + VAR_5;", "if (VAR_8) {", "d0_data += VAR_0->size - 1;", "d1_data += VAR_0->size - 1;", "}", "for (VAR_18 = 0; VAR_18 < VAR_15; VAR_18++) {", "for (VAR_17 = 0; VAR_17 < VAR_16; VAR_17++) {", "int VAR_27 = VAR_27[VAR_17] + 256;", "const int VAR_27 = FFABS(VAR_27[VAR_17] - 128) + FFABS(VAR_27[VAR_17] - 128);", "uint8_t *target;", "int VAR_27;", "if (VAR_8)\ntarget = d0_data - VAR_27;", "else\ntarget = d0_data + VAR_27;", "update(target, VAR_14, VAR_4);", "for (VAR_27 = VAR_27 - VAR_27; VAR_27 < VAR_27 + VAR_27; VAR_27++) {", "if (VAR_8)\ntarget = d1_data - VAR_27;", "else\ntarget = d1_data + VAR_27;", "update(target, VAR_14, 1);", "}", "}", "VAR_27 += VAR_9;", "VAR_27 += VAR_10;", "VAR_27 += VAR_11;", "d0_data += VAR_12;", "d1_data += VAR_13;", "}", "}", "envelope(VAR_0, VAR_2, VAR_7, VAR_7);", "envelope(VAR_0, VAR_2, VAR_7, (VAR_7 + 1) % VAR_0->ncomp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139, 141 ], [ 143, 145 ], [ 149 ], [ 153 ], [ 155, 157 ], [ 159, 161 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193 ] ]
11,564
av_cold int ff_mpv_common_init(MpegEncContext *s) { int i; int nb_slices = (HAVE_THREADS && s->avctx->active_thread_type & FF_THREAD_SLICE) ? s->avctx->thread_count : 1; if (s->encoding && s->avctx->slices) nb_slices = s->avctx->slices; if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence) s->mb_height = (s->height + 31) / 32 * 2; else s->mb_height = (s->height + 15) / 16; if (s->avctx->pix_fmt == AV_PIX_FMT_NONE) { av_log(s->avctx, AV_LOG_ERROR, "decoding to AV_PIX_FMT_NONE is not supported.\n"); return -1; } if (nb_slices > MAX_THREADS || (nb_slices > s->mb_height && s->mb_height)) { int max_slices; if (s->mb_height) max_slices = FFMIN(MAX_THREADS, s->mb_height); else max_slices = MAX_THREADS; av_log(s->avctx, AV_LOG_WARNING, "too many threads/slices (%d)," " reducing to %d\n", nb_slices, max_slices); nb_slices = max_slices; } if ((s->width || s->height) && av_image_check_size(s->width, s->height, 0, s->avctx)) return -1; dct_init(s); /* set chroma shifts */ avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift); FF_ALLOCZ_OR_GOTO(s->avctx, s->picture, MAX_PICTURE_COUNT * sizeof(Picture), fail); for (i = 0; i < MAX_PICTURE_COUNT; i++) { s->picture[i].f = av_frame_alloc(); if (!s->picture[i].f) goto fail; } memset(&s->next_picture, 0, sizeof(s->next_picture)); memset(&s->last_picture, 0, sizeof(s->last_picture)); memset(&s->current_picture, 0, sizeof(s->current_picture)); memset(&s->new_picture, 0, sizeof(s->new_picture)); s->next_picture.f = av_frame_alloc(); if (!s->next_picture.f) goto fail; s->last_picture.f = av_frame_alloc(); if (!s->last_picture.f) goto fail; s->current_picture.f = av_frame_alloc(); if (!s->current_picture.f) goto fail; s->new_picture.f = av_frame_alloc(); if (!s->new_picture.f) goto fail; if (init_context_frame(s)) goto fail; s->parse_context.state = -1; s->context_initialized = 1; s->thread_context[0] = s; // if (s->width && s->height) { if (nb_slices > 1) { for (i = 1; i < nb_slices; i++) { s->thread_context[i] = av_malloc(sizeof(MpegEncContext)); memcpy(s->thread_context[i], s, sizeof(MpegEncContext)); } for (i = 0; i < nb_slices; i++) { if (init_duplicate_context(s->thread_context[i]) < 0) goto fail; s->thread_context[i]->start_mb_y = (s->mb_height * (i) + nb_slices / 2) / nb_slices; s->thread_context[i]->end_mb_y = (s->mb_height * (i + 1) + nb_slices / 2) / nb_slices; } } else { if (init_duplicate_context(s) < 0) goto fail; s->start_mb_y = 0; s->end_mb_y = s->mb_height; } s->slice_context_count = nb_slices; // } return 0; fail: ff_mpv_common_end(s); return -1; }
false
FFmpeg
f30a7d9861af884f352ec2484820a75d79a4e0e2
av_cold int ff_mpv_common_init(MpegEncContext *s) { int i; int nb_slices = (HAVE_THREADS && s->avctx->active_thread_type & FF_THREAD_SLICE) ? s->avctx->thread_count : 1; if (s->encoding && s->avctx->slices) nb_slices = s->avctx->slices; if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence) s->mb_height = (s->height + 31) / 32 * 2; else s->mb_height = (s->height + 15) / 16; if (s->avctx->pix_fmt == AV_PIX_FMT_NONE) { av_log(s->avctx, AV_LOG_ERROR, "decoding to AV_PIX_FMT_NONE is not supported.\n"); return -1; } if (nb_slices > MAX_THREADS || (nb_slices > s->mb_height && s->mb_height)) { int max_slices; if (s->mb_height) max_slices = FFMIN(MAX_THREADS, s->mb_height); else max_slices = MAX_THREADS; av_log(s->avctx, AV_LOG_WARNING, "too many threads/slices (%d)," " reducing to %d\n", nb_slices, max_slices); nb_slices = max_slices; } if ((s->width || s->height) && av_image_check_size(s->width, s->height, 0, s->avctx)) return -1; dct_init(s); avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift); FF_ALLOCZ_OR_GOTO(s->avctx, s->picture, MAX_PICTURE_COUNT * sizeof(Picture), fail); for (i = 0; i < MAX_PICTURE_COUNT; i++) { s->picture[i].f = av_frame_alloc(); if (!s->picture[i].f) goto fail; } memset(&s->next_picture, 0, sizeof(s->next_picture)); memset(&s->last_picture, 0, sizeof(s->last_picture)); memset(&s->current_picture, 0, sizeof(s->current_picture)); memset(&s->new_picture, 0, sizeof(s->new_picture)); s->next_picture.f = av_frame_alloc(); if (!s->next_picture.f) goto fail; s->last_picture.f = av_frame_alloc(); if (!s->last_picture.f) goto fail; s->current_picture.f = av_frame_alloc(); if (!s->current_picture.f) goto fail; s->new_picture.f = av_frame_alloc(); if (!s->new_picture.f) goto fail; if (init_context_frame(s)) goto fail; s->parse_context.state = -1; s->context_initialized = 1; s->thread_context[0] = s; if (nb_slices > 1) { for (i = 1; i < nb_slices; i++) { s->thread_context[i] = av_malloc(sizeof(MpegEncContext)); memcpy(s->thread_context[i], s, sizeof(MpegEncContext)); } for (i = 0; i < nb_slices; i++) { if (init_duplicate_context(s->thread_context[i]) < 0) goto fail; s->thread_context[i]->start_mb_y = (s->mb_height * (i) + nb_slices / 2) / nb_slices; s->thread_context[i]->end_mb_y = (s->mb_height * (i + 1) + nb_slices / 2) / nb_slices; } } else { if (init_duplicate_context(s) < 0) goto fail; s->start_mb_y = 0; s->end_mb_y = s->mb_height; } s->slice_context_count = nb_slices; return 0; fail: ff_mpv_common_end(s); return -1; }
{ "code": [], "line_no": [] }
av_cold int FUNC_0(MpegEncContext *s) { int VAR_0; int VAR_1 = (HAVE_THREADS && s->avctx->active_thread_type & FF_THREAD_SLICE) ? s->avctx->thread_count : 1; if (s->encoding && s->avctx->slices) VAR_1 = s->avctx->slices; if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence) s->mb_height = (s->height + 31) / 32 * 2; else s->mb_height = (s->height + 15) / 16; if (s->avctx->pix_fmt == AV_PIX_FMT_NONE) { av_log(s->avctx, AV_LOG_ERROR, "decoding to AV_PIX_FMT_NONE is not supported.\n"); return -1; } if (VAR_1 > MAX_THREADS || (VAR_1 > s->mb_height && s->mb_height)) { int VAR_2; if (s->mb_height) VAR_2 = FFMIN(MAX_THREADS, s->mb_height); else VAR_2 = MAX_THREADS; av_log(s->avctx, AV_LOG_WARNING, "too many threads/slices (%d)," " reducing to %d\n", VAR_1, VAR_2); VAR_1 = VAR_2; } if ((s->width || s->height) && av_image_check_size(s->width, s->height, 0, s->avctx)) return -1; dct_init(s); avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift); FF_ALLOCZ_OR_GOTO(s->avctx, s->picture, MAX_PICTURE_COUNT * sizeof(Picture), fail); for (VAR_0 = 0; VAR_0 < MAX_PICTURE_COUNT; VAR_0++) { s->picture[VAR_0].f = av_frame_alloc(); if (!s->picture[VAR_0].f) goto fail; } memset(&s->next_picture, 0, sizeof(s->next_picture)); memset(&s->last_picture, 0, sizeof(s->last_picture)); memset(&s->current_picture, 0, sizeof(s->current_picture)); memset(&s->new_picture, 0, sizeof(s->new_picture)); s->next_picture.f = av_frame_alloc(); if (!s->next_picture.f) goto fail; s->last_picture.f = av_frame_alloc(); if (!s->last_picture.f) goto fail; s->current_picture.f = av_frame_alloc(); if (!s->current_picture.f) goto fail; s->new_picture.f = av_frame_alloc(); if (!s->new_picture.f) goto fail; if (init_context_frame(s)) goto fail; s->parse_context.state = -1; s->context_initialized = 1; s->thread_context[0] = s; if (VAR_1 > 1) { for (VAR_0 = 1; VAR_0 < VAR_1; VAR_0++) { s->thread_context[VAR_0] = av_malloc(sizeof(MpegEncContext)); memcpy(s->thread_context[VAR_0], s, sizeof(MpegEncContext)); } for (VAR_0 = 0; VAR_0 < VAR_1; VAR_0++) { if (init_duplicate_context(s->thread_context[VAR_0]) < 0) goto fail; s->thread_context[VAR_0]->start_mb_y = (s->mb_height * (VAR_0) + VAR_1 / 2) / VAR_1; s->thread_context[VAR_0]->end_mb_y = (s->mb_height * (VAR_0 + 1) + VAR_1 / 2) / VAR_1; } } else { if (init_duplicate_context(s) < 0) goto fail; s->start_mb_y = 0; s->end_mb_y = s->mb_height; } s->slice_context_count = VAR_1; return 0; fail: ff_mpv_common_end(s); return -1; }
[ "av_cold int FUNC_0(MpegEncContext *s)\n{", "int VAR_0;", "int VAR_1 = (HAVE_THREADS &&\ns->avctx->active_thread_type & FF_THREAD_SLICE) ?\ns->avctx->thread_count : 1;", "if (s->encoding && s->avctx->slices)\nVAR_1 = s->avctx->slices;", "if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence)\ns->mb_height = (s->height + 31) / 32 * 2;", "else\ns->mb_height = (s->height + 15) / 16;", "if (s->avctx->pix_fmt == AV_PIX_FMT_NONE) {", "av_log(s->avctx, AV_LOG_ERROR,\n\"decoding to AV_PIX_FMT_NONE is not supported.\\n\");", "return -1;", "}", "if (VAR_1 > MAX_THREADS || (VAR_1 > s->mb_height && s->mb_height)) {", "int VAR_2;", "if (s->mb_height)\nVAR_2 = FFMIN(MAX_THREADS, s->mb_height);", "else\nVAR_2 = MAX_THREADS;", "av_log(s->avctx, AV_LOG_WARNING, \"too many threads/slices (%d),\"\n\" reducing to %d\\n\", VAR_1, VAR_2);", "VAR_1 = VAR_2;", "}", "if ((s->width || s->height) &&\nav_image_check_size(s->width, s->height, 0, s->avctx))\nreturn -1;", "dct_init(s);", "avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,\n&s->chroma_x_shift,\n&s->chroma_y_shift);", "FF_ALLOCZ_OR_GOTO(s->avctx, s->picture,\nMAX_PICTURE_COUNT * sizeof(Picture), fail);", "for (VAR_0 = 0; VAR_0 < MAX_PICTURE_COUNT; VAR_0++) {", "s->picture[VAR_0].f = av_frame_alloc();", "if (!s->picture[VAR_0].f)\ngoto fail;", "}", "memset(&s->next_picture, 0, sizeof(s->next_picture));", "memset(&s->last_picture, 0, sizeof(s->last_picture));", "memset(&s->current_picture, 0, sizeof(s->current_picture));", "memset(&s->new_picture, 0, sizeof(s->new_picture));", "s->next_picture.f = av_frame_alloc();", "if (!s->next_picture.f)\ngoto fail;", "s->last_picture.f = av_frame_alloc();", "if (!s->last_picture.f)\ngoto fail;", "s->current_picture.f = av_frame_alloc();", "if (!s->current_picture.f)\ngoto fail;", "s->new_picture.f = av_frame_alloc();", "if (!s->new_picture.f)\ngoto fail;", "if (init_context_frame(s))\ngoto fail;", "s->parse_context.state = -1;", "s->context_initialized = 1;", "s->thread_context[0] = s;", "if (VAR_1 > 1) {", "for (VAR_0 = 1; VAR_0 < VAR_1; VAR_0++) {", "s->thread_context[VAR_0] = av_malloc(sizeof(MpegEncContext));", "memcpy(s->thread_context[VAR_0], s, sizeof(MpegEncContext));", "}", "for (VAR_0 = 0; VAR_0 < VAR_1; VAR_0++) {", "if (init_duplicate_context(s->thread_context[VAR_0]) < 0)\ngoto fail;", "s->thread_context[VAR_0]->start_mb_y =\n(s->mb_height * (VAR_0) + VAR_1 / 2) / VAR_1;", "s->thread_context[VAR_0]->end_mb_y =\n(s->mb_height * (VAR_0 + 1) + VAR_1 / 2) / VAR_1;", "}", "} else {", "if (init_duplicate_context(s) < 0)\ngoto fail;", "s->start_mb_y = 0;", "s->end_mb_y = s->mb_height;", "}", "s->slice_context_count = VAR_1;", "return 0;", "fail:\nff_mpv_common_end(s);", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11 ], [ 15, 17 ], [ 21, 23 ], [ 25, 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51, 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 65, 67, 69 ], [ 73 ], [ 79, 81, 83 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131, 133 ], [ 137, 139 ], [ 143 ], [ 147 ], [ 149 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169, 171 ], [ 173, 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ] ]
11,565
static int read_audio_mux_element(struct LATMContext *latmctx, GetBitContext *gb) { int err; uint8_t use_same_mux = get_bits(gb, 1); if (!use_same_mux) { if ((err = read_stream_mux_config(latmctx, gb)) < 0) return err; } else if (!latmctx->aac_ctx.avctx->extradata) { av_log(latmctx->aac_ctx.avctx, AV_LOG_DEBUG, "no decoder config found\n"); return AVERROR(EAGAIN); } if (latmctx->audio_mux_version_A == 0) { int mux_slot_length_bytes = read_payload_length_info(latmctx, gb); if (mux_slot_length_bytes * 8 > get_bits_left(gb)) { av_log(latmctx->aac_ctx.avctx, AV_LOG_ERROR, "incomplete frame\n"); return AVERROR_INVALIDDATA; } else if (mux_slot_length_bytes * 8 + 256 < get_bits_left(gb)) { av_log(latmctx->aac_ctx.avctx, AV_LOG_ERROR, "frame length mismatch %d << %d\n", mux_slot_length_bytes * 8, get_bits_left(gb)); return AVERROR_INVALIDDATA; } } return 0; }
true
FFmpeg
94d05ff15985d17aba070eaec82acd21c0da3d86
static int read_audio_mux_element(struct LATMContext *latmctx, GetBitContext *gb) { int err; uint8_t use_same_mux = get_bits(gb, 1); if (!use_same_mux) { if ((err = read_stream_mux_config(latmctx, gb)) < 0) return err; } else if (!latmctx->aac_ctx.avctx->extradata) { av_log(latmctx->aac_ctx.avctx, AV_LOG_DEBUG, "no decoder config found\n"); return AVERROR(EAGAIN); } if (latmctx->audio_mux_version_A == 0) { int mux_slot_length_bytes = read_payload_length_info(latmctx, gb); if (mux_slot_length_bytes * 8 > get_bits_left(gb)) { av_log(latmctx->aac_ctx.avctx, AV_LOG_ERROR, "incomplete frame\n"); return AVERROR_INVALIDDATA; } else if (mux_slot_length_bytes * 8 + 256 < get_bits_left(gb)) { av_log(latmctx->aac_ctx.avctx, AV_LOG_ERROR, "frame length mismatch %d << %d\n", mux_slot_length_bytes * 8, get_bits_left(gb)); return AVERROR_INVALIDDATA; } } return 0; }
{ "code": [ " if (mux_slot_length_bytes * 8 > get_bits_left(gb)) {" ], "line_no": [ 31 ] }
static int FUNC_0(struct LATMContext *VAR_0, GetBitContext *VAR_1) { int VAR_2; uint8_t use_same_mux = get_bits(VAR_1, 1); if (!use_same_mux) { if ((VAR_2 = read_stream_mux_config(VAR_0, VAR_1)) < 0) return VAR_2; } else if (!VAR_0->aac_ctx.avctx->extradata) { av_log(VAR_0->aac_ctx.avctx, AV_LOG_DEBUG, "no decoder config found\n"); return AVERROR(EAGAIN); } if (VAR_0->audio_mux_version_A == 0) { int VAR_3 = read_payload_length_info(VAR_0, VAR_1); if (VAR_3 * 8 > get_bits_left(VAR_1)) { av_log(VAR_0->aac_ctx.avctx, AV_LOG_ERROR, "incomplete frame\n"); return AVERROR_INVALIDDATA; } else if (VAR_3 * 8 + 256 < get_bits_left(VAR_1)) { av_log(VAR_0->aac_ctx.avctx, AV_LOG_ERROR, "frame length mismatch %d << %d\n", VAR_3 * 8, get_bits_left(VAR_1)); return AVERROR_INVALIDDATA; } } return 0; }
[ "static int FUNC_0(struct LATMContext *VAR_0,\nGetBitContext *VAR_1)\n{", "int VAR_2;", "uint8_t use_same_mux = get_bits(VAR_1, 1);", "if (!use_same_mux) {", "if ((VAR_2 = read_stream_mux_config(VAR_0, VAR_1)) < 0)\nreturn VAR_2;", "} else if (!VAR_0->aac_ctx.avctx->extradata) {", "av_log(VAR_0->aac_ctx.avctx, AV_LOG_DEBUG,\n\"no decoder config found\\n\");", "return AVERROR(EAGAIN);", "}", "if (VAR_0->audio_mux_version_A == 0) {", "int VAR_3 = read_payload_length_info(VAR_0, VAR_1);", "if (VAR_3 * 8 > get_bits_left(VAR_1)) {", "av_log(VAR_0->aac_ctx.avctx, AV_LOG_ERROR, \"incomplete frame\\n\");", "return AVERROR_INVALIDDATA;", "} else if (VAR_3 * 8 + 256 < get_bits_left(VAR_1)) {", "av_log(VAR_0->aac_ctx.avctx, AV_LOG_ERROR,\n\"frame length mismatch %d << %d\\n\",\nVAR_3 * 8, get_bits_left(VAR_1));", "return AVERROR_INVALIDDATA;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
11,567
static int vpc_has_zero_init(BlockDriverState *bs) { BDRVVPCState *s = bs->opaque; VHDFooter *footer = (VHDFooter *) s->footer_buf; if (cpu_to_be32(footer->type) == VHD_FIXED) { return bdrv_has_zero_init(bs->file); } else { return 1; } }
true
qemu
0d4cc3e715f5794077895345577725539afe81eb
static int vpc_has_zero_init(BlockDriverState *bs) { BDRVVPCState *s = bs->opaque; VHDFooter *footer = (VHDFooter *) s->footer_buf; if (cpu_to_be32(footer->type) == VHD_FIXED) { return bdrv_has_zero_init(bs->file); } else { return 1; } }
{ "code": [ " if (cpu_to_be32(footer->type) == VHD_FIXED) {", " if (cpu_to_be32(footer->type) == VHD_FIXED) {", " if (cpu_to_be32(footer->type) == VHD_FIXED) {" ], "line_no": [ 11, 11, 11 ] }
static int FUNC_0(BlockDriverState *VAR_0) { BDRVVPCState *s = VAR_0->opaque; VHDFooter *footer = (VHDFooter *) s->footer_buf; if (cpu_to_be32(footer->type) == VHD_FIXED) { return bdrv_has_zero_init(VAR_0->file); } else { return 1; } }
[ "static int FUNC_0(BlockDriverState *VAR_0)\n{", "BDRVVPCState *s = VAR_0->opaque;", "VHDFooter *footer = (VHDFooter *) s->footer_buf;", "if (cpu_to_be32(footer->type) == VHD_FIXED) {", "return bdrv_has_zero_init(VAR_0->file);", "} else {", "return 1;", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
11,568
static int mpeg_decode_postinit(AVCodecContext *avctx) { Mpeg1Context *s1 = avctx->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; uint8_t old_permutation[64]; int ret; if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) { // MPEG-1 aspect avctx->sample_aspect_ratio = av_d2q(1.0 / ff_mpeg1_aspect[s->aspect_ratio_info], 255); } else { // MPEG-2 // MPEG-2 aspect if (s->aspect_ratio_info > 1) { AVRational dar = av_mul_q(av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info], (AVRational) { s1->pan_scan.width, s1->pan_scan.height }), (AVRational) { s->width, s->height }); /* We ignore the spec here and guess a bit as reality does not * match the spec, see for example res_change_ffmpeg_aspect.ts * and sequence-display-aspect.mpg. * issue1613, 621, 562 */ if ((s1->pan_scan.width == 0) || (s1->pan_scan.height == 0) || (av_cmp_q(dar, (AVRational) { 4, 3 }) && av_cmp_q(dar, (AVRational) { 16, 9 }))) { s->avctx->sample_aspect_ratio = av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info], (AVRational) { s->width, s->height }); } else { s->avctx->sample_aspect_ratio = av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info], (AVRational) { s1->pan_scan.width, s1->pan_scan.height }); // issue1613 4/3 16/9 -> 16/9 // res_change_ffmpeg_aspect.ts 4/3 225/44 ->4/3 // widescreen-issue562.mpg 4/3 16/9 -> 16/9 // s->avctx->sample_aspect_ratio = av_mul_q(s->avctx->sample_aspect_ratio, (AVRational) {s->width, s->height}); ff_dlog(avctx, "aspect A %d/%d\n", ff_mpeg2_aspect[s->aspect_ratio_info].num, ff_mpeg2_aspect[s->aspect_ratio_info].den); ff_dlog(avctx, "aspect B %d/%d\n", s->avctx->sample_aspect_ratio.num, s->avctx->sample_aspect_ratio.den); } } else { s->avctx->sample_aspect_ratio = ff_mpeg2_aspect[s->aspect_ratio_info]; } } // MPEG-2 if (av_image_check_sar(s->width, s->height, avctx->sample_aspect_ratio) < 0) { av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n", avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den); avctx->sample_aspect_ratio = (AVRational){ 0, 1 }; } if ((s1->mpeg_enc_ctx_allocated == 0) || avctx->coded_width != s->width || avctx->coded_height != s->height || s1->save_width != s->width || s1->save_height != s->height || av_cmp_q(s1->save_aspect, s->avctx->sample_aspect_ratio) || (s1->save_progressive_seq != s->progressive_sequence && FFALIGN(s->height, 16) != FFALIGN(s->height, 32)) || 0) { if (s1->mpeg_enc_ctx_allocated) { ParseContext pc = s->parse_context; s->parse_context.buffer = 0; ff_mpv_common_end(s); s->parse_context = pc; s1->mpeg_enc_ctx_allocated = 0; } ret = ff_set_dimensions(avctx, s->width, s->height); if (ret < 0) return ret; if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->bit_rate) { avctx->rc_max_rate = s->bit_rate; } else if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && s->bit_rate && (s->bit_rate != 0x3FFFF*400 || s->vbv_delay != 0xFFFF)) { avctx->bit_rate = s->bit_rate; } s1->save_aspect = s->avctx->sample_aspect_ratio; s1->save_width = s->width; s1->save_height = s->height; s1->save_progressive_seq = s->progressive_sequence; /* low_delay may be forced, in this case we will have B-frames * that behave like P-frames. */ avctx->has_b_frames = !s->low_delay; if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) { // MPEG-1 fps avctx->framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index]; avctx->ticks_per_frame = 1; avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; } else { // MPEG-2 // MPEG-2 fps av_reduce(&s->avctx->framerate.num, &s->avctx->framerate.den, ff_mpeg12_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num, ff_mpeg12_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den, 1 << 30); avctx->ticks_per_frame = 2; switch (s->chroma_format) { case 1: avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; break; case 2: case 3: avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; break; default: av_assert0(0); } } // MPEG-2 avctx->pix_fmt = mpeg_get_pixelformat(avctx); setup_hwaccel_for_pixfmt(avctx); /* Quantization matrices may need reordering * if DCT permutation is changed. */ memcpy(old_permutation, s->idsp.idct_permutation, 64 * sizeof(uint8_t)); ff_mpv_idct_init(s); if ((ret = ff_mpv_common_init(s)) < 0) return ret; quant_matrix_rebuild(s->intra_matrix, old_permutation, s->idsp.idct_permutation); quant_matrix_rebuild(s->inter_matrix, old_permutation, s->idsp.idct_permutation); quant_matrix_rebuild(s->chroma_intra_matrix, old_permutation, s->idsp.idct_permutation); quant_matrix_rebuild(s->chroma_inter_matrix, old_permutation, s->idsp.idct_permutation); s1->mpeg_enc_ctx_allocated = 1; } return 0; }
true
FFmpeg
c0ece1f4addf8ac31df95775a2d36be2a55fc759
static int mpeg_decode_postinit(AVCodecContext *avctx) { Mpeg1Context *s1 = avctx->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; uint8_t old_permutation[64]; int ret; if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) { avctx->sample_aspect_ratio = av_d2q(1.0 / ff_mpeg1_aspect[s->aspect_ratio_info], 255); } else { aspect if (s->aspect_ratio_info > 1) { AVRational dar = av_mul_q(av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info], (AVRational) { s1->pan_scan.width, s1->pan_scan.height }), (AVRational) { s->width, s->height }); if ((s1->pan_scan.width == 0) || (s1->pan_scan.height == 0) || (av_cmp_q(dar, (AVRational) { 4, 3 }) && av_cmp_q(dar, (AVRational) { 16, 9 }))) { s->avctx->sample_aspect_ratio = av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info], (AVRational) { s->width, s->height }); } else { s->avctx->sample_aspect_ratio = av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info], (AVRational) { s1->pan_scan.width, s1->pan_scan.height }); ff_dlog(avctx, "aspect A %d/%d\n", ff_mpeg2_aspect[s->aspect_ratio_info].num, ff_mpeg2_aspect[s->aspect_ratio_info].den); ff_dlog(avctx, "aspect B %d/%d\n", s->avctx->sample_aspect_ratio.num, s->avctx->sample_aspect_ratio.den); } } else { s->avctx->sample_aspect_ratio = ff_mpeg2_aspect[s->aspect_ratio_info]; } } if (av_image_check_sar(s->width, s->height, avctx->sample_aspect_ratio) < 0) { av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n", avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den); avctx->sample_aspect_ratio = (AVRational){ 0, 1 }; } if ((s1->mpeg_enc_ctx_allocated == 0) || avctx->coded_width != s->width || avctx->coded_height != s->height || s1->save_width != s->width || s1->save_height != s->height || av_cmp_q(s1->save_aspect, s->avctx->sample_aspect_ratio) || (s1->save_progressive_seq != s->progressive_sequence && FFALIGN(s->height, 16) != FFALIGN(s->height, 32)) || 0) { if (s1->mpeg_enc_ctx_allocated) { ParseContext pc = s->parse_context; s->parse_context.buffer = 0; ff_mpv_common_end(s); s->parse_context = pc; s1->mpeg_enc_ctx_allocated = 0; } ret = ff_set_dimensions(avctx, s->width, s->height); if (ret < 0) return ret; if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->bit_rate) { avctx->rc_max_rate = s->bit_rate; } else if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && s->bit_rate && (s->bit_rate != 0x3FFFF*400 || s->vbv_delay != 0xFFFF)) { avctx->bit_rate = s->bit_rate; } s1->save_aspect = s->avctx->sample_aspect_ratio; s1->save_width = s->width; s1->save_height = s->height; s1->save_progressive_seq = s->progressive_sequence; avctx->has_b_frames = !s->low_delay; if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) { avctx->framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index]; avctx->ticks_per_frame = 1; avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; } else { fps av_reduce(&s->avctx->framerate.num, &s->avctx->framerate.den, ff_mpeg12_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num, ff_mpeg12_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den, 1 << 30); avctx->ticks_per_frame = 2; switch (s->chroma_format) { case 1: avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; break; case 2: case 3: avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; break; default: av_assert0(0); } } avctx->pix_fmt = mpeg_get_pixelformat(avctx); setup_hwaccel_for_pixfmt(avctx); memcpy(old_permutation, s->idsp.idct_permutation, 64 * sizeof(uint8_t)); ff_mpv_idct_init(s); if ((ret = ff_mpv_common_init(s)) < 0) return ret; quant_matrix_rebuild(s->intra_matrix, old_permutation, s->idsp.idct_permutation); quant_matrix_rebuild(s->inter_matrix, old_permutation, s->idsp.idct_permutation); quant_matrix_rebuild(s->chroma_intra_matrix, old_permutation, s->idsp.idct_permutation); quant_matrix_rebuild(s->chroma_inter_matrix, old_permutation, s->idsp.idct_permutation); s1->mpeg_enc_ctx_allocated = 1; } return 0; }
{ "code": [ " avctx->sample_aspect_ratio = av_d2q(1.0 / ff_mpeg1_aspect[s->aspect_ratio_info], 255);" ], "line_no": [ 19 ] }
static int FUNC_0(AVCodecContext *VAR_0) { Mpeg1Context *s1 = VAR_0->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; uint8_t old_permutation[64]; int VAR_1; if (VAR_0->codec_id == AV_CODEC_ID_MPEG1VIDEO) { VAR_0->sample_aspect_ratio = av_d2q(1.0 / ff_mpeg1_aspect[s->aspect_ratio_info], 255); } else { aspect if (s->aspect_ratio_info > 1) { AVRational dar = av_mul_q(av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info], (AVRational) { s1->pan_scan.width, s1->pan_scan.height }), (AVRational) { s->width, s->height }); if ((s1->pan_scan.width == 0) || (s1->pan_scan.height == 0) || (av_cmp_q(dar, (AVRational) { 4, 3 }) && av_cmp_q(dar, (AVRational) { 16, 9 }))) { s->VAR_0->sample_aspect_ratio = av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info], (AVRational) { s->width, s->height }); } else { s->VAR_0->sample_aspect_ratio = av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info], (AVRational) { s1->pan_scan.width, s1->pan_scan.height }); ff_dlog(VAR_0, "aspect A %d/%d\n", ff_mpeg2_aspect[s->aspect_ratio_info].num, ff_mpeg2_aspect[s->aspect_ratio_info].den); ff_dlog(VAR_0, "aspect B %d/%d\n", s->VAR_0->sample_aspect_ratio.num, s->VAR_0->sample_aspect_ratio.den); } } else { s->VAR_0->sample_aspect_ratio = ff_mpeg2_aspect[s->aspect_ratio_info]; } } if (av_image_check_sar(s->width, s->height, VAR_0->sample_aspect_ratio) < 0) { av_log(VAR_0, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n", VAR_0->sample_aspect_ratio.num, VAR_0->sample_aspect_ratio.den); VAR_0->sample_aspect_ratio = (AVRational){ 0, 1 }; } if ((s1->mpeg_enc_ctx_allocated == 0) || VAR_0->coded_width != s->width || VAR_0->coded_height != s->height || s1->save_width != s->width || s1->save_height != s->height || av_cmp_q(s1->save_aspect, s->VAR_0->sample_aspect_ratio) || (s1->save_progressive_seq != s->progressive_sequence && FFALIGN(s->height, 16) != FFALIGN(s->height, 32)) || 0) { if (s1->mpeg_enc_ctx_allocated) { ParseContext pc = s->parse_context; s->parse_context.buffer = 0; ff_mpv_common_end(s); s->parse_context = pc; s1->mpeg_enc_ctx_allocated = 0; } VAR_1 = ff_set_dimensions(VAR_0, s->width, s->height); if (VAR_1 < 0) return VAR_1; if (VAR_0->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->bit_rate) { VAR_0->rc_max_rate = s->bit_rate; } else if (VAR_0->codec_id == AV_CODEC_ID_MPEG1VIDEO && s->bit_rate && (s->bit_rate != 0x3FFFF*400 || s->vbv_delay != 0xFFFF)) { VAR_0->bit_rate = s->bit_rate; } s1->save_aspect = s->VAR_0->sample_aspect_ratio; s1->save_width = s->width; s1->save_height = s->height; s1->save_progressive_seq = s->progressive_sequence; VAR_0->has_b_frames = !s->low_delay; if (VAR_0->codec_id == AV_CODEC_ID_MPEG1VIDEO) { VAR_0->framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index]; VAR_0->ticks_per_frame = 1; VAR_0->chroma_sample_location = AVCHROMA_LOC_CENTER; } else { fps av_reduce(&s->VAR_0->framerate.num, &s->VAR_0->framerate.den, ff_mpeg12_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num, ff_mpeg12_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den, 1 << 30); VAR_0->ticks_per_frame = 2; switch (s->chroma_format) { case 1: VAR_0->chroma_sample_location = AVCHROMA_LOC_LEFT; break; case 2: case 3: VAR_0->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; break; default: av_assert0(0); } } VAR_0->pix_fmt = mpeg_get_pixelformat(VAR_0); setup_hwaccel_for_pixfmt(VAR_0); memcpy(old_permutation, s->idsp.idct_permutation, 64 * sizeof(uint8_t)); ff_mpv_idct_init(s); if ((VAR_1 = ff_mpv_common_init(s)) < 0) return VAR_1; quant_matrix_rebuild(s->intra_matrix, old_permutation, s->idsp.idct_permutation); quant_matrix_rebuild(s->inter_matrix, old_permutation, s->idsp.idct_permutation); quant_matrix_rebuild(s->chroma_intra_matrix, old_permutation, s->idsp.idct_permutation); quant_matrix_rebuild(s->chroma_inter_matrix, old_permutation, s->idsp.idct_permutation); s1->mpeg_enc_ctx_allocated = 1; } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "Mpeg1Context *s1 = VAR_0->priv_data;", "MpegEncContext *s = &s1->mpeg_enc_ctx;", "uint8_t old_permutation[64];", "int VAR_1;", "if (VAR_0->codec_id == AV_CODEC_ID_MPEG1VIDEO) {", "VAR_0->sample_aspect_ratio = av_d2q(1.0 / ff_mpeg1_aspect[s->aspect_ratio_info], 255);", "} else {", "aspect\nif (s->aspect_ratio_info > 1) {", "AVRational dar =\nav_mul_q(av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info],\n(AVRational) { s1->pan_scan.width,", "s1->pan_scan.height }),", "(AVRational) { s->width, s->height });", "if ((s1->pan_scan.width == 0) || (s1->pan_scan.height == 0) ||\n(av_cmp_q(dar, (AVRational) { 4, 3 }) &&", "av_cmp_q(dar, (AVRational) { 16, 9 }))) {", "s->VAR_0->sample_aspect_ratio =\nav_div_q(ff_mpeg2_aspect[s->aspect_ratio_info],\n(AVRational) { s->width, s->height });", "} else {", "s->VAR_0->sample_aspect_ratio =\nav_div_q(ff_mpeg2_aspect[s->aspect_ratio_info],\n(AVRational) { s1->pan_scan.width, s1->pan_scan.height });", "ff_dlog(VAR_0, \"aspect A %d/%d\\n\",\nff_mpeg2_aspect[s->aspect_ratio_info].num,\nff_mpeg2_aspect[s->aspect_ratio_info].den);", "ff_dlog(VAR_0, \"aspect B %d/%d\\n\", s->VAR_0->sample_aspect_ratio.num,\ns->VAR_0->sample_aspect_ratio.den);", "}", "} else {", "s->VAR_0->sample_aspect_ratio =\nff_mpeg2_aspect[s->aspect_ratio_info];", "}", "}", "if (av_image_check_sar(s->width, s->height,\nVAR_0->sample_aspect_ratio) < 0) {", "av_log(VAR_0, AV_LOG_WARNING, \"ignoring invalid SAR: %u/%u\\n\",\nVAR_0->sample_aspect_ratio.num,\nVAR_0->sample_aspect_ratio.den);", "VAR_0->sample_aspect_ratio = (AVRational){ 0, 1 };", "}", "if ((s1->mpeg_enc_ctx_allocated == 0) ||\nVAR_0->coded_width != s->width ||\nVAR_0->coded_height != s->height ||\ns1->save_width != s->width ||\ns1->save_height != s->height ||\nav_cmp_q(s1->save_aspect, s->VAR_0->sample_aspect_ratio) ||\n(s1->save_progressive_seq != s->progressive_sequence && FFALIGN(s->height, 16) != FFALIGN(s->height, 32)) ||\n0) {", "if (s1->mpeg_enc_ctx_allocated) {", "ParseContext pc = s->parse_context;", "s->parse_context.buffer = 0;", "ff_mpv_common_end(s);", "s->parse_context = pc;", "s1->mpeg_enc_ctx_allocated = 0;", "}", "VAR_1 = ff_set_dimensions(VAR_0, s->width, s->height);", "if (VAR_1 < 0)\nreturn VAR_1;", "if (VAR_0->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->bit_rate) {", "VAR_0->rc_max_rate = s->bit_rate;", "} else if (VAR_0->codec_id == AV_CODEC_ID_MPEG1VIDEO && s->bit_rate &&", "(s->bit_rate != 0x3FFFF*400 || s->vbv_delay != 0xFFFF)) {", "VAR_0->bit_rate = s->bit_rate;", "}", "s1->save_aspect = s->VAR_0->sample_aspect_ratio;", "s1->save_width = s->width;", "s1->save_height = s->height;", "s1->save_progressive_seq = s->progressive_sequence;", "VAR_0->has_b_frames = !s->low_delay;", "if (VAR_0->codec_id == AV_CODEC_ID_MPEG1VIDEO) {", "VAR_0->framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index];", "VAR_0->ticks_per_frame = 1;", "VAR_0->chroma_sample_location = AVCHROMA_LOC_CENTER;", "} else {", "fps\nav_reduce(&s->VAR_0->framerate.num,\n&s->VAR_0->framerate.den,\nff_mpeg12_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num,\nff_mpeg12_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den,\n1 << 30);", "VAR_0->ticks_per_frame = 2;", "switch (s->chroma_format) {", "case 1: VAR_0->chroma_sample_location = AVCHROMA_LOC_LEFT; break;", "case 2:\ncase 3: VAR_0->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; break;", "default: av_assert0(0);", "}", "}", "VAR_0->pix_fmt = mpeg_get_pixelformat(VAR_0);", "setup_hwaccel_for_pixfmt(VAR_0);", "memcpy(old_permutation, s->idsp.idct_permutation, 64 * sizeof(uint8_t));", "ff_mpv_idct_init(s);", "if ((VAR_1 = ff_mpv_common_init(s)) < 0)\nreturn VAR_1;", "quant_matrix_rebuild(s->intra_matrix, old_permutation, s->idsp.idct_permutation);", "quant_matrix_rebuild(s->inter_matrix, old_permutation, s->idsp.idct_permutation);", "quant_matrix_rebuild(s->chroma_intra_matrix, old_permutation, s->idsp.idct_permutation);", "quant_matrix_rebuild(s->chroma_inter_matrix, old_permutation, s->idsp.idct_permutation);", "s1->mpeg_enc_ctx_allocated = 1;", "}", "return 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27, 29, 31 ], [ 33 ], [ 35 ], [ 47, 49 ], [ 51 ], [ 53, 55, 57 ], [ 59 ], [ 61, 63, 65 ], [ 75, 77, 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103, 105, 107 ], [ 109 ], [ 111 ], [ 115, 117, 119, 121, 123, 125, 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149, 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 181 ], [ 185 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199, 201, 203, 205, 207, 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219, 221 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233 ], [ 241 ], [ 245 ], [ 247, 249 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ] ]
11,569
static void mxf_write_index_table_segment(AVFormatContext *s) { MXFContext *mxf = s->priv_data; AVIOContext *pb = s->pb; int i, j, temporal_reordering = 0; int key_index = mxf->last_key_index; av_log(s, AV_LOG_DEBUG, "edit units count %d\n", mxf->edit_units_count); if (!mxf->edit_units_count && !mxf->edit_unit_byte_count) return; avio_write(pb, index_table_segment_key, 16); if (mxf->edit_unit_byte_count) { klv_encode_ber_length(pb, 80); } else { klv_encode_ber_length(pb, 85 + 12+(s->nb_streams+1)*6 + 12+mxf->edit_units_count*(11+mxf->slice_count*4)); } // instance id mxf_write_local_tag(pb, 16, 0x3C0A); mxf_write_uuid(pb, IndexTableSegment, 0); // index edit rate mxf_write_local_tag(pb, 8, 0x3F0B); avio_wb32(pb, mxf->time_base.den); avio_wb32(pb, mxf->time_base.num); // index start position mxf_write_local_tag(pb, 8, 0x3F0C); avio_wb64(pb, mxf->last_indexed_edit_unit); // index duration mxf_write_local_tag(pb, 8, 0x3F0D); if (mxf->edit_unit_byte_count) avio_wb64(pb, 0); // index table covers whole container else avio_wb64(pb, mxf->edit_units_count); // edit unit byte count mxf_write_local_tag(pb, 4, 0x3F05); avio_wb32(pb, mxf->edit_unit_byte_count); // index sid mxf_write_local_tag(pb, 4, 0x3F06); avio_wb32(pb, 2); // body sid mxf_write_local_tag(pb, 4, 0x3F07); avio_wb32(pb, 1); if (!mxf->edit_unit_byte_count) { // real slice count - 1 mxf_write_local_tag(pb, 1, 0x3F08); avio_w8(pb, mxf->slice_count); // delta entry array mxf_write_local_tag(pb, 8 + (s->nb_streams+1)*6, 0x3F09); avio_wb32(pb, s->nb_streams+1); // num of entries avio_wb32(pb, 6); // size of one entry // write system item delta entry avio_w8(pb, 0); avio_w8(pb, 0); // slice entry avio_wb32(pb, 0); // element delta for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MXFStreamContext *sc = st->priv_data; avio_w8(pb, sc->temporal_reordering); if (sc->temporal_reordering) temporal_reordering = 1; if (i == 0) { // video track avio_w8(pb, 0); // slice number avio_wb32(pb, KAG_SIZE); // system item size including klv fill } else { // audio track unsigned audio_frame_size = sc->aic.samples[0]*sc->aic.sample_size; audio_frame_size += klv_fill_size(audio_frame_size); avio_w8(pb, 1); avio_wb32(pb, (i-1)*audio_frame_size); // element delta } } mxf_write_local_tag(pb, 8 + mxf->edit_units_count*(11+mxf->slice_count*4), 0x3F0A); avio_wb32(pb, mxf->edit_units_count); // num of entries avio_wb32(pb, 11+mxf->slice_count*4); // size of one entry for (i = 0; i < mxf->edit_units_count; i++) { int temporal_offset = 0; if (!(mxf->index_entries[i].flags & 0x33)) { // I frame mxf->last_key_index = key_index; key_index = i; } if (temporal_reordering) { int pic_num_in_gop = i - key_index; if (pic_num_in_gop != mxf->index_entries[i].temporal_ref) { for (j = key_index; j < mxf->edit_units_count; j++) { if (pic_num_in_gop == mxf->index_entries[j].temporal_ref) break; } if (j == mxf->edit_units_count) av_log(s, AV_LOG_WARNING, "missing frames\n"); temporal_offset = j - key_index - pic_num_in_gop; } } avio_w8(pb, temporal_offset); if ((mxf->index_entries[i].flags & 0x30) == 0x30) { // back and forward prediction avio_w8(pb, mxf->last_key_index - i); } else { avio_w8(pb, key_index - i); // key frame offset if ((mxf->index_entries[i].flags & 0x20) == 0x20) // only forward mxf->last_key_index = key_index; } if (!(mxf->index_entries[i].flags & 0x33) && // I frame mxf->index_entries[i].flags & 0x40 && !temporal_offset) mxf->index_entries[i].flags |= 0x80; // random access avio_w8(pb, mxf->index_entries[i].flags); // stream offset avio_wb64(pb, mxf->index_entries[i].offset); if (s->nb_streams > 1) avio_wb32(pb, mxf->index_entries[i].slice_offset); } mxf->last_key_index = key_index - mxf->edit_units_count; mxf->last_indexed_edit_unit += mxf->edit_units_count; mxf->edit_units_count = 0; } }
true
FFmpeg
e3ba817b95bbdc7c8aaf83b4a6804d1b49eb4de4
static void mxf_write_index_table_segment(AVFormatContext *s) { MXFContext *mxf = s->priv_data; AVIOContext *pb = s->pb; int i, j, temporal_reordering = 0; int key_index = mxf->last_key_index; av_log(s, AV_LOG_DEBUG, "edit units count %d\n", mxf->edit_units_count); if (!mxf->edit_units_count && !mxf->edit_unit_byte_count) return; avio_write(pb, index_table_segment_key, 16); if (mxf->edit_unit_byte_count) { klv_encode_ber_length(pb, 80); } else { klv_encode_ber_length(pb, 85 + 12+(s->nb_streams+1)*6 + 12+mxf->edit_units_count*(11+mxf->slice_count*4)); } mxf_write_local_tag(pb, 16, 0x3C0A); mxf_write_uuid(pb, IndexTableSegment, 0); mxf_write_local_tag(pb, 8, 0x3F0B); avio_wb32(pb, mxf->time_base.den); avio_wb32(pb, mxf->time_base.num); mxf_write_local_tag(pb, 8, 0x3F0C); avio_wb64(pb, mxf->last_indexed_edit_unit); mxf_write_local_tag(pb, 8, 0x3F0D); if (mxf->edit_unit_byte_count) avio_wb64(pb, 0); else avio_wb64(pb, mxf->edit_units_count); mxf_write_local_tag(pb, 4, 0x3F05); avio_wb32(pb, mxf->edit_unit_byte_count); mxf_write_local_tag(pb, 4, 0x3F06); avio_wb32(pb, 2); mxf_write_local_tag(pb, 4, 0x3F07); avio_wb32(pb, 1); if (!mxf->edit_unit_byte_count) { mxf_write_local_tag(pb, 1, 0x3F08); avio_w8(pb, mxf->slice_count); mxf_write_local_tag(pb, 8 + (s->nb_streams+1)*6, 0x3F09); avio_wb32(pb, s->nb_streams+1); avio_wb32(pb, 6); avio_w8(pb, 0); avio_w8(pb, 0); avio_wb32(pb, 0); for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MXFStreamContext *sc = st->priv_data; avio_w8(pb, sc->temporal_reordering); if (sc->temporal_reordering) temporal_reordering = 1; if (i == 0) { avio_w8(pb, 0); avio_wb32(pb, KAG_SIZE); } else { unsigned audio_frame_size = sc->aic.samples[0]*sc->aic.sample_size; audio_frame_size += klv_fill_size(audio_frame_size); avio_w8(pb, 1); avio_wb32(pb, (i-1)*audio_frame_size); } } mxf_write_local_tag(pb, 8 + mxf->edit_units_count*(11+mxf->slice_count*4), 0x3F0A); avio_wb32(pb, mxf->edit_units_count); avio_wb32(pb, 11+mxf->slice_count*4); for (i = 0; i < mxf->edit_units_count; i++) { int temporal_offset = 0; if (!(mxf->index_entries[i].flags & 0x33)) { mxf->last_key_index = key_index; key_index = i; } if (temporal_reordering) { int pic_num_in_gop = i - key_index; if (pic_num_in_gop != mxf->index_entries[i].temporal_ref) { for (j = key_index; j < mxf->edit_units_count; j++) { if (pic_num_in_gop == mxf->index_entries[j].temporal_ref) break; } if (j == mxf->edit_units_count) av_log(s, AV_LOG_WARNING, "missing frames\n"); temporal_offset = j - key_index - pic_num_in_gop; } } avio_w8(pb, temporal_offset); if ((mxf->index_entries[i].flags & 0x30) == 0x30) { avio_w8(pb, mxf->last_key_index - i); } else { avio_w8(pb, key_index - i); if ((mxf->index_entries[i].flags & 0x20) == 0x20) mxf->last_key_index = key_index; } if (!(mxf->index_entries[i].flags & 0x33) && mxf->index_entries[i].flags & 0x40 && !temporal_offset) mxf->index_entries[i].flags |= 0x80; avio_w8(pb, mxf->index_entries[i].flags); avio_wb64(pb, mxf->index_entries[i].offset); if (s->nb_streams > 1) avio_wb32(pb, mxf->index_entries[i].slice_offset); } mxf->last_key_index = key_index - mxf->edit_units_count; mxf->last_indexed_edit_unit += mxf->edit_units_count; mxf->edit_units_count = 0; } }
{ "code": [ " klv_encode_ber_length(pb, 85 + 12+(s->nb_streams+1)*6 +", " 12+mxf->edit_units_count*(11+mxf->slice_count*4));" ], "line_no": [ 35, 37 ] }
static void FUNC_0(AVFormatContext *VAR_0) { MXFContext *mxf = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; int VAR_1, VAR_2, VAR_3 = 0; int VAR_4 = mxf->last_key_index; av_log(VAR_0, AV_LOG_DEBUG, "edit units count %d\n", mxf->edit_units_count); if (!mxf->edit_units_count && !mxf->edit_unit_byte_count) return; avio_write(pb, index_table_segment_key, 16); if (mxf->edit_unit_byte_count) { klv_encode_ber_length(pb, 80); } else { klv_encode_ber_length(pb, 85 + 12+(VAR_0->nb_streams+1)*6 + 12+mxf->edit_units_count*(11+mxf->slice_count*4)); } mxf_write_local_tag(pb, 16, 0x3C0A); mxf_write_uuid(pb, IndexTableSegment, 0); mxf_write_local_tag(pb, 8, 0x3F0B); avio_wb32(pb, mxf->time_base.den); avio_wb32(pb, mxf->time_base.num); mxf_write_local_tag(pb, 8, 0x3F0C); avio_wb64(pb, mxf->last_indexed_edit_unit); mxf_write_local_tag(pb, 8, 0x3F0D); if (mxf->edit_unit_byte_count) avio_wb64(pb, 0); else avio_wb64(pb, mxf->edit_units_count); mxf_write_local_tag(pb, 4, 0x3F05); avio_wb32(pb, mxf->edit_unit_byte_count); mxf_write_local_tag(pb, 4, 0x3F06); avio_wb32(pb, 2); mxf_write_local_tag(pb, 4, 0x3F07); avio_wb32(pb, 1); if (!mxf->edit_unit_byte_count) { mxf_write_local_tag(pb, 1, 0x3F08); avio_w8(pb, mxf->slice_count); mxf_write_local_tag(pb, 8 + (VAR_0->nb_streams+1)*6, 0x3F09); avio_wb32(pb, VAR_0->nb_streams+1); avio_wb32(pb, 6); avio_w8(pb, 0); avio_w8(pb, 0); avio_wb32(pb, 0); for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { AVStream *st = VAR_0->streams[VAR_1]; MXFStreamContext *sc = st->priv_data; avio_w8(pb, sc->VAR_3); if (sc->VAR_3) VAR_3 = 1; if (VAR_1 == 0) { avio_w8(pb, 0); avio_wb32(pb, KAG_SIZE); } else { unsigned audio_frame_size = sc->aic.samples[0]*sc->aic.sample_size; audio_frame_size += klv_fill_size(audio_frame_size); avio_w8(pb, 1); avio_wb32(pb, (VAR_1-1)*audio_frame_size); } } mxf_write_local_tag(pb, 8 + mxf->edit_units_count*(11+mxf->slice_count*4), 0x3F0A); avio_wb32(pb, mxf->edit_units_count); avio_wb32(pb, 11+mxf->slice_count*4); for (VAR_1 = 0; VAR_1 < mxf->edit_units_count; VAR_1++) { int temporal_offset = 0; if (!(mxf->index_entries[VAR_1].flags & 0x33)) { mxf->last_key_index = VAR_4; VAR_4 = VAR_1; } if (VAR_3) { int pic_num_in_gop = VAR_1 - VAR_4; if (pic_num_in_gop != mxf->index_entries[VAR_1].temporal_ref) { for (VAR_2 = VAR_4; VAR_2 < mxf->edit_units_count; VAR_2++) { if (pic_num_in_gop == mxf->index_entries[VAR_2].temporal_ref) break; } if (VAR_2 == mxf->edit_units_count) av_log(VAR_0, AV_LOG_WARNING, "missing frames\n"); temporal_offset = VAR_2 - VAR_4 - pic_num_in_gop; } } avio_w8(pb, temporal_offset); if ((mxf->index_entries[VAR_1].flags & 0x30) == 0x30) { avio_w8(pb, mxf->last_key_index - VAR_1); } else { avio_w8(pb, VAR_4 - VAR_1); if ((mxf->index_entries[VAR_1].flags & 0x20) == 0x20) mxf->last_key_index = VAR_4; } if (!(mxf->index_entries[VAR_1].flags & 0x33) && mxf->index_entries[VAR_1].flags & 0x40 && !temporal_offset) mxf->index_entries[VAR_1].flags |= 0x80; avio_w8(pb, mxf->index_entries[VAR_1].flags); avio_wb64(pb, mxf->index_entries[VAR_1].offset); if (VAR_0->nb_streams > 1) avio_wb32(pb, mxf->index_entries[VAR_1].slice_offset); } mxf->last_key_index = VAR_4 - mxf->edit_units_count; mxf->last_indexed_edit_unit += mxf->edit_units_count; mxf->edit_units_count = 0; } }
[ "static void FUNC_0(AVFormatContext *VAR_0)\n{", "MXFContext *mxf = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "int VAR_1, VAR_2, VAR_3 = 0;", "int VAR_4 = mxf->last_key_index;", "av_log(VAR_0, AV_LOG_DEBUG, \"edit units count %d\\n\", mxf->edit_units_count);", "if (!mxf->edit_units_count && !mxf->edit_unit_byte_count)\nreturn;", "avio_write(pb, index_table_segment_key, 16);", "if (mxf->edit_unit_byte_count) {", "klv_encode_ber_length(pb, 80);", "} else {", "klv_encode_ber_length(pb, 85 + 12+(VAR_0->nb_streams+1)*6 +\n12+mxf->edit_units_count*(11+mxf->slice_count*4));", "}", "mxf_write_local_tag(pb, 16, 0x3C0A);", "mxf_write_uuid(pb, IndexTableSegment, 0);", "mxf_write_local_tag(pb, 8, 0x3F0B);", "avio_wb32(pb, mxf->time_base.den);", "avio_wb32(pb, mxf->time_base.num);", "mxf_write_local_tag(pb, 8, 0x3F0C);", "avio_wb64(pb, mxf->last_indexed_edit_unit);", "mxf_write_local_tag(pb, 8, 0x3F0D);", "if (mxf->edit_unit_byte_count)\navio_wb64(pb, 0);", "else\navio_wb64(pb, mxf->edit_units_count);", "mxf_write_local_tag(pb, 4, 0x3F05);", "avio_wb32(pb, mxf->edit_unit_byte_count);", "mxf_write_local_tag(pb, 4, 0x3F06);", "avio_wb32(pb, 2);", "mxf_write_local_tag(pb, 4, 0x3F07);", "avio_wb32(pb, 1);", "if (!mxf->edit_unit_byte_count) {", "mxf_write_local_tag(pb, 1, 0x3F08);", "avio_w8(pb, mxf->slice_count);", "mxf_write_local_tag(pb, 8 + (VAR_0->nb_streams+1)*6, 0x3F09);", "avio_wb32(pb, VAR_0->nb_streams+1);", "avio_wb32(pb, 6);", "avio_w8(pb, 0);", "avio_w8(pb, 0);", "avio_wb32(pb, 0);", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {", "AVStream *st = VAR_0->streams[VAR_1];", "MXFStreamContext *sc = st->priv_data;", "avio_w8(pb, sc->VAR_3);", "if (sc->VAR_3)\nVAR_3 = 1;", "if (VAR_1 == 0) {", "avio_w8(pb, 0);", "avio_wb32(pb, KAG_SIZE);", "} else {", "unsigned audio_frame_size = sc->aic.samples[0]*sc->aic.sample_size;", "audio_frame_size += klv_fill_size(audio_frame_size);", "avio_w8(pb, 1);", "avio_wb32(pb, (VAR_1-1)*audio_frame_size);", "}", "}", "mxf_write_local_tag(pb, 8 + mxf->edit_units_count*(11+mxf->slice_count*4), 0x3F0A);", "avio_wb32(pb, mxf->edit_units_count);", "avio_wb32(pb, 11+mxf->slice_count*4);", "for (VAR_1 = 0; VAR_1 < mxf->edit_units_count; VAR_1++) {", "int temporal_offset = 0;", "if (!(mxf->index_entries[VAR_1].flags & 0x33)) {", "mxf->last_key_index = VAR_4;", "VAR_4 = VAR_1;", "}", "if (VAR_3) {", "int pic_num_in_gop = VAR_1 - VAR_4;", "if (pic_num_in_gop != mxf->index_entries[VAR_1].temporal_ref) {", "for (VAR_2 = VAR_4; VAR_2 < mxf->edit_units_count; VAR_2++) {", "if (pic_num_in_gop == mxf->index_entries[VAR_2].temporal_ref)\nbreak;", "}", "if (VAR_2 == mxf->edit_units_count)\nav_log(VAR_0, AV_LOG_WARNING, \"missing frames\\n\");", "temporal_offset = VAR_2 - VAR_4 - pic_num_in_gop;", "}", "}", "avio_w8(pb, temporal_offset);", "if ((mxf->index_entries[VAR_1].flags & 0x30) == 0x30) {", "avio_w8(pb, mxf->last_key_index - VAR_1);", "} else {", "avio_w8(pb, VAR_4 - VAR_1);", "if ((mxf->index_entries[VAR_1].flags & 0x20) == 0x20)\nmxf->last_key_index = VAR_4;", "}", "if (!(mxf->index_entries[VAR_1].flags & 0x33) &&\nmxf->index_entries[VAR_1].flags & 0x40 && !temporal_offset)\nmxf->index_entries[VAR_1].flags |= 0x80;", "avio_w8(pb, mxf->index_entries[VAR_1].flags);", "avio_wb64(pb, mxf->index_entries[VAR_1].offset);", "if (VAR_0->nb_streams > 1)\navio_wb32(pb, mxf->index_entries[VAR_1].slice_offset);", "}", "mxf->last_key_index = VAR_4 - mxf->edit_units_count;", "mxf->last_indexed_edit_unit += mxf->edit_units_count;", "mxf->edit_units_count = 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57 ], [ 63 ], [ 65 ], [ 71 ], [ 73, 75 ], [ 77, 79 ], [ 85 ], [ 87 ], [ 93 ], [ 95 ], [ 101 ], [ 103 ], [ 107 ], [ 111 ], [ 113 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199, 201 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227, 229 ], [ 231 ], [ 235, 237, 239 ], [ 241 ], [ 245 ], [ 247, 249 ], [ 251 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ] ]
11,571
static int vaapi_h264_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { H264Context * const h = avctx->priv_data; H264SliceContext *sl = &h->slice_ctx[0]; VASliceParameterBufferH264 *slice_param; ff_dlog(avctx, "vaapi_h264_decode_slice(): buffer %p, size %d\n", buffer, size); /* Fill in VASliceParameterBufferH264. */ slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size); if (!slice_param) return -1; slice_param->slice_data_bit_offset = get_bits_count(&sl->gb); slice_param->first_mb_in_slice = (sl->mb_y >> FIELD_OR_MBAFF_PICTURE(h)) * h->mb_width + sl->mb_x; slice_param->slice_type = ff_h264_get_slice_type(sl); slice_param->direct_spatial_mv_pred_flag = sl->slice_type == AV_PICTURE_TYPE_B ? sl->direct_spatial_mv_pred : 0; slice_param->num_ref_idx_l0_active_minus1 = sl->list_count > 0 ? sl->ref_count[0] - 1 : 0; slice_param->num_ref_idx_l1_active_minus1 = sl->list_count > 1 ? sl->ref_count[1] - 1 : 0; slice_param->cabac_init_idc = sl->cabac_init_idc; slice_param->slice_qp_delta = sl->qscale - h->pps.init_qp; slice_param->disable_deblocking_filter_idc = sl->deblocking_filter < 2 ? !sl->deblocking_filter : sl->deblocking_filter; slice_param->slice_alpha_c0_offset_div2 = sl->slice_alpha_c0_offset / 2; slice_param->slice_beta_offset_div2 = sl->slice_beta_offset / 2; slice_param->luma_log2_weight_denom = sl->pwt.luma_log2_weight_denom; slice_param->chroma_log2_weight_denom = sl->pwt.chroma_log2_weight_denom; fill_vaapi_RefPicList(slice_param->RefPicList0, sl->ref_list[0], sl->list_count > 0 ? sl->ref_count[0] : 0); fill_vaapi_RefPicList(slice_param->RefPicList1, sl->ref_list[1], sl->list_count > 1 ? sl->ref_count[1] : 0); fill_vaapi_plain_pred_weight_table(h, 0, &slice_param->luma_weight_l0_flag, slice_param->luma_weight_l0, slice_param->luma_offset_l0, &slice_param->chroma_weight_l0_flag, slice_param->chroma_weight_l0, slice_param->chroma_offset_l0); fill_vaapi_plain_pred_weight_table(h, 1, &slice_param->luma_weight_l1_flag, slice_param->luma_weight_l1, slice_param->luma_offset_l1, &slice_param->chroma_weight_l1_flag, slice_param->chroma_weight_l1, slice_param->chroma_offset_l1); return 0; }
false
FFmpeg
3176217c60ca7828712985092d9102d331ea4f3d
static int vaapi_h264_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { H264Context * const h = avctx->priv_data; H264SliceContext *sl = &h->slice_ctx[0]; VASliceParameterBufferH264 *slice_param; ff_dlog(avctx, "vaapi_h264_decode_slice(): buffer %p, size %d\n", buffer, size); slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size); if (!slice_param) return -1; slice_param->slice_data_bit_offset = get_bits_count(&sl->gb); slice_param->first_mb_in_slice = (sl->mb_y >> FIELD_OR_MBAFF_PICTURE(h)) * h->mb_width + sl->mb_x; slice_param->slice_type = ff_h264_get_slice_type(sl); slice_param->direct_spatial_mv_pred_flag = sl->slice_type == AV_PICTURE_TYPE_B ? sl->direct_spatial_mv_pred : 0; slice_param->num_ref_idx_l0_active_minus1 = sl->list_count > 0 ? sl->ref_count[0] - 1 : 0; slice_param->num_ref_idx_l1_active_minus1 = sl->list_count > 1 ? sl->ref_count[1] - 1 : 0; slice_param->cabac_init_idc = sl->cabac_init_idc; slice_param->slice_qp_delta = sl->qscale - h->pps.init_qp; slice_param->disable_deblocking_filter_idc = sl->deblocking_filter < 2 ? !sl->deblocking_filter : sl->deblocking_filter; slice_param->slice_alpha_c0_offset_div2 = sl->slice_alpha_c0_offset / 2; slice_param->slice_beta_offset_div2 = sl->slice_beta_offset / 2; slice_param->luma_log2_weight_denom = sl->pwt.luma_log2_weight_denom; slice_param->chroma_log2_weight_denom = sl->pwt.chroma_log2_weight_denom; fill_vaapi_RefPicList(slice_param->RefPicList0, sl->ref_list[0], sl->list_count > 0 ? sl->ref_count[0] : 0); fill_vaapi_RefPicList(slice_param->RefPicList1, sl->ref_list[1], sl->list_count > 1 ? sl->ref_count[1] : 0); fill_vaapi_plain_pred_weight_table(h, 0, &slice_param->luma_weight_l0_flag, slice_param->luma_weight_l0, slice_param->luma_offset_l0, &slice_param->chroma_weight_l0_flag, slice_param->chroma_weight_l0, slice_param->chroma_offset_l0); fill_vaapi_plain_pred_weight_table(h, 1, &slice_param->luma_weight_l1_flag, slice_param->luma_weight_l1, slice_param->luma_offset_l1, &slice_param->chroma_weight_l1_flag, slice_param->chroma_weight_l1, slice_param->chroma_offset_l1); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, const uint8_t *VAR_1, uint32_t VAR_2) { H264Context * const h = VAR_0->priv_data; H264SliceContext *sl = &h->slice_ctx[0]; VASliceParameterBufferH264 *slice_param; ff_dlog(VAR_0, "FUNC_0(): VAR_1 %p, VAR_2 %d\n", VAR_1, VAR_2); slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(VAR_0->hwaccel_context, VAR_1, VAR_2); if (!slice_param) return -1; slice_param->slice_data_bit_offset = get_bits_count(&sl->gb); slice_param->first_mb_in_slice = (sl->mb_y >> FIELD_OR_MBAFF_PICTURE(h)) * h->mb_width + sl->mb_x; slice_param->slice_type = ff_h264_get_slice_type(sl); slice_param->direct_spatial_mv_pred_flag = sl->slice_type == AV_PICTURE_TYPE_B ? sl->direct_spatial_mv_pred : 0; slice_param->num_ref_idx_l0_active_minus1 = sl->list_count > 0 ? sl->ref_count[0] - 1 : 0; slice_param->num_ref_idx_l1_active_minus1 = sl->list_count > 1 ? sl->ref_count[1] - 1 : 0; slice_param->cabac_init_idc = sl->cabac_init_idc; slice_param->slice_qp_delta = sl->qscale - h->pps.init_qp; slice_param->disable_deblocking_filter_idc = sl->deblocking_filter < 2 ? !sl->deblocking_filter : sl->deblocking_filter; slice_param->slice_alpha_c0_offset_div2 = sl->slice_alpha_c0_offset / 2; slice_param->slice_beta_offset_div2 = sl->slice_beta_offset / 2; slice_param->luma_log2_weight_denom = sl->pwt.luma_log2_weight_denom; slice_param->chroma_log2_weight_denom = sl->pwt.chroma_log2_weight_denom; fill_vaapi_RefPicList(slice_param->RefPicList0, sl->ref_list[0], sl->list_count > 0 ? sl->ref_count[0] : 0); fill_vaapi_RefPicList(slice_param->RefPicList1, sl->ref_list[1], sl->list_count > 1 ? sl->ref_count[1] : 0); fill_vaapi_plain_pred_weight_table(h, 0, &slice_param->luma_weight_l0_flag, slice_param->luma_weight_l0, slice_param->luma_offset_l0, &slice_param->chroma_weight_l0_flag, slice_param->chroma_weight_l0, slice_param->chroma_offset_l0); fill_vaapi_plain_pred_weight_table(h, 1, &slice_param->luma_weight_l1_flag, slice_param->luma_weight_l1, slice_param->luma_offset_l1, &slice_param->chroma_weight_l1_flag, slice_param->chroma_weight_l1, slice_param->chroma_offset_l1); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nconst uint8_t *VAR_1,\nuint32_t VAR_2)\n{", "H264Context * const h = VAR_0->priv_data;", "H264SliceContext *sl = &h->slice_ctx[0];", "VASliceParameterBufferH264 *slice_param;", "ff_dlog(VAR_0, \"FUNC_0(): VAR_1 %p, VAR_2 %d\\n\",\nVAR_1, VAR_2);", "slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(VAR_0->hwaccel_context, VAR_1, VAR_2);", "if (!slice_param)\nreturn -1;", "slice_param->slice_data_bit_offset = get_bits_count(&sl->gb);", "slice_param->first_mb_in_slice = (sl->mb_y >> FIELD_OR_MBAFF_PICTURE(h)) * h->mb_width + sl->mb_x;", "slice_param->slice_type = ff_h264_get_slice_type(sl);", "slice_param->direct_spatial_mv_pred_flag = sl->slice_type == AV_PICTURE_TYPE_B ? sl->direct_spatial_mv_pred : 0;", "slice_param->num_ref_idx_l0_active_minus1 = sl->list_count > 0 ? sl->ref_count[0] - 1 : 0;", "slice_param->num_ref_idx_l1_active_minus1 = sl->list_count > 1 ? sl->ref_count[1] - 1 : 0;", "slice_param->cabac_init_idc = sl->cabac_init_idc;", "slice_param->slice_qp_delta = sl->qscale - h->pps.init_qp;", "slice_param->disable_deblocking_filter_idc = sl->deblocking_filter < 2 ? !sl->deblocking_filter : sl->deblocking_filter;", "slice_param->slice_alpha_c0_offset_div2 = sl->slice_alpha_c0_offset / 2;", "slice_param->slice_beta_offset_div2 = sl->slice_beta_offset / 2;", "slice_param->luma_log2_weight_denom = sl->pwt.luma_log2_weight_denom;", "slice_param->chroma_log2_weight_denom = sl->pwt.chroma_log2_weight_denom;", "fill_vaapi_RefPicList(slice_param->RefPicList0, sl->ref_list[0], sl->list_count > 0 ? sl->ref_count[0] : 0);", "fill_vaapi_RefPicList(slice_param->RefPicList1, sl->ref_list[1], sl->list_count > 1 ? sl->ref_count[1] : 0);", "fill_vaapi_plain_pred_weight_table(h, 0,\n&slice_param->luma_weight_l0_flag, slice_param->luma_weight_l0, slice_param->luma_offset_l0,\n&slice_param->chroma_weight_l0_flag, slice_param->chroma_weight_l0, slice_param->chroma_offset_l0);", "fill_vaapi_plain_pred_weight_table(h, 1,\n&slice_param->luma_weight_l1_flag, slice_param->luma_weight_l1, slice_param->luma_offset_l1,\n&slice_param->chroma_weight_l1_flag, slice_param->chroma_weight_l1, slice_param->chroma_offset_l1);", "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 ], [ 13 ], [ 17, 19 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 65, 67, 69 ], [ 71, 73, 75 ], [ 77 ], [ 79 ] ]
11,572
static void adaptive_quantization(MpegEncContext *s, double q){ int i; const float lumi_masking= s->avctx->lumi_masking / (128.0*128.0); const float dark_masking= s->avctx->dark_masking / (128.0*128.0); const float temp_cplx_masking= s->avctx->temporal_cplx_masking; const float spatial_cplx_masking = s->avctx->spatial_cplx_masking; const float p_masking = s->avctx->p_masking; float bits_sum= 0.0; float cplx_sum= 0.0; float cplx_tab[s->mb_num]; float bits_tab[s->mb_num]; const int qmin= 2; //s->avctx->mb_qmin; const int qmax= 31; //s->avctx->mb_qmax; Picture * const pic= &s->current_picture; for(i=0; i<s->mb_num; i++){ float temp_cplx= sqrt(pic->mc_mb_var[i]); float spat_cplx= sqrt(pic->mb_var[i]); const int lumi= pic->mb_mean[i]; float bits, cplx, factor; if(spat_cplx < q/3) spat_cplx= q/3; //FIXME finetune if(temp_cplx < q/3) temp_cplx= q/3; //FIXME finetune if((s->mb_type[i]&MB_TYPE_INTRA)){//FIXME hq mode cplx= spat_cplx; factor= 1.0 + p_masking; }else{ cplx= temp_cplx; factor= pow(temp_cplx, - temp_cplx_masking); } factor*=pow(spat_cplx, - spatial_cplx_masking); if(lumi>127) factor*= (1.0 - (lumi-128)*(lumi-128)*lumi_masking); else factor*= (1.0 - (lumi-128)*(lumi-128)*dark_masking); if(factor<0.00001) factor= 0.00001; bits= cplx*factor; cplx_sum+= cplx; bits_sum+= bits; cplx_tab[i]= cplx; bits_tab[i]= bits; } /* handle qmin/qmax cliping */ if(s->flags&CODEC_FLAG_NORMALIZE_AQP){ for(i=0; i<s->mb_num; i++){ float newq= q*cplx_tab[i]/bits_tab[i]; newq*= bits_sum/cplx_sum; if (newq > qmax){ bits_sum -= bits_tab[i]; cplx_sum -= cplx_tab[i]*q/qmax; } else if(newq < qmin){ bits_sum -= bits_tab[i]; cplx_sum -= cplx_tab[i]*q/qmin; } } } for(i=0; i<s->mb_num; i++){ float newq= q*cplx_tab[i]/bits_tab[i]; int intq; if(s->flags&CODEC_FLAG_NORMALIZE_AQP){ newq*= bits_sum/cplx_sum; } if(i && ABS(pic->qscale_table[i-1] - newq)<0.75) intq= pic->qscale_table[i-1]; else intq= (int)(newq + 0.5); if (intq > qmax) intq= qmax; else if(intq < qmin) intq= qmin; //if(i%s->mb_width==0) printf("\n"); //printf("%2d%3d ", intq, ff_sqrt(s->mc_mb_var[i])); pic->qscale_table[i]= intq; } }
false
FFmpeg
17a70fdeeff1260ac9b2651ea9f36dbd23d0ced8
static void adaptive_quantization(MpegEncContext *s, double q){ int i; const float lumi_masking= s->avctx->lumi_masking / (128.0*128.0); const float dark_masking= s->avctx->dark_masking / (128.0*128.0); const float temp_cplx_masking= s->avctx->temporal_cplx_masking; const float spatial_cplx_masking = s->avctx->spatial_cplx_masking; const float p_masking = s->avctx->p_masking; float bits_sum= 0.0; float cplx_sum= 0.0; float cplx_tab[s->mb_num]; float bits_tab[s->mb_num]; const int qmin= 2; const int qmax= 31; Picture * const pic= &s->current_picture; for(i=0; i<s->mb_num; i++){ float temp_cplx= sqrt(pic->mc_mb_var[i]); float spat_cplx= sqrt(pic->mb_var[i]); const int lumi= pic->mb_mean[i]; float bits, cplx, factor; if(spat_cplx < q/3) spat_cplx= q/3; if(temp_cplx < q/3) temp_cplx= q/3; if((s->mb_type[i]&MB_TYPE_INTRA)){ cplx= spat_cplx; factor= 1.0 + p_masking; }else{ cplx= temp_cplx; factor= pow(temp_cplx, - temp_cplx_masking); } factor*=pow(spat_cplx, - spatial_cplx_masking); if(lumi>127) factor*= (1.0 - (lumi-128)*(lumi-128)*lumi_masking); else factor*= (1.0 - (lumi-128)*(lumi-128)*dark_masking); if(factor<0.00001) factor= 0.00001; bits= cplx*factor; cplx_sum+= cplx; bits_sum+= bits; cplx_tab[i]= cplx; bits_tab[i]= bits; } if(s->flags&CODEC_FLAG_NORMALIZE_AQP){ for(i=0; i<s->mb_num; i++){ float newq= q*cplx_tab[i]/bits_tab[i]; newq*= bits_sum/cplx_sum; if (newq > qmax){ bits_sum -= bits_tab[i]; cplx_sum -= cplx_tab[i]*q/qmax; } else if(newq < qmin){ bits_sum -= bits_tab[i]; cplx_sum -= cplx_tab[i]*q/qmin; } } } for(i=0; i<s->mb_num; i++){ float newq= q*cplx_tab[i]/bits_tab[i]; int intq; if(s->flags&CODEC_FLAG_NORMALIZE_AQP){ newq*= bits_sum/cplx_sum; } if(i && ABS(pic->qscale_table[i-1] - newq)<0.75) intq= pic->qscale_table[i-1]; else intq= (int)(newq + 0.5); if (intq > qmax) intq= qmax; else if(intq < qmin) intq= qmin; pic->qscale_table[i]= intq; } }
{ "code": [], "line_no": [] }
static void FUNC_0(MpegEncContext *VAR_0, double VAR_1){ int VAR_2; const float VAR_3= VAR_0->avctx->VAR_3 / (128.0*128.0); const float VAR_4= VAR_0->avctx->VAR_4 / (128.0*128.0); const float VAR_5= VAR_0->avctx->temporal_cplx_masking; const float VAR_6 = VAR_0->avctx->VAR_6; const float VAR_7 = VAR_0->avctx->VAR_7; float VAR_8= 0.0; float VAR_9= 0.0; float VAR_10[VAR_0->mb_num]; float VAR_11[VAR_0->mb_num]; const int VAR_12= 2; const int VAR_13= 31; Picture * const pic= &VAR_0->current_picture; for(VAR_2=0; VAR_2<VAR_0->mb_num; VAR_2++){ float temp_cplx= sqrt(pic->mc_mb_var[VAR_2]); float spat_cplx= sqrt(pic->mb_var[VAR_2]); const int lumi= pic->mb_mean[VAR_2]; float bits, cplx, factor; if(spat_cplx < VAR_1/3) spat_cplx= VAR_1/3; if(temp_cplx < VAR_1/3) temp_cplx= VAR_1/3; if((VAR_0->mb_type[VAR_2]&MB_TYPE_INTRA)){ cplx= spat_cplx; factor= 1.0 + VAR_7; }else{ cplx= temp_cplx; factor= pow(temp_cplx, - VAR_5); } factor*=pow(spat_cplx, - VAR_6); if(lumi>127) factor*= (1.0 - (lumi-128)*(lumi-128)*VAR_3); else factor*= (1.0 - (lumi-128)*(lumi-128)*VAR_4); if(factor<0.00001) factor= 0.00001; bits= cplx*factor; VAR_9+= cplx; VAR_8+= bits; VAR_10[VAR_2]= cplx; VAR_11[VAR_2]= bits; } if(VAR_0->flags&CODEC_FLAG_NORMALIZE_AQP){ for(VAR_2=0; VAR_2<VAR_0->mb_num; VAR_2++){ float newq= VAR_1*VAR_10[VAR_2]/VAR_11[VAR_2]; newq*= VAR_8/VAR_9; if (newq > VAR_13){ VAR_8 -= VAR_11[VAR_2]; VAR_9 -= VAR_10[VAR_2]*VAR_1/VAR_13; } else if(newq < VAR_12){ VAR_8 -= VAR_11[VAR_2]; VAR_9 -= VAR_10[VAR_2]*VAR_1/VAR_12; } } } for(VAR_2=0; VAR_2<VAR_0->mb_num; VAR_2++){ float newq= VAR_1*VAR_10[VAR_2]/VAR_11[VAR_2]; int intq; if(VAR_0->flags&CODEC_FLAG_NORMALIZE_AQP){ newq*= VAR_8/VAR_9; } if(VAR_2 && ABS(pic->qscale_table[VAR_2-1] - newq)<0.75) intq= pic->qscale_table[VAR_2-1]; else intq= (int)(newq + 0.5); if (intq > VAR_13) intq= VAR_13; else if(intq < VAR_12) intq= VAR_12; pic->qscale_table[VAR_2]= intq; } }
[ "static void FUNC_0(MpegEncContext *VAR_0, double VAR_1){", "int VAR_2;", "const float VAR_3= VAR_0->avctx->VAR_3 / (128.0*128.0);", "const float VAR_4= VAR_0->avctx->VAR_4 / (128.0*128.0);", "const float VAR_5= VAR_0->avctx->temporal_cplx_masking;", "const float VAR_6 = VAR_0->avctx->VAR_6;", "const float VAR_7 = VAR_0->avctx->VAR_7;", "float VAR_8= 0.0;", "float VAR_9= 0.0;", "float VAR_10[VAR_0->mb_num];", "float VAR_11[VAR_0->mb_num];", "const int VAR_12= 2;", "const int VAR_13= 31;", "Picture * const pic= &VAR_0->current_picture;", "for(VAR_2=0; VAR_2<VAR_0->mb_num; VAR_2++){", "float temp_cplx= sqrt(pic->mc_mb_var[VAR_2]);", "float spat_cplx= sqrt(pic->mb_var[VAR_2]);", "const int lumi= pic->mb_mean[VAR_2];", "float bits, cplx, factor;", "if(spat_cplx < VAR_1/3) spat_cplx= VAR_1/3;", "if(temp_cplx < VAR_1/3) temp_cplx= VAR_1/3;", "if((VAR_0->mb_type[VAR_2]&MB_TYPE_INTRA)){", "cplx= spat_cplx;", "factor= 1.0 + VAR_7;", "}else{", "cplx= temp_cplx;", "factor= pow(temp_cplx, - VAR_5);", "}", "factor*=pow(spat_cplx, - VAR_6);", "if(lumi>127)\nfactor*= (1.0 - (lumi-128)*(lumi-128)*VAR_3);", "else\nfactor*= (1.0 - (lumi-128)*(lumi-128)*VAR_4);", "if(factor<0.00001) factor= 0.00001;", "bits= cplx*factor;", "VAR_9+= cplx;", "VAR_8+= bits;", "VAR_10[VAR_2]= cplx;", "VAR_11[VAR_2]= bits;", "}", "if(VAR_0->flags&CODEC_FLAG_NORMALIZE_AQP){", "for(VAR_2=0; VAR_2<VAR_0->mb_num; VAR_2++){", "float newq= VAR_1*VAR_10[VAR_2]/VAR_11[VAR_2];", "newq*= VAR_8/VAR_9;", "if (newq > VAR_13){", "VAR_8 -= VAR_11[VAR_2];", "VAR_9 -= VAR_10[VAR_2]*VAR_1/VAR_13;", "}", "else if(newq < VAR_12){", "VAR_8 -= VAR_11[VAR_2];", "VAR_9 -= VAR_10[VAR_2]*VAR_1/VAR_12;", "}", "}", "}", "for(VAR_2=0; VAR_2<VAR_0->mb_num; VAR_2++){", "float newq= VAR_1*VAR_10[VAR_2]/VAR_11[VAR_2];", "int intq;", "if(VAR_0->flags&CODEC_FLAG_NORMALIZE_AQP){", "newq*= VAR_8/VAR_9;", "}", "if(VAR_2 && ABS(pic->qscale_table[VAR_2-1] - newq)<0.75)\nintq= pic->qscale_table[VAR_2-1];", "else\nintq= (int)(newq + 0.5);", "if (intq > VAR_13) intq= VAR_13;", "else if(intq < VAR_12) intq= VAR_12;", "pic->qscale_table[VAR_2]= intq;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 71, 73 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 145, 147 ], [ 149, 151 ], [ 155 ], [ 157 ], [ 163 ], [ 165 ], [ 167 ] ]
11,573
static int flashsv2_prime(FlashSVContext *s, uint8_t *src, int size, int unp_size) { z_stream zs; int zret; // Zlib return code zs.zalloc = NULL; zs.zfree = NULL; zs.opaque = NULL; s->zstream.next_in = src; s->zstream.avail_in = size; s->zstream.next_out = s->tmpblock; s->zstream.avail_out = s->block_size * 3; inflate(&s->zstream, Z_SYNC_FLUSH); deflateInit(&zs, 0); zs.next_in = s->tmpblock; zs.avail_in = s->block_size * 3 - s->zstream.avail_out; zs.next_out = s->deflate_block; zs.avail_out = s->deflate_block_size; deflate(&zs, Z_SYNC_FLUSH); deflateEnd(&zs); if ((zret = inflateReset(&s->zstream)) != Z_OK) { av_log(s->avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret); return AVERROR_UNKNOWN; } s->zstream.next_in = s->deflate_block; s->zstream.avail_in = s->deflate_block_size - zs.avail_out; s->zstream.next_out = s->tmpblock; s->zstream.avail_out = s->block_size * 3; inflate(&s->zstream, Z_SYNC_FLUSH); return 0; }
false
FFmpeg
b3eb4f54c0d091ed518b38a5b90183d0d55fa729
static int flashsv2_prime(FlashSVContext *s, uint8_t *src, int size, int unp_size) { z_stream zs; int zret; zs.zalloc = NULL; zs.zfree = NULL; zs.opaque = NULL; s->zstream.next_in = src; s->zstream.avail_in = size; s->zstream.next_out = s->tmpblock; s->zstream.avail_out = s->block_size * 3; inflate(&s->zstream, Z_SYNC_FLUSH); deflateInit(&zs, 0); zs.next_in = s->tmpblock; zs.avail_in = s->block_size * 3 - s->zstream.avail_out; zs.next_out = s->deflate_block; zs.avail_out = s->deflate_block_size; deflate(&zs, Z_SYNC_FLUSH); deflateEnd(&zs); if ((zret = inflateReset(&s->zstream)) != Z_OK) { av_log(s->avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret); return AVERROR_UNKNOWN; } s->zstream.next_in = s->deflate_block; s->zstream.avail_in = s->deflate_block_size - zs.avail_out; s->zstream.next_out = s->tmpblock; s->zstream.avail_out = s->block_size * 3; inflate(&s->zstream, Z_SYNC_FLUSH); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FlashSVContext *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3) { z_stream zs; int VAR_4; zs.zalloc = NULL; zs.zfree = NULL; zs.opaque = NULL; VAR_0->zstream.next_in = VAR_1; VAR_0->zstream.avail_in = VAR_2; VAR_0->zstream.next_out = VAR_0->tmpblock; VAR_0->zstream.avail_out = VAR_0->block_size * 3; inflate(&VAR_0->zstream, Z_SYNC_FLUSH); deflateInit(&zs, 0); zs.next_in = VAR_0->tmpblock; zs.avail_in = VAR_0->block_size * 3 - VAR_0->zstream.avail_out; zs.next_out = VAR_0->deflate_block; zs.avail_out = VAR_0->deflate_block_size; deflate(&zs, Z_SYNC_FLUSH); deflateEnd(&zs); if ((VAR_4 = inflateReset(&VAR_0->zstream)) != Z_OK) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", VAR_4); return AVERROR_UNKNOWN; } VAR_0->zstream.next_in = VAR_0->deflate_block; VAR_0->zstream.avail_in = VAR_0->deflate_block_size - zs.avail_out; VAR_0->zstream.next_out = VAR_0->tmpblock; VAR_0->zstream.avail_out = VAR_0->block_size * 3; inflate(&VAR_0->zstream, Z_SYNC_FLUSH); return 0; }
[ "static int FUNC_0(FlashSVContext *VAR_0, uint8_t *VAR_1,\nint VAR_2, int VAR_3)\n{", "z_stream zs;", "int VAR_4;", "zs.zalloc = NULL;", "zs.zfree = NULL;", "zs.opaque = NULL;", "VAR_0->zstream.next_in = VAR_1;", "VAR_0->zstream.avail_in = VAR_2;", "VAR_0->zstream.next_out = VAR_0->tmpblock;", "VAR_0->zstream.avail_out = VAR_0->block_size * 3;", "inflate(&VAR_0->zstream, Z_SYNC_FLUSH);", "deflateInit(&zs, 0);", "zs.next_in = VAR_0->tmpblock;", "zs.avail_in = VAR_0->block_size * 3 - VAR_0->zstream.avail_out;", "zs.next_out = VAR_0->deflate_block;", "zs.avail_out = VAR_0->deflate_block_size;", "deflate(&zs, Z_SYNC_FLUSH);", "deflateEnd(&zs);", "if ((VAR_4 = inflateReset(&VAR_0->zstream)) != Z_OK) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Inflate reset error: %d\\n\", VAR_4);", "return AVERROR_UNKNOWN;", "}", "VAR_0->zstream.next_in = VAR_0->deflate_block;", "VAR_0->zstream.avail_in = VAR_0->deflate_block_size - zs.avail_out;", "VAR_0->zstream.next_out = VAR_0->tmpblock;", "VAR_0->zstream.avail_out = VAR_0->block_size * 3;", "inflate(&VAR_0->zstream, Z_SYNC_FLUSH);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ] ]
11,574
int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx) { MpegEncContext *s = &ctx->m; int mb_num_bits = av_log2(s->mb_num - 1) + 1; int header_extension = 0, mb_num, len; /* is there enough space left for a video packet + header */ if (get_bits_count(&s->gb) > s->gb.size_in_bits - 20) return -1; for (len = 0; len < 32; len++) if (get_bits1(&s->gb)) break; if (len != ff_mpeg4_get_video_packet_prefix_length(s)) { av_log(s->avctx, AV_LOG_ERROR, "marker does not match f_code\n"); return -1; } if (ctx->shape != RECT_SHAPE) { header_extension = get_bits1(&s->gb); // FIXME more stuff here } mb_num = get_bits(&s->gb, mb_num_bits); if (mb_num >= s->mb_num) { av_log(s->avctx, AV_LOG_ERROR, "illegal mb_num in video packet (%d %d) \n", mb_num, s->mb_num); return -1; } s->mb_x = mb_num % s->mb_width; s->mb_y = mb_num / s->mb_width; if (ctx->shape != BIN_ONLY_SHAPE) { int qscale = get_bits(&s->gb, s->quant_precision); if (qscale) s->chroma_qscale = s->qscale = qscale; } if (ctx->shape == RECT_SHAPE) header_extension = get_bits1(&s->gb); if (header_extension) { int time_incr = 0; while (get_bits1(&s->gb) != 0) time_incr++; check_marker(s->avctx, &s->gb, "before time_increment in video packed header"); skip_bits(&s->gb, ctx->time_increment_bits); /* time_increment */ check_marker(s->avctx, &s->gb, "before vop_coding_type in video packed header"); skip_bits(&s->gb, 2); /* vop coding type */ // FIXME not rect stuff here if (ctx->shape != BIN_ONLY_SHAPE) { skip_bits(&s->gb, 3); /* intra dc vlc threshold */ // FIXME don't just ignore everything if (s->pict_type == AV_PICTURE_TYPE_S && ctx->vol_sprite_usage == GMC_SPRITE) { if (mpeg4_decode_sprite_trajectory(ctx, &s->gb) < 0) return AVERROR_INVALIDDATA; av_log(s->avctx, AV_LOG_ERROR, "untested\n"); } // FIXME reduced res stuff here if (s->pict_type != AV_PICTURE_TYPE_I) { int f_code = get_bits(&s->gb, 3); /* fcode_for */ if (f_code == 0) av_log(s->avctx, AV_LOG_ERROR, "Error, video packet header damaged (f_code=0)\n"); } if (s->pict_type == AV_PICTURE_TYPE_B) { int b_code = get_bits(&s->gb, 3); if (b_code == 0) av_log(s->avctx, AV_LOG_ERROR, "Error, video packet header damaged (b_code=0)\n"); } } } if (ctx->new_pred) decode_new_pred(ctx, &s->gb); return 0; }
false
FFmpeg
05f4703a168a336363750e32bcfdd6f303fbdbc3
int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx) { MpegEncContext *s = &ctx->m; int mb_num_bits = av_log2(s->mb_num - 1) + 1; int header_extension = 0, mb_num, len; if (get_bits_count(&s->gb) > s->gb.size_in_bits - 20) return -1; for (len = 0; len < 32; len++) if (get_bits1(&s->gb)) break; if (len != ff_mpeg4_get_video_packet_prefix_length(s)) { av_log(s->avctx, AV_LOG_ERROR, "marker does not match f_code\n"); return -1; } if (ctx->shape != RECT_SHAPE) { header_extension = get_bits1(&s->gb); } mb_num = get_bits(&s->gb, mb_num_bits); if (mb_num >= s->mb_num) { av_log(s->avctx, AV_LOG_ERROR, "illegal mb_num in video packet (%d %d) \n", mb_num, s->mb_num); return -1; } s->mb_x = mb_num % s->mb_width; s->mb_y = mb_num / s->mb_width; if (ctx->shape != BIN_ONLY_SHAPE) { int qscale = get_bits(&s->gb, s->quant_precision); if (qscale) s->chroma_qscale = s->qscale = qscale; } if (ctx->shape == RECT_SHAPE) header_extension = get_bits1(&s->gb); if (header_extension) { int time_incr = 0; while (get_bits1(&s->gb) != 0) time_incr++; check_marker(s->avctx, &s->gb, "before time_increment in video packed header"); skip_bits(&s->gb, ctx->time_increment_bits); check_marker(s->avctx, &s->gb, "before vop_coding_type in video packed header"); skip_bits(&s->gb, 2); if (ctx->shape != BIN_ONLY_SHAPE) { skip_bits(&s->gb, 3); if (s->pict_type == AV_PICTURE_TYPE_S && ctx->vol_sprite_usage == GMC_SPRITE) { if (mpeg4_decode_sprite_trajectory(ctx, &s->gb) < 0) return AVERROR_INVALIDDATA; av_log(s->avctx, AV_LOG_ERROR, "untested\n"); } if (s->pict_type != AV_PICTURE_TYPE_I) { int f_code = get_bits(&s->gb, 3); if (f_code == 0) av_log(s->avctx, AV_LOG_ERROR, "Error, video packet header damaged (f_code=0)\n"); } if (s->pict_type == AV_PICTURE_TYPE_B) { int b_code = get_bits(&s->gb, 3); if (b_code == 0) av_log(s->avctx, AV_LOG_ERROR, "Error, video packet header damaged (b_code=0)\n"); } } } if (ctx->new_pred) decode_new_pred(ctx, &s->gb); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(Mpeg4DecContext *VAR_0) { MpegEncContext *s = &VAR_0->m; int VAR_1 = av_log2(s->VAR_3 - 1) + 1; int VAR_2 = 0, VAR_3, VAR_4; if (get_bits_count(&s->gb) > s->gb.size_in_bits - 20) return -1; for (VAR_4 = 0; VAR_4 < 32; VAR_4++) if (get_bits1(&s->gb)) break; if (VAR_4 != ff_mpeg4_get_video_packet_prefix_length(s)) { av_log(s->avctx, AV_LOG_ERROR, "marker does not match VAR_7\n"); return -1; } if (VAR_0->shape != RECT_SHAPE) { VAR_2 = get_bits1(&s->gb); } VAR_3 = get_bits(&s->gb, VAR_1); if (VAR_3 >= s->VAR_3) { av_log(s->avctx, AV_LOG_ERROR, "illegal VAR_3 in video packet (%d %d) \n", VAR_3, s->VAR_3); return -1; } s->mb_x = VAR_3 % s->mb_width; s->mb_y = VAR_3 / s->mb_width; if (VAR_0->shape != BIN_ONLY_SHAPE) { int VAR_5 = get_bits(&s->gb, s->quant_precision); if (VAR_5) s->chroma_qscale = s->VAR_5 = VAR_5; } if (VAR_0->shape == RECT_SHAPE) VAR_2 = get_bits1(&s->gb); if (VAR_2) { int VAR_6 = 0; while (get_bits1(&s->gb) != 0) VAR_6++; check_marker(s->avctx, &s->gb, "before time_increment in video packed header"); skip_bits(&s->gb, VAR_0->time_increment_bits); check_marker(s->avctx, &s->gb, "before vop_coding_type in video packed header"); skip_bits(&s->gb, 2); if (VAR_0->shape != BIN_ONLY_SHAPE) { skip_bits(&s->gb, 3); if (s->pict_type == AV_PICTURE_TYPE_S && VAR_0->vol_sprite_usage == GMC_SPRITE) { if (mpeg4_decode_sprite_trajectory(VAR_0, &s->gb) < 0) return AVERROR_INVALIDDATA; av_log(s->avctx, AV_LOG_ERROR, "untested\n"); } if (s->pict_type != AV_PICTURE_TYPE_I) { int VAR_7 = get_bits(&s->gb, 3); if (VAR_7 == 0) av_log(s->avctx, AV_LOG_ERROR, "Error, video packet header damaged (VAR_7=0)\n"); } if (s->pict_type == AV_PICTURE_TYPE_B) { int VAR_8 = get_bits(&s->gb, 3); if (VAR_8 == 0) av_log(s->avctx, AV_LOG_ERROR, "Error, video packet header damaged (VAR_8=0)\n"); } } } if (VAR_0->new_pred) decode_new_pred(VAR_0, &s->gb); return 0; }
[ "int FUNC_0(Mpeg4DecContext *VAR_0)\n{", "MpegEncContext *s = &VAR_0->m;", "int VAR_1 = av_log2(s->VAR_3 - 1) + 1;", "int VAR_2 = 0, VAR_3, VAR_4;", "if (get_bits_count(&s->gb) > s->gb.size_in_bits - 20)\nreturn -1;", "for (VAR_4 = 0; VAR_4 < 32; VAR_4++)", "if (get_bits1(&s->gb))\nbreak;", "if (VAR_4 != ff_mpeg4_get_video_packet_prefix_length(s)) {", "av_log(s->avctx, AV_LOG_ERROR, \"marker does not match VAR_7\\n\");", "return -1;", "}", "if (VAR_0->shape != RECT_SHAPE) {", "VAR_2 = get_bits1(&s->gb);", "}", "VAR_3 = get_bits(&s->gb, VAR_1);", "if (VAR_3 >= s->VAR_3) {", "av_log(s->avctx, AV_LOG_ERROR,\n\"illegal VAR_3 in video packet (%d %d) \\n\", VAR_3, s->VAR_3);", "return -1;", "}", "s->mb_x = VAR_3 % s->mb_width;", "s->mb_y = VAR_3 / s->mb_width;", "if (VAR_0->shape != BIN_ONLY_SHAPE) {", "int VAR_5 = get_bits(&s->gb, s->quant_precision);", "if (VAR_5)\ns->chroma_qscale = s->VAR_5 = VAR_5;", "}", "if (VAR_0->shape == RECT_SHAPE)\nVAR_2 = get_bits1(&s->gb);", "if (VAR_2) {", "int VAR_6 = 0;", "while (get_bits1(&s->gb) != 0)\nVAR_6++;", "check_marker(s->avctx, &s->gb, \"before time_increment in video packed header\");", "skip_bits(&s->gb, VAR_0->time_increment_bits);", "check_marker(s->avctx, &s->gb, \"before vop_coding_type in video packed header\");", "skip_bits(&s->gb, 2);", "if (VAR_0->shape != BIN_ONLY_SHAPE) {", "skip_bits(&s->gb, 3);", "if (s->pict_type == AV_PICTURE_TYPE_S &&\nVAR_0->vol_sprite_usage == GMC_SPRITE) {", "if (mpeg4_decode_sprite_trajectory(VAR_0, &s->gb) < 0)\nreturn AVERROR_INVALIDDATA;", "av_log(s->avctx, AV_LOG_ERROR, \"untested\\n\");", "}", "if (s->pict_type != AV_PICTURE_TYPE_I) {", "int VAR_7 = get_bits(&s->gb, 3);", "if (VAR_7 == 0)\nav_log(s->avctx, AV_LOG_ERROR,\n\"Error, video packet header damaged (VAR_7=0)\\n\");", "}", "if (s->pict_type == AV_PICTURE_TYPE_B) {", "int VAR_8 = get_bits(&s->gb, 3);", "if (VAR_8 == 0)\nav_log(s->avctx, AV_LOG_ERROR,\n\"Error, video packet header damaged (VAR_8=0)\\n\");", "}", "}", "}", "if (VAR_0->new_pred)\ndecode_new_pred(VAR_0, &s->gb);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 17, 19 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 83, 85 ], [ 89 ], [ 91 ], [ 95, 97 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 115 ], [ 117 ], [ 121, 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 139 ], [ 141 ], [ 143, 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155, 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 173 ], [ 175 ] ]