id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
741
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) { int64_t offset1; int64_t pos; int force = whence & AVSEEK_FORCE; int buffer_size; int short_seek; whence &= ~AVSEEK_FORCE; if(!s) buffer_size = s->buf_end - s->buffer; // pos is the absolute position that the beginning of s->buffer corresponds to in the file pos = s->pos - (s->write_flag ? 0 : buffer_size); if (whence != SEEK_CUR && whence != SEEK_SET) if (whence == SEEK_CUR) { offset1 = pos + (s->buf_ptr - s->buffer); if (offset == 0) return offset1; offset += offset1; } if (offset < 0) if (s->short_seek_get) { short_seek = s->short_seek_get(s->opaque); /* fallback to default short seek */ if (short_seek <= 0) short_seek = s->short_seek_threshold; } else short_seek = s->short_seek_threshold; offset1 = offset - pos; // "offset1" is the relative offset from the beginning of s->buffer s->buf_ptr_max = FFMAX(s->buf_ptr_max, s->buf_ptr); if ((!s->direct || !s->seek) && offset1 >= 0 && offset1 <= (s->write_flag ? s->buf_ptr_max - s->buffer : buffer_size)) { /* can do the seek inside the buffer */ s->buf_ptr = s->buffer + offset1; } else if ((!(s->seekable & AVIO_SEEKABLE_NORMAL) || offset1 <= buffer_size + short_seek) && !s->write_flag && offset1 >= 0 && (!s->direct || !s->seek) && (whence != SEEK_END || force)) { while(s->pos < offset && !s->eof_reached) fill_buffer(s); if (s->eof_reached) return AVERROR_EOF; s->buf_ptr = s->buf_end - (s->pos - offset); } else if(!s->write_flag && offset1 < 0 && -offset1 < buffer_size>>1 && s->seek && offset > 0) { int64_t res; pos -= FFMIN(buffer_size>>1, pos); if ((res = s->seek(s->opaque, pos, SEEK_SET)) < 0) return res; s->buf_end = s->buf_ptr = s->buffer; s->pos = pos; s->eof_reached = 0; fill_buffer(s); return avio_seek(s, offset, SEEK_SET | force); } else { int64_t res; if (s->write_flag) { flush_buffer(s); } if (!s->seek) return AVERROR(EPIPE); if ((res = s->seek(s->opaque, offset, SEEK_SET)) < 0) return res; s->seek_count ++; if (!s->write_flag) s->buf_end = s->buffer; s->buf_ptr = s->buf_ptr_max = s->buffer; s->pos = offset; } s->eof_reached = 0; return offset; }
true
FFmpeg
eca2a49716ae1f42804dd3545da2f740edf03250
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) { int64_t offset1; int64_t pos; int force = whence & AVSEEK_FORCE; int buffer_size; int short_seek; whence &= ~AVSEEK_FORCE; if(!s) buffer_size = s->buf_end - s->buffer; pos = s->pos - (s->write_flag ? 0 : buffer_size); if (whence != SEEK_CUR && whence != SEEK_SET) if (whence == SEEK_CUR) { offset1 = pos + (s->buf_ptr - s->buffer); if (offset == 0) return offset1; offset += offset1; } if (offset < 0) if (s->short_seek_get) { short_seek = s->short_seek_get(s->opaque); if (short_seek <= 0) short_seek = s->short_seek_threshold; } else short_seek = s->short_seek_threshold; offset1 = offset - pos; s->buf_ptr_max = FFMAX(s->buf_ptr_max, s->buf_ptr); if ((!s->direct || !s->seek) && offset1 >= 0 && offset1 <= (s->write_flag ? s->buf_ptr_max - s->buffer : buffer_size)) { s->buf_ptr = s->buffer + offset1; } else if ((!(s->seekable & AVIO_SEEKABLE_NORMAL) || offset1 <= buffer_size + short_seek) && !s->write_flag && offset1 >= 0 && (!s->direct || !s->seek) && (whence != SEEK_END || force)) { while(s->pos < offset && !s->eof_reached) fill_buffer(s); if (s->eof_reached) return AVERROR_EOF; s->buf_ptr = s->buf_end - (s->pos - offset); } else if(!s->write_flag && offset1 < 0 && -offset1 < buffer_size>>1 && s->seek && offset > 0) { int64_t res; pos -= FFMIN(buffer_size>>1, pos); if ((res = s->seek(s->opaque, pos, SEEK_SET)) < 0) return res; s->buf_end = s->buf_ptr = s->buffer; s->pos = pos; s->eof_reached = 0; fill_buffer(s); return avio_seek(s, offset, SEEK_SET | force); } else { int64_t res; if (s->write_flag) { flush_buffer(s); } if (!s->seek) return AVERROR(EPIPE); if ((res = s->seek(s->opaque, offset, SEEK_SET)) < 0) return res; s->seek_count ++; if (!s->write_flag) s->buf_end = s->buffer; s->buf_ptr = s->buf_ptr_max = s->buffer; s->pos = offset; } s->eof_reached = 0; return offset; }
{ "code": [], "line_no": [] }
int64_t FUNC_0(AVIOContext *s, int64_t offset, int whence) { int64_t offset1; int64_t pos; int VAR_0 = whence & AVSEEK_FORCE; int VAR_1; int VAR_2; whence &= ~AVSEEK_FORCE; if(!s) VAR_1 = s->buf_end - s->buffer; pos = s->pos - (s->write_flag ? 0 : VAR_1); if (whence != SEEK_CUR && whence != SEEK_SET) if (whence == SEEK_CUR) { offset1 = pos + (s->buf_ptr - s->buffer); if (offset == 0) return offset1; offset += offset1; } if (offset < 0) if (s->short_seek_get) { VAR_2 = s->short_seek_get(s->opaque); if (VAR_2 <= 0) VAR_2 = s->short_seek_threshold; } else VAR_2 = s->short_seek_threshold; offset1 = offset - pos; s->buf_ptr_max = FFMAX(s->buf_ptr_max, s->buf_ptr); if ((!s->direct || !s->seek) && offset1 >= 0 && offset1 <= (s->write_flag ? s->buf_ptr_max - s->buffer : VAR_1)) { s->buf_ptr = s->buffer + offset1; } else if ((!(s->seekable & AVIO_SEEKABLE_NORMAL) || offset1 <= VAR_1 + VAR_2) && !s->write_flag && offset1 >= 0 && (!s->direct || !s->seek) && (whence != SEEK_END || VAR_0)) { while(s->pos < offset && !s->eof_reached) fill_buffer(s); if (s->eof_reached) return AVERROR_EOF; s->buf_ptr = s->buf_end - (s->pos - offset); } else if(!s->write_flag && offset1 < 0 && -offset1 < VAR_1>>1 && s->seek && offset > 0) { int64_t res; pos -= FFMIN(VAR_1>>1, pos); if ((res = s->seek(s->opaque, pos, SEEK_SET)) < 0) return res; s->buf_end = s->buf_ptr = s->buffer; s->pos = pos; s->eof_reached = 0; fill_buffer(s); return FUNC_0(s, offset, SEEK_SET | VAR_0); } else { int64_t res; if (s->write_flag) { flush_buffer(s); } if (!s->seek) return AVERROR(EPIPE); if ((res = s->seek(s->opaque, offset, SEEK_SET)) < 0) return res; s->seek_count ++; if (!s->write_flag) s->buf_end = s->buffer; s->buf_ptr = s->buf_ptr_max = s->buffer; s->pos = offset; } s->eof_reached = 0; return offset; }
[ "int64_t FUNC_0(AVIOContext *s, int64_t offset, int whence)\n{", "int64_t offset1;", "int64_t pos;", "int VAR_0 = whence & AVSEEK_FORCE;", "int VAR_1;", "int VAR_2;", "whence &= ~AVSEEK_FORCE;", "if(!s)\nVAR_1 = s->buf_end - s->buffer;", "pos = s->pos - (s->write_flag ? 0 : VAR_1);", "if (whence != SEEK_CUR && whence != SEEK_SET)\nif (whence == SEEK_CUR) {", "offset1 = pos + (s->buf_ptr - s->buffer);", "if (offset == 0)\nreturn offset1;", "offset += offset1;", "}", "if (offset < 0)\nif (s->short_seek_get) {", "VAR_2 = s->short_seek_get(s->opaque);", "if (VAR_2 <= 0)\nVAR_2 = s->short_seek_threshold;", "} else", "VAR_2 = s->short_seek_threshold;", "offset1 = offset - pos;", "s->buf_ptr_max = FFMAX(s->buf_ptr_max, s->buf_ptr);", "if ((!s->direct || !s->seek) &&\noffset1 >= 0 && offset1 <= (s->write_flag ? s->buf_ptr_max - s->buffer : VAR_1)) {", "s->buf_ptr = s->buffer + offset1;", "} else if ((!(s->seekable & AVIO_SEEKABLE_NORMAL) ||", "offset1 <= VAR_1 + VAR_2) &&\n!s->write_flag && offset1 >= 0 &&\n(!s->direct || !s->seek) &&\n(whence != SEEK_END || VAR_0)) {", "while(s->pos < offset && !s->eof_reached)\nfill_buffer(s);", "if (s->eof_reached)\nreturn AVERROR_EOF;", "s->buf_ptr = s->buf_end - (s->pos - offset);", "} else if(!s->write_flag && offset1 < 0 && -offset1 < VAR_1>>1 && s->seek && offset > 0) {", "int64_t res;", "pos -= FFMIN(VAR_1>>1, pos);", "if ((res = s->seek(s->opaque, pos, SEEK_SET)) < 0)\nreturn res;", "s->buf_end =\ns->buf_ptr = s->buffer;", "s->pos = pos;", "s->eof_reached = 0;", "fill_buffer(s);", "return FUNC_0(s, offset, SEEK_SET | VAR_0);", "} else {", "int64_t res;", "if (s->write_flag) {", "flush_buffer(s);", "}", "if (!s->seek)\nreturn AVERROR(EPIPE);", "if ((res = s->seek(s->opaque, offset, SEEK_SET)) < 0)\nreturn res;", "s->seek_count ++;", "if (!s->write_flag)\ns->buf_end = s->buffer;", "s->buf_ptr = s->buf_ptr_max = s->buffer;", "s->pos = offset;", "}", "s->eof_reached = 0;", "return offset;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 24 ], [ 28 ], [ 32, 37 ], [ 39 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51, 56 ], [ 58 ], [ 62, 64 ], [ 66 ], [ 68 ], [ 72 ], [ 74 ], [ 76, 78 ], [ 82 ], [ 84 ], [ 86, 88, 90, 92 ], [ 94, 96 ], [ 98, 100 ], [ 102 ], [ 104 ], [ 106 ], [ 110 ], [ 112, 114 ], [ 116, 118 ], [ 120 ], [ 122 ], [ 124 ], [ 126 ], [ 128 ], [ 130 ], [ 132 ], [ 134 ], [ 136 ], [ 138, 140 ], [ 142, 144 ], [ 146 ], [ 148, 150 ], [ 152 ], [ 154 ], [ 156 ], [ 158 ], [ 160 ], [ 162 ] ]
742
static void coroutine_fn v9fs_rename(void *opaque) { int32_t fid; ssize_t err = 0; size_t offset = 7; V9fsString name; int32_t newdirfid; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, "dds", &fid, &newdirfid, &name); if (err < 0) { goto out_nofid; } if (name_is_illegal(name.data)) { err = -ENOENT; goto out_nofid; } if (!strcmp(".", name.data) || !strcmp("..", name.data)) { err = -EISDIR; goto out_nofid; } fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } BUG_ON(fidp->fid_type != P9_FID_NONE); /* if fs driver is not path based, return EOPNOTSUPP */ if (!(pdu->s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT)) { err = -EOPNOTSUPP; goto out; } v9fs_path_write_lock(s); err = v9fs_complete_rename(pdu, fidp, newdirfid, &name); v9fs_path_unlock(s); if (!err) { err = offset; } out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); }
true
qemu
49dd946bb5419681c8668b09a6d10f42bc707b78
static void coroutine_fn v9fs_rename(void *opaque) { int32_t fid; ssize_t err = 0; size_t offset = 7; V9fsString name; int32_t newdirfid; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, "dds", &fid, &newdirfid, &name); if (err < 0) { goto out_nofid; } if (name_is_illegal(name.data)) { err = -ENOENT; goto out_nofid; } if (!strcmp(".", name.data) || !strcmp("..", name.data)) { err = -EISDIR; goto out_nofid; } fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } BUG_ON(fidp->fid_type != P9_FID_NONE); if (!(pdu->s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT)) { err = -EOPNOTSUPP; goto out; } v9fs_path_write_lock(s); err = v9fs_complete_rename(pdu, fidp, newdirfid, &name); v9fs_path_unlock(s); if (!err) { err = offset; } out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); }
{ "code": [ " BUG_ON(fidp->fid_type != P9_FID_NONE);", " BUG_ON(fidp->fid_type != P9_FID_NONE);" ], "line_no": [ 65, 65 ] }
static void VAR_0 v9fs_rename(void *opaque) { int32_t fid; ssize_t err = 0; size_t offset = 7; V9fsString name; int32_t newdirfid; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, "dds", &fid, &newdirfid, &name); if (err < 0) { goto out_nofid; } if (name_is_illegal(name.data)) { err = -ENOENT; goto out_nofid; } if (!strcmp(".", name.data) || !strcmp("..", name.data)) { err = -EISDIR; goto out_nofid; } fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } BUG_ON(fidp->fid_type != P9_FID_NONE); if (!(pdu->s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT)) { err = -EOPNOTSUPP; goto out; } v9fs_path_write_lock(s); err = v9fs_complete_rename(pdu, fidp, newdirfid, &name); v9fs_path_unlock(s); if (!err) { err = offset; } out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); }
[ "static void VAR_0 v9fs_rename(void *opaque)\n{", "int32_t fid;", "ssize_t err = 0;", "size_t offset = 7;", "V9fsString name;", "int32_t newdirfid;", "V9fsFidState *fidp;", "V9fsPDU *pdu = opaque;", "V9fsState *s = pdu->s;", "v9fs_string_init(&name);", "err = pdu_unmarshal(pdu, offset, \"dds\", &fid, &newdirfid, &name);", "if (err < 0) {", "goto out_nofid;", "}", "if (name_is_illegal(name.data)) {", "err = -ENOENT;", "goto out_nofid;", "}", "if (!strcmp(\".\", name.data) || !strcmp(\"..\", name.data)) {", "err = -EISDIR;", "goto out_nofid;", "}", "fidp = get_fid(pdu, fid);", "if (fidp == NULL) {", "err = -ENOENT;", "goto out_nofid;", "}", "BUG_ON(fidp->fid_type != P9_FID_NONE);", "if (!(pdu->s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT)) {", "err = -EOPNOTSUPP;", "goto out;", "}", "v9fs_path_write_lock(s);", "err = v9fs_complete_rename(pdu, fidp, newdirfid, &name);", "v9fs_path_unlock(s);", "if (!err) {", "err = offset;", "}", "out:\nput_fid(pdu, fidp);", "out_nofid:\npdu_complete(pdu, err);", "v9fs_string_free(&name);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93, 95 ], [ 97 ], [ 99 ] ]
743
AVVDPAUContext *av_vdpau_alloc_context(void) { return av_mallocz(sizeof(AVVDPAUContext)); }
true
FFmpeg
3a6ded7cfcb33e06ade98c5791eae06453f65668
AVVDPAUContext *av_vdpau_alloc_context(void) { return av_mallocz(sizeof(AVVDPAUContext)); }
{ "code": [ " return av_mallocz(sizeof(AVVDPAUContext));" ], "line_no": [ 5 ] }
AVVDPAUContext *FUNC_0(void) { return av_mallocz(sizeof(AVVDPAUContext)); }
[ "AVVDPAUContext *FUNC_0(void)\n{", "return av_mallocz(sizeof(AVVDPAUContext));", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
744
static AVBufferRef *pool_alloc_buffer(AVBufferPool *pool) { BufferPoolEntry *buf; AVBufferRef *ret; ret = pool->alloc(pool->size); if (!ret) return NULL; buf = av_mallocz(sizeof(*buf)); if (!buf) { av_buffer_unref(&ret); return NULL; } buf->data = ret->buffer->data; buf->opaque = ret->buffer->opaque; buf->free = ret->buffer->free; buf->pool = pool; ret->buffer->opaque = buf; ret->buffer->free = pool_release_buffer; avpriv_atomic_int_add_and_fetch(&pool->refcount, 1); return ret; }
true
FFmpeg
cea3a63ba3d89d8403eef008f7a7c54d645cff70
static AVBufferRef *pool_alloc_buffer(AVBufferPool *pool) { BufferPoolEntry *buf; AVBufferRef *ret; ret = pool->alloc(pool->size); if (!ret) return NULL; buf = av_mallocz(sizeof(*buf)); if (!buf) { av_buffer_unref(&ret); return NULL; } buf->data = ret->buffer->data; buf->opaque = ret->buffer->opaque; buf->free = ret->buffer->free; buf->pool = pool; ret->buffer->opaque = buf; ret->buffer->free = pool_release_buffer; avpriv_atomic_int_add_and_fetch(&pool->refcount, 1); return ret; }
{ "code": [], "line_no": [] }
static AVBufferRef *FUNC_0(AVBufferPool *pool) { BufferPoolEntry *buf; AVBufferRef *ret; ret = pool->alloc(pool->size); if (!ret) return NULL; buf = av_mallocz(sizeof(*buf)); if (!buf) { av_buffer_unref(&ret); return NULL; } buf->data = ret->buffer->data; buf->opaque = ret->buffer->opaque; buf->free = ret->buffer->free; buf->pool = pool; ret->buffer->opaque = buf; ret->buffer->free = pool_release_buffer; avpriv_atomic_int_add_and_fetch(&pool->refcount, 1); return ret; }
[ "static AVBufferRef *FUNC_0(AVBufferPool *pool)\n{", "BufferPoolEntry *buf;", "AVBufferRef *ret;", "ret = pool->alloc(pool->size);", "if (!ret)\nreturn NULL;", "buf = av_mallocz(sizeof(*buf));", "if (!buf) {", "av_buffer_unref(&ret);", "return NULL;", "}", "buf->data = ret->buffer->data;", "buf->opaque = ret->buffer->opaque;", "buf->free = ret->buffer->free;", "buf->pool = pool;", "ret->buffer->opaque = buf;", "ret->buffer->free = pool_release_buffer;", "avpriv_atomic_int_add_and_fetch(&pool->refcount, 1);", "return ret;", "}" ]
[ 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 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 52 ], [ 54 ] ]
745
static void compute_frame_duration(int *pnum, int *pden, AVStream *st, AVCodecParserContext *pc, AVPacket *pkt) { int frame_size; *pnum = 0; *pden = 0; switch(st->codec.codec_type) { case CODEC_TYPE_VIDEO: if(st->time_base.num*1000 > st->time_base.den){ *pnum = st->time_base.num; *pden = st->time_base.den; }else if(st->codec.time_base.num*1000 > st->codec.time_base.den){ *pnum = st->codec.time_base.num; *pden = st->codec.time_base.den; if (pc && pc->repeat_pict) { *pden *= 2; *pnum = (*pnum) * (2 + pc->repeat_pict); } } break; case CODEC_TYPE_AUDIO: frame_size = get_audio_frame_size(&st->codec, pkt->size); if (frame_size < 0) break; *pnum = frame_size; *pden = st->codec.sample_rate; break; default: break; } }
true
FFmpeg
1677155df8ee2dbf6c99738b289e27c2237506bd
static void compute_frame_duration(int *pnum, int *pden, AVStream *st, AVCodecParserContext *pc, AVPacket *pkt) { int frame_size; *pnum = 0; *pden = 0; switch(st->codec.codec_type) { case CODEC_TYPE_VIDEO: if(st->time_base.num*1000 > st->time_base.den){ *pnum = st->time_base.num; *pden = st->time_base.den; }else if(st->codec.time_base.num*1000 > st->codec.time_base.den){ *pnum = st->codec.time_base.num; *pden = st->codec.time_base.den; if (pc && pc->repeat_pict) { *pden *= 2; *pnum = (*pnum) * (2 + pc->repeat_pict); } } break; case CODEC_TYPE_AUDIO: frame_size = get_audio_frame_size(&st->codec, pkt->size); if (frame_size < 0) break; *pnum = frame_size; *pden = st->codec.sample_rate; break; default: break; } }
{ "code": [ " if(st->time_base.num*1000 > st->time_base.den){", " }else if(st->codec.time_base.num*1000 > st->codec.time_base.den){" ], "line_no": [ 19, 25 ] }
static void FUNC_0(int *VAR_0, int *VAR_1, AVStream *VAR_2, AVCodecParserContext *VAR_3, AVPacket *VAR_4) { int VAR_5; *VAR_0 = 0; *VAR_1 = 0; switch(VAR_2->codec.codec_type) { case CODEC_TYPE_VIDEO: if(VAR_2->time_base.num*1000 > VAR_2->time_base.den){ *VAR_0 = VAR_2->time_base.num; *VAR_1 = VAR_2->time_base.den; }else if(VAR_2->codec.time_base.num*1000 > VAR_2->codec.time_base.den){ *VAR_0 = VAR_2->codec.time_base.num; *VAR_1 = VAR_2->codec.time_base.den; if (VAR_3 && VAR_3->repeat_pict) { *VAR_1 *= 2; *VAR_0 = (*VAR_0) * (2 + VAR_3->repeat_pict); } } break; case CODEC_TYPE_AUDIO: VAR_5 = get_audio_frame_size(&VAR_2->codec, VAR_4->size); if (VAR_5 < 0) break; *VAR_0 = VAR_5; *VAR_1 = VAR_2->codec.sample_rate; break; default: break; } }
[ "static void FUNC_0(int *VAR_0, int *VAR_1, AVStream *VAR_2,\nAVCodecParserContext *VAR_3, AVPacket *VAR_4)\n{", "int VAR_5;", "*VAR_0 = 0;", "*VAR_1 = 0;", "switch(VAR_2->codec.codec_type) {", "case CODEC_TYPE_VIDEO:\nif(VAR_2->time_base.num*1000 > VAR_2->time_base.den){", "*VAR_0 = VAR_2->time_base.num;", "*VAR_1 = VAR_2->time_base.den;", "}else if(VAR_2->codec.time_base.num*1000 > VAR_2->codec.time_base.den){", "*VAR_0 = VAR_2->codec.time_base.num;", "*VAR_1 = VAR_2->codec.time_base.den;", "if (VAR_3 && VAR_3->repeat_pict) {", "*VAR_1 *= 2;", "*VAR_0 = (*VAR_0) * (2 + VAR_3->repeat_pict);", "}", "}", "break;", "case CODEC_TYPE_AUDIO:\nVAR_5 = get_audio_frame_size(&VAR_2->codec, VAR_4->size);", "if (VAR_5 < 0)\nbreak;", "*VAR_0 = VAR_5;", "*VAR_1 = VAR_2->codec.sample_rate;", "break;", "default:\nbreak;", "}", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ] ]
746
static int vdi_check(BlockDriverState *bs) { /* TODO: additional checks possible. */ BDRVVdiState *s = (BDRVVdiState *)bs->opaque; int n_errors = 0; uint32_t blocks_allocated = 0; uint32_t block; uint32_t *bmap; logout("\n"); bmap = qemu_malloc(s->header.blocks_in_image * sizeof(uint32_t)); memset(bmap, 0xff, s->header.blocks_in_image * sizeof(uint32_t)); /* Check block map and value of blocks_allocated. */ for (block = 0; block < s->header.blocks_in_image; block++) { uint32_t bmap_entry = le32_to_cpu(s->bmap[block]); if (bmap_entry != VDI_UNALLOCATED) { if (bmap_entry < s->header.blocks_in_image) { blocks_allocated++; if (bmap[bmap_entry] == VDI_UNALLOCATED) { bmap[bmap_entry] = bmap_entry; } else { fprintf(stderr, "ERROR: block index %" PRIu32 " also used by %" PRIu32 "\n", bmap[bmap_entry], bmap_entry); } } else { fprintf(stderr, "ERROR: block index %" PRIu32 " too large, is %" PRIu32 "\n", block, bmap_entry); n_errors++; } } } if (blocks_allocated != s->header.blocks_allocated) { fprintf(stderr, "ERROR: allocated blocks mismatch, is %" PRIu32 ", should be %" PRIu32 "\n", blocks_allocated, s->header.blocks_allocated); n_errors++; } qemu_free(bmap); return n_errors; }
true
qemu
9ac228e02cf16202547e7025ef300369e0db7781
static int vdi_check(BlockDriverState *bs) { BDRVVdiState *s = (BDRVVdiState *)bs->opaque; int n_errors = 0; uint32_t blocks_allocated = 0; uint32_t block; uint32_t *bmap; logout("\n"); bmap = qemu_malloc(s->header.blocks_in_image * sizeof(uint32_t)); memset(bmap, 0xff, s->header.blocks_in_image * sizeof(uint32_t)); for (block = 0; block < s->header.blocks_in_image; block++) { uint32_t bmap_entry = le32_to_cpu(s->bmap[block]); if (bmap_entry != VDI_UNALLOCATED) { if (bmap_entry < s->header.blocks_in_image) { blocks_allocated++; if (bmap[bmap_entry] == VDI_UNALLOCATED) { bmap[bmap_entry] = bmap_entry; } else { fprintf(stderr, "ERROR: block index %" PRIu32 " also used by %" PRIu32 "\n", bmap[bmap_entry], bmap_entry); } } else { fprintf(stderr, "ERROR: block index %" PRIu32 " too large, is %" PRIu32 "\n", block, bmap_entry); n_errors++; } } } if (blocks_allocated != s->header.blocks_allocated) { fprintf(stderr, "ERROR: allocated blocks mismatch, is %" PRIu32 ", should be %" PRIu32 "\n", blocks_allocated, s->header.blocks_allocated); n_errors++; } qemu_free(bmap); return n_errors; }
{ "code": [ "static int vdi_check(BlockDriverState *bs)", " int n_errors = 0;", " n_errors++;", " n_errors++;", " return n_errors;" ], "line_no": [ 1, 9, 57, 73, 83 ] }
static int FUNC_0(BlockDriverState *VAR_0) { BDRVVdiState *s = (BDRVVdiState *)VAR_0->opaque; int VAR_1 = 0; uint32_t blocks_allocated = 0; uint32_t block; uint32_t *bmap; logout("\n"); bmap = qemu_malloc(s->header.blocks_in_image * sizeof(uint32_t)); memset(bmap, 0xff, s->header.blocks_in_image * sizeof(uint32_t)); for (block = 0; block < s->header.blocks_in_image; block++) { uint32_t bmap_entry = le32_to_cpu(s->bmap[block]); if (bmap_entry != VDI_UNALLOCATED) { if (bmap_entry < s->header.blocks_in_image) { blocks_allocated++; if (bmap[bmap_entry] == VDI_UNALLOCATED) { bmap[bmap_entry] = bmap_entry; } else { fprintf(stderr, "ERROR: block index %" PRIu32 " also used by %" PRIu32 "\n", bmap[bmap_entry], bmap_entry); } } else { fprintf(stderr, "ERROR: block index %" PRIu32 " too large, is %" PRIu32 "\n", block, bmap_entry); VAR_1++; } } } if (blocks_allocated != s->header.blocks_allocated) { fprintf(stderr, "ERROR: allocated blocks mismatch, is %" PRIu32 ", should be %" PRIu32 "\n", blocks_allocated, s->header.blocks_allocated); VAR_1++; } qemu_free(bmap); return VAR_1; }
[ "static int FUNC_0(BlockDriverState *VAR_0)\n{", "BDRVVdiState *s = (BDRVVdiState *)VAR_0->opaque;", "int VAR_1 = 0;", "uint32_t blocks_allocated = 0;", "uint32_t block;", "uint32_t *bmap;", "logout(\"\\n\");", "bmap = qemu_malloc(s->header.blocks_in_image * sizeof(uint32_t));", "memset(bmap, 0xff, s->header.blocks_in_image * sizeof(uint32_t));", "for (block = 0; block < s->header.blocks_in_image; block++) {", "uint32_t bmap_entry = le32_to_cpu(s->bmap[block]);", "if (bmap_entry != VDI_UNALLOCATED) {", "if (bmap_entry < s->header.blocks_in_image) {", "blocks_allocated++;", "if (bmap[bmap_entry] == VDI_UNALLOCATED) {", "bmap[bmap_entry] = bmap_entry;", "} else {", "fprintf(stderr, \"ERROR: block index %\" PRIu32\n\" also used by %\" PRIu32 \"\\n\", bmap[bmap_entry], bmap_entry);", "}", "} else {", "fprintf(stderr, \"ERROR: block index %\" PRIu32\n\" too large, is %\" PRIu32 \"\\n\", block, bmap_entry);", "VAR_1++;", "}", "}", "}", "if (blocks_allocated != s->header.blocks_allocated) {", "fprintf(stderr, \"ERROR: allocated blocks mismatch, is %\" PRIu32\n\", should be %\" PRIu32 \"\\n\",\nblocks_allocated, s->header.blocks_allocated);", "VAR_1++;", "}", "qemu_free(bmap);", "return VAR_1;", "}" ]
[ 1, 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, 1, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69, 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ] ]
749
static void submit_pdu(V9fsState *s, V9fsPDU *pdu) { pdu_handler_t *handler; if (debug_9p_pdu) { pprint_pdu(pdu); } BUG_ON(pdu->id >= ARRAY_SIZE(pdu_handlers)); handler = pdu_handlers[pdu->id]; BUG_ON(handler == NULL); handler(s, pdu); }
true
qemu
5c3234c6c037943bd4c2d643a1b8cc35f563dbdb
static void submit_pdu(V9fsState *s, V9fsPDU *pdu) { pdu_handler_t *handler; if (debug_9p_pdu) { pprint_pdu(pdu); } BUG_ON(pdu->id >= ARRAY_SIZE(pdu_handlers)); handler = pdu_handlers[pdu->id]; BUG_ON(handler == NULL); handler(s, pdu); }
{ "code": [ " BUG_ON(pdu->id >= ARRAY_SIZE(pdu_handlers));", " handler = pdu_handlers[pdu->id];", " BUG_ON(handler == NULL);" ], "line_no": [ 17, 21, 23 ] }
static void FUNC_0(V9fsState *VAR_0, V9fsPDU *VAR_1) { pdu_handler_t *handler; if (debug_9p_pdu) { pprint_pdu(VAR_1); } BUG_ON(VAR_1->id >= ARRAY_SIZE(pdu_handlers)); handler = pdu_handlers[VAR_1->id]; BUG_ON(handler == NULL); handler(VAR_0, VAR_1); }
[ "static void FUNC_0(V9fsState *VAR_0, V9fsPDU *VAR_1)\n{", "pdu_handler_t *handler;", "if (debug_9p_pdu) {", "pprint_pdu(VAR_1);", "}", "BUG_ON(VAR_1->id >= ARRAY_SIZE(pdu_handlers));", "handler = pdu_handlers[VAR_1->id];", "BUG_ON(handler == NULL);", "handler(VAR_0, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
750
uint64_t helper_addqv (uint64_t op1, uint64_t op2) { uint64_t tmp = op1; op1 += op2; if (unlikely((tmp ^ op2 ^ (-1ULL)) & (tmp ^ op1) & (1ULL << 63))) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return op1; }
true
qemu
2958620f67dcfd11476e62b4ca704dae0b978ea3
uint64_t helper_addqv (uint64_t op1, uint64_t op2) { uint64_t tmp = op1; op1 += op2; if (unlikely((tmp ^ op2 ^ (-1ULL)) & (tmp ^ op1) & (1ULL << 63))) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return op1; }
{ "code": [ "uint64_t helper_addqv (uint64_t op1, uint64_t op2)", " uint64_t tmp = op1;", " op1 += op2;", " if (unlikely((tmp ^ op2 ^ (-1ULL)) & (tmp ^ op1) & (1ULL << 63))) {", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " return op1;", " uint64_t tmp = op1;", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " return op1;", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);" ], "line_no": [ 1, 5, 7, 9, 11, 15, 5, 11, 15, 11, 11, 11, 11 ] }
uint64_t FUNC_0 (uint64_t op1, uint64_t op2) { uint64_t tmp = op1; op1 += op2; if (unlikely((tmp ^ op2 ^ (-1ULL)) & (tmp ^ op1) & (1ULL << 63))) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return op1; }
[ "uint64_t FUNC_0 (uint64_t op1, uint64_t op2)\n{", "uint64_t tmp = op1;", "op1 += op2;", "if (unlikely((tmp ^ op2 ^ (-1ULL)) & (tmp ^ op1) & (1ULL << 63))) {", "arith_excp(env, GETPC(), EXC_M_IOV, 0);", "}", "return op1;", "}" ]
[ 1, 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
751
static void cirrus_mem_writeb_mode4and5_8bpp(CirrusVGAState * s, unsigned mode, unsigned offset, uint32_t mem_value) { int x; unsigned val = mem_value; uint8_t *dst; dst = s->vram_ptr + offset; for (x = 0; x < 8; x++) { if (val & 0x80) { *dst = s->cirrus_shadow_gr1; } else if (mode == 5) { *dst = s->cirrus_shadow_gr0; } val <<= 1; dst++; } cpu_physical_memory_set_dirty(s->vram_offset + offset); cpu_physical_memory_set_dirty(s->vram_offset + offset + 7); }
true
qemu
b2eb849d4b1fdb6f35d5c46958c7f703cf64cfef
static void cirrus_mem_writeb_mode4and5_8bpp(CirrusVGAState * s, unsigned mode, unsigned offset, uint32_t mem_value) { int x; unsigned val = mem_value; uint8_t *dst; dst = s->vram_ptr + offset; for (x = 0; x < 8; x++) { if (val & 0x80) { *dst = s->cirrus_shadow_gr1; } else if (mode == 5) { *dst = s->cirrus_shadow_gr0; } val <<= 1; dst++; } cpu_physical_memory_set_dirty(s->vram_offset + offset); cpu_physical_memory_set_dirty(s->vram_offset + offset + 7); }
{ "code": [ " dst = s->vram_ptr + offset;", " dst = s->vram_ptr + offset;" ], "line_no": [ 19, 19 ] }
static void FUNC_0(CirrusVGAState * VAR_0, unsigned VAR_1, unsigned VAR_2, uint32_t VAR_3) { int VAR_4; unsigned VAR_5 = VAR_3; uint8_t *dst; dst = VAR_0->vram_ptr + VAR_2; for (VAR_4 = 0; VAR_4 < 8; VAR_4++) { if (VAR_5 & 0x80) { *dst = VAR_0->cirrus_shadow_gr1; } else if (VAR_1 == 5) { *dst = VAR_0->cirrus_shadow_gr0; } VAR_5 <<= 1; dst++; } cpu_physical_memory_set_dirty(VAR_0->vram_offset + VAR_2); cpu_physical_memory_set_dirty(VAR_0->vram_offset + VAR_2 + 7); }
[ "static void FUNC_0(CirrusVGAState * VAR_0,\nunsigned VAR_1,\nunsigned VAR_2,\nuint32_t VAR_3)\n{", "int VAR_4;", "unsigned VAR_5 = VAR_3;", "uint8_t *dst;", "dst = VAR_0->vram_ptr + VAR_2;", "for (VAR_4 = 0; VAR_4 < 8; VAR_4++) {", "if (VAR_5 & 0x80) {", "*dst = VAR_0->cirrus_shadow_gr1;", "} else if (VAR_1 == 5) {", "*dst = VAR_0->cirrus_shadow_gr0;", "}", "VAR_5 <<= 1;", "dst++;", "}", "cpu_physical_memory_set_dirty(VAR_0->vram_offset + VAR_2);", "cpu_physical_memory_set_dirty(VAR_0->vram_offset + VAR_2 + 7);", "}" ]
[ 0, 0, 0, 0, 1, 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 ], [ 39 ], [ 41 ], [ 43 ] ]
752
void translator_loop(const TranslatorOps *ops, DisasContextBase *db, CPUState *cpu, TranslationBlock *tb) { int max_insns; /* Initialize DisasContext */ db->tb = tb; db->pc_first = tb->pc; db->pc_next = db->pc_first; db->is_jmp = DISAS_NEXT; db->num_insns = 0; db->singlestep_enabled = cpu->singlestep_enabled; /* Instruction counting */ max_insns = db->tb->cflags & CF_COUNT_MASK; if (max_insns == 0) { max_insns = CF_COUNT_MASK; } if (max_insns > TCG_MAX_INSNS) { max_insns = TCG_MAX_INSNS; } if (db->singlestep_enabled || singlestep) { max_insns = 1; } max_insns = ops->init_disas_context(db, cpu, max_insns); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ /* Reset the temp count so that we can identify leaks */ tcg_clear_temp_count(); /* Start translating. */ gen_tb_start(db->tb); ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ while (true) { db->num_insns++; ops->insn_start(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ /* Pass breakpoint hits to target for further processing */ if (unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) { CPUBreakpoint *bp; QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { if (bp->pc == db->pc_next) { if (ops->breakpoint_check(db, cpu, bp)) { break; } } } /* The breakpoint_check hook may use DISAS_TOO_MANY to indicate that only one more instruction is to be executed. Otherwise it should use DISAS_NORETURN when generating an exception, but may use a DISAS_TARGET_* value for Something Else. */ if (db->is_jmp > DISAS_TOO_MANY) { break; } } /* Disassemble one instruction. The translate_insn hook should update db->pc_next and db->is_jmp to indicate what should be done next -- either exiting this loop or locate the start of the next instruction. */ if (db->num_insns == max_insns && (db->tb->cflags & CF_LAST_IO)) { /* Accept I/O on the last instruction. */ gen_io_start(); ops->translate_insn(db, cpu); gen_io_end(); } else { ops->translate_insn(db, cpu); } /* Stop translation if translate_insn so indicated. */ if (db->is_jmp != DISAS_NEXT) { break; } /* Stop translation if the output buffer is full, or we have executed all of the allowed instructions. */ if (tcg_op_buf_full() || db->num_insns >= max_insns) { db->is_jmp = DISAS_TOO_MANY; break; } } /* Emit code to exit the TB, as indicated by db->is_jmp. */ ops->tb_stop(db, cpu); gen_tb_end(db->tb, db->num_insns); /* The disas_log hook may use these values rather than recompute. */ db->tb->size = db->pc_next - db->pc_first; db->tb->icount = db->num_insns; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) && qemu_log_in_addr_range(db->pc_first)) { qemu_log_lock(); qemu_log("----------------\n"); ops->disas_log(db, cpu); qemu_log("\n"); qemu_log_unlock(); } #endif }
true
qemu
c5a49c63fa26e8825ad101dfe86339ae4c216539
void translator_loop(const TranslatorOps *ops, DisasContextBase *db, CPUState *cpu, TranslationBlock *tb) { int max_insns; db->tb = tb; db->pc_first = tb->pc; db->pc_next = db->pc_first; db->is_jmp = DISAS_NEXT; db->num_insns = 0; db->singlestep_enabled = cpu->singlestep_enabled; max_insns = db->tb->cflags & CF_COUNT_MASK; if (max_insns == 0) { max_insns = CF_COUNT_MASK; } if (max_insns > TCG_MAX_INSNS) { max_insns = TCG_MAX_INSNS; } if (db->singlestep_enabled || singlestep) { max_insns = 1; } max_insns = ops->init_disas_context(db, cpu, max_insns); tcg_debug_assert(db->is_jmp == DISAS_NEXT); tcg_clear_temp_count(); gen_tb_start(db->tb); ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); while (true) { db->num_insns++; ops->insn_start(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); if (unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) { CPUBreakpoint *bp; QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { if (bp->pc == db->pc_next) { if (ops->breakpoint_check(db, cpu, bp)) { break; } } } if (db->is_jmp > DISAS_TOO_MANY) { break; } } if (db->num_insns == max_insns && (db->tb->cflags & CF_LAST_IO)) { gen_io_start(); ops->translate_insn(db, cpu); gen_io_end(); } else { ops->translate_insn(db, cpu); } if (db->is_jmp != DISAS_NEXT) { break; } if (tcg_op_buf_full() || db->num_insns >= max_insns) { db->is_jmp = DISAS_TOO_MANY; break; } } ops->tb_stop(db, cpu); gen_tb_end(db->tb, db->num_insns); db->tb->size = db->pc_next - db->pc_first; db->tb->icount = db->num_insns; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) && qemu_log_in_addr_range(db->pc_first)) { qemu_log_lock(); qemu_log("----------------\n"); ops->disas_log(db, cpu); qemu_log("\n"); qemu_log_unlock(); } #endif }
{ "code": [ " max_insns = db->tb->cflags & CF_COUNT_MASK;", " if (db->num_insns == max_insns && (db->tb->cflags & CF_LAST_IO)) {" ], "line_no": [ 29, 129 ] }
void FUNC_0(const TranslatorOps *VAR_0, DisasContextBase *VAR_1, CPUState *VAR_2, TranslationBlock *VAR_3) { int VAR_4; VAR_1->VAR_3 = VAR_3; VAR_1->pc_first = VAR_3->pc; VAR_1->pc_next = VAR_1->pc_first; VAR_1->is_jmp = DISAS_NEXT; VAR_1->num_insns = 0; VAR_1->singlestep_enabled = VAR_2->singlestep_enabled; VAR_4 = VAR_1->VAR_3->cflags & CF_COUNT_MASK; if (VAR_4 == 0) { VAR_4 = CF_COUNT_MASK; } if (VAR_4 > TCG_MAX_INSNS) { VAR_4 = TCG_MAX_INSNS; } if (VAR_1->singlestep_enabled || singlestep) { VAR_4 = 1; } VAR_4 = VAR_0->init_disas_context(VAR_1, VAR_2, VAR_4); tcg_debug_assert(VAR_1->is_jmp == DISAS_NEXT); tcg_clear_temp_count(); gen_tb_start(VAR_1->VAR_3); VAR_0->tb_start(VAR_1, VAR_2); tcg_debug_assert(VAR_1->is_jmp == DISAS_NEXT); while (true) { VAR_1->num_insns++; VAR_0->insn_start(VAR_1, VAR_2); tcg_debug_assert(VAR_1->is_jmp == DISAS_NEXT); if (unlikely(!QTAILQ_EMPTY(&VAR_2->breakpoints))) { CPUBreakpoint *bp; QTAILQ_FOREACH(bp, &VAR_2->breakpoints, entry) { if (bp->pc == VAR_1->pc_next) { if (VAR_0->breakpoint_check(VAR_1, VAR_2, bp)) { break; } } } if (VAR_1->is_jmp > DISAS_TOO_MANY) { break; } } if (VAR_1->num_insns == VAR_4 && (VAR_1->VAR_3->cflags & CF_LAST_IO)) { gen_io_start(); VAR_0->translate_insn(VAR_1, VAR_2); gen_io_end(); } else { VAR_0->translate_insn(VAR_1, VAR_2); } if (VAR_1->is_jmp != DISAS_NEXT) { break; } if (tcg_op_buf_full() || VAR_1->num_insns >= VAR_4) { VAR_1->is_jmp = DISAS_TOO_MANY; break; } } VAR_0->tb_stop(VAR_1, VAR_2); gen_tb_end(VAR_1->VAR_3, VAR_1->num_insns); VAR_1->VAR_3->size = VAR_1->pc_next - VAR_1->pc_first; VAR_1->VAR_3->icount = VAR_1->num_insns; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) && qemu_log_in_addr_range(VAR_1->pc_first)) { qemu_log_lock(); qemu_log("----------------\n"); VAR_0->disas_log(VAR_1, VAR_2); qemu_log("\n"); qemu_log_unlock(); } #endif }
[ "void FUNC_0(const TranslatorOps *VAR_0, DisasContextBase *VAR_1,\nCPUState *VAR_2, TranslationBlock *VAR_3)\n{", "int VAR_4;", "VAR_1->VAR_3 = VAR_3;", "VAR_1->pc_first = VAR_3->pc;", "VAR_1->pc_next = VAR_1->pc_first;", "VAR_1->is_jmp = DISAS_NEXT;", "VAR_1->num_insns = 0;", "VAR_1->singlestep_enabled = VAR_2->singlestep_enabled;", "VAR_4 = VAR_1->VAR_3->cflags & CF_COUNT_MASK;", "if (VAR_4 == 0) {", "VAR_4 = CF_COUNT_MASK;", "}", "if (VAR_4 > TCG_MAX_INSNS) {", "VAR_4 = TCG_MAX_INSNS;", "}", "if (VAR_1->singlestep_enabled || singlestep) {", "VAR_4 = 1;", "}", "VAR_4 = VAR_0->init_disas_context(VAR_1, VAR_2, VAR_4);", "tcg_debug_assert(VAR_1->is_jmp == DISAS_NEXT);", "tcg_clear_temp_count();", "gen_tb_start(VAR_1->VAR_3);", "VAR_0->tb_start(VAR_1, VAR_2);", "tcg_debug_assert(VAR_1->is_jmp == DISAS_NEXT);", "while (true) {", "VAR_1->num_insns++;", "VAR_0->insn_start(VAR_1, VAR_2);", "tcg_debug_assert(VAR_1->is_jmp == DISAS_NEXT);", "if (unlikely(!QTAILQ_EMPTY(&VAR_2->breakpoints))) {", "CPUBreakpoint *bp;", "QTAILQ_FOREACH(bp, &VAR_2->breakpoints, entry) {", "if (bp->pc == VAR_1->pc_next) {", "if (VAR_0->breakpoint_check(VAR_1, VAR_2, bp)) {", "break;", "}", "}", "}", "if (VAR_1->is_jmp > DISAS_TOO_MANY) {", "break;", "}", "}", "if (VAR_1->num_insns == VAR_4 && (VAR_1->VAR_3->cflags & CF_LAST_IO)) {", "gen_io_start();", "VAR_0->translate_insn(VAR_1, VAR_2);", "gen_io_end();", "} else {", "VAR_0->translate_insn(VAR_1, VAR_2);", "}", "if (VAR_1->is_jmp != DISAS_NEXT) {", "break;", "}", "if (tcg_op_buf_full() || VAR_1->num_insns >= VAR_4) {", "VAR_1->is_jmp = DISAS_TOO_MANY;", "break;", "}", "}", "VAR_0->tb_stop(VAR_1, VAR_2);", "gen_tb_end(VAR_1->VAR_3, VAR_1->num_insns);", "VAR_1->VAR_3->size = VAR_1->pc_next - VAR_1->pc_first;", "VAR_1->VAR_3->icount = VAR_1->num_insns;", "#ifdef DEBUG_DISAS\nif (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)\n&& qemu_log_in_addr_range(VAR_1->pc_first)) {", "qemu_log_lock();", "qemu_log(\"----------------\\n\");", "VAR_0->disas_log(VAR_1, VAR_2);", "qemu_log(\"\\n\");", "qemu_log_unlock();", "}", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 59 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 149 ], [ 151 ], [ 153 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 175 ], [ 177 ], [ 183 ], [ 185 ], [ 189, 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207, 209 ] ]
753
static int load_apply_palette(FFFrameSync *fs) { AVFilterContext *ctx = fs->parent; AVFilterLink *inlink = ctx->inputs[0]; PaletteUseContext *s = ctx->priv; AVFrame *master, *second, *out = NULL; int ret; // writable for error diffusal dithering ret = ff_framesync_dualinput_get_writable(fs, &master, &second); if (ret < 0) return ret; if (!master || !second) { ret = AVERROR_BUG; goto error; } if (!s->palette_loaded) { load_palette(s, second); } ret = apply_palette(inlink, master, &out); if (ret < 0) goto error; return ff_filter_frame(ctx->outputs[0], out); error: av_frame_free(&master); av_frame_free(&second); return ret; }
true
FFmpeg
631fa0432be8968e0fd372595749b918224946df
static int load_apply_palette(FFFrameSync *fs) { AVFilterContext *ctx = fs->parent; AVFilterLink *inlink = ctx->inputs[0]; PaletteUseContext *s = ctx->priv; AVFrame *master, *second, *out = NULL; int ret; ret = ff_framesync_dualinput_get_writable(fs, &master, &second); if (ret < 0) return ret; if (!master || !second) { ret = AVERROR_BUG; goto error; } if (!s->palette_loaded) { load_palette(s, second); } ret = apply_palette(inlink, master, &out); if (ret < 0) goto error; return ff_filter_frame(ctx->outputs[0], out); error: av_frame_free(&master); av_frame_free(&second); return ret; }
{ "code": [ " av_frame_free(&second);" ], "line_no": [ 53 ] }
static int FUNC_0(FFFrameSync *VAR_0) { AVFilterContext *ctx = VAR_0->parent; AVFilterLink *inlink = ctx->inputs[0]; PaletteUseContext *s = ctx->priv; AVFrame *master, *second, *out = NULL; int VAR_1; VAR_1 = ff_framesync_dualinput_get_writable(VAR_0, &master, &second); if (VAR_1 < 0) return VAR_1; if (!master || !second) { VAR_1 = AVERROR_BUG; goto error; } if (!s->palette_loaded) { load_palette(s, second); } VAR_1 = apply_palette(inlink, master, &out); if (VAR_1 < 0) goto error; return ff_filter_frame(ctx->outputs[0], out); error: av_frame_free(&master); av_frame_free(&second); return VAR_1; }
[ "static int FUNC_0(FFFrameSync *VAR_0)\n{", "AVFilterContext *ctx = VAR_0->parent;", "AVFilterLink *inlink = ctx->inputs[0];", "PaletteUseContext *s = ctx->priv;", "AVFrame *master, *second, *out = NULL;", "int VAR_1;", "VAR_1 = ff_framesync_dualinput_get_writable(VAR_0, &master, &second);", "if (VAR_1 < 0)\nreturn VAR_1;", "if (!master || !second) {", "VAR_1 = AVERROR_BUG;", "goto error;", "}", "if (!s->palette_loaded) {", "load_palette(s, second);", "}", "VAR_1 = apply_palette(inlink, master, &out);", "if (VAR_1 < 0)\ngoto error;", "return ff_filter_frame(ctx->outputs[0], out);", "error:\nav_frame_free(&master);", "av_frame_free(&second);", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ] ]
755
void avfilter_uninit(void) { memset(registered_avfilters, 0, sizeof(registered_avfilters)); next_registered_avfilter_idx = 0; }
false
FFmpeg
fa2a34cd40d124161c748bb0f430dc63c94dd0da
void avfilter_uninit(void) { memset(registered_avfilters, 0, sizeof(registered_avfilters)); next_registered_avfilter_idx = 0; }
{ "code": [], "line_no": [] }
void FUNC_0(void) { memset(registered_avfilters, 0, sizeof(registered_avfilters)); next_registered_avfilter_idx = 0; }
[ "void FUNC_0(void)\n{", "memset(registered_avfilters, 0, sizeof(registered_avfilters));", "next_registered_avfilter_idx = 0;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
756
int pcm_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AVStream *st; int block_align, byte_rate; int64_t pos; st = s->streams[0]; block_align = st->codec->block_align ? st->codec->block_align : (av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3; byte_rate = st->codec->bit_rate ? st->codec->bit_rate >> 3 : block_align * st->codec->sample_rate; if (block_align <= 0 || byte_rate <= 0) return -1; /* compute the position by aligning it to block_align */ pos = av_rescale_rnd(timestamp * byte_rate, st->time_base.num, st->time_base.den * (int64_t)block_align, (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP); pos *= block_align; /* recompute exact position */ st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num); url_fseek(s->pb, pos + s->data_offset, SEEK_SET); return 0; }
false
FFmpeg
d701934bef6ff6868c0a2179b7b9105c7a49b41f
int pcm_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AVStream *st; int block_align, byte_rate; int64_t pos; st = s->streams[0]; block_align = st->codec->block_align ? st->codec->block_align : (av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3; byte_rate = st->codec->bit_rate ? st->codec->bit_rate >> 3 : block_align * st->codec->sample_rate; if (block_align <= 0 || byte_rate <= 0) return -1; pos = av_rescale_rnd(timestamp * byte_rate, st->time_base.num, st->time_base.den * (int64_t)block_align, (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP); pos *= block_align; st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num); url_fseek(s->pb, pos + s->data_offset, SEEK_SET); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3) { AVStream *st; int VAR_4, VAR_5; int64_t pos; st = VAR_0->streams[0]; VAR_4 = st->codec->VAR_4 ? st->codec->VAR_4 : (av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3; VAR_5 = st->codec->bit_rate ? st->codec->bit_rate >> 3 : VAR_4 * st->codec->sample_rate; if (VAR_4 <= 0 || VAR_5 <= 0) return -1; pos = av_rescale_rnd(VAR_2 * VAR_5, st->time_base.num, st->time_base.den * (int64_t)VAR_4, (VAR_3 & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP); pos *= VAR_4; st->cur_dts = av_rescale(pos, st->time_base.den, VAR_5 * (int64_t)st->time_base.num); url_fseek(VAR_0->pb, pos + VAR_0->data_offset, SEEK_SET); return 0; }
[ "int FUNC_0(AVFormatContext *VAR_0,\nint VAR_1, int64_t VAR_2, int VAR_3)\n{", "AVStream *st;", "int VAR_4, VAR_5;", "int64_t pos;", "st = VAR_0->streams[0];", "VAR_4 = st->codec->VAR_4 ? st->codec->VAR_4 :\n(av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3;", "VAR_5 = st->codec->bit_rate ? st->codec->bit_rate >> 3 :\nVAR_4 * st->codec->sample_rate;", "if (VAR_4 <= 0 || VAR_5 <= 0)\nreturn -1;", "pos = av_rescale_rnd(VAR_2 * VAR_5,\nst->time_base.num,\nst->time_base.den * (int64_t)VAR_4,\n(VAR_3 & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP);", "pos *= VAR_4;", "st->cur_dts = av_rescale(pos, st->time_base.den, VAR_5 * (int64_t)st->time_base.num);", "url_fseek(VAR_0->pb, pos + VAR_0->data_offset, SEEK_SET);", "return 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 ], [ 29, 31 ], [ 37, 39, 41, 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
758
void show_pix_fmts(void) { list_fmts(avcodec_pix_fmt_string, PIX_FMT_NB); }
false
FFmpeg
9cb5c760d73e08bcd5d441d261abe67d472e98ee
void show_pix_fmts(void) { list_fmts(avcodec_pix_fmt_string, PIX_FMT_NB); }
{ "code": [], "line_no": [] }
void FUNC_0(void) { list_fmts(avcodec_pix_fmt_string, PIX_FMT_NB); }
[ "void FUNC_0(void)\n{", "list_fmts(avcodec_pix_fmt_string, PIX_FMT_NB);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
759
static int spdif_get_offset_and_codec(AVFormatContext *s, enum IEC61937DataType data_type, const char *buf, int *offset, enum AVCodecID *codec) { AACADTSHeaderInfo aac_hdr; GetBitContext gbc; switch (data_type & 0xff) { case IEC61937_AC3: *offset = AC3_FRAME_SIZE << 2; *codec = AV_CODEC_ID_AC3; break; case IEC61937_MPEG1_LAYER1: *offset = spdif_mpeg_pkt_offset[1][0]; *codec = AV_CODEC_ID_MP1; break; case IEC61937_MPEG1_LAYER23: *offset = spdif_mpeg_pkt_offset[1][0]; *codec = AV_CODEC_ID_MP3; break; case IEC61937_MPEG2_EXT: *offset = 4608; *codec = AV_CODEC_ID_MP3; break; case IEC61937_MPEG2_AAC: init_get_bits(&gbc, buf, AAC_ADTS_HEADER_SIZE * 8); if (avpriv_aac_parse_header(&gbc, &aac_hdr)) { if (s) /* be silent during a probe */ av_log(s, AV_LOG_ERROR, "Invalid AAC packet in IEC 61937\n"); return AVERROR_INVALIDDATA; } *offset = aac_hdr.samples << 2; *codec = AV_CODEC_ID_AAC; break; case IEC61937_MPEG2_LAYER1_LSF: *offset = spdif_mpeg_pkt_offset[0][0]; *codec = AV_CODEC_ID_MP1; break; case IEC61937_MPEG2_LAYER2_LSF: *offset = spdif_mpeg_pkt_offset[0][1]; *codec = AV_CODEC_ID_MP2; break; case IEC61937_MPEG2_LAYER3_LSF: *offset = spdif_mpeg_pkt_offset[0][2]; *codec = AV_CODEC_ID_MP3; break; case IEC61937_DTS1: *offset = 2048; *codec = AV_CODEC_ID_DTS; break; case IEC61937_DTS2: *offset = 4096; *codec = AV_CODEC_ID_DTS; break; case IEC61937_DTS3: *offset = 8192; *codec = AV_CODEC_ID_DTS; break; default: if (s) { /* be silent during a probe */ avpriv_request_sample(s, "Data type 0x%04x in IEC 61937", data_type); } return AVERROR_PATCHWELCOME; } return 0; }
false
FFmpeg
f86387b6c2b11650cb9d5a8fd886be76e48c665b
static int spdif_get_offset_and_codec(AVFormatContext *s, enum IEC61937DataType data_type, const char *buf, int *offset, enum AVCodecID *codec) { AACADTSHeaderInfo aac_hdr; GetBitContext gbc; switch (data_type & 0xff) { case IEC61937_AC3: *offset = AC3_FRAME_SIZE << 2; *codec = AV_CODEC_ID_AC3; break; case IEC61937_MPEG1_LAYER1: *offset = spdif_mpeg_pkt_offset[1][0]; *codec = AV_CODEC_ID_MP1; break; case IEC61937_MPEG1_LAYER23: *offset = spdif_mpeg_pkt_offset[1][0]; *codec = AV_CODEC_ID_MP3; break; case IEC61937_MPEG2_EXT: *offset = 4608; *codec = AV_CODEC_ID_MP3; break; case IEC61937_MPEG2_AAC: init_get_bits(&gbc, buf, AAC_ADTS_HEADER_SIZE * 8); if (avpriv_aac_parse_header(&gbc, &aac_hdr)) { if (s) av_log(s, AV_LOG_ERROR, "Invalid AAC packet in IEC 61937\n"); return AVERROR_INVALIDDATA; } *offset = aac_hdr.samples << 2; *codec = AV_CODEC_ID_AAC; break; case IEC61937_MPEG2_LAYER1_LSF: *offset = spdif_mpeg_pkt_offset[0][0]; *codec = AV_CODEC_ID_MP1; break; case IEC61937_MPEG2_LAYER2_LSF: *offset = spdif_mpeg_pkt_offset[0][1]; *codec = AV_CODEC_ID_MP2; break; case IEC61937_MPEG2_LAYER3_LSF: *offset = spdif_mpeg_pkt_offset[0][2]; *codec = AV_CODEC_ID_MP3; break; case IEC61937_DTS1: *offset = 2048; *codec = AV_CODEC_ID_DTS; break; case IEC61937_DTS2: *offset = 4096; *codec = AV_CODEC_ID_DTS; break; case IEC61937_DTS3: *offset = 8192; *codec = AV_CODEC_ID_DTS; break; default: if (s) { avpriv_request_sample(s, "Data type 0x%04x in IEC 61937", data_type); } return AVERROR_PATCHWELCOME; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, enum IEC61937DataType VAR_1, const char *VAR_2, int *VAR_3, enum AVCodecID *VAR_4) { AACADTSHeaderInfo aac_hdr; GetBitContext gbc; switch (VAR_1 & 0xff) { case IEC61937_AC3: *VAR_3 = AC3_FRAME_SIZE << 2; *VAR_4 = AV_CODEC_ID_AC3; break; case IEC61937_MPEG1_LAYER1: *VAR_3 = spdif_mpeg_pkt_offset[1][0]; *VAR_4 = AV_CODEC_ID_MP1; break; case IEC61937_MPEG1_LAYER23: *VAR_3 = spdif_mpeg_pkt_offset[1][0]; *VAR_4 = AV_CODEC_ID_MP3; break; case IEC61937_MPEG2_EXT: *VAR_3 = 4608; *VAR_4 = AV_CODEC_ID_MP3; break; case IEC61937_MPEG2_AAC: init_get_bits(&gbc, VAR_2, AAC_ADTS_HEADER_SIZE * 8); if (avpriv_aac_parse_header(&gbc, &aac_hdr)) { if (VAR_0) av_log(VAR_0, AV_LOG_ERROR, "Invalid AAC packet in IEC 61937\n"); return AVERROR_INVALIDDATA; } *VAR_3 = aac_hdr.samples << 2; *VAR_4 = AV_CODEC_ID_AAC; break; case IEC61937_MPEG2_LAYER1_LSF: *VAR_3 = spdif_mpeg_pkt_offset[0][0]; *VAR_4 = AV_CODEC_ID_MP1; break; case IEC61937_MPEG2_LAYER2_LSF: *VAR_3 = spdif_mpeg_pkt_offset[0][1]; *VAR_4 = AV_CODEC_ID_MP2; break; case IEC61937_MPEG2_LAYER3_LSF: *VAR_3 = spdif_mpeg_pkt_offset[0][2]; *VAR_4 = AV_CODEC_ID_MP3; break; case IEC61937_DTS1: *VAR_3 = 2048; *VAR_4 = AV_CODEC_ID_DTS; break; case IEC61937_DTS2: *VAR_3 = 4096; *VAR_4 = AV_CODEC_ID_DTS; break; case IEC61937_DTS3: *VAR_3 = 8192; *VAR_4 = AV_CODEC_ID_DTS; break; default: if (VAR_0) { avpriv_request_sample(VAR_0, "Data type 0x%04x in IEC 61937", VAR_1); } return AVERROR_PATCHWELCOME; } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nenum IEC61937DataType VAR_1,\nconst char *VAR_2, int *VAR_3,\nenum AVCodecID *VAR_4)\n{", "AACADTSHeaderInfo aac_hdr;", "GetBitContext gbc;", "switch (VAR_1 & 0xff) {", "case IEC61937_AC3:\n*VAR_3 = AC3_FRAME_SIZE << 2;", "*VAR_4 = AV_CODEC_ID_AC3;", "break;", "case IEC61937_MPEG1_LAYER1:\n*VAR_3 = spdif_mpeg_pkt_offset[1][0];", "*VAR_4 = AV_CODEC_ID_MP1;", "break;", "case IEC61937_MPEG1_LAYER23:\n*VAR_3 = spdif_mpeg_pkt_offset[1][0];", "*VAR_4 = AV_CODEC_ID_MP3;", "break;", "case IEC61937_MPEG2_EXT:\n*VAR_3 = 4608;", "*VAR_4 = AV_CODEC_ID_MP3;", "break;", "case IEC61937_MPEG2_AAC:\ninit_get_bits(&gbc, VAR_2, AAC_ADTS_HEADER_SIZE * 8);", "if (avpriv_aac_parse_header(&gbc, &aac_hdr)) {", "if (VAR_0)\nav_log(VAR_0, AV_LOG_ERROR, \"Invalid AAC packet in IEC 61937\\n\");", "return AVERROR_INVALIDDATA;", "}", "*VAR_3 = aac_hdr.samples << 2;", "*VAR_4 = AV_CODEC_ID_AAC;", "break;", "case IEC61937_MPEG2_LAYER1_LSF:\n*VAR_3 = spdif_mpeg_pkt_offset[0][0];", "*VAR_4 = AV_CODEC_ID_MP1;", "break;", "case IEC61937_MPEG2_LAYER2_LSF:\n*VAR_3 = spdif_mpeg_pkt_offset[0][1];", "*VAR_4 = AV_CODEC_ID_MP2;", "break;", "case IEC61937_MPEG2_LAYER3_LSF:\n*VAR_3 = spdif_mpeg_pkt_offset[0][2];", "*VAR_4 = AV_CODEC_ID_MP3;", "break;", "case IEC61937_DTS1:\n*VAR_3 = 2048;", "*VAR_4 = AV_CODEC_ID_DTS;", "break;", "case IEC61937_DTS2:\n*VAR_3 = 4096;", "*VAR_4 = AV_CODEC_ID_DTS;", "break;", "case IEC61937_DTS3:\n*VAR_3 = 8192;", "*VAR_4 = AV_CODEC_ID_DTS;", "break;", "default:\nif (VAR_0) {", "avpriv_request_sample(VAR_0, \"Data type 0x%04x in IEC 61937\",\nVAR_1);", "}", "return AVERROR_PATCHWELCOME;", "}", "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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ] ]
760
static av_cold int seqvideo_decode_init(AVCodecContext *avctx) { SeqVideoContext *seq = avctx->priv_data; seq->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_PAL8; seq->frame.data[0] = NULL; return 0; }
false
FFmpeg
3b199d29cd597a3518136d78860e172060b9e83d
static av_cold int seqvideo_decode_init(AVCodecContext *avctx) { SeqVideoContext *seq = avctx->priv_data; seq->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_PAL8; seq->frame.data[0] = NULL; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { SeqVideoContext *seq = avctx->priv_data; seq->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_PAL8; seq->frame.data[0] = NULL; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "SeqVideoContext *seq = avctx->priv_data;", "seq->avctx = avctx;", "avctx->pix_fmt = AV_PIX_FMT_PAL8;", "seq->frame.data[0] = NULL;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ] ]
761
void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec) { int i; void *priv_ctx=NULL; if(!strcmp("AVCodecContext", (*(AVClass**)ctx)->class_name)){ AVCodecContext *avctx= ctx; if(codec && codec->priv_class && avctx->priv_data){ priv_ctx= avctx->priv_data; } } else if (!strcmp("AVFormatContext", (*(AVClass**)ctx)->class_name)) { AVFormatContext *avctx = ctx; if (avctx->oformat && avctx->oformat->priv_class) { priv_ctx = avctx->priv_data; } } for(i=0; i<opt_name_count; i++){ char buf[256]; const AVOption *opt; const char *str= av_get_string(opts_ctx, opt_names[i], &opt, buf, sizeof(buf)); /* if an option with name opt_names[i] is present in opts_ctx then str is non-NULL */ if(str && ((opt->flags & flags) == flags)) av_set_string3(ctx, opt_names[i], str, 1, NULL); /* We need to use a differnt system to pass options to the private context because it is not known which codec and thus context kind that will be when parsing options we thus use opt_values directly instead of opts_ctx */ if(!str && priv_ctx) { if (av_find_opt(priv_ctx, opt_names[i], NULL, flags, flags)) av_set_string3(priv_ctx, opt_names[i], opt_values[i], 0, NULL); } } }
false
FFmpeg
d319064465e148b8adb53d1ea5d38c09f987056e
void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec) { int i; void *priv_ctx=NULL; if(!strcmp("AVCodecContext", (*(AVClass**)ctx)->class_name)){ AVCodecContext *avctx= ctx; if(codec && codec->priv_class && avctx->priv_data){ priv_ctx= avctx->priv_data; } } else if (!strcmp("AVFormatContext", (*(AVClass**)ctx)->class_name)) { AVFormatContext *avctx = ctx; if (avctx->oformat && avctx->oformat->priv_class) { priv_ctx = avctx->priv_data; } } for(i=0; i<opt_name_count; i++){ char buf[256]; const AVOption *opt; const char *str= av_get_string(opts_ctx, opt_names[i], &opt, buf, sizeof(buf)); if(str && ((opt->flags & flags) == flags)) av_set_string3(ctx, opt_names[i], str, 1, NULL); if(!str && priv_ctx) { if (av_find_opt(priv_ctx, opt_names[i], NULL, flags, flags)) av_set_string3(priv_ctx, opt_names[i], opt_values[i], 0, NULL); } } }
{ "code": [], "line_no": [] }
void FUNC_0(void *VAR_0, void *VAR_1, int VAR_2, AVCodec *VAR_3) { int VAR_4; void *VAR_5=NULL; if(!strcmp("AVCodecContext", (*(AVClass**)VAR_0)->class_name)){ AVCodecContext *avctx= VAR_0; if(VAR_3 && VAR_3->priv_class && avctx->priv_data){ VAR_5= avctx->priv_data; } } else if (!strcmp("AVFormatContext", (*(AVClass**)VAR_0)->class_name)) { AVFormatContext *avctx = VAR_0; if (avctx->oformat && avctx->oformat->priv_class) { VAR_5 = avctx->priv_data; } } for(VAR_4=0; VAR_4<opt_name_count; VAR_4++){ char buf[256]; const AVOption *opt; const char *str= av_get_string(VAR_1, opt_names[VAR_4], &opt, buf, sizeof(buf)); if(str && ((opt->VAR_2 & VAR_2) == VAR_2)) av_set_string3(VAR_0, opt_names[VAR_4], str, 1, NULL); if(!str && VAR_5) { if (av_find_opt(VAR_5, opt_names[VAR_4], NULL, VAR_2, VAR_2)) av_set_string3(VAR_5, opt_names[VAR_4], opt_values[VAR_4], 0, NULL); } } }
[ "void FUNC_0(void *VAR_0, void *VAR_1, int VAR_2, AVCodec *VAR_3)\n{", "int VAR_4;", "void *VAR_5=NULL;", "if(!strcmp(\"AVCodecContext\", (*(AVClass**)VAR_0)->class_name)){", "AVCodecContext *avctx= VAR_0;", "if(VAR_3 && VAR_3->priv_class && avctx->priv_data){", "VAR_5= avctx->priv_data;", "}", "} else if (!strcmp(\"AVFormatContext\", (*(AVClass**)VAR_0)->class_name)) {", "AVFormatContext *avctx = VAR_0;", "if (avctx->oformat && avctx->oformat->priv_class) {", "VAR_5 = avctx->priv_data;", "}", "}", "for(VAR_4=0; VAR_4<opt_name_count; VAR_4++){", "char buf[256];", "const AVOption *opt;", "const char *str= av_get_string(VAR_1, opt_names[VAR_4], &opt, buf, sizeof(buf));", "if(str && ((opt->VAR_2 & VAR_2) == VAR_2))\nav_set_string3(VAR_0, opt_names[VAR_4], str, 1, NULL);", "if(!str && VAR_5) {", "if (av_find_opt(VAR_5, opt_names[VAR_4], NULL, VAR_2, VAR_2))\nav_set_string3(VAR_5, opt_names[VAR_4], opt_values[VAR_4], 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ] ]
762
int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect) { BufferSourceContext *c = buffer_filter->priv; AVFilterBufferRef *buf; int ret; if (!buf) { c->eof = 1; return 0; } else if (c->eof) return AVERROR(EINVAL); if (!av_fifo_space(c->fifo) && (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) + sizeof(buf))) < 0) return ret; CHECK_PARAM_CHANGE(buffer_filter, c, frame->width, frame->height, frame->format); buf = avfilter_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE, c->w, c->h); av_image_copy(buf->data, buf->linesize, frame->data, frame->linesize, c->pix_fmt, c->w, c->h); avfilter_copy_frame_props(buf, frame); buf->pts = pts; buf->video->pixel_aspect = pixel_aspect; if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) { avfilter_unref_buffer(buf); return ret; } return 0; }
false
FFmpeg
7bf9e3391fa21d90ff283fc03a12287fe73db9e8
int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect) { BufferSourceContext *c = buffer_filter->priv; AVFilterBufferRef *buf; int ret; if (!buf) { c->eof = 1; return 0; } else if (c->eof) return AVERROR(EINVAL); if (!av_fifo_space(c->fifo) && (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) + sizeof(buf))) < 0) return ret; CHECK_PARAM_CHANGE(buffer_filter, c, frame->width, frame->height, frame->format); buf = avfilter_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE, c->w, c->h); av_image_copy(buf->data, buf->linesize, frame->data, frame->linesize, c->pix_fmt, c->w, c->h); avfilter_copy_frame_props(buf, frame); buf->pts = pts; buf->video->pixel_aspect = pixel_aspect; if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) { avfilter_unref_buffer(buf); return ret; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1, int64_t VAR_2, AVRational VAR_3) { BufferSourceContext *c = VAR_0->priv; AVFilterBufferRef *buf; int VAR_4; if (!buf) { c->eof = 1; return 0; } else if (c->eof) return AVERROR(EINVAL); if (!av_fifo_space(c->fifo) && (VAR_4 = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) + sizeof(buf))) < 0) return VAR_4; CHECK_PARAM_CHANGE(VAR_0, c, VAR_1->width, VAR_1->height, VAR_1->format); buf = avfilter_get_video_buffer(VAR_0->outputs[0], AV_PERM_WRITE, c->w, c->h); av_image_copy(buf->data, buf->linesize, VAR_1->data, VAR_1->linesize, c->pix_fmt, c->w, c->h); avfilter_copy_frame_props(buf, VAR_1); buf->VAR_2 = VAR_2; buf->video->VAR_3 = VAR_3; if ((VAR_4 = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) { avfilter_unref_buffer(buf); return VAR_4; } return 0; }
[ "int FUNC_0(AVFilterContext *VAR_0, AVFrame *VAR_1,\nint64_t VAR_2, AVRational VAR_3)\n{", "BufferSourceContext *c = VAR_0->priv;", "AVFilterBufferRef *buf;", "int VAR_4;", "if (!buf) {", "c->eof = 1;", "return 0;", "} else if (c->eof)", "return AVERROR(EINVAL);", "if (!av_fifo_space(c->fifo) &&\n(VAR_4 = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) +\nsizeof(buf))) < 0)\nreturn VAR_4;", "CHECK_PARAM_CHANGE(VAR_0, c, VAR_1->width, VAR_1->height, VAR_1->format);", "buf = avfilter_get_video_buffer(VAR_0->outputs[0], AV_PERM_WRITE,\nc->w, c->h);", "av_image_copy(buf->data, buf->linesize, VAR_1->data, VAR_1->linesize,\nc->pix_fmt, c->w, c->h);", "avfilter_copy_frame_props(buf, VAR_1);", "buf->VAR_2 = VAR_2;", "buf->video->VAR_3 = VAR_3;", "if ((VAR_4 = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) {", "avfilter_unref_buffer(buf);", "return VAR_4;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29, 31, 33 ], [ 37 ], [ 41, 43 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ] ]
763
static int decode_byterun(uint8_t *dst, int dst_size, const uint8_t *buf, const uint8_t *const buf_end) { const uint8_t *const buf_start = buf; unsigned x; for (x = 0; x < dst_size && buf < buf_end;) { unsigned length; const int8_t value = *buf++; if (value >= 0) { length = value + 1; memcpy(dst + x, buf, FFMIN3(length, dst_size - x, buf_end - buf)); buf += length; } else if (value > -128) { length = -value + 1; memset(dst + x, *buf++, FFMIN(length, dst_size - x)); } else { // noop continue; } x += length; } if (x < dst_size) { av_log(NULL, AV_LOG_WARNING, "decode_byterun ended before plane size\n"); memset(dst+x, 0, dst_size - x); } return buf - buf_start; }
true
FFmpeg
4843227b2ca6876d07caddddd62e58e52d67e94f
static int decode_byterun(uint8_t *dst, int dst_size, const uint8_t *buf, const uint8_t *const buf_end) { const uint8_t *const buf_start = buf; unsigned x; for (x = 0; x < dst_size && buf < buf_end;) { unsigned length; const int8_t value = *buf++; if (value >= 0) { length = value + 1; memcpy(dst + x, buf, FFMIN3(length, dst_size - x, buf_end - buf)); buf += length; } else if (value > -128) { length = -value + 1; memset(dst + x, *buf++, FFMIN(length, dst_size - x)); } else { continue; } x += length; } if (x < dst_size) { av_log(NULL, AV_LOG_WARNING, "decode_byterun ended before plane size\n"); memset(dst+x, 0, dst_size - x); } return buf - buf_start; }
{ "code": [ " length = value + 1;", " memcpy(dst + x, buf, FFMIN3(length, dst_size - x, buf_end - buf));", " length = -value + 1;", " memset(dst + x, *buf++, FFMIN(length, dst_size - x));" ], "line_no": [ 19, 21, 27, 29 ] }
static int FUNC_0(uint8_t *VAR_0, int VAR_1, const uint8_t *VAR_2, const uint8_t *const VAR_3) { const uint8_t *const VAR_4 = VAR_2; unsigned VAR_5; for (VAR_5 = 0; VAR_5 < VAR_1 && VAR_2 < VAR_3;) { unsigned length; const int8_t value = *VAR_2++; if (value >= 0) { length = value + 1; memcpy(VAR_0 + VAR_5, VAR_2, FFMIN3(length, VAR_1 - VAR_5, VAR_3 - VAR_2)); VAR_2 += length; } else if (value > -128) { length = -value + 1; memset(VAR_0 + VAR_5, *VAR_2++, FFMIN(length, VAR_1 - VAR_5)); } else { continue; } VAR_5 += length; } if (VAR_5 < VAR_1) { av_log(NULL, AV_LOG_WARNING, "FUNC_0 ended before plane size\n"); memset(VAR_0+VAR_5, 0, VAR_1 - VAR_5); } return VAR_2 - VAR_4; }
[ "static int FUNC_0(uint8_t *VAR_0, int VAR_1,\nconst uint8_t *VAR_2, const uint8_t *const VAR_3)\n{", "const uint8_t *const VAR_4 = VAR_2;", "unsigned VAR_5;", "for (VAR_5 = 0; VAR_5 < VAR_1 && VAR_2 < VAR_3;) {", "unsigned length;", "const int8_t value = *VAR_2++;", "if (value >= 0) {", "length = value + 1;", "memcpy(VAR_0 + VAR_5, VAR_2, FFMIN3(length, VAR_1 - VAR_5, VAR_3 - VAR_2));", "VAR_2 += length;", "} else if (value > -128) {", "length = -value + 1;", "memset(VAR_0 + VAR_5, *VAR_2++, FFMIN(length, VAR_1 - VAR_5));", "} else {", "continue;", "}", "VAR_5 += length;", "}", "if (VAR_5 < VAR_1) {", "av_log(NULL, AV_LOG_WARNING, \"FUNC_0 ended before plane size\\n\");", "memset(VAR_0+VAR_5, 0, VAR_1 - VAR_5);", "}", "return VAR_2 - VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 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 ] ]
764
uint64_t blk_mig_bytes_total(void) { BlkMigDevState *bmds; uint64_t sum = 0; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { sum += bmds->total_sectors; } return sum << BDRV_SECTOR_BITS; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
uint64_t blk_mig_bytes_total(void) { BlkMigDevState *bmds; uint64_t sum = 0; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { sum += bmds->total_sectors; } return sum << BDRV_SECTOR_BITS; }
{ "code": [], "line_no": [] }
uint64_t FUNC_0(void) { BlkMigDevState *bmds; uint64_t sum = 0; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { sum += bmds->total_sectors; } return sum << BDRV_SECTOR_BITS; }
[ "uint64_t FUNC_0(void)\n{", "BlkMigDevState *bmds;", "uint64_t sum = 0;", "QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {", "sum += bmds->total_sectors;", "}", "return sum << BDRV_SECTOR_BITS;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
765
theora_header (AVFormatContext * s, int idx) { struct ogg *ogg = s->priv_data; struct ogg_stream *os = ogg->streams + idx; AVStream *st = s->streams[idx]; struct theora_params *thp = os->private; int cds = st->codec->extradata_size + os->psize + 2; uint8_t *cdp; if(!(os->buf[os->pstart] & 0x80)) return 0; if(!thp){ thp = av_mallocz(sizeof(*thp)); os->private = thp; if (os->buf[os->pstart] == 0x80) { GetBitContext gb; int width, height; init_get_bits(&gb, os->buf + os->pstart, os->psize*8); skip_bits_long(&gb, 7*8); /* 0x80"theora" */ thp->version = get_bits_long(&gb, 24); if (thp->version < 0x030100) { av_log(s, AV_LOG_ERROR, "Too old or unsupported Theora (%x)\n", thp->version); return -1; width = get_bits(&gb, 16) << 4; height = get_bits(&gb, 16) << 4; avcodec_set_dimensions(st->codec, width, height); if (thp->version >= 0x030400) skip_bits(&gb, 100); if (thp->version >= 0x030200) { width = get_bits_long(&gb, 24); height = get_bits_long(&gb, 24); if ( width <= st->codec->width && width > st->codec->width-16 && height <= st->codec->height && height > st->codec->height-16) avcodec_set_dimensions(st->codec, width, height); skip_bits(&gb, 16); st->codec->time_base.den = get_bits_long(&gb, 32); st->codec->time_base.num = get_bits_long(&gb, 32); st->time_base = st->codec->time_base; st->sample_aspect_ratio.num = get_bits_long(&gb, 24); st->sample_aspect_ratio.den = get_bits_long(&gb, 24); if (thp->version >= 0x030200) skip_bits_long(&gb, 38); if (thp->version >= 0x304000) skip_bits(&gb, 2); thp->gpshift = get_bits(&gb, 5); thp->gpmask = (1 << thp->gpshift) - 1; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_THEORA; } else if (os->buf[os->pstart] == 0x83) { vorbis_comment (s, os->buf + os->pstart + 7, os->psize - 8); st->codec->extradata = av_realloc (st->codec->extradata, cds + FF_INPUT_BUFFER_PADDING_SIZE); cdp = st->codec->extradata + st->codec->extradata_size; *cdp++ = os->psize >> 8; *cdp++ = os->psize & 0xff; memcpy (cdp, os->buf + os->pstart, os->psize); st->codec->extradata_size = cds; return 1;
true
FFmpeg
11d058b7b351db8fb73104c847c5cc43b91735c6
theora_header (AVFormatContext * s, int idx) { struct ogg *ogg = s->priv_data; struct ogg_stream *os = ogg->streams + idx; AVStream *st = s->streams[idx]; struct theora_params *thp = os->private; int cds = st->codec->extradata_size + os->psize + 2; uint8_t *cdp; if(!(os->buf[os->pstart] & 0x80)) return 0; if(!thp){ thp = av_mallocz(sizeof(*thp)); os->private = thp; if (os->buf[os->pstart] == 0x80) { GetBitContext gb; int width, height; init_get_bits(&gb, os->buf + os->pstart, os->psize*8); skip_bits_long(&gb, 7*8); thp->version = get_bits_long(&gb, 24); if (thp->version < 0x030100) { av_log(s, AV_LOG_ERROR, "Too old or unsupported Theora (%x)\n", thp->version); return -1; width = get_bits(&gb, 16) << 4; height = get_bits(&gb, 16) << 4; avcodec_set_dimensions(st->codec, width, height); if (thp->version >= 0x030400) skip_bits(&gb, 100); if (thp->version >= 0x030200) { width = get_bits_long(&gb, 24); height = get_bits_long(&gb, 24); if ( width <= st->codec->width && width > st->codec->width-16 && height <= st->codec->height && height > st->codec->height-16) avcodec_set_dimensions(st->codec, width, height); skip_bits(&gb, 16); st->codec->time_base.den = get_bits_long(&gb, 32); st->codec->time_base.num = get_bits_long(&gb, 32); st->time_base = st->codec->time_base; st->sample_aspect_ratio.num = get_bits_long(&gb, 24); st->sample_aspect_ratio.den = get_bits_long(&gb, 24); if (thp->version >= 0x030200) skip_bits_long(&gb, 38); if (thp->version >= 0x304000) skip_bits(&gb, 2); thp->gpshift = get_bits(&gb, 5); thp->gpmask = (1 << thp->gpshift) - 1; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_THEORA; } else if (os->buf[os->pstart] == 0x83) { vorbis_comment (s, os->buf + os->pstart + 7, os->psize - 8); st->codec->extradata = av_realloc (st->codec->extradata, cds + FF_INPUT_BUFFER_PADDING_SIZE); cdp = st->codec->extradata + st->codec->extradata_size; *cdp++ = os->psize >> 8; *cdp++ = os->psize & 0xff; memcpy (cdp, os->buf + os->pstart, os->psize); st->codec->extradata_size = cds; return 1;
{ "code": [], "line_no": [] }
FUNC_0 (AVFormatContext * VAR_0, int VAR_1) { struct VAR_2 *VAR_2 = VAR_0->priv_data; struct ogg_stream *VAR_3 = VAR_2->streams + VAR_1; AVStream *st = VAR_0->streams[VAR_1]; struct theora_params *VAR_4 = VAR_3->private; int VAR_5 = st->codec->extradata_size + VAR_3->psize + 2; uint8_t *cdp; if(!(VAR_3->buf[VAR_3->pstart] & 0x80)) return 0; if(!VAR_4){ VAR_4 = av_mallocz(sizeof(*VAR_4)); VAR_3->private = VAR_4; if (VAR_3->buf[VAR_3->pstart] == 0x80) { GetBitContext gb; int VAR_6, VAR_7; init_get_bits(&gb, VAR_3->buf + VAR_3->pstart, VAR_3->psize*8); skip_bits_long(&gb, 7*8); VAR_4->version = get_bits_long(&gb, 24); if (VAR_4->version < 0x030100) { av_log(VAR_0, AV_LOG_ERROR, "Too old or unsupported Theora (%x)\n", VAR_4->version); return -1; VAR_6 = get_bits(&gb, 16) << 4; VAR_7 = get_bits(&gb, 16) << 4; avcodec_set_dimensions(st->codec, VAR_6, VAR_7); if (VAR_4->version >= 0x030400) skip_bits(&gb, 100); if (VAR_4->version >= 0x030200) { VAR_6 = get_bits_long(&gb, 24); VAR_7 = get_bits_long(&gb, 24); if ( VAR_6 <= st->codec->VAR_6 && VAR_6 > st->codec->VAR_6-16 && VAR_7 <= st->codec->VAR_7 && VAR_7 > st->codec->VAR_7-16) avcodec_set_dimensions(st->codec, VAR_6, VAR_7); skip_bits(&gb, 16); st->codec->time_base.den = get_bits_long(&gb, 32); st->codec->time_base.num = get_bits_long(&gb, 32); st->time_base = st->codec->time_base; st->sample_aspect_ratio.num = get_bits_long(&gb, 24); st->sample_aspect_ratio.den = get_bits_long(&gb, 24); if (VAR_4->version >= 0x030200) skip_bits_long(&gb, 38); if (VAR_4->version >= 0x304000) skip_bits(&gb, 2); VAR_4->gpshift = get_bits(&gb, 5); VAR_4->gpmask = (1 << VAR_4->gpshift) - 1; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_THEORA; } else if (VAR_3->buf[VAR_3->pstart] == 0x83) { vorbis_comment (VAR_0, VAR_3->buf + VAR_3->pstart + 7, VAR_3->psize - 8); st->codec->extradata = av_realloc (st->codec->extradata, VAR_5 + FF_INPUT_BUFFER_PADDING_SIZE); cdp = st->codec->extradata + st->codec->extradata_size; *cdp++ = VAR_3->psize >> 8; *cdp++ = VAR_3->psize & 0xff; memcpy (cdp, VAR_3->buf + VAR_3->pstart, VAR_3->psize); st->codec->extradata_size = VAR_5; return 1;
[ "FUNC_0 (AVFormatContext * VAR_0, int VAR_1)\n{", "struct VAR_2 *VAR_2 = VAR_0->priv_data;", "struct ogg_stream *VAR_3 = VAR_2->streams + VAR_1;", "AVStream *st = VAR_0->streams[VAR_1];", "struct theora_params *VAR_4 = VAR_3->private;", "int VAR_5 = st->codec->extradata_size + VAR_3->psize + 2;", "uint8_t *cdp;", "if(!(VAR_3->buf[VAR_3->pstart] & 0x80))\nreturn 0;", "if(!VAR_4){", "VAR_4 = av_mallocz(sizeof(*VAR_4));", "VAR_3->private = VAR_4;", "if (VAR_3->buf[VAR_3->pstart] == 0x80) {", "GetBitContext gb;", "int VAR_6, VAR_7;", "init_get_bits(&gb, VAR_3->buf + VAR_3->pstart, VAR_3->psize*8);", "skip_bits_long(&gb, 7*8);", "VAR_4->version = get_bits_long(&gb, 24);", "if (VAR_4->version < 0x030100)\n{", "av_log(VAR_0, AV_LOG_ERROR,\n\"Too old or unsupported Theora (%x)\\n\", VAR_4->version);", "return -1;", "VAR_6 = get_bits(&gb, 16) << 4;", "VAR_7 = get_bits(&gb, 16) << 4;", "avcodec_set_dimensions(st->codec, VAR_6, VAR_7);", "if (VAR_4->version >= 0x030400)\nskip_bits(&gb, 100);", "if (VAR_4->version >= 0x030200) {", "VAR_6 = get_bits_long(&gb, 24);", "VAR_7 = get_bits_long(&gb, 24);", "if ( VAR_6 <= st->codec->VAR_6 && VAR_6 > st->codec->VAR_6-16\n&& VAR_7 <= st->codec->VAR_7 && VAR_7 > st->codec->VAR_7-16)\navcodec_set_dimensions(st->codec, VAR_6, VAR_7);", "skip_bits(&gb, 16);", "st->codec->time_base.den = get_bits_long(&gb, 32);", "st->codec->time_base.num = get_bits_long(&gb, 32);", "st->time_base = st->codec->time_base;", "st->sample_aspect_ratio.num = get_bits_long(&gb, 24);", "st->sample_aspect_ratio.den = get_bits_long(&gb, 24);", "if (VAR_4->version >= 0x030200)\nskip_bits_long(&gb, 38);", "if (VAR_4->version >= 0x304000)\nskip_bits(&gb, 2);", "VAR_4->gpshift = get_bits(&gb, 5);", "VAR_4->gpmask = (1 << VAR_4->gpshift) - 1;", "st->codec->codec_type = CODEC_TYPE_VIDEO;", "st->codec->codec_id = CODEC_ID_THEORA;", "} else if (VAR_3->buf[VAR_3->pstart] == 0x83) {", "vorbis_comment (VAR_0, VAR_3->buf + VAR_3->pstart + 7, VAR_3->psize - 8);", "st->codec->extradata = av_realloc (st->codec->extradata,\nVAR_5 + FF_INPUT_BUFFER_PADDING_SIZE);", "cdp = st->codec->extradata + st->codec->extradata_size;", "*cdp++ = VAR_3->psize >> 8;", "*cdp++ = VAR_3->psize & 0xff;", "memcpy (cdp, VAR_3->buf + VAR_3->pstart, VAR_3->psize);", "st->codec->extradata_size = VAR_5;", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 34 ], [ 36 ], [ 38 ], [ 42 ], [ 46 ], [ 50 ], [ 52, 54 ], [ 56, 58 ], [ 60 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87, 89 ], [ 93 ], [ 96 ], [ 98 ], [ 105 ], [ 109 ], [ 111 ], [ 115, 117 ], [ 119, 121 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 144, 146 ], [ 148 ], [ 150 ], [ 152 ], [ 154 ], [ 156 ], [ 160 ] ]
766
static TAPState *net_tap_fd_init(VLANState *vlan, const char *model, const char *name, int fd) { TAPState *s; s = qemu_mallocz(sizeof(TAPState)); s->fd = fd; s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s); s->vc->fd_readv = tap_receive_iov; qemu_set_fd_handler(s->fd, tap_send, NULL, s); snprintf(s->vc->info_str, sizeof(s->vc->info_str), "fd=%d", fd); return s; }
true
qemu
b946a1533209f61a93e34898aebb5b43154b99c3
static TAPState *net_tap_fd_init(VLANState *vlan, const char *model, const char *name, int fd) { TAPState *s; s = qemu_mallocz(sizeof(TAPState)); s->fd = fd; s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s); s->vc->fd_readv = tap_receive_iov; qemu_set_fd_handler(s->fd, tap_send, NULL, s); snprintf(s->vc->info_str, sizeof(s->vc->info_str), "fd=%d", fd); return s; }
{ "code": [ " s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s);", " s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s);" ], "line_no": [ 19, 19 ] }
static TAPState *FUNC_0(VLANState *vlan, const char *model, const char *name, int fd) { TAPState *s; s = qemu_mallocz(sizeof(TAPState)); s->fd = fd; s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s); s->vc->fd_readv = tap_receive_iov; qemu_set_fd_handler(s->fd, tap_send, NULL, s); snprintf(s->vc->info_str, sizeof(s->vc->info_str), "fd=%d", fd); return s; }
[ "static TAPState *FUNC_0(VLANState *vlan,\nconst char *model,\nconst char *name,\nint fd)\n{", "TAPState *s;", "s = qemu_mallocz(sizeof(TAPState));", "s->fd = fd;", "s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s);", "s->vc->fd_readv = tap_receive_iov;", "qemu_set_fd_handler(s->fd, tap_send, NULL, s);", "snprintf(s->vc->info_str, sizeof(s->vc->info_str), \"fd=%d\", fd);", "return s;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
769
static int write_refcount_block_entries(BlockDriverState *bs, int64_t refcount_block_offset, int first_index, int last_index) { BDRVQcowState *s = bs->opaque; size_t size; int ret; if (cache_refcount_updates) { return 0; } if (first_index < 0) { return 0; } first_index &= ~(REFCOUNTS_PER_SECTOR - 1); last_index = (last_index + REFCOUNTS_PER_SECTOR) & ~(REFCOUNTS_PER_SECTOR - 1); size = (last_index - first_index) << REFCOUNT_SHIFT; BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_UPDATE_PART); ret = bdrv_pwrite(bs->file, refcount_block_offset + (first_index << REFCOUNT_SHIFT), &s->refcount_block_cache[first_index], size); if (ret < 0) { return ret; } return 0; }
true
qemu
8b3b720620a1137a1b794fc3ed64734236f94e06
static int write_refcount_block_entries(BlockDriverState *bs, int64_t refcount_block_offset, int first_index, int last_index) { BDRVQcowState *s = bs->opaque; size_t size; int ret; if (cache_refcount_updates) { return 0; } if (first_index < 0) { return 0; } first_index &= ~(REFCOUNTS_PER_SECTOR - 1); last_index = (last_index + REFCOUNTS_PER_SECTOR) & ~(REFCOUNTS_PER_SECTOR - 1); size = (last_index - first_index) << REFCOUNT_SHIFT; BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_UPDATE_PART); ret = bdrv_pwrite(bs->file, refcount_block_offset + (first_index << REFCOUNT_SHIFT), &s->refcount_block_cache[first_index], size); if (ret < 0) { return ret; } return 0; }
{ "code": [ " ret = bdrv_pwrite(bs->file," ], "line_no": [ 45 ] }
static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, int VAR_2, int VAR_3) { BDRVQcowState *s = VAR_0->opaque; size_t size; int VAR_4; if (cache_refcount_updates) { return 0; } if (VAR_2 < 0) { return 0; } VAR_2 &= ~(REFCOUNTS_PER_SECTOR - 1); VAR_3 = (VAR_3 + REFCOUNTS_PER_SECTOR) & ~(REFCOUNTS_PER_SECTOR - 1); size = (VAR_3 - VAR_2) << REFCOUNT_SHIFT; BLKDBG_EVENT(VAR_0->file, BLKDBG_REFBLOCK_UPDATE_PART); VAR_4 = bdrv_pwrite(VAR_0->file, VAR_1 + (VAR_2 << REFCOUNT_SHIFT), &s->refcount_block_cache[VAR_2], size); if (VAR_4 < 0) { return VAR_4; } return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0,\nint64_t VAR_1, int VAR_2, int VAR_3)\n{", "BDRVQcowState *s = VAR_0->opaque;", "size_t size;", "int VAR_4;", "if (cache_refcount_updates) {", "return 0;", "}", "if (VAR_2 < 0) {", "return 0;", "}", "VAR_2 &= ~(REFCOUNTS_PER_SECTOR - 1);", "VAR_3 = (VAR_3 + REFCOUNTS_PER_SECTOR)\n& ~(REFCOUNTS_PER_SECTOR - 1);", "size = (VAR_3 - VAR_2) << REFCOUNT_SHIFT;", "BLKDBG_EVENT(VAR_0->file, BLKDBG_REFBLOCK_UPDATE_PART);", "VAR_4 = bdrv_pwrite(VAR_0->file,\nVAR_1 + (VAR_2 << REFCOUNT_SHIFT),\n&s->refcount_block_cache[VAR_2], size);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "return 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 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 39 ], [ 43 ], [ 45, 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ] ]
770
static int t15(InterplayACMContext *s, unsigned ind, unsigned col) { GetBitContext *gb = &s->gb; unsigned i, b; int n1, n2, n3; for (i = 0; i < s->rows; i++) { /* b = (x1) + (x2 * 3) + (x3 * 9) */ b = get_bits(gb, 5); n1 = (mul_3x3[b] & 0x0F) - 1; n2 = ((mul_3x3[b] >> 4) & 0x0F) - 1; n3 = ((mul_3x3[b] >> 8) & 0x0F) - 1; set_pos(s, i++, col, n1); if (i >= s->rows) break; set_pos(s, i++, col, n2); if (i >= s->rows) break; set_pos(s, i, col, n3); return 0;
true
FFmpeg
14e4e26559697cfdea584767be4e68474a0a9c7f
static int t15(InterplayACMContext *s, unsigned ind, unsigned col) { GetBitContext *gb = &s->gb; unsigned i, b; int n1, n2, n3; for (i = 0; i < s->rows; i++) { b = get_bits(gb, 5); n1 = (mul_3x3[b] & 0x0F) - 1; n2 = ((mul_3x3[b] >> 4) & 0x0F) - 1; n3 = ((mul_3x3[b] >> 8) & 0x0F) - 1; set_pos(s, i++, col, n1); if (i >= s->rows) break; set_pos(s, i++, col, n2); if (i >= s->rows) break; set_pos(s, i, col, n3); return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(InterplayACMContext *VAR_0, unsigned VAR_1, unsigned VAR_2) { GetBitContext *gb = &VAR_0->gb; unsigned VAR_3, VAR_4; int VAR_5, VAR_6, VAR_7; for (VAR_3 = 0; VAR_3 < VAR_0->rows; VAR_3++) { VAR_4 = get_bits(gb, 5); VAR_5 = (mul_3x3[VAR_4] & 0x0F) - 1; VAR_6 = ((mul_3x3[VAR_4] >> 4) & 0x0F) - 1; VAR_7 = ((mul_3x3[VAR_4] >> 8) & 0x0F) - 1; set_pos(VAR_0, VAR_3++, VAR_2, VAR_5); if (VAR_3 >= VAR_0->rows) break; set_pos(VAR_0, VAR_3++, VAR_2, VAR_6); if (VAR_3 >= VAR_0->rows) break; set_pos(VAR_0, VAR_3, VAR_2, VAR_7); return 0;
[ "static int FUNC_0(InterplayACMContext *VAR_0, unsigned VAR_1, unsigned VAR_2)\n{", "GetBitContext *gb = &VAR_0->gb;", "unsigned VAR_3, VAR_4;", "int VAR_5, VAR_6, VAR_7;", "for (VAR_3 = 0; VAR_3 < VAR_0->rows; VAR_3++) {", "VAR_4 = get_bits(gb, 5);", "VAR_5 = (mul_3x3[VAR_4] & 0x0F) - 1;", "VAR_6 = ((mul_3x3[VAR_4] >> 4) & 0x0F) - 1;", "VAR_7 = ((mul_3x3[VAR_4] >> 8) & 0x0F) - 1;", "set_pos(VAR_0, VAR_3++, VAR_2, VAR_5);", "if (VAR_3 >= VAR_0->rows)\nbreak;", "set_pos(VAR_0, VAR_3++, VAR_2, VAR_6);", "if (VAR_3 >= VAR_0->rows)\nbreak;", "set_pos(VAR_0, VAR_3, VAR_2, VAR_7);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 48 ] ]
773
void do_load_6xx_tlb (int is_code) { target_ulong RPN, CMP, EPN; int way; RPN = env->spr[SPR_RPA]; if (is_code) { CMP = env->spr[SPR_ICMP]; EPN = env->spr[SPR_IMISS]; } else { CMP = env->spr[SPR_DCMP]; EPN = env->spr[SPR_DMISS]; } way = (env->spr[SPR_SRR1] >> 17) & 1; #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { fprintf(logfile, "%s: EPN %08lx %08lx PTE0 %08lx PTE1 %08lx way %d\n", __func__, (unsigned long)T0, (unsigned long)EPN, (unsigned long)CMP, (unsigned long)RPN, way); } #endif /* Store this TLB */ ppc6xx_tlb_store(env, T0 & TARGET_PAGE_MASK, way, is_code, CMP, RPN); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
void do_load_6xx_tlb (int is_code) { target_ulong RPN, CMP, EPN; int way; RPN = env->spr[SPR_RPA]; if (is_code) { CMP = env->spr[SPR_ICMP]; EPN = env->spr[SPR_IMISS]; } else { CMP = env->spr[SPR_DCMP]; EPN = env->spr[SPR_DMISS]; } way = (env->spr[SPR_SRR1] >> 17) & 1; #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { fprintf(logfile, "%s: EPN %08lx %08lx PTE0 %08lx PTE1 %08lx way %d\n", __func__, (unsigned long)T0, (unsigned long)EPN, (unsigned long)CMP, (unsigned long)RPN, way); } #endif ppc6xx_tlb_store(env, T0 & TARGET_PAGE_MASK, way, is_code, CMP, RPN); }
{ "code": [ " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", " } else {", "#endif", " ppc6xx_tlb_store(env, T0 & TARGET_PAGE_MASK, way, is_code, CMP, RPN);", "#endif" ], "line_no": [ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 41, 45, 41 ] }
void FUNC_0 (int VAR_0) { target_ulong RPN, CMP, EPN; int VAR_1; RPN = env->spr[SPR_RPA]; if (VAR_0) { CMP = env->spr[SPR_ICMP]; EPN = env->spr[SPR_IMISS]; } else { CMP = env->spr[SPR_DCMP]; EPN = env->spr[SPR_DMISS]; } VAR_1 = (env->spr[SPR_SRR1] >> 17) & 1; #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { fprintf(logfile, "%s: EPN %08lx %08lx PTE0 %08lx PTE1 %08lx VAR_1 %d\n", __func__, (unsigned long)T0, (unsigned long)EPN, (unsigned long)CMP, (unsigned long)RPN, VAR_1); } #endif ppc6xx_tlb_store(env, T0 & TARGET_PAGE_MASK, VAR_1, VAR_0, CMP, RPN); }
[ "void FUNC_0 (int VAR_0)\n{", "target_ulong RPN, CMP, EPN;", "int VAR_1;", "RPN = env->spr[SPR_RPA];", "if (VAR_0) {", "CMP = env->spr[SPR_ICMP];", "EPN = env->spr[SPR_IMISS];", "} else {", "CMP = env->spr[SPR_DCMP];", "EPN = env->spr[SPR_DMISS];", "}", "VAR_1 = (env->spr[SPR_SRR1] >> 17) & 1;", "#if defined (DEBUG_SOFTWARE_TLB)\nif (loglevel != 0) {", "fprintf(logfile, \"%s: EPN %08lx %08lx PTE0 %08lx PTE1 %08lx VAR_1 %d\\n\",\n__func__, (unsigned long)T0, (unsigned long)EPN,\n(unsigned long)CMP, (unsigned long)RPN, VAR_1);", "}", "#endif\nppc6xx_tlb_store(env, T0 & TARGET_PAGE_MASK, VAR_1, VAR_0, CMP, RPN);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33, 35, 37 ], [ 39 ], [ 41, 45 ], [ 47 ] ]
774
void helper_dcbz(CPUPPCState *env, target_ulong addr, uint32_t is_dcbzl) { int dcbz_size = env->dcache_line_size; #if defined(TARGET_PPC64) if (!is_dcbzl && (env->excp_model == POWERPC_EXCP_970) && ((env->spr[SPR_970_HID5] >> 7) & 0x3) == 1) { dcbz_size = 32; } #endif /* XXX add e500mc support */ do_dcbz(env, addr, dcbz_size, GETPC()); }
true
qemu
c9f82d013be0d8d9c5d9f51bb76e337a0a5a5cac
void helper_dcbz(CPUPPCState *env, target_ulong addr, uint32_t is_dcbzl) { int dcbz_size = env->dcache_line_size; #if defined(TARGET_PPC64) if (!is_dcbzl && (env->excp_model == POWERPC_EXCP_970) && ((env->spr[SPR_970_HID5] >> 7) & 0x3) == 1) { dcbz_size = 32; } #endif do_dcbz(env, addr, dcbz_size, GETPC()); }
{ "code": [ "void helper_dcbz(CPUPPCState *env, target_ulong addr, uint32_t is_dcbzl)", " int dcbz_size = env->dcache_line_size;", " if (!is_dcbzl &&", " (env->excp_model == POWERPC_EXCP_970) &&", " ((env->spr[SPR_970_HID5] >> 7) & 0x3) == 1) {", " do_dcbz(env, addr, dcbz_size, GETPC());" ], "line_no": [ 1, 5, 11, 13, 15, 29 ] }
void FUNC_0(CPUPPCState *VAR_0, target_ulong VAR_1, uint32_t VAR_2) { int VAR_3 = VAR_0->dcache_line_size; #if defined(TARGET_PPC64) if (!VAR_2 && (VAR_0->excp_model == POWERPC_EXCP_970) && ((VAR_0->spr[SPR_970_HID5] >> 7) & 0x3) == 1) { VAR_3 = 32; } #endif do_dcbz(VAR_0, VAR_1, VAR_3, GETPC()); }
[ "void FUNC_0(CPUPPCState *VAR_0, target_ulong VAR_1, uint32_t VAR_2)\n{", "int VAR_3 = VAR_0->dcache_line_size;", "#if defined(TARGET_PPC64)\nif (!VAR_2 &&\n(VAR_0->excp_model == POWERPC_EXCP_970) &&\n((VAR_0->spr[SPR_970_HID5] >> 7) & 0x3) == 1) {", "VAR_3 = 32;", "}", "#endif\ndo_dcbz(VAR_0, VAR_1, VAR_3, GETPC());", "}" ]
[ 1, 1, 1, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 21, 29 ], [ 31 ] ]
775
envlist_create(void) { envlist_t *envlist; if ((envlist = malloc(sizeof (*envlist))) == NULL) return (NULL); QLIST_INIT(&envlist->el_entries); envlist->el_count = 0; return (envlist); }
true
qemu
ec45bbe5f1921c6553fbf9c0c76b358b0403c22d
envlist_create(void) { envlist_t *envlist; if ((envlist = malloc(sizeof (*envlist))) == NULL) return (NULL); QLIST_INIT(&envlist->el_entries); envlist->el_count = 0; return (envlist); }
{ "code": [ "\tif ((envlist = malloc(sizeof (*envlist))) == NULL)", "\t\treturn (NULL);", "\t\treturn (NULL);" ], "line_no": [ 9, 11, 11 ] }
FUNC_0(void) { envlist_t *envlist; if ((envlist = malloc(sizeof (*envlist))) == NULL) return (NULL); QLIST_INIT(&envlist->el_entries); envlist->el_count = 0; return (envlist); }
[ "FUNC_0(void)\n{", "envlist_t *envlist;", "if ((envlist = malloc(sizeof (*envlist))) == NULL)\nreturn (NULL);", "QLIST_INIT(&envlist->el_entries);", "envlist->el_count = 0;", "return (envlist);", "}" ]
[ 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
776
static void gen_ori(DisasContext *ctx) { target_ulong uimm = UIMM(ctx->opcode); if (rS(ctx->opcode) == rA(ctx->opcode) && uimm == 0) { /* NOP */ /* XXX: should handle special NOPs for POWER series */ return; } tcg_gen_ori_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], uimm); }
true
qemu
b68e60e6f0d2865e961a800fb8db96a7fc6494c4
static void gen_ori(DisasContext *ctx) { target_ulong uimm = UIMM(ctx->opcode); if (rS(ctx->opcode) == rA(ctx->opcode) && uimm == 0) { return; } tcg_gen_ori_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], uimm); }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0) { target_ulong uimm = UIMM(VAR_0->opcode); if (rS(VAR_0->opcode) == rA(VAR_0->opcode) && uimm == 0) { return; } tcg_gen_ori_tl(cpu_gpr[rA(VAR_0->opcode)], cpu_gpr[rS(VAR_0->opcode)], uimm); }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "target_ulong uimm = UIMM(VAR_0->opcode);", "if (rS(VAR_0->opcode) == rA(VAR_0->opcode) && uimm == 0) {", "return;", "}", "tcg_gen_ori_tl(cpu_gpr[rA(VAR_0->opcode)], cpu_gpr[rS(VAR_0->opcode)], uimm);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
777
static void close(AVCodecParserContext *s) { H264Context *h = s->priv_data; ParseContext *pc = &h->s.parse_context; av_free(pc->buffer); }
true
FFmpeg
15861962a7a9e64fbe75f5cc0dc7d1c032db8dd5
static void close(AVCodecParserContext *s) { H264Context *h = s->priv_data; ParseContext *pc = &h->s.parse_context; av_free(pc->buffer); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVCodecParserContext *VAR_0) { H264Context *h = VAR_0->priv_data; ParseContext *pc = &h->VAR_0.parse_context; av_free(pc->buffer); }
[ "static void FUNC_0(AVCodecParserContext *VAR_0)\n{", "H264Context *h = VAR_0->priv_data;", "ParseContext *pc = &h->VAR_0.parse_context;", "av_free(pc->buffer);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 14 ] ]
778
static void sch_handle_start_func(SubchDev *sch, ORB *orb) { PMCW *p = &sch->curr_status.pmcw; SCSW *s = &sch->curr_status.scsw; int path; int ret; /* Path management: In our simple css, we always choose the only path. */ path = 0x80; if (!(s->ctrl & SCSW_ACTL_SUSP)) { /* Look at the orb and try to execute the channel program. */ assert(orb != NULL); /* resume does not pass an orb */ p->intparm = orb->intparm; if (!(orb->lpm & path)) { /* Generate a deferred cc 3 condition. */ s->flags |= SCSW_FLAGS_MASK_CC; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= (SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND); return; } sch->ccw_fmt_1 = !!(orb->ctrl0 & ORB_CTRL0_MASK_FMT); sch->ccw_no_data_cnt = 0; } else { s->ctrl &= ~(SCSW_ACTL_SUSP | SCSW_ACTL_RESUME_PEND); } sch->last_cmd_valid = false; do { ret = css_interpret_ccw(sch, sch->channel_prog); switch (ret) { case -EAGAIN: /* ccw chain, continue processing */ break; case 0: /* success */ s->ctrl &= ~SCSW_ACTL_START_PEND; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_STATUS_PEND; s->dstat = SCSW_DSTAT_CHANNEL_END | SCSW_DSTAT_DEVICE_END; s->cpa = sch->channel_prog + 8; break; case -ENOSYS: /* unsupported command, generate unit check (command reject) */ s->ctrl &= ~SCSW_ACTL_START_PEND; s->dstat = SCSW_DSTAT_UNIT_CHECK; /* Set sense bit 0 in ecw0. */ sch->sense_data[0] = 0x80; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; s->cpa = sch->channel_prog + 8; break; case -EFAULT: /* memory problem, generate channel data check */ s->ctrl &= ~SCSW_ACTL_START_PEND; s->cstat = SCSW_CSTAT_DATA_CHECK; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; s->cpa = sch->channel_prog + 8; break; case -EBUSY: /* subchannel busy, generate deferred cc 1 */ s->flags &= ~SCSW_FLAGS_MASK_CC; s->flags |= (1 << 8); s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; break; case -EINPROGRESS: /* channel program has been suspended */ s->ctrl &= ~SCSW_ACTL_START_PEND; s->ctrl |= SCSW_ACTL_SUSP; break; default: /* error, generate channel program check */ s->ctrl &= ~SCSW_ACTL_START_PEND; s->cstat = SCSW_CSTAT_PROG_CHECK; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; s->cpa = sch->channel_prog + 8; break; } } while (ret == -EAGAIN); }
true
qemu
6b7741c2bedeae2e8c54fffce81723ca0a0c25c0
static void sch_handle_start_func(SubchDev *sch, ORB *orb) { PMCW *p = &sch->curr_status.pmcw; SCSW *s = &sch->curr_status.scsw; int path; int ret; path = 0x80; if (!(s->ctrl & SCSW_ACTL_SUSP)) { assert(orb != NULL); p->intparm = orb->intparm; if (!(orb->lpm & path)) { s->flags |= SCSW_FLAGS_MASK_CC; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= (SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND); return; } sch->ccw_fmt_1 = !!(orb->ctrl0 & ORB_CTRL0_MASK_FMT); sch->ccw_no_data_cnt = 0; } else { s->ctrl &= ~(SCSW_ACTL_SUSP | SCSW_ACTL_RESUME_PEND); } sch->last_cmd_valid = false; do { ret = css_interpret_ccw(sch, sch->channel_prog); switch (ret) { case -EAGAIN: break; case 0: s->ctrl &= ~SCSW_ACTL_START_PEND; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_STATUS_PEND; s->dstat = SCSW_DSTAT_CHANNEL_END | SCSW_DSTAT_DEVICE_END; s->cpa = sch->channel_prog + 8; break; case -ENOSYS: s->ctrl &= ~SCSW_ACTL_START_PEND; s->dstat = SCSW_DSTAT_UNIT_CHECK; sch->sense_data[0] = 0x80; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; s->cpa = sch->channel_prog + 8; break; case -EFAULT: s->ctrl &= ~SCSW_ACTL_START_PEND; s->cstat = SCSW_CSTAT_DATA_CHECK; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; s->cpa = sch->channel_prog + 8; break; case -EBUSY: s->flags &= ~SCSW_FLAGS_MASK_CC; s->flags |= (1 << 8); s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; break; case -EINPROGRESS: s->ctrl &= ~SCSW_ACTL_START_PEND; s->ctrl |= SCSW_ACTL_SUSP; break; default: s->ctrl &= ~SCSW_ACTL_START_PEND; s->cstat = SCSW_CSTAT_PROG_CHECK; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; s->cpa = sch->channel_prog + 8; break; } } while (ret == -EAGAIN); }
{ "code": [], "line_no": [] }
static void FUNC_0(SubchDev *VAR_0, ORB *VAR_1) { PMCW *p = &VAR_0->curr_status.pmcw; SCSW *s = &VAR_0->curr_status.scsw; int VAR_2; int VAR_3; VAR_2 = 0x80; if (!(s->ctrl & SCSW_ACTL_SUSP)) { assert(VAR_1 != NULL); p->intparm = VAR_1->intparm; if (!(VAR_1->lpm & VAR_2)) { s->flags |= SCSW_FLAGS_MASK_CC; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= (SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND); return; } VAR_0->ccw_fmt_1 = !!(VAR_1->ctrl0 & ORB_CTRL0_MASK_FMT); VAR_0->ccw_no_data_cnt = 0; } else { s->ctrl &= ~(SCSW_ACTL_SUSP | SCSW_ACTL_RESUME_PEND); } VAR_0->last_cmd_valid = false; do { VAR_3 = css_interpret_ccw(VAR_0, VAR_0->channel_prog); switch (VAR_3) { case -EAGAIN: break; case 0: s->ctrl &= ~SCSW_ACTL_START_PEND; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_STATUS_PEND; s->dstat = SCSW_DSTAT_CHANNEL_END | SCSW_DSTAT_DEVICE_END; s->cpa = VAR_0->channel_prog + 8; break; case -ENOSYS: s->ctrl &= ~SCSW_ACTL_START_PEND; s->dstat = SCSW_DSTAT_UNIT_CHECK; VAR_0->sense_data[0] = 0x80; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; s->cpa = VAR_0->channel_prog + 8; break; case -EFAULT: s->ctrl &= ~SCSW_ACTL_START_PEND; s->cstat = SCSW_CSTAT_DATA_CHECK; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; s->cpa = VAR_0->channel_prog + 8; break; case -EBUSY: s->flags &= ~SCSW_FLAGS_MASK_CC; s->flags |= (1 << 8); s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; break; case -EINPROGRESS: s->ctrl &= ~SCSW_ACTL_START_PEND; s->ctrl |= SCSW_ACTL_SUSP; break; default: s->ctrl &= ~SCSW_ACTL_START_PEND; s->cstat = SCSW_CSTAT_PROG_CHECK; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; s->cpa = VAR_0->channel_prog + 8; break; } } while (VAR_3 == -EAGAIN); }
[ "static void FUNC_0(SubchDev *VAR_0, ORB *VAR_1)\n{", "PMCW *p = &VAR_0->curr_status.pmcw;", "SCSW *s = &VAR_0->curr_status.scsw;", "int VAR_2;", "int VAR_3;", "VAR_2 = 0x80;", "if (!(s->ctrl & SCSW_ACTL_SUSP)) {", "assert(VAR_1 != NULL);", "p->intparm = VAR_1->intparm;", "if (!(VAR_1->lpm & VAR_2)) {", "s->flags |= SCSW_FLAGS_MASK_CC;", "s->ctrl &= ~SCSW_CTRL_MASK_STCTL;", "s->ctrl |= (SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND);", "return;", "}", "VAR_0->ccw_fmt_1 = !!(VAR_1->ctrl0 & ORB_CTRL0_MASK_FMT);", "VAR_0->ccw_no_data_cnt = 0;", "} else {", "s->ctrl &= ~(SCSW_ACTL_SUSP | SCSW_ACTL_RESUME_PEND);", "}", "VAR_0->last_cmd_valid = false;", "do {", "VAR_3 = css_interpret_ccw(VAR_0, VAR_0->channel_prog);", "switch (VAR_3) {", "case -EAGAIN:\nbreak;", "case 0:\ns->ctrl &= ~SCSW_ACTL_START_PEND;", "s->ctrl &= ~SCSW_CTRL_MASK_STCTL;", "s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY |\nSCSW_STCTL_STATUS_PEND;", "s->dstat = SCSW_DSTAT_CHANNEL_END | SCSW_DSTAT_DEVICE_END;", "s->cpa = VAR_0->channel_prog + 8;", "break;", "case -ENOSYS:\ns->ctrl &= ~SCSW_ACTL_START_PEND;", "s->dstat = SCSW_DSTAT_UNIT_CHECK;", "VAR_0->sense_data[0] = 0x80;", "s->ctrl &= ~SCSW_CTRL_MASK_STCTL;", "s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY |\nSCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;", "s->cpa = VAR_0->channel_prog + 8;", "break;", "case -EFAULT:\ns->ctrl &= ~SCSW_ACTL_START_PEND;", "s->cstat = SCSW_CSTAT_DATA_CHECK;", "s->ctrl &= ~SCSW_CTRL_MASK_STCTL;", "s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY |\nSCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;", "s->cpa = VAR_0->channel_prog + 8;", "break;", "case -EBUSY:\ns->flags &= ~SCSW_FLAGS_MASK_CC;", "s->flags |= (1 << 8);", "s->ctrl &= ~SCSW_CTRL_MASK_STCTL;", "s->ctrl |= SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;", "break;", "case -EINPROGRESS:\ns->ctrl &= ~SCSW_ACTL_START_PEND;", "s->ctrl |= SCSW_ACTL_SUSP;", "break;", "default:\ns->ctrl &= ~SCSW_ACTL_START_PEND;", "s->cstat = SCSW_CSTAT_PROG_CHECK;", "s->ctrl &= ~SCSW_CTRL_MASK_STCTL;", "s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY |\nSCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;", "s->cpa = VAR_0->channel_prog + 8;", "break;", "}", "} while (VAR_3 == -EAGAIN);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 69 ], [ 71, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111, 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 147 ], [ 149 ], [ 151 ], [ 153, 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ] ]
779
static int net_vhost_chardev_opts(void *opaque, const char *name, const char *value, Error **errp) { VhostUserChardevProps *props = opaque; if (strcmp(name, "backend") == 0 && strcmp(value, "socket") == 0) { props->is_socket = true; } else if (strcmp(name, "path") == 0) { props->is_unix = true; } else if (strcmp(name, "server") == 0) { } else { error_setg(errp, "vhost-user does not support a chardev with option %s=%s", name, value); return -1; } return 0; }
true
qemu
0a73336d96397c80881219d080518fac6f1ecacb
static int net_vhost_chardev_opts(void *opaque, const char *name, const char *value, Error **errp) { VhostUserChardevProps *props = opaque; if (strcmp(name, "backend") == 0 && strcmp(value, "socket") == 0) { props->is_socket = true; } else if (strcmp(name, "path") == 0) { props->is_unix = true; } else if (strcmp(name, "server") == 0) { } else { error_setg(errp, "vhost-user does not support a chardev with option %s=%s", name, value); return -1; } return 0; }
{ "code": [ " props->is_socket = true;", " } else {", " error_setg(errp,", " name, value);", " return -1;", "static int net_vhost_chardev_opts(void *opaque,", " const char *name, const char *value,", " Error **errp)", " VhostUserChardevProps *props = opaque;", " if (strcmp(name, \"backend\") == 0 && strcmp(value, \"socket\") == 0) {", " props->is_socket = true;", " } else if (strcmp(name, \"path\") == 0) {", " props->is_unix = true;", " } else if (strcmp(name, \"server\") == 0) {", " } else {", " error_setg(errp,", " \"vhost-user does not support a chardev with option %s=%s\",", " name, value);", " return -1;", " return 0;" ], "line_no": [ 15, 23, 25, 29, 31, 1, 3, 5, 9, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 35 ] }
static int FUNC_0(void *VAR_0, const char *VAR_1, const char *VAR_2, Error **VAR_3) { VhostUserChardevProps *props = VAR_0; if (strcmp(VAR_1, "backend") == 0 && strcmp(VAR_2, "socket") == 0) { props->is_socket = true; } else if (strcmp(VAR_1, "path") == 0) { props->is_unix = true; } else if (strcmp(VAR_1, "server") == 0) { } else { error_setg(VAR_3, "vhost-user does not support a chardev with option %s=%s", VAR_1, VAR_2); return -1; } return 0; }
[ "static int FUNC_0(void *VAR_0,\nconst char *VAR_1, const char *VAR_2,\nError **VAR_3)\n{", "VhostUserChardevProps *props = VAR_0;", "if (strcmp(VAR_1, \"backend\") == 0 && strcmp(VAR_2, \"socket\") == 0) {", "props->is_socket = true;", "} else if (strcmp(VAR_1, \"path\") == 0) {", "props->is_unix = true;", "} else if (strcmp(VAR_1, \"server\") == 0) {", "} else {", "error_setg(VAR_3,\n\"vhost-user does not support a chardev with option %s=%s\",\nVAR_1, VAR_2);", "return -1;", "}", "return 0;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
780
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; const uint8_t *buf_end = avpkt->data + avpkt->size; int buf_size = avpkt->size; DPXContext *const s = avctx->priv_data; AVFrame *picture = data; AVFrame *const p = &s->picture; uint8_t *ptr; int magic_num, offset, endian; int x, y; int w, h, stride, bits_per_color, descriptor, elements, target_packet_size, source_packet_size; unsigned int rgbBuffer; magic_num = AV_RB32(buf); buf += 4; /* Check if the files "magic number" is "SDPX" which means it uses * big-endian or XPDS which is for little-endian files */ if (magic_num == AV_RL32("SDPX")) { endian = 0; } else if (magic_num == AV_RB32("SDPX")) { endian = 1; } else { av_log(avctx, AV_LOG_ERROR, "DPX marker not found\n"); offset = read32(&buf, endian); // Need to end in 0x304 offset from start of file buf = avpkt->data + 0x304; w = read32(&buf, endian); h = read32(&buf, endian); // Need to end in 0x320 to read the descriptor buf += 20; descriptor = buf[0]; // Need to end in 0x323 to read the bits per color buf += 3; avctx->bits_per_raw_sample = bits_per_color = buf[0]; switch (descriptor) { case 51: // RGBA elements = 4; break; case 50: // RGB elements = 3; break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported descriptor %d\n", descriptor); switch (bits_per_color) { case 8: if (elements == 4) { avctx->pix_fmt = PIX_FMT_RGBA; } else { avctx->pix_fmt = PIX_FMT_RGB24; source_packet_size = elements; target_packet_size = elements; break; case 10: avctx->pix_fmt = PIX_FMT_RGB48; target_packet_size = 6; source_packet_size = elements * 2; break; case 12: case 16: if (endian) { avctx->pix_fmt = PIX_FMT_RGB48BE; } else { avctx->pix_fmt = PIX_FMT_RGB48LE; target_packet_size = 6; source_packet_size = elements * 2; break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported color depth : %d\n", bits_per_color); if (s->picture.data[0]) avctx->release_buffer(avctx, &s->picture); if (av_image_check_size(w, h, 0, avctx)) if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); if (avctx->get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); // Move pointer to offset from start of file buf = avpkt->data + offset; ptr = p->data[0]; stride = p->linesize[0]; switch (bits_per_color) { case 10: for (x = 0; x < avctx->height; x++) { uint16_t *dst = (uint16_t*)ptr; for (y = 0; y < avctx->width; y++) { rgbBuffer = read32(&buf, endian); // Read out the 10-bit colors and convert to 16-bit *dst++ = make_16bit(rgbBuffer >> 16); *dst++ = make_16bit(rgbBuffer >> 6); *dst++ = make_16bit(rgbBuffer << 4); ptr += stride; break; case 8: case 12: // Treat 12-bit as 16-bit case 16: if (source_packet_size == target_packet_size) { for (x = 0; x < avctx->height; x++) { memcpy(ptr, buf, target_packet_size*avctx->width); ptr += stride; buf += source_packet_size*avctx->width; } else { for (x = 0; x < avctx->height; x++) { uint8_t *dst = ptr; for (y = 0; y < avctx->width; y++) { memcpy(dst, buf, target_packet_size); dst += target_packet_size; buf += source_packet_size; ptr += stride; break; *picture = s->picture; *data_size = sizeof(AVPicture); return buf_size;
true
FFmpeg
fea714ecd9de557054b2540119f6b5635ba0e636
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; const uint8_t *buf_end = avpkt->data + avpkt->size; int buf_size = avpkt->size; DPXContext *const s = avctx->priv_data; AVFrame *picture = data; AVFrame *const p = &s->picture; uint8_t *ptr; int magic_num, offset, endian; int x, y; int w, h, stride, bits_per_color, descriptor, elements, target_packet_size, source_packet_size; unsigned int rgbBuffer; magic_num = AV_RB32(buf); buf += 4; if (magic_num == AV_RL32("SDPX")) { endian = 0; } else if (magic_num == AV_RB32("SDPX")) { endian = 1; } else { av_log(avctx, AV_LOG_ERROR, "DPX marker not found\n"); offset = read32(&buf, endian); buf = avpkt->data + 0x304; w = read32(&buf, endian); h = read32(&buf, endian); buf += 20; descriptor = buf[0]; buf += 3; avctx->bits_per_raw_sample = bits_per_color = buf[0]; switch (descriptor) { case 51: elements = 4; break; case 50: elements = 3; break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported descriptor %d\n", descriptor); switch (bits_per_color) { case 8: if (elements == 4) { avctx->pix_fmt = PIX_FMT_RGBA; } else { avctx->pix_fmt = PIX_FMT_RGB24; source_packet_size = elements; target_packet_size = elements; break; case 10: avctx->pix_fmt = PIX_FMT_RGB48; target_packet_size = 6; source_packet_size = elements * 2; break; case 12: case 16: if (endian) { avctx->pix_fmt = PIX_FMT_RGB48BE; } else { avctx->pix_fmt = PIX_FMT_RGB48LE; target_packet_size = 6; source_packet_size = elements * 2; break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported color depth : %d\n", bits_per_color); if (s->picture.data[0]) avctx->release_buffer(avctx, &s->picture); if (av_image_check_size(w, h, 0, avctx)) if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); if (avctx->get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); buf = avpkt->data + offset; ptr = p->data[0]; stride = p->linesize[0]; switch (bits_per_color) { case 10: for (x = 0; x < avctx->height; x++) { uint16_t *dst = (uint16_t*)ptr; for (y = 0; y < avctx->width; y++) { rgbBuffer = read32(&buf, endian); *dst++ = make_16bit(rgbBuffer >> 16); *dst++ = make_16bit(rgbBuffer >> 6); *dst++ = make_16bit(rgbBuffer << 4); ptr += stride; break; case 8: case 12: case 16: if (source_packet_size == target_packet_size) { for (x = 0; x < avctx->height; x++) { memcpy(ptr, buf, target_packet_size*avctx->width); ptr += stride; buf += source_packet_size*avctx->width; } else { for (x = 0; x < avctx->height; x++) { uint8_t *dst = ptr; for (y = 0; y < avctx->width; y++) { memcpy(dst, buf, target_packet_size); dst += target_packet_size; buf += source_packet_size; ptr += stride; break; *picture = s->picture; *data_size = sizeof(AVPicture); return buf_size;
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; const uint8_t *VAR_5 = VAR_3->VAR_1 + VAR_3->size; int VAR_6 = VAR_3->size; DPXContext *const s = VAR_0->priv_data; AVFrame *picture = VAR_1; AVFrame *const p = &s->picture; uint8_t *ptr; int VAR_7, VAR_8, VAR_9; int VAR_10, VAR_11; int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19; unsigned int VAR_20; VAR_7 = AV_RB32(VAR_4); VAR_4 += 4; if (VAR_7 == AV_RL32("SDPX")) { VAR_9 = 0; } else if (VAR_7 == AV_RB32("SDPX")) { VAR_9 = 1; } else { av_log(VAR_0, AV_LOG_ERROR, "DPX marker not found\n"); VAR_8 = read32(&VAR_4, VAR_9); VAR_4 = VAR_3->VAR_1 + 0x304; VAR_12 = read32(&VAR_4, VAR_9); VAR_13 = read32(&VAR_4, VAR_9); VAR_4 += 20; VAR_16 = VAR_4[0]; VAR_4 += 3; VAR_0->bits_per_raw_sample = VAR_15 = VAR_4[0]; switch (VAR_16) { case 51: VAR_17 = 4; break; case 50: VAR_17 = 3; break; default: av_log(VAR_0, AV_LOG_ERROR, "Unsupported VAR_16 %d\n", VAR_16); switch (VAR_15) { case 8: if (VAR_17 == 4) { VAR_0->pix_fmt = PIX_FMT_RGBA; } else { VAR_0->pix_fmt = PIX_FMT_RGB24; VAR_19 = VAR_17; VAR_18 = VAR_17; break; case 10: VAR_0->pix_fmt = PIX_FMT_RGB48; VAR_18 = 6; VAR_19 = VAR_17 * 2; break; case 12: case 16: if (VAR_9) { VAR_0->pix_fmt = PIX_FMT_RGB48BE; } else { VAR_0->pix_fmt = PIX_FMT_RGB48LE; VAR_18 = 6; VAR_19 = VAR_17 * 2; break; default: av_log(VAR_0, AV_LOG_ERROR, "Unsupported color depth : %d\n", VAR_15); if (s->picture.VAR_1[0]) VAR_0->release_buffer(VAR_0, &s->picture); if (av_image_check_size(VAR_12, VAR_13, 0, VAR_0)) if (VAR_12 != VAR_0->width || VAR_13 != VAR_0->height) avcodec_set_dimensions(VAR_0, VAR_12, VAR_13); if (VAR_0->get_buffer(VAR_0, p) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); VAR_4 = VAR_3->VAR_1 + VAR_8; ptr = p->VAR_1[0]; VAR_14 = p->linesize[0]; switch (VAR_15) { case 10: for (VAR_10 = 0; VAR_10 < VAR_0->height; VAR_10++) { uint16_t *dst = (uint16_t*)ptr; for (VAR_11 = 0; VAR_11 < VAR_0->width; VAR_11++) { VAR_20 = read32(&VAR_4, VAR_9); *dst++ = make_16bit(VAR_20 >> 16); *dst++ = make_16bit(VAR_20 >> 6); *dst++ = make_16bit(VAR_20 << 4); ptr += VAR_14; break; case 8: case 12: case 16: if (VAR_19 == VAR_18) { for (VAR_10 = 0; VAR_10 < VAR_0->height; VAR_10++) { memcpy(ptr, VAR_4, VAR_18*VAR_0->width); ptr += VAR_14; VAR_4 += VAR_19*VAR_0->width; } else { for (VAR_10 = 0; VAR_10 < VAR_0->height; VAR_10++) { uint8_t *dst = ptr; for (VAR_11 = 0; VAR_11 < VAR_0->width; VAR_11++) { memcpy(dst, VAR_4, VAR_18); dst += VAR_18; VAR_4 += VAR_19; ptr += VAR_14; break; *picture = s->picture; *VAR_2 = sizeof(AVPicture); return VAR_6;
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1,\nint *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "const uint8_t *VAR_5 = VAR_3->VAR_1 + VAR_3->size;", "int VAR_6 = VAR_3->size;", "DPXContext *const s = VAR_0->priv_data;", "AVFrame *picture = VAR_1;", "AVFrame *const p = &s->picture;", "uint8_t *ptr;", "int VAR_7, VAR_8, VAR_9;", "int VAR_10, VAR_11;", "int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19;", "unsigned int VAR_20;", "VAR_7 = AV_RB32(VAR_4);", "VAR_4 += 4;", "if (VAR_7 == AV_RL32(\"SDPX\")) {", "VAR_9 = 0;", "} else if (VAR_7 == AV_RB32(\"SDPX\")) {", "VAR_9 = 1;", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"DPX marker not found\\n\");", "VAR_8 = read32(&VAR_4, VAR_9);", "VAR_4 = VAR_3->VAR_1 + 0x304;", "VAR_12 = read32(&VAR_4, VAR_9);", "VAR_13 = read32(&VAR_4, VAR_9);", "VAR_4 += 20;", "VAR_16 = VAR_4[0];", "VAR_4 += 3;", "VAR_0->bits_per_raw_sample =\nVAR_15 = VAR_4[0];", "switch (VAR_16) {", "case 51:\nVAR_17 = 4;", "break;", "case 50:\nVAR_17 = 3;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unsupported VAR_16 %d\\n\", VAR_16);", "switch (VAR_15) {", "case 8:\nif (VAR_17 == 4) {", "VAR_0->pix_fmt = PIX_FMT_RGBA;", "} else {", "VAR_0->pix_fmt = PIX_FMT_RGB24;", "VAR_19 = VAR_17;", "VAR_18 = VAR_17;", "break;", "case 10:\nVAR_0->pix_fmt = PIX_FMT_RGB48;", "VAR_18 = 6;", "VAR_19 = VAR_17 * 2;", "break;", "case 12:\ncase 16:\nif (VAR_9) {", "VAR_0->pix_fmt = PIX_FMT_RGB48BE;", "} else {", "VAR_0->pix_fmt = PIX_FMT_RGB48LE;", "VAR_18 = 6;", "VAR_19 = VAR_17 * 2;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unsupported color depth : %d\\n\", VAR_15);", "if (s->picture.VAR_1[0])\nVAR_0->release_buffer(VAR_0, &s->picture);", "if (av_image_check_size(VAR_12, VAR_13, 0, VAR_0))\nif (VAR_12 != VAR_0->width || VAR_13 != VAR_0->height)\navcodec_set_dimensions(VAR_0, VAR_12, VAR_13);", "if (VAR_0->get_buffer(VAR_0, p) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "VAR_4 = VAR_3->VAR_1 + VAR_8;", "ptr = p->VAR_1[0];", "VAR_14 = p->linesize[0];", "switch (VAR_15) {", "case 10:\nfor (VAR_10 = 0; VAR_10 < VAR_0->height; VAR_10++) {", "uint16_t *dst = (uint16_t*)ptr;", "for (VAR_11 = 0; VAR_11 < VAR_0->width; VAR_11++) {", "VAR_20 = read32(&VAR_4, VAR_9);", "*dst++ = make_16bit(VAR_20 >> 16);", "*dst++ = make_16bit(VAR_20 >> 6);", "*dst++ = make_16bit(VAR_20 << 4);", "ptr += VAR_14;", "break;", "case 8:\ncase 12:\ncase 16:\nif (VAR_19 == VAR_18) {", "for (VAR_10 = 0; VAR_10 < VAR_0->height; VAR_10++) {", "memcpy(ptr, VAR_4, VAR_18*VAR_0->width);", "ptr += VAR_14;", "VAR_4 += VAR_19*VAR_0->width;", "} else {", "for (VAR_10 = 0; VAR_10 < VAR_0->height; VAR_10++) {", "uint8_t *dst = ptr;", "for (VAR_11 = 0; VAR_11 < VAR_0->width; VAR_11++) {", "memcpy(dst, VAR_4, VAR_18);", "dst += VAR_18;", "VAR_4 += VAR_19;", "ptr += VAR_14;", "break;", "*picture = s->picture;", "*VAR_2 = sizeof(AVPicture);", "return VAR_6;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 79 ], [ 81 ], [ 87 ], [ 89, 91 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109, 111 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 130 ], [ 132 ], [ 134 ], [ 136, 138 ], [ 140 ], [ 142 ], [ 144 ], [ 146, 148, 150 ], [ 152 ], [ 154 ], [ 156 ], [ 159 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 173, 175 ], [ 177, 180, 182 ], [ 184 ], [ 186 ], [ 194 ], [ 198 ], [ 200 ], [ 204 ], [ 206, 208 ], [ 210 ], [ 212 ], [ 214 ], [ 218 ], [ 220 ], [ 222 ], [ 225 ], [ 228 ], [ 230, 232, 234, 240 ], [ 242 ], [ 244 ], [ 246 ], [ 248 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 266 ], [ 270 ], [ 275 ], [ 277 ], [ 281 ] ]
783
static int mpeg_decode_mb(MpegEncContext *s, DCTELEM block[12][64]) { int i, j, k, cbp, val, mb_type, motion_type; const int mb_block_count = 4 + (1<< s->chroma_format) dprintf("decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y); assert(s->mb_skiped==0); if (s->mb_skip_run-- != 0) { if(s->pict_type == I_TYPE){ av_log(s->avctx, AV_LOG_ERROR, "skiped MB in I frame at %d %d\n", s->mb_x, s->mb_y); return -1; } /* skip mb */ s->mb_intra = 0; for(i=0;i<12;i++) s->block_last_index[i] = -1; if(s->picture_structure == PICT_FRAME) s->mv_type = MV_TYPE_16X16; else s->mv_type = MV_TYPE_FIELD; if (s->pict_type == P_TYPE) { /* if P type, zero motion vector is implied */ s->mv_dir = MV_DIR_FORWARD; s->mv[0][0][0] = s->mv[0][0][1] = 0; s->last_mv[0][0][0] = s->last_mv[0][0][1] = 0; s->last_mv[0][1][0] = s->last_mv[0][1][1] = 0; s->field_select[0][0]= s->picture_structure - 1; s->mb_skiped = 1; s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16; } else { /* if B type, reuse previous vectors and directions */ s->mv[0][0][0] = s->last_mv[0][0][0]; s->mv[0][0][1] = s->last_mv[0][0][1]; s->mv[1][0][0] = s->last_mv[1][0][0]; s->mv[1][0][1] = s->last_mv[1][0][1]; s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1] | MB_TYPE_SKIP; // assert(s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1]&(MB_TYPE_16x16|MB_TYPE_16x8)); if((s->mv[0][0][0]|s->mv[0][0][1]|s->mv[1][0][0]|s->mv[1][0][1])==0) s->mb_skiped = 1; } return 0; } switch(s->pict_type) { default: case I_TYPE: if (get_bits1(&s->gb) == 0) { if (get_bits1(&s->gb) == 0){ av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in I Frame at %d %d\n", s->mb_x, s->mb_y); return -1; } mb_type = MB_TYPE_QUANT | MB_TYPE_INTRA; } else { mb_type = MB_TYPE_INTRA; } break; case P_TYPE: mb_type = get_vlc2(&s->gb, mb_ptype_vlc.table, MB_PTYPE_VLC_BITS, 1); if (mb_type < 0){ av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in P Frame at %d %d\n", s->mb_x, s->mb_y); return -1; } mb_type = ptype2mb_type[ mb_type ]; break; case B_TYPE: mb_type = get_vlc2(&s->gb, mb_btype_vlc.table, MB_BTYPE_VLC_BITS, 1); if (mb_type < 0){ av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in B Frame at %d %d\n", s->mb_x, s->mb_y); return -1; } mb_type = btype2mb_type[ mb_type ]; break; } dprintf("mb_type=%x\n", mb_type); // motion_type = 0; /* avoid warning */ if (IS_INTRA(mb_type)) { /* compute dct type */ if (s->picture_structure == PICT_FRAME && //FIXME add a interlaced_dct coded var? !s->frame_pred_frame_dct) { s->interlaced_dct = get_bits1(&s->gb); } if (IS_QUANT(mb_type)) s->qscale = get_qscale(s); if (s->concealment_motion_vectors) { /* just parse them */ if (s->picture_structure != PICT_FRAME) skip_bits1(&s->gb); /* field select */ s->mv[0][0][0]= s->last_mv[0][0][0]= s->last_mv[0][1][0] = mpeg_decode_motion(s, s->mpeg_f_code[0][0], s->last_mv[0][0][0]); s->mv[0][0][1]= s->last_mv[0][0][1]= s->last_mv[0][1][1] = mpeg_decode_motion(s, s->mpeg_f_code[0][1], s->last_mv[0][0][1]); skip_bits1(&s->gb); /* marker */ }else memset(s->last_mv, 0, sizeof(s->last_mv)); /* reset mv prediction */ s->mb_intra = 1; #ifdef HAVE_XVMC //one 1 we memcpy blocks in xvmcvideo if(s->avctx->xvmc_acceleration > 1){ XVMC_pack_pblocks(s,-1);//inter are always full blocks if(s->swap_uv){ exchange_uv(s); } } #endif if (s->codec_id == CODEC_ID_MPEG2VIDEO) { for(i=0;i<mb_block_count;i++) { if (mpeg2_decode_block_intra(s, s->pblocks[i], i) < 0) return -1; } } else { for(i=0;i<6;i++) { if (mpeg1_decode_block_intra(s, s->pblocks[i], i) < 0) return -1; } } } else { if (mb_type & MB_TYPE_ZERO_MV){ assert(mb_type & MB_TYPE_CBP); /* compute dct type */ if (s->picture_structure == PICT_FRAME && //FIXME add a interlaced_dct coded var? !s->frame_pred_frame_dct) { s->interlaced_dct = get_bits1(&s->gb); } if (IS_QUANT(mb_type)) s->qscale = get_qscale(s); s->mv_dir = MV_DIR_FORWARD; if(s->picture_structure == PICT_FRAME) s->mv_type = MV_TYPE_16X16; else{ s->mv_type = MV_TYPE_FIELD; mb_type |= MB_TYPE_INTERLACED; s->field_select[0][0]= s->picture_structure - 1; } s->last_mv[0][0][0] = 0; s->last_mv[0][0][1] = 0; s->last_mv[0][1][0] = 0; s->last_mv[0][1][1] = 0; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; }else{ assert(mb_type & MB_TYPE_L0L1); //FIXME decide if MBs in field pictures are MB_TYPE_INTERLACED /* get additionnal motion vector type */ if (s->frame_pred_frame_dct) motion_type = MT_FRAME; else{ motion_type = get_bits(&s->gb, 2); } /* compute dct type */ if (s->picture_structure == PICT_FRAME && //FIXME add a interlaced_dct coded var? !s->frame_pred_frame_dct && HAS_CBP(mb_type)) { s->interlaced_dct = get_bits1(&s->gb); } if (IS_QUANT(mb_type)) s->qscale = get_qscale(s); /* motion vectors */ s->mv_dir = 0; for(i=0;i<2;i++) { if (USES_LIST(mb_type, i)) { s->mv_dir |= (MV_DIR_FORWARD >> i); dprintf("motion_type=%d\n", motion_type); switch(motion_type) { case MT_FRAME: /* or MT_16X8 */ if (s->picture_structure == PICT_FRAME) { /* MT_FRAME */ mb_type |= MB_TYPE_16x16; s->mv_type = MV_TYPE_16X16; s->mv[i][0][0]= s->last_mv[i][0][0]= s->last_mv[i][1][0] = mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][0][0]); s->mv[i][0][1]= s->last_mv[i][0][1]= s->last_mv[i][1][1] = mpeg_decode_motion(s, s->mpeg_f_code[i][1], s->last_mv[i][0][1]); /* full_pel: only for mpeg1 */ if (s->full_pel[i]){ s->mv[i][0][0] <<= 1; s->mv[i][0][1] <<= 1; } } else { /* MT_16X8 */ mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; s->mv_type = MV_TYPE_16X8; for(j=0;j<2;j++) { s->field_select[i][j] = get_bits1(&s->gb); for(k=0;k<2;k++) { val = mpeg_decode_motion(s, s->mpeg_f_code[i][k], s->last_mv[i][j][k]); s->last_mv[i][j][k] = val; s->mv[i][j][k] = val; } } } break; case MT_FIELD: s->mv_type = MV_TYPE_FIELD; if (s->picture_structure == PICT_FRAME) { mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; for(j=0;j<2;j++) { s->field_select[i][j] = get_bits1(&s->gb); val = mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][j][0]); s->last_mv[i][j][0] = val; s->mv[i][j][0] = val; dprintf("fmx=%d\n", val); val = mpeg_decode_motion(s, s->mpeg_f_code[i][1], s->last_mv[i][j][1] >> 1); s->last_mv[i][j][1] = val << 1; s->mv[i][j][1] = val; dprintf("fmy=%d\n", val); } } else { mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED; s->field_select[i][0] = get_bits1(&s->gb); for(k=0;k<2;k++) { val = mpeg_decode_motion(s, s->mpeg_f_code[i][k], s->last_mv[i][0][k]); s->last_mv[i][0][k] = val; s->last_mv[i][1][k] = val; s->mv[i][0][k] = val; } } break; case MT_DMV: { int dmx, dmy, mx, my, m; mx = mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][0][0]); s->last_mv[i][0][0] = mx; s->last_mv[i][1][0] = mx; dmx = get_dmv(s); my = mpeg_decode_motion(s, s->mpeg_f_code[i][1], s->last_mv[i][0][1] >> 1); dmy = get_dmv(s); s->mv_type = MV_TYPE_DMV; s->last_mv[i][0][1] = my<<1; s->last_mv[i][1][1] = my<<1; s->mv[i][0][0] = mx; s->mv[i][0][1] = my; s->mv[i][1][0] = mx;//not used s->mv[i][1][1] = my;//not used if (s->picture_structure == PICT_FRAME) { mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED; //m = 1 + 2 * s->top_field_first; m = s->top_field_first ? 1 : 3; /* top -> top pred */ s->mv[i][2][0] = ((mx * m + (mx > 0)) >> 1) + dmx; s->mv[i][2][1] = ((my * m + (my > 0)) >> 1) + dmy - 1; m = 4 - m; s->mv[i][3][0] = ((mx * m + (mx > 0)) >> 1) + dmx; s->mv[i][3][1] = ((my * m + (my > 0)) >> 1) + dmy + 1; } else { mb_type |= MB_TYPE_16x16; s->mv[i][2][0] = ((mx + (mx > 0)) >> 1) + dmx; s->mv[i][2][1] = ((my + (my > 0)) >> 1) + dmy; if(s->picture_structure == PICT_TOP_FIELD) s->mv[i][2][1]--; else s->mv[i][2][1]++; } } break; default: av_log(s->avctx, AV_LOG_ERROR, "00 motion_type at %d %d\n", s->mb_x, s->mb_y); return -1; } } } } s->mb_intra = 0; if (HAS_CBP(mb_type)) { cbp = get_vlc2(&s->gb, mb_pat_vlc.table, MB_PAT_VLC_BITS, 1); if (cbp < 0 || ((cbp == 0) && (s->chroma_format < 2)) ){ av_log(s->avctx, AV_LOG_ERROR, "invalid cbp at %d %d\n", s->mb_x, s->mb_y); return -1; } if(mb_block_count > 6){ cbp<<= mb_block_count-6; cbp |= get_bits(&s->gb, mb_block_count-6); } #ifdef HAVE_XVMC //on 1 we memcpy blocks in xvmcvideo if(s->avctx->xvmc_acceleration > 1){ XVMC_pack_pblocks(s,cbp); if(s->swap_uv){ exchange_uv(s); } } #endif if (s->codec_id == CODEC_ID_MPEG2VIDEO) { if(s->flags2 & CODEC_FLAG2_FAST){ for(i=0;i<6;i++) { if(cbp & 32) { mpeg2_fast_decode_block_non_intra(s, s->pblocks[i], i); } else { s->block_last_index[i] = -1; } cbp+=cbp; } }else{ cbp<<= 12-mb_block_count; for(i=0;i<mb_block_count;i++) { if ( cbp & (1<<11) ) { if (mpeg2_decode_block_non_intra(s, s->pblocks[i], i) < 0) return -1; } else { s->block_last_index[i] = -1; } cbp+=cbp; } } } else { if(s->flags2 & CODEC_FLAG2_FAST){ for(i=0;i<6;i++) { if (cbp & 32) { mpeg1_fast_decode_block_inter(s, s->pblocks[i], i); } else { s->block_last_index[i] = -1; } cbp+=cbp; } }else{ for(i=0;i<6;i++) { if (cbp & 32) { if (mpeg1_decode_block_inter(s, s->pblocks[i], i) < 0) return -1; } else { s->block_last_index[i] = -1; } cbp+=cbp; } } } }else{ for(i=0;i<6;i++) s->block_last_index[i] = -1; } } s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= mb_type; return 0; }
true
FFmpeg
71434945f20c6d340b4c942de7746e6ea46ec74b
static int mpeg_decode_mb(MpegEncContext *s, DCTELEM block[12][64]) { int i, j, k, cbp, val, mb_type, motion_type; const int mb_block_count = 4 + (1<< s->chroma_format) dprintf("decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y); assert(s->mb_skiped==0); if (s->mb_skip_run-- != 0) { if(s->pict_type == I_TYPE){ av_log(s->avctx, AV_LOG_ERROR, "skiped MB in I frame at %d %d\n", s->mb_x, s->mb_y); return -1; } s->mb_intra = 0; for(i=0;i<12;i++) s->block_last_index[i] = -1; if(s->picture_structure == PICT_FRAME) s->mv_type = MV_TYPE_16X16; else s->mv_type = MV_TYPE_FIELD; if (s->pict_type == P_TYPE) { s->mv_dir = MV_DIR_FORWARD; s->mv[0][0][0] = s->mv[0][0][1] = 0; s->last_mv[0][0][0] = s->last_mv[0][0][1] = 0; s->last_mv[0][1][0] = s->last_mv[0][1][1] = 0; s->field_select[0][0]= s->picture_structure - 1; s->mb_skiped = 1; s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16; } else { s->mv[0][0][0] = s->last_mv[0][0][0]; s->mv[0][0][1] = s->last_mv[0][0][1]; s->mv[1][0][0] = s->last_mv[1][0][0]; s->mv[1][0][1] = s->last_mv[1][0][1]; s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1] | MB_TYPE_SKIP; if((s->mv[0][0][0]|s->mv[0][0][1]|s->mv[1][0][0]|s->mv[1][0][1])==0) s->mb_skiped = 1; } return 0; } switch(s->pict_type) { default: case I_TYPE: if (get_bits1(&s->gb) == 0) { if (get_bits1(&s->gb) == 0){ av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in I Frame at %d %d\n", s->mb_x, s->mb_y); return -1; } mb_type = MB_TYPE_QUANT | MB_TYPE_INTRA; } else { mb_type = MB_TYPE_INTRA; } break; case P_TYPE: mb_type = get_vlc2(&s->gb, mb_ptype_vlc.table, MB_PTYPE_VLC_BITS, 1); if (mb_type < 0){ av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in P Frame at %d %d\n", s->mb_x, s->mb_y); return -1; } mb_type = ptype2mb_type[ mb_type ]; break; case B_TYPE: mb_type = get_vlc2(&s->gb, mb_btype_vlc.table, MB_BTYPE_VLC_BITS, 1); if (mb_type < 0){ av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in B Frame at %d %d\n", s->mb_x, s->mb_y); return -1; } mb_type = btype2mb_type[ mb_type ]; break; } dprintf("mb_type=%x\n", mb_type); if (IS_INTRA(mb_type)) { if (s->picture_structure == PICT_FRAME && !s->frame_pred_frame_dct) { s->interlaced_dct = get_bits1(&s->gb); } if (IS_QUANT(mb_type)) s->qscale = get_qscale(s); if (s->concealment_motion_vectors) { if (s->picture_structure != PICT_FRAME) skip_bits1(&s->gb); s->mv[0][0][0]= s->last_mv[0][0][0]= s->last_mv[0][1][0] = mpeg_decode_motion(s, s->mpeg_f_code[0][0], s->last_mv[0][0][0]); s->mv[0][0][1]= s->last_mv[0][0][1]= s->last_mv[0][1][1] = mpeg_decode_motion(s, s->mpeg_f_code[0][1], s->last_mv[0][0][1]); skip_bits1(&s->gb); }else memset(s->last_mv, 0, sizeof(s->last_mv)); s->mb_intra = 1; #ifdef HAVE_XVMC if(s->avctx->xvmc_acceleration > 1){ XVMC_pack_pblocks(s,-1); if(s->swap_uv){ exchange_uv(s); } } #endif if (s->codec_id == CODEC_ID_MPEG2VIDEO) { for(i=0;i<mb_block_count;i++) { if (mpeg2_decode_block_intra(s, s->pblocks[i], i) < 0) return -1; } } else { for(i=0;i<6;i++) { if (mpeg1_decode_block_intra(s, s->pblocks[i], i) < 0) return -1; } } } else { if (mb_type & MB_TYPE_ZERO_MV){ assert(mb_type & MB_TYPE_CBP); if (s->picture_structure == PICT_FRAME && !s->frame_pred_frame_dct) { s->interlaced_dct = get_bits1(&s->gb); } if (IS_QUANT(mb_type)) s->qscale = get_qscale(s); s->mv_dir = MV_DIR_FORWARD; if(s->picture_structure == PICT_FRAME) s->mv_type = MV_TYPE_16X16; else{ s->mv_type = MV_TYPE_FIELD; mb_type |= MB_TYPE_INTERLACED; s->field_select[0][0]= s->picture_structure - 1; } s->last_mv[0][0][0] = 0; s->last_mv[0][0][1] = 0; s->last_mv[0][1][0] = 0; s->last_mv[0][1][1] = 0; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; }else{ assert(mb_type & MB_TYPE_L0L1); if (s->frame_pred_frame_dct) motion_type = MT_FRAME; else{ motion_type = get_bits(&s->gb, 2); } if (s->picture_structure == PICT_FRAME && !s->frame_pred_frame_dct && HAS_CBP(mb_type)) { s->interlaced_dct = get_bits1(&s->gb); } if (IS_QUANT(mb_type)) s->qscale = get_qscale(s); s->mv_dir = 0; for(i=0;i<2;i++) { if (USES_LIST(mb_type, i)) { s->mv_dir |= (MV_DIR_FORWARD >> i); dprintf("motion_type=%d\n", motion_type); switch(motion_type) { case MT_FRAME: if (s->picture_structure == PICT_FRAME) { mb_type |= MB_TYPE_16x16; s->mv_type = MV_TYPE_16X16; s->mv[i][0][0]= s->last_mv[i][0][0]= s->last_mv[i][1][0] = mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][0][0]); s->mv[i][0][1]= s->last_mv[i][0][1]= s->last_mv[i][1][1] = mpeg_decode_motion(s, s->mpeg_f_code[i][1], s->last_mv[i][0][1]); if (s->full_pel[i]){ s->mv[i][0][0] <<= 1; s->mv[i][0][1] <<= 1; } } else { mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; s->mv_type = MV_TYPE_16X8; for(j=0;j<2;j++) { s->field_select[i][j] = get_bits1(&s->gb); for(k=0;k<2;k++) { val = mpeg_decode_motion(s, s->mpeg_f_code[i][k], s->last_mv[i][j][k]); s->last_mv[i][j][k] = val; s->mv[i][j][k] = val; } } } break; case MT_FIELD: s->mv_type = MV_TYPE_FIELD; if (s->picture_structure == PICT_FRAME) { mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; for(j=0;j<2;j++) { s->field_select[i][j] = get_bits1(&s->gb); val = mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][j][0]); s->last_mv[i][j][0] = val; s->mv[i][j][0] = val; dprintf("fmx=%d\n", val); val = mpeg_decode_motion(s, s->mpeg_f_code[i][1], s->last_mv[i][j][1] >> 1); s->last_mv[i][j][1] = val << 1; s->mv[i][j][1] = val; dprintf("fmy=%d\n", val); } } else { mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED; s->field_select[i][0] = get_bits1(&s->gb); for(k=0;k<2;k++) { val = mpeg_decode_motion(s, s->mpeg_f_code[i][k], s->last_mv[i][0][k]); s->last_mv[i][0][k] = val; s->last_mv[i][1][k] = val; s->mv[i][0][k] = val; } } break; case MT_DMV: { int dmx, dmy, mx, my, m; mx = mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][0][0]); s->last_mv[i][0][0] = mx; s->last_mv[i][1][0] = mx; dmx = get_dmv(s); my = mpeg_decode_motion(s, s->mpeg_f_code[i][1], s->last_mv[i][0][1] >> 1); dmy = get_dmv(s); s->mv_type = MV_TYPE_DMV; s->last_mv[i][0][1] = my<<1; s->last_mv[i][1][1] = my<<1; s->mv[i][0][0] = mx; s->mv[i][0][1] = my; s->mv[i][1][0] = mx; s->mv[i][1][1] = my; if (s->picture_structure == PICT_FRAME) { mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED; m = s->top_field_first ? 1 : 3; s->mv[i][2][0] = ((mx * m + (mx > 0)) >> 1) + dmx; s->mv[i][2][1] = ((my * m + (my > 0)) >> 1) + dmy - 1; m = 4 - m; s->mv[i][3][0] = ((mx * m + (mx > 0)) >> 1) + dmx; s->mv[i][3][1] = ((my * m + (my > 0)) >> 1) + dmy + 1; } else { mb_type |= MB_TYPE_16x16; s->mv[i][2][0] = ((mx + (mx > 0)) >> 1) + dmx; s->mv[i][2][1] = ((my + (my > 0)) >> 1) + dmy; if(s->picture_structure == PICT_TOP_FIELD) s->mv[i][2][1]--; else s->mv[i][2][1]++; } } break; default: av_log(s->avctx, AV_LOG_ERROR, "00 motion_type at %d %d\n", s->mb_x, s->mb_y); return -1; } } } } s->mb_intra = 0; if (HAS_CBP(mb_type)) { cbp = get_vlc2(&s->gb, mb_pat_vlc.table, MB_PAT_VLC_BITS, 1); if (cbp < 0 || ((cbp == 0) && (s->chroma_format < 2)) ){ av_log(s->avctx, AV_LOG_ERROR, "invalid cbp at %d %d\n", s->mb_x, s->mb_y); return -1; } if(mb_block_count > 6){ cbp<<= mb_block_count-6; cbp |= get_bits(&s->gb, mb_block_count-6); } #ifdef HAVE_XVMC if(s->avctx->xvmc_acceleration > 1){ XVMC_pack_pblocks(s,cbp); if(s->swap_uv){ exchange_uv(s); } } #endif if (s->codec_id == CODEC_ID_MPEG2VIDEO) { if(s->flags2 & CODEC_FLAG2_FAST){ for(i=0;i<6;i++) { if(cbp & 32) { mpeg2_fast_decode_block_non_intra(s, s->pblocks[i], i); } else { s->block_last_index[i] = -1; } cbp+=cbp; } }else{ cbp<<= 12-mb_block_count; for(i=0;i<mb_block_count;i++) { if ( cbp & (1<<11) ) { if (mpeg2_decode_block_non_intra(s, s->pblocks[i], i) < 0) return -1; } else { s->block_last_index[i] = -1; } cbp+=cbp; } } } else { if(s->flags2 & CODEC_FLAG2_FAST){ for(i=0;i<6;i++) { if (cbp & 32) { mpeg1_fast_decode_block_inter(s, s->pblocks[i], i); } else { s->block_last_index[i] = -1; } cbp+=cbp; } }else{ for(i=0;i<6;i++) { if (cbp & 32) { if (mpeg1_decode_block_inter(s, s->pblocks[i], i) < 0) return -1; } else { s->block_last_index[i] = -1; } cbp+=cbp; } } } }else{ for(i=0;i<6;i++) s->block_last_index[i] = -1; } } s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= mb_type; return 0; }
{ "code": [ " s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1] | MB_TYPE_SKIP;" ], "line_no": [ 83 ] }
static int FUNC_0(MpegEncContext *VAR_0, DCTELEM VAR_1[12][64]) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; const int VAR_9 = 4 + (1<< VAR_0->chroma_format) dprintf("decode_mb: x=%d y=%d\n", VAR_0->mb_x, VAR_0->mb_y); assert(VAR_0->mb_skiped==0); if (VAR_0->mb_skip_run-- != 0) { if(VAR_0->pict_type == I_TYPE){ av_log(VAR_0->avctx, AV_LOG_ERROR, "skiped MB in I frame at %d %d\n", VAR_0->mb_x, VAR_0->mb_y); return -1; } VAR_0->mb_intra = 0; for(VAR_2=0;VAR_2<12;VAR_2++) VAR_0->block_last_index[VAR_2] = -1; if(VAR_0->picture_structure == PICT_FRAME) VAR_0->mv_type = MV_TYPE_16X16; else VAR_0->mv_type = MV_TYPE_FIELD; if (VAR_0->pict_type == P_TYPE) { VAR_0->mv_dir = MV_DIR_FORWARD; VAR_0->mv[0][0][0] = VAR_0->mv[0][0][1] = 0; VAR_0->last_mv[0][0][0] = VAR_0->last_mv[0][0][1] = 0; VAR_0->last_mv[0][1][0] = VAR_0->last_mv[0][1][1] = 0; VAR_0->field_select[0][0]= VAR_0->picture_structure - 1; VAR_0->mb_skiped = 1; VAR_0->current_picture.VAR_7[ VAR_0->mb_x + VAR_0->mb_y*VAR_0->mb_stride ]= MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16; } else { VAR_0->mv[0][0][0] = VAR_0->last_mv[0][0][0]; VAR_0->mv[0][0][1] = VAR_0->last_mv[0][0][1]; VAR_0->mv[1][0][0] = VAR_0->last_mv[1][0][0]; VAR_0->mv[1][0][1] = VAR_0->last_mv[1][0][1]; VAR_0->current_picture.VAR_7[ VAR_0->mb_x + VAR_0->mb_y*VAR_0->mb_stride ]= VAR_0->current_picture.VAR_7[ VAR_0->mb_x + VAR_0->mb_y*VAR_0->mb_stride - 1] | MB_TYPE_SKIP; if((VAR_0->mv[0][0][0]|VAR_0->mv[0][0][1]|VAR_0->mv[1][0][0]|VAR_0->mv[1][0][1])==0) VAR_0->mb_skiped = 1; } return 0; } switch(VAR_0->pict_type) { default: case I_TYPE: if (get_bits1(&VAR_0->gb) == 0) { if (get_bits1(&VAR_0->gb) == 0){ av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid mb type in I Frame at %d %d\n", VAR_0->mb_x, VAR_0->mb_y); return -1; } VAR_7 = MB_TYPE_QUANT | MB_TYPE_INTRA; } else { VAR_7 = MB_TYPE_INTRA; } break; case P_TYPE: VAR_7 = get_vlc2(&VAR_0->gb, mb_ptype_vlc.table, MB_PTYPE_VLC_BITS, 1); if (VAR_7 < 0){ av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid mb type in P Frame at %d %d\n", VAR_0->mb_x, VAR_0->mb_y); return -1; } VAR_7 = ptype2mb_type[ VAR_7 ]; break; case B_TYPE: VAR_7 = get_vlc2(&VAR_0->gb, mb_btype_vlc.table, MB_BTYPE_VLC_BITS, 1); if (VAR_7 < 0){ av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid mb type in B Frame at %d %d\n", VAR_0->mb_x, VAR_0->mb_y); return -1; } VAR_7 = btype2mb_type[ VAR_7 ]; break; } dprintf("VAR_7=%x\n", VAR_7); if (IS_INTRA(VAR_7)) { if (VAR_0->picture_structure == PICT_FRAME && !VAR_0->frame_pred_frame_dct) { VAR_0->interlaced_dct = get_bits1(&VAR_0->gb); } if (IS_QUANT(VAR_7)) VAR_0->qscale = get_qscale(VAR_0); if (VAR_0->concealment_motion_vectors) { if (VAR_0->picture_structure != PICT_FRAME) skip_bits1(&VAR_0->gb); VAR_0->mv[0][0][0]= VAR_0->last_mv[0][0][0]= VAR_0->last_mv[0][1][0] = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[0][0], VAR_0->last_mv[0][0][0]); VAR_0->mv[0][0][1]= VAR_0->last_mv[0][0][1]= VAR_0->last_mv[0][1][1] = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[0][1], VAR_0->last_mv[0][0][1]); skip_bits1(&VAR_0->gb); }else memset(VAR_0->last_mv, 0, sizeof(VAR_0->last_mv)); VAR_0->mb_intra = 1; #ifdef HAVE_XVMC if(VAR_0->avctx->xvmc_acceleration > 1){ XVMC_pack_pblocks(VAR_0,-1); if(VAR_0->swap_uv){ exchange_uv(VAR_0); } } #endif if (VAR_0->codec_id == CODEC_ID_MPEG2VIDEO) { for(VAR_2=0;VAR_2<VAR_9;VAR_2++) { if (mpeg2_decode_block_intra(VAR_0, VAR_0->pblocks[VAR_2], VAR_2) < 0) return -1; } } else { for(VAR_2=0;VAR_2<6;VAR_2++) { if (mpeg1_decode_block_intra(VAR_0, VAR_0->pblocks[VAR_2], VAR_2) < 0) return -1; } } } else { if (VAR_7 & MB_TYPE_ZERO_MV){ assert(VAR_7 & MB_TYPE_CBP); if (VAR_0->picture_structure == PICT_FRAME && !VAR_0->frame_pred_frame_dct) { VAR_0->interlaced_dct = get_bits1(&VAR_0->gb); } if (IS_QUANT(VAR_7)) VAR_0->qscale = get_qscale(VAR_0); VAR_0->mv_dir = MV_DIR_FORWARD; if(VAR_0->picture_structure == PICT_FRAME) VAR_0->mv_type = MV_TYPE_16X16; else{ VAR_0->mv_type = MV_TYPE_FIELD; VAR_7 |= MB_TYPE_INTERLACED; VAR_0->field_select[0][0]= VAR_0->picture_structure - 1; } VAR_0->last_mv[0][0][0] = 0; VAR_0->last_mv[0][0][1] = 0; VAR_0->last_mv[0][1][0] = 0; VAR_0->last_mv[0][1][1] = 0; VAR_0->mv[0][0][0] = 0; VAR_0->mv[0][0][1] = 0; }else{ assert(VAR_7 & MB_TYPE_L0L1); if (VAR_0->frame_pred_frame_dct) VAR_8 = MT_FRAME; else{ VAR_8 = get_bits(&VAR_0->gb, 2); } if (VAR_0->picture_structure == PICT_FRAME && !VAR_0->frame_pred_frame_dct && HAS_CBP(VAR_7)) { VAR_0->interlaced_dct = get_bits1(&VAR_0->gb); } if (IS_QUANT(VAR_7)) VAR_0->qscale = get_qscale(VAR_0); VAR_0->mv_dir = 0; for(VAR_2=0;VAR_2<2;VAR_2++) { if (USES_LIST(VAR_7, VAR_2)) { VAR_0->mv_dir |= (MV_DIR_FORWARD >> VAR_2); dprintf("VAR_8=%d\n", VAR_8); switch(VAR_8) { case MT_FRAME: if (VAR_0->picture_structure == PICT_FRAME) { VAR_7 |= MB_TYPE_16x16; VAR_0->mv_type = MV_TYPE_16X16; VAR_0->mv[VAR_2][0][0]= VAR_0->last_mv[VAR_2][0][0]= VAR_0->last_mv[VAR_2][1][0] = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][0], VAR_0->last_mv[VAR_2][0][0]); VAR_0->mv[VAR_2][0][1]= VAR_0->last_mv[VAR_2][0][1]= VAR_0->last_mv[VAR_2][1][1] = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][1], VAR_0->last_mv[VAR_2][0][1]); if (VAR_0->full_pel[VAR_2]){ VAR_0->mv[VAR_2][0][0] <<= 1; VAR_0->mv[VAR_2][0][1] <<= 1; } } else { VAR_7 |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; VAR_0->mv_type = MV_TYPE_16X8; for(VAR_3=0;VAR_3<2;VAR_3++) { VAR_0->field_select[VAR_2][VAR_3] = get_bits1(&VAR_0->gb); for(VAR_4=0;VAR_4<2;VAR_4++) { VAR_6 = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][VAR_4], VAR_0->last_mv[VAR_2][VAR_3][VAR_4]); VAR_0->last_mv[VAR_2][VAR_3][VAR_4] = VAR_6; VAR_0->mv[VAR_2][VAR_3][VAR_4] = VAR_6; } } } break; case MT_FIELD: VAR_0->mv_type = MV_TYPE_FIELD; if (VAR_0->picture_structure == PICT_FRAME) { VAR_7 |= MB_TYPE_16x8 | MB_TYPE_INTERLACED; for(VAR_3=0;VAR_3<2;VAR_3++) { VAR_0->field_select[VAR_2][VAR_3] = get_bits1(&VAR_0->gb); VAR_6 = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][0], VAR_0->last_mv[VAR_2][VAR_3][0]); VAR_0->last_mv[VAR_2][VAR_3][0] = VAR_6; VAR_0->mv[VAR_2][VAR_3][0] = VAR_6; dprintf("fmx=%d\n", VAR_6); VAR_6 = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][1], VAR_0->last_mv[VAR_2][VAR_3][1] >> 1); VAR_0->last_mv[VAR_2][VAR_3][1] = VAR_6 << 1; VAR_0->mv[VAR_2][VAR_3][1] = VAR_6; dprintf("fmy=%d\n", VAR_6); } } else { VAR_7 |= MB_TYPE_16x16 | MB_TYPE_INTERLACED; VAR_0->field_select[VAR_2][0] = get_bits1(&VAR_0->gb); for(VAR_4=0;VAR_4<2;VAR_4++) { VAR_6 = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][VAR_4], VAR_0->last_mv[VAR_2][0][VAR_4]); VAR_0->last_mv[VAR_2][0][VAR_4] = VAR_6; VAR_0->last_mv[VAR_2][1][VAR_4] = VAR_6; VAR_0->mv[VAR_2][0][VAR_4] = VAR_6; } } break; case MT_DMV: { int VAR_10, VAR_11, VAR_12, VAR_13, VAR_14; VAR_12 = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][0], VAR_0->last_mv[VAR_2][0][0]); VAR_0->last_mv[VAR_2][0][0] = VAR_12; VAR_0->last_mv[VAR_2][1][0] = VAR_12; VAR_10 = get_dmv(VAR_0); VAR_13 = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][1], VAR_0->last_mv[VAR_2][0][1] >> 1); VAR_11 = get_dmv(VAR_0); VAR_0->mv_type = MV_TYPE_DMV; VAR_0->last_mv[VAR_2][0][1] = VAR_13<<1; VAR_0->last_mv[VAR_2][1][1] = VAR_13<<1; VAR_0->mv[VAR_2][0][0] = VAR_12; VAR_0->mv[VAR_2][0][1] = VAR_13; VAR_0->mv[VAR_2][1][0] = VAR_12; VAR_0->mv[VAR_2][1][1] = VAR_13; if (VAR_0->picture_structure == PICT_FRAME) { VAR_7 |= MB_TYPE_16x16 | MB_TYPE_INTERLACED; VAR_14 = VAR_0->top_field_first ? 1 : 3; VAR_0->mv[VAR_2][2][0] = ((VAR_12 * VAR_14 + (VAR_12 > 0)) >> 1) + VAR_10; VAR_0->mv[VAR_2][2][1] = ((VAR_13 * VAR_14 + (VAR_13 > 0)) >> 1) + VAR_11 - 1; VAR_14 = 4 - VAR_14; VAR_0->mv[VAR_2][3][0] = ((VAR_12 * VAR_14 + (VAR_12 > 0)) >> 1) + VAR_10; VAR_0->mv[VAR_2][3][1] = ((VAR_13 * VAR_14 + (VAR_13 > 0)) >> 1) + VAR_11 + 1; } else { VAR_7 |= MB_TYPE_16x16; VAR_0->mv[VAR_2][2][0] = ((VAR_12 + (VAR_12 > 0)) >> 1) + VAR_10; VAR_0->mv[VAR_2][2][1] = ((VAR_13 + (VAR_13 > 0)) >> 1) + VAR_11; if(VAR_0->picture_structure == PICT_TOP_FIELD) VAR_0->mv[VAR_2][2][1]--; else VAR_0->mv[VAR_2][2][1]++; } } break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "00 VAR_8 at %d %d\n", VAR_0->mb_x, VAR_0->mb_y); return -1; } } } } VAR_0->mb_intra = 0; if (HAS_CBP(VAR_7)) { VAR_5 = get_vlc2(&VAR_0->gb, mb_pat_vlc.table, MB_PAT_VLC_BITS, 1); if (VAR_5 < 0 || ((VAR_5 == 0) && (VAR_0->chroma_format < 2)) ){ av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid VAR_5 at %d %d\n", VAR_0->mb_x, VAR_0->mb_y); return -1; } if(VAR_9 > 6){ VAR_5<<= VAR_9-6; VAR_5 |= get_bits(&VAR_0->gb, VAR_9-6); } #ifdef HAVE_XVMC if(VAR_0->avctx->xvmc_acceleration > 1){ XVMC_pack_pblocks(VAR_0,VAR_5); if(VAR_0->swap_uv){ exchange_uv(VAR_0); } } #endif if (VAR_0->codec_id == CODEC_ID_MPEG2VIDEO) { if(VAR_0->flags2 & CODEC_FLAG2_FAST){ for(VAR_2=0;VAR_2<6;VAR_2++) { if(VAR_5 & 32) { mpeg2_fast_decode_block_non_intra(VAR_0, VAR_0->pblocks[VAR_2], VAR_2); } else { VAR_0->block_last_index[VAR_2] = -1; } VAR_5+=VAR_5; } }else{ VAR_5<<= 12-VAR_9; for(VAR_2=0;VAR_2<VAR_9;VAR_2++) { if ( VAR_5 & (1<<11) ) { if (mpeg2_decode_block_non_intra(VAR_0, VAR_0->pblocks[VAR_2], VAR_2) < 0) return -1; } else { VAR_0->block_last_index[VAR_2] = -1; } VAR_5+=VAR_5; } } } else { if(VAR_0->flags2 & CODEC_FLAG2_FAST){ for(VAR_2=0;VAR_2<6;VAR_2++) { if (VAR_5 & 32) { mpeg1_fast_decode_block_inter(VAR_0, VAR_0->pblocks[VAR_2], VAR_2); } else { VAR_0->block_last_index[VAR_2] = -1; } VAR_5+=VAR_5; } }else{ for(VAR_2=0;VAR_2<6;VAR_2++) { if (VAR_5 & 32) { if (mpeg1_decode_block_inter(VAR_0, VAR_0->pblocks[VAR_2], VAR_2) < 0) return -1; } else { VAR_0->block_last_index[VAR_2] = -1; } VAR_5+=VAR_5; } } } }else{ for(VAR_2=0;VAR_2<6;VAR_2++) VAR_0->block_last_index[VAR_2] = -1; } } VAR_0->current_picture.VAR_7[ VAR_0->mb_x + VAR_0->mb_y*VAR_0->mb_stride ]= VAR_7; return 0; }
[ "static int FUNC_0(MpegEncContext *VAR_0,\nDCTELEM VAR_1[12][64])\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;", "const int VAR_9 = 4 + (1<< VAR_0->chroma_format)\ndprintf(\"decode_mb: x=%d y=%d\\n\", VAR_0->mb_x, VAR_0->mb_y);", "assert(VAR_0->mb_skiped==0);", "if (VAR_0->mb_skip_run-- != 0) {", "if(VAR_0->pict_type == I_TYPE){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"skiped MB in I frame at %d %d\\n\", VAR_0->mb_x, VAR_0->mb_y);", "return -1;", "}", "VAR_0->mb_intra = 0;", "for(VAR_2=0;VAR_2<12;VAR_2++)", "VAR_0->block_last_index[VAR_2] = -1;", "if(VAR_0->picture_structure == PICT_FRAME)\nVAR_0->mv_type = MV_TYPE_16X16;", "else\nVAR_0->mv_type = MV_TYPE_FIELD;", "if (VAR_0->pict_type == P_TYPE) {", "VAR_0->mv_dir = MV_DIR_FORWARD;", "VAR_0->mv[0][0][0] = VAR_0->mv[0][0][1] = 0;", "VAR_0->last_mv[0][0][0] = VAR_0->last_mv[0][0][1] = 0;", "VAR_0->last_mv[0][1][0] = VAR_0->last_mv[0][1][1] = 0;", "VAR_0->field_select[0][0]= VAR_0->picture_structure - 1;", "VAR_0->mb_skiped = 1;", "VAR_0->current_picture.VAR_7[ VAR_0->mb_x + VAR_0->mb_y*VAR_0->mb_stride ]= MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16;", "} else {", "VAR_0->mv[0][0][0] = VAR_0->last_mv[0][0][0];", "VAR_0->mv[0][0][1] = VAR_0->last_mv[0][0][1];", "VAR_0->mv[1][0][0] = VAR_0->last_mv[1][0][0];", "VAR_0->mv[1][0][1] = VAR_0->last_mv[1][0][1];", "VAR_0->current_picture.VAR_7[ VAR_0->mb_x + VAR_0->mb_y*VAR_0->mb_stride ]=\nVAR_0->current_picture.VAR_7[ VAR_0->mb_x + VAR_0->mb_y*VAR_0->mb_stride - 1] | MB_TYPE_SKIP;", "if((VAR_0->mv[0][0][0]|VAR_0->mv[0][0][1]|VAR_0->mv[1][0][0]|VAR_0->mv[1][0][1])==0)\nVAR_0->mb_skiped = 1;", "}", "return 0;", "}", "switch(VAR_0->pict_type) {", "default:\ncase I_TYPE:\nif (get_bits1(&VAR_0->gb) == 0) {", "if (get_bits1(&VAR_0->gb) == 0){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid mb type in I Frame at %d %d\\n\", VAR_0->mb_x, VAR_0->mb_y);", "return -1;", "}", "VAR_7 = MB_TYPE_QUANT | MB_TYPE_INTRA;", "} else {", "VAR_7 = MB_TYPE_INTRA;", "}", "break;", "case P_TYPE:\nVAR_7 = get_vlc2(&VAR_0->gb, mb_ptype_vlc.table, MB_PTYPE_VLC_BITS, 1);", "if (VAR_7 < 0){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid mb type in P Frame at %d %d\\n\", VAR_0->mb_x, VAR_0->mb_y);", "return -1;", "}", "VAR_7 = ptype2mb_type[ VAR_7 ];", "break;", "case B_TYPE:\nVAR_7 = get_vlc2(&VAR_0->gb, mb_btype_vlc.table, MB_BTYPE_VLC_BITS, 1);", "if (VAR_7 < 0){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid mb type in B Frame at %d %d\\n\", VAR_0->mb_x, VAR_0->mb_y);", "return -1;", "}", "VAR_7 = btype2mb_type[ VAR_7 ];", "break;", "}", "dprintf(\"VAR_7=%x\\n\", VAR_7);", "if (IS_INTRA(VAR_7)) {", "if (VAR_0->picture_structure == PICT_FRAME &&\n!VAR_0->frame_pred_frame_dct) {", "VAR_0->interlaced_dct = get_bits1(&VAR_0->gb);", "}", "if (IS_QUANT(VAR_7))\nVAR_0->qscale = get_qscale(VAR_0);", "if (VAR_0->concealment_motion_vectors) {", "if (VAR_0->picture_structure != PICT_FRAME)\nskip_bits1(&VAR_0->gb);", "VAR_0->mv[0][0][0]= VAR_0->last_mv[0][0][0]= VAR_0->last_mv[0][1][0] =\nmpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[0][0], VAR_0->last_mv[0][0][0]);", "VAR_0->mv[0][0][1]= VAR_0->last_mv[0][0][1]= VAR_0->last_mv[0][1][1] =\nmpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[0][1], VAR_0->last_mv[0][0][1]);", "skip_bits1(&VAR_0->gb);", "}else", "memset(VAR_0->last_mv, 0, sizeof(VAR_0->last_mv));", "VAR_0->mb_intra = 1;", "#ifdef HAVE_XVMC\nif(VAR_0->avctx->xvmc_acceleration > 1){", "XVMC_pack_pblocks(VAR_0,-1);", "if(VAR_0->swap_uv){", "exchange_uv(VAR_0);", "}", "}", "#endif\nif (VAR_0->codec_id == CODEC_ID_MPEG2VIDEO) {", "for(VAR_2=0;VAR_2<VAR_9;VAR_2++) {", "if (mpeg2_decode_block_intra(VAR_0, VAR_0->pblocks[VAR_2], VAR_2) < 0)\nreturn -1;", "}", "} else {", "for(VAR_2=0;VAR_2<6;VAR_2++) {", "if (mpeg1_decode_block_intra(VAR_0, VAR_0->pblocks[VAR_2], VAR_2) < 0)\nreturn -1;", "}", "}", "} else {", "if (VAR_7 & MB_TYPE_ZERO_MV){", "assert(VAR_7 & MB_TYPE_CBP);", "if (VAR_0->picture_structure == PICT_FRAME &&\n!VAR_0->frame_pred_frame_dct) {", "VAR_0->interlaced_dct = get_bits1(&VAR_0->gb);", "}", "if (IS_QUANT(VAR_7))\nVAR_0->qscale = get_qscale(VAR_0);", "VAR_0->mv_dir = MV_DIR_FORWARD;", "if(VAR_0->picture_structure == PICT_FRAME)\nVAR_0->mv_type = MV_TYPE_16X16;", "else{", "VAR_0->mv_type = MV_TYPE_FIELD;", "VAR_7 |= MB_TYPE_INTERLACED;", "VAR_0->field_select[0][0]= VAR_0->picture_structure - 1;", "}", "VAR_0->last_mv[0][0][0] = 0;", "VAR_0->last_mv[0][0][1] = 0;", "VAR_0->last_mv[0][1][0] = 0;", "VAR_0->last_mv[0][1][1] = 0;", "VAR_0->mv[0][0][0] = 0;", "VAR_0->mv[0][0][1] = 0;", "}else{", "assert(VAR_7 & MB_TYPE_L0L1);", "if (VAR_0->frame_pred_frame_dct)\nVAR_8 = MT_FRAME;", "else{", "VAR_8 = get_bits(&VAR_0->gb, 2);", "}", "if (VAR_0->picture_structure == PICT_FRAME &&\n!VAR_0->frame_pred_frame_dct && HAS_CBP(VAR_7)) {", "VAR_0->interlaced_dct = get_bits1(&VAR_0->gb);", "}", "if (IS_QUANT(VAR_7))\nVAR_0->qscale = get_qscale(VAR_0);", "VAR_0->mv_dir = 0;", "for(VAR_2=0;VAR_2<2;VAR_2++) {", "if (USES_LIST(VAR_7, VAR_2)) {", "VAR_0->mv_dir |= (MV_DIR_FORWARD >> VAR_2);", "dprintf(\"VAR_8=%d\\n\", VAR_8);", "switch(VAR_8) {", "case MT_FRAME:\nif (VAR_0->picture_structure == PICT_FRAME) {", "VAR_7 |= MB_TYPE_16x16;", "VAR_0->mv_type = MV_TYPE_16X16;", "VAR_0->mv[VAR_2][0][0]= VAR_0->last_mv[VAR_2][0][0]= VAR_0->last_mv[VAR_2][1][0] =\nmpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][0], VAR_0->last_mv[VAR_2][0][0]);", "VAR_0->mv[VAR_2][0][1]= VAR_0->last_mv[VAR_2][0][1]= VAR_0->last_mv[VAR_2][1][1] =\nmpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][1], VAR_0->last_mv[VAR_2][0][1]);", "if (VAR_0->full_pel[VAR_2]){", "VAR_0->mv[VAR_2][0][0] <<= 1;", "VAR_0->mv[VAR_2][0][1] <<= 1;", "}", "} else {", "VAR_7 |= MB_TYPE_16x8 | MB_TYPE_INTERLACED;", "VAR_0->mv_type = MV_TYPE_16X8;", "for(VAR_3=0;VAR_3<2;VAR_3++) {", "VAR_0->field_select[VAR_2][VAR_3] = get_bits1(&VAR_0->gb);", "for(VAR_4=0;VAR_4<2;VAR_4++) {", "VAR_6 = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][VAR_4],\nVAR_0->last_mv[VAR_2][VAR_3][VAR_4]);", "VAR_0->last_mv[VAR_2][VAR_3][VAR_4] = VAR_6;", "VAR_0->mv[VAR_2][VAR_3][VAR_4] = VAR_6;", "}", "}", "}", "break;", "case MT_FIELD:\nVAR_0->mv_type = MV_TYPE_FIELD;", "if (VAR_0->picture_structure == PICT_FRAME) {", "VAR_7 |= MB_TYPE_16x8 | MB_TYPE_INTERLACED;", "for(VAR_3=0;VAR_3<2;VAR_3++) {", "VAR_0->field_select[VAR_2][VAR_3] = get_bits1(&VAR_0->gb);", "VAR_6 = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][0],\nVAR_0->last_mv[VAR_2][VAR_3][0]);", "VAR_0->last_mv[VAR_2][VAR_3][0] = VAR_6;", "VAR_0->mv[VAR_2][VAR_3][0] = VAR_6;", "dprintf(\"fmx=%d\\n\", VAR_6);", "VAR_6 = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][1],\nVAR_0->last_mv[VAR_2][VAR_3][1] >> 1);", "VAR_0->last_mv[VAR_2][VAR_3][1] = VAR_6 << 1;", "VAR_0->mv[VAR_2][VAR_3][1] = VAR_6;", "dprintf(\"fmy=%d\\n\", VAR_6);", "}", "} else {", "VAR_7 |= MB_TYPE_16x16 | MB_TYPE_INTERLACED;", "VAR_0->field_select[VAR_2][0] = get_bits1(&VAR_0->gb);", "for(VAR_4=0;VAR_4<2;VAR_4++) {", "VAR_6 = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][VAR_4],\nVAR_0->last_mv[VAR_2][0][VAR_4]);", "VAR_0->last_mv[VAR_2][0][VAR_4] = VAR_6;", "VAR_0->last_mv[VAR_2][1][VAR_4] = VAR_6;", "VAR_0->mv[VAR_2][0][VAR_4] = VAR_6;", "}", "}", "break;", "case MT_DMV:\n{", "int VAR_10, VAR_11, VAR_12, VAR_13, VAR_14;", "VAR_12 = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][0],\nVAR_0->last_mv[VAR_2][0][0]);", "VAR_0->last_mv[VAR_2][0][0] = VAR_12;", "VAR_0->last_mv[VAR_2][1][0] = VAR_12;", "VAR_10 = get_dmv(VAR_0);", "VAR_13 = mpeg_decode_motion(VAR_0, VAR_0->mpeg_f_code[VAR_2][1],\nVAR_0->last_mv[VAR_2][0][1] >> 1);", "VAR_11 = get_dmv(VAR_0);", "VAR_0->mv_type = MV_TYPE_DMV;", "VAR_0->last_mv[VAR_2][0][1] = VAR_13<<1;", "VAR_0->last_mv[VAR_2][1][1] = VAR_13<<1;", "VAR_0->mv[VAR_2][0][0] = VAR_12;", "VAR_0->mv[VAR_2][0][1] = VAR_13;", "VAR_0->mv[VAR_2][1][0] = VAR_12;", "VAR_0->mv[VAR_2][1][1] = VAR_13;", "if (VAR_0->picture_structure == PICT_FRAME) {", "VAR_7 |= MB_TYPE_16x16 | MB_TYPE_INTERLACED;", "VAR_14 = VAR_0->top_field_first ? 1 : 3;", "VAR_0->mv[VAR_2][2][0] = ((VAR_12 * VAR_14 + (VAR_12 > 0)) >> 1) + VAR_10;", "VAR_0->mv[VAR_2][2][1] = ((VAR_13 * VAR_14 + (VAR_13 > 0)) >> 1) + VAR_11 - 1;", "VAR_14 = 4 - VAR_14;", "VAR_0->mv[VAR_2][3][0] = ((VAR_12 * VAR_14 + (VAR_12 > 0)) >> 1) + VAR_10;", "VAR_0->mv[VAR_2][3][1] = ((VAR_13 * VAR_14 + (VAR_13 > 0)) >> 1) + VAR_11 + 1;", "} else {", "VAR_7 |= MB_TYPE_16x16;", "VAR_0->mv[VAR_2][2][0] = ((VAR_12 + (VAR_12 > 0)) >> 1) + VAR_10;", "VAR_0->mv[VAR_2][2][1] = ((VAR_13 + (VAR_13 > 0)) >> 1) + VAR_11;", "if(VAR_0->picture_structure == PICT_TOP_FIELD)\nVAR_0->mv[VAR_2][2][1]--;", "else\nVAR_0->mv[VAR_2][2][1]++;", "}", "}", "break;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"00 VAR_8 at %d %d\\n\", VAR_0->mb_x, VAR_0->mb_y);", "return -1;", "}", "}", "}", "}", "VAR_0->mb_intra = 0;", "if (HAS_CBP(VAR_7)) {", "VAR_5 = get_vlc2(&VAR_0->gb, mb_pat_vlc.table, MB_PAT_VLC_BITS, 1);", "if (VAR_5 < 0 || ((VAR_5 == 0) && (VAR_0->chroma_format < 2)) ){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid VAR_5 at %d %d\\n\", VAR_0->mb_x, VAR_0->mb_y);", "return -1;", "}", "if(VAR_9 > 6){", "VAR_5<<= VAR_9-6;", "VAR_5 |= get_bits(&VAR_0->gb, VAR_9-6);", "}", "#ifdef HAVE_XVMC\nif(VAR_0->avctx->xvmc_acceleration > 1){", "XVMC_pack_pblocks(VAR_0,VAR_5);", "if(VAR_0->swap_uv){", "exchange_uv(VAR_0);", "}", "}", "#endif\nif (VAR_0->codec_id == CODEC_ID_MPEG2VIDEO) {", "if(VAR_0->flags2 & CODEC_FLAG2_FAST){", "for(VAR_2=0;VAR_2<6;VAR_2++) {", "if(VAR_5 & 32) {", "mpeg2_fast_decode_block_non_intra(VAR_0, VAR_0->pblocks[VAR_2], VAR_2);", "} else {", "VAR_0->block_last_index[VAR_2] = -1;", "}", "VAR_5+=VAR_5;", "}", "}else{", "VAR_5<<= 12-VAR_9;", "for(VAR_2=0;VAR_2<VAR_9;VAR_2++) {", "if ( VAR_5 & (1<<11) ) {", "if (mpeg2_decode_block_non_intra(VAR_0, VAR_0->pblocks[VAR_2], VAR_2) < 0)\nreturn -1;", "} else {", "VAR_0->block_last_index[VAR_2] = -1;", "}", "VAR_5+=VAR_5;", "}", "}", "} else {", "if(VAR_0->flags2 & CODEC_FLAG2_FAST){", "for(VAR_2=0;VAR_2<6;VAR_2++) {", "if (VAR_5 & 32) {", "mpeg1_fast_decode_block_inter(VAR_0, VAR_0->pblocks[VAR_2], VAR_2);", "} else {", "VAR_0->block_last_index[VAR_2] = -1;", "}", "VAR_5+=VAR_5;", "}", "}else{", "for(VAR_2=0;VAR_2<6;VAR_2++) {", "if (VAR_5 & 32) {", "if (mpeg1_decode_block_inter(VAR_0, VAR_0->pblocks[VAR_2], VAR_2) < 0)\nreturn -1;", "} else {", "VAR_0->block_last_index[VAR_2] = -1;", "}", "VAR_5+=VAR_5;", "}", "}", "}", "}else{", "for(VAR_2=0;VAR_2<6;VAR_2++)", "VAR_0->block_last_index[VAR_2] = -1;", "}", "}", "VAR_0->current_picture.VAR_7[ VAR_0->mb_x + VAR_0->mb_y*VAR_0->mb_stride ]= 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 89, 91 ], [ 93 ], [ 97 ], [ 99 ], [ 103 ], [ 105, 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 181, 183 ], [ 187 ], [ 191, 193 ], [ 197, 199 ], [ 201, 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215, 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231, 235 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 267, 269 ], [ 271 ], [ 273 ], [ 277, 279 ], [ 283 ], [ 285, 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 319, 321 ], [ 323 ], [ 325 ], [ 327 ], [ 333, 335 ], [ 337 ], [ 339 ], [ 343, 345 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363, 365 ], [ 369 ], [ 371 ], [ 373, 375 ], [ 377, 379 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405, 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421, 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433, 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443, 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463, 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479, 481 ], [ 483 ], [ 487, 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497, 499 ], [ 501 ], [ 503 ], [ 509 ], [ 511 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 525 ], [ 527 ], [ 533 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 555 ], [ 557 ], [ 559, 561 ], [ 563, 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573, 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 589 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 615, 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631, 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 661 ], [ 663 ], [ 665, 667 ], [ 669 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683 ], [ 685 ], [ 687 ], [ 689 ], [ 691 ], [ 693 ], [ 695 ], [ 697 ], [ 699 ], [ 701 ], [ 703 ], [ 705 ], [ 707, 709 ], [ 711 ], [ 713 ], [ 715 ], [ 717 ], [ 719 ], [ 721 ], [ 723 ], [ 725 ], [ 727 ], [ 729 ], [ 731 ], [ 733 ], [ 737 ], [ 741 ], [ 743 ] ]
784
void op_subo (void) { target_ulong tmp; tmp = T0; T0 = (int32_t)T0 - (int32_t)T1; if (!((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31))) { CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW); } RETURN(); }
true
qemu
76e050c2e62995f1d6905e28674dea3a7fcff1a5
void op_subo (void) { target_ulong tmp; tmp = T0; T0 = (int32_t)T0 - (int32_t)T1; if (!((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31))) { CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW); } RETURN(); }
{ "code": [ " if (!((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31))) {" ], "line_no": [ 13 ] }
void FUNC_0 (void) { target_ulong tmp; tmp = T0; T0 = (int32_t)T0 - (int32_t)T1; if (!((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31))) { CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW); } RETURN(); }
[ "void FUNC_0 (void)\n{", "target_ulong tmp;", "tmp = T0;", "T0 = (int32_t)T0 - (int32_t)T1;", "if (!((T0 >> 31) ^ (T1 >> 31) ^ (tmp >> 31))) {", "CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);", "}", "RETURN();", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
785
int get_physical_address (CPUState *env, mmu_ctx_t *ctx, target_ulong eaddr, int rw, int access_type, int check_BATs) { int ret; #if 0 if (loglevel != 0) { fprintf(logfile, "%s\n", __func__); } #endif if ((access_type == ACCESS_CODE && msr_ir == 0) || (access_type != ACCESS_CODE && msr_dr == 0)) { /* No address translation */ ret = check_physical(env, ctx, eaddr, rw); } else { ret = -1; switch (env->mmu_model) { case POWERPC_MMU_32B: case POWERPC_MMU_SOFT_6xx: case POWERPC_MMU_SOFT_74xx: /* Try to find a BAT */ if (check_BATs) ret = get_bat(env, ctx, eaddr, rw, access_type); /* No break here */ #if defined(TARGET_PPC64) case POWERPC_MMU_64B: case POWERPC_MMU_64BRIDGE: #endif if (ret < 0) { /* We didn't match any BAT entry or don't have BATs */ ret = get_segment(env, ctx, eaddr, rw, access_type); } break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: ret = mmu40x_get_physical_address(env, ctx, eaddr, rw, access_type); break; case POWERPC_MMU_601: /* XXX: TODO */ cpu_abort(env, "601 MMU model not implemented\n"); return -1; case POWERPC_MMU_BOOKE: ret = mmubooke_get_physical_address(env, ctx, eaddr, rw, access_type); break; case POWERPC_MMU_BOOKE_FSL: /* XXX: TODO */ cpu_abort(env, "BookE FSL MMU model not implemented\n"); return -1; case POWERPC_MMU_REAL_4xx: cpu_abort(env, "PowerPC 401 does not do any translation\n"); return -1; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } } #if 0 if (loglevel != 0) { fprintf(logfile, "%s address " ADDRX " => %d " PADDRX "\n", __func__, eaddr, ret, ctx->raddr); } #endif return ret; }
true
qemu
12de9a396acbc95e25c5d60ed097cc55777eaaed
int get_physical_address (CPUState *env, mmu_ctx_t *ctx, target_ulong eaddr, int rw, int access_type, int check_BATs) { int ret; #if 0 if (loglevel != 0) { fprintf(logfile, "%s\n", __func__); } #endif if ((access_type == ACCESS_CODE && msr_ir == 0) || (access_type != ACCESS_CODE && msr_dr == 0)) { ret = check_physical(env, ctx, eaddr, rw); } else { ret = -1; switch (env->mmu_model) { case POWERPC_MMU_32B: case POWERPC_MMU_SOFT_6xx: case POWERPC_MMU_SOFT_74xx: if (check_BATs) ret = get_bat(env, ctx, eaddr, rw, access_type); #if defined(TARGET_PPC64) case POWERPC_MMU_64B: case POWERPC_MMU_64BRIDGE: #endif if (ret < 0) { ret = get_segment(env, ctx, eaddr, rw, access_type); } break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: ret = mmu40x_get_physical_address(env, ctx, eaddr, rw, access_type); break; case POWERPC_MMU_601: cpu_abort(env, "601 MMU model not implemented\n"); return -1; case POWERPC_MMU_BOOKE: ret = mmubooke_get_physical_address(env, ctx, eaddr, rw, access_type); break; case POWERPC_MMU_BOOKE_FSL: cpu_abort(env, "BookE FSL MMU model not implemented\n"); return -1; case POWERPC_MMU_REAL_4xx: cpu_abort(env, "PowerPC 401 does not do any translation\n"); return -1; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } } #if 0 if (loglevel != 0) { fprintf(logfile, "%s address " ADDRX " => %d " PADDRX "\n", __func__, eaddr, ret, ctx->raddr); } #endif return ret; }
{ "code": [ "#endif", "#endif", " case POWERPC_MMU_64BRIDGE:", " case POWERPC_MMU_64BRIDGE:", " break;" ], "line_no": [ 17, 17, 51, 51, 63 ] }
int FUNC_0 (CPUState *VAR_0, mmu_ctx_t *VAR_1, target_ulong VAR_2, int VAR_3, int VAR_4, int VAR_5) { int VAR_6; #if 0 if (loglevel != 0) { fprintf(logfile, "%s\n", __func__); } #endif if ((VAR_4 == ACCESS_CODE && msr_ir == 0) || (VAR_4 != ACCESS_CODE && msr_dr == 0)) { VAR_6 = check_physical(VAR_0, VAR_1, VAR_2, VAR_3); } else { VAR_6 = -1; switch (VAR_0->mmu_model) { case POWERPC_MMU_32B: case POWERPC_MMU_SOFT_6xx: case POWERPC_MMU_SOFT_74xx: if (VAR_5) VAR_6 = get_bat(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); #if defined(TARGET_PPC64) case POWERPC_MMU_64B: case POWERPC_MMU_64BRIDGE: #endif if (VAR_6 < 0) { VAR_6 = get_segment(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); } break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: VAR_6 = mmu40x_get_physical_address(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); break; case POWERPC_MMU_601: cpu_abort(VAR_0, "601 MMU model not implemented\n"); return -1; case POWERPC_MMU_BOOKE: VAR_6 = mmubooke_get_physical_address(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); break; case POWERPC_MMU_BOOKE_FSL: cpu_abort(VAR_0, "BookE FSL MMU model not implemented\n"); return -1; case POWERPC_MMU_REAL_4xx: cpu_abort(VAR_0, "PowerPC 401 does not do any translation\n"); return -1; default: cpu_abort(VAR_0, "Unknown or invalid MMU model\n"); return -1; } } #if 0 if (loglevel != 0) { fprintf(logfile, "%s address " ADDRX " => %d " PADDRX "\n", __func__, VAR_2, VAR_6, VAR_1->raddr); } #endif return VAR_6; }
[ "int FUNC_0 (CPUState *VAR_0, mmu_ctx_t *VAR_1, target_ulong VAR_2,\nint VAR_3, int VAR_4, int VAR_5)\n{", "int VAR_6;", "#if 0\nif (loglevel != 0) {", "fprintf(logfile, \"%s\\n\", __func__);", "}", "#endif\nif ((VAR_4 == ACCESS_CODE && msr_ir == 0) ||\n(VAR_4 != ACCESS_CODE && msr_dr == 0)) {", "VAR_6 = check_physical(VAR_0, VAR_1, VAR_2, VAR_3);", "} else {", "VAR_6 = -1;", "switch (VAR_0->mmu_model) {", "case POWERPC_MMU_32B:\ncase POWERPC_MMU_SOFT_6xx:\ncase POWERPC_MMU_SOFT_74xx:\nif (VAR_5)\nVAR_6 = get_bat(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);", "#if defined(TARGET_PPC64)\ncase POWERPC_MMU_64B:\ncase POWERPC_MMU_64BRIDGE:\n#endif\nif (VAR_6 < 0) {", "VAR_6 = get_segment(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);", "}", "break;", "case POWERPC_MMU_SOFT_4xx:\ncase POWERPC_MMU_SOFT_4xx_Z:\nVAR_6 = mmu40x_get_physical_address(VAR_0, VAR_1, VAR_2,\nVAR_3, VAR_4);", "break;", "case POWERPC_MMU_601:\ncpu_abort(VAR_0, \"601 MMU model not implemented\\n\");", "return -1;", "case POWERPC_MMU_BOOKE:\nVAR_6 = mmubooke_get_physical_address(VAR_0, VAR_1, VAR_2,\nVAR_3, VAR_4);", "break;", "case POWERPC_MMU_BOOKE_FSL:\ncpu_abort(VAR_0, \"BookE FSL MMU model not implemented\\n\");", "return -1;", "case POWERPC_MMU_REAL_4xx:\ncpu_abort(VAR_0, \"PowerPC 401 does not do any translation\\n\");", "return -1;", "default:\ncpu_abort(VAR_0, \"Unknown or invalid MMU model\\n\");", "return -1;", "}", "}", "#if 0\nif (loglevel != 0) {", "fprintf(logfile, \"%s address \" ADDRX \" => %d \" PADDRX \"\\n\",\n__func__, VAR_2, VAR_6, VAR_1->raddr);", "}", "#endif\nreturn VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17, 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35, 37, 41, 43 ], [ 47, 49, 51, 53, 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67, 69, 71 ], [ 73 ], [ 75, 79 ], [ 81 ], [ 83, 85, 87 ], [ 89 ], [ 91, 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119, 121 ], [ 123 ], [ 125, 129 ], [ 131 ] ]
786
uint32_t HELPER(neon_min_f32)(uint32_t a, uint32_t b) { float32 f0 = make_float32(a); float32 f1 = make_float32(b); return (float32_compare_quiet(f0, f1, NFS) == -1) ? a : b; }
false
qemu
4a9f9cb24de52e93aae7539a004dd20314ca1c0c
uint32_t HELPER(neon_min_f32)(uint32_t a, uint32_t b) { float32 f0 = make_float32(a); float32 f1 = make_float32(b); return (float32_compare_quiet(f0, f1, NFS) == -1) ? a : b; }
{ "code": [], "line_no": [] }
uint32_t FUNC_0(neon_min_f32)(uint32_t a, uint32_t b) { float32 f0 = make_float32(a); float32 f1 = make_float32(b); return (float32_compare_quiet(f0, f1, NFS) == -1) ? a : b; }
[ "uint32_t FUNC_0(neon_min_f32)(uint32_t a, uint32_t b)\n{", "float32 f0 = make_float32(a);", "float32 f1 = make_float32(b);", "return (float32_compare_quiet(f0, f1, NFS) == -1) ? a : b;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
787
static void test_primitive_lists(gconstpointer opaque) { TestArgs *args = (TestArgs *) opaque; const SerializeOps *ops = args->ops; PrimitiveType *pt = args->test_data; PrimitiveList pl = { .value = { NULL } }; PrimitiveList pl_copy = { .value = { NULL } }; PrimitiveList *pl_copy_ptr = &pl_copy; Error *err = NULL; void *serialize_data; void *cur_head = NULL; int i; pl.type = pl_copy.type = pt->type; /* build up our list of primitive types */ for (i = 0; i < 32; i++) { switch (pl.type) { case PTYPE_STRING: { strList *tmp = g_new0(strList, 1); tmp->value = g_strdup(pt->value.string); if (pl.value.strings == NULL) { pl.value.strings = tmp; } else { tmp->next = pl.value.strings; pl.value.strings = tmp; } break; } case PTYPE_INTEGER: { intList *tmp = g_new0(intList, 1); tmp->value = pt->value.integer; if (pl.value.integers == NULL) { pl.value.integers = tmp; } else { tmp->next = pl.value.integers; pl.value.integers = tmp; } break; } case PTYPE_S8: { int8List *tmp = g_new0(int8List, 1); tmp->value = pt->value.s8; if (pl.value.s8_integers == NULL) { pl.value.s8_integers = tmp; } else { tmp->next = pl.value.s8_integers; pl.value.s8_integers = tmp; } break; } case PTYPE_S16: { int16List *tmp = g_new0(int16List, 1); tmp->value = pt->value.s16; if (pl.value.s16_integers == NULL) { pl.value.s16_integers = tmp; } else { tmp->next = pl.value.s16_integers; pl.value.s16_integers = tmp; } break; } case PTYPE_S32: { int32List *tmp = g_new0(int32List, 1); tmp->value = pt->value.s32; if (pl.value.s32_integers == NULL) { pl.value.s32_integers = tmp; } else { tmp->next = pl.value.s32_integers; pl.value.s32_integers = tmp; } break; } case PTYPE_S64: { int64List *tmp = g_new0(int64List, 1); tmp->value = pt->value.s64; if (pl.value.s64_integers == NULL) { pl.value.s64_integers = tmp; } else { tmp->next = pl.value.s64_integers; pl.value.s64_integers = tmp; } break; } case PTYPE_U8: { uint8List *tmp = g_new0(uint8List, 1); tmp->value = pt->value.u8; if (pl.value.u8_integers == NULL) { pl.value.u8_integers = tmp; } else { tmp->next = pl.value.u8_integers; pl.value.u8_integers = tmp; } break; } case PTYPE_U16: { uint16List *tmp = g_new0(uint16List, 1); tmp->value = pt->value.u16; if (pl.value.u16_integers == NULL) { pl.value.u16_integers = tmp; } else { tmp->next = pl.value.u16_integers; pl.value.u16_integers = tmp; } break; } case PTYPE_U32: { uint32List *tmp = g_new0(uint32List, 1); tmp->value = pt->value.u32; if (pl.value.u32_integers == NULL) { pl.value.u32_integers = tmp; } else { tmp->next = pl.value.u32_integers; pl.value.u32_integers = tmp; } break; } case PTYPE_U64: { uint64List *tmp = g_new0(uint64List, 1); tmp->value = pt->value.u64; if (pl.value.u64_integers == NULL) { pl.value.u64_integers = tmp; } else { tmp->next = pl.value.u64_integers; pl.value.u64_integers = tmp; } break; } case PTYPE_NUMBER: { numberList *tmp = g_new0(numberList, 1); tmp->value = pt->value.number; if (pl.value.numbers == NULL) { pl.value.numbers = tmp; } else { tmp->next = pl.value.numbers; pl.value.numbers = tmp; } break; } case PTYPE_BOOLEAN: { boolList *tmp = g_new0(boolList, 1); tmp->value = pt->value.boolean; if (pl.value.booleans == NULL) { pl.value.booleans = tmp; } else { tmp->next = pl.value.booleans; pl.value.booleans = tmp; } break; } default: g_assert_not_reached(); } } ops->serialize((void **)&pl, &serialize_data, visit_primitive_list, &err); ops->deserialize((void **)&pl_copy_ptr, serialize_data, visit_primitive_list, &err); g_assert(err == NULL); i = 0; /* compare our deserialized list of primitives to the original */ do { switch (pl_copy.type) { case PTYPE_STRING: { strList *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.strings; } g_assert_cmpstr(pt->value.string, ==, ptr->value); break; } case PTYPE_INTEGER: { intList *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.integers; } g_assert_cmpint(pt->value.integer, ==, ptr->value); break; } case PTYPE_S8: { int8List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.s8_integers; } g_assert_cmpint(pt->value.s8, ==, ptr->value); break; } case PTYPE_S16: { int16List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.s16_integers; } g_assert_cmpint(pt->value.s16, ==, ptr->value); break; } case PTYPE_S32: { int32List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.s32_integers; } g_assert_cmpint(pt->value.s32, ==, ptr->value); break; } case PTYPE_S64: { int64List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.s64_integers; } g_assert_cmpint(pt->value.s64, ==, ptr->value); break; } case PTYPE_U8: { uint8List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.u8_integers; } g_assert_cmpint(pt->value.u8, ==, ptr->value); break; } case PTYPE_U16: { uint16List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.u16_integers; } g_assert_cmpint(pt->value.u16, ==, ptr->value); break; } case PTYPE_U32: { uint32List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.u32_integers; } g_assert_cmpint(pt->value.u32, ==, ptr->value); break; } case PTYPE_U64: { uint64List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.u64_integers; } g_assert_cmpint(pt->value.u64, ==, ptr->value); break; } case PTYPE_NUMBER: { numberList *ptr; GString *double_expected = g_string_new(""); GString *double_actual = g_string_new(""); if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.numbers; } /* we serialize with %f for our reference visitors, so rather than * fuzzy floating math to test "equality", just compare the * formatted values */ g_string_printf(double_expected, "%.6f", pt->value.number); g_string_printf(double_actual, "%.6f", ptr->value); g_assert_cmpstr(double_actual->str, ==, double_expected->str); g_string_free(double_expected, true); g_string_free(double_actual, true); break; } case PTYPE_BOOLEAN: { boolList *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.booleans; } g_assert_cmpint(!!pt->value.boolean, ==, !!ptr->value); break; } default: g_assert_not_reached(); } i++; } while (cur_head); g_assert_cmpint(i, ==, 33); ops->cleanup(serialize_data); dealloc_helper(&pl, visit_primitive_list, &err); g_assert(!err); dealloc_helper(&pl_copy, visit_primitive_list, &err); g_assert(!err); g_free(args); }
false
qemu
3f66f764ee25f10d3e1144ebc057a949421b7728
static void test_primitive_lists(gconstpointer opaque) { TestArgs *args = (TestArgs *) opaque; const SerializeOps *ops = args->ops; PrimitiveType *pt = args->test_data; PrimitiveList pl = { .value = { NULL } }; PrimitiveList pl_copy = { .value = { NULL } }; PrimitiveList *pl_copy_ptr = &pl_copy; Error *err = NULL; void *serialize_data; void *cur_head = NULL; int i; pl.type = pl_copy.type = pt->type; for (i = 0; i < 32; i++) { switch (pl.type) { case PTYPE_STRING: { strList *tmp = g_new0(strList, 1); tmp->value = g_strdup(pt->value.string); if (pl.value.strings == NULL) { pl.value.strings = tmp; } else { tmp->next = pl.value.strings; pl.value.strings = tmp; } break; } case PTYPE_INTEGER: { intList *tmp = g_new0(intList, 1); tmp->value = pt->value.integer; if (pl.value.integers == NULL) { pl.value.integers = tmp; } else { tmp->next = pl.value.integers; pl.value.integers = tmp; } break; } case PTYPE_S8: { int8List *tmp = g_new0(int8List, 1); tmp->value = pt->value.s8; if (pl.value.s8_integers == NULL) { pl.value.s8_integers = tmp; } else { tmp->next = pl.value.s8_integers; pl.value.s8_integers = tmp; } break; } case PTYPE_S16: { int16List *tmp = g_new0(int16List, 1); tmp->value = pt->value.s16; if (pl.value.s16_integers == NULL) { pl.value.s16_integers = tmp; } else { tmp->next = pl.value.s16_integers; pl.value.s16_integers = tmp; } break; } case PTYPE_S32: { int32List *tmp = g_new0(int32List, 1); tmp->value = pt->value.s32; if (pl.value.s32_integers == NULL) { pl.value.s32_integers = tmp; } else { tmp->next = pl.value.s32_integers; pl.value.s32_integers = tmp; } break; } case PTYPE_S64: { int64List *tmp = g_new0(int64List, 1); tmp->value = pt->value.s64; if (pl.value.s64_integers == NULL) { pl.value.s64_integers = tmp; } else { tmp->next = pl.value.s64_integers; pl.value.s64_integers = tmp; } break; } case PTYPE_U8: { uint8List *tmp = g_new0(uint8List, 1); tmp->value = pt->value.u8; if (pl.value.u8_integers == NULL) { pl.value.u8_integers = tmp; } else { tmp->next = pl.value.u8_integers; pl.value.u8_integers = tmp; } break; } case PTYPE_U16: { uint16List *tmp = g_new0(uint16List, 1); tmp->value = pt->value.u16; if (pl.value.u16_integers == NULL) { pl.value.u16_integers = tmp; } else { tmp->next = pl.value.u16_integers; pl.value.u16_integers = tmp; } break; } case PTYPE_U32: { uint32List *tmp = g_new0(uint32List, 1); tmp->value = pt->value.u32; if (pl.value.u32_integers == NULL) { pl.value.u32_integers = tmp; } else { tmp->next = pl.value.u32_integers; pl.value.u32_integers = tmp; } break; } case PTYPE_U64: { uint64List *tmp = g_new0(uint64List, 1); tmp->value = pt->value.u64; if (pl.value.u64_integers == NULL) { pl.value.u64_integers = tmp; } else { tmp->next = pl.value.u64_integers; pl.value.u64_integers = tmp; } break; } case PTYPE_NUMBER: { numberList *tmp = g_new0(numberList, 1); tmp->value = pt->value.number; if (pl.value.numbers == NULL) { pl.value.numbers = tmp; } else { tmp->next = pl.value.numbers; pl.value.numbers = tmp; } break; } case PTYPE_BOOLEAN: { boolList *tmp = g_new0(boolList, 1); tmp->value = pt->value.boolean; if (pl.value.booleans == NULL) { pl.value.booleans = tmp; } else { tmp->next = pl.value.booleans; pl.value.booleans = tmp; } break; } default: g_assert_not_reached(); } } ops->serialize((void **)&pl, &serialize_data, visit_primitive_list, &err); ops->deserialize((void **)&pl_copy_ptr, serialize_data, visit_primitive_list, &err); g_assert(err == NULL); i = 0; do { switch (pl_copy.type) { case PTYPE_STRING: { strList *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.strings; } g_assert_cmpstr(pt->value.string, ==, ptr->value); break; } case PTYPE_INTEGER: { intList *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.integers; } g_assert_cmpint(pt->value.integer, ==, ptr->value); break; } case PTYPE_S8: { int8List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.s8_integers; } g_assert_cmpint(pt->value.s8, ==, ptr->value); break; } case PTYPE_S16: { int16List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.s16_integers; } g_assert_cmpint(pt->value.s16, ==, ptr->value); break; } case PTYPE_S32: { int32List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.s32_integers; } g_assert_cmpint(pt->value.s32, ==, ptr->value); break; } case PTYPE_S64: { int64List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.s64_integers; } g_assert_cmpint(pt->value.s64, ==, ptr->value); break; } case PTYPE_U8: { uint8List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.u8_integers; } g_assert_cmpint(pt->value.u8, ==, ptr->value); break; } case PTYPE_U16: { uint16List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.u16_integers; } g_assert_cmpint(pt->value.u16, ==, ptr->value); break; } case PTYPE_U32: { uint32List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.u32_integers; } g_assert_cmpint(pt->value.u32, ==, ptr->value); break; } case PTYPE_U64: { uint64List *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.u64_integers; } g_assert_cmpint(pt->value.u64, ==, ptr->value); break; } case PTYPE_NUMBER: { numberList *ptr; GString *double_expected = g_string_new(""); GString *double_actual = g_string_new(""); if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.numbers; } g_string_printf(double_expected, "%.6f", pt->value.number); g_string_printf(double_actual, "%.6f", ptr->value); g_assert_cmpstr(double_actual->str, ==, double_expected->str); g_string_free(double_expected, true); g_string_free(double_actual, true); break; } case PTYPE_BOOLEAN: { boolList *ptr; if (cur_head) { ptr = cur_head; cur_head = ptr->next; } else { cur_head = ptr = pl_copy.value.booleans; } g_assert_cmpint(!!pt->value.boolean, ==, !!ptr->value); break; } default: g_assert_not_reached(); } i++; } while (cur_head); g_assert_cmpint(i, ==, 33); ops->cleanup(serialize_data); dealloc_helper(&pl, visit_primitive_list, &err); g_assert(!err); dealloc_helper(&pl_copy, visit_primitive_list, &err); g_assert(!err); g_free(args); }
{ "code": [], "line_no": [] }
static void FUNC_0(gconstpointer VAR_0) { TestArgs *args = (TestArgs *) VAR_0; const SerializeOps *VAR_1 = args->VAR_1; PrimitiveType *pt = args->test_data; PrimitiveList pl = { .value = { NULL } }; PrimitiveList pl_copy = { .value = { NULL } }; PrimitiveList *pl_copy_ptr = &pl_copy; Error *err = NULL; void *VAR_2; void *VAR_3 = NULL; int VAR_4; pl.type = pl_copy.type = pt->type; for (VAR_4 = 0; VAR_4 < 32; VAR_4++) { switch (pl.type) { case PTYPE_STRING: { strList *tmp = g_new0(strList, 1); tmp->value = g_strdup(pt->value.string); if (pl.value.strings == NULL) { pl.value.strings = tmp; } else { tmp->next = pl.value.strings; pl.value.strings = tmp; } break; } case PTYPE_INTEGER: { intList *tmp = g_new0(intList, 1); tmp->value = pt->value.integer; if (pl.value.integers == NULL) { pl.value.integers = tmp; } else { tmp->next = pl.value.integers; pl.value.integers = tmp; } break; } case PTYPE_S8: { int8List *tmp = g_new0(int8List, 1); tmp->value = pt->value.s8; if (pl.value.s8_integers == NULL) { pl.value.s8_integers = tmp; } else { tmp->next = pl.value.s8_integers; pl.value.s8_integers = tmp; } break; } case PTYPE_S16: { int16List *tmp = g_new0(int16List, 1); tmp->value = pt->value.s16; if (pl.value.s16_integers == NULL) { pl.value.s16_integers = tmp; } else { tmp->next = pl.value.s16_integers; pl.value.s16_integers = tmp; } break; } case PTYPE_S32: { int32List *tmp = g_new0(int32List, 1); tmp->value = pt->value.s32; if (pl.value.s32_integers == NULL) { pl.value.s32_integers = tmp; } else { tmp->next = pl.value.s32_integers; pl.value.s32_integers = tmp; } break; } case PTYPE_S64: { int64List *tmp = g_new0(int64List, 1); tmp->value = pt->value.s64; if (pl.value.s64_integers == NULL) { pl.value.s64_integers = tmp; } else { tmp->next = pl.value.s64_integers; pl.value.s64_integers = tmp; } break; } case PTYPE_U8: { uint8List *tmp = g_new0(uint8List, 1); tmp->value = pt->value.u8; if (pl.value.u8_integers == NULL) { pl.value.u8_integers = tmp; } else { tmp->next = pl.value.u8_integers; pl.value.u8_integers = tmp; } break; } case PTYPE_U16: { uint16List *tmp = g_new0(uint16List, 1); tmp->value = pt->value.u16; if (pl.value.u16_integers == NULL) { pl.value.u16_integers = tmp; } else { tmp->next = pl.value.u16_integers; pl.value.u16_integers = tmp; } break; } case PTYPE_U32: { uint32List *tmp = g_new0(uint32List, 1); tmp->value = pt->value.u32; if (pl.value.u32_integers == NULL) { pl.value.u32_integers = tmp; } else { tmp->next = pl.value.u32_integers; pl.value.u32_integers = tmp; } break; } case PTYPE_U64: { uint64List *tmp = g_new0(uint64List, 1); tmp->value = pt->value.u64; if (pl.value.u64_integers == NULL) { pl.value.u64_integers = tmp; } else { tmp->next = pl.value.u64_integers; pl.value.u64_integers = tmp; } break; } case PTYPE_NUMBER: { numberList *tmp = g_new0(numberList, 1); tmp->value = pt->value.number; if (pl.value.numbers == NULL) { pl.value.numbers = tmp; } else { tmp->next = pl.value.numbers; pl.value.numbers = tmp; } break; } case PTYPE_BOOLEAN: { boolList *tmp = g_new0(boolList, 1); tmp->value = pt->value.boolean; if (pl.value.booleans == NULL) { pl.value.booleans = tmp; } else { tmp->next = pl.value.booleans; pl.value.booleans = tmp; } break; } default: g_assert_not_reached(); } } VAR_1->serialize((void **)&pl, &VAR_2, visit_primitive_list, &err); VAR_1->deserialize((void **)&pl_copy_ptr, VAR_2, visit_primitive_list, &err); g_assert(err == NULL); VAR_4 = 0; do { switch (pl_copy.type) { case PTYPE_STRING: { strList *ptr; if (VAR_3) { ptr = VAR_3; VAR_3 = ptr->next; } else { VAR_3 = ptr = pl_copy.value.strings; } g_assert_cmpstr(pt->value.string, ==, ptr->value); break; } case PTYPE_INTEGER: { intList *ptr; if (VAR_3) { ptr = VAR_3; VAR_3 = ptr->next; } else { VAR_3 = ptr = pl_copy.value.integers; } g_assert_cmpint(pt->value.integer, ==, ptr->value); break; } case PTYPE_S8: { int8List *ptr; if (VAR_3) { ptr = VAR_3; VAR_3 = ptr->next; } else { VAR_3 = ptr = pl_copy.value.s8_integers; } g_assert_cmpint(pt->value.s8, ==, ptr->value); break; } case PTYPE_S16: { int16List *ptr; if (VAR_3) { ptr = VAR_3; VAR_3 = ptr->next; } else { VAR_3 = ptr = pl_copy.value.s16_integers; } g_assert_cmpint(pt->value.s16, ==, ptr->value); break; } case PTYPE_S32: { int32List *ptr; if (VAR_3) { ptr = VAR_3; VAR_3 = ptr->next; } else { VAR_3 = ptr = pl_copy.value.s32_integers; } g_assert_cmpint(pt->value.s32, ==, ptr->value); break; } case PTYPE_S64: { int64List *ptr; if (VAR_3) { ptr = VAR_3; VAR_3 = ptr->next; } else { VAR_3 = ptr = pl_copy.value.s64_integers; } g_assert_cmpint(pt->value.s64, ==, ptr->value); break; } case PTYPE_U8: { uint8List *ptr; if (VAR_3) { ptr = VAR_3; VAR_3 = ptr->next; } else { VAR_3 = ptr = pl_copy.value.u8_integers; } g_assert_cmpint(pt->value.u8, ==, ptr->value); break; } case PTYPE_U16: { uint16List *ptr; if (VAR_3) { ptr = VAR_3; VAR_3 = ptr->next; } else { VAR_3 = ptr = pl_copy.value.u16_integers; } g_assert_cmpint(pt->value.u16, ==, ptr->value); break; } case PTYPE_U32: { uint32List *ptr; if (VAR_3) { ptr = VAR_3; VAR_3 = ptr->next; } else { VAR_3 = ptr = pl_copy.value.u32_integers; } g_assert_cmpint(pt->value.u32, ==, ptr->value); break; } case PTYPE_U64: { uint64List *ptr; if (VAR_3) { ptr = VAR_3; VAR_3 = ptr->next; } else { VAR_3 = ptr = pl_copy.value.u64_integers; } g_assert_cmpint(pt->value.u64, ==, ptr->value); break; } case PTYPE_NUMBER: { numberList *ptr; GString *double_expected = g_string_new(""); GString *double_actual = g_string_new(""); if (VAR_3) { ptr = VAR_3; VAR_3 = ptr->next; } else { VAR_3 = ptr = pl_copy.value.numbers; } g_string_printf(double_expected, "%.6f", pt->value.number); g_string_printf(double_actual, "%.6f", ptr->value); g_assert_cmpstr(double_actual->str, ==, double_expected->str); g_string_free(double_expected, true); g_string_free(double_actual, true); break; } case PTYPE_BOOLEAN: { boolList *ptr; if (VAR_3) { ptr = VAR_3; VAR_3 = ptr->next; } else { VAR_3 = ptr = pl_copy.value.booleans; } g_assert_cmpint(!!pt->value.boolean, ==, !!ptr->value); break; } default: g_assert_not_reached(); } VAR_4++; } while (VAR_3); g_assert_cmpint(VAR_4, ==, 33); VAR_1->cleanup(VAR_2); dealloc_helper(&pl, visit_primitive_list, &err); g_assert(!err); dealloc_helper(&pl_copy, visit_primitive_list, &err); g_assert(!err); g_free(args); }
[ "static void FUNC_0(gconstpointer VAR_0)\n{", "TestArgs *args = (TestArgs *) VAR_0;", "const SerializeOps *VAR_1 = args->VAR_1;", "PrimitiveType *pt = args->test_data;", "PrimitiveList pl = { .value = { NULL } };", "PrimitiveList pl_copy = { .value = { NULL } };", "PrimitiveList *pl_copy_ptr = &pl_copy;", "Error *err = NULL;", "void *VAR_2;", "void *VAR_3 = NULL;", "int VAR_4;", "pl.type = pl_copy.type = pt->type;", "for (VAR_4 = 0; VAR_4 < 32; VAR_4++) {", "switch (pl.type) {", "case PTYPE_STRING: {", "strList *tmp = g_new0(strList, 1);", "tmp->value = g_strdup(pt->value.string);", "if (pl.value.strings == NULL) {", "pl.value.strings = tmp;", "} else {", "tmp->next = pl.value.strings;", "pl.value.strings = tmp;", "}", "break;", "}", "case PTYPE_INTEGER: {", "intList *tmp = g_new0(intList, 1);", "tmp->value = pt->value.integer;", "if (pl.value.integers == NULL) {", "pl.value.integers = tmp;", "} else {", "tmp->next = pl.value.integers;", "pl.value.integers = tmp;", "}", "break;", "}", "case PTYPE_S8: {", "int8List *tmp = g_new0(int8List, 1);", "tmp->value = pt->value.s8;", "if (pl.value.s8_integers == NULL) {", "pl.value.s8_integers = tmp;", "} else {", "tmp->next = pl.value.s8_integers;", "pl.value.s8_integers = tmp;", "}", "break;", "}", "case PTYPE_S16: {", "int16List *tmp = g_new0(int16List, 1);", "tmp->value = pt->value.s16;", "if (pl.value.s16_integers == NULL) {", "pl.value.s16_integers = tmp;", "} else {", "tmp->next = pl.value.s16_integers;", "pl.value.s16_integers = tmp;", "}", "break;", "}", "case PTYPE_S32: {", "int32List *tmp = g_new0(int32List, 1);", "tmp->value = pt->value.s32;", "if (pl.value.s32_integers == NULL) {", "pl.value.s32_integers = tmp;", "} else {", "tmp->next = pl.value.s32_integers;", "pl.value.s32_integers = tmp;", "}", "break;", "}", "case PTYPE_S64: {", "int64List *tmp = g_new0(int64List, 1);", "tmp->value = pt->value.s64;", "if (pl.value.s64_integers == NULL) {", "pl.value.s64_integers = tmp;", "} else {", "tmp->next = pl.value.s64_integers;", "pl.value.s64_integers = tmp;", "}", "break;", "}", "case PTYPE_U8: {", "uint8List *tmp = g_new0(uint8List, 1);", "tmp->value = pt->value.u8;", "if (pl.value.u8_integers == NULL) {", "pl.value.u8_integers = tmp;", "} else {", "tmp->next = pl.value.u8_integers;", "pl.value.u8_integers = tmp;", "}", "break;", "}", "case PTYPE_U16: {", "uint16List *tmp = g_new0(uint16List, 1);", "tmp->value = pt->value.u16;", "if (pl.value.u16_integers == NULL) {", "pl.value.u16_integers = tmp;", "} else {", "tmp->next = pl.value.u16_integers;", "pl.value.u16_integers = tmp;", "}", "break;", "}", "case PTYPE_U32: {", "uint32List *tmp = g_new0(uint32List, 1);", "tmp->value = pt->value.u32;", "if (pl.value.u32_integers == NULL) {", "pl.value.u32_integers = tmp;", "} else {", "tmp->next = pl.value.u32_integers;", "pl.value.u32_integers = tmp;", "}", "break;", "}", "case PTYPE_U64: {", "uint64List *tmp = g_new0(uint64List, 1);", "tmp->value = pt->value.u64;", "if (pl.value.u64_integers == NULL) {", "pl.value.u64_integers = tmp;", "} else {", "tmp->next = pl.value.u64_integers;", "pl.value.u64_integers = tmp;", "}", "break;", "}", "case PTYPE_NUMBER: {", "numberList *tmp = g_new0(numberList, 1);", "tmp->value = pt->value.number;", "if (pl.value.numbers == NULL) {", "pl.value.numbers = tmp;", "} else {", "tmp->next = pl.value.numbers;", "pl.value.numbers = tmp;", "}", "break;", "}", "case PTYPE_BOOLEAN: {", "boolList *tmp = g_new0(boolList, 1);", "tmp->value = pt->value.boolean;", "if (pl.value.booleans == NULL) {", "pl.value.booleans = tmp;", "} else {", "tmp->next = pl.value.booleans;", "pl.value.booleans = tmp;", "}", "break;", "}", "default:\ng_assert_not_reached();", "}", "}", "VAR_1->serialize((void **)&pl, &VAR_2, visit_primitive_list, &err);", "VAR_1->deserialize((void **)&pl_copy_ptr, VAR_2, visit_primitive_list, &err);", "g_assert(err == NULL);", "VAR_4 = 0;", "do {", "switch (pl_copy.type) {", "case PTYPE_STRING: {", "strList *ptr;", "if (VAR_3) {", "ptr = VAR_3;", "VAR_3 = ptr->next;", "} else {", "VAR_3 = ptr = pl_copy.value.strings;", "}", "g_assert_cmpstr(pt->value.string, ==, ptr->value);", "break;", "}", "case PTYPE_INTEGER: {", "intList *ptr;", "if (VAR_3) {", "ptr = VAR_3;", "VAR_3 = ptr->next;", "} else {", "VAR_3 = ptr = pl_copy.value.integers;", "}", "g_assert_cmpint(pt->value.integer, ==, ptr->value);", "break;", "}", "case PTYPE_S8: {", "int8List *ptr;", "if (VAR_3) {", "ptr = VAR_3;", "VAR_3 = ptr->next;", "} else {", "VAR_3 = ptr = pl_copy.value.s8_integers;", "}", "g_assert_cmpint(pt->value.s8, ==, ptr->value);", "break;", "}", "case PTYPE_S16: {", "int16List *ptr;", "if (VAR_3) {", "ptr = VAR_3;", "VAR_3 = ptr->next;", "} else {", "VAR_3 = ptr = pl_copy.value.s16_integers;", "}", "g_assert_cmpint(pt->value.s16, ==, ptr->value);", "break;", "}", "case PTYPE_S32: {", "int32List *ptr;", "if (VAR_3) {", "ptr = VAR_3;", "VAR_3 = ptr->next;", "} else {", "VAR_3 = ptr = pl_copy.value.s32_integers;", "}", "g_assert_cmpint(pt->value.s32, ==, ptr->value);", "break;", "}", "case PTYPE_S64: {", "int64List *ptr;", "if (VAR_3) {", "ptr = VAR_3;", "VAR_3 = ptr->next;", "} else {", "VAR_3 = ptr = pl_copy.value.s64_integers;", "}", "g_assert_cmpint(pt->value.s64, ==, ptr->value);", "break;", "}", "case PTYPE_U8: {", "uint8List *ptr;", "if (VAR_3) {", "ptr = VAR_3;", "VAR_3 = ptr->next;", "} else {", "VAR_3 = ptr = pl_copy.value.u8_integers;", "}", "g_assert_cmpint(pt->value.u8, ==, ptr->value);", "break;", "}", "case PTYPE_U16: {", "uint16List *ptr;", "if (VAR_3) {", "ptr = VAR_3;", "VAR_3 = ptr->next;", "} else {", "VAR_3 = ptr = pl_copy.value.u16_integers;", "}", "g_assert_cmpint(pt->value.u16, ==, ptr->value);", "break;", "}", "case PTYPE_U32: {", "uint32List *ptr;", "if (VAR_3) {", "ptr = VAR_3;", "VAR_3 = ptr->next;", "} else {", "VAR_3 = ptr = pl_copy.value.u32_integers;", "}", "g_assert_cmpint(pt->value.u32, ==, ptr->value);", "break;", "}", "case PTYPE_U64: {", "uint64List *ptr;", "if (VAR_3) {", "ptr = VAR_3;", "VAR_3 = ptr->next;", "} else {", "VAR_3 = ptr = pl_copy.value.u64_integers;", "}", "g_assert_cmpint(pt->value.u64, ==, ptr->value);", "break;", "}", "case PTYPE_NUMBER: {", "numberList *ptr;", "GString *double_expected = g_string_new(\"\");", "GString *double_actual = g_string_new(\"\");", "if (VAR_3) {", "ptr = VAR_3;", "VAR_3 = ptr->next;", "} else {", "VAR_3 = ptr = pl_copy.value.numbers;", "}", "g_string_printf(double_expected, \"%.6f\", pt->value.number);", "g_string_printf(double_actual, \"%.6f\", ptr->value);", "g_assert_cmpstr(double_actual->str, ==, double_expected->str);", "g_string_free(double_expected, true);", "g_string_free(double_actual, true);", "break;", "}", "case PTYPE_BOOLEAN: {", "boolList *ptr;", "if (VAR_3) {", "ptr = VAR_3;", "VAR_3 = ptr->next;", "} else {", "VAR_3 = ptr = pl_copy.value.booleans;", "}", "g_assert_cmpint(!!pt->value.boolean, ==, !!ptr->value);", "break;", "}", "default:\ng_assert_not_reached();", "}", "VAR_4++;", "} while (VAR_3);", "g_assert_cmpint(VAR_4, ==, 33);", "VAR_1->cleanup(VAR_2);", "dealloc_helper(&pl, visit_primitive_list, &err);", "g_assert(!err);", "dealloc_helper(&pl_copy, visit_primitive_list, &err);", "g_assert(!err);", "g_free(args);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301, 303 ], [ 305 ], [ 307 ], [ 311 ], [ 313 ], [ 317 ], [ 319 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613, 615 ], [ 617 ], [ 619 ], [ 621 ], [ 625 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ] ]
788
static struct omap_pwl_s *omap_pwl_init(MemoryRegion *system_memory, target_phys_addr_t base, omap_clk clk) { struct omap_pwl_s *s = g_malloc0(sizeof(*s)); omap_pwl_reset(s); memory_region_init_io(&s->iomem, &omap_pwl_ops, s, "omap-pwl", 0x800); memory_region_add_subregion(system_memory, base, &s->iomem); omap_clk_adduser(clk, qemu_allocate_irqs(omap_pwl_clk_update, s, 1)[0]); return s; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static struct omap_pwl_s *omap_pwl_init(MemoryRegion *system_memory, target_phys_addr_t base, omap_clk clk) { struct omap_pwl_s *s = g_malloc0(sizeof(*s)); omap_pwl_reset(s); memory_region_init_io(&s->iomem, &omap_pwl_ops, s, "omap-pwl", 0x800); memory_region_add_subregion(system_memory, base, &s->iomem); omap_clk_adduser(clk, qemu_allocate_irqs(omap_pwl_clk_update, s, 1)[0]); return s; }
{ "code": [], "line_no": [] }
static struct omap_pwl_s *FUNC_0(MemoryRegion *VAR_0, target_phys_addr_t VAR_1, omap_clk VAR_2) { struct omap_pwl_s *VAR_3 = g_malloc0(sizeof(*VAR_3)); omap_pwl_reset(VAR_3); memory_region_init_io(&VAR_3->iomem, &omap_pwl_ops, VAR_3, "omap-pwl", 0x800); memory_region_add_subregion(VAR_0, VAR_1, &VAR_3->iomem); omap_clk_adduser(VAR_2, qemu_allocate_irqs(omap_pwl_clk_update, VAR_3, 1)[0]); return VAR_3; }
[ "static struct omap_pwl_s *FUNC_0(MemoryRegion *VAR_0,\ntarget_phys_addr_t VAR_1,\nomap_clk VAR_2)\n{", "struct omap_pwl_s *VAR_3 = g_malloc0(sizeof(*VAR_3));", "omap_pwl_reset(VAR_3);", "memory_region_init_io(&VAR_3->iomem, &omap_pwl_ops, VAR_3,\n\"omap-pwl\", 0x800);", "memory_region_add_subregion(VAR_0, VAR_1, &VAR_3->iomem);", "omap_clk_adduser(VAR_2, qemu_allocate_irqs(omap_pwl_clk_update, VAR_3, 1)[0]);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ] ]
789
static void gem_transmit(GemState *s) { unsigned desc[2]; target_phys_addr_t packet_desc_addr; uint8_t tx_packet[2048]; uint8_t *p; unsigned total_bytes; /* Do nothing if transmit is not enabled. */ if (!(s->regs[GEM_NWCTRL] & GEM_NWCTRL_TXENA)) { return; } DB_PRINT("\n"); /* The packet we will hand off to qemu. * Packets scattered across multiple descriptors are gathered to this * one contiguous buffer first. */ p = tx_packet; total_bytes = 0; /* read current descriptor */ packet_desc_addr = s->tx_desc_addr; cpu_physical_memory_read(packet_desc_addr, (uint8_t *)&desc[0], sizeof(desc)); /* Handle all descriptors owned by hardware */ while (tx_desc_get_used(desc) == 0) { /* Do nothing if transmit is not enabled. */ if (!(s->regs[GEM_NWCTRL] & GEM_NWCTRL_TXENA)) { return; } print_gem_tx_desc(desc); /* The real hardware would eat this (and possibly crash). * For QEMU let's lend a helping hand. */ if ((tx_desc_get_buffer(desc) == 0) || (tx_desc_get_length(desc) == 0)) { DB_PRINT("Invalid TX descriptor @ 0x%x\n", packet_desc_addr); break; } /* Gather this fragment of the packet from "dma memory" to our contig. * buffer. */ cpu_physical_memory_read(tx_desc_get_buffer(desc), p, tx_desc_get_length(desc)); p += tx_desc_get_length(desc); total_bytes += tx_desc_get_length(desc); /* Last descriptor for this packet; hand the whole thing off */ if (tx_desc_get_last(desc)) { /* Modify the 1st descriptor of this packet to be owned by * the processor. */ cpu_physical_memory_read(s->tx_desc_addr, (uint8_t *)&desc[0], sizeof(desc)); tx_desc_set_used(desc); cpu_physical_memory_write(s->tx_desc_addr, (uint8_t *)&desc[0], sizeof(desc)); /* Advance the hardare current descriptor past this packet */ if (tx_desc_get_wrap(desc)) { s->tx_desc_addr = s->regs[GEM_TXQBASE]; } else { s->tx_desc_addr = packet_desc_addr + 8; } DB_PRINT("TX descriptor next: 0x%08x\n", s->tx_desc_addr); s->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_TXCMPL; /* Handle interrupt consequences */ gem_update_int_status(s); /* Is checksum offload enabled? */ if (s->regs[GEM_DMACFG] & GEM_DMACFG_TXCSUM_OFFL) { net_checksum_calculate(tx_packet, total_bytes); } /* Update MAC statistics */ gem_transmit_updatestats(s, tx_packet, total_bytes); /* Send the packet somewhere */ if (s->phy_loop) { gem_receive(&s->nic->nc, tx_packet, total_bytes); } else { qemu_send_packet(&s->nic->nc, tx_packet, total_bytes); } /* Prepare for next packet */ p = tx_packet; total_bytes = 0; } /* read next descriptor */ if (tx_desc_get_wrap(desc)) { packet_desc_addr = s->regs[GEM_TXQBASE]; } else { packet_desc_addr += 8; } cpu_physical_memory_read(packet_desc_addr, (uint8_t *)&desc[0], sizeof(desc)); } if (tx_desc_get_used(desc)) { s->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_USED; gem_update_int_status(s); } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void gem_transmit(GemState *s) { unsigned desc[2]; target_phys_addr_t packet_desc_addr; uint8_t tx_packet[2048]; uint8_t *p; unsigned total_bytes; if (!(s->regs[GEM_NWCTRL] & GEM_NWCTRL_TXENA)) { return; } DB_PRINT("\n"); p = tx_packet; total_bytes = 0; packet_desc_addr = s->tx_desc_addr; cpu_physical_memory_read(packet_desc_addr, (uint8_t *)&desc[0], sizeof(desc)); while (tx_desc_get_used(desc) == 0) { if (!(s->regs[GEM_NWCTRL] & GEM_NWCTRL_TXENA)) { return; } print_gem_tx_desc(desc); if ((tx_desc_get_buffer(desc) == 0) || (tx_desc_get_length(desc) == 0)) { DB_PRINT("Invalid TX descriptor @ 0x%x\n", packet_desc_addr); break; } cpu_physical_memory_read(tx_desc_get_buffer(desc), p, tx_desc_get_length(desc)); p += tx_desc_get_length(desc); total_bytes += tx_desc_get_length(desc); if (tx_desc_get_last(desc)) { cpu_physical_memory_read(s->tx_desc_addr, (uint8_t *)&desc[0], sizeof(desc)); tx_desc_set_used(desc); cpu_physical_memory_write(s->tx_desc_addr, (uint8_t *)&desc[0], sizeof(desc)); if (tx_desc_get_wrap(desc)) { s->tx_desc_addr = s->regs[GEM_TXQBASE]; } else { s->tx_desc_addr = packet_desc_addr + 8; } DB_PRINT("TX descriptor next: 0x%08x\n", s->tx_desc_addr); s->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_TXCMPL; gem_update_int_status(s); if (s->regs[GEM_DMACFG] & GEM_DMACFG_TXCSUM_OFFL) { net_checksum_calculate(tx_packet, total_bytes); } gem_transmit_updatestats(s, tx_packet, total_bytes); if (s->phy_loop) { gem_receive(&s->nic->nc, tx_packet, total_bytes); } else { qemu_send_packet(&s->nic->nc, tx_packet, total_bytes); } p = tx_packet; total_bytes = 0; } if (tx_desc_get_wrap(desc)) { packet_desc_addr = s->regs[GEM_TXQBASE]; } else { packet_desc_addr += 8; } cpu_physical_memory_read(packet_desc_addr, (uint8_t *)&desc[0], sizeof(desc)); } if (tx_desc_get_used(desc)) { s->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_USED; gem_update_int_status(s); } }
{ "code": [], "line_no": [] }
static void FUNC_0(GemState *VAR_0) { unsigned VAR_1[2]; target_phys_addr_t packet_desc_addr; uint8_t tx_packet[2048]; uint8_t *p; unsigned VAR_2; if (!(VAR_0->regs[GEM_NWCTRL] & GEM_NWCTRL_TXENA)) { return; } DB_PRINT("\n"); p = tx_packet; VAR_2 = 0; packet_desc_addr = VAR_0->tx_desc_addr; cpu_physical_memory_read(packet_desc_addr, (uint8_t *)&VAR_1[0], sizeof(VAR_1)); while (tx_desc_get_used(VAR_1) == 0) { if (!(VAR_0->regs[GEM_NWCTRL] & GEM_NWCTRL_TXENA)) { return; } print_gem_tx_desc(VAR_1); if ((tx_desc_get_buffer(VAR_1) == 0) || (tx_desc_get_length(VAR_1) == 0)) { DB_PRINT("Invalid TX descriptor @ 0x%x\n", packet_desc_addr); break; } cpu_physical_memory_read(tx_desc_get_buffer(VAR_1), p, tx_desc_get_length(VAR_1)); p += tx_desc_get_length(VAR_1); VAR_2 += tx_desc_get_length(VAR_1); if (tx_desc_get_last(VAR_1)) { cpu_physical_memory_read(VAR_0->tx_desc_addr, (uint8_t *)&VAR_1[0], sizeof(VAR_1)); tx_desc_set_used(VAR_1); cpu_physical_memory_write(VAR_0->tx_desc_addr, (uint8_t *)&VAR_1[0], sizeof(VAR_1)); if (tx_desc_get_wrap(VAR_1)) { VAR_0->tx_desc_addr = VAR_0->regs[GEM_TXQBASE]; } else { VAR_0->tx_desc_addr = packet_desc_addr + 8; } DB_PRINT("TX descriptor next: 0x%08x\n", VAR_0->tx_desc_addr); VAR_0->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_TXCMPL; gem_update_int_status(VAR_0); if (VAR_0->regs[GEM_DMACFG] & GEM_DMACFG_TXCSUM_OFFL) { net_checksum_calculate(tx_packet, VAR_2); } gem_transmit_updatestats(VAR_0, tx_packet, VAR_2); if (VAR_0->phy_loop) { gem_receive(&VAR_0->nic->nc, tx_packet, VAR_2); } else { qemu_send_packet(&VAR_0->nic->nc, tx_packet, VAR_2); } p = tx_packet; VAR_2 = 0; } if (tx_desc_get_wrap(VAR_1)) { packet_desc_addr = VAR_0->regs[GEM_TXQBASE]; } else { packet_desc_addr += 8; } cpu_physical_memory_read(packet_desc_addr, (uint8_t *)&VAR_1[0], sizeof(VAR_1)); } if (tx_desc_get_used(VAR_1)) { VAR_0->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_USED; gem_update_int_status(VAR_0); } }
[ "static void FUNC_0(GemState *VAR_0)\n{", "unsigned VAR_1[2];", "target_phys_addr_t packet_desc_addr;", "uint8_t tx_packet[2048];", "uint8_t *p;", "unsigned VAR_2;", "if (!(VAR_0->regs[GEM_NWCTRL] & GEM_NWCTRL_TXENA)) {", "return;", "}", "DB_PRINT(\"\\n\");", "p = tx_packet;", "VAR_2 = 0;", "packet_desc_addr = VAR_0->tx_desc_addr;", "cpu_physical_memory_read(packet_desc_addr,\n(uint8_t *)&VAR_1[0], sizeof(VAR_1));", "while (tx_desc_get_used(VAR_1) == 0) {", "if (!(VAR_0->regs[GEM_NWCTRL] & GEM_NWCTRL_TXENA)) {", "return;", "}", "print_gem_tx_desc(VAR_1);", "if ((tx_desc_get_buffer(VAR_1) == 0) ||\n(tx_desc_get_length(VAR_1) == 0)) {", "DB_PRINT(\"Invalid TX descriptor @ 0x%x\\n\", packet_desc_addr);", "break;", "}", "cpu_physical_memory_read(tx_desc_get_buffer(VAR_1), p,\ntx_desc_get_length(VAR_1));", "p += tx_desc_get_length(VAR_1);", "VAR_2 += tx_desc_get_length(VAR_1);", "if (tx_desc_get_last(VAR_1)) {", "cpu_physical_memory_read(VAR_0->tx_desc_addr,\n(uint8_t *)&VAR_1[0], sizeof(VAR_1));", "tx_desc_set_used(VAR_1);", "cpu_physical_memory_write(VAR_0->tx_desc_addr,\n(uint8_t *)&VAR_1[0], sizeof(VAR_1));", "if (tx_desc_get_wrap(VAR_1)) {", "VAR_0->tx_desc_addr = VAR_0->regs[GEM_TXQBASE];", "} else {", "VAR_0->tx_desc_addr = packet_desc_addr + 8;", "}", "DB_PRINT(\"TX descriptor next: 0x%08x\\n\", VAR_0->tx_desc_addr);", "VAR_0->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_TXCMPL;", "gem_update_int_status(VAR_0);", "if (VAR_0->regs[GEM_DMACFG] & GEM_DMACFG_TXCSUM_OFFL) {", "net_checksum_calculate(tx_packet, VAR_2);", "}", "gem_transmit_updatestats(VAR_0, tx_packet, VAR_2);", "if (VAR_0->phy_loop) {", "gem_receive(&VAR_0->nic->nc, tx_packet, VAR_2);", "} else {", "qemu_send_packet(&VAR_0->nic->nc, tx_packet, VAR_2);", "}", "p = tx_packet;", "VAR_2 = 0;", "}", "if (tx_desc_get_wrap(VAR_1)) {", "packet_desc_addr = VAR_0->regs[GEM_TXQBASE];", "} else {", "packet_desc_addr += 8;", "}", "cpu_physical_memory_read(packet_desc_addr,\n(uint8_t *)&VAR_1[0], sizeof(VAR_1));", "}", "if (tx_desc_get_used(VAR_1)) {", "VAR_0->regs[GEM_TXSTATUS] |= GEM_TXSTATUS_USED;", "gem_update_int_status(VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 39 ], [ 41 ], [ 47 ], [ 49, 51 ], [ 55 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 107 ], [ 115, 117 ], [ 119 ], [ 121, 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 147 ], [ 153 ], [ 155 ], [ 157 ], [ 163 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 183 ], [ 185 ], [ 187 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ] ]
790
static void rx_init_frame(eTSEC *etsec, const uint8_t *buf, size_t size) { uint32_t fcb_size = 0; uint8_t prsdep = (etsec->regs[RCTRL].value >> RCTRL_PRSDEP_OFFSET) & RCTRL_PRSDEP_MASK; if (prsdep != 0) { /* Prepend FCB (FCB size + RCTRL[PAL]) */ fcb_size = 8 + ((etsec->regs[RCTRL].value >> 16) & 0x1F); etsec->rx_fcb_size = fcb_size; /* TODO: fill_FCB(etsec); */ memset(etsec->rx_fcb, 0x0, sizeof(etsec->rx_fcb)); } else { etsec->rx_fcb_size = 0; } if (etsec->rx_buffer != NULL) { g_free(etsec->rx_buffer); } /* Do not copy the frame for now */ etsec->rx_buffer = (uint8_t *)buf; etsec->rx_buffer_len = size; /* CRC padding (We don't have to compute the CRC) */ etsec->rx_padding = 4; etsec->rx_first_in_frame = 1; etsec->rx_remaining_data = etsec->rx_buffer_len; RING_DEBUG("%s: rx_buffer_len:%u rx_padding+crc:%u\n", __func__, etsec->rx_buffer_len, etsec->rx_padding); }
false
qemu
ef1e1e0782e99c9dcf2b35e5310cdd8ca9211374
static void rx_init_frame(eTSEC *etsec, const uint8_t *buf, size_t size) { uint32_t fcb_size = 0; uint8_t prsdep = (etsec->regs[RCTRL].value >> RCTRL_PRSDEP_OFFSET) & RCTRL_PRSDEP_MASK; if (prsdep != 0) { fcb_size = 8 + ((etsec->regs[RCTRL].value >> 16) & 0x1F); etsec->rx_fcb_size = fcb_size; memset(etsec->rx_fcb, 0x0, sizeof(etsec->rx_fcb)); } else { etsec->rx_fcb_size = 0; } if (etsec->rx_buffer != NULL) { g_free(etsec->rx_buffer); } etsec->rx_buffer = (uint8_t *)buf; etsec->rx_buffer_len = size; etsec->rx_padding = 4; etsec->rx_first_in_frame = 1; etsec->rx_remaining_data = etsec->rx_buffer_len; RING_DEBUG("%s: rx_buffer_len:%u rx_padding+crc:%u\n", __func__, etsec->rx_buffer_len, etsec->rx_padding); }
{ "code": [], "line_no": [] }
static void FUNC_0(eTSEC *VAR_0, const uint8_t *VAR_1, size_t VAR_2) { uint32_t fcb_size = 0; uint8_t prsdep = (VAR_0->regs[RCTRL].value >> RCTRL_PRSDEP_OFFSET) & RCTRL_PRSDEP_MASK; if (prsdep != 0) { fcb_size = 8 + ((VAR_0->regs[RCTRL].value >> 16) & 0x1F); VAR_0->rx_fcb_size = fcb_size; memset(VAR_0->rx_fcb, 0x0, sizeof(VAR_0->rx_fcb)); } else { VAR_0->rx_fcb_size = 0; } if (VAR_0->rx_buffer != NULL) { g_free(VAR_0->rx_buffer); } VAR_0->rx_buffer = (uint8_t *)VAR_1; VAR_0->rx_buffer_len = VAR_2; VAR_0->rx_padding = 4; VAR_0->rx_first_in_frame = 1; VAR_0->rx_remaining_data = VAR_0->rx_buffer_len; RING_DEBUG("%s: rx_buffer_len:%u rx_padding+crc:%u\n", __func__, VAR_0->rx_buffer_len, VAR_0->rx_padding); }
[ "static void FUNC_0(eTSEC *VAR_0, const uint8_t *VAR_1, size_t VAR_2)\n{", "uint32_t fcb_size = 0;", "uint8_t prsdep = (VAR_0->regs[RCTRL].value >> RCTRL_PRSDEP_OFFSET)\n& RCTRL_PRSDEP_MASK;", "if (prsdep != 0) {", "fcb_size = 8 + ((VAR_0->regs[RCTRL].value >> 16) & 0x1F);", "VAR_0->rx_fcb_size = fcb_size;", "memset(VAR_0->rx_fcb, 0x0, sizeof(VAR_0->rx_fcb));", "} else {", "VAR_0->rx_fcb_size = 0;", "}", "if (VAR_0->rx_buffer != NULL) {", "g_free(VAR_0->rx_buffer);", "}", "VAR_0->rx_buffer = (uint8_t *)VAR_1;", "VAR_0->rx_buffer_len = VAR_2;", "VAR_0->rx_padding = 4;", "VAR_0->rx_first_in_frame = 1;", "VAR_0->rx_remaining_data = VAR_0->rx_buffer_len;", "RING_DEBUG(\"%s: rx_buffer_len:%u rx_padding+crc:%u\\n\", __func__,\nVAR_0->rx_buffer_len, VAR_0->rx_padding);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13 ], [ 17 ], [ 21 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 57 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ] ]
791
static uint32_t qpci_spapr_io_readl(QPCIBus *bus, void *addr) { QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus); uint64_t port = (uintptr_t)addr; uint32_t v; if (port < s->pio.size) { v = readl(s->pio_cpu_base + port); } else { v = readl(s->mmio_cpu_base + port); } return bswap32(v); }
false
qemu
8360544a6d3a54df1fce80f55ba4ad075a8ded54
static uint32_t qpci_spapr_io_readl(QPCIBus *bus, void *addr) { QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus); uint64_t port = (uintptr_t)addr; uint32_t v; if (port < s->pio.size) { v = readl(s->pio_cpu_base + port); } else { v = readl(s->mmio_cpu_base + port); } return bswap32(v); }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(QPCIBus *bus, void *addr) { QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus); uint64_t port = (uintptr_t)addr; uint32_t v; if (port < s->pio.size) { v = readl(s->pio_cpu_base + port); } else { v = readl(s->mmio_cpu_base + port); } return bswap32(v); }
[ "static uint32_t FUNC_0(QPCIBus *bus, void *addr)\n{", "QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus);", "uint64_t port = (uintptr_t)addr;", "uint32_t v;", "if (port < s->pio.size) {", "v = readl(s->pio_cpu_base + port);", "} else {", "v = readl(s->mmio_cpu_base + port);", "}", "return bswap32(v);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
792
void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) { #if defined(TARGET_MIPS) || defined(TARGET_SH4) CPUArchState *env = cpu->env_ptr; #endif TranslationBlock *tb; uint32_t n, cflags; target_ulong pc, cs_base; uint32_t flags; tb_lock(); tb = tb_find_pc(retaddr); if (!tb) { cpu_abort(cpu, "cpu_io_recompile: could not find TB for pc=%p", (void *)retaddr); } n = cpu->icount_decr.u16.low + tb->icount; cpu_restore_state_from_tb(cpu, tb, retaddr); /* Calculate how many instructions had been executed before the fault occurred. */ n = n - cpu->icount_decr.u16.low; /* Generate a new TB ending on the I/O insn. */ n++; /* On MIPS and SH, delay slot instructions can only be restarted if they were already the first instruction in the TB. If this is not the first instruction in a TB then re-execute the preceding branch. */ #if defined(TARGET_MIPS) if ((env->hflags & MIPS_HFLAG_BMASK) != 0 && n > 1) { env->active_tc.PC -= (env->hflags & MIPS_HFLAG_B16 ? 2 : 4); cpu->icount_decr.u16.low++; env->hflags &= ~MIPS_HFLAG_BMASK; } #elif defined(TARGET_SH4) if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) != 0 && n > 1) { env->pc -= 2; cpu->icount_decr.u16.low++; env->flags &= ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL); } #endif /* This should never happen. */ if (n > CF_COUNT_MASK) { cpu_abort(cpu, "TB too big during recompile"); } cflags = n | CF_LAST_IO; cflags |= curr_cflags(); pc = tb->pc; cs_base = tb->cs_base; flags = tb->flags; tb_phys_invalidate(tb, -1); if (tb->cflags & CF_NOCACHE) { if (tb->orig_tb) { /* Invalidate original TB if this TB was generated in * cpu_exec_nocache() */ tb_phys_invalidate(tb->orig_tb, -1); } tb_free(tb); } /* FIXME: In theory this could raise an exception. In practice we have already translated the block once so it's probably ok. */ tb_gen_code(cpu, pc, cs_base, flags, cflags); /* TODO: If env->pc != tb->pc (i.e. the faulting instruction was not * the first in the TB) then we end up generating a whole new TB and * repeating the fault, which is horribly inefficient. * Better would be to execute just this insn uncached, or generate a * second new TB. * * cpu_loop_exit_noexc will longjmp back to cpu_exec where the * tb_lock gets reset. */ cpu_loop_exit_noexc(cpu); }
false
qemu
9b990ee5a3cc6aa38f81266fb0c6ef37a36c45b9
void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) { #if defined(TARGET_MIPS) || defined(TARGET_SH4) CPUArchState *env = cpu->env_ptr; #endif TranslationBlock *tb; uint32_t n, cflags; target_ulong pc, cs_base; uint32_t flags; tb_lock(); tb = tb_find_pc(retaddr); if (!tb) { cpu_abort(cpu, "cpu_io_recompile: could not find TB for pc=%p", (void *)retaddr); } n = cpu->icount_decr.u16.low + tb->icount; cpu_restore_state_from_tb(cpu, tb, retaddr); n = n - cpu->icount_decr.u16.low; n++; #if defined(TARGET_MIPS) if ((env->hflags & MIPS_HFLAG_BMASK) != 0 && n > 1) { env->active_tc.PC -= (env->hflags & MIPS_HFLAG_B16 ? 2 : 4); cpu->icount_decr.u16.low++; env->hflags &= ~MIPS_HFLAG_BMASK; } #elif defined(TARGET_SH4) if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) != 0 && n > 1) { env->pc -= 2; cpu->icount_decr.u16.low++; env->flags &= ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL); } #endif if (n > CF_COUNT_MASK) { cpu_abort(cpu, "TB too big during recompile"); } cflags = n | CF_LAST_IO; cflags |= curr_cflags(); pc = tb->pc; cs_base = tb->cs_base; flags = tb->flags; tb_phys_invalidate(tb, -1); if (tb->cflags & CF_NOCACHE) { if (tb->orig_tb) { tb_phys_invalidate(tb->orig_tb, -1); } tb_free(tb); } tb_gen_code(cpu, pc, cs_base, flags, cflags); cpu_loop_exit_noexc(cpu); }
{ "code": [], "line_no": [] }
void FUNC_0(CPUState *VAR_0, uintptr_t VAR_1) { #if defined(TARGET_MIPS) || defined(TARGET_SH4) CPUArchState *env = VAR_0->env_ptr; #endif TranslationBlock *tb; uint32_t n, cflags; target_ulong pc, cs_base; uint32_t flags; tb_lock(); tb = tb_find_pc(VAR_1); if (!tb) { cpu_abort(VAR_0, "FUNC_0: could not find TB for pc=%p", (void *)VAR_1); } n = VAR_0->icount_decr.u16.low + tb->icount; cpu_restore_state_from_tb(VAR_0, tb, VAR_1); n = n - VAR_0->icount_decr.u16.low; n++; #if defined(TARGET_MIPS) if ((env->hflags & MIPS_HFLAG_BMASK) != 0 && n > 1) { env->active_tc.PC -= (env->hflags & MIPS_HFLAG_B16 ? 2 : 4); VAR_0->icount_decr.u16.low++; env->hflags &= ~MIPS_HFLAG_BMASK; } #elif defined(TARGET_SH4) if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) != 0 && n > 1) { env->pc -= 2; VAR_0->icount_decr.u16.low++; env->flags &= ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL); } #endif if (n > CF_COUNT_MASK) { cpu_abort(VAR_0, "TB too big during recompile"); } cflags = n | CF_LAST_IO; cflags |= curr_cflags(); pc = tb->pc; cs_base = tb->cs_base; flags = tb->flags; tb_phys_invalidate(tb, -1); if (tb->cflags & CF_NOCACHE) { if (tb->orig_tb) { tb_phys_invalidate(tb->orig_tb, -1); } tb_free(tb); } tb_gen_code(VAR_0, pc, cs_base, flags, cflags); cpu_loop_exit_noexc(VAR_0); }
[ "void FUNC_0(CPUState *VAR_0, uintptr_t VAR_1)\n{", "#if defined(TARGET_MIPS) || defined(TARGET_SH4)\nCPUArchState *env = VAR_0->env_ptr;", "#endif\nTranslationBlock *tb;", "uint32_t n, cflags;", "target_ulong pc, cs_base;", "uint32_t flags;", "tb_lock();", "tb = tb_find_pc(VAR_1);", "if (!tb) {", "cpu_abort(VAR_0, \"FUNC_0: could not find TB for pc=%p\",\n(void *)VAR_1);", "}", "n = VAR_0->icount_decr.u16.low + tb->icount;", "cpu_restore_state_from_tb(VAR_0, tb, VAR_1);", "n = n - VAR_0->icount_decr.u16.low;", "n++;", "#if defined(TARGET_MIPS)\nif ((env->hflags & MIPS_HFLAG_BMASK) != 0 && n > 1) {", "env->active_tc.PC -= (env->hflags & MIPS_HFLAG_B16 ? 2 : 4);", "VAR_0->icount_decr.u16.low++;", "env->hflags &= ~MIPS_HFLAG_BMASK;", "}", "#elif defined(TARGET_SH4)\nif ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) != 0\n&& n > 1) {", "env->pc -= 2;", "VAR_0->icount_decr.u16.low++;", "env->flags &= ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL);", "}", "#endif\nif (n > CF_COUNT_MASK) {", "cpu_abort(VAR_0, \"TB too big during recompile\");", "}", "cflags = n | CF_LAST_IO;", "cflags |= curr_cflags();", "pc = tb->pc;", "cs_base = tb->cs_base;", "flags = tb->flags;", "tb_phys_invalidate(tb, -1);", "if (tb->cflags & CF_NOCACHE) {", "if (tb->orig_tb) {", "tb_phys_invalidate(tb->orig_tb, -1);", "}", "tb_free(tb);", "}", "tb_gen_code(VAR_0, pc, cs_base, flags, cflags);", "cpu_loop_exit_noexc(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 45 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 125 ], [ 147 ], [ 149 ] ]
793
START_TEST(unterminated_array) { QObject *obj = qobject_from_json("[32"); fail_unless(obj == NULL); }
false
qemu
ef76dc59fa5203d146a2acf85a0ad5a5971a4824
START_TEST(unterminated_array) { QObject *obj = qobject_from_json("[32"); fail_unless(obj == NULL); }
{ "code": [], "line_no": [] }
FUNC_0(VAR_0) { QObject *obj = qobject_from_json("[32"); fail_unless(obj == NULL); }
[ "FUNC_0(VAR_0)\n{", "QObject *obj = qobject_from_json(\"[32\");", "fail_unless(obj == NULL);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
796
static void imx_fec_reset(DeviceState *d) { IMXFECState *s = IMX_FEC(d); /* Reset the FEC */ s->eir = 0; s->eimr = 0; s->rx_enabled = 0; s->ecr = 0; s->mscr = 0; s->mibc = 0xc0000000; s->rcr = 0x05ee0001; s->tcr = 0; s->tfwr = 0; s->frsr = 0x500; s->miigsk_cfgr = 0; s->miigsk_enr = 0x6; /* We also reset the PHY */ phy_reset(s); }
false
qemu
ccdb81d3274d281d770703417257bd40bcdf4c0e
static void imx_fec_reset(DeviceState *d) { IMXFECState *s = IMX_FEC(d); s->eir = 0; s->eimr = 0; s->rx_enabled = 0; s->ecr = 0; s->mscr = 0; s->mibc = 0xc0000000; s->rcr = 0x05ee0001; s->tcr = 0; s->tfwr = 0; s->frsr = 0x500; s->miigsk_cfgr = 0; s->miigsk_enr = 0x6; phy_reset(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0) { IMXFECState *s = IMX_FEC(VAR_0); s->eir = 0; s->eimr = 0; s->rx_enabled = 0; s->ecr = 0; s->mscr = 0; s->mibc = 0xc0000000; s->rcr = 0x05ee0001; s->tcr = 0; s->tfwr = 0; s->frsr = 0x500; s->miigsk_cfgr = 0; s->miigsk_enr = 0x6; phy_reset(s); }
[ "static void FUNC_0(DeviceState *VAR_0)\n{", "IMXFECState *s = IMX_FEC(VAR_0);", "s->eir = 0;", "s->eimr = 0;", "s->rx_enabled = 0;", "s->ecr = 0;", "s->mscr = 0;", "s->mibc = 0xc0000000;", "s->rcr = 0x05ee0001;", "s->tcr = 0;", "s->tfwr = 0;", "s->frsr = 0x500;", "s->miigsk_cfgr = 0;", "s->miigsk_enr = 0x6;", "phy_reset(s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ] ]
798
struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta, BlockDriverState *bd, qemu_irq irq, qemu_irq dma[], omap_clk fclk, omap_clk iclk) { struct omap_mmc_s *s = (struct omap_mmc_s *) g_malloc0(sizeof(struct omap_mmc_s)); s->irq = irq; s->dma = dma; s->clk = fclk; s->lines = 4; s->rev = 2; omap_mmc_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_mmc_ops, s, "omap.mmc", omap_l4_region_size(ta, 0)); omap_l4_attach(ta, 0, &s->iomem); /* Instantiate the storage */ s->card = sd_init(bd, false); if (s->card == NULL) { exit(1); } s->cdet = qemu_allocate_irq(omap_mmc_cover_cb, s, 0); sd_set_cb(s->card, NULL, s->cdet); return s; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta, BlockDriverState *bd, qemu_irq irq, qemu_irq dma[], omap_clk fclk, omap_clk iclk) { struct omap_mmc_s *s = (struct omap_mmc_s *) g_malloc0(sizeof(struct omap_mmc_s)); s->irq = irq; s->dma = dma; s->clk = fclk; s->lines = 4; s->rev = 2; omap_mmc_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_mmc_ops, s, "omap.mmc", omap_l4_region_size(ta, 0)); omap_l4_attach(ta, 0, &s->iomem); s->card = sd_init(bd, false); if (s->card == NULL) { exit(1); } s->cdet = qemu_allocate_irq(omap_mmc_cover_cb, s, 0); sd_set_cb(s->card, NULL, s->cdet); return s; }
{ "code": [], "line_no": [] }
struct omap_mmc_s *FUNC_0(struct omap_target_agent_s *VAR_0, BlockDriverState *VAR_1, qemu_irq VAR_2, qemu_irq VAR_3[], omap_clk VAR_4, omap_clk VAR_5) { struct omap_mmc_s *VAR_6 = (struct omap_mmc_s *) g_malloc0(sizeof(struct omap_mmc_s)); VAR_6->VAR_2 = VAR_2; VAR_6->VAR_3 = VAR_3; VAR_6->clk = VAR_4; VAR_6->lines = 4; VAR_6->rev = 2; omap_mmc_reset(VAR_6); memory_region_init_io(&VAR_6->iomem, NULL, &omap_mmc_ops, VAR_6, "omap.mmc", omap_l4_region_size(VAR_0, 0)); omap_l4_attach(VAR_0, 0, &VAR_6->iomem); VAR_6->card = sd_init(VAR_1, false); if (VAR_6->card == NULL) { exit(1); } VAR_6->cdet = qemu_allocate_irq(omap_mmc_cover_cb, VAR_6, 0); sd_set_cb(VAR_6->card, NULL, VAR_6->cdet); return VAR_6; }
[ "struct omap_mmc_s *FUNC_0(struct omap_target_agent_s *VAR_0,\nBlockDriverState *VAR_1, qemu_irq VAR_2, qemu_irq VAR_3[],\nomap_clk VAR_4, omap_clk VAR_5)\n{", "struct omap_mmc_s *VAR_6 = (struct omap_mmc_s *)\ng_malloc0(sizeof(struct omap_mmc_s));", "VAR_6->VAR_2 = VAR_2;", "VAR_6->VAR_3 = VAR_3;", "VAR_6->clk = VAR_4;", "VAR_6->lines = 4;", "VAR_6->rev = 2;", "omap_mmc_reset(VAR_6);", "memory_region_init_io(&VAR_6->iomem, NULL, &omap_mmc_ops, VAR_6, \"omap.mmc\",\nomap_l4_region_size(VAR_0, 0));", "omap_l4_attach(VAR_0, 0, &VAR_6->iomem);", "VAR_6->card = sd_init(VAR_1, false);", "if (VAR_6->card == NULL) {", "exit(1);", "}", "VAR_6->cdet = qemu_allocate_irq(omap_mmc_cover_cb, VAR_6, 0);", "sd_set_cb(VAR_6->card, NULL, VAR_6->cdet);", "return VAR_6;", "}" ]
[ 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 ], [ 31, 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ] ]
799
int vmstate_register(int instance_id, const VMStateDescription *vmsd, void *opaque) { SaveStateEntry *se; se = qemu_malloc(sizeof(SaveStateEntry)); pstrcpy(se->idstr, sizeof(se->idstr), vmsd->name); se->version_id = vmsd->version_id; se->section_id = global_section_id++; se->save_live_state = NULL; se->save_state = NULL; se->load_state = NULL; se->opaque = opaque; se->vmsd = vmsd; if (instance_id == -1) { se->instance_id = calculate_new_instance_id(vmsd->name); } else { se->instance_id = instance_id; } /* add at the end of list */ TAILQ_INSERT_TAIL(&savevm_handlers, se, entry); return 0; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
int vmstate_register(int instance_id, const VMStateDescription *vmsd, void *opaque) { SaveStateEntry *se; se = qemu_malloc(sizeof(SaveStateEntry)); pstrcpy(se->idstr, sizeof(se->idstr), vmsd->name); se->version_id = vmsd->version_id; se->section_id = global_section_id++; se->save_live_state = NULL; se->save_state = NULL; se->load_state = NULL; se->opaque = opaque; se->vmsd = vmsd; if (instance_id == -1) { se->instance_id = calculate_new_instance_id(vmsd->name); } else { se->instance_id = instance_id; } TAILQ_INSERT_TAIL(&savevm_handlers, se, entry); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(int VAR_0, const VMStateDescription *VAR_1, void *VAR_2) { SaveStateEntry *se; se = qemu_malloc(sizeof(SaveStateEntry)); pstrcpy(se->idstr, sizeof(se->idstr), VAR_1->name); se->version_id = VAR_1->version_id; se->section_id = global_section_id++; se->save_live_state = NULL; se->save_state = NULL; se->load_state = NULL; se->VAR_2 = VAR_2; se->VAR_1 = VAR_1; if (VAR_0 == -1) { se->VAR_0 = calculate_new_instance_id(VAR_1->name); } else { se->VAR_0 = VAR_0; } TAILQ_INSERT_TAIL(&savevm_handlers, se, entry); return 0; }
[ "int FUNC_0(int VAR_0, const VMStateDescription *VAR_1,\nvoid *VAR_2)\n{", "SaveStateEntry *se;", "se = qemu_malloc(sizeof(SaveStateEntry));", "pstrcpy(se->idstr, sizeof(se->idstr), VAR_1->name);", "se->version_id = VAR_1->version_id;", "se->section_id = global_section_id++;", "se->save_live_state = NULL;", "se->save_state = NULL;", "se->load_state = NULL;", "se->VAR_2 = VAR_2;", "se->VAR_1 = VAR_1;", "if (VAR_0 == -1) {", "se->VAR_0 = calculate_new_instance_id(VAR_1->name);", "} else {", "se->VAR_0 = VAR_0;", "}", "TAILQ_INSERT_TAIL(&savevm_handlers, se, entry);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ] ]
800
bool qemu_clock_expired(QEMUClockType type) { return timerlist_expired( main_loop_tlg.tl[type]); }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
bool qemu_clock_expired(QEMUClockType type) { return timerlist_expired( main_loop_tlg.tl[type]); }
{ "code": [], "line_no": [] }
bool FUNC_0(QEMUClockType type) { return timerlist_expired( main_loop_tlg.tl[type]); }
[ "bool FUNC_0(QEMUClockType type)\n{", "return timerlist_expired(\nmain_loop_tlg.tl[type]);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ] ]
801
static int proxy_opendir(FsContext *ctx, V9fsPath *fs_path, V9fsFidOpenState *fs) { int serrno, fd; fs->dir = NULL; fd = v9fs_request(ctx->private, T_OPEN, NULL, "sd", fs_path, O_DIRECTORY); if (fd < 0) { errno = -fd; return -1; } fs->dir = fdopendir(fd); if (!fs->dir) { serrno = errno; close(fd); errno = serrno; return -1; } return 0; }
false
qemu
494a8ebe713055d3946183f4b395f85a18b43e9e
static int proxy_opendir(FsContext *ctx, V9fsPath *fs_path, V9fsFidOpenState *fs) { int serrno, fd; fs->dir = NULL; fd = v9fs_request(ctx->private, T_OPEN, NULL, "sd", fs_path, O_DIRECTORY); if (fd < 0) { errno = -fd; return -1; } fs->dir = fdopendir(fd); if (!fs->dir) { serrno = errno; close(fd); errno = serrno; return -1; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, V9fsFidOpenState *VAR_2) { int VAR_3, VAR_4; VAR_2->dir = NULL; VAR_4 = v9fs_request(VAR_0->private, T_OPEN, NULL, "sd", VAR_1, O_DIRECTORY); if (VAR_4 < 0) { errno = -VAR_4; return -1; } VAR_2->dir = fdopendir(VAR_4); if (!VAR_2->dir) { VAR_3 = errno; close(VAR_4); errno = VAR_3; return -1; } return 0; }
[ "static int FUNC_0(FsContext *VAR_0,\nV9fsPath *VAR_1, V9fsFidOpenState *VAR_2)\n{", "int VAR_3, VAR_4;", "VAR_2->dir = NULL;", "VAR_4 = v9fs_request(VAR_0->private, T_OPEN, NULL, \"sd\", VAR_1, O_DIRECTORY);", "if (VAR_4 < 0) {", "errno = -VAR_4;", "return -1;", "}", "VAR_2->dir = fdopendir(VAR_4);", "if (!VAR_2->dir) {", "VAR_3 = errno;", "close(VAR_4);", "errno = VAR_3;", "return -1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
802
static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint32_t rca = 0x0000; uint64_t addr = (sd->ocr & (1 << 30)) ? (uint64_t) req.arg << 9 : req.arg; /* Not interpreting this as an app command */ sd->card_status &= ~APP_CMD; if (sd_cmd_type[req.cmd] == sd_ac || sd_cmd_type[req.cmd] == sd_adtc) rca = req.arg >> 16; DPRINTF("CMD%d 0x%08x state %d\n", req.cmd, req.arg, sd->state); switch (req.cmd) { /* Basic commands (Class 0 and Class 1) */ case 0: /* CMD0: GO_IDLE_STATE */ switch (sd->state) { case sd_inactive_state: return sd->spi ? sd_r1 : sd_r0; default: sd->state = sd_idle_state; sd_reset(sd, sd->bdrv); return sd->spi ? sd_r1 : sd_r0; } break; case 1: /* CMD1: SEND_OP_CMD */ if (!sd->spi) goto bad_cmd; sd->state = sd_transfer_state; return sd_r1; case 2: /* CMD2: ALL_SEND_CID */ if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_ready_state: sd->state = sd_identification_state; return sd_r2_i; default: break; } break; case 3: /* CMD3: SEND_RELATIVE_ADDR */ if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_identification_state: case sd_standby_state: sd->state = sd_standby_state; sd_set_rca(sd); return sd_r6; default: break; } break; case 4: /* CMD4: SEND_DSR */ if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_standby_state: break; default: break; } break; case 5: /* CMD5: reserved for SDIO cards */ return sd_illegal; case 6: /* CMD6: SWITCH_FUNCTION */ if (sd->spi) goto bad_cmd; switch (sd->mode) { case sd_data_transfer_mode: sd_function_switch(sd, req.arg); sd->state = sd_sendingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 7: /* CMD7: SELECT/DESELECT_CARD */ if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_standby_state: if (sd->rca != rca) return sd_r0; sd->state = sd_transfer_state; return sd_r1b; case sd_transfer_state: case sd_sendingdata_state: if (sd->rca == rca) break; sd->state = sd_standby_state; return sd_r1b; case sd_disconnect_state: if (sd->rca != rca) return sd_r0; sd->state = sd_programming_state; return sd_r1b; case sd_programming_state: if (sd->rca == rca) break; sd->state = sd_disconnect_state; return sd_r1b; default: break; } break; case 8: /* CMD8: SEND_IF_COND */ /* Physical Layer Specification Version 2.00 command */ switch (sd->state) { case sd_idle_state: sd->vhs = 0; /* No response if not exactly one VHS bit is set. */ if (!(req.arg >> 8) || (req.arg >> ffs(req.arg & ~0xff))) return sd->spi ? sd_r7 : sd_r0; /* Accept. */ sd->vhs = req.arg; return sd_r7; default: break; } break; case 9: /* CMD9: SEND_CSD */ switch (sd->state) { case sd_standby_state: if (sd->rca != rca) return sd_r0; return sd_r2_s; case sd_transfer_state: if (!sd->spi) break; sd->state = sd_sendingdata_state; memcpy(sd->data, sd->csd, 16); sd->data_start = addr; sd->data_offset = 0; return sd_r1; default: break; } break; case 10: /* CMD10: SEND_CID */ switch (sd->state) { case sd_standby_state: if (sd->rca != rca) return sd_r0; return sd_r2_i; case sd_transfer_state: if (!sd->spi) break; sd->state = sd_sendingdata_state; memcpy(sd->data, sd->cid, 16); sd->data_start = addr; sd->data_offset = 0; return sd_r1; default: break; } break; case 11: /* CMD11: READ_DAT_UNTIL_STOP */ if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = req.arg; sd->data_offset = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; return sd_r0; default: break; } break; case 12: /* CMD12: STOP_TRANSMISSION */ switch (sd->state) { case sd_sendingdata_state: sd->state = sd_transfer_state; return sd_r1b; case sd_receivingdata_state: sd->state = sd_programming_state; /* Bzzzzzzztt .... Operation complete. */ sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 13: /* CMD13: SEND_STATUS */ switch (sd->mode) { case sd_data_transfer_mode: if (sd->rca != rca) return sd_r0; return sd_r1; default: break; } break; case 15: /* CMD15: GO_INACTIVE_STATE */ if (sd->spi) goto bad_cmd; switch (sd->mode) { case sd_data_transfer_mode: if (sd->rca != rca) return sd_r0; sd->state = sd_inactive_state; return sd_r0; default: break; } break; /* Block read commands (Classs 2) */ case 16: /* CMD16: SET_BLOCKLEN */ switch (sd->state) { case sd_transfer_state: if (req.arg > (1 << HWBLOCK_SHIFT)) sd->card_status |= BLOCK_LEN_ERROR; else sd->blk_len = req.arg; return sd_r1; default: break; } break; case 17: /* CMD17: READ_SINGLE_BLOCK */ switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = addr; sd->data_offset = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; return sd_r1; default: break; } break; case 18: /* CMD18: READ_MULTIPLE_BLOCK */ switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = addr; sd->data_offset = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; return sd_r1; default: break; } break; /* Block write commands (Class 4) */ case 24: /* CMD24: WRITE_SINGLE_BLOCK */ if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: /* Writing in SPI mode not implemented. */ if (sd->spi) break; sd->state = sd_receivingdata_state; sd->data_start = addr; sd->data_offset = 0; sd->blk_written = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; if (sd_wp_addr(sd, sd->data_start)) sd->card_status |= WP_VIOLATION; if (sd->csd[14] & 0x30) sd->card_status |= WP_VIOLATION; return sd_r1; default: break; } break; case 25: /* CMD25: WRITE_MULTIPLE_BLOCK */ if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: /* Writing in SPI mode not implemented. */ if (sd->spi) break; sd->state = sd_receivingdata_state; sd->data_start = addr; sd->data_offset = 0; sd->blk_written = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; if (sd_wp_addr(sd, sd->data_start)) sd->card_status |= WP_VIOLATION; if (sd->csd[14] & 0x30) sd->card_status |= WP_VIOLATION; return sd_r1; default: break; } break; case 26: /* CMD26: PROGRAM_CID */ if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 27: /* CMD27: PROGRAM_CSD */ if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; /* Write protection (Class 6) */ case 28: /* CMD28: SET_WRITE_PROT */ switch (sd->state) { case sd_transfer_state: if (addr >= sd->size) { sd->card_status |= ADDRESS_ERROR; return sd_r1b; } sd->state = sd_programming_state; set_bit(sd_addr_to_wpnum(addr), sd->wp_groups); /* Bzzzzzzztt .... Operation complete. */ sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 29: /* CMD29: CLR_WRITE_PROT */ switch (sd->state) { case sd_transfer_state: if (addr >= sd->size) { sd->card_status |= ADDRESS_ERROR; return sd_r1b; } sd->state = sd_programming_state; clear_bit(sd_addr_to_wpnum(addr), sd->wp_groups); /* Bzzzzzzztt .... Operation complete. */ sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 30: /* CMD30: SEND_WRITE_PROT */ switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; *(uint32_t *) sd->data = sd_wpbits(sd, req.arg); sd->data_start = addr; sd->data_offset = 0; return sd_r1b; default: break; } break; /* Erase commands (Class 5) */ case 32: /* CMD32: ERASE_WR_BLK_START */ switch (sd->state) { case sd_transfer_state: sd->erase_start = req.arg; return sd_r1; default: break; } break; case 33: /* CMD33: ERASE_WR_BLK_END */ switch (sd->state) { case sd_transfer_state: sd->erase_end = req.arg; return sd_r1; default: break; } break; case 38: /* CMD38: ERASE */ switch (sd->state) { case sd_transfer_state: if (sd->csd[14] & 0x30) { sd->card_status |= WP_VIOLATION; return sd_r1b; } sd->state = sd_programming_state; sd_erase(sd); /* Bzzzzzzztt .... Operation complete. */ sd->state = sd_transfer_state; return sd_r1b; default: break; } break; /* Lock card commands (Class 7) */ case 42: /* CMD42: LOCK_UNLOCK */ if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 52: case 53: /* CMD52, CMD53: reserved for SDIO cards * (see the SDIO Simplified Specification V2.0) * Handle as illegal command but do not complain * on stderr, as some OSes may use these in their * probing for presence of an SDIO card. */ return sd_illegal; /* Application specific commands (Class 8) */ case 55: /* CMD55: APP_CMD */ if (sd->rca != rca) return sd_r0; sd->expecting_acmd = true; sd->card_status |= APP_CMD; return sd_r1; case 56: /* CMD56: GEN_CMD */ fprintf(stderr, "SD: GEN_CMD 0x%08x\n", req.arg); switch (sd->state) { case sd_transfer_state: sd->data_offset = 0; if (req.arg & 1) sd->state = sd_sendingdata_state; else sd->state = sd_receivingdata_state; return sd_r1; default: break; } break; default: bad_cmd: fprintf(stderr, "SD: Unknown CMD%i\n", req.cmd); return sd_illegal; unimplemented_cmd: /* Commands that are recognised but not yet implemented in SPI mode. */ fprintf(stderr, "SD: CMD%i not implemented in SPI mode\n", req.cmd); return sd_illegal; } fprintf(stderr, "SD: CMD%i in a wrong state\n", req.cmd); return sd_illegal; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint32_t rca = 0x0000; uint64_t addr = (sd->ocr & (1 << 30)) ? (uint64_t) req.arg << 9 : req.arg; sd->card_status &= ~APP_CMD; if (sd_cmd_type[req.cmd] == sd_ac || sd_cmd_type[req.cmd] == sd_adtc) rca = req.arg >> 16; DPRINTF("CMD%d 0x%08x state %d\n", req.cmd, req.arg, sd->state); switch (req.cmd) { case 0: switch (sd->state) { case sd_inactive_state: return sd->spi ? sd_r1 : sd_r0; default: sd->state = sd_idle_state; sd_reset(sd, sd->bdrv); return sd->spi ? sd_r1 : sd_r0; } break; case 1: if (!sd->spi) goto bad_cmd; sd->state = sd_transfer_state; return sd_r1; case 2: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_ready_state: sd->state = sd_identification_state; return sd_r2_i; default: break; } break; case 3: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_identification_state: case sd_standby_state: sd->state = sd_standby_state; sd_set_rca(sd); return sd_r6; default: break; } break; case 4: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_standby_state: break; default: break; } break; case 5: return sd_illegal; case 6: if (sd->spi) goto bad_cmd; switch (sd->mode) { case sd_data_transfer_mode: sd_function_switch(sd, req.arg); sd->state = sd_sendingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 7: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_standby_state: if (sd->rca != rca) return sd_r0; sd->state = sd_transfer_state; return sd_r1b; case sd_transfer_state: case sd_sendingdata_state: if (sd->rca == rca) break; sd->state = sd_standby_state; return sd_r1b; case sd_disconnect_state: if (sd->rca != rca) return sd_r0; sd->state = sd_programming_state; return sd_r1b; case sd_programming_state: if (sd->rca == rca) break; sd->state = sd_disconnect_state; return sd_r1b; default: break; } break; case 8: switch (sd->state) { case sd_idle_state: sd->vhs = 0; if (!(req.arg >> 8) || (req.arg >> ffs(req.arg & ~0xff))) return sd->spi ? sd_r7 : sd_r0; sd->vhs = req.arg; return sd_r7; default: break; } break; case 9: switch (sd->state) { case sd_standby_state: if (sd->rca != rca) return sd_r0; return sd_r2_s; case sd_transfer_state: if (!sd->spi) break; sd->state = sd_sendingdata_state; memcpy(sd->data, sd->csd, 16); sd->data_start = addr; sd->data_offset = 0; return sd_r1; default: break; } break; case 10: switch (sd->state) { case sd_standby_state: if (sd->rca != rca) return sd_r0; return sd_r2_i; case sd_transfer_state: if (!sd->spi) break; sd->state = sd_sendingdata_state; memcpy(sd->data, sd->cid, 16); sd->data_start = addr; sd->data_offset = 0; return sd_r1; default: break; } break; case 11: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = req.arg; sd->data_offset = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; return sd_r0; default: break; } break; case 12: switch (sd->state) { case sd_sendingdata_state: sd->state = sd_transfer_state; return sd_r1b; case sd_receivingdata_state: sd->state = sd_programming_state; sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 13: switch (sd->mode) { case sd_data_transfer_mode: if (sd->rca != rca) return sd_r0; return sd_r1; default: break; } break; case 15: if (sd->spi) goto bad_cmd; switch (sd->mode) { case sd_data_transfer_mode: if (sd->rca != rca) return sd_r0; sd->state = sd_inactive_state; return sd_r0; default: break; } break; case 16: switch (sd->state) { case sd_transfer_state: if (req.arg > (1 << HWBLOCK_SHIFT)) sd->card_status |= BLOCK_LEN_ERROR; else sd->blk_len = req.arg; return sd_r1; default: break; } break; case 17: switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = addr; sd->data_offset = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; return sd_r1; default: break; } break; case 18: switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = addr; sd->data_offset = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; return sd_r1; default: break; } break; case 24: if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: if (sd->spi) break; sd->state = sd_receivingdata_state; sd->data_start = addr; sd->data_offset = 0; sd->blk_written = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; if (sd_wp_addr(sd, sd->data_start)) sd->card_status |= WP_VIOLATION; if (sd->csd[14] & 0x30) sd->card_status |= WP_VIOLATION; return sd_r1; default: break; } break; case 25: if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: if (sd->spi) break; sd->state = sd_receivingdata_state; sd->data_start = addr; sd->data_offset = 0; sd->blk_written = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; if (sd_wp_addr(sd, sd->data_start)) sd->card_status |= WP_VIOLATION; if (sd->csd[14] & 0x30) sd->card_status |= WP_VIOLATION; return sd_r1; default: break; } break; case 26: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 27: if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 28: switch (sd->state) { case sd_transfer_state: if (addr >= sd->size) { sd->card_status |= ADDRESS_ERROR; return sd_r1b; } sd->state = sd_programming_state; set_bit(sd_addr_to_wpnum(addr), sd->wp_groups); sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 29: switch (sd->state) { case sd_transfer_state: if (addr >= sd->size) { sd->card_status |= ADDRESS_ERROR; return sd_r1b; } sd->state = sd_programming_state; clear_bit(sd_addr_to_wpnum(addr), sd->wp_groups); sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 30: switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; *(uint32_t *) sd->data = sd_wpbits(sd, req.arg); sd->data_start = addr; sd->data_offset = 0; return sd_r1b; default: break; } break; case 32: switch (sd->state) { case sd_transfer_state: sd->erase_start = req.arg; return sd_r1; default: break; } break; case 33: switch (sd->state) { case sd_transfer_state: sd->erase_end = req.arg; return sd_r1; default: break; } break; case 38: switch (sd->state) { case sd_transfer_state: if (sd->csd[14] & 0x30) { sd->card_status |= WP_VIOLATION; return sd_r1b; } sd->state = sd_programming_state; sd_erase(sd); sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 42: if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 52: case 53: return sd_illegal; case 55: if (sd->rca != rca) return sd_r0; sd->expecting_acmd = true; sd->card_status |= APP_CMD; return sd_r1; case 56: fprintf(stderr, "SD: GEN_CMD 0x%08x\n", req.arg); switch (sd->state) { case sd_transfer_state: sd->data_offset = 0; if (req.arg & 1) sd->state = sd_sendingdata_state; else sd->state = sd_receivingdata_state; return sd_r1; default: break; } break; default: bad_cmd: fprintf(stderr, "SD: Unknown CMD%i\n", req.cmd); return sd_illegal; unimplemented_cmd: fprintf(stderr, "SD: CMD%i not implemented in SPI mode\n", req.cmd); return sd_illegal; } fprintf(stderr, "SD: CMD%i in a wrong state\n", req.cmd); return sd_illegal; }
{ "code": [], "line_no": [] }
static sd_rsp_type_t FUNC_0(SDState *sd, SDRequest req) { uint32_t rca = 0x0000; uint64_t addr = (sd->ocr & (1 << 30)) ? (uint64_t) req.arg << 9 : req.arg; sd->card_status &= ~APP_CMD; if (sd_cmd_type[req.cmd] == sd_ac || sd_cmd_type[req.cmd] == sd_adtc) rca = req.arg >> 16; DPRINTF("CMD%d 0x%08x state %d\n", req.cmd, req.arg, sd->state); switch (req.cmd) { case 0: switch (sd->state) { case sd_inactive_state: return sd->spi ? sd_r1 : sd_r0; default: sd->state = sd_idle_state; sd_reset(sd, sd->bdrv); return sd->spi ? sd_r1 : sd_r0; } break; case 1: if (!sd->spi) goto bad_cmd; sd->state = sd_transfer_state; return sd_r1; case 2: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_ready_state: sd->state = sd_identification_state; return sd_r2_i; default: break; } break; case 3: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_identification_state: case sd_standby_state: sd->state = sd_standby_state; sd_set_rca(sd); return sd_r6; default: break; } break; case 4: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_standby_state: break; default: break; } break; case 5: return sd_illegal; case 6: if (sd->spi) goto bad_cmd; switch (sd->mode) { case sd_data_transfer_mode: sd_function_switch(sd, req.arg); sd->state = sd_sendingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 7: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_standby_state: if (sd->rca != rca) return sd_r0; sd->state = sd_transfer_state; return sd_r1b; case sd_transfer_state: case sd_sendingdata_state: if (sd->rca == rca) break; sd->state = sd_standby_state; return sd_r1b; case sd_disconnect_state: if (sd->rca != rca) return sd_r0; sd->state = sd_programming_state; return sd_r1b; case sd_programming_state: if (sd->rca == rca) break; sd->state = sd_disconnect_state; return sd_r1b; default: break; } break; case 8: switch (sd->state) { case sd_idle_state: sd->vhs = 0; if (!(req.arg >> 8) || (req.arg >> ffs(req.arg & ~0xff))) return sd->spi ? sd_r7 : sd_r0; sd->vhs = req.arg; return sd_r7; default: break; } break; case 9: switch (sd->state) { case sd_standby_state: if (sd->rca != rca) return sd_r0; return sd_r2_s; case sd_transfer_state: if (!sd->spi) break; sd->state = sd_sendingdata_state; memcpy(sd->data, sd->csd, 16); sd->data_start = addr; sd->data_offset = 0; return sd_r1; default: break; } break; case 10: switch (sd->state) { case sd_standby_state: if (sd->rca != rca) return sd_r0; return sd_r2_i; case sd_transfer_state: if (!sd->spi) break; sd->state = sd_sendingdata_state; memcpy(sd->data, sd->cid, 16); sd->data_start = addr; sd->data_offset = 0; return sd_r1; default: break; } break; case 11: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = req.arg; sd->data_offset = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; return sd_r0; default: break; } break; case 12: switch (sd->state) { case sd_sendingdata_state: sd->state = sd_transfer_state; return sd_r1b; case sd_receivingdata_state: sd->state = sd_programming_state; sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 13: switch (sd->mode) { case sd_data_transfer_mode: if (sd->rca != rca) return sd_r0; return sd_r1; default: break; } break; case 15: if (sd->spi) goto bad_cmd; switch (sd->mode) { case sd_data_transfer_mode: if (sd->rca != rca) return sd_r0; sd->state = sd_inactive_state; return sd_r0; default: break; } break; case 16: switch (sd->state) { case sd_transfer_state: if (req.arg > (1 << HWBLOCK_SHIFT)) sd->card_status |= BLOCK_LEN_ERROR; else sd->blk_len = req.arg; return sd_r1; default: break; } break; case 17: switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = addr; sd->data_offset = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; return sd_r1; default: break; } break; case 18: switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = addr; sd->data_offset = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; return sd_r1; default: break; } break; case 24: if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: if (sd->spi) break; sd->state = sd_receivingdata_state; sd->data_start = addr; sd->data_offset = 0; sd->blk_written = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; if (sd_wp_addr(sd, sd->data_start)) sd->card_status |= WP_VIOLATION; if (sd->csd[14] & 0x30) sd->card_status |= WP_VIOLATION; return sd_r1; default: break; } break; case 25: if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: if (sd->spi) break; sd->state = sd_receivingdata_state; sd->data_start = addr; sd->data_offset = 0; sd->blk_written = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; if (sd_wp_addr(sd, sd->data_start)) sd->card_status |= WP_VIOLATION; if (sd->csd[14] & 0x30) sd->card_status |= WP_VIOLATION; return sd_r1; default: break; } break; case 26: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 27: if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 28: switch (sd->state) { case sd_transfer_state: if (addr >= sd->size) { sd->card_status |= ADDRESS_ERROR; return sd_r1b; } sd->state = sd_programming_state; set_bit(sd_addr_to_wpnum(addr), sd->wp_groups); sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 29: switch (sd->state) { case sd_transfer_state: if (addr >= sd->size) { sd->card_status |= ADDRESS_ERROR; return sd_r1b; } sd->state = sd_programming_state; clear_bit(sd_addr_to_wpnum(addr), sd->wp_groups); sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 30: switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; *(uint32_t *) sd->data = sd_wpbits(sd, req.arg); sd->data_start = addr; sd->data_offset = 0; return sd_r1b; default: break; } break; case 32: switch (sd->state) { case sd_transfer_state: sd->erase_start = req.arg; return sd_r1; default: break; } break; case 33: switch (sd->state) { case sd_transfer_state: sd->erase_end = req.arg; return sd_r1; default: break; } break; case 38: switch (sd->state) { case sd_transfer_state: if (sd->csd[14] & 0x30) { sd->card_status |= WP_VIOLATION; return sd_r1b; } sd->state = sd_programming_state; sd_erase(sd); sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 42: if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 52: case 53: return sd_illegal; case 55: if (sd->rca != rca) return sd_r0; sd->expecting_acmd = true; sd->card_status |= APP_CMD; return sd_r1; case 56: fprintf(stderr, "SD: GEN_CMD 0x%08x\n", req.arg); switch (sd->state) { case sd_transfer_state: sd->data_offset = 0; if (req.arg & 1) sd->state = sd_sendingdata_state; else sd->state = sd_receivingdata_state; return sd_r1; default: break; } break; default: bad_cmd: fprintf(stderr, "SD: Unknown CMD%i\n", req.cmd); return sd_illegal; unimplemented_cmd: fprintf(stderr, "SD: CMD%i not implemented in SPI mode\n", req.cmd); return sd_illegal; } fprintf(stderr, "SD: CMD%i in a wrong state\n", req.cmd); return sd_illegal; }
[ "static sd_rsp_type_t FUNC_0(SDState *sd,\nSDRequest req)\n{", "uint32_t rca = 0x0000;", "uint64_t addr = (sd->ocr & (1 << 30)) ? (uint64_t) req.arg << 9 : req.arg;", "sd->card_status &= ~APP_CMD;", "if (sd_cmd_type[req.cmd] == sd_ac || sd_cmd_type[req.cmd] == sd_adtc)\nrca = req.arg >> 16;", "DPRINTF(\"CMD%d 0x%08x state %d\\n\", req.cmd, req.arg, sd->state);", "switch (req.cmd) {", "case 0:\nswitch (sd->state) {", "case sd_inactive_state:\nreturn sd->spi ? sd_r1 : sd_r0;", "default:\nsd->state = sd_idle_state;", "sd_reset(sd, sd->bdrv);", "return sd->spi ? sd_r1 : sd_r0;", "}", "break;", "case 1:\nif (!sd->spi)\ngoto bad_cmd;", "sd->state = sd_transfer_state;", "return sd_r1;", "case 2:\nif (sd->spi)\ngoto bad_cmd;", "switch (sd->state) {", "case sd_ready_state:\nsd->state = sd_identification_state;", "return sd_r2_i;", "default:\nbreak;", "}", "break;", "case 3:\nif (sd->spi)\ngoto bad_cmd;", "switch (sd->state) {", "case sd_identification_state:\ncase sd_standby_state:\nsd->state = sd_standby_state;", "sd_set_rca(sd);", "return sd_r6;", "default:\nbreak;", "}", "break;", "case 4:\nif (sd->spi)\ngoto bad_cmd;", "switch (sd->state) {", "case sd_standby_state:\nbreak;", "default:\nbreak;", "}", "break;", "case 5:\nreturn sd_illegal;", "case 6:\nif (sd->spi)\ngoto bad_cmd;", "switch (sd->mode) {", "case sd_data_transfer_mode:\nsd_function_switch(sd, req.arg);", "sd->state = sd_sendingdata_state;", "sd->data_start = 0;", "sd->data_offset = 0;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 7:\nif (sd->spi)\ngoto bad_cmd;", "switch (sd->state) {", "case sd_standby_state:\nif (sd->rca != rca)\nreturn sd_r0;", "sd->state = sd_transfer_state;", "return sd_r1b;", "case sd_transfer_state:\ncase sd_sendingdata_state:\nif (sd->rca == rca)\nbreak;", "sd->state = sd_standby_state;", "return sd_r1b;", "case sd_disconnect_state:\nif (sd->rca != rca)\nreturn sd_r0;", "sd->state = sd_programming_state;", "return sd_r1b;", "case sd_programming_state:\nif (sd->rca == rca)\nbreak;", "sd->state = sd_disconnect_state;", "return sd_r1b;", "default:\nbreak;", "}", "break;", "case 8:\nswitch (sd->state) {", "case sd_idle_state:\nsd->vhs = 0;", "if (!(req.arg >> 8) || (req.arg >> ffs(req.arg & ~0xff)))\nreturn sd->spi ? sd_r7 : sd_r0;", "sd->vhs = req.arg;", "return sd_r7;", "default:\nbreak;", "}", "break;", "case 9:\nswitch (sd->state) {", "case sd_standby_state:\nif (sd->rca != rca)\nreturn sd_r0;", "return sd_r2_s;", "case sd_transfer_state:\nif (!sd->spi)\nbreak;", "sd->state = sd_sendingdata_state;", "memcpy(sd->data, sd->csd, 16);", "sd->data_start = addr;", "sd->data_offset = 0;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 10:\nswitch (sd->state) {", "case sd_standby_state:\nif (sd->rca != rca)\nreturn sd_r0;", "return sd_r2_i;", "case sd_transfer_state:\nif (!sd->spi)\nbreak;", "sd->state = sd_sendingdata_state;", "memcpy(sd->data, sd->cid, 16);", "sd->data_start = addr;", "sd->data_offset = 0;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 11:\nif (sd->spi)\ngoto bad_cmd;", "switch (sd->state) {", "case sd_transfer_state:\nsd->state = sd_sendingdata_state;", "sd->data_start = req.arg;", "sd->data_offset = 0;", "if (sd->data_start + sd->blk_len > sd->size)\nsd->card_status |= ADDRESS_ERROR;", "return sd_r0;", "default:\nbreak;", "}", "break;", "case 12:\nswitch (sd->state) {", "case sd_sendingdata_state:\nsd->state = sd_transfer_state;", "return sd_r1b;", "case sd_receivingdata_state:\nsd->state = sd_programming_state;", "sd->state = sd_transfer_state;", "return sd_r1b;", "default:\nbreak;", "}", "break;", "case 13:\nswitch (sd->mode) {", "case sd_data_transfer_mode:\nif (sd->rca != rca)\nreturn sd_r0;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 15:\nif (sd->spi)\ngoto bad_cmd;", "switch (sd->mode) {", "case sd_data_transfer_mode:\nif (sd->rca != rca)\nreturn sd_r0;", "sd->state = sd_inactive_state;", "return sd_r0;", "default:\nbreak;", "}", "break;", "case 16:\nswitch (sd->state) {", "case sd_transfer_state:\nif (req.arg > (1 << HWBLOCK_SHIFT))\nsd->card_status |= BLOCK_LEN_ERROR;", "else\nsd->blk_len = req.arg;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 17:\nswitch (sd->state) {", "case sd_transfer_state:\nsd->state = sd_sendingdata_state;", "sd->data_start = addr;", "sd->data_offset = 0;", "if (sd->data_start + sd->blk_len > sd->size)\nsd->card_status |= ADDRESS_ERROR;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 18:\nswitch (sd->state) {", "case sd_transfer_state:\nsd->state = sd_sendingdata_state;", "sd->data_start = addr;", "sd->data_offset = 0;", "if (sd->data_start + sd->blk_len > sd->size)\nsd->card_status |= ADDRESS_ERROR;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 24:\nif (sd->spi)\ngoto unimplemented_cmd;", "switch (sd->state) {", "case sd_transfer_state:\nif (sd->spi)\nbreak;", "sd->state = sd_receivingdata_state;", "sd->data_start = addr;", "sd->data_offset = 0;", "sd->blk_written = 0;", "if (sd->data_start + sd->blk_len > sd->size)\nsd->card_status |= ADDRESS_ERROR;", "if (sd_wp_addr(sd, sd->data_start))\nsd->card_status |= WP_VIOLATION;", "if (sd->csd[14] & 0x30)\nsd->card_status |= WP_VIOLATION;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 25:\nif (sd->spi)\ngoto unimplemented_cmd;", "switch (sd->state) {", "case sd_transfer_state:\nif (sd->spi)\nbreak;", "sd->state = sd_receivingdata_state;", "sd->data_start = addr;", "sd->data_offset = 0;", "sd->blk_written = 0;", "if (sd->data_start + sd->blk_len > sd->size)\nsd->card_status |= ADDRESS_ERROR;", "if (sd_wp_addr(sd, sd->data_start))\nsd->card_status |= WP_VIOLATION;", "if (sd->csd[14] & 0x30)\nsd->card_status |= WP_VIOLATION;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 26:\nif (sd->spi)\ngoto bad_cmd;", "switch (sd->state) {", "case sd_transfer_state:\nsd->state = sd_receivingdata_state;", "sd->data_start = 0;", "sd->data_offset = 0;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 27:\nif (sd->spi)\ngoto unimplemented_cmd;", "switch (sd->state) {", "case sd_transfer_state:\nsd->state = sd_receivingdata_state;", "sd->data_start = 0;", "sd->data_offset = 0;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 28:\nswitch (sd->state) {", "case sd_transfer_state:\nif (addr >= sd->size) {", "sd->card_status |= ADDRESS_ERROR;", "return sd_r1b;", "}", "sd->state = sd_programming_state;", "set_bit(sd_addr_to_wpnum(addr), sd->wp_groups);", "sd->state = sd_transfer_state;", "return sd_r1b;", "default:\nbreak;", "}", "break;", "case 29:\nswitch (sd->state) {", "case sd_transfer_state:\nif (addr >= sd->size) {", "sd->card_status |= ADDRESS_ERROR;", "return sd_r1b;", "}", "sd->state = sd_programming_state;", "clear_bit(sd_addr_to_wpnum(addr), sd->wp_groups);", "sd->state = sd_transfer_state;", "return sd_r1b;", "default:\nbreak;", "}", "break;", "case 30:\nswitch (sd->state) {", "case sd_transfer_state:\nsd->state = sd_sendingdata_state;", "*(uint32_t *) sd->data = sd_wpbits(sd, req.arg);", "sd->data_start = addr;", "sd->data_offset = 0;", "return sd_r1b;", "default:\nbreak;", "}", "break;", "case 32:\nswitch (sd->state) {", "case sd_transfer_state:\nsd->erase_start = req.arg;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 33:\nswitch (sd->state) {", "case sd_transfer_state:\nsd->erase_end = req.arg;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 38:\nswitch (sd->state) {", "case sd_transfer_state:\nif (sd->csd[14] & 0x30) {", "sd->card_status |= WP_VIOLATION;", "return sd_r1b;", "}", "sd->state = sd_programming_state;", "sd_erase(sd);", "sd->state = sd_transfer_state;", "return sd_r1b;", "default:\nbreak;", "}", "break;", "case 42:\nif (sd->spi)\ngoto unimplemented_cmd;", "switch (sd->state) {", "case sd_transfer_state:\nsd->state = sd_receivingdata_state;", "sd->data_start = 0;", "sd->data_offset = 0;", "return sd_r1;", "default:\nbreak;", "}", "break;", "case 52:\ncase 53:\nreturn sd_illegal;", "case 55:\nif (sd->rca != rca)\nreturn sd_r0;", "sd->expecting_acmd = true;", "sd->card_status |= APP_CMD;", "return sd_r1;", "case 56:\nfprintf(stderr, \"SD: GEN_CMD 0x%08x\\n\", req.arg);", "switch (sd->state) {", "case sd_transfer_state:\nsd->data_offset = 0;", "if (req.arg & 1)\nsd->state = sd_sendingdata_state;", "else\nsd->state = sd_receivingdata_state;", "return sd_r1;", "default:\nbreak;", "}", "break;", "default:\nbad_cmd:\nfprintf(stderr, \"SD: Unknown CMD%i\\n\", req.cmd);", "return sd_illegal;", "unimplemented_cmd:\nfprintf(stderr, \"SD: CMD%i not implemented in SPI mode\\n\", req.cmd);", "return sd_illegal;", "}", "fprintf(stderr, \"SD: CMD%i in a wrong state\\n\", req.cmd);", "return sd_illegal;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35, 37 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57, 59 ], [ 63 ], [ 65 ], [ 69, 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 95, 97, 99 ], [ 101 ], [ 103, 105, 107 ], [ 109 ], [ 111 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 125, 127, 129 ], [ 131 ], [ 133, 135 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 149, 151 ], [ 155, 157, 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 187, 189, 191 ], [ 193 ], [ 195, 197, 199 ], [ 203 ], [ 205 ], [ 209, 211, 213, 215 ], [ 219 ], [ 221 ], [ 225, 227, 229 ], [ 233 ], [ 235 ], [ 239, 241, 243 ], [ 247 ], [ 249 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 263, 267 ], [ 269, 271 ], [ 277, 279 ], [ 285 ], [ 287 ], [ 291, 293 ], [ 295 ], [ 297 ], [ 301, 303 ], [ 305, 307, 309 ], [ 313 ], [ 317, 319, 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 335, 337 ], [ 339 ], [ 341 ], [ 345, 347 ], [ 349, 351, 353 ], [ 357 ], [ 361, 363, 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 379, 381 ], [ 383 ], [ 385 ], [ 389, 391, 393 ], [ 395 ], [ 397, 399 ], [ 401 ], [ 403 ], [ 407, 409 ], [ 411 ], [ 415, 417 ], [ 419 ], [ 421 ], [ 425, 427 ], [ 429, 431 ], [ 433 ], [ 437, 439 ], [ 443 ], [ 445 ], [ 449, 451 ], [ 453 ], [ 455 ], [ 459, 461 ], [ 463, 465, 467 ], [ 471 ], [ 475, 477 ], [ 479 ], [ 481 ], [ 485, 487, 489 ], [ 491 ], [ 493, 495, 497 ], [ 501 ], [ 503 ], [ 507, 509 ], [ 511 ], [ 513 ], [ 519, 521 ], [ 523, 525, 527 ], [ 529, 531 ], [ 535 ], [ 539, 541 ], [ 543 ], [ 545 ], [ 549, 551 ], [ 553, 555 ], [ 557 ], [ 559 ], [ 563, 565 ], [ 567 ], [ 571, 573 ], [ 575 ], [ 577 ], [ 581, 583 ], [ 585, 587 ], [ 589 ], [ 591 ], [ 595, 597 ], [ 599 ], [ 603, 605 ], [ 607 ], [ 609 ], [ 615, 617, 619 ], [ 621 ], [ 623, 627, 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 641, 643 ], [ 645, 647 ], [ 649, 651 ], [ 653 ], [ 657, 659 ], [ 661 ], [ 663 ], [ 667, 669, 671 ], [ 673 ], [ 675, 679, 681 ], [ 683 ], [ 685 ], [ 687 ], [ 689 ], [ 693, 695 ], [ 697, 699 ], [ 701, 703 ], [ 705 ], [ 709, 711 ], [ 713 ], [ 715 ], [ 719, 721, 723 ], [ 725 ], [ 727, 729 ], [ 731 ], [ 733 ], [ 735 ], [ 739, 741 ], [ 743 ], [ 745 ], [ 749, 751, 753 ], [ 755 ], [ 757, 759 ], [ 761 ], [ 763 ], [ 765 ], [ 769, 771 ], [ 773 ], [ 775 ], [ 781, 783 ], [ 785, 787 ], [ 789 ], [ 791 ], [ 793 ], [ 797 ], [ 799 ], [ 803 ], [ 805 ], [ 809, 811 ], [ 813 ], [ 815 ], [ 819, 821 ], [ 823, 825 ], [ 827 ], [ 829 ], [ 831 ], [ 835 ], [ 837 ], [ 841 ], [ 843 ], [ 847, 849 ], [ 851 ], [ 853 ], [ 857, 859 ], [ 861, 863 ], [ 865 ], [ 867 ], [ 869 ], [ 871 ], [ 875, 877 ], [ 879 ], [ 881 ], [ 887, 889 ], [ 891, 893 ], [ 895 ], [ 899, 901 ], [ 903 ], [ 905 ], [ 909, 911 ], [ 913, 915 ], [ 917 ], [ 921, 923 ], [ 925 ], [ 927 ], [ 931, 933 ], [ 935, 937 ], [ 939 ], [ 941 ], [ 943 ], [ 947 ], [ 949 ], [ 953 ], [ 955 ], [ 959, 961 ], [ 963 ], [ 965 ], [ 971, 973, 975 ], [ 977 ], [ 979, 981 ], [ 983 ], [ 985 ], [ 987 ], [ 991, 993 ], [ 995 ], [ 997 ], [ 1001, 1003, 1017 ], [ 1023, 1025, 1027 ], [ 1031 ], [ 1033 ], [ 1035 ], [ 1039, 1041 ], [ 1045 ], [ 1047, 1049 ], [ 1051, 1053 ], [ 1055, 1057 ], [ 1059 ], [ 1063, 1065 ], [ 1067 ], [ 1069 ], [ 1073, 1075, 1077 ], [ 1079 ], [ 1083, 1087 ], [ 1089 ], [ 1091 ], [ 1095 ], [ 1097 ], [ 1099 ] ]
803
static void amdvi_mmio_trace(hwaddr addr, unsigned size) { uint8_t index = (addr & ~0x2000) / 8; if ((addr & 0x2000)) { /* high table */ index = index >= AMDVI_MMIO_REGS_HIGH ? AMDVI_MMIO_REGS_HIGH : index; trace_amdvi_mmio_read(amdvi_mmio_high[index], addr, size, addr & ~0x07); } else { index = index >= AMDVI_MMIO_REGS_LOW ? AMDVI_MMIO_REGS_LOW : index; trace_amdvi_mmio_read(amdvi_mmio_high[index], addr, size, addr & ~0x07); } }
false
qemu
d9429b84af2302b6e28bec3c52710cf67eda3cee
static void amdvi_mmio_trace(hwaddr addr, unsigned size) { uint8_t index = (addr & ~0x2000) / 8; if ((addr & 0x2000)) { index = index >= AMDVI_MMIO_REGS_HIGH ? AMDVI_MMIO_REGS_HIGH : index; trace_amdvi_mmio_read(amdvi_mmio_high[index], addr, size, addr & ~0x07); } else { index = index >= AMDVI_MMIO_REGS_LOW ? AMDVI_MMIO_REGS_LOW : index; trace_amdvi_mmio_read(amdvi_mmio_high[index], addr, size, addr & ~0x07); } }
{ "code": [], "line_no": [] }
static void FUNC_0(hwaddr VAR_0, unsigned VAR_1) { uint8_t index = (VAR_0 & ~0x2000) / 8; if ((VAR_0 & 0x2000)) { index = index >= AMDVI_MMIO_REGS_HIGH ? AMDVI_MMIO_REGS_HIGH : index; trace_amdvi_mmio_read(amdvi_mmio_high[index], VAR_0, VAR_1, VAR_0 & ~0x07); } else { index = index >= AMDVI_MMIO_REGS_LOW ? AMDVI_MMIO_REGS_LOW : index; trace_amdvi_mmio_read(amdvi_mmio_high[index], VAR_0, VAR_1, VAR_0 & ~0x07); } }
[ "static void FUNC_0(hwaddr VAR_0, unsigned VAR_1)\n{", "uint8_t index = (VAR_0 & ~0x2000) / 8;", "if ((VAR_0 & 0x2000)) {", "index = index >= AMDVI_MMIO_REGS_HIGH ? AMDVI_MMIO_REGS_HIGH : index;", "trace_amdvi_mmio_read(amdvi_mmio_high[index], VAR_0, VAR_1, VAR_0 & ~0x07);", "} else {", "index = index >= AMDVI_MMIO_REGS_LOW ? AMDVI_MMIO_REGS_LOW : index;", "trace_amdvi_mmio_read(amdvi_mmio_high[index], VAR_0, VAR_1, VAR_0 & ~0x07);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
804
void virtio_cleanup(VirtIODevice *vdev) { qemu_del_vm_change_state_handler(vdev->vmstate); g_free(vdev->config); g_free(vdev->vq); g_free(vdev->vector_queues); }
false
qemu
c611c76417f52b335ecaab01c61743e3b705eb7c
void virtio_cleanup(VirtIODevice *vdev) { qemu_del_vm_change_state_handler(vdev->vmstate); g_free(vdev->config); g_free(vdev->vq); g_free(vdev->vector_queues); }
{ "code": [], "line_no": [] }
void FUNC_0(VirtIODevice *VAR_0) { qemu_del_vm_change_state_handler(VAR_0->vmstate); g_free(VAR_0->config); g_free(VAR_0->vq); g_free(VAR_0->vector_queues); }
[ "void FUNC_0(VirtIODevice *VAR_0)\n{", "qemu_del_vm_change_state_handler(VAR_0->vmstate);", "g_free(VAR_0->config);", "g_free(VAR_0->vq);", "g_free(VAR_0->vector_queues);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
805
static void gen_pool32axf (CPUMIPSState *env, DisasContext *ctx, int rt, int rs) { int extension = (ctx->opcode >> 6) & 0x3f; int minor = (ctx->opcode >> 12) & 0xf; uint32_t mips32_op; switch (extension) { case TEQ: mips32_op = OPC_TEQ; goto do_trap; case TGE: mips32_op = OPC_TGE; goto do_trap; case TGEU: mips32_op = OPC_TGEU; goto do_trap; case TLT: mips32_op = OPC_TLT; goto do_trap; case TLTU: mips32_op = OPC_TLTU; goto do_trap; case TNE: mips32_op = OPC_TNE; do_trap: gen_trap(ctx, mips32_op, rs, rt, -1); break; #ifndef CONFIG_USER_ONLY case MFC0: case MFC0 + 32: check_cp0_enabled(ctx); if (rt == 0) { /* Treat as NOP. */ break; } gen_mfc0(ctx, cpu_gpr[rt], rs, (ctx->opcode >> 11) & 0x7); break; case MTC0: case MTC0 + 32: check_cp0_enabled(ctx); { TCGv t0 = tcg_temp_new(); gen_load_gpr(t0, rt); gen_mtc0(ctx, t0, rs, (ctx->opcode >> 11) & 0x7); tcg_temp_free(t0); } break; #endif case 0x2a: switch (minor & 3) { case MADD_ACC: gen_muldiv(ctx, OPC_MADD, (ctx->opcode >> 14) & 3, rs, rt); break; case MADDU_ACC: gen_muldiv(ctx, OPC_MADDU, (ctx->opcode >> 14) & 3, rs, rt); break; case MSUB_ACC: gen_muldiv(ctx, OPC_MSUB, (ctx->opcode >> 14) & 3, rs, rt); break; case MSUBU_ACC: gen_muldiv(ctx, OPC_MSUBU, (ctx->opcode >> 14) & 3, rs, rt); break; default: goto pool32axf_invalid; } break; case 0x32: switch (minor & 3) { case MULT_ACC: gen_muldiv(ctx, OPC_MULT, (ctx->opcode >> 14) & 3, rs, rt); break; case MULTU_ACC: gen_muldiv(ctx, OPC_MULTU, (ctx->opcode >> 14) & 3, rs, rt); break; default: goto pool32axf_invalid; } break; case 0x2c: switch (minor) { case BITSWAP: check_insn(ctx, ISA_MIPS32R6); gen_bitswap(ctx, OPC_BITSWAP, rs, rt); break; case SEB: gen_bshfl(ctx, OPC_SEB, rs, rt); break; case SEH: gen_bshfl(ctx, OPC_SEH, rs, rt); break; case CLO: mips32_op = OPC_CLO; goto do_cl; case CLZ: mips32_op = OPC_CLZ; do_cl: check_insn(ctx, ISA_MIPS32); gen_cl(ctx, mips32_op, rt, rs); break; case RDHWR: gen_rdhwr(ctx, rt, rs); break; case WSBH: gen_bshfl(ctx, OPC_WSBH, rs, rt); break; case MULT: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_MULT; goto do_mul; case MULTU: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_MULTU; goto do_mul; case DIV: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_DIV; goto do_div; case DIVU: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_DIVU; goto do_div; do_div: check_insn(ctx, ISA_MIPS32); gen_muldiv(ctx, mips32_op, 0, rs, rt); break; case MADD: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_MADD; goto do_mul; case MADDU: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_MADDU; goto do_mul; case MSUB: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_MSUB; goto do_mul; case MSUBU: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_MSUBU; do_mul: check_insn(ctx, ISA_MIPS32); gen_muldiv(ctx, mips32_op, 0, rs, rt); break; default: goto pool32axf_invalid; } break; case 0x34: switch (minor) { case MFC2: case MTC2: case MFHC2: case MTHC2: case CFC2: case CTC2: generate_exception_err(ctx, EXCP_CpU, 2); break; default: goto pool32axf_invalid; } break; case 0x3c: switch (minor) { case JALR: /* JALRC */ case JALR_HB: /* JALRC_HB */ if (ctx->insn_flags & ISA_MIPS32R6) { /* JALRC, JALRC_HB */ gen_compute_branch(ctx, OPC_JALR, 4, rs, rt, 0, 0); } else { /* JALR, JALR_HB */ gen_compute_branch(ctx, OPC_JALR, 4, rs, rt, 0, 4); ctx->hflags |= MIPS_HFLAG_BDS_STRICT; } break; case JALRS: case JALRS_HB: check_insn_opc_removed(ctx, ISA_MIPS32R6); gen_compute_branch(ctx, OPC_JALR, 4, rs, rt, 0, 2); ctx->hflags |= MIPS_HFLAG_BDS_STRICT; break; default: goto pool32axf_invalid; } break; case 0x05: switch (minor) { case RDPGPR: check_cp0_enabled(ctx); check_insn(ctx, ISA_MIPS32R2); gen_load_srsgpr(rs, rt); break; case WRPGPR: check_cp0_enabled(ctx); check_insn(ctx, ISA_MIPS32R2); gen_store_srsgpr(rs, rt); break; default: goto pool32axf_invalid; } break; #ifndef CONFIG_USER_ONLY case 0x0d: switch (minor) { case TLBP: mips32_op = OPC_TLBP; goto do_cp0; case TLBR: mips32_op = OPC_TLBR; goto do_cp0; case TLBWI: mips32_op = OPC_TLBWI; goto do_cp0; case TLBWR: mips32_op = OPC_TLBWR; goto do_cp0; case TLBINV: mips32_op = OPC_TLBINV; goto do_cp0; case TLBINVF: mips32_op = OPC_TLBINVF; goto do_cp0; case WAIT: mips32_op = OPC_WAIT; goto do_cp0; case DERET: mips32_op = OPC_DERET; goto do_cp0; case ERET: mips32_op = OPC_ERET; do_cp0: gen_cp0(env, ctx, mips32_op, rt, rs); break; default: goto pool32axf_invalid; } break; case 0x1d: switch (minor) { case DI: check_cp0_enabled(ctx); { TCGv t0 = tcg_temp_new(); save_cpu_state(ctx, 1); gen_helper_di(t0, cpu_env); gen_store_gpr(t0, rs); /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; tcg_temp_free(t0); } break; case EI: check_cp0_enabled(ctx); { TCGv t0 = tcg_temp_new(); save_cpu_state(ctx, 1); gen_helper_ei(t0, cpu_env); gen_store_gpr(t0, rs); /* Stop translation as we may have switched the execution mode */ ctx->bstate = BS_STOP; tcg_temp_free(t0); } break; default: goto pool32axf_invalid; } break; #endif case 0x2d: switch (minor) { case SYNC: /* NOP */ break; case SYSCALL: generate_exception_end(ctx, EXCP_SYSCALL); break; case SDBBP: if (is_uhi(extract32(ctx->opcode, 16, 10))) { gen_helper_do_semihosting(cpu_env); } else { check_insn(ctx, ISA_MIPS32); if (ctx->hflags & MIPS_HFLAG_SBRI) { generate_exception_end(ctx, EXCP_RI); } else { generate_exception_end(ctx, EXCP_DBp); } } break; default: goto pool32axf_invalid; } break; case 0x01: switch (minor & 3) { case MFHI_ACC: gen_HILO(ctx, OPC_MFHI, minor >> 2, rs); break; case MFLO_ACC: gen_HILO(ctx, OPC_MFLO, minor >> 2, rs); break; case MTHI_ACC: gen_HILO(ctx, OPC_MTHI, minor >> 2, rs); break; case MTLO_ACC: gen_HILO(ctx, OPC_MTLO, minor >> 2, rs); break; default: goto pool32axf_invalid; } break; case 0x35: check_insn_opc_removed(ctx, ISA_MIPS32R6); switch (minor) { case MFHI32: gen_HILO(ctx, OPC_MFHI, 0, rs); break; case MFLO32: gen_HILO(ctx, OPC_MFLO, 0, rs); break; case MTHI32: gen_HILO(ctx, OPC_MTHI, 0, rs); break; case MTLO32: gen_HILO(ctx, OPC_MTLO, 0, rs); break; default: goto pool32axf_invalid; } break; default: pool32axf_invalid: MIPS_INVAL("pool32axf"); generate_exception_end(ctx, EXCP_RI); break; } }
false
qemu
b00c72180c36510bf9b124e190bd520e3b7e1358
static void gen_pool32axf (CPUMIPSState *env, DisasContext *ctx, int rt, int rs) { int extension = (ctx->opcode >> 6) & 0x3f; int minor = (ctx->opcode >> 12) & 0xf; uint32_t mips32_op; switch (extension) { case TEQ: mips32_op = OPC_TEQ; goto do_trap; case TGE: mips32_op = OPC_TGE; goto do_trap; case TGEU: mips32_op = OPC_TGEU; goto do_trap; case TLT: mips32_op = OPC_TLT; goto do_trap; case TLTU: mips32_op = OPC_TLTU; goto do_trap; case TNE: mips32_op = OPC_TNE; do_trap: gen_trap(ctx, mips32_op, rs, rt, -1); break; #ifndef CONFIG_USER_ONLY case MFC0: case MFC0 + 32: check_cp0_enabled(ctx); if (rt == 0) { break; } gen_mfc0(ctx, cpu_gpr[rt], rs, (ctx->opcode >> 11) & 0x7); break; case MTC0: case MTC0 + 32: check_cp0_enabled(ctx); { TCGv t0 = tcg_temp_new(); gen_load_gpr(t0, rt); gen_mtc0(ctx, t0, rs, (ctx->opcode >> 11) & 0x7); tcg_temp_free(t0); } break; #endif case 0x2a: switch (minor & 3) { case MADD_ACC: gen_muldiv(ctx, OPC_MADD, (ctx->opcode >> 14) & 3, rs, rt); break; case MADDU_ACC: gen_muldiv(ctx, OPC_MADDU, (ctx->opcode >> 14) & 3, rs, rt); break; case MSUB_ACC: gen_muldiv(ctx, OPC_MSUB, (ctx->opcode >> 14) & 3, rs, rt); break; case MSUBU_ACC: gen_muldiv(ctx, OPC_MSUBU, (ctx->opcode >> 14) & 3, rs, rt); break; default: goto pool32axf_invalid; } break; case 0x32: switch (minor & 3) { case MULT_ACC: gen_muldiv(ctx, OPC_MULT, (ctx->opcode >> 14) & 3, rs, rt); break; case MULTU_ACC: gen_muldiv(ctx, OPC_MULTU, (ctx->opcode >> 14) & 3, rs, rt); break; default: goto pool32axf_invalid; } break; case 0x2c: switch (minor) { case BITSWAP: check_insn(ctx, ISA_MIPS32R6); gen_bitswap(ctx, OPC_BITSWAP, rs, rt); break; case SEB: gen_bshfl(ctx, OPC_SEB, rs, rt); break; case SEH: gen_bshfl(ctx, OPC_SEH, rs, rt); break; case CLO: mips32_op = OPC_CLO; goto do_cl; case CLZ: mips32_op = OPC_CLZ; do_cl: check_insn(ctx, ISA_MIPS32); gen_cl(ctx, mips32_op, rt, rs); break; case RDHWR: gen_rdhwr(ctx, rt, rs); break; case WSBH: gen_bshfl(ctx, OPC_WSBH, rs, rt); break; case MULT: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_MULT; goto do_mul; case MULTU: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_MULTU; goto do_mul; case DIV: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_DIV; goto do_div; case DIVU: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_DIVU; goto do_div; do_div: check_insn(ctx, ISA_MIPS32); gen_muldiv(ctx, mips32_op, 0, rs, rt); break; case MADD: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_MADD; goto do_mul; case MADDU: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_MADDU; goto do_mul; case MSUB: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_MSUB; goto do_mul; case MSUBU: check_insn_opc_removed(ctx, ISA_MIPS32R6); mips32_op = OPC_MSUBU; do_mul: check_insn(ctx, ISA_MIPS32); gen_muldiv(ctx, mips32_op, 0, rs, rt); break; default: goto pool32axf_invalid; } break; case 0x34: switch (minor) { case MFC2: case MTC2: case MFHC2: case MTHC2: case CFC2: case CTC2: generate_exception_err(ctx, EXCP_CpU, 2); break; default: goto pool32axf_invalid; } break; case 0x3c: switch (minor) { case JALR: case JALR_HB: if (ctx->insn_flags & ISA_MIPS32R6) { gen_compute_branch(ctx, OPC_JALR, 4, rs, rt, 0, 0); } else { gen_compute_branch(ctx, OPC_JALR, 4, rs, rt, 0, 4); ctx->hflags |= MIPS_HFLAG_BDS_STRICT; } break; case JALRS: case JALRS_HB: check_insn_opc_removed(ctx, ISA_MIPS32R6); gen_compute_branch(ctx, OPC_JALR, 4, rs, rt, 0, 2); ctx->hflags |= MIPS_HFLAG_BDS_STRICT; break; default: goto pool32axf_invalid; } break; case 0x05: switch (minor) { case RDPGPR: check_cp0_enabled(ctx); check_insn(ctx, ISA_MIPS32R2); gen_load_srsgpr(rs, rt); break; case WRPGPR: check_cp0_enabled(ctx); check_insn(ctx, ISA_MIPS32R2); gen_store_srsgpr(rs, rt); break; default: goto pool32axf_invalid; } break; #ifndef CONFIG_USER_ONLY case 0x0d: switch (minor) { case TLBP: mips32_op = OPC_TLBP; goto do_cp0; case TLBR: mips32_op = OPC_TLBR; goto do_cp0; case TLBWI: mips32_op = OPC_TLBWI; goto do_cp0; case TLBWR: mips32_op = OPC_TLBWR; goto do_cp0; case TLBINV: mips32_op = OPC_TLBINV; goto do_cp0; case TLBINVF: mips32_op = OPC_TLBINVF; goto do_cp0; case WAIT: mips32_op = OPC_WAIT; goto do_cp0; case DERET: mips32_op = OPC_DERET; goto do_cp0; case ERET: mips32_op = OPC_ERET; do_cp0: gen_cp0(env, ctx, mips32_op, rt, rs); break; default: goto pool32axf_invalid; } break; case 0x1d: switch (minor) { case DI: check_cp0_enabled(ctx); { TCGv t0 = tcg_temp_new(); save_cpu_state(ctx, 1); gen_helper_di(t0, cpu_env); gen_store_gpr(t0, rs); ctx->bstate = BS_STOP; tcg_temp_free(t0); } break; case EI: check_cp0_enabled(ctx); { TCGv t0 = tcg_temp_new(); save_cpu_state(ctx, 1); gen_helper_ei(t0, cpu_env); gen_store_gpr(t0, rs); ctx->bstate = BS_STOP; tcg_temp_free(t0); } break; default: goto pool32axf_invalid; } break; #endif case 0x2d: switch (minor) { case SYNC: break; case SYSCALL: generate_exception_end(ctx, EXCP_SYSCALL); break; case SDBBP: if (is_uhi(extract32(ctx->opcode, 16, 10))) { gen_helper_do_semihosting(cpu_env); } else { check_insn(ctx, ISA_MIPS32); if (ctx->hflags & MIPS_HFLAG_SBRI) { generate_exception_end(ctx, EXCP_RI); } else { generate_exception_end(ctx, EXCP_DBp); } } break; default: goto pool32axf_invalid; } break; case 0x01: switch (minor & 3) { case MFHI_ACC: gen_HILO(ctx, OPC_MFHI, minor >> 2, rs); break; case MFLO_ACC: gen_HILO(ctx, OPC_MFLO, minor >> 2, rs); break; case MTHI_ACC: gen_HILO(ctx, OPC_MTHI, minor >> 2, rs); break; case MTLO_ACC: gen_HILO(ctx, OPC_MTLO, minor >> 2, rs); break; default: goto pool32axf_invalid; } break; case 0x35: check_insn_opc_removed(ctx, ISA_MIPS32R6); switch (minor) { case MFHI32: gen_HILO(ctx, OPC_MFHI, 0, rs); break; case MFLO32: gen_HILO(ctx, OPC_MFLO, 0, rs); break; case MTHI32: gen_HILO(ctx, OPC_MTHI, 0, rs); break; case MTLO32: gen_HILO(ctx, OPC_MTLO, 0, rs); break; default: goto pool32axf_invalid; } break; default: pool32axf_invalid: MIPS_INVAL("pool32axf"); generate_exception_end(ctx, EXCP_RI); break; } }
{ "code": [], "line_no": [] }
static void FUNC_0 (CPUMIPSState *VAR_0, DisasContext *VAR_1, int VAR_2, int VAR_3) { int VAR_4 = (VAR_1->opcode >> 6) & 0x3f; int VAR_5 = (VAR_1->opcode >> 12) & 0xf; uint32_t mips32_op; switch (VAR_4) { case TEQ: mips32_op = OPC_TEQ; goto do_trap; case TGE: mips32_op = OPC_TGE; goto do_trap; case TGEU: mips32_op = OPC_TGEU; goto do_trap; case TLT: mips32_op = OPC_TLT; goto do_trap; case TLTU: mips32_op = OPC_TLTU; goto do_trap; case TNE: mips32_op = OPC_TNE; do_trap: gen_trap(VAR_1, mips32_op, VAR_3, VAR_2, -1); break; #ifndef CONFIG_USER_ONLY case MFC0: case MFC0 + 32: check_cp0_enabled(VAR_1); if (VAR_2 == 0) { break; } gen_mfc0(VAR_1, cpu_gpr[VAR_2], VAR_3, (VAR_1->opcode >> 11) & 0x7); break; case MTC0: case MTC0 + 32: check_cp0_enabled(VAR_1); { TCGv t0 = tcg_temp_new(); gen_load_gpr(t0, VAR_2); gen_mtc0(VAR_1, t0, VAR_3, (VAR_1->opcode >> 11) & 0x7); tcg_temp_free(t0); } break; #endif case 0x2a: switch (VAR_5 & 3) { case MADD_ACC: gen_muldiv(VAR_1, OPC_MADD, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2); break; case MADDU_ACC: gen_muldiv(VAR_1, OPC_MADDU, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2); break; case MSUB_ACC: gen_muldiv(VAR_1, OPC_MSUB, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2); break; case MSUBU_ACC: gen_muldiv(VAR_1, OPC_MSUBU, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2); break; default: goto pool32axf_invalid; } break; case 0x32: switch (VAR_5 & 3) { case MULT_ACC: gen_muldiv(VAR_1, OPC_MULT, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2); break; case MULTU_ACC: gen_muldiv(VAR_1, OPC_MULTU, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2); break; default: goto pool32axf_invalid; } break; case 0x2c: switch (VAR_5) { case BITSWAP: check_insn(VAR_1, ISA_MIPS32R6); gen_bitswap(VAR_1, OPC_BITSWAP, VAR_3, VAR_2); break; case SEB: gen_bshfl(VAR_1, OPC_SEB, VAR_3, VAR_2); break; case SEH: gen_bshfl(VAR_1, OPC_SEH, VAR_3, VAR_2); break; case CLO: mips32_op = OPC_CLO; goto do_cl; case CLZ: mips32_op = OPC_CLZ; do_cl: check_insn(VAR_1, ISA_MIPS32); gen_cl(VAR_1, mips32_op, VAR_2, VAR_3); break; case RDHWR: gen_rdhwr(VAR_1, VAR_2, VAR_3); break; case WSBH: gen_bshfl(VAR_1, OPC_WSBH, VAR_3, VAR_2); break; case MULT: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); mips32_op = OPC_MULT; goto do_mul; case MULTU: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); mips32_op = OPC_MULTU; goto do_mul; case DIV: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); mips32_op = OPC_DIV; goto do_div; case DIVU: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); mips32_op = OPC_DIVU; goto do_div; do_div: check_insn(VAR_1, ISA_MIPS32); gen_muldiv(VAR_1, mips32_op, 0, VAR_3, VAR_2); break; case MADD: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); mips32_op = OPC_MADD; goto do_mul; case MADDU: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); mips32_op = OPC_MADDU; goto do_mul; case MSUB: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); mips32_op = OPC_MSUB; goto do_mul; case MSUBU: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); mips32_op = OPC_MSUBU; do_mul: check_insn(VAR_1, ISA_MIPS32); gen_muldiv(VAR_1, mips32_op, 0, VAR_3, VAR_2); break; default: goto pool32axf_invalid; } break; case 0x34: switch (VAR_5) { case MFC2: case MTC2: case MFHC2: case MTHC2: case CFC2: case CTC2: generate_exception_err(VAR_1, EXCP_CpU, 2); break; default: goto pool32axf_invalid; } break; case 0x3c: switch (VAR_5) { case JALR: case JALR_HB: if (VAR_1->insn_flags & ISA_MIPS32R6) { gen_compute_branch(VAR_1, OPC_JALR, 4, VAR_3, VAR_2, 0, 0); } else { gen_compute_branch(VAR_1, OPC_JALR, 4, VAR_3, VAR_2, 0, 4); VAR_1->hflags |= MIPS_HFLAG_BDS_STRICT; } break; case JALRS: case JALRS_HB: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); gen_compute_branch(VAR_1, OPC_JALR, 4, VAR_3, VAR_2, 0, 2); VAR_1->hflags |= MIPS_HFLAG_BDS_STRICT; break; default: goto pool32axf_invalid; } break; case 0x05: switch (VAR_5) { case RDPGPR: check_cp0_enabled(VAR_1); check_insn(VAR_1, ISA_MIPS32R2); gen_load_srsgpr(VAR_3, VAR_2); break; case WRPGPR: check_cp0_enabled(VAR_1); check_insn(VAR_1, ISA_MIPS32R2); gen_store_srsgpr(VAR_3, VAR_2); break; default: goto pool32axf_invalid; } break; #ifndef CONFIG_USER_ONLY case 0x0d: switch (VAR_5) { case TLBP: mips32_op = OPC_TLBP; goto do_cp0; case TLBR: mips32_op = OPC_TLBR; goto do_cp0; case TLBWI: mips32_op = OPC_TLBWI; goto do_cp0; case TLBWR: mips32_op = OPC_TLBWR; goto do_cp0; case TLBINV: mips32_op = OPC_TLBINV; goto do_cp0; case TLBINVF: mips32_op = OPC_TLBINVF; goto do_cp0; case WAIT: mips32_op = OPC_WAIT; goto do_cp0; case DERET: mips32_op = OPC_DERET; goto do_cp0; case ERET: mips32_op = OPC_ERET; do_cp0: gen_cp0(VAR_0, VAR_1, mips32_op, VAR_2, VAR_3); break; default: goto pool32axf_invalid; } break; case 0x1d: switch (VAR_5) { case DI: check_cp0_enabled(VAR_1); { TCGv t0 = tcg_temp_new(); save_cpu_state(VAR_1, 1); gen_helper_di(t0, cpu_env); gen_store_gpr(t0, VAR_3); VAR_1->bstate = BS_STOP; tcg_temp_free(t0); } break; case EI: check_cp0_enabled(VAR_1); { TCGv t0 = tcg_temp_new(); save_cpu_state(VAR_1, 1); gen_helper_ei(t0, cpu_env); gen_store_gpr(t0, VAR_3); VAR_1->bstate = BS_STOP; tcg_temp_free(t0); } break; default: goto pool32axf_invalid; } break; #endif case 0x2d: switch (VAR_5) { case SYNC: break; case SYSCALL: generate_exception_end(VAR_1, EXCP_SYSCALL); break; case SDBBP: if (is_uhi(extract32(VAR_1->opcode, 16, 10))) { gen_helper_do_semihosting(cpu_env); } else { check_insn(VAR_1, ISA_MIPS32); if (VAR_1->hflags & MIPS_HFLAG_SBRI) { generate_exception_end(VAR_1, EXCP_RI); } else { generate_exception_end(VAR_1, EXCP_DBp); } } break; default: goto pool32axf_invalid; } break; case 0x01: switch (VAR_5 & 3) { case MFHI_ACC: gen_HILO(VAR_1, OPC_MFHI, VAR_5 >> 2, VAR_3); break; case MFLO_ACC: gen_HILO(VAR_1, OPC_MFLO, VAR_5 >> 2, VAR_3); break; case MTHI_ACC: gen_HILO(VAR_1, OPC_MTHI, VAR_5 >> 2, VAR_3); break; case MTLO_ACC: gen_HILO(VAR_1, OPC_MTLO, VAR_5 >> 2, VAR_3); break; default: goto pool32axf_invalid; } break; case 0x35: check_insn_opc_removed(VAR_1, ISA_MIPS32R6); switch (VAR_5) { case MFHI32: gen_HILO(VAR_1, OPC_MFHI, 0, VAR_3); break; case MFLO32: gen_HILO(VAR_1, OPC_MFLO, 0, VAR_3); break; case MTHI32: gen_HILO(VAR_1, OPC_MTHI, 0, VAR_3); break; case MTLO32: gen_HILO(VAR_1, OPC_MTLO, 0, VAR_3); break; default: goto pool32axf_invalid; } break; default: pool32axf_invalid: MIPS_INVAL("pool32axf"); generate_exception_end(VAR_1, EXCP_RI); break; } }
[ "static void FUNC_0 (CPUMIPSState *VAR_0, DisasContext *VAR_1, int VAR_2, int VAR_3)\n{", "int VAR_4 = (VAR_1->opcode >> 6) & 0x3f;", "int VAR_5 = (VAR_1->opcode >> 12) & 0xf;", "uint32_t mips32_op;", "switch (VAR_4) {", "case TEQ:\nmips32_op = OPC_TEQ;", "goto do_trap;", "case TGE:\nmips32_op = OPC_TGE;", "goto do_trap;", "case TGEU:\nmips32_op = OPC_TGEU;", "goto do_trap;", "case TLT:\nmips32_op = OPC_TLT;", "goto do_trap;", "case TLTU:\nmips32_op = OPC_TLTU;", "goto do_trap;", "case TNE:\nmips32_op = OPC_TNE;", "do_trap:\ngen_trap(VAR_1, mips32_op, VAR_3, VAR_2, -1);", "break;", "#ifndef CONFIG_USER_ONLY\ncase MFC0:\ncase MFC0 + 32:\ncheck_cp0_enabled(VAR_1);", "if (VAR_2 == 0) {", "break;", "}", "gen_mfc0(VAR_1, cpu_gpr[VAR_2], VAR_3, (VAR_1->opcode >> 11) & 0x7);", "break;", "case MTC0:\ncase MTC0 + 32:\ncheck_cp0_enabled(VAR_1);", "{", "TCGv t0 = tcg_temp_new();", "gen_load_gpr(t0, VAR_2);", "gen_mtc0(VAR_1, t0, VAR_3, (VAR_1->opcode >> 11) & 0x7);", "tcg_temp_free(t0);", "}", "break;", "#endif\ncase 0x2a:\nswitch (VAR_5 & 3) {", "case MADD_ACC:\ngen_muldiv(VAR_1, OPC_MADD, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2);", "break;", "case MADDU_ACC:\ngen_muldiv(VAR_1, OPC_MADDU, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2);", "break;", "case MSUB_ACC:\ngen_muldiv(VAR_1, OPC_MSUB, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2);", "break;", "case MSUBU_ACC:\ngen_muldiv(VAR_1, OPC_MSUBU, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2);", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "case 0x32:\nswitch (VAR_5 & 3) {", "case MULT_ACC:\ngen_muldiv(VAR_1, OPC_MULT, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2);", "break;", "case MULTU_ACC:\ngen_muldiv(VAR_1, OPC_MULTU, (VAR_1->opcode >> 14) & 3, VAR_3, VAR_2);", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "case 0x2c:\nswitch (VAR_5) {", "case BITSWAP:\ncheck_insn(VAR_1, ISA_MIPS32R6);", "gen_bitswap(VAR_1, OPC_BITSWAP, VAR_3, VAR_2);", "break;", "case SEB:\ngen_bshfl(VAR_1, OPC_SEB, VAR_3, VAR_2);", "break;", "case SEH:\ngen_bshfl(VAR_1, OPC_SEH, VAR_3, VAR_2);", "break;", "case CLO:\nmips32_op = OPC_CLO;", "goto do_cl;", "case CLZ:\nmips32_op = OPC_CLZ;", "do_cl:\ncheck_insn(VAR_1, ISA_MIPS32);", "gen_cl(VAR_1, mips32_op, VAR_2, VAR_3);", "break;", "case RDHWR:\ngen_rdhwr(VAR_1, VAR_2, VAR_3);", "break;", "case WSBH:\ngen_bshfl(VAR_1, OPC_WSBH, VAR_3, VAR_2);", "break;", "case MULT:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "mips32_op = OPC_MULT;", "goto do_mul;", "case MULTU:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "mips32_op = OPC_MULTU;", "goto do_mul;", "case DIV:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "mips32_op = OPC_DIV;", "goto do_div;", "case DIVU:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "mips32_op = OPC_DIVU;", "goto do_div;", "do_div:\ncheck_insn(VAR_1, ISA_MIPS32);", "gen_muldiv(VAR_1, mips32_op, 0, VAR_3, VAR_2);", "break;", "case MADD:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "mips32_op = OPC_MADD;", "goto do_mul;", "case MADDU:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "mips32_op = OPC_MADDU;", "goto do_mul;", "case MSUB:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "mips32_op = OPC_MSUB;", "goto do_mul;", "case MSUBU:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "mips32_op = OPC_MSUBU;", "do_mul:\ncheck_insn(VAR_1, ISA_MIPS32);", "gen_muldiv(VAR_1, mips32_op, 0, VAR_3, VAR_2);", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "case 0x34:\nswitch (VAR_5) {", "case MFC2:\ncase MTC2:\ncase MFHC2:\ncase MTHC2:\ncase CFC2:\ncase CTC2:\ngenerate_exception_err(VAR_1, EXCP_CpU, 2);", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "case 0x3c:\nswitch (VAR_5) {", "case JALR:\ncase JALR_HB:\nif (VAR_1->insn_flags & ISA_MIPS32R6) {", "gen_compute_branch(VAR_1, OPC_JALR, 4, VAR_3, VAR_2, 0, 0);", "} else {", "gen_compute_branch(VAR_1, OPC_JALR, 4, VAR_3, VAR_2, 0, 4);", "VAR_1->hflags |= MIPS_HFLAG_BDS_STRICT;", "}", "break;", "case JALRS:\ncase JALRS_HB:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "gen_compute_branch(VAR_1, OPC_JALR, 4, VAR_3, VAR_2, 0, 2);", "VAR_1->hflags |= MIPS_HFLAG_BDS_STRICT;", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "case 0x05:\nswitch (VAR_5) {", "case RDPGPR:\ncheck_cp0_enabled(VAR_1);", "check_insn(VAR_1, ISA_MIPS32R2);", "gen_load_srsgpr(VAR_3, VAR_2);", "break;", "case WRPGPR:\ncheck_cp0_enabled(VAR_1);", "check_insn(VAR_1, ISA_MIPS32R2);", "gen_store_srsgpr(VAR_3, VAR_2);", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "#ifndef CONFIG_USER_ONLY\ncase 0x0d:\nswitch (VAR_5) {", "case TLBP:\nmips32_op = OPC_TLBP;", "goto do_cp0;", "case TLBR:\nmips32_op = OPC_TLBR;", "goto do_cp0;", "case TLBWI:\nmips32_op = OPC_TLBWI;", "goto do_cp0;", "case TLBWR:\nmips32_op = OPC_TLBWR;", "goto do_cp0;", "case TLBINV:\nmips32_op = OPC_TLBINV;", "goto do_cp0;", "case TLBINVF:\nmips32_op = OPC_TLBINVF;", "goto do_cp0;", "case WAIT:\nmips32_op = OPC_WAIT;", "goto do_cp0;", "case DERET:\nmips32_op = OPC_DERET;", "goto do_cp0;", "case ERET:\nmips32_op = OPC_ERET;", "do_cp0:\ngen_cp0(VAR_0, VAR_1, mips32_op, VAR_2, VAR_3);", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "case 0x1d:\nswitch (VAR_5) {", "case DI:\ncheck_cp0_enabled(VAR_1);", "{", "TCGv t0 = tcg_temp_new();", "save_cpu_state(VAR_1, 1);", "gen_helper_di(t0, cpu_env);", "gen_store_gpr(t0, VAR_3);", "VAR_1->bstate = BS_STOP;", "tcg_temp_free(t0);", "}", "break;", "case EI:\ncheck_cp0_enabled(VAR_1);", "{", "TCGv t0 = tcg_temp_new();", "save_cpu_state(VAR_1, 1);", "gen_helper_ei(t0, cpu_env);", "gen_store_gpr(t0, VAR_3);", "VAR_1->bstate = BS_STOP;", "tcg_temp_free(t0);", "}", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "#endif\ncase 0x2d:\nswitch (VAR_5) {", "case SYNC:\nbreak;", "case SYSCALL:\ngenerate_exception_end(VAR_1, EXCP_SYSCALL);", "break;", "case SDBBP:\nif (is_uhi(extract32(VAR_1->opcode, 16, 10))) {", "gen_helper_do_semihosting(cpu_env);", "} else {", "check_insn(VAR_1, ISA_MIPS32);", "if (VAR_1->hflags & MIPS_HFLAG_SBRI) {", "generate_exception_end(VAR_1, EXCP_RI);", "} else {", "generate_exception_end(VAR_1, EXCP_DBp);", "}", "}", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "case 0x01:\nswitch (VAR_5 & 3) {", "case MFHI_ACC:\ngen_HILO(VAR_1, OPC_MFHI, VAR_5 >> 2, VAR_3);", "break;", "case MFLO_ACC:\ngen_HILO(VAR_1, OPC_MFLO, VAR_5 >> 2, VAR_3);", "break;", "case MTHI_ACC:\ngen_HILO(VAR_1, OPC_MTHI, VAR_5 >> 2, VAR_3);", "break;", "case MTLO_ACC:\ngen_HILO(VAR_1, OPC_MTLO, VAR_5 >> 2, VAR_3);", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "case 0x35:\ncheck_insn_opc_removed(VAR_1, ISA_MIPS32R6);", "switch (VAR_5) {", "case MFHI32:\ngen_HILO(VAR_1, OPC_MFHI, 0, VAR_3);", "break;", "case MFLO32:\ngen_HILO(VAR_1, OPC_MFLO, 0, VAR_3);", "break;", "case MTHI32:\ngen_HILO(VAR_1, OPC_MTHI, 0, VAR_3);", "break;", "case MTLO32:\ngen_HILO(VAR_1, OPC_MTLO, 0, VAR_3);", "break;", "default:\ngoto pool32axf_invalid;", "}", "break;", "default:\npool32axf_invalid:\nMIPS_INVAL(\"pool32axf\");", "generate_exception_end(VAR_1, EXCP_RI);", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49, 51 ], [ 53 ], [ 55, 57, 59, 61 ], [ 63 ], [ 67 ], [ 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, 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139, 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189, 191 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213, 215 ], [ 217 ], [ 219 ], [ 221, 223 ], [ 225 ], [ 227 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241 ], [ 243 ], [ 245, 247 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 267 ], [ 269, 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283, 285 ], [ 287 ], [ 289 ], [ 291, 293 ], [ 295 ], [ 297 ], [ 299, 301 ], [ 303, 305, 307, 309, 311, 313, 315 ], [ 317 ], [ 319, 321 ], [ 323 ], [ 325 ], [ 327, 329 ], [ 331, 333, 335 ], [ 339 ], [ 341 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353, 355, 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365, 367 ], [ 369 ], [ 371 ], [ 373, 375 ], [ 377, 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387, 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397, 399 ], [ 401 ], [ 403 ], [ 405, 407, 409 ], [ 411, 413 ], [ 415 ], [ 417, 419 ], [ 421 ], [ 423, 425 ], [ 427 ], [ 429, 431 ], [ 433 ], [ 435, 437 ], [ 439 ], [ 441, 443 ], [ 445 ], [ 447, 449 ], [ 451 ], [ 453, 455 ], [ 457 ], [ 459, 461 ], [ 463, 465 ], [ 467 ], [ 469, 471 ], [ 473 ], [ 475 ], [ 477, 479 ], [ 481, 483 ], [ 485 ], [ 487 ], [ 491 ], [ 493 ], [ 495 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507, 509 ], [ 511 ], [ 513 ], [ 517 ], [ 519 ], [ 521 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533, 535 ], [ 537 ], [ 539 ], [ 541, 543, 545 ], [ 547, 551 ], [ 553, 555 ], [ 557 ], [ 559, 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583, 585 ], [ 587 ], [ 589 ], [ 591, 593 ], [ 595, 597 ], [ 599 ], [ 601, 603 ], [ 605 ], [ 607, 609 ], [ 611 ], [ 613, 615 ], [ 617 ], [ 619, 621 ], [ 623 ], [ 625 ], [ 627, 629 ], [ 631 ], [ 633, 635 ], [ 637 ], [ 639, 641 ], [ 643 ], [ 645, 647 ], [ 649 ], [ 651, 653 ], [ 655 ], [ 657, 659 ], [ 661 ], [ 663 ], [ 665, 667, 669 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ] ]
806
void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_select, int16_t (*mv_table)[2], int f_code, int type, int truncate) { MotionEstContext * const c= &s->me; int y, h_range, v_range; // RAL: 8 in MPEG-1, 16 in MPEG-4 int range = (((s->out_format == FMT_MPEG1) ? 8 : 16) << f_code); if(s->msmpeg4_version) range= 16; if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range; h_range= range; v_range= field_select_table ? range>>1 : range; /* clip / convert to intra 16x16 type MVs */ for(y=0; y<s->mb_height; y++){ int x; int xy= y*s->mb_stride; for(x=0; x<s->mb_width; x++){ if (s->mb_type[xy] & type){ // RAL: "type" test added... if(field_select_table==NULL || field_select_table[xy] == field_select){ if( mv_table[xy][0] >=h_range || mv_table[xy][0] <-h_range || mv_table[xy][1] >=v_range || mv_table[xy][1] <-v_range){ if(truncate){ if (mv_table[xy][0] > h_range-1) mv_table[xy][0]= h_range-1; else if(mv_table[xy][0] < -h_range ) mv_table[xy][0]= -h_range; if (mv_table[xy][1] > v_range-1) mv_table[xy][1]= v_range-1; else if(mv_table[xy][1] < -v_range ) mv_table[xy][1]= -v_range; }else{ s->mb_type[xy] &= ~type; s->mb_type[xy] |= CANDIDATE_MB_TYPE_INTRA; mv_table[xy][0]= mv_table[xy][1]= 0; } } } } xy++; } } }
false
FFmpeg
2f300f8965793c3bb9f9d753fcd4542f94f4c58a
void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_select, int16_t (*mv_table)[2], int f_code, int type, int truncate) { MotionEstContext * const c= &s->me; int y, h_range, v_range; int range = (((s->out_format == FMT_MPEG1) ? 8 : 16) << f_code); if(s->msmpeg4_version) range= 16; if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range; h_range= range; v_range= field_select_table ? range>>1 : range; for(y=0; y<s->mb_height; y++){ int x; int xy= y*s->mb_stride; for(x=0; x<s->mb_width; x++){ if (s->mb_type[xy] & type){ if(field_select_table==NULL || field_select_table[xy] == field_select){ if( mv_table[xy][0] >=h_range || mv_table[xy][0] <-h_range || mv_table[xy][1] >=v_range || mv_table[xy][1] <-v_range){ if(truncate){ if (mv_table[xy][0] > h_range-1) mv_table[xy][0]= h_range-1; else if(mv_table[xy][0] < -h_range ) mv_table[xy][0]= -h_range; if (mv_table[xy][1] > v_range-1) mv_table[xy][1]= v_range-1; else if(mv_table[xy][1] < -v_range ) mv_table[xy][1]= -v_range; }else{ s->mb_type[xy] &= ~type; s->mb_type[xy] |= CANDIDATE_MB_TYPE_INTRA; mv_table[xy][0]= mv_table[xy][1]= 0; } } } } xy++; } } }
{ "code": [], "line_no": [] }
void FUNC_0(MpegEncContext * VAR_0, uint8_t *VAR_1, int VAR_2, VAR_3 (*mv_table)[2], int VAR_4, int VAR_5, int VAR_6) { MotionEstContext * const c= &VAR_0->me; int VAR_7, VAR_8, VAR_9; int VAR_10 = (((VAR_0->out_format == FMT_MPEG1) ? 8 : 16) << VAR_4); if(VAR_0->msmpeg4_version) VAR_10= 16; if(c->avctx->me_range && VAR_10 > c->avctx->me_range) VAR_10= c->avctx->me_range; VAR_8= VAR_10; VAR_9= VAR_1 ? VAR_10>>1 : VAR_10; for(VAR_7=0; VAR_7<VAR_0->mb_height; VAR_7++){ int x; int xy= VAR_7*VAR_0->mb_stride; for(x=0; x<VAR_0->mb_width; x++){ if (VAR_0->mb_type[xy] & VAR_5){ if(VAR_1==NULL || VAR_1[xy] == VAR_2){ if( mv_table[xy][0] >=VAR_8 || mv_table[xy][0] <-VAR_8 || mv_table[xy][1] >=VAR_9 || mv_table[xy][1] <-VAR_9){ if(VAR_6){ if (mv_table[xy][0] > VAR_8-1) mv_table[xy][0]= VAR_8-1; else if(mv_table[xy][0] < -VAR_8 ) mv_table[xy][0]= -VAR_8; if (mv_table[xy][1] > VAR_9-1) mv_table[xy][1]= VAR_9-1; else if(mv_table[xy][1] < -VAR_9 ) mv_table[xy][1]= -VAR_9; }else{ VAR_0->mb_type[xy] &= ~VAR_5; VAR_0->mb_type[xy] |= CANDIDATE_MB_TYPE_INTRA; mv_table[xy][0]= mv_table[xy][1]= 0; } } } } xy++; } } }
[ "void FUNC_0(MpegEncContext * VAR_0, uint8_t *VAR_1, int VAR_2,\nVAR_3 (*mv_table)[2], int VAR_4, int VAR_5, int VAR_6)\n{", "MotionEstContext * const c= &VAR_0->me;", "int VAR_7, VAR_8, VAR_9;", "int VAR_10 = (((VAR_0->out_format == FMT_MPEG1) ? 8 : 16) << VAR_4);", "if(VAR_0->msmpeg4_version) VAR_10= 16;", "if(c->avctx->me_range && VAR_10 > c->avctx->me_range) VAR_10= c->avctx->me_range;", "VAR_8= VAR_10;", "VAR_9= VAR_1 ? VAR_10>>1 : VAR_10;", "for(VAR_7=0; VAR_7<VAR_0->mb_height; VAR_7++){", "int x;", "int xy= VAR_7*VAR_0->mb_stride;", "for(x=0; x<VAR_0->mb_width; x++){", "if (VAR_0->mb_type[xy] & VAR_5){", "if(VAR_1==NULL || VAR_1[xy] == VAR_2){", "if( mv_table[xy][0] >=VAR_8 || mv_table[xy][0] <-VAR_8\n|| mv_table[xy][1] >=VAR_9 || mv_table[xy][1] <-VAR_9){", "if(VAR_6){", "if (mv_table[xy][0] > VAR_8-1) mv_table[xy][0]= VAR_8-1;", "else if(mv_table[xy][0] < -VAR_8 ) mv_table[xy][0]= -VAR_8;", "if (mv_table[xy][1] > VAR_9-1) mv_table[xy][1]= VAR_9-1;", "else if(mv_table[xy][1] < -VAR_9 ) mv_table[xy][1]= -VAR_9;", "}else{", "VAR_0->mb_type[xy] &= ~VAR_5;", "VAR_0->mb_type[xy] |= CANDIDATE_MB_TYPE_INTRA;", "mv_table[xy][0]=\nmv_table[xy][1]= 0;", "}", "}", "}", "}", "xy++;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ] ]
807
ThreadPool *thread_pool_new(AioContext *ctx) { ThreadPool *pool = g_new(ThreadPool, 1); thread_pool_init_one(pool, ctx); return pool; }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
ThreadPool *thread_pool_new(AioContext *ctx) { ThreadPool *pool = g_new(ThreadPool, 1); thread_pool_init_one(pool, ctx); return pool; }
{ "code": [], "line_no": [] }
ThreadPool *FUNC_0(AioContext *ctx) { ThreadPool *pool = g_new(ThreadPool, 1); thread_pool_init_one(pool, ctx); return pool; }
[ "ThreadPool *FUNC_0(AioContext *ctx)\n{", "ThreadPool *pool = g_new(ThreadPool, 1);", "thread_pool_init_one(pool, ctx);", "return pool;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
808
static int parse_bootdevices(char *devices) { /* We just do some generic consistency checks */ const char *p; int bitmap = 0; for (p = devices; *p != '\0'; p++) { /* Allowed boot devices are: * a-b: floppy disk drives * c-f: IDE disk drives * g-m: machine implementation dependant drives * n-p: network devices * It's up to each machine implementation to check if the given boot * devices match the actual hardware implementation and firmware * features. */ if (*p < 'a' || *p > 'p') { fprintf(stderr, "Invalid boot device '%c'\n", *p); exit(1); } if (bitmap & (1 << (*p - 'a'))) { fprintf(stderr, "Boot device '%c' was given twice\n", *p); exit(1); } bitmap |= 1 << (*p - 'a'); } return bitmap; }
false
qemu
4e9e9d6e0a68f1691bcdcc80601a9a1bc2954736
static int parse_bootdevices(char *devices) { const char *p; int bitmap = 0; for (p = devices; *p != '\0'; p++) { if (*p < 'a' || *p > 'p') { fprintf(stderr, "Invalid boot device '%c'\n", *p); exit(1); } if (bitmap & (1 << (*p - 'a'))) { fprintf(stderr, "Boot device '%c' was given twice\n", *p); exit(1); } bitmap |= 1 << (*p - 'a'); } return bitmap; }
{ "code": [], "line_no": [] }
static int FUNC_0(char *VAR_0) { const char *VAR_1; int VAR_2 = 0; for (VAR_1 = VAR_0; *VAR_1 != '\0'; VAR_1++) { if (*VAR_1 < 'a' || *VAR_1 > 'VAR_1') { fprintf(stderr, "Invalid boot device '%c'\n", *VAR_1); exit(1); } if (VAR_2 & (1 << (*VAR_1 - 'a'))) { fprintf(stderr, "Boot device '%c' was given twice\n", *VAR_1); exit(1); } VAR_2 |= 1 << (*VAR_1 - 'a'); } return VAR_2; }
[ "static int FUNC_0(char *VAR_0)\n{", "const char *VAR_1;", "int VAR_2 = 0;", "for (VAR_1 = VAR_0; *VAR_1 != '\\0'; VAR_1++) {", "if (*VAR_1 < 'a' || *VAR_1 > 'VAR_1') {", "fprintf(stderr, \"Invalid boot device '%c'\\n\", *VAR_1);", "exit(1);", "}", "if (VAR_2 & (1 << (*VAR_1 - 'a'))) {", "fprintf(stderr, \"Boot device '%c' was given twice\\n\", *VAR_1);", "exit(1);", "}", "VAR_2 |= 1 << (*VAR_1 - 'a');", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 13 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ] ]
809
static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1, TCGReg arg2, int label_index) { static const MIPSInsn b_zero[16] = { [TCG_COND_LT] = OPC_BLTZ, [TCG_COND_GT] = OPC_BGTZ, [TCG_COND_LE] = OPC_BLEZ, [TCG_COND_GE] = OPC_BGEZ, }; TCGLabel *l; MIPSInsn s_opc = OPC_SLTU; MIPSInsn b_opc; int cmp_map; switch (cond) { case TCG_COND_EQ: b_opc = OPC_BEQ; break; case TCG_COND_NE: b_opc = OPC_BNE; break; case TCG_COND_LT: case TCG_COND_GT: case TCG_COND_LE: case TCG_COND_GE: if (arg2 == 0) { b_opc = b_zero[cond]; arg2 = arg1; arg1 = 0; break; } s_opc = OPC_SLT; /* FALLTHRU */ case TCG_COND_LTU: case TCG_COND_GTU: case TCG_COND_LEU: case TCG_COND_GEU: cmp_map = mips_cmp_map[cond]; if (cmp_map & MIPS_CMP_SWAP) { TCGReg t = arg1; arg1 = arg2; arg2 = t; } tcg_out_opc_reg(s, s_opc, TCG_TMP0, arg1, arg2); b_opc = (cmp_map & MIPS_CMP_INV ? OPC_BEQ : OPC_BNE); arg1 = TCG_TMP0; arg2 = TCG_REG_ZERO; break; default: tcg_abort(); break; } tcg_out_opc_br(s, b_opc, arg1, arg2); l = &s->labels[label_index]; if (l->has_value) { reloc_pc16(s->code_ptr - 1, l->u.value_ptr); } else { tcg_out_reloc(s, s->code_ptr - 1, R_MIPS_PC16, label_index, 0); } tcg_out_nop(s); }
false
qemu
bec1631100323fac0900aea71043d5c4e22fc2fa
static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1, TCGReg arg2, int label_index) { static const MIPSInsn b_zero[16] = { [TCG_COND_LT] = OPC_BLTZ, [TCG_COND_GT] = OPC_BGTZ, [TCG_COND_LE] = OPC_BLEZ, [TCG_COND_GE] = OPC_BGEZ, }; TCGLabel *l; MIPSInsn s_opc = OPC_SLTU; MIPSInsn b_opc; int cmp_map; switch (cond) { case TCG_COND_EQ: b_opc = OPC_BEQ; break; case TCG_COND_NE: b_opc = OPC_BNE; break; case TCG_COND_LT: case TCG_COND_GT: case TCG_COND_LE: case TCG_COND_GE: if (arg2 == 0) { b_opc = b_zero[cond]; arg2 = arg1; arg1 = 0; break; } s_opc = OPC_SLT; case TCG_COND_LTU: case TCG_COND_GTU: case TCG_COND_LEU: case TCG_COND_GEU: cmp_map = mips_cmp_map[cond]; if (cmp_map & MIPS_CMP_SWAP) { TCGReg t = arg1; arg1 = arg2; arg2 = t; } tcg_out_opc_reg(s, s_opc, TCG_TMP0, arg1, arg2); b_opc = (cmp_map & MIPS_CMP_INV ? OPC_BEQ : OPC_BNE); arg1 = TCG_TMP0; arg2 = TCG_REG_ZERO; break; default: tcg_abort(); break; } tcg_out_opc_br(s, b_opc, arg1, arg2); l = &s->labels[label_index]; if (l->has_value) { reloc_pc16(s->code_ptr - 1, l->u.value_ptr); } else { tcg_out_reloc(s, s->code_ptr - 1, R_MIPS_PC16, label_index, 0); } tcg_out_nop(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0, TCGCond VAR_1, TCGReg VAR_2, TCGReg VAR_3, int VAR_4) { static const MIPSInsn VAR_5[16] = { [TCG_COND_LT] = OPC_BLTZ, [TCG_COND_GT] = OPC_BGTZ, [TCG_COND_LE] = OPC_BLEZ, [TCG_COND_GE] = OPC_BGEZ, }; TCGLabel *l; MIPSInsn s_opc = OPC_SLTU; MIPSInsn b_opc; int VAR_6; switch (VAR_1) { case TCG_COND_EQ: b_opc = OPC_BEQ; break; case TCG_COND_NE: b_opc = OPC_BNE; break; case TCG_COND_LT: case TCG_COND_GT: case TCG_COND_LE: case TCG_COND_GE: if (VAR_3 == 0) { b_opc = VAR_5[VAR_1]; VAR_3 = VAR_2; VAR_2 = 0; break; } s_opc = OPC_SLT; case TCG_COND_LTU: case TCG_COND_GTU: case TCG_COND_LEU: case TCG_COND_GEU: VAR_6 = mips_cmp_map[VAR_1]; if (VAR_6 & MIPS_CMP_SWAP) { TCGReg t = VAR_2; VAR_2 = VAR_3; VAR_3 = t; } tcg_out_opc_reg(VAR_0, s_opc, TCG_TMP0, VAR_2, VAR_3); b_opc = (VAR_6 & MIPS_CMP_INV ? OPC_BEQ : OPC_BNE); VAR_2 = TCG_TMP0; VAR_3 = TCG_REG_ZERO; break; default: tcg_abort(); break; } tcg_out_opc_br(VAR_0, b_opc, VAR_2, VAR_3); l = &VAR_0->labels[VAR_4]; if (l->has_value) { reloc_pc16(VAR_0->code_ptr - 1, l->u.value_ptr); } else { tcg_out_reloc(VAR_0, VAR_0->code_ptr - 1, R_MIPS_PC16, VAR_4, 0); } tcg_out_nop(VAR_0); }
[ "static void FUNC_0(TCGContext *VAR_0, TCGCond VAR_1, TCGReg VAR_2,\nTCGReg VAR_3, int VAR_4)\n{", "static const MIPSInsn VAR_5[16] = {", "[TCG_COND_LT] = OPC_BLTZ,\n[TCG_COND_GT] = OPC_BGTZ,\n[TCG_COND_LE] = OPC_BLEZ,\n[TCG_COND_GE] = OPC_BGEZ,\n};", "TCGLabel *l;", "MIPSInsn s_opc = OPC_SLTU;", "MIPSInsn b_opc;", "int VAR_6;", "switch (VAR_1) {", "case TCG_COND_EQ:\nb_opc = OPC_BEQ;", "break;", "case TCG_COND_NE:\nb_opc = OPC_BNE;", "break;", "case TCG_COND_LT:\ncase TCG_COND_GT:\ncase TCG_COND_LE:\ncase TCG_COND_GE:\nif (VAR_3 == 0) {", "b_opc = VAR_5[VAR_1];", "VAR_3 = VAR_2;", "VAR_2 = 0;", "break;", "}", "s_opc = OPC_SLT;", "case TCG_COND_LTU:\ncase TCG_COND_GTU:\ncase TCG_COND_LEU:\ncase TCG_COND_GEU:\nVAR_6 = mips_cmp_map[VAR_1];", "if (VAR_6 & MIPS_CMP_SWAP) {", "TCGReg t = VAR_2;", "VAR_2 = VAR_3;", "VAR_3 = t;", "}", "tcg_out_opc_reg(VAR_0, s_opc, TCG_TMP0, VAR_2, VAR_3);", "b_opc = (VAR_6 & MIPS_CMP_INV ? OPC_BEQ : OPC_BNE);", "VAR_2 = TCG_TMP0;", "VAR_3 = TCG_REG_ZERO;", "break;", "default:\ntcg_abort();", "break;", "}", "tcg_out_opc_br(VAR_0, b_opc, VAR_2, VAR_3);", "l = &VAR_0->labels[VAR_4];", "if (l->has_value) {", "reloc_pc16(VAR_0->code_ptr - 1, l->u.value_ptr);", "} else {", "tcg_out_reloc(VAR_0, VAR_0->code_ptr - 1, R_MIPS_PC16, VAR_4, 0);", "}", "tcg_out_nop(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11, 13, 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 47, 49, 51, 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 73, 75, 77, 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ] ]
810
static unsigned int dec_move_rp(DisasContext *dc) { TCGv t[2]; DIS(fprintf (logfile, "move $r%u, $p%u\n", dc->op1, dc->op2)); cris_cc_mask(dc, 0); t[0] = tcg_temp_new(TCG_TYPE_TL); if (dc->op2 == PR_CCS) { cris_evaluate_flags(dc); t_gen_mov_TN_reg(t[0], dc->op1); if (dc->tb_flags & U_FLAG) { t[1] = tcg_temp_new(TCG_TYPE_TL); /* User space is not allowed to touch all flags. */ tcg_gen_andi_tl(t[0], t[0], 0x39f); tcg_gen_andi_tl(t[1], cpu_PR[PR_CCS], ~0x39f); tcg_gen_or_tl(t[0], t[1], t[0]); tcg_temp_free(t[1]); } } else t_gen_mov_TN_reg(t[0], dc->op1); t_gen_mov_preg_TN(dc, dc->op2, t[0]); if (dc->op2 == PR_CCS) { cris_update_cc_op(dc, CC_OP_FLAGS, 4); dc->flags_uptodate = 1; } tcg_temp_free(t[0]); return 2; }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static unsigned int dec_move_rp(DisasContext *dc) { TCGv t[2]; DIS(fprintf (logfile, "move $r%u, $p%u\n", dc->op1, dc->op2)); cris_cc_mask(dc, 0); t[0] = tcg_temp_new(TCG_TYPE_TL); if (dc->op2 == PR_CCS) { cris_evaluate_flags(dc); t_gen_mov_TN_reg(t[0], dc->op1); if (dc->tb_flags & U_FLAG) { t[1] = tcg_temp_new(TCG_TYPE_TL); tcg_gen_andi_tl(t[0], t[0], 0x39f); tcg_gen_andi_tl(t[1], cpu_PR[PR_CCS], ~0x39f); tcg_gen_or_tl(t[0], t[1], t[0]); tcg_temp_free(t[1]); } } else t_gen_mov_TN_reg(t[0], dc->op1); t_gen_mov_preg_TN(dc, dc->op2, t[0]); if (dc->op2 == PR_CCS) { cris_update_cc_op(dc, CC_OP_FLAGS, 4); dc->flags_uptodate = 1; } tcg_temp_free(t[0]); return 2; }
{ "code": [], "line_no": [] }
static unsigned int FUNC_0(DisasContext *VAR_0) { TCGv t[2]; DIS(fprintf (logfile, "move $r%u, $p%u\n", VAR_0->op1, VAR_0->op2)); cris_cc_mask(VAR_0, 0); t[0] = tcg_temp_new(TCG_TYPE_TL); if (VAR_0->op2 == PR_CCS) { cris_evaluate_flags(VAR_0); t_gen_mov_TN_reg(t[0], VAR_0->op1); if (VAR_0->tb_flags & U_FLAG) { t[1] = tcg_temp_new(TCG_TYPE_TL); tcg_gen_andi_tl(t[0], t[0], 0x39f); tcg_gen_andi_tl(t[1], cpu_PR[PR_CCS], ~0x39f); tcg_gen_or_tl(t[0], t[1], t[0]); tcg_temp_free(t[1]); } } else t_gen_mov_TN_reg(t[0], VAR_0->op1); t_gen_mov_preg_TN(VAR_0, VAR_0->op2, t[0]); if (VAR_0->op2 == PR_CCS) { cris_update_cc_op(VAR_0, CC_OP_FLAGS, 4); VAR_0->flags_uptodate = 1; } tcg_temp_free(t[0]); return 2; }
[ "static unsigned int FUNC_0(DisasContext *VAR_0)\n{", "TCGv t[2];", "DIS(fprintf (logfile, \"move $r%u, $p%u\\n\", VAR_0->op1, VAR_0->op2));", "cris_cc_mask(VAR_0, 0);", "t[0] = tcg_temp_new(TCG_TYPE_TL);", "if (VAR_0->op2 == PR_CCS) {", "cris_evaluate_flags(VAR_0);", "t_gen_mov_TN_reg(t[0], VAR_0->op1);", "if (VAR_0->tb_flags & U_FLAG) {", "t[1] = tcg_temp_new(TCG_TYPE_TL);", "tcg_gen_andi_tl(t[0], t[0], 0x39f);", "tcg_gen_andi_tl(t[1], cpu_PR[PR_CCS], ~0x39f);", "tcg_gen_or_tl(t[0], t[1], t[0]);", "tcg_temp_free(t[1]);", "}", "}", "else\nt_gen_mov_TN_reg(t[0], VAR_0->op1);", "t_gen_mov_preg_TN(VAR_0, VAR_0->op2, t[0]);", "if (VAR_0->op2 == PR_CCS) {", "cris_update_cc_op(VAR_0, CC_OP_FLAGS, 4);", "VAR_0->flags_uptodate = 1;", "}", "tcg_temp_free(t[0]);", "return 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
811
static uint32_t get_elf_hwcap(void) { ARMCPU *cpu = ARM_CPU(thread_cpu); uint32_t hwcaps = 0; hwcaps |= ARM_HWCAP_ARM_SWP; hwcaps |= ARM_HWCAP_ARM_HALF; hwcaps |= ARM_HWCAP_ARM_THUMB; hwcaps |= ARM_HWCAP_ARM_FAST_MULT; /* probe for the extra features */ #define GET_FEATURE(feat, hwcap) \ do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0) /* EDSP is in v5TE and above, but all our v5 CPUs are v5TE */ GET_FEATURE(ARM_FEATURE_V5, ARM_HWCAP_ARM_EDSP); GET_FEATURE(ARM_FEATURE_VFP, ARM_HWCAP_ARM_VFP); GET_FEATURE(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT); GET_FEATURE(ARM_FEATURE_THUMB2EE, ARM_HWCAP_ARM_THUMBEE); GET_FEATURE(ARM_FEATURE_NEON, ARM_HWCAP_ARM_NEON); GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPv3); GET_FEATURE(ARM_FEATURE_V6K, ARM_HWCAP_ARM_TLS); GET_FEATURE(ARM_FEATURE_VFP4, ARM_HWCAP_ARM_VFPv4); GET_FEATURE(ARM_FEATURE_ARM_DIV, ARM_HWCAP_ARM_IDIVA); GET_FEATURE(ARM_FEATURE_THUMB_DIV, ARM_HWCAP_ARM_IDIVT); /* All QEMU's VFPv3 CPUs have 32 registers, see VFP_DREG in translate.c. * Note that the ARM_HWCAP_ARM_VFPv3D16 bit is always the inverse of * ARM_HWCAP_ARM_VFPD32 (and so always clear for QEMU); it is unrelated * to our VFP_FP16 feature bit. */ GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPD32); GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE); #undef GET_FEATURE return hwcaps; }
false
qemu
ad6919dc0ab3b8ae26d772e883aa8e709785d249
static uint32_t get_elf_hwcap(void) { ARMCPU *cpu = ARM_CPU(thread_cpu); uint32_t hwcaps = 0; hwcaps |= ARM_HWCAP_ARM_SWP; hwcaps |= ARM_HWCAP_ARM_HALF; hwcaps |= ARM_HWCAP_ARM_THUMB; hwcaps |= ARM_HWCAP_ARM_FAST_MULT; #define GET_FEATURE(feat, hwcap) \ do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0) GET_FEATURE(ARM_FEATURE_V5, ARM_HWCAP_ARM_EDSP); GET_FEATURE(ARM_FEATURE_VFP, ARM_HWCAP_ARM_VFP); GET_FEATURE(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT); GET_FEATURE(ARM_FEATURE_THUMB2EE, ARM_HWCAP_ARM_THUMBEE); GET_FEATURE(ARM_FEATURE_NEON, ARM_HWCAP_ARM_NEON); GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPv3); GET_FEATURE(ARM_FEATURE_V6K, ARM_HWCAP_ARM_TLS); GET_FEATURE(ARM_FEATURE_VFP4, ARM_HWCAP_ARM_VFPv4); GET_FEATURE(ARM_FEATURE_ARM_DIV, ARM_HWCAP_ARM_IDIVA); GET_FEATURE(ARM_FEATURE_THUMB_DIV, ARM_HWCAP_ARM_IDIVT); GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPD32); GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE); #undef GET_FEATURE return hwcaps; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(void) { ARMCPU *cpu = ARM_CPU(thread_cpu); uint32_t hwcaps = 0; hwcaps |= ARM_HWCAP_ARM_SWP; hwcaps |= ARM_HWCAP_ARM_HALF; hwcaps |= ARM_HWCAP_ARM_THUMB; hwcaps |= ARM_HWCAP_ARM_FAST_MULT; #define GET_FEATURE(feat, hwcap) \ do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0) GET_FEATURE(ARM_FEATURE_V5, ARM_HWCAP_ARM_EDSP); GET_FEATURE(ARM_FEATURE_VFP, ARM_HWCAP_ARM_VFP); GET_FEATURE(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT); GET_FEATURE(ARM_FEATURE_THUMB2EE, ARM_HWCAP_ARM_THUMBEE); GET_FEATURE(ARM_FEATURE_NEON, ARM_HWCAP_ARM_NEON); GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPv3); GET_FEATURE(ARM_FEATURE_V6K, ARM_HWCAP_ARM_TLS); GET_FEATURE(ARM_FEATURE_VFP4, ARM_HWCAP_ARM_VFPv4); GET_FEATURE(ARM_FEATURE_ARM_DIV, ARM_HWCAP_ARM_IDIVA); GET_FEATURE(ARM_FEATURE_THUMB_DIV, ARM_HWCAP_ARM_IDIVT); GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPD32); GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE); #undef GET_FEATURE return hwcaps; }
[ "static uint32_t FUNC_0(void)\n{", "ARMCPU *cpu = ARM_CPU(thread_cpu);", "uint32_t hwcaps = 0;", "hwcaps |= ARM_HWCAP_ARM_SWP;", "hwcaps |= ARM_HWCAP_ARM_HALF;", "hwcaps |= ARM_HWCAP_ARM_THUMB;", "hwcaps |= ARM_HWCAP_ARM_FAST_MULT;", "#define GET_FEATURE(feat, hwcap) \\\ndo { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0)", "GET_FEATURE(ARM_FEATURE_V5, ARM_HWCAP_ARM_EDSP);", "GET_FEATURE(ARM_FEATURE_VFP, ARM_HWCAP_ARM_VFP);", "GET_FEATURE(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT);", "GET_FEATURE(ARM_FEATURE_THUMB2EE, ARM_HWCAP_ARM_THUMBEE);", "GET_FEATURE(ARM_FEATURE_NEON, ARM_HWCAP_ARM_NEON);", "GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPv3);", "GET_FEATURE(ARM_FEATURE_V6K, ARM_HWCAP_ARM_TLS);", "GET_FEATURE(ARM_FEATURE_VFP4, ARM_HWCAP_ARM_VFPv4);", "GET_FEATURE(ARM_FEATURE_ARM_DIV, ARM_HWCAP_ARM_IDIVA);", "GET_FEATURE(ARM_FEATURE_THUMB_DIV, ARM_HWCAP_ARM_IDIVT);", "GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPD32);", "GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE);", "#undef GET_FEATURE\nreturn hwcaps;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 59 ], [ 61 ], [ 63, 67 ], [ 69 ] ]
812
static void test_visitor_out_native_list_uint64(TestOutputVisitorData *data, const void *unused) { test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_U64); }
false
qemu
b3db211f3c80bb996a704d665fe275619f728bd4
static void test_visitor_out_native_list_uint64(TestOutputVisitorData *data, const void *unused) { test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_U64); }
{ "code": [], "line_no": [] }
static void FUNC_0(TestOutputVisitorData *VAR_0, const void *VAR_1) { test_native_list(VAR_0, VAR_1, USER_DEF_NATIVE_LIST_UNION_KIND_U64); }
[ "static void FUNC_0(TestOutputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "test_native_list(VAR_0, VAR_1, USER_DEF_NATIVE_LIST_UNION_KIND_U64);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
813
BlockAIOCB *bdrv_aio_flush(BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque) { trace_bdrv_aio_flush(bs, opaque); Coroutine *co; BlockAIOCBCoroutine *acb; acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->need_bh = true; acb->req.error = -EINPROGRESS; co = qemu_coroutine_create(bdrv_aio_flush_co_entry); qemu_coroutine_enter(co, acb); bdrv_co_maybe_schedule_bh(acb); return &acb->common; }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
BlockAIOCB *bdrv_aio_flush(BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque) { trace_bdrv_aio_flush(bs, opaque); Coroutine *co; BlockAIOCBCoroutine *acb; acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->need_bh = true; acb->req.error = -EINPROGRESS; co = qemu_coroutine_create(bdrv_aio_flush_co_entry); qemu_coroutine_enter(co, acb); bdrv_co_maybe_schedule_bh(acb); return &acb->common; }
{ "code": [], "line_no": [] }
BlockAIOCB *FUNC_0(BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque) { trace_bdrv_aio_flush(bs, opaque); Coroutine *co; BlockAIOCBCoroutine *acb; acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->need_bh = true; acb->req.error = -EINPROGRESS; co = qemu_coroutine_create(bdrv_aio_flush_co_entry); qemu_coroutine_enter(co, acb); bdrv_co_maybe_schedule_bh(acb); return &acb->common; }
[ "BlockAIOCB *FUNC_0(BlockDriverState *bs,\nBlockCompletionFunc *cb, void *opaque)\n{", "trace_bdrv_aio_flush(bs, opaque);", "Coroutine *co;", "BlockAIOCBCoroutine *acb;", "acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);", "acb->need_bh = true;", "acb->req.error = -EINPROGRESS;", "co = qemu_coroutine_create(bdrv_aio_flush_co_entry);", "qemu_coroutine_enter(co, acb);", "bdrv_co_maybe_schedule_bh(acb);", "return &acb->common;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ] ]
816
xmit_seg(E1000State *s) { uint16_t len; unsigned int frames = s->tx.tso_frames, css, sofar; struct e1000_tx *tp = &s->tx; if (tp->props.tse && tp->props.cptse) { css = tp->props.ipcss; DBGOUT(TXSUM, "frames %d size %d ipcss %d\n", frames, tp->size, css); if (tp->props.ip) { /* IPv4 */ stw_be_p(tp->data+css+2, tp->size - css); stw_be_p(tp->data+css+4, lduw_be_p(tp->data + css + 4) + frames); } else { /* IPv6 */ stw_be_p(tp->data+css+4, tp->size - css); } css = tp->props.tucss; len = tp->size - css; DBGOUT(TXSUM, "tcp %d tucss %d len %d\n", tp->props.tcp, css, len); if (tp->props.tcp) { sofar = frames * tp->props.mss; stl_be_p(tp->data+css+4, ldl_be_p(tp->data+css+4)+sofar); /* seq */ if (tp->props.paylen - sofar > tp->props.mss) { tp->data[css + 13] &= ~9; /* PSH, FIN */ } else if (frames) { e1000x_inc_reg_if_not_full(s->mac_reg, TSCTC); } } else /* UDP */ stw_be_p(tp->data+css+4, len); if (tp->props.sum_needed & E1000_TXD_POPTS_TXSM) { unsigned int phsum; // add pseudo-header length before checksum calculation void *sp = tp->data + tp->props.tucso; phsum = lduw_be_p(sp) + len; phsum = (phsum >> 16) + (phsum & 0xffff); stw_be_p(sp, phsum); } tp->tso_frames++; } if (tp->props.sum_needed & E1000_TXD_POPTS_TXSM) { putsum(tp->data, tp->size, tp->props.tucso, tp->props.tucss, tp->props.tucse); } if (tp->props.sum_needed & E1000_TXD_POPTS_IXSM) { putsum(tp->data, tp->size, tp->props.ipcso, tp->props.ipcss, tp->props.ipcse); } if (tp->vlan_needed) { memmove(tp->vlan, tp->data, 4); memmove(tp->data, tp->data + 4, 8); memcpy(tp->data + 8, tp->vlan_header, 4); e1000_send_packet(s, tp->vlan, tp->size + 4); } else { e1000_send_packet(s, tp->data, tp->size); } e1000x_inc_reg_if_not_full(s->mac_reg, TPT); e1000x_grow_8reg_if_not_full(s->mac_reg, TOTL, s->tx.size); s->mac_reg[GPTC] = s->mac_reg[TPT]; s->mac_reg[GOTCL] = s->mac_reg[TOTL]; s->mac_reg[GOTCH] = s->mac_reg[TOTH]; }
false
qemu
7d08c73e7bdc39b10e5f2f5acdce700f17ffe962
xmit_seg(E1000State *s) { uint16_t len; unsigned int frames = s->tx.tso_frames, css, sofar; struct e1000_tx *tp = &s->tx; if (tp->props.tse && tp->props.cptse) { css = tp->props.ipcss; DBGOUT(TXSUM, "frames %d size %d ipcss %d\n", frames, tp->size, css); if (tp->props.ip) { stw_be_p(tp->data+css+2, tp->size - css); stw_be_p(tp->data+css+4, lduw_be_p(tp->data + css + 4) + frames); } else { stw_be_p(tp->data+css+4, tp->size - css); } css = tp->props.tucss; len = tp->size - css; DBGOUT(TXSUM, "tcp %d tucss %d len %d\n", tp->props.tcp, css, len); if (tp->props.tcp) { sofar = frames * tp->props.mss; stl_be_p(tp->data+css+4, ldl_be_p(tp->data+css+4)+sofar); if (tp->props.paylen - sofar > tp->props.mss) { tp->data[css + 13] &= ~9; } else if (frames) { e1000x_inc_reg_if_not_full(s->mac_reg, TSCTC); } } else stw_be_p(tp->data+css+4, len); if (tp->props.sum_needed & E1000_TXD_POPTS_TXSM) { unsigned int phsum; void *sp = tp->data + tp->props.tucso; phsum = lduw_be_p(sp) + len; phsum = (phsum >> 16) + (phsum & 0xffff); stw_be_p(sp, phsum); } tp->tso_frames++; } if (tp->props.sum_needed & E1000_TXD_POPTS_TXSM) { putsum(tp->data, tp->size, tp->props.tucso, tp->props.tucss, tp->props.tucse); } if (tp->props.sum_needed & E1000_TXD_POPTS_IXSM) { putsum(tp->data, tp->size, tp->props.ipcso, tp->props.ipcss, tp->props.ipcse); } if (tp->vlan_needed) { memmove(tp->vlan, tp->data, 4); memmove(tp->data, tp->data + 4, 8); memcpy(tp->data + 8, tp->vlan_header, 4); e1000_send_packet(s, tp->vlan, tp->size + 4); } else { e1000_send_packet(s, tp->data, tp->size); } e1000x_inc_reg_if_not_full(s->mac_reg, TPT); e1000x_grow_8reg_if_not_full(s->mac_reg, TOTL, s->tx.size); s->mac_reg[GPTC] = s->mac_reg[TPT]; s->mac_reg[GOTCL] = s->mac_reg[TOTL]; s->mac_reg[GOTCH] = s->mac_reg[TOTH]; }
{ "code": [], "line_no": [] }
FUNC_0(E1000State *VAR_0) { uint16_t len; unsigned int VAR_1 = VAR_0->tx.tso_frames, VAR_2, VAR_3; struct e1000_tx *VAR_4 = &VAR_0->tx; if (VAR_4->props.tse && VAR_4->props.cptse) { VAR_2 = VAR_4->props.ipcss; DBGOUT(TXSUM, "VAR_1 %d size %d ipcss %d\n", VAR_1, VAR_4->size, VAR_2); if (VAR_4->props.ip) { stw_be_p(VAR_4->data+VAR_2+2, VAR_4->size - VAR_2); stw_be_p(VAR_4->data+VAR_2+4, lduw_be_p(VAR_4->data + VAR_2 + 4) + VAR_1); } else { stw_be_p(VAR_4->data+VAR_2+4, VAR_4->size - VAR_2); } VAR_2 = VAR_4->props.tucss; len = VAR_4->size - VAR_2; DBGOUT(TXSUM, "tcp %d tucss %d len %d\n", VAR_4->props.tcp, VAR_2, len); if (VAR_4->props.tcp) { VAR_3 = VAR_1 * VAR_4->props.mss; stl_be_p(VAR_4->data+VAR_2+4, ldl_be_p(VAR_4->data+VAR_2+4)+VAR_3); if (VAR_4->props.paylen - VAR_3 > VAR_4->props.mss) { VAR_4->data[VAR_2 + 13] &= ~9; } else if (VAR_1) { e1000x_inc_reg_if_not_full(VAR_0->mac_reg, TSCTC); } } else stw_be_p(VAR_4->data+VAR_2+4, len); if (VAR_4->props.sum_needed & E1000_TXD_POPTS_TXSM) { unsigned int VAR_5; void *VAR_6 = VAR_4->data + VAR_4->props.tucso; VAR_5 = lduw_be_p(VAR_6) + len; VAR_5 = (VAR_5 >> 16) + (VAR_5 & 0xffff); stw_be_p(VAR_6, VAR_5); } VAR_4->tso_frames++; } if (VAR_4->props.sum_needed & E1000_TXD_POPTS_TXSM) { putsum(VAR_4->data, VAR_4->size, VAR_4->props.tucso, VAR_4->props.tucss, VAR_4->props.tucse); } if (VAR_4->props.sum_needed & E1000_TXD_POPTS_IXSM) { putsum(VAR_4->data, VAR_4->size, VAR_4->props.ipcso, VAR_4->props.ipcss, VAR_4->props.ipcse); } if (VAR_4->vlan_needed) { memmove(VAR_4->vlan, VAR_4->data, 4); memmove(VAR_4->data, VAR_4->data + 4, 8); memcpy(VAR_4->data + 8, VAR_4->vlan_header, 4); e1000_send_packet(VAR_0, VAR_4->vlan, VAR_4->size + 4); } else { e1000_send_packet(VAR_0, VAR_4->data, VAR_4->size); } e1000x_inc_reg_if_not_full(VAR_0->mac_reg, TPT); e1000x_grow_8reg_if_not_full(VAR_0->mac_reg, TOTL, VAR_0->tx.size); VAR_0->mac_reg[GPTC] = VAR_0->mac_reg[TPT]; VAR_0->mac_reg[GOTCL] = VAR_0->mac_reg[TOTL]; VAR_0->mac_reg[GOTCH] = VAR_0->mac_reg[TOTH]; }
[ "FUNC_0(E1000State *VAR_0)\n{", "uint16_t len;", "unsigned int VAR_1 = VAR_0->tx.tso_frames, VAR_2, VAR_3;", "struct e1000_tx *VAR_4 = &VAR_0->tx;", "if (VAR_4->props.tse && VAR_4->props.cptse) {", "VAR_2 = VAR_4->props.ipcss;", "DBGOUT(TXSUM, \"VAR_1 %d size %d ipcss %d\\n\",\nVAR_1, VAR_4->size, VAR_2);", "if (VAR_4->props.ip) {", "stw_be_p(VAR_4->data+VAR_2+2, VAR_4->size - VAR_2);", "stw_be_p(VAR_4->data+VAR_2+4,\nlduw_be_p(VAR_4->data + VAR_2 + 4) + VAR_1);", "} else {", "stw_be_p(VAR_4->data+VAR_2+4, VAR_4->size - VAR_2);", "}", "VAR_2 = VAR_4->props.tucss;", "len = VAR_4->size - VAR_2;", "DBGOUT(TXSUM, \"tcp %d tucss %d len %d\\n\", VAR_4->props.tcp, VAR_2, len);", "if (VAR_4->props.tcp) {", "VAR_3 = VAR_1 * VAR_4->props.mss;", "stl_be_p(VAR_4->data+VAR_2+4, ldl_be_p(VAR_4->data+VAR_2+4)+VAR_3);", "if (VAR_4->props.paylen - VAR_3 > VAR_4->props.mss) {", "VAR_4->data[VAR_2 + 13] &= ~9;", "} else if (VAR_1) {", "e1000x_inc_reg_if_not_full(VAR_0->mac_reg, TSCTC);", "}", "} else", "stw_be_p(VAR_4->data+VAR_2+4, len);", "if (VAR_4->props.sum_needed & E1000_TXD_POPTS_TXSM) {", "unsigned int VAR_5;", "void *VAR_6 = VAR_4->data + VAR_4->props.tucso;", "VAR_5 = lduw_be_p(VAR_6) + len;", "VAR_5 = (VAR_5 >> 16) + (VAR_5 & 0xffff);", "stw_be_p(VAR_6, VAR_5);", "}", "VAR_4->tso_frames++;", "}", "if (VAR_4->props.sum_needed & E1000_TXD_POPTS_TXSM) {", "putsum(VAR_4->data, VAR_4->size, VAR_4->props.tucso,\nVAR_4->props.tucss, VAR_4->props.tucse);", "}", "if (VAR_4->props.sum_needed & E1000_TXD_POPTS_IXSM) {", "putsum(VAR_4->data, VAR_4->size, VAR_4->props.ipcso,\nVAR_4->props.ipcss, VAR_4->props.ipcse);", "}", "if (VAR_4->vlan_needed) {", "memmove(VAR_4->vlan, VAR_4->data, 4);", "memmove(VAR_4->data, VAR_4->data + 4, 8);", "memcpy(VAR_4->data + 8, VAR_4->vlan_header, 4);", "e1000_send_packet(VAR_0, VAR_4->vlan, VAR_4->size + 4);", "} else {", "e1000_send_packet(VAR_0, VAR_4->data, VAR_4->size);", "}", "e1000x_inc_reg_if_not_full(VAR_0->mac_reg, TPT);", "e1000x_grow_8reg_if_not_full(VAR_0->mac_reg, TOTL, VAR_0->tx.size);", "VAR_0->mac_reg[GPTC] = VAR_0->mac_reg[TPT];", "VAR_0->mac_reg[GOTCL] = VAR_0->mac_reg[TOTL];", "VAR_0->mac_reg[GOTCH] = VAR_0->mac_reg[TOTH];", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ] ]
817
int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile) { int mbn, blk, num_blocks, num_coeffs, blk_size, scan_pos, run, val, pos, is_intra, mc_type, mv_x, mv_y, col_mask; uint8_t col_flags[8]; int32_t prev_dc, trvec[64]; uint32_t cbp, sym, lo, hi, quant, buf_offs, q; IVIMbInfo *mb; RVMapDesc *rvmap = band->rv_map; void (*mc_with_delta_func)(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type); void (*mc_no_delta_func) (int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type); const uint16_t *base_tab; const uint8_t *scale_tab; prev_dc = 0; /* init intra prediction for the DC coefficient */ blk_size = band->blk_size; col_mask = blk_size - 1; /* column mask for tracking non-zero coeffs */ num_blocks = (band->mb_size != blk_size) ? 4 : 1; /* number of blocks per mb */ num_coeffs = blk_size * blk_size; if (blk_size == 8) { mc_with_delta_func = ff_ivi_mc_8x8_delta; mc_no_delta_func = ff_ivi_mc_8x8_no_delta; } else { mc_with_delta_func = ff_ivi_mc_4x4_delta; mc_no_delta_func = ff_ivi_mc_4x4_no_delta; } for (mbn = 0, mb = tile->mbs; mbn < tile->num_MBs; mb++, mbn++) { is_intra = !mb->type; cbp = mb->cbp; buf_offs = mb->buf_offs; quant = av_clip(band->glob_quant + mb->q_delta, 0, 23); base_tab = is_intra ? band->intra_base : band->inter_base; scale_tab = is_intra ? band->intra_scale : band->inter_scale; if (scale_tab) quant = scale_tab[quant]; if (!is_intra) { mv_x = mb->mv_x; mv_y = mb->mv_y; if (!band->is_halfpel) { mc_type = 0; /* we have only fullpel vectors */ } else { mc_type = ((mv_y & 1) << 1) | (mv_x & 1); mv_x >>= 1; mv_y >>= 1; /* convert halfpel vectors into fullpel ones */ } } for (blk = 0; blk < num_blocks; blk++) { /* adjust block position in the buffer according to its number */ if (blk & 1) { buf_offs += blk_size; } else if (blk == 2) { buf_offs -= blk_size; buf_offs += blk_size * band->pitch; } if (cbp & 1) { /* block coded ? */ scan_pos = -1; memset(trvec, 0, num_coeffs*sizeof(trvec[0])); /* zero transform vector */ memset(col_flags, 0, sizeof(col_flags)); /* zero column flags */ while (scan_pos <= num_coeffs) { sym = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1); if (sym == rvmap->eob_sym) break; /* End of block */ if (sym == rvmap->esc_sym) { /* Escape - run/val explicitly coded using 3 vlc codes */ run = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1; lo = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1); hi = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1); val = IVI_TOSIGNED((hi << 6) | lo); /* merge them and convert into signed val */ } else { if (sym >= 256U) { av_log(NULL, AV_LOG_ERROR, "Invalid sym encountered: %d.\n", sym); return -1; } run = rvmap->runtab[sym]; val = rvmap->valtab[sym]; } /* de-zigzag and dequantize */ scan_pos += run; if (scan_pos >= num_coeffs) break; pos = band->scan[scan_pos]; if (!val) av_dlog(NULL, "Val = 0 encountered!\n"); q = (base_tab[pos] * quant) >> 9; if (q > 1) val = val * q + FFSIGN(val) * (((q ^ 1) - 1) >> 1); trvec[pos] = val; col_flags[pos & col_mask] |= !!val; /* track columns containing non-zero coeffs */ }// while if (scan_pos >= num_coeffs && sym != rvmap->eob_sym) return -1; /* corrupt block data */ /* undoing DC coeff prediction for intra-blocks */ if (is_intra && band->is_2d_trans) { prev_dc += trvec[0]; trvec[0] = prev_dc; col_flags[0] |= !!prev_dc; } /* apply inverse transform */ band->inv_transform(trvec, band->buf + buf_offs, band->pitch, col_flags); /* apply motion compensation */ if (!is_intra) mc_with_delta_func(band->buf + buf_offs, band->ref_buf + buf_offs + mv_y * band->pitch + mv_x, band->pitch, mc_type); } else { /* block not coded */ /* for intra blocks apply the dc slant transform */ /* for inter - perform the motion compensation without delta */ if (is_intra && band->dc_transform) { band->dc_transform(&prev_dc, band->buf + buf_offs, band->pitch, blk_size); } else mc_no_delta_func(band->buf + buf_offs, band->ref_buf + buf_offs + mv_y * band->pitch + mv_x, band->pitch, mc_type); } cbp >>= 1; }// for blk }// for mbn align_get_bits(gb); return 0; }
false
FFmpeg
0846719dd11ab3f7a7caee13e7af71f71d913389
int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile) { int mbn, blk, num_blocks, num_coeffs, blk_size, scan_pos, run, val, pos, is_intra, mc_type, mv_x, mv_y, col_mask; uint8_t col_flags[8]; int32_t prev_dc, trvec[64]; uint32_t cbp, sym, lo, hi, quant, buf_offs, q; IVIMbInfo *mb; RVMapDesc *rvmap = band->rv_map; void (*mc_with_delta_func)(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type); void (*mc_no_delta_func) (int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type); const uint16_t *base_tab; const uint8_t *scale_tab; prev_dc = 0; blk_size = band->blk_size; col_mask = blk_size - 1; num_blocks = (band->mb_size != blk_size) ? 4 : 1; num_coeffs = blk_size * blk_size; if (blk_size == 8) { mc_with_delta_func = ff_ivi_mc_8x8_delta; mc_no_delta_func = ff_ivi_mc_8x8_no_delta; } else { mc_with_delta_func = ff_ivi_mc_4x4_delta; mc_no_delta_func = ff_ivi_mc_4x4_no_delta; } for (mbn = 0, mb = tile->mbs; mbn < tile->num_MBs; mb++, mbn++) { is_intra = !mb->type; cbp = mb->cbp; buf_offs = mb->buf_offs; quant = av_clip(band->glob_quant + mb->q_delta, 0, 23); base_tab = is_intra ? band->intra_base : band->inter_base; scale_tab = is_intra ? band->intra_scale : band->inter_scale; if (scale_tab) quant = scale_tab[quant]; if (!is_intra) { mv_x = mb->mv_x; mv_y = mb->mv_y; if (!band->is_halfpel) { mc_type = 0; } else { mc_type = ((mv_y & 1) << 1) | (mv_x & 1); mv_x >>= 1; mv_y >>= 1; } } for (blk = 0; blk < num_blocks; blk++) { if (blk & 1) { buf_offs += blk_size; } else if (blk == 2) { buf_offs -= blk_size; buf_offs += blk_size * band->pitch; } if (cbp & 1) { scan_pos = -1; memset(trvec, 0, num_coeffs*sizeof(trvec[0])); memset(col_flags, 0, sizeof(col_flags)); while (scan_pos <= num_coeffs) { sym = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1); if (sym == rvmap->eob_sym) break; if (sym == rvmap->esc_sym) { run = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1; lo = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1); hi = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1); val = IVI_TOSIGNED((hi << 6) | lo); } else { if (sym >= 256U) { av_log(NULL, AV_LOG_ERROR, "Invalid sym encountered: %d.\n", sym); return -1; } run = rvmap->runtab[sym]; val = rvmap->valtab[sym]; } scan_pos += run; if (scan_pos >= num_coeffs) break; pos = band->scan[scan_pos]; if (!val) av_dlog(NULL, "Val = 0 encountered!\n"); q = (base_tab[pos] * quant) >> 9; if (q > 1) val = val * q + FFSIGN(val) * (((q ^ 1) - 1) >> 1); trvec[pos] = val; col_flags[pos & col_mask] |= !!val; } if (scan_pos >= num_coeffs && sym != rvmap->eob_sym) return -1; if (is_intra && band->is_2d_trans) { prev_dc += trvec[0]; trvec[0] = prev_dc; col_flags[0] |= !!prev_dc; } band->inv_transform(trvec, band->buf + buf_offs, band->pitch, col_flags); if (!is_intra) mc_with_delta_func(band->buf + buf_offs, band->ref_buf + buf_offs + mv_y * band->pitch + mv_x, band->pitch, mc_type); } else { if (is_intra && band->dc_transform) { band->dc_transform(&prev_dc, band->buf + buf_offs, band->pitch, blk_size); } else mc_no_delta_func(band->buf + buf_offs, band->ref_buf + buf_offs + mv_y * band->pitch + mv_x, band->pitch, mc_type); } cbp >>= 1; } } align_get_bits(gb); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(GetBitContext *VAR_0, IVIBandDesc *VAR_1, IVITile *VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11, VAR_12, VAR_22, VAR_14, VAR_15, VAR_16; uint8_t col_flags[8]; int32_t prev_dc, trvec[64]; uint32_t cbp, sym, lo, hi, quant, buf_offs, q; IVIMbInfo *mb; RVMapDesc *rvmap = VAR_1->rv_map; void (*VAR_17)(int16_t *VAR_22, const int16_t *VAR_22, uint32_t VAR_22, int VAR_22); void (*VAR_21) (int16_t *VAR_22, const int16_t *VAR_22, uint32_t VAR_22, int VAR_22); const uint16_t *VAR_22; const uint8_t *VAR_23; prev_dc = 0; VAR_7 = VAR_1->VAR_7; VAR_16 = VAR_7 - 1; VAR_5 = (VAR_1->mb_size != VAR_7) ? 4 : 1; VAR_6 = VAR_7 * VAR_7; if (VAR_7 == 8) { VAR_17 = ff_ivi_mc_8x8_delta; VAR_21 = ff_ivi_mc_8x8_no_delta; } else { VAR_17 = ff_ivi_mc_4x4_delta; VAR_21 = ff_ivi_mc_4x4_no_delta; } for (VAR_3 = 0, mb = VAR_2->mbs; VAR_3 < VAR_2->num_MBs; mb++, VAR_3++) { VAR_12 = !mb->type; cbp = mb->cbp; buf_offs = mb->buf_offs; quant = av_clip(VAR_1->glob_quant + mb->q_delta, 0, 23); VAR_22 = VAR_12 ? VAR_1->intra_base : VAR_1->inter_base; VAR_23 = VAR_12 ? VAR_1->intra_scale : VAR_1->inter_scale; if (VAR_23) quant = VAR_23[quant]; if (!VAR_12) { VAR_14 = mb->VAR_14; VAR_15 = mb->VAR_15; if (!VAR_1->is_halfpel) { VAR_22 = 0; } else { VAR_22 = ((VAR_15 & 1) << 1) | (VAR_14 & 1); VAR_14 >>= 1; VAR_15 >>= 1; } } for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) { if (VAR_4 & 1) { buf_offs += VAR_7; } else if (VAR_4 == 2) { buf_offs -= VAR_7; buf_offs += VAR_7 * VAR_1->VAR_22; } if (cbp & 1) { VAR_8 = -1; memset(trvec, 0, VAR_6*sizeof(trvec[0])); memset(col_flags, 0, sizeof(col_flags)); while (VAR_8 <= VAR_6) { sym = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1); if (sym == rvmap->eob_sym) break; if (sym == rvmap->esc_sym) { VAR_9 = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1; lo = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1); hi = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1); VAR_10 = IVI_TOSIGNED((hi << 6) | lo); } else { if (sym >= 256U) { av_log(NULL, AV_LOG_ERROR, "Invalid sym encountered: %d.\n", sym); return -1; } VAR_9 = rvmap->runtab[sym]; VAR_10 = rvmap->valtab[sym]; } VAR_8 += VAR_9; if (VAR_8 >= VAR_6) break; VAR_11 = VAR_1->scan[VAR_8]; if (!VAR_10) av_dlog(NULL, "Val = 0 encountered!\n"); q = (VAR_22[VAR_11] * quant) >> 9; if (q > 1) VAR_10 = VAR_10 * q + FFSIGN(VAR_10) * (((q ^ 1) - 1) >> 1); trvec[VAR_11] = VAR_10; col_flags[VAR_11 & VAR_16] |= !!VAR_10; } if (VAR_8 >= VAR_6 && sym != rvmap->eob_sym) return -1; if (VAR_12 && VAR_1->is_2d_trans) { prev_dc += trvec[0]; trvec[0] = prev_dc; col_flags[0] |= !!prev_dc; } VAR_1->inv_transform(trvec, VAR_1->VAR_22 + buf_offs, VAR_1->VAR_22, col_flags); if (!VAR_12) VAR_17(VAR_1->VAR_22 + buf_offs, VAR_1->VAR_22 + buf_offs + VAR_15 * VAR_1->VAR_22 + VAR_14, VAR_1->VAR_22, VAR_22); } else { if (VAR_12 && VAR_1->dc_transform) { VAR_1->dc_transform(&prev_dc, VAR_1->VAR_22 + buf_offs, VAR_1->VAR_22, VAR_7); } else VAR_21(VAR_1->VAR_22 + buf_offs, VAR_1->VAR_22 + buf_offs + VAR_15 * VAR_1->VAR_22 + VAR_14, VAR_1->VAR_22, VAR_22); } cbp >>= 1; } } align_get_bits(VAR_0); return 0; }
[ "int FUNC_0(GetBitContext *VAR_0, IVIBandDesc *VAR_1, IVITile *VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10,\nVAR_11, VAR_12, VAR_22, VAR_14, VAR_15, VAR_16;", "uint8_t col_flags[8];", "int32_t prev_dc, trvec[64];", "uint32_t cbp, sym, lo, hi, quant, buf_offs, q;", "IVIMbInfo *mb;", "RVMapDesc *rvmap = VAR_1->rv_map;", "void (*VAR_17)(int16_t *VAR_22, const int16_t *VAR_22, uint32_t VAR_22, int VAR_22);", "void (*VAR_21) (int16_t *VAR_22, const int16_t *VAR_22, uint32_t VAR_22, int VAR_22);", "const uint16_t *VAR_22;", "const uint8_t *VAR_23;", "prev_dc = 0;", "VAR_7 = VAR_1->VAR_7;", "VAR_16 = VAR_7 - 1;", "VAR_5 = (VAR_1->mb_size != VAR_7) ? 4 : 1;", "VAR_6 = VAR_7 * VAR_7;", "if (VAR_7 == 8) {", "VAR_17 = ff_ivi_mc_8x8_delta;", "VAR_21 = ff_ivi_mc_8x8_no_delta;", "} else {", "VAR_17 = ff_ivi_mc_4x4_delta;", "VAR_21 = ff_ivi_mc_4x4_no_delta;", "}", "for (VAR_3 = 0, mb = VAR_2->mbs; VAR_3 < VAR_2->num_MBs; mb++, VAR_3++) {", "VAR_12 = !mb->type;", "cbp = mb->cbp;", "buf_offs = mb->buf_offs;", "quant = av_clip(VAR_1->glob_quant + mb->q_delta, 0, 23);", "VAR_22 = VAR_12 ? VAR_1->intra_base : VAR_1->inter_base;", "VAR_23 = VAR_12 ? VAR_1->intra_scale : VAR_1->inter_scale;", "if (VAR_23)\nquant = VAR_23[quant];", "if (!VAR_12) {", "VAR_14 = mb->VAR_14;", "VAR_15 = mb->VAR_15;", "if (!VAR_1->is_halfpel) {", "VAR_22 = 0;", "} else {", "VAR_22 = ((VAR_15 & 1) << 1) | (VAR_14 & 1);", "VAR_14 >>= 1;", "VAR_15 >>= 1;", "}", "}", "for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) {", "if (VAR_4 & 1) {", "buf_offs += VAR_7;", "} else if (VAR_4 == 2) {", "buf_offs -= VAR_7;", "buf_offs += VAR_7 * VAR_1->VAR_22;", "}", "if (cbp & 1) {", "VAR_8 = -1;", "memset(trvec, 0, VAR_6*sizeof(trvec[0]));", "memset(col_flags, 0, sizeof(col_flags));", "while (VAR_8 <= VAR_6) {", "sym = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1);", "if (sym == rvmap->eob_sym)\nbreak;", "if (sym == rvmap->esc_sym) {", "VAR_9 = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1;", "lo = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1);", "hi = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1);", "VAR_10 = IVI_TOSIGNED((hi << 6) | lo);", "} else {", "if (sym >= 256U) {", "av_log(NULL, AV_LOG_ERROR, \"Invalid sym encountered: %d.\\n\", sym);", "return -1;", "}", "VAR_9 = rvmap->runtab[sym];", "VAR_10 = rvmap->valtab[sym];", "}", "VAR_8 += VAR_9;", "if (VAR_8 >= VAR_6)\nbreak;", "VAR_11 = VAR_1->scan[VAR_8];", "if (!VAR_10)\nav_dlog(NULL, \"Val = 0 encountered!\\n\");", "q = (VAR_22[VAR_11] * quant) >> 9;", "if (q > 1)\nVAR_10 = VAR_10 * q + FFSIGN(VAR_10) * (((q ^ 1) - 1) >> 1);", "trvec[VAR_11] = VAR_10;", "col_flags[VAR_11 & VAR_16] |= !!VAR_10;", "}", "if (VAR_8 >= VAR_6 && sym != rvmap->eob_sym)\nreturn -1;", "if (VAR_12 && VAR_1->is_2d_trans) {", "prev_dc += trvec[0];", "trvec[0] = prev_dc;", "col_flags[0] |= !!prev_dc;", "}", "VAR_1->inv_transform(trvec, VAR_1->VAR_22 + buf_offs,\nVAR_1->VAR_22, col_flags);", "if (!VAR_12)\nVAR_17(VAR_1->VAR_22 + buf_offs,\nVAR_1->VAR_22 + buf_offs + VAR_15 * VAR_1->VAR_22 + VAR_14,\nVAR_1->VAR_22, VAR_22);", "} else {", "if (VAR_12 && VAR_1->dc_transform) {", "VAR_1->dc_transform(&prev_dc, VAR_1->VAR_22 + buf_offs,\nVAR_1->VAR_22, VAR_7);", "} else", "VAR_21(VAR_1->VAR_22 + buf_offs,\nVAR_1->VAR_22 + buf_offs + VAR_15 * VAR_1->VAR_22 + VAR_14,\nVAR_1->VAR_22, VAR_22);", "}", "cbp >>= 1;", "}", "}", "align_get_bits(VAR_0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 173 ], [ 175, 177 ], [ 179 ], [ 183, 185 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 203, 205 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 225, 227 ], [ 233, 235, 237, 239 ], [ 241 ], [ 249 ], [ 251, 253 ], [ 255 ], [ 257, 259, 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 275 ], [ 279 ], [ 281 ] ]
818
static void assigned_dev_ioport_write(void *opaque, target_phys_addr_t addr, uint64_t data, unsigned size) { assigned_dev_ioport_rw(opaque, addr, size, &data); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void assigned_dev_ioport_write(void *opaque, target_phys_addr_t addr, uint64_t data, unsigned size) { assigned_dev_ioport_rw(opaque, addr, size, &data); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { assigned_dev_ioport_rw(VAR_0, VAR_1, VAR_3, &VAR_2); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "assigned_dev_ioport_rw(VAR_0, VAR_1, VAR_3, &VAR_2);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
819
static int kvm_put_fpu(CPUState *env) { struct kvm_fpu fpu; int i; memset(&fpu, 0, sizeof fpu); fpu.fsw = env->fpus & ~(7 << 11); fpu.fsw |= (env->fpstt & 7) << 11; fpu.fcw = env->fpuc; for (i = 0; i < 8; ++i) fpu.ftwx |= (!env->fptags[i]) << i; memcpy(fpu.fpr, env->fpregs, sizeof env->fpregs); memcpy(fpu.xmm, env->xmm_regs, sizeof env->xmm_regs); fpu.mxcsr = env->mxcsr; return kvm_vcpu_ioctl(env, KVM_SET_FPU, &fpu); }
false
qemu
b9bec74bcb16519a876ec21cd5277c526a9b512d
static int kvm_put_fpu(CPUState *env) { struct kvm_fpu fpu; int i; memset(&fpu, 0, sizeof fpu); fpu.fsw = env->fpus & ~(7 << 11); fpu.fsw |= (env->fpstt & 7) << 11; fpu.fcw = env->fpuc; for (i = 0; i < 8; ++i) fpu.ftwx |= (!env->fptags[i]) << i; memcpy(fpu.fpr, env->fpregs, sizeof env->fpregs); memcpy(fpu.xmm, env->xmm_regs, sizeof env->xmm_regs); fpu.mxcsr = env->mxcsr; return kvm_vcpu_ioctl(env, KVM_SET_FPU, &fpu); }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUState *VAR_0) { struct kvm_fpu VAR_1; int VAR_2; memset(&VAR_1, 0, sizeof VAR_1); VAR_1.fsw = VAR_0->fpus & ~(7 << 11); VAR_1.fsw |= (VAR_0->fpstt & 7) << 11; VAR_1.fcw = VAR_0->fpuc; for (VAR_2 = 0; VAR_2 < 8; ++VAR_2) VAR_1.ftwx |= (!VAR_0->fptags[VAR_2]) << VAR_2; memcpy(VAR_1.fpr, VAR_0->fpregs, sizeof VAR_0->fpregs); memcpy(VAR_1.xmm, VAR_0->xmm_regs, sizeof VAR_0->xmm_regs); VAR_1.mxcsr = VAR_0->mxcsr; return kvm_vcpu_ioctl(VAR_0, KVM_SET_FPU, &VAR_1); }
[ "static int FUNC_0(CPUState *VAR_0)\n{", "struct kvm_fpu VAR_1;", "int VAR_2;", "memset(&VAR_1, 0, sizeof VAR_1);", "VAR_1.fsw = VAR_0->fpus & ~(7 << 11);", "VAR_1.fsw |= (VAR_0->fpstt & 7) << 11;", "VAR_1.fcw = VAR_0->fpuc;", "for (VAR_2 = 0; VAR_2 < 8; ++VAR_2)", "VAR_1.ftwx |= (!VAR_0->fptags[VAR_2]) << VAR_2;", "memcpy(VAR_1.fpr, VAR_0->fpregs, sizeof VAR_0->fpregs);", "memcpy(VAR_1.xmm, VAR_0->xmm_regs, sizeof VAR_0->xmm_regs);", "VAR_1.mxcsr = VAR_0->mxcsr;", "return kvm_vcpu_ioctl(VAR_0, KVM_SET_FPU, &VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ] ]
820
target_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length, struct disassemble_info *info) { int i; for(i = 0; i < length; i++) { myaddr[i] = ldub_code(memaddr + i); } return 0; }
true
qemu
e612a1f7256bb3546cf3e9ae6cad3997c4153663
target_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length, struct disassemble_info *info) { int i; for(i = 0; i < length; i++) { myaddr[i] = ldub_code(memaddr + i); } return 0; }
{ "code": [ " int i;", " for(i = 0; i < length; i++) {", " myaddr[i] = ldub_code(memaddr + i);" ], "line_no": [ 11, 13, 15 ] }
FUNC_0 (bfd_vma VAR_0, bfd_byte *VAR_1, int VAR_2, struct disassemble_info *VAR_3) { int VAR_4; for(VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) { VAR_1[VAR_4] = ldub_code(VAR_0 + VAR_4); } return 0; }
[ "FUNC_0 (bfd_vma VAR_0,\nbfd_byte *VAR_1,\nint VAR_2,\nstruct disassemble_info *VAR_3)\n{", "int VAR_4;", "for(VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) {", "VAR_1[VAR_4] = ldub_code(VAR_0 + VAR_4);", "}", "return 0;", "}" ]
[ 0, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
821
static int http_connect(URLContext *h, const char *path, const char *hoststr, const char *auth, int *new_location) { HTTPContext *s = h->priv_data; int post, err, ch; char line[1024], *q; char *auth_b64; int auth_b64_len = strlen(auth)* 4 / 3 + 12; int64_t off = s->off; /* send http header */ post = h->flags & URL_WRONLY; auth_b64 = av_malloc(auth_b64_len); av_base64_encode(auth_b64, auth_b64_len, auth, strlen(auth)); snprintf(s->buffer, sizeof(s->buffer), "%s %s HTTP/1.1\r\n" "User-Agent: %s\r\n" "Accept: */*\r\n" "Range: bytes=%"PRId64"-\r\n" "Host: %s\r\n" "Authorization: Basic %s\r\n" "Connection: close\r\n" "\r\n", post ? "POST" : "GET", path, LIBAVFORMAT_IDENT, s->off, hoststr, auth_b64); av_freep(&auth_b64); if (http_write(h, s->buffer, strlen(s->buffer)) < 0) return AVERROR(EIO); /* init input buffer */ s->buf_ptr = s->buffer; s->buf_end = s->buffer; s->line_count = 0; s->off = 0; s->filesize = -1; if (post) { return 0; } /* wait for header */ q = line; for(;;) { ch = http_getc(s); if (ch < 0) return AVERROR(EIO); if (ch == '\n') { /* process line */ if (q > line && q[-1] == '\r') q--; *q = '\0'; #ifdef DEBUG printf("header='%s'\n", line); #endif err = process_line(h, line, s->line_count, new_location); if (err < 0) return err; if (err == 0) break; s->line_count++; q = line; } else { if ((q - line) < sizeof(line) - 1) *q++ = ch; } } return (off == s->off) ? 0 : -1; }
true
FFmpeg
d176f9038711e497b32f1431e60e4e3da94179d1
static int http_connect(URLContext *h, const char *path, const char *hoststr, const char *auth, int *new_location) { HTTPContext *s = h->priv_data; int post, err, ch; char line[1024], *q; char *auth_b64; int auth_b64_len = strlen(auth)* 4 / 3 + 12; int64_t off = s->off; post = h->flags & URL_WRONLY; auth_b64 = av_malloc(auth_b64_len); av_base64_encode(auth_b64, auth_b64_len, auth, strlen(auth)); snprintf(s->buffer, sizeof(s->buffer), "%s %s HTTP/1.1\r\n" "User-Agent: %s\r\n" "Accept: * s->buf_ptr = s->buffer; s->buf_end = s->buffer; s->line_count = 0; s->off = 0; s->filesize = -1; if (post) { return 0; } q = line; for(;;) { ch = http_getc(s); if (ch < 0) return AVERROR(EIO); if (ch == '\n') { if (q > line && q[-1] == '\r') q--; *q = '\0'; #ifdef DEBUG printf("header='%s'\n", line); #endif err = process_line(h, line, s->line_count, new_location); if (err < 0) return err; if (err == 0) break; s->line_count++; q = line; } else { if ((q - line) < sizeof(line) - 1) *q++ = ch; } } return (off == s->off) ? 0 : -1; }
{ "code": [ " int auth_b64_len = strlen(auth)* 4 / 3 + 12;" ], "line_no": [ 15 ] }
static int FUNC_0(URLContext *VAR_0, const char *VAR_1, const char *VAR_2, const char *VAR_3, int *VAR_4) { HTTPContext *s = VAR_0->priv_data; int VAR_5, VAR_6, VAR_7; char VAR_8[1024], *VAR_9; char *VAR_10; int VAR_11 = strlen(VAR_3)* 4 / 3 + 12; int64_t off = s->off; VAR_5 = VAR_0->flags & URL_WRONLY; VAR_10 = av_malloc(VAR_11); av_base64_encode(VAR_10, VAR_11, VAR_3, strlen(VAR_3)); snprintf(s->buffer, sizeof(s->buffer), "%s %s HTTP/1.1\r\n" "User-Agent: %s\r\n" "Accept: * s->buf_ptr = s->buffer; s->buf_end = s->buffer; s->line_count = 0; s->off = 0; s->filesize = -1; if (VAR_5) { return 0; } VAR_9 = VAR_8; for(;;) { VAR_7 = http_getc(s); if (VAR_7 < 0) return AVERROR(EIO); if (VAR_7 == '\n') { if (VAR_9 > VAR_8 && VAR_9[-1] == '\r') VAR_9--; *VAR_9 = '\0'; #ifdef DEBUG printf("header='%s'\n", VAR_8); #endif VAR_6 = process_line(VAR_0, VAR_8, s->line_count, VAR_4); if (VAR_6 < 0) return VAR_6; if (VAR_6 == 0) break; s->line_count++; VAR_9 = VAR_8; } else { if ((VAR_9 - VAR_8) < sizeof(VAR_8) - 1) *VAR_9++ = VAR_7; } } return (off == s->off) ? 0 : -1; }
[ "static int FUNC_0(URLContext *VAR_0, const char *VAR_1, const char *VAR_2,\nconst char *VAR_3, int *VAR_4)\n{", "HTTPContext *s = VAR_0->priv_data;", "int VAR_5, VAR_6, VAR_7;", "char VAR_8[1024], *VAR_9;", "char *VAR_10;", "int VAR_11 = strlen(VAR_3)* 4 / 3 + 12;", "int64_t off = s->off;", "VAR_5 = VAR_0->flags & URL_WRONLY;", "VAR_10 = av_malloc(VAR_11);", "av_base64_encode(VAR_10, VAR_11, VAR_3, strlen(VAR_3));", "snprintf(s->buffer, sizeof(s->buffer),\n\"%s %s HTTP/1.1\\r\\n\"\n\"User-Agent: %s\\r\\n\"\n\"Accept: *\ns->buf_ptr = s->buffer;", "s->buf_end = s->buffer;", "s->line_count = 0;", "s->off = 0;", "s->filesize = -1;", "if (VAR_5) {", "return 0;", "}", "VAR_9 = VAR_8;", "for(;;) {", "VAR_7 = http_getc(s);", "if (VAR_7 < 0)\nreturn AVERROR(EIO);", "if (VAR_7 == '\\n') {", "if (VAR_9 > VAR_8 && VAR_9[-1] == '\\r')\nVAR_9--;", "*VAR_9 = '\\0';", "#ifdef DEBUG\nprintf(\"header='%s'\\n\", VAR_8);", "#endif\nVAR_6 = process_line(VAR_0, VAR_8, s->line_count, VAR_4);", "if (VAR_6 < 0)\nreturn VAR_6;", "if (VAR_6 == 0)\nbreak;", "s->line_count++;", "VAR_9 = VAR_8;", "} else {", "if ((VAR_9 - VAR_8) < sizeof(VAR_8) - 1)\n*VAR_9++ = VAR_7;", "}", "}", "return (off == s->off) ? 0 : -1;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33, 35, 37, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 107, 109 ], [ 111 ], [ 113, 115 ], [ 117, 119 ], [ 121, 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ] ]
822
static void set_guest_connected(VirtIOSerialPort *port, int guest_connected) { VirtConsole *vcon = VIRTIO_CONSOLE(port); DeviceState *dev = DEVICE(port); if (vcon->chr) { qemu_chr_fe_set_open(vcon->chr, guest_connected); } if (dev->id) { qapi_event_send_vserport_change(dev->id, guest_connected, &error_abort); } }
true
qemu
bce6261eb2d879625126485d4ddd28cacb93152e
static void set_guest_connected(VirtIOSerialPort *port, int guest_connected) { VirtConsole *vcon = VIRTIO_CONSOLE(port); DeviceState *dev = DEVICE(port); if (vcon->chr) { qemu_chr_fe_set_open(vcon->chr, guest_connected); } if (dev->id) { qapi_event_send_vserport_change(dev->id, guest_connected, &error_abort); } }
{ "code": [ " if (vcon->chr) {" ], "line_no": [ 11 ] }
static void FUNC_0(VirtIOSerialPort *VAR_0, int VAR_1) { VirtConsole *vcon = VIRTIO_CONSOLE(VAR_0); DeviceState *dev = DEVICE(VAR_0); if (vcon->chr) { qemu_chr_fe_set_open(vcon->chr, VAR_1); } if (dev->id) { qapi_event_send_vserport_change(dev->id, VAR_1, &error_abort); } }
[ "static void FUNC_0(VirtIOSerialPort *VAR_0, int VAR_1)\n{", "VirtConsole *vcon = VIRTIO_CONSOLE(VAR_0);", "DeviceState *dev = DEVICE(VAR_0);", "if (vcon->chr) {", "qemu_chr_fe_set_open(vcon->chr, VAR_1);", "}", "if (dev->id) {", "qapi_event_send_vserport_change(dev->id, VAR_1,\n&error_abort);", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ] ]
823
void error_setg_errno(Error **errp, int os_errno, const char *fmt, ...) { va_list ap; char *msg; int saved_errno = errno; if (errp == NULL) { return; } va_start(ap, fmt); error_setv(errp, ERROR_CLASS_GENERIC_ERROR, fmt, ap); va_end(ap); if (os_errno != 0) { msg = (*errp)->msg; (*errp)->msg = g_strdup_printf("%s: %s", msg, strerror(os_errno)); g_free(msg); } errno = saved_errno; }
true
qemu
1e9b65bb1bad51735cab6c861c29b592dccabf0e
void error_setg_errno(Error **errp, int os_errno, const char *fmt, ...) { va_list ap; char *msg; int saved_errno = errno; if (errp == NULL) { return; } va_start(ap, fmt); error_setv(errp, ERROR_CLASS_GENERIC_ERROR, fmt, ap); va_end(ap); if (os_errno != 0) { msg = (*errp)->msg; (*errp)->msg = g_strdup_printf("%s: %s", msg, strerror(os_errno)); g_free(msg); } errno = saved_errno; }
{ "code": [ " error_setv(errp, ERROR_CLASS_GENERIC_ERROR, fmt, ap);", "void error_setg_errno(Error **errp, int os_errno, const char *fmt, ...)", " error_setv(errp, ERROR_CLASS_GENERIC_ERROR, fmt, ap);", " error_setv(errp, ERROR_CLASS_GENERIC_ERROR, fmt, ap);" ], "line_no": [ 23, 1, 23, 23 ] }
void FUNC_0(Error **VAR_0, int VAR_1, const char *VAR_2, ...) { va_list ap; char *VAR_3; int VAR_4 = errno; if (VAR_0 == NULL) { return; } va_start(ap, VAR_2); error_setv(VAR_0, ERROR_CLASS_GENERIC_ERROR, VAR_2, ap); va_end(ap); if (VAR_1 != 0) { VAR_3 = (*VAR_0)->VAR_3; (*VAR_0)->VAR_3 = g_strdup_printf("%s: %s", VAR_3, strerror(VAR_1)); g_free(VAR_3); } errno = VAR_4; }
[ "void FUNC_0(Error **VAR_0, int VAR_1, const char *VAR_2, ...)\n{", "va_list ap;", "char *VAR_3;", "int VAR_4 = errno;", "if (VAR_0 == NULL) {", "return;", "}", "va_start(ap, VAR_2);", "error_setv(VAR_0, ERROR_CLASS_GENERIC_ERROR, VAR_2, ap);", "va_end(ap);", "if (VAR_1 != 0) {", "VAR_3 = (*VAR_0)->VAR_3;", "(*VAR_0)->VAR_3 = g_strdup_printf(\"%s: %s\", VAR_3, strerror(VAR_1));", "g_free(VAR_3);", "}", "errno = VAR_4;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ] ]
824
void bitmap_set(unsigned long *map, long start, long nr) { unsigned long *p = map + BIT_WORD(start); const long size = start + nr; int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG); unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start); while (nr - bits_to_set >= 0) { *p |= mask_to_set; nr -= bits_to_set; bits_to_set = BITS_PER_LONG; mask_to_set = ~0UL; p++; } if (nr) { mask_to_set &= BITMAP_LAST_WORD_MASK(size); *p |= mask_to_set; } }
true
qemu
e12ed72e5c00dd3375b8bd107200e4d7e950276a
void bitmap_set(unsigned long *map, long start, long nr) { unsigned long *p = map + BIT_WORD(start); const long size = start + nr; int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG); unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start); while (nr - bits_to_set >= 0) { *p |= mask_to_set; nr -= bits_to_set; bits_to_set = BITS_PER_LONG; mask_to_set = ~0UL; p++; } if (nr) { mask_to_set &= BITMAP_LAST_WORD_MASK(size); *p |= mask_to_set; } }
{ "code": [], "line_no": [] }
void FUNC_0(unsigned long *VAR_0, long VAR_1, long VAR_2) { unsigned long *VAR_3 = VAR_0 + BIT_WORD(VAR_1); const long VAR_4 = VAR_1 + VAR_2; int VAR_5 = BITS_PER_LONG - (VAR_1 % BITS_PER_LONG); unsigned long VAR_6 = BITMAP_FIRST_WORD_MASK(VAR_1); while (VAR_2 - VAR_5 >= 0) { *VAR_3 |= VAR_6; VAR_2 -= VAR_5; VAR_5 = BITS_PER_LONG; VAR_6 = ~0UL; VAR_3++; } if (VAR_2) { VAR_6 &= BITMAP_LAST_WORD_MASK(VAR_4); *VAR_3 |= VAR_6; } }
[ "void FUNC_0(unsigned long *VAR_0, long VAR_1, long VAR_2)\n{", "unsigned long *VAR_3 = VAR_0 + BIT_WORD(VAR_1);", "const long VAR_4 = VAR_1 + VAR_2;", "int VAR_5 = BITS_PER_LONG - (VAR_1 % BITS_PER_LONG);", "unsigned long VAR_6 = BITMAP_FIRST_WORD_MASK(VAR_1);", "while (VAR_2 - VAR_5 >= 0) {", "*VAR_3 |= VAR_6;", "VAR_2 -= VAR_5;", "VAR_5 = BITS_PER_LONG;", "VAR_6 = ~0UL;", "VAR_3++;", "}", "if (VAR_2) {", "VAR_6 &= BITMAP_LAST_WORD_MASK(VAR_4);", "*VAR_3 |= VAR_6;", "}", "}" ]
[ 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 ] ]
825
static void vmdk_free_extents(BlockDriverState *bs) { int i; BDRVVmdkState *s = bs->opaque; for (i = 0; i < s->num_extents; i++) { g_free(s->extents[i].l1_table); g_free(s->extents[i].l2_cache); g_free(s->extents[i].l1_backup_table); } g_free(s->extents); }
true
qemu
b3c0bfb6f949d8f1c97f390f951c0bab3e703810
static void vmdk_free_extents(BlockDriverState *bs) { int i; BDRVVmdkState *s = bs->opaque; for (i = 0; i < s->num_extents; i++) { g_free(s->extents[i].l1_table); g_free(s->extents[i].l2_cache); g_free(s->extents[i].l1_backup_table); } g_free(s->extents); }
{ "code": [ " g_free(s->extents[i].l1_table);", " g_free(s->extents[i].l2_cache);", " g_free(s->extents[i].l1_backup_table);" ], "line_no": [ 13, 15, 17 ] }
static void FUNC_0(BlockDriverState *VAR_0) { int VAR_1; BDRVVmdkState *s = VAR_0->opaque; for (VAR_1 = 0; VAR_1 < s->num_extents; VAR_1++) { g_free(s->extents[VAR_1].l1_table); g_free(s->extents[VAR_1].l2_cache); g_free(s->extents[VAR_1].l1_backup_table); } g_free(s->extents); }
[ "static void FUNC_0(BlockDriverState *VAR_0)\n{", "int VAR_1;", "BDRVVmdkState *s = VAR_0->opaque;", "for (VAR_1 = 0; VAR_1 < s->num_extents; VAR_1++) {", "g_free(s->extents[VAR_1].l1_table);", "g_free(s->extents[VAR_1].l2_cache);", "g_free(s->extents[VAR_1].l1_backup_table);", "}", "g_free(s->extents);", "}" ]
[ 0, 0, 0, 0, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
826
static void console_putchar(TextConsole *s, int ch) { TextCell *c; int y1, i; int x, y; switch(s->state) { case TTY_STATE_NORM: switch(ch) { case '\r': /* carriage return */ s->x = 0; break; case '\n': /* newline */ console_put_lf(s); break; case '\b': /* backspace */ if (s->x > 0) s->x--; break; case '\t': /* tabspace */ if (s->x + (8 - (s->x % 8)) > s->width) { s->x = 0; console_put_lf(s); } else { s->x = s->x + (8 - (s->x % 8)); } break; case '\a': /* alert aka. bell */ /* TODO: has to be implemented */ break; case 14: /* SI (shift in), character set 0 (ignored) */ break; case 15: /* SO (shift out), character set 1 (ignored) */ break; case 27: /* esc (introducing an escape sequence) */ s->state = TTY_STATE_ESC; break; default: if (s->x >= s->width) { /* line wrap */ s->x = 0; console_put_lf(s); } y1 = (s->y_base + s->y) % s->total_height; c = &s->cells[y1 * s->width + s->x]; c->ch = ch; c->t_attrib = s->t_attrib; update_xy(s, s->x, s->y); s->x++; break; } break; case TTY_STATE_ESC: /* check if it is a terminal escape sequence */ if (ch == '[') { for(i=0;i<MAX_ESC_PARAMS;i++) s->esc_params[i] = 0; s->nb_esc_params = 0; s->state = TTY_STATE_CSI; } else { s->state = TTY_STATE_NORM; } break; case TTY_STATE_CSI: /* handle escape sequence parameters */ if (ch >= '0' && ch <= '9') { if (s->nb_esc_params < MAX_ESC_PARAMS) { s->esc_params[s->nb_esc_params] = s->esc_params[s->nb_esc_params] * 10 + ch - '0'; } } else { s->nb_esc_params++; if (ch == ';') break; #ifdef DEBUG_CONSOLE fprintf(stderr, "escape sequence CSI%d;%d%c, %d parameters\n", s->esc_params[0], s->esc_params[1], ch, s->nb_esc_params); #endif s->state = TTY_STATE_NORM; switch(ch) { case 'A': /* move cursor up */ if (s->esc_params[0] == 0) { s->esc_params[0] = 1; } s->y -= s->esc_params[0]; if (s->y < 0) { s->y = 0; } break; case 'B': /* move cursor down */ if (s->esc_params[0] == 0) { s->esc_params[0] = 1; } s->y += s->esc_params[0]; if (s->y >= s->height) { s->y = s->height - 1; } break; case 'C': /* move cursor right */ if (s->esc_params[0] == 0) { s->esc_params[0] = 1; } s->x += s->esc_params[0]; if (s->x >= s->width) { s->x = s->width - 1; } break; case 'D': /* move cursor left */ if (s->esc_params[0] == 0) { s->esc_params[0] = 1; } s->x -= s->esc_params[0]; if (s->x < 0) { s->x = 0; } break; case 'G': /* move cursor to column */ s->x = s->esc_params[0] - 1; if (s->x < 0) { s->x = 0; } break; case 'f': case 'H': /* move cursor to row, column */ s->x = s->esc_params[1] - 1; if (s->x < 0) { s->x = 0; } s->y = s->esc_params[0] - 1; if (s->y < 0) { s->y = 0; } break; case 'J': switch (s->esc_params[0]) { case 0: /* clear to end of screen */ for (y = s->y; y < s->height; y++) { for (x = 0; x < s->width; x++) { if (y == s->y && x < s->x) { continue; } console_clear_xy(s, x, y); } } break; case 1: /* clear from beginning of screen */ for (y = 0; y <= s->y; y++) { for (x = 0; x < s->width; x++) { if (y == s->y && x > s->x) { break; } console_clear_xy(s, x, y); } } break; case 2: /* clear entire screen */ for (y = 0; y <= s->height; y++) { for (x = 0; x < s->width; x++) { console_clear_xy(s, x, y); } } break; } break; case 'K': switch (s->esc_params[0]) { case 0: /* clear to eol */ for(x = s->x; x < s->width; x++) { console_clear_xy(s, x, s->y); } break; case 1: /* clear from beginning of line */ for (x = 0; x <= s->x; x++) { console_clear_xy(s, x, s->y); } break; case 2: /* clear entire line */ for(x = 0; x < s->width; x++) { console_clear_xy(s, x, s->y); } break; } break; case 'm': console_handle_escape(s); break; case 'n': /* report cursor position */ /* TODO: send ESC[row;colR */ break; case 's': /* save cursor position */ s->x_saved = s->x; s->y_saved = s->y; break; case 'u': /* restore cursor position */ s->x = s->x_saved; s->y = s->y_saved; break; default: #ifdef DEBUG_CONSOLE fprintf(stderr, "unhandled escape character '%c'\n", ch); #endif break; } break; } } }
true
qemu
3eea5498ca501922520b3447ba94815bfc109743
static void console_putchar(TextConsole *s, int ch) { TextCell *c; int y1, i; int x, y; switch(s->state) { case TTY_STATE_NORM: switch(ch) { case '\r': s->x = 0; break; case '\n': console_put_lf(s); break; case '\b': if (s->x > 0) s->x--; break; case '\t': if (s->x + (8 - (s->x % 8)) > s->width) { s->x = 0; console_put_lf(s); } else { s->x = s->x + (8 - (s->x % 8)); } break; case '\a': break; case 14: break; case 15: break; case 27: s->state = TTY_STATE_ESC; break; default: if (s->x >= s->width) { s->x = 0; console_put_lf(s); } y1 = (s->y_base + s->y) % s->total_height; c = &s->cells[y1 * s->width + s->x]; c->ch = ch; c->t_attrib = s->t_attrib; update_xy(s, s->x, s->y); s->x++; break; } break; case TTY_STATE_ESC: if (ch == '[') { for(i=0;i<MAX_ESC_PARAMS;i++) s->esc_params[i] = 0; s->nb_esc_params = 0; s->state = TTY_STATE_CSI; } else { s->state = TTY_STATE_NORM; } break; case TTY_STATE_CSI: if (ch >= '0' && ch <= '9') { if (s->nb_esc_params < MAX_ESC_PARAMS) { s->esc_params[s->nb_esc_params] = s->esc_params[s->nb_esc_params] * 10 + ch - '0'; } } else { s->nb_esc_params++; if (ch == ';') break; #ifdef DEBUG_CONSOLE fprintf(stderr, "escape sequence CSI%d;%d%c, %d parameters\n", s->esc_params[0], s->esc_params[1], ch, s->nb_esc_params); #endif s->state = TTY_STATE_NORM; switch(ch) { case 'A': if (s->esc_params[0] == 0) { s->esc_params[0] = 1; } s->y -= s->esc_params[0]; if (s->y < 0) { s->y = 0; } break; case 'B': if (s->esc_params[0] == 0) { s->esc_params[0] = 1; } s->y += s->esc_params[0]; if (s->y >= s->height) { s->y = s->height - 1; } break; case 'C': if (s->esc_params[0] == 0) { s->esc_params[0] = 1; } s->x += s->esc_params[0]; if (s->x >= s->width) { s->x = s->width - 1; } break; case 'D': if (s->esc_params[0] == 0) { s->esc_params[0] = 1; } s->x -= s->esc_params[0]; if (s->x < 0) { s->x = 0; } break; case 'G': s->x = s->esc_params[0] - 1; if (s->x < 0) { s->x = 0; } break; case 'f': case 'H': s->x = s->esc_params[1] - 1; if (s->x < 0) { s->x = 0; } s->y = s->esc_params[0] - 1; if (s->y < 0) { s->y = 0; } break; case 'J': switch (s->esc_params[0]) { case 0: for (y = s->y; y < s->height; y++) { for (x = 0; x < s->width; x++) { if (y == s->y && x < s->x) { continue; } console_clear_xy(s, x, y); } } break; case 1: for (y = 0; y <= s->y; y++) { for (x = 0; x < s->width; x++) { if (y == s->y && x > s->x) { break; } console_clear_xy(s, x, y); } } break; case 2: for (y = 0; y <= s->height; y++) { for (x = 0; x < s->width; x++) { console_clear_xy(s, x, y); } } break; } break; case 'K': switch (s->esc_params[0]) { case 0: for(x = s->x; x < s->width; x++) { console_clear_xy(s, x, s->y); } break; case 1: for (x = 0; x <= s->x; x++) { console_clear_xy(s, x, s->y); } break; case 2: for(x = 0; x < s->width; x++) { console_clear_xy(s, x, s->y); } break; } break; case 'm': console_handle_escape(s); break; case 'n': break; case 's': s->x_saved = s->x; s->y_saved = s->y; break; case 'u': s->x = s->x_saved; s->y = s->y_saved; break; default: #ifdef DEBUG_CONSOLE fprintf(stderr, "unhandled escape character '%c'\n", ch); #endif break; } break; } } }
{ "code": [ " s->nb_esc_params++;", " s->y -= s->esc_params[0];", " if (s->y < 0) {", " s->y = 0;", " s->y += s->esc_params[0];", " if (s->y >= s->height) {", " s->y = s->height - 1;", " s->x += s->esc_params[0];", " if (s->x >= s->width) {", " s->x = s->width - 1;", " s->x -= s->esc_params[0];", " if (s->x < 0) {", " s->x = 0;", " s->x = s->esc_params[0] - 1;", " if (s->x < 0) {", " s->x = 0;", " s->x = s->esc_params[1] - 1;", " if (s->x < 0) {", " s->x = 0;", " s->y = s->esc_params[0] - 1;", " if (s->y < 0) {", " s->y = 0;" ], "line_no": [ 143, 171, 173, 175, 191, 193, 195, 211, 213, 215, 231, 233, 235, 245, 233, 235, 261, 233, 235, 269, 173, 175 ] }
static void FUNC_0(TextConsole *VAR_0, int VAR_1) { TextCell *c; int VAR_2, VAR_3; int VAR_4, VAR_5; switch(VAR_0->state) { case TTY_STATE_NORM: switch(VAR_1) { case '\r': VAR_0->VAR_4 = 0; break; case '\n': console_put_lf(VAR_0); break; case '\b': if (VAR_0->VAR_4 > 0) VAR_0->VAR_4--; break; case '\t': if (VAR_0->VAR_4 + (8 - (VAR_0->VAR_4 % 8)) > VAR_0->width) { VAR_0->VAR_4 = 0; console_put_lf(VAR_0); } else { VAR_0->VAR_4 = VAR_0->VAR_4 + (8 - (VAR_0->VAR_4 % 8)); } break; case '\a': break; case 14: break; case 15: break; case 27: VAR_0->state = TTY_STATE_ESC; break; default: if (VAR_0->VAR_4 >= VAR_0->width) { VAR_0->VAR_4 = 0; console_put_lf(VAR_0); } VAR_2 = (VAR_0->y_base + VAR_0->VAR_5) % VAR_0->total_height; c = &VAR_0->cells[VAR_2 * VAR_0->width + VAR_0->VAR_4]; c->VAR_1 = VAR_1; c->t_attrib = VAR_0->t_attrib; update_xy(VAR_0, VAR_0->VAR_4, VAR_0->VAR_5); VAR_0->VAR_4++; break; } break; case TTY_STATE_ESC: if (VAR_1 == '[') { for(VAR_3=0;VAR_3<MAX_ESC_PARAMS;VAR_3++) VAR_0->esc_params[VAR_3] = 0; VAR_0->nb_esc_params = 0; VAR_0->state = TTY_STATE_CSI; } else { VAR_0->state = TTY_STATE_NORM; } break; case TTY_STATE_CSI: if (VAR_1 >= '0' && VAR_1 <= '9') { if (VAR_0->nb_esc_params < MAX_ESC_PARAMS) { VAR_0->esc_params[VAR_0->nb_esc_params] = VAR_0->esc_params[VAR_0->nb_esc_params] * 10 + VAR_1 - '0'; } } else { VAR_0->nb_esc_params++; if (VAR_1 == ';') break; #ifdef DEBUG_CONSOLE fprintf(stderr, "escape sequence CSI%d;%d%c, %d parameters\n", VAR_0->esc_params[0], VAR_0->esc_params[1], VAR_1, VAR_0->nb_esc_params); #endif VAR_0->state = TTY_STATE_NORM; switch(VAR_1) { case 'A': if (VAR_0->esc_params[0] == 0) { VAR_0->esc_params[0] = 1; } VAR_0->VAR_5 -= VAR_0->esc_params[0]; if (VAR_0->VAR_5 < 0) { VAR_0->VAR_5 = 0; } break; case 'B': if (VAR_0->esc_params[0] == 0) { VAR_0->esc_params[0] = 1; } VAR_0->VAR_5 += VAR_0->esc_params[0]; if (VAR_0->VAR_5 >= VAR_0->height) { VAR_0->VAR_5 = VAR_0->height - 1; } break; case 'C': if (VAR_0->esc_params[0] == 0) { VAR_0->esc_params[0] = 1; } VAR_0->VAR_4 += VAR_0->esc_params[0]; if (VAR_0->VAR_4 >= VAR_0->width) { VAR_0->VAR_4 = VAR_0->width - 1; } break; case 'D': if (VAR_0->esc_params[0] == 0) { VAR_0->esc_params[0] = 1; } VAR_0->VAR_4 -= VAR_0->esc_params[0]; if (VAR_0->VAR_4 < 0) { VAR_0->VAR_4 = 0; } break; case 'G': VAR_0->VAR_4 = VAR_0->esc_params[0] - 1; if (VAR_0->VAR_4 < 0) { VAR_0->VAR_4 = 0; } break; case 'f': case 'H': VAR_0->VAR_4 = VAR_0->esc_params[1] - 1; if (VAR_0->VAR_4 < 0) { VAR_0->VAR_4 = 0; } VAR_0->VAR_5 = VAR_0->esc_params[0] - 1; if (VAR_0->VAR_5 < 0) { VAR_0->VAR_5 = 0; } break; case 'J': switch (VAR_0->esc_params[0]) { case 0: for (VAR_5 = VAR_0->VAR_5; VAR_5 < VAR_0->height; VAR_5++) { for (VAR_4 = 0; VAR_4 < VAR_0->width; VAR_4++) { if (VAR_5 == VAR_0->VAR_5 && VAR_4 < VAR_0->VAR_4) { continue; } console_clear_xy(VAR_0, VAR_4, VAR_5); } } break; case 1: for (VAR_5 = 0; VAR_5 <= VAR_0->VAR_5; VAR_5++) { for (VAR_4 = 0; VAR_4 < VAR_0->width; VAR_4++) { if (VAR_5 == VAR_0->VAR_5 && VAR_4 > VAR_0->VAR_4) { break; } console_clear_xy(VAR_0, VAR_4, VAR_5); } } break; case 2: for (VAR_5 = 0; VAR_5 <= VAR_0->height; VAR_5++) { for (VAR_4 = 0; VAR_4 < VAR_0->width; VAR_4++) { console_clear_xy(VAR_0, VAR_4, VAR_5); } } break; } break; case 'K': switch (VAR_0->esc_params[0]) { case 0: for(VAR_4 = VAR_0->VAR_4; VAR_4 < VAR_0->width; VAR_4++) { console_clear_xy(VAR_0, VAR_4, VAR_0->VAR_5); } break; case 1: for (VAR_4 = 0; VAR_4 <= VAR_0->VAR_4; VAR_4++) { console_clear_xy(VAR_0, VAR_4, VAR_0->VAR_5); } break; case 2: for(VAR_4 = 0; VAR_4 < VAR_0->width; VAR_4++) { console_clear_xy(VAR_0, VAR_4, VAR_0->VAR_5); } break; } break; case 'm': console_handle_escape(VAR_0); break; case 'n': break; case 'VAR_0': VAR_0->x_saved = VAR_0->VAR_4; VAR_0->y_saved = VAR_0->VAR_5; break; case 'u': VAR_0->VAR_4 = VAR_0->x_saved; VAR_0->VAR_5 = VAR_0->y_saved; break; default: #ifdef DEBUG_CONSOLE fprintf(stderr, "unhandled escape character '%c'\n", VAR_1); #endif break; } break; } } }
[ "static void FUNC_0(TextConsole *VAR_0, int VAR_1)\n{", "TextCell *c;", "int VAR_2, VAR_3;", "int VAR_4, VAR_5;", "switch(VAR_0->state) {", "case TTY_STATE_NORM:\nswitch(VAR_1) {", "case '\\r':\nVAR_0->VAR_4 = 0;", "break;", "case '\\n':\nconsole_put_lf(VAR_0);", "break;", "case '\\b':\nif (VAR_0->VAR_4 > 0)\nVAR_0->VAR_4--;", "break;", "case '\\t':\nif (VAR_0->VAR_4 + (8 - (VAR_0->VAR_4 % 8)) > VAR_0->width) {", "VAR_0->VAR_4 = 0;", "console_put_lf(VAR_0);", "} else {", "VAR_0->VAR_4 = VAR_0->VAR_4 + (8 - (VAR_0->VAR_4 % 8));", "}", "break;", "case '\\a':\nbreak;", "case 14:\nbreak;", "case 15:\nbreak;", "case 27:\nVAR_0->state = TTY_STATE_ESC;", "break;", "default:\nif (VAR_0->VAR_4 >= VAR_0->width) {", "VAR_0->VAR_4 = 0;", "console_put_lf(VAR_0);", "}", "VAR_2 = (VAR_0->y_base + VAR_0->VAR_5) % VAR_0->total_height;", "c = &VAR_0->cells[VAR_2 * VAR_0->width + VAR_0->VAR_4];", "c->VAR_1 = VAR_1;", "c->t_attrib = VAR_0->t_attrib;", "update_xy(VAR_0, VAR_0->VAR_4, VAR_0->VAR_5);", "VAR_0->VAR_4++;", "break;", "}", "break;", "case TTY_STATE_ESC:\nif (VAR_1 == '[') {", "for(VAR_3=0;VAR_3<MAX_ESC_PARAMS;VAR_3++)", "VAR_0->esc_params[VAR_3] = 0;", "VAR_0->nb_esc_params = 0;", "VAR_0->state = TTY_STATE_CSI;", "} else {", "VAR_0->state = TTY_STATE_NORM;", "}", "break;", "case TTY_STATE_CSI:\nif (VAR_1 >= '0' && VAR_1 <= '9') {", "if (VAR_0->nb_esc_params < MAX_ESC_PARAMS) {", "VAR_0->esc_params[VAR_0->nb_esc_params] =\nVAR_0->esc_params[VAR_0->nb_esc_params] * 10 + VAR_1 - '0';", "}", "} else {", "VAR_0->nb_esc_params++;", "if (VAR_1 == ';')", "break;", "#ifdef DEBUG_CONSOLE\nfprintf(stderr, \"escape sequence CSI%d;%d%c, %d parameters\\n\",", "VAR_0->esc_params[0], VAR_0->esc_params[1], VAR_1, VAR_0->nb_esc_params);", "#endif\nVAR_0->state = TTY_STATE_NORM;", "switch(VAR_1) {", "case 'A':\nif (VAR_0->esc_params[0] == 0) {", "VAR_0->esc_params[0] = 1;", "}", "VAR_0->VAR_5 -= VAR_0->esc_params[0];", "if (VAR_0->VAR_5 < 0) {", "VAR_0->VAR_5 = 0;", "}", "break;", "case 'B':\nif (VAR_0->esc_params[0] == 0) {", "VAR_0->esc_params[0] = 1;", "}", "VAR_0->VAR_5 += VAR_0->esc_params[0];", "if (VAR_0->VAR_5 >= VAR_0->height) {", "VAR_0->VAR_5 = VAR_0->height - 1;", "}", "break;", "case 'C':\nif (VAR_0->esc_params[0] == 0) {", "VAR_0->esc_params[0] = 1;", "}", "VAR_0->VAR_4 += VAR_0->esc_params[0];", "if (VAR_0->VAR_4 >= VAR_0->width) {", "VAR_0->VAR_4 = VAR_0->width - 1;", "}", "break;", "case 'D':\nif (VAR_0->esc_params[0] == 0) {", "VAR_0->esc_params[0] = 1;", "}", "VAR_0->VAR_4 -= VAR_0->esc_params[0];", "if (VAR_0->VAR_4 < 0) {", "VAR_0->VAR_4 = 0;", "}", "break;", "case 'G':\nVAR_0->VAR_4 = VAR_0->esc_params[0] - 1;", "if (VAR_0->VAR_4 < 0) {", "VAR_0->VAR_4 = 0;", "}", "break;", "case 'f':\ncase 'H':\nVAR_0->VAR_4 = VAR_0->esc_params[1] - 1;", "if (VAR_0->VAR_4 < 0) {", "VAR_0->VAR_4 = 0;", "}", "VAR_0->VAR_5 = VAR_0->esc_params[0] - 1;", "if (VAR_0->VAR_5 < 0) {", "VAR_0->VAR_5 = 0;", "}", "break;", "case 'J':\nswitch (VAR_0->esc_params[0]) {", "case 0:\nfor (VAR_5 = VAR_0->VAR_5; VAR_5 < VAR_0->height; VAR_5++) {", "for (VAR_4 = 0; VAR_4 < VAR_0->width; VAR_4++) {", "if (VAR_5 == VAR_0->VAR_5 && VAR_4 < VAR_0->VAR_4) {", "continue;", "}", "console_clear_xy(VAR_0, VAR_4, VAR_5);", "}", "}", "break;", "case 1:\nfor (VAR_5 = 0; VAR_5 <= VAR_0->VAR_5; VAR_5++) {", "for (VAR_4 = 0; VAR_4 < VAR_0->width; VAR_4++) {", "if (VAR_5 == VAR_0->VAR_5 && VAR_4 > VAR_0->VAR_4) {", "break;", "}", "console_clear_xy(VAR_0, VAR_4, VAR_5);", "}", "}", "break;", "case 2:\nfor (VAR_5 = 0; VAR_5 <= VAR_0->height; VAR_5++) {", "for (VAR_4 = 0; VAR_4 < VAR_0->width; VAR_4++) {", "console_clear_xy(VAR_0, VAR_4, VAR_5);", "}", "}", "break;", "}", "break;", "case 'K':\nswitch (VAR_0->esc_params[0]) {", "case 0:\nfor(VAR_4 = VAR_0->VAR_4; VAR_4 < VAR_0->width; VAR_4++) {", "console_clear_xy(VAR_0, VAR_4, VAR_0->VAR_5);", "}", "break;", "case 1:\nfor (VAR_4 = 0; VAR_4 <= VAR_0->VAR_4; VAR_4++) {", "console_clear_xy(VAR_0, VAR_4, VAR_0->VAR_5);", "}", "break;", "case 2:\nfor(VAR_4 = 0; VAR_4 < VAR_0->width; VAR_4++) {", "console_clear_xy(VAR_0, VAR_4, VAR_0->VAR_5);", "}", "break;", "}", "break;", "case 'm':\nconsole_handle_escape(VAR_0);", "break;", "case 'n':\nbreak;", "case 'VAR_0':\nVAR_0->x_saved = VAR_0->VAR_4;", "VAR_0->y_saved = VAR_0->VAR_5;", "break;", "case 'u':\nVAR_0->VAR_4 = VAR_0->x_saved;", "VAR_0->VAR_5 = VAR_0->y_saved;", "break;", "default:\n#ifdef DEBUG_CONSOLE\nfprintf(stderr, \"unhandled escape character '%c'\\n\", VAR_1);", "#endif\nbreak;", "}", "break;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 59 ], [ 61, 65 ], [ 67, 71 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221, 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241, 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255, 257, 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279, 281 ], [ 283, 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305, 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327, 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347, 349 ], [ 351, 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363, 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375, 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391, 393 ], [ 395 ], [ 397, 403 ], [ 405, 409 ], [ 411 ], [ 413 ], [ 415, 419 ], [ 421 ], [ 423 ], [ 425, 427, 429 ], [ 431, 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ] ]
827
static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, ...) { va_list ap; va_start(ap, fmt); fprintf(stderr, "blkverify: %s sector_num=%ld nb_sectors=%d ", acb->is_write ? "write" : "read", acb->sector_num, acb->nb_sectors); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); va_end(ap); exit(1); }
true
qemu
687db4ed2ecd5fd74c94fbb420482823cca4ab7e
static void blkverify_err(BlkverifyAIOCB *acb, const char *fmt, ...) { va_list ap; va_start(ap, fmt); fprintf(stderr, "blkverify: %s sector_num=%ld nb_sectors=%d ", acb->is_write ? "write" : "read", acb->sector_num, acb->nb_sectors); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); va_end(ap); exit(1); }
{ "code": [ " fprintf(stderr, \"blkverify: %s sector_num=%ld nb_sectors=%d \"," ], "line_no": [ 11 ] }
static void FUNC_0(BlkverifyAIOCB *VAR_0, const char *VAR_1, ...) { va_list ap; va_start(ap, VAR_1); fprintf(stderr, "blkverify: %s sector_num=%ld nb_sectors=%d ", VAR_0->is_write ? "write" : "read", VAR_0->sector_num, VAR_0->nb_sectors); vfprintf(stderr, VAR_1, ap); fprintf(stderr, "\n"); va_end(ap); exit(1); }
[ "static void FUNC_0(BlkverifyAIOCB *VAR_0, const char *VAR_1, ...)\n{", "va_list ap;", "va_start(ap, VAR_1);", "fprintf(stderr, \"blkverify: %s sector_num=%ld nb_sectors=%d \",\nVAR_0->is_write ? \"write\" : \"read\", VAR_0->sector_num,\nVAR_0->nb_sectors);", "vfprintf(stderr, VAR_1, ap);", "fprintf(stderr, \"\\n\");", "va_end(ap);", "exit(1);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
828
static void format_line(void *ptr, int level, const char *fmt, va_list vl, char part[3][512], int part_size, int *print_prefix, int type[2]) { AVClass* avc = ptr ? *(AVClass **) ptr : NULL; part[0][0] = part[1][0] = part[2][0] = 0; if(type) type[0] = type[1] = AV_CLASS_CATEGORY_NA + 16; if (*print_prefix && avc) { if (avc->parent_log_context_offset) { AVClass** parent = *(AVClass ***) (((uint8_t *) ptr) + avc->parent_log_context_offset); if (parent && *parent) { snprintf(part[0], part_size, "[%s @ %p] ", (*parent)->item_name(parent), parent); if(type) type[0] = get_category(((uint8_t *) ptr) + avc->parent_log_context_offset); } } snprintf(part[1], part_size, "[%s @ %p] ", avc->item_name(ptr), ptr); if(type) type[1] = get_category(ptr); } vsnprintf(part[2], part_size, fmt, vl); *print_prefix = strlen(part[2]) && part[2][strlen(part[2]) - 1] == '\n'; }
true
FFmpeg
258dfff8394d383beaa639d19912b3f068f67e16
static void format_line(void *ptr, int level, const char *fmt, va_list vl, char part[3][512], int part_size, int *print_prefix, int type[2]) { AVClass* avc = ptr ? *(AVClass **) ptr : NULL; part[0][0] = part[1][0] = part[2][0] = 0; if(type) type[0] = type[1] = AV_CLASS_CATEGORY_NA + 16; if (*print_prefix && avc) { if (avc->parent_log_context_offset) { AVClass** parent = *(AVClass ***) (((uint8_t *) ptr) + avc->parent_log_context_offset); if (parent && *parent) { snprintf(part[0], part_size, "[%s @ %p] ", (*parent)->item_name(parent), parent); if(type) type[0] = get_category(((uint8_t *) ptr) + avc->parent_log_context_offset); } } snprintf(part[1], part_size, "[%s @ %p] ", avc->item_name(ptr), ptr); if(type) type[1] = get_category(ptr); } vsnprintf(part[2], part_size, fmt, vl); *print_prefix = strlen(part[2]) && part[2][strlen(part[2]) - 1] == '\n'; }
{ "code": [ " char part[3][512], int part_size, int *print_prefix, int type[2])" ], "line_no": [ 3 ] }
static void FUNC_0(void *VAR_0, int VAR_1, const char *VAR_2, va_list VAR_3, char VAR_4[3][512], int VAR_5, int *VAR_6, int VAR_7[2]) { AVClass* avc = VAR_0 ? *(AVClass **) VAR_0 : NULL; VAR_4[0][0] = VAR_4[1][0] = VAR_4[2][0] = 0; if(VAR_7) VAR_7[0] = VAR_7[1] = AV_CLASS_CATEGORY_NA + 16; if (*VAR_6 && avc) { if (avc->parent_log_context_offset) { AVClass** parent = *(AVClass ***) (((uint8_t *) VAR_0) + avc->parent_log_context_offset); if (parent && *parent) { snprintf(VAR_4[0], VAR_5, "[%s @ %p] ", (*parent)->item_name(parent), parent); if(VAR_7) VAR_7[0] = get_category(((uint8_t *) VAR_0) + avc->parent_log_context_offset); } } snprintf(VAR_4[1], VAR_5, "[%s @ %p] ", avc->item_name(VAR_0), VAR_0); if(VAR_7) VAR_7[1] = get_category(VAR_0); } vsnprintf(VAR_4[2], VAR_5, VAR_2, VAR_3); *VAR_6 = strlen(VAR_4[2]) && VAR_4[2][strlen(VAR_4[2]) - 1] == '\n'; }
[ "static void FUNC_0(void *VAR_0, int VAR_1, const char *VAR_2, va_list VAR_3,\nchar VAR_4[3][512], int VAR_5, int *VAR_6, int VAR_7[2])\n{", "AVClass* avc = VAR_0 ? *(AVClass **) VAR_0 : NULL;", "VAR_4[0][0] = VAR_4[1][0] = VAR_4[2][0] = 0;", "if(VAR_7) VAR_7[0] = VAR_7[1] = AV_CLASS_CATEGORY_NA + 16;", "if (*VAR_6 && avc) {", "if (avc->parent_log_context_offset) {", "AVClass** parent = *(AVClass ***) (((uint8_t *) VAR_0) +\navc->parent_log_context_offset);", "if (parent && *parent) {", "snprintf(VAR_4[0], VAR_5, \"[%s @ %p] \",\n(*parent)->item_name(parent), parent);", "if(VAR_7) VAR_7[0] = get_category(((uint8_t *) VAR_0) + avc->parent_log_context_offset);", "}", "}", "snprintf(VAR_4[1], VAR_5, \"[%s @ %p] \",\navc->item_name(VAR_0), VAR_0);", "if(VAR_7) VAR_7[1] = get_category(VAR_0);", "}", "vsnprintf(VAR_4[2], VAR_5, VAR_2, VAR_3);", "*VAR_6 = strlen(VAR_4[2]) && VAR_4[2][strlen(VAR_4[2]) - 1] == '\\n';", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ] ]
829
find_c_packed_planar_out_funcs(SwsContext *c, yuv2planar1_fn *yuv2yuv1, yuv2planarX_fn *yuv2yuvX, yuv2packed1_fn *yuv2packed1, yuv2packed2_fn *yuv2packed2, yuv2packedX_fn *yuv2packedX) { enum PixelFormat dstFormat = c->dstFormat; if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21) { *yuv2yuvX = yuv2nv12X_c; } else if (is16BPS(dstFormat)) { *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX16BE_c : yuv2yuvX16LE_c; } else if (is9_OR_10BPS(dstFormat)) { if (av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1 == 8) { *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX9BE_c : yuv2yuvX9LE_c; } else { *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX10BE_c : yuv2yuvX10LE_c; } } else { *yuv2yuv1 = yuv2yuv1_c; *yuv2yuvX = yuv2yuvX_c; } if(c->flags & SWS_FULL_CHR_H_INT) { switch (dstFormat) { case PIX_FMT_RGBA: #if CONFIG_SMALL *yuv2packedX = yuv2rgba32_full_X_c; #else #if CONFIG_SWSCALE_ALPHA if (c->alpPixBuf) { *yuv2packedX = yuv2rgba32_full_X_c; } else #endif /* CONFIG_SWSCALE_ALPHA */ { *yuv2packedX = yuv2rgbx32_full_X_c; } #endif /* !CONFIG_SMALL */ break; case PIX_FMT_ARGB: #if CONFIG_SMALL *yuv2packedX = yuv2argb32_full_X_c; #else #if CONFIG_SWSCALE_ALPHA if (c->alpPixBuf) { *yuv2packedX = yuv2argb32_full_X_c; } else #endif /* CONFIG_SWSCALE_ALPHA */ { *yuv2packedX = yuv2xrgb32_full_X_c; } #endif /* !CONFIG_SMALL */ break; case PIX_FMT_BGRA: #if CONFIG_SMALL *yuv2packedX = yuv2bgra32_full_X_c; #else #if CONFIG_SWSCALE_ALPHA if (c->alpPixBuf) { *yuv2packedX = yuv2bgra32_full_X_c; } else #endif /* CONFIG_SWSCALE_ALPHA */ { *yuv2packedX = yuv2bgrx32_full_X_c; } #endif /* !CONFIG_SMALL */ break; case PIX_FMT_ABGR: #if CONFIG_SMALL *yuv2packedX = yuv2abgr32_full_X_c; #else #if CONFIG_SWSCALE_ALPHA if (c->alpPixBuf) { *yuv2packedX = yuv2abgr32_full_X_c; } else #endif /* CONFIG_SWSCALE_ALPHA */ { *yuv2packedX = yuv2xbgr32_full_X_c; } #endif /* !CONFIG_SMALL */ break; case PIX_FMT_RGB24: *yuv2packedX = yuv2rgb24_full_X_c; break; case PIX_FMT_BGR24: *yuv2packedX = yuv2bgr24_full_X_c; break; } } else { switch (dstFormat) { case PIX_FMT_GRAY16BE: *yuv2packed1 = yuv2gray16BE_1_c; *yuv2packed2 = yuv2gray16BE_2_c; *yuv2packedX = yuv2gray16BE_X_c; break; case PIX_FMT_GRAY16LE: *yuv2packed1 = yuv2gray16LE_1_c; *yuv2packed2 = yuv2gray16LE_2_c; *yuv2packedX = yuv2gray16LE_X_c; break; case PIX_FMT_MONOWHITE: *yuv2packed1 = yuv2monowhite_1_c; *yuv2packed2 = yuv2monowhite_2_c; *yuv2packedX = yuv2monowhite_X_c; break; case PIX_FMT_MONOBLACK: *yuv2packed1 = yuv2monoblack_1_c; *yuv2packed2 = yuv2monoblack_2_c; *yuv2packedX = yuv2monoblack_X_c; break; case PIX_FMT_YUYV422: *yuv2packed1 = yuv2yuyv422_1_c; *yuv2packed2 = yuv2yuyv422_2_c; *yuv2packedX = yuv2yuyv422_X_c; break; case PIX_FMT_UYVY422: *yuv2packed1 = yuv2uyvy422_1_c; *yuv2packed2 = yuv2uyvy422_2_c; *yuv2packedX = yuv2uyvy422_X_c; break; case PIX_FMT_RGB48LE: //*yuv2packed1 = yuv2rgb48le_1_c; //*yuv2packed2 = yuv2rgb48le_2_c; //*yuv2packedX = yuv2rgb48le_X_c; //break; case PIX_FMT_RGB48BE: *yuv2packed1 = yuv2rgb48be_1_c; *yuv2packed2 = yuv2rgb48be_2_c; *yuv2packedX = yuv2rgb48be_X_c; break; case PIX_FMT_BGR48LE: //*yuv2packed1 = yuv2bgr48le_1_c; //*yuv2packed2 = yuv2bgr48le_2_c; //*yuv2packedX = yuv2bgr48le_X_c; //break; case PIX_FMT_BGR48BE: *yuv2packed1 = yuv2bgr48be_1_c; *yuv2packed2 = yuv2bgr48be_2_c; *yuv2packedX = yuv2bgr48be_X_c; break; case PIX_FMT_RGB32: case PIX_FMT_BGR32: #if CONFIG_SMALL *yuv2packed1 = yuv2rgb32_1_c; *yuv2packed2 = yuv2rgb32_2_c; *yuv2packedX = yuv2rgb32_X_c; #else #if CONFIG_SWSCALE_ALPHA if (c->alpPixBuf) { *yuv2packed1 = yuv2rgba32_1_c; *yuv2packed2 = yuv2rgba32_2_c; *yuv2packedX = yuv2rgba32_X_c; } else #endif /* CONFIG_SWSCALE_ALPHA */ { *yuv2packed1 = yuv2rgbx32_1_c; *yuv2packed2 = yuv2rgbx32_2_c; *yuv2packedX = yuv2rgbx32_X_c; } #endif /* !CONFIG_SMALL */ break; case PIX_FMT_RGB32_1: case PIX_FMT_BGR32_1: #if CONFIG_SMALL *yuv2packed1 = yuv2rgb32_1_1_c; *yuv2packed2 = yuv2rgb32_1_2_c; *yuv2packedX = yuv2rgb32_1_X_c; #else #if CONFIG_SWSCALE_ALPHA if (c->alpPixBuf) { *yuv2packed1 = yuv2rgba32_1_1_c; *yuv2packed2 = yuv2rgba32_1_2_c; *yuv2packedX = yuv2rgba32_1_X_c; } else #endif /* CONFIG_SWSCALE_ALPHA */ { *yuv2packed1 = yuv2rgbx32_1_1_c; *yuv2packed2 = yuv2rgbx32_1_2_c; *yuv2packedX = yuv2rgbx32_1_X_c; } #endif /* !CONFIG_SMALL */ break; case PIX_FMT_RGB24: *yuv2packed1 = yuv2rgb24_1_c; *yuv2packed2 = yuv2rgb24_2_c; *yuv2packedX = yuv2rgb24_X_c; break; case PIX_FMT_BGR24: *yuv2packed1 = yuv2bgr24_1_c; *yuv2packed2 = yuv2bgr24_2_c; *yuv2packedX = yuv2bgr24_X_c; break; case PIX_FMT_RGB565: case PIX_FMT_BGR565: *yuv2packed1 = yuv2rgb16_1_c; *yuv2packed2 = yuv2rgb16_2_c; *yuv2packedX = yuv2rgb16_X_c; break; case PIX_FMT_RGB555: case PIX_FMT_BGR555: *yuv2packed1 = yuv2rgb15_1_c; *yuv2packed2 = yuv2rgb15_2_c; *yuv2packedX = yuv2rgb15_X_c; break; case PIX_FMT_RGB444: case PIX_FMT_BGR444: *yuv2packed1 = yuv2rgb12_1_c; *yuv2packed2 = yuv2rgb12_2_c; *yuv2packedX = yuv2rgb12_X_c; break; case PIX_FMT_RGB8: case PIX_FMT_BGR8: *yuv2packed1 = yuv2rgb8_1_c; *yuv2packed2 = yuv2rgb8_2_c; *yuv2packedX = yuv2rgb8_X_c; break; case PIX_FMT_RGB4: case PIX_FMT_BGR4: *yuv2packed1 = yuv2rgb4_1_c; *yuv2packed2 = yuv2rgb4_2_c; *yuv2packedX = yuv2rgb4_X_c; break; case PIX_FMT_RGB4_BYTE: case PIX_FMT_BGR4_BYTE: *yuv2packed1 = yuv2rgb4b_1_c; *yuv2packed2 = yuv2rgb4b_2_c; *yuv2packedX = yuv2rgb4b_X_c; break; } } }
false
FFmpeg
dff5a8353266641311827a4bbdd940f7ad08c8b6
find_c_packed_planar_out_funcs(SwsContext *c, yuv2planar1_fn *yuv2yuv1, yuv2planarX_fn *yuv2yuvX, yuv2packed1_fn *yuv2packed1, yuv2packed2_fn *yuv2packed2, yuv2packedX_fn *yuv2packedX) { enum PixelFormat dstFormat = c->dstFormat; if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21) { *yuv2yuvX = yuv2nv12X_c; } else if (is16BPS(dstFormat)) { *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX16BE_c : yuv2yuvX16LE_c; } else if (is9_OR_10BPS(dstFormat)) { if (av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1 == 8) { *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX9BE_c : yuv2yuvX9LE_c; } else { *yuv2yuvX = isBE(dstFormat) ? yuv2yuvX10BE_c : yuv2yuvX10LE_c; } } else { *yuv2yuv1 = yuv2yuv1_c; *yuv2yuvX = yuv2yuvX_c; } if(c->flags & SWS_FULL_CHR_H_INT) { switch (dstFormat) { case PIX_FMT_RGBA: #if CONFIG_SMALL *yuv2packedX = yuv2rgba32_full_X_c; #else #if CONFIG_SWSCALE_ALPHA if (c->alpPixBuf) { *yuv2packedX = yuv2rgba32_full_X_c; } else #endif { *yuv2packedX = yuv2rgbx32_full_X_c; } #endif break; case PIX_FMT_ARGB: #if CONFIG_SMALL *yuv2packedX = yuv2argb32_full_X_c; #else #if CONFIG_SWSCALE_ALPHA if (c->alpPixBuf) { *yuv2packedX = yuv2argb32_full_X_c; } else #endif { *yuv2packedX = yuv2xrgb32_full_X_c; } #endif break; case PIX_FMT_BGRA: #if CONFIG_SMALL *yuv2packedX = yuv2bgra32_full_X_c; #else #if CONFIG_SWSCALE_ALPHA if (c->alpPixBuf) { *yuv2packedX = yuv2bgra32_full_X_c; } else #endif { *yuv2packedX = yuv2bgrx32_full_X_c; } #endif break; case PIX_FMT_ABGR: #if CONFIG_SMALL *yuv2packedX = yuv2abgr32_full_X_c; #else #if CONFIG_SWSCALE_ALPHA if (c->alpPixBuf) { *yuv2packedX = yuv2abgr32_full_X_c; } else #endif { *yuv2packedX = yuv2xbgr32_full_X_c; } #endif break; case PIX_FMT_RGB24: *yuv2packedX = yuv2rgb24_full_X_c; break; case PIX_FMT_BGR24: *yuv2packedX = yuv2bgr24_full_X_c; break; } } else { switch (dstFormat) { case PIX_FMT_GRAY16BE: *yuv2packed1 = yuv2gray16BE_1_c; *yuv2packed2 = yuv2gray16BE_2_c; *yuv2packedX = yuv2gray16BE_X_c; break; case PIX_FMT_GRAY16LE: *yuv2packed1 = yuv2gray16LE_1_c; *yuv2packed2 = yuv2gray16LE_2_c; *yuv2packedX = yuv2gray16LE_X_c; break; case PIX_FMT_MONOWHITE: *yuv2packed1 = yuv2monowhite_1_c; *yuv2packed2 = yuv2monowhite_2_c; *yuv2packedX = yuv2monowhite_X_c; break; case PIX_FMT_MONOBLACK: *yuv2packed1 = yuv2monoblack_1_c; *yuv2packed2 = yuv2monoblack_2_c; *yuv2packedX = yuv2monoblack_X_c; break; case PIX_FMT_YUYV422: *yuv2packed1 = yuv2yuyv422_1_c; *yuv2packed2 = yuv2yuyv422_2_c; *yuv2packedX = yuv2yuyv422_X_c; break; case PIX_FMT_UYVY422: *yuv2packed1 = yuv2uyvy422_1_c; *yuv2packed2 = yuv2uyvy422_2_c; *yuv2packedX = yuv2uyvy422_X_c; break; case PIX_FMT_RGB48LE: case PIX_FMT_RGB48BE: *yuv2packed1 = yuv2rgb48be_1_c; *yuv2packed2 = yuv2rgb48be_2_c; *yuv2packedX = yuv2rgb48be_X_c; break; case PIX_FMT_BGR48LE: case PIX_FMT_BGR48BE: *yuv2packed1 = yuv2bgr48be_1_c; *yuv2packed2 = yuv2bgr48be_2_c; *yuv2packedX = yuv2bgr48be_X_c; break; case PIX_FMT_RGB32: case PIX_FMT_BGR32: #if CONFIG_SMALL *yuv2packed1 = yuv2rgb32_1_c; *yuv2packed2 = yuv2rgb32_2_c; *yuv2packedX = yuv2rgb32_X_c; #else #if CONFIG_SWSCALE_ALPHA if (c->alpPixBuf) { *yuv2packed1 = yuv2rgba32_1_c; *yuv2packed2 = yuv2rgba32_2_c; *yuv2packedX = yuv2rgba32_X_c; } else #endif { *yuv2packed1 = yuv2rgbx32_1_c; *yuv2packed2 = yuv2rgbx32_2_c; *yuv2packedX = yuv2rgbx32_X_c; } #endif break; case PIX_FMT_RGB32_1: case PIX_FMT_BGR32_1: #if CONFIG_SMALL *yuv2packed1 = yuv2rgb32_1_1_c; *yuv2packed2 = yuv2rgb32_1_2_c; *yuv2packedX = yuv2rgb32_1_X_c; #else #if CONFIG_SWSCALE_ALPHA if (c->alpPixBuf) { *yuv2packed1 = yuv2rgba32_1_1_c; *yuv2packed2 = yuv2rgba32_1_2_c; *yuv2packedX = yuv2rgba32_1_X_c; } else #endif { *yuv2packed1 = yuv2rgbx32_1_1_c; *yuv2packed2 = yuv2rgbx32_1_2_c; *yuv2packedX = yuv2rgbx32_1_X_c; } #endif break; case PIX_FMT_RGB24: *yuv2packed1 = yuv2rgb24_1_c; *yuv2packed2 = yuv2rgb24_2_c; *yuv2packedX = yuv2rgb24_X_c; break; case PIX_FMT_BGR24: *yuv2packed1 = yuv2bgr24_1_c; *yuv2packed2 = yuv2bgr24_2_c; *yuv2packedX = yuv2bgr24_X_c; break; case PIX_FMT_RGB565: case PIX_FMT_BGR565: *yuv2packed1 = yuv2rgb16_1_c; *yuv2packed2 = yuv2rgb16_2_c; *yuv2packedX = yuv2rgb16_X_c; break; case PIX_FMT_RGB555: case PIX_FMT_BGR555: *yuv2packed1 = yuv2rgb15_1_c; *yuv2packed2 = yuv2rgb15_2_c; *yuv2packedX = yuv2rgb15_X_c; break; case PIX_FMT_RGB444: case PIX_FMT_BGR444: *yuv2packed1 = yuv2rgb12_1_c; *yuv2packed2 = yuv2rgb12_2_c; *yuv2packedX = yuv2rgb12_X_c; break; case PIX_FMT_RGB8: case PIX_FMT_BGR8: *yuv2packed1 = yuv2rgb8_1_c; *yuv2packed2 = yuv2rgb8_2_c; *yuv2packedX = yuv2rgb8_X_c; break; case PIX_FMT_RGB4: case PIX_FMT_BGR4: *yuv2packed1 = yuv2rgb4_1_c; *yuv2packed2 = yuv2rgb4_2_c; *yuv2packedX = yuv2rgb4_X_c; break; case PIX_FMT_RGB4_BYTE: case PIX_FMT_BGR4_BYTE: *yuv2packed1 = yuv2rgb4b_1_c; *yuv2packed2 = yuv2rgb4b_2_c; *yuv2packedX = yuv2rgb4b_X_c; break; } } }
{ "code": [], "line_no": [] }
FUNC_0(SwsContext *VAR_0, yuv2planar1_fn *VAR_1, yuv2planarX_fn *VAR_2, yuv2packed1_fn *VAR_3, yuv2packed2_fn *VAR_4, yuv2packedX_fn *VAR_5) { enum PixelFormat VAR_6 = VAR_0->VAR_6; if (VAR_6 == PIX_FMT_NV12 || VAR_6 == PIX_FMT_NV21) { *VAR_2 = yuv2nv12X_c; } else if (is16BPS(VAR_6)) { *VAR_2 = isBE(VAR_6) ? yuv2yuvX16BE_c : yuv2yuvX16LE_c; } else if (is9_OR_10BPS(VAR_6)) { if (av_pix_fmt_descriptors[VAR_6].comp[0].depth_minus1 == 8) { *VAR_2 = isBE(VAR_6) ? yuv2yuvX9BE_c : yuv2yuvX9LE_c; } else { *VAR_2 = isBE(VAR_6) ? yuv2yuvX10BE_c : yuv2yuvX10LE_c; } } else { *VAR_1 = yuv2yuv1_c; *VAR_2 = yuv2yuvX_c; } if(VAR_0->flags & SWS_FULL_CHR_H_INT) { switch (VAR_6) { case PIX_FMT_RGBA: #if CONFIG_SMALL *VAR_5 = yuv2rgba32_full_X_c; #else #if CONFIG_SWSCALE_ALPHA if (VAR_0->alpPixBuf) { *VAR_5 = yuv2rgba32_full_X_c; } else #endif { *VAR_5 = yuv2rgbx32_full_X_c; } #endif break; case PIX_FMT_ARGB: #if CONFIG_SMALL *VAR_5 = yuv2argb32_full_X_c; #else #if CONFIG_SWSCALE_ALPHA if (VAR_0->alpPixBuf) { *VAR_5 = yuv2argb32_full_X_c; } else #endif { *VAR_5 = yuv2xrgb32_full_X_c; } #endif break; case PIX_FMT_BGRA: #if CONFIG_SMALL *VAR_5 = yuv2bgra32_full_X_c; #else #if CONFIG_SWSCALE_ALPHA if (VAR_0->alpPixBuf) { *VAR_5 = yuv2bgra32_full_X_c; } else #endif { *VAR_5 = yuv2bgrx32_full_X_c; } #endif break; case PIX_FMT_ABGR: #if CONFIG_SMALL *VAR_5 = yuv2abgr32_full_X_c; #else #if CONFIG_SWSCALE_ALPHA if (VAR_0->alpPixBuf) { *VAR_5 = yuv2abgr32_full_X_c; } else #endif { *VAR_5 = yuv2xbgr32_full_X_c; } #endif break; case PIX_FMT_RGB24: *VAR_5 = yuv2rgb24_full_X_c; break; case PIX_FMT_BGR24: *VAR_5 = yuv2bgr24_full_X_c; break; } } else { switch (VAR_6) { case PIX_FMT_GRAY16BE: *VAR_3 = yuv2gray16BE_1_c; *VAR_4 = yuv2gray16BE_2_c; *VAR_5 = yuv2gray16BE_X_c; break; case PIX_FMT_GRAY16LE: *VAR_3 = yuv2gray16LE_1_c; *VAR_4 = yuv2gray16LE_2_c; *VAR_5 = yuv2gray16LE_X_c; break; case PIX_FMT_MONOWHITE: *VAR_3 = yuv2monowhite_1_c; *VAR_4 = yuv2monowhite_2_c; *VAR_5 = yuv2monowhite_X_c; break; case PIX_FMT_MONOBLACK: *VAR_3 = yuv2monoblack_1_c; *VAR_4 = yuv2monoblack_2_c; *VAR_5 = yuv2monoblack_X_c; break; case PIX_FMT_YUYV422: *VAR_3 = yuv2yuyv422_1_c; *VAR_4 = yuv2yuyv422_2_c; *VAR_5 = yuv2yuyv422_X_c; break; case PIX_FMT_UYVY422: *VAR_3 = yuv2uyvy422_1_c; *VAR_4 = yuv2uyvy422_2_c; *VAR_5 = yuv2uyvy422_X_c; break; case PIX_FMT_RGB48LE: case PIX_FMT_RGB48BE: *VAR_3 = yuv2rgb48be_1_c; *VAR_4 = yuv2rgb48be_2_c; *VAR_5 = yuv2rgb48be_X_c; break; case PIX_FMT_BGR48LE: case PIX_FMT_BGR48BE: *VAR_3 = yuv2bgr48be_1_c; *VAR_4 = yuv2bgr48be_2_c; *VAR_5 = yuv2bgr48be_X_c; break; case PIX_FMT_RGB32: case PIX_FMT_BGR32: #if CONFIG_SMALL *VAR_3 = yuv2rgb32_1_c; *VAR_4 = yuv2rgb32_2_c; *VAR_5 = yuv2rgb32_X_c; #else #if CONFIG_SWSCALE_ALPHA if (VAR_0->alpPixBuf) { *VAR_3 = yuv2rgba32_1_c; *VAR_4 = yuv2rgba32_2_c; *VAR_5 = yuv2rgba32_X_c; } else #endif { *VAR_3 = yuv2rgbx32_1_c; *VAR_4 = yuv2rgbx32_2_c; *VAR_5 = yuv2rgbx32_X_c; } #endif break; case PIX_FMT_RGB32_1: case PIX_FMT_BGR32_1: #if CONFIG_SMALL *VAR_3 = yuv2rgb32_1_1_c; *VAR_4 = yuv2rgb32_1_2_c; *VAR_5 = yuv2rgb32_1_X_c; #else #if CONFIG_SWSCALE_ALPHA if (VAR_0->alpPixBuf) { *VAR_3 = yuv2rgba32_1_1_c; *VAR_4 = yuv2rgba32_1_2_c; *VAR_5 = yuv2rgba32_1_X_c; } else #endif { *VAR_3 = yuv2rgbx32_1_1_c; *VAR_4 = yuv2rgbx32_1_2_c; *VAR_5 = yuv2rgbx32_1_X_c; } #endif break; case PIX_FMT_RGB24: *VAR_3 = yuv2rgb24_1_c; *VAR_4 = yuv2rgb24_2_c; *VAR_5 = yuv2rgb24_X_c; break; case PIX_FMT_BGR24: *VAR_3 = yuv2bgr24_1_c; *VAR_4 = yuv2bgr24_2_c; *VAR_5 = yuv2bgr24_X_c; break; case PIX_FMT_RGB565: case PIX_FMT_BGR565: *VAR_3 = yuv2rgb16_1_c; *VAR_4 = yuv2rgb16_2_c; *VAR_5 = yuv2rgb16_X_c; break; case PIX_FMT_RGB555: case PIX_FMT_BGR555: *VAR_3 = yuv2rgb15_1_c; *VAR_4 = yuv2rgb15_2_c; *VAR_5 = yuv2rgb15_X_c; break; case PIX_FMT_RGB444: case PIX_FMT_BGR444: *VAR_3 = yuv2rgb12_1_c; *VAR_4 = yuv2rgb12_2_c; *VAR_5 = yuv2rgb12_X_c; break; case PIX_FMT_RGB8: case PIX_FMT_BGR8: *VAR_3 = yuv2rgb8_1_c; *VAR_4 = yuv2rgb8_2_c; *VAR_5 = yuv2rgb8_X_c; break; case PIX_FMT_RGB4: case PIX_FMT_BGR4: *VAR_3 = yuv2rgb4_1_c; *VAR_4 = yuv2rgb4_2_c; *VAR_5 = yuv2rgb4_X_c; break; case PIX_FMT_RGB4_BYTE: case PIX_FMT_BGR4_BYTE: *VAR_3 = yuv2rgb4b_1_c; *VAR_4 = yuv2rgb4b_2_c; *VAR_5 = yuv2rgb4b_X_c; break; } } }
[ "FUNC_0(SwsContext *VAR_0,\nyuv2planar1_fn *VAR_1, yuv2planarX_fn *VAR_2,\nyuv2packed1_fn *VAR_3, yuv2packed2_fn *VAR_4,\nyuv2packedX_fn *VAR_5)\n{", "enum PixelFormat VAR_6 = VAR_0->VAR_6;", "if (VAR_6 == PIX_FMT_NV12 || VAR_6 == PIX_FMT_NV21) {", "*VAR_2 = yuv2nv12X_c;", "} else if (is16BPS(VAR_6)) {", "*VAR_2 = isBE(VAR_6) ? yuv2yuvX16BE_c : yuv2yuvX16LE_c;", "} else if (is9_OR_10BPS(VAR_6)) {", "if (av_pix_fmt_descriptors[VAR_6].comp[0].depth_minus1 == 8) {", "*VAR_2 = isBE(VAR_6) ? yuv2yuvX9BE_c : yuv2yuvX9LE_c;", "} else {", "*VAR_2 = isBE(VAR_6) ? yuv2yuvX10BE_c : yuv2yuvX10LE_c;", "}", "} else {", "*VAR_1 = yuv2yuv1_c;", "*VAR_2 = yuv2yuvX_c;", "}", "if(VAR_0->flags & SWS_FULL_CHR_H_INT) {", "switch (VAR_6) {", "case PIX_FMT_RGBA:\n#if CONFIG_SMALL\n*VAR_5 = yuv2rgba32_full_X_c;", "#else\n#if CONFIG_SWSCALE_ALPHA\nif (VAR_0->alpPixBuf) {", "*VAR_5 = yuv2rgba32_full_X_c;", "} else", "#endif\n{", "*VAR_5 = yuv2rgbx32_full_X_c;", "}", "#endif\nbreak;", "case PIX_FMT_ARGB:\n#if CONFIG_SMALL\n*VAR_5 = yuv2argb32_full_X_c;", "#else\n#if CONFIG_SWSCALE_ALPHA\nif (VAR_0->alpPixBuf) {", "*VAR_5 = yuv2argb32_full_X_c;", "} else", "#endif\n{", "*VAR_5 = yuv2xrgb32_full_X_c;", "}", "#endif\nbreak;", "case PIX_FMT_BGRA:\n#if CONFIG_SMALL\n*VAR_5 = yuv2bgra32_full_X_c;", "#else\n#if CONFIG_SWSCALE_ALPHA\nif (VAR_0->alpPixBuf) {", "*VAR_5 = yuv2bgra32_full_X_c;", "} else", "#endif\n{", "*VAR_5 = yuv2bgrx32_full_X_c;", "}", "#endif\nbreak;", "case PIX_FMT_ABGR:\n#if CONFIG_SMALL\n*VAR_5 = yuv2abgr32_full_X_c;", "#else\n#if CONFIG_SWSCALE_ALPHA\nif (VAR_0->alpPixBuf) {", "*VAR_5 = yuv2abgr32_full_X_c;", "} else", "#endif\n{", "*VAR_5 = yuv2xbgr32_full_X_c;", "}", "#endif\nbreak;", "case PIX_FMT_RGB24:\n*VAR_5 = yuv2rgb24_full_X_c;", "break;", "case PIX_FMT_BGR24:\n*VAR_5 = yuv2bgr24_full_X_c;", "break;", "}", "} else {", "switch (VAR_6) {", "case PIX_FMT_GRAY16BE:\n*VAR_3 = yuv2gray16BE_1_c;", "*VAR_4 = yuv2gray16BE_2_c;", "*VAR_5 = yuv2gray16BE_X_c;", "break;", "case PIX_FMT_GRAY16LE:\n*VAR_3 = yuv2gray16LE_1_c;", "*VAR_4 = yuv2gray16LE_2_c;", "*VAR_5 = yuv2gray16LE_X_c;", "break;", "case PIX_FMT_MONOWHITE:\n*VAR_3 = yuv2monowhite_1_c;", "*VAR_4 = yuv2monowhite_2_c;", "*VAR_5 = yuv2monowhite_X_c;", "break;", "case PIX_FMT_MONOBLACK:\n*VAR_3 = yuv2monoblack_1_c;", "*VAR_4 = yuv2monoblack_2_c;", "*VAR_5 = yuv2monoblack_X_c;", "break;", "case PIX_FMT_YUYV422:\n*VAR_3 = yuv2yuyv422_1_c;", "*VAR_4 = yuv2yuyv422_2_c;", "*VAR_5 = yuv2yuyv422_X_c;", "break;", "case PIX_FMT_UYVY422:\n*VAR_3 = yuv2uyvy422_1_c;", "*VAR_4 = yuv2uyvy422_2_c;", "*VAR_5 = yuv2uyvy422_X_c;", "break;", "case PIX_FMT_RGB48LE:\ncase PIX_FMT_RGB48BE:\n*VAR_3 = yuv2rgb48be_1_c;", "*VAR_4 = yuv2rgb48be_2_c;", "*VAR_5 = yuv2rgb48be_X_c;", "break;", "case PIX_FMT_BGR48LE:\ncase PIX_FMT_BGR48BE:\n*VAR_3 = yuv2bgr48be_1_c;", "*VAR_4 = yuv2bgr48be_2_c;", "*VAR_5 = yuv2bgr48be_X_c;", "break;", "case PIX_FMT_RGB32:\ncase PIX_FMT_BGR32:\n#if CONFIG_SMALL\n*VAR_3 = yuv2rgb32_1_c;", "*VAR_4 = yuv2rgb32_2_c;", "*VAR_5 = yuv2rgb32_X_c;", "#else\n#if CONFIG_SWSCALE_ALPHA\nif (VAR_0->alpPixBuf) {", "*VAR_3 = yuv2rgba32_1_c;", "*VAR_4 = yuv2rgba32_2_c;", "*VAR_5 = yuv2rgba32_X_c;", "} else", "#endif\n{", "*VAR_3 = yuv2rgbx32_1_c;", "*VAR_4 = yuv2rgbx32_2_c;", "*VAR_5 = yuv2rgbx32_X_c;", "}", "#endif\nbreak;", "case PIX_FMT_RGB32_1:\ncase PIX_FMT_BGR32_1:\n#if CONFIG_SMALL\n*VAR_3 = yuv2rgb32_1_1_c;", "*VAR_4 = yuv2rgb32_1_2_c;", "*VAR_5 = yuv2rgb32_1_X_c;", "#else\n#if CONFIG_SWSCALE_ALPHA\nif (VAR_0->alpPixBuf) {", "*VAR_3 = yuv2rgba32_1_1_c;", "*VAR_4 = yuv2rgba32_1_2_c;", "*VAR_5 = yuv2rgba32_1_X_c;", "} else", "#endif\n{", "*VAR_3 = yuv2rgbx32_1_1_c;", "*VAR_4 = yuv2rgbx32_1_2_c;", "*VAR_5 = yuv2rgbx32_1_X_c;", "}", "#endif\nbreak;", "case PIX_FMT_RGB24:\n*VAR_3 = yuv2rgb24_1_c;", "*VAR_4 = yuv2rgb24_2_c;", "*VAR_5 = yuv2rgb24_X_c;", "break;", "case PIX_FMT_BGR24:\n*VAR_3 = yuv2bgr24_1_c;", "*VAR_4 = yuv2bgr24_2_c;", "*VAR_5 = yuv2bgr24_X_c;", "break;", "case PIX_FMT_RGB565:\ncase PIX_FMT_BGR565:\n*VAR_3 = yuv2rgb16_1_c;", "*VAR_4 = yuv2rgb16_2_c;", "*VAR_5 = yuv2rgb16_X_c;", "break;", "case PIX_FMT_RGB555:\ncase PIX_FMT_BGR555:\n*VAR_3 = yuv2rgb15_1_c;", "*VAR_4 = yuv2rgb15_2_c;", "*VAR_5 = yuv2rgb15_X_c;", "break;", "case PIX_FMT_RGB444:\ncase PIX_FMT_BGR444:\n*VAR_3 = yuv2rgb12_1_c;", "*VAR_4 = yuv2rgb12_2_c;", "*VAR_5 = yuv2rgb12_X_c;", "break;", "case PIX_FMT_RGB8:\ncase PIX_FMT_BGR8:\n*VAR_3 = yuv2rgb8_1_c;", "*VAR_4 = yuv2rgb8_2_c;", "*VAR_5 = yuv2rgb8_X_c;", "break;", "case PIX_FMT_RGB4:\ncase PIX_FMT_BGR4:\n*VAR_3 = yuv2rgb4_1_c;", "*VAR_4 = yuv2rgb4_2_c;", "*VAR_5 = yuv2rgb4_X_c;", "break;", "case PIX_FMT_RGB4_BYTE:\ncase PIX_FMT_BGR4_BYTE:\n*VAR_3 = yuv2rgb4b_1_c;", "*VAR_4 = yuv2rgb4b_2_c;", "*VAR_5 = yuv2rgb4b_X_c;", "break;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49, 51 ], [ 53, 55, 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75, 77, 79 ], [ 81, 83, 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103, 105, 107 ], [ 109, 111, 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131, 133, 135 ], [ 137, 139, 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155, 157 ], [ 159, 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227, 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237, 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257, 267, 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279, 281, 283 ], [ 285 ], [ 287 ], [ 289, 291, 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303, 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315, 317 ], [ 319, 321, 323, 325 ], [ 327 ], [ 329 ], [ 331, 333, 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345, 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357, 359 ], [ 361, 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371, 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381, 383, 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393, 395, 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405, 407, 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417, 419, 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429, 431, 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441, 443, 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ] ]
830
static av_always_inline void h264_filter_mb_fast_internal(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int pixel_shift) { int chroma = !(CONFIG_GRAY && (h->flags&CODEC_FLAG_GRAY)); int chroma444 = CHROMA444(h); int chroma422 = CHROMA422(h); int mb_xy = h->mb_xy; int left_type= h->left_type[LTOP]; int top_type= h->top_type; int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); int a = h->slice_alpha_c0_offset - qp_bd_offset; int b = h->slice_beta_offset - qp_bd_offset; int mb_type = h->cur_pic.mb_type[mb_xy]; int qp = h->cur_pic.qscale_table[mb_xy]; int qp0 = h->cur_pic.qscale_table[mb_xy - 1]; int qp1 = h->cur_pic.qscale_table[h->top_mb_xy]; int qpc = get_chroma_qp( h, 0, qp ); int qpc0 = get_chroma_qp( h, 0, qp0 ); int qpc1 = get_chroma_qp( h, 0, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; if( IS_INTRA(mb_type) ) { static const int16_t bS4[4] = {4,4,4,4}; static const int16_t bS3[4] = {3,3,3,3}; const int16_t *bSH = FIELD_PICTURE(h) ? bS3 : bS4; if(left_type) filter_mb_edgev( &img_y[4*0<<pixel_shift], linesize, bS4, qp0, a, b, h, 1); if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, bS3, qp, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, a, b, h, 1); } filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, a, b, h, 0); } else { filter_mb_edgev( &img_y[4*1<<pixel_shift], linesize, bS3, qp, a, b, h, 0); filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, bS3, qp, a, b, h, 0); filter_mb_edgev( &img_y[4*3<<pixel_shift], linesize, bS3, qp, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, a, b, h, 1); } filter_mb_edgeh( &img_y[4*1*linesize], linesize, bS3, qp, a, b, h, 0); filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, a, b, h, 0); filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, a, b, h, 0); } if(chroma){ if(chroma444){ if(left_type){ filter_mb_edgev( &img_cb[4*0<<pixel_shift], linesize, bS4, qpc0, a, b, h, 1); filter_mb_edgev( &img_cr[4*0<<pixel_shift], linesize, bS4, qpc0, a, b, h, 1); } if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1 ); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1 ); } filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); } else { filter_mb_edgev( &img_cb[4*1<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*1<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cb[4*3<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*3<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgeh( &img_cb[4*1*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*1*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cb[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); } }else if(chroma422){ if(left_type){ filter_mb_edgecv(&img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); filter_mb_edgecv(&img_cr[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); } filter_mb_edgecv(&img_cb[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgecv(&img_cr[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgech(&img_cb[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); filter_mb_edgech(&img_cr[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgech(&img_cb[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cb[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cb[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); }else{ if(left_type){ filter_mb_edgecv( &img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); filter_mb_edgecv( &img_cr[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); } filter_mb_edgecv( &img_cb[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgecv( &img_cr[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); } } return; } else { LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]); int edges; if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 && !chroma444 ) { edges = 4; AV_WN64A(bS[0][0], 0x0002000200020002ULL); AV_WN64A(bS[0][2], 0x0002000200020002ULL); AV_WN64A(bS[1][0], 0x0002000200020002ULL); AV_WN64A(bS[1][2], 0x0002000200020002ULL); } else { int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); //(mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0; int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); // (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (h->left_type[LTOP] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0; int step = 1+(mb_type>>24); //IS_8x8DCT(mb_type) ? 2 : 1; edges = 4 - 3*((mb_type>>3) & !(h->cbp & 15)); //(mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4; h->h264dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, h->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE(h)); } if( IS_INTRA(left_type) ) AV_WN64A(bS[0][0], 0x0004000400040004ULL); if( IS_INTRA(top_type) ) AV_WN64A(bS[1][0], FIELD_PICTURE(h) ? 0x0003000300030003ULL : 0x0004000400040004ULL); #define FILTER(hv,dir,edge,intra)\ if(AV_RN64A(bS[dir][edge])) { \ filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qp : qp##dir, a, b, h, intra );\ if(chroma){\ if(chroma444){\ filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ } else if(!(edge&1)) {\ filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ }\ }\ } if(left_type) FILTER(v,0,0,1); if( edges == 1 ) { if(top_type) FILTER(h,1,0,1); } else if( IS_8x8DCT(mb_type) ) { FILTER(v,0,2,0); if(top_type) FILTER(h,1,0,1); FILTER(h,1,2,0); } else { FILTER(v,0,1,0); FILTER(v,0,2,0); FILTER(v,0,3,0); if(top_type) FILTER(h,1,0,1); FILTER(h,1,1,0); FILTER(h,1,2,0); FILTER(h,1,3,0); } #undef FILTER } }
false
FFmpeg
f777504f640260337974848c7d5d7a3f064bbb45
static av_always_inline void h264_filter_mb_fast_internal(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int pixel_shift) { int chroma = !(CONFIG_GRAY && (h->flags&CODEC_FLAG_GRAY)); int chroma444 = CHROMA444(h); int chroma422 = CHROMA422(h); int mb_xy = h->mb_xy; int left_type= h->left_type[LTOP]; int top_type= h->top_type; int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); int a = h->slice_alpha_c0_offset - qp_bd_offset; int b = h->slice_beta_offset - qp_bd_offset; int mb_type = h->cur_pic.mb_type[mb_xy]; int qp = h->cur_pic.qscale_table[mb_xy]; int qp0 = h->cur_pic.qscale_table[mb_xy - 1]; int qp1 = h->cur_pic.qscale_table[h->top_mb_xy]; int qpc = get_chroma_qp( h, 0, qp ); int qpc0 = get_chroma_qp( h, 0, qp0 ); int qpc1 = get_chroma_qp( h, 0, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; if( IS_INTRA(mb_type) ) { static const int16_t bS4[4] = {4,4,4,4}; static const int16_t bS3[4] = {3,3,3,3}; const int16_t *bSH = FIELD_PICTURE(h) ? bS3 : bS4; if(left_type) filter_mb_edgev( &img_y[4*0<<pixel_shift], linesize, bS4, qp0, a, b, h, 1); if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, bS3, qp, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, a, b, h, 1); } filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, a, b, h, 0); } else { filter_mb_edgev( &img_y[4*1<<pixel_shift], linesize, bS3, qp, a, b, h, 0); filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, bS3, qp, a, b, h, 0); filter_mb_edgev( &img_y[4*3<<pixel_shift], linesize, bS3, qp, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, a, b, h, 1); } filter_mb_edgeh( &img_y[4*1*linesize], linesize, bS3, qp, a, b, h, 0); filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, a, b, h, 0); filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, a, b, h, 0); } if(chroma){ if(chroma444){ if(left_type){ filter_mb_edgev( &img_cb[4*0<<pixel_shift], linesize, bS4, qpc0, a, b, h, 1); filter_mb_edgev( &img_cr[4*0<<pixel_shift], linesize, bS4, qpc0, a, b, h, 1); } if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1 ); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1 ); } filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); } else { filter_mb_edgev( &img_cb[4*1<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*1<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cb[4*3<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgev( &img_cr[4*3<<pixel_shift], linesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgeh( &img_cb[4*1*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*1*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cb[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); filter_mb_edgeh( &img_cr[4*3*linesize], linesize, bS3, qpc, a, b, h, 0); } }else if(chroma422){ if(left_type){ filter_mb_edgecv(&img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); filter_mb_edgecv(&img_cr[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); } filter_mb_edgecv(&img_cb[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgecv(&img_cr[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgech(&img_cb[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); filter_mb_edgech(&img_cr[4*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgech(&img_cb[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*1*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cb[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cb[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech(&img_cr[4*3*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); }else{ if(left_type){ filter_mb_edgecv( &img_cb[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); filter_mb_edgecv( &img_cr[2*0<<pixel_shift], uvlinesize, bS4, qpc0, a, b, h, 1); } filter_mb_edgecv( &img_cb[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgecv( &img_cr[2*2<<pixel_shift], uvlinesize, bS3, qpc, a, b, h, 0); if(top_type){ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, a, b, h, 1); } filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, a, b, h, 0); } } return; } else { LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]); int edges; if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 && !chroma444 ) { edges = 4; AV_WN64A(bS[0][0], 0x0002000200020002ULL); AV_WN64A(bS[0][2], 0x0002000200020002ULL); AV_WN64A(bS[1][0], 0x0002000200020002ULL); AV_WN64A(bS[1][2], 0x0002000200020002ULL); } else { int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); int step = 1+(mb_type>>24); edges = 4 - 3*((mb_type>>3) & !(h->cbp & 15)); h->h264dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, h->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE(h)); } if( IS_INTRA(left_type) ) AV_WN64A(bS[0][0], 0x0004000400040004ULL); if( IS_INTRA(top_type) ) AV_WN64A(bS[1][0], FIELD_PICTURE(h) ? 0x0003000300030003ULL : 0x0004000400040004ULL); #define FILTER(hv,dir,edge,intra)\ if(AV_RN64A(bS[dir][edge])) { \ filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qp : qp##dir, a, b, h, intra );\ if(chroma){\ if(chroma444){\ filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ } else if(!(edge&1)) {\ filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, a, b, h, intra );\ }\ }\ } if(left_type) FILTER(v,0,0,1); if( edges == 1 ) { if(top_type) FILTER(h,1,0,1); } else if( IS_8x8DCT(mb_type) ) { FILTER(v,0,2,0); if(top_type) FILTER(h,1,0,1); FILTER(h,1,2,0); } else { FILTER(v,0,1,0); FILTER(v,0,2,0); FILTER(v,0,3,0); if(top_type) FILTER(h,1,0,1); FILTER(h,1,1,0); FILTER(h,1,2,0); FILTER(h,1,3,0); } #undef FILTER } }
{ "code": [], "line_no": [] }
static av_always_inline void FUNC_0(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int pixel_shift) { int VAR_0 = !(CONFIG_GRAY && (h->flags&CODEC_FLAG_GRAY)); int VAR_1 = CHROMA444(h); int VAR_2 = CHROMA422(h); int VAR_3 = h->VAR_3; int VAR_4= h->VAR_4[LTOP]; int VAR_5= h->VAR_5; int VAR_6 = 6 * (h->sps.bit_depth_luma - 8); int VAR_7 = h->slice_alpha_c0_offset - VAR_6; int VAR_8 = h->slice_beta_offset - VAR_6; int VAR_9 = h->cur_pic.VAR_9[VAR_3]; int VAR_10 = h->cur_pic.qscale_table[VAR_3]; int VAR_11 = h->cur_pic.qscale_table[VAR_3 - 1]; int VAR_12 = h->cur_pic.qscale_table[h->top_mb_xy]; int VAR_13 = get_chroma_qp( h, 0, VAR_10 ); int VAR_14 = get_chroma_qp( h, 0, VAR_11 ); int VAR_15 = get_chroma_qp( h, 0, VAR_12 ); VAR_11 = (VAR_10 + VAR_11 + 1) >> 1; VAR_12 = (VAR_10 + VAR_12 + 1) >> 1; VAR_14 = (VAR_13 + VAR_14 + 1) >> 1; VAR_15 = (VAR_13 + VAR_15 + 1) >> 1; if( IS_INTRA(VAR_9) ) { static const int16_t VAR_16[4] = {4,4,4,4}; static const int16_t VAR_17[4] = {3,3,3,3}; const int16_t *VAR_18 = FIELD_PICTURE(h) ? VAR_17 : VAR_16; if(VAR_4) filter_mb_edgev( &img_y[4*0<<pixel_shift], linesize, VAR_16, VAR_11, VAR_7, VAR_8, h, 1); if( IS_8x8DCT(VAR_9) ) { filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); if(VAR_5){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, VAR_18, VAR_12, VAR_7, VAR_8, h, 1); } filter_mb_edgeh( &img_y[4*2*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); } else { filter_mb_edgev( &img_y[4*1<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_y[4*3<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); if(VAR_5){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, VAR_18, VAR_12, VAR_7, VAR_8, h, 1); } filter_mb_edgeh( &img_y[4*1*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_y[4*2*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_y[4*3*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0); } if(VAR_0){ if(VAR_1){ if(VAR_4){ filter_mb_edgev( &img_cb[4*0<<pixel_shift], linesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1); filter_mb_edgev( &img_cr[4*0<<pixel_shift], linesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1); } if( IS_8x8DCT(VAR_9) ) { filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); if(VAR_5){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1 ); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1 ); } filter_mb_edgeh( &img_cb[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); } else { filter_mb_edgev( &img_cb[4*1<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_cr[4*1<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_cb[4*3<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgev( &img_cr[4*3<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); if(VAR_5){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1); } filter_mb_edgeh( &img_cb[4*1*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_cr[4*1*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_cb[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_cb[4*3*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgeh( &img_cr[4*3*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); } }else if(VAR_2){ if(VAR_4){ filter_mb_edgecv(&img_cb[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1); filter_mb_edgecv(&img_cr[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1); } filter_mb_edgecv(&img_cb[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgecv(&img_cr[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); if(VAR_5){ filter_mb_edgech(&img_cb[4*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1); filter_mb_edgech(&img_cr[4*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1); } filter_mb_edgech(&img_cb[4*1*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgech(&img_cr[4*1*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgech(&img_cb[4*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgech(&img_cr[4*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgech(&img_cb[4*3*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgech(&img_cr[4*3*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); }else{ if(VAR_4){ filter_mb_edgecv( &img_cb[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1); filter_mb_edgecv( &img_cr[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1); } filter_mb_edgecv( &img_cb[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgecv( &img_cr[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); if(VAR_5){ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1); filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1); } filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0); } } return; } else { LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]); int VAR_19; if( IS_8x8DCT(VAR_9) && (h->cbp&7) == 7 && !VAR_1 ) { VAR_19 = 4; AV_WN64A(bS[0][0], 0x0002000200020002ULL); AV_WN64A(bS[0][2], 0x0002000200020002ULL); AV_WN64A(bS[1][0], 0x0002000200020002ULL); AV_WN64A(bS[1][2], 0x0002000200020002ULL); } else { int VAR_20 = (3*(((5*VAR_9)>>5)&1)) | (VAR_9>>4); int VAR_21 = 3*((VAR_20>>1) & ((5*VAR_4)>>5)&1); int VAR_22 = 1+(VAR_9>>24); VAR_19 = 4 - 3*((VAR_9>>3) & !(h->cbp & 15)); h->h264dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, h->list_count==2, VAR_19, VAR_22, VAR_21, VAR_20, FIELD_PICTURE(h)); } if( IS_INTRA(VAR_4) ) AV_WN64A(bS[0][0], 0x0004000400040004ULL); if( IS_INTRA(VAR_5) ) AV_WN64A(bS[1][0], FIELD_PICTURE(h) ? 0x0003000300030003ULL : 0x0004000400040004ULL); #define FILTER(hv,dir,edge,intra)\ if(AV_RN64A(bS[dir][edge])) { \ filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? VAR_10 : VAR_10##dir, VAR_7, VAR_8, h, intra );\ if(VAR_0){\ if(VAR_1){\ filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\ filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\ } else if(!(edge&1)) {\ filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\ filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\ }\ }\ } if(VAR_4) FILTER(v,0,0,1); if( VAR_19 == 1 ) { if(VAR_5) FILTER(h,1,0,1); } else if( IS_8x8DCT(VAR_9) ) { FILTER(v,0,2,0); if(VAR_5) FILTER(h,1,0,1); FILTER(h,1,2,0); } else { FILTER(v,0,1,0); FILTER(v,0,2,0); FILTER(v,0,3,0); if(VAR_5) FILTER(h,1,0,1); FILTER(h,1,1,0); FILTER(h,1,2,0); FILTER(h,1,3,0); } #undef FILTER } }
[ "static av_always_inline void FUNC_0(H264Context *h,\nint mb_x, int mb_y,\nuint8_t *img_y,\nuint8_t *img_cb,\nuint8_t *img_cr,\nunsigned int linesize,\nunsigned int uvlinesize,\nint pixel_shift)\n{", "int VAR_0 = !(CONFIG_GRAY && (h->flags&CODEC_FLAG_GRAY));", "int VAR_1 = CHROMA444(h);", "int VAR_2 = CHROMA422(h);", "int VAR_3 = h->VAR_3;", "int VAR_4= h->VAR_4[LTOP];", "int VAR_5= h->VAR_5;", "int VAR_6 = 6 * (h->sps.bit_depth_luma - 8);", "int VAR_7 = h->slice_alpha_c0_offset - VAR_6;", "int VAR_8 = h->slice_beta_offset - VAR_6;", "int VAR_9 = h->cur_pic.VAR_9[VAR_3];", "int VAR_10 = h->cur_pic.qscale_table[VAR_3];", "int VAR_11 = h->cur_pic.qscale_table[VAR_3 - 1];", "int VAR_12 = h->cur_pic.qscale_table[h->top_mb_xy];", "int VAR_13 = get_chroma_qp( h, 0, VAR_10 );", "int VAR_14 = get_chroma_qp( h, 0, VAR_11 );", "int VAR_15 = get_chroma_qp( h, 0, VAR_12 );", "VAR_11 = (VAR_10 + VAR_11 + 1) >> 1;", "VAR_12 = (VAR_10 + VAR_12 + 1) >> 1;", "VAR_14 = (VAR_13 + VAR_14 + 1) >> 1;", "VAR_15 = (VAR_13 + VAR_15 + 1) >> 1;", "if( IS_INTRA(VAR_9) ) {", "static const int16_t VAR_16[4] = {4,4,4,4};", "static const int16_t VAR_17[4] = {3,3,3,3};", "const int16_t *VAR_18 = FIELD_PICTURE(h) ? VAR_17 : VAR_16;", "if(VAR_4)\nfilter_mb_edgev( &img_y[4*0<<pixel_shift], linesize, VAR_16, VAR_11, VAR_7, VAR_8, h, 1);", "if( IS_8x8DCT(VAR_9) ) {", "filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "if(VAR_5){", "filter_mb_edgeh( &img_y[4*0*linesize], linesize, VAR_18, VAR_12, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgeh( &img_y[4*2*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "} else {", "filter_mb_edgev( &img_y[4*1<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_y[4*2<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_y[4*3<<pixel_shift], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "if(VAR_5){", "filter_mb_edgeh( &img_y[4*0*linesize], linesize, VAR_18, VAR_12, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgeh( &img_y[4*1*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_y[4*2*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_y[4*3*linesize], linesize, VAR_17, VAR_10, VAR_7, VAR_8, h, 0);", "}", "if(VAR_0){", "if(VAR_1){", "if(VAR_4){", "filter_mb_edgev( &img_cb[4*0<<pixel_shift], linesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1);", "filter_mb_edgev( &img_cr[4*0<<pixel_shift], linesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1);", "}", "if( IS_8x8DCT(VAR_9) ) {", "filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "if(VAR_5){", "filter_mb_edgeh( &img_cb[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1 );", "filter_mb_edgeh( &img_cr[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1 );", "}", "filter_mb_edgeh( &img_cb[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_cr[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "} else {", "filter_mb_edgev( &img_cb[4*1<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_cr[4*1<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_cb[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_cr[4*2<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_cb[4*3<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgev( &img_cr[4*3<<pixel_shift], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "if(VAR_5){", "filter_mb_edgeh( &img_cb[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1);", "filter_mb_edgeh( &img_cr[4*0*linesize], linesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgeh( &img_cb[4*1*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_cr[4*1*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_cb[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_cr[4*2*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_cb[4*3*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgeh( &img_cr[4*3*linesize], linesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "}", "}else if(VAR_2){", "if(VAR_4){", "filter_mb_edgecv(&img_cb[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1);", "filter_mb_edgecv(&img_cr[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgecv(&img_cb[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgecv(&img_cr[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "if(VAR_5){", "filter_mb_edgech(&img_cb[4*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1);", "filter_mb_edgech(&img_cr[4*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgech(&img_cb[4*1*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgech(&img_cr[4*1*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgech(&img_cb[4*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgech(&img_cr[4*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgech(&img_cb[4*3*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgech(&img_cr[4*3*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "}else{", "if(VAR_4){", "filter_mb_edgecv( &img_cb[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1);", "filter_mb_edgecv( &img_cr[2*0<<pixel_shift], uvlinesize, VAR_16, VAR_14, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgecv( &img_cb[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgecv( &img_cr[2*2<<pixel_shift], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "if(VAR_5){", "filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1);", "filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, VAR_18, VAR_15, VAR_7, VAR_8, h, 1);", "}", "filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, VAR_17, VAR_13, VAR_7, VAR_8, h, 0);", "}", "}", "return;", "} else {", "LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]);", "int VAR_19;", "if( IS_8x8DCT(VAR_9) && (h->cbp&7) == 7 && !VAR_1 ) {", "VAR_19 = 4;", "AV_WN64A(bS[0][0], 0x0002000200020002ULL);", "AV_WN64A(bS[0][2], 0x0002000200020002ULL);", "AV_WN64A(bS[1][0], 0x0002000200020002ULL);", "AV_WN64A(bS[1][2], 0x0002000200020002ULL);", "} else {", "int VAR_20 = (3*(((5*VAR_9)>>5)&1)) | (VAR_9>>4);", "int VAR_21 = 3*((VAR_20>>1) & ((5*VAR_4)>>5)&1);", "int VAR_22 = 1+(VAR_9>>24);", "VAR_19 = 4 - 3*((VAR_9>>3) & !(h->cbp & 15));", "h->h264dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache,\nh->list_count==2, VAR_19, VAR_22, VAR_21, VAR_20, FIELD_PICTURE(h));", "}", "if( IS_INTRA(VAR_4) )\nAV_WN64A(bS[0][0], 0x0004000400040004ULL);", "if( IS_INTRA(VAR_5) )\nAV_WN64A(bS[1][0], FIELD_PICTURE(h) ? 0x0003000300030003ULL : 0x0004000400040004ULL);", "#define FILTER(hv,dir,edge,intra)\\\nif(AV_RN64A(bS[dir][edge])) { \\", "filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? VAR_10 : VAR_10##dir, VAR_7, VAR_8, h, intra );\\", "if(VAR_0){\\", "if(VAR_1){\\", "filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\\", "filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1<<pixel_shift)], linesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\\", "} else if(!(edge&1)) {\\", "filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\\", "filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1<<pixel_shift)], uvlinesize, bS[dir][edge], edge ? VAR_13 : VAR_13##dir, VAR_7, VAR_8, h, intra );\\", "}\\", "}\\", "}", "if(VAR_4)\nFILTER(v,0,0,1);", "if( VAR_19 == 1 ) {", "if(VAR_5)\nFILTER(h,1,0,1);", "} else if( IS_8x8DCT(VAR_9) ) {", "FILTER(v,0,2,0);", "if(VAR_5)\nFILTER(h,1,0,1);", "FILTER(h,1,2,0);", "} else {", "FILTER(v,0,1,0);", "FILTER(v,0,2,0);", "FILTER(v,0,3,0);", "if(VAR_5)\nFILTER(h,1,0,1);", "FILTER(h,1,1,0);", "FILTER(h,1,2,0);", "FILTER(h,1,3,0);", "}", "#undef FILTER\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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273, 275 ], [ 277 ], [ 279, 281 ], [ 283, 285 ], [ 289, 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315, 317 ], [ 319 ], [ 321, 323 ], [ 325 ], [ 327 ], [ 329, 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343, 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355, 357 ], [ 359 ] ]
831
static int h263_decode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; int i; s->avctx = avctx; s->out_format = FMT_H263; s->width = avctx->width; s->height = avctx->height; /* select sub codec */ switch(avctx->codec->id) { case CODEC_ID_H263: s->gob_number = 0; s->first_gob_line = 0; break; case CODEC_ID_MPEG4: s->time_increment_bits = 4; /* default value for broken headers */ s->h263_pred = 1; s->has_b_frames = 1; //default, might be overriden in the vol header during header parsing break; case CODEC_ID_MSMPEG4V1: s->h263_msmpeg4 = 1; s->h263_pred = 1; s->msmpeg4_version=1; break; case CODEC_ID_MSMPEG4V2: s->h263_msmpeg4 = 1; s->h263_pred = 1; s->msmpeg4_version=2; break; case CODEC_ID_MSMPEG4V3: s->h263_msmpeg4 = 1; s->h263_pred = 1; s->msmpeg4_version=3; break; case CODEC_ID_WMV1: s->h263_msmpeg4 = 1; s->h263_pred = 1; s->msmpeg4_version=4; break; case CODEC_ID_H263I: s->h263_intel = 1; break; default: return -1; } /* for h263, we allocate the images after having read the header */ if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4) if (MPV_common_init(s) < 0) return -1; /* XXX: suppress this matrix init, only needed because using mpeg1 dequantize in mmx case */ for(i=0;i<64;i++) s->non_intra_matrix[i] = default_non_intra_matrix[i]; if (s->h263_msmpeg4) msmpeg4_decode_init_vlc(s); else h263_decode_init_vlc(s); return 0; }
true
FFmpeg
d7e9533aa06f4073a27812349b35ba5fede11ca1
static int h263_decode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; int i; s->avctx = avctx; s->out_format = FMT_H263; s->width = avctx->width; s->height = avctx->height; switch(avctx->codec->id) { case CODEC_ID_H263: s->gob_number = 0; s->first_gob_line = 0; break; case CODEC_ID_MPEG4: s->time_increment_bits = 4; s->h263_pred = 1; s->has_b_frames = 1; break; case CODEC_ID_MSMPEG4V1: s->h263_msmpeg4 = 1; s->h263_pred = 1; s->msmpeg4_version=1; break; case CODEC_ID_MSMPEG4V2: s->h263_msmpeg4 = 1; s->h263_pred = 1; s->msmpeg4_version=2; break; case CODEC_ID_MSMPEG4V3: s->h263_msmpeg4 = 1; s->h263_pred = 1; s->msmpeg4_version=3; break; case CODEC_ID_WMV1: s->h263_msmpeg4 = 1; s->h263_pred = 1; s->msmpeg4_version=4; break; case CODEC_ID_H263I: s->h263_intel = 1; break; default: return -1; } if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4) if (MPV_common_init(s) < 0) return -1; for(i=0;i<64;i++) s->non_intra_matrix[i] = default_non_intra_matrix[i]; if (s->h263_msmpeg4) msmpeg4_decode_init_vlc(s); else h263_decode_init_vlc(s); return 0; }
{ "code": [ " for(i=0;i<64;i++)", " s->non_intra_matrix[i] = default_non_intra_matrix[i];", " int i;", " s->non_intra_matrix[i] = default_non_intra_matrix[i];", " for(i=0;i<64;i++)", " s->non_intra_matrix[i] = default_non_intra_matrix[i];" ], "line_no": [ 113, 115, 7, 115, 113, 115 ] }
static int FUNC_0(AVCodecContext *VAR_0) { MpegEncContext *s = VAR_0->priv_data; int VAR_1; s->VAR_0 = VAR_0; s->out_format = FMT_H263; s->width = VAR_0->width; s->height = VAR_0->height; switch(VAR_0->codec->id) { case CODEC_ID_H263: s->gob_number = 0; s->first_gob_line = 0; break; case CODEC_ID_MPEG4: s->time_increment_bits = 4; s->h263_pred = 1; s->has_b_frames = 1; break; case CODEC_ID_MSMPEG4V1: s->h263_msmpeg4 = 1; s->h263_pred = 1; s->msmpeg4_version=1; break; case CODEC_ID_MSMPEG4V2: s->h263_msmpeg4 = 1; s->h263_pred = 1; s->msmpeg4_version=2; break; case CODEC_ID_MSMPEG4V3: s->h263_msmpeg4 = 1; s->h263_pred = 1; s->msmpeg4_version=3; break; case CODEC_ID_WMV1: s->h263_msmpeg4 = 1; s->h263_pred = 1; s->msmpeg4_version=4; break; case CODEC_ID_H263I: s->h263_intel = 1; break; default: return -1; } if (VAR_0->codec->id != CODEC_ID_H263 && VAR_0->codec->id != CODEC_ID_MPEG4) if (MPV_common_init(s) < 0) return -1; for(VAR_1=0;VAR_1<64;VAR_1++) s->non_intra_matrix[VAR_1] = default_non_intra_matrix[VAR_1]; if (s->h263_msmpeg4) msmpeg4_decode_init_vlc(s); else h263_decode_init_vlc(s); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "MpegEncContext *s = VAR_0->priv_data;", "int VAR_1;", "s->VAR_0 = VAR_0;", "s->out_format = FMT_H263;", "s->width = VAR_0->width;", "s->height = VAR_0->height;", "switch(VAR_0->codec->id) {", "case CODEC_ID_H263:\ns->gob_number = 0;", "s->first_gob_line = 0;", "break;", "case CODEC_ID_MPEG4:\ns->time_increment_bits = 4;", "s->h263_pred = 1;", "s->has_b_frames = 1;", "break;", "case CODEC_ID_MSMPEG4V1:\ns->h263_msmpeg4 = 1;", "s->h263_pred = 1;", "s->msmpeg4_version=1;", "break;", "case CODEC_ID_MSMPEG4V2:\ns->h263_msmpeg4 = 1;", "s->h263_pred = 1;", "s->msmpeg4_version=2;", "break;", "case CODEC_ID_MSMPEG4V3:\ns->h263_msmpeg4 = 1;", "s->h263_pred = 1;", "s->msmpeg4_version=3;", "break;", "case CODEC_ID_WMV1:\ns->h263_msmpeg4 = 1;", "s->h263_pred = 1;", "s->msmpeg4_version=4;", "break;", "case CODEC_ID_H263I:\ns->h263_intel = 1;", "break;", "default:\nreturn -1;", "}", "if (VAR_0->codec->id != CODEC_ID_H263 && VAR_0->codec->id != CODEC_ID_MPEG4)\nif (MPV_common_init(s) < 0)\nreturn -1;", "for(VAR_1=0;VAR_1<64;VAR_1++)", "s->non_intra_matrix[VAR_1] = default_non_intra_matrix[VAR_1];", "if (s->h263_msmpeg4)\nmsmpeg4_decode_init_vlc(s);", "else\nh263_decode_init_vlc(s);", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 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 ], [ 101, 103, 105 ], [ 113 ], [ 115 ], [ 119, 121 ], [ 123, 125 ], [ 129 ], [ 131 ] ]
832
static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) { IEC958Context *ctx = s->priv_data; int ret, padding; ctx->out_bytes = pkt->size; ctx->length_code = FFALIGN(pkt->size, 2) << 3; ret = ctx->header_info(s, pkt); if (ret < 0) return -1; if (!ctx->pkt_offset) return 0; padding = (ctx->pkt_offset - BURST_HEADER_SIZE - ctx->out_bytes) >> 1; if (padding < 0) { av_log(s, AV_LOG_ERROR, "bitrate is too high\n"); return -1; } put_le16(s->pb, SYNCWORD1); //Pa put_le16(s->pb, SYNCWORD2); //Pb put_le16(s->pb, ctx->data_type); //Pc put_le16(s->pb, ctx->length_code);//Pd #if HAVE_BIGENDIAN put_buffer(s->pb, ctx->out_buf, ctx->out_bytes & ~1); #else av_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + FF_INPUT_BUFFER_PADDING_SIZE); if (!ctx->buffer) return AVERROR(ENOMEM); ff_spdif_bswap_buf16((uint16_t *)ctx->buffer, (uint16_t *)ctx->out_buf, ctx->out_bytes >> 1); put_buffer(s->pb, ctx->buffer, ctx->out_bytes & ~1); #endif if (ctx->out_bytes & 1) put_be16(s->pb, ctx->out_buf[ctx->out_bytes - 1]); for (; padding > 0; padding--) put_be16(s->pb, 0); av_log(s, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n", ctx->data_type, ctx->out_bytes, ctx->pkt_offset); put_flush_packet(s->pb); return 0; }
true
FFmpeg
4b6bfbe2b70ea87831fa9a42a2ac112ee8a386d2
static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt) { IEC958Context *ctx = s->priv_data; int ret, padding; ctx->out_bytes = pkt->size; ctx->length_code = FFALIGN(pkt->size, 2) << 3; ret = ctx->header_info(s, pkt); if (ret < 0) return -1; if (!ctx->pkt_offset) return 0; padding = (ctx->pkt_offset - BURST_HEADER_SIZE - ctx->out_bytes) >> 1; if (padding < 0) { av_log(s, AV_LOG_ERROR, "bitrate is too high\n"); return -1; } put_le16(s->pb, SYNCWORD1); put_le16(s->pb, SYNCWORD2); put_le16(s->pb, ctx->data_type); put_le16(s->pb, ctx->length_code); #if HAVE_BIGENDIAN put_buffer(s->pb, ctx->out_buf, ctx->out_bytes & ~1); #else av_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + FF_INPUT_BUFFER_PADDING_SIZE); if (!ctx->buffer) return AVERROR(ENOMEM); ff_spdif_bswap_buf16((uint16_t *)ctx->buffer, (uint16_t *)ctx->out_buf, ctx->out_bytes >> 1); put_buffer(s->pb, ctx->buffer, ctx->out_bytes & ~1); #endif if (ctx->out_bytes & 1) put_be16(s->pb, ctx->out_buf[ctx->out_bytes - 1]); for (; padding > 0; padding--) put_be16(s->pb, 0); av_log(s, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n", ctx->data_type, ctx->out_bytes, ctx->pkt_offset); put_flush_packet(s->pb); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct AVFormatContext *VAR_0, AVPacket *VAR_1) { IEC958Context *ctx = VAR_0->priv_data; int VAR_2, VAR_3; ctx->out_bytes = VAR_1->size; ctx->length_code = FFALIGN(VAR_1->size, 2) << 3; VAR_2 = ctx->header_info(VAR_0, VAR_1); if (VAR_2 < 0) return -1; if (!ctx->pkt_offset) return 0; VAR_3 = (ctx->pkt_offset - BURST_HEADER_SIZE - ctx->out_bytes) >> 1; if (VAR_3 < 0) { av_log(VAR_0, AV_LOG_ERROR, "bitrate is too high\n"); return -1; } put_le16(VAR_0->pb, SYNCWORD1); put_le16(VAR_0->pb, SYNCWORD2); put_le16(VAR_0->pb, ctx->data_type); put_le16(VAR_0->pb, ctx->length_code); #if HAVE_BIGENDIAN put_buffer(VAR_0->pb, ctx->out_buf, ctx->out_bytes & ~1); #else av_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + FF_INPUT_BUFFER_PADDING_SIZE); if (!ctx->buffer) return AVERROR(ENOMEM); ff_spdif_bswap_buf16((uint16_t *)ctx->buffer, (uint16_t *)ctx->out_buf, ctx->out_bytes >> 1); put_buffer(VAR_0->pb, ctx->buffer, ctx->out_bytes & ~1); #endif if (ctx->out_bytes & 1) put_be16(VAR_0->pb, ctx->out_buf[ctx->out_bytes - 1]); for (; VAR_3 > 0; VAR_3--) put_be16(VAR_0->pb, 0); av_log(VAR_0, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n", ctx->data_type, ctx->out_bytes, ctx->pkt_offset); put_flush_packet(VAR_0->pb); return 0; }
[ "static int FUNC_0(struct AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "IEC958Context *ctx = VAR_0->priv_data;", "int VAR_2, VAR_3;", "ctx->out_bytes = VAR_1->size;", "ctx->length_code = FFALIGN(VAR_1->size, 2) << 3;", "VAR_2 = ctx->header_info(VAR_0, VAR_1);", "if (VAR_2 < 0)\nreturn -1;", "if (!ctx->pkt_offset)\nreturn 0;", "VAR_3 = (ctx->pkt_offset - BURST_HEADER_SIZE - ctx->out_bytes) >> 1;", "if (VAR_3 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"bitrate is too high\\n\");", "return -1;", "}", "put_le16(VAR_0->pb, SYNCWORD1);", "put_le16(VAR_0->pb, SYNCWORD2);", "put_le16(VAR_0->pb, ctx->data_type);", "put_le16(VAR_0->pb, ctx->length_code);", "#if HAVE_BIGENDIAN\nput_buffer(VAR_0->pb, ctx->out_buf, ctx->out_bytes & ~1);", "#else\nav_fast_malloc(&ctx->buffer, &ctx->buffer_size, ctx->out_bytes + FF_INPUT_BUFFER_PADDING_SIZE);", "if (!ctx->buffer)\nreturn AVERROR(ENOMEM);", "ff_spdif_bswap_buf16((uint16_t *)ctx->buffer, (uint16_t *)ctx->out_buf, ctx->out_bytes >> 1);", "put_buffer(VAR_0->pb, ctx->buffer, ctx->out_bytes & ~1);", "#endif\nif (ctx->out_bytes & 1)\nput_be16(VAR_0->pb, ctx->out_buf[ctx->out_bytes - 1]);", "for (; VAR_3 > 0; VAR_3--)", "put_be16(VAR_0->pb, 0);", "av_log(VAR_0, AV_LOG_DEBUG, \"type=%x len=%i pkt_offset=%i\\n\",\nctx->data_type, ctx->out_bytes, ctx->pkt_offset);", "put_flush_packet(VAR_0->pb);", "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 ], [ 12 ], [ 14 ], [ 18 ], [ 20, 22 ], [ 24, 26 ], [ 30 ], [ 32 ], [ 34 ], [ 36 ], [ 38 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 52, 54 ], [ 56, 58 ], [ 60, 62 ], [ 64 ], [ 66 ], [ 68, 72, 74 ], [ 78 ], [ 80 ], [ 84, 86 ], [ 90 ], [ 92 ], [ 94 ] ]
833
static void blkverify_refresh_filename(BlockDriverState *bs, QDict *options) { BDRVBlkverifyState *s = bs->opaque; /* bs->file->bs has already been refreshed */ bdrv_refresh_filename(s->test_file->bs); if (bs->file->bs->full_open_options && s->test_file->bs->full_open_options) { QDict *opts = qdict_new(); qdict_put_str(opts, "driver", "blkverify"); QINCREF(bs->file->bs->full_open_options); qdict_put(opts, "raw", bs->file->bs->full_open_options); QINCREF(s->test_file->bs->full_open_options); qdict_put(opts, "test", s->test_file->bs->full_open_options); bs->full_open_options = opts; } if (bs->file->bs->exact_filename[0] && s->test_file->bs->exact_filename[0]) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "blkverify:%s:%s", bs->file->bs->exact_filename, s->test_file->bs->exact_filename); } }
true
qemu
05cc758a3dfc79488d0a8eb7f5830a41871e78d0
static void blkverify_refresh_filename(BlockDriverState *bs, QDict *options) { BDRVBlkverifyState *s = bs->opaque; bdrv_refresh_filename(s->test_file->bs); if (bs->file->bs->full_open_options && s->test_file->bs->full_open_options) { QDict *opts = qdict_new(); qdict_put_str(opts, "driver", "blkverify"); QINCREF(bs->file->bs->full_open_options); qdict_put(opts, "raw", bs->file->bs->full_open_options); QINCREF(s->test_file->bs->full_open_options); qdict_put(opts, "test", s->test_file->bs->full_open_options); bs->full_open_options = opts; } if (bs->file->bs->exact_filename[0] && s->test_file->bs->exact_filename[0]) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "blkverify:%s:%s", bs->file->bs->exact_filename, s->test_file->bs->exact_filename); } }
{ "code": [ " snprintf(bs->exact_filename, sizeof(bs->exact_filename),", " \"blkverify:%s:%s\",", " bs->file->bs->exact_filename,", " s->test_file->bs->exact_filename);" ], "line_no": [ 49, 51, 53, 55 ] }
static void FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1) { BDRVBlkverifyState *s = VAR_0->opaque; bdrv_refresh_filename(s->test_file->VAR_0); if (VAR_0->file->VAR_0->full_open_options && s->test_file->VAR_0->full_open_options) { QDict *opts = qdict_new(); qdict_put_str(opts, "driver", "blkverify"); QINCREF(VAR_0->file->VAR_0->full_open_options); qdict_put(opts, "raw", VAR_0->file->VAR_0->full_open_options); QINCREF(s->test_file->VAR_0->full_open_options); qdict_put(opts, "test", s->test_file->VAR_0->full_open_options); VAR_0->full_open_options = opts; } if (VAR_0->file->VAR_0->exact_filename[0] && s->test_file->VAR_0->exact_filename[0]) { snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename), "blkverify:%s:%s", VAR_0->file->VAR_0->exact_filename, s->test_file->VAR_0->exact_filename); } }
[ "static void FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1)\n{", "BDRVBlkverifyState *s = VAR_0->opaque;", "bdrv_refresh_filename(s->test_file->VAR_0);", "if (VAR_0->file->VAR_0->full_open_options\n&& s->test_file->VAR_0->full_open_options)\n{", "QDict *opts = qdict_new();", "qdict_put_str(opts, \"driver\", \"blkverify\");", "QINCREF(VAR_0->file->VAR_0->full_open_options);", "qdict_put(opts, \"raw\", VAR_0->file->VAR_0->full_open_options);", "QINCREF(s->test_file->VAR_0->full_open_options);", "qdict_put(opts, \"test\", s->test_file->VAR_0->full_open_options);", "VAR_0->full_open_options = opts;", "}", "if (VAR_0->file->VAR_0->exact_filename[0]\n&& s->test_file->VAR_0->exact_filename[0])\n{", "snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),\n\"blkverify:%s:%s\",\nVAR_0->file->VAR_0->exact_filename,\ns->test_file->VAR_0->exact_filename);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 15, 17, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43, 45, 47 ], [ 49, 51, 53, 55 ], [ 57 ], [ 59 ] ]
834
static int ffmmal_read_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame) { MMALDecodeContext *ctx = avctx->priv_data; MMAL_BUFFER_HEADER_T *buffer = NULL; MMAL_STATUS_T status = 0; int ret = 0; if (ctx->eos_received) goto done; while (1) { // To ensure decoding in lockstep with a constant delay between fed packets // and output frames, we always wait until an output buffer is available. // Except during start we don't know after how many input packets the decoder // is going to return the first buffer, and we can't distinguish decoder // being busy from decoder waiting for input. So just poll at the start and // keep feeding new data to the buffer. // We are pretty sure the decoder will produce output if we sent more input // frames than what a h264 decoder could logically delay. This avoids too // excessive buffering. // We also wait if we sent eos, but didn't receive it yet (think of decoding // stream with a very low number of frames). if (ctx->frames_output || ctx->packets_sent > MAX_DELAYED_FRAMES || ctx->eos_sent) { buffer = mmal_queue_wait(ctx->queue_decoded_frames); } else { buffer = mmal_queue_get(ctx->queue_decoded_frames); } if (!buffer) goto done; ctx->eos_received |= !!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_EOS); if (ctx->eos_received) goto done; if (buffer->cmd == MMAL_EVENT_FORMAT_CHANGED) { MMAL_COMPONENT_T *decoder = ctx->decoder; MMAL_EVENT_FORMAT_CHANGED_T *ev = mmal_event_format_changed_get(buffer); MMAL_BUFFER_HEADER_T *stale_buffer; av_log(avctx, AV_LOG_INFO, "Changing output format.\n"); if ((status = mmal_port_disable(decoder->output[0]))) goto done; while ((stale_buffer = mmal_queue_get(ctx->queue_decoded_frames))) mmal_buffer_header_release(stale_buffer); mmal_format_copy(decoder->output[0]->format, ev->format); if ((ret = ffmal_update_format(avctx)) < 0) goto done; if ((status = mmal_port_enable(decoder->output[0], output_callback))) goto done; if ((ret = ffmmal_fill_output_port(avctx)) < 0) goto done; if ((ret = ffmmal_fill_input_port(avctx)) < 0) goto done; mmal_buffer_header_release(buffer); continue; } else if (buffer->cmd) { char s[20]; av_get_codec_tag_string(s, sizeof(s), buffer->cmd); av_log(avctx, AV_LOG_WARNING, "Unknown MMAL event %s on output port\n", s); goto done; } else if (buffer->length == 0) { // Unused output buffer that got drained after format change. mmal_buffer_header_release(buffer); continue; } ctx->frames_output++; if ((ret = ffmal_copy_frame(avctx, frame, buffer)) < 0) goto done; *got_frame = 1; break; } done: if (buffer) mmal_buffer_header_release(buffer); if (status && ret >= 0) ret = AVERROR_UNKNOWN; return ret; }
false
FFmpeg
b84675d63aaede8f6944b901250a10456c5477e6
static int ffmmal_read_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame) { MMALDecodeContext *ctx = avctx->priv_data; MMAL_BUFFER_HEADER_T *buffer = NULL; MMAL_STATUS_T status = 0; int ret = 0; if (ctx->eos_received) goto done; while (1) { if (ctx->frames_output || ctx->packets_sent > MAX_DELAYED_FRAMES || ctx->eos_sent) { buffer = mmal_queue_wait(ctx->queue_decoded_frames); } else { buffer = mmal_queue_get(ctx->queue_decoded_frames); } if (!buffer) goto done; ctx->eos_received |= !!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_EOS); if (ctx->eos_received) goto done; if (buffer->cmd == MMAL_EVENT_FORMAT_CHANGED) { MMAL_COMPONENT_T *decoder = ctx->decoder; MMAL_EVENT_FORMAT_CHANGED_T *ev = mmal_event_format_changed_get(buffer); MMAL_BUFFER_HEADER_T *stale_buffer; av_log(avctx, AV_LOG_INFO, "Changing output format.\n"); if ((status = mmal_port_disable(decoder->output[0]))) goto done; while ((stale_buffer = mmal_queue_get(ctx->queue_decoded_frames))) mmal_buffer_header_release(stale_buffer); mmal_format_copy(decoder->output[0]->format, ev->format); if ((ret = ffmal_update_format(avctx)) < 0) goto done; if ((status = mmal_port_enable(decoder->output[0], output_callback))) goto done; if ((ret = ffmmal_fill_output_port(avctx)) < 0) goto done; if ((ret = ffmmal_fill_input_port(avctx)) < 0) goto done; mmal_buffer_header_release(buffer); continue; } else if (buffer->cmd) { char s[20]; av_get_codec_tag_string(s, sizeof(s), buffer->cmd); av_log(avctx, AV_LOG_WARNING, "Unknown MMAL event %s on output port\n", s); goto done; } else if (buffer->length == 0) { mmal_buffer_header_release(buffer); continue; } ctx->frames_output++; if ((ret = ffmal_copy_frame(avctx, frame, buffer)) < 0) goto done; *got_frame = 1; break; } done: if (buffer) mmal_buffer_header_release(buffer); if (status && ret >= 0) ret = AVERROR_UNKNOWN; return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, int *VAR_2) { MMALDecodeContext *ctx = VAR_0->priv_data; MMAL_BUFFER_HEADER_T *buffer = NULL; MMAL_STATUS_T status = 0; int VAR_3 = 0; if (ctx->eos_received) goto done; while (1) { if (ctx->frames_output || ctx->packets_sent > MAX_DELAYED_FRAMES || ctx->eos_sent) { buffer = mmal_queue_wait(ctx->queue_decoded_frames); } else { buffer = mmal_queue_get(ctx->queue_decoded_frames); } if (!buffer) goto done; ctx->eos_received |= !!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_EOS); if (ctx->eos_received) goto done; if (buffer->cmd == MMAL_EVENT_FORMAT_CHANGED) { MMAL_COMPONENT_T *decoder = ctx->decoder; MMAL_EVENT_FORMAT_CHANGED_T *ev = mmal_event_format_changed_get(buffer); MMAL_BUFFER_HEADER_T *stale_buffer; av_log(VAR_0, AV_LOG_INFO, "Changing output format.\n"); if ((status = mmal_port_disable(decoder->output[0]))) goto done; while ((stale_buffer = mmal_queue_get(ctx->queue_decoded_frames))) mmal_buffer_header_release(stale_buffer); mmal_format_copy(decoder->output[0]->format, ev->format); if ((VAR_3 = ffmal_update_format(VAR_0)) < 0) goto done; if ((status = mmal_port_enable(decoder->output[0], output_callback))) goto done; if ((VAR_3 = ffmmal_fill_output_port(VAR_0)) < 0) goto done; if ((VAR_3 = ffmmal_fill_input_port(VAR_0)) < 0) goto done; mmal_buffer_header_release(buffer); continue; } else if (buffer->cmd) { char VAR_4[20]; av_get_codec_tag_string(VAR_4, sizeof(VAR_4), buffer->cmd); av_log(VAR_0, AV_LOG_WARNING, "Unknown MMAL event %VAR_4 on output port\n", VAR_4); goto done; } else if (buffer->length == 0) { mmal_buffer_header_release(buffer); continue; } ctx->frames_output++; if ((VAR_3 = ffmal_copy_frame(VAR_0, VAR_1, buffer)) < 0) goto done; *VAR_2 = 1; break; } done: if (buffer) mmal_buffer_header_release(buffer); if (status && VAR_3 >= 0) VAR_3 = AVERROR_UNKNOWN; return VAR_3; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, int *VAR_2)\n{", "MMALDecodeContext *ctx = VAR_0->priv_data;", "MMAL_BUFFER_HEADER_T *buffer = NULL;", "MMAL_STATUS_T status = 0;", "int VAR_3 = 0;", "if (ctx->eos_received)\ngoto done;", "while (1) {", "if (ctx->frames_output || ctx->packets_sent > MAX_DELAYED_FRAMES || ctx->eos_sent) {", "buffer = mmal_queue_wait(ctx->queue_decoded_frames);", "} else {", "buffer = mmal_queue_get(ctx->queue_decoded_frames);", "}", "if (!buffer)\ngoto done;", "ctx->eos_received |= !!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_EOS);", "if (ctx->eos_received)\ngoto done;", "if (buffer->cmd == MMAL_EVENT_FORMAT_CHANGED) {", "MMAL_COMPONENT_T *decoder = ctx->decoder;", "MMAL_EVENT_FORMAT_CHANGED_T *ev = mmal_event_format_changed_get(buffer);", "MMAL_BUFFER_HEADER_T *stale_buffer;", "av_log(VAR_0, AV_LOG_INFO, \"Changing output format.\\n\");", "if ((status = mmal_port_disable(decoder->output[0])))\ngoto done;", "while ((stale_buffer = mmal_queue_get(ctx->queue_decoded_frames)))\nmmal_buffer_header_release(stale_buffer);", "mmal_format_copy(decoder->output[0]->format, ev->format);", "if ((VAR_3 = ffmal_update_format(VAR_0)) < 0)\ngoto done;", "if ((status = mmal_port_enable(decoder->output[0], output_callback)))\ngoto done;", "if ((VAR_3 = ffmmal_fill_output_port(VAR_0)) < 0)\ngoto done;", "if ((VAR_3 = ffmmal_fill_input_port(VAR_0)) < 0)\ngoto done;", "mmal_buffer_header_release(buffer);", "continue;", "} else if (buffer->cmd) {", "char VAR_4[20];", "av_get_codec_tag_string(VAR_4, sizeof(VAR_4), buffer->cmd);", "av_log(VAR_0, AV_LOG_WARNING, \"Unknown MMAL event %VAR_4 on output port\\n\", VAR_4);", "goto done;", "} else if (buffer->length == 0) {", "mmal_buffer_header_release(buffer);", "continue;", "}", "ctx->frames_output++;", "if ((VAR_3 = ffmal_copy_frame(VAR_0, VAR_1, buffer)) < 0)\ngoto done;", "*VAR_2 = 1;", "break;", "}", "done:\nif (buffer)\nmmal_buffer_header_release(buffer);", "if (status && VAR_3 >= 0)\nVAR_3 = AVERROR_UNKNOWN;", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 61 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83, 85 ], [ 89, 91 ], [ 95 ], [ 99, 101 ], [ 105, 107 ], [ 111, 113 ], [ 117, 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 153, 155 ], [ 159 ], [ 161 ], [ 163 ], [ 167, 169, 171 ], [ 173, 175 ], [ 177 ], [ 179 ] ]
835
void ff_sbrdsp_init_x86(SBRDSPContext *s) { if (HAVE_YASM) { int mm_flags = av_get_cpu_flags(); if (mm_flags & AV_CPU_FLAG_SSE) { s->sum_square = ff_sbr_sum_square_sse; s->hf_g_filt = ff_sbr_hf_g_filt_sse; } } }
false
FFmpeg
e0c6cce44729d94e2a5507a4b6d031f23e8bd7b6
void ff_sbrdsp_init_x86(SBRDSPContext *s) { if (HAVE_YASM) { int mm_flags = av_get_cpu_flags(); if (mm_flags & AV_CPU_FLAG_SSE) { s->sum_square = ff_sbr_sum_square_sse; s->hf_g_filt = ff_sbr_hf_g_filt_sse; } } }
{ "code": [], "line_no": [] }
void FUNC_0(SBRDSPContext *VAR_0) { if (HAVE_YASM) { int VAR_1 = av_get_cpu_flags(); if (VAR_1 & AV_CPU_FLAG_SSE) { VAR_0->sum_square = ff_sbr_sum_square_sse; VAR_0->hf_g_filt = ff_sbr_hf_g_filt_sse; } } }
[ "void FUNC_0(SBRDSPContext *VAR_0)\n{", "if (HAVE_YASM) {", "int VAR_1 = av_get_cpu_flags();", "if (VAR_1 & AV_CPU_FLAG_SSE) {", "VAR_0->sum_square = ff_sbr_sum_square_sse;", "VAR_0->hf_g_filt = ff_sbr_hf_g_filt_sse;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
836
static int usb_host_handle_control(USBHostDevice *s, USBPacket *p) { struct usbdevfs_urb *urb; AsyncURB *aurb; int ret, value, index; /* * Process certain standard device requests. * These are infrequent and are processed synchronously. */ value = le16_to_cpu(s->ctrl.req.wValue); index = le16_to_cpu(s->ctrl.req.wIndex); dprintf("husb: ctrl type 0x%x req 0x%x val 0x%x index %u len %u\n", s->ctrl.req.bRequestType, s->ctrl.req.bRequest, value, index, s->ctrl.len); if (s->ctrl.req.bRequestType == 0) { switch (s->ctrl.req.bRequest) { case USB_REQ_SET_ADDRESS: return usb_host_set_address(s, value); case USB_REQ_SET_CONFIGURATION: return usb_host_set_config(s, value & 0xff); } } if (s->ctrl.req.bRequestType == 1 && s->ctrl.req.bRequest == USB_REQ_SET_INTERFACE) return usb_host_set_interface(s, index, value); /* The rest are asynchronous */ aurb = async_alloc(); aurb->hdev = s; aurb->packet = p; /* * Setup ctrl transfer. * * s->ctrl is layed out such that data buffer immediately follows * 'req' struct which is exactly what usbdevfs expects. */ urb = &aurb->urb; urb->type = USBDEVFS_URB_TYPE_CONTROL; urb->endpoint = p->devep; urb->buffer = &s->ctrl.req; urb->buffer_length = 8 + s->ctrl.len; urb->usercontext = s; ret = ioctl(s->fd, USBDEVFS_SUBMITURB, urb); dprintf("husb: submit ctrl. len %u aurb %p\n", urb->buffer_length, aurb); if (ret < 0) { dprintf("husb: submit failed. errno %d\n", errno); async_free(aurb); switch(errno) { case ETIMEDOUT: return USB_RET_NAK; case EPIPE: default: return USB_RET_STALL; } } usb_defer_packet(p, async_cancel, aurb); return USB_RET_ASYNC; }
true
qemu
c4c0e236beabb9de5ff472f77aeb811ec5484615
static int usb_host_handle_control(USBHostDevice *s, USBPacket *p) { struct usbdevfs_urb *urb; AsyncURB *aurb; int ret, value, index; value = le16_to_cpu(s->ctrl.req.wValue); index = le16_to_cpu(s->ctrl.req.wIndex); dprintf("husb: ctrl type 0x%x req 0x%x val 0x%x index %u len %u\n", s->ctrl.req.bRequestType, s->ctrl.req.bRequest, value, index, s->ctrl.len); if (s->ctrl.req.bRequestType == 0) { switch (s->ctrl.req.bRequest) { case USB_REQ_SET_ADDRESS: return usb_host_set_address(s, value); case USB_REQ_SET_CONFIGURATION: return usb_host_set_config(s, value & 0xff); } } if (s->ctrl.req.bRequestType == 1 && s->ctrl.req.bRequest == USB_REQ_SET_INTERFACE) return usb_host_set_interface(s, index, value); aurb = async_alloc(); aurb->hdev = s; aurb->packet = p; urb = &aurb->urb; urb->type = USBDEVFS_URB_TYPE_CONTROL; urb->endpoint = p->devep; urb->buffer = &s->ctrl.req; urb->buffer_length = 8 + s->ctrl.len; urb->usercontext = s; ret = ioctl(s->fd, USBDEVFS_SUBMITURB, urb); dprintf("husb: submit ctrl. len %u aurb %p\n", urb->buffer_length, aurb); if (ret < 0) { dprintf("husb: submit failed. errno %d\n", errno); async_free(aurb); switch(errno) { case ETIMEDOUT: return USB_RET_NAK; case EPIPE: default: return USB_RET_STALL; } } usb_defer_packet(p, async_cancel, aurb); return USB_RET_ASYNC; }
{ "code": [ " urb->buffer_length = 8 + s->ctrl.len;" ], "line_no": [ 99 ] }
static int FUNC_0(USBHostDevice *VAR_0, USBPacket *VAR_1) { struct usbdevfs_urb *VAR_2; AsyncURB *aurb; int VAR_3, VAR_4, VAR_5; VAR_4 = le16_to_cpu(VAR_0->ctrl.req.wValue); VAR_5 = le16_to_cpu(VAR_0->ctrl.req.wIndex); dprintf("husb: ctrl type 0x%x req 0x%x val 0x%x VAR_5 %u len %u\n", VAR_0->ctrl.req.bRequestType, VAR_0->ctrl.req.bRequest, VAR_4, VAR_5, VAR_0->ctrl.len); if (VAR_0->ctrl.req.bRequestType == 0) { switch (VAR_0->ctrl.req.bRequest) { case USB_REQ_SET_ADDRESS: return usb_host_set_address(VAR_0, VAR_4); case USB_REQ_SET_CONFIGURATION: return usb_host_set_config(VAR_0, VAR_4 & 0xff); } } if (VAR_0->ctrl.req.bRequestType == 1 && VAR_0->ctrl.req.bRequest == USB_REQ_SET_INTERFACE) return usb_host_set_interface(VAR_0, VAR_5, VAR_4); aurb = async_alloc(); aurb->hdev = VAR_0; aurb->packet = VAR_1; VAR_2 = &aurb->VAR_2; VAR_2->type = USBDEVFS_URB_TYPE_CONTROL; VAR_2->endpoint = VAR_1->devep; VAR_2->buffer = &VAR_0->ctrl.req; VAR_2->buffer_length = 8 + VAR_0->ctrl.len; VAR_2->usercontext = VAR_0; VAR_3 = ioctl(VAR_0->fd, USBDEVFS_SUBMITURB, VAR_2); dprintf("husb: submit ctrl. len %u aurb %VAR_1\n", VAR_2->buffer_length, aurb); if (VAR_3 < 0) { dprintf("husb: submit failed. errno %d\n", errno); async_free(aurb); switch(errno) { case ETIMEDOUT: return USB_RET_NAK; case EPIPE: default: return USB_RET_STALL; } } usb_defer_packet(VAR_1, async_cancel, aurb); return USB_RET_ASYNC; }
[ "static int FUNC_0(USBHostDevice *VAR_0, USBPacket *VAR_1)\n{", "struct usbdevfs_urb *VAR_2;", "AsyncURB *aurb;", "int VAR_3, VAR_4, VAR_5;", "VAR_4 = le16_to_cpu(VAR_0->ctrl.req.wValue);", "VAR_5 = le16_to_cpu(VAR_0->ctrl.req.wIndex);", "dprintf(\"husb: ctrl type 0x%x req 0x%x val 0x%x VAR_5 %u len %u\\n\",\nVAR_0->ctrl.req.bRequestType, VAR_0->ctrl.req.bRequest, VAR_4, VAR_5,\nVAR_0->ctrl.len);", "if (VAR_0->ctrl.req.bRequestType == 0) {", "switch (VAR_0->ctrl.req.bRequest) {", "case USB_REQ_SET_ADDRESS:\nreturn usb_host_set_address(VAR_0, VAR_4);", "case USB_REQ_SET_CONFIGURATION:\nreturn usb_host_set_config(VAR_0, VAR_4 & 0xff);", "}", "}", "if (VAR_0->ctrl.req.bRequestType == 1 &&\nVAR_0->ctrl.req.bRequest == USB_REQ_SET_INTERFACE)\nreturn usb_host_set_interface(VAR_0, VAR_5, VAR_4);", "aurb = async_alloc();", "aurb->hdev = VAR_0;", "aurb->packet = VAR_1;", "VAR_2 = &aurb->VAR_2;", "VAR_2->type = USBDEVFS_URB_TYPE_CONTROL;", "VAR_2->endpoint = VAR_1->devep;", "VAR_2->buffer = &VAR_0->ctrl.req;", "VAR_2->buffer_length = 8 + VAR_0->ctrl.len;", "VAR_2->usercontext = VAR_0;", "VAR_3 = ioctl(VAR_0->fd, USBDEVFS_SUBMITURB, VAR_2);", "dprintf(\"husb: submit ctrl. len %u aurb %VAR_1\\n\", VAR_2->buffer_length, aurb);", "if (VAR_3 < 0) {", "dprintf(\"husb: submit failed. errno %d\\n\", errno);", "async_free(aurb);", "switch(errno) {", "case ETIMEDOUT:\nreturn USB_RET_NAK;", "case EPIPE:\ndefault:\nreturn USB_RET_STALL;", "}", "}", "usb_defer_packet(VAR_1, async_cancel, aurb);", "return USB_RET_ASYNC;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 21 ], [ 23 ], [ 27, 29, 31 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 55, 57, 59 ], [ 67 ], [ 69 ], [ 71 ], [ 87 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 103 ], [ 107 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125, 127 ], [ 129, 131, 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ] ]
839
static void pc_init1(MachineState *machine) { PCMachineState *pc_machine = PC_MACHINE(machine); MemoryRegion *system_memory = get_system_memory(); MemoryRegion *system_io = get_system_io(); int i; ram_addr_t below_4g_mem_size, above_4g_mem_size; PCIBus *pci_bus; ISABus *isa_bus; PCII440FXState *i440fx_state; int piix3_devfn = -1; qemu_irq *cpu_irq; qemu_irq *gsi; qemu_irq *i8259; qemu_irq *smi_irq; GSIState *gsi_state; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; BusState *idebus[MAX_IDE_BUS]; ISADevice *rtc_state; ISADevice *floppy; MemoryRegion *ram_memory; MemoryRegion *pci_memory; MemoryRegion *rom_memory; DeviceState *icc_bridge; FWCfgState *fw_cfg = NULL; PcGuestInfo *guest_info; ram_addr_t lowmem; /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory). * If it doesn't, we need to split it in chunks below and above 4G. * In any case, try to make sure that guest addresses aligned at * 1G boundaries get mapped to host addresses aligned at 1G boundaries. * For old machine types, use whatever split we used historically to avoid * breaking migration. */ if (machine->ram_size >= 0xe0000000) { lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000; } else { lowmem = 0xe0000000; } /* Handle the machine opt max-ram-below-4g. It is basically doing * min(qemu limit, user limit). */ if (lowmem > pc_machine->max_ram_below_4g) { lowmem = pc_machine->max_ram_below_4g; if (machine->ram_size - lowmem > lowmem && lowmem & ((1ULL << 30) - 1)) { error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64 ") not a multiple of 1G; possible bad performance.", pc_machine->max_ram_below_4g); } } if (machine->ram_size >= lowmem) { above_4g_mem_size = machine->ram_size - lowmem; below_4g_mem_size = lowmem; } else { above_4g_mem_size = 0; below_4g_mem_size = machine->ram_size; } if (xen_enabled() && xen_hvm_init(&below_4g_mem_size, &above_4g_mem_size, &ram_memory) != 0) { fprintf(stderr, "xen hardware virtual machine initialisation failed\n"); exit(1); } icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE); object_property_add_child(qdev_get_machine(), "icc-bridge", OBJECT(icc_bridge), NULL); pc_cpus_init(machine->cpu_model, icc_bridge); if (kvm_enabled() && kvmclock_enabled) { kvmclock_create(); } if (pci_enabled) { pci_memory = g_new(MemoryRegion, 1); memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory = pci_memory; } else { pci_memory = NULL; rom_memory = system_memory; } guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size); guest_info->has_acpi_build = has_acpi_build; guest_info->legacy_acpi_table_size = legacy_acpi_table_size; guest_info->isapc_ram_fw = !pci_enabled; guest_info->has_reserved_memory = has_reserved_memory; guest_info->rsdp_in_ram = rsdp_in_ram; if (smbios_defaults) { MachineClass *mc = MACHINE_GET_CLASS(machine); /* These values are guest ABI, do not change */ smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)", mc->name, smbios_legacy_mode, smbios_uuid_encoded); } /* allocate ram and load rom/bios */ if (!xen_enabled()) { fw_cfg = pc_memory_init(machine, system_memory, below_4g_mem_size, above_4g_mem_size, rom_memory, &ram_memory, guest_info); } else if (machine->kernel_filename != NULL) { /* For xen HVM direct kernel boot, load linux here */ fw_cfg = xen_load_linux(machine->kernel_filename, machine->kernel_cmdline, machine->initrd_filename, below_4g_mem_size, guest_info); } gsi_state = g_malloc0(sizeof(*gsi_state)); if (kvm_irqchip_in_kernel()) { kvm_pc_setup_irq_routing(pci_enabled); gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state, GSI_NUM_PINS); } else { gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); } if (pci_enabled) { pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi, system_memory, system_io, machine->ram_size, below_4g_mem_size, above_4g_mem_size, pci_memory, ram_memory); } else { pci_bus = NULL; i440fx_state = NULL; isa_bus = isa_bus_new(NULL, get_system_memory(), system_io); no_hpet = 1; } isa_bus_irqs(isa_bus, gsi); if (kvm_irqchip_in_kernel()) { i8259 = kvm_i8259_init(isa_bus); } else if (xen_enabled()) { i8259 = xen_interrupt_controller_init(); } else { cpu_irq = pc_allocate_cpu_irq(); i8259 = i8259_init(isa_bus, cpu_irq[0]); } for (i = 0; i < ISA_NUM_IRQS; i++) { gsi_state->i8259_irq[i] = i8259[i]; } if (pci_enabled) { ioapic_init_gsi(gsi_state, "i440fx"); } qdev_init_nofail(icc_bridge); pc_register_ferr_irq(gsi[13]); pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL); assert(pc_machine->vmport != ON_OFF_AUTO_MAX); if (pc_machine->vmport == ON_OFF_AUTO_AUTO) { pc_machine->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; } /* init basic PC hardware */ pc_basic_device_init(isa_bus, gsi, &rtc_state, true, &floppy, (pc_machine->vmport != ON_OFF_AUTO_ON), 0x4); pc_nic_init(isa_bus, pci_bus); ide_drive_get(hd, ARRAY_SIZE(hd)); if (pci_enabled) { PCIDevice *dev; if (xen_enabled()) { dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1); } else { dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1); } idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0"); idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1"); } else { for(i = 0; i < MAX_IDE_BUS; i++) { ISADevice *dev; char busname[] = "ide.0"; dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); /* * The ide bus name is ide.0 for the first bus and ide.1 for the * second one. */ busname[4] = '0' + i; idebus[i] = qdev_get_child_bus(DEVICE(dev), busname); } } pc_cmos_init(below_4g_mem_size, above_4g_mem_size, machine->boot_order, machine, floppy, idebus[0], idebus[1], rtc_state); if (pci_enabled && usb_enabled()) { pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci"); } if (pci_enabled && acpi_enabled) { DeviceState *piix4_pm; I2CBus *smbus; smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1); /* TODO: Populate SPD eeprom data. */ smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, gsi[9], *smi_irq, kvm_enabled(), fw_cfg, &piix4_pm); smbus_eeprom_init(smbus, 8, NULL, 0); object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, (Object **)&pc_machine->acpi_dev, object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); object_property_set_link(OBJECT(machine), OBJECT(piix4_pm), PC_MACHINE_ACPI_DEVICE_PROP, &error_abort); } if (pci_enabled) { pc_pci_device_init(pci_bus); } }
true
qemu
2ba154cf4eb8636cdd3aa90f392ca9e77206ca39
static void pc_init1(MachineState *machine) { PCMachineState *pc_machine = PC_MACHINE(machine); MemoryRegion *system_memory = get_system_memory(); MemoryRegion *system_io = get_system_io(); int i; ram_addr_t below_4g_mem_size, above_4g_mem_size; PCIBus *pci_bus; ISABus *isa_bus; PCII440FXState *i440fx_state; int piix3_devfn = -1; qemu_irq *cpu_irq; qemu_irq *gsi; qemu_irq *i8259; qemu_irq *smi_irq; GSIState *gsi_state; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; BusState *idebus[MAX_IDE_BUS]; ISADevice *rtc_state; ISADevice *floppy; MemoryRegion *ram_memory; MemoryRegion *pci_memory; MemoryRegion *rom_memory; DeviceState *icc_bridge; FWCfgState *fw_cfg = NULL; PcGuestInfo *guest_info; ram_addr_t lowmem; if (machine->ram_size >= 0xe0000000) { lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000; } else { lowmem = 0xe0000000; } if (lowmem > pc_machine->max_ram_below_4g) { lowmem = pc_machine->max_ram_below_4g; if (machine->ram_size - lowmem > lowmem && lowmem & ((1ULL << 30) - 1)) { error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64 ") not a multiple of 1G; possible bad performance.", pc_machine->max_ram_below_4g); } } if (machine->ram_size >= lowmem) { above_4g_mem_size = machine->ram_size - lowmem; below_4g_mem_size = lowmem; } else { above_4g_mem_size = 0; below_4g_mem_size = machine->ram_size; } if (xen_enabled() && xen_hvm_init(&below_4g_mem_size, &above_4g_mem_size, &ram_memory) != 0) { fprintf(stderr, "xen hardware virtual machine initialisation failed\n"); exit(1); } icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE); object_property_add_child(qdev_get_machine(), "icc-bridge", OBJECT(icc_bridge), NULL); pc_cpus_init(machine->cpu_model, icc_bridge); if (kvm_enabled() && kvmclock_enabled) { kvmclock_create(); } if (pci_enabled) { pci_memory = g_new(MemoryRegion, 1); memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory = pci_memory; } else { pci_memory = NULL; rom_memory = system_memory; } guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size); guest_info->has_acpi_build = has_acpi_build; guest_info->legacy_acpi_table_size = legacy_acpi_table_size; guest_info->isapc_ram_fw = !pci_enabled; guest_info->has_reserved_memory = has_reserved_memory; guest_info->rsdp_in_ram = rsdp_in_ram; if (smbios_defaults) { MachineClass *mc = MACHINE_GET_CLASS(machine); smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)", mc->name, smbios_legacy_mode, smbios_uuid_encoded); } if (!xen_enabled()) { fw_cfg = pc_memory_init(machine, system_memory, below_4g_mem_size, above_4g_mem_size, rom_memory, &ram_memory, guest_info); } else if (machine->kernel_filename != NULL) { fw_cfg = xen_load_linux(machine->kernel_filename, machine->kernel_cmdline, machine->initrd_filename, below_4g_mem_size, guest_info); } gsi_state = g_malloc0(sizeof(*gsi_state)); if (kvm_irqchip_in_kernel()) { kvm_pc_setup_irq_routing(pci_enabled); gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state, GSI_NUM_PINS); } else { gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); } if (pci_enabled) { pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi, system_memory, system_io, machine->ram_size, below_4g_mem_size, above_4g_mem_size, pci_memory, ram_memory); } else { pci_bus = NULL; i440fx_state = NULL; isa_bus = isa_bus_new(NULL, get_system_memory(), system_io); no_hpet = 1; } isa_bus_irqs(isa_bus, gsi); if (kvm_irqchip_in_kernel()) { i8259 = kvm_i8259_init(isa_bus); } else if (xen_enabled()) { i8259 = xen_interrupt_controller_init(); } else { cpu_irq = pc_allocate_cpu_irq(); i8259 = i8259_init(isa_bus, cpu_irq[0]); } for (i = 0; i < ISA_NUM_IRQS; i++) { gsi_state->i8259_irq[i] = i8259[i]; } if (pci_enabled) { ioapic_init_gsi(gsi_state, "i440fx"); } qdev_init_nofail(icc_bridge); pc_register_ferr_irq(gsi[13]); pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL); assert(pc_machine->vmport != ON_OFF_AUTO_MAX); if (pc_machine->vmport == ON_OFF_AUTO_AUTO) { pc_machine->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; } pc_basic_device_init(isa_bus, gsi, &rtc_state, true, &floppy, (pc_machine->vmport != ON_OFF_AUTO_ON), 0x4); pc_nic_init(isa_bus, pci_bus); ide_drive_get(hd, ARRAY_SIZE(hd)); if (pci_enabled) { PCIDevice *dev; if (xen_enabled()) { dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1); } else { dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1); } idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0"); idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1"); } else { for(i = 0; i < MAX_IDE_BUS; i++) { ISADevice *dev; char busname[] = "ide.0"; dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); busname[4] = '0' + i; idebus[i] = qdev_get_child_bus(DEVICE(dev), busname); } } pc_cmos_init(below_4g_mem_size, above_4g_mem_size, machine->boot_order, machine, floppy, idebus[0], idebus[1], rtc_state); if (pci_enabled && usb_enabled()) { pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci"); } if (pci_enabled && acpi_enabled) { DeviceState *piix4_pm; I2CBus *smbus; smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1); smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, gsi[9], *smi_irq, kvm_enabled(), fw_cfg, &piix4_pm); smbus_eeprom_init(smbus, 8, NULL, 0); object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, (Object **)&pc_machine->acpi_dev, object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); object_property_set_link(OBJECT(machine), OBJECT(piix4_pm), PC_MACHINE_ACPI_DEVICE_PROP, &error_abort); } if (pci_enabled) { pc_pci_device_init(pci_bus); } }
{ "code": [ " qemu_irq *smi_irq;", " smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);", " gsi[9], *smi_irq," ], "line_no": [ 29, 419, 425 ] }
static void FUNC_0(MachineState *VAR_0) { PCMachineState *pc_machine = PC_MACHINE(VAR_0); MemoryRegion *system_memory = get_system_memory(); MemoryRegion *system_io = get_system_io(); int VAR_1; ram_addr_t below_4g_mem_size, above_4g_mem_size; PCIBus *pci_bus; ISABus *isa_bus; PCII440FXState *i440fx_state; int VAR_2 = -1; qemu_irq *cpu_irq; qemu_irq *gsi; qemu_irq *i8259; qemu_irq *smi_irq; GSIState *gsi_state; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; BusState *idebus[MAX_IDE_BUS]; ISADevice *rtc_state; ISADevice *floppy; MemoryRegion *ram_memory; MemoryRegion *pci_memory; MemoryRegion *rom_memory; DeviceState *icc_bridge; FWCfgState *fw_cfg = NULL; PcGuestInfo *guest_info; ram_addr_t lowmem; if (VAR_0->ram_size >= 0xe0000000) { lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000; } else { lowmem = 0xe0000000; } if (lowmem > pc_machine->max_ram_below_4g) { lowmem = pc_machine->max_ram_below_4g; if (VAR_0->ram_size - lowmem > lowmem && lowmem & ((1ULL << 30) - 1)) { error_report("Warning: Large VAR_0 and max_ram_below_4g(%"PRIu64 ") not a multiple of 1G; possible bad performance.", pc_machine->max_ram_below_4g); } } if (VAR_0->ram_size >= lowmem) { above_4g_mem_size = VAR_0->ram_size - lowmem; below_4g_mem_size = lowmem; } else { above_4g_mem_size = 0; below_4g_mem_size = VAR_0->ram_size; } if (xen_enabled() && xen_hvm_init(&below_4g_mem_size, &above_4g_mem_size, &ram_memory) != 0) { fprintf(stderr, "xen hardware virtual VAR_0 initialisation failed\n"); exit(1); } icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE); object_property_add_child(qdev_get_machine(), "icc-bridge", OBJECT(icc_bridge), NULL); pc_cpus_init(VAR_0->cpu_model, icc_bridge); if (kvm_enabled() && kvmclock_enabled) { kvmclock_create(); } if (pci_enabled) { pci_memory = g_new(MemoryRegion, 1); memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); rom_memory = pci_memory; } else { pci_memory = NULL; rom_memory = system_memory; } guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size); guest_info->has_acpi_build = has_acpi_build; guest_info->legacy_acpi_table_size = legacy_acpi_table_size; guest_info->isapc_ram_fw = !pci_enabled; guest_info->has_reserved_memory = has_reserved_memory; guest_info->rsdp_in_ram = rsdp_in_ram; if (smbios_defaults) { MachineClass *mc = MACHINE_GET_CLASS(VAR_0); smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)", mc->name, smbios_legacy_mode, smbios_uuid_encoded); } if (!xen_enabled()) { fw_cfg = pc_memory_init(VAR_0, system_memory, below_4g_mem_size, above_4g_mem_size, rom_memory, &ram_memory, guest_info); } else if (VAR_0->kernel_filename != NULL) { fw_cfg = xen_load_linux(VAR_0->kernel_filename, VAR_0->kernel_cmdline, VAR_0->initrd_filename, below_4g_mem_size, guest_info); } gsi_state = g_malloc0(sizeof(*gsi_state)); if (kvm_irqchip_in_kernel()) { kvm_pc_setup_irq_routing(pci_enabled); gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state, GSI_NUM_PINS); } else { gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); } if (pci_enabled) { pci_bus = i440fx_init(&i440fx_state, &VAR_2, &isa_bus, gsi, system_memory, system_io, VAR_0->ram_size, below_4g_mem_size, above_4g_mem_size, pci_memory, ram_memory); } else { pci_bus = NULL; i440fx_state = NULL; isa_bus = isa_bus_new(NULL, get_system_memory(), system_io); no_hpet = 1; } isa_bus_irqs(isa_bus, gsi); if (kvm_irqchip_in_kernel()) { i8259 = kvm_i8259_init(isa_bus); } else if (xen_enabled()) { i8259 = xen_interrupt_controller_init(); } else { cpu_irq = pc_allocate_cpu_irq(); i8259 = i8259_init(isa_bus, cpu_irq[0]); } for (VAR_1 = 0; VAR_1 < ISA_NUM_IRQS; VAR_1++) { gsi_state->i8259_irq[VAR_1] = i8259[VAR_1]; } if (pci_enabled) { ioapic_init_gsi(gsi_state, "i440fx"); } qdev_init_nofail(icc_bridge); pc_register_ferr_irq(gsi[13]); pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL); assert(pc_machine->vmport != ON_OFF_AUTO_MAX); if (pc_machine->vmport == ON_OFF_AUTO_AUTO) { pc_machine->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; } pc_basic_device_init(isa_bus, gsi, &rtc_state, true, &floppy, (pc_machine->vmport != ON_OFF_AUTO_ON), 0x4); pc_nic_init(isa_bus, pci_bus); ide_drive_get(hd, ARRAY_SIZE(hd)); if (pci_enabled) { PCIDevice *dev; if (xen_enabled()) { dev = pci_piix3_xen_ide_init(pci_bus, hd, VAR_2 + 1); } else { dev = pci_piix3_ide_init(pci_bus, hd, VAR_2 + 1); } idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0"); idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1"); } else { for(VAR_1 = 0; VAR_1 < MAX_IDE_BUS; VAR_1++) { ISADevice *dev; char busname[] = "ide.0"; dev = isa_ide_init(isa_bus, ide_iobase[VAR_1], ide_iobase2[VAR_1], ide_irq[VAR_1], hd[MAX_IDE_DEVS * VAR_1], hd[MAX_IDE_DEVS * VAR_1 + 1]); busname[4] = '0' + VAR_1; idebus[VAR_1] = qdev_get_child_bus(DEVICE(dev), busname); } } pc_cmos_init(below_4g_mem_size, above_4g_mem_size, VAR_0->boot_order, VAR_0, floppy, idebus[0], idebus[1], rtc_state); if (pci_enabled && usb_enabled()) { pci_create_simple(pci_bus, VAR_2 + 2, "piix3-usb-uhci"); } if (pci_enabled && acpi_enabled) { DeviceState *piix4_pm; I2CBus *smbus; smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1); smbus = piix4_pm_init(pci_bus, VAR_2 + 3, 0xb100, gsi[9], *smi_irq, kvm_enabled(), fw_cfg, &piix4_pm); smbus_eeprom_init(smbus, 8, NULL, 0); object_property_add_link(OBJECT(VAR_0), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, (Object **)&pc_machine->acpi_dev, object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); object_property_set_link(OBJECT(VAR_0), OBJECT(piix4_pm), PC_MACHINE_ACPI_DEVICE_PROP, &error_abort); } if (pci_enabled) { pc_pci_device_init(pci_bus); } }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "PCMachineState *pc_machine = PC_MACHINE(VAR_0);", "MemoryRegion *system_memory = get_system_memory();", "MemoryRegion *system_io = get_system_io();", "int VAR_1;", "ram_addr_t below_4g_mem_size, above_4g_mem_size;", "PCIBus *pci_bus;", "ISABus *isa_bus;", "PCII440FXState *i440fx_state;", "int VAR_2 = -1;", "qemu_irq *cpu_irq;", "qemu_irq *gsi;", "qemu_irq *i8259;", "qemu_irq *smi_irq;", "GSIState *gsi_state;", "DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];", "BusState *idebus[MAX_IDE_BUS];", "ISADevice *rtc_state;", "ISADevice *floppy;", "MemoryRegion *ram_memory;", "MemoryRegion *pci_memory;", "MemoryRegion *rom_memory;", "DeviceState *icc_bridge;", "FWCfgState *fw_cfg = NULL;", "PcGuestInfo *guest_info;", "ram_addr_t lowmem;", "if (VAR_0->ram_size >= 0xe0000000) {", "lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000;", "} else {", "lowmem = 0xe0000000;", "}", "if (lowmem > pc_machine->max_ram_below_4g) {", "lowmem = pc_machine->max_ram_below_4g;", "if (VAR_0->ram_size - lowmem > lowmem &&\nlowmem & ((1ULL << 30) - 1)) {", "error_report(\"Warning: Large VAR_0 and max_ram_below_4g(%\"PRIu64\n\") not a multiple of 1G; possible bad performance.\",", "pc_machine->max_ram_below_4g);", "}", "}", "if (VAR_0->ram_size >= lowmem) {", "above_4g_mem_size = VAR_0->ram_size - lowmem;", "below_4g_mem_size = lowmem;", "} else {", "above_4g_mem_size = 0;", "below_4g_mem_size = VAR_0->ram_size;", "}", "if (xen_enabled() && xen_hvm_init(&below_4g_mem_size, &above_4g_mem_size,\n&ram_memory) != 0) {", "fprintf(stderr, \"xen hardware virtual VAR_0 initialisation failed\\n\");", "exit(1);", "}", "icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);", "object_property_add_child(qdev_get_machine(), \"icc-bridge\",\nOBJECT(icc_bridge), NULL);", "pc_cpus_init(VAR_0->cpu_model, icc_bridge);", "if (kvm_enabled() && kvmclock_enabled) {", "kvmclock_create();", "}", "if (pci_enabled) {", "pci_memory = g_new(MemoryRegion, 1);", "memory_region_init(pci_memory, NULL, \"pci\", UINT64_MAX);", "rom_memory = pci_memory;", "} else {", "pci_memory = NULL;", "rom_memory = system_memory;", "}", "guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);", "guest_info->has_acpi_build = has_acpi_build;", "guest_info->legacy_acpi_table_size = legacy_acpi_table_size;", "guest_info->isapc_ram_fw = !pci_enabled;", "guest_info->has_reserved_memory = has_reserved_memory;", "guest_info->rsdp_in_ram = rsdp_in_ram;", "if (smbios_defaults) {", "MachineClass *mc = MACHINE_GET_CLASS(VAR_0);", "smbios_set_defaults(\"QEMU\", \"Standard PC (i440FX + PIIX, 1996)\",\nmc->name, smbios_legacy_mode, smbios_uuid_encoded);", "}", "if (!xen_enabled()) {", "fw_cfg = pc_memory_init(VAR_0, system_memory,\nbelow_4g_mem_size, above_4g_mem_size,\nrom_memory, &ram_memory, guest_info);", "} else if (VAR_0->kernel_filename != NULL) {", "fw_cfg = xen_load_linux(VAR_0->kernel_filename,\nVAR_0->kernel_cmdline,\nVAR_0->initrd_filename,\nbelow_4g_mem_size,\nguest_info);", "}", "gsi_state = g_malloc0(sizeof(*gsi_state));", "if (kvm_irqchip_in_kernel()) {", "kvm_pc_setup_irq_routing(pci_enabled);", "gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,\nGSI_NUM_PINS);", "} else {", "gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);", "}", "if (pci_enabled) {", "pci_bus = i440fx_init(&i440fx_state, &VAR_2, &isa_bus, gsi,\nsystem_memory, system_io, VAR_0->ram_size,\nbelow_4g_mem_size,\nabove_4g_mem_size,\npci_memory, ram_memory);", "} else {", "pci_bus = NULL;", "i440fx_state = NULL;", "isa_bus = isa_bus_new(NULL, get_system_memory(), system_io);", "no_hpet = 1;", "}", "isa_bus_irqs(isa_bus, gsi);", "if (kvm_irqchip_in_kernel()) {", "i8259 = kvm_i8259_init(isa_bus);", "} else if (xen_enabled()) {", "i8259 = xen_interrupt_controller_init();", "} else {", "cpu_irq = pc_allocate_cpu_irq();", "i8259 = i8259_init(isa_bus, cpu_irq[0]);", "}", "for (VAR_1 = 0; VAR_1 < ISA_NUM_IRQS; VAR_1++) {", "gsi_state->i8259_irq[VAR_1] = i8259[VAR_1];", "}", "if (pci_enabled) {", "ioapic_init_gsi(gsi_state, \"i440fx\");", "}", "qdev_init_nofail(icc_bridge);", "pc_register_ferr_irq(gsi[13]);", "pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);", "assert(pc_machine->vmport != ON_OFF_AUTO_MAX);", "if (pc_machine->vmport == ON_OFF_AUTO_AUTO) {", "pc_machine->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON;", "}", "pc_basic_device_init(isa_bus, gsi, &rtc_state, true, &floppy,\n(pc_machine->vmport != ON_OFF_AUTO_ON), 0x4);", "pc_nic_init(isa_bus, pci_bus);", "ide_drive_get(hd, ARRAY_SIZE(hd));", "if (pci_enabled) {", "PCIDevice *dev;", "if (xen_enabled()) {", "dev = pci_piix3_xen_ide_init(pci_bus, hd, VAR_2 + 1);", "} else {", "dev = pci_piix3_ide_init(pci_bus, hd, VAR_2 + 1);", "}", "idebus[0] = qdev_get_child_bus(&dev->qdev, \"ide.0\");", "idebus[1] = qdev_get_child_bus(&dev->qdev, \"ide.1\");", "} else {", "for(VAR_1 = 0; VAR_1 < MAX_IDE_BUS; VAR_1++) {", "ISADevice *dev;", "char busname[] = \"ide.0\";", "dev = isa_ide_init(isa_bus, ide_iobase[VAR_1], ide_iobase2[VAR_1],\nide_irq[VAR_1],\nhd[MAX_IDE_DEVS * VAR_1], hd[MAX_IDE_DEVS * VAR_1 + 1]);", "busname[4] = '0' + VAR_1;", "idebus[VAR_1] = qdev_get_child_bus(DEVICE(dev), busname);", "}", "}", "pc_cmos_init(below_4g_mem_size, above_4g_mem_size, VAR_0->boot_order,\nVAR_0, floppy, idebus[0], idebus[1], rtc_state);", "if (pci_enabled && usb_enabled()) {", "pci_create_simple(pci_bus, VAR_2 + 2, \"piix3-usb-uhci\");", "}", "if (pci_enabled && acpi_enabled) {", "DeviceState *piix4_pm;", "I2CBus *smbus;", "smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);", "smbus = piix4_pm_init(pci_bus, VAR_2 + 3, 0xb100,\ngsi[9], *smi_irq,\nkvm_enabled(), fw_cfg, &piix4_pm);", "smbus_eeprom_init(smbus, 8, NULL, 0);", "object_property_add_link(OBJECT(VAR_0), PC_MACHINE_ACPI_DEVICE_PROP,\nTYPE_HOTPLUG_HANDLER,\n(Object **)&pc_machine->acpi_dev,\nobject_property_allow_set_link,\nOBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort);", "object_property_set_link(OBJECT(VAR_0), OBJECT(piix4_pm),\nPC_MACHINE_ACPI_DEVICE_PROP, &error_abort);", "}", "if (pci_enabled) {", "pc_pci_device_init(pci_bus);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 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 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139, 141 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 199, 201 ], [ 203 ], [ 209 ], [ 211, 213, 215 ], [ 217 ], [ 221, 223, 225, 227, 229 ], [ 231 ], [ 235 ], [ 237 ], [ 239 ], [ 241, 243 ], [ 245 ], [ 247 ], [ 249 ], [ 253 ], [ 255, 257, 259, 261, 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 315 ], [ 319 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 335, 337 ], [ 341 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373, 375, 377 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 397, 399 ], [ 403 ], [ 405 ], [ 407 ], [ 411 ], [ 413 ], [ 415 ], [ 419 ], [ 423, 425, 427 ], [ 429 ], [ 433, 435, 437, 439, 441 ], [ 443, 445 ], [ 447 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ] ]
840
static void parse_type_int64(Visitor *v, const char *name, int64_t *obj, Error **errp) { StringInputVisitor *siv = to_siv(v); if (!siv->string) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "integer"); return; } parse_str(siv, errp); if (!siv->ranges) { goto error; } if (!siv->cur_range) { Range *r; siv->cur_range = g_list_first(siv->ranges); if (!siv->cur_range) { goto error; } r = siv->cur_range->data; if (!r) { goto error; } siv->cur = r->begin; } *obj = siv->cur; siv->cur++; return; error: error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "an int64 value or range"); }
true
qemu
74f24cb6306d065045d0e2215a7d10533fa59c57
static void parse_type_int64(Visitor *v, const char *name, int64_t *obj, Error **errp) { StringInputVisitor *siv = to_siv(v); if (!siv->string) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "integer"); return; } parse_str(siv, errp); if (!siv->ranges) { goto error; } if (!siv->cur_range) { Range *r; siv->cur_range = g_list_first(siv->ranges); if (!siv->cur_range) { goto error; } r = siv->cur_range->data; if (!r) { goto error; } siv->cur = r->begin; } *obj = siv->cur; siv->cur++; return; error: error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "an int64 value or range"); }
{ "code": [ " parse_str(siv, errp);", " parse_str(siv, errp);" ], "line_no": [ 23, 23 ] }
static void FUNC_0(Visitor *VAR_0, const char *VAR_1, int64_t *VAR_2, Error **VAR_3) { StringInputVisitor *siv = to_siv(VAR_0); if (!siv->string) { error_setg(VAR_3, QERR_INVALID_PARAMETER_TYPE, VAR_1 ? VAR_1 : "null", "integer"); return; } parse_str(siv, VAR_3); if (!siv->ranges) { goto error; } if (!siv->cur_range) { Range *r; siv->cur_range = g_list_first(siv->ranges); if (!siv->cur_range) { goto error; } r = siv->cur_range->data; if (!r) { goto error; } siv->cur = r->begin; } *VAR_2 = siv->cur; siv->cur++; return; error: error_setg(VAR_3, QERR_INVALID_PARAMETER_VALUE, VAR_1 ? VAR_1 : "null", "an int64 value or range"); }
[ "static void FUNC_0(Visitor *VAR_0, const char *VAR_1, int64_t *VAR_2,\nError **VAR_3)\n{", "StringInputVisitor *siv = to_siv(VAR_0);", "if (!siv->string) {", "error_setg(VAR_3, QERR_INVALID_PARAMETER_TYPE, VAR_1 ? VAR_1 : \"null\",\n\"integer\");", "return;", "}", "parse_str(siv, VAR_3);", "if (!siv->ranges) {", "goto error;", "}", "if (!siv->cur_range) {", "Range *r;", "siv->cur_range = g_list_first(siv->ranges);", "if (!siv->cur_range) {", "goto error;", "}", "r = siv->cur_range->data;", "if (!r) {", "goto error;", "}", "siv->cur = r->begin;", "}", "*VAR_2 = siv->cur;", "siv->cur++;", "return;", "error:\nerror_setg(VAR_3, QERR_INVALID_PARAMETER_VALUE, VAR_1 ? VAR_1 : \"null\",\n\"an int64 value or range\");", "}" ]
[ 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 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 75, 77, 79 ], [ 81 ] ]
841
void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len) { s->chr_read(s->handler_opaque, buf, len); }
true
qemu
ac3107340fbb9422ea63ee5d6729775965e121fd
void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len) { s->chr_read(s->handler_opaque, buf, len); }
{ "code": [ " s->chr_read(s->handler_opaque, buf, len);" ], "line_no": [ 5 ] }
void FUNC_0(CharDriverState *VAR_0, uint8_t *VAR_1, int VAR_2) { VAR_0->chr_read(VAR_0->handler_opaque, VAR_1, VAR_2); }
[ "void FUNC_0(CharDriverState *VAR_0, uint8_t *VAR_1, int VAR_2)\n{", "VAR_0->chr_read(VAR_0->handler_opaque, VAR_1, VAR_2);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
842
static void virtio_set_status(struct subchannel_id schid, unsigned long dev_addr) { unsigned char status = dev_addr; if (run_ccw(schid, CCW_CMD_WRITE_STATUS, &status, sizeof(status))) { virtio_panic("Could not write status to host!\n"); } }
true
qemu
c9262e8a84a29f22fbb5edde5d17f4f6166d5ae1
static void virtio_set_status(struct subchannel_id schid, unsigned long dev_addr) { unsigned char status = dev_addr; if (run_ccw(schid, CCW_CMD_WRITE_STATUS, &status, sizeof(status))) { virtio_panic("Could not write status to host!\n"); } }
{ "code": [ " virtio_panic(\"Could not write status to host!\\n\");" ], "line_no": [ 11 ] }
static void FUNC_0(struct subchannel_id VAR_0, unsigned long VAR_1) { unsigned char VAR_2 = VAR_1; if (run_ccw(VAR_0, CCW_CMD_WRITE_STATUS, &VAR_2, sizeof(VAR_2))) { virtio_panic("Could not write VAR_2 to host!\n"); } }
[ "static void FUNC_0(struct subchannel_id VAR_0,\nunsigned long VAR_1)\n{", "unsigned char VAR_2 = VAR_1;", "if (run_ccw(VAR_0, CCW_CMD_WRITE_STATUS, &VAR_2, sizeof(VAR_2))) {", "virtio_panic(\"Could not write VAR_2 to host!\\n\");", "}", "}" ]
[ 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
843
uint32_t do_arm_semihosting(CPUState *env) { target_ulong args; char * s; int nr; uint32_t ret; uint32_t len; #ifdef CONFIG_USER_ONLY TaskState *ts = env->opaque; #else CPUState *ts = env; #endif nr = env->regs[0]; args = env->regs[1]; switch (nr) { case SYS_OPEN: if (!(s = lock_user_string(ARG(0)))) /* FIXME - should this error code be -TARGET_EFAULT ? */ return (uint32_t)-1; if (ARG(1) >= 12) return (uint32_t)-1; if (strcmp(s, ":tt") == 0) { if (ARG(1) < 4) return STDIN_FILENO; else return STDOUT_FILENO; } if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "open,%s,%x,1a4", ARG(0), (int)ARG(2)+1, gdb_open_modeflags[ARG(1)]); return env->regs[0]; } else { ret = set_swi_errno(ts, open(s, open_modeflags[ARG(1)], 0644)); } unlock_user(s, ARG(0), 0); return ret; case SYS_CLOSE: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "close,%x", ARG(0)); return env->regs[0]; } else { return set_swi_errno(ts, close(ARG(0))); } case SYS_WRITEC: { char c; if (get_user_u8(c, args)) /* FIXME - should this error code be -TARGET_EFAULT ? */ return (uint32_t)-1; /* Write to debug console. stderr is near enough. */ if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "write,2,%x,1", args); return env->regs[0]; } else { return write(STDERR_FILENO, &c, 1); } } case SYS_WRITE0: if (!(s = lock_user_string(args))) /* FIXME - should this error code be -TARGET_EFAULT ? */ return (uint32_t)-1; len = strlen(s); if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "write,2,%x,%x\n", args, len); ret = env->regs[0]; } else { ret = write(STDERR_FILENO, s, len); } unlock_user(s, args, 0); return ret; case SYS_WRITE: len = ARG(2); if (use_gdb_syscalls()) { arm_semi_syscall_len = len; gdb_do_syscall(arm_semi_cb, "write,%x,%x,%x", ARG(0), ARG(1), len); return env->regs[0]; } else { if (!(s = lock_user(VERIFY_READ, ARG(1), len, 1))) /* FIXME - should this error code be -TARGET_EFAULT ? */ return (uint32_t)-1; ret = set_swi_errno(ts, write(ARG(0), s, len)); unlock_user(s, ARG(1), 0); if (ret == (uint32_t)-1) return -1; return len - ret; } case SYS_READ: len = ARG(2); if (use_gdb_syscalls()) { arm_semi_syscall_len = len; gdb_do_syscall(arm_semi_cb, "read,%x,%x,%x", ARG(0), ARG(1), len); return env->regs[0]; } else { if (!(s = lock_user(VERIFY_WRITE, ARG(1), len, 0))) /* FIXME - should this error code be -TARGET_EFAULT ? */ return (uint32_t)-1; do ret = set_swi_errno(ts, read(ARG(0), s, len)); while (ret == -1 && errno == EINTR); unlock_user(s, ARG(1), len); if (ret == (uint32_t)-1) return -1; return len - ret; } case SYS_READC: /* XXX: Read from debug cosole. Not implemented. */ return 0; case SYS_ISTTY: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "isatty,%x", ARG(0)); return env->regs[0]; } else { return isatty(ARG(0)); } case SYS_SEEK: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "lseek,%x,%x,0", ARG(0), ARG(1)); return env->regs[0]; } else { ret = set_swi_errno(ts, lseek(ARG(0), ARG(1), SEEK_SET)); if (ret == (uint32_t)-1) return -1; return 0; } case SYS_FLEN: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_flen_cb, "fstat,%x,%x", ARG(0), env->regs[13]-64); return env->regs[0]; } else { struct stat buf; ret = set_swi_errno(ts, fstat(ARG(0), &buf)); if (ret == (uint32_t)-1) return -1; return buf.st_size; } case SYS_TMPNAM: /* XXX: Not implemented. */ return -1; case SYS_REMOVE: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "unlink,%s", ARG(0), (int)ARG(1)+1); ret = env->regs[0]; } else { if (!(s = lock_user_string(ARG(0)))) /* FIXME - should this error code be -TARGET_EFAULT ? */ return (uint32_t)-1; ret = set_swi_errno(ts, remove(s)); unlock_user(s, ARG(0), 0); } return ret; case SYS_RENAME: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "rename,%s,%s", ARG(0), (int)ARG(1)+1, ARG(2), (int)ARG(3)+1); return env->regs[0]; } else { char *s2; s = lock_user_string(ARG(0)); s2 = lock_user_string(ARG(2)); if (!s || !s2) /* FIXME - should this error code be -TARGET_EFAULT ? */ ret = (uint32_t)-1; else ret = set_swi_errno(ts, rename(s, s2)); if (s2) unlock_user(s2, ARG(2), 0); if (s) unlock_user(s, ARG(0), 0); return ret; } case SYS_CLOCK: return clock() / (CLOCKS_PER_SEC / 100); case SYS_TIME: return set_swi_errno(ts, time(NULL)); case SYS_SYSTEM: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "system,%s", ARG(0), (int)ARG(1)+1); return env->regs[0]; } else { if (!(s = lock_user_string(ARG(0)))) /* FIXME - should this error code be -TARGET_EFAULT ? */ return (uint32_t)-1; ret = set_swi_errno(ts, system(s)); unlock_user(s, ARG(0), 0); return ret; } case SYS_ERRNO: #ifdef CONFIG_USER_ONLY return ts->swi_errno; #else return syscall_err; #endif case SYS_GET_CMDLINE: #ifdef CONFIG_USER_ONLY /* Build a commandline from the original argv. */ { char *arm_cmdline_buffer; const char *host_cmdline_buffer; unsigned int i; unsigned int arm_cmdline_len = ARG(1); unsigned int host_cmdline_len = ts->info->arg_end-ts->info->arg_start; if (!arm_cmdline_len || host_cmdline_len > arm_cmdline_len) { return -1; /* not enough space to store command line */ } if (!host_cmdline_len) { /* We special-case the "empty command line" case (argc==0). Just provide the terminating 0. */ arm_cmdline_buffer = lock_user(VERIFY_WRITE, ARG(0), 1, 0); arm_cmdline_buffer[0] = 0; unlock_user(arm_cmdline_buffer, ARG(0), 1); /* Adjust the commandline length argument. */ SET_ARG(1, 0); return 0; } /* lock the buffers on the ARM side */ arm_cmdline_buffer = lock_user(VERIFY_WRITE, ARG(0), host_cmdline_len, 0); host_cmdline_buffer = lock_user(VERIFY_READ, ts->info->arg_start, host_cmdline_len, 1); if (arm_cmdline_buffer && host_cmdline_buffer) { /* the last argument is zero-terminated; no need for additional termination */ memcpy(arm_cmdline_buffer, host_cmdline_buffer, host_cmdline_len); /* separate arguments by white spaces */ for (i = 0; i < host_cmdline_len-1; i++) { if (arm_cmdline_buffer[i] == 0) { arm_cmdline_buffer[i] = ' '; } } /* Adjust the commandline length argument. */ SET_ARG(1, host_cmdline_len-1); } /* Unlock the buffers on the ARM side. */ unlock_user(arm_cmdline_buffer, ARG(0), host_cmdline_len); unlock_user((void*)host_cmdline_buffer, ts->info->arg_start, 0); /* Return success if we could return a commandline. */ return (arm_cmdline_buffer && host_cmdline_buffer) ? 0 : -1; } #else return -1; #endif case SYS_HEAPINFO: { uint32_t *ptr; uint32_t limit; #ifdef CONFIG_USER_ONLY /* Some C libraries assume the heap immediately follows .bss, so allocate it using sbrk. */ if (!ts->heap_limit) { long ret; ts->heap_base = do_brk(0); limit = ts->heap_base + ARM_ANGEL_HEAP_SIZE; /* Try a big heap, and reduce the size if that fails. */ for (;;) { ret = do_brk(limit); if (ret != -1) break; limit = (ts->heap_base >> 1) + (limit >> 1); } ts->heap_limit = limit; } if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0))) /* FIXME - should this error code be -TARGET_EFAULT ? */ return (uint32_t)-1; ptr[0] = tswap32(ts->heap_base); ptr[1] = tswap32(ts->heap_limit); ptr[2] = tswap32(ts->stack_base); ptr[3] = tswap32(0); /* Stack limit. */ unlock_user(ptr, ARG(0), 16); #else limit = ram_size; if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0))) /* FIXME - should this error code be -TARGET_EFAULT ? */ return (uint32_t)-1; /* TODO: Make this use the limit of the loaded application. */ ptr[0] = tswap32(limit / 2); ptr[1] = tswap32(limit); ptr[2] = tswap32(limit); /* Stack base */ ptr[3] = tswap32(0); /* Stack limit. */ unlock_user(ptr, ARG(0), 16); #endif return 0; } case SYS_EXIT: gdb_exit(env, 0); exit(0); default: fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr); cpu_dump_state(env, stderr, fprintf, 0); abort(); } }
true
qemu
206ae74aea5593f5f5bad769a6b4f101f17bc6fd
uint32_t do_arm_semihosting(CPUState *env) { target_ulong args; char * s; int nr; uint32_t ret; uint32_t len; #ifdef CONFIG_USER_ONLY TaskState *ts = env->opaque; #else CPUState *ts = env; #endif nr = env->regs[0]; args = env->regs[1]; switch (nr) { case SYS_OPEN: if (!(s = lock_user_string(ARG(0)))) return (uint32_t)-1; if (ARG(1) >= 12) return (uint32_t)-1; if (strcmp(s, ":tt") == 0) { if (ARG(1) < 4) return STDIN_FILENO; else return STDOUT_FILENO; } if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "open,%s,%x,1a4", ARG(0), (int)ARG(2)+1, gdb_open_modeflags[ARG(1)]); return env->regs[0]; } else { ret = set_swi_errno(ts, open(s, open_modeflags[ARG(1)], 0644)); } unlock_user(s, ARG(0), 0); return ret; case SYS_CLOSE: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "close,%x", ARG(0)); return env->regs[0]; } else { return set_swi_errno(ts, close(ARG(0))); } case SYS_WRITEC: { char c; if (get_user_u8(c, args)) return (uint32_t)-1; if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "write,2,%x,1", args); return env->regs[0]; } else { return write(STDERR_FILENO, &c, 1); } } case SYS_WRITE0: if (!(s = lock_user_string(args))) return (uint32_t)-1; len = strlen(s); if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "write,2,%x,%x\n", args, len); ret = env->regs[0]; } else { ret = write(STDERR_FILENO, s, len); } unlock_user(s, args, 0); return ret; case SYS_WRITE: len = ARG(2); if (use_gdb_syscalls()) { arm_semi_syscall_len = len; gdb_do_syscall(arm_semi_cb, "write,%x,%x,%x", ARG(0), ARG(1), len); return env->regs[0]; } else { if (!(s = lock_user(VERIFY_READ, ARG(1), len, 1))) return (uint32_t)-1; ret = set_swi_errno(ts, write(ARG(0), s, len)); unlock_user(s, ARG(1), 0); if (ret == (uint32_t)-1) return -1; return len - ret; } case SYS_READ: len = ARG(2); if (use_gdb_syscalls()) { arm_semi_syscall_len = len; gdb_do_syscall(arm_semi_cb, "read,%x,%x,%x", ARG(0), ARG(1), len); return env->regs[0]; } else { if (!(s = lock_user(VERIFY_WRITE, ARG(1), len, 0))) return (uint32_t)-1; do ret = set_swi_errno(ts, read(ARG(0), s, len)); while (ret == -1 && errno == EINTR); unlock_user(s, ARG(1), len); if (ret == (uint32_t)-1) return -1; return len - ret; } case SYS_READC: return 0; case SYS_ISTTY: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "isatty,%x", ARG(0)); return env->regs[0]; } else { return isatty(ARG(0)); } case SYS_SEEK: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "lseek,%x,%x,0", ARG(0), ARG(1)); return env->regs[0]; } else { ret = set_swi_errno(ts, lseek(ARG(0), ARG(1), SEEK_SET)); if (ret == (uint32_t)-1) return -1; return 0; } case SYS_FLEN: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_flen_cb, "fstat,%x,%x", ARG(0), env->regs[13]-64); return env->regs[0]; } else { struct stat buf; ret = set_swi_errno(ts, fstat(ARG(0), &buf)); if (ret == (uint32_t)-1) return -1; return buf.st_size; } case SYS_TMPNAM: return -1; case SYS_REMOVE: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "unlink,%s", ARG(0), (int)ARG(1)+1); ret = env->regs[0]; } else { if (!(s = lock_user_string(ARG(0)))) return (uint32_t)-1; ret = set_swi_errno(ts, remove(s)); unlock_user(s, ARG(0), 0); } return ret; case SYS_RENAME: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "rename,%s,%s", ARG(0), (int)ARG(1)+1, ARG(2), (int)ARG(3)+1); return env->regs[0]; } else { char *s2; s = lock_user_string(ARG(0)); s2 = lock_user_string(ARG(2)); if (!s || !s2) ret = (uint32_t)-1; else ret = set_swi_errno(ts, rename(s, s2)); if (s2) unlock_user(s2, ARG(2), 0); if (s) unlock_user(s, ARG(0), 0); return ret; } case SYS_CLOCK: return clock() / (CLOCKS_PER_SEC / 100); case SYS_TIME: return set_swi_errno(ts, time(NULL)); case SYS_SYSTEM: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "system,%s", ARG(0), (int)ARG(1)+1); return env->regs[0]; } else { if (!(s = lock_user_string(ARG(0)))) return (uint32_t)-1; ret = set_swi_errno(ts, system(s)); unlock_user(s, ARG(0), 0); return ret; } case SYS_ERRNO: #ifdef CONFIG_USER_ONLY return ts->swi_errno; #else return syscall_err; #endif case SYS_GET_CMDLINE: #ifdef CONFIG_USER_ONLY { char *arm_cmdline_buffer; const char *host_cmdline_buffer; unsigned int i; unsigned int arm_cmdline_len = ARG(1); unsigned int host_cmdline_len = ts->info->arg_end-ts->info->arg_start; if (!arm_cmdline_len || host_cmdline_len > arm_cmdline_len) { return -1; } if (!host_cmdline_len) { arm_cmdline_buffer = lock_user(VERIFY_WRITE, ARG(0), 1, 0); arm_cmdline_buffer[0] = 0; unlock_user(arm_cmdline_buffer, ARG(0), 1); SET_ARG(1, 0); return 0; } arm_cmdline_buffer = lock_user(VERIFY_WRITE, ARG(0), host_cmdline_len, 0); host_cmdline_buffer = lock_user(VERIFY_READ, ts->info->arg_start, host_cmdline_len, 1); if (arm_cmdline_buffer && host_cmdline_buffer) { memcpy(arm_cmdline_buffer, host_cmdline_buffer, host_cmdline_len); for (i = 0; i < host_cmdline_len-1; i++) { if (arm_cmdline_buffer[i] == 0) { arm_cmdline_buffer[i] = ' '; } } SET_ARG(1, host_cmdline_len-1); } unlock_user(arm_cmdline_buffer, ARG(0), host_cmdline_len); unlock_user((void*)host_cmdline_buffer, ts->info->arg_start, 0); return (arm_cmdline_buffer && host_cmdline_buffer) ? 0 : -1; } #else return -1; #endif case SYS_HEAPINFO: { uint32_t *ptr; uint32_t limit; #ifdef CONFIG_USER_ONLY if (!ts->heap_limit) { long ret; ts->heap_base = do_brk(0); limit = ts->heap_base + ARM_ANGEL_HEAP_SIZE; for (;;) { ret = do_brk(limit); if (ret != -1) break; limit = (ts->heap_base >> 1) + (limit >> 1); } ts->heap_limit = limit; } if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0))) return (uint32_t)-1; ptr[0] = tswap32(ts->heap_base); ptr[1] = tswap32(ts->heap_limit); ptr[2] = tswap32(ts->stack_base); ptr[3] = tswap32(0); unlock_user(ptr, ARG(0), 16); #else limit = ram_size; if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0))) return (uint32_t)-1; ptr[0] = tswap32(limit / 2); ptr[1] = tswap32(limit); ptr[2] = tswap32(limit); ptr[3] = tswap32(0); unlock_user(ptr, ARG(0), 16); #endif return 0; } case SYS_EXIT: gdb_exit(env, 0); exit(0); default: fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr); cpu_dump_state(env, stderr, fprintf, 0); abort(); } }
{ "code": [ " long ret;", " if (ret != -1)" ], "line_no": [ 535, 549 ] }
uint32_t FUNC_0(CPUState *env) { target_ulong args; char * VAR_0; int VAR_1; uint32_t ret; uint32_t len; #ifdef CONFIG_USER_ONLY TaskState *ts = env->opaque; #else CPUState *ts = env; #endif VAR_1 = env->regs[0]; args = env->regs[1]; switch (VAR_1) { case SYS_OPEN: if (!(VAR_0 = lock_user_string(ARG(0)))) return (uint32_t)-1; if (ARG(1) >= 12) return (uint32_t)-1; if (strcmp(VAR_0, ":tt") == 0) { if (ARG(1) < 4) return STDIN_FILENO; else return STDOUT_FILENO; } if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "open,%VAR_0,%x,1a4", ARG(0), (int)ARG(2)+1, gdb_open_modeflags[ARG(1)]); return env->regs[0]; } else { ret = set_swi_errno(ts, open(VAR_0, open_modeflags[ARG(1)], 0644)); } unlock_user(VAR_0, ARG(0), 0); return ret; case SYS_CLOSE: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "close,%x", ARG(0)); return env->regs[0]; } else { return set_swi_errno(ts, close(ARG(0))); } case SYS_WRITEC: { char VAR_2; if (get_user_u8(VAR_2, args)) return (uint32_t)-1; if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "write,2,%x,1", args); return env->regs[0]; } else { return write(STDERR_FILENO, &VAR_2, 1); } } case SYS_WRITE0: if (!(VAR_0 = lock_user_string(args))) return (uint32_t)-1; len = strlen(VAR_0); if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "write,2,%x,%x\n", args, len); ret = env->regs[0]; } else { ret = write(STDERR_FILENO, VAR_0, len); } unlock_user(VAR_0, args, 0); return ret; case SYS_WRITE: len = ARG(2); if (use_gdb_syscalls()) { arm_semi_syscall_len = len; gdb_do_syscall(arm_semi_cb, "write,%x,%x,%x", ARG(0), ARG(1), len); return env->regs[0]; } else { if (!(VAR_0 = lock_user(VERIFY_READ, ARG(1), len, 1))) return (uint32_t)-1; ret = set_swi_errno(ts, write(ARG(0), VAR_0, len)); unlock_user(VAR_0, ARG(1), 0); if (ret == (uint32_t)-1) return -1; return len - ret; } case SYS_READ: len = ARG(2); if (use_gdb_syscalls()) { arm_semi_syscall_len = len; gdb_do_syscall(arm_semi_cb, "read,%x,%x,%x", ARG(0), ARG(1), len); return env->regs[0]; } else { if (!(VAR_0 = lock_user(VERIFY_WRITE, ARG(1), len, 0))) return (uint32_t)-1; do ret = set_swi_errno(ts, read(ARG(0), VAR_0, len)); while (ret == -1 && errno == EINTR); unlock_user(VAR_0, ARG(1), len); if (ret == (uint32_t)-1) return -1; return len - ret; } case SYS_READC: return 0; case SYS_ISTTY: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "isatty,%x", ARG(0)); return env->regs[0]; } else { return isatty(ARG(0)); } case SYS_SEEK: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "lseek,%x,%x,0", ARG(0), ARG(1)); return env->regs[0]; } else { ret = set_swi_errno(ts, lseek(ARG(0), ARG(1), SEEK_SET)); if (ret == (uint32_t)-1) return -1; return 0; } case SYS_FLEN: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_flen_cb, "fstat,%x,%x", ARG(0), env->regs[13]-64); return env->regs[0]; } else { struct stat VAR_3; ret = set_swi_errno(ts, fstat(ARG(0), &VAR_3)); if (ret == (uint32_t)-1) return -1; return VAR_3.st_size; } case SYS_TMPNAM: return -1; case SYS_REMOVE: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "unlink,%VAR_0", ARG(0), (int)ARG(1)+1); ret = env->regs[0]; } else { if (!(VAR_0 = lock_user_string(ARG(0)))) return (uint32_t)-1; ret = set_swi_errno(ts, remove(VAR_0)); unlock_user(VAR_0, ARG(0), 0); } return ret; case SYS_RENAME: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "rename,%VAR_0,%VAR_0", ARG(0), (int)ARG(1)+1, ARG(2), (int)ARG(3)+1); return env->regs[0]; } else { char *VAR_4; VAR_0 = lock_user_string(ARG(0)); VAR_4 = lock_user_string(ARG(2)); if (!VAR_0 || !VAR_4) ret = (uint32_t)-1; else ret = set_swi_errno(ts, rename(VAR_0, VAR_4)); if (VAR_4) unlock_user(VAR_4, ARG(2), 0); if (VAR_0) unlock_user(VAR_0, ARG(0), 0); return ret; } case SYS_CLOCK: return clock() / (CLOCKS_PER_SEC / 100); case SYS_TIME: return set_swi_errno(ts, time(NULL)); case SYS_SYSTEM: if (use_gdb_syscalls()) { gdb_do_syscall(arm_semi_cb, "system,%VAR_0", ARG(0), (int)ARG(1)+1); return env->regs[0]; } else { if (!(VAR_0 = lock_user_string(ARG(0)))) return (uint32_t)-1; ret = set_swi_errno(ts, system(VAR_0)); unlock_user(VAR_0, ARG(0), 0); return ret; } case SYS_ERRNO: #ifdef CONFIG_USER_ONLY return ts->swi_errno; #else return syscall_err; #endif case SYS_GET_CMDLINE: #ifdef CONFIG_USER_ONLY { char *arm_cmdline_buffer; const char *host_cmdline_buffer; unsigned int i; unsigned int arm_cmdline_len = ARG(1); unsigned int host_cmdline_len = ts->info->arg_end-ts->info->arg_start; if (!arm_cmdline_len || host_cmdline_len > arm_cmdline_len) { return -1; } if (!host_cmdline_len) { arm_cmdline_buffer = lock_user(VERIFY_WRITE, ARG(0), 1, 0); arm_cmdline_buffer[0] = 0; unlock_user(arm_cmdline_buffer, ARG(0), 1); SET_ARG(1, 0); return 0; } arm_cmdline_buffer = lock_user(VERIFY_WRITE, ARG(0), host_cmdline_len, 0); host_cmdline_buffer = lock_user(VERIFY_READ, ts->info->arg_start, host_cmdline_len, 1); if (arm_cmdline_buffer && host_cmdline_buffer) { memcpy(arm_cmdline_buffer, host_cmdline_buffer, host_cmdline_len); for (i = 0; i < host_cmdline_len-1; i++) { if (arm_cmdline_buffer[i] == 0) { arm_cmdline_buffer[i] = ' '; } } SET_ARG(1, host_cmdline_len-1); } unlock_user(arm_cmdline_buffer, ARG(0), host_cmdline_len); unlock_user((void*)host_cmdline_buffer, ts->info->arg_start, 0); return (arm_cmdline_buffer && host_cmdline_buffer) ? 0 : -1; } #else return -1; #endif case SYS_HEAPINFO: { uint32_t *ptr; uint32_t limit; #ifdef CONFIG_USER_ONLY if (!ts->heap_limit) { long ret; ts->heap_base = do_brk(0); limit = ts->heap_base + ARM_ANGEL_HEAP_SIZE; for (;;) { ret = do_brk(limit); if (ret != -1) break; limit = (ts->heap_base >> 1) + (limit >> 1); } ts->heap_limit = limit; } if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0))) return (uint32_t)-1; ptr[0] = tswap32(ts->heap_base); ptr[1] = tswap32(ts->heap_limit); ptr[2] = tswap32(ts->stack_base); ptr[3] = tswap32(0); unlock_user(ptr, ARG(0), 16); #else limit = ram_size; if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0))) return (uint32_t)-1; ptr[0] = tswap32(limit / 2); ptr[1] = tswap32(limit); ptr[2] = tswap32(limit); ptr[3] = tswap32(0); unlock_user(ptr, ARG(0), 16); #endif return 0; } case SYS_EXIT: gdb_exit(env, 0); exit(0); default: fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", VAR_1); cpu_dump_state(env, stderr, fprintf, 0); abort(); } }
[ "uint32_t FUNC_0(CPUState *env)\n{", "target_ulong args;", "char * VAR_0;", "int VAR_1;", "uint32_t ret;", "uint32_t len;", "#ifdef CONFIG_USER_ONLY\nTaskState *ts = env->opaque;", "#else\nCPUState *ts = env;", "#endif\nVAR_1 = env->regs[0];", "args = env->regs[1];", "switch (VAR_1) {", "case SYS_OPEN:\nif (!(VAR_0 = lock_user_string(ARG(0))))\nreturn (uint32_t)-1;", "if (ARG(1) >= 12)\nreturn (uint32_t)-1;", "if (strcmp(VAR_0, \":tt\") == 0) {", "if (ARG(1) < 4)\nreturn STDIN_FILENO;", "else\nreturn STDOUT_FILENO;", "}", "if (use_gdb_syscalls()) {", "gdb_do_syscall(arm_semi_cb, \"open,%VAR_0,%x,1a4\", ARG(0),\n(int)ARG(2)+1, gdb_open_modeflags[ARG(1)]);", "return env->regs[0];", "} else {", "ret = set_swi_errno(ts, open(VAR_0, open_modeflags[ARG(1)], 0644));", "}", "unlock_user(VAR_0, ARG(0), 0);", "return ret;", "case SYS_CLOSE:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(arm_semi_cb, \"close,%x\", ARG(0));", "return env->regs[0];", "} else {", "return set_swi_errno(ts, close(ARG(0)));", "}", "case SYS_WRITEC:\n{", "char VAR_2;", "if (get_user_u8(VAR_2, args))\nreturn (uint32_t)-1;", "if (use_gdb_syscalls()) {", "gdb_do_syscall(arm_semi_cb, \"write,2,%x,1\", args);", "return env->regs[0];", "} else {", "return write(STDERR_FILENO, &VAR_2, 1);", "}", "}", "case SYS_WRITE0:\nif (!(VAR_0 = lock_user_string(args)))\nreturn (uint32_t)-1;", "len = strlen(VAR_0);", "if (use_gdb_syscalls()) {", "gdb_do_syscall(arm_semi_cb, \"write,2,%x,%x\\n\", args, len);", "ret = env->regs[0];", "} else {", "ret = write(STDERR_FILENO, VAR_0, len);", "}", "unlock_user(VAR_0, args, 0);", "return ret;", "case SYS_WRITE:\nlen = ARG(2);", "if (use_gdb_syscalls()) {", "arm_semi_syscall_len = len;", "gdb_do_syscall(arm_semi_cb, \"write,%x,%x,%x\", ARG(0), ARG(1), len);", "return env->regs[0];", "} else {", "if (!(VAR_0 = lock_user(VERIFY_READ, ARG(1), len, 1)))\nreturn (uint32_t)-1;", "ret = set_swi_errno(ts, write(ARG(0), VAR_0, len));", "unlock_user(VAR_0, ARG(1), 0);", "if (ret == (uint32_t)-1)\nreturn -1;", "return len - ret;", "}", "case SYS_READ:\nlen = ARG(2);", "if (use_gdb_syscalls()) {", "arm_semi_syscall_len = len;", "gdb_do_syscall(arm_semi_cb, \"read,%x,%x,%x\", ARG(0), ARG(1), len);", "return env->regs[0];", "} else {", "if (!(VAR_0 = lock_user(VERIFY_WRITE, ARG(1), len, 0)))\nreturn (uint32_t)-1;", "do\nret = set_swi_errno(ts, read(ARG(0), VAR_0, len));", "while (ret == -1 && errno == EINTR);", "unlock_user(VAR_0, ARG(1), len);", "if (ret == (uint32_t)-1)\nreturn -1;", "return len - ret;", "}", "case SYS_READC:\nreturn 0;", "case SYS_ISTTY:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(arm_semi_cb, \"isatty,%x\", ARG(0));", "return env->regs[0];", "} else {", "return isatty(ARG(0));", "}", "case SYS_SEEK:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(arm_semi_cb, \"lseek,%x,%x,0\", ARG(0), ARG(1));", "return env->regs[0];", "} else {", "ret = set_swi_errno(ts, lseek(ARG(0), ARG(1), SEEK_SET));", "if (ret == (uint32_t)-1)\nreturn -1;", "return 0;", "}", "case SYS_FLEN:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(arm_semi_flen_cb, \"fstat,%x,%x\",\nARG(0), env->regs[13]-64);", "return env->regs[0];", "} else {", "struct stat VAR_3;", "ret = set_swi_errno(ts, fstat(ARG(0), &VAR_3));", "if (ret == (uint32_t)-1)\nreturn -1;", "return VAR_3.st_size;", "}", "case SYS_TMPNAM:\nreturn -1;", "case SYS_REMOVE:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(arm_semi_cb, \"unlink,%VAR_0\", ARG(0), (int)ARG(1)+1);", "ret = env->regs[0];", "} else {", "if (!(VAR_0 = lock_user_string(ARG(0))))\nreturn (uint32_t)-1;", "ret = set_swi_errno(ts, remove(VAR_0));", "unlock_user(VAR_0, ARG(0), 0);", "}", "return ret;", "case SYS_RENAME:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(arm_semi_cb, \"rename,%VAR_0,%VAR_0\",\nARG(0), (int)ARG(1)+1, ARG(2), (int)ARG(3)+1);", "return env->regs[0];", "} else {", "char *VAR_4;", "VAR_0 = lock_user_string(ARG(0));", "VAR_4 = lock_user_string(ARG(2));", "if (!VAR_0 || !VAR_4)\nret = (uint32_t)-1;", "else\nret = set_swi_errno(ts, rename(VAR_0, VAR_4));", "if (VAR_4)\nunlock_user(VAR_4, ARG(2), 0);", "if (VAR_0)\nunlock_user(VAR_0, ARG(0), 0);", "return ret;", "}", "case SYS_CLOCK:\nreturn clock() / (CLOCKS_PER_SEC / 100);", "case SYS_TIME:\nreturn set_swi_errno(ts, time(NULL));", "case SYS_SYSTEM:\nif (use_gdb_syscalls()) {", "gdb_do_syscall(arm_semi_cb, \"system,%VAR_0\", ARG(0), (int)ARG(1)+1);", "return env->regs[0];", "} else {", "if (!(VAR_0 = lock_user_string(ARG(0))))\nreturn (uint32_t)-1;", "ret = set_swi_errno(ts, system(VAR_0));", "unlock_user(VAR_0, ARG(0), 0);", "return ret;", "}", "case SYS_ERRNO:\n#ifdef CONFIG_USER_ONLY\nreturn ts->swi_errno;", "#else\nreturn syscall_err;", "#endif\ncase SYS_GET_CMDLINE:\n#ifdef CONFIG_USER_ONLY\n{", "char *arm_cmdline_buffer;", "const char *host_cmdline_buffer;", "unsigned int i;", "unsigned int arm_cmdline_len = ARG(1);", "unsigned int host_cmdline_len =\nts->info->arg_end-ts->info->arg_start;", "if (!arm_cmdline_len || host_cmdline_len > arm_cmdline_len) {", "return -1;", "}", "if (!host_cmdline_len) {", "arm_cmdline_buffer = lock_user(VERIFY_WRITE, ARG(0), 1, 0);", "arm_cmdline_buffer[0] = 0;", "unlock_user(arm_cmdline_buffer, ARG(0), 1);", "SET_ARG(1, 0);", "return 0;", "}", "arm_cmdline_buffer =\nlock_user(VERIFY_WRITE, ARG(0), host_cmdline_len, 0);", "host_cmdline_buffer =\nlock_user(VERIFY_READ, ts->info->arg_start,\nhost_cmdline_len, 1);", "if (arm_cmdline_buffer && host_cmdline_buffer)\n{", "memcpy(arm_cmdline_buffer, host_cmdline_buffer,\nhost_cmdline_len);", "for (i = 0; i < host_cmdline_len-1; i++) {", "if (arm_cmdline_buffer[i] == 0) {", "arm_cmdline_buffer[i] = ' ';", "}", "}", "SET_ARG(1, host_cmdline_len-1);", "}", "unlock_user(arm_cmdline_buffer, ARG(0), host_cmdline_len);", "unlock_user((void*)host_cmdline_buffer, ts->info->arg_start, 0);", "return (arm_cmdline_buffer && host_cmdline_buffer) ? 0 : -1;", "}", "#else\nreturn -1;", "#endif\ncase SYS_HEAPINFO:\n{", "uint32_t *ptr;", "uint32_t limit;", "#ifdef CONFIG_USER_ONLY\nif (!ts->heap_limit) {", "long ret;", "ts->heap_base = do_brk(0);", "limit = ts->heap_base + ARM_ANGEL_HEAP_SIZE;", "for (;;) {", "ret = do_brk(limit);", "if (ret != -1)\nbreak;", "limit = (ts->heap_base >> 1) + (limit >> 1);", "}", "ts->heap_limit = limit;", "}", "if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0)))\nreturn (uint32_t)-1;", "ptr[0] = tswap32(ts->heap_base);", "ptr[1] = tswap32(ts->heap_limit);", "ptr[2] = tswap32(ts->stack_base);", "ptr[3] = tswap32(0);", "unlock_user(ptr, ARG(0), 16);", "#else\nlimit = ram_size;", "if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0)))\nreturn (uint32_t)-1;", "ptr[0] = tswap32(limit / 2);", "ptr[1] = tswap32(limit);", "ptr[2] = tswap32(limit);", "ptr[3] = tswap32(0);", "unlock_user(ptr, ARG(0), 16);", "#endif\nreturn 0;", "}", "case SYS_EXIT:\ngdb_exit(env, 0);", "exit(0);", "default:\nfprintf(stderr, \"qemu: Unsupported SemiHosting SWI 0x%02x\\n\", VAR_1);", "cpu_dump_state(env, stderr, fprintf, 0);", "abort();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23, 27 ], [ 29 ], [ 31 ], [ 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 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 97, 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 121, 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, 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213, 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, 281 ], [ 283, 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293, 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307, 309 ], [ 311, 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325, 329 ], [ 331, 333 ], [ 335, 337 ], [ 339, 341 ], [ 343 ], [ 345 ], [ 347, 349 ], [ 351, 353 ], [ 355, 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365, 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379, 381, 383 ], [ 385, 387 ], [ 389, 391, 393, 397 ], [ 399 ], [ 401 ], [ 405 ], [ 407 ], [ 409, 411 ], [ 415 ], [ 417 ], [ 419 ], [ 423 ], [ 429 ], [ 431 ], [ 433 ], [ 439 ], [ 441 ], [ 443 ], [ 449, 451 ], [ 453, 455, 457 ], [ 461, 463 ], [ 469, 471 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 491 ], [ 493 ], [ 499 ], [ 501 ], [ 507 ], [ 509 ], [ 511, 513 ], [ 515, 517, 519 ], [ 521 ], [ 523 ], [ 527, 533 ], [ 535 ], [ 539 ], [ 541 ], [ 545 ], [ 547 ], [ 549, 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 563, 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579, 581 ], [ 583, 587 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601, 603 ], [ 605 ], [ 607, 609 ], [ 611 ], [ 613, 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ] ]
844
int inet_connect(const char *str, Error **errp) { QemuOpts *opts; int sock = -1; opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); if (inet_parse(opts, str) == 0) { sock = inet_connect_opts(opts, true, NULL, errp); } else { error_set(errp, QERR_SOCKET_CREATE_FAILED); } qemu_opts_del(opts); return sock; }
true
qemu
233aa5c2d1cf4655ffe335025a68cf5454f87dad
int inet_connect(const char *str, Error **errp) { QemuOpts *opts; int sock = -1; opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); if (inet_parse(opts, str) == 0) { sock = inet_connect_opts(opts, true, NULL, errp); } else { error_set(errp, QERR_SOCKET_CREATE_FAILED); } qemu_opts_del(opts); return sock; }
{ "code": [ " } else {", " sock = inet_connect_opts(opts, true, NULL, errp);" ], "line_no": [ 17, 15 ] }
int FUNC_0(const char *VAR_0, Error **VAR_1) { QemuOpts *opts; int VAR_2 = -1; opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); if (inet_parse(opts, VAR_0) == 0) { VAR_2 = inet_connect_opts(opts, true, NULL, VAR_1); } else { error_set(VAR_1, QERR_SOCKET_CREATE_FAILED); } qemu_opts_del(opts); return VAR_2; }
[ "int FUNC_0(const char *VAR_0, Error **VAR_1)\n{", "QemuOpts *opts;", "int VAR_2 = -1;", "opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);", "if (inet_parse(opts, VAR_0) == 0) {", "VAR_2 = inet_connect_opts(opts, true, NULL, VAR_1);", "} else {", "error_set(VAR_1, QERR_SOCKET_CREATE_FAILED);", "}", "qemu_opts_del(opts);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
845
static void do_interrupt_user(CPUX86State *env, int intno, int is_int, int error_code, target_ulong next_eip) { SegmentCache *dt; target_ulong ptr; int dpl, cpl, shift; uint32_t e2; dt = &env->idt; if (env->hflags & HF_LMA_MASK) { shift = 4; } else { shift = 3; } ptr = dt->base + (intno << shift); e2 = cpu_ldl_kernel(env, ptr + 4); dpl = (e2 >> DESC_DPL_SHIFT) & 3; cpl = env->hflags & HF_CPL_MASK; /* check privilege if software int */ if (is_int && dpl < cpl) { raise_exception_err(env, EXCP0D_GPF, (intno << shift) + 2); } /* Since we emulate only user space, we cannot do more than exiting the emulation with the suitable exception and error code. So update EIP for INT 0x80 and EXCP_SYSCALL. */ if (is_int || intno == EXCP_SYSCALL) { env->eip = next_eip; } }
true
qemu
885b7c44e4f8b7a012a92770a0dba8b238662caa
static void do_interrupt_user(CPUX86State *env, int intno, int is_int, int error_code, target_ulong next_eip) { SegmentCache *dt; target_ulong ptr; int dpl, cpl, shift; uint32_t e2; dt = &env->idt; if (env->hflags & HF_LMA_MASK) { shift = 4; } else { shift = 3; } ptr = dt->base + (intno << shift); e2 = cpu_ldl_kernel(env, ptr + 4); dpl = (e2 >> DESC_DPL_SHIFT) & 3; cpl = env->hflags & HF_CPL_MASK; if (is_int && dpl < cpl) { raise_exception_err(env, EXCP0D_GPF, (intno << shift) + 2); } if (is_int || intno == EXCP_SYSCALL) { env->eip = next_eip; } }
{ "code": [ " SegmentCache *dt;", " target_ulong ptr;", " int dpl, cpl, shift;", " uint32_t e2;", " dt = &env->idt;", " if (env->hflags & HF_LMA_MASK) {", " shift = 4;", " } else {", " shift = 3;", " ptr = dt->base + (intno << shift);", " e2 = cpu_ldl_kernel(env, ptr + 4);", " dpl = (e2 >> DESC_DPL_SHIFT) & 3;", " cpl = env->hflags & HF_CPL_MASK;", " if (is_int && dpl < cpl) {", " raise_exception_err(env, EXCP0D_GPF, (intno << shift) + 2);" ], "line_no": [ 7, 9, 11, 13, 17, 19, 21, 23, 25, 29, 31, 35, 37, 41, 43 ] }
static void FUNC_0(CPUX86State *VAR_0, int VAR_1, int VAR_2, int VAR_3, target_ulong VAR_4) { SegmentCache *dt; target_ulong ptr; int VAR_5, VAR_6, VAR_7; uint32_t e2; dt = &VAR_0->idt; if (VAR_0->hflags & HF_LMA_MASK) { VAR_7 = 4; } else { VAR_7 = 3; } ptr = dt->base + (VAR_1 << VAR_7); e2 = cpu_ldl_kernel(VAR_0, ptr + 4); VAR_5 = (e2 >> DESC_DPL_SHIFT) & 3; VAR_6 = VAR_0->hflags & HF_CPL_MASK; if (VAR_2 && VAR_5 < VAR_6) { raise_exception_err(VAR_0, EXCP0D_GPF, (VAR_1 << VAR_7) + 2); } if (VAR_2 || VAR_1 == EXCP_SYSCALL) { VAR_0->eip = VAR_4; } }
[ "static void FUNC_0(CPUX86State *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, target_ulong VAR_4)\n{", "SegmentCache *dt;", "target_ulong ptr;", "int VAR_5, VAR_6, VAR_7;", "uint32_t e2;", "dt = &VAR_0->idt;", "if (VAR_0->hflags & HF_LMA_MASK) {", "VAR_7 = 4;", "} else {", "VAR_7 = 3;", "}", "ptr = dt->base + (VAR_1 << VAR_7);", "e2 = cpu_ldl_kernel(VAR_0, ptr + 4);", "VAR_5 = (e2 >> DESC_DPL_SHIFT) & 3;", "VAR_6 = VAR_0->hflags & HF_CPL_MASK;", "if (VAR_2 && VAR_5 < VAR_6) {", "raise_exception_err(VAR_0, EXCP0D_GPF, (VAR_1 << VAR_7) + 2);", "}", "if (VAR_2 || VAR_1 == EXCP_SYSCALL) {", "VAR_0->eip = VAR_4;", "}", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
846
static int64_t load_kernel(void) { int64_t entry, kernel_high; long kernel_size, initrd_size, params_size; ram_addr_t initrd_offset; uint32_t *params_buf; int big_endian; #ifdef TARGET_WORDS_BIGENDIAN big_endian = 1; #else big_endian = 0; #endif kernel_size = load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys, NULL, (uint64_t *)&entry, NULL, (uint64_t *)&kernel_high, big_endian, ELF_MACHINE, 1); if (kernel_size >= 0) { if ((entry & ~0x7fffffffULL) == 0x80000000) entry = (int32_t)entry; } else { fprintf(stderr, "qemu: could not load kernel '%s'\n", loaderparams.kernel_filename); exit(1); } /* load initrd */ initrd_size = 0; initrd_offset = 0; if (loaderparams.initrd_filename) { initrd_size = get_image_size (loaderparams.initrd_filename); if (initrd_size > 0) { initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; if (initrd_offset + initrd_size > ram_size) { fprintf(stderr, "qemu: memory too small for initial ram disk '%s'\n", loaderparams.initrd_filename); exit(1); } initrd_size = load_image_targphys(loaderparams.initrd_filename, initrd_offset, ram_size - initrd_offset); } if (initrd_size == (target_ulong) -1) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", loaderparams.initrd_filename); exit(1); } } /* Store command line. */ params_size = 264; params_buf = g_malloc(params_size); params_buf[0] = tswap32(ram_size); params_buf[1] = tswap32(0x12345678); if (initrd_size > 0) { snprintf((char *)params_buf + 8, 256, "rd_start=0x%" PRIx64 " rd_size=%li %s", cpu_mips_phys_to_kseg0(NULL, initrd_offset), initrd_size, loaderparams.kernel_cmdline); } else { snprintf((char *)params_buf + 8, 256, "%s", loaderparams.kernel_cmdline); } rom_add_blob_fixed("params", params_buf, params_size, (16 << 20) - 264); return entry; }
true
qemu
3ad9fd5a257794d516db515c217c78a5806112fe
static int64_t load_kernel(void) { int64_t entry, kernel_high; long kernel_size, initrd_size, params_size; ram_addr_t initrd_offset; uint32_t *params_buf; int big_endian; #ifdef TARGET_WORDS_BIGENDIAN big_endian = 1; #else big_endian = 0; #endif kernel_size = load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys, NULL, (uint64_t *)&entry, NULL, (uint64_t *)&kernel_high, big_endian, ELF_MACHINE, 1); if (kernel_size >= 0) { if ((entry & ~0x7fffffffULL) == 0x80000000) entry = (int32_t)entry; } else { fprintf(stderr, "qemu: could not load kernel '%s'\n", loaderparams.kernel_filename); exit(1); } initrd_size = 0; initrd_offset = 0; if (loaderparams.initrd_filename) { initrd_size = get_image_size (loaderparams.initrd_filename); if (initrd_size > 0) { initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; if (initrd_offset + initrd_size > ram_size) { fprintf(stderr, "qemu: memory too small for initial ram disk '%s'\n", loaderparams.initrd_filename); exit(1); } initrd_size = load_image_targphys(loaderparams.initrd_filename, initrd_offset, ram_size - initrd_offset); } if (initrd_size == (target_ulong) -1) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", loaderparams.initrd_filename); exit(1); } } params_size = 264; params_buf = g_malloc(params_size); params_buf[0] = tswap32(ram_size); params_buf[1] = tswap32(0x12345678); if (initrd_size > 0) { snprintf((char *)params_buf + 8, 256, "rd_start=0x%" PRIx64 " rd_size=%li %s", cpu_mips_phys_to_kseg0(NULL, initrd_offset), initrd_size, loaderparams.kernel_cmdline); } else { snprintf((char *)params_buf + 8, 256, "%s", loaderparams.kernel_cmdline); } rom_add_blob_fixed("params", params_buf, params_size, (16 << 20) - 264); return entry; }
{ "code": [], "line_no": [] }
static int64_t FUNC_0(void) { int64_t entry, kernel_high; long VAR_0, VAR_1, VAR_2; ram_addr_t initrd_offset; uint32_t *params_buf; int VAR_3; #ifdef TARGET_WORDS_BIGENDIAN VAR_3 = 1; #else VAR_3 = 0; #endif VAR_0 = load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys, NULL, (uint64_t *)&entry, NULL, (uint64_t *)&kernel_high, VAR_3, ELF_MACHINE, 1); if (VAR_0 >= 0) { if ((entry & ~0x7fffffffULL) == 0x80000000) entry = (int32_t)entry; } else { fprintf(stderr, "qemu: could not load kernel '%s'\n", loaderparams.kernel_filename); exit(1); } VAR_1 = 0; initrd_offset = 0; if (loaderparams.initrd_filename) { VAR_1 = get_image_size (loaderparams.initrd_filename); if (VAR_1 > 0) { initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; if (initrd_offset + VAR_1 > ram_size) { fprintf(stderr, "qemu: memory too small for initial ram disk '%s'\n", loaderparams.initrd_filename); exit(1); } VAR_1 = load_image_targphys(loaderparams.initrd_filename, initrd_offset, ram_size - initrd_offset); } if (VAR_1 == (target_ulong) -1) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", loaderparams.initrd_filename); exit(1); } } VAR_2 = 264; params_buf = g_malloc(VAR_2); params_buf[0] = tswap32(ram_size); params_buf[1] = tswap32(0x12345678); if (VAR_1 > 0) { snprintf((char *)params_buf + 8, 256, "rd_start=0x%" PRIx64 " rd_size=%li %s", cpu_mips_phys_to_kseg0(NULL, initrd_offset), VAR_1, loaderparams.kernel_cmdline); } else { snprintf((char *)params_buf + 8, 256, "%s", loaderparams.kernel_cmdline); } rom_add_blob_fixed("params", params_buf, VAR_2, (16 << 20) - 264); return entry; }
[ "static int64_t FUNC_0(void)\n{", "int64_t entry, kernel_high;", "long VAR_0, VAR_1, VAR_2;", "ram_addr_t initrd_offset;", "uint32_t *params_buf;", "int VAR_3;", "#ifdef TARGET_WORDS_BIGENDIAN\nVAR_3 = 1;", "#else\nVAR_3 = 0;", "#endif\nVAR_0 = load_elf(loaderparams.kernel_filename, cpu_mips_kseg0_to_phys,\nNULL, (uint64_t *)&entry, NULL,\n(uint64_t *)&kernel_high, VAR_3,\nELF_MACHINE, 1);", "if (VAR_0 >= 0) {", "if ((entry & ~0x7fffffffULL) == 0x80000000)\nentry = (int32_t)entry;", "} else {", "fprintf(stderr, \"qemu: could not load kernel '%s'\\n\",\nloaderparams.kernel_filename);", "exit(1);", "}", "VAR_1 = 0;", "initrd_offset = 0;", "if (loaderparams.initrd_filename) {", "VAR_1 = get_image_size (loaderparams.initrd_filename);", "if (VAR_1 > 0) {", "initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK;", "if (initrd_offset + VAR_1 > ram_size) {", "fprintf(stderr,\n\"qemu: memory too small for initial ram disk '%s'\\n\",\nloaderparams.initrd_filename);", "exit(1);", "}", "VAR_1 = load_image_targphys(loaderparams.initrd_filename,\ninitrd_offset,\nram_size - initrd_offset);", "}", "if (VAR_1 == (target_ulong) -1) {", "fprintf(stderr, \"qemu: could not load initial ram disk '%s'\\n\",\nloaderparams.initrd_filename);", "exit(1);", "}", "}", "VAR_2 = 264;", "params_buf = g_malloc(VAR_2);", "params_buf[0] = tswap32(ram_size);", "params_buf[1] = tswap32(0x12345678);", "if (VAR_1 > 0) {", "snprintf((char *)params_buf + 8, 256, \"rd_start=0x%\" PRIx64 \" rd_size=%li %s\",\ncpu_mips_phys_to_kseg0(NULL, initrd_offset),\nVAR_1, loaderparams.kernel_cmdline);", "} else {", "snprintf((char *)params_buf + 8, 256, \"%s\", loaderparams.kernel_cmdline);", "}", "rom_add_blob_fixed(\"params\", params_buf, VAR_2,\n(16 << 20) - 264);", "return entry;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21, 23 ], [ 25, 27, 29, 31, 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71, 73 ], [ 75 ], [ 77 ], [ 79, 81, 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 115 ], [ 117, 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131, 133 ], [ 138 ], [ 140 ] ]
847
static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) { CinFrameHeader *hdr = &cin->frame_header; hdr->video_frame_type = avio_r8(pb); hdr->audio_frame_type = avio_r8(pb); hdr->pal_colors_count = avio_rl16(pb); hdr->video_frame_size = avio_rl32(pb); hdr->audio_frame_size = avio_rl32(pb); if (pb->eof_reached || pb->error) return AVERROR(EIO); if (avio_rl32(pb) != 0xAA55AA55) return 0; }
true
FFmpeg
48d6556dd46d4f4fac10d0f4a819e314887cd50e
static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) { CinFrameHeader *hdr = &cin->frame_header; hdr->video_frame_type = avio_r8(pb); hdr->audio_frame_type = avio_r8(pb); hdr->pal_colors_count = avio_rl16(pb); hdr->video_frame_size = avio_rl32(pb); hdr->audio_frame_size = avio_rl32(pb); if (pb->eof_reached || pb->error) return AVERROR(EIO); if (avio_rl32(pb) != 0xAA55AA55) return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(CinDemuxContext *VAR_0, AVIOContext *VAR_1) { CinFrameHeader *hdr = &VAR_0->frame_header; hdr->video_frame_type = avio_r8(VAR_1); hdr->audio_frame_type = avio_r8(VAR_1); hdr->pal_colors_count = avio_rl16(VAR_1); hdr->video_frame_size = avio_rl32(VAR_1); hdr->audio_frame_size = avio_rl32(VAR_1); if (VAR_1->eof_reached || VAR_1->error) return AVERROR(EIO); if (avio_rl32(VAR_1) != 0xAA55AA55) return 0; }
[ "static int FUNC_0(CinDemuxContext *VAR_0, AVIOContext *VAR_1) {", "CinFrameHeader *hdr = &VAR_0->frame_header;", "hdr->video_frame_type = avio_r8(VAR_1);", "hdr->audio_frame_type = avio_r8(VAR_1);", "hdr->pal_colors_count = avio_rl16(VAR_1);", "hdr->video_frame_size = avio_rl32(VAR_1);", "hdr->audio_frame_size = avio_rl32(VAR_1);", "if (VAR_1->eof_reached || VAR_1->error)\nreturn AVERROR(EIO);", "if (avio_rl32(VAR_1) != 0xAA55AA55)\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25, 32 ], [ 34 ] ]
849
static void test_endianness_combine(gconstpointer data) { const TestCase *test = data; char *args; args = g_strdup_printf("-display none -M %s%s%s -device pc-testdev", test->machine, test->superio ? " -device " : "", test->superio ?: ""); qtest_start(args); isa_outl(test, 0xe0, 0x87654321); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87654321); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4321); isa_outw(test, 0xe2, 0x8866); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x88664321); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8866); g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4321); isa_outw(test, 0xe0, 0x4422); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x88664422); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8866); g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4422); isa_outb(test, 0xe3, 0x87); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87664422); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8766); isa_outb(test, 0xe2, 0x65); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87654422); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4422); isa_outb(test, 0xe1, 0x43); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87654322); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4322); isa_outb(test, 0xe0, 0x21); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87654321); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4321); qtest_quit(global_qtest); g_free(args); }
true
qemu
2ad645d2854746b55ddfd1d8e951f689cca5d78f
static void test_endianness_combine(gconstpointer data) { const TestCase *test = data; char *args; args = g_strdup_printf("-display none -M %s%s%s -device pc-testdev", test->machine, test->superio ? " -device " : "", test->superio ?: ""); qtest_start(args); isa_outl(test, 0xe0, 0x87654321); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87654321); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4321); isa_outw(test, 0xe2, 0x8866); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x88664321); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8866); g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4321); isa_outw(test, 0xe0, 0x4422); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x88664422); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8866); g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4422); isa_outb(test, 0xe3, 0x87); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87664422); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8766); isa_outb(test, 0xe2, 0x65); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87654422); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4422); isa_outb(test, 0xe1, 0x43); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87654322); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4322); isa_outb(test, 0xe0, 0x21); g_assert_cmphex(isa_inl(test, 0xe8), ==, 0x87654321); g_assert_cmphex(isa_inw(test, 0xea), ==, 0x8765); g_assert_cmphex(isa_inw(test, 0xe8), ==, 0x4321); qtest_quit(global_qtest); g_free(args); }
{ "code": [ " args = g_strdup_printf(\"-display none -M %s%s%s -device pc-testdev\",", " args = g_strdup_printf(\"-display none -M %s%s%s -device pc-testdev\",", " args = g_strdup_printf(\"-display none -M %s%s%s -device pc-testdev\"," ], "line_no": [ 11, 11, 11 ] }
static void FUNC_0(gconstpointer VAR_0) { const TestCase *VAR_1 = VAR_0; char *VAR_2; VAR_2 = g_strdup_printf("-display none -M %s%s%s -device pc-testdev", VAR_1->machine, VAR_1->superio ? " -device " : "", VAR_1->superio ?: ""); qtest_start(VAR_2); isa_outl(VAR_1, 0xe0, 0x87654321); g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x87654321); g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8765); g_assert_cmphex(isa_inw(VAR_1, 0xe8), ==, 0x4321); isa_outw(VAR_1, 0xe2, 0x8866); g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x88664321); g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8866); g_assert_cmphex(isa_inw(VAR_1, 0xe8), ==, 0x4321); isa_outw(VAR_1, 0xe0, 0x4422); g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x88664422); g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8866); g_assert_cmphex(isa_inw(VAR_1, 0xe8), ==, 0x4422); isa_outb(VAR_1, 0xe3, 0x87); g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x87664422); g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8766); isa_outb(VAR_1, 0xe2, 0x65); g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x87654422); g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8765); g_assert_cmphex(isa_inw(VAR_1, 0xe8), ==, 0x4422); isa_outb(VAR_1, 0xe1, 0x43); g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x87654322); g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8765); g_assert_cmphex(isa_inw(VAR_1, 0xe8), ==, 0x4322); isa_outb(VAR_1, 0xe0, 0x21); g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x87654321); g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8765); g_assert_cmphex(isa_inw(VAR_1, 0xe8), ==, 0x4321); qtest_quit(global_qtest); g_free(VAR_2); }
[ "static void FUNC_0(gconstpointer VAR_0)\n{", "const TestCase *VAR_1 = VAR_0;", "char *VAR_2;", "VAR_2 = g_strdup_printf(\"-display none -M %s%s%s -device pc-testdev\",\nVAR_1->machine,\nVAR_1->superio ? \" -device \" : \"\",\nVAR_1->superio ?: \"\");", "qtest_start(VAR_2);", "isa_outl(VAR_1, 0xe0, 0x87654321);", "g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x87654321);", "g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8765);", "g_assert_cmphex(isa_inw(VAR_1, 0xe8), ==, 0x4321);", "isa_outw(VAR_1, 0xe2, 0x8866);", "g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x88664321);", "g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8866);", "g_assert_cmphex(isa_inw(VAR_1, 0xe8), ==, 0x4321);", "isa_outw(VAR_1, 0xe0, 0x4422);", "g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x88664422);", "g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8866);", "g_assert_cmphex(isa_inw(VAR_1, 0xe8), ==, 0x4422);", "isa_outb(VAR_1, 0xe3, 0x87);", "g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x87664422);", "g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8766);", "isa_outb(VAR_1, 0xe2, 0x65);", "g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x87654422);", "g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8765);", "g_assert_cmphex(isa_inw(VAR_1, 0xe8), ==, 0x4422);", "isa_outb(VAR_1, 0xe1, 0x43);", "g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x87654322);", "g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8765);", "g_assert_cmphex(isa_inw(VAR_1, 0xe8), ==, 0x4322);", "isa_outb(VAR_1, 0xe0, 0x21);", "g_assert_cmphex(isa_inl(VAR_1, 0xe8), ==, 0x87654321);", "g_assert_cmphex(isa_inw(VAR_1, 0xea), ==, 0x8765);", "g_assert_cmphex(isa_inw(VAR_1, 0xe8), ==, 0x4321);", "qtest_quit(global_qtest);", "g_free(VAR_2);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13, 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ] ]
851
int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height) { int i; if (pix_fmt != AV_PIX_FMT_YUV420P && pix_fmt != AV_PIX_FMT_YUVJ420P && pix_fmt != AV_PIX_FMT_YUV422P && pix_fmt != AV_PIX_FMT_YUVJ422P && pix_fmt != AV_PIX_FMT_YUV444P && pix_fmt != AV_PIX_FMT_YUV411P && pix_fmt != AV_PIX_FMT_GRAY8) return -1; if ((width & 3) != 0 || (height & 3) != 0) return -1; for(i=0;i<3;i++) { if (i == 1) { switch(pix_fmt) { case AV_PIX_FMT_YUVJ420P: case AV_PIX_FMT_YUV420P: width >>= 1; height >>= 1; break; case AV_PIX_FMT_YUV422P: case AV_PIX_FMT_YUVJ422P: width >>= 1; break; case AV_PIX_FMT_YUV411P: width >>= 2; break; default: break; } if (pix_fmt == AV_PIX_FMT_GRAY8) { break; } } if (src == dst) { deinterlace_bottom_field_inplace(dst->data[i], dst->linesize[i], width, height); } else { deinterlace_bottom_field(dst->data[i],dst->linesize[i], src->data[i], src->linesize[i], width, height); } } emms_c(); return 0; }
false
FFmpeg
210461c0a83a5625560fa1d92229200dc7fb869b
int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height) { int i; if (pix_fmt != AV_PIX_FMT_YUV420P && pix_fmt != AV_PIX_FMT_YUVJ420P && pix_fmt != AV_PIX_FMT_YUV422P && pix_fmt != AV_PIX_FMT_YUVJ422P && pix_fmt != AV_PIX_FMT_YUV444P && pix_fmt != AV_PIX_FMT_YUV411P && pix_fmt != AV_PIX_FMT_GRAY8) return -1; if ((width & 3) != 0 || (height & 3) != 0) return -1; for(i=0;i<3;i++) { if (i == 1) { switch(pix_fmt) { case AV_PIX_FMT_YUVJ420P: case AV_PIX_FMT_YUV420P: width >>= 1; height >>= 1; break; case AV_PIX_FMT_YUV422P: case AV_PIX_FMT_YUVJ422P: width >>= 1; break; case AV_PIX_FMT_YUV411P: width >>= 2; break; default: break; } if (pix_fmt == AV_PIX_FMT_GRAY8) { break; } } if (src == dst) { deinterlace_bottom_field_inplace(dst->data[i], dst->linesize[i], width, height); } else { deinterlace_bottom_field(dst->data[i],dst->linesize[i], src->data[i], src->linesize[i], width, height); } } emms_c(); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVPicture *VAR_0, const AVPicture *VAR_1, enum AVPixelFormat VAR_2, int VAR_3, int VAR_4) { int VAR_5; if (VAR_2 != AV_PIX_FMT_YUV420P && VAR_2 != AV_PIX_FMT_YUVJ420P && VAR_2 != AV_PIX_FMT_YUV422P && VAR_2 != AV_PIX_FMT_YUVJ422P && VAR_2 != AV_PIX_FMT_YUV444P && VAR_2 != AV_PIX_FMT_YUV411P && VAR_2 != AV_PIX_FMT_GRAY8) return -1; if ((VAR_3 & 3) != 0 || (VAR_4 & 3) != 0) return -1; for(VAR_5=0;VAR_5<3;VAR_5++) { if (VAR_5 == 1) { switch(VAR_2) { case AV_PIX_FMT_YUVJ420P: case AV_PIX_FMT_YUV420P: VAR_3 >>= 1; VAR_4 >>= 1; break; case AV_PIX_FMT_YUV422P: case AV_PIX_FMT_YUVJ422P: VAR_3 >>= 1; break; case AV_PIX_FMT_YUV411P: VAR_3 >>= 2; break; default: break; } if (VAR_2 == AV_PIX_FMT_GRAY8) { break; } } if (VAR_1 == VAR_0) { deinterlace_bottom_field_inplace(VAR_0->data[VAR_5], VAR_0->linesize[VAR_5], VAR_3, VAR_4); } else { deinterlace_bottom_field(VAR_0->data[VAR_5],VAR_0->linesize[VAR_5], VAR_1->data[VAR_5], VAR_1->linesize[VAR_5], VAR_3, VAR_4); } } emms_c(); return 0; }
[ "int FUNC_0(AVPicture *VAR_0, const AVPicture *VAR_1,\nenum AVPixelFormat VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5;", "if (VAR_2 != AV_PIX_FMT_YUV420P &&\nVAR_2 != AV_PIX_FMT_YUVJ420P &&\nVAR_2 != AV_PIX_FMT_YUV422P &&\nVAR_2 != AV_PIX_FMT_YUVJ422P &&\nVAR_2 != AV_PIX_FMT_YUV444P &&\nVAR_2 != AV_PIX_FMT_YUV411P &&\nVAR_2 != AV_PIX_FMT_GRAY8)\nreturn -1;", "if ((VAR_3 & 3) != 0 || (VAR_4 & 3) != 0)\nreturn -1;", "for(VAR_5=0;VAR_5<3;VAR_5++) {", "if (VAR_5 == 1) {", "switch(VAR_2) {", "case AV_PIX_FMT_YUVJ420P:\ncase AV_PIX_FMT_YUV420P:\nVAR_3 >>= 1;", "VAR_4 >>= 1;", "break;", "case AV_PIX_FMT_YUV422P:\ncase AV_PIX_FMT_YUVJ422P:\nVAR_3 >>= 1;", "break;", "case AV_PIX_FMT_YUV411P:\nVAR_3 >>= 2;", "break;", "default:\nbreak;", "}", "if (VAR_2 == AV_PIX_FMT_GRAY8) {", "break;", "}", "}", "if (VAR_1 == VAR_0) {", "deinterlace_bottom_field_inplace(VAR_0->data[VAR_5], VAR_0->linesize[VAR_5],\nVAR_3, VAR_4);", "} else {", "deinterlace_bottom_field(VAR_0->data[VAR_5],VAR_0->linesize[VAR_5],\nVAR_1->data[VAR_5], VAR_1->linesize[VAR_5],\nVAR_3, VAR_4);", "}", "}", "emms_c();", "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 ], [ 11, 13, 15, 17, 19, 21, 23, 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 49, 51, 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85, 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ] ]
852
static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2, ptrdiff_t dststride, AVFrame *ref, const Mv *mv, int x_off, int y_off, int block_w, int block_h) { HEVCLocalContext *lc = &s->HEVClc; uint8_t *src1 = ref->data[1]; uint8_t *src2 = ref->data[2]; ptrdiff_t src1stride = ref->linesize[1]; ptrdiff_t src2stride = ref->linesize[2]; int pic_width = s->ps.sps->width >> 1; int pic_height = s->ps.sps->height >> 1; int mx = mv->x & 7; int my = mv->y & 7; x_off += mv->x >> 3; y_off += mv->y >> 3; src1 += y_off * src1stride + (x_off << s->ps.sps->pixel_shift); src2 += y_off * src2stride + (x_off << s->ps.sps->pixel_shift); if (x_off < EPEL_EXTRA_BEFORE || y_off < EPEL_EXTRA_AFTER || x_off >= pic_width - block_w - EPEL_EXTRA_AFTER || y_off >= pic_height - block_h - EPEL_EXTRA_AFTER) { const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift; int offset1 = EPEL_EXTRA_BEFORE * (src1stride + (1 << s->ps.sps->pixel_shift)); int buf_offset1 = EPEL_EXTRA_BEFORE * (edge_emu_stride + (1 << s->ps.sps->pixel_shift)); int offset2 = EPEL_EXTRA_BEFORE * (src2stride + (1 << s->ps.sps->pixel_shift)); int buf_offset2 = EPEL_EXTRA_BEFORE * (edge_emu_stride + (1 << s->ps.sps->pixel_shift)); s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src1 - offset1, edge_emu_stride, src1stride, block_w + EPEL_EXTRA, block_h + EPEL_EXTRA, x_off - EPEL_EXTRA_BEFORE, y_off - EPEL_EXTRA_BEFORE, pic_width, pic_height); src1 = lc->edge_emu_buffer + buf_offset1; src1stride = edge_emu_stride; s->hevcdsp.put_hevc_epel[!!my][!!mx](dst1, dststride, src1, src1stride, block_w, block_h, mx, my, lc->mc_buffer); s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src2 - offset2, edge_emu_stride, src2stride, block_w + EPEL_EXTRA, block_h + EPEL_EXTRA, x_off - EPEL_EXTRA_BEFORE, y_off - EPEL_EXTRA_BEFORE, pic_width, pic_height); src2 = lc->edge_emu_buffer + buf_offset2; src2stride = edge_emu_stride; s->hevcdsp.put_hevc_epel[!!my][!!mx](dst2, dststride, src2, src2stride, block_w, block_h, mx, my, lc->mc_buffer); } else { s->hevcdsp.put_hevc_epel[!!my][!!mx](dst1, dststride, src1, src1stride, block_w, block_h, mx, my, lc->mc_buffer); s->hevcdsp.put_hevc_epel[!!my][!!mx](dst2, dststride, src2, src2stride, block_w, block_h, mx, my, lc->mc_buffer); } }
false
FFmpeg
a1926a29fb4325afa46842883f197c74d4535c36
static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2, ptrdiff_t dststride, AVFrame *ref, const Mv *mv, int x_off, int y_off, int block_w, int block_h) { HEVCLocalContext *lc = &s->HEVClc; uint8_t *src1 = ref->data[1]; uint8_t *src2 = ref->data[2]; ptrdiff_t src1stride = ref->linesize[1]; ptrdiff_t src2stride = ref->linesize[2]; int pic_width = s->ps.sps->width >> 1; int pic_height = s->ps.sps->height >> 1; int mx = mv->x & 7; int my = mv->y & 7; x_off += mv->x >> 3; y_off += mv->y >> 3; src1 += y_off * src1stride + (x_off << s->ps.sps->pixel_shift); src2 += y_off * src2stride + (x_off << s->ps.sps->pixel_shift); if (x_off < EPEL_EXTRA_BEFORE || y_off < EPEL_EXTRA_AFTER || x_off >= pic_width - block_w - EPEL_EXTRA_AFTER || y_off >= pic_height - block_h - EPEL_EXTRA_AFTER) { const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift; int offset1 = EPEL_EXTRA_BEFORE * (src1stride + (1 << s->ps.sps->pixel_shift)); int buf_offset1 = EPEL_EXTRA_BEFORE * (edge_emu_stride + (1 << s->ps.sps->pixel_shift)); int offset2 = EPEL_EXTRA_BEFORE * (src2stride + (1 << s->ps.sps->pixel_shift)); int buf_offset2 = EPEL_EXTRA_BEFORE * (edge_emu_stride + (1 << s->ps.sps->pixel_shift)); s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src1 - offset1, edge_emu_stride, src1stride, block_w + EPEL_EXTRA, block_h + EPEL_EXTRA, x_off - EPEL_EXTRA_BEFORE, y_off - EPEL_EXTRA_BEFORE, pic_width, pic_height); src1 = lc->edge_emu_buffer + buf_offset1; src1stride = edge_emu_stride; s->hevcdsp.put_hevc_epel[!!my][!!mx](dst1, dststride, src1, src1stride, block_w, block_h, mx, my, lc->mc_buffer); s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src2 - offset2, edge_emu_stride, src2stride, block_w + EPEL_EXTRA, block_h + EPEL_EXTRA, x_off - EPEL_EXTRA_BEFORE, y_off - EPEL_EXTRA_BEFORE, pic_width, pic_height); src2 = lc->edge_emu_buffer + buf_offset2; src2stride = edge_emu_stride; s->hevcdsp.put_hevc_epel[!!my][!!mx](dst2, dststride, src2, src2stride, block_w, block_h, mx, my, lc->mc_buffer); } else { s->hevcdsp.put_hevc_epel[!!my][!!mx](dst1, dststride, src1, src1stride, block_w, block_h, mx, my, lc->mc_buffer); s->hevcdsp.put_hevc_epel[!!my][!!mx](dst2, dststride, src2, src2stride, block_w, block_h, mx, my, lc->mc_buffer); } }
{ "code": [], "line_no": [] }
static void FUNC_0(HEVCContext *VAR_0, int16_t *VAR_1, int16_t *VAR_2, ptrdiff_t VAR_3, AVFrame *VAR_4, const Mv *VAR_5, int VAR_6, int VAR_7, int VAR_8, int VAR_9) { HEVCLocalContext *lc = &VAR_0->HEVClc; uint8_t *src1 = VAR_4->data[1]; uint8_t *src2 = VAR_4->data[2]; ptrdiff_t src1stride = VAR_4->linesize[1]; ptrdiff_t src2stride = VAR_4->linesize[2]; int VAR_10 = VAR_0->ps.sps->width >> 1; int VAR_11 = VAR_0->ps.sps->height >> 1; int VAR_12 = VAR_5->x & 7; int VAR_13 = VAR_5->y & 7; VAR_6 += VAR_5->x >> 3; VAR_7 += VAR_5->y >> 3; src1 += VAR_7 * src1stride + (VAR_6 << VAR_0->ps.sps->pixel_shift); src2 += VAR_7 * src2stride + (VAR_6 << VAR_0->ps.sps->pixel_shift); if (VAR_6 < EPEL_EXTRA_BEFORE || VAR_7 < EPEL_EXTRA_AFTER || VAR_6 >= VAR_10 - VAR_8 - EPEL_EXTRA_AFTER || VAR_7 >= VAR_11 - VAR_9 - EPEL_EXTRA_AFTER) { const int VAR_14 = EDGE_EMU_BUFFER_STRIDE << VAR_0->ps.sps->pixel_shift; int VAR_15 = EPEL_EXTRA_BEFORE * (src1stride + (1 << VAR_0->ps.sps->pixel_shift)); int VAR_16 = EPEL_EXTRA_BEFORE * (VAR_14 + (1 << VAR_0->ps.sps->pixel_shift)); int VAR_17 = EPEL_EXTRA_BEFORE * (src2stride + (1 << VAR_0->ps.sps->pixel_shift)); int VAR_18 = EPEL_EXTRA_BEFORE * (VAR_14 + (1 << VAR_0->ps.sps->pixel_shift)); VAR_0->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src1 - VAR_15, VAR_14, src1stride, VAR_8 + EPEL_EXTRA, VAR_9 + EPEL_EXTRA, VAR_6 - EPEL_EXTRA_BEFORE, VAR_7 - EPEL_EXTRA_BEFORE, VAR_10, VAR_11); src1 = lc->edge_emu_buffer + VAR_16; src1stride = VAR_14; VAR_0->hevcdsp.put_hevc_epel[!!VAR_13][!!VAR_12](VAR_1, VAR_3, src1, src1stride, VAR_8, VAR_9, VAR_12, VAR_13, lc->mc_buffer); VAR_0->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src2 - VAR_17, VAR_14, src2stride, VAR_8 + EPEL_EXTRA, VAR_9 + EPEL_EXTRA, VAR_6 - EPEL_EXTRA_BEFORE, VAR_7 - EPEL_EXTRA_BEFORE, VAR_10, VAR_11); src2 = lc->edge_emu_buffer + VAR_18; src2stride = VAR_14; VAR_0->hevcdsp.put_hevc_epel[!!VAR_13][!!VAR_12](VAR_2, VAR_3, src2, src2stride, VAR_8, VAR_9, VAR_12, VAR_13, lc->mc_buffer); } else { VAR_0->hevcdsp.put_hevc_epel[!!VAR_13][!!VAR_12](VAR_1, VAR_3, src1, src1stride, VAR_8, VAR_9, VAR_12, VAR_13, lc->mc_buffer); VAR_0->hevcdsp.put_hevc_epel[!!VAR_13][!!VAR_12](VAR_2, VAR_3, src2, src2stride, VAR_8, VAR_9, VAR_12, VAR_13, lc->mc_buffer); } }
[ "static void FUNC_0(HEVCContext *VAR_0, int16_t *VAR_1, int16_t *VAR_2,\nptrdiff_t VAR_3, AVFrame *VAR_4, const Mv *VAR_5,\nint VAR_6, int VAR_7, int VAR_8, int VAR_9)\n{", "HEVCLocalContext *lc = &VAR_0->HEVClc;", "uint8_t *src1 = VAR_4->data[1];", "uint8_t *src2 = VAR_4->data[2];", "ptrdiff_t src1stride = VAR_4->linesize[1];", "ptrdiff_t src2stride = VAR_4->linesize[2];", "int VAR_10 = VAR_0->ps.sps->width >> 1;", "int VAR_11 = VAR_0->ps.sps->height >> 1;", "int VAR_12 = VAR_5->x & 7;", "int VAR_13 = VAR_5->y & 7;", "VAR_6 += VAR_5->x >> 3;", "VAR_7 += VAR_5->y >> 3;", "src1 += VAR_7 * src1stride + (VAR_6 << VAR_0->ps.sps->pixel_shift);", "src2 += VAR_7 * src2stride + (VAR_6 << VAR_0->ps.sps->pixel_shift);", "if (VAR_6 < EPEL_EXTRA_BEFORE || VAR_7 < EPEL_EXTRA_AFTER ||\nVAR_6 >= VAR_10 - VAR_8 - EPEL_EXTRA_AFTER ||\nVAR_7 >= VAR_11 - VAR_9 - EPEL_EXTRA_AFTER) {", "const int VAR_14 = EDGE_EMU_BUFFER_STRIDE << VAR_0->ps.sps->pixel_shift;", "int VAR_15 = EPEL_EXTRA_BEFORE * (src1stride + (1 << VAR_0->ps.sps->pixel_shift));", "int VAR_16 = EPEL_EXTRA_BEFORE *\n(VAR_14 + (1 << VAR_0->ps.sps->pixel_shift));", "int VAR_17 = EPEL_EXTRA_BEFORE * (src2stride + (1 << VAR_0->ps.sps->pixel_shift));", "int VAR_18 = EPEL_EXTRA_BEFORE *\n(VAR_14 + (1 << VAR_0->ps.sps->pixel_shift));", "VAR_0->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src1 - VAR_15,\nVAR_14, src1stride,\nVAR_8 + EPEL_EXTRA, VAR_9 + EPEL_EXTRA,\nVAR_6 - EPEL_EXTRA_BEFORE,\nVAR_7 - EPEL_EXTRA_BEFORE,\nVAR_10, VAR_11);", "src1 = lc->edge_emu_buffer + VAR_16;", "src1stride = VAR_14;", "VAR_0->hevcdsp.put_hevc_epel[!!VAR_13][!!VAR_12](VAR_1, VAR_3, src1, src1stride,\nVAR_8, VAR_9, VAR_12, VAR_13, lc->mc_buffer);", "VAR_0->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src2 - VAR_17,\nVAR_14, src2stride,\nVAR_8 + EPEL_EXTRA, VAR_9 + EPEL_EXTRA,\nVAR_6 - EPEL_EXTRA_BEFORE,\nVAR_7 - EPEL_EXTRA_BEFORE,\nVAR_10, VAR_11);", "src2 = lc->edge_emu_buffer + VAR_18;", "src2stride = VAR_14;", "VAR_0->hevcdsp.put_hevc_epel[!!VAR_13][!!VAR_12](VAR_2, VAR_3, src2, src2stride,\nVAR_8, VAR_9, VAR_12, VAR_13,\nlc->mc_buffer);", "} else {", "VAR_0->hevcdsp.put_hevc_epel[!!VAR_13][!!VAR_12](VAR_1, VAR_3, src1, src1stride,\nVAR_8, VAR_9, VAR_12, VAR_13,\nlc->mc_buffer);", "VAR_0->hevcdsp.put_hevc_epel[!!VAR_13][!!VAR_12](VAR_2, VAR_3, src2, src2stride,\nVAR_8, VAR_9, VAR_12, VAR_13,\nlc->mc_buffer);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43, 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 63, 65, 67, 69, 71, 73 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 87, 89, 91, 93, 95, 97 ], [ 99 ], [ 101 ], [ 105, 107, 109 ], [ 111 ], [ 113, 115, 117 ], [ 119, 121, 123 ], [ 125 ], [ 127 ] ]
853
static void mpegts_push_data(void *opaque, const uint8_t *buf, int buf_size, int is_start) { PESContext *pes = opaque; MpegTSContext *ts = pes->stream->priv_data; AVStream *st; const uint8_t *p; int len, code, codec_type, codec_id; if (is_start) { pes->state = MPEGTS_HEADER; pes->data_index = 0; } p = buf; while (buf_size > 0) { switch(pes->state) { case MPEGTS_HEADER: len = PES_START_SIZE - pes->data_index; if (len > buf_size) len = buf_size; memcpy(pes->header + pes->data_index, p, len); pes->data_index += len; p += len; buf_size -= len; if (pes->data_index == PES_START_SIZE) { /* we got all the PES or section header. We can now decide */ #if 0 av_hex_dump(pes->header, pes->data_index); #endif if (pes->header[0] == 0x00 && pes->header[1] == 0x00 && pes->header[2] == 0x01) { /* it must be an mpeg2 PES stream */ /* XXX: add AC3 support */ code = pes->header[3] | 0x100; if (!((code >= 0x1c0 && code <= 0x1df) || (code >= 0x1e0 && code <= 0x1ef))) goto skip; if (!pes->st) { /* allocate stream */ if (code >= 0x1c0 && code <= 0x1df) { codec_type = CODEC_TYPE_AUDIO; codec_id = CODEC_ID_MP2; } else { codec_type = CODEC_TYPE_VIDEO; codec_id = CODEC_ID_MPEG1VIDEO; } st = av_new_stream(pes->stream, pes->pid); if (st) { st->priv_data = pes; st->codec.codec_type = codec_type; st->codec.codec_id = codec_id; pes->st = st; } } pes->state = MPEGTS_PESHEADER_FILL; pes->total_size = (pes->header[4] << 8) | pes->header[5]; /* NOTE: a zero total size means the PES size is unbounded */ if (pes->total_size) pes->total_size += 6; pes->pes_header_size = pes->header[8] + 9; } else { /* otherwise, it should be a table */ /* skip packet */ skip: pes->state = MPEGTS_SKIP; continue; } } break; /**********************************************/ /* PES packing parsing */ case MPEGTS_PESHEADER_FILL: len = pes->pes_header_size - pes->data_index; if (len > buf_size) len = buf_size; memcpy(pes->header + pes->data_index, p, len); pes->data_index += len; p += len; buf_size -= len; if (pes->data_index == pes->pes_header_size) { const uint8_t *r; unsigned int flags; flags = pes->header[7]; r = pes->header + 9; pes->pts = AV_NOPTS_VALUE; pes->dts = AV_NOPTS_VALUE; if ((flags & 0xc0) == 0x80) { pes->pts = get_pts(r); r += 5; } else if ((flags & 0xc0) == 0xc0) { pes->pts = get_pts(r); r += 5; pes->dts = get_pts(r); r += 5; } /* we got the full header. We parse it and get the payload */ pes->state = MPEGTS_PAYLOAD; } break; case MPEGTS_PAYLOAD: if (pes->total_size) { len = pes->total_size - pes->data_index; if (len > buf_size) len = buf_size; } else { len = buf_size; } if (len > 0) { AVPacket *pkt = ts->pkt; if (pes->st && av_new_packet(pkt, len) == 0) { memcpy(pkt->data, p, len); pkt->stream_index = pes->st->index; pkt->pts = pes->pts; /* reset pts values */ pes->pts = AV_NOPTS_VALUE; pes->dts = AV_NOPTS_VALUE; ts->stop_parse = 1; return; } } buf_size = 0; break; case MPEGTS_SKIP: buf_size = 0; break; } } }
false
FFmpeg
ec23a47286a9be0ca67b78f4d8b9d87220c18286
static void mpegts_push_data(void *opaque, const uint8_t *buf, int buf_size, int is_start) { PESContext *pes = opaque; MpegTSContext *ts = pes->stream->priv_data; AVStream *st; const uint8_t *p; int len, code, codec_type, codec_id; if (is_start) { pes->state = MPEGTS_HEADER; pes->data_index = 0; } p = buf; while (buf_size > 0) { switch(pes->state) { case MPEGTS_HEADER: len = PES_START_SIZE - pes->data_index; if (len > buf_size) len = buf_size; memcpy(pes->header + pes->data_index, p, len); pes->data_index += len; p += len; buf_size -= len; if (pes->data_index == PES_START_SIZE) { #if 0 av_hex_dump(pes->header, pes->data_index); #endif if (pes->header[0] == 0x00 && pes->header[1] == 0x00 && pes->header[2] == 0x01) { code = pes->header[3] | 0x100; if (!((code >= 0x1c0 && code <= 0x1df) || (code >= 0x1e0 && code <= 0x1ef))) goto skip; if (!pes->st) { if (code >= 0x1c0 && code <= 0x1df) { codec_type = CODEC_TYPE_AUDIO; codec_id = CODEC_ID_MP2; } else { codec_type = CODEC_TYPE_VIDEO; codec_id = CODEC_ID_MPEG1VIDEO; } st = av_new_stream(pes->stream, pes->pid); if (st) { st->priv_data = pes; st->codec.codec_type = codec_type; st->codec.codec_id = codec_id; pes->st = st; } } pes->state = MPEGTS_PESHEADER_FILL; pes->total_size = (pes->header[4] << 8) | pes->header[5]; if (pes->total_size) pes->total_size += 6; pes->pes_header_size = pes->header[8] + 9; } else { skip: pes->state = MPEGTS_SKIP; continue; } } break; case MPEGTS_PESHEADER_FILL: len = pes->pes_header_size - pes->data_index; if (len > buf_size) len = buf_size; memcpy(pes->header + pes->data_index, p, len); pes->data_index += len; p += len; buf_size -= len; if (pes->data_index == pes->pes_header_size) { const uint8_t *r; unsigned int flags; flags = pes->header[7]; r = pes->header + 9; pes->pts = AV_NOPTS_VALUE; pes->dts = AV_NOPTS_VALUE; if ((flags & 0xc0) == 0x80) { pes->pts = get_pts(r); r += 5; } else if ((flags & 0xc0) == 0xc0) { pes->pts = get_pts(r); r += 5; pes->dts = get_pts(r); r += 5; } pes->state = MPEGTS_PAYLOAD; } break; case MPEGTS_PAYLOAD: if (pes->total_size) { len = pes->total_size - pes->data_index; if (len > buf_size) len = buf_size; } else { len = buf_size; } if (len > 0) { AVPacket *pkt = ts->pkt; if (pes->st && av_new_packet(pkt, len) == 0) { memcpy(pkt->data, p, len); pkt->stream_index = pes->st->index; pkt->pts = pes->pts; pes->pts = AV_NOPTS_VALUE; pes->dts = AV_NOPTS_VALUE; ts->stop_parse = 1; return; } } buf_size = 0; break; case MPEGTS_SKIP: buf_size = 0; break; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3) { PESContext *pes = VAR_0; MpegTSContext *ts = pes->stream->priv_data; AVStream *st; const uint8_t *VAR_4; int VAR_5, VAR_6, VAR_7, VAR_8; if (VAR_3) { pes->state = MPEGTS_HEADER; pes->data_index = 0; } VAR_4 = VAR_1; while (VAR_2 > 0) { switch(pes->state) { case MPEGTS_HEADER: VAR_5 = PES_START_SIZE - pes->data_index; if (VAR_5 > VAR_2) VAR_5 = VAR_2; memcpy(pes->header + pes->data_index, VAR_4, VAR_5); pes->data_index += VAR_5; VAR_4 += VAR_5; VAR_2 -= VAR_5; if (pes->data_index == PES_START_SIZE) { #if 0 av_hex_dump(pes->header, pes->data_index); #endif if (pes->header[0] == 0x00 && pes->header[1] == 0x00 && pes->header[2] == 0x01) { VAR_6 = pes->header[3] | 0x100; if (!((VAR_6 >= 0x1c0 && VAR_6 <= 0x1df) || (VAR_6 >= 0x1e0 && VAR_6 <= 0x1ef))) goto skip; if (!pes->st) { if (VAR_6 >= 0x1c0 && VAR_6 <= 0x1df) { VAR_7 = CODEC_TYPE_AUDIO; VAR_8 = CODEC_ID_MP2; } else { VAR_7 = CODEC_TYPE_VIDEO; VAR_8 = CODEC_ID_MPEG1VIDEO; } st = av_new_stream(pes->stream, pes->pid); if (st) { st->priv_data = pes; st->codec.VAR_7 = VAR_7; st->codec.VAR_8 = VAR_8; pes->st = st; } } pes->state = MPEGTS_PESHEADER_FILL; pes->total_size = (pes->header[4] << 8) | pes->header[5]; if (pes->total_size) pes->total_size += 6; pes->pes_header_size = pes->header[8] + 9; } else { skip: pes->state = MPEGTS_SKIP; continue; } } break; case MPEGTS_PESHEADER_FILL: VAR_5 = pes->pes_header_size - pes->data_index; if (VAR_5 > VAR_2) VAR_5 = VAR_2; memcpy(pes->header + pes->data_index, VAR_4, VAR_5); pes->data_index += VAR_5; VAR_4 += VAR_5; VAR_2 -= VAR_5; if (pes->data_index == pes->pes_header_size) { const uint8_t *VAR_9; unsigned int VAR_10; VAR_10 = pes->header[7]; VAR_9 = pes->header + 9; pes->pts = AV_NOPTS_VALUE; pes->dts = AV_NOPTS_VALUE; if ((VAR_10 & 0xc0) == 0x80) { pes->pts = get_pts(VAR_9); VAR_9 += 5; } else if ((VAR_10 & 0xc0) == 0xc0) { pes->pts = get_pts(VAR_9); VAR_9 += 5; pes->dts = get_pts(VAR_9); VAR_9 += 5; } pes->state = MPEGTS_PAYLOAD; } break; case MPEGTS_PAYLOAD: if (pes->total_size) { VAR_5 = pes->total_size - pes->data_index; if (VAR_5 > VAR_2) VAR_5 = VAR_2; } else { VAR_5 = VAR_2; } if (VAR_5 > 0) { AVPacket *pkt = ts->pkt; if (pes->st && av_new_packet(pkt, VAR_5) == 0) { memcpy(pkt->data, VAR_4, VAR_5); pkt->stream_index = pes->st->index; pkt->pts = pes->pts; pes->pts = AV_NOPTS_VALUE; pes->dts = AV_NOPTS_VALUE; ts->stop_parse = 1; return; } } VAR_2 = 0; break; case MPEGTS_SKIP: VAR_2 = 0; break; } } }
[ "static void FUNC_0(void *VAR_0,\nconst uint8_t *VAR_1, int VAR_2, int VAR_3)\n{", "PESContext *pes = VAR_0;", "MpegTSContext *ts = pes->stream->priv_data;", "AVStream *st;", "const uint8_t *VAR_4;", "int VAR_5, VAR_6, VAR_7, VAR_8;", "if (VAR_3) {", "pes->state = MPEGTS_HEADER;", "pes->data_index = 0;", "}", "VAR_4 = VAR_1;", "while (VAR_2 > 0) {", "switch(pes->state) {", "case MPEGTS_HEADER:\nVAR_5 = PES_START_SIZE - pes->data_index;", "if (VAR_5 > VAR_2)\nVAR_5 = VAR_2;", "memcpy(pes->header + pes->data_index, VAR_4, VAR_5);", "pes->data_index += VAR_5;", "VAR_4 += VAR_5;", "VAR_2 -= VAR_5;", "if (pes->data_index == PES_START_SIZE) {", "#if 0\nav_hex_dump(pes->header, pes->data_index);", "#endif\nif (pes->header[0] == 0x00 && pes->header[1] == 0x00 &&\npes->header[2] == 0x01) {", "VAR_6 = pes->header[3] | 0x100;", "if (!((VAR_6 >= 0x1c0 && VAR_6 <= 0x1df) ||\n(VAR_6 >= 0x1e0 && VAR_6 <= 0x1ef)))\ngoto skip;", "if (!pes->st) {", "if (VAR_6 >= 0x1c0 && VAR_6 <= 0x1df) {", "VAR_7 = CODEC_TYPE_AUDIO;", "VAR_8 = CODEC_ID_MP2;", "} else {", "VAR_7 = CODEC_TYPE_VIDEO;", "VAR_8 = CODEC_ID_MPEG1VIDEO;", "}", "st = av_new_stream(pes->stream, pes->pid);", "if (st) {", "st->priv_data = pes;", "st->codec.VAR_7 = VAR_7;", "st->codec.VAR_8 = VAR_8;", "pes->st = st;", "}", "}", "pes->state = MPEGTS_PESHEADER_FILL;", "pes->total_size = (pes->header[4] << 8) | pes->header[5];", "if (pes->total_size)\npes->total_size += 6;", "pes->pes_header_size = pes->header[8] + 9;", "} else {", "skip:\npes->state = MPEGTS_SKIP;", "continue;", "}", "}", "break;", "case MPEGTS_PESHEADER_FILL:\nVAR_5 = pes->pes_header_size - pes->data_index;", "if (VAR_5 > VAR_2)\nVAR_5 = VAR_2;", "memcpy(pes->header + pes->data_index, VAR_4, VAR_5);", "pes->data_index += VAR_5;", "VAR_4 += VAR_5;", "VAR_2 -= VAR_5;", "if (pes->data_index == pes->pes_header_size) {", "const uint8_t *VAR_9;", "unsigned int VAR_10;", "VAR_10 = pes->header[7];", "VAR_9 = pes->header + 9;", "pes->pts = AV_NOPTS_VALUE;", "pes->dts = AV_NOPTS_VALUE;", "if ((VAR_10 & 0xc0) == 0x80) {", "pes->pts = get_pts(VAR_9);", "VAR_9 += 5;", "} else if ((VAR_10 & 0xc0) == 0xc0) {", "pes->pts = get_pts(VAR_9);", "VAR_9 += 5;", "pes->dts = get_pts(VAR_9);", "VAR_9 += 5;", "}", "pes->state = MPEGTS_PAYLOAD;", "}", "break;", "case MPEGTS_PAYLOAD:\nif (pes->total_size) {", "VAR_5 = pes->total_size - pes->data_index;", "if (VAR_5 > VAR_2)\nVAR_5 = VAR_2;", "} else {", "VAR_5 = VAR_2;", "}", "if (VAR_5 > 0) {", "AVPacket *pkt = ts->pkt;", "if (pes->st && av_new_packet(pkt, VAR_5) == 0) {", "memcpy(pkt->data, VAR_4, VAR_5);", "pkt->stream_index = pes->st->index;", "pkt->pts = pes->pts;", "pes->pts = AV_NOPTS_VALUE;", "pes->dts = AV_NOPTS_VALUE;", "ts->stop_parse = 1;", "return;", "}", "}", "VAR_2 = 0;", "break;", "case MPEGTS_SKIP:\nVAR_2 = 0;", "break;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 55, 57 ], [ 59, 61, 63 ], [ 69 ], [ 71, 73, 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 147, 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251, 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ] ]
856
static bool gscb_needed(void *opaque) { return kvm_s390_get_gs(); }
true
qemu
0280b3eb7c0519b43452c05cf51f8777d9e38975
static bool gscb_needed(void *opaque) { return kvm_s390_get_gs(); }
{ "code": [ " return kvm_s390_get_gs();" ], "line_no": [ 5 ] }
static bool FUNC_0(void *opaque) { return kvm_s390_get_gs(); }
[ "static bool FUNC_0(void *opaque)\n{", "return kvm_s390_get_gs();", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
857
void do_fctiw (void) { union { double d; uint64_t i; } p; /* XXX: higher bits are not supposed to be significant. * to make tests easier, return the same as a real PowerPC 750 (aka G3) */ p.i = float64_to_int32(FT0, &env->fp_status); p.i |= 0xFFF80000ULL << 32; FT0 = p.d; }
true
qemu
e864cabdc0a38bb598ddcf88b264896dc6f3e3b2
void do_fctiw (void) { union { double d; uint64_t i; } p; p.i = float64_to_int32(FT0, &env->fp_status); p.i |= 0xFFF80000ULL << 32; FT0 = p.d; }
{ "code": [ " p.i = float64_to_int32(FT0, &env->fp_status);" ], "line_no": [ 21 ] }
void FUNC_0 (void) { union { double d; uint64_t i; } VAR_0; VAR_0.i = float64_to_int32(FT0, &env->fp_status); VAR_0.i |= 0xFFF80000ULL << 32; FT0 = VAR_0.d; }
[ "void FUNC_0 (void)\n{", "union {", "double d;", "uint64_t i;", "} VAR_0;", "VAR_0.i = float64_to_int32(FT0, &env->fp_status);", "VAR_0.i |= 0xFFF80000ULL << 32;", "FT0 = VAR_0.d;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
858
static struct omap_mpu_timer_s *omap_mpu_timer_init(MemoryRegion *system_memory, hwaddr base, qemu_irq irq, omap_clk clk) { struct omap_mpu_timer_s *s = (struct omap_mpu_timer_s *) g_malloc0(sizeof(struct omap_mpu_timer_s)); s->irq = irq; s->clk = clk; s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_timer_tick, s); s->tick = qemu_bh_new(omap_timer_fire, s); omap_mpu_timer_reset(s); omap_timer_clk_setup(s); memory_region_init_io(&s->iomem, NULL, &omap_mpu_timer_ops, s, "omap-mpu-timer", 0x100); memory_region_add_subregion(system_memory, base, &s->iomem); return s; }
true
qemu
b45c03f585ea9bb1af76c73e82195418c294919d
static struct omap_mpu_timer_s *omap_mpu_timer_init(MemoryRegion *system_memory, hwaddr base, qemu_irq irq, omap_clk clk) { struct omap_mpu_timer_s *s = (struct omap_mpu_timer_s *) g_malloc0(sizeof(struct omap_mpu_timer_s)); s->irq = irq; s->clk = clk; s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_timer_tick, s); s->tick = qemu_bh_new(omap_timer_fire, s); omap_mpu_timer_reset(s); omap_timer_clk_setup(s); memory_region_init_io(&s->iomem, NULL, &omap_mpu_timer_ops, s, "omap-mpu-timer", 0x100); memory_region_add_subregion(system_memory, base, &s->iomem); return s; }
{ "code": [ " struct omap_mpu_timer_s *s = (struct omap_mpu_timer_s *)", " g_malloc0(sizeof(struct omap_mpu_timer_s));" ], "line_no": [ 9, 11 ] }
static struct omap_mpu_timer_s *FUNC_0(MemoryRegion *VAR_0, hwaddr VAR_1, qemu_irq VAR_2, omap_clk VAR_3) { struct omap_mpu_timer_s *VAR_4 = (struct omap_mpu_timer_s *) g_malloc0(sizeof(struct omap_mpu_timer_s)); VAR_4->VAR_2 = VAR_2; VAR_4->VAR_3 = VAR_3; VAR_4->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_timer_tick, VAR_4); VAR_4->tick = qemu_bh_new(omap_timer_fire, VAR_4); omap_mpu_timer_reset(VAR_4); omap_timer_clk_setup(VAR_4); memory_region_init_io(&VAR_4->iomem, NULL, &omap_mpu_timer_ops, VAR_4, "omap-mpu-timer", 0x100); memory_region_add_subregion(VAR_0, VAR_1, &VAR_4->iomem); return VAR_4; }
[ "static struct omap_mpu_timer_s *FUNC_0(MemoryRegion *VAR_0,\nhwaddr VAR_1,\nqemu_irq VAR_2, omap_clk VAR_3)\n{", "struct omap_mpu_timer_s *VAR_4 = (struct omap_mpu_timer_s *)\ng_malloc0(sizeof(struct omap_mpu_timer_s));", "VAR_4->VAR_2 = VAR_2;", "VAR_4->VAR_3 = VAR_3;", "VAR_4->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_timer_tick, VAR_4);", "VAR_4->tick = qemu_bh_new(omap_timer_fire, VAR_4);", "omap_mpu_timer_reset(VAR_4);", "omap_timer_clk_setup(VAR_4);", "memory_region_init_io(&VAR_4->iomem, NULL, &omap_mpu_timer_ops, VAR_4,\n\"omap-mpu-timer\", 0x100);", "memory_region_add_subregion(VAR_0, VAR_1, &VAR_4->iomem);", "return VAR_4;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35 ], [ 39 ], [ 41 ] ]
861
static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { LibOpenJPEGContext *ctx = avctx->priv_data; opj_cinfo_t *compress = ctx->compress; opj_image_t *image = ctx->image; opj_cio_t *stream = ctx->stream; int cpyresult = 0; int ret, len; AVFrame *gbrframe; switch (avctx->pix_fmt) { case AV_PIX_FMT_RGB24: case AV_PIX_FMT_RGBA: case AV_PIX_FMT_GRAY8A: cpyresult = libopenjpeg_copy_packed8(avctx, frame, image); break; case AV_PIX_FMT_XYZ12: cpyresult = libopenjpeg_copy_packed12(avctx, frame, image); break; case AV_PIX_FMT_RGB48: case AV_PIX_FMT_RGBA64: cpyresult = libopenjpeg_copy_packed16(avctx, frame, image); break; case AV_PIX_FMT_GBR24P: case AV_PIX_FMT_GBRP9: case AV_PIX_FMT_GBRP10: case AV_PIX_FMT_GBRP12: case AV_PIX_FMT_GBRP14: case AV_PIX_FMT_GBRP16: gbrframe = av_frame_alloc(); av_frame_ref(gbrframe, frame); gbrframe->data[0] = frame->data[2]; // swap to be rgb gbrframe->data[1] = frame->data[0]; gbrframe->data[2] = frame->data[1]; gbrframe->linesize[0] = frame->linesize[2]; gbrframe->linesize[1] = frame->linesize[0]; gbrframe->linesize[2] = frame->linesize[1]; if (avctx->pix_fmt == AV_PIX_FMT_GBR24P) { cpyresult = libopenjpeg_copy_unpacked8(avctx, gbrframe, image); } else { cpyresult = libopenjpeg_copy_unpacked16(avctx, gbrframe, image); } av_frame_free(&gbrframe); break; case AV_PIX_FMT_GRAY8: case AV_PIX_FMT_YUV410P: case AV_PIX_FMT_YUV411P: case AV_PIX_FMT_YUV420P: case AV_PIX_FMT_YUV422P: case AV_PIX_FMT_YUV440P: case AV_PIX_FMT_YUV444P: case AV_PIX_FMT_YUVA420P: case AV_PIX_FMT_YUVA422P: case AV_PIX_FMT_YUVA444P: cpyresult = libopenjpeg_copy_unpacked8(avctx, frame, image); break; case AV_PIX_FMT_GRAY16: case AV_PIX_FMT_YUV420P9: case AV_PIX_FMT_YUV422P9: case AV_PIX_FMT_YUV444P9: case AV_PIX_FMT_YUVA420P9: case AV_PIX_FMT_YUVA422P9: case AV_PIX_FMT_YUVA444P9: case AV_PIX_FMT_YUV444P10: case AV_PIX_FMT_YUV422P10: case AV_PIX_FMT_YUV420P10: case AV_PIX_FMT_YUVA444P10: case AV_PIX_FMT_YUVA422P10: case AV_PIX_FMT_YUVA420P10: case AV_PIX_FMT_YUV420P12: case AV_PIX_FMT_YUV422P12: case AV_PIX_FMT_YUV444P12: case AV_PIX_FMT_YUV420P14: case AV_PIX_FMT_YUV422P14: case AV_PIX_FMT_YUV444P14: case AV_PIX_FMT_YUV444P16: case AV_PIX_FMT_YUV422P16: case AV_PIX_FMT_YUV420P16: case AV_PIX_FMT_YUVA444P16: case AV_PIX_FMT_YUVA422P16: case AV_PIX_FMT_YUVA420P16: cpyresult = libopenjpeg_copy_unpacked16(avctx, frame, image); break; default: av_log(avctx, AV_LOG_ERROR, "The frame's pixel format '%s' is not supported\n", av_get_pix_fmt_name(avctx->pix_fmt)); return AVERROR(EINVAL); break; } if (!cpyresult) { av_log(avctx, AV_LOG_ERROR, "Could not copy the frame data to the internal image buffer\n"); return -1; } cio_seek(stream, 0); if (!opj_encode(compress, stream, image, NULL)) { av_log(avctx, AV_LOG_ERROR, "Error during the opj encode\n"); return -1; } len = cio_tell(stream); if ((ret = ff_alloc_packet2(avctx, pkt, len)) < 0) { return ret; } memcpy(pkt->data, stream->buffer, len); pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; return 0; }
true
FFmpeg
97af2faaba70c866ae4c11459a79a16d4a014530
static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { LibOpenJPEGContext *ctx = avctx->priv_data; opj_cinfo_t *compress = ctx->compress; opj_image_t *image = ctx->image; opj_cio_t *stream = ctx->stream; int cpyresult = 0; int ret, len; AVFrame *gbrframe; switch (avctx->pix_fmt) { case AV_PIX_FMT_RGB24: case AV_PIX_FMT_RGBA: case AV_PIX_FMT_GRAY8A: cpyresult = libopenjpeg_copy_packed8(avctx, frame, image); break; case AV_PIX_FMT_XYZ12: cpyresult = libopenjpeg_copy_packed12(avctx, frame, image); break; case AV_PIX_FMT_RGB48: case AV_PIX_FMT_RGBA64: cpyresult = libopenjpeg_copy_packed16(avctx, frame, image); break; case AV_PIX_FMT_GBR24P: case AV_PIX_FMT_GBRP9: case AV_PIX_FMT_GBRP10: case AV_PIX_FMT_GBRP12: case AV_PIX_FMT_GBRP14: case AV_PIX_FMT_GBRP16: gbrframe = av_frame_alloc(); av_frame_ref(gbrframe, frame); gbrframe->data[0] = frame->data[2]; gbrframe->data[1] = frame->data[0]; gbrframe->data[2] = frame->data[1]; gbrframe->linesize[0] = frame->linesize[2]; gbrframe->linesize[1] = frame->linesize[0]; gbrframe->linesize[2] = frame->linesize[1]; if (avctx->pix_fmt == AV_PIX_FMT_GBR24P) { cpyresult = libopenjpeg_copy_unpacked8(avctx, gbrframe, image); } else { cpyresult = libopenjpeg_copy_unpacked16(avctx, gbrframe, image); } av_frame_free(&gbrframe); break; case AV_PIX_FMT_GRAY8: case AV_PIX_FMT_YUV410P: case AV_PIX_FMT_YUV411P: case AV_PIX_FMT_YUV420P: case AV_PIX_FMT_YUV422P: case AV_PIX_FMT_YUV440P: case AV_PIX_FMT_YUV444P: case AV_PIX_FMT_YUVA420P: case AV_PIX_FMT_YUVA422P: case AV_PIX_FMT_YUVA444P: cpyresult = libopenjpeg_copy_unpacked8(avctx, frame, image); break; case AV_PIX_FMT_GRAY16: case AV_PIX_FMT_YUV420P9: case AV_PIX_FMT_YUV422P9: case AV_PIX_FMT_YUV444P9: case AV_PIX_FMT_YUVA420P9: case AV_PIX_FMT_YUVA422P9: case AV_PIX_FMT_YUVA444P9: case AV_PIX_FMT_YUV444P10: case AV_PIX_FMT_YUV422P10: case AV_PIX_FMT_YUV420P10: case AV_PIX_FMT_YUVA444P10: case AV_PIX_FMT_YUVA422P10: case AV_PIX_FMT_YUVA420P10: case AV_PIX_FMT_YUV420P12: case AV_PIX_FMT_YUV422P12: case AV_PIX_FMT_YUV444P12: case AV_PIX_FMT_YUV420P14: case AV_PIX_FMT_YUV422P14: case AV_PIX_FMT_YUV444P14: case AV_PIX_FMT_YUV444P16: case AV_PIX_FMT_YUV422P16: case AV_PIX_FMT_YUV420P16: case AV_PIX_FMT_YUVA444P16: case AV_PIX_FMT_YUVA422P16: case AV_PIX_FMT_YUVA420P16: cpyresult = libopenjpeg_copy_unpacked16(avctx, frame, image); break; default: av_log(avctx, AV_LOG_ERROR, "The frame's pixel format '%s' is not supported\n", av_get_pix_fmt_name(avctx->pix_fmt)); return AVERROR(EINVAL); break; } if (!cpyresult) { av_log(avctx, AV_LOG_ERROR, "Could not copy the frame data to the internal image buffer\n"); return -1; } cio_seek(stream, 0); if (!opj_encode(compress, stream, image, NULL)) { av_log(avctx, AV_LOG_ERROR, "Error during the opj encode\n"); return -1; } len = cio_tell(stream); if ((ret = ff_alloc_packet2(avctx, pkt, len)) < 0) { return ret; } memcpy(pkt->data, stream->buffer, len); pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { LibOpenJPEGContext *ctx = VAR_0->priv_data; opj_cinfo_t *compress = ctx->compress; opj_image_t *image = ctx->image; opj_cio_t *stream = ctx->stream; int VAR_4 = 0; int VAR_5, VAR_6; AVFrame *gbrframe; switch (VAR_0->pix_fmt) { case AV_PIX_FMT_RGB24: case AV_PIX_FMT_RGBA: case AV_PIX_FMT_GRAY8A: VAR_4 = libopenjpeg_copy_packed8(VAR_0, VAR_2, image); break; case AV_PIX_FMT_XYZ12: VAR_4 = libopenjpeg_copy_packed12(VAR_0, VAR_2, image); break; case AV_PIX_FMT_RGB48: case AV_PIX_FMT_RGBA64: VAR_4 = libopenjpeg_copy_packed16(VAR_0, VAR_2, image); break; case AV_PIX_FMT_GBR24P: case AV_PIX_FMT_GBRP9: case AV_PIX_FMT_GBRP10: case AV_PIX_FMT_GBRP12: case AV_PIX_FMT_GBRP14: case AV_PIX_FMT_GBRP16: gbrframe = av_frame_alloc(); av_frame_ref(gbrframe, VAR_2); gbrframe->data[0] = VAR_2->data[2]; gbrframe->data[1] = VAR_2->data[0]; gbrframe->data[2] = VAR_2->data[1]; gbrframe->linesize[0] = VAR_2->linesize[2]; gbrframe->linesize[1] = VAR_2->linesize[0]; gbrframe->linesize[2] = VAR_2->linesize[1]; if (VAR_0->pix_fmt == AV_PIX_FMT_GBR24P) { VAR_4 = libopenjpeg_copy_unpacked8(VAR_0, gbrframe, image); } else { VAR_4 = libopenjpeg_copy_unpacked16(VAR_0, gbrframe, image); } av_frame_free(&gbrframe); break; case AV_PIX_FMT_GRAY8: case AV_PIX_FMT_YUV410P: case AV_PIX_FMT_YUV411P: case AV_PIX_FMT_YUV420P: case AV_PIX_FMT_YUV422P: case AV_PIX_FMT_YUV440P: case AV_PIX_FMT_YUV444P: case AV_PIX_FMT_YUVA420P: case AV_PIX_FMT_YUVA422P: case AV_PIX_FMT_YUVA444P: VAR_4 = libopenjpeg_copy_unpacked8(VAR_0, VAR_2, image); break; case AV_PIX_FMT_GRAY16: case AV_PIX_FMT_YUV420P9: case AV_PIX_FMT_YUV422P9: case AV_PIX_FMT_YUV444P9: case AV_PIX_FMT_YUVA420P9: case AV_PIX_FMT_YUVA422P9: case AV_PIX_FMT_YUVA444P9: case AV_PIX_FMT_YUV444P10: case AV_PIX_FMT_YUV422P10: case AV_PIX_FMT_YUV420P10: case AV_PIX_FMT_YUVA444P10: case AV_PIX_FMT_YUVA422P10: case AV_PIX_FMT_YUVA420P10: case AV_PIX_FMT_YUV420P12: case AV_PIX_FMT_YUV422P12: case AV_PIX_FMT_YUV444P12: case AV_PIX_FMT_YUV420P14: case AV_PIX_FMT_YUV422P14: case AV_PIX_FMT_YUV444P14: case AV_PIX_FMT_YUV444P16: case AV_PIX_FMT_YUV422P16: case AV_PIX_FMT_YUV420P16: case AV_PIX_FMT_YUVA444P16: case AV_PIX_FMT_YUVA422P16: case AV_PIX_FMT_YUVA420P16: VAR_4 = libopenjpeg_copy_unpacked16(VAR_0, VAR_2, image); break; default: av_log(VAR_0, AV_LOG_ERROR, "The VAR_2's pixel format '%s' is not supported\n", av_get_pix_fmt_name(VAR_0->pix_fmt)); return AVERROR(EINVAL); break; } if (!VAR_4) { av_log(VAR_0, AV_LOG_ERROR, "Could not copy the VAR_2 data to the internal image buffer\n"); return -1; } cio_seek(stream, 0); if (!opj_encode(compress, stream, image, NULL)) { av_log(VAR_0, AV_LOG_ERROR, "Error during the opj encode\n"); return -1; } VAR_6 = cio_tell(stream); if ((VAR_5 = ff_alloc_packet2(VAR_0, VAR_1, VAR_6)) < 0) { return VAR_5; } memcpy(VAR_1->data, stream->buffer, VAR_6); VAR_1->flags |= AV_PKT_FLAG_KEY; *VAR_3 = 1; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "LibOpenJPEGContext *ctx = VAR_0->priv_data;", "opj_cinfo_t *compress = ctx->compress;", "opj_image_t *image = ctx->image;", "opj_cio_t *stream = ctx->stream;", "int VAR_4 = 0;", "int VAR_5, VAR_6;", "AVFrame *gbrframe;", "switch (VAR_0->pix_fmt) {", "case AV_PIX_FMT_RGB24:\ncase AV_PIX_FMT_RGBA:\ncase AV_PIX_FMT_GRAY8A:\nVAR_4 = libopenjpeg_copy_packed8(VAR_0, VAR_2, image);", "break;", "case AV_PIX_FMT_XYZ12:\nVAR_4 = libopenjpeg_copy_packed12(VAR_0, VAR_2, image);", "break;", "case AV_PIX_FMT_RGB48:\ncase AV_PIX_FMT_RGBA64:\nVAR_4 = libopenjpeg_copy_packed16(VAR_0, VAR_2, image);", "break;", "case AV_PIX_FMT_GBR24P:\ncase AV_PIX_FMT_GBRP9:\ncase AV_PIX_FMT_GBRP10:\ncase AV_PIX_FMT_GBRP12:\ncase AV_PIX_FMT_GBRP14:\ncase AV_PIX_FMT_GBRP16:\ngbrframe = av_frame_alloc();", "av_frame_ref(gbrframe, VAR_2);", "gbrframe->data[0] = VAR_2->data[2];", "gbrframe->data[1] = VAR_2->data[0];", "gbrframe->data[2] = VAR_2->data[1];", "gbrframe->linesize[0] = VAR_2->linesize[2];", "gbrframe->linesize[1] = VAR_2->linesize[0];", "gbrframe->linesize[2] = VAR_2->linesize[1];", "if (VAR_0->pix_fmt == AV_PIX_FMT_GBR24P) {", "VAR_4 = libopenjpeg_copy_unpacked8(VAR_0, gbrframe, image);", "} else {", "VAR_4 = libopenjpeg_copy_unpacked16(VAR_0, gbrframe, image);", "}", "av_frame_free(&gbrframe);", "break;", "case AV_PIX_FMT_GRAY8:\ncase AV_PIX_FMT_YUV410P:\ncase AV_PIX_FMT_YUV411P:\ncase AV_PIX_FMT_YUV420P:\ncase AV_PIX_FMT_YUV422P:\ncase AV_PIX_FMT_YUV440P:\ncase AV_PIX_FMT_YUV444P:\ncase AV_PIX_FMT_YUVA420P:\ncase AV_PIX_FMT_YUVA422P:\ncase AV_PIX_FMT_YUVA444P:\nVAR_4 = libopenjpeg_copy_unpacked8(VAR_0, VAR_2, image);", "break;", "case AV_PIX_FMT_GRAY16:\ncase AV_PIX_FMT_YUV420P9:\ncase AV_PIX_FMT_YUV422P9:\ncase AV_PIX_FMT_YUV444P9:\ncase AV_PIX_FMT_YUVA420P9:\ncase AV_PIX_FMT_YUVA422P9:\ncase AV_PIX_FMT_YUVA444P9:\ncase AV_PIX_FMT_YUV444P10:\ncase AV_PIX_FMT_YUV422P10:\ncase AV_PIX_FMT_YUV420P10:\ncase AV_PIX_FMT_YUVA444P10:\ncase AV_PIX_FMT_YUVA422P10:\ncase AV_PIX_FMT_YUVA420P10:\ncase AV_PIX_FMT_YUV420P12:\ncase AV_PIX_FMT_YUV422P12:\ncase AV_PIX_FMT_YUV444P12:\ncase AV_PIX_FMT_YUV420P14:\ncase AV_PIX_FMT_YUV422P14:\ncase AV_PIX_FMT_YUV444P14:\ncase AV_PIX_FMT_YUV444P16:\ncase AV_PIX_FMT_YUV422P16:\ncase AV_PIX_FMT_YUV420P16:\ncase AV_PIX_FMT_YUVA444P16:\ncase AV_PIX_FMT_YUVA422P16:\ncase AV_PIX_FMT_YUVA420P16:\nVAR_4 = libopenjpeg_copy_unpacked16(VAR_0, VAR_2, image);", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR,\n\"The VAR_2's pixel format '%s' is not supported\\n\",\nav_get_pix_fmt_name(VAR_0->pix_fmt));", "return AVERROR(EINVAL);", "break;", "}", "if (!VAR_4) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Could not copy the VAR_2 data to the internal image buffer\\n\");", "return -1;", "}", "cio_seek(stream, 0);", "if (!opj_encode(compress, stream, image, NULL)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Error during the opj encode\\n\");", "return -1;", "}", "VAR_6 = cio_tell(stream);", "if ((VAR_5 = ff_alloc_packet2(VAR_0, VAR_1, VAR_6)) < 0) {", "return VAR_5;", "}", "memcpy(VAR_1->data, stream->buffer, VAR_6);", "VAR_1->flags |= AV_PKT_FLAG_KEY;", "*VAR_3 = 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27, 29, 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41, 43, 45 ], [ 47 ], [ 49, 51, 53, 55, 57, 59, 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113 ], [ 115 ], [ 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167 ], [ 169 ], [ 171, 173, 175, 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ] ]
862
static void termsig_handler(int signum) { state = TERMINATE; qemu_notify_event(); }
true
qemu
23994a5f524aa575c7a4b2e5250f17b127d2cf2f
static void termsig_handler(int signum) { state = TERMINATE; qemu_notify_event(); }
{ "code": [ " state = TERMINATE;" ], "line_no": [ 5 ] }
static void FUNC_0(int VAR_0) { state = TERMINATE; qemu_notify_event(); }
[ "static void FUNC_0(int VAR_0)\n{", "state = TERMINATE;", "qemu_notify_event();", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
864
static int qxl_post_load(void *opaque, int version) { PCIQXLDevice* d = opaque; uint8_t *ram_start = d->vga.vram_ptr; QXLCommandExt *cmds; int in, out, newmode; assert(d->last_release_offset < d->vga.vram_size); if (d->last_release_offset == 0) { d->last_release = NULL; } else { d->last_release = (QXLReleaseInfo *)(ram_start + d->last_release_offset); } d->modes = (QXLModes*)((uint8_t*)d->rom + d->rom->modes_offset); trace_qxl_post_load(d->id, qxl_mode_to_string(d->mode)); newmode = d->mode; d->mode = QXL_MODE_UNDEFINED; switch (newmode) { case QXL_MODE_UNDEFINED: qxl_create_memslots(d); break; case QXL_MODE_VGA: qxl_create_memslots(d); qxl_enter_vga_mode(d); break; case QXL_MODE_NATIVE: qxl_create_memslots(d); qxl_create_guest_primary(d, 1, QXL_SYNC); /* replay surface-create and cursor-set commands */ cmds = g_malloc0(sizeof(QXLCommandExt) * (d->ssd.num_surfaces + 1)); for (in = 0, out = 0; in < d->ssd.num_surfaces; in++) { if (d->guest_surfaces.cmds[in] == 0) { continue; } cmds[out].cmd.data = d->guest_surfaces.cmds[in]; cmds[out].cmd.type = QXL_CMD_SURFACE; cmds[out].group_id = MEMSLOT_GROUP_GUEST; out++; } if (d->guest_cursor) { cmds[out].cmd.data = d->guest_cursor; cmds[out].cmd.type = QXL_CMD_CURSOR; cmds[out].group_id = MEMSLOT_GROUP_GUEST; out++; } qxl_spice_loadvm_commands(d, cmds, out); g_free(cmds); if (d->guest_monitors_config) { qxl_spice_monitors_config_async(d, 1); } break; case QXL_MODE_COMPAT: /* note: no need to call qxl_create_memslots, qxl_set_mode * creates the mem slot. */ qxl_set_mode(d, d->shadow_rom.mode, 1); break; } return 0; }
true
qemu
9de68637dff05a18d0eafcff2737e551b70bc490
static int qxl_post_load(void *opaque, int version) { PCIQXLDevice* d = opaque; uint8_t *ram_start = d->vga.vram_ptr; QXLCommandExt *cmds; int in, out, newmode; assert(d->last_release_offset < d->vga.vram_size); if (d->last_release_offset == 0) { d->last_release = NULL; } else { d->last_release = (QXLReleaseInfo *)(ram_start + d->last_release_offset); } d->modes = (QXLModes*)((uint8_t*)d->rom + d->rom->modes_offset); trace_qxl_post_load(d->id, qxl_mode_to_string(d->mode)); newmode = d->mode; d->mode = QXL_MODE_UNDEFINED; switch (newmode) { case QXL_MODE_UNDEFINED: qxl_create_memslots(d); break; case QXL_MODE_VGA: qxl_create_memslots(d); qxl_enter_vga_mode(d); break; case QXL_MODE_NATIVE: qxl_create_memslots(d); qxl_create_guest_primary(d, 1, QXL_SYNC); cmds = g_malloc0(sizeof(QXLCommandExt) * (d->ssd.num_surfaces + 1)); for (in = 0, out = 0; in < d->ssd.num_surfaces; in++) { if (d->guest_surfaces.cmds[in] == 0) { continue; } cmds[out].cmd.data = d->guest_surfaces.cmds[in]; cmds[out].cmd.type = QXL_CMD_SURFACE; cmds[out].group_id = MEMSLOT_GROUP_GUEST; out++; } if (d->guest_cursor) { cmds[out].cmd.data = d->guest_cursor; cmds[out].cmd.type = QXL_CMD_CURSOR; cmds[out].group_id = MEMSLOT_GROUP_GUEST; out++; } qxl_spice_loadvm_commands(d, cmds, out); g_free(cmds); if (d->guest_monitors_config) { qxl_spice_monitors_config_async(d, 1); } break; case QXL_MODE_COMPAT: qxl_set_mode(d, d->shadow_rom.mode, 1); break; } return 0; }
{ "code": [ " cmds = g_malloc0(sizeof(QXLCommandExt) * (d->ssd.num_surfaces + 1));" ], "line_no": [ 67 ] }
static int FUNC_0(void *VAR_0, int VAR_1) { PCIQXLDevice* d = VAR_0; uint8_t *ram_start = d->vga.vram_ptr; QXLCommandExt *cmds; int VAR_2, VAR_3, VAR_4; assert(d->last_release_offset < d->vga.vram_size); if (d->last_release_offset == 0) { d->last_release = NULL; } else { d->last_release = (QXLReleaseInfo *)(ram_start + d->last_release_offset); } d->modes = (QXLModes*)((uint8_t*)d->rom + d->rom->modes_offset); trace_qxl_post_load(d->id, qxl_mode_to_string(d->mode)); VAR_4 = d->mode; d->mode = QXL_MODE_UNDEFINED; switch (VAR_4) { case QXL_MODE_UNDEFINED: qxl_create_memslots(d); break; case QXL_MODE_VGA: qxl_create_memslots(d); qxl_enter_vga_mode(d); break; case QXL_MODE_NATIVE: qxl_create_memslots(d); qxl_create_guest_primary(d, 1, QXL_SYNC); cmds = g_malloc0(sizeof(QXLCommandExt) * (d->ssd.num_surfaces + 1)); for (VAR_2 = 0, VAR_3 = 0; VAR_2 < d->ssd.num_surfaces; VAR_2++) { if (d->guest_surfaces.cmds[VAR_2] == 0) { continue; } cmds[VAR_3].cmd.data = d->guest_surfaces.cmds[VAR_2]; cmds[VAR_3].cmd.type = QXL_CMD_SURFACE; cmds[VAR_3].group_id = MEMSLOT_GROUP_GUEST; VAR_3++; } if (d->guest_cursor) { cmds[VAR_3].cmd.data = d->guest_cursor; cmds[VAR_3].cmd.type = QXL_CMD_CURSOR; cmds[VAR_3].group_id = MEMSLOT_GROUP_GUEST; VAR_3++; } qxl_spice_loadvm_commands(d, cmds, VAR_3); g_free(cmds); if (d->guest_monitors_config) { qxl_spice_monitors_config_async(d, 1); } break; case QXL_MODE_COMPAT: qxl_set_mode(d, d->shadow_rom.mode, 1); break; } return 0; }
[ "static int FUNC_0(void *VAR_0, int VAR_1)\n{", "PCIQXLDevice* d = VAR_0;", "uint8_t *ram_start = d->vga.vram_ptr;", "QXLCommandExt *cmds;", "int VAR_2, VAR_3, VAR_4;", "assert(d->last_release_offset < d->vga.vram_size);", "if (d->last_release_offset == 0) {", "d->last_release = NULL;", "} else {", "d->last_release = (QXLReleaseInfo *)(ram_start + d->last_release_offset);", "}", "d->modes = (QXLModes*)((uint8_t*)d->rom + d->rom->modes_offset);", "trace_qxl_post_load(d->id, qxl_mode_to_string(d->mode));", "VAR_4 = d->mode;", "d->mode = QXL_MODE_UNDEFINED;", "switch (VAR_4) {", "case QXL_MODE_UNDEFINED:\nqxl_create_memslots(d);", "break;", "case QXL_MODE_VGA:\nqxl_create_memslots(d);", "qxl_enter_vga_mode(d);", "break;", "case QXL_MODE_NATIVE:\nqxl_create_memslots(d);", "qxl_create_guest_primary(d, 1, QXL_SYNC);", "cmds = g_malloc0(sizeof(QXLCommandExt) * (d->ssd.num_surfaces + 1));", "for (VAR_2 = 0, VAR_3 = 0; VAR_2 < d->ssd.num_surfaces; VAR_2++) {", "if (d->guest_surfaces.cmds[VAR_2] == 0) {", "continue;", "}", "cmds[VAR_3].cmd.data = d->guest_surfaces.cmds[VAR_2];", "cmds[VAR_3].cmd.type = QXL_CMD_SURFACE;", "cmds[VAR_3].group_id = MEMSLOT_GROUP_GUEST;", "VAR_3++;", "}", "if (d->guest_cursor) {", "cmds[VAR_3].cmd.data = d->guest_cursor;", "cmds[VAR_3].cmd.type = QXL_CMD_CURSOR;", "cmds[VAR_3].group_id = MEMSLOT_GROUP_GUEST;", "VAR_3++;", "}", "qxl_spice_loadvm_commands(d, cmds, VAR_3);", "g_free(cmds);", "if (d->guest_monitors_config) {", "qxl_spice_monitors_config_async(d, 1);", "}", "break;", "case QXL_MODE_COMPAT:\nqxl_set_mode(d, d->shadow_rom.mode, 1);", "break;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ] ]