id
int32 0
27.3k
| func
stringlengths 26
142k
| target
bool 2
classes | project
stringclasses 2
values | commit_id
stringlengths 40
40
| func_clean
stringlengths 26
131k
| vul_lines
dict | normalized_func
stringlengths 24
132k
| lines
listlengths 1
2.8k
| label
listlengths 1
2.8k
| line_no
listlengths 1
2.8k
|
---|---|---|---|---|---|---|---|---|---|---|
15,569 | static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AVPacket *avpkt) {
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
NuvContext *c = avctx->priv_data;
AVFrame *picture = data;
int orig_size = buf_size;
int keyframe;
int result;
enum {NUV_UNCOMPRESSED = '0', NUV_RTJPEG = '1',
NUV_RTJPEG_IN_LZO = '2', NUV_LZO = '3',
NUV_BLACK = 'N', NUV_COPY_LAST = 'L'} comptype;
if (buf_size < 12) {
av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
return -1;
}
// codec data (rtjpeg quant tables)
if (buf[0] == 'D' && buf[1] == 'R') {
int ret;
// skip rest of the frameheader.
buf = &buf[12];
buf_size -= 12;
ret = get_quant(avctx, c, buf, buf_size);
if (ret < 0)
return ret;
ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
return orig_size;
}
if (buf[0] != 'V' || buf_size < 12) {
av_log(avctx, AV_LOG_ERROR, "not a nuv video frame\n");
return -1;
}
comptype = buf[1];
switch (comptype) {
case NUV_RTJPEG_IN_LZO:
case NUV_RTJPEG:
keyframe = !buf[2]; break;
case NUV_COPY_LAST:
keyframe = 0; break;
default:
keyframe = 1; break;
}
// skip rest of the frameheader.
buf = &buf[12];
buf_size -= 12;
if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) {
int outlen = c->decomp_size, inlen = buf_size;
if (av_lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen))
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
buf = c->decomp_buf;
buf_size = c->decomp_size;
}
if (c->codec_frameheader) {
int w, h, q;
if (buf_size < 12) {
av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame\n");
return -1;
}
w = AV_RL16(&buf[6]);
h = AV_RL16(&buf[8]);
q = buf[10];
if (!codec_reinit(avctx, w, h, q))
return -1;
buf = &buf[12];
buf_size -= 12;
}
if (keyframe && c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
c->pic.reference = 3;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
result = avctx->reget_buffer(avctx, &c->pic);
if (result < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
c->pic.pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
c->pic.key_frame = keyframe;
// decompress/copy/whatever data
switch (comptype) {
case NUV_LZO:
case NUV_UNCOMPRESSED: {
int height = c->height;
if (buf_size < c->width * height * 3 / 2) {
av_log(avctx, AV_LOG_ERROR, "uncompressed frame too short\n");
height = buf_size / c->width / 3 * 2;
}
copy_frame(&c->pic, buf, c->width, height);
break;
}
case NUV_RTJPEG_IN_LZO:
case NUV_RTJPEG: {
ff_rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, buf, buf_size);
break;
}
case NUV_BLACK: {
memset(c->pic.data[0], 0, c->width * c->height);
memset(c->pic.data[1], 128, c->width * c->height / 4);
memset(c->pic.data[2], 128, c->width * c->height / 4);
break;
}
case NUV_COPY_LAST: {
/* nothing more to do here */
break;
}
default:
av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
return -1;
}
*picture = c->pic;
*data_size = sizeof(AVFrame);
return orig_size;
}
| false | FFmpeg | 859a579e9bbf47fae2e09494c43bcf813dcb2fad | static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AVPacket *avpkt) {
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
NuvContext *c = avctx->priv_data;
AVFrame *picture = data;
int orig_size = buf_size;
int keyframe;
int result;
enum {NUV_UNCOMPRESSED = '0', NUV_RTJPEG = '1',
NUV_RTJPEG_IN_LZO = '2', NUV_LZO = '3',
NUV_BLACK = 'N', NUV_COPY_LAST = 'L'} comptype;
if (buf_size < 12) {
av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
return -1;
}
if (buf[0] == 'D' && buf[1] == 'R') {
int ret;
buf = &buf[12];
buf_size -= 12;
ret = get_quant(avctx, c, buf, buf_size);
if (ret < 0)
return ret;
ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
return orig_size;
}
if (buf[0] != 'V' || buf_size < 12) {
av_log(avctx, AV_LOG_ERROR, "not a nuv video frame\n");
return -1;
}
comptype = buf[1];
switch (comptype) {
case NUV_RTJPEG_IN_LZO:
case NUV_RTJPEG:
keyframe = !buf[2]; break;
case NUV_COPY_LAST:
keyframe = 0; break;
default:
keyframe = 1; break;
}
buf = &buf[12];
buf_size -= 12;
if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) {
int outlen = c->decomp_size, inlen = buf_size;
if (av_lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen))
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
buf = c->decomp_buf;
buf_size = c->decomp_size;
}
if (c->codec_frameheader) {
int w, h, q;
if (buf_size < 12) {
av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame\n");
return -1;
}
w = AV_RL16(&buf[6]);
h = AV_RL16(&buf[8]);
q = buf[10];
if (!codec_reinit(avctx, w, h, q))
return -1;
buf = &buf[12];
buf_size -= 12;
}
if (keyframe && c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
c->pic.reference = 3;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
result = avctx->reget_buffer(avctx, &c->pic);
if (result < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
c->pic.pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
c->pic.key_frame = keyframe;
switch (comptype) {
case NUV_LZO:
case NUV_UNCOMPRESSED: {
int height = c->height;
if (buf_size < c->width * height * 3 / 2) {
av_log(avctx, AV_LOG_ERROR, "uncompressed frame too short\n");
height = buf_size / c->width / 3 * 2;
}
copy_frame(&c->pic, buf, c->width, height);
break;
}
case NUV_RTJPEG_IN_LZO:
case NUV_RTJPEG: {
ff_rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, buf, buf_size);
break;
}
case NUV_BLACK: {
memset(c->pic.data[0], 0, c->width * c->height);
memset(c->pic.data[1], 128, c->width * c->height / 4);
memset(c->pic.data[2], 128, c->width * c->height / 4);
break;
}
case NUV_COPY_LAST: {
break;
}
default:
av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
return -1;
}
*picture = c->pic;
*data_size = sizeof(AVFrame);
return orig_size;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,
AVPacket *VAR_3) {
const uint8_t *VAR_4 = VAR_3->VAR_1;
int VAR_5 = VAR_3->size;
NuvContext *c = VAR_0->priv_data;
AVFrame *picture = VAR_1;
int VAR_6 = VAR_5;
int VAR_7;
int VAR_8;
enum {NUV_UNCOMPRESSED = '0', NUV_RTJPEG = '1',
NUV_RTJPEG_IN_LZO = '2', NUV_LZO = '3',
NUV_BLACK = 'N', NUV_COPY_LAST = 'L'} VAR_9;
if (VAR_5 < 12) {
av_log(VAR_0, AV_LOG_ERROR, "coded frame too small\n");
return -1;
}
if (VAR_4[0] == 'D' && VAR_4[1] == 'R') {
int VAR_10;
VAR_4 = &VAR_4[12];
VAR_5 -= 12;
VAR_10 = get_quant(VAR_0, c, VAR_4, VAR_5);
if (VAR_10 < 0)
return VAR_10;
ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->VAR_16, c->lq, c->cq);
return VAR_6;
}
if (VAR_4[0] != 'V' || VAR_5 < 12) {
av_log(VAR_0, AV_LOG_ERROR, "not a nuv video frame\n");
return -1;
}
VAR_9 = VAR_4[1];
switch (VAR_9) {
case NUV_RTJPEG_IN_LZO:
case NUV_RTJPEG:
VAR_7 = !VAR_4[2]; break;
case NUV_COPY_LAST:
VAR_7 = 0; break;
default:
VAR_7 = 1; break;
}
VAR_4 = &VAR_4[12];
VAR_5 -= 12;
if (VAR_9 == NUV_RTJPEG_IN_LZO || VAR_9 == NUV_LZO) {
int VAR_11 = c->decomp_size, VAR_12 = VAR_5;
if (av_lzo1x_decode(c->decomp_buf, &VAR_11, VAR_4, &VAR_12))
av_log(VAR_0, AV_LOG_ERROR, "error during lzo decompression\n");
VAR_4 = c->decomp_buf;
VAR_5 = c->decomp_size;
}
if (c->codec_frameheader) {
int VAR_13, VAR_14, VAR_15;
if (VAR_5 < 12) {
av_log(VAR_0, AV_LOG_ERROR, "invalid nuv video frame\n");
return -1;
}
VAR_13 = AV_RL16(&VAR_4[6]);
VAR_14 = AV_RL16(&VAR_4[8]);
VAR_15 = VAR_4[10];
if (!codec_reinit(VAR_0, VAR_13, VAR_14, VAR_15))
return -1;
VAR_4 = &VAR_4[12];
VAR_5 -= 12;
}
if (VAR_7 && c->pic.VAR_1[0])
VAR_0->release_buffer(VAR_0, &c->pic);
c->pic.reference = 3;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
VAR_8 = VAR_0->reget_buffer(VAR_0, &c->pic);
if (VAR_8 < 0) {
av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
c->pic.pict_type = VAR_7 ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
c->pic.key_frame = VAR_7;
switch (VAR_9) {
case NUV_LZO:
case NUV_UNCOMPRESSED: {
int VAR_16 = c->VAR_16;
if (VAR_5 < c->width * VAR_16 * 3 / 2) {
av_log(VAR_0, AV_LOG_ERROR, "uncompressed frame too short\n");
VAR_16 = VAR_5 / c->width / 3 * 2;
}
copy_frame(&c->pic, VAR_4, c->width, VAR_16);
break;
}
case NUV_RTJPEG_IN_LZO:
case NUV_RTJPEG: {
ff_rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, VAR_4, VAR_5);
break;
}
case NUV_BLACK: {
memset(c->pic.VAR_1[0], 0, c->width * c->VAR_16);
memset(c->pic.VAR_1[1], 128, c->width * c->VAR_16 / 4);
memset(c->pic.VAR_1[2], 128, c->width * c->VAR_16 / 4);
break;
}
case NUV_COPY_LAST: {
break;
}
default:
av_log(VAR_0, AV_LOG_ERROR, "unknown compression\n");
return -1;
}
*picture = c->pic;
*VAR_2 = sizeof(AVFrame);
return VAR_6;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,\nAVPacket *VAR_3) {",
"const uint8_t *VAR_4 = VAR_3->VAR_1;",
"int VAR_5 = VAR_3->size;",
"NuvContext *c = VAR_0->priv_data;",
"AVFrame *picture = VAR_1;",
"int VAR_6 = VAR_5;",
"int VAR_7;",
"int VAR_8;",
"enum {NUV_UNCOMPRESSED = '0', NUV_RTJPEG = '1',",
"NUV_RTJPEG_IN_LZO = '2', NUV_LZO = '3',\nNUV_BLACK = 'N', NUV_COPY_LAST = 'L'} VAR_9;",
"if (VAR_5 < 12) {",
"av_log(VAR_0, AV_LOG_ERROR, \"coded frame too small\\n\");",
"return -1;",
"}",
"if (VAR_4[0] == 'D' && VAR_4[1] == 'R') {",
"int VAR_10;",
"VAR_4 = &VAR_4[12];",
"VAR_5 -= 12;",
"VAR_10 = get_quant(VAR_0, c, VAR_4, VAR_5);",
"if (VAR_10 < 0)\nreturn VAR_10;",
"ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->VAR_16, c->lq, c->cq);",
"return VAR_6;",
"}",
"if (VAR_4[0] != 'V' || VAR_5 < 12) {",
"av_log(VAR_0, AV_LOG_ERROR, \"not a nuv video frame\\n\");",
"return -1;",
"}",
"VAR_9 = VAR_4[1];",
"switch (VAR_9) {",
"case NUV_RTJPEG_IN_LZO:\ncase NUV_RTJPEG:\nVAR_7 = !VAR_4[2]; break;",
"case NUV_COPY_LAST:\nVAR_7 = 0; break;",
"default:\nVAR_7 = 1; break;",
"}",
"VAR_4 = &VAR_4[12];",
"VAR_5 -= 12;",
"if (VAR_9 == NUV_RTJPEG_IN_LZO || VAR_9 == NUV_LZO) {",
"int VAR_11 = c->decomp_size, VAR_12 = VAR_5;",
"if (av_lzo1x_decode(c->decomp_buf, &VAR_11, VAR_4, &VAR_12))\nav_log(VAR_0, AV_LOG_ERROR, \"error during lzo decompression\\n\");",
"VAR_4 = c->decomp_buf;",
"VAR_5 = c->decomp_size;",
"}",
"if (c->codec_frameheader) {",
"int VAR_13, VAR_14, VAR_15;",
"if (VAR_5 < 12) {",
"av_log(VAR_0, AV_LOG_ERROR, \"invalid nuv video frame\\n\");",
"return -1;",
"}",
"VAR_13 = AV_RL16(&VAR_4[6]);",
"VAR_14 = AV_RL16(&VAR_4[8]);",
"VAR_15 = VAR_4[10];",
"if (!codec_reinit(VAR_0, VAR_13, VAR_14, VAR_15))\nreturn -1;",
"VAR_4 = &VAR_4[12];",
"VAR_5 -= 12;",
"}",
"if (VAR_7 && c->pic.VAR_1[0])\nVAR_0->release_buffer(VAR_0, &c->pic);",
"c->pic.reference = 3;",
"c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |\nFF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;",
"VAR_8 = VAR_0->reget_buffer(VAR_0, &c->pic);",
"if (VAR_8 < 0) {",
"av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");",
"return -1;",
"}",
"c->pic.pict_type = VAR_7 ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;",
"c->pic.key_frame = VAR_7;",
"switch (VAR_9) {",
"case NUV_LZO:\ncase NUV_UNCOMPRESSED: {",
"int VAR_16 = c->VAR_16;",
"if (VAR_5 < c->width * VAR_16 * 3 / 2) {",
"av_log(VAR_0, AV_LOG_ERROR, \"uncompressed frame too short\\n\");",
"VAR_16 = VAR_5 / c->width / 3 * 2;",
"}",
"copy_frame(&c->pic, VAR_4, c->width, VAR_16);",
"break;",
"}",
"case NUV_RTJPEG_IN_LZO:\ncase NUV_RTJPEG: {",
"ff_rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, VAR_4, VAR_5);",
"break;",
"}",
"case NUV_BLACK: {",
"memset(c->pic.VAR_1[0], 0, c->width * c->VAR_16);",
"memset(c->pic.VAR_1[1], 128, c->width * c->VAR_16 / 4);",
"memset(c->pic.VAR_1[2], 128, c->width * c->VAR_16 / 4);",
"break;",
"}",
"case NUV_COPY_LAST: {",
"break;",
"}",
"default:\nav_log(VAR_0, AV_LOG_ERROR, \"unknown compression\\n\");",
"return -1;",
"}",
"*picture = c->pic;",
"*VAR_2 = sizeof(AVFrame);",
"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,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21,
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51,
53
],
[
55
],
[
57
],
[
59
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75,
77,
79
],
[
81,
83
],
[
85,
87
],
[
89
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101,
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129,
131
],
[
133
],
[
135
],
[
137
],
[
141,
143
],
[
145
],
[
147,
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
163
],
[
165
],
[
169
],
[
171,
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191,
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
217
],
[
219
],
[
221,
223
],
[
225
],
[
227
],
[
231
],
[
233
],
[
235
],
[
237
]
]
|
15,570 | qio_channel_websock_extract_headers(char *buffer,
QIOChannelWebsockHTTPHeader *hdrs,
size_t nhdrsalloc,
Error **errp)
{
char *nl, *sep, *tmp;
size_t nhdrs = 0;
/*
* First parse the HTTP protocol greeting of format:
*
* $METHOD $PATH $VERSION
*
* e.g.
*
* GET / HTTP/1.1
*/
nl = strstr(buffer, QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);
if (!nl) {
error_setg(errp, "Missing HTTP header delimiter");
return 0;
}
*nl = '\0';
tmp = strchr(buffer, ' ');
if (!tmp) {
error_setg(errp, "Missing HTTP path delimiter");
return 0;
}
*tmp = '\0';
if (!g_str_equal(buffer, QIO_CHANNEL_WEBSOCK_HTTP_METHOD)) {
error_setg(errp, "Unsupported HTTP method %s", buffer);
return 0;
}
buffer = tmp + 1;
tmp = strchr(buffer, ' ');
if (!tmp) {
error_setg(errp, "Missing HTTP version delimiter");
return 0;
}
*tmp = '\0';
if (!g_str_equal(buffer, QIO_CHANNEL_WEBSOCK_HTTP_PATH)) {
error_setg(errp, "Unexpected HTTP path %s", buffer);
return 0;
}
buffer = tmp + 1;
if (!g_str_equal(buffer, QIO_CHANNEL_WEBSOCK_HTTP_VERSION)) {
error_setg(errp, "Unsupported HTTP version %s", buffer);
return 0;
}
buffer = nl + strlen(QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);
/*
* Now parse all the header fields of format
*
* $NAME: $VALUE
*
* e.g.
*
* Cache-control: no-cache
*/
do {
QIOChannelWebsockHTTPHeader *hdr;
nl = strstr(buffer, QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);
if (nl) {
*nl = '\0';
}
sep = strchr(buffer, ':');
if (!sep) {
error_setg(errp, "Malformed HTTP header");
return 0;
}
*sep = '\0';
sep++;
while (*sep == ' ') {
sep++;
}
if (nhdrs >= nhdrsalloc) {
error_setg(errp, "Too many HTTP headers");
return 0;
}
hdr = &hdrs[nhdrs++];
hdr->name = buffer;
hdr->value = sep;
/* Canonicalize header name for easier identification later */
for (tmp = hdr->name; *tmp; tmp++) {
*tmp = g_ascii_tolower(*tmp);
}
if (nl) {
buffer = nl + strlen(QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);
}
} while (nl != NULL);
return nhdrs;
}
| true | qemu | f69a8bde29354493ff8aea64cc9cb3b531d16337 | qio_channel_websock_extract_headers(char *buffer,
QIOChannelWebsockHTTPHeader *hdrs,
size_t nhdrsalloc,
Error **errp)
{
char *nl, *sep, *tmp;
size_t nhdrs = 0;
nl = strstr(buffer, QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);
if (!nl) {
error_setg(errp, "Missing HTTP header delimiter");
return 0;
}
*nl = '\0';
tmp = strchr(buffer, ' ');
if (!tmp) {
error_setg(errp, "Missing HTTP path delimiter");
return 0;
}
*tmp = '\0';
if (!g_str_equal(buffer, QIO_CHANNEL_WEBSOCK_HTTP_METHOD)) {
error_setg(errp, "Unsupported HTTP method %s", buffer);
return 0;
}
buffer = tmp + 1;
tmp = strchr(buffer, ' ');
if (!tmp) {
error_setg(errp, "Missing HTTP version delimiter");
return 0;
}
*tmp = '\0';
if (!g_str_equal(buffer, QIO_CHANNEL_WEBSOCK_HTTP_PATH)) {
error_setg(errp, "Unexpected HTTP path %s", buffer);
return 0;
}
buffer = tmp + 1;
if (!g_str_equal(buffer, QIO_CHANNEL_WEBSOCK_HTTP_VERSION)) {
error_setg(errp, "Unsupported HTTP version %s", buffer);
return 0;
}
buffer = nl + strlen(QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);
do {
QIOChannelWebsockHTTPHeader *hdr;
nl = strstr(buffer, QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);
if (nl) {
*nl = '\0';
}
sep = strchr(buffer, ':');
if (!sep) {
error_setg(errp, "Malformed HTTP header");
return 0;
}
*sep = '\0';
sep++;
while (*sep == ' ') {
sep++;
}
if (nhdrs >= nhdrsalloc) {
error_setg(errp, "Too many HTTP headers");
return 0;
}
hdr = &hdrs[nhdrs++];
hdr->name = buffer;
hdr->value = sep;
for (tmp = hdr->name; *tmp; tmp++) {
*tmp = g_ascii_tolower(*tmp);
}
if (nl) {
buffer = nl + strlen(QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);
}
} while (nl != NULL);
return nhdrs;
}
| {
"code": [
"qio_channel_websock_extract_headers(char *buffer,",
" return 0;",
" return 0;",
" return 0;",
" return 0;",
" return 0;",
" return 0;"
],
"line_no": [
1,
43,
43,
43,
43,
159,
159
]
} | FUNC_0(char *VAR_0,
QIOChannelWebsockHTTPHeader *VAR_1,
size_t VAR_2,
Error **VAR_3)
{
char *VAR_4, *VAR_5, *VAR_6;
size_t nhdrs = 0;
VAR_4 = strstr(VAR_0, QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);
if (!VAR_4) {
error_setg(VAR_3, "Missing HTTP header delimiter");
return 0;
}
*VAR_4 = '\0';
VAR_6 = strchr(VAR_0, ' ');
if (!VAR_6) {
error_setg(VAR_3, "Missing HTTP path delimiter");
return 0;
}
*VAR_6 = '\0';
if (!g_str_equal(VAR_0, QIO_CHANNEL_WEBSOCK_HTTP_METHOD)) {
error_setg(VAR_3, "Unsupported HTTP method %s", VAR_0);
return 0;
}
VAR_0 = VAR_6 + 1;
VAR_6 = strchr(VAR_0, ' ');
if (!VAR_6) {
error_setg(VAR_3, "Missing HTTP version delimiter");
return 0;
}
*VAR_6 = '\0';
if (!g_str_equal(VAR_0, QIO_CHANNEL_WEBSOCK_HTTP_PATH)) {
error_setg(VAR_3, "Unexpected HTTP path %s", VAR_0);
return 0;
}
VAR_0 = VAR_6 + 1;
if (!g_str_equal(VAR_0, QIO_CHANNEL_WEBSOCK_HTTP_VERSION)) {
error_setg(VAR_3, "Unsupported HTTP version %s", VAR_0);
return 0;
}
VAR_0 = VAR_4 + strlen(QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);
do {
QIOChannelWebsockHTTPHeader *hdr;
VAR_4 = strstr(VAR_0, QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);
if (VAR_4) {
*VAR_4 = '\0';
}
VAR_5 = strchr(VAR_0, ':');
if (!VAR_5) {
error_setg(VAR_3, "Malformed HTTP header");
return 0;
}
*VAR_5 = '\0';
VAR_5++;
while (*VAR_5 == ' ') {
VAR_5++;
}
if (nhdrs >= VAR_2) {
error_setg(VAR_3, "Too many HTTP headers");
return 0;
}
hdr = &VAR_1[nhdrs++];
hdr->name = VAR_0;
hdr->value = VAR_5;
for (VAR_6 = hdr->name; *VAR_6; VAR_6++) {
*VAR_6 = g_ascii_tolower(*VAR_6);
}
if (VAR_4) {
VAR_0 = VAR_4 + strlen(QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);
}
} while (VAR_4 != NULL);
return nhdrs;
}
| [
"FUNC_0(char *VAR_0,\nQIOChannelWebsockHTTPHeader *VAR_1,\nsize_t VAR_2,\nError **VAR_3)\n{",
"char *VAR_4, *VAR_5, *VAR_6;",
"size_t nhdrs = 0;",
"VAR_4 = strstr(VAR_0, QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);",
"if (!VAR_4) {",
"error_setg(VAR_3, \"Missing HTTP header delimiter\");",
"return 0;",
"}",
"*VAR_4 = '\\0';",
"VAR_6 = strchr(VAR_0, ' ');",
"if (!VAR_6) {",
"error_setg(VAR_3, \"Missing HTTP path delimiter\");",
"return 0;",
"}",
"*VAR_6 = '\\0';",
"if (!g_str_equal(VAR_0, QIO_CHANNEL_WEBSOCK_HTTP_METHOD)) {",
"error_setg(VAR_3, \"Unsupported HTTP method %s\", VAR_0);",
"return 0;",
"}",
"VAR_0 = VAR_6 + 1;",
"VAR_6 = strchr(VAR_0, ' ');",
"if (!VAR_6) {",
"error_setg(VAR_3, \"Missing HTTP version delimiter\");",
"return 0;",
"}",
"*VAR_6 = '\\0';",
"if (!g_str_equal(VAR_0, QIO_CHANNEL_WEBSOCK_HTTP_PATH)) {",
"error_setg(VAR_3, \"Unexpected HTTP path %s\", VAR_0);",
"return 0;",
"}",
"VAR_0 = VAR_6 + 1;",
"if (!g_str_equal(VAR_0, QIO_CHANNEL_WEBSOCK_HTTP_VERSION)) {",
"error_setg(VAR_3, \"Unsupported HTTP version %s\", VAR_0);",
"return 0;",
"}",
"VAR_0 = VAR_4 + strlen(QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);",
"do {",
"QIOChannelWebsockHTTPHeader *hdr;",
"VAR_4 = strstr(VAR_0, QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);",
"if (VAR_4) {",
"*VAR_4 = '\\0';",
"}",
"VAR_5 = strchr(VAR_0, ':');",
"if (!VAR_5) {",
"error_setg(VAR_3, \"Malformed HTTP header\");",
"return 0;",
"}",
"*VAR_5 = '\\0';",
"VAR_5++;",
"while (*VAR_5 == ' ') {",
"VAR_5++;",
"}",
"if (nhdrs >= VAR_2) {",
"error_setg(VAR_3, \"Too many HTTP headers\");",
"return 0;",
"}",
"hdr = &VAR_1[nhdrs++];",
"hdr->name = VAR_0;",
"hdr->value = VAR_5;",
"for (VAR_6 = hdr->name; *VAR_6; VAR_6++) {",
"*VAR_6 = g_ascii_tolower(*VAR_6);",
"}",
"if (VAR_4) {",
"VAR_0 = VAR_4 + strlen(QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM);",
"}",
"} while (VAR_4 != NULL);",
"return nhdrs;",
"}"
]
| [
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,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65
],
[
67
],
[
69
],
[
71
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91
],
[
93
],
[
95
],
[
97
],
[
101
],
[
105
],
[
107
],
[
109
],
[
111
],
[
115
],
[
137
],
[
139
],
[
143
],
[
145
],
[
147
],
[
149
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
175
],
[
177
],
[
179
],
[
181
],
[
185
],
[
187
],
[
189
],
[
195
],
[
197
],
[
199
],
[
203
],
[
205
],
[
207
],
[
209
],
[
213
],
[
215
]
]
|
15,571 | static inline void cris_ftag_d(unsigned int x)
{
register unsigned int v asm("$r10") = x;
asm ("ftagd\t[%0]\n" : : "r" (v) );
}
| true | qemu | 21ce148c7ec71ee32834061355a5ecfd1a11f90f | static inline void cris_ftag_d(unsigned int x)
{
register unsigned int v asm("$r10") = x;
asm ("ftagd\t[%0]\n" : : "r" (v) );
}
| {
"code": [
"static inline void cris_ftag_d(unsigned int x)"
],
"line_no": [
1
]
} | static inline void FUNC_0(unsigned int VAR_0)
{
register unsigned int VAR_1 asm("$r10") = VAR_0;
asm ("ftagd\t[%0]\n" : : "r" (VAR_1) );
}
| [
"static inline void FUNC_0(unsigned int VAR_0)\n{",
"register unsigned int VAR_1 asm(\"$r10\") = VAR_0;",
"asm (\"ftagd\\t[%0]\\n\" : : \"r\" (VAR_1) );",
"}"
]
| [
1,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
]
]
|
15,572 | int spapr_h_cas_compose_response(sPAPRMachineState *spapr,
target_ulong addr, target_ulong size,
sPAPROptionVector *ov5_updates)
{
void *fdt, *fdt_skel;
sPAPRDeviceTreeUpdateHeader hdr = { .version_id = 1 };
if (spapr_hotplugged_dev_before_cas()) {
return 1;
size -= sizeof(hdr);
/* Create skeleton */
fdt_skel = g_malloc0(size);
_FDT((fdt_create(fdt_skel, size)));
_FDT((fdt_begin_node(fdt_skel, "")));
_FDT((fdt_end_node(fdt_skel)));
_FDT((fdt_finish(fdt_skel)));
fdt = g_malloc0(size);
_FDT((fdt_open_into(fdt_skel, fdt, size)));
g_free(fdt_skel);
/* Fixup cpu nodes */
_FDT((spapr_fixup_cpu_dt(fdt, spapr)));
if (spapr_dt_cas_updates(spapr, fdt, ov5_updates)) {
return -1;
/* Pack resulting tree */
_FDT((fdt_pack(fdt)));
if (fdt_totalsize(fdt) + sizeof(hdr) > size) {
trace_spapr_cas_failed(size);
return -1;
cpu_physical_memory_write(addr, &hdr, sizeof(hdr));
cpu_physical_memory_write(addr + sizeof(hdr), fdt, fdt_totalsize(fdt));
trace_spapr_cas_continue(fdt_totalsize(fdt) + sizeof(hdr));
g_free(fdt);
return 0; | true | qemu | 827b17c468b0dae69f82f852958d16f4bf6d6bf0 | int spapr_h_cas_compose_response(sPAPRMachineState *spapr,
target_ulong addr, target_ulong size,
sPAPROptionVector *ov5_updates)
{
void *fdt, *fdt_skel;
sPAPRDeviceTreeUpdateHeader hdr = { .version_id = 1 };
if (spapr_hotplugged_dev_before_cas()) {
return 1;
size -= sizeof(hdr);
fdt_skel = g_malloc0(size);
_FDT((fdt_create(fdt_skel, size)));
_FDT((fdt_begin_node(fdt_skel, "")));
_FDT((fdt_end_node(fdt_skel)));
_FDT((fdt_finish(fdt_skel)));
fdt = g_malloc0(size);
_FDT((fdt_open_into(fdt_skel, fdt, size)));
g_free(fdt_skel);
_FDT((spapr_fixup_cpu_dt(fdt, spapr)));
if (spapr_dt_cas_updates(spapr, fdt, ov5_updates)) {
return -1;
_FDT((fdt_pack(fdt)));
if (fdt_totalsize(fdt) + sizeof(hdr) > size) {
trace_spapr_cas_failed(size);
return -1;
cpu_physical_memory_write(addr, &hdr, sizeof(hdr));
cpu_physical_memory_write(addr + sizeof(hdr), fdt, fdt_totalsize(fdt));
trace_spapr_cas_continue(fdt_totalsize(fdt) + sizeof(hdr));
g_free(fdt);
return 0; | {
"code": [],
"line_no": []
} | int FUNC_0(sPAPRMachineState *VAR_0,
target_ulong VAR_1, target_ulong VAR_2,
sPAPROptionVector *VAR_3)
{
void *VAR_4, *VAR_5;
sPAPRDeviceTreeUpdateHeader hdr = { .version_id = 1 };
if (spapr_hotplugged_dev_before_cas()) {
return 1;
VAR_2 -= sizeof(hdr);
VAR_5 = g_malloc0(VAR_2);
_FDT((fdt_create(VAR_5, VAR_2)));
_FDT((fdt_begin_node(VAR_5, "")));
_FDT((fdt_end_node(VAR_5)));
_FDT((fdt_finish(VAR_5)));
VAR_4 = g_malloc0(VAR_2);
_FDT((fdt_open_into(VAR_5, VAR_4, VAR_2)));
g_free(VAR_5);
_FDT((spapr_fixup_cpu_dt(VAR_4, VAR_0)));
if (spapr_dt_cas_updates(VAR_0, VAR_4, VAR_3)) {
return -1;
_FDT((fdt_pack(VAR_4)));
if (fdt_totalsize(VAR_4) + sizeof(hdr) > VAR_2) {
trace_spapr_cas_failed(VAR_2);
return -1;
cpu_physical_memory_write(VAR_1, &hdr, sizeof(hdr));
cpu_physical_memory_write(VAR_1 + sizeof(hdr), VAR_4, fdt_totalsize(VAR_4));
trace_spapr_cas_continue(fdt_totalsize(VAR_4) + sizeof(hdr));
g_free(VAR_4);
return 0; | [
"int FUNC_0(sPAPRMachineState *VAR_0,\ntarget_ulong VAR_1, target_ulong VAR_2,\nsPAPROptionVector *VAR_3)\n{",
"void *VAR_4, *VAR_5;",
"sPAPRDeviceTreeUpdateHeader hdr = { .version_id = 1 };",
"if (spapr_hotplugged_dev_before_cas()) {",
"return 1;",
"VAR_2 -= sizeof(hdr);",
"VAR_5 = g_malloc0(VAR_2);",
"_FDT((fdt_create(VAR_5, VAR_2)));",
"_FDT((fdt_begin_node(VAR_5, \"\")));",
"_FDT((fdt_end_node(VAR_5)));",
"_FDT((fdt_finish(VAR_5)));",
"VAR_4 = g_malloc0(VAR_2);",
"_FDT((fdt_open_into(VAR_5, VAR_4, VAR_2)));",
"g_free(VAR_5);",
"_FDT((spapr_fixup_cpu_dt(VAR_4, VAR_0)));",
"if (spapr_dt_cas_updates(VAR_0, VAR_4, VAR_3)) {",
"return -1;",
"_FDT((fdt_pack(VAR_4)));",
"if (fdt_totalsize(VAR_4) + sizeof(hdr) > VAR_2) {",
"trace_spapr_cas_failed(VAR_2);",
"return -1;",
"cpu_physical_memory_write(VAR_1, &hdr, sizeof(hdr));",
"cpu_physical_memory_write(VAR_1 + sizeof(hdr), VAR_4, fdt_totalsize(VAR_4));",
"trace_spapr_cas_continue(fdt_totalsize(VAR_4) + sizeof(hdr));",
"g_free(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,
0,
0,
0,
0
]
| [
[
1,
2,
3,
4
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
11
],
[
12
],
[
13
],
[
14
],
[
15
],
[
16
],
[
17
],
[
18
],
[
20
],
[
21
],
[
22
],
[
24
],
[
25
],
[
26
],
[
27
],
[
28
],
[
29
],
[
30
],
[
31
],
[
32
]
]
|
15,573 | static void wav_destroy (void *opaque)
{
WAVState *wav = opaque;
uint8_t rlen[4];
uint8_t dlen[4];
uint32_t datalen = wav->bytes;
uint32_t rifflen = datalen + 36;
if (!wav->f) {
return;
}
le_store (rlen, rifflen, 4);
le_store (dlen, datalen, 4);
qemu_fseek (wav->f, 4, SEEK_SET);
qemu_put_buffer (wav->f, rlen, 4);
qemu_fseek (wav->f, 32, SEEK_CUR);
qemu_put_buffer (wav->f, dlen, 4);
qemu_fclose (wav->f);
if (wav->path) {
qemu_free (wav->path);
}
}
| true | qemu | e84a4fedf74983ad0517b4754f927a96a2eea7ce | static void wav_destroy (void *opaque)
{
WAVState *wav = opaque;
uint8_t rlen[4];
uint8_t dlen[4];
uint32_t datalen = wav->bytes;
uint32_t rifflen = datalen + 36;
if (!wav->f) {
return;
}
le_store (rlen, rifflen, 4);
le_store (dlen, datalen, 4);
qemu_fseek (wav->f, 4, SEEK_SET);
qemu_put_buffer (wav->f, rlen, 4);
qemu_fseek (wav->f, 32, SEEK_CUR);
qemu_put_buffer (wav->f, dlen, 4);
qemu_fclose (wav->f);
if (wav->path) {
qemu_free (wav->path);
}
}
| {
"code": [
" if (!wav->f) {",
" le_store (rlen, rifflen, 4);",
" le_store (dlen, datalen, 4);",
" qemu_fseek (wav->f, 4, SEEK_SET);",
" qemu_put_buffer (wav->f, rlen, 4);",
" qemu_fseek (wav->f, 32, SEEK_CUR);",
" qemu_put_buffer (wav->f, dlen, 4);",
" qemu_fclose (wav->f);",
" if (wav->path) {",
" qemu_free (wav->path);"
],
"line_no": [
17,
25,
27,
31,
33,
37,
39,
41,
43,
45
]
} | static void FUNC_0 (void *VAR_0)
{
WAVState *wav = VAR_0;
uint8_t rlen[4];
uint8_t dlen[4];
uint32_t datalen = wav->bytes;
uint32_t rifflen = datalen + 36;
if (!wav->f) {
return;
}
le_store (rlen, rifflen, 4);
le_store (dlen, datalen, 4);
qemu_fseek (wav->f, 4, SEEK_SET);
qemu_put_buffer (wav->f, rlen, 4);
qemu_fseek (wav->f, 32, SEEK_CUR);
qemu_put_buffer (wav->f, dlen, 4);
qemu_fclose (wav->f);
if (wav->path) {
qemu_free (wav->path);
}
}
| [
"static void FUNC_0 (void *VAR_0)\n{",
"WAVState *wav = VAR_0;",
"uint8_t rlen[4];",
"uint8_t dlen[4];",
"uint32_t datalen = wav->bytes;",
"uint32_t rifflen = datalen + 36;",
"if (!wav->f) {",
"return;",
"}",
"le_store (rlen, rifflen, 4);",
"le_store (dlen, datalen, 4);",
"qemu_fseek (wav->f, 4, SEEK_SET);",
"qemu_put_buffer (wav->f, rlen, 4);",
"qemu_fseek (wav->f, 32, SEEK_CUR);",
"qemu_put_buffer (wav->f, dlen, 4);",
"qemu_fclose (wav->f);",
"if (wav->path) {",
"qemu_free (wav->path);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
1,
0,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
]
]
|
15,574 | void event_notifier_cleanup(EventNotifier *e)
{
CloseHandle(e->event);
} | true | qemu | aa262928595d431bfee7914cb7d9d79197f887a2 | void event_notifier_cleanup(EventNotifier *e)
{
CloseHandle(e->event);
} | {
"code": [],
"line_no": []
} | void FUNC_0(EventNotifier *VAR_0)
{
CloseHandle(VAR_0->event);
} | [
"void FUNC_0(EventNotifier *VAR_0)\n{",
"CloseHandle(VAR_0->event);",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
8
]
]
|
15,575 | static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame,
unsigned int c, const unsigned int *div_blocks,
unsigned int *js_blocks)
{
unsigned int b;
ALSBlockData bd = { 0 };
bd.ra_block = ra_frame;
bd.const_block = ctx->const_block;
bd.shift_lsbs = ctx->shift_lsbs;
bd.opt_order = ctx->opt_order;
bd.store_prev_samples = ctx->store_prev_samples;
bd.use_ltp = ctx->use_ltp;
bd.ltp_lag = ctx->ltp_lag;
bd.ltp_gain = ctx->ltp_gain[0];
bd.quant_cof = ctx->quant_cof[0];
bd.lpc_cof = ctx->lpc_cof[0];
bd.prev_raw_samples = ctx->prev_raw_samples;
bd.raw_samples = ctx->raw_samples[c];
for (b = 0; b < ctx->num_blocks; b++) {
bd.block_length = div_blocks[b];
if (read_decode_block(ctx, &bd)) {
// damaged block, write zero for the rest of the frame
zero_remaining(b, ctx->num_blocks, div_blocks, bd.raw_samples);
return -1;
}
bd.raw_samples += div_blocks[b];
bd.ra_block = 0;
}
return 0;
}
| true | FFmpeg | ca488ad480360dfafcb5766f7bfbb567a0638979 | static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame,
unsigned int c, const unsigned int *div_blocks,
unsigned int *js_blocks)
{
unsigned int b;
ALSBlockData bd = { 0 };
bd.ra_block = ra_frame;
bd.const_block = ctx->const_block;
bd.shift_lsbs = ctx->shift_lsbs;
bd.opt_order = ctx->opt_order;
bd.store_prev_samples = ctx->store_prev_samples;
bd.use_ltp = ctx->use_ltp;
bd.ltp_lag = ctx->ltp_lag;
bd.ltp_gain = ctx->ltp_gain[0];
bd.quant_cof = ctx->quant_cof[0];
bd.lpc_cof = ctx->lpc_cof[0];
bd.prev_raw_samples = ctx->prev_raw_samples;
bd.raw_samples = ctx->raw_samples[c];
for (b = 0; b < ctx->num_blocks; b++) {
bd.block_length = div_blocks[b];
if (read_decode_block(ctx, &bd)) {
zero_remaining(b, ctx->num_blocks, div_blocks, bd.raw_samples);
return -1;
}
bd.raw_samples += div_blocks[b];
bd.ra_block = 0;
}
return 0;
}
| {
"code": [
" return -1;",
" return -1;",
" return -1;",
" return 0;",
" if (read_decode_block(ctx, &bd)) {",
" return -1;",
" return -1;",
" return -1;"
],
"line_no": [
55,
55,
55,
67,
49,
55,
55,
55
]
} | static int FUNC_0(ALSDecContext *VAR_0, unsigned int VAR_1,
unsigned int VAR_2, const unsigned int *VAR_3,
unsigned int *VAR_4)
{
unsigned int VAR_5;
ALSBlockData bd = { 0 };
bd.ra_block = VAR_1;
bd.const_block = VAR_0->const_block;
bd.shift_lsbs = VAR_0->shift_lsbs;
bd.opt_order = VAR_0->opt_order;
bd.store_prev_samples = VAR_0->store_prev_samples;
bd.use_ltp = VAR_0->use_ltp;
bd.ltp_lag = VAR_0->ltp_lag;
bd.ltp_gain = VAR_0->ltp_gain[0];
bd.quant_cof = VAR_0->quant_cof[0];
bd.lpc_cof = VAR_0->lpc_cof[0];
bd.prev_raw_samples = VAR_0->prev_raw_samples;
bd.raw_samples = VAR_0->raw_samples[VAR_2];
for (VAR_5 = 0; VAR_5 < VAR_0->num_blocks; VAR_5++) {
bd.block_length = VAR_3[VAR_5];
if (read_decode_block(VAR_0, &bd)) {
zero_remaining(VAR_5, VAR_0->num_blocks, VAR_3, bd.raw_samples);
return -1;
}
bd.raw_samples += VAR_3[VAR_5];
bd.ra_block = 0;
}
return 0;
}
| [
"static int FUNC_0(ALSDecContext *VAR_0, unsigned int VAR_1,\nunsigned int VAR_2, const unsigned int *VAR_3,\nunsigned int *VAR_4)\n{",
"unsigned int VAR_5;",
"ALSBlockData bd = { 0 };",
"bd.ra_block = VAR_1;",
"bd.const_block = VAR_0->const_block;",
"bd.shift_lsbs = VAR_0->shift_lsbs;",
"bd.opt_order = VAR_0->opt_order;",
"bd.store_prev_samples = VAR_0->store_prev_samples;",
"bd.use_ltp = VAR_0->use_ltp;",
"bd.ltp_lag = VAR_0->ltp_lag;",
"bd.ltp_gain = VAR_0->ltp_gain[0];",
"bd.quant_cof = VAR_0->quant_cof[0];",
"bd.lpc_cof = VAR_0->lpc_cof[0];",
"bd.prev_raw_samples = VAR_0->prev_raw_samples;",
"bd.raw_samples = VAR_0->raw_samples[VAR_2];",
"for (VAR_5 = 0; VAR_5 < VAR_0->num_blocks; VAR_5++) {",
"bd.block_length = VAR_3[VAR_5];",
"if (read_decode_block(VAR_0, &bd)) {",
"zero_remaining(VAR_5, VAR_0->num_blocks, VAR_3, bd.raw_samples);",
"return -1;",
"}",
"bd.raw_samples += VAR_3[VAR_5];",
"bd.ra_block = 0;",
"}",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
0,
0,
0,
1,
0
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
43
],
[
45
],
[
49
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
]
]
|
15,576 | int ff_load_image(uint8_t *data[4], int linesize[4],
int *w, int *h, enum AVPixelFormat *pix_fmt,
const char *filename, void *log_ctx)
{
AVInputFormat *iformat = NULL;
AVFormatContext *format_ctx = NULL;
AVCodec *codec;
AVCodecContext *codec_ctx;
AVFrame *frame;
int frame_decoded, ret = 0;
AVPacket pkt;
av_register_all();
iformat = av_find_input_format("image2");
if ((ret = avformat_open_input(&format_ctx, filename, iformat, NULL)) < 0) {
av_log(log_ctx, AV_LOG_ERROR,
"Failed to open input file '%s'\n", filename);
return ret;
}
codec_ctx = format_ctx->streams[0]->codec;
codec = avcodec_find_decoder(codec_ctx->codec_id);
if (!codec) {
av_log(log_ctx, AV_LOG_ERROR, "Failed to find codec\n");
ret = AVERROR(EINVAL);
goto end;
}
if ((ret = avcodec_open2(codec_ctx, codec, NULL)) < 0) {
av_log(log_ctx, AV_LOG_ERROR, "Failed to open codec\n");
goto end;
}
if (!(frame = avcodec_alloc_frame()) ) {
av_log(log_ctx, AV_LOG_ERROR, "Failed to alloc frame\n");
ret = AVERROR(ENOMEM);
goto end;
}
ret = av_read_frame(format_ctx, &pkt);
if (ret < 0) {
av_log(log_ctx, AV_LOG_ERROR, "Failed to read frame from file\n");
goto end;
}
ret = avcodec_decode_video2(codec_ctx, frame, &frame_decoded, &pkt);
if (ret < 0 || !frame_decoded) {
av_log(log_ctx, AV_LOG_ERROR, "Failed to decode image from file\n");
goto end;
}
ret = 0;
*w = frame->width;
*h = frame->height;
*pix_fmt = frame->format;
if ((ret = av_image_alloc(data, linesize, *w, *h, *pix_fmt, 16)) < 0)
goto end;
ret = 0;
av_image_copy(data, linesize, (const uint8_t **)frame->data, frame->linesize, *pix_fmt, *w, *h);
end:
if (codec_ctx)
avcodec_close(codec_ctx);
if (format_ctx)
avformat_close_input(&format_ctx);
av_freep(&frame);
if (ret < 0)
av_log(log_ctx, AV_LOG_ERROR, "Error loading image file '%s'\n", filename);
return ret;
}
| true | FFmpeg | fd9e88fe6018bc72cd0aa10afc3c1a68df8c6558 | int ff_load_image(uint8_t *data[4], int linesize[4],
int *w, int *h, enum AVPixelFormat *pix_fmt,
const char *filename, void *log_ctx)
{
AVInputFormat *iformat = NULL;
AVFormatContext *format_ctx = NULL;
AVCodec *codec;
AVCodecContext *codec_ctx;
AVFrame *frame;
int frame_decoded, ret = 0;
AVPacket pkt;
av_register_all();
iformat = av_find_input_format("image2");
if ((ret = avformat_open_input(&format_ctx, filename, iformat, NULL)) < 0) {
av_log(log_ctx, AV_LOG_ERROR,
"Failed to open input file '%s'\n", filename);
return ret;
}
codec_ctx = format_ctx->streams[0]->codec;
codec = avcodec_find_decoder(codec_ctx->codec_id);
if (!codec) {
av_log(log_ctx, AV_LOG_ERROR, "Failed to find codec\n");
ret = AVERROR(EINVAL);
goto end;
}
if ((ret = avcodec_open2(codec_ctx, codec, NULL)) < 0) {
av_log(log_ctx, AV_LOG_ERROR, "Failed to open codec\n");
goto end;
}
if (!(frame = avcodec_alloc_frame()) ) {
av_log(log_ctx, AV_LOG_ERROR, "Failed to alloc frame\n");
ret = AVERROR(ENOMEM);
goto end;
}
ret = av_read_frame(format_ctx, &pkt);
if (ret < 0) {
av_log(log_ctx, AV_LOG_ERROR, "Failed to read frame from file\n");
goto end;
}
ret = avcodec_decode_video2(codec_ctx, frame, &frame_decoded, &pkt);
if (ret < 0 || !frame_decoded) {
av_log(log_ctx, AV_LOG_ERROR, "Failed to decode image from file\n");
goto end;
}
ret = 0;
*w = frame->width;
*h = frame->height;
*pix_fmt = frame->format;
if ((ret = av_image_alloc(data, linesize, *w, *h, *pix_fmt, 16)) < 0)
goto end;
ret = 0;
av_image_copy(data, linesize, (const uint8_t **)frame->data, frame->linesize, *pix_fmt, *w, *h);
end:
if (codec_ctx)
avcodec_close(codec_ctx);
if (format_ctx)
avformat_close_input(&format_ctx);
av_freep(&frame);
if (ret < 0)
av_log(log_ctx, AV_LOG_ERROR, "Error loading image file '%s'\n", filename);
return ret;
}
| {
"code": [
" if (codec_ctx)",
" avcodec_close(codec_ctx);"
],
"line_no": [
129,
131
]
} | int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4],
int *VAR_2, int *VAR_3, enum AVPixelFormat *VAR_4,
const char *VAR_5, void *VAR_6)
{
AVInputFormat *iformat = NULL;
AVFormatContext *format_ctx = NULL;
AVCodec *codec;
AVCodecContext *codec_ctx;
AVFrame *frame;
int VAR_7, VAR_8 = 0;
AVPacket pkt;
av_register_all();
iformat = av_find_input_format("image2");
if ((VAR_8 = avformat_open_input(&format_ctx, VAR_5, iformat, NULL)) < 0) {
av_log(VAR_6, AV_LOG_ERROR,
"Failed to open input file '%s'\n", VAR_5);
return VAR_8;
}
codec_ctx = format_ctx->streams[0]->codec;
codec = avcodec_find_decoder(codec_ctx->codec_id);
if (!codec) {
av_log(VAR_6, AV_LOG_ERROR, "Failed to find codec\n");
VAR_8 = AVERROR(EINVAL);
goto end;
}
if ((VAR_8 = avcodec_open2(codec_ctx, codec, NULL)) < 0) {
av_log(VAR_6, AV_LOG_ERROR, "Failed to open codec\n");
goto end;
}
if (!(frame = avcodec_alloc_frame()) ) {
av_log(VAR_6, AV_LOG_ERROR, "Failed to alloc frame\n");
VAR_8 = AVERROR(ENOMEM);
goto end;
}
VAR_8 = av_read_frame(format_ctx, &pkt);
if (VAR_8 < 0) {
av_log(VAR_6, AV_LOG_ERROR, "Failed to read frame from file\n");
goto end;
}
VAR_8 = avcodec_decode_video2(codec_ctx, frame, &VAR_7, &pkt);
if (VAR_8 < 0 || !VAR_7) {
av_log(VAR_6, AV_LOG_ERROR, "Failed to decode image from file\n");
goto end;
}
VAR_8 = 0;
*VAR_2 = frame->width;
*VAR_3 = frame->height;
*VAR_4 = frame->format;
if ((VAR_8 = av_image_alloc(VAR_0, VAR_1, *VAR_2, *VAR_3, *VAR_4, 16)) < 0)
goto end;
VAR_8 = 0;
av_image_copy(VAR_0, VAR_1, (const uint8_t **)frame->VAR_0, frame->VAR_1, *VAR_4, *VAR_2, *VAR_3);
end:
if (codec_ctx)
avcodec_close(codec_ctx);
if (format_ctx)
avformat_close_input(&format_ctx);
av_freep(&frame);
if (VAR_8 < 0)
av_log(VAR_6, AV_LOG_ERROR, "Error loading image file '%s'\n", VAR_5);
return VAR_8;
}
| [
"int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4],\nint *VAR_2, int *VAR_3, enum AVPixelFormat *VAR_4,\nconst char *VAR_5, void *VAR_6)\n{",
"AVInputFormat *iformat = NULL;",
"AVFormatContext *format_ctx = NULL;",
"AVCodec *codec;",
"AVCodecContext *codec_ctx;",
"AVFrame *frame;",
"int VAR_7, VAR_8 = 0;",
"AVPacket pkt;",
"av_register_all();",
"iformat = av_find_input_format(\"image2\");",
"if ((VAR_8 = avformat_open_input(&format_ctx, VAR_5, iformat, NULL)) < 0) {",
"av_log(VAR_6, AV_LOG_ERROR,\n\"Failed to open input file '%s'\\n\", VAR_5);",
"return VAR_8;",
"}",
"codec_ctx = format_ctx->streams[0]->codec;",
"codec = avcodec_find_decoder(codec_ctx->codec_id);",
"if (!codec) {",
"av_log(VAR_6, AV_LOG_ERROR, \"Failed to find codec\\n\");",
"VAR_8 = AVERROR(EINVAL);",
"goto end;",
"}",
"if ((VAR_8 = avcodec_open2(codec_ctx, codec, NULL)) < 0) {",
"av_log(VAR_6, AV_LOG_ERROR, \"Failed to open codec\\n\");",
"goto end;",
"}",
"if (!(frame = avcodec_alloc_frame()) ) {",
"av_log(VAR_6, AV_LOG_ERROR, \"Failed to alloc frame\\n\");",
"VAR_8 = AVERROR(ENOMEM);",
"goto end;",
"}",
"VAR_8 = av_read_frame(format_ctx, &pkt);",
"if (VAR_8 < 0) {",
"av_log(VAR_6, AV_LOG_ERROR, \"Failed to read frame from file\\n\");",
"goto end;",
"}",
"VAR_8 = avcodec_decode_video2(codec_ctx, frame, &VAR_7, &pkt);",
"if (VAR_8 < 0 || !VAR_7) {",
"av_log(VAR_6, AV_LOG_ERROR, \"Failed to decode image from file\\n\");",
"goto end;",
"}",
"VAR_8 = 0;",
"*VAR_2 = frame->width;",
"*VAR_3 = frame->height;",
"*VAR_4 = frame->format;",
"if ((VAR_8 = av_image_alloc(VAR_0, VAR_1, *VAR_2, *VAR_3, *VAR_4, 16)) < 0)\ngoto end;",
"VAR_8 = 0;",
"av_image_copy(VAR_0, VAR_1, (const uint8_t **)frame->VAR_0, frame->VAR_1, *VAR_4, *VAR_2, *VAR_3);",
"end:\nif (codec_ctx)\navcodec_close(codec_ctx);",
"if (format_ctx)\navformat_close_input(&format_ctx);",
"av_freep(&frame);",
"if (VAR_8 < 0)\nav_log(VAR_6, AV_LOG_ERROR, \"Error loading image file '%s'\\n\", VAR_5);",
"return VAR_8;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
29
],
[
31
],
[
33,
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
107
],
[
109
],
[
111
],
[
115,
117
],
[
119
],
[
123
],
[
127,
129,
131
],
[
133,
135
],
[
137
],
[
141,
143
],
[
145
],
[
147
]
]
|
15,579 | int ff_h264_set_parameter_from_sps(H264Context *h)
{
if (h->flags & CODEC_FLAG_LOW_DELAY ||
(h->sps.bitstream_restriction_flag &&
!h->sps.num_reorder_frames)) {
if (h->avctx->has_b_frames > 1 || h->delayed_pic[0])
av_log(h->avctx, AV_LOG_WARNING, "Delayed frames seen. "
"Reenabling low delay requires a codec flush.\n");
else
h->low_delay = 1;
}
if (h->avctx->has_b_frames < 2)
h->avctx->has_b_frames = !h->low_delay;
if (h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||
h->cur_chroma_format_idc != h->sps.chroma_format_idc) {
if (h->avctx->codec &&
h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU &&
(h->sps.bit_depth_luma != 8 || h->sps.chroma_format_idc > 1)) {
av_log(h->avctx, AV_LOG_ERROR,
"VDPAU decoding does not support video colorspace.\n");
return AVERROR_INVALIDDATA;
}
if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 14 &&
h->sps.bit_depth_luma != 11 && h->sps.bit_depth_luma != 13) {
h->avctx->bits_per_raw_sample = h->sps.bit_depth_luma;
h->cur_chroma_format_idc = h->sps.chroma_format_idc;
h->pixel_shift = h->sps.bit_depth_luma > 8;
ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma,
h->sps.chroma_format_idc);
ff_h264chroma_init(&h->h264chroma, h->sps.bit_depth_chroma);
ff_h264qpel_init(&h->h264qpel, h->sps.bit_depth_luma);
ff_h264_pred_init(&h->hpc, h->avctx->codec_id, h->sps.bit_depth_luma,
h->sps.chroma_format_idc);
ff_videodsp_init(&h->vdsp, h->sps.bit_depth_luma);
} else {
av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n",
h->sps.bit_depth_luma);
return AVERROR_INVALIDDATA;
}
}
return 0;
}
| true | FFmpeg | 354db19ff44c3e33ba1a4298d1b3eaefb0ddc7e3 | int ff_h264_set_parameter_from_sps(H264Context *h)
{
if (h->flags & CODEC_FLAG_LOW_DELAY ||
(h->sps.bitstream_restriction_flag &&
!h->sps.num_reorder_frames)) {
if (h->avctx->has_b_frames > 1 || h->delayed_pic[0])
av_log(h->avctx, AV_LOG_WARNING, "Delayed frames seen. "
"Reenabling low delay requires a codec flush.\n");
else
h->low_delay = 1;
}
if (h->avctx->has_b_frames < 2)
h->avctx->has_b_frames = !h->low_delay;
if (h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||
h->cur_chroma_format_idc != h->sps.chroma_format_idc) {
if (h->avctx->codec &&
h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU &&
(h->sps.bit_depth_luma != 8 || h->sps.chroma_format_idc > 1)) {
av_log(h->avctx, AV_LOG_ERROR,
"VDPAU decoding does not support video colorspace.\n");
return AVERROR_INVALIDDATA;
}
if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 14 &&
h->sps.bit_depth_luma != 11 && h->sps.bit_depth_luma != 13) {
h->avctx->bits_per_raw_sample = h->sps.bit_depth_luma;
h->cur_chroma_format_idc = h->sps.chroma_format_idc;
h->pixel_shift = h->sps.bit_depth_luma > 8;
ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma,
h->sps.chroma_format_idc);
ff_h264chroma_init(&h->h264chroma, h->sps.bit_depth_chroma);
ff_h264qpel_init(&h->h264qpel, h->sps.bit_depth_luma);
ff_h264_pred_init(&h->hpc, h->avctx->codec_id, h->sps.bit_depth_luma,
h->sps.chroma_format_idc);
ff_videodsp_init(&h->vdsp, h->sps.bit_depth_luma);
} else {
av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n",
h->sps.bit_depth_luma);
return AVERROR_INVALIDDATA;
}
}
return 0;
}
| {
"code": [
" if (h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||"
],
"line_no": [
31
]
} | int FUNC_0(H264Context *VAR_0)
{
if (VAR_0->flags & CODEC_FLAG_LOW_DELAY ||
(VAR_0->sps.bitstream_restriction_flag &&
!VAR_0->sps.num_reorder_frames)) {
if (VAR_0->avctx->has_b_frames > 1 || VAR_0->delayed_pic[0])
av_log(VAR_0->avctx, AV_LOG_WARNING, "Delayed frames seen. "
"Reenabling low delay requires a codec flush.\n");
else
VAR_0->low_delay = 1;
}
if (VAR_0->avctx->has_b_frames < 2)
VAR_0->avctx->has_b_frames = !VAR_0->low_delay;
if (VAR_0->avctx->bits_per_raw_sample != VAR_0->sps.bit_depth_luma ||
VAR_0->cur_chroma_format_idc != VAR_0->sps.chroma_format_idc) {
if (VAR_0->avctx->codec &&
VAR_0->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU &&
(VAR_0->sps.bit_depth_luma != 8 || VAR_0->sps.chroma_format_idc > 1)) {
av_log(VAR_0->avctx, AV_LOG_ERROR,
"VDPAU decoding does not support video colorspace.\n");
return AVERROR_INVALIDDATA;
}
if (VAR_0->sps.bit_depth_luma >= 8 && VAR_0->sps.bit_depth_luma <= 14 &&
VAR_0->sps.bit_depth_luma != 11 && VAR_0->sps.bit_depth_luma != 13) {
VAR_0->avctx->bits_per_raw_sample = VAR_0->sps.bit_depth_luma;
VAR_0->cur_chroma_format_idc = VAR_0->sps.chroma_format_idc;
VAR_0->pixel_shift = VAR_0->sps.bit_depth_luma > 8;
ff_h264dsp_init(&VAR_0->h264dsp, VAR_0->sps.bit_depth_luma,
VAR_0->sps.chroma_format_idc);
ff_h264chroma_init(&VAR_0->h264chroma, VAR_0->sps.bit_depth_chroma);
ff_h264qpel_init(&VAR_0->h264qpel, VAR_0->sps.bit_depth_luma);
ff_h264_pred_init(&VAR_0->hpc, VAR_0->avctx->codec_id, VAR_0->sps.bit_depth_luma,
VAR_0->sps.chroma_format_idc);
ff_videodsp_init(&VAR_0->vdsp, VAR_0->sps.bit_depth_luma);
} else {
av_log(VAR_0->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n",
VAR_0->sps.bit_depth_luma);
return AVERROR_INVALIDDATA;
}
}
return 0;
}
| [
"int FUNC_0(H264Context *VAR_0)\n{",
"if (VAR_0->flags & CODEC_FLAG_LOW_DELAY ||\n(VAR_0->sps.bitstream_restriction_flag &&\n!VAR_0->sps.num_reorder_frames)) {",
"if (VAR_0->avctx->has_b_frames > 1 || VAR_0->delayed_pic[0])\nav_log(VAR_0->avctx, AV_LOG_WARNING, \"Delayed frames seen. \"\n\"Reenabling low delay requires a codec flush.\\n\");",
"else\nVAR_0->low_delay = 1;",
"}",
"if (VAR_0->avctx->has_b_frames < 2)\nVAR_0->avctx->has_b_frames = !VAR_0->low_delay;",
"if (VAR_0->avctx->bits_per_raw_sample != VAR_0->sps.bit_depth_luma ||\nVAR_0->cur_chroma_format_idc != VAR_0->sps.chroma_format_idc) {",
"if (VAR_0->avctx->codec &&\nVAR_0->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU &&\n(VAR_0->sps.bit_depth_luma != 8 || VAR_0->sps.chroma_format_idc > 1)) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"VDPAU decoding does not support video colorspace.\\n\");",
"return AVERROR_INVALIDDATA;",
"}",
"if (VAR_0->sps.bit_depth_luma >= 8 && VAR_0->sps.bit_depth_luma <= 14 &&\nVAR_0->sps.bit_depth_luma != 11 && VAR_0->sps.bit_depth_luma != 13) {",
"VAR_0->avctx->bits_per_raw_sample = VAR_0->sps.bit_depth_luma;",
"VAR_0->cur_chroma_format_idc = VAR_0->sps.chroma_format_idc;",
"VAR_0->pixel_shift = VAR_0->sps.bit_depth_luma > 8;",
"ff_h264dsp_init(&VAR_0->h264dsp, VAR_0->sps.bit_depth_luma,\nVAR_0->sps.chroma_format_idc);",
"ff_h264chroma_init(&VAR_0->h264chroma, VAR_0->sps.bit_depth_chroma);",
"ff_h264qpel_init(&VAR_0->h264qpel, VAR_0->sps.bit_depth_luma);",
"ff_h264_pred_init(&VAR_0->hpc, VAR_0->avctx->codec_id, VAR_0->sps.bit_depth_luma,\nVAR_0->sps.chroma_format_idc);",
"ff_videodsp_init(&VAR_0->vdsp, VAR_0->sps.bit_depth_luma);",
"} else {",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"Unsupported bit depth %d\\n\",\nVAR_0->sps.bit_depth_luma);",
"return AVERROR_INVALIDDATA;",
"}",
"}",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5,
7,
9
],
[
11,
13,
15
],
[
17,
19
],
[
21
],
[
25,
27
],
[
31,
33
],
[
35,
37,
39
],
[
41,
43
],
[
45
],
[
47
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
61,
63
],
[
65
],
[
67
],
[
69,
71
],
[
75
],
[
77
],
[
79,
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
]
]
|
15,580 | static void gen_compute_branch(DisasContext *ctx, uint32_t opc, int r1,
int r2 , int32_t constant , int32_t offset)
{
TCGv temp, temp2;
int n;
switch (opc) {
/* SB-format jumps */
case OPC1_16_SB_J:
case OPC1_32_B_J:
gen_goto_tb(ctx, 0, ctx->pc + offset * 2);
break;
case OPC1_32_B_CALL:
case OPC1_16_SB_CALL:
gen_helper_1arg(call, ctx->next_pc);
gen_goto_tb(ctx, 0, ctx->pc + offset * 2);
break;
case OPC1_16_SB_JZ:
gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_d[15], 0, offset);
break;
case OPC1_16_SB_JNZ:
gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_d[15], 0, offset);
break;
/* SBC-format jumps */
case OPC1_16_SBC_JEQ:
gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_d[15], constant, offset);
break;
case OPC1_16_SBC_JNE:
gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_d[15], constant, offset);
break;
/* SBRN-format jumps */
case OPC1_16_SBRN_JZ_T:
temp = tcg_temp_new();
tcg_gen_andi_tl(temp, cpu_gpr_d[15], 0x1u << constant);
gen_branch_condi(ctx, TCG_COND_EQ, temp, 0, offset);
tcg_temp_free(temp);
break;
case OPC1_16_SBRN_JNZ_T:
temp = tcg_temp_new();
tcg_gen_andi_tl(temp, cpu_gpr_d[15], 0x1u << constant);
gen_branch_condi(ctx, TCG_COND_NE, temp, 0, offset);
tcg_temp_free(temp);
break;
/* SBR-format jumps */
case OPC1_16_SBR_JEQ:
gen_branch_cond(ctx, TCG_COND_EQ, cpu_gpr_d[r1], cpu_gpr_d[15],
offset);
break;
case OPC1_16_SBR_JNE:
gen_branch_cond(ctx, TCG_COND_NE, cpu_gpr_d[r1], cpu_gpr_d[15],
offset);
break;
case OPC1_16_SBR_JNZ:
gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_d[r1], 0, offset);
break;
case OPC1_16_SBR_JNZ_A:
gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_a[r1], 0, offset);
break;
case OPC1_16_SBR_JGEZ:
gen_branch_condi(ctx, TCG_COND_GE, cpu_gpr_d[r1], 0, offset);
break;
case OPC1_16_SBR_JGTZ:
gen_branch_condi(ctx, TCG_COND_GT, cpu_gpr_d[r1], 0, offset);
break;
case OPC1_16_SBR_JLEZ:
gen_branch_condi(ctx, TCG_COND_LE, cpu_gpr_d[r1], 0, offset);
break;
case OPC1_16_SBR_JLTZ:
gen_branch_condi(ctx, TCG_COND_LT, cpu_gpr_d[r1], 0, offset);
break;
case OPC1_16_SBR_JZ:
gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_d[r1], 0, offset);
break;
case OPC1_16_SBR_JZ_A:
gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_a[r1], 0, offset);
break;
case OPC1_16_SBR_LOOP:
gen_loop(ctx, r1, offset * 2 - 32);
break;
/* SR-format jumps */
case OPC1_16_SR_JI:
tcg_gen_andi_tl(cpu_PC, cpu_gpr_a[r1], 0xfffffffe);
tcg_gen_exit_tb(0);
break;
case OPC2_32_SYS_RET:
case OPC2_16_SR_RET:
gen_helper_ret(cpu_env);
tcg_gen_exit_tb(0);
break;
/* B-format */
case OPC1_32_B_CALLA:
gen_helper_1arg(call, ctx->next_pc);
gen_goto_tb(ctx, 0, EA_B_ABSOLUT(offset));
break;
case OPC1_32_B_FCALL:
gen_fcall_save_ctx(ctx);
gen_goto_tb(ctx, 0, ctx->pc + offset * 2);
break;
case OPC1_32_B_FCALLA:
gen_fcall_save_ctx(ctx);
gen_goto_tb(ctx, 0, EA_B_ABSOLUT(offset));
break;
case OPC1_32_B_JLA:
tcg_gen_movi_tl(cpu_gpr_a[11], ctx->next_pc);
/* fall through */
case OPC1_32_B_JA:
gen_goto_tb(ctx, 0, EA_B_ABSOLUT(offset));
break;
case OPC1_32_B_JL:
tcg_gen_movi_tl(cpu_gpr_a[11], ctx->next_pc);
gen_goto_tb(ctx, 0, ctx->pc + offset * 2);
break;
/* BOL format */
case OPCM_32_BRC_EQ_NEQ:
if (MASK_OP_BRC_OP2(ctx->opcode) == OPC2_32_BRC_JEQ) {
gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_d[r1], constant, offset);
} else {
gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_d[r1], constant, offset);
}
break;
case OPCM_32_BRC_GE:
if (MASK_OP_BRC_OP2(ctx->opcode) == OP2_32_BRC_JGE) {
gen_branch_condi(ctx, TCG_COND_GE, cpu_gpr_d[r1], constant, offset);
} else {
constant = MASK_OP_BRC_CONST4(ctx->opcode);
gen_branch_condi(ctx, TCG_COND_GEU, cpu_gpr_d[r1], constant,
offset);
}
break;
case OPCM_32_BRC_JLT:
if (MASK_OP_BRC_OP2(ctx->opcode) == OPC2_32_BRC_JLT) {
gen_branch_condi(ctx, TCG_COND_LT, cpu_gpr_d[r1], constant, offset);
} else {
constant = MASK_OP_BRC_CONST4(ctx->opcode);
gen_branch_condi(ctx, TCG_COND_LTU, cpu_gpr_d[r1], constant,
offset);
}
break;
case OPCM_32_BRC_JNE:
temp = tcg_temp_new();
if (MASK_OP_BRC_OP2(ctx->opcode) == OPC2_32_BRC_JNED) {
tcg_gen_mov_tl(temp, cpu_gpr_d[r1]);
/* subi is unconditional */
tcg_gen_subi_tl(cpu_gpr_d[r1], cpu_gpr_d[r1], 1);
gen_branch_condi(ctx, TCG_COND_NE, temp, constant, offset);
} else {
tcg_gen_mov_tl(temp, cpu_gpr_d[r1]);
/* addi is unconditional */
tcg_gen_addi_tl(cpu_gpr_d[r1], cpu_gpr_d[r1], 1);
gen_branch_condi(ctx, TCG_COND_NE, temp, constant, offset);
}
tcg_temp_free(temp);
break;
/* BRN format */
case OPCM_32_BRN_JTT:
n = MASK_OP_BRN_N(ctx->opcode);
temp = tcg_temp_new();
tcg_gen_andi_tl(temp, cpu_gpr_d[r1], (1 << n));
if (MASK_OP_BRN_OP2(ctx->opcode) == OPC2_32_BRN_JNZ_T) {
gen_branch_condi(ctx, TCG_COND_NE, temp, 0, offset);
} else {
gen_branch_condi(ctx, TCG_COND_EQ, temp, 0, offset);
}
tcg_temp_free(temp);
break;
/* BRR Format */
case OPCM_32_BRR_EQ_NEQ:
if (MASK_OP_BRR_OP2(ctx->opcode) == OPC2_32_BRR_JEQ) {
gen_branch_cond(ctx, TCG_COND_EQ, cpu_gpr_d[r1], cpu_gpr_d[r2],
offset);
} else {
gen_branch_cond(ctx, TCG_COND_NE, cpu_gpr_d[r1], cpu_gpr_d[r2],
offset);
}
break;
case OPCM_32_BRR_ADDR_EQ_NEQ:
if (MASK_OP_BRR_OP2(ctx->opcode) == OPC2_32_BRR_JEQ_A) {
gen_branch_cond(ctx, TCG_COND_EQ, cpu_gpr_a[r1], cpu_gpr_a[r2],
offset);
} else {
gen_branch_cond(ctx, TCG_COND_NE, cpu_gpr_a[r1], cpu_gpr_a[r2],
offset);
}
break;
case OPCM_32_BRR_GE:
if (MASK_OP_BRR_OP2(ctx->opcode) == OPC2_32_BRR_JGE) {
gen_branch_cond(ctx, TCG_COND_GE, cpu_gpr_d[r1], cpu_gpr_d[r2],
offset);
} else {
gen_branch_cond(ctx, TCG_COND_GEU, cpu_gpr_d[r1], cpu_gpr_d[r2],
offset);
}
break;
case OPCM_32_BRR_JLT:
if (MASK_OP_BRR_OP2(ctx->opcode) == OPC2_32_BRR_JLT) {
gen_branch_cond(ctx, TCG_COND_LT, cpu_gpr_d[r1], cpu_gpr_d[r2],
offset);
} else {
gen_branch_cond(ctx, TCG_COND_LTU, cpu_gpr_d[r1], cpu_gpr_d[r2],
offset);
}
break;
case OPCM_32_BRR_LOOP:
if (MASK_OP_BRR_OP2(ctx->opcode) == OPC2_32_BRR_LOOP) {
gen_loop(ctx, r2, offset * 2);
} else {
/* OPC2_32_BRR_LOOPU */
gen_goto_tb(ctx, 0, ctx->pc + offset * 2);
}
break;
case OPCM_32_BRR_JNE:
temp = tcg_temp_new();
temp2 = tcg_temp_new();
if (MASK_OP_BRC_OP2(ctx->opcode) == OPC2_32_BRR_JNED) {
tcg_gen_mov_tl(temp, cpu_gpr_d[r1]);
/* also save r2, in case of r1 == r2, so r2 is not decremented */
tcg_gen_mov_tl(temp2, cpu_gpr_d[r2]);
/* subi is unconditional */
tcg_gen_subi_tl(cpu_gpr_d[r1], cpu_gpr_d[r1], 1);
gen_branch_cond(ctx, TCG_COND_NE, temp, temp2, offset);
} else {
tcg_gen_mov_tl(temp, cpu_gpr_d[r1]);
/* also save r2, in case of r1 == r2, so r2 is not decremented */
tcg_gen_mov_tl(temp2, cpu_gpr_d[r2]);
/* addi is unconditional */
tcg_gen_addi_tl(cpu_gpr_d[r1], cpu_gpr_d[r1], 1);
gen_branch_cond(ctx, TCG_COND_NE, temp, temp2, offset);
}
tcg_temp_free(temp);
tcg_temp_free(temp2);
break;
case OPCM_32_BRR_JNZ:
if (MASK_OP_BRR_OP2(ctx->opcode) == OPC2_32_BRR_JNZ_A) {
gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_a[r1], 0, offset);
} else {
gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_a[r1], 0, offset);
}
break;
default:
printf("Branch Error at %x\n", ctx->pc);
}
ctx->bstate = BS_BRANCH;
}
| true | qemu | f678f671ba654d4610f0e43d175c8c1b2fad10df | static void gen_compute_branch(DisasContext *ctx, uint32_t opc, int r1,
int r2 , int32_t constant , int32_t offset)
{
TCGv temp, temp2;
int n;
switch (opc) {
case OPC1_16_SB_J:
case OPC1_32_B_J:
gen_goto_tb(ctx, 0, ctx->pc + offset * 2);
break;
case OPC1_32_B_CALL:
case OPC1_16_SB_CALL:
gen_helper_1arg(call, ctx->next_pc);
gen_goto_tb(ctx, 0, ctx->pc + offset * 2);
break;
case OPC1_16_SB_JZ:
gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_d[15], 0, offset);
break;
case OPC1_16_SB_JNZ:
gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_d[15], 0, offset);
break;
case OPC1_16_SBC_JEQ:
gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_d[15], constant, offset);
break;
case OPC1_16_SBC_JNE:
gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_d[15], constant, offset);
break;
case OPC1_16_SBRN_JZ_T:
temp = tcg_temp_new();
tcg_gen_andi_tl(temp, cpu_gpr_d[15], 0x1u << constant);
gen_branch_condi(ctx, TCG_COND_EQ, temp, 0, offset);
tcg_temp_free(temp);
break;
case OPC1_16_SBRN_JNZ_T:
temp = tcg_temp_new();
tcg_gen_andi_tl(temp, cpu_gpr_d[15], 0x1u << constant);
gen_branch_condi(ctx, TCG_COND_NE, temp, 0, offset);
tcg_temp_free(temp);
break;
case OPC1_16_SBR_JEQ:
gen_branch_cond(ctx, TCG_COND_EQ, cpu_gpr_d[r1], cpu_gpr_d[15],
offset);
break;
case OPC1_16_SBR_JNE:
gen_branch_cond(ctx, TCG_COND_NE, cpu_gpr_d[r1], cpu_gpr_d[15],
offset);
break;
case OPC1_16_SBR_JNZ:
gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_d[r1], 0, offset);
break;
case OPC1_16_SBR_JNZ_A:
gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_a[r1], 0, offset);
break;
case OPC1_16_SBR_JGEZ:
gen_branch_condi(ctx, TCG_COND_GE, cpu_gpr_d[r1], 0, offset);
break;
case OPC1_16_SBR_JGTZ:
gen_branch_condi(ctx, TCG_COND_GT, cpu_gpr_d[r1], 0, offset);
break;
case OPC1_16_SBR_JLEZ:
gen_branch_condi(ctx, TCG_COND_LE, cpu_gpr_d[r1], 0, offset);
break;
case OPC1_16_SBR_JLTZ:
gen_branch_condi(ctx, TCG_COND_LT, cpu_gpr_d[r1], 0, offset);
break;
case OPC1_16_SBR_JZ:
gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_d[r1], 0, offset);
break;
case OPC1_16_SBR_JZ_A:
gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_a[r1], 0, offset);
break;
case OPC1_16_SBR_LOOP:
gen_loop(ctx, r1, offset * 2 - 32);
break;
case OPC1_16_SR_JI:
tcg_gen_andi_tl(cpu_PC, cpu_gpr_a[r1], 0xfffffffe);
tcg_gen_exit_tb(0);
break;
case OPC2_32_SYS_RET:
case OPC2_16_SR_RET:
gen_helper_ret(cpu_env);
tcg_gen_exit_tb(0);
break;
case OPC1_32_B_CALLA:
gen_helper_1arg(call, ctx->next_pc);
gen_goto_tb(ctx, 0, EA_B_ABSOLUT(offset));
break;
case OPC1_32_B_FCALL:
gen_fcall_save_ctx(ctx);
gen_goto_tb(ctx, 0, ctx->pc + offset * 2);
break;
case OPC1_32_B_FCALLA:
gen_fcall_save_ctx(ctx);
gen_goto_tb(ctx, 0, EA_B_ABSOLUT(offset));
break;
case OPC1_32_B_JLA:
tcg_gen_movi_tl(cpu_gpr_a[11], ctx->next_pc);
case OPC1_32_B_JA:
gen_goto_tb(ctx, 0, EA_B_ABSOLUT(offset));
break;
case OPC1_32_B_JL:
tcg_gen_movi_tl(cpu_gpr_a[11], ctx->next_pc);
gen_goto_tb(ctx, 0, ctx->pc + offset * 2);
break;
case OPCM_32_BRC_EQ_NEQ:
if (MASK_OP_BRC_OP2(ctx->opcode) == OPC2_32_BRC_JEQ) {
gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_d[r1], constant, offset);
} else {
gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_d[r1], constant, offset);
}
break;
case OPCM_32_BRC_GE:
if (MASK_OP_BRC_OP2(ctx->opcode) == OP2_32_BRC_JGE) {
gen_branch_condi(ctx, TCG_COND_GE, cpu_gpr_d[r1], constant, offset);
} else {
constant = MASK_OP_BRC_CONST4(ctx->opcode);
gen_branch_condi(ctx, TCG_COND_GEU, cpu_gpr_d[r1], constant,
offset);
}
break;
case OPCM_32_BRC_JLT:
if (MASK_OP_BRC_OP2(ctx->opcode) == OPC2_32_BRC_JLT) {
gen_branch_condi(ctx, TCG_COND_LT, cpu_gpr_d[r1], constant, offset);
} else {
constant = MASK_OP_BRC_CONST4(ctx->opcode);
gen_branch_condi(ctx, TCG_COND_LTU, cpu_gpr_d[r1], constant,
offset);
}
break;
case OPCM_32_BRC_JNE:
temp = tcg_temp_new();
if (MASK_OP_BRC_OP2(ctx->opcode) == OPC2_32_BRC_JNED) {
tcg_gen_mov_tl(temp, cpu_gpr_d[r1]);
tcg_gen_subi_tl(cpu_gpr_d[r1], cpu_gpr_d[r1], 1);
gen_branch_condi(ctx, TCG_COND_NE, temp, constant, offset);
} else {
tcg_gen_mov_tl(temp, cpu_gpr_d[r1]);
tcg_gen_addi_tl(cpu_gpr_d[r1], cpu_gpr_d[r1], 1);
gen_branch_condi(ctx, TCG_COND_NE, temp, constant, offset);
}
tcg_temp_free(temp);
break;
case OPCM_32_BRN_JTT:
n = MASK_OP_BRN_N(ctx->opcode);
temp = tcg_temp_new();
tcg_gen_andi_tl(temp, cpu_gpr_d[r1], (1 << n));
if (MASK_OP_BRN_OP2(ctx->opcode) == OPC2_32_BRN_JNZ_T) {
gen_branch_condi(ctx, TCG_COND_NE, temp, 0, offset);
} else {
gen_branch_condi(ctx, TCG_COND_EQ, temp, 0, offset);
}
tcg_temp_free(temp);
break;
case OPCM_32_BRR_EQ_NEQ:
if (MASK_OP_BRR_OP2(ctx->opcode) == OPC2_32_BRR_JEQ) {
gen_branch_cond(ctx, TCG_COND_EQ, cpu_gpr_d[r1], cpu_gpr_d[r2],
offset);
} else {
gen_branch_cond(ctx, TCG_COND_NE, cpu_gpr_d[r1], cpu_gpr_d[r2],
offset);
}
break;
case OPCM_32_BRR_ADDR_EQ_NEQ:
if (MASK_OP_BRR_OP2(ctx->opcode) == OPC2_32_BRR_JEQ_A) {
gen_branch_cond(ctx, TCG_COND_EQ, cpu_gpr_a[r1], cpu_gpr_a[r2],
offset);
} else {
gen_branch_cond(ctx, TCG_COND_NE, cpu_gpr_a[r1], cpu_gpr_a[r2],
offset);
}
break;
case OPCM_32_BRR_GE:
if (MASK_OP_BRR_OP2(ctx->opcode) == OPC2_32_BRR_JGE) {
gen_branch_cond(ctx, TCG_COND_GE, cpu_gpr_d[r1], cpu_gpr_d[r2],
offset);
} else {
gen_branch_cond(ctx, TCG_COND_GEU, cpu_gpr_d[r1], cpu_gpr_d[r2],
offset);
}
break;
case OPCM_32_BRR_JLT:
if (MASK_OP_BRR_OP2(ctx->opcode) == OPC2_32_BRR_JLT) {
gen_branch_cond(ctx, TCG_COND_LT, cpu_gpr_d[r1], cpu_gpr_d[r2],
offset);
} else {
gen_branch_cond(ctx, TCG_COND_LTU, cpu_gpr_d[r1], cpu_gpr_d[r2],
offset);
}
break;
case OPCM_32_BRR_LOOP:
if (MASK_OP_BRR_OP2(ctx->opcode) == OPC2_32_BRR_LOOP) {
gen_loop(ctx, r2, offset * 2);
} else {
gen_goto_tb(ctx, 0, ctx->pc + offset * 2);
}
break;
case OPCM_32_BRR_JNE:
temp = tcg_temp_new();
temp2 = tcg_temp_new();
if (MASK_OP_BRC_OP2(ctx->opcode) == OPC2_32_BRR_JNED) {
tcg_gen_mov_tl(temp, cpu_gpr_d[r1]);
tcg_gen_mov_tl(temp2, cpu_gpr_d[r2]);
tcg_gen_subi_tl(cpu_gpr_d[r1], cpu_gpr_d[r1], 1);
gen_branch_cond(ctx, TCG_COND_NE, temp, temp2, offset);
} else {
tcg_gen_mov_tl(temp, cpu_gpr_d[r1]);
tcg_gen_mov_tl(temp2, cpu_gpr_d[r2]);
tcg_gen_addi_tl(cpu_gpr_d[r1], cpu_gpr_d[r1], 1);
gen_branch_cond(ctx, TCG_COND_NE, temp, temp2, offset);
}
tcg_temp_free(temp);
tcg_temp_free(temp2);
break;
case OPCM_32_BRR_JNZ:
if (MASK_OP_BRR_OP2(ctx->opcode) == OPC2_32_BRR_JNZ_A) {
gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_a[r1], 0, offset);
} else {
gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_a[r1], 0, offset);
}
break;
default:
printf("Branch Error at %x\n", ctx->pc);
}
ctx->bstate = BS_BRANCH;
}
| {
"code": [
" printf(\"Branch Error at %x\\n\", ctx->pc);"
],
"line_no": [
483
]
} | static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1, int VAR_2,
int VAR_3 , int32_t VAR_4 , int32_t VAR_5)
{
TCGv temp, temp2;
int VAR_6;
switch (VAR_1) {
case OPC1_16_SB_J:
case OPC1_32_B_J:
gen_goto_tb(VAR_0, 0, VAR_0->pc + VAR_5 * 2);
break;
case OPC1_32_B_CALL:
case OPC1_16_SB_CALL:
gen_helper_1arg(call, VAR_0->next_pc);
gen_goto_tb(VAR_0, 0, VAR_0->pc + VAR_5 * 2);
break;
case OPC1_16_SB_JZ:
gen_branch_condi(VAR_0, TCG_COND_EQ, cpu_gpr_d[15], 0, VAR_5);
break;
case OPC1_16_SB_JNZ:
gen_branch_condi(VAR_0, TCG_COND_NE, cpu_gpr_d[15], 0, VAR_5);
break;
case OPC1_16_SBC_JEQ:
gen_branch_condi(VAR_0, TCG_COND_EQ, cpu_gpr_d[15], VAR_4, VAR_5);
break;
case OPC1_16_SBC_JNE:
gen_branch_condi(VAR_0, TCG_COND_NE, cpu_gpr_d[15], VAR_4, VAR_5);
break;
case OPC1_16_SBRN_JZ_T:
temp = tcg_temp_new();
tcg_gen_andi_tl(temp, cpu_gpr_d[15], 0x1u << VAR_4);
gen_branch_condi(VAR_0, TCG_COND_EQ, temp, 0, VAR_5);
tcg_temp_free(temp);
break;
case OPC1_16_SBRN_JNZ_T:
temp = tcg_temp_new();
tcg_gen_andi_tl(temp, cpu_gpr_d[15], 0x1u << VAR_4);
gen_branch_condi(VAR_0, TCG_COND_NE, temp, 0, VAR_5);
tcg_temp_free(temp);
break;
case OPC1_16_SBR_JEQ:
gen_branch_cond(VAR_0, TCG_COND_EQ, cpu_gpr_d[VAR_2], cpu_gpr_d[15],
VAR_5);
break;
case OPC1_16_SBR_JNE:
gen_branch_cond(VAR_0, TCG_COND_NE, cpu_gpr_d[VAR_2], cpu_gpr_d[15],
VAR_5);
break;
case OPC1_16_SBR_JNZ:
gen_branch_condi(VAR_0, TCG_COND_NE, cpu_gpr_d[VAR_2], 0, VAR_5);
break;
case OPC1_16_SBR_JNZ_A:
gen_branch_condi(VAR_0, TCG_COND_NE, cpu_gpr_a[VAR_2], 0, VAR_5);
break;
case OPC1_16_SBR_JGEZ:
gen_branch_condi(VAR_0, TCG_COND_GE, cpu_gpr_d[VAR_2], 0, VAR_5);
break;
case OPC1_16_SBR_JGTZ:
gen_branch_condi(VAR_0, TCG_COND_GT, cpu_gpr_d[VAR_2], 0, VAR_5);
break;
case OPC1_16_SBR_JLEZ:
gen_branch_condi(VAR_0, TCG_COND_LE, cpu_gpr_d[VAR_2], 0, VAR_5);
break;
case OPC1_16_SBR_JLTZ:
gen_branch_condi(VAR_0, TCG_COND_LT, cpu_gpr_d[VAR_2], 0, VAR_5);
break;
case OPC1_16_SBR_JZ:
gen_branch_condi(VAR_0, TCG_COND_EQ, cpu_gpr_d[VAR_2], 0, VAR_5);
break;
case OPC1_16_SBR_JZ_A:
gen_branch_condi(VAR_0, TCG_COND_EQ, cpu_gpr_a[VAR_2], 0, VAR_5);
break;
case OPC1_16_SBR_LOOP:
gen_loop(VAR_0, VAR_2, VAR_5 * 2 - 32);
break;
case OPC1_16_SR_JI:
tcg_gen_andi_tl(cpu_PC, cpu_gpr_a[VAR_2], 0xfffffffe);
tcg_gen_exit_tb(0);
break;
case OPC2_32_SYS_RET:
case OPC2_16_SR_RET:
gen_helper_ret(cpu_env);
tcg_gen_exit_tb(0);
break;
case OPC1_32_B_CALLA:
gen_helper_1arg(call, VAR_0->next_pc);
gen_goto_tb(VAR_0, 0, EA_B_ABSOLUT(VAR_5));
break;
case OPC1_32_B_FCALL:
gen_fcall_save_ctx(VAR_0);
gen_goto_tb(VAR_0, 0, VAR_0->pc + VAR_5 * 2);
break;
case OPC1_32_B_FCALLA:
gen_fcall_save_ctx(VAR_0);
gen_goto_tb(VAR_0, 0, EA_B_ABSOLUT(VAR_5));
break;
case OPC1_32_B_JLA:
tcg_gen_movi_tl(cpu_gpr_a[11], VAR_0->next_pc);
case OPC1_32_B_JA:
gen_goto_tb(VAR_0, 0, EA_B_ABSOLUT(VAR_5));
break;
case OPC1_32_B_JL:
tcg_gen_movi_tl(cpu_gpr_a[11], VAR_0->next_pc);
gen_goto_tb(VAR_0, 0, VAR_0->pc + VAR_5 * 2);
break;
case OPCM_32_BRC_EQ_NEQ:
if (MASK_OP_BRC_OP2(VAR_0->opcode) == OPC2_32_BRC_JEQ) {
gen_branch_condi(VAR_0, TCG_COND_EQ, cpu_gpr_d[VAR_2], VAR_4, VAR_5);
} else {
gen_branch_condi(VAR_0, TCG_COND_NE, cpu_gpr_d[VAR_2], VAR_4, VAR_5);
}
break;
case OPCM_32_BRC_GE:
if (MASK_OP_BRC_OP2(VAR_0->opcode) == OP2_32_BRC_JGE) {
gen_branch_condi(VAR_0, TCG_COND_GE, cpu_gpr_d[VAR_2], VAR_4, VAR_5);
} else {
VAR_4 = MASK_OP_BRC_CONST4(VAR_0->opcode);
gen_branch_condi(VAR_0, TCG_COND_GEU, cpu_gpr_d[VAR_2], VAR_4,
VAR_5);
}
break;
case OPCM_32_BRC_JLT:
if (MASK_OP_BRC_OP2(VAR_0->opcode) == OPC2_32_BRC_JLT) {
gen_branch_condi(VAR_0, TCG_COND_LT, cpu_gpr_d[VAR_2], VAR_4, VAR_5);
} else {
VAR_4 = MASK_OP_BRC_CONST4(VAR_0->opcode);
gen_branch_condi(VAR_0, TCG_COND_LTU, cpu_gpr_d[VAR_2], VAR_4,
VAR_5);
}
break;
case OPCM_32_BRC_JNE:
temp = tcg_temp_new();
if (MASK_OP_BRC_OP2(VAR_0->opcode) == OPC2_32_BRC_JNED) {
tcg_gen_mov_tl(temp, cpu_gpr_d[VAR_2]);
tcg_gen_subi_tl(cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_2], 1);
gen_branch_condi(VAR_0, TCG_COND_NE, temp, VAR_4, VAR_5);
} else {
tcg_gen_mov_tl(temp, cpu_gpr_d[VAR_2]);
tcg_gen_addi_tl(cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_2], 1);
gen_branch_condi(VAR_0, TCG_COND_NE, temp, VAR_4, VAR_5);
}
tcg_temp_free(temp);
break;
case OPCM_32_BRN_JTT:
VAR_6 = MASK_OP_BRN_N(VAR_0->opcode);
temp = tcg_temp_new();
tcg_gen_andi_tl(temp, cpu_gpr_d[VAR_2], (1 << VAR_6));
if (MASK_OP_BRN_OP2(VAR_0->opcode) == OPC2_32_BRN_JNZ_T) {
gen_branch_condi(VAR_0, TCG_COND_NE, temp, 0, VAR_5);
} else {
gen_branch_condi(VAR_0, TCG_COND_EQ, temp, 0, VAR_5);
}
tcg_temp_free(temp);
break;
case OPCM_32_BRR_EQ_NEQ:
if (MASK_OP_BRR_OP2(VAR_0->opcode) == OPC2_32_BRR_JEQ) {
gen_branch_cond(VAR_0, TCG_COND_EQ, cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3],
VAR_5);
} else {
gen_branch_cond(VAR_0, TCG_COND_NE, cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3],
VAR_5);
}
break;
case OPCM_32_BRR_ADDR_EQ_NEQ:
if (MASK_OP_BRR_OP2(VAR_0->opcode) == OPC2_32_BRR_JEQ_A) {
gen_branch_cond(VAR_0, TCG_COND_EQ, cpu_gpr_a[VAR_2], cpu_gpr_a[VAR_3],
VAR_5);
} else {
gen_branch_cond(VAR_0, TCG_COND_NE, cpu_gpr_a[VAR_2], cpu_gpr_a[VAR_3],
VAR_5);
}
break;
case OPCM_32_BRR_GE:
if (MASK_OP_BRR_OP2(VAR_0->opcode) == OPC2_32_BRR_JGE) {
gen_branch_cond(VAR_0, TCG_COND_GE, cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3],
VAR_5);
} else {
gen_branch_cond(VAR_0, TCG_COND_GEU, cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3],
VAR_5);
}
break;
case OPCM_32_BRR_JLT:
if (MASK_OP_BRR_OP2(VAR_0->opcode) == OPC2_32_BRR_JLT) {
gen_branch_cond(VAR_0, TCG_COND_LT, cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3],
VAR_5);
} else {
gen_branch_cond(VAR_0, TCG_COND_LTU, cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3],
VAR_5);
}
break;
case OPCM_32_BRR_LOOP:
if (MASK_OP_BRR_OP2(VAR_0->opcode) == OPC2_32_BRR_LOOP) {
gen_loop(VAR_0, VAR_3, VAR_5 * 2);
} else {
gen_goto_tb(VAR_0, 0, VAR_0->pc + VAR_5 * 2);
}
break;
case OPCM_32_BRR_JNE:
temp = tcg_temp_new();
temp2 = tcg_temp_new();
if (MASK_OP_BRC_OP2(VAR_0->opcode) == OPC2_32_BRR_JNED) {
tcg_gen_mov_tl(temp, cpu_gpr_d[VAR_2]);
tcg_gen_mov_tl(temp2, cpu_gpr_d[VAR_3]);
tcg_gen_subi_tl(cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_2], 1);
gen_branch_cond(VAR_0, TCG_COND_NE, temp, temp2, VAR_5);
} else {
tcg_gen_mov_tl(temp, cpu_gpr_d[VAR_2]);
tcg_gen_mov_tl(temp2, cpu_gpr_d[VAR_3]);
tcg_gen_addi_tl(cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_2], 1);
gen_branch_cond(VAR_0, TCG_COND_NE, temp, temp2, VAR_5);
}
tcg_temp_free(temp);
tcg_temp_free(temp2);
break;
case OPCM_32_BRR_JNZ:
if (MASK_OP_BRR_OP2(VAR_0->opcode) == OPC2_32_BRR_JNZ_A) {
gen_branch_condi(VAR_0, TCG_COND_NE, cpu_gpr_a[VAR_2], 0, VAR_5);
} else {
gen_branch_condi(VAR_0, TCG_COND_EQ, cpu_gpr_a[VAR_2], 0, VAR_5);
}
break;
default:
printf("Branch Error at %x\VAR_6", VAR_0->pc);
}
VAR_0->bstate = BS_BRANCH;
}
| [
"static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1, int VAR_2,\nint VAR_3 , int32_t VAR_4 , int32_t VAR_5)\n{",
"TCGv temp, temp2;",
"int VAR_6;",
"switch (VAR_1) {",
"case OPC1_16_SB_J:\ncase OPC1_32_B_J:\ngen_goto_tb(VAR_0, 0, VAR_0->pc + VAR_5 * 2);",
"break;",
"case OPC1_32_B_CALL:\ncase OPC1_16_SB_CALL:\ngen_helper_1arg(call, VAR_0->next_pc);",
"gen_goto_tb(VAR_0, 0, VAR_0->pc + VAR_5 * 2);",
"break;",
"case OPC1_16_SB_JZ:\ngen_branch_condi(VAR_0, TCG_COND_EQ, cpu_gpr_d[15], 0, VAR_5);",
"break;",
"case OPC1_16_SB_JNZ:\ngen_branch_condi(VAR_0, TCG_COND_NE, cpu_gpr_d[15], 0, VAR_5);",
"break;",
"case OPC1_16_SBC_JEQ:\ngen_branch_condi(VAR_0, TCG_COND_EQ, cpu_gpr_d[15], VAR_4, VAR_5);",
"break;",
"case OPC1_16_SBC_JNE:\ngen_branch_condi(VAR_0, TCG_COND_NE, cpu_gpr_d[15], VAR_4, VAR_5);",
"break;",
"case OPC1_16_SBRN_JZ_T:\ntemp = tcg_temp_new();",
"tcg_gen_andi_tl(temp, cpu_gpr_d[15], 0x1u << VAR_4);",
"gen_branch_condi(VAR_0, TCG_COND_EQ, temp, 0, VAR_5);",
"tcg_temp_free(temp);",
"break;",
"case OPC1_16_SBRN_JNZ_T:\ntemp = tcg_temp_new();",
"tcg_gen_andi_tl(temp, cpu_gpr_d[15], 0x1u << VAR_4);",
"gen_branch_condi(VAR_0, TCG_COND_NE, temp, 0, VAR_5);",
"tcg_temp_free(temp);",
"break;",
"case OPC1_16_SBR_JEQ:\ngen_branch_cond(VAR_0, TCG_COND_EQ, cpu_gpr_d[VAR_2], cpu_gpr_d[15],\nVAR_5);",
"break;",
"case OPC1_16_SBR_JNE:\ngen_branch_cond(VAR_0, TCG_COND_NE, cpu_gpr_d[VAR_2], cpu_gpr_d[15],\nVAR_5);",
"break;",
"case OPC1_16_SBR_JNZ:\ngen_branch_condi(VAR_0, TCG_COND_NE, cpu_gpr_d[VAR_2], 0, VAR_5);",
"break;",
"case OPC1_16_SBR_JNZ_A:\ngen_branch_condi(VAR_0, TCG_COND_NE, cpu_gpr_a[VAR_2], 0, VAR_5);",
"break;",
"case OPC1_16_SBR_JGEZ:\ngen_branch_condi(VAR_0, TCG_COND_GE, cpu_gpr_d[VAR_2], 0, VAR_5);",
"break;",
"case OPC1_16_SBR_JGTZ:\ngen_branch_condi(VAR_0, TCG_COND_GT, cpu_gpr_d[VAR_2], 0, VAR_5);",
"break;",
"case OPC1_16_SBR_JLEZ:\ngen_branch_condi(VAR_0, TCG_COND_LE, cpu_gpr_d[VAR_2], 0, VAR_5);",
"break;",
"case OPC1_16_SBR_JLTZ:\ngen_branch_condi(VAR_0, TCG_COND_LT, cpu_gpr_d[VAR_2], 0, VAR_5);",
"break;",
"case OPC1_16_SBR_JZ:\ngen_branch_condi(VAR_0, TCG_COND_EQ, cpu_gpr_d[VAR_2], 0, VAR_5);",
"break;",
"case OPC1_16_SBR_JZ_A:\ngen_branch_condi(VAR_0, TCG_COND_EQ, cpu_gpr_a[VAR_2], 0, VAR_5);",
"break;",
"case OPC1_16_SBR_LOOP:\ngen_loop(VAR_0, VAR_2, VAR_5 * 2 - 32);",
"break;",
"case OPC1_16_SR_JI:\ntcg_gen_andi_tl(cpu_PC, cpu_gpr_a[VAR_2], 0xfffffffe);",
"tcg_gen_exit_tb(0);",
"break;",
"case OPC2_32_SYS_RET:\ncase OPC2_16_SR_RET:\ngen_helper_ret(cpu_env);",
"tcg_gen_exit_tb(0);",
"break;",
"case OPC1_32_B_CALLA:\ngen_helper_1arg(call, VAR_0->next_pc);",
"gen_goto_tb(VAR_0, 0, EA_B_ABSOLUT(VAR_5));",
"break;",
"case OPC1_32_B_FCALL:\ngen_fcall_save_ctx(VAR_0);",
"gen_goto_tb(VAR_0, 0, VAR_0->pc + VAR_5 * 2);",
"break;",
"case OPC1_32_B_FCALLA:\ngen_fcall_save_ctx(VAR_0);",
"gen_goto_tb(VAR_0, 0, EA_B_ABSOLUT(VAR_5));",
"break;",
"case OPC1_32_B_JLA:\ntcg_gen_movi_tl(cpu_gpr_a[11], VAR_0->next_pc);",
"case OPC1_32_B_JA:\ngen_goto_tb(VAR_0, 0, EA_B_ABSOLUT(VAR_5));",
"break;",
"case OPC1_32_B_JL:\ntcg_gen_movi_tl(cpu_gpr_a[11], VAR_0->next_pc);",
"gen_goto_tb(VAR_0, 0, VAR_0->pc + VAR_5 * 2);",
"break;",
"case OPCM_32_BRC_EQ_NEQ:\nif (MASK_OP_BRC_OP2(VAR_0->opcode) == OPC2_32_BRC_JEQ) {",
"gen_branch_condi(VAR_0, TCG_COND_EQ, cpu_gpr_d[VAR_2], VAR_4, VAR_5);",
"} else {",
"gen_branch_condi(VAR_0, TCG_COND_NE, cpu_gpr_d[VAR_2], VAR_4, VAR_5);",
"}",
"break;",
"case OPCM_32_BRC_GE:\nif (MASK_OP_BRC_OP2(VAR_0->opcode) == OP2_32_BRC_JGE) {",
"gen_branch_condi(VAR_0, TCG_COND_GE, cpu_gpr_d[VAR_2], VAR_4, VAR_5);",
"} else {",
"VAR_4 = MASK_OP_BRC_CONST4(VAR_0->opcode);",
"gen_branch_condi(VAR_0, TCG_COND_GEU, cpu_gpr_d[VAR_2], VAR_4,\nVAR_5);",
"}",
"break;",
"case OPCM_32_BRC_JLT:\nif (MASK_OP_BRC_OP2(VAR_0->opcode) == OPC2_32_BRC_JLT) {",
"gen_branch_condi(VAR_0, TCG_COND_LT, cpu_gpr_d[VAR_2], VAR_4, VAR_5);",
"} else {",
"VAR_4 = MASK_OP_BRC_CONST4(VAR_0->opcode);",
"gen_branch_condi(VAR_0, TCG_COND_LTU, cpu_gpr_d[VAR_2], VAR_4,\nVAR_5);",
"}",
"break;",
"case OPCM_32_BRC_JNE:\ntemp = tcg_temp_new();",
"if (MASK_OP_BRC_OP2(VAR_0->opcode) == OPC2_32_BRC_JNED) {",
"tcg_gen_mov_tl(temp, cpu_gpr_d[VAR_2]);",
"tcg_gen_subi_tl(cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_2], 1);",
"gen_branch_condi(VAR_0, TCG_COND_NE, temp, VAR_4, VAR_5);",
"} else {",
"tcg_gen_mov_tl(temp, cpu_gpr_d[VAR_2]);",
"tcg_gen_addi_tl(cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_2], 1);",
"gen_branch_condi(VAR_0, TCG_COND_NE, temp, VAR_4, VAR_5);",
"}",
"tcg_temp_free(temp);",
"break;",
"case OPCM_32_BRN_JTT:\nVAR_6 = MASK_OP_BRN_N(VAR_0->opcode);",
"temp = tcg_temp_new();",
"tcg_gen_andi_tl(temp, cpu_gpr_d[VAR_2], (1 << VAR_6));",
"if (MASK_OP_BRN_OP2(VAR_0->opcode) == OPC2_32_BRN_JNZ_T) {",
"gen_branch_condi(VAR_0, TCG_COND_NE, temp, 0, VAR_5);",
"} else {",
"gen_branch_condi(VAR_0, TCG_COND_EQ, temp, 0, VAR_5);",
"}",
"tcg_temp_free(temp);",
"break;",
"case OPCM_32_BRR_EQ_NEQ:\nif (MASK_OP_BRR_OP2(VAR_0->opcode) == OPC2_32_BRR_JEQ) {",
"gen_branch_cond(VAR_0, TCG_COND_EQ, cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3],\nVAR_5);",
"} else {",
"gen_branch_cond(VAR_0, TCG_COND_NE, cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3],\nVAR_5);",
"}",
"break;",
"case OPCM_32_BRR_ADDR_EQ_NEQ:\nif (MASK_OP_BRR_OP2(VAR_0->opcode) == OPC2_32_BRR_JEQ_A) {",
"gen_branch_cond(VAR_0, TCG_COND_EQ, cpu_gpr_a[VAR_2], cpu_gpr_a[VAR_3],\nVAR_5);",
"} else {",
"gen_branch_cond(VAR_0, TCG_COND_NE, cpu_gpr_a[VAR_2], cpu_gpr_a[VAR_3],\nVAR_5);",
"}",
"break;",
"case OPCM_32_BRR_GE:\nif (MASK_OP_BRR_OP2(VAR_0->opcode) == OPC2_32_BRR_JGE) {",
"gen_branch_cond(VAR_0, TCG_COND_GE, cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3],\nVAR_5);",
"} else {",
"gen_branch_cond(VAR_0, TCG_COND_GEU, cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3],\nVAR_5);",
"}",
"break;",
"case OPCM_32_BRR_JLT:\nif (MASK_OP_BRR_OP2(VAR_0->opcode) == OPC2_32_BRR_JLT) {",
"gen_branch_cond(VAR_0, TCG_COND_LT, cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3],\nVAR_5);",
"} else {",
"gen_branch_cond(VAR_0, TCG_COND_LTU, cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_3],\nVAR_5);",
"}",
"break;",
"case OPCM_32_BRR_LOOP:\nif (MASK_OP_BRR_OP2(VAR_0->opcode) == OPC2_32_BRR_LOOP) {",
"gen_loop(VAR_0, VAR_3, VAR_5 * 2);",
"} else {",
"gen_goto_tb(VAR_0, 0, VAR_0->pc + VAR_5 * 2);",
"}",
"break;",
"case OPCM_32_BRR_JNE:\ntemp = tcg_temp_new();",
"temp2 = tcg_temp_new();",
"if (MASK_OP_BRC_OP2(VAR_0->opcode) == OPC2_32_BRR_JNED) {",
"tcg_gen_mov_tl(temp, cpu_gpr_d[VAR_2]);",
"tcg_gen_mov_tl(temp2, cpu_gpr_d[VAR_3]);",
"tcg_gen_subi_tl(cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_2], 1);",
"gen_branch_cond(VAR_0, TCG_COND_NE, temp, temp2, VAR_5);",
"} else {",
"tcg_gen_mov_tl(temp, cpu_gpr_d[VAR_2]);",
"tcg_gen_mov_tl(temp2, cpu_gpr_d[VAR_3]);",
"tcg_gen_addi_tl(cpu_gpr_d[VAR_2], cpu_gpr_d[VAR_2], 1);",
"gen_branch_cond(VAR_0, TCG_COND_NE, temp, temp2, VAR_5);",
"}",
"tcg_temp_free(temp);",
"tcg_temp_free(temp2);",
"break;",
"case OPCM_32_BRR_JNZ:\nif (MASK_OP_BRR_OP2(VAR_0->opcode) == OPC2_32_BRR_JNZ_A) {",
"gen_branch_condi(VAR_0, TCG_COND_NE, cpu_gpr_a[VAR_2], 0, VAR_5);",
"} else {",
"gen_branch_condi(VAR_0, TCG_COND_EQ, cpu_gpr_a[VAR_2], 0, VAR_5);",
"}",
"break;",
"default:\nprintf(\"Branch Error at %x\\VAR_6\", VAR_0->pc);",
"}",
"VAR_0->bstate = BS_BRANCH;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
17,
19,
21
],
[
23
],
[
25,
27,
29
],
[
31
],
[
33
],
[
35,
37
],
[
39
],
[
41,
43
],
[
45
],
[
49,
51
],
[
53
],
[
55,
57
],
[
59
],
[
63,
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75,
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
89,
91,
93
],
[
95
],
[
97,
99,
101
],
[
103
],
[
105,
107
],
[
109
],
[
111,
113
],
[
115
],
[
117,
119
],
[
121
],
[
123,
125
],
[
127
],
[
129,
131
],
[
133
],
[
135,
137
],
[
139
],
[
141,
143
],
[
145
],
[
147,
149
],
[
151
],
[
153,
155
],
[
157
],
[
161,
163
],
[
165
],
[
167
],
[
169,
171,
173
],
[
175
],
[
177
],
[
181,
183
],
[
185
],
[
187
],
[
189,
191
],
[
193
],
[
195
],
[
197,
199
],
[
201
],
[
203
],
[
205,
207
],
[
211,
213
],
[
215
],
[
217,
219
],
[
221
],
[
223
],
[
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
],
[
287
],
[
289
],
[
291
],
[
293
],
[
297
],
[
299
],
[
301
],
[
303
],
[
305
],
[
309,
311
],
[
315
],
[
317
],
[
321
],
[
323
],
[
325
],
[
327
],
[
329
],
[
331
],
[
333
],
[
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
],
[
419
],
[
421
],
[
423
],
[
425,
427
],
[
429
],
[
431
],
[
433
],
[
437
],
[
441
],
[
443
],
[
445
],
[
447
],
[
451
],
[
455
],
[
457
],
[
459
],
[
461
],
[
463
],
[
465
],
[
467,
469
],
[
471
],
[
473
],
[
475
],
[
477
],
[
479
],
[
481,
483
],
[
485
],
[
487
],
[
489
]
]
|
15,581 | static inline void RENAME(bgr16ToY)(uint8_t *dst, uint8_t *src, int width)
{
int i;
for(i=0; i<width; i++)
{
int d= ((uint16_t*)src)[i];
int b= d&0x1F;
int g= (d>>5)&0x3F;
int r= (d>>11)&0x1F;
dst[i]= ((2*RY*r + GY*g + 2*BY*b)>>(RGB2YUV_SHIFT-2)) + 16;
}
}
| true | FFmpeg | 2da0d70d5eebe42f9fcd27ee554419ebe2a5da06 | static inline void RENAME(bgr16ToY)(uint8_t *dst, uint8_t *src, int width)
{
int i;
for(i=0; i<width; i++)
{
int d= ((uint16_t*)src)[i];
int b= d&0x1F;
int g= (d>>5)&0x3F;
int r= (d>>11)&0x1F;
dst[i]= ((2*RY*r + GY*g + 2*BY*b)>>(RGB2YUV_SHIFT-2)) + 16;
}
}
| {
"code": [
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\t\tint d= ((uint16_t*)src)[i];",
"\t\tint b= d&0x1F;",
"\t\tint g= (d>>5)&0x3F;",
"\t\tint r= (d>>11)&0x1F;",
"\t\tdst[i]= ((2*RY*r + GY*g + 2*BY*b)>>(RGB2YUV_SHIFT-2)) + 16;",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\t\tint d= ((uint16_t*)src)[i];",
"\t\tint b= d&0x1F;",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\t\tint d= ((uint16_t*)src)[i];",
"\t\tint g= (d>>5)&0x3F;",
"\t\tdst[i]= ((2*RY*r + GY*g + 2*BY*b)>>(RGB2YUV_SHIFT-2)) + 16;",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\t\tint d= ((uint16_t*)src)[i];",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;"
],
"line_no": [
5,
5,
5,
5,
7,
5,
7,
5,
7,
5,
7,
5,
7,
5,
7,
5,
7,
5,
7,
5,
7,
11,
13,
15,
17,
21,
5,
7,
5,
7,
11,
13,
5,
7,
5,
7,
5,
7,
5,
7,
5,
7,
5,
7,
11,
15,
21,
5,
7,
5,
7,
11,
5,
7,
5,
7,
5,
7,
5,
5,
5,
5,
5
]
} | static inline void FUNC_0(bgr16ToY)(uint8_t *dst, uint8_t *src, int width)
{
int VAR_0;
for(VAR_0=0; VAR_0<width; VAR_0++)
{
int d= ((uint16_t*)src)[VAR_0];
int b= d&0x1F;
int g= (d>>5)&0x3F;
int r= (d>>11)&0x1F;
dst[VAR_0]= ((2*RY*r + GY*g + 2*BY*b)>>(RGB2YUV_SHIFT-2)) + 16;
}
}
| [
"static inline void FUNC_0(bgr16ToY)(uint8_t *dst, uint8_t *src, int width)\n{",
"int VAR_0;",
"for(VAR_0=0; VAR_0<width; VAR_0++)",
"{",
"int d= ((uint16_t*)src)[VAR_0];",
"int b= d&0x1F;",
"int g= (d>>5)&0x3F;",
"int r= (d>>11)&0x1F;",
"dst[VAR_0]= ((2*RY*r + GY*g + 2*BY*b)>>(RGB2YUV_SHIFT-2)) + 16;",
"}",
"}"
]
| [
0,
1,
1,
0,
1,
1,
1,
1,
1,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
]
]
|
15,584 | static int film_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
FilmDemuxContext *film = s->priv_data;
AVIOContext *pb = s->pb;
film_sample *sample;
int ret = 0;
int i;
int left, right;
if (film->current_sample >= film->sample_count)
sample = &film->sample_table[film->current_sample];
/* position the stream (will probably be there anyway) */
avio_seek(pb, sample->sample_offset, SEEK_SET);
/* do a special song and dance when loading FILM Cinepak chunks */
if ((sample->stream == film->video_stream_index) &&
(film->video_type == CODEC_ID_CINEPAK)) {
pkt->pos= avio_tell(pb);
if (av_new_packet(pkt, sample->sample_size))
return AVERROR(ENOMEM);
avio_read(pb, pkt->data, sample->sample_size);
} else if ((sample->stream == film->audio_stream_index) &&
(film->audio_channels == 2) &&
(film->audio_type != CODEC_ID_ADPCM_ADX)) {
/* stereo PCM needs to be interleaved */
if (av_new_packet(pkt, sample->sample_size))
return AVERROR(ENOMEM);
/* make sure the interleave buffer is large enough */
if (sample->sample_size > film->stereo_buffer_size) {
av_free(film->stereo_buffer);
film->stereo_buffer_size = sample->sample_size;
film->stereo_buffer = av_malloc(film->stereo_buffer_size);
if (!film->stereo_buffer) {
film->stereo_buffer_size = 0;
return AVERROR(ENOMEM);
}
}
pkt->pos= avio_tell(pb);
ret = avio_read(pb, film->stereo_buffer, sample->sample_size);
if (ret != sample->sample_size)
ret = AVERROR(EIO);
left = 0;
right = sample->sample_size / 2;
for (i = 0; i < sample->sample_size; ) {
if (film->audio_bits == 8) {
pkt->data[i++] = film->stereo_buffer[left++];
pkt->data[i++] = film->stereo_buffer[right++];
} else {
pkt->data[i++] = film->stereo_buffer[left++];
pkt->data[i++] = film->stereo_buffer[left++];
pkt->data[i++] = film->stereo_buffer[right++];
pkt->data[i++] = film->stereo_buffer[right++];
}
}
} else {
ret= av_get_packet(pb, pkt, sample->sample_size);
if (ret != sample->sample_size)
ret = AVERROR(EIO);
}
pkt->stream_index = sample->stream;
pkt->pts = sample->pts;
film->current_sample++;
return ret;
} | true | FFmpeg | 1795fed7bc7a8b8109757cb5f27198c5b05698b5 | static int film_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
FilmDemuxContext *film = s->priv_data;
AVIOContext *pb = s->pb;
film_sample *sample;
int ret = 0;
int i;
int left, right;
if (film->current_sample >= film->sample_count)
sample = &film->sample_table[film->current_sample];
avio_seek(pb, sample->sample_offset, SEEK_SET);
if ((sample->stream == film->video_stream_index) &&
(film->video_type == CODEC_ID_CINEPAK)) {
pkt->pos= avio_tell(pb);
if (av_new_packet(pkt, sample->sample_size))
return AVERROR(ENOMEM);
avio_read(pb, pkt->data, sample->sample_size);
} else if ((sample->stream == film->audio_stream_index) &&
(film->audio_channels == 2) &&
(film->audio_type != CODEC_ID_ADPCM_ADX)) {
if (av_new_packet(pkt, sample->sample_size))
return AVERROR(ENOMEM);
if (sample->sample_size > film->stereo_buffer_size) {
av_free(film->stereo_buffer);
film->stereo_buffer_size = sample->sample_size;
film->stereo_buffer = av_malloc(film->stereo_buffer_size);
if (!film->stereo_buffer) {
film->stereo_buffer_size = 0;
return AVERROR(ENOMEM);
}
}
pkt->pos= avio_tell(pb);
ret = avio_read(pb, film->stereo_buffer, sample->sample_size);
if (ret != sample->sample_size)
ret = AVERROR(EIO);
left = 0;
right = sample->sample_size / 2;
for (i = 0; i < sample->sample_size; ) {
if (film->audio_bits == 8) {
pkt->data[i++] = film->stereo_buffer[left++];
pkt->data[i++] = film->stereo_buffer[right++];
} else {
pkt->data[i++] = film->stereo_buffer[left++];
pkt->data[i++] = film->stereo_buffer[left++];
pkt->data[i++] = film->stereo_buffer[right++];
pkt->data[i++] = film->stereo_buffer[right++];
}
}
} else {
ret= av_get_packet(pb, pkt, sample->sample_size);
if (ret != sample->sample_size)
ret = AVERROR(EIO);
}
pkt->stream_index = sample->stream;
pkt->pts = sample->pts;
film->current_sample++;
return ret;
} | {
"code": [],
"line_no": []
} | static int FUNC_0(AVFormatContext *VAR_0,
AVPacket *VAR_1)
{
FilmDemuxContext *film = VAR_0->priv_data;
AVIOContext *pb = VAR_0->pb;
film_sample *sample;
int VAR_2 = 0;
int VAR_3;
int VAR_4, VAR_5;
if (film->current_sample >= film->sample_count)
sample = &film->sample_table[film->current_sample];
avio_seek(pb, sample->sample_offset, SEEK_SET);
if ((sample->stream == film->video_stream_index) &&
(film->video_type == CODEC_ID_CINEPAK)) {
VAR_1->pos= avio_tell(pb);
if (av_new_packet(VAR_1, sample->sample_size))
return AVERROR(ENOMEM);
avio_read(pb, VAR_1->data, sample->sample_size);
} else if ((sample->stream == film->audio_stream_index) &&
(film->audio_channels == 2) &&
(film->audio_type != CODEC_ID_ADPCM_ADX)) {
if (av_new_packet(VAR_1, sample->sample_size))
return AVERROR(ENOMEM);
if (sample->sample_size > film->stereo_buffer_size) {
av_free(film->stereo_buffer);
film->stereo_buffer_size = sample->sample_size;
film->stereo_buffer = av_malloc(film->stereo_buffer_size);
if (!film->stereo_buffer) {
film->stereo_buffer_size = 0;
return AVERROR(ENOMEM);
}
}
VAR_1->pos= avio_tell(pb);
VAR_2 = avio_read(pb, film->stereo_buffer, sample->sample_size);
if (VAR_2 != sample->sample_size)
VAR_2 = AVERROR(EIO);
VAR_4 = 0;
VAR_5 = sample->sample_size / 2;
for (VAR_3 = 0; VAR_3 < sample->sample_size; ) {
if (film->audio_bits == 8) {
VAR_1->data[VAR_3++] = film->stereo_buffer[VAR_4++];
VAR_1->data[VAR_3++] = film->stereo_buffer[VAR_5++];
} else {
VAR_1->data[VAR_3++] = film->stereo_buffer[VAR_4++];
VAR_1->data[VAR_3++] = film->stereo_buffer[VAR_4++];
VAR_1->data[VAR_3++] = film->stereo_buffer[VAR_5++];
VAR_1->data[VAR_3++] = film->stereo_buffer[VAR_5++];
}
}
} else {
VAR_2= av_get_packet(pb, VAR_1, sample->sample_size);
if (VAR_2 != sample->sample_size)
VAR_2 = AVERROR(EIO);
}
VAR_1->stream_index = sample->stream;
VAR_1->pts = sample->pts;
film->current_sample++;
return VAR_2;
} | [
"static int FUNC_0(AVFormatContext *VAR_0,\nAVPacket *VAR_1)\n{",
"FilmDemuxContext *film = VAR_0->priv_data;",
"AVIOContext *pb = VAR_0->pb;",
"film_sample *sample;",
"int VAR_2 = 0;",
"int VAR_3;",
"int VAR_4, VAR_5;",
"if (film->current_sample >= film->sample_count)\nsample = &film->sample_table[film->current_sample];",
"avio_seek(pb, sample->sample_offset, SEEK_SET);",
"if ((sample->stream == film->video_stream_index) &&\n(film->video_type == CODEC_ID_CINEPAK)) {",
"VAR_1->pos= avio_tell(pb);",
"if (av_new_packet(VAR_1, sample->sample_size))\nreturn AVERROR(ENOMEM);",
"avio_read(pb, VAR_1->data, sample->sample_size);",
"} else if ((sample->stream == film->audio_stream_index) &&",
"(film->audio_channels == 2) &&\n(film->audio_type != CODEC_ID_ADPCM_ADX)) {",
"if (av_new_packet(VAR_1, sample->sample_size))\nreturn AVERROR(ENOMEM);",
"if (sample->sample_size > film->stereo_buffer_size) {",
"av_free(film->stereo_buffer);",
"film->stereo_buffer_size = sample->sample_size;",
"film->stereo_buffer = av_malloc(film->stereo_buffer_size);",
"if (!film->stereo_buffer) {",
"film->stereo_buffer_size = 0;",
"return AVERROR(ENOMEM);",
"}",
"}",
"VAR_1->pos= avio_tell(pb);",
"VAR_2 = avio_read(pb, film->stereo_buffer, sample->sample_size);",
"if (VAR_2 != sample->sample_size)\nVAR_2 = AVERROR(EIO);",
"VAR_4 = 0;",
"VAR_5 = sample->sample_size / 2;",
"for (VAR_3 = 0; VAR_3 < sample->sample_size; ) {",
"if (film->audio_bits == 8) {",
"VAR_1->data[VAR_3++] = film->stereo_buffer[VAR_4++];",
"VAR_1->data[VAR_3++] = film->stereo_buffer[VAR_5++];",
"} else {",
"VAR_1->data[VAR_3++] = film->stereo_buffer[VAR_4++];",
"VAR_1->data[VAR_3++] = film->stereo_buffer[VAR_4++];",
"VAR_1->data[VAR_3++] = film->stereo_buffer[VAR_5++];",
"VAR_1->data[VAR_3++] = film->stereo_buffer[VAR_5++];",
"}",
"}",
"} else {",
"VAR_2= av_get_packet(pb, VAR_1, sample->sample_size);",
"if (VAR_2 != sample->sample_size)\nVAR_2 = AVERROR(EIO);",
"}",
"VAR_1->stream_index = sample->stream;",
"VAR_1->pts = sample->pts;",
"film->current_sample++;",
"return VAR_2;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21,
26
],
[
32
],
[
38,
40
],
[
42
],
[
44,
46
],
[
48
],
[
50
],
[
52,
54
],
[
62,
64
],
[
70
],
[
72
],
[
74
],
[
76
],
[
78
],
[
80
],
[
82
],
[
84
],
[
86
],
[
90
],
[
92
],
[
94,
96
],
[
100
],
[
102
],
[
104
],
[
106
],
[
108
],
[
110
],
[
112
],
[
114
],
[
116
],
[
118
],
[
120
],
[
122
],
[
124
],
[
126
],
[
128
],
[
130,
132
],
[
134
],
[
138
],
[
140
],
[
144
],
[
148
],
[
150
]
]
|
15,585 | static void tcg_out_qemu_st(TCGContext* s, TCGReg data_reg, TCGReg addr_reg,
TCGMemOpIdx oi)
{
TCGMemOp opc = get_memop(oi);
#ifdef CONFIG_SOFTMMU
unsigned mem_index = get_mmuidx(oi);
tcg_insn_unit *label_ptr;
TCGReg base_reg;
base_reg = tcg_out_tlb_read(s, addr_reg, opc, mem_index, 0);
label_ptr = s->code_ptr + 1;
tcg_out_insn(s, RI, BRC, S390_CC_NE, 0);
tcg_out_qemu_st_direct(s, opc, data_reg, base_reg, TCG_REG_R2, 0);
add_qemu_ldst_label(s, 0, oi, data_reg, addr_reg, s->code_ptr, label_ptr);
#else
TCGReg index_reg;
tcg_target_long disp;
tcg_prepare_user_ldst(s, &addr_reg, &index_reg, &disp);
tcg_out_qemu_st_direct(s, opc, data_reg, addr_reg, index_reg, disp);
#endif
}
| true | qemu | cd3b29b745b0ff393b2d37317837bc726b8dacc8 | static void tcg_out_qemu_st(TCGContext* s, TCGReg data_reg, TCGReg addr_reg,
TCGMemOpIdx oi)
{
TCGMemOp opc = get_memop(oi);
#ifdef CONFIG_SOFTMMU
unsigned mem_index = get_mmuidx(oi);
tcg_insn_unit *label_ptr;
TCGReg base_reg;
base_reg = tcg_out_tlb_read(s, addr_reg, opc, mem_index, 0);
label_ptr = s->code_ptr + 1;
tcg_out_insn(s, RI, BRC, S390_CC_NE, 0);
tcg_out_qemu_st_direct(s, opc, data_reg, base_reg, TCG_REG_R2, 0);
add_qemu_ldst_label(s, 0, oi, data_reg, addr_reg, s->code_ptr, label_ptr);
#else
TCGReg index_reg;
tcg_target_long disp;
tcg_prepare_user_ldst(s, &addr_reg, &index_reg, &disp);
tcg_out_qemu_st_direct(s, opc, data_reg, addr_reg, index_reg, disp);
#endif
}
| {
"code": [
" label_ptr = s->code_ptr + 1;",
" tcg_out_insn(s, RI, BRC, S390_CC_NE, 0);",
" label_ptr = s->code_ptr + 1;",
" tcg_out_insn(s, RI, BRC, S390_CC_NE, 0);"
],
"line_no": [
23,
25,
23,
25
]
} | static void FUNC_0(TCGContext* VAR_0, TCGReg VAR_1, TCGReg VAR_2,
TCGMemOpIdx VAR_3)
{
TCGMemOp opc = get_memop(VAR_3);
#ifdef CONFIG_SOFTMMU
unsigned mem_index = get_mmuidx(VAR_3);
tcg_insn_unit *label_ptr;
TCGReg base_reg;
base_reg = tcg_out_tlb_read(VAR_0, VAR_2, opc, mem_index, 0);
label_ptr = VAR_0->code_ptr + 1;
tcg_out_insn(VAR_0, RI, BRC, S390_CC_NE, 0);
tcg_out_qemu_st_direct(VAR_0, opc, VAR_1, base_reg, TCG_REG_R2, 0);
add_qemu_ldst_label(VAR_0, 0, VAR_3, VAR_1, VAR_2, VAR_0->code_ptr, label_ptr);
#else
TCGReg index_reg;
tcg_target_long disp;
tcg_prepare_user_ldst(VAR_0, &VAR_2, &index_reg, &disp);
tcg_out_qemu_st_direct(VAR_0, opc, VAR_1, VAR_2, index_reg, disp);
#endif
}
| [
"static void FUNC_0(TCGContext* VAR_0, TCGReg VAR_1, TCGReg VAR_2,\nTCGMemOpIdx VAR_3)\n{",
"TCGMemOp opc = get_memop(VAR_3);",
"#ifdef CONFIG_SOFTMMU\nunsigned mem_index = get_mmuidx(VAR_3);",
"tcg_insn_unit *label_ptr;",
"TCGReg base_reg;",
"base_reg = tcg_out_tlb_read(VAR_0, VAR_2, opc, mem_index, 0);",
"label_ptr = VAR_0->code_ptr + 1;",
"tcg_out_insn(VAR_0, RI, BRC, S390_CC_NE, 0);",
"tcg_out_qemu_st_direct(VAR_0, opc, VAR_1, base_reg, TCG_REG_R2, 0);",
"add_qemu_ldst_label(VAR_0, 0, VAR_3, VAR_1, VAR_2, VAR_0->code_ptr, label_ptr);",
"#else\nTCGReg index_reg;",
"tcg_target_long disp;",
"tcg_prepare_user_ldst(VAR_0, &VAR_2, &index_reg, &disp);",
"tcg_out_qemu_st_direct(VAR_0, opc, VAR_1, VAR_2, index_reg, disp);",
"#endif\n}"
]
| [
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9,
11
],
[
13
],
[
15
],
[
19
],
[
23
],
[
25
],
[
29
],
[
33
],
[
35,
37
],
[
39
],
[
43
],
[
45
],
[
47,
49
]
]
|
15,586 | static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)
{
int64_t sector_num, end;
BlockDriverState *base = s->base;
BlockDriverState *bs = s->source;
BlockDriverState *target_bs = blk_bs(s->target);
int ret, n;
end = s->bdev_length / BDRV_SECTOR_SIZE;
if (base == NULL && !bdrv_has_zero_init(target_bs)) {
if (!bdrv_can_write_zeroes_with_unmap(target_bs)) {
bdrv_set_dirty_bitmap(s->dirty_bitmap, 0, end);
return 0;
}
s->initial_zeroing_ongoing = true;
for (sector_num = 0; sector_num < end; ) {
int nb_sectors = MIN(end - sector_num,
QEMU_ALIGN_DOWN(INT_MAX, s->granularity) >> BDRV_SECTOR_BITS);
mirror_throttle(s);
if (block_job_is_cancelled(&s->common)) {
s->initial_zeroing_ongoing = false;
return 0;
}
if (s->in_flight >= MAX_IN_FLIGHT) {
trace_mirror_yield(s, s->in_flight, s->buf_free_count, -1);
mirror_wait_for_io(s);
continue;
}
mirror_do_zero_or_discard(s, sector_num, nb_sectors, false);
sector_num += nb_sectors;
}
mirror_wait_for_all_io(s);
s->initial_zeroing_ongoing = false;
}
/* First part, loop on the sectors and initialize the dirty bitmap. */
for (sector_num = 0; sector_num < end; ) {
/* Just to make sure we are not exceeding int limit. */
int nb_sectors = MIN(INT_MAX >> BDRV_SECTOR_BITS,
end - sector_num);
mirror_throttle(s);
if (block_job_is_cancelled(&s->common)) {
return 0;
}
ret = bdrv_is_allocated_above(bs, base, sector_num, nb_sectors, &n);
if (ret < 0) {
return ret;
}
assert(n > 0);
if (ret == 1) {
bdrv_set_dirty_bitmap(s->dirty_bitmap, sector_num, n);
}
sector_num += n;
}
return 0;
}
| true | qemu | 67adf4b39806df42b4c96377b37004de0df3a1fd | static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)
{
int64_t sector_num, end;
BlockDriverState *base = s->base;
BlockDriverState *bs = s->source;
BlockDriverState *target_bs = blk_bs(s->target);
int ret, n;
end = s->bdev_length / BDRV_SECTOR_SIZE;
if (base == NULL && !bdrv_has_zero_init(target_bs)) {
if (!bdrv_can_write_zeroes_with_unmap(target_bs)) {
bdrv_set_dirty_bitmap(s->dirty_bitmap, 0, end);
return 0;
}
s->initial_zeroing_ongoing = true;
for (sector_num = 0; sector_num < end; ) {
int nb_sectors = MIN(end - sector_num,
QEMU_ALIGN_DOWN(INT_MAX, s->granularity) >> BDRV_SECTOR_BITS);
mirror_throttle(s);
if (block_job_is_cancelled(&s->common)) {
s->initial_zeroing_ongoing = false;
return 0;
}
if (s->in_flight >= MAX_IN_FLIGHT) {
trace_mirror_yield(s, s->in_flight, s->buf_free_count, -1);
mirror_wait_for_io(s);
continue;
}
mirror_do_zero_or_discard(s, sector_num, nb_sectors, false);
sector_num += nb_sectors;
}
mirror_wait_for_all_io(s);
s->initial_zeroing_ongoing = false;
}
for (sector_num = 0; sector_num < end; ) {
int nb_sectors = MIN(INT_MAX >> BDRV_SECTOR_BITS,
end - sector_num);
mirror_throttle(s);
if (block_job_is_cancelled(&s->common)) {
return 0;
}
ret = bdrv_is_allocated_above(bs, base, sector_num, nb_sectors, &n);
if (ret < 0) {
return ret;
}
assert(n > 0);
if (ret == 1) {
bdrv_set_dirty_bitmap(s->dirty_bitmap, sector_num, n);
}
sector_num += n;
}
return 0;
}
| {
"code": [
" trace_mirror_yield(s, s->in_flight, s->buf_free_count, -1);"
],
"line_no": [
59
]
} | static int VAR_0 mirror_dirty_init(MirrorBlockJob *s)
{
int64_t sector_num, end;
BlockDriverState *base = s->base;
BlockDriverState *bs = s->source;
BlockDriverState *target_bs = blk_bs(s->target);
int ret, n;
end = s->bdev_length / BDRV_SECTOR_SIZE;
if (base == NULL && !bdrv_has_zero_init(target_bs)) {
if (!bdrv_can_write_zeroes_with_unmap(target_bs)) {
bdrv_set_dirty_bitmap(s->dirty_bitmap, 0, end);
return 0;
}
s->initial_zeroing_ongoing = true;
for (sector_num = 0; sector_num < end; ) {
int nb_sectors = MIN(end - sector_num,
QEMU_ALIGN_DOWN(INT_MAX, s->granularity) >> BDRV_SECTOR_BITS);
mirror_throttle(s);
if (block_job_is_cancelled(&s->common)) {
s->initial_zeroing_ongoing = false;
return 0;
}
if (s->in_flight >= MAX_IN_FLIGHT) {
trace_mirror_yield(s, s->in_flight, s->buf_free_count, -1);
mirror_wait_for_io(s);
continue;
}
mirror_do_zero_or_discard(s, sector_num, nb_sectors, false);
sector_num += nb_sectors;
}
mirror_wait_for_all_io(s);
s->initial_zeroing_ongoing = false;
}
for (sector_num = 0; sector_num < end; ) {
int nb_sectors = MIN(INT_MAX >> BDRV_SECTOR_BITS,
end - sector_num);
mirror_throttle(s);
if (block_job_is_cancelled(&s->common)) {
return 0;
}
ret = bdrv_is_allocated_above(bs, base, sector_num, nb_sectors, &n);
if (ret < 0) {
return ret;
}
assert(n > 0);
if (ret == 1) {
bdrv_set_dirty_bitmap(s->dirty_bitmap, sector_num, n);
}
sector_num += n;
}
return 0;
}
| [
"static int VAR_0 mirror_dirty_init(MirrorBlockJob *s)\n{",
"int64_t sector_num, end;",
"BlockDriverState *base = s->base;",
"BlockDriverState *bs = s->source;",
"BlockDriverState *target_bs = blk_bs(s->target);",
"int ret, n;",
"end = s->bdev_length / BDRV_SECTOR_SIZE;",
"if (base == NULL && !bdrv_has_zero_init(target_bs)) {",
"if (!bdrv_can_write_zeroes_with_unmap(target_bs)) {",
"bdrv_set_dirty_bitmap(s->dirty_bitmap, 0, end);",
"return 0;",
"}",
"s->initial_zeroing_ongoing = true;",
"for (sector_num = 0; sector_num < end; ) {",
"int nb_sectors = MIN(end - sector_num,\nQEMU_ALIGN_DOWN(INT_MAX, s->granularity) >> BDRV_SECTOR_BITS);",
"mirror_throttle(s);",
"if (block_job_is_cancelled(&s->common)) {",
"s->initial_zeroing_ongoing = false;",
"return 0;",
"}",
"if (s->in_flight >= MAX_IN_FLIGHT) {",
"trace_mirror_yield(s, s->in_flight, s->buf_free_count, -1);",
"mirror_wait_for_io(s);",
"continue;",
"}",
"mirror_do_zero_or_discard(s, sector_num, nb_sectors, false);",
"sector_num += nb_sectors;",
"}",
"mirror_wait_for_all_io(s);",
"s->initial_zeroing_ongoing = false;",
"}",
"for (sector_num = 0; sector_num < end; ) {",
"int nb_sectors = MIN(INT_MAX >> BDRV_SECTOR_BITS,\nend - sector_num);",
"mirror_throttle(s);",
"if (block_job_is_cancelled(&s->common)) {",
"return 0;",
"}",
"ret = bdrv_is_allocated_above(bs, base, sector_num, nb_sectors, &n);",
"if (ret < 0) {",
"return ret;",
"}",
"assert(n > 0);",
"if (ret == 1) {",
"bdrv_set_dirty_bitmap(s->dirty_bitmap, sector_num, n);",
"}",
"sector_num += n;",
"}",
"return 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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37,
39
],
[
43
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73
],
[
77
],
[
79
],
[
81
],
[
87
],
[
91,
93
],
[
97
],
[
101
],
[
103
],
[
105
],
[
109
],
[
111
],
[
113
],
[
115
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
]
]
|
15,587 | uint32_t do_arm_semihosting(CPUARMState *env)
{
target_ulong args;
char * s;
int nr;
uint32_t ret;
uint32_t len;
#ifdef CONFIG_USER_ONLY
TaskState *ts = env->opaque;
#else
CPUARMState *ts = env;
#endif
nr = env->regs[0];
args = env->regs[1];
switch (nr) {
case TARGET_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 TARGET_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 TARGET_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 TARGET_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 TARGET_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 TARGET_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 TARGET_SYS_READC:
/* XXX: Read from debug console. Not implemented. */
return 0;
case TARGET_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 TARGET_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 TARGET_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 TARGET_SYS_TMPNAM:
/* XXX: Not implemented. */
return -1;
case TARGET_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 TARGET_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 TARGET_SYS_CLOCK:
return clock() / (CLOCKS_PER_SEC / 100);
case TARGET_SYS_TIME:
return set_swi_errno(ts, time(NULL));
case TARGET_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 TARGET_SYS_ERRNO:
#ifdef CONFIG_USER_ONLY
return ts->swi_errno;
#else
return syscall_err;
#endif
case TARGET_SYS_GET_CMDLINE:
{
/* Build a command-line from the original argv.
*
* The inputs are:
* * ARG(0), pointer to a buffer of at least the size
* specified in ARG(1).
* * ARG(1), size of the buffer pointed to by ARG(0) in
* bytes.
*
* The outputs are:
* * ARG(0), pointer to null-terminated string of the
* command line.
* * ARG(1), length of the string pointed to by ARG(0).
*/
char *output_buffer;
size_t input_size = ARG(1);
size_t output_size;
int status = 0;
/* Compute the size of the output string. */
#if !defined(CONFIG_USER_ONLY)
output_size = strlen(ts->boot_info->kernel_filename)
+ 1 /* Separating space. */
+ strlen(ts->boot_info->kernel_cmdline)
+ 1; /* Terminating null byte. */
#else
unsigned int i;
output_size = ts->info->arg_end - ts->info->arg_start;
if (!output_size) {
/* We special-case the "empty command line" case (argc==0).
Just provide the terminating 0. */
output_size = 1;
}
#endif
if (output_size > input_size) {
/* Not enough space to store command-line arguments. */
return -1;
}
/* Adjust the command-line length. */
SET_ARG(1, output_size - 1);
/* Lock the buffer on the ARM side. */
output_buffer = lock_user(VERIFY_WRITE, ARG(0), output_size, 0);
if (!output_buffer) {
return -1;
}
/* Copy the command-line arguments. */
#if !defined(CONFIG_USER_ONLY)
pstrcpy(output_buffer, output_size, ts->boot_info->kernel_filename);
pstrcat(output_buffer, output_size, " ");
pstrcat(output_buffer, output_size, ts->boot_info->kernel_cmdline);
#else
if (output_size == 1) {
/* Empty command-line. */
output_buffer[0] = '\0';
goto out;
}
if (copy_from_user(output_buffer, ts->info->arg_start,
output_size)) {
status = -1;
goto out;
}
/* Separate arguments by white spaces. */
for (i = 0; i < output_size - 1; i++) {
if (output_buffer[i] == 0) {
output_buffer[i] = ' ';
}
}
out:
#endif
/* Unlock the buffer on the ARM side. */
unlock_user(output_buffer, ARG(0), output_size);
return status;
}
case TARGET_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) {
abi_ulong 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 >= limit) {
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 TARGET_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 | 396bef4b3846bf4e80a2bee38e9a2d8554d0f251 | uint32_t do_arm_semihosting(CPUARMState *env)
{
target_ulong args;
char * s;
int nr;
uint32_t ret;
uint32_t len;
#ifdef CONFIG_USER_ONLY
TaskState *ts = env->opaque;
#else
CPUARMState *ts = env;
#endif
nr = env->regs[0];
args = env->regs[1];
switch (nr) {
case TARGET_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 TARGET_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 TARGET_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 TARGET_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 TARGET_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 TARGET_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 TARGET_SYS_READC:
return 0;
case TARGET_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 TARGET_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 TARGET_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 TARGET_SYS_TMPNAM:
return -1;
case TARGET_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 TARGET_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 TARGET_SYS_CLOCK:
return clock() / (CLOCKS_PER_SEC / 100);
case TARGET_SYS_TIME:
return set_swi_errno(ts, time(NULL));
case TARGET_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 TARGET_SYS_ERRNO:
#ifdef CONFIG_USER_ONLY
return ts->swi_errno;
#else
return syscall_err;
#endif
case TARGET_SYS_GET_CMDLINE:
{
char *output_buffer;
size_t input_size = ARG(1);
size_t output_size;
int status = 0;
#if !defined(CONFIG_USER_ONLY)
output_size = strlen(ts->boot_info->kernel_filename)
+ 1
+ strlen(ts->boot_info->kernel_cmdline)
+ 1;
#else
unsigned int i;
output_size = ts->info->arg_end - ts->info->arg_start;
if (!output_size) {
output_size = 1;
}
#endif
if (output_size > input_size) {
return -1;
}
SET_ARG(1, output_size - 1);
output_buffer = lock_user(VERIFY_WRITE, ARG(0), output_size, 0);
if (!output_buffer) {
return -1;
}
#if !defined(CONFIG_USER_ONLY)
pstrcpy(output_buffer, output_size, ts->boot_info->kernel_filename);
pstrcat(output_buffer, output_size, " ");
pstrcat(output_buffer, output_size, ts->boot_info->kernel_cmdline);
#else
if (output_size == 1) {
output_buffer[0] = '\0';
goto out;
}
if (copy_from_user(output_buffer, ts->info->arg_start,
output_size)) {
status = -1;
goto out;
}
for (i = 0; i < output_size - 1; i++) {
if (output_buffer[i] == 0) {
output_buffer[i] = ' ';
}
}
out:
#endif
unlock_user(output_buffer, ARG(0), output_size);
return status;
}
case TARGET_SYS_HEAPINFO:
{
uint32_t *ptr;
uint32_t limit;
#ifdef CONFIG_USER_ONLY
if (!ts->heap_limit) {
abi_ulong ret;
ts->heap_base = do_brk(0);
limit = ts->heap_base + ARM_ANGEL_HEAP_SIZE;
for (;;) {
ret = do_brk(limit);
if (ret >= limit) {
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 TARGET_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": [
" if (ARG(1) >= 12)",
" if (ARG(1) < 4)",
" return STDIN_FILENO;",
" return STDOUT_FILENO;",
" return env->regs[0];"
],
"line_no": [
41,
47,
49,
53,
63
]
} | uint32_t FUNC_0(CPUARMState *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
CPUARMState *ts = env;
#endif
VAR_1 = env->regs[0];
args = env->regs[1];
switch (VAR_1) {
case TARGET_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 TARGET_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 TARGET_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 TARGET_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 TARGET_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 TARGET_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 TARGET_SYS_READC:
return 0;
case TARGET_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 TARGET_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 TARGET_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 TARGET_SYS_TMPNAM:
return -1;
case TARGET_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 TARGET_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 TARGET_SYS_CLOCK:
return clock() / (CLOCKS_PER_SEC / 100);
case TARGET_SYS_TIME:
return set_swi_errno(ts, time(NULL));
case TARGET_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 TARGET_SYS_ERRNO:
#ifdef CONFIG_USER_ONLY
return ts->swi_errno;
#else
return syscall_err;
#endif
case TARGET_SYS_GET_CMDLINE:
{
char *VAR_5;
size_t input_size = ARG(1);
size_t output_size;
int VAR_6 = 0;
#if !defined(CONFIG_USER_ONLY)
output_size = strlen(ts->boot_info->kernel_filename)
+ 1
+ strlen(ts->boot_info->kernel_cmdline)
+ 1;
#else
unsigned int i;
output_size = ts->info->arg_end - ts->info->arg_start;
if (!output_size) {
output_size = 1;
}
#endif
if (output_size > input_size) {
return -1;
}
SET_ARG(1, output_size - 1);
VAR_5 = lock_user(VERIFY_WRITE, ARG(0), output_size, 0);
if (!VAR_5) {
return -1;
}
#if !defined(CONFIG_USER_ONLY)
pstrcpy(VAR_5, output_size, ts->boot_info->kernel_filename);
pstrcat(VAR_5, output_size, " ");
pstrcat(VAR_5, output_size, ts->boot_info->kernel_cmdline);
#else
if (output_size == 1) {
VAR_5[0] = '\0';
goto out;
}
if (copy_from_user(VAR_5, ts->info->arg_start,
output_size)) {
VAR_6 = -1;
goto out;
}
for (i = 0; i < output_size - 1; i++) {
if (VAR_5[i] == 0) {
VAR_5[i] = ' ';
}
}
out:
#endif
unlock_user(VAR_5, ARG(0), output_size);
return VAR_6;
}
case TARGET_SYS_HEAPINFO:
{
uint32_t *ptr;
uint32_t limit;
#ifdef CONFIG_USER_ONLY
if (!ts->heap_limit) {
abi_ulong ret;
ts->heap_base = do_brk(0);
limit = ts->heap_base + ARM_ANGEL_HEAP_SIZE;
for (;;) {
ret = do_brk(limit);
if (ret >= limit) {
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 TARGET_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(CPUARMState *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\nCPUARMState *ts = env;",
"#endif\nVAR_1 = env->regs[0];",
"args = env->regs[1];",
"switch (VAR_1) {",
"case TARGET_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 TARGET_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 TARGET_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 TARGET_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 TARGET_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 TARGET_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 TARGET_SYS_READC:\nreturn 0;",
"case TARGET_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 TARGET_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 TARGET_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 TARGET_SYS_TMPNAM:\nreturn -1;",
"case TARGET_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 TARGET_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 TARGET_SYS_CLOCK:\nreturn clock() / (CLOCKS_PER_SEC / 100);",
"case TARGET_SYS_TIME:\nreturn set_swi_errno(ts, time(NULL));",
"case TARGET_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 TARGET_SYS_ERRNO:\n#ifdef CONFIG_USER_ONLY\nreturn ts->swi_errno;",
"#else\nreturn syscall_err;",
"#endif\ncase TARGET_SYS_GET_CMDLINE:\n{",
"char *VAR_5;",
"size_t input_size = ARG(1);",
"size_t output_size;",
"int VAR_6 = 0;",
"#if !defined(CONFIG_USER_ONLY)\noutput_size = strlen(ts->boot_info->kernel_filename)\n+ 1\n+ strlen(ts->boot_info->kernel_cmdline)\n+ 1;",
"#else\nunsigned int i;",
"output_size = ts->info->arg_end - ts->info->arg_start;",
"if (!output_size) {",
"output_size = 1;",
"}",
"#endif\nif (output_size > input_size) {",
"return -1;",
"}",
"SET_ARG(1, output_size - 1);",
"VAR_5 = lock_user(VERIFY_WRITE, ARG(0), output_size, 0);",
"if (!VAR_5) {",
"return -1;",
"}",
"#if !defined(CONFIG_USER_ONLY)\npstrcpy(VAR_5, output_size, ts->boot_info->kernel_filename);",
"pstrcat(VAR_5, output_size, \" \");",
"pstrcat(VAR_5, output_size, ts->boot_info->kernel_cmdline);",
"#else\nif (output_size == 1) {",
"VAR_5[0] = '\\0';",
"goto out;",
"}",
"if (copy_from_user(VAR_5, ts->info->arg_start,\noutput_size)) {",
"VAR_6 = -1;",
"goto out;",
"}",
"for (i = 0; i < output_size - 1; i++) {",
"if (VAR_5[i] == 0) {",
"VAR_5[i] = ' ';",
"}",
"}",
"out:\n#endif\nunlock_user(VAR_5, ARG(0), output_size);",
"return VAR_6;",
"}",
"case TARGET_SYS_HEAPINFO:\n{",
"uint32_t *ptr;",
"uint32_t limit;",
"#ifdef CONFIG_USER_ONLY\nif (!ts->heap_limit) {",
"abi_ulong ret;",
"ts->heap_base = do_brk(0);",
"limit = ts->heap_base + ARM_ANGEL_HEAP_SIZE;",
"for (;;) {",
"ret = do_brk(limit);",
"if (ret >= limit) {",
"break;",
"}",
"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 TARGET_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,
1,
0,
1,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
423
],
[
425
],
[
427
],
[
429
],
[
435,
437,
439,
441,
443
],
[
445,
447
],
[
451
],
[
453
],
[
459
],
[
461
],
[
463,
467
],
[
471
],
[
473
],
[
479
],
[
485
],
[
487
],
[
489
],
[
491
],
[
497,
499
],
[
501
],
[
503
],
[
505,
507
],
[
511
],
[
513
],
[
515
],
[
519,
521
],
[
523
],
[
525
],
[
527
],
[
533
],
[
535
],
[
537
],
[
539
],
[
541
],
[
543,
545,
549
],
[
553
],
[
555
],
[
557,
559
],
[
561
],
[
563
],
[
567,
573
],
[
575
],
[
579
],
[
581
],
[
585
],
[
587
],
[
589
],
[
591
],
[
593
],
[
595
],
[
597
],
[
599
],
[
601
],
[
605,
609
],
[
611
],
[
613
],
[
615
],
[
617
],
[
619
],
[
621,
623
],
[
625,
629
],
[
633
],
[
635
],
[
637
],
[
639
],
[
641
],
[
643,
645
],
[
647
],
[
649,
651
],
[
653
],
[
655,
657
],
[
659
],
[
661
],
[
663
],
[
665
]
]
|
15,588 | static void video_audio_display(VideoState *s)
{
int i, i_start, x, y1, y, ys, delay, n, nb_display_channels;
int ch, channels, h, h2, bgcolor, fgcolor;
int16_t time_diff;
int rdft_bits, nb_freq;
for (rdft_bits = 1; (1 << rdft_bits) < 2 * s->height; rdft_bits++)
;
nb_freq = 1 << (rdft_bits - 1);
/* compute display index : center on currently output samples */
channels = s->audio_tgt.channels;
nb_display_channels = channels;
if (!s->paused) {
int data_used= s->show_mode == SHOW_MODE_WAVES ? s->width : (2*nb_freq);
n = 2 * channels;
delay = s->audio_write_buf_size;
delay /= n;
/* to be more precise, we take into account the time spent since
the last buffer computation */
if (audio_callback_time) {
time_diff = av_gettime() - audio_callback_time;
delay -= (time_diff * s->audio_tgt.freq) / 1000000;
}
delay += 2 * data_used;
if (delay < data_used)
delay = data_used;
i_start= x = compute_mod(s->sample_array_index - delay * channels, SAMPLE_ARRAY_SIZE);
if (s->show_mode == SHOW_MODE_WAVES) {
h = INT_MIN;
for (i = 0; i < 1000; i += channels) {
int idx = (SAMPLE_ARRAY_SIZE + x - i) % SAMPLE_ARRAY_SIZE;
int a = s->sample_array[idx];
int b = s->sample_array[(idx + 4 * channels) % SAMPLE_ARRAY_SIZE];
int c = s->sample_array[(idx + 5 * channels) % SAMPLE_ARRAY_SIZE];
int d = s->sample_array[(idx + 9 * channels) % SAMPLE_ARRAY_SIZE];
int score = a - d;
if (h < score && (b ^ c) < 0) {
h = score;
i_start = idx;
}
}
}
s->last_i_start = i_start;
} else {
i_start = s->last_i_start;
}
bgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);
if (s->show_mode == SHOW_MODE_WAVES) {
fill_rectangle(screen,
s->xleft, s->ytop, s->width, s->height,
bgcolor, 0);
fgcolor = SDL_MapRGB(screen->format, 0xff, 0xff, 0xff);
/* total height for one channel */
h = s->height / nb_display_channels;
/* graph height / 2 */
h2 = (h * 9) / 20;
for (ch = 0; ch < nb_display_channels; ch++) {
i = i_start + ch;
y1 = s->ytop + ch * h + (h / 2); /* position of center line */
for (x = 0; x < s->width; x++) {
y = (s->sample_array[i] * h2) >> 15;
if (y < 0) {
y = -y;
ys = y1 - y;
} else {
ys = y1;
}
fill_rectangle(screen,
s->xleft + x, ys, 1, y,
fgcolor, 0);
i += channels;
if (i >= SAMPLE_ARRAY_SIZE)
i -= SAMPLE_ARRAY_SIZE;
}
}
fgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0xff);
for (ch = 1; ch < nb_display_channels; ch++) {
y = s->ytop + ch * h;
fill_rectangle(screen,
s->xleft, y, s->width, 1,
fgcolor, 0);
}
SDL_UpdateRect(screen, s->xleft, s->ytop, s->width, s->height);
} else {
nb_display_channels= FFMIN(nb_display_channels, 2);
if (rdft_bits != s->rdft_bits) {
av_rdft_end(s->rdft);
av_free(s->rdft_data);
s->rdft = av_rdft_init(rdft_bits, DFT_R2C);
s->rdft_bits = rdft_bits;
s->rdft_data = av_malloc(4 * nb_freq * sizeof(*s->rdft_data));
}
{
FFTSample *data[2];
for (ch = 0; ch < nb_display_channels; ch++) {
data[ch] = s->rdft_data + 2 * nb_freq * ch;
i = i_start + ch;
for (x = 0; x < 2 * nb_freq; x++) {
double w = (x-nb_freq) * (1.0 / nb_freq);
data[ch][x] = s->sample_array[i] * (1.0 - w * w);
i += channels;
if (i >= SAMPLE_ARRAY_SIZE)
i -= SAMPLE_ARRAY_SIZE;
}
av_rdft_calc(s->rdft, data[ch]);
}
// least efficient way to do this, we should of course directly access it but its more than fast enough
for (y = 0; y < s->height; y++) {
double w = 1 / sqrt(nb_freq);
int a = sqrt(w * sqrt(data[0][2 * y + 0] * data[0][2 * y + 0] + data[0][2 * y + 1] * data[0][2 * y + 1]));
int b = (nb_display_channels == 2 ) ? sqrt(w * sqrt(data[1][2 * y + 0] * data[1][2 * y + 0]
+ data[1][2 * y + 1] * data[1][2 * y + 1])) : a;
a = FFMIN(a, 255);
b = FFMIN(b, 255);
fgcolor = SDL_MapRGB(screen->format, a, b, (a + b) / 2);
fill_rectangle(screen,
s->xpos, s->height-y, 1, 1,
fgcolor, 0);
}
}
SDL_UpdateRect(screen, s->xpos, s->ytop, 1, s->height);
if (!s->paused)
s->xpos++;
if (s->xpos >= s->width)
s->xpos= s->xleft;
}
}
| true | FFmpeg | 92b50b71a1e4e78fa2828dc2e0a4428674a8a9b0 | static void video_audio_display(VideoState *s)
{
int i, i_start, x, y1, y, ys, delay, n, nb_display_channels;
int ch, channels, h, h2, bgcolor, fgcolor;
int16_t time_diff;
int rdft_bits, nb_freq;
for (rdft_bits = 1; (1 << rdft_bits) < 2 * s->height; rdft_bits++)
;
nb_freq = 1 << (rdft_bits - 1);
channels = s->audio_tgt.channels;
nb_display_channels = channels;
if (!s->paused) {
int data_used= s->show_mode == SHOW_MODE_WAVES ? s->width : (2*nb_freq);
n = 2 * channels;
delay = s->audio_write_buf_size;
delay /= n;
if (audio_callback_time) {
time_diff = av_gettime() - audio_callback_time;
delay -= (time_diff * s->audio_tgt.freq) / 1000000;
}
delay += 2 * data_used;
if (delay < data_used)
delay = data_used;
i_start= x = compute_mod(s->sample_array_index - delay * channels, SAMPLE_ARRAY_SIZE);
if (s->show_mode == SHOW_MODE_WAVES) {
h = INT_MIN;
for (i = 0; i < 1000; i += channels) {
int idx = (SAMPLE_ARRAY_SIZE + x - i) % SAMPLE_ARRAY_SIZE;
int a = s->sample_array[idx];
int b = s->sample_array[(idx + 4 * channels) % SAMPLE_ARRAY_SIZE];
int c = s->sample_array[(idx + 5 * channels) % SAMPLE_ARRAY_SIZE];
int d = s->sample_array[(idx + 9 * channels) % SAMPLE_ARRAY_SIZE];
int score = a - d;
if (h < score && (b ^ c) < 0) {
h = score;
i_start = idx;
}
}
}
s->last_i_start = i_start;
} else {
i_start = s->last_i_start;
}
bgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);
if (s->show_mode == SHOW_MODE_WAVES) {
fill_rectangle(screen,
s->xleft, s->ytop, s->width, s->height,
bgcolor, 0);
fgcolor = SDL_MapRGB(screen->format, 0xff, 0xff, 0xff);
h = s->height / nb_display_channels;
h2 = (h * 9) / 20;
for (ch = 0; ch < nb_display_channels; ch++) {
i = i_start + ch;
y1 = s->ytop + ch * h + (h / 2);
for (x = 0; x < s->width; x++) {
y = (s->sample_array[i] * h2) >> 15;
if (y < 0) {
y = -y;
ys = y1 - y;
} else {
ys = y1;
}
fill_rectangle(screen,
s->xleft + x, ys, 1, y,
fgcolor, 0);
i += channels;
if (i >= SAMPLE_ARRAY_SIZE)
i -= SAMPLE_ARRAY_SIZE;
}
}
fgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0xff);
for (ch = 1; ch < nb_display_channels; ch++) {
y = s->ytop + ch * h;
fill_rectangle(screen,
s->xleft, y, s->width, 1,
fgcolor, 0);
}
SDL_UpdateRect(screen, s->xleft, s->ytop, s->width, s->height);
} else {
nb_display_channels= FFMIN(nb_display_channels, 2);
if (rdft_bits != s->rdft_bits) {
av_rdft_end(s->rdft);
av_free(s->rdft_data);
s->rdft = av_rdft_init(rdft_bits, DFT_R2C);
s->rdft_bits = rdft_bits;
s->rdft_data = av_malloc(4 * nb_freq * sizeof(*s->rdft_data));
}
{
FFTSample *data[2];
for (ch = 0; ch < nb_display_channels; ch++) {
data[ch] = s->rdft_data + 2 * nb_freq * ch;
i = i_start + ch;
for (x = 0; x < 2 * nb_freq; x++) {
double w = (x-nb_freq) * (1.0 / nb_freq);
data[ch][x] = s->sample_array[i] * (1.0 - w * w);
i += channels;
if (i >= SAMPLE_ARRAY_SIZE)
i -= SAMPLE_ARRAY_SIZE;
}
av_rdft_calc(s->rdft, data[ch]);
}
for (y = 0; y < s->height; y++) {
double w = 1 / sqrt(nb_freq);
int a = sqrt(w * sqrt(data[0][2 * y + 0] * data[0][2 * y + 0] + data[0][2 * y + 1] * data[0][2 * y + 1]));
int b = (nb_display_channels == 2 ) ? sqrt(w * sqrt(data[1][2 * y + 0] * data[1][2 * y + 0]
+ data[1][2 * y + 1] * data[1][2 * y + 1])) : a;
a = FFMIN(a, 255);
b = FFMIN(b, 255);
fgcolor = SDL_MapRGB(screen->format, a, b, (a + b) / 2);
fill_rectangle(screen,
s->xpos, s->height-y, 1, 1,
fgcolor, 0);
}
}
SDL_UpdateRect(screen, s->xpos, s->ytop, 1, s->height);
if (!s->paused)
s->xpos++;
if (s->xpos >= s->width)
s->xpos= s->xleft;
}
}
| {
"code": [
" int16_t time_diff;"
],
"line_no": [
9
]
} | static void FUNC_0(VideoState *VAR_0)
{
int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;
int VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15;
int16_t time_diff;
int VAR_16, VAR_17;
for (VAR_16 = 1; (1 << VAR_16) < 2 * VAR_0->height; VAR_16++)
;
VAR_17 = 1 << (VAR_16 - 1);
VAR_11 = VAR_0->audio_tgt.VAR_11;
VAR_9 = VAR_11;
if (!VAR_0->paused) {
int VAR_18= VAR_0->show_mode == SHOW_MODE_WAVES ? VAR_0->width : (2*VAR_17);
VAR_8 = 2 * VAR_11;
VAR_7 = VAR_0->audio_write_buf_size;
VAR_7 /= VAR_8;
if (audio_callback_time) {
time_diff = av_gettime() - audio_callback_time;
VAR_7 -= (time_diff * VAR_0->audio_tgt.freq) / 1000000;
}
VAR_7 += 2 * VAR_18;
if (VAR_7 < VAR_18)
VAR_7 = VAR_18;
VAR_2= VAR_3 = compute_mod(VAR_0->sample_array_index - VAR_7 * VAR_11, SAMPLE_ARRAY_SIZE);
if (VAR_0->show_mode == SHOW_MODE_WAVES) {
VAR_12 = INT_MIN;
for (VAR_1 = 0; VAR_1 < 1000; VAR_1 += VAR_11) {
int VAR_19 = (SAMPLE_ARRAY_SIZE + VAR_3 - VAR_1) % SAMPLE_ARRAY_SIZE;
int VAR_20 = VAR_0->sample_array[VAR_19];
int VAR_21 = VAR_0->sample_array[(VAR_19 + 4 * VAR_11) % SAMPLE_ARRAY_SIZE];
int VAR_22 = VAR_0->sample_array[(VAR_19 + 5 * VAR_11) % SAMPLE_ARRAY_SIZE];
int VAR_23 = VAR_0->sample_array[(VAR_19 + 9 * VAR_11) % SAMPLE_ARRAY_SIZE];
int VAR_24 = VAR_20 - VAR_23;
if (VAR_12 < VAR_24 && (VAR_21 ^ VAR_22) < 0) {
VAR_12 = VAR_24;
VAR_2 = VAR_19;
}
}
}
VAR_0->last_i_start = VAR_2;
} else {
VAR_2 = VAR_0->last_i_start;
}
VAR_14 = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);
if (VAR_0->show_mode == SHOW_MODE_WAVES) {
fill_rectangle(screen,
VAR_0->xleft, VAR_0->ytop, VAR_0->width, VAR_0->height,
VAR_14, 0);
VAR_15 = SDL_MapRGB(screen->format, 0xff, 0xff, 0xff);
VAR_12 = VAR_0->height / VAR_9;
VAR_13 = (VAR_12 * 9) / 20;
for (VAR_10 = 0; VAR_10 < VAR_9; VAR_10++) {
VAR_1 = VAR_2 + VAR_10;
VAR_4 = VAR_0->ytop + VAR_10 * VAR_12 + (VAR_12 / 2);
for (VAR_3 = 0; VAR_3 < VAR_0->width; VAR_3++) {
VAR_5 = (VAR_0->sample_array[VAR_1] * VAR_13) >> 15;
if (VAR_5 < 0) {
VAR_5 = -VAR_5;
VAR_6 = VAR_4 - VAR_5;
} else {
VAR_6 = VAR_4;
}
fill_rectangle(screen,
VAR_0->xleft + VAR_3, VAR_6, 1, VAR_5,
VAR_15, 0);
VAR_1 += VAR_11;
if (VAR_1 >= SAMPLE_ARRAY_SIZE)
VAR_1 -= SAMPLE_ARRAY_SIZE;
}
}
VAR_15 = SDL_MapRGB(screen->format, 0x00, 0x00, 0xff);
for (VAR_10 = 1; VAR_10 < VAR_9; VAR_10++) {
VAR_5 = VAR_0->ytop + VAR_10 * VAR_12;
fill_rectangle(screen,
VAR_0->xleft, VAR_5, VAR_0->width, 1,
VAR_15, 0);
}
SDL_UpdateRect(screen, VAR_0->xleft, VAR_0->ytop, VAR_0->width, VAR_0->height);
} else {
VAR_9= FFMIN(VAR_9, 2);
if (VAR_16 != VAR_0->VAR_16) {
av_rdft_end(VAR_0->rdft);
av_free(VAR_0->rdft_data);
VAR_0->rdft = av_rdft_init(VAR_16, DFT_R2C);
VAR_0->VAR_16 = VAR_16;
VAR_0->rdft_data = av_malloc(4 * VAR_17 * sizeof(*VAR_0->rdft_data));
}
{
FFTSample *data[2];
for (VAR_10 = 0; VAR_10 < VAR_9; VAR_10++) {
data[VAR_10] = VAR_0->rdft_data + 2 * VAR_17 * VAR_10;
VAR_1 = VAR_2 + VAR_10;
for (VAR_3 = 0; VAR_3 < 2 * VAR_17; VAR_3++) {
double VAR_25 = (VAR_3-VAR_17) * (1.0 / VAR_17);
data[VAR_10][VAR_3] = VAR_0->sample_array[VAR_1] * (1.0 - VAR_25 * VAR_25);
VAR_1 += VAR_11;
if (VAR_1 >= SAMPLE_ARRAY_SIZE)
VAR_1 -= SAMPLE_ARRAY_SIZE;
}
av_rdft_calc(VAR_0->rdft, data[VAR_10]);
}
for (VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5++) {
double VAR_25 = 1 / sqrt(VAR_17);
int VAR_20 = sqrt(VAR_25 * sqrt(data[0][2 * VAR_5 + 0] * data[0][2 * VAR_5 + 0] + data[0][2 * VAR_5 + 1] * data[0][2 * VAR_5 + 1]));
int VAR_21 = (VAR_9 == 2 ) ? sqrt(VAR_25 * sqrt(data[1][2 * VAR_5 + 0] * data[1][2 * VAR_5 + 0]
+ data[1][2 * VAR_5 + 1] * data[1][2 * VAR_5 + 1])) : VAR_20;
VAR_20 = FFMIN(VAR_20, 255);
VAR_21 = FFMIN(VAR_21, 255);
VAR_15 = SDL_MapRGB(screen->format, VAR_20, VAR_21, (VAR_20 + VAR_21) / 2);
fill_rectangle(screen,
VAR_0->xpos, VAR_0->height-VAR_5, 1, 1,
VAR_15, 0);
}
}
SDL_UpdateRect(screen, VAR_0->xpos, VAR_0->ytop, 1, VAR_0->height);
if (!VAR_0->paused)
VAR_0->xpos++;
if (VAR_0->xpos >= VAR_0->width)
VAR_0->xpos= VAR_0->xleft;
}
}
| [
"static void FUNC_0(VideoState *VAR_0)\n{",
"int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;",
"int VAR_10, VAR_11, VAR_12, VAR_13, VAR_14, VAR_15;",
"int16_t time_diff;",
"int VAR_16, VAR_17;",
"for (VAR_16 = 1; (1 << VAR_16) < 2 * VAR_0->height; VAR_16++)",
";",
"VAR_17 = 1 << (VAR_16 - 1);",
"VAR_11 = VAR_0->audio_tgt.VAR_11;",
"VAR_9 = VAR_11;",
"if (!VAR_0->paused) {",
"int VAR_18= VAR_0->show_mode == SHOW_MODE_WAVES ? VAR_0->width : (2*VAR_17);",
"VAR_8 = 2 * VAR_11;",
"VAR_7 = VAR_0->audio_write_buf_size;",
"VAR_7 /= VAR_8;",
"if (audio_callback_time) {",
"time_diff = av_gettime() - audio_callback_time;",
"VAR_7 -= (time_diff * VAR_0->audio_tgt.freq) / 1000000;",
"}",
"VAR_7 += 2 * VAR_18;",
"if (VAR_7 < VAR_18)\nVAR_7 = VAR_18;",
"VAR_2= VAR_3 = compute_mod(VAR_0->sample_array_index - VAR_7 * VAR_11, SAMPLE_ARRAY_SIZE);",
"if (VAR_0->show_mode == SHOW_MODE_WAVES) {",
"VAR_12 = INT_MIN;",
"for (VAR_1 = 0; VAR_1 < 1000; VAR_1 += VAR_11) {",
"int VAR_19 = (SAMPLE_ARRAY_SIZE + VAR_3 - VAR_1) % SAMPLE_ARRAY_SIZE;",
"int VAR_20 = VAR_0->sample_array[VAR_19];",
"int VAR_21 = VAR_0->sample_array[(VAR_19 + 4 * VAR_11) % SAMPLE_ARRAY_SIZE];",
"int VAR_22 = VAR_0->sample_array[(VAR_19 + 5 * VAR_11) % SAMPLE_ARRAY_SIZE];",
"int VAR_23 = VAR_0->sample_array[(VAR_19 + 9 * VAR_11) % SAMPLE_ARRAY_SIZE];",
"int VAR_24 = VAR_20 - VAR_23;",
"if (VAR_12 < VAR_24 && (VAR_21 ^ VAR_22) < 0) {",
"VAR_12 = VAR_24;",
"VAR_2 = VAR_19;",
"}",
"}",
"}",
"VAR_0->last_i_start = VAR_2;",
"} else {",
"VAR_2 = VAR_0->last_i_start;",
"}",
"VAR_14 = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);",
"if (VAR_0->show_mode == SHOW_MODE_WAVES) {",
"fill_rectangle(screen,\nVAR_0->xleft, VAR_0->ytop, VAR_0->width, VAR_0->height,\nVAR_14, 0);",
"VAR_15 = SDL_MapRGB(screen->format, 0xff, 0xff, 0xff);",
"VAR_12 = VAR_0->height / VAR_9;",
"VAR_13 = (VAR_12 * 9) / 20;",
"for (VAR_10 = 0; VAR_10 < VAR_9; VAR_10++) {",
"VAR_1 = VAR_2 + VAR_10;",
"VAR_4 = VAR_0->ytop + VAR_10 * VAR_12 + (VAR_12 / 2);",
"for (VAR_3 = 0; VAR_3 < VAR_0->width; VAR_3++) {",
"VAR_5 = (VAR_0->sample_array[VAR_1] * VAR_13) >> 15;",
"if (VAR_5 < 0) {",
"VAR_5 = -VAR_5;",
"VAR_6 = VAR_4 - VAR_5;",
"} else {",
"VAR_6 = VAR_4;",
"}",
"fill_rectangle(screen,\nVAR_0->xleft + VAR_3, VAR_6, 1, VAR_5,\nVAR_15, 0);",
"VAR_1 += VAR_11;",
"if (VAR_1 >= SAMPLE_ARRAY_SIZE)\nVAR_1 -= SAMPLE_ARRAY_SIZE;",
"}",
"}",
"VAR_15 = SDL_MapRGB(screen->format, 0x00, 0x00, 0xff);",
"for (VAR_10 = 1; VAR_10 < VAR_9; VAR_10++) {",
"VAR_5 = VAR_0->ytop + VAR_10 * VAR_12;",
"fill_rectangle(screen,\nVAR_0->xleft, VAR_5, VAR_0->width, 1,\nVAR_15, 0);",
"}",
"SDL_UpdateRect(screen, VAR_0->xleft, VAR_0->ytop, VAR_0->width, VAR_0->height);",
"} else {",
"VAR_9= FFMIN(VAR_9, 2);",
"if (VAR_16 != VAR_0->VAR_16) {",
"av_rdft_end(VAR_0->rdft);",
"av_free(VAR_0->rdft_data);",
"VAR_0->rdft = av_rdft_init(VAR_16, DFT_R2C);",
"VAR_0->VAR_16 = VAR_16;",
"VAR_0->rdft_data = av_malloc(4 * VAR_17 * sizeof(*VAR_0->rdft_data));",
"}",
"{",
"FFTSample *data[2];",
"for (VAR_10 = 0; VAR_10 < VAR_9; VAR_10++) {",
"data[VAR_10] = VAR_0->rdft_data + 2 * VAR_17 * VAR_10;",
"VAR_1 = VAR_2 + VAR_10;",
"for (VAR_3 = 0; VAR_3 < 2 * VAR_17; VAR_3++) {",
"double VAR_25 = (VAR_3-VAR_17) * (1.0 / VAR_17);",
"data[VAR_10][VAR_3] = VAR_0->sample_array[VAR_1] * (1.0 - VAR_25 * VAR_25);",
"VAR_1 += VAR_11;",
"if (VAR_1 >= SAMPLE_ARRAY_SIZE)\nVAR_1 -= SAMPLE_ARRAY_SIZE;",
"}",
"av_rdft_calc(VAR_0->rdft, data[VAR_10]);",
"}",
"for (VAR_5 = 0; VAR_5 < VAR_0->height; VAR_5++) {",
"double VAR_25 = 1 / sqrt(VAR_17);",
"int VAR_20 = sqrt(VAR_25 * sqrt(data[0][2 * VAR_5 + 0] * data[0][2 * VAR_5 + 0] + data[0][2 * VAR_5 + 1] * data[0][2 * VAR_5 + 1]));",
"int VAR_21 = (VAR_9 == 2 ) ? sqrt(VAR_25 * sqrt(data[1][2 * VAR_5 + 0] * data[1][2 * VAR_5 + 0]\n+ data[1][2 * VAR_5 + 1] * data[1][2 * VAR_5 + 1])) : VAR_20;",
"VAR_20 = FFMIN(VAR_20, 255);",
"VAR_21 = FFMIN(VAR_21, 255);",
"VAR_15 = SDL_MapRGB(screen->format, VAR_20, VAR_21, (VAR_20 + VAR_21) / 2);",
"fill_rectangle(screen,\nVAR_0->xpos, VAR_0->height-VAR_5, 1, 1,\nVAR_15, 0);",
"}",
"}",
"SDL_UpdateRect(screen, VAR_0->xpos, VAR_0->ytop, 1, VAR_0->height);",
"if (!VAR_0->paused)\nVAR_0->xpos++;",
"if (VAR_0->xpos >= VAR_0->width)\nVAR_0->xpos= VAR_0->xleft;",
"}",
"}"
]
| [
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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57,
59
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97
],
[
99
],
[
101
],
[
103
],
[
107
],
[
109
],
[
111,
113,
115
],
[
119
],
[
125
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153,
155,
157
],
[
159
],
[
161,
163
],
[
165
],
[
167
],
[
171
],
[
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
],
[
237
],
[
239
],
[
241
],
[
243,
245
],
[
247
],
[
249
],
[
251
],
[
255,
257,
259
],
[
261
],
[
263
],
[
265
],
[
267,
269
],
[
271,
273
],
[
275
],
[
277
]
]
|
15,590 | static int dirac_unpack_prediction_parameters(DiracContext *s)
{
static const uint8_t default_blen[] = { 4, 12, 16, 24 };
static const uint8_t default_bsep[] = { 4, 8, 12, 16 };
GetBitContext *gb = &s->gb;
unsigned idx, ref;
align_get_bits(gb);
/* [DIRAC_STD] 11.2.2 Block parameters. block_parameters() */
/* Luma and Chroma are equal. 11.2.3 */
idx = svq3_get_ue_golomb(gb); /* [DIRAC_STD] index */
if (idx > 4) {
av_log(s->avctx, AV_LOG_ERROR, "Block prediction index too high\n");
return -1;
}
if (idx == 0) {
s->plane[0].xblen = svq3_get_ue_golomb(gb);
s->plane[0].yblen = svq3_get_ue_golomb(gb);
s->plane[0].xbsep = svq3_get_ue_golomb(gb);
s->plane[0].ybsep = svq3_get_ue_golomb(gb);
} else {
/*[DIRAC_STD] preset_block_params(index). Table 11.1 */
s->plane[0].xblen = default_blen[idx-1];
s->plane[0].yblen = default_blen[idx-1];
s->plane[0].xbsep = default_bsep[idx-1];
s->plane[0].ybsep = default_bsep[idx-1];
}
/*[DIRAC_STD] 11.2.4 motion_data_dimensions()
Calculated in function dirac_unpack_block_motion_data */
if (s->plane[0].xbsep < s->plane[0].xblen/2 || s->plane[0].ybsep < s->plane[0].yblen/2) {
av_log(s->avctx, AV_LOG_ERROR, "Block separation too small\n");
return -1;
}
if (s->plane[0].xbsep > s->plane[0].xblen || s->plane[0].ybsep > s->plane[0].yblen) {
av_log(s->avctx, AV_LOG_ERROR, "Block seperation greater than size\n");
return -1;
}
if (FFMAX(s->plane[0].xblen, s->plane[0].yblen) > MAX_BLOCKSIZE) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported large block size\n");
return -1;
}
/*[DIRAC_STD] 11.2.5 Motion vector precision. motion_vector_precision()
Read motion vector precision */
s->mv_precision = svq3_get_ue_golomb(gb);
if (s->mv_precision > 3) {
av_log(s->avctx, AV_LOG_ERROR, "MV precision finer than eighth-pel\n");
return -1;
}
/*[DIRAC_STD] 11.2.6 Global motion. global_motion()
Read the global motion compensation parameters */
s->globalmc_flag = get_bits1(gb);
if (s->globalmc_flag) {
memset(s->globalmc, 0, sizeof(s->globalmc));
/* [DIRAC_STD] pan_tilt(gparams) */
for (ref = 0; ref < s->num_refs; ref++) {
if (get_bits1(gb)) {
s->globalmc[ref].pan_tilt[0] = dirac_get_se_golomb(gb);
s->globalmc[ref].pan_tilt[1] = dirac_get_se_golomb(gb);
}
/* [DIRAC_STD] zoom_rotate_shear(gparams)
zoom/rotation/shear parameters */
if (get_bits1(gb)) {
s->globalmc[ref].zrs_exp = svq3_get_ue_golomb(gb);
s->globalmc[ref].zrs[0][0] = dirac_get_se_golomb(gb);
s->globalmc[ref].zrs[0][1] = dirac_get_se_golomb(gb);
s->globalmc[ref].zrs[1][0] = dirac_get_se_golomb(gb);
s->globalmc[ref].zrs[1][1] = dirac_get_se_golomb(gb);
} else {
s->globalmc[ref].zrs[0][0] = 1;
s->globalmc[ref].zrs[1][1] = 1;
}
/* [DIRAC_STD] perspective(gparams) */
if (get_bits1(gb)) {
s->globalmc[ref].perspective_exp = svq3_get_ue_golomb(gb);
s->globalmc[ref].perspective[0] = dirac_get_se_golomb(gb);
s->globalmc[ref].perspective[1] = dirac_get_se_golomb(gb);
}
}
}
/*[DIRAC_STD] 11.2.7 Picture prediction mode. prediction_mode()
Picture prediction mode, not currently used. */
if (svq3_get_ue_golomb(gb)) {
av_log(s->avctx, AV_LOG_ERROR, "Unknown picture prediction mode\n");
return -1;
}
/* [DIRAC_STD] 11.2.8 Reference picture weight. reference_picture_weights()
just data read, weight calculation will be done later on. */
s->weight_log2denom = 1;
s->weight[0] = 1;
s->weight[1] = 1;
if (get_bits1(gb)) {
s->weight_log2denom = svq3_get_ue_golomb(gb);
s->weight[0] = dirac_get_se_golomb(gb);
if (s->num_refs == 2)
s->weight[1] = dirac_get_se_golomb(gb);
}
return 0;
}
| true | FFmpeg | 601d072e68fb2967e561980336bea0b0625e629e | static int dirac_unpack_prediction_parameters(DiracContext *s)
{
static const uint8_t default_blen[] = { 4, 12, 16, 24 };
static const uint8_t default_bsep[] = { 4, 8, 12, 16 };
GetBitContext *gb = &s->gb;
unsigned idx, ref;
align_get_bits(gb);
idx = svq3_get_ue_golomb(gb);
if (idx > 4) {
av_log(s->avctx, AV_LOG_ERROR, "Block prediction index too high\n");
return -1;
}
if (idx == 0) {
s->plane[0].xblen = svq3_get_ue_golomb(gb);
s->plane[0].yblen = svq3_get_ue_golomb(gb);
s->plane[0].xbsep = svq3_get_ue_golomb(gb);
s->plane[0].ybsep = svq3_get_ue_golomb(gb);
} else {
s->plane[0].xblen = default_blen[idx-1];
s->plane[0].yblen = default_blen[idx-1];
s->plane[0].xbsep = default_bsep[idx-1];
s->plane[0].ybsep = default_bsep[idx-1];
}
if (s->plane[0].xbsep < s->plane[0].xblen/2 || s->plane[0].ybsep < s->plane[0].yblen/2) {
av_log(s->avctx, AV_LOG_ERROR, "Block separation too small\n");
return -1;
}
if (s->plane[0].xbsep > s->plane[0].xblen || s->plane[0].ybsep > s->plane[0].yblen) {
av_log(s->avctx, AV_LOG_ERROR, "Block seperation greater than size\n");
return -1;
}
if (FFMAX(s->plane[0].xblen, s->plane[0].yblen) > MAX_BLOCKSIZE) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported large block size\n");
return -1;
}
s->mv_precision = svq3_get_ue_golomb(gb);
if (s->mv_precision > 3) {
av_log(s->avctx, AV_LOG_ERROR, "MV precision finer than eighth-pel\n");
return -1;
}
s->globalmc_flag = get_bits1(gb);
if (s->globalmc_flag) {
memset(s->globalmc, 0, sizeof(s->globalmc));
for (ref = 0; ref < s->num_refs; ref++) {
if (get_bits1(gb)) {
s->globalmc[ref].pan_tilt[0] = dirac_get_se_golomb(gb);
s->globalmc[ref].pan_tilt[1] = dirac_get_se_golomb(gb);
}
if (get_bits1(gb)) {
s->globalmc[ref].zrs_exp = svq3_get_ue_golomb(gb);
s->globalmc[ref].zrs[0][0] = dirac_get_se_golomb(gb);
s->globalmc[ref].zrs[0][1] = dirac_get_se_golomb(gb);
s->globalmc[ref].zrs[1][0] = dirac_get_se_golomb(gb);
s->globalmc[ref].zrs[1][1] = dirac_get_se_golomb(gb);
} else {
s->globalmc[ref].zrs[0][0] = 1;
s->globalmc[ref].zrs[1][1] = 1;
}
if (get_bits1(gb)) {
s->globalmc[ref].perspective_exp = svq3_get_ue_golomb(gb);
s->globalmc[ref].perspective[0] = dirac_get_se_golomb(gb);
s->globalmc[ref].perspective[1] = dirac_get_se_golomb(gb);
}
}
}
if (svq3_get_ue_golomb(gb)) {
av_log(s->avctx, AV_LOG_ERROR, "Unknown picture prediction mode\n");
return -1;
}
s->weight_log2denom = 1;
s->weight[0] = 1;
s->weight[1] = 1;
if (get_bits1(gb)) {
s->weight_log2denom = svq3_get_ue_golomb(gb);
s->weight[0] = dirac_get_se_golomb(gb);
if (s->num_refs == 2)
s->weight[1] = dirac_get_se_golomb(gb);
}
return 0;
}
| {
"code": [
" if (s->plane[0].xbsep < s->plane[0].xblen/2 || s->plane[0].ybsep < s->plane[0].yblen/2) {"
],
"line_no": [
67
]
} | static int FUNC_0(DiracContext *VAR_0)
{
static const uint8_t VAR_1[] = { 4, 12, 16, 24 };
static const uint8_t VAR_2[] = { 4, 8, 12, 16 };
GetBitContext *gb = &VAR_0->gb;
unsigned VAR_3, VAR_4;
align_get_bits(gb);
VAR_3 = svq3_get_ue_golomb(gb);
if (VAR_3 > 4) {
av_log(VAR_0->avctx, AV_LOG_ERROR, "Block prediction index too high\n");
return -1;
}
if (VAR_3 == 0) {
VAR_0->plane[0].xblen = svq3_get_ue_golomb(gb);
VAR_0->plane[0].yblen = svq3_get_ue_golomb(gb);
VAR_0->plane[0].xbsep = svq3_get_ue_golomb(gb);
VAR_0->plane[0].ybsep = svq3_get_ue_golomb(gb);
} else {
VAR_0->plane[0].xblen = VAR_1[VAR_3-1];
VAR_0->plane[0].yblen = VAR_1[VAR_3-1];
VAR_0->plane[0].xbsep = VAR_2[VAR_3-1];
VAR_0->plane[0].ybsep = VAR_2[VAR_3-1];
}
if (VAR_0->plane[0].xbsep < VAR_0->plane[0].xblen/2 || VAR_0->plane[0].ybsep < VAR_0->plane[0].yblen/2) {
av_log(VAR_0->avctx, AV_LOG_ERROR, "Block separation too small\n");
return -1;
}
if (VAR_0->plane[0].xbsep > VAR_0->plane[0].xblen || VAR_0->plane[0].ybsep > VAR_0->plane[0].yblen) {
av_log(VAR_0->avctx, AV_LOG_ERROR, "Block seperation greater than size\n");
return -1;
}
if (FFMAX(VAR_0->plane[0].xblen, VAR_0->plane[0].yblen) > MAX_BLOCKSIZE) {
av_log(VAR_0->avctx, AV_LOG_ERROR, "Unsupported large block size\n");
return -1;
}
VAR_0->mv_precision = svq3_get_ue_golomb(gb);
if (VAR_0->mv_precision > 3) {
av_log(VAR_0->avctx, AV_LOG_ERROR, "MV precision finer than eighth-pel\n");
return -1;
}
VAR_0->globalmc_flag = get_bits1(gb);
if (VAR_0->globalmc_flag) {
memset(VAR_0->globalmc, 0, sizeof(VAR_0->globalmc));
for (VAR_4 = 0; VAR_4 < VAR_0->num_refs; VAR_4++) {
if (get_bits1(gb)) {
VAR_0->globalmc[VAR_4].pan_tilt[0] = dirac_get_se_golomb(gb);
VAR_0->globalmc[VAR_4].pan_tilt[1] = dirac_get_se_golomb(gb);
}
if (get_bits1(gb)) {
VAR_0->globalmc[VAR_4].zrs_exp = svq3_get_ue_golomb(gb);
VAR_0->globalmc[VAR_4].zrs[0][0] = dirac_get_se_golomb(gb);
VAR_0->globalmc[VAR_4].zrs[0][1] = dirac_get_se_golomb(gb);
VAR_0->globalmc[VAR_4].zrs[1][0] = dirac_get_se_golomb(gb);
VAR_0->globalmc[VAR_4].zrs[1][1] = dirac_get_se_golomb(gb);
} else {
VAR_0->globalmc[VAR_4].zrs[0][0] = 1;
VAR_0->globalmc[VAR_4].zrs[1][1] = 1;
}
if (get_bits1(gb)) {
VAR_0->globalmc[VAR_4].perspective_exp = svq3_get_ue_golomb(gb);
VAR_0->globalmc[VAR_4].perspective[0] = dirac_get_se_golomb(gb);
VAR_0->globalmc[VAR_4].perspective[1] = dirac_get_se_golomb(gb);
}
}
}
if (svq3_get_ue_golomb(gb)) {
av_log(VAR_0->avctx, AV_LOG_ERROR, "Unknown picture prediction mode\n");
return -1;
}
VAR_0->weight_log2denom = 1;
VAR_0->weight[0] = 1;
VAR_0->weight[1] = 1;
if (get_bits1(gb)) {
VAR_0->weight_log2denom = svq3_get_ue_golomb(gb);
VAR_0->weight[0] = dirac_get_se_golomb(gb);
if (VAR_0->num_refs == 2)
VAR_0->weight[1] = dirac_get_se_golomb(gb);
}
return 0;
}
| [
"static int FUNC_0(DiracContext *VAR_0)\n{",
"static const uint8_t VAR_1[] = { 4, 12, 16, 24 };",
"static const uint8_t VAR_2[] = { 4, 8, 12, 16 };",
"GetBitContext *gb = &VAR_0->gb;",
"unsigned VAR_3, VAR_4;",
"align_get_bits(gb);",
"VAR_3 = svq3_get_ue_golomb(gb);",
"if (VAR_3 > 4) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"Block prediction index too high\\n\");",
"return -1;",
"}",
"if (VAR_3 == 0) {",
"VAR_0->plane[0].xblen = svq3_get_ue_golomb(gb);",
"VAR_0->plane[0].yblen = svq3_get_ue_golomb(gb);",
"VAR_0->plane[0].xbsep = svq3_get_ue_golomb(gb);",
"VAR_0->plane[0].ybsep = svq3_get_ue_golomb(gb);",
"} else {",
"VAR_0->plane[0].xblen = VAR_1[VAR_3-1];",
"VAR_0->plane[0].yblen = VAR_1[VAR_3-1];",
"VAR_0->plane[0].xbsep = VAR_2[VAR_3-1];",
"VAR_0->plane[0].ybsep = VAR_2[VAR_3-1];",
"}",
"if (VAR_0->plane[0].xbsep < VAR_0->plane[0].xblen/2 || VAR_0->plane[0].ybsep < VAR_0->plane[0].yblen/2) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"Block separation too small\\n\");",
"return -1;",
"}",
"if (VAR_0->plane[0].xbsep > VAR_0->plane[0].xblen || VAR_0->plane[0].ybsep > VAR_0->plane[0].yblen) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"Block seperation greater than size\\n\");",
"return -1;",
"}",
"if (FFMAX(VAR_0->plane[0].xblen, VAR_0->plane[0].yblen) > MAX_BLOCKSIZE) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"Unsupported large block size\\n\");",
"return -1;",
"}",
"VAR_0->mv_precision = svq3_get_ue_golomb(gb);",
"if (VAR_0->mv_precision > 3) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"MV precision finer than eighth-pel\\n\");",
"return -1;",
"}",
"VAR_0->globalmc_flag = get_bits1(gb);",
"if (VAR_0->globalmc_flag) {",
"memset(VAR_0->globalmc, 0, sizeof(VAR_0->globalmc));",
"for (VAR_4 = 0; VAR_4 < VAR_0->num_refs; VAR_4++) {",
"if (get_bits1(gb)) {",
"VAR_0->globalmc[VAR_4].pan_tilt[0] = dirac_get_se_golomb(gb);",
"VAR_0->globalmc[VAR_4].pan_tilt[1] = dirac_get_se_golomb(gb);",
"}",
"if (get_bits1(gb)) {",
"VAR_0->globalmc[VAR_4].zrs_exp = svq3_get_ue_golomb(gb);",
"VAR_0->globalmc[VAR_4].zrs[0][0] = dirac_get_se_golomb(gb);",
"VAR_0->globalmc[VAR_4].zrs[0][1] = dirac_get_se_golomb(gb);",
"VAR_0->globalmc[VAR_4].zrs[1][0] = dirac_get_se_golomb(gb);",
"VAR_0->globalmc[VAR_4].zrs[1][1] = dirac_get_se_golomb(gb);",
"} else {",
"VAR_0->globalmc[VAR_4].zrs[0][0] = 1;",
"VAR_0->globalmc[VAR_4].zrs[1][1] = 1;",
"}",
"if (get_bits1(gb)) {",
"VAR_0->globalmc[VAR_4].perspective_exp = svq3_get_ue_golomb(gb);",
"VAR_0->globalmc[VAR_4].perspective[0] = dirac_get_se_golomb(gb);",
"VAR_0->globalmc[VAR_4].perspective[1] = dirac_get_se_golomb(gb);",
"}",
"}",
"}",
"if (svq3_get_ue_golomb(gb)) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"Unknown picture prediction mode\\n\");",
"return -1;",
"}",
"VAR_0->weight_log2denom = 1;",
"VAR_0->weight[0] = 1;",
"VAR_0->weight[1] = 1;",
"if (get_bits1(gb)) {",
"VAR_0->weight_log2denom = svq3_get_ue_golomb(gb);",
"VAR_0->weight[0] = dirac_get_se_golomb(gb);",
"if (VAR_0->num_refs == 2)\nVAR_0->weight[1] = dirac_get_se_golomb(gb);",
"}",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
17
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
113
],
[
115
],
[
117
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
177
],
[
179
],
[
181
],
[
183
],
[
191
],
[
193
],
[
195
],
[
199
],
[
201
],
[
203
],
[
205,
207
],
[
209
],
[
211
],
[
213
]
]
|
15,591 | static int check_timecode(void *log_ctx, AVTimecode *tc)
{
if (tc->fps <= 0) {
av_log(log_ctx, AV_LOG_ERROR, "Timecode frame rate must be specified\n");
return AVERROR(EINVAL);
}
if ((tc->flags & AV_TIMECODE_FLAG_DROPFRAME) && tc->fps != 30 && tc->fps != 60) {
av_log(log_ctx, AV_LOG_ERROR, "Drop frame is only allowed with 30000/1001 or 60000/1001 FPS\n");
return AVERROR(EINVAL);
}
if (check_fps(tc->fps) < 0) {
av_log(log_ctx, AV_LOG_WARNING, "Using non-standard frame rate %d/%d\n",
tc->rate.num, tc->rate.den);
}
return 0;
}
| true | FFmpeg | b46dcd5209a77254345ae098b83a872634c5591b | static int check_timecode(void *log_ctx, AVTimecode *tc)
{
if (tc->fps <= 0) {
av_log(log_ctx, AV_LOG_ERROR, "Timecode frame rate must be specified\n");
return AVERROR(EINVAL);
}
if ((tc->flags & AV_TIMECODE_FLAG_DROPFRAME) && tc->fps != 30 && tc->fps != 60) {
av_log(log_ctx, AV_LOG_ERROR, "Drop frame is only allowed with 30000/1001 or 60000/1001 FPS\n");
return AVERROR(EINVAL);
}
if (check_fps(tc->fps) < 0) {
av_log(log_ctx, AV_LOG_WARNING, "Using non-standard frame rate %d/%d\n",
tc->rate.num, tc->rate.den);
}
return 0;
}
| {
"code": [
" if (tc->fps <= 0) {"
],
"line_no": [
5
]
} | static int FUNC_0(void *VAR_0, AVTimecode *VAR_1)
{
if (VAR_1->fps <= 0) {
av_log(VAR_0, AV_LOG_ERROR, "Timecode frame rate must be specified\n");
return AVERROR(EINVAL);
}
if ((VAR_1->flags & AV_TIMECODE_FLAG_DROPFRAME) && VAR_1->fps != 30 && VAR_1->fps != 60) {
av_log(VAR_0, AV_LOG_ERROR, "Drop frame is only allowed with 30000/1001 or 60000/1001 FPS\n");
return AVERROR(EINVAL);
}
if (check_fps(VAR_1->fps) < 0) {
av_log(VAR_0, AV_LOG_WARNING, "Using non-standard frame rate %d/%d\n",
VAR_1->rate.num, VAR_1->rate.den);
}
return 0;
}
| [
"static int FUNC_0(void *VAR_0, AVTimecode *VAR_1)\n{",
"if (VAR_1->fps <= 0) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Timecode frame rate must be specified\\n\");",
"return AVERROR(EINVAL);",
"}",
"if ((VAR_1->flags & AV_TIMECODE_FLAG_DROPFRAME) && VAR_1->fps != 30 && VAR_1->fps != 60) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Drop frame is only allowed with 30000/1001 or 60000/1001 FPS\\n\");",
"return AVERROR(EINVAL);",
"}",
"if (check_fps(VAR_1->fps) < 0) {",
"av_log(VAR_0, AV_LOG_WARNING, \"Using non-standard frame rate %d/%d\\n\",\nVAR_1->rate.num, VAR_1->rate.den);",
"}",
"return 0;",
"}"
]
| [
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23,
25
],
[
27
],
[
29
],
[
31
]
]
|
15,592 | static void RENAME(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0,
const int16_t *ubuf[2], const int16_t *bguf[2],
const int16_t *abuf0, uint8_t *dest,
int dstW, int uvalpha, int y)
{
const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
const int16_t *buf1= buf0; //FIXME needed for RGB1/BGR1
if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
"push %%"REG_BP" \n\t"
YSCALEYUV2RGB1(%%REGBP, %5)
"pxor %%mm7, %%mm7 \n\t"
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
#endif
WRITERGB15(%%REGb, 8280(%5), %%REGBP)
"pop %%"REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
"a" (&c->redDither)
);
} else {
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
"push %%"REG_BP" \n\t"
YSCALEYUV2RGB1b(%%REGBP, %5)
"pxor %%mm7, %%mm7 \n\t"
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
#endif
WRITERGB15(%%REGb, 8280(%5), %%REGBP)
"pop %%"REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
"a" (&c->redDither)
);
}
}
| true | FFmpeg | 1bab6f852c7ca433285d19f65c701885fa69cc57 | static void RENAME(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0,
const int16_t *ubuf[2], const int16_t *bguf[2],
const int16_t *abuf0, uint8_t *dest,
int dstW, int uvalpha, int y)
{
const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
const int16_t *buf1= buf0;
if (uvalpha < 2048) {
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
"push %%"REG_BP" \n\t"
YSCALEYUV2RGB1(%%REGBP, %5)
"pxor %%mm7, %%mm7 \n\t"
#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
#endif
WRITERGB15(%%REGb, 8280(%5), %%REGBP)
"pop %%"REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
"a" (&c->redDither)
);
} else {
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
"push %%"REG_BP" \n\t"
YSCALEYUV2RGB1b(%%REGBP, %5)
"pxor %%mm7, %%mm7 \n\t"
#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
#endif
WRITERGB15(%%REGb, 8280(%5), %%REGBP)
"pop %%"REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
"a" (&c->redDither)
);
}
}
| {
"code": [
" const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];",
" const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];",
" const int16_t *ubuf[2], const int16_t *bguf[2],",
" const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];",
" const int16_t *ubuf[2], const int16_t *bguf[2],",
" const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];",
" const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];"
],
"line_no": [
11,
11,
3,
11,
3,
11,
11
]
} | static void FUNC_0(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0,
const int16_t *ubuf[2], const int16_t *bguf[2],
const int16_t *abuf0, uint8_t *dest,
int dstW, int uvalpha, int y)
{
const int16_t *VAR_0 = ubuf[0], *ubuf1 = ubuf[1];
const int16_t *VAR_1= buf0;
if (uvalpha < 2048) {
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
"push %%"REG_BP" \n\t"
YSCALEYUV2RGB1(%%REGBP, %5)
"pxor %%mm7, %%mm7 \n\t"
#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
#endif
WRITERGB15(%%REGb, 8280(%5), %%REGBP)
"pop %%"REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
:: "c" (buf0), "d" (VAR_1), "S" (VAR_0), "D" (ubuf1), "m" (dest),
"a" (&c->redDither)
);
} else {
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
"push %%"REG_BP" \n\t"
YSCALEYUV2RGB1b(%%REGBP, %5)
"pxor %%mm7, %%mm7 \n\t"
#ifdef DITHER1XBPP
"paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
"paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
"paddusb "RED_DITHER"(%5), %%mm5 \n\t"
#endif
WRITERGB15(%%REGb, 8280(%5), %%REGBP)
"pop %%"REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
:: "c" (buf0), "d" (VAR_1), "S" (VAR_0), "D" (ubuf1), "m" (dest),
"a" (&c->redDither)
);
}
}
| [
"static void FUNC_0(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0,\nconst int16_t *ubuf[2], const int16_t *bguf[2],\nconst int16_t *abuf0, uint8_t *dest,\nint dstW, int uvalpha, int y)\n{",
"const int16_t *VAR_0 = ubuf[0], *ubuf1 = ubuf[1];",
"const int16_t *VAR_1= buf0;",
"if (uvalpha < 2048) {",
"__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB1(%%REGBP, %5)\n\"pxor %%mm7, %%mm7 \\n\\t\"\n#ifdef DITHER1XBPP\n\"paddusb \"BLUE_DITHER\"(%5), %%mm2 \\n\\t\"\n\"paddusb \"GREEN_DITHER\"(%5), %%mm4 \\n\\t\"\n\"paddusb \"RED_DITHER\"(%5), %%mm5 \\n\\t\"\n#endif\nWRITERGB15(%%REGb, 8280(%5), %%REGBP)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (VAR_1), \"S\" (VAR_0), \"D\" (ubuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);",
"} else {",
"__asm__ volatile(\n\"mov %%\"REG_b\", \"ESP_OFFSET\"(%5) \\n\\t\"\n\"mov %4, %%\"REG_b\" \\n\\t\"\n\"push %%\"REG_BP\" \\n\\t\"\nYSCALEYUV2RGB1b(%%REGBP, %5)\n\"pxor %%mm7, %%mm7 \\n\\t\"\n#ifdef DITHER1XBPP\n\"paddusb \"BLUE_DITHER\"(%5), %%mm2 \\n\\t\"\n\"paddusb \"GREEN_DITHER\"(%5), %%mm4 \\n\\t\"\n\"paddusb \"RED_DITHER\"(%5), %%mm5 \\n\\t\"\n#endif\nWRITERGB15(%%REGb, 8280(%5), %%REGBP)\n\"pop %%\"REG_BP\" \\n\\t\"\n\"mov \"ESP_OFFSET\"(%5), %%\"REG_b\" \\n\\t\"\n:: \"c\" (buf0), \"d\" (VAR_1), \"S\" (VAR_0), \"D\" (ubuf1), \"m\" (dest),\n\"a\" (&c->redDither)\n);",
"}",
"}"
]
| [
1,
1,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
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,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91
],
[
93
],
[
95
]
]
|
15,593 | static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDisplay *display,
const uint8_t *buf, int buf_size, int top_bottom, int non_mod)
{
DVBSubContext *ctx = avctx->priv_data;
DVBSubRegion *region = get_region(ctx, display->region_id);
const uint8_t *buf_end = buf + buf_size;
uint8_t *pbuf;
int x_pos, y_pos;
int i;
uint8_t map2to4[] = { 0x0, 0x7, 0x8, 0xf};
uint8_t map2to8[] = {0x00, 0x77, 0x88, 0xff};
uint8_t map4to8[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
uint8_t *map_table;
av_dlog(avctx, "DVB pixel block size %d, %s field:\n", buf_size,
top_bottom ? "bottom" : "top");
#ifdef DEBUG_PACKET_CONTENTS
for (i = 0; i < buf_size; i++) {
if (i % 16 == 0)
av_log(avctx, AV_LOG_INFO, "0x%08p: ", buf+i);
av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
if (i % 16 == 15)
av_log(avctx, AV_LOG_INFO, "\n");
}
if (i % 16)
av_log(avctx, AV_LOG_INFO, "\n");
#endif
if (region == 0)
return;
pbuf = region->pbuf;
x_pos = display->x_pos;
y_pos = display->y_pos;
if ((y_pos & 1) != top_bottom)
y_pos++;
while (buf < buf_end) {
if (x_pos > region->width || y_pos > region->height) {
av_log(avctx, AV_LOG_ERROR, "Invalid object location!\n");
return;
}
switch (*buf++) {
case 0x10:
if (region->depth == 8)
map_table = map2to8;
else if (region->depth == 4)
map_table = map2to4;
else
map_table = NULL;
x_pos += dvbsub_read_2bit_string(pbuf + (y_pos * region->width) + x_pos,
region->width - x_pos, &buf, buf_size,
non_mod, map_table);
break;
case 0x11:
if (region->depth < 4) {
av_log(avctx, AV_LOG_ERROR, "4-bit pixel string in %d-bit region!\n", region->depth);
return;
}
if (region->depth == 8)
map_table = map4to8;
else
map_table = NULL;
x_pos += dvbsub_read_4bit_string(pbuf + (y_pos * region->width) + x_pos,
region->width - x_pos, &buf, buf_size,
non_mod, map_table);
break;
case 0x12:
if (region->depth < 8) {
av_log(avctx, AV_LOG_ERROR, "8-bit pixel string in %d-bit region!\n", region->depth);
return;
}
x_pos += dvbsub_read_8bit_string(pbuf + (y_pos * region->width) + x_pos,
region->width - x_pos, &buf, buf_size,
non_mod, NULL);
break;
case 0x20:
map2to4[0] = (*buf) >> 4;
map2to4[1] = (*buf++) & 0xf;
map2to4[2] = (*buf) >> 4;
map2to4[3] = (*buf++) & 0xf;
break;
case 0x21:
for (i = 0; i < 4; i++)
map2to8[i] = *buf++;
break;
case 0x22:
for (i = 0; i < 16; i++)
map4to8[i] = *buf++;
break;
case 0xf0:
x_pos = display->x_pos;
y_pos += 2;
break;
default:
av_log(avctx, AV_LOG_INFO, "Unknown/unsupported pixel block 0x%x\n", *(buf-1));
}
}
}
| true | FFmpeg | 52b2e95cd9f829b83b879a0694173d4ef1558c46 | static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDisplay *display,
const uint8_t *buf, int buf_size, int top_bottom, int non_mod)
{
DVBSubContext *ctx = avctx->priv_data;
DVBSubRegion *region = get_region(ctx, display->region_id);
const uint8_t *buf_end = buf + buf_size;
uint8_t *pbuf;
int x_pos, y_pos;
int i;
uint8_t map2to4[] = { 0x0, 0x7, 0x8, 0xf};
uint8_t map2to8[] = {0x00, 0x77, 0x88, 0xff};
uint8_t map4to8[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
uint8_t *map_table;
av_dlog(avctx, "DVB pixel block size %d, %s field:\n", buf_size,
top_bottom ? "bottom" : "top");
#ifdef DEBUG_PACKET_CONTENTS
for (i = 0; i < buf_size; i++) {
if (i % 16 == 0)
av_log(avctx, AV_LOG_INFO, "0x%08p: ", buf+i);
av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
if (i % 16 == 15)
av_log(avctx, AV_LOG_INFO, "\n");
}
if (i % 16)
av_log(avctx, AV_LOG_INFO, "\n");
#endif
if (region == 0)
return;
pbuf = region->pbuf;
x_pos = display->x_pos;
y_pos = display->y_pos;
if ((y_pos & 1) != top_bottom)
y_pos++;
while (buf < buf_end) {
if (x_pos > region->width || y_pos > region->height) {
av_log(avctx, AV_LOG_ERROR, "Invalid object location!\n");
return;
}
switch (*buf++) {
case 0x10:
if (region->depth == 8)
map_table = map2to8;
else if (region->depth == 4)
map_table = map2to4;
else
map_table = NULL;
x_pos += dvbsub_read_2bit_string(pbuf + (y_pos * region->width) + x_pos,
region->width - x_pos, &buf, buf_size,
non_mod, map_table);
break;
case 0x11:
if (region->depth < 4) {
av_log(avctx, AV_LOG_ERROR, "4-bit pixel string in %d-bit region!\n", region->depth);
return;
}
if (region->depth == 8)
map_table = map4to8;
else
map_table = NULL;
x_pos += dvbsub_read_4bit_string(pbuf + (y_pos * region->width) + x_pos,
region->width - x_pos, &buf, buf_size,
non_mod, map_table);
break;
case 0x12:
if (region->depth < 8) {
av_log(avctx, AV_LOG_ERROR, "8-bit pixel string in %d-bit region!\n", region->depth);
return;
}
x_pos += dvbsub_read_8bit_string(pbuf + (y_pos * region->width) + x_pos,
region->width - x_pos, &buf, buf_size,
non_mod, NULL);
break;
case 0x20:
map2to4[0] = (*buf) >> 4;
map2to4[1] = (*buf++) & 0xf;
map2to4[2] = (*buf) >> 4;
map2to4[3] = (*buf++) & 0xf;
break;
case 0x21:
for (i = 0; i < 4; i++)
map2to8[i] = *buf++;
break;
case 0x22:
for (i = 0; i < 16; i++)
map4to8[i] = *buf++;
break;
case 0xf0:
x_pos = display->x_pos;
y_pos += 2;
break;
default:
av_log(avctx, AV_LOG_INFO, "Unknown/unsupported pixel block 0x%x\n", *(buf-1));
}
}
}
| {
"code": [
" region->width - x_pos, &buf, buf_size,",
" region->width - x_pos, &buf, buf_size,",
" region->width - x_pos, &buf, buf_size,"
],
"line_no": [
125,
125,
125
]
} | static void FUNC_0(AVCodecContext *VAR_0, DVBSubObjectDisplay *VAR_1,
const uint8_t *VAR_2, int VAR_3, int VAR_4, int VAR_5)
{
DVBSubContext *ctx = VAR_0->priv_data;
DVBSubRegion *region = get_region(ctx, VAR_1->region_id);
const uint8_t *VAR_6 = VAR_2 + VAR_3;
uint8_t *pbuf;
int VAR_7, VAR_8;
int VAR_9;
uint8_t map2to4[] = { 0x0, 0x7, 0x8, 0xf};
uint8_t map2to8[] = {0x00, 0x77, 0x88, 0xff};
uint8_t map4to8[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
uint8_t *map_table;
av_dlog(VAR_0, "DVB pixel block size %d, %s field:\n", VAR_3,
VAR_4 ? "bottom" : "top");
#ifdef DEBUG_PACKET_CONTENTS
for (VAR_9 = 0; VAR_9 < VAR_3; VAR_9++) {
if (VAR_9 % 16 == 0)
av_log(VAR_0, AV_LOG_INFO, "0x%08p: ", VAR_2+VAR_9);
av_log(VAR_0, AV_LOG_INFO, "%02x ", VAR_2[VAR_9]);
if (VAR_9 % 16 == 15)
av_log(VAR_0, AV_LOG_INFO, "\n");
}
if (VAR_9 % 16)
av_log(VAR_0, AV_LOG_INFO, "\n");
#endif
if (region == 0)
return;
pbuf = region->pbuf;
VAR_7 = VAR_1->VAR_7;
VAR_8 = VAR_1->VAR_8;
if ((VAR_8 & 1) != VAR_4)
VAR_8++;
while (VAR_2 < VAR_6) {
if (VAR_7 > region->width || VAR_8 > region->height) {
av_log(VAR_0, AV_LOG_ERROR, "Invalid object location!\n");
return;
}
switch (*VAR_2++) {
case 0x10:
if (region->depth == 8)
map_table = map2to8;
else if (region->depth == 4)
map_table = map2to4;
else
map_table = NULL;
VAR_7 += dvbsub_read_2bit_string(pbuf + (VAR_8 * region->width) + VAR_7,
region->width - VAR_7, &VAR_2, VAR_3,
VAR_5, map_table);
break;
case 0x11:
if (region->depth < 4) {
av_log(VAR_0, AV_LOG_ERROR, "4-bit pixel string in %d-bit region!\n", region->depth);
return;
}
if (region->depth == 8)
map_table = map4to8;
else
map_table = NULL;
VAR_7 += dvbsub_read_4bit_string(pbuf + (VAR_8 * region->width) + VAR_7,
region->width - VAR_7, &VAR_2, VAR_3,
VAR_5, map_table);
break;
case 0x12:
if (region->depth < 8) {
av_log(VAR_0, AV_LOG_ERROR, "8-bit pixel string in %d-bit region!\n", region->depth);
return;
}
VAR_7 += dvbsub_read_8bit_string(pbuf + (VAR_8 * region->width) + VAR_7,
region->width - VAR_7, &VAR_2, VAR_3,
VAR_5, NULL);
break;
case 0x20:
map2to4[0] = (*VAR_2) >> 4;
map2to4[1] = (*VAR_2++) & 0xf;
map2to4[2] = (*VAR_2) >> 4;
map2to4[3] = (*VAR_2++) & 0xf;
break;
case 0x21:
for (VAR_9 = 0; VAR_9 < 4; VAR_9++)
map2to8[VAR_9] = *VAR_2++;
break;
case 0x22:
for (VAR_9 = 0; VAR_9 < 16; VAR_9++)
map4to8[VAR_9] = *VAR_2++;
break;
case 0xf0:
VAR_7 = VAR_1->VAR_7;
VAR_8 += 2;
break;
default:
av_log(VAR_0, AV_LOG_INFO, "Unknown/unsupported pixel block 0x%x\n", *(VAR_2-1));
}
}
}
| [
"static void FUNC_0(AVCodecContext *VAR_0, DVBSubObjectDisplay *VAR_1,\nconst uint8_t *VAR_2, int VAR_3, int VAR_4, int VAR_5)\n{",
"DVBSubContext *ctx = VAR_0->priv_data;",
"DVBSubRegion *region = get_region(ctx, VAR_1->region_id);",
"const uint8_t *VAR_6 = VAR_2 + VAR_3;",
"uint8_t *pbuf;",
"int VAR_7, VAR_8;",
"int VAR_9;",
"uint8_t map2to4[] = { 0x0, 0x7, 0x8, 0xf};",
"uint8_t map2to8[] = {0x00, 0x77, 0x88, 0xff};",
"uint8_t map4to8[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,",
"0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};",
"uint8_t *map_table;",
"av_dlog(VAR_0, \"DVB pixel block size %d, %s field:\\n\", VAR_3,\nVAR_4 ? \"bottom\" : \"top\");",
"#ifdef DEBUG_PACKET_CONTENTS\nfor (VAR_9 = 0; VAR_9 < VAR_3; VAR_9++) {",
"if (VAR_9 % 16 == 0)\nav_log(VAR_0, AV_LOG_INFO, \"0x%08p: \", VAR_2+VAR_9);",
"av_log(VAR_0, AV_LOG_INFO, \"%02x \", VAR_2[VAR_9]);",
"if (VAR_9 % 16 == 15)\nav_log(VAR_0, AV_LOG_INFO, \"\\n\");",
"}",
"if (VAR_9 % 16)\nav_log(VAR_0, AV_LOG_INFO, \"\\n\");",
"#endif\nif (region == 0)\nreturn;",
"pbuf = region->pbuf;",
"VAR_7 = VAR_1->VAR_7;",
"VAR_8 = VAR_1->VAR_8;",
"if ((VAR_8 & 1) != VAR_4)\nVAR_8++;",
"while (VAR_2 < VAR_6) {",
"if (VAR_7 > region->width || VAR_8 > region->height) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Invalid object location!\\n\");",
"return;",
"}",
"switch (*VAR_2++) {",
"case 0x10:\nif (region->depth == 8)\nmap_table = map2to8;",
"else if (region->depth == 4)\nmap_table = map2to4;",
"else\nmap_table = NULL;",
"VAR_7 += dvbsub_read_2bit_string(pbuf + (VAR_8 * region->width) + VAR_7,\nregion->width - VAR_7, &VAR_2, VAR_3,\nVAR_5, map_table);",
"break;",
"case 0x11:\nif (region->depth < 4) {",
"av_log(VAR_0, AV_LOG_ERROR, \"4-bit pixel string in %d-bit region!\\n\", region->depth);",
"return;",
"}",
"if (region->depth == 8)\nmap_table = map4to8;",
"else\nmap_table = NULL;",
"VAR_7 += dvbsub_read_4bit_string(pbuf + (VAR_8 * region->width) + VAR_7,\nregion->width - VAR_7, &VAR_2, VAR_3,\nVAR_5, map_table);",
"break;",
"case 0x12:\nif (region->depth < 8) {",
"av_log(VAR_0, AV_LOG_ERROR, \"8-bit pixel string in %d-bit region!\\n\", region->depth);",
"return;",
"}",
"VAR_7 += dvbsub_read_8bit_string(pbuf + (VAR_8 * region->width) + VAR_7,\nregion->width - VAR_7, &VAR_2, VAR_3,\nVAR_5, NULL);",
"break;",
"case 0x20:\nmap2to4[0] = (*VAR_2) >> 4;",
"map2to4[1] = (*VAR_2++) & 0xf;",
"map2to4[2] = (*VAR_2) >> 4;",
"map2to4[3] = (*VAR_2++) & 0xf;",
"break;",
"case 0x21:\nfor (VAR_9 = 0; VAR_9 < 4; VAR_9++)",
"map2to8[VAR_9] = *VAR_2++;",
"break;",
"case 0x22:\nfor (VAR_9 = 0; VAR_9 < 16; VAR_9++)",
"map4to8[VAR_9] = *VAR_2++;",
"break;",
"case 0xf0:\nVAR_7 = VAR_1->VAR_7;",
"VAR_8 += 2;",
"break;",
"default:\nav_log(VAR_0, AV_LOG_INFO, \"Unknown/unsupported pixel block 0x%x\\n\", *(VAR_2-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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35,
37
],
[
41,
43
],
[
45,
47
],
[
51
],
[
53,
55
],
[
57
],
[
61,
63
],
[
67,
71,
73
],
[
77
],
[
81
],
[
83
],
[
87,
89
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
105
],
[
107,
109,
111
],
[
113,
115
],
[
117,
119
],
[
123,
125,
127
],
[
129
],
[
131,
133
],
[
135
],
[
137
],
[
139
],
[
143,
145
],
[
147,
149
],
[
153,
155,
157
],
[
159
],
[
161,
163
],
[
165
],
[
167
],
[
169
],
[
173,
175,
177
],
[
179
],
[
183,
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195,
197
],
[
199
],
[
201
],
[
203,
205
],
[
207
],
[
209
],
[
213,
215
],
[
217
],
[
219
],
[
221,
223
],
[
225
],
[
227
],
[
231
]
]
|
15,595 | static inline void gen_op_sdivx(TCGv dst, TCGv src1, TCGv src2)
{
int l1, l2;
l1 = gen_new_label();
l2 = gen_new_label();
tcg_gen_mov_tl(cpu_cc_src, src1);
tcg_gen_mov_tl(cpu_cc_src2, src2);
gen_trap_ifdivzero_tl(cpu_cc_src2);
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_cc_src, INT64_MIN, l1);
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_cc_src2, -1, l1);
tcg_gen_movi_i64(dst, INT64_MIN);
tcg_gen_br(l2);
gen_set_label(l1);
tcg_gen_div_i64(dst, cpu_cc_src, cpu_cc_src2);
gen_set_label(l2);
}
| true | qemu | 8e91ed308062e742610e4cfdfd4a09bc045ead45 | static inline void gen_op_sdivx(TCGv dst, TCGv src1, TCGv src2)
{
int l1, l2;
l1 = gen_new_label();
l2 = gen_new_label();
tcg_gen_mov_tl(cpu_cc_src, src1);
tcg_gen_mov_tl(cpu_cc_src2, src2);
gen_trap_ifdivzero_tl(cpu_cc_src2);
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_cc_src, INT64_MIN, l1);
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_cc_src2, -1, l1);
tcg_gen_movi_i64(dst, INT64_MIN);
tcg_gen_br(l2);
gen_set_label(l1);
tcg_gen_div_i64(dst, cpu_cc_src, cpu_cc_src2);
gen_set_label(l2);
}
| {
"code": [
" tcg_gen_mov_tl(cpu_cc_src, src1);",
" tcg_gen_mov_tl(cpu_cc_src2, src2);",
" gen_trap_ifdivzero_tl(cpu_cc_src2);",
" tcg_gen_brcondi_tl(TCG_COND_NE, cpu_cc_src, INT64_MIN, l1);",
" tcg_gen_brcondi_tl(TCG_COND_NE, cpu_cc_src2, -1, l1);",
" tcg_gen_div_i64(dst, cpu_cc_src, cpu_cc_src2);"
],
"line_no": [
13,
15,
17,
19,
21,
29
]
} | static inline void FUNC_0(TCGv VAR_0, TCGv VAR_1, TCGv VAR_2)
{
int VAR_3, VAR_4;
VAR_3 = gen_new_label();
VAR_4 = gen_new_label();
tcg_gen_mov_tl(cpu_cc_src, VAR_1);
tcg_gen_mov_tl(cpu_cc_src2, VAR_2);
gen_trap_ifdivzero_tl(cpu_cc_src2);
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_cc_src, INT64_MIN, VAR_3);
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_cc_src2, -1, VAR_3);
tcg_gen_movi_i64(VAR_0, INT64_MIN);
tcg_gen_br(VAR_4);
gen_set_label(VAR_3);
tcg_gen_div_i64(VAR_0, cpu_cc_src, cpu_cc_src2);
gen_set_label(VAR_4);
}
| [
"static inline void FUNC_0(TCGv VAR_0, TCGv VAR_1, TCGv VAR_2)\n{",
"int VAR_3, VAR_4;",
"VAR_3 = gen_new_label();",
"VAR_4 = gen_new_label();",
"tcg_gen_mov_tl(cpu_cc_src, VAR_1);",
"tcg_gen_mov_tl(cpu_cc_src2, VAR_2);",
"gen_trap_ifdivzero_tl(cpu_cc_src2);",
"tcg_gen_brcondi_tl(TCG_COND_NE, cpu_cc_src, INT64_MIN, VAR_3);",
"tcg_gen_brcondi_tl(TCG_COND_NE, cpu_cc_src2, -1, VAR_3);",
"tcg_gen_movi_i64(VAR_0, INT64_MIN);",
"tcg_gen_br(VAR_4);",
"gen_set_label(VAR_3);",
"tcg_gen_div_i64(VAR_0, cpu_cc_src, cpu_cc_src2);",
"gen_set_label(VAR_4);",
"}"
]
| [
0,
0,
0,
0,
1,
1,
1,
1,
1,
0,
0,
0,
1,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
]
]
|
15,596 | static void iterative_me(SnowContext *s){
int pass, mb_x, mb_y;
const int b_width = s->b_width << s->block_max_depth;
const int b_height= s->b_height << s->block_max_depth;
const int b_stride= b_width;
int color[3];
for(pass=0; pass<50; pass++){
int change= 0;
for(mb_y= 0; mb_y<b_height; mb_y++){
for(mb_x= 0; mb_x<b_width; mb_x++){
int dia_change, i, j;
int best_rd= INT_MAX;
BlockNode backup;
const int index= mb_x + mb_y * b_stride;
BlockNode *block= &s->block[index];
BlockNode *tb = mb_y ? &s->block[index-b_stride ] : &null_block;
BlockNode *lb = mb_x ? &s->block[index -1] : &null_block;
BlockNode *rb = mb_x<b_width ? &s->block[index +1] : &null_block;
BlockNode *bb = mb_y<b_height ? &s->block[index+b_stride ] : &null_block;
BlockNode *tlb= mb_x && mb_y ? &s->block[index-b_stride-1] : &null_block;
BlockNode *trb= mb_x<b_width && mb_y ? &s->block[index-b_stride+1] : &null_block;
BlockNode *blb= mb_x && mb_y<b_height ? &s->block[index+b_stride-1] : &null_block;
BlockNode *brb= mb_x<b_width && mb_y<b_height ? &s->block[index+b_stride+1] : &null_block;
if(pass && (block->type & BLOCK_OPT))
continue;
block->type |= BLOCK_OPT;
backup= *block;
if(!s->me_cache_generation)
memset(s->me_cache, 0, sizeof(s->me_cache));
s->me_cache_generation += 1<<22;
// get previous score (cant be cached due to OBMC)
check_block(s, mb_x, mb_y, (int[2]){block->mx, block->my}, 0, &best_rd);
check_block(s, mb_x, mb_y, (int[2]){0, 0}, 0, &best_rd);
check_block(s, mb_x, mb_y, (int[2]){tb->mx, tb->my}, 0, &best_rd);
check_block(s, mb_x, mb_y, (int[2]){lb->mx, lb->my}, 0, &best_rd);
check_block(s, mb_x, mb_y, (int[2]){rb->mx, rb->my}, 0, &best_rd);
check_block(s, mb_x, mb_y, (int[2]){bb->mx, bb->my}, 0, &best_rd);
/* fullpel ME */
//FIXME avoid subpel interpol / round to nearest integer
do{
dia_change=0;
for(i=0; i<FFMAX(s->avctx->dia_size, 1); i++){
for(j=0; j<i; j++){
dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx+4*(i-j), block->my+(4*j)}, 0, &best_rd);
dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx-4*(i-j), block->my-(4*j)}, 0, &best_rd);
dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx+4*(i-j), block->my-(4*j)}, 0, &best_rd);
dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx-4*(i-j), block->my+(4*j)}, 0, &best_rd);
}
}
}while(dia_change);
/* subpel ME */
do{
static const int square[8][2]= {{+1, 0},{-1, 0},{ 0,+1},{ 0,-1},{+1,+1},{-1,-1},{+1,-1},{-1,+1},};
dia_change=0;
for(i=0; i<8; i++)
dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx+square[i][0], block->my+square[i][1]}, 0, &best_rd);
}while(dia_change);
//FIXME or try the standard 2 pass qpel or similar
for(i=0; i<3; i++){
color[i]= get_dc(s, mb_x, mb_y, i);
}
check_block(s, mb_x, mb_y, color, 1, &best_rd);
//FIXME RD style color selection
if(!same_block(block, &backup)){
if(tb != &null_block) tb ->type &= ~BLOCK_OPT;
if(lb != &null_block) lb ->type &= ~BLOCK_OPT;
if(rb != &null_block) rb ->type &= ~BLOCK_OPT;
if(bb != &null_block) bb ->type &= ~BLOCK_OPT;
if(tlb!= &null_block) tlb->type &= ~BLOCK_OPT;
if(trb!= &null_block) trb->type &= ~BLOCK_OPT;
if(blb!= &null_block) blb->type &= ~BLOCK_OPT;
if(brb!= &null_block) brb->type &= ~BLOCK_OPT;
change ++;
}
}
}
av_log(NULL, AV_LOG_ERROR, "pass:%d changed:%d\n", pass, change);
if(!change)
break;
}
}
| true | FFmpeg | 13705b69ebe9e375fdb52469760a0fbb5f593cc1 | static void iterative_me(SnowContext *s){
int pass, mb_x, mb_y;
const int b_width = s->b_width << s->block_max_depth;
const int b_height= s->b_height << s->block_max_depth;
const int b_stride= b_width;
int color[3];
for(pass=0; pass<50; pass++){
int change= 0;
for(mb_y= 0; mb_y<b_height; mb_y++){
for(mb_x= 0; mb_x<b_width; mb_x++){
int dia_change, i, j;
int best_rd= INT_MAX;
BlockNode backup;
const int index= mb_x + mb_y * b_stride;
BlockNode *block= &s->block[index];
BlockNode *tb = mb_y ? &s->block[index-b_stride ] : &null_block;
BlockNode *lb = mb_x ? &s->block[index -1] : &null_block;
BlockNode *rb = mb_x<b_width ? &s->block[index +1] : &null_block;
BlockNode *bb = mb_y<b_height ? &s->block[index+b_stride ] : &null_block;
BlockNode *tlb= mb_x && mb_y ? &s->block[index-b_stride-1] : &null_block;
BlockNode *trb= mb_x<b_width && mb_y ? &s->block[index-b_stride+1] : &null_block;
BlockNode *blb= mb_x && mb_y<b_height ? &s->block[index+b_stride-1] : &null_block;
BlockNode *brb= mb_x<b_width && mb_y<b_height ? &s->block[index+b_stride+1] : &null_block;
if(pass && (block->type & BLOCK_OPT))
continue;
block->type |= BLOCK_OPT;
backup= *block;
if(!s->me_cache_generation)
memset(s->me_cache, 0, sizeof(s->me_cache));
s->me_cache_generation += 1<<22;
check_block(s, mb_x, mb_y, (int[2]){block->mx, block->my}, 0, &best_rd);
check_block(s, mb_x, mb_y, (int[2]){0, 0}, 0, &best_rd);
check_block(s, mb_x, mb_y, (int[2]){tb->mx, tb->my}, 0, &best_rd);
check_block(s, mb_x, mb_y, (int[2]){lb->mx, lb->my}, 0, &best_rd);
check_block(s, mb_x, mb_y, (int[2]){rb->mx, rb->my}, 0, &best_rd);
check_block(s, mb_x, mb_y, (int[2]){bb->mx, bb->my}, 0, &best_rd);
do{
dia_change=0;
for(i=0; i<FFMAX(s->avctx->dia_size, 1); i++){
for(j=0; j<i; j++){
dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx+4*(i-j), block->my+(4*j)}, 0, &best_rd);
dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx-4*(i-j), block->my-(4*j)}, 0, &best_rd);
dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx+4*(i-j), block->my-(4*j)}, 0, &best_rd);
dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx-4*(i-j), block->my+(4*j)}, 0, &best_rd);
}
}
}while(dia_change);
do{
static const int square[8][2]= {{+1, 0},{-1, 0},{ 0,+1},{ 0,-1},{+1,+1},{-1,-1},{+1,-1},{-1,+1},};
dia_change=0;
for(i=0; i<8; i++)
dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx+square[i][0], block->my+square[i][1]}, 0, &best_rd);
}while(dia_change);
for(i=0; i<3; i++){
color[i]= get_dc(s, mb_x, mb_y, i);
}
check_block(s, mb_x, mb_y, color, 1, &best_rd);
if(!same_block(block, &backup)){
if(tb != &null_block) tb ->type &= ~BLOCK_OPT;
if(lb != &null_block) lb ->type &= ~BLOCK_OPT;
if(rb != &null_block) rb ->type &= ~BLOCK_OPT;
if(bb != &null_block) bb ->type &= ~BLOCK_OPT;
if(tlb!= &null_block) tlb->type &= ~BLOCK_OPT;
if(trb!= &null_block) trb->type &= ~BLOCK_OPT;
if(blb!= &null_block) blb->type &= ~BLOCK_OPT;
if(brb!= &null_block) brb->type &= ~BLOCK_OPT;
change ++;
}
}
}
av_log(NULL, AV_LOG_ERROR, "pass:%d changed:%d\n", pass, change);
if(!change)
break;
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(SnowContext *VAR_0){
int VAR_1, VAR_2, VAR_3;
const int VAR_4 = VAR_0->VAR_4 << VAR_0->block_max_depth;
const int VAR_5= VAR_0->VAR_5 << VAR_0->block_max_depth;
const int VAR_6= VAR_4;
int VAR_7[3];
for(VAR_1=0; VAR_1<50; VAR_1++){
int VAR_8= 0;
for(VAR_3= 0; VAR_3<VAR_5; VAR_3++){
for(VAR_2= 0; VAR_2<VAR_4; VAR_2++){
int VAR_9, VAR_10, VAR_11;
int VAR_12= INT_MAX;
BlockNode backup;
const int VAR_13= VAR_2 + VAR_3 * VAR_6;
BlockNode *block= &VAR_0->block[VAR_13];
BlockNode *tb = VAR_3 ? &VAR_0->block[VAR_13-VAR_6 ] : &null_block;
BlockNode *lb = VAR_2 ? &VAR_0->block[VAR_13 -1] : &null_block;
BlockNode *rb = VAR_2<VAR_4 ? &VAR_0->block[VAR_13 +1] : &null_block;
BlockNode *bb = VAR_3<VAR_5 ? &VAR_0->block[VAR_13+VAR_6 ] : &null_block;
BlockNode *tlb= VAR_2 && VAR_3 ? &VAR_0->block[VAR_13-VAR_6-1] : &null_block;
BlockNode *trb= VAR_2<VAR_4 && VAR_3 ? &VAR_0->block[VAR_13-VAR_6+1] : &null_block;
BlockNode *blb= VAR_2 && VAR_3<VAR_5 ? &VAR_0->block[VAR_13+VAR_6-1] : &null_block;
BlockNode *brb= VAR_2<VAR_4 && VAR_3<VAR_5 ? &VAR_0->block[VAR_13+VAR_6+1] : &null_block;
if(VAR_1 && (block->type & BLOCK_OPT))
continue;
block->type |= BLOCK_OPT;
backup= *block;
if(!VAR_0->me_cache_generation)
memset(VAR_0->me_cache, 0, sizeof(VAR_0->me_cache));
VAR_0->me_cache_generation += 1<<22;
check_block(VAR_0, VAR_2, VAR_3, (int[2]){block->mx, block->my}, 0, &VAR_12);
check_block(VAR_0, VAR_2, VAR_3, (int[2]){0, 0}, 0, &VAR_12);
check_block(VAR_0, VAR_2, VAR_3, (int[2]){tb->mx, tb->my}, 0, &VAR_12);
check_block(VAR_0, VAR_2, VAR_3, (int[2]){lb->mx, lb->my}, 0, &VAR_12);
check_block(VAR_0, VAR_2, VAR_3, (int[2]){rb->mx, rb->my}, 0, &VAR_12);
check_block(VAR_0, VAR_2, VAR_3, (int[2]){bb->mx, bb->my}, 0, &VAR_12);
do{
VAR_9=0;
for(VAR_10=0; VAR_10<FFMAX(VAR_0->avctx->dia_size, 1); VAR_10++){
for(VAR_11=0; VAR_11<VAR_10; VAR_11++){
VAR_9 |= check_block(VAR_0, VAR_2, VAR_3, (int[2]){block->mx+4*(VAR_10-VAR_11), block->my+(4*VAR_11)}, 0, &VAR_12);
VAR_9 |= check_block(VAR_0, VAR_2, VAR_3, (int[2]){block->mx-4*(VAR_10-VAR_11), block->my-(4*VAR_11)}, 0, &VAR_12);
VAR_9 |= check_block(VAR_0, VAR_2, VAR_3, (int[2]){block->mx+4*(VAR_10-VAR_11), block->my-(4*VAR_11)}, 0, &VAR_12);
VAR_9 |= check_block(VAR_0, VAR_2, VAR_3, (int[2]){block->mx-4*(VAR_10-VAR_11), block->my+(4*VAR_11)}, 0, &VAR_12);
}
}
}while(VAR_9);
do{
static const int VAR_14[8][2]= {{+1, 0},{-1, 0},{ 0,+1},{ 0,-1},{+1,+1},{-1,-1},{+1,-1},{-1,+1},};
VAR_9=0;
for(VAR_10=0; VAR_10<8; VAR_10++)
VAR_9 |= check_block(VAR_0, VAR_2, VAR_3, (int[2]){block->mx+VAR_14[VAR_10][0], block->my+VAR_14[VAR_10][1]}, 0, &VAR_12);
}while(VAR_9);
for(VAR_10=0; VAR_10<3; VAR_10++){
VAR_7[VAR_10]= get_dc(VAR_0, VAR_2, VAR_3, VAR_10);
}
check_block(VAR_0, VAR_2, VAR_3, VAR_7, 1, &VAR_12);
if(!same_block(block, &backup)){
if(tb != &null_block) tb ->type &= ~BLOCK_OPT;
if(lb != &null_block) lb ->type &= ~BLOCK_OPT;
if(rb != &null_block) rb ->type &= ~BLOCK_OPT;
if(bb != &null_block) bb ->type &= ~BLOCK_OPT;
if(tlb!= &null_block) tlb->type &= ~BLOCK_OPT;
if(trb!= &null_block) trb->type &= ~BLOCK_OPT;
if(blb!= &null_block) blb->type &= ~BLOCK_OPT;
if(brb!= &null_block) brb->type &= ~BLOCK_OPT;
VAR_8 ++;
}
}
}
av_log(NULL, AV_LOG_ERROR, "VAR_1:%d changed:%d\n", VAR_1, VAR_8);
if(!VAR_8)
break;
}
}
| [
"static void FUNC_0(SnowContext *VAR_0){",
"int VAR_1, VAR_2, VAR_3;",
"const int VAR_4 = VAR_0->VAR_4 << VAR_0->block_max_depth;",
"const int VAR_5= VAR_0->VAR_5 << VAR_0->block_max_depth;",
"const int VAR_6= VAR_4;",
"int VAR_7[3];",
"for(VAR_1=0; VAR_1<50; VAR_1++){",
"int VAR_8= 0;",
"for(VAR_3= 0; VAR_3<VAR_5; VAR_3++){",
"for(VAR_2= 0; VAR_2<VAR_4; VAR_2++){",
"int VAR_9, VAR_10, VAR_11;",
"int VAR_12= INT_MAX;",
"BlockNode backup;",
"const int VAR_13= VAR_2 + VAR_3 * VAR_6;",
"BlockNode *block= &VAR_0->block[VAR_13];",
"BlockNode *tb = VAR_3 ? &VAR_0->block[VAR_13-VAR_6 ] : &null_block;",
"BlockNode *lb = VAR_2 ? &VAR_0->block[VAR_13 -1] : &null_block;",
"BlockNode *rb = VAR_2<VAR_4 ? &VAR_0->block[VAR_13 +1] : &null_block;",
"BlockNode *bb = VAR_3<VAR_5 ? &VAR_0->block[VAR_13+VAR_6 ] : &null_block;",
"BlockNode *tlb= VAR_2 && VAR_3 ? &VAR_0->block[VAR_13-VAR_6-1] : &null_block;",
"BlockNode *trb= VAR_2<VAR_4 && VAR_3 ? &VAR_0->block[VAR_13-VAR_6+1] : &null_block;",
"BlockNode *blb= VAR_2 && VAR_3<VAR_5 ? &VAR_0->block[VAR_13+VAR_6-1] : &null_block;",
"BlockNode *brb= VAR_2<VAR_4 && VAR_3<VAR_5 ? &VAR_0->block[VAR_13+VAR_6+1] : &null_block;",
"if(VAR_1 && (block->type & BLOCK_OPT))\ncontinue;",
"block->type |= BLOCK_OPT;",
"backup= *block;",
"if(!VAR_0->me_cache_generation)\nmemset(VAR_0->me_cache, 0, sizeof(VAR_0->me_cache));",
"VAR_0->me_cache_generation += 1<<22;",
"check_block(VAR_0, VAR_2, VAR_3, (int[2]){block->mx, block->my}, 0, &VAR_12);",
"check_block(VAR_0, VAR_2, VAR_3, (int[2]){0, 0}, 0, &VAR_12);",
"check_block(VAR_0, VAR_2, VAR_3, (int[2]){tb->mx, tb->my}, 0, &VAR_12);",
"check_block(VAR_0, VAR_2, VAR_3, (int[2]){lb->mx, lb->my}, 0, &VAR_12);",
"check_block(VAR_0, VAR_2, VAR_3, (int[2]){rb->mx, rb->my}, 0, &VAR_12);",
"check_block(VAR_0, VAR_2, VAR_3, (int[2]){bb->mx, bb->my}, 0, &VAR_12);",
"do{",
"VAR_9=0;",
"for(VAR_10=0; VAR_10<FFMAX(VAR_0->avctx->dia_size, 1); VAR_10++){",
"for(VAR_11=0; VAR_11<VAR_10; VAR_11++){",
"VAR_9 |= check_block(VAR_0, VAR_2, VAR_3, (int[2]){block->mx+4*(VAR_10-VAR_11), block->my+(4*VAR_11)}, 0, &VAR_12);",
"VAR_9 |= check_block(VAR_0, VAR_2, VAR_3, (int[2]){block->mx-4*(VAR_10-VAR_11), block->my-(4*VAR_11)}, 0, &VAR_12);",
"VAR_9 |= check_block(VAR_0, VAR_2, VAR_3, (int[2]){block->mx+4*(VAR_10-VAR_11), block->my-(4*VAR_11)}, 0, &VAR_12);",
"VAR_9 |= check_block(VAR_0, VAR_2, VAR_3, (int[2]){block->mx-4*(VAR_10-VAR_11), block->my+(4*VAR_11)}, 0, &VAR_12);",
"}",
"}",
"}while(VAR_9);",
"do{",
"static const int VAR_14[8][2]= {{+1, 0},{-1, 0},{ 0,+1},{ 0,-1},{+1,+1},{-1,-1},{+1,-1},{-1,+1},};",
"VAR_9=0;",
"for(VAR_10=0; VAR_10<8; VAR_10++)",
"VAR_9 |= check_block(VAR_0, VAR_2, VAR_3, (int[2]){block->mx+VAR_14[VAR_10][0], block->my+VAR_14[VAR_10][1]}, 0, &VAR_12);",
"}while(VAR_9);",
"for(VAR_10=0; VAR_10<3; VAR_10++){",
"VAR_7[VAR_10]= get_dc(VAR_0, VAR_2, VAR_3, VAR_10);",
"}",
"check_block(VAR_0, VAR_2, VAR_3, VAR_7, 1, &VAR_12);",
"if(!same_block(block, &backup)){",
"if(tb != &null_block) tb ->type &= ~BLOCK_OPT;",
"if(lb != &null_block) lb ->type &= ~BLOCK_OPT;",
"if(rb != &null_block) rb ->type &= ~BLOCK_OPT;",
"if(bb != &null_block) bb ->type &= ~BLOCK_OPT;",
"if(tlb!= &null_block) tlb->type &= ~BLOCK_OPT;",
"if(trb!= &null_block) trb->type &= ~BLOCK_OPT;",
"if(blb!= &null_block) blb->type &= ~BLOCK_OPT;",
"if(brb!= &null_block) brb->type &= ~BLOCK_OPT;",
"VAR_8 ++;",
"}",
"}",
"}",
"av_log(NULL, AV_LOG_ERROR, \"VAR_1:%d changed:%d\\n\", VAR_1, VAR_8);",
"if(!VAR_8)\nbreak;",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1
],
[
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53,
55
],
[
57
],
[
61
],
[
65,
67
],
[
69
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
133
],
[
135
],
[
137
],
[
139
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173,
175
],
[
177
],
[
179
]
]
|
15,597 | static void coroutine_fn v9fs_xattrcreate(void *opaque)
{
int flags;
int32_t fid;
int64_t size;
ssize_t err = 0;
V9fsString name;
size_t offset = 7;
V9fsFidState *file_fidp;
V9fsFidState *xattr_fidp;
V9fsPDU *pdu = opaque;
v9fs_string_init(&name);
err = pdu_unmarshal(pdu, offset, "dsqd", &fid, &name, &size, &flags);
if (err < 0) {
goto out_nofid;
}
trace_v9fs_xattrcreate(pdu->tag, pdu->id, fid, name.data, size, flags);
file_fidp = get_fid(pdu, fid);
if (file_fidp == NULL) {
err = -EINVAL;
goto out_nofid;
}
/* Make the file fid point to xattr */
xattr_fidp = file_fidp;
xattr_fidp->fid_type = P9_FID_XATTR;
xattr_fidp->fs.xattr.copied_len = 0;
xattr_fidp->fs.xattr.len = size;
xattr_fidp->fs.xattr.flags = flags;
v9fs_string_init(&xattr_fidp->fs.xattr.name);
v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name);
xattr_fidp->fs.xattr.value = g_malloc(size);
err = offset;
put_fid(pdu, file_fidp);
out_nofid:
pdu_complete(pdu, err);
v9fs_string_free(&name);
}
| true | qemu | eb687602853b4ae656e9236ee4222609f3a6887d | static void coroutine_fn v9fs_xattrcreate(void *opaque)
{
int flags;
int32_t fid;
int64_t size;
ssize_t err = 0;
V9fsString name;
size_t offset = 7;
V9fsFidState *file_fidp;
V9fsFidState *xattr_fidp;
V9fsPDU *pdu = opaque;
v9fs_string_init(&name);
err = pdu_unmarshal(pdu, offset, "dsqd", &fid, &name, &size, &flags);
if (err < 0) {
goto out_nofid;
}
trace_v9fs_xattrcreate(pdu->tag, pdu->id, fid, name.data, size, flags);
file_fidp = get_fid(pdu, fid);
if (file_fidp == NULL) {
err = -EINVAL;
goto out_nofid;
}
xattr_fidp = file_fidp;
xattr_fidp->fid_type = P9_FID_XATTR;
xattr_fidp->fs.xattr.copied_len = 0;
xattr_fidp->fs.xattr.len = size;
xattr_fidp->fs.xattr.flags = flags;
v9fs_string_init(&xattr_fidp->fs.xattr.name);
v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name);
xattr_fidp->fs.xattr.value = g_malloc(size);
err = offset;
put_fid(pdu, file_fidp);
out_nofid:
pdu_complete(pdu, err);
v9fs_string_free(&name);
}
| {
"code": [
" xattr_fidp->fs.xattr.value = g_malloc(size);"
],
"line_no": [
65
]
} | static void VAR_0 v9fs_xattrcreate(void *opaque)
{
int flags;
int32_t fid;
int64_t size;
ssize_t err = 0;
V9fsString name;
size_t offset = 7;
V9fsFidState *file_fidp;
V9fsFidState *xattr_fidp;
V9fsPDU *pdu = opaque;
v9fs_string_init(&name);
err = pdu_unmarshal(pdu, offset, "dsqd", &fid, &name, &size, &flags);
if (err < 0) {
goto out_nofid;
}
trace_v9fs_xattrcreate(pdu->tag, pdu->id, fid, name.data, size, flags);
file_fidp = get_fid(pdu, fid);
if (file_fidp == NULL) {
err = -EINVAL;
goto out_nofid;
}
xattr_fidp = file_fidp;
xattr_fidp->fid_type = P9_FID_XATTR;
xattr_fidp->fs.xattr.copied_len = 0;
xattr_fidp->fs.xattr.len = size;
xattr_fidp->fs.xattr.flags = flags;
v9fs_string_init(&xattr_fidp->fs.xattr.name);
v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name);
xattr_fidp->fs.xattr.value = g_malloc(size);
err = offset;
put_fid(pdu, file_fidp);
out_nofid:
pdu_complete(pdu, err);
v9fs_string_free(&name);
}
| [
"static void VAR_0 v9fs_xattrcreate(void *opaque)\n{",
"int flags;",
"int32_t fid;",
"int64_t size;",
"ssize_t err = 0;",
"V9fsString name;",
"size_t offset = 7;",
"V9fsFidState *file_fidp;",
"V9fsFidState *xattr_fidp;",
"V9fsPDU *pdu = opaque;",
"v9fs_string_init(&name);",
"err = pdu_unmarshal(pdu, offset, \"dsqd\", &fid, &name, &size, &flags);",
"if (err < 0) {",
"goto out_nofid;",
"}",
"trace_v9fs_xattrcreate(pdu->tag, pdu->id, fid, name.data, size, flags);",
"file_fidp = get_fid(pdu, fid);",
"if (file_fidp == NULL) {",
"err = -EINVAL;",
"goto out_nofid;",
"}",
"xattr_fidp = file_fidp;",
"xattr_fidp->fid_type = P9_FID_XATTR;",
"xattr_fidp->fs.xattr.copied_len = 0;",
"xattr_fidp->fs.xattr.len = size;",
"xattr_fidp->fs.xattr.flags = flags;",
"v9fs_string_init(&xattr_fidp->fs.xattr.name);",
"v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name);",
"xattr_fidp->fs.xattr.value = g_malloc(size);",
"err = offset;",
"put_fid(pdu, file_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,
0,
1,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71,
73
],
[
75
],
[
77
]
]
|
15,598 | static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
int size, int64_t pos, uint64_t cluster_time,
uint64_t block_duration, int is_keyframe,
uint8_t *additional, uint64_t additional_id, int additional_size,
int64_t cluster_pos, int64_t discard_padding)
{
uint64_t timecode = AV_NOPTS_VALUE;
MatroskaTrack *track;
int res = 0;
AVStream *st;
int16_t block_time;
uint32_t *lace_size = NULL;
int n, flags, laces = 0;
uint64_t num;
int trust_default_duration = 1;
if ((n = matroska_ebmlnum_uint(matroska, data, size, &num)) < 0) {
av_log(matroska->ctx, AV_LOG_ERROR, "EBML block data error\n");
return n;
}
data += n;
size -= n;
track = matroska_find_track_by_num(matroska, num);
if (!track || !track->stream) {
av_log(matroska->ctx, AV_LOG_INFO,
"Invalid stream %"PRIu64" or size %u\n", num, size);
return AVERROR_INVALIDDATA;
} else if (size <= 3)
return 0;
st = track->stream;
if (st->discard >= AVDISCARD_ALL)
return res;
av_assert1(block_duration != AV_NOPTS_VALUE);
block_time = sign_extend(AV_RB16(data), 16);
data += 2;
flags = *data++;
size -= 3;
if (is_keyframe == -1)
is_keyframe = flags & 0x80 ? AV_PKT_FLAG_KEY : 0;
if (cluster_time != (uint64_t) -1 &&
(block_time >= 0 || cluster_time >= -block_time)) {
timecode = cluster_time + block_time - track->codec_delay_in_track_tb;
if (track->type == MATROSKA_TRACK_TYPE_SUBTITLE &&
timecode < track->end_timecode)
is_keyframe = 0; /* overlapping subtitles are not key frame */
if (is_keyframe)
av_add_index_entry(st, cluster_pos, timecode, 0, 0,
AVINDEX_KEYFRAME);
}
if (matroska->skip_to_keyframe &&
track->type != MATROSKA_TRACK_TYPE_SUBTITLE) {
if (timecode < matroska->skip_to_timecode)
return res;
if (is_keyframe)
matroska->skip_to_keyframe = 0;
else if (!st->skip_to_keyframe) {
av_log(matroska->ctx, AV_LOG_ERROR, "File is broken, keyframes not correctly marked!\n");
matroska->skip_to_keyframe = 0;
}
}
res = matroska_parse_laces(matroska, &data, &size, (flags & 0x06) >> 1,
&lace_size, &laces);
if (res)
goto end;
if (track->audio.samplerate == 8000) {
// If this is needed for more codecs, then add them here
if (st->codecpar->codec_id == AV_CODEC_ID_AC3) {
if (track->audio.samplerate != st->codecpar->sample_rate || !st->codecpar->frame_size)
trust_default_duration = 0;
}
}
if (!block_duration && trust_default_duration)
block_duration = track->default_duration * laces / matroska->time_scale;
if (cluster_time != (uint64_t)-1 && (block_time >= 0 || cluster_time >= -block_time))
track->end_timecode =
FFMAX(track->end_timecode, timecode + block_duration);
for (n = 0; n < laces; n++) {
int64_t lace_duration = block_duration*(n+1) / laces - block_duration*n / laces;
if (lace_size[n] > size) {
av_log(matroska->ctx, AV_LOG_ERROR, "Invalid packet size\n");
break;
}
if ((st->codecpar->codec_id == AV_CODEC_ID_RA_288 ||
st->codecpar->codec_id == AV_CODEC_ID_COOK ||
st->codecpar->codec_id == AV_CODEC_ID_SIPR ||
st->codecpar->codec_id == AV_CODEC_ID_ATRAC3) &&
st->codecpar->block_align && track->audio.sub_packet_size) {
res = matroska_parse_rm_audio(matroska, track, st, data,
lace_size[n],
timecode, pos);
if (res)
goto end;
} else if (st->codecpar->codec_id == AV_CODEC_ID_WEBVTT) {
res = matroska_parse_webvtt(matroska, track, st,
data, lace_size[n],
timecode, lace_duration,
pos);
if (res)
goto end;
} else {
res = matroska_parse_frame(matroska, track, st, data, lace_size[n],
timecode, lace_duration, pos,
!n ? is_keyframe : 0,
additional, additional_id, additional_size,
discard_padding);
if (res)
goto end;
}
if (timecode != AV_NOPTS_VALUE)
timecode = lace_duration ? timecode + lace_duration : AV_NOPTS_VALUE;
data += lace_size[n];
size -= lace_size[n];
}
end:
av_free(lace_size);
return res;
}
| true | FFmpeg | d59820f6fec3fd112436fb7712e4f9d6d768b664 | static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
int size, int64_t pos, uint64_t cluster_time,
uint64_t block_duration, int is_keyframe,
uint8_t *additional, uint64_t additional_id, int additional_size,
int64_t cluster_pos, int64_t discard_padding)
{
uint64_t timecode = AV_NOPTS_VALUE;
MatroskaTrack *track;
int res = 0;
AVStream *st;
int16_t block_time;
uint32_t *lace_size = NULL;
int n, flags, laces = 0;
uint64_t num;
int trust_default_duration = 1;
if ((n = matroska_ebmlnum_uint(matroska, data, size, &num)) < 0) {
av_log(matroska->ctx, AV_LOG_ERROR, "EBML block data error\n");
return n;
}
data += n;
size -= n;
track = matroska_find_track_by_num(matroska, num);
if (!track || !track->stream) {
av_log(matroska->ctx, AV_LOG_INFO,
"Invalid stream %"PRIu64" or size %u\n", num, size);
return AVERROR_INVALIDDATA;
} else if (size <= 3)
return 0;
st = track->stream;
if (st->discard >= AVDISCARD_ALL)
return res;
av_assert1(block_duration != AV_NOPTS_VALUE);
block_time = sign_extend(AV_RB16(data), 16);
data += 2;
flags = *data++;
size -= 3;
if (is_keyframe == -1)
is_keyframe = flags & 0x80 ? AV_PKT_FLAG_KEY : 0;
if (cluster_time != (uint64_t) -1 &&
(block_time >= 0 || cluster_time >= -block_time)) {
timecode = cluster_time + block_time - track->codec_delay_in_track_tb;
if (track->type == MATROSKA_TRACK_TYPE_SUBTITLE &&
timecode < track->end_timecode)
is_keyframe = 0;
if (is_keyframe)
av_add_index_entry(st, cluster_pos, timecode, 0, 0,
AVINDEX_KEYFRAME);
}
if (matroska->skip_to_keyframe &&
track->type != MATROSKA_TRACK_TYPE_SUBTITLE) {
if (timecode < matroska->skip_to_timecode)
return res;
if (is_keyframe)
matroska->skip_to_keyframe = 0;
else if (!st->skip_to_keyframe) {
av_log(matroska->ctx, AV_LOG_ERROR, "File is broken, keyframes not correctly marked!\n");
matroska->skip_to_keyframe = 0;
}
}
res = matroska_parse_laces(matroska, &data, &size, (flags & 0x06) >> 1,
&lace_size, &laces);
if (res)
goto end;
if (track->audio.samplerate == 8000) {
if (st->codecpar->codec_id == AV_CODEC_ID_AC3) {
if (track->audio.samplerate != st->codecpar->sample_rate || !st->codecpar->frame_size)
trust_default_duration = 0;
}
}
if (!block_duration && trust_default_duration)
block_duration = track->default_duration * laces / matroska->time_scale;
if (cluster_time != (uint64_t)-1 && (block_time >= 0 || cluster_time >= -block_time))
track->end_timecode =
FFMAX(track->end_timecode, timecode + block_duration);
for (n = 0; n < laces; n++) {
int64_t lace_duration = block_duration*(n+1) / laces - block_duration*n / laces;
if (lace_size[n] > size) {
av_log(matroska->ctx, AV_LOG_ERROR, "Invalid packet size\n");
break;
}
if ((st->codecpar->codec_id == AV_CODEC_ID_RA_288 ||
st->codecpar->codec_id == AV_CODEC_ID_COOK ||
st->codecpar->codec_id == AV_CODEC_ID_SIPR ||
st->codecpar->codec_id == AV_CODEC_ID_ATRAC3) &&
st->codecpar->block_align && track->audio.sub_packet_size) {
res = matroska_parse_rm_audio(matroska, track, st, data,
lace_size[n],
timecode, pos);
if (res)
goto end;
} else if (st->codecpar->codec_id == AV_CODEC_ID_WEBVTT) {
res = matroska_parse_webvtt(matroska, track, st,
data, lace_size[n],
timecode, lace_duration,
pos);
if (res)
goto end;
} else {
res = matroska_parse_frame(matroska, track, st, data, lace_size[n],
timecode, lace_duration, pos,
!n ? is_keyframe : 0,
additional, additional_id, additional_size,
discard_padding);
if (res)
goto end;
}
if (timecode != AV_NOPTS_VALUE)
timecode = lace_duration ? timecode + lace_duration : AV_NOPTS_VALUE;
data += lace_size[n];
size -= lace_size[n];
}
end:
av_free(lace_size);
return res;
}
| {
"code": [
" if (timecode < matroska->skip_to_timecode)"
],
"line_no": [
111
]
} | static int FUNC_0(MatroskaDemuxContext *VAR_0, uint8_t *VAR_1,
int VAR_2, int64_t VAR_3, uint64_t VAR_4,
uint64_t VAR_5, int VAR_6,
uint8_t *VAR_7, uint64_t VAR_8, int VAR_9,
int64_t VAR_10, int64_t VAR_11)
{
uint64_t timecode = AV_NOPTS_VALUE;
MatroskaTrack *track;
int VAR_12 = 0;
AVStream *st;
int16_t block_time;
uint32_t *lace_size = NULL;
int VAR_13, VAR_14, VAR_15 = 0;
uint64_t num;
int VAR_16 = 1;
if ((VAR_13 = matroska_ebmlnum_uint(VAR_0, VAR_1, VAR_2, &num)) < 0) {
av_log(VAR_0->ctx, AV_LOG_ERROR, "EBML block VAR_1 error\VAR_13");
return VAR_13;
}
VAR_1 += VAR_13;
VAR_2 -= VAR_13;
track = matroska_find_track_by_num(VAR_0, num);
if (!track || !track->stream) {
av_log(VAR_0->ctx, AV_LOG_INFO,
"Invalid stream %"PRIu64" or VAR_2 %u\VAR_13", num, VAR_2);
return AVERROR_INVALIDDATA;
} else if (VAR_2 <= 3)
return 0;
st = track->stream;
if (st->discard >= AVDISCARD_ALL)
return VAR_12;
av_assert1(VAR_5 != AV_NOPTS_VALUE);
block_time = sign_extend(AV_RB16(VAR_1), 16);
VAR_1 += 2;
VAR_14 = *VAR_1++;
VAR_2 -= 3;
if (VAR_6 == -1)
VAR_6 = VAR_14 & 0x80 ? AV_PKT_FLAG_KEY : 0;
if (VAR_4 != (uint64_t) -1 &&
(block_time >= 0 || VAR_4 >= -block_time)) {
timecode = VAR_4 + block_time - track->codec_delay_in_track_tb;
if (track->type == MATROSKA_TRACK_TYPE_SUBTITLE &&
timecode < track->end_timecode)
VAR_6 = 0;
if (VAR_6)
av_add_index_entry(st, VAR_10, timecode, 0, 0,
AVINDEX_KEYFRAME);
}
if (VAR_0->skip_to_keyframe &&
track->type != MATROSKA_TRACK_TYPE_SUBTITLE) {
if (timecode < VAR_0->skip_to_timecode)
return VAR_12;
if (VAR_6)
VAR_0->skip_to_keyframe = 0;
else if (!st->skip_to_keyframe) {
av_log(VAR_0->ctx, AV_LOG_ERROR, "File is broken, keyframes not correctly marked!\VAR_13");
VAR_0->skip_to_keyframe = 0;
}
}
VAR_12 = matroska_parse_laces(VAR_0, &VAR_1, &VAR_2, (VAR_14 & 0x06) >> 1,
&lace_size, &VAR_15);
if (VAR_12)
goto end;
if (track->audio.samplerate == 8000) {
if (st->codecpar->codec_id == AV_CODEC_ID_AC3) {
if (track->audio.samplerate != st->codecpar->sample_rate || !st->codecpar->frame_size)
VAR_16 = 0;
}
}
if (!VAR_5 && VAR_16)
VAR_5 = track->default_duration * VAR_15 / VAR_0->time_scale;
if (VAR_4 != (uint64_t)-1 && (block_time >= 0 || VAR_4 >= -block_time))
track->end_timecode =
FFMAX(track->end_timecode, timecode + VAR_5);
for (VAR_13 = 0; VAR_13 < VAR_15; VAR_13++) {
int64_t lace_duration = VAR_5*(VAR_13+1) / VAR_15 - VAR_5*VAR_13 / VAR_15;
if (lace_size[VAR_13] > VAR_2) {
av_log(VAR_0->ctx, AV_LOG_ERROR, "Invalid packet VAR_2\VAR_13");
break;
}
if ((st->codecpar->codec_id == AV_CODEC_ID_RA_288 ||
st->codecpar->codec_id == AV_CODEC_ID_COOK ||
st->codecpar->codec_id == AV_CODEC_ID_SIPR ||
st->codecpar->codec_id == AV_CODEC_ID_ATRAC3) &&
st->codecpar->block_align && track->audio.sub_packet_size) {
VAR_12 = matroska_parse_rm_audio(VAR_0, track, st, VAR_1,
lace_size[VAR_13],
timecode, VAR_3);
if (VAR_12)
goto end;
} else if (st->codecpar->codec_id == AV_CODEC_ID_WEBVTT) {
VAR_12 = matroska_parse_webvtt(VAR_0, track, st,
VAR_1, lace_size[VAR_13],
timecode, lace_duration,
VAR_3);
if (VAR_12)
goto end;
} else {
VAR_12 = matroska_parse_frame(VAR_0, track, st, VAR_1, lace_size[VAR_13],
timecode, lace_duration, VAR_3,
!VAR_13 ? VAR_6 : 0,
VAR_7, VAR_8, VAR_9,
VAR_11);
if (VAR_12)
goto end;
}
if (timecode != AV_NOPTS_VALUE)
timecode = lace_duration ? timecode + lace_duration : AV_NOPTS_VALUE;
VAR_1 += lace_size[VAR_13];
VAR_2 -= lace_size[VAR_13];
}
end:
av_free(lace_size);
return VAR_12;
}
| [
"static int FUNC_0(MatroskaDemuxContext *VAR_0, uint8_t *VAR_1,\nint VAR_2, int64_t VAR_3, uint64_t VAR_4,\nuint64_t VAR_5, int VAR_6,\nuint8_t *VAR_7, uint64_t VAR_8, int VAR_9,\nint64_t VAR_10, int64_t VAR_11)\n{",
"uint64_t timecode = AV_NOPTS_VALUE;",
"MatroskaTrack *track;",
"int VAR_12 = 0;",
"AVStream *st;",
"int16_t block_time;",
"uint32_t *lace_size = NULL;",
"int VAR_13, VAR_14, VAR_15 = 0;",
"uint64_t num;",
"int VAR_16 = 1;",
"if ((VAR_13 = matroska_ebmlnum_uint(VAR_0, VAR_1, VAR_2, &num)) < 0) {",
"av_log(VAR_0->ctx, AV_LOG_ERROR, \"EBML block VAR_1 error\\VAR_13\");",
"return VAR_13;",
"}",
"VAR_1 += VAR_13;",
"VAR_2 -= VAR_13;",
"track = matroska_find_track_by_num(VAR_0, num);",
"if (!track || !track->stream) {",
"av_log(VAR_0->ctx, AV_LOG_INFO,\n\"Invalid stream %\"PRIu64\" or VAR_2 %u\\VAR_13\", num, VAR_2);",
"return AVERROR_INVALIDDATA;",
"} else if (VAR_2 <= 3)",
"return 0;",
"st = track->stream;",
"if (st->discard >= AVDISCARD_ALL)\nreturn VAR_12;",
"av_assert1(VAR_5 != AV_NOPTS_VALUE);",
"block_time = sign_extend(AV_RB16(VAR_1), 16);",
"VAR_1 += 2;",
"VAR_14 = *VAR_1++;",
"VAR_2 -= 3;",
"if (VAR_6 == -1)\nVAR_6 = VAR_14 & 0x80 ? AV_PKT_FLAG_KEY : 0;",
"if (VAR_4 != (uint64_t) -1 &&\n(block_time >= 0 || VAR_4 >= -block_time)) {",
"timecode = VAR_4 + block_time - track->codec_delay_in_track_tb;",
"if (track->type == MATROSKA_TRACK_TYPE_SUBTITLE &&\ntimecode < track->end_timecode)\nVAR_6 = 0;",
"if (VAR_6)\nav_add_index_entry(st, VAR_10, timecode, 0, 0,\nAVINDEX_KEYFRAME);",
"}",
"if (VAR_0->skip_to_keyframe &&\ntrack->type != MATROSKA_TRACK_TYPE_SUBTITLE) {",
"if (timecode < VAR_0->skip_to_timecode)\nreturn VAR_12;",
"if (VAR_6)\nVAR_0->skip_to_keyframe = 0;",
"else if (!st->skip_to_keyframe) {",
"av_log(VAR_0->ctx, AV_LOG_ERROR, \"File is broken, keyframes not correctly marked!\\VAR_13\");",
"VAR_0->skip_to_keyframe = 0;",
"}",
"}",
"VAR_12 = matroska_parse_laces(VAR_0, &VAR_1, &VAR_2, (VAR_14 & 0x06) >> 1,\n&lace_size, &VAR_15);",
"if (VAR_12)\ngoto end;",
"if (track->audio.samplerate == 8000) {",
"if (st->codecpar->codec_id == AV_CODEC_ID_AC3) {",
"if (track->audio.samplerate != st->codecpar->sample_rate || !st->codecpar->frame_size)\nVAR_16 = 0;",
"}",
"}",
"if (!VAR_5 && VAR_16)\nVAR_5 = track->default_duration * VAR_15 / VAR_0->time_scale;",
"if (VAR_4 != (uint64_t)-1 && (block_time >= 0 || VAR_4 >= -block_time))\ntrack->end_timecode =\nFFMAX(track->end_timecode, timecode + VAR_5);",
"for (VAR_13 = 0; VAR_13 < VAR_15; VAR_13++) {",
"int64_t lace_duration = VAR_5*(VAR_13+1) / VAR_15 - VAR_5*VAR_13 / VAR_15;",
"if (lace_size[VAR_13] > VAR_2) {",
"av_log(VAR_0->ctx, AV_LOG_ERROR, \"Invalid packet VAR_2\\VAR_13\");",
"break;",
"}",
"if ((st->codecpar->codec_id == AV_CODEC_ID_RA_288 ||\nst->codecpar->codec_id == AV_CODEC_ID_COOK ||\nst->codecpar->codec_id == AV_CODEC_ID_SIPR ||\nst->codecpar->codec_id == AV_CODEC_ID_ATRAC3) &&\nst->codecpar->block_align && track->audio.sub_packet_size) {",
"VAR_12 = matroska_parse_rm_audio(VAR_0, track, st, VAR_1,\nlace_size[VAR_13],\ntimecode, VAR_3);",
"if (VAR_12)\ngoto end;",
"} else if (st->codecpar->codec_id == AV_CODEC_ID_WEBVTT) {",
"VAR_12 = matroska_parse_webvtt(VAR_0, track, st,\nVAR_1, lace_size[VAR_13],\ntimecode, lace_duration,\nVAR_3);",
"if (VAR_12)\ngoto end;",
"} else {",
"VAR_12 = matroska_parse_frame(VAR_0, track, st, VAR_1, lace_size[VAR_13],\ntimecode, lace_duration, VAR_3,\n!VAR_13 ? VAR_6 : 0,\nVAR_7, VAR_8, VAR_9,\nVAR_11);",
"if (VAR_12)\ngoto end;",
"}",
"if (timecode != AV_NOPTS_VALUE)\ntimecode = lace_duration ? timecode + lace_duration : AV_NOPTS_VALUE;",
"VAR_1 += lace_size[VAR_13];",
"VAR_2 -= lace_size[VAR_13];",
"}",
"end:\nav_free(lace_size);",
"return VAR_12;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
]
| [
[
1,
3,
5,
7,
9,
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47
],
[
49
],
[
51,
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63,
65
],
[
67
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79,
81
],
[
85,
87
],
[
89
],
[
91,
93,
95
],
[
97,
99,
101
],
[
103
],
[
107,
109
],
[
111,
113
],
[
115,
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
131,
133
],
[
137,
139
],
[
143
],
[
147
],
[
149,
151
],
[
153
],
[
155
],
[
159,
161
],
[
165,
167,
169
],
[
173
],
[
175
],
[
179
],
[
181
],
[
183
],
[
185
],
[
189,
191,
193,
195,
197
],
[
199,
201,
203
],
[
205,
207
],
[
211
],
[
213,
215,
217,
219
],
[
221,
223
],
[
225
],
[
227,
229,
231,
233,
235
],
[
237,
239
],
[
241
],
[
245,
247
],
[
249
],
[
251
],
[
253
],
[
257,
259
],
[
261
],
[
263
]
]
|
15,599 | void cpu_x86_dump_state(CPUX86State *env, FILE *f, int flags)
{
int eflags, i;
char cc_op_name[32];
static const char *seg_name[6] = { "ES", "CS", "SS", "DS", "FS", "GS" };
eflags = env->eflags;
fprintf(f, "EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n"
"ESI=%08x EDI=%08x EBP=%08x ESP=%08x\n"
"EIP=%08x EFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d\n",
env->regs[R_EAX], env->regs[R_EBX], env->regs[R_ECX], env->regs[R_EDX],
env->regs[R_ESI], env->regs[R_EDI], env->regs[R_EBP], env->regs[R_ESP],
env->eip, eflags,
eflags & DF_MASK ? 'D' : '-',
eflags & CC_O ? 'O' : '-',
eflags & CC_S ? 'S' : '-',
eflags & CC_Z ? 'Z' : '-',
eflags & CC_A ? 'A' : '-',
eflags & CC_P ? 'P' : '-',
eflags & CC_C ? 'C' : '-',
env->hflags & HF_CPL_MASK,
(env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
(env->a20_mask >> 20) & 1);
for(i = 0; i < 6; i++) {
SegmentCache *sc = &env->segs[i];
fprintf(f, "%s =%04x %08x %08x %08x\n",
seg_name[i],
sc->selector,
(int)sc->base,
sc->limit,
sc->flags);
}
fprintf(f, "LDT=%04x %08x %08x %08x\n",
env->ldt.selector,
(int)env->ldt.base,
env->ldt.limit,
env->ldt.flags);
fprintf(f, "TR =%04x %08x %08x %08x\n",
env->tr.selector,
(int)env->tr.base,
env->tr.limit,
env->tr.flags);
fprintf(f, "GDT= %08x %08x\n",
(int)env->gdt.base, env->gdt.limit);
fprintf(f, "IDT= %08x %08x\n",
(int)env->idt.base, env->idt.limit);
fprintf(f, "CR0=%08x CR2=%08x CR3=%08x CR4=%08x\n",
env->cr[0], env->cr[2], env->cr[3], env->cr[4]);
if (flags & X86_DUMP_CCOP) {
if ((unsigned)env->cc_op < CC_OP_NB)
strcpy(cc_op_name, cc_op_str[env->cc_op]);
else
snprintf(cc_op_name, sizeof(cc_op_name), "[%d]", env->cc_op);
fprintf(f, "CCS=%08x CCD=%08x CCO=%-8s\n",
env->cc_src, env->cc_dst, cc_op_name);
}
if (flags & X86_DUMP_FPU) {
fprintf(f, "ST0=%f ST1=%f ST2=%f ST3=%f\n",
(double)env->fpregs[0],
(double)env->fpregs[1],
(double)env->fpregs[2],
(double)env->fpregs[3]);
fprintf(f, "ST4=%f ST5=%f ST6=%f ST7=%f\n",
(double)env->fpregs[4],
(double)env->fpregs[5],
(double)env->fpregs[7],
(double)env->fpregs[8]);
}
}
| true | qemu | eba2af633fb8fa3b20ad578184d79e1f0eabcefe | void cpu_x86_dump_state(CPUX86State *env, FILE *f, int flags)
{
int eflags, i;
char cc_op_name[32];
static const char *seg_name[6] = { "ES", "CS", "SS", "DS", "FS", "GS" };
eflags = env->eflags;
fprintf(f, "EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n"
"ESI=%08x EDI=%08x EBP=%08x ESP=%08x\n"
"EIP=%08x EFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d\n",
env->regs[R_EAX], env->regs[R_EBX], env->regs[R_ECX], env->regs[R_EDX],
env->regs[R_ESI], env->regs[R_EDI], env->regs[R_EBP], env->regs[R_ESP],
env->eip, eflags,
eflags & DF_MASK ? 'D' : '-',
eflags & CC_O ? 'O' : '-',
eflags & CC_S ? 'S' : '-',
eflags & CC_Z ? 'Z' : '-',
eflags & CC_A ? 'A' : '-',
eflags & CC_P ? 'P' : '-',
eflags & CC_C ? 'C' : '-',
env->hflags & HF_CPL_MASK,
(env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
(env->a20_mask >> 20) & 1);
for(i = 0; i < 6; i++) {
SegmentCache *sc = &env->segs[i];
fprintf(f, "%s =%04x %08x %08x %08x\n",
seg_name[i],
sc->selector,
(int)sc->base,
sc->limit,
sc->flags);
}
fprintf(f, "LDT=%04x %08x %08x %08x\n",
env->ldt.selector,
(int)env->ldt.base,
env->ldt.limit,
env->ldt.flags);
fprintf(f, "TR =%04x %08x %08x %08x\n",
env->tr.selector,
(int)env->tr.base,
env->tr.limit,
env->tr.flags);
fprintf(f, "GDT= %08x %08x\n",
(int)env->gdt.base, env->gdt.limit);
fprintf(f, "IDT= %08x %08x\n",
(int)env->idt.base, env->idt.limit);
fprintf(f, "CR0=%08x CR2=%08x CR3=%08x CR4=%08x\n",
env->cr[0], env->cr[2], env->cr[3], env->cr[4]);
if (flags & X86_DUMP_CCOP) {
if ((unsigned)env->cc_op < CC_OP_NB)
strcpy(cc_op_name, cc_op_str[env->cc_op]);
else
snprintf(cc_op_name, sizeof(cc_op_name), "[%d]", env->cc_op);
fprintf(f, "CCS=%08x CCD=%08x CCO=%-8s\n",
env->cc_src, env->cc_dst, cc_op_name);
}
if (flags & X86_DUMP_FPU) {
fprintf(f, "ST0=%f ST1=%f ST2=%f ST3=%f\n",
(double)env->fpregs[0],
(double)env->fpregs[1],
(double)env->fpregs[2],
(double)env->fpregs[3]);
fprintf(f, "ST4=%f ST5=%f ST6=%f ST7=%f\n",
(double)env->fpregs[4],
(double)env->fpregs[5],
(double)env->fpregs[7],
(double)env->fpregs[8]);
}
}
| {
"code": [
" strcpy(cc_op_name, cc_op_str[env->cc_op]);"
],
"line_no": [
103
]
} | void FUNC_0(CPUX86State *VAR_0, FILE *VAR_1, int VAR_2)
{
int VAR_3, VAR_4;
char VAR_5[32];
static const char *VAR_6[6] = { "ES", "CS", "SS", "DS", "FS", "GS" };
VAR_3 = VAR_0->VAR_3;
fprintf(VAR_1, "EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n"
"ESI=%08x EDI=%08x EBP=%08x ESP=%08x\n"
"EIP=%08x EFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d\n",
VAR_0->regs[R_EAX], VAR_0->regs[R_EBX], VAR_0->regs[R_ECX], VAR_0->regs[R_EDX],
VAR_0->regs[R_ESI], VAR_0->regs[R_EDI], VAR_0->regs[R_EBP], VAR_0->regs[R_ESP],
VAR_0->eip, VAR_3,
VAR_3 & DF_MASK ? 'D' : '-',
VAR_3 & CC_O ? 'O' : '-',
VAR_3 & CC_S ? 'S' : '-',
VAR_3 & CC_Z ? 'Z' : '-',
VAR_3 & CC_A ? 'A' : '-',
VAR_3 & CC_P ? 'P' : '-',
VAR_3 & CC_C ? 'C' : '-',
VAR_0->hflags & HF_CPL_MASK,
(VAR_0->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
(VAR_0->a20_mask >> 20) & 1);
for(VAR_4 = 0; VAR_4 < 6; VAR_4++) {
SegmentCache *sc = &VAR_0->segs[VAR_4];
fprintf(VAR_1, "%s =%04x %08x %08x %08x\n",
VAR_6[VAR_4],
sc->selector,
(int)sc->base,
sc->limit,
sc->VAR_2);
}
fprintf(VAR_1, "LDT=%04x %08x %08x %08x\n",
VAR_0->ldt.selector,
(int)VAR_0->ldt.base,
VAR_0->ldt.limit,
VAR_0->ldt.VAR_2);
fprintf(VAR_1, "TR =%04x %08x %08x %08x\n",
VAR_0->tr.selector,
(int)VAR_0->tr.base,
VAR_0->tr.limit,
VAR_0->tr.VAR_2);
fprintf(VAR_1, "GDT= %08x %08x\n",
(int)VAR_0->gdt.base, VAR_0->gdt.limit);
fprintf(VAR_1, "IDT= %08x %08x\n",
(int)VAR_0->idt.base, VAR_0->idt.limit);
fprintf(VAR_1, "CR0=%08x CR2=%08x CR3=%08x CR4=%08x\n",
VAR_0->cr[0], VAR_0->cr[2], VAR_0->cr[3], VAR_0->cr[4]);
if (VAR_2 & X86_DUMP_CCOP) {
if ((unsigned)VAR_0->cc_op < CC_OP_NB)
strcpy(VAR_5, cc_op_str[VAR_0->cc_op]);
else
snprintf(VAR_5, sizeof(VAR_5), "[%d]", VAR_0->cc_op);
fprintf(VAR_1, "CCS=%08x CCD=%08x CCO=%-8s\n",
VAR_0->cc_src, VAR_0->cc_dst, VAR_5);
}
if (VAR_2 & X86_DUMP_FPU) {
fprintf(VAR_1, "ST0=%VAR_1 ST1=%VAR_1 ST2=%VAR_1 ST3=%VAR_1\n",
(double)VAR_0->fpregs[0],
(double)VAR_0->fpregs[1],
(double)VAR_0->fpregs[2],
(double)VAR_0->fpregs[3]);
fprintf(VAR_1, "ST4=%VAR_1 ST5=%VAR_1 ST6=%VAR_1 ST7=%VAR_1\n",
(double)VAR_0->fpregs[4],
(double)VAR_0->fpregs[5],
(double)VAR_0->fpregs[7],
(double)VAR_0->fpregs[8]);
}
}
| [
"void FUNC_0(CPUX86State *VAR_0, FILE *VAR_1, int VAR_2)\n{",
"int VAR_3, VAR_4;",
"char VAR_5[32];",
"static const char *VAR_6[6] = { \"ES\", \"CS\", \"SS\", \"DS\", \"FS\", \"GS\" };",
"VAR_3 = VAR_0->VAR_3;",
"fprintf(VAR_1, \"EAX=%08x EBX=%08x ECX=%08x EDX=%08x\\n\"\n\"ESI=%08x EDI=%08x EBP=%08x ESP=%08x\\n\"\n\"EIP=%08x EFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d\\n\",\nVAR_0->regs[R_EAX], VAR_0->regs[R_EBX], VAR_0->regs[R_ECX], VAR_0->regs[R_EDX],\nVAR_0->regs[R_ESI], VAR_0->regs[R_EDI], VAR_0->regs[R_EBP], VAR_0->regs[R_ESP],\nVAR_0->eip, VAR_3,\nVAR_3 & DF_MASK ? 'D' : '-',\nVAR_3 & CC_O ? 'O' : '-',\nVAR_3 & CC_S ? 'S' : '-',\nVAR_3 & CC_Z ? 'Z' : '-',\nVAR_3 & CC_A ? 'A' : '-',\nVAR_3 & CC_P ? 'P' : '-',\nVAR_3 & CC_C ? 'C' : '-',\nVAR_0->hflags & HF_CPL_MASK,\n(VAR_0->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,\n(VAR_0->a20_mask >> 20) & 1);",
"for(VAR_4 = 0; VAR_4 < 6; VAR_4++) {",
"SegmentCache *sc = &VAR_0->segs[VAR_4];",
"fprintf(VAR_1, \"%s =%04x %08x %08x %08x\\n\",\nVAR_6[VAR_4],\nsc->selector,\n(int)sc->base,\nsc->limit,\nsc->VAR_2);",
"}",
"fprintf(VAR_1, \"LDT=%04x %08x %08x %08x\\n\",\nVAR_0->ldt.selector,\n(int)VAR_0->ldt.base,\nVAR_0->ldt.limit,\nVAR_0->ldt.VAR_2);",
"fprintf(VAR_1, \"TR =%04x %08x %08x %08x\\n\",\nVAR_0->tr.selector,\n(int)VAR_0->tr.base,\nVAR_0->tr.limit,\nVAR_0->tr.VAR_2);",
"fprintf(VAR_1, \"GDT= %08x %08x\\n\",\n(int)VAR_0->gdt.base, VAR_0->gdt.limit);",
"fprintf(VAR_1, \"IDT= %08x %08x\\n\",\n(int)VAR_0->idt.base, VAR_0->idt.limit);",
"fprintf(VAR_1, \"CR0=%08x CR2=%08x CR3=%08x CR4=%08x\\n\",\nVAR_0->cr[0], VAR_0->cr[2], VAR_0->cr[3], VAR_0->cr[4]);",
"if (VAR_2 & X86_DUMP_CCOP) {",
"if ((unsigned)VAR_0->cc_op < CC_OP_NB)\nstrcpy(VAR_5, cc_op_str[VAR_0->cc_op]);",
"else\nsnprintf(VAR_5, sizeof(VAR_5), \"[%d]\", VAR_0->cc_op);",
"fprintf(VAR_1, \"CCS=%08x CCD=%08x CCO=%-8s\\n\",\nVAR_0->cc_src, VAR_0->cc_dst, VAR_5);",
"}",
"if (VAR_2 & X86_DUMP_FPU) {",
"fprintf(VAR_1, \"ST0=%VAR_1 ST1=%VAR_1 ST2=%VAR_1 ST3=%VAR_1\\n\",\n(double)VAR_0->fpregs[0],\n(double)VAR_0->fpregs[1],\n(double)VAR_0->fpregs[2],\n(double)VAR_0->fpregs[3]);",
"fprintf(VAR_1, \"ST4=%VAR_1 ST5=%VAR_1 ST6=%VAR_1 ST7=%VAR_1\\n\",\n(double)VAR_0->fpregs[4],\n(double)VAR_0->fpregs[5],\n(double)VAR_0->fpregs[7],\n(double)VAR_0->fpregs[8]);",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15,
17,
19,
21,
23,
25,
27,
29,
31,
33,
35,
37,
39,
41,
43,
45
],
[
47
],
[
49
],
[
51,
53,
55,
57,
59,
61
],
[
63
],
[
65,
67,
69,
71,
73
],
[
75,
77,
79,
81,
83
],
[
85,
87
],
[
89,
91
],
[
93,
95
],
[
99
],
[
101,
103
],
[
105,
107
],
[
109,
111
],
[
113
],
[
115
],
[
117,
119,
121,
123,
125
],
[
127,
129,
131,
133,
135
],
[
137
],
[
139
]
]
|
15,600 | static void memory_region_read_accessor(MemoryRegion *mr,
hwaddr addr,
uint64_t *value,
unsigned size,
unsigned shift,
uint64_t mask)
{
uint64_t tmp;
if (mr->flush_coalesced_mmio) {
qemu_flush_coalesced_mmio_buffer();
}
tmp = mr->ops->read(mr->opaque, addr, size);
trace_memory_region_ops_read(mr, addr, tmp, size);
*value |= (tmp & mask) << shift;
}
| true | qemu | cc05c43ad942165ecc6ffd39e41991bee43af044 | static void memory_region_read_accessor(MemoryRegion *mr,
hwaddr addr,
uint64_t *value,
unsigned size,
unsigned shift,
uint64_t mask)
{
uint64_t tmp;
if (mr->flush_coalesced_mmio) {
qemu_flush_coalesced_mmio_buffer();
}
tmp = mr->ops->read(mr->opaque, addr, size);
trace_memory_region_ops_read(mr, addr, tmp, size);
*value |= (tmp & mask) << shift;
}
| {
"code": [
"static void memory_region_read_accessor(MemoryRegion *mr,",
" hwaddr addr,",
" uint64_t *value,",
" unsigned size,",
" unsigned shift,",
" uint64_t mask)",
" uint64_t tmp;",
" tmp = mr->ops->read(mr->opaque, addr, size);",
" hwaddr addr,"
],
"line_no": [
1,
3,
5,
7,
9,
11,
15,
25,
3
]
} | static void FUNC_0(MemoryRegion *VAR_0,
hwaddr VAR_1,
uint64_t *VAR_2,
unsigned VAR_3,
unsigned VAR_4,
uint64_t VAR_5)
{
uint64_t tmp;
if (VAR_0->flush_coalesced_mmio) {
qemu_flush_coalesced_mmio_buffer();
}
tmp = VAR_0->ops->read(VAR_0->opaque, VAR_1, VAR_3);
trace_memory_region_ops_read(VAR_0, VAR_1, tmp, VAR_3);
*VAR_2 |= (tmp & VAR_5) << VAR_4;
}
| [
"static void FUNC_0(MemoryRegion *VAR_0,\nhwaddr VAR_1,\nuint64_t *VAR_2,\nunsigned VAR_3,\nunsigned VAR_4,\nuint64_t VAR_5)\n{",
"uint64_t tmp;",
"if (VAR_0->flush_coalesced_mmio) {",
"qemu_flush_coalesced_mmio_buffer();",
"}",
"tmp = VAR_0->ops->read(VAR_0->opaque, VAR_1, VAR_3);",
"trace_memory_region_ops_read(VAR_0, VAR_1, tmp, VAR_3);",
"*VAR_2 |= (tmp & VAR_5) << VAR_4;",
"}"
]
| [
1,
1,
0,
0,
0,
1,
0,
0,
0
]
| [
[
1,
3,
5,
7,
9,
11,
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
]
]
|
15,601 | static void dec_load(DisasContext *dc)
{
TCGv t, *addr;
unsigned int size;
size = 1 << (dc->opcode & 3);
LOG_DIS("l %x %d\n", dc->opcode, size);
t_sync_flags(dc);
addr = compute_ldst_addr(dc, &t);
/* If we get a fault on a dslot, the jmpstate better be in sync. */
sync_jmpstate(dc);
/* Verify alignment if needed. */
if ((dc->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && size > 1) {
gen_helper_memalign(*addr, tcg_const_tl(dc->rd),
tcg_const_tl(0), tcg_const_tl(size - 1));
if (dc->rd) {
gen_load(dc, cpu_R[dc->rd], *addr, size);
} else {
gen_load(dc, env_imm, *addr, size);
if (addr == &t)
tcg_temp_free(t);
| true | qemu | 0187688f3270433269fc7d4909ad36dc5c5db7aa | static void dec_load(DisasContext *dc)
{
TCGv t, *addr;
unsigned int size;
size = 1 << (dc->opcode & 3);
LOG_DIS("l %x %d\n", dc->opcode, size);
t_sync_flags(dc);
addr = compute_ldst_addr(dc, &t);
sync_jmpstate(dc);
if ((dc->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && size > 1) {
gen_helper_memalign(*addr, tcg_const_tl(dc->rd),
tcg_const_tl(0), tcg_const_tl(size - 1));
if (dc->rd) {
gen_load(dc, cpu_R[dc->rd], *addr, size);
} else {
gen_load(dc, env_imm, *addr, size);
if (addr == &t)
tcg_temp_free(t);
| {
"code": [],
"line_no": []
} | static void FUNC_0(DisasContext *VAR_0)
{
TCGv t, *addr;
unsigned int VAR_1;
VAR_1 = 1 << (VAR_0->opcode & 3);
LOG_DIS("l %x %d\n", VAR_0->opcode, VAR_1);
t_sync_flags(VAR_0);
addr = compute_ldst_addr(VAR_0, &t);
sync_jmpstate(VAR_0);
if ((VAR_0->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && VAR_1 > 1) {
gen_helper_memalign(*addr, tcg_const_tl(VAR_0->rd),
tcg_const_tl(0), tcg_const_tl(VAR_1 - 1));
if (VAR_0->rd) {
gen_load(VAR_0, cpu_R[VAR_0->rd], *addr, VAR_1);
} else {
gen_load(VAR_0, env_imm, *addr, VAR_1);
if (addr == &t)
tcg_temp_free(t);
| [
"static void FUNC_0(DisasContext *VAR_0)\n{",
"TCGv t, *addr;",
"unsigned int VAR_1;",
"VAR_1 = 1 << (VAR_0->opcode & 3);",
"LOG_DIS(\"l %x %d\\n\", VAR_0->opcode, VAR_1);",
"t_sync_flags(VAR_0);",
"addr = compute_ldst_addr(VAR_0, &t);",
"sync_jmpstate(VAR_0);",
"if ((VAR_0->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && VAR_1 > 1) {",
"gen_helper_memalign(*addr, tcg_const_tl(VAR_0->rd),\ntcg_const_tl(0), tcg_const_tl(VAR_1 - 1));",
"if (VAR_0->rd) {",
"gen_load(VAR_0, cpu_R[VAR_0->rd], *addr, VAR_1);",
"} else {",
"gen_load(VAR_0, env_imm, *addr, VAR_1);",
"if (addr == &t)\ntcg_temp_free(t);"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
21
],
[
23
],
[
25
],
[
31
],
[
37
],
[
39,
41
],
[
46
],
[
48
],
[
50
],
[
52
],
[
57,
59
]
]
|
15,602 | static void test_visitor_in_int_overflow(TestInputVisitorData *data,
const void *unused)
{
int64_t res = 0;
Error *err = NULL;
Visitor *v;
/* this will overflow a Qint/int64, so should be deserialized into
* a QFloat/double field instead, leading to an error if we pass it
* to visit_type_int. confirm this.
*/
v = visitor_input_test_init(data, "%f", DBL_MAX);
visit_type_int(v, &res, NULL, &err);
g_assert(err);
error_free(err);
}
| true | qemu | a12a5a1a0132527afe87c079e4aae4aad372bd94 | static void test_visitor_in_int_overflow(TestInputVisitorData *data,
const void *unused)
{
int64_t res = 0;
Error *err = NULL;
Visitor *v;
v = visitor_input_test_init(data, "%f", DBL_MAX);
visit_type_int(v, &res, NULL, &err);
g_assert(err);
error_free(err);
}
| {
"code": [
" error_free(err);",
" g_assert(err);",
" error_free(err);",
" g_assert(err);",
" error_free(err);",
" g_assert(err);",
" error_free(err);",
" g_assert(err);",
" error_free(err);",
" g_assert(err);",
" error_free(err);",
" g_assert(err);",
" error_free(err);",
" g_assert(err);",
" error_free(err);",
" g_assert(err);",
" error_free(err);",
" g_assert(err);",
" error_free(err);",
" g_assert(err);",
" error_free(err);",
" g_assert(err);",
" error_free(err);",
" g_assert(err);",
" error_free(err);",
" g_assert(err);",
" error_free(err);",
" g_assert(err);",
" error_free(err);"
],
"line_no": [
31,
29,
31,
29,
31,
29,
31,
29,
31,
29,
31,
29,
31,
29,
31,
29,
31,
29,
31,
29,
31,
29,
31,
29,
31,
29,
31,
29,
31
]
} | static void FUNC_0(TestInputVisitorData *VAR_0,
const void *VAR_1)
{
int64_t res = 0;
Error *err = NULL;
Visitor *v;
v = visitor_input_test_init(VAR_0, "%f", DBL_MAX);
visit_type_int(v, &res, NULL, &err);
g_assert(err);
error_free(err);
}
| [
"static void FUNC_0(TestInputVisitorData *VAR_0,\nconst void *VAR_1)\n{",
"int64_t res = 0;",
"Error *err = NULL;",
"Visitor *v;",
"v = visitor_input_test_init(VAR_0, \"%f\", DBL_MAX);",
"visit_type_int(v, &res, NULL, &err);",
"g_assert(err);",
"error_free(err);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
1,
1,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
]
]
|
15,603 | static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
AVCodecParserContext *pc, AVPacket *pkt)
{
int num, den, presentation_delayed, delay, i;
int64_t offset;
if (s->flags & AVFMT_FLAG_NOFILLIN)
return;
if((s->flags & AVFMT_FLAG_IGNDTS) && pkt->pts != AV_NOPTS_VALUE)
pkt->dts= AV_NOPTS_VALUE;
if (st->codec->codec_id != CODEC_ID_H264 && pc && pc->pict_type == AV_PICTURE_TYPE_B)
//FIXME Set low_delay = 0 when has_b_frames = 1
st->codec->has_b_frames = 1;
/* do we have a video B-frame ? */
delay= st->codec->has_b_frames;
presentation_delayed = 0;
// ignore delay caused by frame threading so that the mpeg2-without-dts
// warning will not trigger
if (delay && st->codec->active_thread_type&FF_THREAD_FRAME)
delay -= st->codec->thread_count-1;
/* XXX: need has_b_frame, but cannot get it if the codec is
not initialized */
if (delay &&
pc && pc->pict_type != AV_PICTURE_TYPE_B)
presentation_delayed = 1;
if(pkt->pts != AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && pkt->dts - (1LL<<(st->pts_wrap_bits-1)) > pkt->pts && st->pts_wrap_bits<63){
pkt->dts -= 1LL<<st->pts_wrap_bits;
}
// some mpeg2 in mpeg-ps lack dts (issue171 / input_file.mpg)
// we take the conservative approach and discard both
// Note, if this is misbehaving for a H.264 file then possibly presentation_delayed is not set correctly.
if(delay==1 && pkt->dts == pkt->pts && pkt->dts != AV_NOPTS_VALUE && presentation_delayed){
av_log(s, AV_LOG_DEBUG, "invalid dts/pts combination %"PRIi64"\n", pkt->dts);
pkt->dts= pkt->pts= AV_NOPTS_VALUE;
}
if (pkt->duration == 0) {
compute_frame_duration(&num, &den, st, pc, pkt);
if (den && num) {
pkt->duration = av_rescale_rnd(1, num * (int64_t)st->time_base.den, den * (int64_t)st->time_base.num, AV_ROUND_DOWN);
if(pkt->duration != 0 && s->packet_buffer)
update_initial_durations(s, st, pkt);
}
}
/* correct timestamps with byte offset if demuxers only have timestamps
on packet boundaries */
if(pc && st->need_parsing == AVSTREAM_PARSE_TIMESTAMPS && pkt->size){
/* this will estimate bitrate based on this frame's duration and size */
offset = av_rescale(pc->offset, pkt->duration, pkt->size);
if(pkt->pts != AV_NOPTS_VALUE)
pkt->pts += offset;
if(pkt->dts != AV_NOPTS_VALUE)
pkt->dts += offset;
}
if (pc && pc->dts_sync_point >= 0) {
// we have synchronization info from the parser
int64_t den = st->codec->time_base.den * (int64_t) st->time_base.num;
if (den > 0) {
int64_t num = st->codec->time_base.num * (int64_t) st->time_base.den;
if (pkt->dts != AV_NOPTS_VALUE) {
// got DTS from the stream, update reference timestamp
st->reference_dts = pkt->dts - pc->dts_ref_dts_delta * num / den;
pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
} else if (st->reference_dts != AV_NOPTS_VALUE) {
// compute DTS based on reference timestamp
pkt->dts = st->reference_dts + pc->dts_ref_dts_delta * num / den;
pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
}
if (pc->dts_sync_point > 0)
st->reference_dts = pkt->dts; // new reference
}
}
/* This may be redundant, but it should not hurt. */
if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts)
presentation_delayed = 1;
// av_log(NULL, AV_LOG_DEBUG, "IN delayed:%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64" st:%d pc:%p\n", presentation_delayed, pkt->pts, pkt->dts, st->cur_dts, pkt->stream_index, pc);
/* interpolate PTS and DTS if they are not present */
//We skip H264 currently because delay and has_b_frames are not reliably set
if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != CODEC_ID_H264){
if (presentation_delayed) {
/* DTS = decompression timestamp */
/* PTS = presentation timestamp */
if (pkt->dts == AV_NOPTS_VALUE)
pkt->dts = st->last_IP_pts;
update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts);
if (pkt->dts == AV_NOPTS_VALUE)
pkt->dts = st->cur_dts;
/* this is tricky: the dts must be incremented by the duration
of the frame we are displaying, i.e. the last I- or P-frame */
if (st->last_IP_duration == 0)
st->last_IP_duration = pkt->duration;
if(pkt->dts != AV_NOPTS_VALUE)
st->cur_dts = pkt->dts + st->last_IP_duration;
st->last_IP_duration = pkt->duration;
st->last_IP_pts= pkt->pts;
/* cannot compute PTS if not present (we can compute it only
by knowing the future */
} else if(pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE || pkt->duration){
if(pkt->pts != AV_NOPTS_VALUE && pkt->duration){
int64_t old_diff= FFABS(st->cur_dts - pkt->duration - pkt->pts);
int64_t new_diff= FFABS(st->cur_dts - pkt->pts);
if(old_diff < new_diff && old_diff < (pkt->duration>>3)){
pkt->pts += pkt->duration;
// av_log(NULL, AV_LOG_DEBUG, "id:%d old:%"PRId64" new:%"PRId64" dur:%d cur:%"PRId64" size:%d\n", pkt->stream_index, old_diff, new_diff, pkt->duration, st->cur_dts, pkt->size);
}
}
/* presentation is not delayed : PTS and DTS are the same */
if(pkt->pts == AV_NOPTS_VALUE)
pkt->pts = pkt->dts;
update_initial_timestamps(s, pkt->stream_index, pkt->pts, pkt->pts);
if(pkt->pts == AV_NOPTS_VALUE)
pkt->pts = st->cur_dts;
pkt->dts = pkt->pts;
if(pkt->pts != AV_NOPTS_VALUE)
st->cur_dts = pkt->pts + pkt->duration;
}
}
if(pkt->pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY){
st->pts_buffer[0]= pkt->pts;
for(i=0; i<delay && st->pts_buffer[i] > st->pts_buffer[i+1]; i++)
FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i+1]);
if(pkt->dts == AV_NOPTS_VALUE)
pkt->dts= st->pts_buffer[0];
if(st->codec->codec_id == CODEC_ID_H264){ //we skiped it above so we try here
update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts); // this should happen on the first packet
}
if(pkt->dts > st->cur_dts)
st->cur_dts = pkt->dts;
}
// av_log(NULL, AV_LOG_ERROR, "OUTdelayed:%d/%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64"\n", presentation_delayed, delay, pkt->pts, pkt->dts, st->cur_dts);
/* update flags */
if(is_intra_only(st->codec))
pkt->flags |= AV_PKT_FLAG_KEY;
else if (pc) {
pkt->flags = 0;
/* keyframe computation */
if (pc->key_frame == 1)
pkt->flags |= AV_PKT_FLAG_KEY;
else if (pc->key_frame == -1 && pc->pict_type == AV_PICTURE_TYPE_I)
pkt->flags |= AV_PKT_FLAG_KEY;
}
if (pc)
pkt->convergence_duration = pc->convergence_duration;
}
| true | FFmpeg | 26ae9a5d7c448a3eb42641b546ee8d585ab716e6 | static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
AVCodecParserContext *pc, AVPacket *pkt)
{
int num, den, presentation_delayed, delay, i;
int64_t offset;
if (s->flags & AVFMT_FLAG_NOFILLIN)
return;
if((s->flags & AVFMT_FLAG_IGNDTS) && pkt->pts != AV_NOPTS_VALUE)
pkt->dts= AV_NOPTS_VALUE;
if (st->codec->codec_id != CODEC_ID_H264 && pc && pc->pict_type == AV_PICTURE_TYPE_B)
st->codec->has_b_frames = 1;
delay= st->codec->has_b_frames;
presentation_delayed = 0;
if (delay && st->codec->active_thread_type&FF_THREAD_FRAME)
delay -= st->codec->thread_count-1;
if (delay &&
pc && pc->pict_type != AV_PICTURE_TYPE_B)
presentation_delayed = 1;
if(pkt->pts != AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && pkt->dts - (1LL<<(st->pts_wrap_bits-1)) > pkt->pts && st->pts_wrap_bits<63){
pkt->dts -= 1LL<<st->pts_wrap_bits;
}
if(delay==1 && pkt->dts == pkt->pts && pkt->dts != AV_NOPTS_VALUE && presentation_delayed){
av_log(s, AV_LOG_DEBUG, "invalid dts/pts combination %"PRIi64"\n", pkt->dts);
pkt->dts= pkt->pts= AV_NOPTS_VALUE;
}
if (pkt->duration == 0) {
compute_frame_duration(&num, &den, st, pc, pkt);
if (den && num) {
pkt->duration = av_rescale_rnd(1, num * (int64_t)st->time_base.den, den * (int64_t)st->time_base.num, AV_ROUND_DOWN);
if(pkt->duration != 0 && s->packet_buffer)
update_initial_durations(s, st, pkt);
}
}
if(pc && st->need_parsing == AVSTREAM_PARSE_TIMESTAMPS && pkt->size){
offset = av_rescale(pc->offset, pkt->duration, pkt->size);
if(pkt->pts != AV_NOPTS_VALUE)
pkt->pts += offset;
if(pkt->dts != AV_NOPTS_VALUE)
pkt->dts += offset;
}
if (pc && pc->dts_sync_point >= 0) {
int64_t den = st->codec->time_base.den * (int64_t) st->time_base.num;
if (den > 0) {
int64_t num = st->codec->time_base.num * (int64_t) st->time_base.den;
if (pkt->dts != AV_NOPTS_VALUE) {
st->reference_dts = pkt->dts - pc->dts_ref_dts_delta * num / den;
pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
} else if (st->reference_dts != AV_NOPTS_VALUE) {
pkt->dts = st->reference_dts + pc->dts_ref_dts_delta * num / den;
pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
}
if (pc->dts_sync_point > 0)
st->reference_dts = pkt->dts;
}
}
if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts)
presentation_delayed = 1;
if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != CODEC_ID_H264){
if (presentation_delayed) {
if (pkt->dts == AV_NOPTS_VALUE)
pkt->dts = st->last_IP_pts;
update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts);
if (pkt->dts == AV_NOPTS_VALUE)
pkt->dts = st->cur_dts;
if (st->last_IP_duration == 0)
st->last_IP_duration = pkt->duration;
if(pkt->dts != AV_NOPTS_VALUE)
st->cur_dts = pkt->dts + st->last_IP_duration;
st->last_IP_duration = pkt->duration;
st->last_IP_pts= pkt->pts;
} else if(pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE || pkt->duration){
if(pkt->pts != AV_NOPTS_VALUE && pkt->duration){
int64_t old_diff= FFABS(st->cur_dts - pkt->duration - pkt->pts);
int64_t new_diff= FFABS(st->cur_dts - pkt->pts);
if(old_diff < new_diff && old_diff < (pkt->duration>>3)){
pkt->pts += pkt->duration;
}
}
if(pkt->pts == AV_NOPTS_VALUE)
pkt->pts = pkt->dts;
update_initial_timestamps(s, pkt->stream_index, pkt->pts, pkt->pts);
if(pkt->pts == AV_NOPTS_VALUE)
pkt->pts = st->cur_dts;
pkt->dts = pkt->pts;
if(pkt->pts != AV_NOPTS_VALUE)
st->cur_dts = pkt->pts + pkt->duration;
}
}
if(pkt->pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY){
st->pts_buffer[0]= pkt->pts;
for(i=0; i<delay && st->pts_buffer[i] > st->pts_buffer[i+1]; i++)
FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i+1]);
if(pkt->dts == AV_NOPTS_VALUE)
pkt->dts= st->pts_buffer[0];
if(st->codec->codec_id == CODEC_ID_H264){
update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts);
}
if(pkt->dts > st->cur_dts)
st->cur_dts = pkt->dts;
}
if(is_intra_only(st->codec))
pkt->flags |= AV_PKT_FLAG_KEY;
else if (pc) {
pkt->flags = 0;
if (pc->key_frame == 1)
pkt->flags |= AV_PKT_FLAG_KEY;
else if (pc->key_frame == -1 && pc->pict_type == AV_PICTURE_TYPE_I)
pkt->flags |= AV_PKT_FLAG_KEY;
}
if (pc)
pkt->convergence_duration = pc->convergence_duration;
}
| {
"code": [
" if (delay && st->codec->active_thread_type&FF_THREAD_FRAME)",
" delay -= st->codec->thread_count-1;"
],
"line_no": [
45,
47
]
} | static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1,
AVCodecParserContext *VAR_2, AVPacket *VAR_3)
{
int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;
int64_t offset;
if (VAR_0->flags & AVFMT_FLAG_NOFILLIN)
return;
if((VAR_0->flags & AVFMT_FLAG_IGNDTS) && VAR_3->pts != AV_NOPTS_VALUE)
VAR_3->dts= AV_NOPTS_VALUE;
if (VAR_1->codec->codec_id != CODEC_ID_H264 && VAR_2 && VAR_2->pict_type == AV_PICTURE_TYPE_B)
VAR_1->codec->has_b_frames = 1;
VAR_7= VAR_1->codec->has_b_frames;
VAR_6 = 0;
if (VAR_7 && VAR_1->codec->active_thread_type&FF_THREAD_FRAME)
VAR_7 -= VAR_1->codec->thread_count-1;
if (VAR_7 &&
VAR_2 && VAR_2->pict_type != AV_PICTURE_TYPE_B)
VAR_6 = 1;
if(VAR_3->pts != AV_NOPTS_VALUE && VAR_3->dts != AV_NOPTS_VALUE && VAR_3->dts - (1LL<<(VAR_1->pts_wrap_bits-1)) > VAR_3->pts && VAR_1->pts_wrap_bits<63){
VAR_3->dts -= 1LL<<VAR_1->pts_wrap_bits;
}
if(VAR_7==1 && VAR_3->dts == VAR_3->pts && VAR_3->dts != AV_NOPTS_VALUE && VAR_6){
av_log(VAR_0, AV_LOG_DEBUG, "invalid dts/pts combination %"PRIi64"\n", VAR_3->dts);
VAR_3->dts= VAR_3->pts= AV_NOPTS_VALUE;
}
if (VAR_3->duration == 0) {
compute_frame_duration(&VAR_4, &VAR_5, VAR_1, VAR_2, VAR_3);
if (VAR_5 && VAR_4) {
VAR_3->duration = av_rescale_rnd(1, VAR_4 * (int64_t)VAR_1->time_base.VAR_5, VAR_5 * (int64_t)VAR_1->time_base.VAR_4, AV_ROUND_DOWN);
if(VAR_3->duration != 0 && VAR_0->packet_buffer)
update_initial_durations(VAR_0, VAR_1, VAR_3);
}
}
if(VAR_2 && VAR_1->need_parsing == AVSTREAM_PARSE_TIMESTAMPS && VAR_3->size){
offset = av_rescale(VAR_2->offset, VAR_3->duration, VAR_3->size);
if(VAR_3->pts != AV_NOPTS_VALUE)
VAR_3->pts += offset;
if(VAR_3->dts != AV_NOPTS_VALUE)
VAR_3->dts += offset;
}
if (VAR_2 && VAR_2->dts_sync_point >= 0) {
int64_t VAR_5 = VAR_1->codec->time_base.VAR_5 * (int64_t) VAR_1->time_base.VAR_4;
if (VAR_5 > 0) {
int64_t VAR_4 = VAR_1->codec->time_base.VAR_4 * (int64_t) VAR_1->time_base.VAR_5;
if (VAR_3->dts != AV_NOPTS_VALUE) {
VAR_1->reference_dts = VAR_3->dts - VAR_2->dts_ref_dts_delta * VAR_4 / VAR_5;
VAR_3->pts = VAR_3->dts + VAR_2->pts_dts_delta * VAR_4 / VAR_5;
} else if (VAR_1->reference_dts != AV_NOPTS_VALUE) {
VAR_3->dts = VAR_1->reference_dts + VAR_2->dts_ref_dts_delta * VAR_4 / VAR_5;
VAR_3->pts = VAR_3->dts + VAR_2->pts_dts_delta * VAR_4 / VAR_5;
}
if (VAR_2->dts_sync_point > 0)
VAR_1->reference_dts = VAR_3->dts;
}
}
if(VAR_3->dts != AV_NOPTS_VALUE && VAR_3->pts != AV_NOPTS_VALUE && VAR_3->pts > VAR_3->dts)
VAR_6 = 1;
if((VAR_7==0 || (VAR_7==1 && VAR_2)) && VAR_1->codec->codec_id != CODEC_ID_H264){
if (VAR_6) {
if (VAR_3->dts == AV_NOPTS_VALUE)
VAR_3->dts = VAR_1->last_IP_pts;
update_initial_timestamps(VAR_0, VAR_3->stream_index, VAR_3->dts, VAR_3->pts);
if (VAR_3->dts == AV_NOPTS_VALUE)
VAR_3->dts = VAR_1->cur_dts;
if (VAR_1->last_IP_duration == 0)
VAR_1->last_IP_duration = VAR_3->duration;
if(VAR_3->dts != AV_NOPTS_VALUE)
VAR_1->cur_dts = VAR_3->dts + VAR_1->last_IP_duration;
VAR_1->last_IP_duration = VAR_3->duration;
VAR_1->last_IP_pts= VAR_3->pts;
} else if(VAR_3->pts != AV_NOPTS_VALUE || VAR_3->dts != AV_NOPTS_VALUE || VAR_3->duration){
if(VAR_3->pts != AV_NOPTS_VALUE && VAR_3->duration){
int64_t old_diff= FFABS(VAR_1->cur_dts - VAR_3->duration - VAR_3->pts);
int64_t new_diff= FFABS(VAR_1->cur_dts - VAR_3->pts);
if(old_diff < new_diff && old_diff < (VAR_3->duration>>3)){
VAR_3->pts += VAR_3->duration;
}
}
if(VAR_3->pts == AV_NOPTS_VALUE)
VAR_3->pts = VAR_3->dts;
update_initial_timestamps(VAR_0, VAR_3->stream_index, VAR_3->pts, VAR_3->pts);
if(VAR_3->pts == AV_NOPTS_VALUE)
VAR_3->pts = VAR_1->cur_dts;
VAR_3->dts = VAR_3->pts;
if(VAR_3->pts != AV_NOPTS_VALUE)
VAR_1->cur_dts = VAR_3->pts + VAR_3->duration;
}
}
if(VAR_3->pts != AV_NOPTS_VALUE && VAR_7 <= MAX_REORDER_DELAY){
VAR_1->pts_buffer[0]= VAR_3->pts;
for(VAR_8=0; VAR_8<VAR_7 && VAR_1->pts_buffer[VAR_8] > VAR_1->pts_buffer[VAR_8+1]; VAR_8++)
FFSWAP(int64_t, VAR_1->pts_buffer[VAR_8], VAR_1->pts_buffer[VAR_8+1]);
if(VAR_3->dts == AV_NOPTS_VALUE)
VAR_3->dts= VAR_1->pts_buffer[0];
if(VAR_1->codec->codec_id == CODEC_ID_H264){
update_initial_timestamps(VAR_0, VAR_3->stream_index, VAR_3->dts, VAR_3->pts);
}
if(VAR_3->dts > VAR_1->cur_dts)
VAR_1->cur_dts = VAR_3->dts;
}
if(is_intra_only(VAR_1->codec))
VAR_3->flags |= AV_PKT_FLAG_KEY;
else if (VAR_2) {
VAR_3->flags = 0;
if (VAR_2->key_frame == 1)
VAR_3->flags |= AV_PKT_FLAG_KEY;
else if (VAR_2->key_frame == -1 && VAR_2->pict_type == AV_PICTURE_TYPE_I)
VAR_3->flags |= AV_PKT_FLAG_KEY;
}
if (VAR_2)
VAR_3->convergence_duration = VAR_2->convergence_duration;
}
| [
"static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1,\nAVCodecParserContext *VAR_2, AVPacket *VAR_3)\n{",
"int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;",
"int64_t offset;",
"if (VAR_0->flags & AVFMT_FLAG_NOFILLIN)\nreturn;",
"if((VAR_0->flags & AVFMT_FLAG_IGNDTS) && VAR_3->pts != AV_NOPTS_VALUE)\nVAR_3->dts= AV_NOPTS_VALUE;",
"if (VAR_1->codec->codec_id != CODEC_ID_H264 && VAR_2 && VAR_2->pict_type == AV_PICTURE_TYPE_B)\nVAR_1->codec->has_b_frames = 1;",
"VAR_7= VAR_1->codec->has_b_frames;",
"VAR_6 = 0;",
"if (VAR_7 && VAR_1->codec->active_thread_type&FF_THREAD_FRAME)\nVAR_7 -= VAR_1->codec->thread_count-1;",
"if (VAR_7 &&\nVAR_2 && VAR_2->pict_type != AV_PICTURE_TYPE_B)\nVAR_6 = 1;",
"if(VAR_3->pts != AV_NOPTS_VALUE && VAR_3->dts != AV_NOPTS_VALUE && VAR_3->dts - (1LL<<(VAR_1->pts_wrap_bits-1)) > VAR_3->pts && VAR_1->pts_wrap_bits<63){",
"VAR_3->dts -= 1LL<<VAR_1->pts_wrap_bits;",
"}",
"if(VAR_7==1 && VAR_3->dts == VAR_3->pts && VAR_3->dts != AV_NOPTS_VALUE && VAR_6){",
"av_log(VAR_0, AV_LOG_DEBUG, \"invalid dts/pts combination %\"PRIi64\"\\n\", VAR_3->dts);",
"VAR_3->dts= VAR_3->pts= AV_NOPTS_VALUE;",
"}",
"if (VAR_3->duration == 0) {",
"compute_frame_duration(&VAR_4, &VAR_5, VAR_1, VAR_2, VAR_3);",
"if (VAR_5 && VAR_4) {",
"VAR_3->duration = av_rescale_rnd(1, VAR_4 * (int64_t)VAR_1->time_base.VAR_5, VAR_5 * (int64_t)VAR_1->time_base.VAR_4, AV_ROUND_DOWN);",
"if(VAR_3->duration != 0 && VAR_0->packet_buffer)\nupdate_initial_durations(VAR_0, VAR_1, VAR_3);",
"}",
"}",
"if(VAR_2 && VAR_1->need_parsing == AVSTREAM_PARSE_TIMESTAMPS && VAR_3->size){",
"offset = av_rescale(VAR_2->offset, VAR_3->duration, VAR_3->size);",
"if(VAR_3->pts != AV_NOPTS_VALUE)\nVAR_3->pts += offset;",
"if(VAR_3->dts != AV_NOPTS_VALUE)\nVAR_3->dts += offset;",
"}",
"if (VAR_2 && VAR_2->dts_sync_point >= 0) {",
"int64_t VAR_5 = VAR_1->codec->time_base.VAR_5 * (int64_t) VAR_1->time_base.VAR_4;",
"if (VAR_5 > 0) {",
"int64_t VAR_4 = VAR_1->codec->time_base.VAR_4 * (int64_t) VAR_1->time_base.VAR_5;",
"if (VAR_3->dts != AV_NOPTS_VALUE) {",
"VAR_1->reference_dts = VAR_3->dts - VAR_2->dts_ref_dts_delta * VAR_4 / VAR_5;",
"VAR_3->pts = VAR_3->dts + VAR_2->pts_dts_delta * VAR_4 / VAR_5;",
"} else if (VAR_1->reference_dts != AV_NOPTS_VALUE) {",
"VAR_3->dts = VAR_1->reference_dts + VAR_2->dts_ref_dts_delta * VAR_4 / VAR_5;",
"VAR_3->pts = VAR_3->dts + VAR_2->pts_dts_delta * VAR_4 / VAR_5;",
"}",
"if (VAR_2->dts_sync_point > 0)\nVAR_1->reference_dts = VAR_3->dts;",
"}",
"}",
"if(VAR_3->dts != AV_NOPTS_VALUE && VAR_3->pts != AV_NOPTS_VALUE && VAR_3->pts > VAR_3->dts)\nVAR_6 = 1;",
"if((VAR_7==0 || (VAR_7==1 && VAR_2)) && VAR_1->codec->codec_id != CODEC_ID_H264){",
"if (VAR_6) {",
"if (VAR_3->dts == AV_NOPTS_VALUE)\nVAR_3->dts = VAR_1->last_IP_pts;",
"update_initial_timestamps(VAR_0, VAR_3->stream_index, VAR_3->dts, VAR_3->pts);",
"if (VAR_3->dts == AV_NOPTS_VALUE)\nVAR_3->dts = VAR_1->cur_dts;",
"if (VAR_1->last_IP_duration == 0)\nVAR_1->last_IP_duration = VAR_3->duration;",
"if(VAR_3->dts != AV_NOPTS_VALUE)\nVAR_1->cur_dts = VAR_3->dts + VAR_1->last_IP_duration;",
"VAR_1->last_IP_duration = VAR_3->duration;",
"VAR_1->last_IP_pts= VAR_3->pts;",
"} else if(VAR_3->pts != AV_NOPTS_VALUE || VAR_3->dts != AV_NOPTS_VALUE || VAR_3->duration){",
"if(VAR_3->pts != AV_NOPTS_VALUE && VAR_3->duration){",
"int64_t old_diff= FFABS(VAR_1->cur_dts - VAR_3->duration - VAR_3->pts);",
"int64_t new_diff= FFABS(VAR_1->cur_dts - VAR_3->pts);",
"if(old_diff < new_diff && old_diff < (VAR_3->duration>>3)){",
"VAR_3->pts += VAR_3->duration;",
"}",
"}",
"if(VAR_3->pts == AV_NOPTS_VALUE)\nVAR_3->pts = VAR_3->dts;",
"update_initial_timestamps(VAR_0, VAR_3->stream_index, VAR_3->pts, VAR_3->pts);",
"if(VAR_3->pts == AV_NOPTS_VALUE)\nVAR_3->pts = VAR_1->cur_dts;",
"VAR_3->dts = VAR_3->pts;",
"if(VAR_3->pts != AV_NOPTS_VALUE)\nVAR_1->cur_dts = VAR_3->pts + VAR_3->duration;",
"}",
"}",
"if(VAR_3->pts != AV_NOPTS_VALUE && VAR_7 <= MAX_REORDER_DELAY){",
"VAR_1->pts_buffer[0]= VAR_3->pts;",
"for(VAR_8=0; VAR_8<VAR_7 && VAR_1->pts_buffer[VAR_8] > VAR_1->pts_buffer[VAR_8+1]; VAR_8++)",
"FFSWAP(int64_t, VAR_1->pts_buffer[VAR_8], VAR_1->pts_buffer[VAR_8+1]);",
"if(VAR_3->dts == AV_NOPTS_VALUE)\nVAR_3->dts= VAR_1->pts_buffer[0];",
"if(VAR_1->codec->codec_id == CODEC_ID_H264){",
"update_initial_timestamps(VAR_0, VAR_3->stream_index, VAR_3->dts, VAR_3->pts);",
"}",
"if(VAR_3->dts > VAR_1->cur_dts)\nVAR_1->cur_dts = VAR_3->dts;",
"}",
"if(is_intra_only(VAR_1->codec))\nVAR_3->flags |= AV_PKT_FLAG_KEY;",
"else if (VAR_2) {",
"VAR_3->flags = 0;",
"if (VAR_2->key_frame == 1)\nVAR_3->flags |= AV_PKT_FLAG_KEY;",
"else if (VAR_2->key_frame == -1 && VAR_2->pict_type == AV_PICTURE_TYPE_I)\nVAR_3->flags |= AV_PKT_FLAG_KEY;",
"}",
"if (VAR_2)\nVAR_3->convergence_duration = VAR_2->convergence_duration;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
13,
15
],
[
19,
21
],
[
25,
29
],
[
35
],
[
37
],
[
45,
47
],
[
55,
57,
59
],
[
63
],
[
65
],
[
67
],
[
77
],
[
79
],
[
81
],
[
83
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97,
99
],
[
101
],
[
103
],
[
111
],
[
115
],
[
117,
119
],
[
121,
123
],
[
125
],
[
129
],
[
133
],
[
135
],
[
137
],
[
139
],
[
143
],
[
145
],
[
147
],
[
151
],
[
153
],
[
155
],
[
157,
159
],
[
161
],
[
163
],
[
169,
171
],
[
181
],
[
183
],
[
189,
191
],
[
193
],
[
195,
197
],
[
205,
207
],
[
209,
211
],
[
213
],
[
215
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231
],
[
235
],
[
237
],
[
243,
245
],
[
247
],
[
249,
251
],
[
253
],
[
255,
257
],
[
259
],
[
261
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273,
275
],
[
277
],
[
279
],
[
281
],
[
283,
285
],
[
287
],
[
297,
299
],
[
301
],
[
303
],
[
307,
309
],
[
311,
313
],
[
315
],
[
317,
319
],
[
321
]
]
|
15,604 | static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
{
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
ShowWavesContext *showwaves = ctx->priv;
const int nb_samples = insamples->audio->nb_samples;
AVFilterBufferRef *outpicref = showwaves->outpicref;
int linesize = outpicref ? outpicref->linesize[0] : 0;
int16_t *p = (int16_t *)insamples->data[0];
int nb_channels = av_get_channel_layout_nb_channels(insamples->audio->channel_layout);
int i, j, h;
const int n = showwaves->n;
const int x = 255 / (nb_channels * n); /* multiplication factor, pre-computed to avoid in-loop divisions */
/* draw data in the buffer */
for (i = 0; i < nb_samples; i++) {
if (showwaves->buf_idx == 0 && showwaves->sample_count_mod == 0) {
showwaves->outpicref = outpicref =
ff_get_video_buffer(outlink, AV_PERM_WRITE|AV_PERM_ALIGN,
outlink->w, outlink->h);
outpicref->video->w = outlink->w;
outpicref->video->h = outlink->h;
outpicref->pts = insamples->pts +
av_rescale_q((p - (int16_t *)insamples->data[0]) / nb_channels,
(AVRational){ 1, inlink->sample_rate },
outlink->time_base);
linesize = outpicref->linesize[0];
memset(outpicref->data[0], 0, showwaves->h*linesize);
}
for (j = 0; j < nb_channels; j++) {
h = showwaves->h/2 - av_rescale(*p++, showwaves->h/2, MAX_INT16);
if (h >= 0 && h < outlink->h)
*(outpicref->data[0] + showwaves->buf_idx + h * linesize) += x;
}
showwaves->sample_count_mod++;
if (showwaves->sample_count_mod == n) {
showwaves->sample_count_mod = 0;
showwaves->buf_idx++;
}
if (showwaves->buf_idx == showwaves->w)
push_frame(outlink);
}
avfilter_unref_buffer(insamples);
return 0;
}
| false | FFmpeg | 5f634480d1c4ed7711a15d1be07e49177cf351c1 | static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
{
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
ShowWavesContext *showwaves = ctx->priv;
const int nb_samples = insamples->audio->nb_samples;
AVFilterBufferRef *outpicref = showwaves->outpicref;
int linesize = outpicref ? outpicref->linesize[0] : 0;
int16_t *p = (int16_t *)insamples->data[0];
int nb_channels = av_get_channel_layout_nb_channels(insamples->audio->channel_layout);
int i, j, h;
const int n = showwaves->n;
const int x = 255 / (nb_channels * n);
for (i = 0; i < nb_samples; i++) {
if (showwaves->buf_idx == 0 && showwaves->sample_count_mod == 0) {
showwaves->outpicref = outpicref =
ff_get_video_buffer(outlink, AV_PERM_WRITE|AV_PERM_ALIGN,
outlink->w, outlink->h);
outpicref->video->w = outlink->w;
outpicref->video->h = outlink->h;
outpicref->pts = insamples->pts +
av_rescale_q((p - (int16_t *)insamples->data[0]) / nb_channels,
(AVRational){ 1, inlink->sample_rate },
outlink->time_base);
linesize = outpicref->linesize[0];
memset(outpicref->data[0], 0, showwaves->h*linesize);
}
for (j = 0; j < nb_channels; j++) {
h = showwaves->h/2 - av_rescale(*p++, showwaves->h/2, MAX_INT16);
if (h >= 0 && h < outlink->h)
*(outpicref->data[0] + showwaves->buf_idx + h * linesize) += x;
}
showwaves->sample_count_mod++;
if (showwaves->sample_count_mod == n) {
showwaves->sample_count_mod = 0;
showwaves->buf_idx++;
}
if (showwaves->buf_idx == showwaves->w)
push_frame(outlink);
}
avfilter_unref_buffer(insamples);
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1)
{
AVFilterContext *ctx = VAR_0->dst;
AVFilterLink *outlink = ctx->outputs[0];
ShowWavesContext *showwaves = ctx->priv;
const int VAR_2 = VAR_1->audio->VAR_2;
AVFilterBufferRef *outpicref = showwaves->outpicref;
int VAR_3 = outpicref ? outpicref->VAR_3[0] : 0;
int16_t *p = (int16_t *)VAR_1->data[0];
int VAR_4 = av_get_channel_layout_nb_channels(VAR_1->audio->channel_layout);
int VAR_5, VAR_6, VAR_7;
const int VAR_8 = showwaves->VAR_8;
const int VAR_9 = 255 / (VAR_4 * VAR_8);
for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) {
if (showwaves->buf_idx == 0 && showwaves->sample_count_mod == 0) {
showwaves->outpicref = outpicref =
ff_get_video_buffer(outlink, AV_PERM_WRITE|AV_PERM_ALIGN,
outlink->w, outlink->VAR_7);
outpicref->video->w = outlink->w;
outpicref->video->VAR_7 = outlink->VAR_7;
outpicref->pts = VAR_1->pts +
av_rescale_q((p - (int16_t *)VAR_1->data[0]) / VAR_4,
(AVRational){ 1, VAR_0->sample_rate },
outlink->time_base);
VAR_3 = outpicref->VAR_3[0];
memset(outpicref->data[0], 0, showwaves->VAR_7*VAR_3);
}
for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) {
VAR_7 = showwaves->VAR_7/2 - av_rescale(*p++, showwaves->VAR_7/2, MAX_INT16);
if (VAR_7 >= 0 && VAR_7 < outlink->VAR_7)
*(outpicref->data[0] + showwaves->buf_idx + VAR_7 * VAR_3) += VAR_9;
}
showwaves->sample_count_mod++;
if (showwaves->sample_count_mod == VAR_8) {
showwaves->sample_count_mod = 0;
showwaves->buf_idx++;
}
if (showwaves->buf_idx == showwaves->w)
push_frame(outlink);
}
avfilter_unref_buffer(VAR_1);
return 0;
}
| [
"static int FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1)\n{",
"AVFilterContext *ctx = VAR_0->dst;",
"AVFilterLink *outlink = ctx->outputs[0];",
"ShowWavesContext *showwaves = ctx->priv;",
"const int VAR_2 = VAR_1->audio->VAR_2;",
"AVFilterBufferRef *outpicref = showwaves->outpicref;",
"int VAR_3 = outpicref ? outpicref->VAR_3[0] : 0;",
"int16_t *p = (int16_t *)VAR_1->data[0];",
"int VAR_4 = av_get_channel_layout_nb_channels(VAR_1->audio->channel_layout);",
"int VAR_5, VAR_6, VAR_7;",
"const int VAR_8 = showwaves->VAR_8;",
"const int VAR_9 = 255 / (VAR_4 * VAR_8);",
"for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) {",
"if (showwaves->buf_idx == 0 && showwaves->sample_count_mod == 0) {",
"showwaves->outpicref = outpicref =\nff_get_video_buffer(outlink, AV_PERM_WRITE|AV_PERM_ALIGN,\noutlink->w, outlink->VAR_7);",
"outpicref->video->w = outlink->w;",
"outpicref->video->VAR_7 = outlink->VAR_7;",
"outpicref->pts = VAR_1->pts +\nav_rescale_q((p - (int16_t *)VAR_1->data[0]) / VAR_4,\n(AVRational){ 1, VAR_0->sample_rate },",
"outlink->time_base);",
"VAR_3 = outpicref->VAR_3[0];",
"memset(outpicref->data[0], 0, showwaves->VAR_7*VAR_3);",
"}",
"for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) {",
"VAR_7 = showwaves->VAR_7/2 - av_rescale(*p++, showwaves->VAR_7/2, MAX_INT16);",
"if (VAR_7 >= 0 && VAR_7 < outlink->VAR_7)\n*(outpicref->data[0] + showwaves->buf_idx + VAR_7 * VAR_3) += VAR_9;",
"}",
"showwaves->sample_count_mod++;",
"if (showwaves->sample_count_mod == VAR_8) {",
"showwaves->sample_count_mod = 0;",
"showwaves->buf_idx++;",
"}",
"if (showwaves->buf_idx == showwaves->w)\npush_frame(outlink);",
"}",
"avfilter_unref_buffer(VAR_1);",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
31
],
[
33
],
[
35,
37,
39
],
[
41
],
[
43
],
[
45,
47,
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63,
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79,
81
],
[
83
],
[
87
],
[
89
],
[
91
]
]
|
15,605 | static inline void quantize_coefs(double *coef, int *idx, float *lpc, int order,
int c_bits)
{
int i;
const float *quant_arr = tns_tmp2_map[c_bits];
for (i = 0; i < order; i++) {
idx[i] = quant_array_idx((float)coef[i], quant_arr, c_bits ? 16 : 8);
lpc[i] = quant_arr[idx[i]];
}
}
| false | FFmpeg | d55f83de4d419d22d2fd2c0b9ff4ce6bf93847d6 | static inline void quantize_coefs(double *coef, int *idx, float *lpc, int order,
int c_bits)
{
int i;
const float *quant_arr = tns_tmp2_map[c_bits];
for (i = 0; i < order; i++) {
idx[i] = quant_array_idx((float)coef[i], quant_arr, c_bits ? 16 : 8);
lpc[i] = quant_arr[idx[i]];
}
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(double *VAR_0, int *VAR_1, float *VAR_2, int VAR_3,
int VAR_4)
{
int VAR_5;
const float *VAR_6 = tns_tmp2_map[VAR_4];
for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5++) {
VAR_1[VAR_5] = quant_array_idx((float)VAR_0[VAR_5], VAR_6, VAR_4 ? 16 : 8);
VAR_2[VAR_5] = VAR_6[VAR_1[VAR_5]];
}
}
| [
"static inline void FUNC_0(double *VAR_0, int *VAR_1, float *VAR_2, int VAR_3,\nint VAR_4)\n{",
"int VAR_5;",
"const float *VAR_6 = tns_tmp2_map[VAR_4];",
"for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5++) {",
"VAR_1[VAR_5] = quant_array_idx((float)VAR_0[VAR_5], VAR_6, VAR_4 ? 16 : 8);",
"VAR_2[VAR_5] = VAR_6[VAR_1[VAR_5]];",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
]
]
|
15,606 | static void scsi_block_class_initfn(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(klass);
sc->realize = scsi_block_realize;
sc->unrealize = scsi_unrealize;
sc->alloc_req = scsi_block_new_request;
sc->parse_cdb = scsi_block_parse_cdb;
dc->fw_name = "disk";
dc->desc = "SCSI block device passthrough";
dc->reset = scsi_disk_reset;
dc->props = scsi_block_properties;
dc->vmsd = &vmstate_scsi_disk_state;
}
| false | qemu | fb7b5c0df6e3c501973ce4d57eb2b1d4344a519d | static void scsi_block_class_initfn(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(klass);
sc->realize = scsi_block_realize;
sc->unrealize = scsi_unrealize;
sc->alloc_req = scsi_block_new_request;
sc->parse_cdb = scsi_block_parse_cdb;
dc->fw_name = "disk";
dc->desc = "SCSI block device passthrough";
dc->reset = scsi_disk_reset;
dc->props = scsi_block_properties;
dc->vmsd = &vmstate_scsi_disk_state;
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)
{
DeviceClass *dc = DEVICE_CLASS(VAR_0);
SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(VAR_0);
sc->realize = scsi_block_realize;
sc->unrealize = scsi_unrealize;
sc->alloc_req = scsi_block_new_request;
sc->parse_cdb = scsi_block_parse_cdb;
dc->fw_name = "disk";
dc->desc = "SCSI block device passthrough";
dc->reset = scsi_disk_reset;
dc->props = scsi_block_properties;
dc->vmsd = &vmstate_scsi_disk_state;
}
| [
"static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{",
"DeviceClass *dc = DEVICE_CLASS(VAR_0);",
"SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(VAR_0);",
"sc->realize = scsi_block_realize;",
"sc->unrealize = scsi_unrealize;",
"sc->alloc_req = scsi_block_new_request;",
"sc->parse_cdb = scsi_block_parse_cdb;",
"dc->fw_name = \"disk\";",
"dc->desc = \"SCSI block device passthrough\";",
"dc->reset = scsi_disk_reset;",
"dc->props = scsi_block_properties;",
"dc->vmsd = &vmstate_scsi_disk_state;",
"}"
]
| [
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
]
]
|
15,607 | static inline target_phys_addr_t get_pgaddr(target_phys_addr_t sdr1,
int sdr_sh,
target_phys_addr_t hash,
target_phys_addr_t mask)
{
return (sdr1 & ((target_phys_addr_t)(-1ULL) << sdr_sh)) | (hash & mask);
}
| false | qemu | bb593904c18e22ea0671dfa1b02e24982f2bf0ea | static inline target_phys_addr_t get_pgaddr(target_phys_addr_t sdr1,
int sdr_sh,
target_phys_addr_t hash,
target_phys_addr_t mask)
{
return (sdr1 & ((target_phys_addr_t)(-1ULL) << sdr_sh)) | (hash & mask);
}
| {
"code": [],
"line_no": []
} | static inline target_phys_addr_t FUNC_0(target_phys_addr_t sdr1,
int sdr_sh,
target_phys_addr_t hash,
target_phys_addr_t mask)
{
return (sdr1 & ((target_phys_addr_t)(-1ULL) << sdr_sh)) | (hash & mask);
}
| [
"static inline target_phys_addr_t FUNC_0(target_phys_addr_t sdr1,\nint sdr_sh,\ntarget_phys_addr_t hash,\ntarget_phys_addr_t mask)\n{",
"return (sdr1 & ((target_phys_addr_t)(-1ULL) << sdr_sh)) | (hash & mask);",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3,
5,
7,
9
],
[
11
],
[
13
]
]
|
15,608 | int vhdx_parse_log(BlockDriverState *bs, BDRVVHDXState *s, bool *flushed,
Error **errp)
{
int ret = 0;
VHDXHeader *hdr;
VHDXLogSequence logs = { 0 };
hdr = s->headers[s->curr_header];
*flushed = false;
/* s->log.hdr is freed in vhdx_close() */
if (s->log.hdr == NULL) {
s->log.hdr = qemu_blockalign(bs, sizeof(VHDXLogEntryHeader));
}
s->log.offset = hdr->log_offset;
s->log.length = hdr->log_length;
if (s->log.offset < VHDX_LOG_MIN_SIZE ||
s->log.offset % VHDX_LOG_MIN_SIZE) {
ret = -EINVAL;
goto exit;
}
/* per spec, only log version of 0 is supported */
if (hdr->log_version != 0) {
ret = -EINVAL;
goto exit;
}
/* If either the log guid, or log length is zero,
* then a replay log is not present */
if (guid_eq(hdr->log_guid, zero_guid)) {
goto exit;
}
if (hdr->log_length == 0) {
goto exit;
}
if (hdr->log_length % VHDX_LOG_MIN_SIZE) {
ret = -EINVAL;
goto exit;
}
/* The log is present, we need to find if and where there is an active
* sequence of valid entries present in the log. */
ret = vhdx_log_search(bs, s, &logs);
if (ret < 0) {
goto exit;
}
if (logs.valid) {
if (bs->read_only) {
ret = -EPERM;
error_setg_errno(errp, EPERM,
"VHDX image file '%s' opened read-only, but "
"contains a log that needs to be replayed. To "
"replay the log, execute:\n qemu-img check -r "
"all '%s'",
bs->filename, bs->filename);
goto exit;
}
/* now flush the log */
ret = vhdx_log_flush(bs, s, &logs);
if (ret < 0) {
goto exit;
}
*flushed = true;
}
exit:
return ret;
}
| false | qemu | bf89e87427fb99b994eb0dfb710bb4b45785f733 | int vhdx_parse_log(BlockDriverState *bs, BDRVVHDXState *s, bool *flushed,
Error **errp)
{
int ret = 0;
VHDXHeader *hdr;
VHDXLogSequence logs = { 0 };
hdr = s->headers[s->curr_header];
*flushed = false;
if (s->log.hdr == NULL) {
s->log.hdr = qemu_blockalign(bs, sizeof(VHDXLogEntryHeader));
}
s->log.offset = hdr->log_offset;
s->log.length = hdr->log_length;
if (s->log.offset < VHDX_LOG_MIN_SIZE ||
s->log.offset % VHDX_LOG_MIN_SIZE) {
ret = -EINVAL;
goto exit;
}
if (hdr->log_version != 0) {
ret = -EINVAL;
goto exit;
}
if (guid_eq(hdr->log_guid, zero_guid)) {
goto exit;
}
if (hdr->log_length == 0) {
goto exit;
}
if (hdr->log_length % VHDX_LOG_MIN_SIZE) {
ret = -EINVAL;
goto exit;
}
ret = vhdx_log_search(bs, s, &logs);
if (ret < 0) {
goto exit;
}
if (logs.valid) {
if (bs->read_only) {
ret = -EPERM;
error_setg_errno(errp, EPERM,
"VHDX image file '%s' opened read-only, but "
"contains a log that needs to be replayed. To "
"replay the log, execute:\n qemu-img check -r "
"all '%s'",
bs->filename, bs->filename);
goto exit;
}
ret = vhdx_log_flush(bs, s, &logs);
if (ret < 0) {
goto exit;
}
*flushed = true;
}
exit:
return ret;
}
| {
"code": [],
"line_no": []
} | int FUNC_0(BlockDriverState *VAR_0, BDRVVHDXState *VAR_1, bool *VAR_2,
Error **VAR_3)
{
int VAR_4 = 0;
VHDXHeader *hdr;
VHDXLogSequence logs = { 0 };
hdr = VAR_1->headers[VAR_1->curr_header];
*VAR_2 = false;
if (VAR_1->log.hdr == NULL) {
VAR_1->log.hdr = qemu_blockalign(VAR_0, sizeof(VHDXLogEntryHeader));
}
VAR_1->log.offset = hdr->log_offset;
VAR_1->log.length = hdr->log_length;
if (VAR_1->log.offset < VHDX_LOG_MIN_SIZE ||
VAR_1->log.offset % VHDX_LOG_MIN_SIZE) {
VAR_4 = -EINVAL;
goto exit;
}
if (hdr->log_version != 0) {
VAR_4 = -EINVAL;
goto exit;
}
if (guid_eq(hdr->log_guid, zero_guid)) {
goto exit;
}
if (hdr->log_length == 0) {
goto exit;
}
if (hdr->log_length % VHDX_LOG_MIN_SIZE) {
VAR_4 = -EINVAL;
goto exit;
}
VAR_4 = vhdx_log_search(VAR_0, VAR_1, &logs);
if (VAR_4 < 0) {
goto exit;
}
if (logs.valid) {
if (VAR_0->read_only) {
VAR_4 = -EPERM;
error_setg_errno(VAR_3, EPERM,
"VHDX image file '%VAR_1' opened read-only, but "
"contains a log that needs to be replayed. To "
"replay the log, execute:\n qemu-img check -r "
"all '%VAR_1'",
VAR_0->filename, VAR_0->filename);
goto exit;
}
VAR_4 = vhdx_log_flush(VAR_0, VAR_1, &logs);
if (VAR_4 < 0) {
goto exit;
}
*VAR_2 = true;
}
exit:
return VAR_4;
}
| [
"int FUNC_0(BlockDriverState *VAR_0, BDRVVHDXState *VAR_1, bool *VAR_2,\nError **VAR_3)\n{",
"int VAR_4 = 0;",
"VHDXHeader *hdr;",
"VHDXLogSequence logs = { 0 };",
"hdr = VAR_1->headers[VAR_1->curr_header];",
"*VAR_2 = false;",
"if (VAR_1->log.hdr == NULL) {",
"VAR_1->log.hdr = qemu_blockalign(VAR_0, sizeof(VHDXLogEntryHeader));",
"}",
"VAR_1->log.offset = hdr->log_offset;",
"VAR_1->log.length = hdr->log_length;",
"if (VAR_1->log.offset < VHDX_LOG_MIN_SIZE ||\nVAR_1->log.offset % VHDX_LOG_MIN_SIZE) {",
"VAR_4 = -EINVAL;",
"goto exit;",
"}",
"if (hdr->log_version != 0) {",
"VAR_4 = -EINVAL;",
"goto exit;",
"}",
"if (guid_eq(hdr->log_guid, zero_guid)) {",
"goto exit;",
"}",
"if (hdr->log_length == 0) {",
"goto exit;",
"}",
"if (hdr->log_length % VHDX_LOG_MIN_SIZE) {",
"VAR_4 = -EINVAL;",
"goto exit;",
"}",
"VAR_4 = vhdx_log_search(VAR_0, VAR_1, &logs);",
"if (VAR_4 < 0) {",
"goto exit;",
"}",
"if (logs.valid) {",
"if (VAR_0->read_only) {",
"VAR_4 = -EPERM;",
"error_setg_errno(VAR_3, EPERM,\n\"VHDX image file '%VAR_1' opened read-only, but \"\n\"contains a log that needs to be replayed. To \"\n\"replay the log, execute:\\n qemu-img check -r \"\n\"all '%VAR_1'\",\nVAR_0->filename, VAR_0->filename);",
"goto exit;",
"}",
"VAR_4 = vhdx_log_flush(VAR_0, VAR_1, &logs);",
"if (VAR_4 < 0) {",
"goto exit;",
"}",
"*VAR_2 = true;",
"}",
"exit:\nreturn VAR_4;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
19
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
39,
41
],
[
43
],
[
45
],
[
47
],
[
53
],
[
55
],
[
57
],
[
59
],
[
67
],
[
69
],
[
71
],
[
75
],
[
77
],
[
79
],
[
83
],
[
85
],
[
87
],
[
89
],
[
101
],
[
103
],
[
105
],
[
107
],
[
111
],
[
113
],
[
115
],
[
117,
119,
121,
123,
125,
127
],
[
129
],
[
131
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
151,
153
],
[
155
]
]
|
15,609 | static gboolean fd_trampoline(GIOChannel *chan, GIOCondition cond, gpointer opaque)
{
IOTrampoline *tramp = opaque;
if ((cond & G_IO_IN) && tramp->fd_read) {
tramp->fd_read(tramp->opaque);
}
if ((cond & G_IO_OUT) && tramp->fd_write) {
tramp->fd_write(tramp->opaque);
}
return TRUE;
}
| false | qemu | be08e65e01f1c50fa1552c4f892443cb25bb98e4 | static gboolean fd_trampoline(GIOChannel *chan, GIOCondition cond, gpointer opaque)
{
IOTrampoline *tramp = opaque;
if ((cond & G_IO_IN) && tramp->fd_read) {
tramp->fd_read(tramp->opaque);
}
if ((cond & G_IO_OUT) && tramp->fd_write) {
tramp->fd_write(tramp->opaque);
}
return TRUE;
}
| {
"code": [],
"line_no": []
} | static gboolean FUNC_0(GIOChannel *chan, GIOCondition cond, gpointer opaque)
{
IOTrampoline *tramp = opaque;
if ((cond & G_IO_IN) && tramp->fd_read) {
tramp->fd_read(tramp->opaque);
}
if ((cond & G_IO_OUT) && tramp->fd_write) {
tramp->fd_write(tramp->opaque);
}
return TRUE;
}
| [
"static gboolean FUNC_0(GIOChannel *chan, GIOCondition cond, gpointer opaque)\n{",
"IOTrampoline *tramp = opaque;",
"if ((cond & G_IO_IN) && tramp->fd_read) {",
"tramp->fd_read(tramp->opaque);",
"}",
"if ((cond & G_IO_OUT) && tramp->fd_write) {",
"tramp->fd_write(tramp->opaque);",
"}",
"return TRUE;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
]
]
|
15,610 | static void s390_virtio_serial_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass);
k->init = s390_virtio_serial_init;
dc->props = s390_virtio_serial_properties;
dc->alias = "virtio-serial";
}
| false | qemu | 6acbe4c6f18e7de00481ff30574262b58526de45 | static void s390_virtio_serial_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass);
k->init = s390_virtio_serial_init;
dc->props = s390_virtio_serial_properties;
dc->alias = "virtio-serial";
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)
{
DeviceClass *dc = DEVICE_CLASS(VAR_0);
VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(VAR_0);
k->init = s390_virtio_serial_init;
dc->props = s390_virtio_serial_properties;
dc->alias = "virtio-serial";
}
| [
"static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{",
"DeviceClass *dc = DEVICE_CLASS(VAR_0);",
"VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(VAR_0);",
"k->init = s390_virtio_serial_init;",
"dc->props = s390_virtio_serial_properties;",
"dc->alias = \"virtio-serial\";",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
]
]
|
15,611 | static uint64_t get_fourcc(AVIOContext *bc)
{
unsigned int len = ffio_read_varlen(bc);
if (len == 2)
return avio_rl16(bc);
else if (len == 4)
return avio_rl32(bc);
else
return -1;
}
| false | FFmpeg | 7ccc0ed6a0cedbe80443779a805ec90335cd832f | static uint64_t get_fourcc(AVIOContext *bc)
{
unsigned int len = ffio_read_varlen(bc);
if (len == 2)
return avio_rl16(bc);
else if (len == 4)
return avio_rl32(bc);
else
return -1;
}
| {
"code": [],
"line_no": []
} | static uint64_t FUNC_0(AVIOContext *bc)
{
unsigned int VAR_0 = ffio_read_varlen(bc);
if (VAR_0 == 2)
return avio_rl16(bc);
else if (VAR_0 == 4)
return avio_rl32(bc);
else
return -1;
}
| [
"static uint64_t FUNC_0(AVIOContext *bc)\n{",
"unsigned int VAR_0 = ffio_read_varlen(bc);",
"if (VAR_0 == 2)\nreturn avio_rl16(bc);",
"else if (VAR_0 == 4)\nreturn avio_rl32(bc);",
"else\nreturn -1;",
"}"
]
| [
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9,
11
],
[
13,
15
],
[
17,
19
],
[
21
]
]
|
15,613 | void qemu_chr_be_generic_open(CharDriverState *s)
{
if (s->idle_tag == 0) {
s->idle_tag = g_idle_add(qemu_chr_be_generic_open_bh, s);
}
}
| false | qemu | bd5c51ee6c4f1c79cae5ad2516d711a27b4ea8ec | void qemu_chr_be_generic_open(CharDriverState *s)
{
if (s->idle_tag == 0) {
s->idle_tag = g_idle_add(qemu_chr_be_generic_open_bh, s);
}
}
| {
"code": [],
"line_no": []
} | void FUNC_0(CharDriverState *VAR_0)
{
if (VAR_0->idle_tag == 0) {
VAR_0->idle_tag = g_idle_add(qemu_chr_be_generic_open_bh, VAR_0);
}
}
| [
"void FUNC_0(CharDriverState *VAR_0)\n{",
"if (VAR_0->idle_tag == 0) {",
"VAR_0->idle_tag = g_idle_add(qemu_chr_be_generic_open_bh, VAR_0);",
"}",
"}"
]
| [
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
]
]
|
15,614 | static void write_fp_dreg(DisasContext *s, int reg, TCGv_i64 v)
{
TCGv_i64 tcg_zero = tcg_const_i64(0);
tcg_gen_st_i64(v, cpu_env, fp_reg_offset(reg, MO_64));
tcg_gen_st_i64(tcg_zero, cpu_env, fp_reg_hi_offset(reg));
tcg_temp_free_i64(tcg_zero);
}
| false | qemu | 90e496386fe7fd32c189561f846b7913f95b8cf4 | static void write_fp_dreg(DisasContext *s, int reg, TCGv_i64 v)
{
TCGv_i64 tcg_zero = tcg_const_i64(0);
tcg_gen_st_i64(v, cpu_env, fp_reg_offset(reg, MO_64));
tcg_gen_st_i64(tcg_zero, cpu_env, fp_reg_hi_offset(reg));
tcg_temp_free_i64(tcg_zero);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(DisasContext *VAR_0, int VAR_1, TCGv_i64 VAR_2)
{
TCGv_i64 tcg_zero = tcg_const_i64(0);
tcg_gen_st_i64(VAR_2, cpu_env, fp_reg_offset(VAR_1, MO_64));
tcg_gen_st_i64(tcg_zero, cpu_env, fp_reg_hi_offset(VAR_1));
tcg_temp_free_i64(tcg_zero);
}
| [
"static void FUNC_0(DisasContext *VAR_0, int VAR_1, TCGv_i64 VAR_2)\n{",
"TCGv_i64 tcg_zero = tcg_const_i64(0);",
"tcg_gen_st_i64(VAR_2, cpu_env, fp_reg_offset(VAR_1, MO_64));",
"tcg_gen_st_i64(tcg_zero, cpu_env, fp_reg_hi_offset(VAR_1));",
"tcg_temp_free_i64(tcg_zero);",
"}"
]
| [
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
]
]
|
15,616 | static int ac3_probe(AVProbeData *p)
{
int max_frames, first_frames = 0, frames;
uint8_t *buf, *buf2, *end;
AC3HeaderInfo hdr;
if(p->buf_size < 7)
return 0;
max_frames = 0;
buf = p->buf;
end = buf + p->buf_size;
for(; buf < end; buf++) {
buf2 = buf;
for(frames = 0; buf2 < end; frames++) {
if(ff_ac3_parse_header(buf2, &hdr) < 0)
break;
buf2 += hdr.frame_size;
}
max_frames = FFMAX(max_frames, frames);
if(buf == p->buf)
first_frames = frames;
}
if (first_frames>=3) return AVPROBE_SCORE_MAX * 3 / 4;
else if(max_frames>=3) return AVPROBE_SCORE_MAX / 2;
else if(max_frames>=1) return 1;
else return 0;
}
| false | FFmpeg | d1a4544de904cc76fea32d9d22252152ebb18edb | static int ac3_probe(AVProbeData *p)
{
int max_frames, first_frames = 0, frames;
uint8_t *buf, *buf2, *end;
AC3HeaderInfo hdr;
if(p->buf_size < 7)
return 0;
max_frames = 0;
buf = p->buf;
end = buf + p->buf_size;
for(; buf < end; buf++) {
buf2 = buf;
for(frames = 0; buf2 < end; frames++) {
if(ff_ac3_parse_header(buf2, &hdr) < 0)
break;
buf2 += hdr.frame_size;
}
max_frames = FFMAX(max_frames, frames);
if(buf == p->buf)
first_frames = frames;
}
if (first_frames>=3) return AVPROBE_SCORE_MAX * 3 / 4;
else if(max_frames>=3) return AVPROBE_SCORE_MAX / 2;
else if(max_frames>=1) return 1;
else return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVProbeData *VAR_0)
{
int VAR_1, VAR_2 = 0, VAR_3;
uint8_t *buf, *buf2, *end;
AC3HeaderInfo hdr;
if(VAR_0->buf_size < 7)
return 0;
VAR_1 = 0;
buf = VAR_0->buf;
end = buf + VAR_0->buf_size;
for(; buf < end; buf++) {
buf2 = buf;
for(VAR_3 = 0; buf2 < end; VAR_3++) {
if(ff_ac3_parse_header(buf2, &hdr) < 0)
break;
buf2 += hdr.frame_size;
}
VAR_1 = FFMAX(VAR_1, VAR_3);
if(buf == VAR_0->buf)
VAR_2 = VAR_3;
}
if (VAR_2>=3) return AVPROBE_SCORE_MAX * 3 / 4;
else if(VAR_1>=3) return AVPROBE_SCORE_MAX / 2;
else if(VAR_1>=1) return 1;
else return 0;
}
| [
"static int FUNC_0(AVProbeData *VAR_0)\n{",
"int VAR_1, VAR_2 = 0, VAR_3;",
"uint8_t *buf, *buf2, *end;",
"AC3HeaderInfo hdr;",
"if(VAR_0->buf_size < 7)\nreturn 0;",
"VAR_1 = 0;",
"buf = VAR_0->buf;",
"end = buf + VAR_0->buf_size;",
"for(; buf < end; buf++) {",
"buf2 = buf;",
"for(VAR_3 = 0; buf2 < end; VAR_3++) {",
"if(ff_ac3_parse_header(buf2, &hdr) < 0)\nbreak;",
"buf2 += hdr.frame_size;",
"}",
"VAR_1 = FFMAX(VAR_1, VAR_3);",
"if(buf == VAR_0->buf)\nVAR_2 = VAR_3;",
"}",
"if (VAR_2>=3) return AVPROBE_SCORE_MAX * 3 / 4;",
"else if(VAR_1>=3) return AVPROBE_SCORE_MAX / 2;",
"else if(VAR_1>=1) return 1;",
"else return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13,
15
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
33
],
[
35,
37
],
[
39
],
[
41
],
[
43
],
[
45,
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
]
]
|
15,617 | int init_put_byte(ByteIOContext *s,
unsigned char *buffer,
int buffer_size,
int write_flag,
void *opaque,
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
void (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*seek)(void *opaque, offset_t offset, int whence))
{
s->buffer = buffer;
s->buffer_size = buffer_size;
s->buf_ptr = buffer;
s->write_flag = write_flag;
if (!s->write_flag)
s->buf_end = buffer;
else
s->buf_end = buffer + buffer_size;
s->opaque = opaque;
s->write_packet = write_packet;
s->read_packet = read_packet;
s->seek = seek;
s->pos = 0;
s->must_flush = 0;
s->eof_reached = 0;
s->is_streamed = 0;
s->max_packet_size = 0;
s->checksum_ptr= NULL;
s->update_checksum= NULL;
return 0;
}
| false | FFmpeg | 465e1dadbef7596a3eb87089a66bb4ecdc26d3c4 | int init_put_byte(ByteIOContext *s,
unsigned char *buffer,
int buffer_size,
int write_flag,
void *opaque,
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
void (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*seek)(void *opaque, offset_t offset, int whence))
{
s->buffer = buffer;
s->buffer_size = buffer_size;
s->buf_ptr = buffer;
s->write_flag = write_flag;
if (!s->write_flag)
s->buf_end = buffer;
else
s->buf_end = buffer + buffer_size;
s->opaque = opaque;
s->write_packet = write_packet;
s->read_packet = read_packet;
s->seek = seek;
s->pos = 0;
s->must_flush = 0;
s->eof_reached = 0;
s->is_streamed = 0;
s->max_packet_size = 0;
s->checksum_ptr= NULL;
s->update_checksum= NULL;
return 0;
}
| {
"code": [],
"line_no": []
} | int FUNC_0(ByteIOContext *VAR_0,
unsigned char *VAR_1,
int VAR_2,
int VAR_3,
void *VAR_10,
int (*VAR_5)(void *VAR_10, uint8_t *VAR_9, int VAR_9),
void (*VAR_8)(void *VAR_10, uint8_t *VAR_9, int VAR_9),
int (*VAR_9)(void *VAR_10, offset_t VAR_10, int VAR_11))
{
VAR_0->VAR_1 = VAR_1;
VAR_0->VAR_2 = VAR_2;
VAR_0->buf_ptr = VAR_1;
VAR_0->VAR_3 = VAR_3;
if (!VAR_0->VAR_3)
VAR_0->buf_end = VAR_1;
else
VAR_0->buf_end = VAR_1 + VAR_2;
VAR_0->VAR_10 = VAR_10;
VAR_0->VAR_8 = VAR_8;
VAR_0->VAR_5 = VAR_5;
VAR_0->VAR_9 = VAR_9;
VAR_0->pos = 0;
VAR_0->must_flush = 0;
VAR_0->eof_reached = 0;
VAR_0->is_streamed = 0;
VAR_0->max_packet_size = 0;
VAR_0->checksum_ptr= NULL;
VAR_0->update_checksum= NULL;
return 0;
}
| [
"int FUNC_0(ByteIOContext *VAR_0,\nunsigned char *VAR_1,\nint VAR_2,\nint VAR_3,\nvoid *VAR_10,\nint (*VAR_5)(void *VAR_10, uint8_t *VAR_9, int VAR_9),\nvoid (*VAR_8)(void *VAR_10, uint8_t *VAR_9, int VAR_9),\nint (*VAR_9)(void *VAR_10, offset_t VAR_10, int VAR_11))\n{",
"VAR_0->VAR_1 = VAR_1;",
"VAR_0->VAR_2 = VAR_2;",
"VAR_0->buf_ptr = VAR_1;",
"VAR_0->VAR_3 = VAR_3;",
"if (!VAR_0->VAR_3)\nVAR_0->buf_end = VAR_1;",
"else\nVAR_0->buf_end = VAR_1 + VAR_2;",
"VAR_0->VAR_10 = VAR_10;",
"VAR_0->VAR_8 = VAR_8;",
"VAR_0->VAR_5 = VAR_5;",
"VAR_0->VAR_9 = VAR_9;",
"VAR_0->pos = 0;",
"VAR_0->must_flush = 0;",
"VAR_0->eof_reached = 0;",
"VAR_0->is_streamed = 0;",
"VAR_0->max_packet_size = 0;",
"VAR_0->checksum_ptr= NULL;",
"VAR_0->update_checksum= NULL;",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7,
9,
11,
13,
15,
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27,
29
],
[
31,
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
]
]
|
15,618 | static void do_interrupt_v7m(CPUARMState *env)
{
uint32_t xpsr = xpsr_read(env);
uint32_t lr;
uint32_t addr;
lr = 0xfffffff1;
if (env->v7m.current_sp)
lr |= 4;
if (env->v7m.exception == 0)
lr |= 8;
/* For exceptions we just mark as pending on the NVIC, and let that
handle it. */
/* TODO: Need to escalate if the current priority is higher than the
one we're raising. */
switch (env->exception_index) {
case EXCP_UDEF:
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
return;
case EXCP_SWI:
env->regs[15] += 2;
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SVC);
return;
case EXCP_PREFETCH_ABORT:
case EXCP_DATA_ABORT:
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_MEM);
return;
case EXCP_BKPT:
if (semihosting_enabled) {
int nr;
nr = lduw_code(env->regs[15]) & 0xff;
if (nr == 0xab) {
env->regs[15] += 2;
env->regs[0] = do_arm_semihosting(env);
return;
}
}
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_DEBUG);
return;
case EXCP_IRQ:
env->v7m.exception = armv7m_nvic_acknowledge_irq(env->nvic);
break;
case EXCP_EXCEPTION_EXIT:
do_v7m_exception_exit(env);
return;
default:
cpu_abort(env, "Unhandled exception 0x%x\n", env->exception_index);
return; /* Never happens. Keep compiler happy. */
}
/* Align stack pointer. */
/* ??? Should only do this if Configuration Control Register
STACKALIGN bit is set. */
if (env->regs[13] & 4) {
env->regs[13] -= 4;
xpsr |= 0x200;
}
/* Switch to the handler mode. */
v7m_push(env, xpsr);
v7m_push(env, env->regs[15]);
v7m_push(env, env->regs[14]);
v7m_push(env, env->regs[12]);
v7m_push(env, env->regs[3]);
v7m_push(env, env->regs[2]);
v7m_push(env, env->regs[1]);
v7m_push(env, env->regs[0]);
switch_v7m_sp(env, 0);
/* Clear IT bits */
env->condexec_bits = 0;
env->regs[14] = lr;
addr = ldl_phys(env->v7m.vecbase + env->v7m.exception * 4);
env->regs[15] = addr & 0xfffffffe;
env->thumb = addr & 1;
}
| true | qemu | d8fd2954996255ba6ad610917e7849832d0120b7 | static void do_interrupt_v7m(CPUARMState *env)
{
uint32_t xpsr = xpsr_read(env);
uint32_t lr;
uint32_t addr;
lr = 0xfffffff1;
if (env->v7m.current_sp)
lr |= 4;
if (env->v7m.exception == 0)
lr |= 8;
switch (env->exception_index) {
case EXCP_UDEF:
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
return;
case EXCP_SWI:
env->regs[15] += 2;
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SVC);
return;
case EXCP_PREFETCH_ABORT:
case EXCP_DATA_ABORT:
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_MEM);
return;
case EXCP_BKPT:
if (semihosting_enabled) {
int nr;
nr = lduw_code(env->regs[15]) & 0xff;
if (nr == 0xab) {
env->regs[15] += 2;
env->regs[0] = do_arm_semihosting(env);
return;
}
}
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_DEBUG);
return;
case EXCP_IRQ:
env->v7m.exception = armv7m_nvic_acknowledge_irq(env->nvic);
break;
case EXCP_EXCEPTION_EXIT:
do_v7m_exception_exit(env);
return;
default:
cpu_abort(env, "Unhandled exception 0x%x\n", env->exception_index);
return;
}
if (env->regs[13] & 4) {
env->regs[13] -= 4;
xpsr |= 0x200;
}
v7m_push(env, xpsr);
v7m_push(env, env->regs[15]);
v7m_push(env, env->regs[14]);
v7m_push(env, env->regs[12]);
v7m_push(env, env->regs[3]);
v7m_push(env, env->regs[2]);
v7m_push(env, env->regs[1]);
v7m_push(env, env->regs[0]);
switch_v7m_sp(env, 0);
env->condexec_bits = 0;
env->regs[14] = lr;
addr = ldl_phys(env->v7m.vecbase + env->v7m.exception * 4);
env->regs[15] = addr & 0xfffffffe;
env->thumb = addr & 1;
}
| {
"code": [
" nr = lduw_code(env->regs[15]) & 0xff;"
],
"line_no": [
63
]
} | static void FUNC_0(CPUARMState *VAR_0)
{
uint32_t xpsr = xpsr_read(VAR_0);
uint32_t lr;
uint32_t addr;
lr = 0xfffffff1;
if (VAR_0->v7m.current_sp)
lr |= 4;
if (VAR_0->v7m.exception == 0)
lr |= 8;
switch (VAR_0->exception_index) {
case EXCP_UDEF:
armv7m_nvic_set_pending(VAR_0->nvic, ARMV7M_EXCP_USAGE);
return;
case EXCP_SWI:
VAR_0->regs[15] += 2;
armv7m_nvic_set_pending(VAR_0->nvic, ARMV7M_EXCP_SVC);
return;
case EXCP_PREFETCH_ABORT:
case EXCP_DATA_ABORT:
armv7m_nvic_set_pending(VAR_0->nvic, ARMV7M_EXCP_MEM);
return;
case EXCP_BKPT:
if (semihosting_enabled) {
int VAR_1;
VAR_1 = lduw_code(VAR_0->regs[15]) & 0xff;
if (VAR_1 == 0xab) {
VAR_0->regs[15] += 2;
VAR_0->regs[0] = do_arm_semihosting(VAR_0);
return;
}
}
armv7m_nvic_set_pending(VAR_0->nvic, ARMV7M_EXCP_DEBUG);
return;
case EXCP_IRQ:
VAR_0->v7m.exception = armv7m_nvic_acknowledge_irq(VAR_0->nvic);
break;
case EXCP_EXCEPTION_EXIT:
do_v7m_exception_exit(VAR_0);
return;
default:
cpu_abort(VAR_0, "Unhandled exception 0x%x\n", VAR_0->exception_index);
return;
}
if (VAR_0->regs[13] & 4) {
VAR_0->regs[13] -= 4;
xpsr |= 0x200;
}
v7m_push(VAR_0, xpsr);
v7m_push(VAR_0, VAR_0->regs[15]);
v7m_push(VAR_0, VAR_0->regs[14]);
v7m_push(VAR_0, VAR_0->regs[12]);
v7m_push(VAR_0, VAR_0->regs[3]);
v7m_push(VAR_0, VAR_0->regs[2]);
v7m_push(VAR_0, VAR_0->regs[1]);
v7m_push(VAR_0, VAR_0->regs[0]);
switch_v7m_sp(VAR_0, 0);
VAR_0->condexec_bits = 0;
VAR_0->regs[14] = lr;
addr = ldl_phys(VAR_0->v7m.vecbase + VAR_0->v7m.exception * 4);
VAR_0->regs[15] = addr & 0xfffffffe;
VAR_0->thumb = addr & 1;
}
| [
"static void FUNC_0(CPUARMState *VAR_0)\n{",
"uint32_t xpsr = xpsr_read(VAR_0);",
"uint32_t lr;",
"uint32_t addr;",
"lr = 0xfffffff1;",
"if (VAR_0->v7m.current_sp)\nlr |= 4;",
"if (VAR_0->v7m.exception == 0)\nlr |= 8;",
"switch (VAR_0->exception_index) {",
"case EXCP_UDEF:\narmv7m_nvic_set_pending(VAR_0->nvic, ARMV7M_EXCP_USAGE);",
"return;",
"case EXCP_SWI:\nVAR_0->regs[15] += 2;",
"armv7m_nvic_set_pending(VAR_0->nvic, ARMV7M_EXCP_SVC);",
"return;",
"case EXCP_PREFETCH_ABORT:\ncase EXCP_DATA_ABORT:\narmv7m_nvic_set_pending(VAR_0->nvic, ARMV7M_EXCP_MEM);",
"return;",
"case EXCP_BKPT:\nif (semihosting_enabled) {",
"int VAR_1;",
"VAR_1 = lduw_code(VAR_0->regs[15]) & 0xff;",
"if (VAR_1 == 0xab) {",
"VAR_0->regs[15] += 2;",
"VAR_0->regs[0] = do_arm_semihosting(VAR_0);",
"return;",
"}",
"}",
"armv7m_nvic_set_pending(VAR_0->nvic, ARMV7M_EXCP_DEBUG);",
"return;",
"case EXCP_IRQ:\nVAR_0->v7m.exception = armv7m_nvic_acknowledge_irq(VAR_0->nvic);",
"break;",
"case EXCP_EXCEPTION_EXIT:\ndo_v7m_exception_exit(VAR_0);",
"return;",
"default:\ncpu_abort(VAR_0, \"Unhandled exception 0x%x\\n\", VAR_0->exception_index);",
"return;",
"}",
"if (VAR_0->regs[13] & 4) {",
"VAR_0->regs[13] -= 4;",
"xpsr |= 0x200;",
"}",
"v7m_push(VAR_0, xpsr);",
"v7m_push(VAR_0, VAR_0->regs[15]);",
"v7m_push(VAR_0, VAR_0->regs[14]);",
"v7m_push(VAR_0, VAR_0->regs[12]);",
"v7m_push(VAR_0, VAR_0->regs[3]);",
"v7m_push(VAR_0, VAR_0->regs[2]);",
"v7m_push(VAR_0, VAR_0->regs[1]);",
"v7m_push(VAR_0, VAR_0->regs[0]);",
"switch_v7m_sp(VAR_0, 0);",
"VAR_0->condexec_bits = 0;",
"VAR_0->regs[14] = lr;",
"addr = ldl_phys(VAR_0->v7m.vecbase + VAR_0->v7m.exception * 4);",
"VAR_0->regs[15] = addr & 0xfffffffe;",
"VAR_0->thumb = addr & 1;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15,
17
],
[
19,
21
],
[
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
],
[
109
],
[
111
],
[
113
],
[
115
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
]
]
|
15,619 | static int aac_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
AACContext *ac = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
GetBitContext gb;
int buf_consumed;
int buf_offset;
int err;
int new_extradata_size;
const uint8_t *new_extradata = av_packet_get_side_data(avpkt,
AV_PKT_DATA_NEW_EXTRADATA,
&new_extradata_size);
int jp_dualmono_size;
const uint8_t *jp_dualmono = av_packet_get_side_data(avpkt,
AV_PKT_DATA_JP_DUALMONO,
&jp_dualmono_size);
if (new_extradata && 0) {
av_free(avctx->extradata);
avctx->extradata = av_mallocz(new_extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
avctx->extradata_size = new_extradata_size;
memcpy(avctx->extradata, new_extradata, new_extradata_size);
push_output_configuration(ac);
if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
avctx->extradata,
avctx->extradata_size*8, 1) < 0) {
pop_output_configuration(ac);
}
}
ac->dmono_mode = 0;
if (jp_dualmono && jp_dualmono_size > 0)
ac->dmono_mode = 1 + *jp_dualmono;
if (ac->force_dmono_mode >= 0)
ac->dmono_mode = ac->force_dmono_mode;
init_get_bits(&gb, buf, buf_size * 8);
if ((err = aac_decode_frame_int(avctx, data, got_frame_ptr, &gb, avpkt)) < 0)
return err;
buf_consumed = (get_bits_count(&gb) + 7) >> 3;
for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++)
if (buf[buf_offset])
break;
return buf_size > buf_offset ? buf_consumed : buf_size;
} | true | FFmpeg | b563afe6fa9345a62750055998a28a3926c02334 | static int aac_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
AACContext *ac = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
GetBitContext gb;
int buf_consumed;
int buf_offset;
int err;
int new_extradata_size;
const uint8_t *new_extradata = av_packet_get_side_data(avpkt,
AV_PKT_DATA_NEW_EXTRADATA,
&new_extradata_size);
int jp_dualmono_size;
const uint8_t *jp_dualmono = av_packet_get_side_data(avpkt,
AV_PKT_DATA_JP_DUALMONO,
&jp_dualmono_size);
if (new_extradata && 0) {
av_free(avctx->extradata);
avctx->extradata = av_mallocz(new_extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
avctx->extradata_size = new_extradata_size;
memcpy(avctx->extradata, new_extradata, new_extradata_size);
push_output_configuration(ac);
if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
avctx->extradata,
avctx->extradata_size*8, 1) < 0) {
pop_output_configuration(ac);
}
}
ac->dmono_mode = 0;
if (jp_dualmono && jp_dualmono_size > 0)
ac->dmono_mode = 1 + *jp_dualmono;
if (ac->force_dmono_mode >= 0)
ac->dmono_mode = ac->force_dmono_mode;
init_get_bits(&gb, buf, buf_size * 8);
if ((err = aac_decode_frame_int(avctx, data, got_frame_ptr, &gb, avpkt)) < 0)
return err;
buf_consumed = (get_bits_count(&gb) + 7) >> 3;
for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++)
if (buf[buf_offset])
break;
return buf_size > buf_offset ? buf_consumed : buf_size;
} | {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,
int *VAR_2, AVPacket *VAR_3)
{
AACContext *ac = VAR_0->priv_data;
const uint8_t *VAR_4 = VAR_3->VAR_1;
int VAR_5 = VAR_3->size;
GetBitContext gb;
int VAR_6;
int VAR_7;
int VAR_8;
int VAR_9;
const uint8_t *VAR_10 = av_packet_get_side_data(VAR_3,
AV_PKT_DATA_NEW_EXTRADATA,
&VAR_9);
int VAR_11;
const uint8_t *VAR_12 = av_packet_get_side_data(VAR_3,
AV_PKT_DATA_JP_DUALMONO,
&VAR_11);
if (VAR_10 && 0) {
av_free(VAR_0->extradata);
VAR_0->extradata = av_mallocz(VAR_9 +
FF_INPUT_BUFFER_PADDING_SIZE);
if (!VAR_0->extradata)
return AVERROR(ENOMEM);
VAR_0->extradata_size = VAR_9;
memcpy(VAR_0->extradata, VAR_10, VAR_9);
push_output_configuration(ac);
if (decode_audio_specific_config(ac, ac->VAR_0, &ac->oc[1].m4ac,
VAR_0->extradata,
VAR_0->extradata_size*8, 1) < 0) {
pop_output_configuration(ac);
}
}
ac->dmono_mode = 0;
if (VAR_12 && VAR_11 > 0)
ac->dmono_mode = 1 + *VAR_12;
if (ac->force_dmono_mode >= 0)
ac->dmono_mode = ac->force_dmono_mode;
init_get_bits(&gb, VAR_4, VAR_5 * 8);
if ((VAR_8 = aac_decode_frame_int(VAR_0, VAR_1, VAR_2, &gb, VAR_3)) < 0)
return VAR_8;
VAR_6 = (get_bits_count(&gb) + 7) >> 3;
for (VAR_7 = VAR_6; VAR_7 < VAR_5; VAR_7++)
if (VAR_4[VAR_7])
break;
return VAR_5 > VAR_7 ? VAR_6 : VAR_5;
} | [
"static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{",
"AACContext *ac = VAR_0->priv_data;",
"const uint8_t *VAR_4 = VAR_3->VAR_1;",
"int VAR_5 = VAR_3->size;",
"GetBitContext gb;",
"int VAR_6;",
"int VAR_7;",
"int VAR_8;",
"int VAR_9;",
"const uint8_t *VAR_10 = av_packet_get_side_data(VAR_3,\nAV_PKT_DATA_NEW_EXTRADATA,\n&VAR_9);",
"int VAR_11;",
"const uint8_t *VAR_12 = av_packet_get_side_data(VAR_3,\nAV_PKT_DATA_JP_DUALMONO,\n&VAR_11);",
"if (VAR_10 && 0) {",
"av_free(VAR_0->extradata);",
"VAR_0->extradata = av_mallocz(VAR_9 +\nFF_INPUT_BUFFER_PADDING_SIZE);",
"if (!VAR_0->extradata)\nreturn AVERROR(ENOMEM);",
"VAR_0->extradata_size = VAR_9;",
"memcpy(VAR_0->extradata, VAR_10, VAR_9);",
"push_output_configuration(ac);",
"if (decode_audio_specific_config(ac, ac->VAR_0, &ac->oc[1].m4ac,\nVAR_0->extradata,\nVAR_0->extradata_size*8, 1) < 0) {",
"pop_output_configuration(ac);",
"}",
"}",
"ac->dmono_mode = 0;",
"if (VAR_12 && VAR_11 > 0)\nac->dmono_mode = 1 + *VAR_12;",
"if (ac->force_dmono_mode >= 0)\nac->dmono_mode = ac->force_dmono_mode;",
"init_get_bits(&gb, VAR_4, VAR_5 * 8);",
"if ((VAR_8 = aac_decode_frame_int(VAR_0, VAR_1, VAR_2, &gb, VAR_3)) < 0)\nreturn VAR_8;",
"VAR_6 = (get_bits_count(&gb) + 7) >> 3;",
"for (VAR_7 = VAR_6; VAR_7 < VAR_5; VAR_7++)",
"if (VAR_4[VAR_7])\nbreak;",
"return VAR_5 > VAR_7 ? VAR_6 : VAR_5;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
2,
3
],
[
4
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
10
],
[
11
],
[
12,
13,
14
],
[
15
],
[
16,
17,
18
],
[
19
],
[
20
],
[
21,
22
],
[
23,
24
],
[
25
],
[
26
],
[
27
],
[
28,
29,
30
],
[
31
],
[
32
],
[
33
],
[
34
],
[
35,
36
],
[
37,
38
],
[
39
],
[
40,
41
],
[
42
],
[
43
],
[
44,
45
],
[
46
],
[
47
]
]
|
15,620 | static void block_job_unref(BlockJob *job)
{
if (--job->refcnt == 0) {
BlockDriverState *bs = blk_bs(job->blk);
bs->job = NULL;
block_job_remove_all_bdrv(job);
blk_remove_aio_context_notifier(job->blk,
block_job_attached_aio_context,
block_job_detach_aio_context, job);
blk_unref(job->blk);
error_free(job->blocker);
g_free(job->id);
QLIST_REMOVE(job, job_list);
g_free(job);
}
}
| true | qemu | 4172a00373b2c81374293becc02b16b7f8c76659 | static void block_job_unref(BlockJob *job)
{
if (--job->refcnt == 0) {
BlockDriverState *bs = blk_bs(job->blk);
bs->job = NULL;
block_job_remove_all_bdrv(job);
blk_remove_aio_context_notifier(job->blk,
block_job_attached_aio_context,
block_job_detach_aio_context, job);
blk_unref(job->blk);
error_free(job->blocker);
g_free(job->id);
QLIST_REMOVE(job, job_list);
g_free(job);
}
}
| {
"code": [
"static void block_job_unref(BlockJob *job)"
],
"line_no": [
1
]
} | static void FUNC_0(BlockJob *VAR_0)
{
if (--VAR_0->refcnt == 0) {
BlockDriverState *bs = blk_bs(VAR_0->blk);
bs->VAR_0 = NULL;
block_job_remove_all_bdrv(VAR_0);
blk_remove_aio_context_notifier(VAR_0->blk,
block_job_attached_aio_context,
block_job_detach_aio_context, VAR_0);
blk_unref(VAR_0->blk);
error_free(VAR_0->blocker);
g_free(VAR_0->id);
QLIST_REMOVE(VAR_0, job_list);
g_free(VAR_0);
}
}
| [
"static void FUNC_0(BlockJob *VAR_0)\n{",
"if (--VAR_0->refcnt == 0) {",
"BlockDriverState *bs = blk_bs(VAR_0->blk);",
"bs->VAR_0 = NULL;",
"block_job_remove_all_bdrv(VAR_0);",
"blk_remove_aio_context_notifier(VAR_0->blk,\nblock_job_attached_aio_context,\nblock_job_detach_aio_context, VAR_0);",
"blk_unref(VAR_0->blk);",
"error_free(VAR_0->blocker);",
"g_free(VAR_0->id);",
"QLIST_REMOVE(VAR_0, job_list);",
"g_free(VAR_0);",
"}",
"}"
]
| [
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13,
15,
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
]
]
|
15,621 | static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int packet_size, ret, width, height;
AVStream *st = s->streams[0];
width = st->codec->width;
height = st->codec->height;
packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
if (packet_size < 0)
return -1;
ret= av_get_packet(s->pb, pkt, packet_size);
pkt->pts=
pkt->dts= pkt->pos / packet_size;
pkt->stream_index = 0;
if (ret != packet_size)
return AVERROR(EIO);
return 0;
}
| true | FFmpeg | 22a7e19b50cc1627dd16e22c5e89b1f92f1d0c0e | static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int packet_size, ret, width, height;
AVStream *st = s->streams[0];
width = st->codec->width;
height = st->codec->height;
packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
if (packet_size < 0)
return -1;
ret= av_get_packet(s->pb, pkt, packet_size);
pkt->pts=
pkt->dts= pkt->pos / packet_size;
pkt->stream_index = 0;
if (ret != packet_size)
return AVERROR(EIO);
return 0;
}
| {
"code": [
" if (ret != packet_size)"
],
"line_no": [
35
]
} | static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)
{
int VAR_2, VAR_3, VAR_4, VAR_5;
AVStream *st = VAR_0->streams[0];
VAR_4 = st->codec->VAR_4;
VAR_5 = st->codec->VAR_5;
VAR_2 = avpicture_get_size(st->codec->pix_fmt, VAR_4, VAR_5);
if (VAR_2 < 0)
return -1;
VAR_3= av_get_packet(VAR_0->pb, VAR_1, VAR_2);
VAR_1->pts=
VAR_1->dts= VAR_1->pos / VAR_2;
VAR_1->stream_index = 0;
if (VAR_3 != VAR_2)
return AVERROR(EIO);
return 0;
}
| [
"static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{",
"int VAR_2, VAR_3, VAR_4, VAR_5;",
"AVStream *st = VAR_0->streams[0];",
"VAR_4 = st->codec->VAR_4;",
"VAR_5 = st->codec->VAR_5;",
"VAR_2 = avpicture_get_size(st->codec->pix_fmt, VAR_4, VAR_5);",
"if (VAR_2 < 0)\nreturn -1;",
"VAR_3= av_get_packet(VAR_0->pb, VAR_1, VAR_2);",
"VAR_1->pts=\nVAR_1->dts= VAR_1->pos / VAR_2;",
"VAR_1->stream_index = 0;",
"if (VAR_3 != VAR_2)\nreturn AVERROR(EIO);",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
17
],
[
19,
21
],
[
25
],
[
27,
29
],
[
33
],
[
35,
37
],
[
39
],
[
41
]
]
|
15,623 | static int mpeg_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
Mpeg1Context *s = avctx->priv_data;
AVFrame *picture = data;
MpegEncContext *s2 = &s->mpeg_enc_ctx;
av_dlog(avctx, "fill_buffer\n");
if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) {
/* special case for last picture */
if (s2->low_delay == 0 && s2->next_picture_ptr) {
*picture = s2->next_picture_ptr->f;
s2->next_picture_ptr = NULL;
*data_size = sizeof(AVFrame);
}
return buf_size;
}
if (s2->flags & CODEC_FLAG_TRUNCATED) {
int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size, NULL);
if (ff_combine_frame(&s2->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0)
return buf_size;
}
s2->codec_tag = avpriv_toupper4(avctx->codec_tag);
if (s->mpeg_enc_ctx_allocated == 0 && ( s2->codec_tag == AV_RL32("VCR2")
|| s2->codec_tag == AV_RL32("BW10")
))
vcr2_init_sequence(avctx);
s->slice_count = 0;
if (avctx->extradata && !avctx->frame_number) {
int ret = decode_chunks(avctx, picture, data_size, avctx->extradata, avctx->extradata_size);
if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
return ret;
}
return decode_chunks(avctx, picture, data_size, buf, buf_size);
} | true | FFmpeg | 951cbea56fdc03ef96d07fbd7e5bed755d42ac8a | static int mpeg_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
Mpeg1Context *s = avctx->priv_data;
AVFrame *picture = data;
MpegEncContext *s2 = &s->mpeg_enc_ctx;
av_dlog(avctx, "fill_buffer\n");
if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) {
if (s2->low_delay == 0 && s2->next_picture_ptr) {
*picture = s2->next_picture_ptr->f;
s2->next_picture_ptr = NULL;
*data_size = sizeof(AVFrame);
}
return buf_size;
}
if (s2->flags & CODEC_FLAG_TRUNCATED) {
int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size, NULL);
if (ff_combine_frame(&s2->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0)
return buf_size;
}
s2->codec_tag = avpriv_toupper4(avctx->codec_tag);
if (s->mpeg_enc_ctx_allocated == 0 && ( s2->codec_tag == AV_RL32("VCR2")
|| s2->codec_tag == AV_RL32("BW10")
))
vcr2_init_sequence(avctx);
s->slice_count = 0;
if (avctx->extradata && !avctx->frame_number) {
int ret = decode_chunks(avctx, picture, data_size, avctx->extradata, avctx->extradata_size);
if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
return ret;
}
return decode_chunks(avctx, picture, data_size, buf, buf_size);
} | {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
AVPacket *VAR_3)
{
const uint8_t *VAR_4 = VAR_3->VAR_1;
int VAR_5 = VAR_3->size;
Mpeg1Context *s = VAR_0->priv_data;
AVFrame *picture = VAR_1;
MpegEncContext *s2 = &s->mpeg_enc_ctx;
av_dlog(VAR_0, "fill_buffer\n");
if (VAR_5 == 0 || (VAR_5 == 4 && AV_RB32(VAR_4) == SEQ_END_CODE)) {
if (s2->low_delay == 0 && s2->next_picture_ptr) {
*picture = s2->next_picture_ptr->f;
s2->next_picture_ptr = NULL;
*VAR_2 = sizeof(AVFrame);
}
return VAR_5;
}
if (s2->flags & CODEC_FLAG_TRUNCATED) {
int VAR_6 = ff_mpeg1_find_frame_end(&s2->parse_context, VAR_4, VAR_5, NULL);
if (ff_combine_frame(&s2->parse_context, VAR_6, (const uint8_t **)&VAR_4, &VAR_5) < 0)
return VAR_5;
}
s2->codec_tag = avpriv_toupper4(VAR_0->codec_tag);
if (s->mpeg_enc_ctx_allocated == 0 && ( s2->codec_tag == AV_RL32("VCR2")
|| s2->codec_tag == AV_RL32("BW10")
))
vcr2_init_sequence(VAR_0);
s->slice_count = 0;
if (VAR_0->extradata && !VAR_0->frame_number) {
int VAR_7 = decode_chunks(VAR_0, picture, VAR_2, VAR_0->extradata, VAR_0->extradata_size);
if (VAR_7 < 0 && (VAR_0->err_recognition & AV_EF_EXPLODE))
return VAR_7;
}
return decode_chunks(VAR_0, picture, VAR_2, VAR_4, VAR_5);
} | [
"static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{",
"const uint8_t *VAR_4 = VAR_3->VAR_1;",
"int VAR_5 = VAR_3->size;",
"Mpeg1Context *s = VAR_0->priv_data;",
"AVFrame *picture = VAR_1;",
"MpegEncContext *s2 = &s->mpeg_enc_ctx;",
"av_dlog(VAR_0, \"fill_buffer\\n\");",
"if (VAR_5 == 0 || (VAR_5 == 4 && AV_RB32(VAR_4) == SEQ_END_CODE)) {",
"if (s2->low_delay == 0 && s2->next_picture_ptr) {",
"*picture = s2->next_picture_ptr->f;",
"s2->next_picture_ptr = NULL;",
"*VAR_2 = sizeof(AVFrame);",
"}",
"return VAR_5;",
"}",
"if (s2->flags & CODEC_FLAG_TRUNCATED) {",
"int VAR_6 = ff_mpeg1_find_frame_end(&s2->parse_context, VAR_4, VAR_5, NULL);",
"if (ff_combine_frame(&s2->parse_context, VAR_6, (const uint8_t **)&VAR_4, &VAR_5) < 0)\nreturn VAR_5;",
"}",
"s2->codec_tag = avpriv_toupper4(VAR_0->codec_tag);",
"if (s->mpeg_enc_ctx_allocated == 0 && ( s2->codec_tag == AV_RL32(\"VCR2\")\n|| s2->codec_tag == AV_RL32(\"BW10\")\n))\nvcr2_init_sequence(VAR_0);",
"s->slice_count = 0;",
"if (VAR_0->extradata && !VAR_0->frame_number) {",
"int VAR_7 = decode_chunks(VAR_0, picture, VAR_2, VAR_0->extradata, VAR_0->extradata_size);",
"if (VAR_7 < 0 && (VAR_0->err_recognition & AV_EF_EXPLODE))\nreturn VAR_7;",
"}",
"return decode_chunks(VAR_0, picture, VAR_2, VAR_4, VAR_5);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
51,
53
],
[
55
],
[
59
],
[
61,
63,
65,
67
],
[
71
],
[
75
],
[
77
],
[
80,
82
],
[
84
],
[
88
],
[
90
]
]
|
15,624 | void ff_h264_remove_all_refs(H264Context *h)
{
int i;
for (i = 0; i < 16; i++) {
remove_long(h, i, 0);
}
assert(h->long_ref_count == 0);
if (h->short_ref_count && !h->last_pic_for_ec.f->data[0]) {
ff_h264_unref_picture(h, &h->last_pic_for_ec);
if (h->short_ref[0]->f->buf[0])
ff_h264_ref_picture(h, &h->last_pic_for_ec, h->short_ref[0]);
}
for (i = 0; i < h->short_ref_count; i++) {
unreference_pic(h, h->short_ref[i], 0);
h->short_ref[i] = NULL;
}
h->short_ref_count = 0;
memset(h->default_ref, 0, sizeof(h->default_ref));
}
| true | FFmpeg | b6eaa3928e198554a3934dd5ad6eac4d16f27df2 | void ff_h264_remove_all_refs(H264Context *h)
{
int i;
for (i = 0; i < 16; i++) {
remove_long(h, i, 0);
}
assert(h->long_ref_count == 0);
if (h->short_ref_count && !h->last_pic_for_ec.f->data[0]) {
ff_h264_unref_picture(h, &h->last_pic_for_ec);
if (h->short_ref[0]->f->buf[0])
ff_h264_ref_picture(h, &h->last_pic_for_ec, h->short_ref[0]);
}
for (i = 0; i < h->short_ref_count; i++) {
unreference_pic(h, h->short_ref[i], 0);
h->short_ref[i] = NULL;
}
h->short_ref_count = 0;
memset(h->default_ref, 0, sizeof(h->default_ref));
}
| {
"code": [
" if (h->short_ref[0]->f->buf[0])",
" ff_h264_ref_picture(h, &h->last_pic_for_ec, h->short_ref[0]);"
],
"line_no": [
23,
25
]
} | void FUNC_0(H264Context *VAR_0)
{
int VAR_1;
for (VAR_1 = 0; VAR_1 < 16; VAR_1++) {
remove_long(VAR_0, VAR_1, 0);
}
assert(VAR_0->long_ref_count == 0);
if (VAR_0->short_ref_count && !VAR_0->last_pic_for_ec.f->data[0]) {
ff_h264_unref_picture(VAR_0, &VAR_0->last_pic_for_ec);
if (VAR_0->short_ref[0]->f->buf[0])
ff_h264_ref_picture(VAR_0, &VAR_0->last_pic_for_ec, VAR_0->short_ref[0]);
}
for (VAR_1 = 0; VAR_1 < VAR_0->short_ref_count; VAR_1++) {
unreference_pic(VAR_0, VAR_0->short_ref[VAR_1], 0);
VAR_0->short_ref[VAR_1] = NULL;
}
VAR_0->short_ref_count = 0;
memset(VAR_0->default_ref, 0, sizeof(VAR_0->default_ref));
}
| [
"void FUNC_0(H264Context *VAR_0)\n{",
"int VAR_1;",
"for (VAR_1 = 0; VAR_1 < 16; VAR_1++) {",
"remove_long(VAR_0, VAR_1, 0);",
"}",
"assert(VAR_0->long_ref_count == 0);",
"if (VAR_0->short_ref_count && !VAR_0->last_pic_for_ec.f->data[0]) {",
"ff_h264_unref_picture(VAR_0, &VAR_0->last_pic_for_ec);",
"if (VAR_0->short_ref[0]->f->buf[0])\nff_h264_ref_picture(VAR_0, &VAR_0->last_pic_for_ec, VAR_0->short_ref[0]);",
"}",
"for (VAR_1 = 0; VAR_1 < VAR_0->short_ref_count; VAR_1++) {",
"unreference_pic(VAR_0, VAR_0->short_ref[VAR_1], 0);",
"VAR_0->short_ref[VAR_1] = NULL;",
"}",
"VAR_0->short_ref_count = 0;",
"memset(VAR_0->default_ref, 0, sizeof(VAR_0->default_ref));",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23,
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
]
]
|
15,625 | static int oss_init_in (HWVoiceIn *hw, struct audsettings *as)
{
OSSVoiceIn *oss = (OSSVoiceIn *) hw;
struct oss_params req, obt;
int endianness;
int err;
int fd;
audfmt_e effective_fmt;
struct audsettings obt_as;
oss->fd = -1;
req.fmt = aud_to_ossfmt (as->fmt, as->endianness);
req.freq = as->freq;
req.nchannels = as->nchannels;
req.fragsize = conf.fragsize;
req.nfrags = conf.nfrags;
if (oss_open (1, &req, &obt, &fd)) {
return -1;
}
err = oss_to_audfmt (obt.fmt, &effective_fmt, &endianness);
if (err) {
oss_anal_close (&fd);
return -1;
}
obt_as.freq = obt.freq;
obt_as.nchannels = obt.nchannels;
obt_as.fmt = effective_fmt;
obt_as.endianness = endianness;
audio_pcm_init_info (&hw->info, &obt_as);
oss->nfrags = obt.nfrags;
oss->fragsize = obt.fragsize;
if (obt.nfrags * obt.fragsize & hw->info.align) {
dolog ("warning: Misaligned ADC buffer, size %d, alignment %d\n",
obt.nfrags * obt.fragsize, hw->info.align + 1);
}
hw->samples = (obt.nfrags * obt.fragsize) >> hw->info.shift;
oss->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
if (!oss->pcm_buf) {
dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n",
hw->samples, 1 << hw->info.shift);
oss_anal_close (&fd);
return -1;
}
oss->fd = fd;
return 0;
}
| true | qemu | 5706db1deb061ee9affdcea81e59c4c2cad7c41e | static int oss_init_in (HWVoiceIn *hw, struct audsettings *as)
{
OSSVoiceIn *oss = (OSSVoiceIn *) hw;
struct oss_params req, obt;
int endianness;
int err;
int fd;
audfmt_e effective_fmt;
struct audsettings obt_as;
oss->fd = -1;
req.fmt = aud_to_ossfmt (as->fmt, as->endianness);
req.freq = as->freq;
req.nchannels = as->nchannels;
req.fragsize = conf.fragsize;
req.nfrags = conf.nfrags;
if (oss_open (1, &req, &obt, &fd)) {
return -1;
}
err = oss_to_audfmt (obt.fmt, &effective_fmt, &endianness);
if (err) {
oss_anal_close (&fd);
return -1;
}
obt_as.freq = obt.freq;
obt_as.nchannels = obt.nchannels;
obt_as.fmt = effective_fmt;
obt_as.endianness = endianness;
audio_pcm_init_info (&hw->info, &obt_as);
oss->nfrags = obt.nfrags;
oss->fragsize = obt.fragsize;
if (obt.nfrags * obt.fragsize & hw->info.align) {
dolog ("warning: Misaligned ADC buffer, size %d, alignment %d\n",
obt.nfrags * obt.fragsize, hw->info.align + 1);
}
hw->samples = (obt.nfrags * obt.fragsize) >> hw->info.shift;
oss->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
if (!oss->pcm_buf) {
dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n",
hw->samples, 1 << hw->info.shift);
oss_anal_close (&fd);
return -1;
}
oss->fd = fd;
return 0;
}
| {
"code": [
"static int oss_init_in (HWVoiceIn *hw, struct audsettings *as)"
],
"line_no": [
1
]
} | static int FUNC_0 (HWVoiceIn *VAR_0, struct audsettings *VAR_1)
{
OSSVoiceIn *oss = (OSSVoiceIn *) VAR_0;
struct oss_params VAR_2, VAR_3;
int VAR_4;
int VAR_5;
int VAR_6;
audfmt_e effective_fmt;
struct audsettings VAR_7;
oss->VAR_6 = -1;
VAR_2.fmt = aud_to_ossfmt (VAR_1->fmt, VAR_1->VAR_4);
VAR_2.freq = VAR_1->freq;
VAR_2.nchannels = VAR_1->nchannels;
VAR_2.fragsize = conf.fragsize;
VAR_2.nfrags = conf.nfrags;
if (oss_open (1, &VAR_2, &VAR_3, &VAR_6)) {
return -1;
}
VAR_5 = oss_to_audfmt (VAR_3.fmt, &effective_fmt, &VAR_4);
if (VAR_5) {
oss_anal_close (&VAR_6);
return -1;
}
VAR_7.freq = VAR_3.freq;
VAR_7.nchannels = VAR_3.nchannels;
VAR_7.fmt = effective_fmt;
VAR_7.VAR_4 = VAR_4;
audio_pcm_init_info (&VAR_0->info, &VAR_7);
oss->nfrags = VAR_3.nfrags;
oss->fragsize = VAR_3.fragsize;
if (VAR_3.nfrags * VAR_3.fragsize & VAR_0->info.align) {
dolog ("warning: Misaligned ADC buffer, size %d, alignment %d\n",
VAR_3.nfrags * VAR_3.fragsize, VAR_0->info.align + 1);
}
VAR_0->samples = (VAR_3.nfrags * VAR_3.fragsize) >> VAR_0->info.shift;
oss->pcm_buf = audio_calloc (AUDIO_FUNC, VAR_0->samples, 1 << VAR_0->info.shift);
if (!oss->pcm_buf) {
dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n",
VAR_0->samples, 1 << VAR_0->info.shift);
oss_anal_close (&VAR_6);
return -1;
}
oss->VAR_6 = VAR_6;
return 0;
}
| [
"static int FUNC_0 (HWVoiceIn *VAR_0, struct audsettings *VAR_1)\n{",
"OSSVoiceIn *oss = (OSSVoiceIn *) VAR_0;",
"struct oss_params VAR_2, VAR_3;",
"int VAR_4;",
"int VAR_5;",
"int VAR_6;",
"audfmt_e effective_fmt;",
"struct audsettings VAR_7;",
"oss->VAR_6 = -1;",
"VAR_2.fmt = aud_to_ossfmt (VAR_1->fmt, VAR_1->VAR_4);",
"VAR_2.freq = VAR_1->freq;",
"VAR_2.nchannels = VAR_1->nchannels;",
"VAR_2.fragsize = conf.fragsize;",
"VAR_2.nfrags = conf.nfrags;",
"if (oss_open (1, &VAR_2, &VAR_3, &VAR_6)) {",
"return -1;",
"}",
"VAR_5 = oss_to_audfmt (VAR_3.fmt, &effective_fmt, &VAR_4);",
"if (VAR_5) {",
"oss_anal_close (&VAR_6);",
"return -1;",
"}",
"VAR_7.freq = VAR_3.freq;",
"VAR_7.nchannels = VAR_3.nchannels;",
"VAR_7.fmt = effective_fmt;",
"VAR_7.VAR_4 = VAR_4;",
"audio_pcm_init_info (&VAR_0->info, &VAR_7);",
"oss->nfrags = VAR_3.nfrags;",
"oss->fragsize = VAR_3.fragsize;",
"if (VAR_3.nfrags * VAR_3.fragsize & VAR_0->info.align) {",
"dolog (\"warning: Misaligned ADC buffer, size %d, alignment %d\\n\",\nVAR_3.nfrags * VAR_3.fragsize, VAR_0->info.align + 1);",
"}",
"VAR_0->samples = (VAR_3.nfrags * VAR_3.fragsize) >> VAR_0->info.shift;",
"oss->pcm_buf = audio_calloc (AUDIO_FUNC, VAR_0->samples, 1 << VAR_0->info.shift);",
"if (!oss->pcm_buf) {",
"dolog (\"Could not allocate ADC buffer (%d samples, each %d bytes)\\n\",\nVAR_0->samples, 1 << VAR_0->info.shift);",
"oss_anal_close (&VAR_6);",
"return -1;",
"}",
"oss->VAR_6 = VAR_6;",
"return 0;",
"}"
]
| [
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65
],
[
67
],
[
69
],
[
73
],
[
75,
77
],
[
79
],
[
83
],
[
85
],
[
87
],
[
89,
91
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103
],
[
105
]
]
|
15,626 | int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
{
int i;
int usesVFilter, usesHFilter;
int unscaled;
SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
int srcW= c->srcW;
int srcH= c->srcH;
int dstW= c->dstW;
int dstH= c->dstH;
int dst_stride = FFALIGN(dstW * sizeof(int16_t) + 16, 16), dst_stride_px = dst_stride >> 1;
int flags, cpu_flags;
enum PixelFormat srcFormat= c->srcFormat;
enum PixelFormat dstFormat= c->dstFormat;
cpu_flags = av_get_cpu_flags();
flags = c->flags;
emms_c();
if (!rgb15to16) sws_rgb2rgb_init();
unscaled = (srcW == dstW && srcH == dstH);
if (!isSupportedIn(srcFormat)) {
av_log(c, AV_LOG_ERROR, "%s is not supported as input pixel format\n", sws_format_name(srcFormat));
return AVERROR(EINVAL);
}
if (!isSupportedOut(dstFormat)) {
av_log(c, AV_LOG_ERROR, "%s is not supported as output pixel format\n", sws_format_name(dstFormat));
return AVERROR(EINVAL);
}
i= flags & ( SWS_POINT
|SWS_AREA
|SWS_BILINEAR
|SWS_FAST_BILINEAR
|SWS_BICUBIC
|SWS_X
|SWS_GAUSS
|SWS_LANCZOS
|SWS_SINC
|SWS_SPLINE
|SWS_BICUBLIN);
if(!i || (i & (i-1))) {
av_log(c, AV_LOG_ERROR, "Exactly one scaler algorithm must be chosen\n");
return AVERROR(EINVAL);
}
/* sanity check */
if (srcW<4 || srcH<1 || dstW<8 || dstH<1) { //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code
av_log(c, AV_LOG_ERROR, "%dx%d -> %dx%d is invalid scaling dimension\n",
srcW, srcH, dstW, dstH);
return AVERROR(EINVAL);
}
if (!dstFilter) dstFilter= &dummyFilter;
if (!srcFilter) srcFilter= &dummyFilter;
c->lumXInc= ((srcW<<16) + (dstW>>1))/dstW;
c->lumYInc= ((srcH<<16) + (dstH>>1))/dstH;
c->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[dstFormat]);
c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[srcFormat]);
c->vRounder= 4* 0x0001000100010001ULL;
usesVFilter = (srcFilter->lumV && srcFilter->lumV->length>1) ||
(srcFilter->chrV && srcFilter->chrV->length>1) ||
(dstFilter->lumV && dstFilter->lumV->length>1) ||
(dstFilter->chrV && dstFilter->chrV->length>1);
usesHFilter = (srcFilter->lumH && srcFilter->lumH->length>1) ||
(srcFilter->chrH && srcFilter->chrH->length>1) ||
(dstFilter->lumH && dstFilter->lumH->length>1) ||
(dstFilter->chrH && dstFilter->chrH->length>1);
getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat);
getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
// reuse chroma for 2 pixels RGB/BGR unless user wants full chroma interpolation
if (flags & SWS_FULL_CHR_H_INT &&
dstFormat != PIX_FMT_RGBA &&
dstFormat != PIX_FMT_ARGB &&
dstFormat != PIX_FMT_BGRA &&
dstFormat != PIX_FMT_ABGR &&
dstFormat != PIX_FMT_RGB24 &&
dstFormat != PIX_FMT_BGR24) {
av_log(c, AV_LOG_ERROR,
"full chroma interpolation for destination format '%s' not yet implemented\n",
sws_format_name(dstFormat));
flags &= ~SWS_FULL_CHR_H_INT;
c->flags = flags;
}
if (isAnyRGB(dstFormat) && !(flags&SWS_FULL_CHR_H_INT)) c->chrDstHSubSample=1;
// drop some chroma lines if the user wants it
c->vChrDrop= (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;
c->chrSrcVSubSample+= c->vChrDrop;
// drop every other pixel for chroma calculation unless user wants full chroma
if (isAnyRGB(srcFormat) && !(flags&SWS_FULL_CHR_H_INP)
&& srcFormat!=PIX_FMT_RGB8 && srcFormat!=PIX_FMT_BGR8
&& srcFormat!=PIX_FMT_RGB4 && srcFormat!=PIX_FMT_BGR4
&& srcFormat!=PIX_FMT_RGB4_BYTE && srcFormat!=PIX_FMT_BGR4_BYTE
&& ((dstW>>c->chrDstHSubSample) <= (srcW>>1) || (flags&SWS_FAST_BILINEAR)))
c->chrSrcHSubSample=1;
// Note the -((-x)>>y) is so that we always round toward +inf.
c->chrSrcW= -((-srcW) >> c->chrSrcHSubSample);
c->chrSrcH= -((-srcH) >> c->chrSrcVSubSample);
c->chrDstW= -((-dstW) >> c->chrDstHSubSample);
c->chrDstH= -((-dstH) >> c->chrDstVSubSample);
/* unscaled special cases */
if (unscaled && !usesHFilter && !usesVFilter && (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) {
ff_get_unscaled_swscale(c);
if (c->swScale) {
if (flags&SWS_PRINT_INFO)
av_log(c, AV_LOG_INFO, "using unscaled %s -> %s special converter\n",
sws_format_name(srcFormat), sws_format_name(dstFormat));
return 0;
}
}
c->scalingBpp = FFMAX(av_pix_fmt_descriptors[srcFormat].comp[0].depth_minus1,
av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1) >= 8 ? 16 : 8;
if (c->scalingBpp == 16)
dst_stride <<= 1;
FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW, 16) * 2 * c->scalingBpp >> 3, fail);
if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2 && c->scalingBpp == 8) {
c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0;
if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) {
if (flags&SWS_PRINT_INFO)
av_log(c, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n");
}
if (usesHFilter) c->canMMX2BeUsed=0;
}
else
c->canMMX2BeUsed=0;
c->chrXInc= ((c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW;
c->chrYInc= ((c->chrSrcH<<16) + (c->chrDstH>>1))/c->chrDstH;
// match pixel 0 of the src to pixel 0 of dst and match pixel n-2 of src to pixel n-2 of dst
// but only for the FAST_BILINEAR mode otherwise do correct scaling
// n-2 is the last chrominance sample available
// this is not perfect, but no one should notice the difference, the more correct variant
// would be like the vertical one, but that would require some special code for the
// first and last pixel
if (flags&SWS_FAST_BILINEAR) {
if (c->canMMX2BeUsed) {
c->lumXInc+= 20;
c->chrXInc+= 20;
}
//we don't use the x86 asm scaler if MMX is available
else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) {
c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20;
c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20;
}
}
/* precalculate horizontal scaler filter coefficients */
{
#if HAVE_MMX2
// can't downscale !!!
if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) {
c->lumMmx2FilterCodeSize = initMMX2HScaler( dstW, c->lumXInc, NULL, NULL, NULL, 8);
c->chrMmx2FilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc, NULL, NULL, NULL, 4);
#ifdef MAP_ANONYMOUS
c->lumMmx2FilterCode = mmap(NULL, c->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
c->chrMmx2FilterCode = mmap(NULL, c->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
#elif HAVE_VIRTUALALLOC
c->lumMmx2FilterCode = VirtualAlloc(NULL, c->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
c->chrMmx2FilterCode = VirtualAlloc(NULL, c->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#else
c->lumMmx2FilterCode = av_malloc(c->lumMmx2FilterCodeSize);
c->chrMmx2FilterCode = av_malloc(c->chrMmx2FilterCodeSize);
#endif
if (!c->lumMmx2FilterCode || !c->chrMmx2FilterCode)
return AVERROR(ENOMEM);
FF_ALLOCZ_OR_GOTO(c, c->hLumFilter , (dstW /8+8)*sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(c, c->hChrFilter , (c->chrDstW /4+8)*sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(c, c->hLumFilterPos, (dstW /2/8+8)*sizeof(int32_t), fail);
FF_ALLOCZ_OR_GOTO(c, c->hChrFilterPos, (c->chrDstW/2/4+8)*sizeof(int32_t), fail);
initMMX2HScaler( dstW, c->lumXInc, c->lumMmx2FilterCode, c->hLumFilter, c->hLumFilterPos, 8);
initMMX2HScaler(c->chrDstW, c->chrXInc, c->chrMmx2FilterCode, c->hChrFilter, c->hChrFilterPos, 4);
#ifdef MAP_ANONYMOUS
mprotect(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
mprotect(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
#endif
} else
#endif /* HAVE_MMX2 */
{
const int filterAlign=
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 4 :
(HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 :
1;
if (initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc,
srcW , dstW, filterAlign, 1<<14,
(flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags, cpu_flags,
srcFilter->lumH, dstFilter->lumH, c->param) < 0)
goto fail;
if (initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc,
c->chrSrcW, c->chrDstW, filterAlign, 1<<14,
(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, cpu_flags,
srcFilter->chrH, dstFilter->chrH, c->param) < 0)
goto fail;
}
} // initialize horizontal stuff
/* precalculate vertical scaler filter coefficients */
{
const int filterAlign=
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) && (flags & SWS_ACCURATE_RND) ? 2 :
(HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 :
1;
if (initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc,
srcH , dstH, filterAlign, (1<<12),
(flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags, cpu_flags,
srcFilter->lumV, dstFilter->lumV, c->param) < 0)
goto fail;
if (initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc,
c->chrSrcH, c->chrDstH, filterAlign, (1<<12),
(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, cpu_flags,
srcFilter->chrV, dstFilter->chrV, c->param) < 0)
goto fail;
#if HAVE_ALTIVEC
FF_ALLOC_OR_GOTO(c, c->vYCoeffsBank, sizeof (vector signed short)*c->vLumFilterSize*c->dstH, fail);
FF_ALLOC_OR_GOTO(c, c->vCCoeffsBank, sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH, fail);
for (i=0;i<c->vLumFilterSize*c->dstH;i++) {
int j;
short *p = (short *)&c->vYCoeffsBank[i];
for (j=0;j<8;j++)
p[j] = c->vLumFilter[i];
}
for (i=0;i<c->vChrFilterSize*c->chrDstH;i++) {
int j;
short *p = (short *)&c->vCCoeffsBank[i];
for (j=0;j<8;j++)
p[j] = c->vChrFilter[i];
}
#endif
}
// calculate buffer sizes so that they won't run out while handling these damn slices
c->vLumBufSize= c->vLumFilterSize;
c->vChrBufSize= c->vChrFilterSize;
for (i=0; i<dstH; i++) {
int chrI= i*c->chrDstH / dstH;
int nextSlice= FFMAX(c->vLumFilterPos[i ] + c->vLumFilterSize - 1,
((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)<<c->chrSrcVSubSample));
nextSlice>>= c->chrSrcVSubSample;
nextSlice<<= c->chrSrcVSubSample;
if (c->vLumFilterPos[i ] + c->vLumBufSize < nextSlice)
c->vLumBufSize= nextSlice - c->vLumFilterPos[i];
if (c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>c->chrSrcVSubSample))
c->vChrBufSize= (nextSlice>>c->chrSrcVSubSample) - c->vChrFilterPos[chrI];
}
// allocate pixbufs (we use dynamic allocation because otherwise we would need to
// allocate several megabytes to handle all possible cases)
FF_ALLOC_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail);
FF_ALLOC_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail);
FF_ALLOC_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail);
if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat))
FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail);
//Note we need at least one pixel more at the end because of the MMX code (just in case someone wanna replace the 4000/8000)
/* align at 16 bytes for AltiVec */
for (i=0; i<c->vLumBufSize; i++) {
FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], dst_stride+1, fail);
c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize];
}
c->uv_off_px = dst_stride_px;
c->uv_off_byte = dst_stride;
for (i=0; i<c->vChrBufSize; i++) {
FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], dst_stride*2+1, fail);
c->chrUPixBuf[i] = c->chrUPixBuf[i+c->vChrBufSize];
c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + (dst_stride >> 1);
}
if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
for (i=0; i<c->vLumBufSize; i++) {
FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], dst_stride+1, fail);
c->alpPixBuf[i] = c->alpPixBuf[i+c->vLumBufSize];
}
//try to avoid drawing green stuff between the right end and the stride end
for (i=0; i<c->vChrBufSize; i++)
memset(c->chrUPixBuf[i], 64, dst_stride*2+1);
assert(c->chrDstH <= dstH);
if (flags&SWS_PRINT_INFO) {
if (flags&SWS_FAST_BILINEAR) av_log(c, AV_LOG_INFO, "FAST_BILINEAR scaler, ");
else if (flags&SWS_BILINEAR) av_log(c, AV_LOG_INFO, "BILINEAR scaler, ");
else if (flags&SWS_BICUBIC) av_log(c, AV_LOG_INFO, "BICUBIC scaler, ");
else if (flags&SWS_X) av_log(c, AV_LOG_INFO, "Experimental scaler, ");
else if (flags&SWS_POINT) av_log(c, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, ");
else if (flags&SWS_AREA) av_log(c, AV_LOG_INFO, "Area Averaging scaler, ");
else if (flags&SWS_BICUBLIN) av_log(c, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, ");
else if (flags&SWS_GAUSS) av_log(c, AV_LOG_INFO, "Gaussian scaler, ");
else if (flags&SWS_SINC) av_log(c, AV_LOG_INFO, "Sinc scaler, ");
else if (flags&SWS_LANCZOS) av_log(c, AV_LOG_INFO, "Lanczos scaler, ");
else if (flags&SWS_SPLINE) av_log(c, AV_LOG_INFO, "Bicubic spline scaler, ");
else av_log(c, AV_LOG_INFO, "ehh flags invalid?! ");
av_log(c, AV_LOG_INFO, "from %s to %s%s ",
sws_format_name(srcFormat),
#ifdef DITHER1XBPP
dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 ||
dstFormat == PIX_FMT_RGB444BE || dstFormat == PIX_FMT_RGB444LE ||
dstFormat == PIX_FMT_BGR444BE || dstFormat == PIX_FMT_BGR444LE ? "dithered " : "",
#else
"",
#endif
sws_format_name(dstFormat));
if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) av_log(c, AV_LOG_INFO, "using MMX2\n");
else if (HAVE_AMD3DNOW && cpu_flags & AV_CPU_FLAG_3DNOW) av_log(c, AV_LOG_INFO, "using 3DNOW\n");
else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) av_log(c, AV_LOG_INFO, "using MMX\n");
else if (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) av_log(c, AV_LOG_INFO, "using AltiVec\n");
else av_log(c, AV_LOG_INFO, "using C\n");
if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) {
if (c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR))
av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
else {
if (c->hLumFilterSize==4)
av_log(c, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal luminance scaling\n");
else if (c->hLumFilterSize==8)
av_log(c, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal luminance scaling\n");
else
av_log(c, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal luminance scaling\n");
if (c->hChrFilterSize==4)
av_log(c, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal chrominance scaling\n");
else if (c->hChrFilterSize==8)
av_log(c, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal chrominance scaling\n");
else
av_log(c, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal chrominance scaling\n");
}
} else {
#if HAVE_MMX
av_log(c, AV_LOG_VERBOSE, "using x86 asm scaler for horizontal scaling\n");
#else
if (flags & SWS_FAST_BILINEAR)
av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR C scaler for horizontal scaling\n");
else
av_log(c, AV_LOG_VERBOSE, "using C scaler for horizontal scaling\n");
#endif
}
if (isPlanarYUV(dstFormat)) {
if (c->vLumFilterSize==1)
av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else
av_log(c, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (YV12 like)\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
} else {
if (c->vLumFilterSize==1 && c->vChrFilterSize==2)
av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
" 2-tap scaler for vertical chrominance scaling (BGR)\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else if (c->vLumFilterSize==2 && c->vChrFilterSize==2)
av_log(c, AV_LOG_VERBOSE, "using 2-tap linear %s scaler for vertical scaling (BGR)\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else
av_log(c, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (BGR)\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
}
if (dstFormat==PIX_FMT_BGR24)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR24 converter\n",
(HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) ? "MMX2" :
((HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C"));
else if (dstFormat==PIX_FMT_RGB32)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR32 converter\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else if (dstFormat==PIX_FMT_BGR565)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR16 converter\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else if (dstFormat==PIX_FMT_BGR555)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR15 converter\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else if (dstFormat == PIX_FMT_RGB444BE || dstFormat == PIX_FMT_RGB444LE ||
dstFormat == PIX_FMT_BGR444BE || dstFormat == PIX_FMT_BGR444LE)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR12 converter\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
av_log(c, AV_LOG_DEBUG, "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc);
av_log(c, AV_LOG_DEBUG, "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc);
}
c->swScale= ff_getSwsFunc(c);
return 0;
fail: //FIXME replace things by appropriate error codes
return -1;
}
| true | FFmpeg | baba2eedacbbaecf55bdb89dbfe32c69799df99f | int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
{
int i;
int usesVFilter, usesHFilter;
int unscaled;
SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
int srcW= c->srcW;
int srcH= c->srcH;
int dstW= c->dstW;
int dstH= c->dstH;
int dst_stride = FFALIGN(dstW * sizeof(int16_t) + 16, 16), dst_stride_px = dst_stride >> 1;
int flags, cpu_flags;
enum PixelFormat srcFormat= c->srcFormat;
enum PixelFormat dstFormat= c->dstFormat;
cpu_flags = av_get_cpu_flags();
flags = c->flags;
emms_c();
if (!rgb15to16) sws_rgb2rgb_init();
unscaled = (srcW == dstW && srcH == dstH);
if (!isSupportedIn(srcFormat)) {
av_log(c, AV_LOG_ERROR, "%s is not supported as input pixel format\n", sws_format_name(srcFormat));
return AVERROR(EINVAL);
}
if (!isSupportedOut(dstFormat)) {
av_log(c, AV_LOG_ERROR, "%s is not supported as output pixel format\n", sws_format_name(dstFormat));
return AVERROR(EINVAL);
}
i= flags & ( SWS_POINT
|SWS_AREA
|SWS_BILINEAR
|SWS_FAST_BILINEAR
|SWS_BICUBIC
|SWS_X
|SWS_GAUSS
|SWS_LANCZOS
|SWS_SINC
|SWS_SPLINE
|SWS_BICUBLIN);
if(!i || (i & (i-1))) {
av_log(c, AV_LOG_ERROR, "Exactly one scaler algorithm must be chosen\n");
return AVERROR(EINVAL);
}
if (srcW<4 || srcH<1 || dstW<8 || dstH<1) {
av_log(c, AV_LOG_ERROR, "%dx%d -> %dx%d is invalid scaling dimension\n",
srcW, srcH, dstW, dstH);
return AVERROR(EINVAL);
}
if (!dstFilter) dstFilter= &dummyFilter;
if (!srcFilter) srcFilter= &dummyFilter;
c->lumXInc= ((srcW<<16) + (dstW>>1))/dstW;
c->lumYInc= ((srcH<<16) + (dstH>>1))/dstH;
c->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[dstFormat]);
c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[srcFormat]);
c->vRounder= 4* 0x0001000100010001ULL;
usesVFilter = (srcFilter->lumV && srcFilter->lumV->length>1) ||
(srcFilter->chrV && srcFilter->chrV->length>1) ||
(dstFilter->lumV && dstFilter->lumV->length>1) ||
(dstFilter->chrV && dstFilter->chrV->length>1);
usesHFilter = (srcFilter->lumH && srcFilter->lumH->length>1) ||
(srcFilter->chrH && srcFilter->chrH->length>1) ||
(dstFilter->lumH && dstFilter->lumH->length>1) ||
(dstFilter->chrH && dstFilter->chrH->length>1);
getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat);
getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
if (flags & SWS_FULL_CHR_H_INT &&
dstFormat != PIX_FMT_RGBA &&
dstFormat != PIX_FMT_ARGB &&
dstFormat != PIX_FMT_BGRA &&
dstFormat != PIX_FMT_ABGR &&
dstFormat != PIX_FMT_RGB24 &&
dstFormat != PIX_FMT_BGR24) {
av_log(c, AV_LOG_ERROR,
"full chroma interpolation for destination format '%s' not yet implemented\n",
sws_format_name(dstFormat));
flags &= ~SWS_FULL_CHR_H_INT;
c->flags = flags;
}
if (isAnyRGB(dstFormat) && !(flags&SWS_FULL_CHR_H_INT)) c->chrDstHSubSample=1;
c->vChrDrop= (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;
c->chrSrcVSubSample+= c->vChrDrop;
if (isAnyRGB(srcFormat) && !(flags&SWS_FULL_CHR_H_INP)
&& srcFormat!=PIX_FMT_RGB8 && srcFormat!=PIX_FMT_BGR8
&& srcFormat!=PIX_FMT_RGB4 && srcFormat!=PIX_FMT_BGR4
&& srcFormat!=PIX_FMT_RGB4_BYTE && srcFormat!=PIX_FMT_BGR4_BYTE
&& ((dstW>>c->chrDstHSubSample) <= (srcW>>1) || (flags&SWS_FAST_BILINEAR)))
c->chrSrcHSubSample=1;
c->chrSrcW= -((-srcW) >> c->chrSrcHSubSample);
c->chrSrcH= -((-srcH) >> c->chrSrcVSubSample);
c->chrDstW= -((-dstW) >> c->chrDstHSubSample);
c->chrDstH= -((-dstH) >> c->chrDstVSubSample);
if (unscaled && !usesHFilter && !usesVFilter && (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) {
ff_get_unscaled_swscale(c);
if (c->swScale) {
if (flags&SWS_PRINT_INFO)
av_log(c, AV_LOG_INFO, "using unscaled %s -> %s special converter\n",
sws_format_name(srcFormat), sws_format_name(dstFormat));
return 0;
}
}
c->scalingBpp = FFMAX(av_pix_fmt_descriptors[srcFormat].comp[0].depth_minus1,
av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1) >= 8 ? 16 : 8;
if (c->scalingBpp == 16)
dst_stride <<= 1;
FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW, 16) * 2 * c->scalingBpp >> 3, fail);
if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2 && c->scalingBpp == 8) {
c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0;
if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) {
if (flags&SWS_PRINT_INFO)
av_log(c, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n");
}
if (usesHFilter) c->canMMX2BeUsed=0;
}
else
c->canMMX2BeUsed=0;
c->chrXInc= ((c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW;
c->chrYInc= ((c->chrSrcH<<16) + (c->chrDstH>>1))/c->chrDstH;
if (flags&SWS_FAST_BILINEAR) {
if (c->canMMX2BeUsed) {
c->lumXInc+= 20;
c->chrXInc+= 20;
}
else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) {
c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20;
c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20;
}
}
{
#if HAVE_MMX2
if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) {
c->lumMmx2FilterCodeSize = initMMX2HScaler( dstW, c->lumXInc, NULL, NULL, NULL, 8);
c->chrMmx2FilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc, NULL, NULL, NULL, 4);
#ifdef MAP_ANONYMOUS
c->lumMmx2FilterCode = mmap(NULL, c->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
c->chrMmx2FilterCode = mmap(NULL, c->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
#elif HAVE_VIRTUALALLOC
c->lumMmx2FilterCode = VirtualAlloc(NULL, c->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
c->chrMmx2FilterCode = VirtualAlloc(NULL, c->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#else
c->lumMmx2FilterCode = av_malloc(c->lumMmx2FilterCodeSize);
c->chrMmx2FilterCode = av_malloc(c->chrMmx2FilterCodeSize);
#endif
if (!c->lumMmx2FilterCode || !c->chrMmx2FilterCode)
return AVERROR(ENOMEM);
FF_ALLOCZ_OR_GOTO(c, c->hLumFilter , (dstW /8+8)*sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(c, c->hChrFilter , (c->chrDstW /4+8)*sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(c, c->hLumFilterPos, (dstW /2/8+8)*sizeof(int32_t), fail);
FF_ALLOCZ_OR_GOTO(c, c->hChrFilterPos, (c->chrDstW/2/4+8)*sizeof(int32_t), fail);
initMMX2HScaler( dstW, c->lumXInc, c->lumMmx2FilterCode, c->hLumFilter, c->hLumFilterPos, 8);
initMMX2HScaler(c->chrDstW, c->chrXInc, c->chrMmx2FilterCode, c->hChrFilter, c->hChrFilterPos, 4);
#ifdef MAP_ANONYMOUS
mprotect(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
mprotect(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
#endif
} else
#endif
{
const int filterAlign=
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 4 :
(HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 :
1;
if (initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc,
srcW , dstW, filterAlign, 1<<14,
(flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags, cpu_flags,
srcFilter->lumH, dstFilter->lumH, c->param) < 0)
goto fail;
if (initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc,
c->chrSrcW, c->chrDstW, filterAlign, 1<<14,
(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, cpu_flags,
srcFilter->chrH, dstFilter->chrH, c->param) < 0)
goto fail;
}
}
{
const int filterAlign=
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) && (flags & SWS_ACCURATE_RND) ? 2 :
(HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 :
1;
if (initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc,
srcH , dstH, filterAlign, (1<<12),
(flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags, cpu_flags,
srcFilter->lumV, dstFilter->lumV, c->param) < 0)
goto fail;
if (initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc,
c->chrSrcH, c->chrDstH, filterAlign, (1<<12),
(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, cpu_flags,
srcFilter->chrV, dstFilter->chrV, c->param) < 0)
goto fail;
#if HAVE_ALTIVEC
FF_ALLOC_OR_GOTO(c, c->vYCoeffsBank, sizeof (vector signed short)*c->vLumFilterSize*c->dstH, fail);
FF_ALLOC_OR_GOTO(c, c->vCCoeffsBank, sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH, fail);
for (i=0;i<c->vLumFilterSize*c->dstH;i++) {
int j;
short *p = (short *)&c->vYCoeffsBank[i];
for (j=0;j<8;j++)
p[j] = c->vLumFilter[i];
}
for (i=0;i<c->vChrFilterSize*c->chrDstH;i++) {
int j;
short *p = (short *)&c->vCCoeffsBank[i];
for (j=0;j<8;j++)
p[j] = c->vChrFilter[i];
}
#endif
}
c->vLumBufSize= c->vLumFilterSize;
c->vChrBufSize= c->vChrFilterSize;
for (i=0; i<dstH; i++) {
int chrI= i*c->chrDstH / dstH;
int nextSlice= FFMAX(c->vLumFilterPos[i ] + c->vLumFilterSize - 1,
((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)<<c->chrSrcVSubSample));
nextSlice>>= c->chrSrcVSubSample;
nextSlice<<= c->chrSrcVSubSample;
if (c->vLumFilterPos[i ] + c->vLumBufSize < nextSlice)
c->vLumBufSize= nextSlice - c->vLumFilterPos[i];
if (c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>c->chrSrcVSubSample))
c->vChrBufSize= (nextSlice>>c->chrSrcVSubSample) - c->vChrFilterPos[chrI];
}
FF_ALLOC_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail);
FF_ALLOC_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail);
FF_ALLOC_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail);
if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat))
FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail);
for (i=0; i<c->vLumBufSize; i++) {
FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], dst_stride+1, fail);
c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize];
}
c->uv_off_px = dst_stride_px;
c->uv_off_byte = dst_stride;
for (i=0; i<c->vChrBufSize; i++) {
FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], dst_stride*2+1, fail);
c->chrUPixBuf[i] = c->chrUPixBuf[i+c->vChrBufSize];
c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + (dst_stride >> 1);
}
if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
for (i=0; i<c->vLumBufSize; i++) {
FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], dst_stride+1, fail);
c->alpPixBuf[i] = c->alpPixBuf[i+c->vLumBufSize];
}
for (i=0; i<c->vChrBufSize; i++)
memset(c->chrUPixBuf[i], 64, dst_stride*2+1);
assert(c->chrDstH <= dstH);
if (flags&SWS_PRINT_INFO) {
if (flags&SWS_FAST_BILINEAR) av_log(c, AV_LOG_INFO, "FAST_BILINEAR scaler, ");
else if (flags&SWS_BILINEAR) av_log(c, AV_LOG_INFO, "BILINEAR scaler, ");
else if (flags&SWS_BICUBIC) av_log(c, AV_LOG_INFO, "BICUBIC scaler, ");
else if (flags&SWS_X) av_log(c, AV_LOG_INFO, "Experimental scaler, ");
else if (flags&SWS_POINT) av_log(c, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, ");
else if (flags&SWS_AREA) av_log(c, AV_LOG_INFO, "Area Averaging scaler, ");
else if (flags&SWS_BICUBLIN) av_log(c, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, ");
else if (flags&SWS_GAUSS) av_log(c, AV_LOG_INFO, "Gaussian scaler, ");
else if (flags&SWS_SINC) av_log(c, AV_LOG_INFO, "Sinc scaler, ");
else if (flags&SWS_LANCZOS) av_log(c, AV_LOG_INFO, "Lanczos scaler, ");
else if (flags&SWS_SPLINE) av_log(c, AV_LOG_INFO, "Bicubic spline scaler, ");
else av_log(c, AV_LOG_INFO, "ehh flags invalid?! ");
av_log(c, AV_LOG_INFO, "from %s to %s%s ",
sws_format_name(srcFormat),
#ifdef DITHER1XBPP
dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 ||
dstFormat == PIX_FMT_RGB444BE || dstFormat == PIX_FMT_RGB444LE ||
dstFormat == PIX_FMT_BGR444BE || dstFormat == PIX_FMT_BGR444LE ? "dithered " : "",
#else
"",
#endif
sws_format_name(dstFormat));
if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) av_log(c, AV_LOG_INFO, "using MMX2\n");
else if (HAVE_AMD3DNOW && cpu_flags & AV_CPU_FLAG_3DNOW) av_log(c, AV_LOG_INFO, "using 3DNOW\n");
else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) av_log(c, AV_LOG_INFO, "using MMX\n");
else if (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) av_log(c, AV_LOG_INFO, "using AltiVec\n");
else av_log(c, AV_LOG_INFO, "using C\n");
if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) {
if (c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR))
av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
else {
if (c->hLumFilterSize==4)
av_log(c, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal luminance scaling\n");
else if (c->hLumFilterSize==8)
av_log(c, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal luminance scaling\n");
else
av_log(c, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal luminance scaling\n");
if (c->hChrFilterSize==4)
av_log(c, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal chrominance scaling\n");
else if (c->hChrFilterSize==8)
av_log(c, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal chrominance scaling\n");
else
av_log(c, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal chrominance scaling\n");
}
} else {
#if HAVE_MMX
av_log(c, AV_LOG_VERBOSE, "using x86 asm scaler for horizontal scaling\n");
#else
if (flags & SWS_FAST_BILINEAR)
av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR C scaler for horizontal scaling\n");
else
av_log(c, AV_LOG_VERBOSE, "using C scaler for horizontal scaling\n");
#endif
}
if (isPlanarYUV(dstFormat)) {
if (c->vLumFilterSize==1)
av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else
av_log(c, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (YV12 like)\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
} else {
if (c->vLumFilterSize==1 && c->vChrFilterSize==2)
av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
" 2-tap scaler for vertical chrominance scaling (BGR)\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else if (c->vLumFilterSize==2 && c->vChrFilterSize==2)
av_log(c, AV_LOG_VERBOSE, "using 2-tap linear %s scaler for vertical scaling (BGR)\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else
av_log(c, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (BGR)\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
}
if (dstFormat==PIX_FMT_BGR24)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR24 converter\n",
(HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) ? "MMX2" :
((HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C"));
else if (dstFormat==PIX_FMT_RGB32)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR32 converter\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else if (dstFormat==PIX_FMT_BGR565)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR16 converter\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else if (dstFormat==PIX_FMT_BGR555)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR15 converter\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else if (dstFormat == PIX_FMT_RGB444BE || dstFormat == PIX_FMT_RGB444LE ||
dstFormat == PIX_FMT_BGR444BE || dstFormat == PIX_FMT_BGR444LE)
av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR12 converter\n",
(HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? "MMX" : "C");
av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
av_log(c, AV_LOG_DEBUG, "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc);
av_log(c, AV_LOG_DEBUG, "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc);
}
c->swScale= ff_getSwsFunc(c);
return 0;
fail:
return -1;
}
| {
"code": [
" FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], dst_stride+1, fail);",
" c->uv_off_px = dst_stride_px;",
" c->uv_off_byte = dst_stride;",
" FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], dst_stride*2+1, fail);",
" c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + (dst_stride >> 1);",
" FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], dst_stride+1, fail);"
],
"line_no": [
551,
557,
559,
563,
567,
575
]
} | int FUNC_0(SwsContext *VAR_0, SwsFilter *VAR_1, SwsFilter *VAR_2)
{
int VAR_3;
int VAR_4, VAR_5;
int VAR_6;
SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
int VAR_7= VAR_0->VAR_7;
int VAR_8= VAR_0->VAR_8;
int VAR_9= VAR_0->VAR_9;
int VAR_10= VAR_0->VAR_10;
int VAR_11 = FFALIGN(VAR_9 * sizeof(int16_t) + 16, 16), VAR_12 = VAR_11 >> 1;
int VAR_13, VAR_14;
enum PixelFormat VAR_15= VAR_0->VAR_15;
enum PixelFormat VAR_16= VAR_0->VAR_16;
VAR_14 = av_get_cpu_flags();
VAR_13 = VAR_0->VAR_13;
emms_c();
if (!rgb15to16) sws_rgb2rgb_init();
VAR_6 = (VAR_7 == VAR_9 && VAR_8 == VAR_10);
if (!isSupportedIn(VAR_15)) {
av_log(VAR_0, AV_LOG_ERROR, "%s is not supported as input pixel format\n", sws_format_name(VAR_15));
return AVERROR(EINVAL);
}
if (!isSupportedOut(VAR_16)) {
av_log(VAR_0, AV_LOG_ERROR, "%s is not supported as output pixel format\n", sws_format_name(VAR_16));
return AVERROR(EINVAL);
}
VAR_3= VAR_13 & ( SWS_POINT
|SWS_AREA
|SWS_BILINEAR
|SWS_FAST_BILINEAR
|SWS_BICUBIC
|SWS_X
|SWS_GAUSS
|SWS_LANCZOS
|SWS_SINC
|SWS_SPLINE
|SWS_BICUBLIN);
if(!VAR_3 || (VAR_3 & (VAR_3-1))) {
av_log(VAR_0, AV_LOG_ERROR, "Exactly one scaler algorithm must be chosen\n");
return AVERROR(EINVAL);
}
if (VAR_7<4 || VAR_8<1 || VAR_9<8 || VAR_10<1) {
av_log(VAR_0, AV_LOG_ERROR, "%dx%d -> %dx%d is invalid scaling dimension\n",
VAR_7, VAR_8, VAR_9, VAR_10);
return AVERROR(EINVAL);
}
if (!VAR_2) VAR_2= &dummyFilter;
if (!VAR_1) VAR_1= &dummyFilter;
VAR_0->lumXInc= ((VAR_7<<16) + (VAR_9>>1))/VAR_9;
VAR_0->lumYInc= ((VAR_8<<16) + (VAR_10>>1))/VAR_10;
VAR_0->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[VAR_16]);
VAR_0->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[VAR_15]);
VAR_0->vRounder= 4* 0x0001000100010001ULL;
VAR_4 = (VAR_1->lumV && VAR_1->lumV->length>1) ||
(VAR_1->chrV && VAR_1->chrV->length>1) ||
(VAR_2->lumV && VAR_2->lumV->length>1) ||
(VAR_2->chrV && VAR_2->chrV->length>1);
VAR_5 = (VAR_1->lumH && VAR_1->lumH->length>1) ||
(VAR_1->chrH && VAR_1->chrH->length>1) ||
(VAR_2->lumH && VAR_2->lumH->length>1) ||
(VAR_2->chrH && VAR_2->chrH->length>1);
getSubSampleFactors(&VAR_0->chrSrcHSubSample, &VAR_0->chrSrcVSubSample, VAR_15);
getSubSampleFactors(&VAR_0->chrDstHSubSample, &VAR_0->chrDstVSubSample, VAR_16);
if (VAR_13 & SWS_FULL_CHR_H_INT &&
VAR_16 != PIX_FMT_RGBA &&
VAR_16 != PIX_FMT_ARGB &&
VAR_16 != PIX_FMT_BGRA &&
VAR_16 != PIX_FMT_ABGR &&
VAR_16 != PIX_FMT_RGB24 &&
VAR_16 != PIX_FMT_BGR24) {
av_log(VAR_0, AV_LOG_ERROR,
"full chroma interpolation for destination format '%s' not yet implemented\n",
sws_format_name(VAR_16));
VAR_13 &= ~SWS_FULL_CHR_H_INT;
VAR_0->VAR_13 = VAR_13;
}
if (isAnyRGB(VAR_16) && !(VAR_13&SWS_FULL_CHR_H_INT)) VAR_0->chrDstHSubSample=1;
VAR_0->vChrDrop= (VAR_13&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;
VAR_0->chrSrcVSubSample+= VAR_0->vChrDrop;
if (isAnyRGB(VAR_15) && !(VAR_13&SWS_FULL_CHR_H_INP)
&& VAR_15!=PIX_FMT_RGB8 && VAR_15!=PIX_FMT_BGR8
&& VAR_15!=PIX_FMT_RGB4 && VAR_15!=PIX_FMT_BGR4
&& VAR_15!=PIX_FMT_RGB4_BYTE && VAR_15!=PIX_FMT_BGR4_BYTE
&& ((VAR_9>>VAR_0->chrDstHSubSample) <= (VAR_7>>1) || (VAR_13&SWS_FAST_BILINEAR)))
VAR_0->chrSrcHSubSample=1;
VAR_0->chrSrcW= -((-VAR_7) >> VAR_0->chrSrcHSubSample);
VAR_0->chrSrcH= -((-VAR_8) >> VAR_0->chrSrcVSubSample);
VAR_0->chrDstW= -((-VAR_9) >> VAR_0->chrDstHSubSample);
VAR_0->chrDstH= -((-VAR_10) >> VAR_0->chrDstVSubSample);
if (VAR_6 && !VAR_5 && !VAR_4 && (VAR_0->srcRange == VAR_0->dstRange || isAnyRGB(VAR_16))) {
ff_get_unscaled_swscale(VAR_0);
if (VAR_0->swScale) {
if (VAR_13&SWS_PRINT_INFO)
av_log(VAR_0, AV_LOG_INFO, "using VAR_6 %s -> %s special converter\n",
sws_format_name(VAR_15), sws_format_name(VAR_16));
return 0;
}
}
VAR_0->scalingBpp = FFMAX(av_pix_fmt_descriptors[VAR_15].comp[0].depth_minus1,
av_pix_fmt_descriptors[VAR_16].comp[0].depth_minus1) >= 8 ? 16 : 8;
if (VAR_0->scalingBpp == 16)
VAR_11 <<= 1;
FF_ALLOC_OR_GOTO(VAR_0, VAR_0->formatConvBuffer, FFALIGN(VAR_7, 16) * 2 * VAR_0->scalingBpp >> 3, fail);
if (HAVE_MMX2 && VAR_14 & AV_CPU_FLAG_MMX2 && VAR_0->scalingBpp == 8) {
VAR_0->canMMX2BeUsed= (VAR_9 >=VAR_7 && (VAR_9&31)==0 && (VAR_7&15)==0) ? 1 : 0;
if (!VAR_0->canMMX2BeUsed && VAR_9 >=VAR_7 && (VAR_7&15)==0 && (VAR_13&SWS_FAST_BILINEAR)) {
if (VAR_13&SWS_PRINT_INFO)
av_log(VAR_0, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n");
}
if (VAR_5) VAR_0->canMMX2BeUsed=0;
}
else
VAR_0->canMMX2BeUsed=0;
VAR_0->chrXInc= ((VAR_0->chrSrcW<<16) + (VAR_0->chrDstW>>1))/VAR_0->chrDstW;
VAR_0->chrYInc= ((VAR_0->chrSrcH<<16) + (VAR_0->chrDstH>>1))/VAR_0->chrDstH;
if (VAR_13&SWS_FAST_BILINEAR) {
if (VAR_0->canMMX2BeUsed) {
VAR_0->lumXInc+= 20;
VAR_0->chrXInc+= 20;
}
else if (HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) {
VAR_0->lumXInc = ((VAR_7-2)<<16)/(VAR_9-2) - 20;
VAR_0->chrXInc = ((VAR_0->chrSrcW-2)<<16)/(VAR_0->chrDstW-2) - 20;
}
}
{
#if HAVE_MMX2
if (VAR_0->canMMX2BeUsed && (VAR_13 & SWS_FAST_BILINEAR)) {
VAR_0->lumMmx2FilterCodeSize = initMMX2HScaler( VAR_9, VAR_0->lumXInc, NULL, NULL, NULL, 8);
VAR_0->chrMmx2FilterCodeSize = initMMX2HScaler(VAR_0->chrDstW, VAR_0->chrXInc, NULL, NULL, NULL, 4);
#ifdef MAP_ANONYMOUS
VAR_0->lumMmx2FilterCode = mmap(NULL, VAR_0->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
VAR_0->chrMmx2FilterCode = mmap(NULL, VAR_0->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
#elif HAVE_VIRTUALALLOC
VAR_0->lumMmx2FilterCode = VirtualAlloc(NULL, VAR_0->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
VAR_0->chrMmx2FilterCode = VirtualAlloc(NULL, VAR_0->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#else
VAR_0->lumMmx2FilterCode = av_malloc(VAR_0->lumMmx2FilterCodeSize);
VAR_0->chrMmx2FilterCode = av_malloc(VAR_0->chrMmx2FilterCodeSize);
#endif
if (!VAR_0->lumMmx2FilterCode || !VAR_0->chrMmx2FilterCode)
return AVERROR(ENOMEM);
FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hLumFilter , (VAR_9 /8+8)*sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hChrFilter , (VAR_0->chrDstW /4+8)*sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hLumFilterPos, (VAR_9 /2/8+8)*sizeof(int32_t), fail);
FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hChrFilterPos, (VAR_0->chrDstW/2/4+8)*sizeof(int32_t), fail);
initMMX2HScaler( VAR_9, VAR_0->lumXInc, VAR_0->lumMmx2FilterCode, VAR_0->hLumFilter, VAR_0->hLumFilterPos, 8);
initMMX2HScaler(VAR_0->chrDstW, VAR_0->chrXInc, VAR_0->chrMmx2FilterCode, VAR_0->hChrFilter, VAR_0->hChrFilterPos, 4);
#ifdef MAP_ANONYMOUS
mprotect(VAR_0->lumMmx2FilterCode, VAR_0->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
mprotect(VAR_0->chrMmx2FilterCode, VAR_0->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
#endif
} else
#endif
{
const int VAR_18=
(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? 4 :
(HAVE_ALTIVEC && VAR_14 & AV_CPU_FLAG_ALTIVEC) ? 8 :
1;
if (initFilter(&VAR_0->hLumFilter, &VAR_0->hLumFilterPos, &VAR_0->hLumFilterSize, VAR_0->lumXInc,
VAR_7 , VAR_9, VAR_18, 1<<14,
(VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BICUBIC) : VAR_13, VAR_14,
VAR_1->lumH, VAR_2->lumH, VAR_0->param) < 0)
goto fail;
if (initFilter(&VAR_0->hChrFilter, &VAR_0->hChrFilterPos, &VAR_0->hChrFilterSize, VAR_0->chrXInc,
VAR_0->chrSrcW, VAR_0->chrDstW, VAR_18, 1<<14,
(VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BILINEAR) : VAR_13, VAR_14,
VAR_1->chrH, VAR_2->chrH, VAR_0->param) < 0)
goto fail;
}
}
{
const int VAR_18=
(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) && (VAR_13 & SWS_ACCURATE_RND) ? 2 :
(HAVE_ALTIVEC && VAR_14 & AV_CPU_FLAG_ALTIVEC) ? 8 :
1;
if (initFilter(&VAR_0->vLumFilter, &VAR_0->vLumFilterPos, &VAR_0->vLumFilterSize, VAR_0->lumYInc,
VAR_8 , VAR_10, VAR_18, (1<<12),
(VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BICUBIC) : VAR_13, VAR_14,
VAR_1->lumV, VAR_2->lumV, VAR_0->param) < 0)
goto fail;
if (initFilter(&VAR_0->vChrFilter, &VAR_0->vChrFilterPos, &VAR_0->vChrFilterSize, VAR_0->chrYInc,
VAR_0->chrSrcH, VAR_0->chrDstH, VAR_18, (1<<12),
(VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BILINEAR) : VAR_13, VAR_14,
VAR_1->chrV, VAR_2->chrV, VAR_0->param) < 0)
goto fail;
#if HAVE_ALTIVEC
FF_ALLOC_OR_GOTO(VAR_0, VAR_0->vYCoeffsBank, sizeof (vector signed short)*VAR_0->vLumFilterSize*VAR_0->VAR_10, fail);
FF_ALLOC_OR_GOTO(VAR_0, VAR_0->vCCoeffsBank, sizeof (vector signed short)*VAR_0->vChrFilterSize*VAR_0->chrDstH, fail);
for (VAR_3=0;VAR_3<VAR_0->vLumFilterSize*VAR_0->VAR_10;VAR_3++) {
int j;
short *p = (short *)&VAR_0->vYCoeffsBank[VAR_3];
for (j=0;j<8;j++)
p[j] = VAR_0->vLumFilter[VAR_3];
}
for (VAR_3=0;VAR_3<VAR_0->vChrFilterSize*VAR_0->chrDstH;VAR_3++) {
int j;
short *p = (short *)&VAR_0->vCCoeffsBank[VAR_3];
for (j=0;j<8;j++)
p[j] = VAR_0->vChrFilter[VAR_3];
}
#endif
}
VAR_0->vLumBufSize= VAR_0->vLumFilterSize;
VAR_0->vChrBufSize= VAR_0->vChrFilterSize;
for (VAR_3=0; VAR_3<VAR_10; VAR_3++) {
int VAR_18= VAR_3*VAR_0->chrDstH / VAR_10;
int VAR_19= FFMAX(VAR_0->vLumFilterPos[VAR_3 ] + VAR_0->vLumFilterSize - 1,
((VAR_0->vChrFilterPos[VAR_18] + VAR_0->vChrFilterSize - 1)<<VAR_0->chrSrcVSubSample));
VAR_19>>= VAR_0->chrSrcVSubSample;
VAR_19<<= VAR_0->chrSrcVSubSample;
if (VAR_0->vLumFilterPos[VAR_3 ] + VAR_0->vLumBufSize < VAR_19)
VAR_0->vLumBufSize= VAR_19 - VAR_0->vLumFilterPos[VAR_3];
if (VAR_0->vChrFilterPos[VAR_18] + VAR_0->vChrBufSize < (VAR_19>>VAR_0->chrSrcVSubSample))
VAR_0->vChrBufSize= (VAR_19>>VAR_0->chrSrcVSubSample) - VAR_0->vChrFilterPos[VAR_18];
}
FF_ALLOC_OR_GOTO(VAR_0, VAR_0->lumPixBuf, VAR_0->vLumBufSize*2*sizeof(int16_t*), fail);
FF_ALLOC_OR_GOTO(VAR_0, VAR_0->chrUPixBuf, VAR_0->vChrBufSize*2*sizeof(int16_t*), fail);
FF_ALLOC_OR_GOTO(VAR_0, VAR_0->chrVPixBuf, VAR_0->vChrBufSize*2*sizeof(int16_t*), fail);
if (CONFIG_SWSCALE_ALPHA && isALPHA(VAR_0->VAR_15) && isALPHA(VAR_0->VAR_16))
FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->alpPixBuf, VAR_0->vLumBufSize*2*sizeof(int16_t*), fail);
for (VAR_3=0; VAR_3<VAR_0->vLumBufSize; VAR_3++) {
FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->lumPixBuf[VAR_3+VAR_0->vLumBufSize], VAR_11+1, fail);
VAR_0->lumPixBuf[VAR_3] = VAR_0->lumPixBuf[VAR_3+VAR_0->vLumBufSize];
}
VAR_0->uv_off_px = VAR_12;
VAR_0->uv_off_byte = VAR_11;
for (VAR_3=0; VAR_3<VAR_0->vChrBufSize; VAR_3++) {
FF_ALLOC_OR_GOTO(VAR_0, VAR_0->chrUPixBuf[VAR_3+VAR_0->vChrBufSize], VAR_11*2+1, fail);
VAR_0->chrUPixBuf[VAR_3] = VAR_0->chrUPixBuf[VAR_3+VAR_0->vChrBufSize];
VAR_0->chrVPixBuf[VAR_3] = VAR_0->chrVPixBuf[VAR_3+VAR_0->vChrBufSize] = VAR_0->chrUPixBuf[VAR_3] + (VAR_11 >> 1);
}
if (CONFIG_SWSCALE_ALPHA && VAR_0->alpPixBuf)
for (VAR_3=0; VAR_3<VAR_0->vLumBufSize; VAR_3++) {
FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->alpPixBuf[VAR_3+VAR_0->vLumBufSize], VAR_11+1, fail);
VAR_0->alpPixBuf[VAR_3] = VAR_0->alpPixBuf[VAR_3+VAR_0->vLumBufSize];
}
for (VAR_3=0; VAR_3<VAR_0->vChrBufSize; VAR_3++)
memset(VAR_0->chrUPixBuf[VAR_3], 64, VAR_11*2+1);
assert(VAR_0->chrDstH <= VAR_10);
if (VAR_13&SWS_PRINT_INFO) {
if (VAR_13&SWS_FAST_BILINEAR) av_log(VAR_0, AV_LOG_INFO, "FAST_BILINEAR scaler, ");
else if (VAR_13&SWS_BILINEAR) av_log(VAR_0, AV_LOG_INFO, "BILINEAR scaler, ");
else if (VAR_13&SWS_BICUBIC) av_log(VAR_0, AV_LOG_INFO, "BICUBIC scaler, ");
else if (VAR_13&SWS_X) av_log(VAR_0, AV_LOG_INFO, "Experimental scaler, ");
else if (VAR_13&SWS_POINT) av_log(VAR_0, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, ");
else if (VAR_13&SWS_AREA) av_log(VAR_0, AV_LOG_INFO, "Area Averaging scaler, ");
else if (VAR_13&SWS_BICUBLIN) av_log(VAR_0, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, ");
else if (VAR_13&SWS_GAUSS) av_log(VAR_0, AV_LOG_INFO, "Gaussian scaler, ");
else if (VAR_13&SWS_SINC) av_log(VAR_0, AV_LOG_INFO, "Sinc scaler, ");
else if (VAR_13&SWS_LANCZOS) av_log(VAR_0, AV_LOG_INFO, "Lanczos scaler, ");
else if (VAR_13&SWS_SPLINE) av_log(VAR_0, AV_LOG_INFO, "Bicubic spline scaler, ");
else av_log(VAR_0, AV_LOG_INFO, "ehh VAR_13 invalid?! ");
av_log(VAR_0, AV_LOG_INFO, "from %s to %s%s ",
sws_format_name(VAR_15),
#ifdef DITHER1XBPP
VAR_16 == PIX_FMT_BGR555 || VAR_16 == PIX_FMT_BGR565 ||
VAR_16 == PIX_FMT_RGB444BE || VAR_16 == PIX_FMT_RGB444LE ||
VAR_16 == PIX_FMT_BGR444BE || VAR_16 == PIX_FMT_BGR444LE ? "dithered " : "",
#else
"",
#endif
sws_format_name(VAR_16));
if (HAVE_MMX2 && VAR_14 & AV_CPU_FLAG_MMX2) av_log(VAR_0, AV_LOG_INFO, "using MMX2\n");
else if (HAVE_AMD3DNOW && VAR_14 & AV_CPU_FLAG_3DNOW) av_log(VAR_0, AV_LOG_INFO, "using 3DNOW\n");
else if (HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) av_log(VAR_0, AV_LOG_INFO, "using MMX\n");
else if (HAVE_ALTIVEC && VAR_14 & AV_CPU_FLAG_ALTIVEC) av_log(VAR_0, AV_LOG_INFO, "using AltiVec\n");
else av_log(VAR_0, AV_LOG_INFO, "using C\n");
if (HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) {
if (VAR_0->canMMX2BeUsed && (VAR_13&SWS_FAST_BILINEAR))
av_log(VAR_0, AV_LOG_VERBOSE, "using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
else {
if (VAR_0->hLumFilterSize==4)
av_log(VAR_0, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal luminance scaling\n");
else if (VAR_0->hLumFilterSize==8)
av_log(VAR_0, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal luminance scaling\n");
else
av_log(VAR_0, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal luminance scaling\n");
if (VAR_0->hChrFilterSize==4)
av_log(VAR_0, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal chrominance scaling\n");
else if (VAR_0->hChrFilterSize==8)
av_log(VAR_0, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal chrominance scaling\n");
else
av_log(VAR_0, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal chrominance scaling\n");
}
} else {
#if HAVE_MMX
av_log(VAR_0, AV_LOG_VERBOSE, "using x86 asm scaler for horizontal scaling\n");
#else
if (VAR_13 & SWS_FAST_BILINEAR)
av_log(VAR_0, AV_LOG_VERBOSE, "using FAST_BILINEAR C scaler for horizontal scaling\n");
else
av_log(VAR_0, AV_LOG_VERBOSE, "using C scaler for horizontal scaling\n");
#endif
}
if (isPlanarYUV(VAR_16)) {
if (VAR_0->vLumFilterSize==1)
av_log(VAR_0, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n",
(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else
av_log(VAR_0, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (YV12 like)\n",
(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? "MMX" : "C");
} else {
if (VAR_0->vLumFilterSize==1 && VAR_0->vChrFilterSize==2)
av_log(VAR_0, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
" 2-tap scaler for vertical chrominance scaling (BGR)\n",
(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else if (VAR_0->vLumFilterSize==2 && VAR_0->vChrFilterSize==2)
av_log(VAR_0, AV_LOG_VERBOSE, "using 2-tap linear %s scaler for vertical scaling (BGR)\n",
(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else
av_log(VAR_0, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (BGR)\n",
(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? "MMX" : "C");
}
if (VAR_16==PIX_FMT_BGR24)
av_log(VAR_0, AV_LOG_VERBOSE, "using %s YV12->BGR24 converter\n",
(HAVE_MMX2 && VAR_14 & AV_CPU_FLAG_MMX2) ? "MMX2" :
((HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? "MMX" : "C"));
else if (VAR_16==PIX_FMT_RGB32)
av_log(VAR_0, AV_LOG_VERBOSE, "using %s YV12->BGR32 converter\n",
(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else if (VAR_16==PIX_FMT_BGR565)
av_log(VAR_0, AV_LOG_VERBOSE, "using %s YV12->BGR16 converter\n",
(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else if (VAR_16==PIX_FMT_BGR555)
av_log(VAR_0, AV_LOG_VERBOSE, "using %s YV12->BGR15 converter\n",
(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? "MMX" : "C");
else if (VAR_16 == PIX_FMT_RGB444BE || VAR_16 == PIX_FMT_RGB444LE ||
VAR_16 == PIX_FMT_BGR444BE || VAR_16 == PIX_FMT_BGR444LE)
av_log(VAR_0, AV_LOG_VERBOSE, "using %s YV12->BGR12 converter\n",
(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? "MMX" : "C");
av_log(VAR_0, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", VAR_7, VAR_8, VAR_9, VAR_10);
av_log(VAR_0, AV_LOG_DEBUG, "lum VAR_7=%d VAR_8=%d VAR_9=%d VAR_10=%d xInc=%d yInc=%d\n",
VAR_0->VAR_7, VAR_0->VAR_8, VAR_0->VAR_9, VAR_0->VAR_10, VAR_0->lumXInc, VAR_0->lumYInc);
av_log(VAR_0, AV_LOG_DEBUG, "chr VAR_7=%d VAR_8=%d VAR_9=%d VAR_10=%d xInc=%d yInc=%d\n",
VAR_0->chrSrcW, VAR_0->chrSrcH, VAR_0->chrDstW, VAR_0->chrDstH, VAR_0->chrXInc, VAR_0->chrYInc);
}
VAR_0->swScale= ff_getSwsFunc(VAR_0);
return 0;
fail:
return -1;
}
| [
"int FUNC_0(SwsContext *VAR_0, SwsFilter *VAR_1, SwsFilter *VAR_2)\n{",
"int VAR_3;",
"int VAR_4, VAR_5;",
"int VAR_6;",
"SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};",
"int VAR_7= VAR_0->VAR_7;",
"int VAR_8= VAR_0->VAR_8;",
"int VAR_9= VAR_0->VAR_9;",
"int VAR_10= VAR_0->VAR_10;",
"int VAR_11 = FFALIGN(VAR_9 * sizeof(int16_t) + 16, 16), VAR_12 = VAR_11 >> 1;",
"int VAR_13, VAR_14;",
"enum PixelFormat VAR_15= VAR_0->VAR_15;",
"enum PixelFormat VAR_16= VAR_0->VAR_16;",
"VAR_14 = av_get_cpu_flags();",
"VAR_13 = VAR_0->VAR_13;",
"emms_c();",
"if (!rgb15to16) sws_rgb2rgb_init();",
"VAR_6 = (VAR_7 == VAR_9 && VAR_8 == VAR_10);",
"if (!isSupportedIn(VAR_15)) {",
"av_log(VAR_0, AV_LOG_ERROR, \"%s is not supported as input pixel format\\n\", sws_format_name(VAR_15));",
"return AVERROR(EINVAL);",
"}",
"if (!isSupportedOut(VAR_16)) {",
"av_log(VAR_0, AV_LOG_ERROR, \"%s is not supported as output pixel format\\n\", sws_format_name(VAR_16));",
"return AVERROR(EINVAL);",
"}",
"VAR_3= VAR_13 & ( SWS_POINT\n|SWS_AREA\n|SWS_BILINEAR\n|SWS_FAST_BILINEAR\n|SWS_BICUBIC\n|SWS_X\n|SWS_GAUSS\n|SWS_LANCZOS\n|SWS_SINC\n|SWS_SPLINE\n|SWS_BICUBLIN);",
"if(!VAR_3 || (VAR_3 & (VAR_3-1))) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Exactly one scaler algorithm must be chosen\\n\");",
"return AVERROR(EINVAL);",
"}",
"if (VAR_7<4 || VAR_8<1 || VAR_9<8 || VAR_10<1) {",
"av_log(VAR_0, AV_LOG_ERROR, \"%dx%d -> %dx%d is invalid scaling dimension\\n\",\nVAR_7, VAR_8, VAR_9, VAR_10);",
"return AVERROR(EINVAL);",
"}",
"if (!VAR_2) VAR_2= &dummyFilter;",
"if (!VAR_1) VAR_1= &dummyFilter;",
"VAR_0->lumXInc= ((VAR_7<<16) + (VAR_9>>1))/VAR_9;",
"VAR_0->lumYInc= ((VAR_8<<16) + (VAR_10>>1))/VAR_10;",
"VAR_0->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[VAR_16]);",
"VAR_0->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[VAR_15]);",
"VAR_0->vRounder= 4* 0x0001000100010001ULL;",
"VAR_4 = (VAR_1->lumV && VAR_1->lumV->length>1) ||\n(VAR_1->chrV && VAR_1->chrV->length>1) ||\n(VAR_2->lumV && VAR_2->lumV->length>1) ||\n(VAR_2->chrV && VAR_2->chrV->length>1);",
"VAR_5 = (VAR_1->lumH && VAR_1->lumH->length>1) ||\n(VAR_1->chrH && VAR_1->chrH->length>1) ||\n(VAR_2->lumH && VAR_2->lumH->length>1) ||\n(VAR_2->chrH && VAR_2->chrH->length>1);",
"getSubSampleFactors(&VAR_0->chrSrcHSubSample, &VAR_0->chrSrcVSubSample, VAR_15);",
"getSubSampleFactors(&VAR_0->chrDstHSubSample, &VAR_0->chrDstVSubSample, VAR_16);",
"if (VAR_13 & SWS_FULL_CHR_H_INT &&\nVAR_16 != PIX_FMT_RGBA &&\nVAR_16 != PIX_FMT_ARGB &&\nVAR_16 != PIX_FMT_BGRA &&\nVAR_16 != PIX_FMT_ABGR &&\nVAR_16 != PIX_FMT_RGB24 &&\nVAR_16 != PIX_FMT_BGR24) {",
"av_log(VAR_0, AV_LOG_ERROR,\n\"full chroma interpolation for destination format '%s' not yet implemented\\n\",\nsws_format_name(VAR_16));",
"VAR_13 &= ~SWS_FULL_CHR_H_INT;",
"VAR_0->VAR_13 = VAR_13;",
"}",
"if (isAnyRGB(VAR_16) && !(VAR_13&SWS_FULL_CHR_H_INT)) VAR_0->chrDstHSubSample=1;",
"VAR_0->vChrDrop= (VAR_13&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;",
"VAR_0->chrSrcVSubSample+= VAR_0->vChrDrop;",
"if (isAnyRGB(VAR_15) && !(VAR_13&SWS_FULL_CHR_H_INP)\n&& VAR_15!=PIX_FMT_RGB8 && VAR_15!=PIX_FMT_BGR8\n&& VAR_15!=PIX_FMT_RGB4 && VAR_15!=PIX_FMT_BGR4\n&& VAR_15!=PIX_FMT_RGB4_BYTE && VAR_15!=PIX_FMT_BGR4_BYTE\n&& ((VAR_9>>VAR_0->chrDstHSubSample) <= (VAR_7>>1) || (VAR_13&SWS_FAST_BILINEAR)))\nVAR_0->chrSrcHSubSample=1;",
"VAR_0->chrSrcW= -((-VAR_7) >> VAR_0->chrSrcHSubSample);",
"VAR_0->chrSrcH= -((-VAR_8) >> VAR_0->chrSrcVSubSample);",
"VAR_0->chrDstW= -((-VAR_9) >> VAR_0->chrDstHSubSample);",
"VAR_0->chrDstH= -((-VAR_10) >> VAR_0->chrDstVSubSample);",
"if (VAR_6 && !VAR_5 && !VAR_4 && (VAR_0->srcRange == VAR_0->dstRange || isAnyRGB(VAR_16))) {",
"ff_get_unscaled_swscale(VAR_0);",
"if (VAR_0->swScale) {",
"if (VAR_13&SWS_PRINT_INFO)\nav_log(VAR_0, AV_LOG_INFO, \"using VAR_6 %s -> %s special converter\\n\",\nsws_format_name(VAR_15), sws_format_name(VAR_16));",
"return 0;",
"}",
"}",
"VAR_0->scalingBpp = FFMAX(av_pix_fmt_descriptors[VAR_15].comp[0].depth_minus1,\nav_pix_fmt_descriptors[VAR_16].comp[0].depth_minus1) >= 8 ? 16 : 8;",
"if (VAR_0->scalingBpp == 16)\nVAR_11 <<= 1;",
"FF_ALLOC_OR_GOTO(VAR_0, VAR_0->formatConvBuffer, FFALIGN(VAR_7, 16) * 2 * VAR_0->scalingBpp >> 3, fail);",
"if (HAVE_MMX2 && VAR_14 & AV_CPU_FLAG_MMX2 && VAR_0->scalingBpp == 8) {",
"VAR_0->canMMX2BeUsed= (VAR_9 >=VAR_7 && (VAR_9&31)==0 && (VAR_7&15)==0) ? 1 : 0;",
"if (!VAR_0->canMMX2BeUsed && VAR_9 >=VAR_7 && (VAR_7&15)==0 && (VAR_13&SWS_FAST_BILINEAR)) {",
"if (VAR_13&SWS_PRINT_INFO)\nav_log(VAR_0, AV_LOG_INFO, \"output width is not a multiple of 32 -> no MMX2 scaler\\n\");",
"}",
"if (VAR_5) VAR_0->canMMX2BeUsed=0;",
"}",
"else\nVAR_0->canMMX2BeUsed=0;",
"VAR_0->chrXInc= ((VAR_0->chrSrcW<<16) + (VAR_0->chrDstW>>1))/VAR_0->chrDstW;",
"VAR_0->chrYInc= ((VAR_0->chrSrcH<<16) + (VAR_0->chrDstH>>1))/VAR_0->chrDstH;",
"if (VAR_13&SWS_FAST_BILINEAR) {",
"if (VAR_0->canMMX2BeUsed) {",
"VAR_0->lumXInc+= 20;",
"VAR_0->chrXInc+= 20;",
"}",
"else if (HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) {",
"VAR_0->lumXInc = ((VAR_7-2)<<16)/(VAR_9-2) - 20;",
"VAR_0->chrXInc = ((VAR_0->chrSrcW-2)<<16)/(VAR_0->chrDstW-2) - 20;",
"}",
"}",
"{",
"#if HAVE_MMX2\nif (VAR_0->canMMX2BeUsed && (VAR_13 & SWS_FAST_BILINEAR)) {",
"VAR_0->lumMmx2FilterCodeSize = initMMX2HScaler( VAR_9, VAR_0->lumXInc, NULL, NULL, NULL, 8);",
"VAR_0->chrMmx2FilterCodeSize = initMMX2HScaler(VAR_0->chrDstW, VAR_0->chrXInc, NULL, NULL, NULL, 4);",
"#ifdef MAP_ANONYMOUS\nVAR_0->lumMmx2FilterCode = mmap(NULL, VAR_0->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);",
"VAR_0->chrMmx2FilterCode = mmap(NULL, VAR_0->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);",
"#elif HAVE_VIRTUALALLOC\nVAR_0->lumMmx2FilterCode = VirtualAlloc(NULL, VAR_0->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);",
"VAR_0->chrMmx2FilterCode = VirtualAlloc(NULL, VAR_0->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);",
"#else\nVAR_0->lumMmx2FilterCode = av_malloc(VAR_0->lumMmx2FilterCodeSize);",
"VAR_0->chrMmx2FilterCode = av_malloc(VAR_0->chrMmx2FilterCodeSize);",
"#endif\nif (!VAR_0->lumMmx2FilterCode || !VAR_0->chrMmx2FilterCode)\nreturn AVERROR(ENOMEM);",
"FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hLumFilter , (VAR_9 /8+8)*sizeof(int16_t), fail);",
"FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hChrFilter , (VAR_0->chrDstW /4+8)*sizeof(int16_t), fail);",
"FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hLumFilterPos, (VAR_9 /2/8+8)*sizeof(int32_t), fail);",
"FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->hChrFilterPos, (VAR_0->chrDstW/2/4+8)*sizeof(int32_t), fail);",
"initMMX2HScaler( VAR_9, VAR_0->lumXInc, VAR_0->lumMmx2FilterCode, VAR_0->hLumFilter, VAR_0->hLumFilterPos, 8);",
"initMMX2HScaler(VAR_0->chrDstW, VAR_0->chrXInc, VAR_0->chrMmx2FilterCode, VAR_0->hChrFilter, VAR_0->hChrFilterPos, 4);",
"#ifdef MAP_ANONYMOUS\nmprotect(VAR_0->lumMmx2FilterCode, VAR_0->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ);",
"mprotect(VAR_0->chrMmx2FilterCode, VAR_0->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ);",
"#endif\n} else",
"#endif\n{",
"const int VAR_18=\n(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? 4 :\n(HAVE_ALTIVEC && VAR_14 & AV_CPU_FLAG_ALTIVEC) ? 8 :\n1;",
"if (initFilter(&VAR_0->hLumFilter, &VAR_0->hLumFilterPos, &VAR_0->hLumFilterSize, VAR_0->lumXInc,\nVAR_7 , VAR_9, VAR_18, 1<<14,\n(VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BICUBIC) : VAR_13, VAR_14,\nVAR_1->lumH, VAR_2->lumH, VAR_0->param) < 0)\ngoto fail;",
"if (initFilter(&VAR_0->hChrFilter, &VAR_0->hChrFilterPos, &VAR_0->hChrFilterSize, VAR_0->chrXInc,\nVAR_0->chrSrcW, VAR_0->chrDstW, VAR_18, 1<<14,\n(VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BILINEAR) : VAR_13, VAR_14,\nVAR_1->chrH, VAR_2->chrH, VAR_0->param) < 0)\ngoto fail;",
"}",
"}",
"{",
"const int VAR_18=\n(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) && (VAR_13 & SWS_ACCURATE_RND) ? 2 :\n(HAVE_ALTIVEC && VAR_14 & AV_CPU_FLAG_ALTIVEC) ? 8 :\n1;",
"if (initFilter(&VAR_0->vLumFilter, &VAR_0->vLumFilterPos, &VAR_0->vLumFilterSize, VAR_0->lumYInc,\nVAR_8 , VAR_10, VAR_18, (1<<12),\n(VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BICUBIC) : VAR_13, VAR_14,\nVAR_1->lumV, VAR_2->lumV, VAR_0->param) < 0)\ngoto fail;",
"if (initFilter(&VAR_0->vChrFilter, &VAR_0->vChrFilterPos, &VAR_0->vChrFilterSize, VAR_0->chrYInc,\nVAR_0->chrSrcH, VAR_0->chrDstH, VAR_18, (1<<12),\n(VAR_13&SWS_BICUBLIN) ? (VAR_13|SWS_BILINEAR) : VAR_13, VAR_14,\nVAR_1->chrV, VAR_2->chrV, VAR_0->param) < 0)\ngoto fail;",
"#if HAVE_ALTIVEC\nFF_ALLOC_OR_GOTO(VAR_0, VAR_0->vYCoeffsBank, sizeof (vector signed short)*VAR_0->vLumFilterSize*VAR_0->VAR_10, fail);",
"FF_ALLOC_OR_GOTO(VAR_0, VAR_0->vCCoeffsBank, sizeof (vector signed short)*VAR_0->vChrFilterSize*VAR_0->chrDstH, fail);",
"for (VAR_3=0;VAR_3<VAR_0->vLumFilterSize*VAR_0->VAR_10;VAR_3++) {",
"int j;",
"short *p = (short *)&VAR_0->vYCoeffsBank[VAR_3];",
"for (j=0;j<8;j++)",
"p[j] = VAR_0->vLumFilter[VAR_3];",
"}",
"for (VAR_3=0;VAR_3<VAR_0->vChrFilterSize*VAR_0->chrDstH;VAR_3++) {",
"int j;",
"short *p = (short *)&VAR_0->vCCoeffsBank[VAR_3];",
"for (j=0;j<8;j++)",
"p[j] = VAR_0->vChrFilter[VAR_3];",
"}",
"#endif\n}",
"VAR_0->vLumBufSize= VAR_0->vLumFilterSize;",
"VAR_0->vChrBufSize= VAR_0->vChrFilterSize;",
"for (VAR_3=0; VAR_3<VAR_10; VAR_3++) {",
"int VAR_18= VAR_3*VAR_0->chrDstH / VAR_10;",
"int VAR_19= FFMAX(VAR_0->vLumFilterPos[VAR_3 ] + VAR_0->vLumFilterSize - 1,\n((VAR_0->vChrFilterPos[VAR_18] + VAR_0->vChrFilterSize - 1)<<VAR_0->chrSrcVSubSample));",
"VAR_19>>= VAR_0->chrSrcVSubSample;",
"VAR_19<<= VAR_0->chrSrcVSubSample;",
"if (VAR_0->vLumFilterPos[VAR_3 ] + VAR_0->vLumBufSize < VAR_19)\nVAR_0->vLumBufSize= VAR_19 - VAR_0->vLumFilterPos[VAR_3];",
"if (VAR_0->vChrFilterPos[VAR_18] + VAR_0->vChrBufSize < (VAR_19>>VAR_0->chrSrcVSubSample))\nVAR_0->vChrBufSize= (VAR_19>>VAR_0->chrSrcVSubSample) - VAR_0->vChrFilterPos[VAR_18];",
"}",
"FF_ALLOC_OR_GOTO(VAR_0, VAR_0->lumPixBuf, VAR_0->vLumBufSize*2*sizeof(int16_t*), fail);",
"FF_ALLOC_OR_GOTO(VAR_0, VAR_0->chrUPixBuf, VAR_0->vChrBufSize*2*sizeof(int16_t*), fail);",
"FF_ALLOC_OR_GOTO(VAR_0, VAR_0->chrVPixBuf, VAR_0->vChrBufSize*2*sizeof(int16_t*), fail);",
"if (CONFIG_SWSCALE_ALPHA && isALPHA(VAR_0->VAR_15) && isALPHA(VAR_0->VAR_16))\nFF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->alpPixBuf, VAR_0->vLumBufSize*2*sizeof(int16_t*), fail);",
"for (VAR_3=0; VAR_3<VAR_0->vLumBufSize; VAR_3++) {",
"FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->lumPixBuf[VAR_3+VAR_0->vLumBufSize], VAR_11+1, fail);",
"VAR_0->lumPixBuf[VAR_3] = VAR_0->lumPixBuf[VAR_3+VAR_0->vLumBufSize];",
"}",
"VAR_0->uv_off_px = VAR_12;",
"VAR_0->uv_off_byte = VAR_11;",
"for (VAR_3=0; VAR_3<VAR_0->vChrBufSize; VAR_3++) {",
"FF_ALLOC_OR_GOTO(VAR_0, VAR_0->chrUPixBuf[VAR_3+VAR_0->vChrBufSize], VAR_11*2+1, fail);",
"VAR_0->chrUPixBuf[VAR_3] = VAR_0->chrUPixBuf[VAR_3+VAR_0->vChrBufSize];",
"VAR_0->chrVPixBuf[VAR_3] = VAR_0->chrVPixBuf[VAR_3+VAR_0->vChrBufSize] = VAR_0->chrUPixBuf[VAR_3] + (VAR_11 >> 1);",
"}",
"if (CONFIG_SWSCALE_ALPHA && VAR_0->alpPixBuf)\nfor (VAR_3=0; VAR_3<VAR_0->vLumBufSize; VAR_3++) {",
"FF_ALLOCZ_OR_GOTO(VAR_0, VAR_0->alpPixBuf[VAR_3+VAR_0->vLumBufSize], VAR_11+1, fail);",
"VAR_0->alpPixBuf[VAR_3] = VAR_0->alpPixBuf[VAR_3+VAR_0->vLumBufSize];",
"}",
"for (VAR_3=0; VAR_3<VAR_0->vChrBufSize; VAR_3++)",
"memset(VAR_0->chrUPixBuf[VAR_3], 64, VAR_11*2+1);",
"assert(VAR_0->chrDstH <= VAR_10);",
"if (VAR_13&SWS_PRINT_INFO) {",
"if (VAR_13&SWS_FAST_BILINEAR) av_log(VAR_0, AV_LOG_INFO, \"FAST_BILINEAR scaler, \");",
"else if (VAR_13&SWS_BILINEAR) av_log(VAR_0, AV_LOG_INFO, \"BILINEAR scaler, \");",
"else if (VAR_13&SWS_BICUBIC) av_log(VAR_0, AV_LOG_INFO, \"BICUBIC scaler, \");",
"else if (VAR_13&SWS_X) av_log(VAR_0, AV_LOG_INFO, \"Experimental scaler, \");",
"else if (VAR_13&SWS_POINT) av_log(VAR_0, AV_LOG_INFO, \"Nearest Neighbor / POINT scaler, \");",
"else if (VAR_13&SWS_AREA) av_log(VAR_0, AV_LOG_INFO, \"Area Averaging scaler, \");",
"else if (VAR_13&SWS_BICUBLIN) av_log(VAR_0, AV_LOG_INFO, \"luma BICUBIC / chroma BILINEAR scaler, \");",
"else if (VAR_13&SWS_GAUSS) av_log(VAR_0, AV_LOG_INFO, \"Gaussian scaler, \");",
"else if (VAR_13&SWS_SINC) av_log(VAR_0, AV_LOG_INFO, \"Sinc scaler, \");",
"else if (VAR_13&SWS_LANCZOS) av_log(VAR_0, AV_LOG_INFO, \"Lanczos scaler, \");",
"else if (VAR_13&SWS_SPLINE) av_log(VAR_0, AV_LOG_INFO, \"Bicubic spline scaler, \");",
"else av_log(VAR_0, AV_LOG_INFO, \"ehh VAR_13 invalid?! \");",
"av_log(VAR_0, AV_LOG_INFO, \"from %s to %s%s \",\nsws_format_name(VAR_15),\n#ifdef DITHER1XBPP\nVAR_16 == PIX_FMT_BGR555 || VAR_16 == PIX_FMT_BGR565 ||\nVAR_16 == PIX_FMT_RGB444BE || VAR_16 == PIX_FMT_RGB444LE ||\nVAR_16 == PIX_FMT_BGR444BE || VAR_16 == PIX_FMT_BGR444LE ? \"dithered \" : \"\",\n#else\n\"\",\n#endif\nsws_format_name(VAR_16));",
"if (HAVE_MMX2 && VAR_14 & AV_CPU_FLAG_MMX2) av_log(VAR_0, AV_LOG_INFO, \"using MMX2\\n\");",
"else if (HAVE_AMD3DNOW && VAR_14 & AV_CPU_FLAG_3DNOW) av_log(VAR_0, AV_LOG_INFO, \"using 3DNOW\\n\");",
"else if (HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) av_log(VAR_0, AV_LOG_INFO, \"using MMX\\n\");",
"else if (HAVE_ALTIVEC && VAR_14 & AV_CPU_FLAG_ALTIVEC) av_log(VAR_0, AV_LOG_INFO, \"using AltiVec\\n\");",
"else av_log(VAR_0, AV_LOG_INFO, \"using C\\n\");",
"if (HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) {",
"if (VAR_0->canMMX2BeUsed && (VAR_13&SWS_FAST_BILINEAR))\nav_log(VAR_0, AV_LOG_VERBOSE, \"using FAST_BILINEAR MMX2 scaler for horizontal scaling\\n\");",
"else {",
"if (VAR_0->hLumFilterSize==4)\nav_log(VAR_0, AV_LOG_VERBOSE, \"using 4-tap MMX scaler for horizontal luminance scaling\\n\");",
"else if (VAR_0->hLumFilterSize==8)\nav_log(VAR_0, AV_LOG_VERBOSE, \"using 8-tap MMX scaler for horizontal luminance scaling\\n\");",
"else\nav_log(VAR_0, AV_LOG_VERBOSE, \"using n-tap MMX scaler for horizontal luminance scaling\\n\");",
"if (VAR_0->hChrFilterSize==4)\nav_log(VAR_0, AV_LOG_VERBOSE, \"using 4-tap MMX scaler for horizontal chrominance scaling\\n\");",
"else if (VAR_0->hChrFilterSize==8)\nav_log(VAR_0, AV_LOG_VERBOSE, \"using 8-tap MMX scaler for horizontal chrominance scaling\\n\");",
"else\nav_log(VAR_0, AV_LOG_VERBOSE, \"using n-tap MMX scaler for horizontal chrominance scaling\\n\");",
"}",
"} else {",
"#if HAVE_MMX\nav_log(VAR_0, AV_LOG_VERBOSE, \"using x86 asm scaler for horizontal scaling\\n\");",
"#else\nif (VAR_13 & SWS_FAST_BILINEAR)\nav_log(VAR_0, AV_LOG_VERBOSE, \"using FAST_BILINEAR C scaler for horizontal scaling\\n\");",
"else\nav_log(VAR_0, AV_LOG_VERBOSE, \"using C scaler for horizontal scaling\\n\");",
"#endif\n}",
"if (isPlanarYUV(VAR_16)) {",
"if (VAR_0->vLumFilterSize==1)\nav_log(VAR_0, AV_LOG_VERBOSE, \"using 1-tap %s \\\"scaler\\\" for vertical scaling (YV12 like)\\n\",\n(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? \"MMX\" : \"C\");",
"else\nav_log(VAR_0, AV_LOG_VERBOSE, \"using n-tap %s scaler for vertical scaling (YV12 like)\\n\",\n(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? \"MMX\" : \"C\");",
"} else {",
"if (VAR_0->vLumFilterSize==1 && VAR_0->vChrFilterSize==2)\nav_log(VAR_0, AV_LOG_VERBOSE, \"using 1-tap %s \\\"scaler\\\" for vertical luminance scaling (BGR)\\n\"\n\" 2-tap scaler for vertical chrominance scaling (BGR)\\n\",\n(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? \"MMX\" : \"C\");",
"else if (VAR_0->vLumFilterSize==2 && VAR_0->vChrFilterSize==2)\nav_log(VAR_0, AV_LOG_VERBOSE, \"using 2-tap linear %s scaler for vertical scaling (BGR)\\n\",\n(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? \"MMX\" : \"C\");",
"else\nav_log(VAR_0, AV_LOG_VERBOSE, \"using n-tap %s scaler for vertical scaling (BGR)\\n\",\n(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? \"MMX\" : \"C\");",
"}",
"if (VAR_16==PIX_FMT_BGR24)\nav_log(VAR_0, AV_LOG_VERBOSE, \"using %s YV12->BGR24 converter\\n\",\n(HAVE_MMX2 && VAR_14 & AV_CPU_FLAG_MMX2) ? \"MMX2\" :\n((HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? \"MMX\" : \"C\"));",
"else if (VAR_16==PIX_FMT_RGB32)\nav_log(VAR_0, AV_LOG_VERBOSE, \"using %s YV12->BGR32 converter\\n\",\n(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? \"MMX\" : \"C\");",
"else if (VAR_16==PIX_FMT_BGR565)\nav_log(VAR_0, AV_LOG_VERBOSE, \"using %s YV12->BGR16 converter\\n\",\n(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? \"MMX\" : \"C\");",
"else if (VAR_16==PIX_FMT_BGR555)\nav_log(VAR_0, AV_LOG_VERBOSE, \"using %s YV12->BGR15 converter\\n\",\n(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? \"MMX\" : \"C\");",
"else if (VAR_16 == PIX_FMT_RGB444BE || VAR_16 == PIX_FMT_RGB444LE ||\nVAR_16 == PIX_FMT_BGR444BE || VAR_16 == PIX_FMT_BGR444LE)\nav_log(VAR_0, AV_LOG_VERBOSE, \"using %s YV12->BGR12 converter\\n\",\n(HAVE_MMX && VAR_14 & AV_CPU_FLAG_MMX) ? \"MMX\" : \"C\");",
"av_log(VAR_0, AV_LOG_VERBOSE, \"%dx%d -> %dx%d\\n\", VAR_7, VAR_8, VAR_9, VAR_10);",
"av_log(VAR_0, AV_LOG_DEBUG, \"lum VAR_7=%d VAR_8=%d VAR_9=%d VAR_10=%d xInc=%d yInc=%d\\n\",\nVAR_0->VAR_7, VAR_0->VAR_8, VAR_0->VAR_9, VAR_0->VAR_10, VAR_0->lumXInc, VAR_0->lumYInc);",
"av_log(VAR_0, AV_LOG_DEBUG, \"chr VAR_7=%d VAR_8=%d VAR_9=%d VAR_10=%d xInc=%d yInc=%d\\n\",\nVAR_0->chrSrcW, VAR_0->chrSrcH, VAR_0->chrDstW, VAR_0->chrDstH, VAR_0->chrXInc, VAR_0->chrYInc);",
"}",
"VAR_0->swScale= ff_getSwsFunc(VAR_0);",
"return 0;",
"fail:\nreturn -1;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
1,
1,
0,
1,
0,
1,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
63,
65,
67,
69,
71,
73,
75,
77,
79,
81,
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
95
],
[
97,
99
],
[
101
],
[
103
],
[
107
],
[
109
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
125,
127,
129,
131
],
[
133,
135,
137,
139
],
[
143
],
[
145
],
[
151,
153,
155,
157,
159,
161,
163
],
[
165,
167,
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
183
],
[
185
],
[
191,
193,
195,
197,
199,
201
],
[
207
],
[
209
],
[
211
],
[
213
],
[
219
],
[
221
],
[
225
],
[
227,
229,
231
],
[
233
],
[
235
],
[
237
],
[
241,
243
],
[
245,
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257,
259
],
[
261
],
[
263
],
[
265
],
[
267,
269
],
[
273
],
[
275
],
[
291
],
[
293
],
[
295
],
[
297
],
[
299
],
[
303
],
[
305
],
[
307
],
[
309
],
[
311
],
[
317
],
[
319,
323
],
[
325
],
[
327
],
[
331,
333
],
[
335
],
[
337,
339
],
[
341
],
[
343,
345
],
[
347
],
[
349,
353,
355
],
[
357
],
[
359
],
[
361
],
[
363
],
[
367
],
[
369
],
[
373,
375
],
[
377
],
[
379,
381
],
[
383,
385
],
[
387,
389,
391,
393
],
[
397,
399,
401,
403,
405
],
[
407,
409,
411,
413,
415
],
[
417
],
[
419
],
[
425
],
[
427,
429,
431,
433
],
[
437,
439,
441,
443,
445
],
[
447,
449,
451,
453,
455
],
[
459,
461
],
[
463
],
[
467
],
[
469
],
[
471
],
[
473
],
[
475
],
[
477
],
[
481
],
[
483
],
[
485
],
[
487
],
[
489
],
[
491
],
[
493,
495
],
[
501
],
[
503
],
[
505
],
[
507
],
[
509,
511
],
[
515
],
[
517
],
[
519,
521
],
[
523,
525
],
[
527
],
[
535
],
[
537
],
[
539
],
[
541,
543
],
[
549
],
[
551
],
[
553
],
[
555
],
[
557
],
[
559
],
[
561
],
[
563
],
[
565
],
[
567
],
[
569
],
[
571,
573
],
[
575
],
[
577
],
[
579
],
[
585
],
[
587
],
[
591
],
[
595
],
[
597
],
[
599
],
[
601
],
[
603
],
[
605
],
[
607
],
[
609
],
[
611
],
[
613
],
[
615
],
[
617
],
[
619
],
[
623,
625,
627,
629,
631,
633,
635,
637,
639,
641
],
[
645
],
[
647
],
[
649
],
[
651
],
[
653
],
[
657
],
[
659,
661
],
[
663
],
[
665,
667
],
[
669,
671
],
[
673,
675
],
[
679,
681
],
[
683,
685
],
[
687,
689
],
[
691
],
[
693
],
[
695,
697
],
[
699,
701,
703
],
[
705,
707
],
[
709,
711
],
[
713
],
[
715,
717,
719
],
[
721,
723,
725
],
[
727
],
[
729,
731,
733,
735
],
[
737,
739,
741
],
[
743,
745,
747
],
[
749
],
[
753,
755,
757,
759
],
[
761,
763,
765
],
[
767,
769,
771
],
[
773,
775,
777
],
[
779,
781,
783,
785
],
[
789
],
[
791,
793
],
[
795,
797
],
[
799
],
[
803
],
[
805
],
[
807,
809
],
[
811
]
]
|
15,627 | static int kvmppc_get_pvinfo(CPUPPCState *env, struct kvm_ppc_pvinfo *pvinfo)
{
PowerPCCPU *cpu = ppc_env_get_cpu(env);
CPUState *cs = CPU(cpu);
if (kvm_check_extension(cs->kvm_state, KVM_CAP_PPC_GET_PVINFO) &&
!kvm_vm_ioctl(cs->kvm_state, KVM_PPC_GET_PVINFO, pvinfo)) {
return 0;
}
return 1;
}
| false | qemu | 6fd33a750214a866772dd77573cfa24c27ad956d | static int kvmppc_get_pvinfo(CPUPPCState *env, struct kvm_ppc_pvinfo *pvinfo)
{
PowerPCCPU *cpu = ppc_env_get_cpu(env);
CPUState *cs = CPU(cpu);
if (kvm_check_extension(cs->kvm_state, KVM_CAP_PPC_GET_PVINFO) &&
!kvm_vm_ioctl(cs->kvm_state, KVM_PPC_GET_PVINFO, pvinfo)) {
return 0;
}
return 1;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(CPUPPCState *VAR_0, struct kvm_ppc_pvinfo *VAR_1)
{
PowerPCCPU *cpu = ppc_env_get_cpu(VAR_0);
CPUState *cs = CPU(cpu);
if (kvm_check_extension(cs->kvm_state, KVM_CAP_PPC_GET_PVINFO) &&
!kvm_vm_ioctl(cs->kvm_state, KVM_PPC_GET_PVINFO, VAR_1)) {
return 0;
}
return 1;
}
| [
"static int FUNC_0(CPUPPCState *VAR_0, struct kvm_ppc_pvinfo *VAR_1)\n{",
"PowerPCCPU *cpu = ppc_env_get_cpu(VAR_0);",
"CPUState *cs = CPU(cpu);",
"if (kvm_check_extension(cs->kvm_state, KVM_CAP_PPC_GET_PVINFO) &&\n!kvm_vm_ioctl(cs->kvm_state, KVM_PPC_GET_PVINFO, VAR_1)) {",
"return 0;",
"}",
"return 1;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11,
13
],
[
15
],
[
17
],
[
21
],
[
23
]
]
|
15,629 | static void vncws_tls_handshake_io(void *opaque)
{
struct VncState *vs = (struct VncState *)opaque;
VNC_DEBUG("Handshake IO continue\n");
vncws_start_tls_handshake(vs);
}
| false | qemu | 51941e4695c6f6c1f786bacef7e8c3a477570e04 | static void vncws_tls_handshake_io(void *opaque)
{
struct VncState *vs = (struct VncState *)opaque;
VNC_DEBUG("Handshake IO continue\n");
vncws_start_tls_handshake(vs);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void *VAR_0)
{
struct VncState *VAR_1 = (struct VncState *)VAR_0;
VNC_DEBUG("Handshake IO continue\n");
vncws_start_tls_handshake(VAR_1);
}
| [
"static void FUNC_0(void *VAR_0)\n{",
"struct VncState *VAR_1 = (struct VncState *)VAR_0;",
"VNC_DEBUG(\"Handshake IO continue\\n\");",
"vncws_start_tls_handshake(VAR_1);",
"}"
]
| [
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
]
]
|
15,630 | static void pause_all_vcpus(void)
{
CPUState *penv = first_cpu;
while (penv) {
penv->stop = 1;
qemu_thread_signal(penv->thread, SIGUSR1);
qemu_cpu_kick(penv);
penv = (CPUState *)penv->next_cpu;
}
while (!all_vcpus_paused()) {
qemu_cond_timedwait(&qemu_pause_cond, &qemu_global_mutex, 100);
penv = first_cpu;
while (penv) {
qemu_thread_signal(penv->thread, SIGUSR1);
penv = (CPUState *)penv->next_cpu;
}
}
}
| false | qemu | cc84de9570ffe01a9c3c169bd62ab9586a9a080c | static void pause_all_vcpus(void)
{
CPUState *penv = first_cpu;
while (penv) {
penv->stop = 1;
qemu_thread_signal(penv->thread, SIGUSR1);
qemu_cpu_kick(penv);
penv = (CPUState *)penv->next_cpu;
}
while (!all_vcpus_paused()) {
qemu_cond_timedwait(&qemu_pause_cond, &qemu_global_mutex, 100);
penv = first_cpu;
while (penv) {
qemu_thread_signal(penv->thread, SIGUSR1);
penv = (CPUState *)penv->next_cpu;
}
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void)
{
CPUState *penv = first_cpu;
while (penv) {
penv->stop = 1;
qemu_thread_signal(penv->thread, SIGUSR1);
qemu_cpu_kick(penv);
penv = (CPUState *)penv->next_cpu;
}
while (!all_vcpus_paused()) {
qemu_cond_timedwait(&qemu_pause_cond, &qemu_global_mutex, 100);
penv = first_cpu;
while (penv) {
qemu_thread_signal(penv->thread, SIGUSR1);
penv = (CPUState *)penv->next_cpu;
}
}
}
| [
"static void FUNC_0(void)\n{",
"CPUState *penv = first_cpu;",
"while (penv) {",
"penv->stop = 1;",
"qemu_thread_signal(penv->thread, SIGUSR1);",
"qemu_cpu_kick(penv);",
"penv = (CPUState *)penv->next_cpu;",
"}",
"while (!all_vcpus_paused()) {",
"qemu_cond_timedwait(&qemu_pause_cond, &qemu_global_mutex, 100);",
"penv = first_cpu;",
"while (penv) {",
"qemu_thread_signal(penv->thread, SIGUSR1);",
"penv = (CPUState *)penv->next_cpu;",
"}",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
]
]
|
15,631 | static void pnv_icp_realize(DeviceState *dev, Error **errp)
{
PnvICPState *icp = PNV_ICP(dev);
memory_region_init_io(&icp->mmio, OBJECT(dev), &pnv_icp_ops,
icp, "icp-thread", 0x1000);
}
| false | qemu | 100f738850639a108d6767316ce4dcc1d1ea4ae4 | static void pnv_icp_realize(DeviceState *dev, Error **errp)
{
PnvICPState *icp = PNV_ICP(dev);
memory_region_init_io(&icp->mmio, OBJECT(dev), &pnv_icp_ops,
icp, "icp-thread", 0x1000);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)
{
PnvICPState *icp = PNV_ICP(VAR_0);
memory_region_init_io(&icp->mmio, OBJECT(VAR_0), &pnv_icp_ops,
icp, "icp-thread", 0x1000);
}
| [
"static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{",
"PnvICPState *icp = PNV_ICP(VAR_0);",
"memory_region_init_io(&icp->mmio, OBJECT(VAR_0), &pnv_icp_ops,\nicp, \"icp-thread\", 0x1000);",
"}"
]
| [
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9,
11
],
[
13
]
]
|
15,632 | static void usb_device_class_init(ObjectClass *klass, void *data)
{
DeviceClass *k = DEVICE_CLASS(klass);
k->bus_type = TYPE_USB_BUS;
k->init = usb_qdev_init;
k->unplug = qdev_simple_unplug_cb;
k->exit = usb_qdev_exit;
k->props = usb_props;
}
| false | qemu | 7d553f27fce284805d7f94603932045ee3bbb979 | static void usb_device_class_init(ObjectClass *klass, void *data)
{
DeviceClass *k = DEVICE_CLASS(klass);
k->bus_type = TYPE_USB_BUS;
k->init = usb_qdev_init;
k->unplug = qdev_simple_unplug_cb;
k->exit = usb_qdev_exit;
k->props = usb_props;
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)
{
DeviceClass *k = DEVICE_CLASS(VAR_0);
k->bus_type = TYPE_USB_BUS;
k->init = usb_qdev_init;
k->unplug = qdev_simple_unplug_cb;
k->exit = usb_qdev_exit;
k->props = usb_props;
}
| [
"static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{",
"DeviceClass *k = DEVICE_CLASS(VAR_0);",
"k->bus_type = TYPE_USB_BUS;",
"k->init = usb_qdev_init;",
"k->unplug = qdev_simple_unplug_cb;",
"k->exit = usb_qdev_exit;",
"k->props = usb_props;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
]
]
|
15,633 | static void qmp_output_type_bool(Visitor *v, const char *name, bool *obj,
Error **errp)
{
QmpOutputVisitor *qov = to_qov(v);
qmp_output_add(qov, name, qbool_from_bool(*obj));
}
| false | qemu | b3db211f3c80bb996a704d665fe275619f728bd4 | static void qmp_output_type_bool(Visitor *v, const char *name, bool *obj,
Error **errp)
{
QmpOutputVisitor *qov = to_qov(v);
qmp_output_add(qov, name, qbool_from_bool(*obj));
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(Visitor *VAR_0, const char *VAR_1, bool *VAR_2,
Error **VAR_3)
{
QmpOutputVisitor *qov = to_qov(VAR_0);
qmp_output_add(qov, VAR_1, qbool_from_bool(*VAR_2));
}
| [
"static void FUNC_0(Visitor *VAR_0, const char *VAR_1, bool *VAR_2,\nError **VAR_3)\n{",
"QmpOutputVisitor *qov = to_qov(VAR_0);",
"qmp_output_add(qov, VAR_1, qbool_from_bool(*VAR_2));",
"}"
]
| [
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
]
]
|
15,636 | static unsigned int * create_elf_tables(char *p, int argc, int envc,
struct elfhdr * exec,
unsigned long load_addr,
unsigned long load_bias,
unsigned long interp_load_addr, int ibcs,
struct image_info *info)
{
target_ulong *argv, *envp;
target_ulong *sp, *csp;
/*
* Force 16 byte _final_ alignment here for generality.
*/
sp = (unsigned int *) (~15UL & (unsigned long) p);
csp = sp;
csp -= (DLINFO_ITEMS + 1) * 2;
#ifdef DLINFO_ARCH_ITEMS
csp -= DLINFO_ARCH_ITEMS*2;
#endif
csp -= envc+1;
csp -= argc+1;
csp -= (!ibcs ? 3 : 1); /* argc itself */
if ((unsigned long)csp & 15UL)
sp -= ((unsigned long)csp & 15UL) / sizeof(*sp);
#define NEW_AUX_ENT(nr, id, val) \
put_user (tswapl(id), sp + (nr * 2)); \
put_user (tswapl(val), sp + (nr * 2 + 1))
sp -= 2;
NEW_AUX_ENT (0, AT_NULL, 0);
sp -= DLINFO_ITEMS*2;
NEW_AUX_ENT( 0, AT_PHDR, (target_ulong)(load_addr + exec->e_phoff));
NEW_AUX_ENT( 1, AT_PHENT, (target_ulong)(sizeof (struct elf_phdr)));
NEW_AUX_ENT( 2, AT_PHNUM, (target_ulong)(exec->e_phnum));
NEW_AUX_ENT( 3, AT_PAGESZ, (target_ulong)(TARGET_PAGE_SIZE));
NEW_AUX_ENT( 4, AT_BASE, (target_ulong)(interp_load_addr));
NEW_AUX_ENT( 5, AT_FLAGS, (target_ulong)0);
NEW_AUX_ENT( 6, AT_ENTRY, load_bias + exec->e_entry);
NEW_AUX_ENT( 7, AT_UID, (target_ulong) getuid());
NEW_AUX_ENT( 8, AT_EUID, (target_ulong) geteuid());
NEW_AUX_ENT( 9, AT_GID, (target_ulong) getgid());
NEW_AUX_ENT(11, AT_EGID, (target_ulong) getegid());
#ifdef ARCH_DLINFO
/*
* ARCH_DLINFO must come last so platform specific code can enforce
* special alignment requirements on the AUXV if necessary (eg. PPC).
*/
ARCH_DLINFO;
#endif
#undef NEW_AUX_ENT
sp -= envc+1;
envp = sp;
sp -= argc+1;
argv = sp;
if (!ibcs) {
put_user(tswapl((target_ulong)envp),--sp);
put_user(tswapl((target_ulong)argv),--sp);
}
put_user(tswapl(argc),--sp);
info->arg_start = (unsigned int)((unsigned long)p & 0xffffffff);
while (argc-->0) {
put_user(tswapl((target_ulong)p),argv++);
while (get_user(p++)) /* nothing */ ;
}
put_user(0,argv);
info->arg_end = info->env_start = (unsigned int)((unsigned long)p & 0xffffffff);
while (envc-->0) {
put_user(tswapl((target_ulong)p),envp++);
while (get_user(p++)) /* nothing */ ;
}
put_user(0,envp);
info->env_end = (unsigned int)((unsigned long)p & 0xffffffff);
return sp;
}
| false | qemu | edf779ffccc836661a7b654d320571a6c220caea | static unsigned int * create_elf_tables(char *p, int argc, int envc,
struct elfhdr * exec,
unsigned long load_addr,
unsigned long load_bias,
unsigned long interp_load_addr, int ibcs,
struct image_info *info)
{
target_ulong *argv, *envp;
target_ulong *sp, *csp;
sp = (unsigned int *) (~15UL & (unsigned long) p);
csp = sp;
csp -= (DLINFO_ITEMS + 1) * 2;
#ifdef DLINFO_ARCH_ITEMS
csp -= DLINFO_ARCH_ITEMS*2;
#endif
csp -= envc+1;
csp -= argc+1;
csp -= (!ibcs ? 3 : 1);
if ((unsigned long)csp & 15UL)
sp -= ((unsigned long)csp & 15UL) / sizeof(*sp);
#define NEW_AUX_ENT(nr, id, val) \
put_user (tswapl(id), sp + (nr * 2)); \
put_user (tswapl(val), sp + (nr * 2 + 1))
sp -= 2;
NEW_AUX_ENT (0, AT_NULL, 0);
sp -= DLINFO_ITEMS*2;
NEW_AUX_ENT( 0, AT_PHDR, (target_ulong)(load_addr + exec->e_phoff));
NEW_AUX_ENT( 1, AT_PHENT, (target_ulong)(sizeof (struct elf_phdr)));
NEW_AUX_ENT( 2, AT_PHNUM, (target_ulong)(exec->e_phnum));
NEW_AUX_ENT( 3, AT_PAGESZ, (target_ulong)(TARGET_PAGE_SIZE));
NEW_AUX_ENT( 4, AT_BASE, (target_ulong)(interp_load_addr));
NEW_AUX_ENT( 5, AT_FLAGS, (target_ulong)0);
NEW_AUX_ENT( 6, AT_ENTRY, load_bias + exec->e_entry);
NEW_AUX_ENT( 7, AT_UID, (target_ulong) getuid());
NEW_AUX_ENT( 8, AT_EUID, (target_ulong) geteuid());
NEW_AUX_ENT( 9, AT_GID, (target_ulong) getgid());
NEW_AUX_ENT(11, AT_EGID, (target_ulong) getegid());
#ifdef ARCH_DLINFO
ARCH_DLINFO;
#endif
#undef NEW_AUX_ENT
sp -= envc+1;
envp = sp;
sp -= argc+1;
argv = sp;
if (!ibcs) {
put_user(tswapl((target_ulong)envp),--sp);
put_user(tswapl((target_ulong)argv),--sp);
}
put_user(tswapl(argc),--sp);
info->arg_start = (unsigned int)((unsigned long)p & 0xffffffff);
while (argc-->0) {
put_user(tswapl((target_ulong)p),argv++);
while (get_user(p++)) ;
}
put_user(0,argv);
info->arg_end = info->env_start = (unsigned int)((unsigned long)p & 0xffffffff);
while (envc-->0) {
put_user(tswapl((target_ulong)p),envp++);
while (get_user(p++)) ;
}
put_user(0,envp);
info->env_end = (unsigned int)((unsigned long)p & 0xffffffff);
return sp;
}
| {
"code": [],
"line_no": []
} | static unsigned int * FUNC_0(char *VAR_0, int VAR_1, int VAR_2,
struct elfhdr * VAR_3,
unsigned long VAR_4,
unsigned long VAR_5,
unsigned long VAR_6, int VAR_7,
struct image_info *VAR_8)
{
target_ulong *argv, *envp;
target_ulong *sp, *csp;
sp = (unsigned int *) (~15UL & (unsigned long) VAR_0);
csp = sp;
csp -= (DLINFO_ITEMS + 1) * 2;
#ifdef DLINFO_ARCH_ITEMS
csp -= DLINFO_ARCH_ITEMS*2;
#endif
csp -= VAR_2+1;
csp -= VAR_1+1;
csp -= (!VAR_7 ? 3 : 1);
if ((unsigned long)csp & 15UL)
sp -= ((unsigned long)csp & 15UL) / sizeof(*sp);
#define NEW_AUX_ENT(nr, id, val) \
put_user (tswapl(id), sp + (nr * 2)); \
put_user (tswapl(val), sp + (nr * 2 + 1))
sp -= 2;
NEW_AUX_ENT (0, AT_NULL, 0);
sp -= DLINFO_ITEMS*2;
NEW_AUX_ENT( 0, AT_PHDR, (target_ulong)(VAR_4 + VAR_3->e_phoff));
NEW_AUX_ENT( 1, AT_PHENT, (target_ulong)(sizeof (struct elf_phdr)));
NEW_AUX_ENT( 2, AT_PHNUM, (target_ulong)(VAR_3->e_phnum));
NEW_AUX_ENT( 3, AT_PAGESZ, (target_ulong)(TARGET_PAGE_SIZE));
NEW_AUX_ENT( 4, AT_BASE, (target_ulong)(VAR_6));
NEW_AUX_ENT( 5, AT_FLAGS, (target_ulong)0);
NEW_AUX_ENT( 6, AT_ENTRY, VAR_5 + VAR_3->e_entry);
NEW_AUX_ENT( 7, AT_UID, (target_ulong) getuid());
NEW_AUX_ENT( 8, AT_EUID, (target_ulong) geteuid());
NEW_AUX_ENT( 9, AT_GID, (target_ulong) getgid());
NEW_AUX_ENT(11, AT_EGID, (target_ulong) getegid());
#ifdef ARCH_DLINFO
ARCH_DLINFO;
#endif
#undef NEW_AUX_ENT
sp -= VAR_2+1;
envp = sp;
sp -= VAR_1+1;
argv = sp;
if (!VAR_7) {
put_user(tswapl((target_ulong)envp),--sp);
put_user(tswapl((target_ulong)argv),--sp);
}
put_user(tswapl(VAR_1),--sp);
VAR_8->arg_start = (unsigned int)((unsigned long)VAR_0 & 0xffffffff);
while (VAR_1-->0) {
put_user(tswapl((target_ulong)VAR_0),argv++);
while (get_user(VAR_0++)) ;
}
put_user(0,argv);
VAR_8->arg_end = VAR_8->env_start = (unsigned int)((unsigned long)VAR_0 & 0xffffffff);
while (VAR_2-->0) {
put_user(tswapl((target_ulong)VAR_0),envp++);
while (get_user(VAR_0++)) ;
}
put_user(0,envp);
VAR_8->env_end = (unsigned int)((unsigned long)VAR_0 & 0xffffffff);
return sp;
}
| [
"static unsigned int * FUNC_0(char *VAR_0, int VAR_1, int VAR_2,\nstruct elfhdr * VAR_3,\nunsigned long VAR_4,\nunsigned long VAR_5,\nunsigned long VAR_6, int VAR_7,\nstruct image_info *VAR_8)\n{",
"target_ulong *argv, *envp;",
"target_ulong *sp, *csp;",
"sp = (unsigned int *) (~15UL & (unsigned long) VAR_0);",
"csp = sp;",
"csp -= (DLINFO_ITEMS + 1) * 2;",
"#ifdef DLINFO_ARCH_ITEMS\ncsp -= DLINFO_ARCH_ITEMS*2;",
"#endif\ncsp -= VAR_2+1;",
"csp -= VAR_1+1;",
"csp -= (!VAR_7 ? 3 : 1);",
"if ((unsigned long)csp & 15UL)\nsp -= ((unsigned long)csp & 15UL) / sizeof(*sp);",
"#define NEW_AUX_ENT(nr, id, val) \\\nput_user (tswapl(id), sp + (nr * 2)); \\",
"put_user (tswapl(val), sp + (nr * 2 + 1))\nsp -= 2;",
"NEW_AUX_ENT (0, AT_NULL, 0);",
"sp -= DLINFO_ITEMS*2;",
"NEW_AUX_ENT( 0, AT_PHDR, (target_ulong)(VAR_4 + VAR_3->e_phoff));",
"NEW_AUX_ENT( 1, AT_PHENT, (target_ulong)(sizeof (struct elf_phdr)));",
"NEW_AUX_ENT( 2, AT_PHNUM, (target_ulong)(VAR_3->e_phnum));",
"NEW_AUX_ENT( 3, AT_PAGESZ, (target_ulong)(TARGET_PAGE_SIZE));",
"NEW_AUX_ENT( 4, AT_BASE, (target_ulong)(VAR_6));",
"NEW_AUX_ENT( 5, AT_FLAGS, (target_ulong)0);",
"NEW_AUX_ENT( 6, AT_ENTRY, VAR_5 + VAR_3->e_entry);",
"NEW_AUX_ENT( 7, AT_UID, (target_ulong) getuid());",
"NEW_AUX_ENT( 8, AT_EUID, (target_ulong) geteuid());",
"NEW_AUX_ENT( 9, AT_GID, (target_ulong) getgid());",
"NEW_AUX_ENT(11, AT_EGID, (target_ulong) getegid());",
"#ifdef ARCH_DLINFO\nARCH_DLINFO;",
"#endif\n#undef NEW_AUX_ENT\nsp -= VAR_2+1;",
"envp = sp;",
"sp -= VAR_1+1;",
"argv = sp;",
"if (!VAR_7) {",
"put_user(tswapl((target_ulong)envp),--sp);",
"put_user(tswapl((target_ulong)argv),--sp);",
"}",
"put_user(tswapl(VAR_1),--sp);",
"VAR_8->arg_start = (unsigned int)((unsigned long)VAR_0 & 0xffffffff);",
"while (VAR_1-->0) {",
"put_user(tswapl((target_ulong)VAR_0),argv++);",
"while (get_user(VAR_0++)) ;",
"}",
"put_user(0,argv);",
"VAR_8->arg_end = VAR_8->env_start = (unsigned int)((unsigned long)VAR_0 & 0xffffffff);",
"while (VAR_2-->0) {",
"put_user(tswapl((target_ulong)VAR_0),envp++);",
"while (get_user(VAR_0++)) ;",
"}",
"put_user(0,envp);",
"VAR_8->env_end = (unsigned int)((unsigned long)VAR_0 & 0xffffffff);",
"return sp;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
27
],
[
29
],
[
31
],
[
33,
35
],
[
37,
39
],
[
41
],
[
43
],
[
45,
47
],
[
51,
53
],
[
55,
57
],
[
59
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87,
97
],
[
99,
101,
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
]
]
|
15,637 | static void assigned_dev_msix_mmio_write(void *opaque, target_phys_addr_t addr,
uint64_t val, unsigned size)
{
AssignedDevice *adev = opaque;
PCIDevice *pdev = &adev->dev;
uint16_t ctrl;
MSIXTableEntry orig;
int i = addr >> 4;
if (i >= adev->msix_max) {
return; /* Drop write */
}
ctrl = pci_get_word(pdev->config + pdev->msix_cap + PCI_MSIX_FLAGS);
DEBUG("write to MSI-X table offset 0x%lx, val 0x%lx\n", addr, val);
if (ctrl & PCI_MSIX_FLAGS_ENABLE) {
orig = adev->msix_table[i];
}
memcpy((uint8_t *)adev->msix_table + addr, &val, size);
if (ctrl & PCI_MSIX_FLAGS_ENABLE) {
MSIXTableEntry *entry = &adev->msix_table[i];
if (!assigned_dev_msix_masked(&orig) &&
assigned_dev_msix_masked(entry)) {
/*
* Vector masked, disable it
*
* XXX It's not clear if we can or should actually attempt
* to mask or disable the interrupt. KVM doesn't have
* support for pending bits and kvm_assign_set_msix_entry
* doesn't modify the device hardware mask. Interrupts
* while masked are simply not injected to the guest, so
* are lost. Can we get away with always injecting an
* interrupt on unmask?
*/
} else if (assigned_dev_msix_masked(&orig) &&
!assigned_dev_msix_masked(entry)) {
/* Vector unmasked */
if (i >= adev->msi_virq_nr || adev->msi_virq[i] < 0) {
/* Previously unassigned vector, start from scratch */
assigned_dev_update_msix(pdev);
return;
} else {
/* Update an existing, previously masked vector */
MSIMessage msg;
int ret;
msg.address = entry->addr_lo |
((uint64_t)entry->addr_hi << 32);
msg.data = entry->data;
ret = kvm_irqchip_update_msi_route(kvm_state,
adev->msi_virq[i], msg);
if (ret) {
error_report("Error updating irq routing entry (%d)", ret);
}
}
}
}
}
| false | qemu | a8170e5e97ad17ca169c64ba87ae2f53850dab4c | static void assigned_dev_msix_mmio_write(void *opaque, target_phys_addr_t addr,
uint64_t val, unsigned size)
{
AssignedDevice *adev = opaque;
PCIDevice *pdev = &adev->dev;
uint16_t ctrl;
MSIXTableEntry orig;
int i = addr >> 4;
if (i >= adev->msix_max) {
return;
}
ctrl = pci_get_word(pdev->config + pdev->msix_cap + PCI_MSIX_FLAGS);
DEBUG("write to MSI-X table offset 0x%lx, val 0x%lx\n", addr, val);
if (ctrl & PCI_MSIX_FLAGS_ENABLE) {
orig = adev->msix_table[i];
}
memcpy((uint8_t *)adev->msix_table + addr, &val, size);
if (ctrl & PCI_MSIX_FLAGS_ENABLE) {
MSIXTableEntry *entry = &adev->msix_table[i];
if (!assigned_dev_msix_masked(&orig) &&
assigned_dev_msix_masked(entry)) {
} else if (assigned_dev_msix_masked(&orig) &&
!assigned_dev_msix_masked(entry)) {
if (i >= adev->msi_virq_nr || adev->msi_virq[i] < 0) {
assigned_dev_update_msix(pdev);
return;
} else {
MSIMessage msg;
int ret;
msg.address = entry->addr_lo |
((uint64_t)entry->addr_hi << 32);
msg.data = entry->data;
ret = kvm_irqchip_update_msi_route(kvm_state,
adev->msi_virq[i], msg);
if (ret) {
error_report("Error updating irq routing entry (%d)", ret);
}
}
}
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,
uint64_t VAR_2, unsigned VAR_3)
{
AssignedDevice *adev = VAR_0;
PCIDevice *pdev = &adev->dev;
uint16_t ctrl;
MSIXTableEntry orig;
int VAR_4 = VAR_1 >> 4;
if (VAR_4 >= adev->msix_max) {
return;
}
ctrl = pci_get_word(pdev->config + pdev->msix_cap + PCI_MSIX_FLAGS);
DEBUG("write to MSI-X table offset 0x%lx, VAR_2 0x%lx\n", VAR_1, VAR_2);
if (ctrl & PCI_MSIX_FLAGS_ENABLE) {
orig = adev->msix_table[VAR_4];
}
memcpy((uint8_t *)adev->msix_table + VAR_1, &VAR_2, VAR_3);
if (ctrl & PCI_MSIX_FLAGS_ENABLE) {
MSIXTableEntry *entry = &adev->msix_table[VAR_4];
if (!assigned_dev_msix_masked(&orig) &&
assigned_dev_msix_masked(entry)) {
} else if (assigned_dev_msix_masked(&orig) &&
!assigned_dev_msix_masked(entry)) {
if (VAR_4 >= adev->msi_virq_nr || adev->msi_virq[VAR_4] < 0) {
assigned_dev_update_msix(pdev);
return;
} else {
MSIMessage msg;
int VAR_5;
msg.address = entry->addr_lo |
((uint64_t)entry->addr_hi << 32);
msg.data = entry->data;
VAR_5 = kvm_irqchip_update_msi_route(kvm_state,
adev->msi_virq[VAR_4], msg);
if (VAR_5) {
error_report("Error updating irq routing entry (%d)", VAR_5);
}
}
}
}
}
| [
"static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{",
"AssignedDevice *adev = VAR_0;",
"PCIDevice *pdev = &adev->dev;",
"uint16_t ctrl;",
"MSIXTableEntry orig;",
"int VAR_4 = VAR_1 >> 4;",
"if (VAR_4 >= adev->msix_max) {",
"return;",
"}",
"ctrl = pci_get_word(pdev->config + pdev->msix_cap + PCI_MSIX_FLAGS);",
"DEBUG(\"write to MSI-X table offset 0x%lx, VAR_2 0x%lx\\n\", VAR_1, VAR_2);",
"if (ctrl & PCI_MSIX_FLAGS_ENABLE) {",
"orig = adev->msix_table[VAR_4];",
"}",
"memcpy((uint8_t *)adev->msix_table + VAR_1, &VAR_2, VAR_3);",
"if (ctrl & PCI_MSIX_FLAGS_ENABLE) {",
"MSIXTableEntry *entry = &adev->msix_table[VAR_4];",
"if (!assigned_dev_msix_masked(&orig) &&\nassigned_dev_msix_masked(entry)) {",
"} else if (assigned_dev_msix_masked(&orig) &&",
"!assigned_dev_msix_masked(entry)) {",
"if (VAR_4 >= adev->msi_virq_nr || adev->msi_virq[VAR_4] < 0) {",
"assigned_dev_update_msix(pdev);",
"return;",
"} else {",
"MSIMessage msg;",
"int VAR_5;",
"msg.address = entry->addr_lo |\n((uint64_t)entry->addr_hi << 32);",
"msg.data = entry->data;",
"VAR_5 = kvm_irqchip_update_msi_route(kvm_state,\nadev->msi_virq[VAR_4], msg);",
"if (VAR_5) {",
"error_report(\"Error updating irq routing entry (%d)\", VAR_5);",
"}",
"}",
"}",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
27
],
[
31
],
[
35
],
[
37
],
[
39
],
[
43
],
[
47
],
[
49
],
[
53,
55
],
[
79
],
[
81
],
[
85
],
[
89
],
[
91
],
[
93
],
[
97
],
[
99
],
[
103,
105
],
[
107
],
[
111,
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
]
]
|
15,638 | static void test_cancel(void)
{
WorkerTestData data[100];
int num_canceled;
int i;
/* Start more work items than there will be threads, to ensure
* the pool is full.
*/
test_submit_many();
/* Start long running jobs, to ensure we can cancel some. */
for (i = 0; i < 100; i++) {
data[i].n = 0;
data[i].ret = -EINPROGRESS;
data[i].aiocb = thread_pool_submit_aio(long_cb, &data[i],
done_cb, &data[i]);
}
/* Starting the threads may be left to a bottom half. Let it
* run, but do not waste too much time...
*/
active = 100;
qemu_aio_wait_nonblocking();
/* Wait some time for the threads to start, with some sanity
* testing on the behavior of the scheduler...
*/
g_assert_cmpint(active, ==, 100);
g_usleep(1000000);
g_assert_cmpint(active, >, 50);
/* Cancel the jobs that haven't been started yet. */
num_canceled = 0;
for (i = 0; i < 100; i++) {
if (__sync_val_compare_and_swap(&data[i].n, 0, 3) == 0) {
data[i].ret = -ECANCELED;
bdrv_aio_cancel(data[i].aiocb);
active--;
num_canceled++;
}
}
g_assert_cmpint(active, >, 0);
g_assert_cmpint(num_canceled, <, 100);
/* Canceling the others will be a blocking operation. */
for (i = 0; i < 100; i++) {
if (data[i].n != 3) {
bdrv_aio_cancel(data[i].aiocb);
}
}
/* Finish execution and execute any remaining callbacks. */
qemu_aio_wait_all();
g_assert_cmpint(active, ==, 0);
for (i = 0; i < 100; i++) {
if (data[i].n == 3) {
g_assert_cmpint(data[i].ret, ==, -ECANCELED);
g_assert(data[i].aiocb != NULL);
} else {
g_assert_cmpint(data[i].n, ==, 2);
g_assert_cmpint(data[i].ret, ==, 0);
g_assert(data[i].aiocb == NULL);
}
}
}
| false | qemu | c4d9d19645a484298a67e9021060bc7c2b081d0f | static void test_cancel(void)
{
WorkerTestData data[100];
int num_canceled;
int i;
test_submit_many();
for (i = 0; i < 100; i++) {
data[i].n = 0;
data[i].ret = -EINPROGRESS;
data[i].aiocb = thread_pool_submit_aio(long_cb, &data[i],
done_cb, &data[i]);
}
active = 100;
qemu_aio_wait_nonblocking();
g_assert_cmpint(active, ==, 100);
g_usleep(1000000);
g_assert_cmpint(active, >, 50);
num_canceled = 0;
for (i = 0; i < 100; i++) {
if (__sync_val_compare_and_swap(&data[i].n, 0, 3) == 0) {
data[i].ret = -ECANCELED;
bdrv_aio_cancel(data[i].aiocb);
active--;
num_canceled++;
}
}
g_assert_cmpint(active, >, 0);
g_assert_cmpint(num_canceled, <, 100);
for (i = 0; i < 100; i++) {
if (data[i].n != 3) {
bdrv_aio_cancel(data[i].aiocb);
}
}
qemu_aio_wait_all();
g_assert_cmpint(active, ==, 0);
for (i = 0; i < 100; i++) {
if (data[i].n == 3) {
g_assert_cmpint(data[i].ret, ==, -ECANCELED);
g_assert(data[i].aiocb != NULL);
} else {
g_assert_cmpint(data[i].n, ==, 2);
g_assert_cmpint(data[i].ret, ==, 0);
g_assert(data[i].aiocb == NULL);
}
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void)
{
WorkerTestData data[100];
int VAR_0;
int VAR_1;
test_submit_many();
for (VAR_1 = 0; VAR_1 < 100; VAR_1++) {
data[VAR_1].n = 0;
data[VAR_1].ret = -EINPROGRESS;
data[VAR_1].aiocb = thread_pool_submit_aio(long_cb, &data[VAR_1],
done_cb, &data[VAR_1]);
}
active = 100;
qemu_aio_wait_nonblocking();
g_assert_cmpint(active, ==, 100);
g_usleep(1000000);
g_assert_cmpint(active, >, 50);
VAR_0 = 0;
for (VAR_1 = 0; VAR_1 < 100; VAR_1++) {
if (__sync_val_compare_and_swap(&data[VAR_1].n, 0, 3) == 0) {
data[VAR_1].ret = -ECANCELED;
bdrv_aio_cancel(data[VAR_1].aiocb);
active--;
VAR_0++;
}
}
g_assert_cmpint(active, >, 0);
g_assert_cmpint(VAR_0, <, 100);
for (VAR_1 = 0; VAR_1 < 100; VAR_1++) {
if (data[VAR_1].n != 3) {
bdrv_aio_cancel(data[VAR_1].aiocb);
}
}
qemu_aio_wait_all();
g_assert_cmpint(active, ==, 0);
for (VAR_1 = 0; VAR_1 < 100; VAR_1++) {
if (data[VAR_1].n == 3) {
g_assert_cmpint(data[VAR_1].ret, ==, -ECANCELED);
g_assert(data[VAR_1].aiocb != NULL);
} else {
g_assert_cmpint(data[VAR_1].n, ==, 2);
g_assert_cmpint(data[VAR_1].ret, ==, 0);
g_assert(data[VAR_1].aiocb == NULL);
}
}
}
| [
"static void FUNC_0(void)\n{",
"WorkerTestData data[100];",
"int VAR_0;",
"int VAR_1;",
"test_submit_many();",
"for (VAR_1 = 0; VAR_1 < 100; VAR_1++) {",
"data[VAR_1].n = 0;",
"data[VAR_1].ret = -EINPROGRESS;",
"data[VAR_1].aiocb = thread_pool_submit_aio(long_cb, &data[VAR_1],\ndone_cb, &data[VAR_1]);",
"}",
"active = 100;",
"qemu_aio_wait_nonblocking();",
"g_assert_cmpint(active, ==, 100);",
"g_usleep(1000000);",
"g_assert_cmpint(active, >, 50);",
"VAR_0 = 0;",
"for (VAR_1 = 0; VAR_1 < 100; VAR_1++) {",
"if (__sync_val_compare_and_swap(&data[VAR_1].n, 0, 3) == 0) {",
"data[VAR_1].ret = -ECANCELED;",
"bdrv_aio_cancel(data[VAR_1].aiocb);",
"active--;",
"VAR_0++;",
"}",
"}",
"g_assert_cmpint(active, >, 0);",
"g_assert_cmpint(VAR_0, <, 100);",
"for (VAR_1 = 0; VAR_1 < 100; VAR_1++) {",
"if (data[VAR_1].n != 3) {",
"bdrv_aio_cancel(data[VAR_1].aiocb);",
"}",
"}",
"qemu_aio_wait_all();",
"g_assert_cmpint(active, ==, 0);",
"for (VAR_1 = 0; VAR_1 < 100; VAR_1++) {",
"if (data[VAR_1].n == 3) {",
"g_assert_cmpint(data[VAR_1].ret, ==, -ECANCELED);",
"g_assert(data[VAR_1].aiocb != NULL);",
"} else {",
"g_assert_cmpint(data[VAR_1].n, ==, 2);",
"g_assert_cmpint(data[VAR_1].ret, ==, 0);",
"g_assert(data[VAR_1].aiocb == NULL);",
"}",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
19
],
[
25
],
[
27
],
[
29
],
[
31,
33
],
[
35
],
[
45
],
[
47
],
[
57
],
[
59
],
[
61
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
]
]
|
15,639 | int qemu_paio_write(struct qemu_paiocb *aiocb)
{
return qemu_paio_submit(aiocb, QEMU_PAIO_WRITE);
}
| false | qemu | 9ef91a677110ec200d7b2904fc4bcae5a77329ad | int qemu_paio_write(struct qemu_paiocb *aiocb)
{
return qemu_paio_submit(aiocb, QEMU_PAIO_WRITE);
}
| {
"code": [],
"line_no": []
} | int FUNC_0(struct qemu_paiocb *VAR_0)
{
return qemu_paio_submit(VAR_0, QEMU_PAIO_WRITE);
}
| [
"int FUNC_0(struct qemu_paiocb *VAR_0)\n{",
"return qemu_paio_submit(VAR_0, QEMU_PAIO_WRITE);",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
]
]
|
15,640 | static ssize_t v9fs_synth_llistxattr(FsContext *ctx, V9fsPath *path,
void *value, size_t size)
{
errno = ENOTSUP;
return -1;
}
| false | qemu | 364031f17932814484657e5551ba12957d993d7e | static ssize_t v9fs_synth_llistxattr(FsContext *ctx, V9fsPath *path,
void *value, size_t size)
{
errno = ENOTSUP;
return -1;
}
| {
"code": [],
"line_no": []
} | static ssize_t FUNC_0(FsContext *ctx, V9fsPath *path,
void *value, size_t size)
{
errno = ENOTSUP;
return -1;
}
| [
"static ssize_t FUNC_0(FsContext *ctx, V9fsPath *path,\nvoid *value, size_t size)\n{",
"errno = ENOTSUP;",
"return -1;",
"}"
]
| [
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
]
]
|
15,641 | static int qemu_rbd_set_keypairs(rados_t cluster, const char *keypairs,
Error **errp)
{
char *p, *buf;
char *name;
char *value;
Error *local_err = NULL;
int ret = 0;
buf = g_strdup(keypairs);
p = buf;
while (p) {
name = qemu_rbd_next_tok(RBD_MAX_CONF_NAME_SIZE, p,
'=', "conf option name", &p, &local_err);
if (local_err) {
break;
}
if (!p) {
error_setg(errp, "conf option %s has no value", name);
ret = -EINVAL;
break;
}
value = qemu_rbd_next_tok(RBD_MAX_CONF_VAL_SIZE, p,
':', "conf option value", &p, &local_err);
if (local_err) {
break;
}
ret = rados_conf_set(cluster, name, value);
if (ret < 0) {
error_setg_errno(errp, -ret, "invalid conf option %s", name);
ret = -EINVAL;
break;
}
}
if (local_err) {
error_propagate(errp, local_err);
ret = -EINVAL;
}
g_free(buf);
return ret;
}
| false | qemu | 730b00bbfdc15f914f47e03a703fa7647c10c4a9 | static int qemu_rbd_set_keypairs(rados_t cluster, const char *keypairs,
Error **errp)
{
char *p, *buf;
char *name;
char *value;
Error *local_err = NULL;
int ret = 0;
buf = g_strdup(keypairs);
p = buf;
while (p) {
name = qemu_rbd_next_tok(RBD_MAX_CONF_NAME_SIZE, p,
'=', "conf option name", &p, &local_err);
if (local_err) {
break;
}
if (!p) {
error_setg(errp, "conf option %s has no value", name);
ret = -EINVAL;
break;
}
value = qemu_rbd_next_tok(RBD_MAX_CONF_VAL_SIZE, p,
':', "conf option value", &p, &local_err);
if (local_err) {
break;
}
ret = rados_conf_set(cluster, name, value);
if (ret < 0) {
error_setg_errno(errp, -ret, "invalid conf option %s", name);
ret = -EINVAL;
break;
}
}
if (local_err) {
error_propagate(errp, local_err);
ret = -EINVAL;
}
g_free(buf);
return ret;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(rados_t VAR_0, const char *VAR_1,
Error **VAR_2)
{
char *VAR_3, *VAR_4;
char *VAR_5;
char *VAR_6;
Error *local_err = NULL;
int VAR_7 = 0;
VAR_4 = g_strdup(VAR_1);
VAR_3 = VAR_4;
while (VAR_3) {
VAR_5 = qemu_rbd_next_tok(RBD_MAX_CONF_NAME_SIZE, VAR_3,
'=', "conf option VAR_5", &VAR_3, &local_err);
if (local_err) {
break;
}
if (!VAR_3) {
error_setg(VAR_2, "conf option %s has no VAR_6", VAR_5);
VAR_7 = -EINVAL;
break;
}
VAR_6 = qemu_rbd_next_tok(RBD_MAX_CONF_VAL_SIZE, VAR_3,
':', "conf option VAR_6", &VAR_3, &local_err);
if (local_err) {
break;
}
VAR_7 = rados_conf_set(VAR_0, VAR_5, VAR_6);
if (VAR_7 < 0) {
error_setg_errno(VAR_2, -VAR_7, "invalid conf option %s", VAR_5);
VAR_7 = -EINVAL;
break;
}
}
if (local_err) {
error_propagate(VAR_2, local_err);
VAR_7 = -EINVAL;
}
g_free(VAR_4);
return VAR_7;
}
| [
"static int FUNC_0(rados_t VAR_0, const char *VAR_1,\nError **VAR_2)\n{",
"char *VAR_3, *VAR_4;",
"char *VAR_5;",
"char *VAR_6;",
"Error *local_err = NULL;",
"int VAR_7 = 0;",
"VAR_4 = g_strdup(VAR_1);",
"VAR_3 = VAR_4;",
"while (VAR_3) {",
"VAR_5 = qemu_rbd_next_tok(RBD_MAX_CONF_NAME_SIZE, VAR_3,\n'=', \"conf option VAR_5\", &VAR_3, &local_err);",
"if (local_err) {",
"break;",
"}",
"if (!VAR_3) {",
"error_setg(VAR_2, \"conf option %s has no VAR_6\", VAR_5);",
"VAR_7 = -EINVAL;",
"break;",
"}",
"VAR_6 = qemu_rbd_next_tok(RBD_MAX_CONF_VAL_SIZE, VAR_3,\n':', \"conf option VAR_6\", &VAR_3, &local_err);",
"if (local_err) {",
"break;",
"}",
"VAR_7 = rados_conf_set(VAR_0, VAR_5, VAR_6);",
"if (VAR_7 < 0) {",
"error_setg_errno(VAR_2, -VAR_7, \"invalid conf option %s\", VAR_5);",
"VAR_7 = -EINVAL;",
"break;",
"}",
"}",
"if (local_err) {",
"error_propagate(VAR_2, local_err);",
"VAR_7 = -EINVAL;",
"}",
"g_free(VAR_4);",
"return VAR_7;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
25
],
[
27,
29
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51,
53
],
[
55
],
[
57
],
[
59
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
]
]
|
15,642 | static void spapr_phb_remove_pci_device_cb(DeviceState *dev, void *opaque)
{
/* some version guests do not wait for completion of a device
* cleanup (generally done asynchronously by the kernel) before
* signaling to QEMU that the device is safe, but instead sleep
* for some 'safe' period of time. unfortunately on a busy host
* this sleep isn't guaranteed to be long enough, resulting in
* bad things like IRQ lines being left asserted during final
* device removal. to deal with this we call reset just prior
* to finalizing the device, which will put the device back into
* an 'idle' state, as the device cleanup code expects.
*/
pci_device_reset(PCI_DEVICE(dev));
object_unparent(OBJECT(dev));
}
| false | qemu | 318347234d7069b62d38391dd27e269a3107d668 | static void spapr_phb_remove_pci_device_cb(DeviceState *dev, void *opaque)
{
pci_device_reset(PCI_DEVICE(dev));
object_unparent(OBJECT(dev));
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(DeviceState *VAR_0, void *VAR_1)
{
pci_device_reset(PCI_DEVICE(VAR_0));
object_unparent(OBJECT(VAR_0));
}
| [
"static void FUNC_0(DeviceState *VAR_0, void *VAR_1)\n{",
"pci_device_reset(PCI_DEVICE(VAR_0));",
"object_unparent(OBJECT(VAR_0));",
"}"
]
| [
0,
0,
0,
0
]
| [
[
1,
3
],
[
25
],
[
27
],
[
29
]
]
|
15,643 | static QObject *parse_object(JSONParserContext *ctxt, QList **tokens, va_list *ap)
{
QDict *dict = NULL;
QObject *token, *peek;
QList *working = qlist_copy(*tokens);
token = qlist_pop(working);
if (token == NULL) {
goto out;
}
if (!token_is_operator(token, '{')) {
goto out;
}
qobject_decref(token);
token = NULL;
dict = qdict_new();
peek = qlist_peek(working);
if (peek == NULL) {
parse_error(ctxt, NULL, "premature EOI");
goto out;
}
if (!token_is_operator(peek, '}')) {
if (parse_pair(ctxt, dict, &working, ap) == -1) {
goto out;
}
token = qlist_pop(working);
if (token == NULL) {
parse_error(ctxt, NULL, "premature EOI");
goto out;
}
while (!token_is_operator(token, '}')) {
if (!token_is_operator(token, ',')) {
parse_error(ctxt, token, "expected separator in dict");
goto out;
}
qobject_decref(token);
token = NULL;
if (parse_pair(ctxt, dict, &working, ap) == -1) {
goto out;
}
token = qlist_pop(working);
if (token == NULL) {
parse_error(ctxt, NULL, "premature EOI");
goto out;
}
}
qobject_decref(token);
token = NULL;
} else {
token = qlist_pop(working);
qobject_decref(token);
token = NULL;
}
QDECREF(*tokens);
*tokens = working;
return QOBJECT(dict);
out:
qobject_decref(token);
QDECREF(working);
QDECREF(dict);
return NULL;
}
| false | qemu | 65c0f1e9558c7c762cdb333406243fff1d687117 | static QObject *parse_object(JSONParserContext *ctxt, QList **tokens, va_list *ap)
{
QDict *dict = NULL;
QObject *token, *peek;
QList *working = qlist_copy(*tokens);
token = qlist_pop(working);
if (token == NULL) {
goto out;
}
if (!token_is_operator(token, '{')) {
goto out;
}
qobject_decref(token);
token = NULL;
dict = qdict_new();
peek = qlist_peek(working);
if (peek == NULL) {
parse_error(ctxt, NULL, "premature EOI");
goto out;
}
if (!token_is_operator(peek, '}')) {
if (parse_pair(ctxt, dict, &working, ap) == -1) {
goto out;
}
token = qlist_pop(working);
if (token == NULL) {
parse_error(ctxt, NULL, "premature EOI");
goto out;
}
while (!token_is_operator(token, '}')) {
if (!token_is_operator(token, ',')) {
parse_error(ctxt, token, "expected separator in dict");
goto out;
}
qobject_decref(token);
token = NULL;
if (parse_pair(ctxt, dict, &working, ap) == -1) {
goto out;
}
token = qlist_pop(working);
if (token == NULL) {
parse_error(ctxt, NULL, "premature EOI");
goto out;
}
}
qobject_decref(token);
token = NULL;
} else {
token = qlist_pop(working);
qobject_decref(token);
token = NULL;
}
QDECREF(*tokens);
*tokens = working;
return QOBJECT(dict);
out:
qobject_decref(token);
QDECREF(working);
QDECREF(dict);
return NULL;
}
| {
"code": [],
"line_no": []
} | static QObject *FUNC_0(JSONParserContext *ctxt, QList **tokens, va_list *ap)
{
QDict *dict = NULL;
QObject *token, *peek;
QList *working = qlist_copy(*tokens);
token = qlist_pop(working);
if (token == NULL) {
goto out;
}
if (!token_is_operator(token, '{')) {
goto out;
}
qobject_decref(token);
token = NULL;
dict = qdict_new();
peek = qlist_peek(working);
if (peek == NULL) {
parse_error(ctxt, NULL, "premature EOI");
goto out;
}
if (!token_is_operator(peek, '}')) {
if (parse_pair(ctxt, dict, &working, ap) == -1) {
goto out;
}
token = qlist_pop(working);
if (token == NULL) {
parse_error(ctxt, NULL, "premature EOI");
goto out;
}
while (!token_is_operator(token, '}')) {
if (!token_is_operator(token, ',')) {
parse_error(ctxt, token, "expected separator in dict");
goto out;
}
qobject_decref(token);
token = NULL;
if (parse_pair(ctxt, dict, &working, ap) == -1) {
goto out;
}
token = qlist_pop(working);
if (token == NULL) {
parse_error(ctxt, NULL, "premature EOI");
goto out;
}
}
qobject_decref(token);
token = NULL;
} else {
token = qlist_pop(working);
qobject_decref(token);
token = NULL;
}
QDECREF(*tokens);
*tokens = working;
return QOBJECT(dict);
out:
qobject_decref(token);
QDECREF(working);
QDECREF(dict);
return NULL;
}
| [
"static QObject *FUNC_0(JSONParserContext *ctxt, QList **tokens, va_list *ap)\n{",
"QDict *dict = NULL;",
"QObject *token, *peek;",
"QList *working = qlist_copy(*tokens);",
"token = qlist_pop(working);",
"if (token == NULL) {",
"goto out;",
"}",
"if (!token_is_operator(token, '{')) {",
"goto out;",
"}",
"qobject_decref(token);",
"token = NULL;",
"dict = qdict_new();",
"peek = qlist_peek(working);",
"if (peek == NULL) {",
"parse_error(ctxt, NULL, \"premature EOI\");",
"goto out;",
"}",
"if (!token_is_operator(peek, '}')) {",
"if (parse_pair(ctxt, dict, &working, ap) == -1) {",
"goto out;",
"}",
"token = qlist_pop(working);",
"if (token == NULL) {",
"parse_error(ctxt, NULL, \"premature EOI\");",
"goto out;",
"}",
"while (!token_is_operator(token, '}')) {",
"if (!token_is_operator(token, ',')) {",
"parse_error(ctxt, token, \"expected separator in dict\");",
"goto out;",
"}",
"qobject_decref(token);",
"token = NULL;",
"if (parse_pair(ctxt, dict, &working, ap) == -1) {",
"goto out;",
"}",
"token = qlist_pop(working);",
"if (token == NULL) {",
"parse_error(ctxt, NULL, \"premature EOI\");",
"goto out;",
"}",
"}",
"qobject_decref(token);",
"token = NULL;",
"} else {",
"token = qlist_pop(working);",
"qobject_decref(token);",
"token = NULL;",
"}",
"QDECREF(*tokens);",
"*tokens = working;",
"return QOBJECT(dict);",
"out:\nqobject_decref(token);",
"QDECREF(working);",
"QDECREF(dict);",
"return NULL;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
89
],
[
91
],
[
93
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
125
],
[
127
],
[
131
],
[
135,
137
],
[
139
],
[
141
],
[
143
],
[
145
]
]
|
15,645 | static int64_t coroutine_fn qcow2_co_get_block_status(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, int *pnum)
{
BDRVQcow2State *s = bs->opaque;
uint64_t cluster_offset;
int index_in_cluster, ret;
int64_t status = 0;
*pnum = nb_sectors;
qemu_co_mutex_lock(&s->lock);
ret = qcow2_get_cluster_offset(bs, sector_num << 9, pnum, &cluster_offset);
qemu_co_mutex_unlock(&s->lock);
if (ret < 0) {
return ret;
}
if (cluster_offset != 0 && ret != QCOW2_CLUSTER_COMPRESSED &&
!s->cipher) {
index_in_cluster = sector_num & (s->cluster_sectors - 1);
cluster_offset |= (index_in_cluster << BDRV_SECTOR_BITS);
status |= BDRV_BLOCK_OFFSET_VALID | cluster_offset;
}
if (ret == QCOW2_CLUSTER_ZERO) {
status |= BDRV_BLOCK_ZERO;
} else if (ret != QCOW2_CLUSTER_UNALLOCATED) {
status |= BDRV_BLOCK_DATA;
}
return status;
}
| false | qemu | 67a0fd2a9bca204d2b39f910a97c7137636a0715 | static int64_t coroutine_fn qcow2_co_get_block_status(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, int *pnum)
{
BDRVQcow2State *s = bs->opaque;
uint64_t cluster_offset;
int index_in_cluster, ret;
int64_t status = 0;
*pnum = nb_sectors;
qemu_co_mutex_lock(&s->lock);
ret = qcow2_get_cluster_offset(bs, sector_num << 9, pnum, &cluster_offset);
qemu_co_mutex_unlock(&s->lock);
if (ret < 0) {
return ret;
}
if (cluster_offset != 0 && ret != QCOW2_CLUSTER_COMPRESSED &&
!s->cipher) {
index_in_cluster = sector_num & (s->cluster_sectors - 1);
cluster_offset |= (index_in_cluster << BDRV_SECTOR_BITS);
status |= BDRV_BLOCK_OFFSET_VALID | cluster_offset;
}
if (ret == QCOW2_CLUSTER_ZERO) {
status |= BDRV_BLOCK_ZERO;
} else if (ret != QCOW2_CLUSTER_UNALLOCATED) {
status |= BDRV_BLOCK_DATA;
}
return status;
}
| {
"code": [],
"line_no": []
} | static int64_t VAR_0 qcow2_co_get_block_status(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, int *pnum)
{
BDRVQcow2State *s = bs->opaque;
uint64_t cluster_offset;
int index_in_cluster, ret;
int64_t status = 0;
*pnum = nb_sectors;
qemu_co_mutex_lock(&s->lock);
ret = qcow2_get_cluster_offset(bs, sector_num << 9, pnum, &cluster_offset);
qemu_co_mutex_unlock(&s->lock);
if (ret < 0) {
return ret;
}
if (cluster_offset != 0 && ret != QCOW2_CLUSTER_COMPRESSED &&
!s->cipher) {
index_in_cluster = sector_num & (s->cluster_sectors - 1);
cluster_offset |= (index_in_cluster << BDRV_SECTOR_BITS);
status |= BDRV_BLOCK_OFFSET_VALID | cluster_offset;
}
if (ret == QCOW2_CLUSTER_ZERO) {
status |= BDRV_BLOCK_ZERO;
} else if (ret != QCOW2_CLUSTER_UNALLOCATED) {
status |= BDRV_BLOCK_DATA;
}
return status;
}
| [
"static int64_t VAR_0 qcow2_co_get_block_status(BlockDriverState *bs,\nint64_t sector_num, int nb_sectors, int *pnum)\n{",
"BDRVQcow2State *s = bs->opaque;",
"uint64_t cluster_offset;",
"int index_in_cluster, ret;",
"int64_t status = 0;",
"*pnum = nb_sectors;",
"qemu_co_mutex_lock(&s->lock);",
"ret = qcow2_get_cluster_offset(bs, sector_num << 9, pnum, &cluster_offset);",
"qemu_co_mutex_unlock(&s->lock);",
"if (ret < 0) {",
"return ret;",
"}",
"if (cluster_offset != 0 && ret != QCOW2_CLUSTER_COMPRESSED &&\n!s->cipher) {",
"index_in_cluster = sector_num & (s->cluster_sectors - 1);",
"cluster_offset |= (index_in_cluster << BDRV_SECTOR_BITS);",
"status |= BDRV_BLOCK_OFFSET_VALID | cluster_offset;",
"}",
"if (ret == QCOW2_CLUSTER_ZERO) {",
"status |= BDRV_BLOCK_ZERO;",
"} else if (ret != QCOW2_CLUSTER_UNALLOCATED) {",
"status |= BDRV_BLOCK_DATA;",
"}",
"return status;",
"}"
]
| [
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
],
[
33,
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
]
]
|
15,646 | int avpriv_exif_decode_ifd(void *logctx, GetByteContext *gbytes, int le,
int depth, AVDictionary **metadata)
{
int i, ret;
int entries;
entries = ff_tget_short(gbytes, le);
if (bytestream2_get_bytes_left(gbytes) < entries * 12) {
return AVERROR_INVALIDDATA;
}
for (i = 0; i < entries; i++) {
if ((ret = exif_decode_tag(logctx, gbytes, le, depth, metadata)) < 0) {
return ret;
}
}
// return next IDF offset or 0x000000000 or a value < 0 for failure
return ff_tget_long(gbytes, le);
}
| false | FFmpeg | ae100046ca32b0b83031a60d0c3cdfc5ceb9f874 | int avpriv_exif_decode_ifd(void *logctx, GetByteContext *gbytes, int le,
int depth, AVDictionary **metadata)
{
int i, ret;
int entries;
entries = ff_tget_short(gbytes, le);
if (bytestream2_get_bytes_left(gbytes) < entries * 12) {
return AVERROR_INVALIDDATA;
}
for (i = 0; i < entries; i++) {
if ((ret = exif_decode_tag(logctx, gbytes, le, depth, metadata)) < 0) {
return ret;
}
}
return ff_tget_long(gbytes, le);
}
| {
"code": [],
"line_no": []
} | int FUNC_0(void *VAR_0, GetByteContext *VAR_1, int VAR_2,
int VAR_3, AVDictionary **VAR_4)
{
int VAR_5, VAR_6;
int VAR_7;
VAR_7 = ff_tget_short(VAR_1, VAR_2);
if (bytestream2_get_bytes_left(VAR_1) < VAR_7 * 12) {
return AVERROR_INVALIDDATA;
}
for (VAR_5 = 0; VAR_5 < VAR_7; VAR_5++) {
if ((VAR_6 = exif_decode_tag(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4)) < 0) {
return VAR_6;
}
}
return ff_tget_long(VAR_1, VAR_2);
}
| [
"int FUNC_0(void *VAR_0, GetByteContext *VAR_1, int VAR_2,\nint VAR_3, AVDictionary **VAR_4)\n{",
"int VAR_5, VAR_6;",
"int VAR_7;",
"VAR_7 = ff_tget_short(VAR_1, VAR_2);",
"if (bytestream2_get_bytes_left(VAR_1) < VAR_7 * 12) {",
"return AVERROR_INVALIDDATA;",
"}",
"for (VAR_5 = 0; VAR_5 < VAR_7; VAR_5++) {",
"if ((VAR_6 = exif_decode_tag(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4)) < 0) {",
"return VAR_6;",
"}",
"}",
"return ff_tget_long(VAR_1, VAR_2);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
39
],
[
41
]
]
|
15,647 | static struct omap_rtc_s *omap_rtc_init(MemoryRegion *system_memory,
target_phys_addr_t base,
qemu_irq *irq, omap_clk clk)
{
struct omap_rtc_s *s = (struct omap_rtc_s *)
g_malloc0(sizeof(struct omap_rtc_s));
s->irq = irq[0];
s->alarm = irq[1];
s->clk = qemu_new_timer_ms(rt_clock, omap_rtc_tick, s);
omap_rtc_reset(s);
memory_region_init_io(&s->iomem, &omap_rtc_ops, s,
"omap-rtc", 0x800);
memory_region_add_subregion(system_memory, base, &s->iomem);
return s;
}
| false | qemu | 0919ac787641db11024912651f3bc5764d4f1286 | static struct omap_rtc_s *omap_rtc_init(MemoryRegion *system_memory,
target_phys_addr_t base,
qemu_irq *irq, omap_clk clk)
{
struct omap_rtc_s *s = (struct omap_rtc_s *)
g_malloc0(sizeof(struct omap_rtc_s));
s->irq = irq[0];
s->alarm = irq[1];
s->clk = qemu_new_timer_ms(rt_clock, omap_rtc_tick, s);
omap_rtc_reset(s);
memory_region_init_io(&s->iomem, &omap_rtc_ops, s,
"omap-rtc", 0x800);
memory_region_add_subregion(system_memory, base, &s->iomem);
return s;
}
| {
"code": [],
"line_no": []
} | static struct omap_rtc_s *FUNC_0(MemoryRegion *VAR_0,
target_phys_addr_t VAR_1,
qemu_irq *VAR_2, omap_clk VAR_3)
{
struct omap_rtc_s *VAR_4 = (struct omap_rtc_s *)
g_malloc0(sizeof(struct omap_rtc_s));
VAR_4->VAR_2 = VAR_2[0];
VAR_4->alarm = VAR_2[1];
VAR_4->VAR_3 = qemu_new_timer_ms(rt_clock, omap_rtc_tick, VAR_4);
omap_rtc_reset(VAR_4);
memory_region_init_io(&VAR_4->iomem, &omap_rtc_ops, VAR_4,
"omap-rtc", 0x800);
memory_region_add_subregion(VAR_0, VAR_1, &VAR_4->iomem);
return VAR_4;
}
| [
"static struct omap_rtc_s *FUNC_0(MemoryRegion *VAR_0,\ntarget_phys_addr_t VAR_1,\nqemu_irq *VAR_2, omap_clk VAR_3)\n{",
"struct omap_rtc_s *VAR_4 = (struct omap_rtc_s *)\ng_malloc0(sizeof(struct omap_rtc_s));",
"VAR_4->VAR_2 = VAR_2[0];",
"VAR_4->alarm = VAR_2[1];",
"VAR_4->VAR_3 = qemu_new_timer_ms(rt_clock, omap_rtc_tick, VAR_4);",
"omap_rtc_reset(VAR_4);",
"memory_region_init_io(&VAR_4->iomem, &omap_rtc_ops, VAR_4,\n\"omap-rtc\", 0x800);",
"memory_region_add_subregion(VAR_0, VAR_1, &VAR_4->iomem);",
"return VAR_4;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9,
11
],
[
15
],
[
17
],
[
19
],
[
23
],
[
27,
29
],
[
31
],
[
35
],
[
37
]
]
|
15,648 | static inline void patch_reloc(tcg_insn_unit *code_ptr, int type,
intptr_t value, intptr_t addend)
{
assert(addend == 0);
switch (type) {
case R_AARCH64_JUMP26:
case R_AARCH64_CALL26:
reloc_pc26(code_ptr, (tcg_insn_unit *)value);
break;
case R_AARCH64_CONDBR19:
reloc_pc19(code_ptr, (tcg_insn_unit *)value);
break;
default:
tcg_abort();
}
}
| false | qemu | eabb7b91b36b202b4dac2df2d59d698e3aff197a | static inline void patch_reloc(tcg_insn_unit *code_ptr, int type,
intptr_t value, intptr_t addend)
{
assert(addend == 0);
switch (type) {
case R_AARCH64_JUMP26:
case R_AARCH64_CALL26:
reloc_pc26(code_ptr, (tcg_insn_unit *)value);
break;
case R_AARCH64_CONDBR19:
reloc_pc19(code_ptr, (tcg_insn_unit *)value);
break;
default:
tcg_abort();
}
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(tcg_insn_unit *VAR_0, int VAR_1,
intptr_t VAR_2, intptr_t VAR_3)
{
assert(VAR_3 == 0);
switch (VAR_1) {
case R_AARCH64_JUMP26:
case R_AARCH64_CALL26:
reloc_pc26(VAR_0, (tcg_insn_unit *)VAR_2);
break;
case R_AARCH64_CONDBR19:
reloc_pc19(VAR_0, (tcg_insn_unit *)VAR_2);
break;
default:
tcg_abort();
}
}
| [
"static inline void FUNC_0(tcg_insn_unit *VAR_0, int VAR_1,\nintptr_t VAR_2, intptr_t VAR_3)\n{",
"assert(VAR_3 == 0);",
"switch (VAR_1) {",
"case R_AARCH64_JUMP26:\ncase R_AARCH64_CALL26:\nreloc_pc26(VAR_0, (tcg_insn_unit *)VAR_2);",
"break;",
"case R_AARCH64_CONDBR19:\nreloc_pc19(VAR_0, (tcg_insn_unit *)VAR_2);",
"break;",
"default:\ntcg_abort();",
"}",
"}"
]
| [
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
]
]
|
15,649 | static void disas_simd_mod_imm(DisasContext *s, uint32_t insn)
{
int rd = extract32(insn, 0, 5);
int cmode = extract32(insn, 12, 4);
int cmode_3_1 = extract32(cmode, 1, 3);
int cmode_0 = extract32(cmode, 0, 1);
int o2 = extract32(insn, 11, 1);
uint64_t abcdefgh = extract32(insn, 5, 5) | (extract32(insn, 16, 3) << 5);
bool is_neg = extract32(insn, 29, 1);
bool is_q = extract32(insn, 30, 1);
uint64_t imm = 0;
TCGv_i64 tcg_rd, tcg_imm;
int i;
if (o2 != 0 || ((cmode == 0xf) && is_neg && !is_q)) {
unallocated_encoding(s);
return;
}
if (!fp_access_check(s)) {
return;
}
/* See AdvSIMDExpandImm() in ARM ARM */
switch (cmode_3_1) {
case 0: /* Replicate(Zeros(24):imm8, 2) */
case 1: /* Replicate(Zeros(16):imm8:Zeros(8), 2) */
case 2: /* Replicate(Zeros(8):imm8:Zeros(16), 2) */
case 3: /* Replicate(imm8:Zeros(24), 2) */
{
int shift = cmode_3_1 * 8;
imm = bitfield_replicate(abcdefgh << shift, 32);
break;
}
case 4: /* Replicate(Zeros(8):imm8, 4) */
case 5: /* Replicate(imm8:Zeros(8), 4) */
{
int shift = (cmode_3_1 & 0x1) * 8;
imm = bitfield_replicate(abcdefgh << shift, 16);
break;
}
case 6:
if (cmode_0) {
/* Replicate(Zeros(8):imm8:Ones(16), 2) */
imm = (abcdefgh << 16) | 0xffff;
} else {
/* Replicate(Zeros(16):imm8:Ones(8), 2) */
imm = (abcdefgh << 8) | 0xff;
}
imm = bitfield_replicate(imm, 32);
break;
case 7:
if (!cmode_0 && !is_neg) {
imm = bitfield_replicate(abcdefgh, 8);
} else if (!cmode_0 && is_neg) {
int i;
imm = 0;
for (i = 0; i < 8; i++) {
if ((abcdefgh) & (1 << i)) {
imm |= 0xffULL << (i * 8);
}
}
} else if (cmode_0) {
if (is_neg) {
imm = (abcdefgh & 0x3f) << 48;
if (abcdefgh & 0x80) {
imm |= 0x8000000000000000ULL;
}
if (abcdefgh & 0x40) {
imm |= 0x3fc0000000000000ULL;
} else {
imm |= 0x4000000000000000ULL;
}
} else {
imm = (abcdefgh & 0x3f) << 19;
if (abcdefgh & 0x80) {
imm |= 0x80000000;
}
if (abcdefgh & 0x40) {
imm |= 0x3e000000;
} else {
imm |= 0x40000000;
}
imm |= (imm << 32);
}
}
break;
}
if (cmode_3_1 != 7 && is_neg) {
imm = ~imm;
}
tcg_imm = tcg_const_i64(imm);
tcg_rd = new_tmp_a64(s);
for (i = 0; i < 2; i++) {
int foffs = i ? fp_reg_hi_offset(rd) : fp_reg_offset(rd, MO_64);
if (i == 1 && !is_q) {
/* non-quad ops clear high half of vector */
tcg_gen_movi_i64(tcg_rd, 0);
} else if ((cmode & 0x9) == 0x1 || (cmode & 0xd) == 0x9) {
tcg_gen_ld_i64(tcg_rd, cpu_env, foffs);
if (is_neg) {
/* AND (BIC) */
tcg_gen_and_i64(tcg_rd, tcg_rd, tcg_imm);
} else {
/* ORR */
tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_imm);
}
} else {
/* MOVI */
tcg_gen_mov_i64(tcg_rd, tcg_imm);
}
tcg_gen_st_i64(tcg_rd, cpu_env, foffs);
}
tcg_temp_free_i64(tcg_imm);
}
| false | qemu | 90e496386fe7fd32c189561f846b7913f95b8cf4 | static void disas_simd_mod_imm(DisasContext *s, uint32_t insn)
{
int rd = extract32(insn, 0, 5);
int cmode = extract32(insn, 12, 4);
int cmode_3_1 = extract32(cmode, 1, 3);
int cmode_0 = extract32(cmode, 0, 1);
int o2 = extract32(insn, 11, 1);
uint64_t abcdefgh = extract32(insn, 5, 5) | (extract32(insn, 16, 3) << 5);
bool is_neg = extract32(insn, 29, 1);
bool is_q = extract32(insn, 30, 1);
uint64_t imm = 0;
TCGv_i64 tcg_rd, tcg_imm;
int i;
if (o2 != 0 || ((cmode == 0xf) && is_neg && !is_q)) {
unallocated_encoding(s);
return;
}
if (!fp_access_check(s)) {
return;
}
switch (cmode_3_1) {
case 0:
case 1:
case 2:
case 3:
{
int shift = cmode_3_1 * 8;
imm = bitfield_replicate(abcdefgh << shift, 32);
break;
}
case 4:
case 5:
{
int shift = (cmode_3_1 & 0x1) * 8;
imm = bitfield_replicate(abcdefgh << shift, 16);
break;
}
case 6:
if (cmode_0) {
imm = (abcdefgh << 16) | 0xffff;
} else {
imm = (abcdefgh << 8) | 0xff;
}
imm = bitfield_replicate(imm, 32);
break;
case 7:
if (!cmode_0 && !is_neg) {
imm = bitfield_replicate(abcdefgh, 8);
} else if (!cmode_0 && is_neg) {
int i;
imm = 0;
for (i = 0; i < 8; i++) {
if ((abcdefgh) & (1 << i)) {
imm |= 0xffULL << (i * 8);
}
}
} else if (cmode_0) {
if (is_neg) {
imm = (abcdefgh & 0x3f) << 48;
if (abcdefgh & 0x80) {
imm |= 0x8000000000000000ULL;
}
if (abcdefgh & 0x40) {
imm |= 0x3fc0000000000000ULL;
} else {
imm |= 0x4000000000000000ULL;
}
} else {
imm = (abcdefgh & 0x3f) << 19;
if (abcdefgh & 0x80) {
imm |= 0x80000000;
}
if (abcdefgh & 0x40) {
imm |= 0x3e000000;
} else {
imm |= 0x40000000;
}
imm |= (imm << 32);
}
}
break;
}
if (cmode_3_1 != 7 && is_neg) {
imm = ~imm;
}
tcg_imm = tcg_const_i64(imm);
tcg_rd = new_tmp_a64(s);
for (i = 0; i < 2; i++) {
int foffs = i ? fp_reg_hi_offset(rd) : fp_reg_offset(rd, MO_64);
if (i == 1 && !is_q) {
tcg_gen_movi_i64(tcg_rd, 0);
} else if ((cmode & 0x9) == 0x1 || (cmode & 0xd) == 0x9) {
tcg_gen_ld_i64(tcg_rd, cpu_env, foffs);
if (is_neg) {
tcg_gen_and_i64(tcg_rd, tcg_rd, tcg_imm);
} else {
tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_imm);
}
} else {
tcg_gen_mov_i64(tcg_rd, tcg_imm);
}
tcg_gen_st_i64(tcg_rd, cpu_env, foffs);
}
tcg_temp_free_i64(tcg_imm);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1)
{
int VAR_2 = extract32(VAR_1, 0, 5);
int VAR_3 = extract32(VAR_1, 12, 4);
int VAR_4 = extract32(VAR_3, 1, 3);
int VAR_5 = extract32(VAR_3, 0, 1);
int VAR_6 = extract32(VAR_1, 11, 1);
uint64_t abcdefgh = extract32(VAR_1, 5, 5) | (extract32(VAR_1, 16, 3) << 5);
bool is_neg = extract32(VAR_1, 29, 1);
bool is_q = extract32(VAR_1, 30, 1);
uint64_t imm = 0;
TCGv_i64 tcg_rd, tcg_imm;
int VAR_9;
if (VAR_6 != 0 || ((VAR_3 == 0xf) && is_neg && !is_q)) {
unallocated_encoding(VAR_0);
return;
}
if (!fp_access_check(VAR_0)) {
return;
}
switch (VAR_4) {
case 0:
case 1:
case 2:
case 3:
{
int VAR_9 = VAR_4 * 8;
imm = bitfield_replicate(abcdefgh << VAR_9, 32);
break;
}
case 4:
case 5:
{
int VAR_9 = (VAR_4 & 0x1) * 8;
imm = bitfield_replicate(abcdefgh << VAR_9, 16);
break;
}
case 6:
if (VAR_5) {
imm = (abcdefgh << 16) | 0xffff;
} else {
imm = (abcdefgh << 8) | 0xff;
}
imm = bitfield_replicate(imm, 32);
break;
case 7:
if (!VAR_5 && !is_neg) {
imm = bitfield_replicate(abcdefgh, 8);
} else if (!VAR_5 && is_neg) {
int VAR_9;
imm = 0;
for (VAR_9 = 0; VAR_9 < 8; VAR_9++) {
if ((abcdefgh) & (1 << VAR_9)) {
imm |= 0xffULL << (VAR_9 * 8);
}
}
} else if (VAR_5) {
if (is_neg) {
imm = (abcdefgh & 0x3f) << 48;
if (abcdefgh & 0x80) {
imm |= 0x8000000000000000ULL;
}
if (abcdefgh & 0x40) {
imm |= 0x3fc0000000000000ULL;
} else {
imm |= 0x4000000000000000ULL;
}
} else {
imm = (abcdefgh & 0x3f) << 19;
if (abcdefgh & 0x80) {
imm |= 0x80000000;
}
if (abcdefgh & 0x40) {
imm |= 0x3e000000;
} else {
imm |= 0x40000000;
}
imm |= (imm << 32);
}
}
break;
}
if (VAR_4 != 7 && is_neg) {
imm = ~imm;
}
tcg_imm = tcg_const_i64(imm);
tcg_rd = new_tmp_a64(VAR_0);
for (VAR_9 = 0; VAR_9 < 2; VAR_9++) {
int VAR_9 = VAR_9 ? fp_reg_hi_offset(VAR_2) : fp_reg_offset(VAR_2, MO_64);
if (VAR_9 == 1 && !is_q) {
tcg_gen_movi_i64(tcg_rd, 0);
} else if ((VAR_3 & 0x9) == 0x1 || (VAR_3 & 0xd) == 0x9) {
tcg_gen_ld_i64(tcg_rd, cpu_env, VAR_9);
if (is_neg) {
tcg_gen_and_i64(tcg_rd, tcg_rd, tcg_imm);
} else {
tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_imm);
}
} else {
tcg_gen_mov_i64(tcg_rd, tcg_imm);
}
tcg_gen_st_i64(tcg_rd, cpu_env, VAR_9);
}
tcg_temp_free_i64(tcg_imm);
}
| [
"static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1)\n{",
"int VAR_2 = extract32(VAR_1, 0, 5);",
"int VAR_3 = extract32(VAR_1, 12, 4);",
"int VAR_4 = extract32(VAR_3, 1, 3);",
"int VAR_5 = extract32(VAR_3, 0, 1);",
"int VAR_6 = extract32(VAR_1, 11, 1);",
"uint64_t abcdefgh = extract32(VAR_1, 5, 5) | (extract32(VAR_1, 16, 3) << 5);",
"bool is_neg = extract32(VAR_1, 29, 1);",
"bool is_q = extract32(VAR_1, 30, 1);",
"uint64_t imm = 0;",
"TCGv_i64 tcg_rd, tcg_imm;",
"int VAR_9;",
"if (VAR_6 != 0 || ((VAR_3 == 0xf) && is_neg && !is_q)) {",
"unallocated_encoding(VAR_0);",
"return;",
"}",
"if (!fp_access_check(VAR_0)) {",
"return;",
"}",
"switch (VAR_4) {",
"case 0:\ncase 1:\ncase 2:\ncase 3:\n{",
"int VAR_9 = VAR_4 * 8;",
"imm = bitfield_replicate(abcdefgh << VAR_9, 32);",
"break;",
"}",
"case 4:\ncase 5:\n{",
"int VAR_9 = (VAR_4 & 0x1) * 8;",
"imm = bitfield_replicate(abcdefgh << VAR_9, 16);",
"break;",
"}",
"case 6:\nif (VAR_5) {",
"imm = (abcdefgh << 16) | 0xffff;",
"} else {",
"imm = (abcdefgh << 8) | 0xff;",
"}",
"imm = bitfield_replicate(imm, 32);",
"break;",
"case 7:\nif (!VAR_5 && !is_neg) {",
"imm = bitfield_replicate(abcdefgh, 8);",
"} else if (!VAR_5 && is_neg) {",
"int VAR_9;",
"imm = 0;",
"for (VAR_9 = 0; VAR_9 < 8; VAR_9++) {",
"if ((abcdefgh) & (1 << VAR_9)) {",
"imm |= 0xffULL << (VAR_9 * 8);",
"}",
"}",
"} else if (VAR_5) {",
"if (is_neg) {",
"imm = (abcdefgh & 0x3f) << 48;",
"if (abcdefgh & 0x80) {",
"imm |= 0x8000000000000000ULL;",
"}",
"if (abcdefgh & 0x40) {",
"imm |= 0x3fc0000000000000ULL;",
"} else {",
"imm |= 0x4000000000000000ULL;",
"}",
"} else {",
"imm = (abcdefgh & 0x3f) << 19;",
"if (abcdefgh & 0x80) {",
"imm |= 0x80000000;",
"}",
"if (abcdefgh & 0x40) {",
"imm |= 0x3e000000;",
"} else {",
"imm |= 0x40000000;",
"}",
"imm |= (imm << 32);",
"}",
"}",
"break;",
"}",
"if (VAR_4 != 7 && is_neg) {",
"imm = ~imm;",
"}",
"tcg_imm = tcg_const_i64(imm);",
"tcg_rd = new_tmp_a64(VAR_0);",
"for (VAR_9 = 0; VAR_9 < 2; VAR_9++) {",
"int VAR_9 = VAR_9 ? fp_reg_hi_offset(VAR_2) : fp_reg_offset(VAR_2, MO_64);",
"if (VAR_9 == 1 && !is_q) {",
"tcg_gen_movi_i64(tcg_rd, 0);",
"} else if ((VAR_3 & 0x9) == 0x1 || (VAR_3 & 0xd) == 0x9) {",
"tcg_gen_ld_i64(tcg_rd, cpu_env, VAR_9);",
"if (is_neg) {",
"tcg_gen_and_i64(tcg_rd, tcg_rd, tcg_imm);",
"} else {",
"tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_imm);",
"}",
"} else {",
"tcg_gen_mov_i64(tcg_rd, tcg_imm);",
"}",
"tcg_gen_st_i64(tcg_rd, cpu_env, VAR_9);",
"}",
"tcg_temp_free_i64(tcg_imm);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
49
],
[
51,
53,
55,
57,
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69,
71,
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83,
85
],
[
89
],
[
91
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103,
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
179
],
[
181
],
[
183
],
[
187
],
[
189
],
[
193
],
[
195
],
[
199
],
[
203
],
[
205
],
[
207
],
[
209
],
[
213
],
[
215
],
[
219
],
[
221
],
[
223
],
[
227
],
[
229
],
[
231
],
[
233
],
[
237
],
[
239
]
]
|
15,650 | int tcp_ctl(struct socket *so)
{
Slirp *slirp = so->slirp;
struct sbuf *sb = &so->so_snd;
struct ex_list *ex_ptr;
int do_pty;
DEBUG_CALL("tcp_ctl");
DEBUG_ARG("so = %lx", (long )so);
if (so->so_faddr.s_addr != slirp->vhost_addr.s_addr) {
/* Check if it's pty_exec */
for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
if (ex_ptr->ex_fport == so->so_fport &&
so->so_faddr.s_addr == ex_ptr->ex_addr.s_addr) {
if (ex_ptr->ex_pty == 3) {
so->s = -1;
so->extra = (void *)ex_ptr->ex_exec;
return 1;
}
do_pty = ex_ptr->ex_pty;
DEBUG_MISC((dfd, " executing %s \n",ex_ptr->ex_exec));
return fork_exec(so, ex_ptr->ex_exec, do_pty);
}
}
}
sb->sb_cc =
snprintf(sb->sb_wptr, sb->sb_datalen - (sb->sb_wptr - sb->sb_data),
"Error: No application configured.\r\n");
sb->sb_wptr += sb->sb_cc;
return 0;
}
| false | qemu | b2bedb214469af55179d907a60cd67fed6b0779e | int tcp_ctl(struct socket *so)
{
Slirp *slirp = so->slirp;
struct sbuf *sb = &so->so_snd;
struct ex_list *ex_ptr;
int do_pty;
DEBUG_CALL("tcp_ctl");
DEBUG_ARG("so = %lx", (long )so);
if (so->so_faddr.s_addr != slirp->vhost_addr.s_addr) {
for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
if (ex_ptr->ex_fport == so->so_fport &&
so->so_faddr.s_addr == ex_ptr->ex_addr.s_addr) {
if (ex_ptr->ex_pty == 3) {
so->s = -1;
so->extra = (void *)ex_ptr->ex_exec;
return 1;
}
do_pty = ex_ptr->ex_pty;
DEBUG_MISC((dfd, " executing %s \n",ex_ptr->ex_exec));
return fork_exec(so, ex_ptr->ex_exec, do_pty);
}
}
}
sb->sb_cc =
snprintf(sb->sb_wptr, sb->sb_datalen - (sb->sb_wptr - sb->sb_data),
"Error: No application configured.\r\n");
sb->sb_wptr += sb->sb_cc;
return 0;
}
| {
"code": [],
"line_no": []
} | int FUNC_0(struct socket *VAR_0)
{
Slirp *slirp = VAR_0->slirp;
struct sbuf *VAR_1 = &VAR_0->so_snd;
struct ex_list *VAR_2;
int VAR_3;
DEBUG_CALL("FUNC_0");
DEBUG_ARG("VAR_0 = %lx", (long )VAR_0);
if (VAR_0->so_faddr.s_addr != slirp->vhost_addr.s_addr) {
for (VAR_2 = slirp->exec_list; VAR_2; VAR_2 = VAR_2->ex_next) {
if (VAR_2->ex_fport == VAR_0->so_fport &&
VAR_0->so_faddr.s_addr == VAR_2->ex_addr.s_addr) {
if (VAR_2->ex_pty == 3) {
VAR_0->s = -1;
VAR_0->extra = (void *)VAR_2->ex_exec;
return 1;
}
VAR_3 = VAR_2->ex_pty;
DEBUG_MISC((dfd, " executing %s \n",VAR_2->ex_exec));
return fork_exec(VAR_0, VAR_2->ex_exec, VAR_3);
}
}
}
VAR_1->sb_cc =
snprintf(VAR_1->sb_wptr, VAR_1->sb_datalen - (VAR_1->sb_wptr - VAR_1->sb_data),
"Error: No application configured.\r\n");
VAR_1->sb_wptr += VAR_1->sb_cc;
return 0;
}
| [
"int FUNC_0(struct socket *VAR_0)\n{",
"Slirp *slirp = VAR_0->slirp;",
"struct sbuf *VAR_1 = &VAR_0->so_snd;",
"struct ex_list *VAR_2;",
"int VAR_3;",
"DEBUG_CALL(\"FUNC_0\");",
"DEBUG_ARG(\"VAR_0 = %lx\", (long )VAR_0);",
"if (VAR_0->so_faddr.s_addr != slirp->vhost_addr.s_addr) {",
"for (VAR_2 = slirp->exec_list; VAR_2; VAR_2 = VAR_2->ex_next) {",
"if (VAR_2->ex_fport == VAR_0->so_fport &&\nVAR_0->so_faddr.s_addr == VAR_2->ex_addr.s_addr) {",
"if (VAR_2->ex_pty == 3) {",
"VAR_0->s = -1;",
"VAR_0->extra = (void *)VAR_2->ex_exec;",
"return 1;",
"}",
"VAR_3 = VAR_2->ex_pty;",
"DEBUG_MISC((dfd, \" executing %s \\n\",VAR_2->ex_exec));",
"return fork_exec(VAR_0, VAR_2->ex_exec, VAR_3);",
"}",
"}",
"}",
"VAR_1->sb_cc =\nsnprintf(VAR_1->sb_wptr, VAR_1->sb_datalen - (VAR_1->sb_wptr - VAR_1->sb_data),\n\"Error: No application configured.\\r\\n\");",
"VAR_1->sb_wptr += VAR_1->sb_cc;",
"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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
21
],
[
25
],
[
27,
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53,
55,
57
],
[
59
],
[
61
],
[
63
]
]
|
15,651 | void cpu_outl(CPUState *env, pio_addr_t addr, uint32_t val)
{
LOG_IOPORT("outl: %04"FMT_pioaddr" %08"PRIx32"\n", addr, val);
ioport_write(2, addr, val);
#ifdef CONFIG_KQEMU
if (env)
env->last_io_time = cpu_get_time_fast();
#endif
}
| false | qemu | 4a1418e07bdcfaa3177739e04707ecaec75d89e1 | void cpu_outl(CPUState *env, pio_addr_t addr, uint32_t val)
{
LOG_IOPORT("outl: %04"FMT_pioaddr" %08"PRIx32"\n", addr, val);
ioport_write(2, addr, val);
#ifdef CONFIG_KQEMU
if (env)
env->last_io_time = cpu_get_time_fast();
#endif
}
| {
"code": [],
"line_no": []
} | void FUNC_0(CPUState *VAR_0, pio_addr_t VAR_1, uint32_t VAR_2)
{
LOG_IOPORT("outl: %04"FMT_pioaddr" %08"PRIx32"\n", VAR_1, VAR_2);
ioport_write(2, VAR_1, VAR_2);
#ifdef CONFIG_KQEMU
if (VAR_0)
VAR_0->last_io_time = cpu_get_time_fast();
#endif
}
| [
"void FUNC_0(CPUState *VAR_0, pio_addr_t VAR_1, uint32_t VAR_2)\n{",
"LOG_IOPORT(\"outl: %04\"FMT_pioaddr\" %08\"PRIx32\"\\n\", VAR_1, VAR_2);",
"ioport_write(2, VAR_1, VAR_2);",
"#ifdef CONFIG_KQEMU\nif (VAR_0)\nVAR_0->last_io_time = cpu_get_time_fast();",
"#endif\n}"
]
| [
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9,
11,
13
],
[
15,
17
]
]
|
15,652 | static int v9fs_synth_lsetxattr(FsContext *ctx, V9fsPath *path,
const char *name, void *value,
size_t size, int flags)
{
errno = ENOTSUP;
return -1;
}
| false | qemu | 364031f17932814484657e5551ba12957d993d7e | static int v9fs_synth_lsetxattr(FsContext *ctx, V9fsPath *path,
const char *name, void *value,
size_t size, int flags)
{
errno = ENOTSUP;
return -1;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,
const char *VAR_2, void *VAR_3,
size_t VAR_4, int VAR_5)
{
errno = ENOTSUP;
return -1;
}
| [
"static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,\nconst char *VAR_2, void *VAR_3,\nsize_t VAR_4, int VAR_5)\n{",
"errno = ENOTSUP;",
"return -1;",
"}"
]
| [
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
]
]
|
15,656 | static void register_types(void)
{
register_char_driver_qapi("null", CHARDEV_BACKEND_KIND_NULL, NULL);
register_char_driver("socket", qemu_chr_open_socket);
register_char_driver("udp", qemu_chr_open_udp);
register_char_driver("memory", qemu_chr_open_ringbuf);
register_char_driver_qapi("file", CHARDEV_BACKEND_KIND_FILE,
qemu_chr_parse_file_out);
register_char_driver_qapi("stdio", CHARDEV_BACKEND_KIND_STDIO,
qemu_chr_parse_stdio);
register_char_driver_qapi("serial", CHARDEV_BACKEND_KIND_SERIAL,
qemu_chr_parse_serial);
register_char_driver_qapi("tty", CHARDEV_BACKEND_KIND_SERIAL,
qemu_chr_parse_serial);
register_char_driver_qapi("parallel", CHARDEV_BACKEND_KIND_PARALLEL,
qemu_chr_parse_parallel);
register_char_driver_qapi("parport", CHARDEV_BACKEND_KIND_PARALLEL,
qemu_chr_parse_parallel);
#ifdef _WIN32
register_char_driver("pipe", qemu_chr_open_win_pipe);
register_char_driver("console", qemu_chr_open_win_con);
#else
register_char_driver("pipe", qemu_chr_open_pipe);
#endif
#ifdef HAVE_CHARDEV_TTY
register_char_driver("pty", qemu_chr_open_pty);
#endif
}
| false | qemu | e68c5958668596a5023e30ddf8368410878f7682 | static void register_types(void)
{
register_char_driver_qapi("null", CHARDEV_BACKEND_KIND_NULL, NULL);
register_char_driver("socket", qemu_chr_open_socket);
register_char_driver("udp", qemu_chr_open_udp);
register_char_driver("memory", qemu_chr_open_ringbuf);
register_char_driver_qapi("file", CHARDEV_BACKEND_KIND_FILE,
qemu_chr_parse_file_out);
register_char_driver_qapi("stdio", CHARDEV_BACKEND_KIND_STDIO,
qemu_chr_parse_stdio);
register_char_driver_qapi("serial", CHARDEV_BACKEND_KIND_SERIAL,
qemu_chr_parse_serial);
register_char_driver_qapi("tty", CHARDEV_BACKEND_KIND_SERIAL,
qemu_chr_parse_serial);
register_char_driver_qapi("parallel", CHARDEV_BACKEND_KIND_PARALLEL,
qemu_chr_parse_parallel);
register_char_driver_qapi("parport", CHARDEV_BACKEND_KIND_PARALLEL,
qemu_chr_parse_parallel);
#ifdef _WIN32
register_char_driver("pipe", qemu_chr_open_win_pipe);
register_char_driver("console", qemu_chr_open_win_con);
#else
register_char_driver("pipe", qemu_chr_open_pipe);
#endif
#ifdef HAVE_CHARDEV_TTY
register_char_driver("pty", qemu_chr_open_pty);
#endif
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void)
{
register_char_driver_qapi("null", CHARDEV_BACKEND_KIND_NULL, NULL);
register_char_driver("socket", qemu_chr_open_socket);
register_char_driver("udp", qemu_chr_open_udp);
register_char_driver("memory", qemu_chr_open_ringbuf);
register_char_driver_qapi("file", CHARDEV_BACKEND_KIND_FILE,
qemu_chr_parse_file_out);
register_char_driver_qapi("stdio", CHARDEV_BACKEND_KIND_STDIO,
qemu_chr_parse_stdio);
register_char_driver_qapi("serial", CHARDEV_BACKEND_KIND_SERIAL,
qemu_chr_parse_serial);
register_char_driver_qapi("tty", CHARDEV_BACKEND_KIND_SERIAL,
qemu_chr_parse_serial);
register_char_driver_qapi("parallel", CHARDEV_BACKEND_KIND_PARALLEL,
qemu_chr_parse_parallel);
register_char_driver_qapi("parport", CHARDEV_BACKEND_KIND_PARALLEL,
qemu_chr_parse_parallel);
#ifdef _WIN32
register_char_driver("pipe", qemu_chr_open_win_pipe);
register_char_driver("console", qemu_chr_open_win_con);
#else
register_char_driver("pipe", qemu_chr_open_pipe);
#endif
#ifdef HAVE_CHARDEV_TTY
register_char_driver("pty", qemu_chr_open_pty);
#endif
}
| [
"static void FUNC_0(void)\n{",
"register_char_driver_qapi(\"null\", CHARDEV_BACKEND_KIND_NULL, NULL);",
"register_char_driver(\"socket\", qemu_chr_open_socket);",
"register_char_driver(\"udp\", qemu_chr_open_udp);",
"register_char_driver(\"memory\", qemu_chr_open_ringbuf);",
"register_char_driver_qapi(\"file\", CHARDEV_BACKEND_KIND_FILE,\nqemu_chr_parse_file_out);",
"register_char_driver_qapi(\"stdio\", CHARDEV_BACKEND_KIND_STDIO,\nqemu_chr_parse_stdio);",
"register_char_driver_qapi(\"serial\", CHARDEV_BACKEND_KIND_SERIAL,\nqemu_chr_parse_serial);",
"register_char_driver_qapi(\"tty\", CHARDEV_BACKEND_KIND_SERIAL,\nqemu_chr_parse_serial);",
"register_char_driver_qapi(\"parallel\", CHARDEV_BACKEND_KIND_PARALLEL,\nqemu_chr_parse_parallel);",
"register_char_driver_qapi(\"parport\", CHARDEV_BACKEND_KIND_PARALLEL,\nqemu_chr_parse_parallel);",
"#ifdef _WIN32\nregister_char_driver(\"pipe\", qemu_chr_open_win_pipe);",
"register_char_driver(\"console\", qemu_chr_open_win_con);",
"#else\nregister_char_driver(\"pipe\", qemu_chr_open_pipe);",
"#endif\n#ifdef HAVE_CHARDEV_TTY\nregister_char_driver(\"pty\", qemu_chr_open_pty);",
"#endif\n}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13,
15
],
[
17,
19
],
[
21,
23
],
[
25,
27
],
[
29,
31
],
[
33,
35
],
[
37,
39
],
[
41
],
[
43,
45
],
[
47,
49,
51
],
[
53,
55
]
]
|
15,657 | static void FUNCC(pred8x8_vertical_add)(uint8_t *pix, const int *block_offset,
const int16_t *block, ptrdiff_t stride)
{
int i;
for(i=0; i<4; i++)
FUNCC(pred4x4_vertical_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride);
}
| false | FFmpeg | 1acd7d594c15aa491729c837ad3519d3469e620a | static void FUNCC(pred8x8_vertical_add)(uint8_t *pix, const int *block_offset,
const int16_t *block, ptrdiff_t stride)
{
int i;
for(i=0; i<4; i++)
FUNCC(pred4x4_vertical_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(pred8x8_vertical_add)(uint8_t *pix, const int *block_offset,
const int16_t *block, ptrdiff_t stride)
{
int VAR_0;
for(VAR_0=0; VAR_0<4; VAR_0++)
FUNC_0(pred4x4_vertical_add)(pix + block_offset[VAR_0], block + VAR_0*16*sizeof(pixel), stride);
}
| [
"static void FUNC_0(pred8x8_vertical_add)(uint8_t *pix, const int *block_offset,\nconst int16_t *block, ptrdiff_t stride)\n{",
"int VAR_0;",
"for(VAR_0=0; VAR_0<4; VAR_0++)",
"FUNC_0(pred4x4_vertical_add)(pix + block_offset[VAR_0], block + VAR_0*16*sizeof(pixel), stride);",
"}"
]
| [
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
]
]
|
15,658 | static inline void dv_decode_video_segment(DVVideoDecodeContext *s,
UINT8 *buf_ptr1,
const UINT16 *mb_pos_ptr)
{
int quant, dc, dct_mode, class1, j;
int mb_index, mb_x, mb_y, v, last_index;
DCTELEM *block, *block1;
int c_offset, bits_left;
UINT8 *y_ptr;
BlockInfo mb_data[5 * 6], *mb, *mb1;
void (*idct_put)(UINT8 *dest, int line_size, DCTELEM *block);
UINT8 *buf_ptr;
PutBitContext pb, vs_pb;
UINT8 mb_bit_buffer[80 + 4]; /* allow some slack */
int mb_bit_count;
UINT8 vs_bit_buffer[5 * 80 + 4]; /* allow some slack */
int vs_bit_count;
memset(s->block, 0, sizeof(s->block));
/* pass 1 : read DC and AC coefficients in blocks */
buf_ptr = buf_ptr1;
block1 = &s->block[0][0];
mb1 = mb_data;
init_put_bits(&vs_pb, vs_bit_buffer, 5 * 80, NULL, NULL);
vs_bit_count = 0;
for(mb_index = 0; mb_index < 5; mb_index++) {
/* skip header */
quant = buf_ptr[3] & 0x0f;
buf_ptr += 4;
init_put_bits(&pb, mb_bit_buffer, 80, NULL, NULL);
mb_bit_count = 0;
mb = mb1;
block = block1;
for(j = 0;j < 6; j++) {
/* NOTE: size is not important here */
init_get_bits(&s->gb, buf_ptr, 14);
/* get the dc */
dc = get_bits(&s->gb, 9);
dc = (dc << (32 - 9)) >> (32 - 9);
dct_mode = get_bits1(&s->gb);
mb->dct_mode = dct_mode;
mb->scan_table = s->dv_zigzag[dct_mode];
class1 = get_bits(&s->gb, 2);
mb->shift_offset = (class1 == 3);
mb->shift_table = s->dv_shift[dct_mode]
[quant + dv_quant_offset[class1]];
dc = dc << 2;
/* convert to unsigned because 128 is not added in the
standard IDCT */
dc += 1024;
block[0] = dc;
last_index = block_sizes[j];
buf_ptr += last_index >> 3;
mb->pos = 0;
mb->partial_bit_count = 0;
dv_decode_ac(s, mb, block, last_index);
/* write the remaining bits in a new buffer only if the
block is finished */
bits_left = last_index - s->gb.index;
if (mb->eob_reached) {
mb->partial_bit_count = 0;
mb_bit_count += bits_left;
bit_copy(&pb, &s->gb, bits_left);
} else {
/* should be < 16 bits otherwise a codeword could have
been parsed */
mb->partial_bit_count = bits_left;
mb->partial_bit_buffer = get_bits(&s->gb, bits_left);
}
block += 64;
mb++;
}
flush_put_bits(&pb);
/* pass 2 : we can do it just after */
#ifdef VLC_DEBUG
printf("***pass 2 size=%d\n", mb_bit_count);
#endif
block = block1;
mb = mb1;
init_get_bits(&s->gb, mb_bit_buffer, 80);
for(j = 0;j < 6; j++) {
if (!mb->eob_reached && s->gb.index < mb_bit_count) {
dv_decode_ac(s, mb, block, mb_bit_count);
/* if still not finished, no need to parse other blocks */
if (!mb->eob_reached) {
/* we could not parse the current AC coefficient,
so we add the remaining bytes */
bits_left = mb_bit_count - s->gb.index;
if (bits_left > 0) {
mb->partial_bit_count += bits_left;
mb->partial_bit_buffer =
(mb->partial_bit_buffer << bits_left) |
get_bits(&s->gb, bits_left);
}
goto next_mb;
}
}
block += 64;
mb++;
}
/* all blocks are finished, so the extra bytes can be used at
the video segment level */
bits_left = mb_bit_count - s->gb.index;
vs_bit_count += bits_left;
bit_copy(&vs_pb, &s->gb, bits_left);
next_mb:
mb1 += 6;
block1 += 6 * 64;
}
/* we need a pass other the whole video segment */
flush_put_bits(&vs_pb);
#ifdef VLC_DEBUG
printf("***pass 3 size=%d\n", vs_bit_count);
#endif
block = &s->block[0][0];
mb = mb_data;
init_get_bits(&s->gb, vs_bit_buffer, 5 * 80);
for(mb_index = 0; mb_index < 5; mb_index++) {
for(j = 0;j < 6; j++) {
if (!mb->eob_reached) {
#ifdef VLC_DEBUG
printf("start %d:%d\n", mb_index, j);
#endif
dv_decode_ac(s, mb, block, vs_bit_count);
}
block += 64;
mb++;
}
}
/* compute idct and place blocks */
block = &s->block[0][0];
mb = mb_data;
for(mb_index = 0; mb_index < 5; mb_index++) {
v = *mb_pos_ptr++;
mb_x = v & 0xff;
mb_y = v >> 8;
y_ptr = s->current_picture[0] + (mb_y * s->linesize[0] * 8) + (mb_x * 8);
if (s->sampling_411)
c_offset = (mb_y * s->linesize[1] * 8) + ((mb_x >> 2) * 8);
else
c_offset = ((mb_y >> 1) * s->linesize[1] * 8) + ((mb_x >> 1) * 8);
for(j = 0;j < 6; j++) {
idct_put = s->idct_put[mb->dct_mode];
if (j < 4) {
if (s->sampling_411 && mb_x < (704 / 8)) {
/* NOTE: at end of line, the macroblock is handled as 420 */
idct_put(y_ptr + (j * 8), s->linesize[0], block);
} else {
idct_put(y_ptr + ((j & 1) * 8) + ((j >> 1) * 8 * s->linesize[0]),
s->linesize[0], block);
}
} else {
if (s->sampling_411 && mb_x >= (704 / 8)) {
uint8_t pixels[64], *c_ptr, *c_ptr1, *ptr;
int y, linesize;
/* NOTE: at end of line, the macroblock is handled as 420 */
idct_put(pixels, 8, block);
linesize = s->linesize[6 - j];
c_ptr = s->current_picture[6 - j] + c_offset;
ptr = pixels;
for(y = 0;y < 8; y++) {
/* convert to 411P */
c_ptr1 = c_ptr + linesize;
c_ptr1[0] = c_ptr[0] = (ptr[0] + ptr[1]) >> 1;
c_ptr1[1] = c_ptr[1] = (ptr[2] + ptr[3]) >> 1;
c_ptr1[2] = c_ptr[2] = (ptr[4] + ptr[5]) >> 1;
c_ptr1[3] = c_ptr[3] = (ptr[6] + ptr[7]) >> 1;
c_ptr += linesize * 2;
ptr += 8;
}
} else {
/* don't ask me why they inverted Cb and Cr ! */
idct_put(s->current_picture[6 - j] + c_offset,
s->linesize[6 - j], block);
}
}
block += 64;
mb++;
}
}
}
| false | FFmpeg | 68f593b48433842f3407586679fe07f3e5199ab9 | static inline void dv_decode_video_segment(DVVideoDecodeContext *s,
UINT8 *buf_ptr1,
const UINT16 *mb_pos_ptr)
{
int quant, dc, dct_mode, class1, j;
int mb_index, mb_x, mb_y, v, last_index;
DCTELEM *block, *block1;
int c_offset, bits_left;
UINT8 *y_ptr;
BlockInfo mb_data[5 * 6], *mb, *mb1;
void (*idct_put)(UINT8 *dest, int line_size, DCTELEM *block);
UINT8 *buf_ptr;
PutBitContext pb, vs_pb;
UINT8 mb_bit_buffer[80 + 4];
int mb_bit_count;
UINT8 vs_bit_buffer[5 * 80 + 4];
int vs_bit_count;
memset(s->block, 0, sizeof(s->block));
buf_ptr = buf_ptr1;
block1 = &s->block[0][0];
mb1 = mb_data;
init_put_bits(&vs_pb, vs_bit_buffer, 5 * 80, NULL, NULL);
vs_bit_count = 0;
for(mb_index = 0; mb_index < 5; mb_index++) {
quant = buf_ptr[3] & 0x0f;
buf_ptr += 4;
init_put_bits(&pb, mb_bit_buffer, 80, NULL, NULL);
mb_bit_count = 0;
mb = mb1;
block = block1;
for(j = 0;j < 6; j++) {
init_get_bits(&s->gb, buf_ptr, 14);
dc = get_bits(&s->gb, 9);
dc = (dc << (32 - 9)) >> (32 - 9);
dct_mode = get_bits1(&s->gb);
mb->dct_mode = dct_mode;
mb->scan_table = s->dv_zigzag[dct_mode];
class1 = get_bits(&s->gb, 2);
mb->shift_offset = (class1 == 3);
mb->shift_table = s->dv_shift[dct_mode]
[quant + dv_quant_offset[class1]];
dc = dc << 2;
dc += 1024;
block[0] = dc;
last_index = block_sizes[j];
buf_ptr += last_index >> 3;
mb->pos = 0;
mb->partial_bit_count = 0;
dv_decode_ac(s, mb, block, last_index);
bits_left = last_index - s->gb.index;
if (mb->eob_reached) {
mb->partial_bit_count = 0;
mb_bit_count += bits_left;
bit_copy(&pb, &s->gb, bits_left);
} else {
mb->partial_bit_count = bits_left;
mb->partial_bit_buffer = get_bits(&s->gb, bits_left);
}
block += 64;
mb++;
}
flush_put_bits(&pb);
#ifdef VLC_DEBUG
printf("***pass 2 size=%d\n", mb_bit_count);
#endif
block = block1;
mb = mb1;
init_get_bits(&s->gb, mb_bit_buffer, 80);
for(j = 0;j < 6; j++) {
if (!mb->eob_reached && s->gb.index < mb_bit_count) {
dv_decode_ac(s, mb, block, mb_bit_count);
if (!mb->eob_reached) {
bits_left = mb_bit_count - s->gb.index;
if (bits_left > 0) {
mb->partial_bit_count += bits_left;
mb->partial_bit_buffer =
(mb->partial_bit_buffer << bits_left) |
get_bits(&s->gb, bits_left);
}
goto next_mb;
}
}
block += 64;
mb++;
}
bits_left = mb_bit_count - s->gb.index;
vs_bit_count += bits_left;
bit_copy(&vs_pb, &s->gb, bits_left);
next_mb:
mb1 += 6;
block1 += 6 * 64;
}
flush_put_bits(&vs_pb);
#ifdef VLC_DEBUG
printf("***pass 3 size=%d\n", vs_bit_count);
#endif
block = &s->block[0][0];
mb = mb_data;
init_get_bits(&s->gb, vs_bit_buffer, 5 * 80);
for(mb_index = 0; mb_index < 5; mb_index++) {
for(j = 0;j < 6; j++) {
if (!mb->eob_reached) {
#ifdef VLC_DEBUG
printf("start %d:%d\n", mb_index, j);
#endif
dv_decode_ac(s, mb, block, vs_bit_count);
}
block += 64;
mb++;
}
}
block = &s->block[0][0];
mb = mb_data;
for(mb_index = 0; mb_index < 5; mb_index++) {
v = *mb_pos_ptr++;
mb_x = v & 0xff;
mb_y = v >> 8;
y_ptr = s->current_picture[0] + (mb_y * s->linesize[0] * 8) + (mb_x * 8);
if (s->sampling_411)
c_offset = (mb_y * s->linesize[1] * 8) + ((mb_x >> 2) * 8);
else
c_offset = ((mb_y >> 1) * s->linesize[1] * 8) + ((mb_x >> 1) * 8);
for(j = 0;j < 6; j++) {
idct_put = s->idct_put[mb->dct_mode];
if (j < 4) {
if (s->sampling_411 && mb_x < (704 / 8)) {
idct_put(y_ptr + (j * 8), s->linesize[0], block);
} else {
idct_put(y_ptr + ((j & 1) * 8) + ((j >> 1) * 8 * s->linesize[0]),
s->linesize[0], block);
}
} else {
if (s->sampling_411 && mb_x >= (704 / 8)) {
uint8_t pixels[64], *c_ptr, *c_ptr1, *ptr;
int y, linesize;
idct_put(pixels, 8, block);
linesize = s->linesize[6 - j];
c_ptr = s->current_picture[6 - j] + c_offset;
ptr = pixels;
for(y = 0;y < 8; y++) {
c_ptr1 = c_ptr + linesize;
c_ptr1[0] = c_ptr[0] = (ptr[0] + ptr[1]) >> 1;
c_ptr1[1] = c_ptr[1] = (ptr[2] + ptr[3]) >> 1;
c_ptr1[2] = c_ptr[2] = (ptr[4] + ptr[5]) >> 1;
c_ptr1[3] = c_ptr[3] = (ptr[6] + ptr[7]) >> 1;
c_ptr += linesize * 2;
ptr += 8;
}
} else {
idct_put(s->current_picture[6 - j] + c_offset,
s->linesize[6 - j], block);
}
}
block += 64;
mb++;
}
}
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(DVVideoDecodeContext *VAR_0,
UINT8 *VAR_1,
const UINT16 *VAR_2)
{
int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;
int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12;
DCTELEM *VAR_18, *block1;
int VAR_13, VAR_14;
UINT8 *y_ptr;
BlockInfo mb_data[5 * 6], *mb, *mb1;
void (*VAR_15)(UINT8 *VAR_16, int VAR_17, DCTELEM *VAR_18);
UINT8 *buf_ptr;
PutBitContext pb, vs_pb;
UINT8 mb_bit_buffer[80 + 4];
int VAR_19;
UINT8 vs_bit_buffer[5 * 80 + 4];
int VAR_20;
memset(VAR_0->VAR_18, 0, sizeof(VAR_0->VAR_18));
buf_ptr = VAR_1;
block1 = &VAR_0->VAR_18[0][0];
mb1 = mb_data;
init_put_bits(&vs_pb, vs_bit_buffer, 5 * 80, NULL, NULL);
VAR_20 = 0;
for(VAR_8 = 0; VAR_8 < 5; VAR_8++) {
VAR_3 = buf_ptr[3] & 0x0f;
buf_ptr += 4;
init_put_bits(&pb, mb_bit_buffer, 80, NULL, NULL);
VAR_19 = 0;
mb = mb1;
VAR_18 = block1;
for(VAR_7 = 0;VAR_7 < 6; VAR_7++) {
init_get_bits(&VAR_0->gb, buf_ptr, 14);
VAR_4 = get_bits(&VAR_0->gb, 9);
VAR_4 = (VAR_4 << (32 - 9)) >> (32 - 9);
VAR_5 = get_bits1(&VAR_0->gb);
mb->VAR_5 = VAR_5;
mb->scan_table = VAR_0->dv_zigzag[VAR_5];
VAR_6 = get_bits(&VAR_0->gb, 2);
mb->shift_offset = (VAR_6 == 3);
mb->shift_table = VAR_0->dv_shift[VAR_5]
[VAR_3 + dv_quant_offset[VAR_6]];
VAR_4 = VAR_4 << 2;
VAR_4 += 1024;
VAR_18[0] = VAR_4;
VAR_12 = block_sizes[VAR_7];
buf_ptr += VAR_12 >> 3;
mb->pos = 0;
mb->partial_bit_count = 0;
dv_decode_ac(VAR_0, mb, VAR_18, VAR_12);
VAR_14 = VAR_12 - VAR_0->gb.index;
if (mb->eob_reached) {
mb->partial_bit_count = 0;
VAR_19 += VAR_14;
bit_copy(&pb, &VAR_0->gb, VAR_14);
} else {
mb->partial_bit_count = VAR_14;
mb->partial_bit_buffer = get_bits(&VAR_0->gb, VAR_14);
}
VAR_18 += 64;
mb++;
}
flush_put_bits(&pb);
#ifdef VLC_DEBUG
printf("***pass 2 size=%d\n", VAR_19);
#endif
VAR_18 = block1;
mb = mb1;
init_get_bits(&VAR_0->gb, mb_bit_buffer, 80);
for(VAR_7 = 0;VAR_7 < 6; VAR_7++) {
if (!mb->eob_reached && VAR_0->gb.index < VAR_19) {
dv_decode_ac(VAR_0, mb, VAR_18, VAR_19);
if (!mb->eob_reached) {
VAR_14 = VAR_19 - VAR_0->gb.index;
if (VAR_14 > 0) {
mb->partial_bit_count += VAR_14;
mb->partial_bit_buffer =
(mb->partial_bit_buffer << VAR_14) |
get_bits(&VAR_0->gb, VAR_14);
}
goto next_mb;
}
}
VAR_18 += 64;
mb++;
}
VAR_14 = VAR_19 - VAR_0->gb.index;
VAR_20 += VAR_14;
bit_copy(&vs_pb, &VAR_0->gb, VAR_14);
next_mb:
mb1 += 6;
block1 += 6 * 64;
}
flush_put_bits(&vs_pb);
#ifdef VLC_DEBUG
printf("***pass 3 size=%d\n", VAR_20);
#endif
VAR_18 = &VAR_0->VAR_18[0][0];
mb = mb_data;
init_get_bits(&VAR_0->gb, vs_bit_buffer, 5 * 80);
for(VAR_8 = 0; VAR_8 < 5; VAR_8++) {
for(VAR_7 = 0;VAR_7 < 6; VAR_7++) {
if (!mb->eob_reached) {
#ifdef VLC_DEBUG
printf("start %d:%d\n", VAR_8, VAR_7);
#endif
dv_decode_ac(VAR_0, mb, VAR_18, VAR_20);
}
VAR_18 += 64;
mb++;
}
}
VAR_18 = &VAR_0->VAR_18[0][0];
mb = mb_data;
for(VAR_8 = 0; VAR_8 < 5; VAR_8++) {
VAR_11 = *VAR_2++;
VAR_9 = VAR_11 & 0xff;
VAR_10 = VAR_11 >> 8;
y_ptr = VAR_0->current_picture[0] + (VAR_10 * VAR_0->VAR_22[0] * 8) + (VAR_9 * 8);
if (VAR_0->sampling_411)
VAR_13 = (VAR_10 * VAR_0->VAR_22[1] * 8) + ((VAR_9 >> 2) * 8);
else
VAR_13 = ((VAR_10 >> 1) * VAR_0->VAR_22[1] * 8) + ((VAR_9 >> 1) * 8);
for(VAR_7 = 0;VAR_7 < 6; VAR_7++) {
VAR_15 = VAR_0->VAR_15[mb->VAR_5];
if (VAR_7 < 4) {
if (VAR_0->sampling_411 && VAR_9 < (704 / 8)) {
VAR_15(y_ptr + (VAR_7 * 8), VAR_0->VAR_22[0], VAR_18);
} else {
VAR_15(y_ptr + ((VAR_7 & 1) * 8) + ((VAR_7 >> 1) * 8 * VAR_0->VAR_22[0]),
VAR_0->VAR_22[0], VAR_18);
}
} else {
if (VAR_0->sampling_411 && VAR_9 >= (704 / 8)) {
uint8_t pixels[64], *c_ptr, *c_ptr1, *ptr;
int VAR_21, VAR_22;
VAR_15(pixels, 8, VAR_18);
VAR_22 = VAR_0->VAR_22[6 - VAR_7];
c_ptr = VAR_0->current_picture[6 - VAR_7] + VAR_13;
ptr = pixels;
for(VAR_21 = 0;VAR_21 < 8; VAR_21++) {
c_ptr1 = c_ptr + VAR_22;
c_ptr1[0] = c_ptr[0] = (ptr[0] + ptr[1]) >> 1;
c_ptr1[1] = c_ptr[1] = (ptr[2] + ptr[3]) >> 1;
c_ptr1[2] = c_ptr[2] = (ptr[4] + ptr[5]) >> 1;
c_ptr1[3] = c_ptr[3] = (ptr[6] + ptr[7]) >> 1;
c_ptr += VAR_22 * 2;
ptr += 8;
}
} else {
VAR_15(VAR_0->current_picture[6 - VAR_7] + VAR_13,
VAR_0->VAR_22[6 - VAR_7], VAR_18);
}
}
VAR_18 += 64;
mb++;
}
}
}
| [
"static inline void FUNC_0(DVVideoDecodeContext *VAR_0,\nUINT8 *VAR_1,\nconst UINT16 *VAR_2)\n{",
"int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;",
"int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12;",
"DCTELEM *VAR_18, *block1;",
"int VAR_13, VAR_14;",
"UINT8 *y_ptr;",
"BlockInfo mb_data[5 * 6], *mb, *mb1;",
"void (*VAR_15)(UINT8 *VAR_16, int VAR_17, DCTELEM *VAR_18);",
"UINT8 *buf_ptr;",
"PutBitContext pb, vs_pb;",
"UINT8 mb_bit_buffer[80 + 4];",
"int VAR_19;",
"UINT8 vs_bit_buffer[5 * 80 + 4];",
"int VAR_20;",
"memset(VAR_0->VAR_18, 0, sizeof(VAR_0->VAR_18));",
"buf_ptr = VAR_1;",
"block1 = &VAR_0->VAR_18[0][0];",
"mb1 = mb_data;",
"init_put_bits(&vs_pb, vs_bit_buffer, 5 * 80, NULL, NULL);",
"VAR_20 = 0;",
"for(VAR_8 = 0; VAR_8 < 5; VAR_8++) {",
"VAR_3 = buf_ptr[3] & 0x0f;",
"buf_ptr += 4;",
"init_put_bits(&pb, mb_bit_buffer, 80, NULL, NULL);",
"VAR_19 = 0;",
"mb = mb1;",
"VAR_18 = block1;",
"for(VAR_7 = 0;VAR_7 < 6; VAR_7++) {",
"init_get_bits(&VAR_0->gb, buf_ptr, 14);",
"VAR_4 = get_bits(&VAR_0->gb, 9);",
"VAR_4 = (VAR_4 << (32 - 9)) >> (32 - 9);",
"VAR_5 = get_bits1(&VAR_0->gb);",
"mb->VAR_5 = VAR_5;",
"mb->scan_table = VAR_0->dv_zigzag[VAR_5];",
"VAR_6 = get_bits(&VAR_0->gb, 2);",
"mb->shift_offset = (VAR_6 == 3);",
"mb->shift_table = VAR_0->dv_shift[VAR_5]\n[VAR_3 + dv_quant_offset[VAR_6]];",
"VAR_4 = VAR_4 << 2;",
"VAR_4 += 1024;",
"VAR_18[0] = VAR_4;",
"VAR_12 = block_sizes[VAR_7];",
"buf_ptr += VAR_12 >> 3;",
"mb->pos = 0;",
"mb->partial_bit_count = 0;",
"dv_decode_ac(VAR_0, mb, VAR_18, VAR_12);",
"VAR_14 = VAR_12 - VAR_0->gb.index;",
"if (mb->eob_reached) {",
"mb->partial_bit_count = 0;",
"VAR_19 += VAR_14;",
"bit_copy(&pb, &VAR_0->gb, VAR_14);",
"} else {",
"mb->partial_bit_count = VAR_14;",
"mb->partial_bit_buffer = get_bits(&VAR_0->gb, VAR_14);",
"}",
"VAR_18 += 64;",
"mb++;",
"}",
"flush_put_bits(&pb);",
"#ifdef VLC_DEBUG\nprintf(\"***pass 2 size=%d\\n\", VAR_19);",
"#endif\nVAR_18 = block1;",
"mb = mb1;",
"init_get_bits(&VAR_0->gb, mb_bit_buffer, 80);",
"for(VAR_7 = 0;VAR_7 < 6; VAR_7++) {",
"if (!mb->eob_reached && VAR_0->gb.index < VAR_19) {",
"dv_decode_ac(VAR_0, mb, VAR_18, VAR_19);",
"if (!mb->eob_reached) {",
"VAR_14 = VAR_19 - VAR_0->gb.index;",
"if (VAR_14 > 0) {",
"mb->partial_bit_count += VAR_14;",
"mb->partial_bit_buffer =\n(mb->partial_bit_buffer << VAR_14) |\nget_bits(&VAR_0->gb, VAR_14);",
"}",
"goto next_mb;",
"}",
"}",
"VAR_18 += 64;",
"mb++;",
"}",
"VAR_14 = VAR_19 - VAR_0->gb.index;",
"VAR_20 += VAR_14;",
"bit_copy(&vs_pb, &VAR_0->gb, VAR_14);",
"next_mb:\nmb1 += 6;",
"block1 += 6 * 64;",
"}",
"flush_put_bits(&vs_pb);",
"#ifdef VLC_DEBUG\nprintf(\"***pass 3 size=%d\\n\", VAR_20);",
"#endif\nVAR_18 = &VAR_0->VAR_18[0][0];",
"mb = mb_data;",
"init_get_bits(&VAR_0->gb, vs_bit_buffer, 5 * 80);",
"for(VAR_8 = 0; VAR_8 < 5; VAR_8++) {",
"for(VAR_7 = 0;VAR_7 < 6; VAR_7++) {",
"if (!mb->eob_reached) {",
"#ifdef VLC_DEBUG\nprintf(\"start %d:%d\\n\", VAR_8, VAR_7);",
"#endif\ndv_decode_ac(VAR_0, mb, VAR_18, VAR_20);",
"}",
"VAR_18 += 64;",
"mb++;",
"}",
"}",
"VAR_18 = &VAR_0->VAR_18[0][0];",
"mb = mb_data;",
"for(VAR_8 = 0; VAR_8 < 5; VAR_8++) {",
"VAR_11 = *VAR_2++;",
"VAR_9 = VAR_11 & 0xff;",
"VAR_10 = VAR_11 >> 8;",
"y_ptr = VAR_0->current_picture[0] + (VAR_10 * VAR_0->VAR_22[0] * 8) + (VAR_9 * 8);",
"if (VAR_0->sampling_411)\nVAR_13 = (VAR_10 * VAR_0->VAR_22[1] * 8) + ((VAR_9 >> 2) * 8);",
"else\nVAR_13 = ((VAR_10 >> 1) * VAR_0->VAR_22[1] * 8) + ((VAR_9 >> 1) * 8);",
"for(VAR_7 = 0;VAR_7 < 6; VAR_7++) {",
"VAR_15 = VAR_0->VAR_15[mb->VAR_5];",
"if (VAR_7 < 4) {",
"if (VAR_0->sampling_411 && VAR_9 < (704 / 8)) {",
"VAR_15(y_ptr + (VAR_7 * 8), VAR_0->VAR_22[0], VAR_18);",
"} else {",
"VAR_15(y_ptr + ((VAR_7 & 1) * 8) + ((VAR_7 >> 1) * 8 * VAR_0->VAR_22[0]),\nVAR_0->VAR_22[0], VAR_18);",
"}",
"} else {",
"if (VAR_0->sampling_411 && VAR_9 >= (704 / 8)) {",
"uint8_t pixels[64], *c_ptr, *c_ptr1, *ptr;",
"int VAR_21, VAR_22;",
"VAR_15(pixels, 8, VAR_18);",
"VAR_22 = VAR_0->VAR_22[6 - VAR_7];",
"c_ptr = VAR_0->current_picture[6 - VAR_7] + VAR_13;",
"ptr = pixels;",
"for(VAR_21 = 0;VAR_21 < 8; VAR_21++) {",
"c_ptr1 = c_ptr + VAR_22;",
"c_ptr1[0] = c_ptr[0] = (ptr[0] + ptr[1]) >> 1;",
"c_ptr1[1] = c_ptr[1] = (ptr[2] + ptr[3]) >> 1;",
"c_ptr1[2] = c_ptr[2] = (ptr[4] + ptr[5]) >> 1;",
"c_ptr1[3] = c_ptr[3] = (ptr[6] + ptr[7]) >> 1;",
"c_ptr += VAR_22 * 2;",
"ptr += 8;",
"}",
"} else {",
"VAR_15(VAR_0->current_picture[6 - VAR_7] + VAR_13,\nVAR_0->VAR_22[6 - VAR_7], VAR_18);",
"}",
"}",
"VAR_18 += 64;",
"mb++;",
"}",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
37
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93,
95
],
[
97
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
117
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
155
],
[
161,
163
],
[
165,
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
181
],
[
187
],
[
189
],
[
191
],
[
193,
195,
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
217
],
[
219
],
[
221
],
[
223,
225
],
[
227
],
[
229
],
[
235
],
[
239,
241
],
[
243,
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257,
259
],
[
261,
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273
],
[
279
],
[
281
],
[
283
],
[
285
],
[
287
],
[
289
],
[
291
],
[
293,
295
],
[
297,
299
],
[
301
],
[
303
],
[
305
],
[
307
],
[
311
],
[
313
],
[
315,
317
],
[
319
],
[
321
],
[
323
],
[
325
],
[
327
],
[
331
],
[
333
],
[
335
],
[
337
],
[
339
],
[
343
],
[
345
],
[
347
],
[
349
],
[
351
],
[
353
],
[
355
],
[
357
],
[
359
],
[
363,
365
],
[
367
],
[
369
],
[
371
],
[
373
],
[
375
],
[
377
],
[
379
]
]
|
15,659 | void helper_syscall(CPUX86State *env, int next_eip_addend)
{
int selector;
if (!(env->efer & MSR_EFER_SCE)) {
raise_exception_err(env, EXCP06_ILLOP, 0);
}
selector = (env->star >> 32) & 0xffff;
if (env->hflags & HF_LMA_MASK) {
int code64;
env->regs[R_ECX] = env->eip + next_eip_addend;
env->regs[11] = cpu_compute_eflags(env);
code64 = env->hflags & HF_CS64_MASK;
env->eflags &= ~env->fmask;
cpu_load_eflags(env, env->eflags, 0);
cpu_x86_set_cpl(env, 0);
cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc,
0, 0xffffffff,
DESC_G_MASK | DESC_P_MASK |
DESC_S_MASK |
DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK |
DESC_L_MASK);
cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc,
0, 0xffffffff,
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
DESC_S_MASK |
DESC_W_MASK | DESC_A_MASK);
if (code64) {
env->eip = env->lstar;
} else {
env->eip = env->cstar;
}
} else {
env->regs[R_ECX] = (uint32_t)(env->eip + next_eip_addend);
env->eflags &= ~(IF_MASK | RF_MASK | VM_MASK);
cpu_x86_set_cpl(env, 0);
cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc,
0, 0xffffffff,
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
DESC_S_MASK |
DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc,
0, 0xffffffff,
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
DESC_S_MASK |
DESC_W_MASK | DESC_A_MASK);
env->eip = (uint32_t)env->star;
}
}
| false | qemu | 7848c8d19f8556666df25044bbd5d8b29439c368 | void helper_syscall(CPUX86State *env, int next_eip_addend)
{
int selector;
if (!(env->efer & MSR_EFER_SCE)) {
raise_exception_err(env, EXCP06_ILLOP, 0);
}
selector = (env->star >> 32) & 0xffff;
if (env->hflags & HF_LMA_MASK) {
int code64;
env->regs[R_ECX] = env->eip + next_eip_addend;
env->regs[11] = cpu_compute_eflags(env);
code64 = env->hflags & HF_CS64_MASK;
env->eflags &= ~env->fmask;
cpu_load_eflags(env, env->eflags, 0);
cpu_x86_set_cpl(env, 0);
cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc,
0, 0xffffffff,
DESC_G_MASK | DESC_P_MASK |
DESC_S_MASK |
DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK |
DESC_L_MASK);
cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc,
0, 0xffffffff,
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
DESC_S_MASK |
DESC_W_MASK | DESC_A_MASK);
if (code64) {
env->eip = env->lstar;
} else {
env->eip = env->cstar;
}
} else {
env->regs[R_ECX] = (uint32_t)(env->eip + next_eip_addend);
env->eflags &= ~(IF_MASK | RF_MASK | VM_MASK);
cpu_x86_set_cpl(env, 0);
cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc,
0, 0xffffffff,
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
DESC_S_MASK |
DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc,
0, 0xffffffff,
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
DESC_S_MASK |
DESC_W_MASK | DESC_A_MASK);
env->eip = (uint32_t)env->star;
}
}
| {
"code": [],
"line_no": []
} | void FUNC_0(CPUX86State *VAR_0, int VAR_1)
{
int VAR_2;
if (!(VAR_0->efer & MSR_EFER_SCE)) {
raise_exception_err(VAR_0, EXCP06_ILLOP, 0);
}
VAR_2 = (VAR_0->star >> 32) & 0xffff;
if (VAR_0->hflags & HF_LMA_MASK) {
int VAR_3;
VAR_0->regs[R_ECX] = VAR_0->eip + VAR_1;
VAR_0->regs[11] = cpu_compute_eflags(VAR_0);
VAR_3 = VAR_0->hflags & HF_CS64_MASK;
VAR_0->eflags &= ~VAR_0->fmask;
cpu_load_eflags(VAR_0, VAR_0->eflags, 0);
cpu_x86_set_cpl(VAR_0, 0);
cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_2 & 0xfffc,
0, 0xffffffff,
DESC_G_MASK | DESC_P_MASK |
DESC_S_MASK |
DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK |
DESC_L_MASK);
cpu_x86_load_seg_cache(VAR_0, R_SS, (VAR_2 + 8) & 0xfffc,
0, 0xffffffff,
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
DESC_S_MASK |
DESC_W_MASK | DESC_A_MASK);
if (VAR_3) {
VAR_0->eip = VAR_0->lstar;
} else {
VAR_0->eip = VAR_0->cstar;
}
} else {
VAR_0->regs[R_ECX] = (uint32_t)(VAR_0->eip + VAR_1);
VAR_0->eflags &= ~(IF_MASK | RF_MASK | VM_MASK);
cpu_x86_set_cpl(VAR_0, 0);
cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_2 & 0xfffc,
0, 0xffffffff,
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
DESC_S_MASK |
DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
cpu_x86_load_seg_cache(VAR_0, R_SS, (VAR_2 + 8) & 0xfffc,
0, 0xffffffff,
DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
DESC_S_MASK |
DESC_W_MASK | DESC_A_MASK);
VAR_0->eip = (uint32_t)VAR_0->star;
}
}
| [
"void FUNC_0(CPUX86State *VAR_0, int VAR_1)\n{",
"int VAR_2;",
"if (!(VAR_0->efer & MSR_EFER_SCE)) {",
"raise_exception_err(VAR_0, EXCP06_ILLOP, 0);",
"}",
"VAR_2 = (VAR_0->star >> 32) & 0xffff;",
"if (VAR_0->hflags & HF_LMA_MASK) {",
"int VAR_3;",
"VAR_0->regs[R_ECX] = VAR_0->eip + VAR_1;",
"VAR_0->regs[11] = cpu_compute_eflags(VAR_0);",
"VAR_3 = VAR_0->hflags & HF_CS64_MASK;",
"VAR_0->eflags &= ~VAR_0->fmask;",
"cpu_load_eflags(VAR_0, VAR_0->eflags, 0);",
"cpu_x86_set_cpl(VAR_0, 0);",
"cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_2 & 0xfffc,\n0, 0xffffffff,\nDESC_G_MASK | DESC_P_MASK |\nDESC_S_MASK |\nDESC_CS_MASK | DESC_R_MASK | DESC_A_MASK |\nDESC_L_MASK);",
"cpu_x86_load_seg_cache(VAR_0, R_SS, (VAR_2 + 8) & 0xfffc,\n0, 0xffffffff,\nDESC_G_MASK | DESC_B_MASK | DESC_P_MASK |\nDESC_S_MASK |\nDESC_W_MASK | DESC_A_MASK);",
"if (VAR_3) {",
"VAR_0->eip = VAR_0->lstar;",
"} else {",
"VAR_0->eip = VAR_0->cstar;",
"}",
"} else {",
"VAR_0->regs[R_ECX] = (uint32_t)(VAR_0->eip + VAR_1);",
"VAR_0->eflags &= ~(IF_MASK | RF_MASK | VM_MASK);",
"cpu_x86_set_cpl(VAR_0, 0);",
"cpu_x86_load_seg_cache(VAR_0, R_CS, VAR_2 & 0xfffc,\n0, 0xffffffff,\nDESC_G_MASK | DESC_B_MASK | DESC_P_MASK |\nDESC_S_MASK |\nDESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);",
"cpu_x86_load_seg_cache(VAR_0, R_SS, (VAR_2 + 8) & 0xfffc,\n0, 0xffffffff,\nDESC_G_MASK | DESC_B_MASK | DESC_P_MASK |\nDESC_S_MASK |\nDESC_W_MASK | DESC_A_MASK);",
"VAR_0->eip = (uint32_t)VAR_0->star;",
"}",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39,
41,
43,
45,
47,
49
],
[
51,
53,
55,
57,
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
77
],
[
79
],
[
81,
83,
85,
87,
89
],
[
91,
93,
95,
97,
99
],
[
101
],
[
103
],
[
105
]
]
|
15,662 | static int net_socket_listen_init(NetClientState *peer,
const char *model,
const char *name,
const char *host_str)
{
NetClientState *nc;
NetSocketState *s;
struct sockaddr_in saddr;
int fd, ret;
Error *err = NULL;
if (parse_host_port(&saddr, host_str, &err) < 0) {
error_report_err(err);
return -1;
}
fd = qemu_socket(PF_INET, SOCK_STREAM, 0);
if (fd < 0) {
perror("socket");
return -1;
}
qemu_set_nonblock(fd);
socket_set_fast_reuse(fd);
ret = bind(fd, (struct sockaddr *)&saddr, sizeof(saddr));
if (ret < 0) {
perror("bind");
closesocket(fd);
return -1;
}
ret = listen(fd, 0);
if (ret < 0) {
perror("listen");
closesocket(fd);
return -1;
}
nc = qemu_new_net_client(&net_socket_info, peer, model, name);
s = DO_UPCAST(NetSocketState, nc, nc);
s->fd = -1;
s->listen_fd = fd;
s->nc.link_down = true;
net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);
qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s);
return 0;
}
| true | qemu | 0522a959aec29768610900636f6234ab40530f82 | static int net_socket_listen_init(NetClientState *peer,
const char *model,
const char *name,
const char *host_str)
{
NetClientState *nc;
NetSocketState *s;
struct sockaddr_in saddr;
int fd, ret;
Error *err = NULL;
if (parse_host_port(&saddr, host_str, &err) < 0) {
error_report_err(err);
return -1;
}
fd = qemu_socket(PF_INET, SOCK_STREAM, 0);
if (fd < 0) {
perror("socket");
return -1;
}
qemu_set_nonblock(fd);
socket_set_fast_reuse(fd);
ret = bind(fd, (struct sockaddr *)&saddr, sizeof(saddr));
if (ret < 0) {
perror("bind");
closesocket(fd);
return -1;
}
ret = listen(fd, 0);
if (ret < 0) {
perror("listen");
closesocket(fd);
return -1;
}
nc = qemu_new_net_client(&net_socket_info, peer, model, name);
s = DO_UPCAST(NetSocketState, nc, nc);
s->fd = -1;
s->listen_fd = fd;
s->nc.link_down = true;
net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);
qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s);
return 0;
}
| {
"code": [
" const char *host_str)",
" Error *err = NULL;",
" if (parse_host_port(&saddr, host_str, &err) < 0) {",
" error_report_err(err);",
" perror(\"socket\");",
" perror(\"bind\");",
" perror(\"listen\");",
" Error *err = NULL;",
" if (parse_host_port(&saddr, host_str, &err) < 0) {",
" error_report_err(err);",
" perror(\"socket\");",
" error_report_err(err);",
" Error *err = NULL;",
" if (parse_host_port(&saddr, host_str, &err) < 0) {",
" error_report_err(err);",
" error_report_err(err);",
" error_report_err(err);",
" Error *err = NULL;",
" error_report_err(err);",
" error_report_err(err);",
" perror(\"bind\");",
" error_report_err(err);",
" Error *err = NULL;"
],
"line_no": [
7,
19,
23,
25,
37,
55,
67,
19,
23,
25,
37,
25,
19,
23,
25,
25,
25,
19,
25,
25,
55,
25,
19
]
} | static int FUNC_0(NetClientState *VAR_0,
const char *VAR_1,
const char *VAR_2,
const char *VAR_3)
{
NetClientState *nc;
NetSocketState *s;
struct sockaddr_in VAR_4;
int VAR_5, VAR_6;
Error *err = NULL;
if (parse_host_port(&VAR_4, VAR_3, &err) < 0) {
error_report_err(err);
return -1;
}
VAR_5 = qemu_socket(PF_INET, SOCK_STREAM, 0);
if (VAR_5 < 0) {
perror("socket");
return -1;
}
qemu_set_nonblock(VAR_5);
socket_set_fast_reuse(VAR_5);
VAR_6 = bind(VAR_5, (struct sockaddr *)&VAR_4, sizeof(VAR_4));
if (VAR_6 < 0) {
perror("bind");
closesocket(VAR_5);
return -1;
}
VAR_6 = listen(VAR_5, 0);
if (VAR_6 < 0) {
perror("listen");
closesocket(VAR_5);
return -1;
}
nc = qemu_new_net_client(&net_socket_info, VAR_0, VAR_1, VAR_2);
s = DO_UPCAST(NetSocketState, nc, nc);
s->VAR_5 = -1;
s->listen_fd = VAR_5;
s->nc.link_down = true;
net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);
qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s);
return 0;
}
| [
"static int FUNC_0(NetClientState *VAR_0,\nconst char *VAR_1,\nconst char *VAR_2,\nconst char *VAR_3)\n{",
"NetClientState *nc;",
"NetSocketState *s;",
"struct sockaddr_in VAR_4;",
"int VAR_5, VAR_6;",
"Error *err = NULL;",
"if (parse_host_port(&VAR_4, VAR_3, &err) < 0) {",
"error_report_err(err);",
"return -1;",
"}",
"VAR_5 = qemu_socket(PF_INET, SOCK_STREAM, 0);",
"if (VAR_5 < 0) {",
"perror(\"socket\");",
"return -1;",
"}",
"qemu_set_nonblock(VAR_5);",
"socket_set_fast_reuse(VAR_5);",
"VAR_6 = bind(VAR_5, (struct sockaddr *)&VAR_4, sizeof(VAR_4));",
"if (VAR_6 < 0) {",
"perror(\"bind\");",
"closesocket(VAR_5);",
"return -1;",
"}",
"VAR_6 = listen(VAR_5, 0);",
"if (VAR_6 < 0) {",
"perror(\"listen\");",
"closesocket(VAR_5);",
"return -1;",
"}",
"nc = qemu_new_net_client(&net_socket_info, VAR_0, VAR_1, VAR_2);",
"s = DO_UPCAST(NetSocketState, nc, nc);",
"s->VAR_5 = -1;",
"s->listen_fd = VAR_5;",
"s->nc.link_down = true;",
"net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);",
"qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s);",
"return 0;",
"}"
]
| [
1,
0,
0,
0,
0,
1,
1,
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
1,
0,
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
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91
],
[
93
],
[
95
]
]
|
15,663 | static int check_oflag_copied(BlockDriverState *bs, BdrvCheckResult *res,
BdrvCheckMode fix)
{
BDRVQcowState *s = bs->opaque;
uint64_t *l2_table = qemu_blockalign(bs, s->cluster_size);
int ret;
int refcount;
int i, j;
for (i = 0; i < s->l1_size; i++) {
uint64_t l1_entry = s->l1_table[i];
uint64_t l2_offset = l1_entry & L1E_OFFSET_MASK;
bool l2_dirty = false;
if (!l2_offset) {
continue;
}
refcount = get_refcount(bs, l2_offset >> s->cluster_bits);
if (refcount < 0) {
/* don't print message nor increment check_errors */
continue;
}
if ((refcount == 1) != ((l1_entry & QCOW_OFLAG_COPIED) != 0)) {
fprintf(stderr, "%s OFLAG_COPIED L2 cluster: l1_index=%d "
"l1_entry=%" PRIx64 " refcount=%d\n",
fix & BDRV_FIX_ERRORS ? "Repairing" :
"ERROR",
i, l1_entry, refcount);
if (fix & BDRV_FIX_ERRORS) {
s->l1_table[i] = refcount == 1
? l1_entry | QCOW_OFLAG_COPIED
: l1_entry & ~QCOW_OFLAG_COPIED;
ret = qcow2_write_l1_entry(bs, i);
if (ret < 0) {
res->check_errors++;
goto fail;
}
res->corruptions_fixed++;
} else {
res->corruptions++;
}
}
ret = bdrv_pread(bs->file, l2_offset, l2_table,
s->l2_size * sizeof(uint64_t));
if (ret < 0) {
fprintf(stderr, "ERROR: Could not read L2 table: %s\n",
strerror(-ret));
res->check_errors++;
goto fail;
}
for (j = 0; j < s->l2_size; j++) {
uint64_t l2_entry = be64_to_cpu(l2_table[j]);
uint64_t data_offset = l2_entry & L2E_OFFSET_MASK;
int cluster_type = qcow2_get_cluster_type(l2_entry);
if ((cluster_type == QCOW2_CLUSTER_NORMAL) ||
((cluster_type == QCOW2_CLUSTER_ZERO) && (data_offset != 0))) {
refcount = get_refcount(bs, data_offset >> s->cluster_bits);
if (refcount < 0) {
/* don't print message nor increment check_errors */
continue;
}
if ((refcount == 1) != ((l2_entry & QCOW_OFLAG_COPIED) != 0)) {
fprintf(stderr, "%s OFLAG_COPIED data cluster: "
"l2_entry=%" PRIx64 " refcount=%d\n",
fix & BDRV_FIX_ERRORS ? "Repairing" :
"ERROR",
l2_entry, refcount);
if (fix & BDRV_FIX_ERRORS) {
l2_table[j] = cpu_to_be64(refcount == 1
? l2_entry | QCOW_OFLAG_COPIED
: l2_entry & ~QCOW_OFLAG_COPIED);
l2_dirty = true;
res->corruptions_fixed++;
} else {
res->corruptions++;
}
}
}
}
if (l2_dirty) {
ret = qcow2_pre_write_overlap_check(bs,
QCOW2_OL_DEFAULT & ~QCOW2_OL_ACTIVE_L2, l2_offset,
s->cluster_size);
if (ret < 0) {
fprintf(stderr, "ERROR: Could not write L2 table; metadata "
"overlap check failed: %s\n", strerror(-ret));
res->check_errors++;
goto fail;
}
ret = bdrv_pwrite(bs->file, l2_offset, l2_table, s->cluster_size);
if (ret < 0) {
fprintf(stderr, "ERROR: Could not write L2 table: %s\n",
strerror(-ret));
res->check_errors++;
goto fail;
}
}
}
ret = 0;
fail:
qemu_vfree(l2_table);
return ret;
}
| true | qemu | 231bb267644ee3a9ebfd9c7f42d5d41610194b45 | static int check_oflag_copied(BlockDriverState *bs, BdrvCheckResult *res,
BdrvCheckMode fix)
{
BDRVQcowState *s = bs->opaque;
uint64_t *l2_table = qemu_blockalign(bs, s->cluster_size);
int ret;
int refcount;
int i, j;
for (i = 0; i < s->l1_size; i++) {
uint64_t l1_entry = s->l1_table[i];
uint64_t l2_offset = l1_entry & L1E_OFFSET_MASK;
bool l2_dirty = false;
if (!l2_offset) {
continue;
}
refcount = get_refcount(bs, l2_offset >> s->cluster_bits);
if (refcount < 0) {
continue;
}
if ((refcount == 1) != ((l1_entry & QCOW_OFLAG_COPIED) != 0)) {
fprintf(stderr, "%s OFLAG_COPIED L2 cluster: l1_index=%d "
"l1_entry=%" PRIx64 " refcount=%d\n",
fix & BDRV_FIX_ERRORS ? "Repairing" :
"ERROR",
i, l1_entry, refcount);
if (fix & BDRV_FIX_ERRORS) {
s->l1_table[i] = refcount == 1
? l1_entry | QCOW_OFLAG_COPIED
: l1_entry & ~QCOW_OFLAG_COPIED;
ret = qcow2_write_l1_entry(bs, i);
if (ret < 0) {
res->check_errors++;
goto fail;
}
res->corruptions_fixed++;
} else {
res->corruptions++;
}
}
ret = bdrv_pread(bs->file, l2_offset, l2_table,
s->l2_size * sizeof(uint64_t));
if (ret < 0) {
fprintf(stderr, "ERROR: Could not read L2 table: %s\n",
strerror(-ret));
res->check_errors++;
goto fail;
}
for (j = 0; j < s->l2_size; j++) {
uint64_t l2_entry = be64_to_cpu(l2_table[j]);
uint64_t data_offset = l2_entry & L2E_OFFSET_MASK;
int cluster_type = qcow2_get_cluster_type(l2_entry);
if ((cluster_type == QCOW2_CLUSTER_NORMAL) ||
((cluster_type == QCOW2_CLUSTER_ZERO) && (data_offset != 0))) {
refcount = get_refcount(bs, data_offset >> s->cluster_bits);
if (refcount < 0) {
continue;
}
if ((refcount == 1) != ((l2_entry & QCOW_OFLAG_COPIED) != 0)) {
fprintf(stderr, "%s OFLAG_COPIED data cluster: "
"l2_entry=%" PRIx64 " refcount=%d\n",
fix & BDRV_FIX_ERRORS ? "Repairing" :
"ERROR",
l2_entry, refcount);
if (fix & BDRV_FIX_ERRORS) {
l2_table[j] = cpu_to_be64(refcount == 1
? l2_entry | QCOW_OFLAG_COPIED
: l2_entry & ~QCOW_OFLAG_COPIED);
l2_dirty = true;
res->corruptions_fixed++;
} else {
res->corruptions++;
}
}
}
}
if (l2_dirty) {
ret = qcow2_pre_write_overlap_check(bs,
QCOW2_OL_DEFAULT & ~QCOW2_OL_ACTIVE_L2, l2_offset,
s->cluster_size);
if (ret < 0) {
fprintf(stderr, "ERROR: Could not write L2 table; metadata "
"overlap check failed: %s\n", strerror(-ret));
res->check_errors++;
goto fail;
}
ret = bdrv_pwrite(bs->file, l2_offset, l2_table, s->cluster_size);
if (ret < 0) {
fprintf(stderr, "ERROR: Could not write L2 table: %s\n",
strerror(-ret));
res->check_errors++;
goto fail;
}
}
}
ret = 0;
fail:
qemu_vfree(l2_table);
return ret;
}
| {
"code": [
" ret = qcow2_pre_write_overlap_check(bs,",
" QCOW2_OL_DEFAULT & ~QCOW2_OL_ACTIVE_L2, l2_offset,",
" s->cluster_size);"
],
"line_no": [
171,
173,
175
]
} | static int FUNC_0(BlockDriverState *VAR_0, BdrvCheckResult *VAR_1,
BdrvCheckMode VAR_2)
{
BDRVQcowState *s = VAR_0->opaque;
uint64_t *l2_table = qemu_blockalign(VAR_0, s->cluster_size);
int VAR_3;
int VAR_4;
int VAR_5, VAR_6;
for (VAR_5 = 0; VAR_5 < s->l1_size; VAR_5++) {
uint64_t l1_entry = s->l1_table[VAR_5];
uint64_t l2_offset = l1_entry & L1E_OFFSET_MASK;
bool l2_dirty = false;
if (!l2_offset) {
continue;
}
VAR_4 = get_refcount(VAR_0, l2_offset >> s->cluster_bits);
if (VAR_4 < 0) {
continue;
}
if ((VAR_4 == 1) != ((l1_entry & QCOW_OFLAG_COPIED) != 0)) {
fprintf(stderr, "%s OFLAG_COPIED L2 cluster: l1_index=%d "
"l1_entry=%" PRIx64 " VAR_4=%d\n",
VAR_2 & BDRV_FIX_ERRORS ? "Repairing" :
"ERROR",
VAR_5, l1_entry, VAR_4);
if (VAR_2 & BDRV_FIX_ERRORS) {
s->l1_table[VAR_5] = VAR_4 == 1
? l1_entry | QCOW_OFLAG_COPIED
: l1_entry & ~QCOW_OFLAG_COPIED;
VAR_3 = qcow2_write_l1_entry(VAR_0, VAR_5);
if (VAR_3 < 0) {
VAR_1->check_errors++;
goto fail;
}
VAR_1->corruptions_fixed++;
} else {
VAR_1->corruptions++;
}
}
VAR_3 = bdrv_pread(VAR_0->file, l2_offset, l2_table,
s->l2_size * sizeof(uint64_t));
if (VAR_3 < 0) {
fprintf(stderr, "ERROR: Could not read L2 table: %s\n",
strerror(-VAR_3));
VAR_1->check_errors++;
goto fail;
}
for (VAR_6 = 0; VAR_6 < s->l2_size; VAR_6++) {
uint64_t l2_entry = be64_to_cpu(l2_table[VAR_6]);
uint64_t data_offset = l2_entry & L2E_OFFSET_MASK;
int cluster_type = qcow2_get_cluster_type(l2_entry);
if ((cluster_type == QCOW2_CLUSTER_NORMAL) ||
((cluster_type == QCOW2_CLUSTER_ZERO) && (data_offset != 0))) {
VAR_4 = get_refcount(VAR_0, data_offset >> s->cluster_bits);
if (VAR_4 < 0) {
continue;
}
if ((VAR_4 == 1) != ((l2_entry & QCOW_OFLAG_COPIED) != 0)) {
fprintf(stderr, "%s OFLAG_COPIED data cluster: "
"l2_entry=%" PRIx64 " VAR_4=%d\n",
VAR_2 & BDRV_FIX_ERRORS ? "Repairing" :
"ERROR",
l2_entry, VAR_4);
if (VAR_2 & BDRV_FIX_ERRORS) {
l2_table[VAR_6] = cpu_to_be64(VAR_4 == 1
? l2_entry | QCOW_OFLAG_COPIED
: l2_entry & ~QCOW_OFLAG_COPIED);
l2_dirty = true;
VAR_1->corruptions_fixed++;
} else {
VAR_1->corruptions++;
}
}
}
}
if (l2_dirty) {
VAR_3 = qcow2_pre_write_overlap_check(VAR_0,
QCOW2_OL_DEFAULT & ~QCOW2_OL_ACTIVE_L2, l2_offset,
s->cluster_size);
if (VAR_3 < 0) {
fprintf(stderr, "ERROR: Could not write L2 table; metadata "
"overlap check failed: %s\n", strerror(-VAR_3));
VAR_1->check_errors++;
goto fail;
}
VAR_3 = bdrv_pwrite(VAR_0->file, l2_offset, l2_table, s->cluster_size);
if (VAR_3 < 0) {
fprintf(stderr, "ERROR: Could not write L2 table: %s\n",
strerror(-VAR_3));
VAR_1->check_errors++;
goto fail;
}
}
}
VAR_3 = 0;
fail:
qemu_vfree(l2_table);
return VAR_3;
}
| [
"static int FUNC_0(BlockDriverState *VAR_0, BdrvCheckResult *VAR_1,\nBdrvCheckMode VAR_2)\n{",
"BDRVQcowState *s = VAR_0->opaque;",
"uint64_t *l2_table = qemu_blockalign(VAR_0, s->cluster_size);",
"int VAR_3;",
"int VAR_4;",
"int VAR_5, VAR_6;",
"for (VAR_5 = 0; VAR_5 < s->l1_size; VAR_5++) {",
"uint64_t l1_entry = s->l1_table[VAR_5];",
"uint64_t l2_offset = l1_entry & L1E_OFFSET_MASK;",
"bool l2_dirty = false;",
"if (!l2_offset) {",
"continue;",
"}",
"VAR_4 = get_refcount(VAR_0, l2_offset >> s->cluster_bits);",
"if (VAR_4 < 0) {",
"continue;",
"}",
"if ((VAR_4 == 1) != ((l1_entry & QCOW_OFLAG_COPIED) != 0)) {",
"fprintf(stderr, \"%s OFLAG_COPIED L2 cluster: l1_index=%d \"\n\"l1_entry=%\" PRIx64 \" VAR_4=%d\\n\",\nVAR_2 & BDRV_FIX_ERRORS ? \"Repairing\" :\n\"ERROR\",\nVAR_5, l1_entry, VAR_4);",
"if (VAR_2 & BDRV_FIX_ERRORS) {",
"s->l1_table[VAR_5] = VAR_4 == 1\n? l1_entry | QCOW_OFLAG_COPIED\n: l1_entry & ~QCOW_OFLAG_COPIED;",
"VAR_3 = qcow2_write_l1_entry(VAR_0, VAR_5);",
"if (VAR_3 < 0) {",
"VAR_1->check_errors++;",
"goto fail;",
"}",
"VAR_1->corruptions_fixed++;",
"} else {",
"VAR_1->corruptions++;",
"}",
"}",
"VAR_3 = bdrv_pread(VAR_0->file, l2_offset, l2_table,\ns->l2_size * sizeof(uint64_t));",
"if (VAR_3 < 0) {",
"fprintf(stderr, \"ERROR: Could not read L2 table: %s\\n\",\nstrerror(-VAR_3));",
"VAR_1->check_errors++;",
"goto fail;",
"}",
"for (VAR_6 = 0; VAR_6 < s->l2_size; VAR_6++) {",
"uint64_t l2_entry = be64_to_cpu(l2_table[VAR_6]);",
"uint64_t data_offset = l2_entry & L2E_OFFSET_MASK;",
"int cluster_type = qcow2_get_cluster_type(l2_entry);",
"if ((cluster_type == QCOW2_CLUSTER_NORMAL) ||\n((cluster_type == QCOW2_CLUSTER_ZERO) && (data_offset != 0))) {",
"VAR_4 = get_refcount(VAR_0, data_offset >> s->cluster_bits);",
"if (VAR_4 < 0) {",
"continue;",
"}",
"if ((VAR_4 == 1) != ((l2_entry & QCOW_OFLAG_COPIED) != 0)) {",
"fprintf(stderr, \"%s OFLAG_COPIED data cluster: \"\n\"l2_entry=%\" PRIx64 \" VAR_4=%d\\n\",\nVAR_2 & BDRV_FIX_ERRORS ? \"Repairing\" :\n\"ERROR\",\nl2_entry, VAR_4);",
"if (VAR_2 & BDRV_FIX_ERRORS) {",
"l2_table[VAR_6] = cpu_to_be64(VAR_4 == 1\n? l2_entry | QCOW_OFLAG_COPIED\n: l2_entry & ~QCOW_OFLAG_COPIED);",
"l2_dirty = true;",
"VAR_1->corruptions_fixed++;",
"} else {",
"VAR_1->corruptions++;",
"}",
"}",
"}",
"}",
"if (l2_dirty) {",
"VAR_3 = qcow2_pre_write_overlap_check(VAR_0,\nQCOW2_OL_DEFAULT & ~QCOW2_OL_ACTIVE_L2, l2_offset,\ns->cluster_size);",
"if (VAR_3 < 0) {",
"fprintf(stderr, \"ERROR: Could not write L2 table; metadata \"",
"\"overlap check failed: %s\\n\", strerror(-VAR_3));",
"VAR_1->check_errors++;",
"goto fail;",
"}",
"VAR_3 = bdrv_pwrite(VAR_0->file, l2_offset, l2_table, s->cluster_size);",
"if (VAR_3 < 0) {",
"fprintf(stderr, \"ERROR: Could not write L2 table: %s\\n\",\nstrerror(-VAR_3));",
"VAR_1->check_errors++;",
"goto fail;",
"}",
"}",
"}",
"VAR_3 = 0;",
"fail:\nqemu_vfree(l2_table);",
"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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49,
51,
53,
55,
57
],
[
59
],
[
61,
63,
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
89,
91
],
[
93
],
[
95,
97
],
[
99
],
[
101
],
[
103
],
[
107
],
[
109
],
[
111
],
[
113
],
[
117,
119
],
[
121
],
[
123
],
[
127
],
[
129
],
[
131
],
[
133,
135,
137,
139,
141
],
[
143
],
[
145,
147,
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
169
],
[
171,
173,
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
191
],
[
193
],
[
195,
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
211
],
[
215,
217
],
[
219
],
[
221
]
]
|
15,665 | static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
const char *name, int devfn,
PCIConfigReadFunc *config_read,
PCIConfigWriteFunc *config_write,
uint8_t header_type)
{
if (devfn < 0) {
for(devfn = bus->devfn_min ; devfn < 256; devfn += 8) {
if (!bus->devices[devfn])
goto found;
}
return NULL;
found: ;
} else if (bus->devices[devfn]) {
return NULL;
}
pci_dev->bus = bus;
pci_dev->devfn = devfn;
pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
memset(pci_dev->irq_state, 0, sizeof(pci_dev->irq_state));
pci_config_alloc(pci_dev);
header_type &= ~PCI_HEADER_TYPE_MULTI_FUNCTION;
if (header_type == PCI_HEADER_TYPE_NORMAL) {
pci_set_default_subsystem_id(pci_dev);
}
pci_init_cmask(pci_dev);
pci_init_wmask(pci_dev);
if (header_type == PCI_HEADER_TYPE_BRIDGE) {
pci_init_wmask_bridge(pci_dev);
}
if (!config_read)
config_read = pci_default_read_config;
if (!config_write)
config_write = pci_default_write_config;
pci_dev->config_read = config_read;
pci_dev->config_write = config_write;
bus->devices[devfn] = pci_dev;
pci_dev->irq = qemu_allocate_irqs(pci_set_irq, pci_dev, PCI_NUM_PINS);
pci_dev->version_id = 2; /* Current pci device vmstate version */
return pci_dev;
}
| true | qemu | c364c974d9ab90e25e7887f516da65d2811ba5e3 | static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
const char *name, int devfn,
PCIConfigReadFunc *config_read,
PCIConfigWriteFunc *config_write,
uint8_t header_type)
{
if (devfn < 0) {
for(devfn = bus->devfn_min ; devfn < 256; devfn += 8) {
if (!bus->devices[devfn])
goto found;
}
return NULL;
found: ;
} else if (bus->devices[devfn]) {
return NULL;
}
pci_dev->bus = bus;
pci_dev->devfn = devfn;
pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
memset(pci_dev->irq_state, 0, sizeof(pci_dev->irq_state));
pci_config_alloc(pci_dev);
header_type &= ~PCI_HEADER_TYPE_MULTI_FUNCTION;
if (header_type == PCI_HEADER_TYPE_NORMAL) {
pci_set_default_subsystem_id(pci_dev);
}
pci_init_cmask(pci_dev);
pci_init_wmask(pci_dev);
if (header_type == PCI_HEADER_TYPE_BRIDGE) {
pci_init_wmask_bridge(pci_dev);
}
if (!config_read)
config_read = pci_default_read_config;
if (!config_write)
config_write = pci_default_write_config;
pci_dev->config_read = config_read;
pci_dev->config_write = config_write;
bus->devices[devfn] = pci_dev;
pci_dev->irq = qemu_allocate_irqs(pci_set_irq, pci_dev, PCI_NUM_PINS);
pci_dev->version_id = 2;
return pci_dev;
}
| {
"code": [
" return NULL;",
" return NULL;"
],
"line_no": [
23,
23
]
} | static PCIDevice *FUNC_0(PCIDevice *pci_dev, PCIBus *bus,
const char *name, int devfn,
PCIConfigReadFunc *config_read,
PCIConfigWriteFunc *config_write,
uint8_t header_type)
{
if (devfn < 0) {
for(devfn = bus->devfn_min ; devfn < 256; devfn += 8) {
if (!bus->devices[devfn])
goto found;
}
return NULL;
found: ;
} else if (bus->devices[devfn]) {
return NULL;
}
pci_dev->bus = bus;
pci_dev->devfn = devfn;
pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
memset(pci_dev->irq_state, 0, sizeof(pci_dev->irq_state));
pci_config_alloc(pci_dev);
header_type &= ~PCI_HEADER_TYPE_MULTI_FUNCTION;
if (header_type == PCI_HEADER_TYPE_NORMAL) {
pci_set_default_subsystem_id(pci_dev);
}
pci_init_cmask(pci_dev);
pci_init_wmask(pci_dev);
if (header_type == PCI_HEADER_TYPE_BRIDGE) {
pci_init_wmask_bridge(pci_dev);
}
if (!config_read)
config_read = pci_default_read_config;
if (!config_write)
config_write = pci_default_write_config;
pci_dev->config_read = config_read;
pci_dev->config_write = config_write;
bus->devices[devfn] = pci_dev;
pci_dev->irq = qemu_allocate_irqs(pci_set_irq, pci_dev, PCI_NUM_PINS);
pci_dev->version_id = 2;
return pci_dev;
}
| [
"static PCIDevice *FUNC_0(PCIDevice *pci_dev, PCIBus *bus,\nconst char *name, int devfn,\nPCIConfigReadFunc *config_read,\nPCIConfigWriteFunc *config_write,\nuint8_t header_type)\n{",
"if (devfn < 0) {",
"for(devfn = bus->devfn_min ; devfn < 256; devfn += 8) {",
"if (!bus->devices[devfn])\ngoto found;",
"}",
"return NULL;",
"found: ;",
"} else if (bus->devices[devfn]) {",
"return NULL;",
"}",
"pci_dev->bus = bus;",
"pci_dev->devfn = devfn;",
"pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);",
"memset(pci_dev->irq_state, 0, sizeof(pci_dev->irq_state));",
"pci_config_alloc(pci_dev);",
"header_type &= ~PCI_HEADER_TYPE_MULTI_FUNCTION;",
"if (header_type == PCI_HEADER_TYPE_NORMAL) {",
"pci_set_default_subsystem_id(pci_dev);",
"}",
"pci_init_cmask(pci_dev);",
"pci_init_wmask(pci_dev);",
"if (header_type == PCI_HEADER_TYPE_BRIDGE) {",
"pci_init_wmask_bridge(pci_dev);",
"}",
"if (!config_read)\nconfig_read = pci_default_read_config;",
"if (!config_write)\nconfig_write = pci_default_write_config;",
"pci_dev->config_read = config_read;",
"pci_dev->config_write = config_write;",
"bus->devices[devfn] = pci_dev;",
"pci_dev->irq = qemu_allocate_irqs(pci_set_irq, pci_dev, PCI_NUM_PINS);",
"pci_dev->version_id = 2;",
"return pci_dev;",
"}"
]
| [
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7,
9,
11
],
[
13
],
[
15
],
[
17,
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65,
67
],
[
69,
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
]
]
|
15,666 | static void put_int8(QEMUFile *f, void *pv, size_t size)
{
int8_t *v = pv;
qemu_put_s8s(f, v);
}
| true | qemu | 60fe637bf0e4d7989e21e50f52526444765c63b4 | static void put_int8(QEMUFile *f, void *pv, size_t size)
{
int8_t *v = pv;
qemu_put_s8s(f, v);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(QEMUFile *VAR_0, void *VAR_1, size_t VAR_2)
{
int8_t *v = VAR_1;
qemu_put_s8s(VAR_0, v);
}
| [
"static void FUNC_0(QEMUFile *VAR_0, void *VAR_1, size_t VAR_2)\n{",
"int8_t *v = VAR_1;",
"qemu_put_s8s(VAR_0, v);",
"}"
]
| [
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
]
]
|
15,667 | static void decode_q_branch(SnowContext *s, int level, int x, int y){
const int w= s->b_width << s->block_max_depth;
const int rem_depth= s->block_max_depth - level;
const int index= (x + y*w) << rem_depth;
int trx= (x+1)<<rem_depth;
const BlockNode *left = x ? &s->block[index-1] : &null_block;
const BlockNode *top = y ? &s->block[index-w] : &null_block;
const BlockNode *tl = y && x ? &s->block[index-w-1] : left;
const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl; //FIXME use lt
int s_context= 2*left->level + 2*top->level + tl->level + tr->level;
if(s->keyframe){
set_blocks(s, level, x, y, null_block.color[0], null_block.color[1], null_block.color[2], null_block.mx, null_block.my, null_block.ref, BLOCK_INTRA);
return;
}
if(level==s->block_max_depth || get_rac(&s->c, &s->block_state[4 + s_context])){
int type, mx, my;
int l = left->color[0];
int cb= left->color[1];
int cr= left->color[2];
int ref = 0;
int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref);
int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 0*av_log2(2*FFABS(tr->mx - top->mx));
int my_context= av_log2(2*FFABS(left->my - top->my)) + 0*av_log2(2*FFABS(tr->my - top->my));
type= get_rac(&s->c, &s->block_state[1 + left->type + top->type]) ? BLOCK_INTRA : 0;
if(type){
pred_mv(s, &mx, &my, 0, left, top, tr);
l += get_symbol(&s->c, &s->block_state[32], 1);
cb+= get_symbol(&s->c, &s->block_state[64], 1);
cr+= get_symbol(&s->c, &s->block_state[96], 1);
}else{
if(s->ref_frames > 1)
ref= get_symbol(&s->c, &s->block_state[128 + 1024 + 32*ref_context], 0);
pred_mv(s, &mx, &my, ref, left, top, tr);
mx+= get_symbol(&s->c, &s->block_state[128 + 32*(mx_context + 16*!!ref)], 1);
my+= get_symbol(&s->c, &s->block_state[128 + 32*(my_context + 16*!!ref)], 1);
}
set_blocks(s, level, x, y, l, cb, cr, mx, my, ref, type);
}else{
decode_q_branch(s, level+1, 2*x+0, 2*y+0);
decode_q_branch(s, level+1, 2*x+1, 2*y+0);
decode_q_branch(s, level+1, 2*x+0, 2*y+1);
decode_q_branch(s, level+1, 2*x+1, 2*y+1);
}
}
| true | FFmpeg | 0af48e29f55a4e5824e6f7157ac94cf8b210aa84 | static void decode_q_branch(SnowContext *s, int level, int x, int y){
const int w= s->b_width << s->block_max_depth;
const int rem_depth= s->block_max_depth - level;
const int index= (x + y*w) << rem_depth;
int trx= (x+1)<<rem_depth;
const BlockNode *left = x ? &s->block[index-1] : &null_block;
const BlockNode *top = y ? &s->block[index-w] : &null_block;
const BlockNode *tl = y && x ? &s->block[index-w-1] : left;
const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl;
int s_context= 2*left->level + 2*top->level + tl->level + tr->level;
if(s->keyframe){
set_blocks(s, level, x, y, null_block.color[0], null_block.color[1], null_block.color[2], null_block.mx, null_block.my, null_block.ref, BLOCK_INTRA);
return;
}
if(level==s->block_max_depth || get_rac(&s->c, &s->block_state[4 + s_context])){
int type, mx, my;
int l = left->color[0];
int cb= left->color[1];
int cr= left->color[2];
int ref = 0;
int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref);
int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 0*av_log2(2*FFABS(tr->mx - top->mx));
int my_context= av_log2(2*FFABS(left->my - top->my)) + 0*av_log2(2*FFABS(tr->my - top->my));
type= get_rac(&s->c, &s->block_state[1 + left->type + top->type]) ? BLOCK_INTRA : 0;
if(type){
pred_mv(s, &mx, &my, 0, left, top, tr);
l += get_symbol(&s->c, &s->block_state[32], 1);
cb+= get_symbol(&s->c, &s->block_state[64], 1);
cr+= get_symbol(&s->c, &s->block_state[96], 1);
}else{
if(s->ref_frames > 1)
ref= get_symbol(&s->c, &s->block_state[128 + 1024 + 32*ref_context], 0);
pred_mv(s, &mx, &my, ref, left, top, tr);
mx+= get_symbol(&s->c, &s->block_state[128 + 32*(mx_context + 16*!!ref)], 1);
my+= get_symbol(&s->c, &s->block_state[128 + 32*(my_context + 16*!!ref)], 1);
}
set_blocks(s, level, x, y, l, cb, cr, mx, my, ref, type);
}else{
decode_q_branch(s, level+1, 2*x+0, 2*y+0);
decode_q_branch(s, level+1, 2*x+1, 2*y+0);
decode_q_branch(s, level+1, 2*x+0, 2*y+1);
decode_q_branch(s, level+1, 2*x+1, 2*y+1);
}
}
| {
"code": [
"static void decode_q_branch(SnowContext *s, int level, int x, int y){",
" decode_q_branch(s, level+1, 2*x+0, 2*y+0);",
" decode_q_branch(s, level+1, 2*x+1, 2*y+0);",
" decode_q_branch(s, level+1, 2*x+0, 2*y+1);",
" decode_q_branch(s, level+1, 2*x+1, 2*y+1);"
],
"line_no": [
1,
85,
87,
89,
91
]
} | static void FUNC_0(SnowContext *VAR_0, int VAR_1, int VAR_2, int VAR_3){
const int VAR_4= VAR_0->b_width << VAR_0->block_max_depth;
const int VAR_5= VAR_0->block_max_depth - VAR_1;
const int VAR_6= (VAR_2 + VAR_3*VAR_4) << VAR_5;
int VAR_7= (VAR_2+1)<<VAR_5;
const BlockNode *VAR_8 = VAR_2 ? &VAR_0->block[VAR_6-1] : &null_block;
const BlockNode *VAR_9 = VAR_3 ? &VAR_0->block[VAR_6-VAR_4] : &null_block;
const BlockNode *VAR_10 = VAR_3 && VAR_2 ? &VAR_0->block[VAR_6-VAR_4-1] : VAR_8;
const BlockNode *VAR_11 = VAR_3 && VAR_7<VAR_4 && ((VAR_2&1)==0 || VAR_1==0) ? &VAR_0->block[VAR_6-VAR_4+(1<<VAR_5)] : VAR_10;
int VAR_12= 2*VAR_8->VAR_1 + 2*VAR_9->VAR_1 + VAR_10->VAR_1 + VAR_11->VAR_1;
if(VAR_0->keyframe){
set_blocks(VAR_0, VAR_1, VAR_2, VAR_3, null_block.color[0], null_block.color[1], null_block.color[2], null_block.VAR_14, null_block.VAR_15, null_block.VAR_19, BLOCK_INTRA);
return;
}
if(VAR_1==VAR_0->block_max_depth || get_rac(&VAR_0->c, &VAR_0->block_state[4 + VAR_12])){
int VAR_13, VAR_14, VAR_15;
int VAR_16 = VAR_8->color[0];
int VAR_17= VAR_8->color[1];
int VAR_18= VAR_8->color[2];
int VAR_19 = 0;
int VAR_20= av_log2(2*VAR_8->VAR_19) + av_log2(2*VAR_9->VAR_19);
int VAR_21= av_log2(2*FFABS(VAR_8->VAR_14 - VAR_9->VAR_14)) + 0*av_log2(2*FFABS(VAR_11->VAR_14 - VAR_9->VAR_14));
int VAR_22= av_log2(2*FFABS(VAR_8->VAR_15 - VAR_9->VAR_15)) + 0*av_log2(2*FFABS(VAR_11->VAR_15 - VAR_9->VAR_15));
VAR_13= get_rac(&VAR_0->c, &VAR_0->block_state[1 + VAR_8->VAR_13 + VAR_9->VAR_13]) ? BLOCK_INTRA : 0;
if(VAR_13){
pred_mv(VAR_0, &VAR_14, &VAR_15, 0, VAR_8, VAR_9, VAR_11);
VAR_16 += get_symbol(&VAR_0->c, &VAR_0->block_state[32], 1);
VAR_17+= get_symbol(&VAR_0->c, &VAR_0->block_state[64], 1);
VAR_18+= get_symbol(&VAR_0->c, &VAR_0->block_state[96], 1);
}else{
if(VAR_0->ref_frames > 1)
VAR_19= get_symbol(&VAR_0->c, &VAR_0->block_state[128 + 1024 + 32*VAR_20], 0);
pred_mv(VAR_0, &VAR_14, &VAR_15, VAR_19, VAR_8, VAR_9, VAR_11);
VAR_14+= get_symbol(&VAR_0->c, &VAR_0->block_state[128 + 32*(VAR_21 + 16*!!VAR_19)], 1);
VAR_15+= get_symbol(&VAR_0->c, &VAR_0->block_state[128 + 32*(VAR_22 + 16*!!VAR_19)], 1);
}
set_blocks(VAR_0, VAR_1, VAR_2, VAR_3, VAR_16, VAR_17, VAR_18, VAR_14, VAR_15, VAR_19, VAR_13);
}else{
FUNC_0(VAR_0, VAR_1+1, 2*VAR_2+0, 2*VAR_3+0);
FUNC_0(VAR_0, VAR_1+1, 2*VAR_2+1, 2*VAR_3+0);
FUNC_0(VAR_0, VAR_1+1, 2*VAR_2+0, 2*VAR_3+1);
FUNC_0(VAR_0, VAR_1+1, 2*VAR_2+1, 2*VAR_3+1);
}
}
| [
"static void FUNC_0(SnowContext *VAR_0, int VAR_1, int VAR_2, int VAR_3){",
"const int VAR_4= VAR_0->b_width << VAR_0->block_max_depth;",
"const int VAR_5= VAR_0->block_max_depth - VAR_1;",
"const int VAR_6= (VAR_2 + VAR_3*VAR_4) << VAR_5;",
"int VAR_7= (VAR_2+1)<<VAR_5;",
"const BlockNode *VAR_8 = VAR_2 ? &VAR_0->block[VAR_6-1] : &null_block;",
"const BlockNode *VAR_9 = VAR_3 ? &VAR_0->block[VAR_6-VAR_4] : &null_block;",
"const BlockNode *VAR_10 = VAR_3 && VAR_2 ? &VAR_0->block[VAR_6-VAR_4-1] : VAR_8;",
"const BlockNode *VAR_11 = VAR_3 && VAR_7<VAR_4 && ((VAR_2&1)==0 || VAR_1==0) ? &VAR_0->block[VAR_6-VAR_4+(1<<VAR_5)] : VAR_10;",
"int VAR_12= 2*VAR_8->VAR_1 + 2*VAR_9->VAR_1 + VAR_10->VAR_1 + VAR_11->VAR_1;",
"if(VAR_0->keyframe){",
"set_blocks(VAR_0, VAR_1, VAR_2, VAR_3, null_block.color[0], null_block.color[1], null_block.color[2], null_block.VAR_14, null_block.VAR_15, null_block.VAR_19, BLOCK_INTRA);",
"return;",
"}",
"if(VAR_1==VAR_0->block_max_depth || get_rac(&VAR_0->c, &VAR_0->block_state[4 + VAR_12])){",
"int VAR_13, VAR_14, VAR_15;",
"int VAR_16 = VAR_8->color[0];",
"int VAR_17= VAR_8->color[1];",
"int VAR_18= VAR_8->color[2];",
"int VAR_19 = 0;",
"int VAR_20= av_log2(2*VAR_8->VAR_19) + av_log2(2*VAR_9->VAR_19);",
"int VAR_21= av_log2(2*FFABS(VAR_8->VAR_14 - VAR_9->VAR_14)) + 0*av_log2(2*FFABS(VAR_11->VAR_14 - VAR_9->VAR_14));",
"int VAR_22= av_log2(2*FFABS(VAR_8->VAR_15 - VAR_9->VAR_15)) + 0*av_log2(2*FFABS(VAR_11->VAR_15 - VAR_9->VAR_15));",
"VAR_13= get_rac(&VAR_0->c, &VAR_0->block_state[1 + VAR_8->VAR_13 + VAR_9->VAR_13]) ? BLOCK_INTRA : 0;",
"if(VAR_13){",
"pred_mv(VAR_0, &VAR_14, &VAR_15, 0, VAR_8, VAR_9, VAR_11);",
"VAR_16 += get_symbol(&VAR_0->c, &VAR_0->block_state[32], 1);",
"VAR_17+= get_symbol(&VAR_0->c, &VAR_0->block_state[64], 1);",
"VAR_18+= get_symbol(&VAR_0->c, &VAR_0->block_state[96], 1);",
"}else{",
"if(VAR_0->ref_frames > 1)\nVAR_19= get_symbol(&VAR_0->c, &VAR_0->block_state[128 + 1024 + 32*VAR_20], 0);",
"pred_mv(VAR_0, &VAR_14, &VAR_15, VAR_19, VAR_8, VAR_9, VAR_11);",
"VAR_14+= get_symbol(&VAR_0->c, &VAR_0->block_state[128 + 32*(VAR_21 + 16*!!VAR_19)], 1);",
"VAR_15+= get_symbol(&VAR_0->c, &VAR_0->block_state[128 + 32*(VAR_22 + 16*!!VAR_19)], 1);",
"}",
"set_blocks(VAR_0, VAR_1, VAR_2, VAR_3, VAR_16, VAR_17, VAR_18, VAR_14, VAR_15, VAR_19, VAR_13);",
"}else{",
"FUNC_0(VAR_0, VAR_1+1, 2*VAR_2+0, 2*VAR_3+0);",
"FUNC_0(VAR_0, VAR_1+1, 2*VAR_2+1, 2*VAR_3+0);",
"FUNC_0(VAR_0, VAR_1+1, 2*VAR_2+0, 2*VAR_3+1);",
"FUNC_0(VAR_0, VAR_1+1, 2*VAR_2+1, 2*VAR_3+1);",
"}",
"}"
]
| [
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
1,
0,
0
]
| [
[
1
],
[
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69,
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
]
]
|
15,668 | static int encode_tile(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile, int tileno)
{
int compno, reslevelno, bandno, ret;
Jpeg2000T1Context t1;
Jpeg2000CodingStyle *codsty = &s->codsty;
for (compno = 0; compno < s->ncomponents; compno++){
Jpeg2000Component *comp = s->tile[tileno].comp + compno;
av_log(s->avctx, AV_LOG_DEBUG,"dwt\n");
if (ret = ff_dwt_encode(&comp->dwt, comp->i_data))
return ret;
av_log(s->avctx, AV_LOG_DEBUG,"after dwt -> tier1\n");
for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){
Jpeg2000ResLevel *reslevel = comp->reslevel + reslevelno;
for (bandno = 0; bandno < reslevel->nbands ; bandno++){
Jpeg2000Band *band = reslevel->band + bandno;
Jpeg2000Prec *prec = band->prec; // we support only 1 precinct per band ATM in the encoder
int cblkx, cblky, cblkno=0, xx0, x0, xx1, y0, yy0, yy1, bandpos;
yy0 = bandno == 0 ? 0 : comp->reslevel[reslevelno-1].coord[1][1] - comp->reslevel[reslevelno-1].coord[1][0];
y0 = yy0;
yy1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[1][0] + 1, band->log2_cblk_height) << band->log2_cblk_height,
band->coord[1][1]) - band->coord[1][0] + yy0;
if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1])
continue;
bandpos = bandno + (reslevelno > 0);
for (cblky = 0; cblky < prec->nb_codeblocks_height; cblky++){
if (reslevelno == 0 || bandno == 1)
xx0 = 0;
else
xx0 = comp->reslevel[reslevelno-1].coord[0][1] - comp->reslevel[reslevelno-1].coord[0][0];
x0 = xx0;
xx1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[0][0] + 1, band->log2_cblk_width) << band->log2_cblk_width,
band->coord[0][1]) - band->coord[0][0] + xx0;
for (cblkx = 0; cblkx < prec->nb_codeblocks_width; cblkx++, cblkno++){
int y, x;
if (codsty->transform == FF_DWT53){
for (y = yy0; y < yy1; y++){
int *ptr = t1.data[y-yy0];
for (x = xx0; x < xx1; x++){
*ptr++ = comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x] << NMSEDEC_FRACBITS;
}
}
} else{
for (y = yy0; y < yy1; y++){
int *ptr = t1.data[y-yy0];
for (x = xx0; x < xx1; x++){
*ptr = (comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x]);
*ptr = (int64_t)*ptr * (int64_t)(16384 * 65536 / band->i_stepsize) >> 14 - NMSEDEC_FRACBITS;
ptr++;
}
}
}
encode_cblk(s, &t1, prec->cblk + cblkno, tile, xx1 - xx0, yy1 - yy0,
bandpos, codsty->nreslevels - reslevelno - 1);
xx0 = xx1;
xx1 = FFMIN(xx1 + (1 << band->log2_cblk_width), band->coord[0][1] - band->coord[0][0] + x0);
}
yy0 = yy1;
yy1 = FFMIN(yy1 + (1 << band->log2_cblk_height), band->coord[1][1] - band->coord[1][0] + y0);
}
}
}
av_log(s->avctx, AV_LOG_DEBUG, "after tier1\n");
}
av_log(s->avctx, AV_LOG_DEBUG, "rate control\n");
truncpasses(s, tile);
if (ret = encode_packets(s, tile, tileno))
return ret;
av_log(s->avctx, AV_LOG_DEBUG, "after rate control\n");
return 0;
}
| true | FFmpeg | f57119b8e58cb5437c3ab40d797293ecb9b4a894 | static int encode_tile(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile, int tileno)
{
int compno, reslevelno, bandno, ret;
Jpeg2000T1Context t1;
Jpeg2000CodingStyle *codsty = &s->codsty;
for (compno = 0; compno < s->ncomponents; compno++){
Jpeg2000Component *comp = s->tile[tileno].comp + compno;
av_log(s->avctx, AV_LOG_DEBUG,"dwt\n");
if (ret = ff_dwt_encode(&comp->dwt, comp->i_data))
return ret;
av_log(s->avctx, AV_LOG_DEBUG,"after dwt -> tier1\n");
for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){
Jpeg2000ResLevel *reslevel = comp->reslevel + reslevelno;
for (bandno = 0; bandno < reslevel->nbands ; bandno++){
Jpeg2000Band *band = reslevel->band + bandno;
Jpeg2000Prec *prec = band->prec;
int cblkx, cblky, cblkno=0, xx0, x0, xx1, y0, yy0, yy1, bandpos;
yy0 = bandno == 0 ? 0 : comp->reslevel[reslevelno-1].coord[1][1] - comp->reslevel[reslevelno-1].coord[1][0];
y0 = yy0;
yy1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[1][0] + 1, band->log2_cblk_height) << band->log2_cblk_height,
band->coord[1][1]) - band->coord[1][0] + yy0;
if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1])
continue;
bandpos = bandno + (reslevelno > 0);
for (cblky = 0; cblky < prec->nb_codeblocks_height; cblky++){
if (reslevelno == 0 || bandno == 1)
xx0 = 0;
else
xx0 = comp->reslevel[reslevelno-1].coord[0][1] - comp->reslevel[reslevelno-1].coord[0][0];
x0 = xx0;
xx1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[0][0] + 1, band->log2_cblk_width) << band->log2_cblk_width,
band->coord[0][1]) - band->coord[0][0] + xx0;
for (cblkx = 0; cblkx < prec->nb_codeblocks_width; cblkx++, cblkno++){
int y, x;
if (codsty->transform == FF_DWT53){
for (y = yy0; y < yy1; y++){
int *ptr = t1.data[y-yy0];
for (x = xx0; x < xx1; x++){
*ptr++ = comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x] << NMSEDEC_FRACBITS;
}
}
} else{
for (y = yy0; y < yy1; y++){
int *ptr = t1.data[y-yy0];
for (x = xx0; x < xx1; x++){
*ptr = (comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x]);
*ptr = (int64_t)*ptr * (int64_t)(16384 * 65536 / band->i_stepsize) >> 14 - NMSEDEC_FRACBITS;
ptr++;
}
}
}
encode_cblk(s, &t1, prec->cblk + cblkno, tile, xx1 - xx0, yy1 - yy0,
bandpos, codsty->nreslevels - reslevelno - 1);
xx0 = xx1;
xx1 = FFMIN(xx1 + (1 << band->log2_cblk_width), band->coord[0][1] - band->coord[0][0] + x0);
}
yy0 = yy1;
yy1 = FFMIN(yy1 + (1 << band->log2_cblk_height), band->coord[1][1] - band->coord[1][0] + y0);
}
}
}
av_log(s->avctx, AV_LOG_DEBUG, "after tier1\n");
}
av_log(s->avctx, AV_LOG_DEBUG, "rate control\n");
truncpasses(s, tile);
if (ret = encode_packets(s, tile, tileno))
return ret;
av_log(s->avctx, AV_LOG_DEBUG, "after rate control\n");
return 0;
}
| {
"code": [
" *ptr = (int64_t)*ptr * (int64_t)(16384 * 65536 / band->i_stepsize) >> 14 - NMSEDEC_FRACBITS;"
],
"line_no": [
107
]
} | static int FUNC_0(Jpeg2000EncoderContext *VAR_0, Jpeg2000Tile *VAR_1, int VAR_2)
{
int VAR_3, VAR_4, VAR_5, VAR_6;
Jpeg2000T1Context t1;
Jpeg2000CodingStyle *codsty = &VAR_0->codsty;
for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++){
Jpeg2000Component *comp = VAR_0->VAR_1[VAR_2].comp + VAR_3;
av_log(VAR_0->avctx, AV_LOG_DEBUG,"dwt\n");
if (VAR_6 = ff_dwt_encode(&comp->dwt, comp->i_data))
return VAR_6;
av_log(VAR_0->avctx, AV_LOG_DEBUG,"after dwt -> tier1\n");
for (VAR_4 = 0; VAR_4 < codsty->nreslevels; VAR_4++){
Jpeg2000ResLevel *reslevel = comp->reslevel + VAR_4;
for (VAR_5 = 0; VAR_5 < reslevel->nbands ; VAR_5++){
Jpeg2000Band *band = reslevel->band + VAR_5;
Jpeg2000Prec *prec = band->prec;
int cblkx, cblky, cblkno=0, xx0, x0, xx1, y0, yy0, yy1, bandpos;
yy0 = VAR_5 == 0 ? 0 : comp->reslevel[VAR_4-1].coord[1][1] - comp->reslevel[VAR_4-1].coord[1][0];
y0 = yy0;
yy1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[1][0] + 1, band->log2_cblk_height) << band->log2_cblk_height,
band->coord[1][1]) - band->coord[1][0] + yy0;
if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1])
continue;
bandpos = VAR_5 + (VAR_4 > 0);
for (cblky = 0; cblky < prec->nb_codeblocks_height; cblky++){
if (VAR_4 == 0 || VAR_5 == 1)
xx0 = 0;
else
xx0 = comp->reslevel[VAR_4-1].coord[0][1] - comp->reslevel[VAR_4-1].coord[0][0];
x0 = xx0;
xx1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[0][0] + 1, band->log2_cblk_width) << band->log2_cblk_width,
band->coord[0][1]) - band->coord[0][0] + xx0;
for (cblkx = 0; cblkx < prec->nb_codeblocks_width; cblkx++, cblkno++){
int y, x;
if (codsty->transform == FF_DWT53){
for (y = yy0; y < yy1; y++){
int *ptr = t1.data[y-yy0];
for (x = xx0; x < xx1; x++){
*ptr++ = comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x] << NMSEDEC_FRACBITS;
}
}
} else{
for (y = yy0; y < yy1; y++){
int *ptr = t1.data[y-yy0];
for (x = xx0; x < xx1; x++){
*ptr = (comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x]);
*ptr = (int64_t)*ptr * (int64_t)(16384 * 65536 / band->i_stepsize) >> 14 - NMSEDEC_FRACBITS;
ptr++;
}
}
}
encode_cblk(VAR_0, &t1, prec->cblk + cblkno, VAR_1, xx1 - xx0, yy1 - yy0,
bandpos, codsty->nreslevels - VAR_4 - 1);
xx0 = xx1;
xx1 = FFMIN(xx1 + (1 << band->log2_cblk_width), band->coord[0][1] - band->coord[0][0] + x0);
}
yy0 = yy1;
yy1 = FFMIN(yy1 + (1 << band->log2_cblk_height), band->coord[1][1] - band->coord[1][0] + y0);
}
}
}
av_log(VAR_0->avctx, AV_LOG_DEBUG, "after tier1\n");
}
av_log(VAR_0->avctx, AV_LOG_DEBUG, "rate control\n");
truncpasses(VAR_0, VAR_1);
if (VAR_6 = encode_packets(VAR_0, VAR_1, VAR_2))
return VAR_6;
av_log(VAR_0->avctx, AV_LOG_DEBUG, "after rate control\n");
return 0;
}
| [
"static int FUNC_0(Jpeg2000EncoderContext *VAR_0, Jpeg2000Tile *VAR_1, int VAR_2)\n{",
"int VAR_3, VAR_4, VAR_5, VAR_6;",
"Jpeg2000T1Context t1;",
"Jpeg2000CodingStyle *codsty = &VAR_0->codsty;",
"for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++){",
"Jpeg2000Component *comp = VAR_0->VAR_1[VAR_2].comp + VAR_3;",
"av_log(VAR_0->avctx, AV_LOG_DEBUG,\"dwt\\n\");",
"if (VAR_6 = ff_dwt_encode(&comp->dwt, comp->i_data))\nreturn VAR_6;",
"av_log(VAR_0->avctx, AV_LOG_DEBUG,\"after dwt -> tier1\\n\");",
"for (VAR_4 = 0; VAR_4 < codsty->nreslevels; VAR_4++){",
"Jpeg2000ResLevel *reslevel = comp->reslevel + VAR_4;",
"for (VAR_5 = 0; VAR_5 < reslevel->nbands ; VAR_5++){",
"Jpeg2000Band *band = reslevel->band + VAR_5;",
"Jpeg2000Prec *prec = band->prec;",
"int cblkx, cblky, cblkno=0, xx0, x0, xx1, y0, yy0, yy1, bandpos;",
"yy0 = VAR_5 == 0 ? 0 : comp->reslevel[VAR_4-1].coord[1][1] - comp->reslevel[VAR_4-1].coord[1][0];",
"y0 = yy0;",
"yy1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[1][0] + 1, band->log2_cblk_height) << band->log2_cblk_height,\nband->coord[1][1]) - band->coord[1][0] + yy0;",
"if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1])\ncontinue;",
"bandpos = VAR_5 + (VAR_4 > 0);",
"for (cblky = 0; cblky < prec->nb_codeblocks_height; cblky++){",
"if (VAR_4 == 0 || VAR_5 == 1)\nxx0 = 0;",
"else\nxx0 = comp->reslevel[VAR_4-1].coord[0][1] - comp->reslevel[VAR_4-1].coord[0][0];",
"x0 = xx0;",
"xx1 = FFMIN(ff_jpeg2000_ceildivpow2(band->coord[0][0] + 1, band->log2_cblk_width) << band->log2_cblk_width,\nband->coord[0][1]) - band->coord[0][0] + xx0;",
"for (cblkx = 0; cblkx < prec->nb_codeblocks_width; cblkx++, cblkno++){",
"int y, x;",
"if (codsty->transform == FF_DWT53){",
"for (y = yy0; y < yy1; y++){",
"int *ptr = t1.data[y-yy0];",
"for (x = xx0; x < xx1; x++){",
"*ptr++ = comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x] << NMSEDEC_FRACBITS;",
"}",
"}",
"} else{",
"for (y = yy0; y < yy1; y++){",
"int *ptr = t1.data[y-yy0];",
"for (x = xx0; x < xx1; x++){",
"*ptr = (comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * y + x]);",
"*ptr = (int64_t)*ptr * (int64_t)(16384 * 65536 / band->i_stepsize) >> 14 - NMSEDEC_FRACBITS;",
"ptr++;",
"}",
"}",
"}",
"encode_cblk(VAR_0, &t1, prec->cblk + cblkno, VAR_1, xx1 - xx0, yy1 - yy0,\nbandpos, codsty->nreslevels - VAR_4 - 1);",
"xx0 = xx1;",
"xx1 = FFMIN(xx1 + (1 << band->log2_cblk_width), band->coord[0][1] - band->coord[0][0] + x0);",
"}",
"yy0 = yy1;",
"yy1 = FFMIN(yy1 + (1 << band->log2_cblk_height), band->coord[1][1] - band->coord[1][0] + y0);",
"}",
"}",
"}",
"av_log(VAR_0->avctx, AV_LOG_DEBUG, \"after tier1\\n\");",
"}",
"av_log(VAR_0->avctx, AV_LOG_DEBUG, \"rate control\\n\");",
"truncpasses(VAR_0, VAR_1);",
"if (VAR_6 = encode_packets(VAR_0, VAR_1, VAR_2))\nreturn VAR_6;",
"av_log(VAR_0->avctx, AV_LOG_DEBUG, \"after rate control\\n\");",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19,
21
],
[
23
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45,
47
],
[
51,
53
],
[
57
],
[
61
],
[
63,
65
],
[
67,
69
],
[
71
],
[
73,
75
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117,
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
143
],
[
145
],
[
147,
149
],
[
151
],
[
153
],
[
155
]
]
|
15,669 | static struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *memory,
hwaddr base,
qemu_irq kbd_int, qemu_irq gpio_int, qemu_irq wakeup,
omap_clk clk)
{
struct omap_mpuio_s *s = (struct omap_mpuio_s *)
g_malloc0(sizeof(struct omap_mpuio_s));
s->irq = gpio_int;
s->kbd_irq = kbd_int;
s->wakeup = wakeup;
s->in = qemu_allocate_irqs(omap_mpuio_set, s, 16);
omap_mpuio_reset(s);
memory_region_init_io(&s->iomem, NULL, &omap_mpuio_ops, s,
"omap-mpuio", 0x800);
memory_region_add_subregion(memory, base, &s->iomem);
omap_clk_adduser(clk, qemu_allocate_irq(omap_mpuio_onoff, s, 0));
return s;
}
| true | qemu | b45c03f585ea9bb1af76c73e82195418c294919d | static struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *memory,
hwaddr base,
qemu_irq kbd_int, qemu_irq gpio_int, qemu_irq wakeup,
omap_clk clk)
{
struct omap_mpuio_s *s = (struct omap_mpuio_s *)
g_malloc0(sizeof(struct omap_mpuio_s));
s->irq = gpio_int;
s->kbd_irq = kbd_int;
s->wakeup = wakeup;
s->in = qemu_allocate_irqs(omap_mpuio_set, s, 16);
omap_mpuio_reset(s);
memory_region_init_io(&s->iomem, NULL, &omap_mpuio_ops, s,
"omap-mpuio", 0x800);
memory_region_add_subregion(memory, base, &s->iomem);
omap_clk_adduser(clk, qemu_allocate_irq(omap_mpuio_onoff, s, 0));
return s;
}
| {
"code": [
" struct omap_mpuio_s *s = (struct omap_mpuio_s *)",
" g_malloc0(sizeof(struct omap_mpuio_s));"
],
"line_no": [
11,
13
]
} | static struct omap_mpuio_s *FUNC_0(MemoryRegion *VAR_0,
hwaddr VAR_1,
qemu_irq VAR_2, qemu_irq VAR_3, qemu_irq VAR_4,
omap_clk VAR_5)
{
struct omap_mpuio_s *VAR_6 = (struct omap_mpuio_s *)
g_malloc0(sizeof(struct omap_mpuio_s));
VAR_6->irq = VAR_3;
VAR_6->kbd_irq = VAR_2;
VAR_6->VAR_4 = VAR_4;
VAR_6->in = qemu_allocate_irqs(omap_mpuio_set, VAR_6, 16);
omap_mpuio_reset(VAR_6);
memory_region_init_io(&VAR_6->iomem, NULL, &omap_mpuio_ops, VAR_6,
"omap-mpuio", 0x800);
memory_region_add_subregion(VAR_0, VAR_1, &VAR_6->iomem);
omap_clk_adduser(VAR_5, qemu_allocate_irq(omap_mpuio_onoff, VAR_6, 0));
return VAR_6;
}
| [
"static struct omap_mpuio_s *FUNC_0(MemoryRegion *VAR_0,\nhwaddr VAR_1,\nqemu_irq VAR_2, qemu_irq VAR_3, qemu_irq VAR_4,\nomap_clk VAR_5)\n{",
"struct omap_mpuio_s *VAR_6 = (struct omap_mpuio_s *)\ng_malloc0(sizeof(struct omap_mpuio_s));",
"VAR_6->irq = VAR_3;",
"VAR_6->kbd_irq = VAR_2;",
"VAR_6->VAR_4 = VAR_4;",
"VAR_6->in = qemu_allocate_irqs(omap_mpuio_set, VAR_6, 16);",
"omap_mpuio_reset(VAR_6);",
"memory_region_init_io(&VAR_6->iomem, NULL, &omap_mpuio_ops, VAR_6,\n\"omap-mpuio\", 0x800);",
"memory_region_add_subregion(VAR_0, VAR_1, &VAR_6->iomem);",
"omap_clk_adduser(VAR_5, qemu_allocate_irq(omap_mpuio_onoff, VAR_6, 0));",
"return VAR_6;",
"}"
]
| [
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7,
9
],
[
11,
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29,
31
],
[
33
],
[
37
],
[
41
],
[
43
]
]
|
15,670 | static int decode_block(MJpegDecodeContext *s, int16_t *block, int component,
int dc_index, int ac_index, int16_t *quant_matrix)
{
int code, i, j, level, val;
/* DC coef */
val = mjpeg_decode_dc(s, dc_index);
if (val == 0xfffff) {
av_log(s->avctx, AV_LOG_ERROR, "error dc\n");
return AVERROR_INVALIDDATA;
}
val = val * quant_matrix[0] + s->last_dc[component];
s->last_dc[component] = val;
block[0] = val;
/* AC coefs */
i = 0;
{OPEN_READER(re, &s->gb);
do {
UPDATE_CACHE(re, &s->gb);
GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2);
i += ((unsigned)code) >> 4;
code &= 0xf;
if (code) {
if (code > MIN_CACHE_BITS - 16)
UPDATE_CACHE(re, &s->gb);
{
int cache = GET_CACHE(re, &s->gb);
int sign = (~cache) >> 31;
level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;
}
LAST_SKIP_BITS(re, &s->gb, code);
if (i > 63) {
av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
return AVERROR_INVALIDDATA;
}
j = s->scantable.permutated[i];
block[j] = level * quant_matrix[j];
}
} while (i < 63);
CLOSE_READER(re, &s->gb);}
return 0;
} | true | FFmpeg | dffae122d0f448029c30afc672233f114a3fe09c | static int decode_block(MJpegDecodeContext *s, int16_t *block, int component,
int dc_index, int ac_index, int16_t *quant_matrix)
{
int code, i, j, level, val;
val = mjpeg_decode_dc(s, dc_index);
if (val == 0xfffff) {
av_log(s->avctx, AV_LOG_ERROR, "error dc\n");
return AVERROR_INVALIDDATA;
}
val = val * quant_matrix[0] + s->last_dc[component];
s->last_dc[component] = val;
block[0] = val;
i = 0;
{OPEN_READER(re, &s->gb);
do {
UPDATE_CACHE(re, &s->gb);
GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2);
i += ((unsigned)code) >> 4;
code &= 0xf;
if (code) {
if (code > MIN_CACHE_BITS - 16)
UPDATE_CACHE(re, &s->gb);
{
int cache = GET_CACHE(re, &s->gb);
int sign = (~cache) >> 31;
level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;
}
LAST_SKIP_BITS(re, &s->gb, code);
if (i > 63) {
av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
return AVERROR_INVALIDDATA;
}
j = s->scantable.permutated[i];
block[j] = level * quant_matrix[j];
}
} while (i < 63);
CLOSE_READER(re, &s->gb);}
return 0;
} | {
"code": [],
"line_no": []
} | static int FUNC_0(MJpegDecodeContext *VAR_0, int16_t *VAR_1, int VAR_2,
int VAR_3, int VAR_4, int16_t *VAR_5)
{
int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;
VAR_10 = mjpeg_decode_dc(VAR_0, VAR_3);
if (VAR_10 == 0xfffff) {
av_log(VAR_0->avctx, AV_LOG_ERROR, "error dc\n");
return AVERROR_INVALIDDATA;
}
VAR_10 = VAR_10 * VAR_5[0] + VAR_0->last_dc[VAR_2];
VAR_0->last_dc[VAR_2] = VAR_10;
VAR_1[0] = VAR_10;
VAR_7 = 0;
{OPEN_READER(re, &VAR_0->gb);
do {
UPDATE_CACHE(re, &VAR_0->gb);
GET_VLC(VAR_6, re, &VAR_0->gb, VAR_0->vlcs[1][VAR_4].table, 9, 2);
VAR_7 += ((unsigned)VAR_6) >> 4;
VAR_6 &= 0xf;
if (VAR_6) {
if (VAR_6 > MIN_CACHE_BITS - 16)
UPDATE_CACHE(re, &VAR_0->gb);
{
int VAR_11 = GET_CACHE(re, &VAR_0->gb);
int VAR_12 = (~VAR_11) >> 31;
VAR_9 = (NEG_USR32(VAR_12 ^ VAR_11,VAR_6) ^ VAR_12) - VAR_12;
}
LAST_SKIP_BITS(re, &VAR_0->gb, VAR_6);
if (VAR_7 > 63) {
av_log(VAR_0->avctx, AV_LOG_ERROR, "error count: %d\n", VAR_7);
return AVERROR_INVALIDDATA;
}
VAR_8 = VAR_0->scantable.permutated[VAR_7];
VAR_1[VAR_8] = VAR_9 * VAR_5[VAR_8];
}
} while (VAR_7 < 63);
CLOSE_READER(re, &VAR_0->gb);}
return 0;
} | [
"static int FUNC_0(MJpegDecodeContext *VAR_0, int16_t *VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int16_t *VAR_5)\n{",
"int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;",
"VAR_10 = mjpeg_decode_dc(VAR_0, VAR_3);",
"if (VAR_10 == 0xfffff) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"error dc\\n\");",
"return AVERROR_INVALIDDATA;",
"}",
"VAR_10 = VAR_10 * VAR_5[0] + VAR_0->last_dc[VAR_2];",
"VAR_0->last_dc[VAR_2] = VAR_10;",
"VAR_1[0] = VAR_10;",
"VAR_7 = 0;",
"{OPEN_READER(re, &VAR_0->gb);",
"do {",
"UPDATE_CACHE(re, &VAR_0->gb);",
"GET_VLC(VAR_6, re, &VAR_0->gb, VAR_0->vlcs[1][VAR_4].table, 9, 2);",
"VAR_7 += ((unsigned)VAR_6) >> 4;",
"VAR_6 &= 0xf;",
"if (VAR_6) {",
"if (VAR_6 > MIN_CACHE_BITS - 16)\nUPDATE_CACHE(re, &VAR_0->gb);",
"{",
"int VAR_11 = GET_CACHE(re, &VAR_0->gb);",
"int VAR_12 = (~VAR_11) >> 31;",
"VAR_9 = (NEG_USR32(VAR_12 ^ VAR_11,VAR_6) ^ VAR_12) - VAR_12;",
"}",
"LAST_SKIP_BITS(re, &VAR_0->gb, VAR_6);",
"if (VAR_7 > 63) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"error count: %d\\n\", VAR_7);",
"return AVERROR_INVALIDDATA;",
"}",
"VAR_8 = VAR_0->scantable.permutated[VAR_7];",
"VAR_1[VAR_8] = VAR_9 * VAR_5[VAR_8];",
"}",
"} while (VAR_7 < 63);",
"CLOSE_READER(re, &VAR_0->gb);}",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
26
],
[
28
],
[
32
],
[
34
],
[
36
],
[
38
],
[
40
],
[
44
],
[
46
],
[
48
],
[
50,
52
],
[
56
],
[
58
],
[
60
],
[
62
],
[
64
],
[
68
],
[
72
],
[
74
],
[
76
],
[
78
],
[
80
],
[
82
],
[
84
],
[
86
],
[
88
],
[
92
],
[
94
]
]
|
15,671 | static void iscsi_attach_aio_context(BlockDriverState *bs,
AioContext *new_context)
{
IscsiLun *iscsilun = bs->opaque;
iscsilun->aio_context = new_context;
iscsi_set_events(iscsilun);
#if defined(LIBISCSI_FEATURE_NOP_COUNTER)
/* Set up a timer for sending out iSCSI NOPs */
iscsilun->nop_timer = aio_timer_new(iscsilun->aio_context,
QEMU_CLOCK_REALTIME, SCALE_MS,
iscsi_nop_timed_event, iscsilun);
timer_mod(iscsilun->nop_timer,
qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + NOP_INTERVAL);
#endif
}
| true | qemu | e49ab19fcaa617ad6cdfe1ac401327326b6a2552 | static void iscsi_attach_aio_context(BlockDriverState *bs,
AioContext *new_context)
{
IscsiLun *iscsilun = bs->opaque;
iscsilun->aio_context = new_context;
iscsi_set_events(iscsilun);
#if defined(LIBISCSI_FEATURE_NOP_COUNTER)
iscsilun->nop_timer = aio_timer_new(iscsilun->aio_context,
QEMU_CLOCK_REALTIME, SCALE_MS,
iscsi_nop_timed_event, iscsilun);
timer_mod(iscsilun->nop_timer,
qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + NOP_INTERVAL);
#endif
}
| {
"code": [
"#endif",
"#endif",
"#endif",
"#endif",
"#endif",
"#endif",
"#endif",
"#endif",
"#if defined(LIBISCSI_FEATURE_NOP_COUNTER)",
"#endif",
"#if defined(LIBISCSI_FEATURE_NOP_COUNTER)",
"#endif",
"#endif",
"#endif",
"#endif"
],
"line_no": [
31,
31,
31,
31,
31,
31,
31,
31,
17,
31,
17,
31,
31,
31,
31
]
} | static void FUNC_0(BlockDriverState *VAR_0,
AioContext *VAR_1)
{
IscsiLun *iscsilun = VAR_0->opaque;
iscsilun->aio_context = VAR_1;
iscsi_set_events(iscsilun);
#if defined(LIBISCSI_FEATURE_NOP_COUNTER)
iscsilun->nop_timer = aio_timer_new(iscsilun->aio_context,
QEMU_CLOCK_REALTIME, SCALE_MS,
iscsi_nop_timed_event, iscsilun);
timer_mod(iscsilun->nop_timer,
qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + NOP_INTERVAL);
#endif
}
| [
"static void FUNC_0(BlockDriverState *VAR_0,\nAioContext *VAR_1)\n{",
"IscsiLun *iscsilun = VAR_0->opaque;",
"iscsilun->aio_context = VAR_1;",
"iscsi_set_events(iscsilun);",
"#if defined(LIBISCSI_FEATURE_NOP_COUNTER)\niscsilun->nop_timer = aio_timer_new(iscsilun->aio_context,\nQEMU_CLOCK_REALTIME, SCALE_MS,\niscsi_nop_timed_event, iscsilun);",
"timer_mod(iscsilun->nop_timer,\nqemu_clock_get_ms(QEMU_CLOCK_REALTIME) + NOP_INTERVAL);",
"#endif\n}"
]
| [
0,
0,
0,
0,
1,
0,
1
]
| [
[
1,
3,
5
],
[
7
],
[
11
],
[
13
],
[
17,
21,
23,
25
],
[
27,
29
],
[
31,
33
]
]
|
15,672 | static int64_t alloc_block(BlockDriverState* bs, int64_t sector_num)
{
BDRVVPCState *s = bs->opaque;
int64_t bat_offset;
uint32_t index, bat_value;
int ret;
uint8_t bitmap[s->bitmap_size];
// Check if sector_num is valid
if ((sector_num < 0) || (sector_num > bs->total_sectors))
return -1;
// Write entry into in-memory BAT
index = (sector_num * 512) / s->block_size;
if (s->pagetable[index] != 0xFFFFFFFF)
return -1;
s->pagetable[index] = s->free_data_block_offset / 512;
// Initialize the block's bitmap
memset(bitmap, 0xff, s->bitmap_size);
bdrv_pwrite(bs->file, s->free_data_block_offset, bitmap, s->bitmap_size);
// Write new footer (the old one will be overwritten)
s->free_data_block_offset += s->block_size + s->bitmap_size;
ret = rewrite_footer(bs);
if (ret < 0)
goto fail;
// Write BAT entry to disk
bat_offset = s->bat_offset + (4 * index);
bat_value = be32_to_cpu(s->pagetable[index]);
ret = bdrv_pwrite(bs->file, bat_offset, &bat_value, 4);
if (ret < 0)
goto fail;
return get_sector_offset(bs, sector_num, 0);
fail:
s->free_data_block_offset -= (s->block_size + s->bitmap_size);
return -1;
}
| true | qemu | 078a458e077d6b0db262c4b05fee51d01de2d1d2 | static int64_t alloc_block(BlockDriverState* bs, int64_t sector_num)
{
BDRVVPCState *s = bs->opaque;
int64_t bat_offset;
uint32_t index, bat_value;
int ret;
uint8_t bitmap[s->bitmap_size];
if ((sector_num < 0) || (sector_num > bs->total_sectors))
return -1;
index = (sector_num * 512) / s->block_size;
if (s->pagetable[index] != 0xFFFFFFFF)
return -1;
s->pagetable[index] = s->free_data_block_offset / 512;
memset(bitmap, 0xff, s->bitmap_size);
bdrv_pwrite(bs->file, s->free_data_block_offset, bitmap, s->bitmap_size);
s->free_data_block_offset += s->block_size + s->bitmap_size;
ret = rewrite_footer(bs);
if (ret < 0)
goto fail;
bat_offset = s->bat_offset + (4 * index);
bat_value = be32_to_cpu(s->pagetable[index]);
ret = bdrv_pwrite(bs->file, bat_offset, &bat_value, 4);
if (ret < 0)
goto fail;
return get_sector_offset(bs, sector_num, 0);
fail:
s->free_data_block_offset -= (s->block_size + s->bitmap_size);
return -1;
}
| {
"code": [
" bdrv_pwrite(bs->file, s->free_data_block_offset, bitmap, s->bitmap_size);",
" ret = bdrv_pwrite(bs->file, bat_offset, &bat_value, 4);"
],
"line_no": [
43,
65
]
} | static int64_t FUNC_0(BlockDriverState* bs, int64_t sector_num)
{
BDRVVPCState *s = bs->opaque;
int64_t bat_offset;
uint32_t index, bat_value;
int VAR_0;
uint8_t bitmap[s->bitmap_size];
if ((sector_num < 0) || (sector_num > bs->total_sectors))
return -1;
index = (sector_num * 512) / s->block_size;
if (s->pagetable[index] != 0xFFFFFFFF)
return -1;
s->pagetable[index] = s->free_data_block_offset / 512;
memset(bitmap, 0xff, s->bitmap_size);
bdrv_pwrite(bs->file, s->free_data_block_offset, bitmap, s->bitmap_size);
s->free_data_block_offset += s->block_size + s->bitmap_size;
VAR_0 = rewrite_footer(bs);
if (VAR_0 < 0)
goto fail;
bat_offset = s->bat_offset + (4 * index);
bat_value = be32_to_cpu(s->pagetable[index]);
VAR_0 = bdrv_pwrite(bs->file, bat_offset, &bat_value, 4);
if (VAR_0 < 0)
goto fail;
return get_sector_offset(bs, sector_num, 0);
fail:
s->free_data_block_offset -= (s->block_size + s->bitmap_size);
return -1;
}
| [
"static int64_t FUNC_0(BlockDriverState* bs, int64_t sector_num)\n{",
"BDRVVPCState *s = bs->opaque;",
"int64_t bat_offset;",
"uint32_t index, bat_value;",
"int VAR_0;",
"uint8_t bitmap[s->bitmap_size];",
"if ((sector_num < 0) || (sector_num > bs->total_sectors))\nreturn -1;",
"index = (sector_num * 512) / s->block_size;",
"if (s->pagetable[index] != 0xFFFFFFFF)\nreturn -1;",
"s->pagetable[index] = s->free_data_block_offset / 512;",
"memset(bitmap, 0xff, s->bitmap_size);",
"bdrv_pwrite(bs->file, s->free_data_block_offset, bitmap, s->bitmap_size);",
"s->free_data_block_offset += s->block_size + s->bitmap_size;",
"VAR_0 = rewrite_footer(bs);",
"if (VAR_0 < 0)\ngoto fail;",
"bat_offset = s->bat_offset + (4 * index);",
"bat_value = be32_to_cpu(s->pagetable[index]);",
"VAR_0 = bdrv_pwrite(bs->file, bat_offset, &bat_value, 4);",
"if (VAR_0 < 0)\ngoto fail;",
"return get_sector_offset(bs, sector_num, 0);",
"fail:\ns->free_data_block_offset -= (s->block_size + s->bitmap_size);",
"return -1;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
19,
21
],
[
27
],
[
29,
31
],
[
35
],
[
41
],
[
43
],
[
49
],
[
51
],
[
53,
55
],
[
61
],
[
63
],
[
65
],
[
67,
69
],
[
73
],
[
77,
79
],
[
81
],
[
83
]
]
|
15,673 | static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,
Jpeg2000T1Context *t1, Jpeg2000Cblk *cblk,
int width, int height, int bandpos)
{
int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y, clnpass_cnt = 0;
int bpass_csty_symbol = JPEG2000_CBLK_BYPASS & codsty->cblk_style;
int vert_causal_ctx_csty_symbol = JPEG2000_CBLK_VSC & codsty->cblk_style;
for (y = 0; y < height; y++)
memset(t1->data[y], 0, width * sizeof(**t1->data));
/* If code-block contains no compressed data: nothing to do. */
if (!cblk->length)
return 0;
for (y = 0; y < height+2; y++)
memset(t1->flags[y], 0, (width + 2)*sizeof(**t1->flags));
cblk->data[cblk->length] = 0xff;
cblk->data[cblk->length+1] = 0xff;
ff_mqc_initdec(&t1->mqc, cblk->data);
while (passno--) {
if (bpno < 0) {
av_log(s->avctx, AV_LOG_ERROR, "bpno invalid\n");
return AVERROR(EINVAL);
}
switch(pass_t) {
case 0:
decode_sigpass(t1, width, height, bpno + 1, bandpos,
bpass_csty_symbol && (clnpass_cnt >= 4), vert_causal_ctx_csty_symbol);
break;
case 1:
decode_refpass(t1, width, height, bpno + 1);
if (bpass_csty_symbol && clnpass_cnt >= 4)
ff_mqc_initdec(&t1->mqc, cblk->data);
break;
case 2:
decode_clnpass(s, t1, width, height, bpno + 1, bandpos,
codsty->cblk_style & JPEG2000_CBLK_SEGSYM, vert_causal_ctx_csty_symbol);
clnpass_cnt = clnpass_cnt + 1;
if (bpass_csty_symbol && clnpass_cnt >= 4)
ff_mqc_initdec(&t1->mqc, cblk->data);
break;
}
pass_t++;
if (pass_t == 3) {
bpno--;
pass_t = 0;
}
}
return 0;
}
| true | FFmpeg | 3b8617429014301b26b587a5e537910746d3377a | static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty,
Jpeg2000T1Context *t1, Jpeg2000Cblk *cblk,
int width, int height, int bandpos)
{
int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y, clnpass_cnt = 0;
int bpass_csty_symbol = JPEG2000_CBLK_BYPASS & codsty->cblk_style;
int vert_causal_ctx_csty_symbol = JPEG2000_CBLK_VSC & codsty->cblk_style;
for (y = 0; y < height; y++)
memset(t1->data[y], 0, width * sizeof(**t1->data));
if (!cblk->length)
return 0;
for (y = 0; y < height+2; y++)
memset(t1->flags[y], 0, (width + 2)*sizeof(**t1->flags));
cblk->data[cblk->length] = 0xff;
cblk->data[cblk->length+1] = 0xff;
ff_mqc_initdec(&t1->mqc, cblk->data);
while (passno--) {
if (bpno < 0) {
av_log(s->avctx, AV_LOG_ERROR, "bpno invalid\n");
return AVERROR(EINVAL);
}
switch(pass_t) {
case 0:
decode_sigpass(t1, width, height, bpno + 1, bandpos,
bpass_csty_symbol && (clnpass_cnt >= 4), vert_causal_ctx_csty_symbol);
break;
case 1:
decode_refpass(t1, width, height, bpno + 1);
if (bpass_csty_symbol && clnpass_cnt >= 4)
ff_mqc_initdec(&t1->mqc, cblk->data);
break;
case 2:
decode_clnpass(s, t1, width, height, bpno + 1, bandpos,
codsty->cblk_style & JPEG2000_CBLK_SEGSYM, vert_causal_ctx_csty_symbol);
clnpass_cnt = clnpass_cnt + 1;
if (bpass_csty_symbol && clnpass_cnt >= 4)
ff_mqc_initdec(&t1->mqc, cblk->data);
break;
}
pass_t++;
if (pass_t == 3) {
bpno--;
pass_t = 0;
}
}
return 0;
}
| {
"code": [
" if (bpno < 0) {",
" av_log(s->avctx, AV_LOG_ERROR, \"bpno invalid\\n\");",
" return AVERROR(EINVAL);"
],
"line_no": [
47,
49,
51
]
} | static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000CodingStyle *VAR_1,
Jpeg2000T1Context *VAR_2, Jpeg2000Cblk *VAR_3,
int VAR_4, int VAR_5, int VAR_6)
{
int VAR_7 = VAR_3->npasses, VAR_8 = 2, VAR_9 = VAR_3->nonzerobits - 1, VAR_10, VAR_11 = 0;
int VAR_12 = JPEG2000_CBLK_BYPASS & VAR_1->cblk_style;
int VAR_13 = JPEG2000_CBLK_VSC & VAR_1->cblk_style;
for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++)
memset(VAR_2->data[VAR_10], 0, VAR_4 * sizeof(**VAR_2->data));
if (!VAR_3->length)
return 0;
for (VAR_10 = 0; VAR_10 < VAR_5+2; VAR_10++)
memset(VAR_2->flags[VAR_10], 0, (VAR_4 + 2)*sizeof(**VAR_2->flags));
VAR_3->data[VAR_3->length] = 0xff;
VAR_3->data[VAR_3->length+1] = 0xff;
ff_mqc_initdec(&VAR_2->mqc, VAR_3->data);
while (VAR_7--) {
if (VAR_9 < 0) {
av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_9 invalid\n");
return AVERROR(EINVAL);
}
switch(VAR_8) {
case 0:
decode_sigpass(VAR_2, VAR_4, VAR_5, VAR_9 + 1, VAR_6,
VAR_12 && (VAR_11 >= 4), VAR_13);
break;
case 1:
decode_refpass(VAR_2, VAR_4, VAR_5, VAR_9 + 1);
if (VAR_12 && VAR_11 >= 4)
ff_mqc_initdec(&VAR_2->mqc, VAR_3->data);
break;
case 2:
decode_clnpass(VAR_0, VAR_2, VAR_4, VAR_5, VAR_9 + 1, VAR_6,
VAR_1->cblk_style & JPEG2000_CBLK_SEGSYM, VAR_13);
VAR_11 = VAR_11 + 1;
if (VAR_12 && VAR_11 >= 4)
ff_mqc_initdec(&VAR_2->mqc, VAR_3->data);
break;
}
VAR_8++;
if (VAR_8 == 3) {
VAR_9--;
VAR_8 = 0;
}
}
return 0;
}
| [
"static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000CodingStyle *VAR_1,\nJpeg2000T1Context *VAR_2, Jpeg2000Cblk *VAR_3,\nint VAR_4, int VAR_5, int VAR_6)\n{",
"int VAR_7 = VAR_3->npasses, VAR_8 = 2, VAR_9 = VAR_3->nonzerobits - 1, VAR_10, VAR_11 = 0;",
"int VAR_12 = JPEG2000_CBLK_BYPASS & VAR_1->cblk_style;",
"int VAR_13 = JPEG2000_CBLK_VSC & VAR_1->cblk_style;",
"for (VAR_10 = 0; VAR_10 < VAR_5; VAR_10++)",
"memset(VAR_2->data[VAR_10], 0, VAR_4 * sizeof(**VAR_2->data));",
"if (!VAR_3->length)\nreturn 0;",
"for (VAR_10 = 0; VAR_10 < VAR_5+2; VAR_10++)",
"memset(VAR_2->flags[VAR_10], 0, (VAR_4 + 2)*sizeof(**VAR_2->flags));",
"VAR_3->data[VAR_3->length] = 0xff;",
"VAR_3->data[VAR_3->length+1] = 0xff;",
"ff_mqc_initdec(&VAR_2->mqc, VAR_3->data);",
"while (VAR_7--) {",
"if (VAR_9 < 0) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_9 invalid\\n\");",
"return AVERROR(EINVAL);",
"}",
"switch(VAR_8) {",
"case 0:\ndecode_sigpass(VAR_2, VAR_4, VAR_5, VAR_9 + 1, VAR_6,\nVAR_12 && (VAR_11 >= 4), VAR_13);",
"break;",
"case 1:\ndecode_refpass(VAR_2, VAR_4, VAR_5, VAR_9 + 1);",
"if (VAR_12 && VAR_11 >= 4)\nff_mqc_initdec(&VAR_2->mqc, VAR_3->data);",
"break;",
"case 2:\ndecode_clnpass(VAR_0, VAR_2, VAR_4, VAR_5, VAR_9 + 1, VAR_6,\nVAR_1->cblk_style & JPEG2000_CBLK_SEGSYM, VAR_13);",
"VAR_11 = VAR_11 + 1;",
"if (VAR_12 && VAR_11 >= 4)\nff_mqc_initdec(&VAR_2->mqc, VAR_3->data);",
"break;",
"}",
"VAR_8++;",
"if (VAR_8 == 3) {",
"VAR_9--;",
"VAR_8 = 0;",
"}",
"}",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
25,
27
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57,
59,
61
],
[
63
],
[
65,
67
],
[
69,
71
],
[
73
],
[
75,
77,
79
],
[
81
],
[
83,
85
],
[
87
],
[
89
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
]
]
|
15,674 | static void gen_addq(DisasContext *s, TCGv_i64 val, int rlow, int rhigh)
{
TCGv_i64 tmp;
TCGv tmpl;
TCGv tmph;
/* Load 64-bit value rd:rn. */
tmpl = load_reg(s, rlow);
tmph = load_reg(s, rhigh);
tmp = tcg_temp_new_i64();
tcg_gen_concat_i32_i64(tmp, tmpl, tmph);
dead_tmp(tmpl);
dead_tmp(tmph);
tcg_gen_add_i64(val, val, tmp);
tcg_temp_free_i64(tmp);
}
| true | qemu | 7d1b0095bff7157e856d1d0e6c4295641ced2752 | static void gen_addq(DisasContext *s, TCGv_i64 val, int rlow, int rhigh)
{
TCGv_i64 tmp;
TCGv tmpl;
TCGv tmph;
tmpl = load_reg(s, rlow);
tmph = load_reg(s, rhigh);
tmp = tcg_temp_new_i64();
tcg_gen_concat_i32_i64(tmp, tmpl, tmph);
dead_tmp(tmpl);
dead_tmp(tmph);
tcg_gen_add_i64(val, val, tmp);
tcg_temp_free_i64(tmp);
}
| {
"code": [
" dead_tmp(tmpl);",
" dead_tmp(tmph);"
],
"line_no": [
23,
25
]
} | static void FUNC_0(DisasContext *VAR_0, TCGv_i64 VAR_1, int VAR_2, int VAR_3)
{
TCGv_i64 tmp;
TCGv tmpl;
TCGv tmph;
tmpl = load_reg(VAR_0, VAR_2);
tmph = load_reg(VAR_0, VAR_3);
tmp = tcg_temp_new_i64();
tcg_gen_concat_i32_i64(tmp, tmpl, tmph);
dead_tmp(tmpl);
dead_tmp(tmph);
tcg_gen_add_i64(VAR_1, VAR_1, tmp);
tcg_temp_free_i64(tmp);
}
| [
"static void FUNC_0(DisasContext *VAR_0, TCGv_i64 VAR_1, int VAR_2, int VAR_3)\n{",
"TCGv_i64 tmp;",
"TCGv tmpl;",
"TCGv tmph;",
"tmpl = load_reg(VAR_0, VAR_2);",
"tmph = load_reg(VAR_0, VAR_3);",
"tmp = tcg_temp_new_i64();",
"tcg_gen_concat_i32_i64(tmp, tmpl, tmph);",
"dead_tmp(tmpl);",
"dead_tmp(tmph);",
"tcg_gen_add_i64(VAR_1, VAR_1, tmp);",
"tcg_temp_free_i64(tmp);",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
]
]
|
15,675 | static int do_compress_ram_page(QEMUFile *f, RAMBlock *block,
ram_addr_t offset)
{
RAMState *rs = &ram_state;
int bytes_sent, blen;
uint8_t *p = block->host + (offset & TARGET_PAGE_MASK);
bytes_sent = save_page_header(rs, block, offset |
RAM_SAVE_FLAG_COMPRESS_PAGE);
blen = qemu_put_compression_data(f, p, TARGET_PAGE_SIZE,
migrate_compress_level());
if (blen < 0) {
bytes_sent = 0;
qemu_file_set_error(migrate_get_current()->to_dst_file, blen);
error_report("compressed data failed!");
} else {
bytes_sent += blen;
ram_release_pages(block->idstr, offset & TARGET_PAGE_MASK, 1);
}
return bytes_sent;
}
| true | qemu | 2bf3aa85f08186b8162b76e7e8efe5b5a44306a6 | static int do_compress_ram_page(QEMUFile *f, RAMBlock *block,
ram_addr_t offset)
{
RAMState *rs = &ram_state;
int bytes_sent, blen;
uint8_t *p = block->host + (offset & TARGET_PAGE_MASK);
bytes_sent = save_page_header(rs, block, offset |
RAM_SAVE_FLAG_COMPRESS_PAGE);
blen = qemu_put_compression_data(f, p, TARGET_PAGE_SIZE,
migrate_compress_level());
if (blen < 0) {
bytes_sent = 0;
qemu_file_set_error(migrate_get_current()->to_dst_file, blen);
error_report("compressed data failed!");
} else {
bytes_sent += blen;
ram_release_pages(block->idstr, offset & TARGET_PAGE_MASK, 1);
}
return bytes_sent;
}
| {
"code": [
" bytes_sent = save_page_header(rs, block, offset |"
],
"line_no": [
15
]
} | static int FUNC_0(QEMUFile *VAR_0, RAMBlock *VAR_1,
ram_addr_t VAR_2)
{
RAMState *rs = &ram_state;
int VAR_3, VAR_4;
uint8_t *p = VAR_1->host + (VAR_2 & TARGET_PAGE_MASK);
VAR_3 = save_page_header(rs, VAR_1, VAR_2 |
RAM_SAVE_FLAG_COMPRESS_PAGE);
VAR_4 = qemu_put_compression_data(VAR_0, p, TARGET_PAGE_SIZE,
migrate_compress_level());
if (VAR_4 < 0) {
VAR_3 = 0;
qemu_file_set_error(migrate_get_current()->to_dst_file, VAR_4);
error_report("compressed data failed!");
} else {
VAR_3 += VAR_4;
ram_release_pages(VAR_1->idstr, VAR_2 & TARGET_PAGE_MASK, 1);
}
return VAR_3;
}
| [
"static int FUNC_0(QEMUFile *VAR_0, RAMBlock *VAR_1,\nram_addr_t VAR_2)\n{",
"RAMState *rs = &ram_state;",
"int VAR_3, VAR_4;",
"uint8_t *p = VAR_1->host + (VAR_2 & TARGET_PAGE_MASK);",
"VAR_3 = save_page_header(rs, VAR_1, VAR_2 |\nRAM_SAVE_FLAG_COMPRESS_PAGE);",
"VAR_4 = qemu_put_compression_data(VAR_0, p, TARGET_PAGE_SIZE,\nmigrate_compress_level());",
"if (VAR_4 < 0) {",
"VAR_3 = 0;",
"qemu_file_set_error(migrate_get_current()->to_dst_file, VAR_4);",
"error_report(\"compressed data failed!\");",
"} else {",
"VAR_3 += VAR_4;",
"ram_release_pages(VAR_1->idstr, VAR_2 & TARGET_PAGE_MASK, 1);",
"}",
"return VAR_3;",
"}"
]
| [
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15,
17
],
[
19,
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
]
]
|
15,676 | void ff_avg_h264_qpel4_mc11_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_hv_qrt_and_aver_dst_4x4_msa(src - 2,
src - (stride * 2),
stride, dst, stride);
}
| false | FFmpeg | 1181d93231e9b807965724587d363c1cfd5a1d0d | void ff_avg_h264_qpel4_mc11_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_hv_qrt_and_aver_dst_4x4_msa(src - 2,
src - (stride * 2),
stride, dst, stride);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,
ptrdiff_t VAR_2)
{
avc_luma_hv_qrt_and_aver_dst_4x4_msa(VAR_1 - 2,
VAR_1 - (VAR_2 * 2),
VAR_2, VAR_0, VAR_2);
}
| [
"void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{",
"avc_luma_hv_qrt_and_aver_dst_4x4_msa(VAR_1 - 2,\nVAR_1 - (VAR_2 * 2),\nVAR_2, VAR_0, VAR_2);",
"}"
]
| [
0,
0,
0
]
| [
[
1,
3,
5
],
[
7,
9,
11
],
[
13
]
]
|
15,677 | static int ra144_decode_frame(AVCodecContext * avctx,
void *vdata, int *data_size,
const uint8_t * buf, int buf_size)
{
static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};
unsigned int a, b, c;
int i;
signed short *shptr;
int16_t *data = vdata;
unsigned int val;
Real144_internal *glob = avctx->priv_data;
GetBitContext gb;
if(buf_size == 0)
return 0;
init_get_bits(&gb, buf, 20 * 8);
for (i=0; i<10; i++)
// "<< 1"? Doesn't this make one value out of two of the table useless?
glob->swapbuf1[i] = decodetable[i][get_bits(&gb, sizes[i]) << 1];
do_voice(glob->swapbuf1, glob->swapbuf2);
val = decodeval[get_bits(&gb, 5) << 1]; // Useless table entries?
a = t_sqrt(val*glob->oldval) >> 12;
for (c=0; c < NBLOCKS; c++) {
if (c == (NBLOCKS - 1)) {
dec1(glob, glob->swapbuf1, glob->swapbuf2, 3, val);
} else {
if (c * 2 == (NBLOCKS - 2)) {
if (glob->oldval < val) {
dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, a, glob->swapbuf2alt, c);
} else {
dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, a, glob->swapbuf2, c);
}
} else {
if (c * 2 < (NBLOCKS - 2)) {
dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, glob->oldval, glob->swapbuf2, c);
} else {
dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, val, glob->swapbuf2alt, c);
}
}
}
}
/* do output */
for (b=0, c=0; c<4; c++) {
unsigned int gval = glob->gbuf1[c * 2];
unsigned short *gsp = glob->gbuf2 + b;
signed short output_buffer[40];
do_output_subblock(glob, gsp, gval, output_buffer, &gb);
shptr = output_buffer;
while (shptr < output_buffer + BLOCKSIZE)
*data++ = av_clip_int16(*(shptr++) << 2);
b += 30;
}
glob->oldval = val;
FFSWAP(unsigned int *, glob->swapbuf1alt, glob->swapbuf1);
FFSWAP(unsigned int *, glob->swapbuf2alt, glob->swapbuf2);
*data_size = 2*160;
return 20;
}
| false | FFmpeg | 59ffb6e2cc0974f3090a10facdedf8da5f6bf742 | static int ra144_decode_frame(AVCodecContext * avctx,
void *vdata, int *data_size,
const uint8_t * buf, int buf_size)
{
static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};
unsigned int a, b, c;
int i;
signed short *shptr;
int16_t *data = vdata;
unsigned int val;
Real144_internal *glob = avctx->priv_data;
GetBitContext gb;
if(buf_size == 0)
return 0;
init_get_bits(&gb, buf, 20 * 8);
for (i=0; i<10; i++)
glob->swapbuf1[i] = decodetable[i][get_bits(&gb, sizes[i]) << 1];
do_voice(glob->swapbuf1, glob->swapbuf2);
val = decodeval[get_bits(&gb, 5) << 1];
a = t_sqrt(val*glob->oldval) >> 12;
for (c=0; c < NBLOCKS; c++) {
if (c == (NBLOCKS - 1)) {
dec1(glob, glob->swapbuf1, glob->swapbuf2, 3, val);
} else {
if (c * 2 == (NBLOCKS - 2)) {
if (glob->oldval < val) {
dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, a, glob->swapbuf2alt, c);
} else {
dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, a, glob->swapbuf2, c);
}
} else {
if (c * 2 < (NBLOCKS - 2)) {
dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, glob->oldval, glob->swapbuf2, c);
} else {
dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, val, glob->swapbuf2alt, c);
}
}
}
}
for (b=0, c=0; c<4; c++) {
unsigned int gval = glob->gbuf1[c * 2];
unsigned short *gsp = glob->gbuf2 + b;
signed short output_buffer[40];
do_output_subblock(glob, gsp, gval, output_buffer, &gb);
shptr = output_buffer;
while (shptr < output_buffer + BLOCKSIZE)
*data++ = av_clip_int16(*(shptr++) << 2);
b += 30;
}
glob->oldval = val;
FFSWAP(unsigned int *, glob->swapbuf1alt, glob->swapbuf1);
FFSWAP(unsigned int *, glob->swapbuf2alt, glob->swapbuf2);
*data_size = 2*160;
return 20;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext * VAR_0,
void *VAR_1, int *VAR_2,
const uint8_t * VAR_3, int VAR_4)
{
static const uint8_t VAR_5[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};
unsigned int VAR_6, VAR_7, VAR_8;
int VAR_9;
signed short *VAR_10;
int16_t *data = VAR_1;
unsigned int VAR_11;
Real144_internal *glob = VAR_0->priv_data;
GetBitContext gb;
if(VAR_4 == 0)
return 0;
init_get_bits(&gb, VAR_3, 20 * 8);
for (VAR_9=0; VAR_9<10; VAR_9++)
glob->swapbuf1[VAR_9] = decodetable[VAR_9][get_bits(&gb, VAR_5[VAR_9]) << 1];
do_voice(glob->swapbuf1, glob->swapbuf2);
VAR_11 = decodeval[get_bits(&gb, 5) << 1];
VAR_6 = t_sqrt(VAR_11*glob->oldval) >> 12;
for (VAR_8=0; VAR_8 < NBLOCKS; VAR_8++) {
if (VAR_8 == (NBLOCKS - 1)) {
dec1(glob, glob->swapbuf1, glob->swapbuf2, 3, VAR_11);
} else {
if (VAR_8 * 2 == (NBLOCKS - 2)) {
if (glob->oldval < VAR_11) {
dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, VAR_6, glob->swapbuf2alt, VAR_8);
} else {
dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, VAR_6, glob->swapbuf2, VAR_8);
}
} else {
if (VAR_8 * 2 < (NBLOCKS - 2)) {
dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, glob->oldval, glob->swapbuf2, VAR_8);
} else {
dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, VAR_11, glob->swapbuf2alt, VAR_8);
}
}
}
}
for (VAR_7=0, VAR_8=0; VAR_8<4; VAR_8++) {
unsigned int VAR_12 = glob->gbuf1[VAR_8 * 2];
unsigned short *VAR_13 = glob->gbuf2 + VAR_7;
signed short VAR_14[40];
do_output_subblock(glob, VAR_13, VAR_12, VAR_14, &gb);
VAR_10 = VAR_14;
while (VAR_10 < VAR_14 + BLOCKSIZE)
*data++ = av_clip_int16(*(VAR_10++) << 2);
VAR_7 += 30;
}
glob->oldval = VAR_11;
FFSWAP(unsigned int *, glob->swapbuf1alt, glob->swapbuf1);
FFSWAP(unsigned int *, glob->swapbuf2alt, glob->swapbuf2);
*VAR_2 = 2*160;
return 20;
}
| [
"static int FUNC_0(AVCodecContext * VAR_0,\nvoid *VAR_1, int *VAR_2,\nconst uint8_t * VAR_3, int VAR_4)\n{",
"static const uint8_t VAR_5[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};",
"unsigned int VAR_6, VAR_7, VAR_8;",
"int VAR_9;",
"signed short *VAR_10;",
"int16_t *data = VAR_1;",
"unsigned int VAR_11;",
"Real144_internal *glob = VAR_0->priv_data;",
"GetBitContext gb;",
"if(VAR_4 == 0)\nreturn 0;",
"init_get_bits(&gb, VAR_3, 20 * 8);",
"for (VAR_9=0; VAR_9<10; VAR_9++)",
"glob->swapbuf1[VAR_9] = decodetable[VAR_9][get_bits(&gb, VAR_5[VAR_9]) << 1];",
"do_voice(glob->swapbuf1, glob->swapbuf2);",
"VAR_11 = decodeval[get_bits(&gb, 5) << 1];",
"VAR_6 = t_sqrt(VAR_11*glob->oldval) >> 12;",
"for (VAR_8=0; VAR_8 < NBLOCKS; VAR_8++) {",
"if (VAR_8 == (NBLOCKS - 1)) {",
"dec1(glob, glob->swapbuf1, glob->swapbuf2, 3, VAR_11);",
"} else {",
"if (VAR_8 * 2 == (NBLOCKS - 2)) {",
"if (glob->oldval < VAR_11) {",
"dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, VAR_6, glob->swapbuf2alt, VAR_8);",
"} else {",
"dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, VAR_6, glob->swapbuf2, VAR_8);",
"}",
"} else {",
"if (VAR_8 * 2 < (NBLOCKS - 2)) {",
"dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, glob->oldval, glob->swapbuf2, VAR_8);",
"} else {",
"dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, VAR_11, glob->swapbuf2alt, VAR_8);",
"}",
"}",
"}",
"}",
"for (VAR_7=0, VAR_8=0; VAR_8<4; VAR_8++) {",
"unsigned int VAR_12 = glob->gbuf1[VAR_8 * 2];",
"unsigned short *VAR_13 = glob->gbuf2 + VAR_7;",
"signed short VAR_14[40];",
"do_output_subblock(glob, VAR_13, VAR_12, VAR_14, &gb);",
"VAR_10 = VAR_14;",
"while (VAR_10 < VAR_14 + BLOCKSIZE)\n*data++ = av_clip_int16(*(VAR_10++) << 2);",
"VAR_7 += 30;",
"}",
"glob->oldval = VAR_11;",
"FFSWAP(unsigned int *, glob->swapbuf1alt, glob->swapbuf1);",
"FFSWAP(unsigned int *, glob->swapbuf2alt, glob->swapbuf2);",
"*VAR_2 = 2*160;",
"return 20;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
29,
31
],
[
35
],
[
39
],
[
43
],
[
47
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
99
],
[
101
],
[
103
],
[
105
],
[
109
],
[
113
],
[
115,
117
],
[
119
],
[
121
],
[
125
],
[
129
],
[
131
],
[
135
],
[
137
],
[
139
]
]
|
15,678 | static int h261_decode_picture_header(H261Context *h)
{
MpegEncContext *const s = &h->s;
int format, i;
uint32_t startcode = 0;
for (i = get_bits_left(&s->gb); i > 24; i -= 1) {
startcode = ((startcode << 1) | get_bits(&s->gb, 1)) & 0x000FFFFF;
if (startcode == 0x10)
break;
}
if (startcode != 0x10) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1;
}
/* temporal reference */
i = get_bits(&s->gb, 5); /* picture timestamp */
if (i < (s->picture_number & 31))
i += 32;
s->picture_number = (s->picture_number & ~31) + i;
s->avctx->time_base = (AVRational) { 1001, 30000 };
/* PTYPE starts here */
skip_bits1(&s->gb); /* split screen off */
skip_bits1(&s->gb); /* camera off */
skip_bits1(&s->gb); /* freeze picture release off */
format = get_bits1(&s->gb);
// only 2 formats possible
if (format == 0) { // QCIF
s->width = 176;
s->height = 144;
s->mb_width = 11;
s->mb_height = 9;
} else { // CIF
s->width = 352;
s->height = 288;
s->mb_width = 22;
s->mb_height = 18;
}
s->mb_num = s->mb_width * s->mb_height;
skip_bits1(&s->gb); /* still image mode off */
skip_bits1(&s->gb); /* Reserved */
/* PEI */
while (get_bits1(&s->gb) != 0)
skip_bits(&s->gb, 8);
/* H.261 has no I-frames, but if we pass AV_PICTURE_TYPE_I for the first
* frame, the codec crashes if it does not contain all I-blocks
* (e.g. when a packet is lost). */
s->pict_type = AV_PICTURE_TYPE_P;
h->gob_number = 0;
return 0;
}
| false | FFmpeg | 719dbe86ea0e85b3b89f492c69e10bb0e733bcbb | static int h261_decode_picture_header(H261Context *h)
{
MpegEncContext *const s = &h->s;
int format, i;
uint32_t startcode = 0;
for (i = get_bits_left(&s->gb); i > 24; i -= 1) {
startcode = ((startcode << 1) | get_bits(&s->gb, 1)) & 0x000FFFFF;
if (startcode == 0x10)
break;
}
if (startcode != 0x10) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1;
}
i = get_bits(&s->gb, 5);
if (i < (s->picture_number & 31))
i += 32;
s->picture_number = (s->picture_number & ~31) + i;
s->avctx->time_base = (AVRational) { 1001, 30000 };
skip_bits1(&s->gb);
skip_bits1(&s->gb);
skip_bits1(&s->gb);
format = get_bits1(&s->gb);
if (format == 0) {
s->width = 176;
s->height = 144;
s->mb_width = 11;
s->mb_height = 9;
} else {
s->width = 352;
s->height = 288;
s->mb_width = 22;
s->mb_height = 18;
}
s->mb_num = s->mb_width * s->mb_height;
skip_bits1(&s->gb);
skip_bits1(&s->gb);
while (get_bits1(&s->gb) != 0)
skip_bits(&s->gb, 8);
s->pict_type = AV_PICTURE_TYPE_P;
h->gob_number = 0;
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(H261Context *VAR_0)
{
MpegEncContext *const s = &VAR_0->s;
int VAR_1, VAR_2;
uint32_t startcode = 0;
for (VAR_2 = get_bits_left(&s->gb); VAR_2 > 24; VAR_2 -= 1) {
startcode = ((startcode << 1) | get_bits(&s->gb, 1)) & 0x000FFFFF;
if (startcode == 0x10)
break;
}
if (startcode != 0x10) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1;
}
VAR_2 = get_bits(&s->gb, 5);
if (VAR_2 < (s->picture_number & 31))
VAR_2 += 32;
s->picture_number = (s->picture_number & ~31) + VAR_2;
s->avctx->time_base = (AVRational) { 1001, 30000 };
skip_bits1(&s->gb);
skip_bits1(&s->gb);
skip_bits1(&s->gb);
VAR_1 = get_bits1(&s->gb);
if (VAR_1 == 0) {
s->width = 176;
s->height = 144;
s->mb_width = 11;
s->mb_height = 9;
} else {
s->width = 352;
s->height = 288;
s->mb_width = 22;
s->mb_height = 18;
}
s->mb_num = s->mb_width * s->mb_height;
skip_bits1(&s->gb);
skip_bits1(&s->gb);
while (get_bits1(&s->gb) != 0)
skip_bits(&s->gb, 8);
s->pict_type = AV_PICTURE_TYPE_P;
VAR_0->gob_number = 0;
return 0;
}
| [
"static int FUNC_0(H261Context *VAR_0)\n{",
"MpegEncContext *const s = &VAR_0->s;",
"int VAR_1, VAR_2;",
"uint32_t startcode = 0;",
"for (VAR_2 = get_bits_left(&s->gb); VAR_2 > 24; VAR_2 -= 1) {",
"startcode = ((startcode << 1) | get_bits(&s->gb, 1)) & 0x000FFFFF;",
"if (startcode == 0x10)\nbreak;",
"}",
"if (startcode != 0x10) {",
"av_log(s->avctx, AV_LOG_ERROR, \"Bad picture start code\\n\");",
"return -1;",
"}",
"VAR_2 = get_bits(&s->gb, 5);",
"if (VAR_2 < (s->picture_number & 31))\nVAR_2 += 32;",
"s->picture_number = (s->picture_number & ~31) + VAR_2;",
"s->avctx->time_base = (AVRational) { 1001, 30000 };",
"skip_bits1(&s->gb);",
"skip_bits1(&s->gb);",
"skip_bits1(&s->gb);",
"VAR_1 = get_bits1(&s->gb);",
"if (VAR_1 == 0) {",
"s->width = 176;",
"s->height = 144;",
"s->mb_width = 11;",
"s->mb_height = 9;",
"} else {",
"s->width = 352;",
"s->height = 288;",
"s->mb_width = 22;",
"s->mb_height = 18;",
"}",
"s->mb_num = s->mb_width * s->mb_height;",
"skip_bits1(&s->gb);",
"skip_bits1(&s->gb);",
"while (get_bits1(&s->gb) != 0)\nskip_bits(&s->gb, 8);",
"s->pict_type = AV_PICTURE_TYPE_P;",
"VAR_0->gob_number = 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
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
19,
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
39
],
[
41,
43
],
[
45
],
[
49
],
[
55
],
[
57
],
[
59
],
[
63
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
93
],
[
97
],
[
99
],
[
105,
107
],
[
117
],
[
121
],
[
123
],
[
125
]
]
|
15,680 | static void ppc_cpu_unrealizefn(DeviceState *dev, Error **errp)
{
PowerPCCPU *cpu = POWERPC_CPU(dev);
CPUPPCState *env = &cpu->env;
opc_handler_t **table;
int i, j;
cpu_exec_exit(CPU(dev));
for (i = 0; i < PPC_CPU_OPCODES_LEN; i++) {
if (env->opcodes[i] == &invalid_handler) {
continue;
}
if (is_indirect_opcode(env->opcodes[i])) {
table = ind_table(env->opcodes[i]);
for (j = 0; j < PPC_CPU_INDIRECT_OPCODES_LEN; j++) {
if (table[j] != &invalid_handler &&
is_indirect_opcode(table[j])) {
g_free((opc_handler_t *)((uintptr_t)table[j] &
~PPC_INDIRECT));
}
}
g_free((opc_handler_t *)((uintptr_t)env->opcodes[i] &
~PPC_INDIRECT));
}
}
}
| true | qemu | 323ad19bcc601d3ec9cb6f0f5b4d67b602fc519e | static void ppc_cpu_unrealizefn(DeviceState *dev, Error **errp)
{
PowerPCCPU *cpu = POWERPC_CPU(dev);
CPUPPCState *env = &cpu->env;
opc_handler_t **table;
int i, j;
cpu_exec_exit(CPU(dev));
for (i = 0; i < PPC_CPU_OPCODES_LEN; i++) {
if (env->opcodes[i] == &invalid_handler) {
continue;
}
if (is_indirect_opcode(env->opcodes[i])) {
table = ind_table(env->opcodes[i]);
for (j = 0; j < PPC_CPU_INDIRECT_OPCODES_LEN; j++) {
if (table[j] != &invalid_handler &&
is_indirect_opcode(table[j])) {
g_free((opc_handler_t *)((uintptr_t)table[j] &
~PPC_INDIRECT));
}
}
g_free((opc_handler_t *)((uintptr_t)env->opcodes[i] &
~PPC_INDIRECT));
}
}
}
| {
"code": [
" opc_handler_t **table;",
" int i, j;",
" if (table[j] != &invalid_handler &&",
" is_indirect_opcode(table[j])) {",
" ~PPC_INDIRECT));"
],
"line_no": [
9,
11,
33,
35,
39
]
} | static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)
{
PowerPCCPU *cpu = POWERPC_CPU(VAR_0);
CPUPPCState *env = &cpu->env;
opc_handler_t **table;
int VAR_2, VAR_3;
cpu_exec_exit(CPU(VAR_0));
for (VAR_2 = 0; VAR_2 < PPC_CPU_OPCODES_LEN; VAR_2++) {
if (env->opcodes[VAR_2] == &invalid_handler) {
continue;
}
if (is_indirect_opcode(env->opcodes[VAR_2])) {
table = ind_table(env->opcodes[VAR_2]);
for (VAR_3 = 0; VAR_3 < PPC_CPU_INDIRECT_OPCODES_LEN; VAR_3++) {
if (table[VAR_3] != &invalid_handler &&
is_indirect_opcode(table[VAR_3])) {
g_free((opc_handler_t *)((uintptr_t)table[VAR_3] &
~PPC_INDIRECT));
}
}
g_free((opc_handler_t *)((uintptr_t)env->opcodes[VAR_2] &
~PPC_INDIRECT));
}
}
}
| [
"static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{",
"PowerPCCPU *cpu = POWERPC_CPU(VAR_0);",
"CPUPPCState *env = &cpu->env;",
"opc_handler_t **table;",
"int VAR_2, VAR_3;",
"cpu_exec_exit(CPU(VAR_0));",
"for (VAR_2 = 0; VAR_2 < PPC_CPU_OPCODES_LEN; VAR_2++) {",
"if (env->opcodes[VAR_2] == &invalid_handler) {",
"continue;",
"}",
"if (is_indirect_opcode(env->opcodes[VAR_2])) {",
"table = ind_table(env->opcodes[VAR_2]);",
"for (VAR_3 = 0; VAR_3 < PPC_CPU_INDIRECT_OPCODES_LEN; VAR_3++) {",
"if (table[VAR_3] != &invalid_handler &&\nis_indirect_opcode(table[VAR_3])) {",
"g_free((opc_handler_t *)((uintptr_t)table[VAR_3] &\n~PPC_INDIRECT));",
"}",
"}",
"g_free((opc_handler_t *)((uintptr_t)env->opcodes[VAR_2] &\n~PPC_INDIRECT));",
"}",
"}",
"}"
]
| [
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33,
35
],
[
37,
39
],
[
41
],
[
43
],
[
45,
47
],
[
49
],
[
51
],
[
53
]
]
|
15,681 | static void h261_decode_init_vlc(H261Context *h){
static int done = 0;
if(!done){
done = 1;
init_vlc(&h261_mba_vlc, H261_MBA_VLC_BITS, 35,
h261_mba_bits, 1, 1,
h261_mba_code, 1, 1);
init_vlc(&h261_mtype_vlc, H261_MTYPE_VLC_BITS, 10,
h261_mtype_bits, 1, 1,
h261_mtype_code, 1, 1);
init_vlc(&h261_mv_vlc, H261_MV_VLC_BITS, 17,
&h261_mv_tab[0][1], 2, 1,
&h261_mv_tab[0][0], 2, 1);
init_vlc(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63,
&h261_cbp_tab[0][1], 2, 1,
&h261_cbp_tab[0][0], 2, 1);
init_rl(&h261_rl_tcoeff);
init_vlc_rl(&h261_rl_tcoeff);
}
}
| true | FFmpeg | 073c2593c9f0aa4445a6fc1b9b24e6e52a8cc2c1 | static void h261_decode_init_vlc(H261Context *h){
static int done = 0;
if(!done){
done = 1;
init_vlc(&h261_mba_vlc, H261_MBA_VLC_BITS, 35,
h261_mba_bits, 1, 1,
h261_mba_code, 1, 1);
init_vlc(&h261_mtype_vlc, H261_MTYPE_VLC_BITS, 10,
h261_mtype_bits, 1, 1,
h261_mtype_code, 1, 1);
init_vlc(&h261_mv_vlc, H261_MV_VLC_BITS, 17,
&h261_mv_tab[0][1], 2, 1,
&h261_mv_tab[0][0], 2, 1);
init_vlc(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63,
&h261_cbp_tab[0][1], 2, 1,
&h261_cbp_tab[0][0], 2, 1);
init_rl(&h261_rl_tcoeff);
init_vlc_rl(&h261_rl_tcoeff);
}
}
| {
"code": [
" static int done = 0;",
" done = 1;",
" init_rl(&h261_rl_tcoeff);",
" h261_mba_code, 1, 1);",
" h261_mtype_code, 1, 1);",
" &h261_mv_tab[0][0], 2, 1);",
" &h261_cbp_tab[0][0], 2, 1);",
" init_rl(&h261_rl_tcoeff);",
" init_vlc_rl(&h261_rl_tcoeff);"
],
"line_no": [
3,
9,
35,
15,
21,
27,
33,
35,
37
]
} | static void FUNC_0(H261Context *VAR_0){
static int VAR_1 = 0;
if(!VAR_1){
VAR_1 = 1;
init_vlc(&h261_mba_vlc, H261_MBA_VLC_BITS, 35,
h261_mba_bits, 1, 1,
h261_mba_code, 1, 1);
init_vlc(&h261_mtype_vlc, H261_MTYPE_VLC_BITS, 10,
h261_mtype_bits, 1, 1,
h261_mtype_code, 1, 1);
init_vlc(&h261_mv_vlc, H261_MV_VLC_BITS, 17,
&h261_mv_tab[0][1], 2, 1,
&h261_mv_tab[0][0], 2, 1);
init_vlc(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63,
&h261_cbp_tab[0][1], 2, 1,
&h261_cbp_tab[0][0], 2, 1);
init_rl(&h261_rl_tcoeff);
init_vlc_rl(&h261_rl_tcoeff);
}
}
| [
"static void FUNC_0(H261Context *VAR_0){",
"static int VAR_1 = 0;",
"if(!VAR_1){",
"VAR_1 = 1;",
"init_vlc(&h261_mba_vlc, H261_MBA_VLC_BITS, 35,\nh261_mba_bits, 1, 1,\nh261_mba_code, 1, 1);",
"init_vlc(&h261_mtype_vlc, H261_MTYPE_VLC_BITS, 10,\nh261_mtype_bits, 1, 1,\nh261_mtype_code, 1, 1);",
"init_vlc(&h261_mv_vlc, H261_MV_VLC_BITS, 17,\n&h261_mv_tab[0][1], 2, 1,\n&h261_mv_tab[0][0], 2, 1);",
"init_vlc(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63,\n&h261_cbp_tab[0][1], 2, 1,\n&h261_cbp_tab[0][0], 2, 1);",
"init_rl(&h261_rl_tcoeff);",
"init_vlc_rl(&h261_rl_tcoeff);",
"}",
"}"
]
| [
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
0,
0
]
| [
[
1
],
[
3
],
[
7
],
[
9
],
[
11,
13,
15
],
[
17,
19,
21
],
[
23,
25,
27
],
[
29,
31,
33
],
[
35
],
[
37
],
[
39
],
[
41
]
]
|
15,682 | static void init_proc_750cl (CPUPPCState *env)
{
gen_spr_ne_601(env);
gen_spr_7xx(env);
/* XXX : not implemented */
spr_register(env, SPR_L2CR, "L2CR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, NULL,
0x00000000);
/* Time base */
gen_tbl(env);
/* Thermal management */
/* Those registers are fake on 750CL */
spr_register(env, SPR_THRM1, "THRM1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_THRM2, "THRM2",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_THRM3, "THRM3",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* XXX: not implemented */
spr_register(env, SPR_750_TDCL, "TDCL",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_TDCH, "TDCH",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* DMA */
/* XXX : not implemented */
spr_register(env, SPR_750_WPAR, "WPAR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_DMAL, "DMAL",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_DMAU, "DMAU",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* Hardware implementation registers */
/* XXX : not implemented */
spr_register(env, SPR_HID0, "HID0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* XXX : not implemented */
spr_register(env, SPR_HID1, "HID1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* XXX : not implemented */
spr_register(env, SPR_750CL_HID2, "HID2",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* XXX : not implemented */
spr_register(env, SPR_750CL_HID4, "HID4",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* Quantization registers */
/* XXX : not implemented */
spr_register(env, SPR_750_GQR0, "GQR0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* XXX : not implemented */
spr_register(env, SPR_750_GQR1, "GQR1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* XXX : not implemented */
spr_register(env, SPR_750_GQR2, "GQR2",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* XXX : not implemented */
spr_register(env, SPR_750_GQR3, "GQR3",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* XXX : not implemented */
spr_register(env, SPR_750_GQR4, "GQR4",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* XXX : not implemented */
spr_register(env, SPR_750_GQR5, "GQR5",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* XXX : not implemented */
spr_register(env, SPR_750_GQR6, "GQR6",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* XXX : not implemented */
spr_register(env, SPR_750_GQR7, "GQR7",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* Memory management */
gen_low_BATs(env);
/* PowerPC 750cl has 8 DBATs and 8 IBATs */
gen_high_BATs(env);
init_excp_750cl(env);
env->dcache_line_size = 32;
env->icache_line_size = 32;
/* Allocate hardware IRQ controller */
ppc6xx_irq_init(env);
}
| true | qemu | 9633fcc6a02f23e3ef00aa5fe3fe9c41f57c3456 | static void init_proc_750cl (CPUPPCState *env)
{
gen_spr_ne_601(env);
gen_spr_7xx(env);
spr_register(env, SPR_L2CR, "L2CR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, NULL,
0x00000000);
gen_tbl(env);
spr_register(env, SPR_THRM1, "THRM1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_THRM2, "THRM2",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_THRM3, "THRM3",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_TDCL, "TDCL",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_TDCH, "TDCH",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_WPAR, "WPAR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_DMAL, "DMAL",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_DMAU, "DMAU",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_HID0, "HID0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_HID1, "HID1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750CL_HID2, "HID2",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750CL_HID4, "HID4",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_GQR0, "GQR0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_GQR1, "GQR1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_GQR2, "GQR2",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_GQR3, "GQR3",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_GQR4, "GQR4",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_GQR5, "GQR5",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_GQR6, "GQR6",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750_GQR7, "GQR7",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
gen_low_BATs(env);
gen_high_BATs(env);
init_excp_750cl(env);
env->dcache_line_size = 32;
env->icache_line_size = 32;
ppc6xx_irq_init(env);
}
| {
"code": [
" &spr_read_generic, NULL,",
" &spr_read_generic, NULL,",
" &spr_read_generic, NULL,",
" &spr_read_generic, NULL,",
" &spr_read_generic, NULL,",
" &spr_read_generic, NULL,",
" &spr_read_generic, NULL,",
" &spr_read_generic, NULL,",
" &spr_read_generic, NULL,",
" &spr_read_generic, NULL,",
" &spr_read_generic, NULL,",
" &spr_read_generic, NULL,"
],
"line_no": [
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15
]
} | static void FUNC_0 (CPUPPCState *VAR_0)
{
gen_spr_ne_601(VAR_0);
gen_spr_7xx(VAR_0);
spr_register(VAR_0, SPR_L2CR, "L2CR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, NULL,
0x00000000);
gen_tbl(VAR_0);
spr_register(VAR_0, SPR_THRM1, "THRM1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_THRM2, "THRM2",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_THRM3, "THRM3",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750_TDCL, "TDCL",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750_TDCH, "TDCH",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750_WPAR, "WPAR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750_DMAL, "DMAL",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750_DMAU, "DMAU",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_HID0, "HID0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_HID1, "HID1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750CL_HID2, "HID2",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750CL_HID4, "HID4",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750_GQR0, "GQR0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750_GQR1, "GQR1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750_GQR2, "GQR2",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750_GQR3, "GQR3",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750_GQR4, "GQR4",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750_GQR5, "GQR5",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750_GQR6, "GQR6",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_750_GQR7, "GQR7",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
gen_low_BATs(VAR_0);
gen_high_BATs(VAR_0);
init_excp_750cl(VAR_0);
VAR_0->dcache_line_size = 32;
VAR_0->icache_line_size = 32;
ppc6xx_irq_init(VAR_0);
}
| [
"static void FUNC_0 (CPUPPCState *VAR_0)\n{",
"gen_spr_ne_601(VAR_0);",
"gen_spr_7xx(VAR_0);",
"spr_register(VAR_0, SPR_L2CR, \"L2CR\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, NULL,\n0x00000000);",
"gen_tbl(VAR_0);",
"spr_register(VAR_0, SPR_THRM1, \"THRM1\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_THRM2, \"THRM2\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_THRM3, \"THRM3\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750_TDCL, \"TDCL\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750_TDCH, \"TDCH\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750_WPAR, \"WPAR\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750_DMAL, \"DMAL\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750_DMAU, \"DMAU\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_HID0, \"HID0\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_HID1, \"HID1\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750CL_HID2, \"HID2\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750CL_HID4, \"HID4\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750_GQR0, \"GQR0\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750_GQR1, \"GQR1\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750_GQR2, \"GQR2\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750_GQR3, \"GQR3\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750_GQR4, \"GQR4\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750_GQR5, \"GQR5\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750_GQR6, \"GQR6\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_750_GQR7, \"GQR7\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"gen_low_BATs(VAR_0);",
"gen_high_BATs(VAR_0);",
"init_excp_750cl(VAR_0);",
"VAR_0->dcache_line_size = 32;",
"VAR_0->icache_line_size = 32;",
"ppc6xx_irq_init(VAR_0);",
"}"
]
| [
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
11,
13,
15,
17
],
[
21
],
[
27,
29,
31,
33
],
[
35,
37,
39,
41
],
[
43,
45,
47,
49
],
[
53,
55,
57,
59
],
[
61,
63,
65,
67
],
[
73,
75,
77,
79
],
[
81,
83,
85,
87
],
[
89,
91,
93,
95
],
[
101,
103,
105,
107
],
[
111,
113,
115,
117
],
[
121,
123,
125,
127
],
[
131,
133,
135,
137
],
[
143,
145,
147,
149
],
[
153,
155,
157,
159
],
[
163,
165,
167,
169
],
[
173,
175,
177,
179
],
[
183,
185,
187,
189
],
[
193,
195,
197,
199
],
[
203,
205,
207,
209
],
[
213,
215,
217,
219
],
[
223
],
[
227
],
[
229
],
[
231
],
[
233
],
[
237
],
[
239
]
]
|
15,683 | static target_ulong h_set_mode(PowerPCCPU *cpu, sPAPREnvironment *spapr,
target_ulong opcode, target_ulong *args)
{
CPUState *cs;
target_ulong mflags = args[0];
target_ulong resource = args[1];
target_ulong value1 = args[2];
target_ulong value2 = args[3];
target_ulong ret = H_P2;
if (resource == H_SET_MODE_ENDIAN) {
if (value1) {
ret = H_P3;
goto out;
}
if (value2) {
ret = H_P4;
goto out;
}
switch (mflags) {
case H_SET_MODE_ENDIAN_BIG:
CPU_FOREACH(cs) {
PowerPCCPU *cp = POWERPC_CPU(cs);
CPUPPCState *env = &cp->env;
env->spr[SPR_LPCR] &= ~LPCR_ILE;
}
ret = H_SUCCESS;
break;
case H_SET_MODE_ENDIAN_LITTLE:
CPU_FOREACH(cs) {
PowerPCCPU *cp = POWERPC_CPU(cs);
CPUPPCState *env = &cp->env;
env->spr[SPR_LPCR] |= LPCR_ILE;
}
ret = H_SUCCESS;
break;
default:
ret = H_UNSUPPORTED_FLAG;
}
}
out:
return ret;
}
| true | qemu | a46622fd07edc6fd3c66f8ab79b4782a78b115f3 | static target_ulong h_set_mode(PowerPCCPU *cpu, sPAPREnvironment *spapr,
target_ulong opcode, target_ulong *args)
{
CPUState *cs;
target_ulong mflags = args[0];
target_ulong resource = args[1];
target_ulong value1 = args[2];
target_ulong value2 = args[3];
target_ulong ret = H_P2;
if (resource == H_SET_MODE_ENDIAN) {
if (value1) {
ret = H_P3;
goto out;
}
if (value2) {
ret = H_P4;
goto out;
}
switch (mflags) {
case H_SET_MODE_ENDIAN_BIG:
CPU_FOREACH(cs) {
PowerPCCPU *cp = POWERPC_CPU(cs);
CPUPPCState *env = &cp->env;
env->spr[SPR_LPCR] &= ~LPCR_ILE;
}
ret = H_SUCCESS;
break;
case H_SET_MODE_ENDIAN_LITTLE:
CPU_FOREACH(cs) {
PowerPCCPU *cp = POWERPC_CPU(cs);
CPUPPCState *env = &cp->env;
env->spr[SPR_LPCR] |= LPCR_ILE;
}
ret = H_SUCCESS;
break;
default:
ret = H_UNSUPPORTED_FLAG;
}
}
out:
return ret;
}
| {
"code": [
" if (resource == H_SET_MODE_ENDIAN) {",
" PowerPCCPU *cp = POWERPC_CPU(cs);",
" CPUPPCState *env = &cp->env;",
" env->spr[SPR_LPCR] &= ~LPCR_ILE;",
" PowerPCCPU *cp = POWERPC_CPU(cs);",
" CPUPPCState *env = &cp->env;",
" env->spr[SPR_LPCR] |= LPCR_ILE;"
],
"line_no": [
21,
47,
49,
51,
47,
49,
69
]
} | static target_ulong FUNC_0(PowerPCCPU *cpu, sPAPREnvironment *spapr,
target_ulong opcode, target_ulong *args)
{
CPUState *cs;
target_ulong mflags = args[0];
target_ulong resource = args[1];
target_ulong value1 = args[2];
target_ulong value2 = args[3];
target_ulong ret = H_P2;
if (resource == H_SET_MODE_ENDIAN) {
if (value1) {
ret = H_P3;
goto out;
}
if (value2) {
ret = H_P4;
goto out;
}
switch (mflags) {
case H_SET_MODE_ENDIAN_BIG:
CPU_FOREACH(cs) {
PowerPCCPU *cp = POWERPC_CPU(cs);
CPUPPCState *env = &cp->env;
env->spr[SPR_LPCR] &= ~LPCR_ILE;
}
ret = H_SUCCESS;
break;
case H_SET_MODE_ENDIAN_LITTLE:
CPU_FOREACH(cs) {
PowerPCCPU *cp = POWERPC_CPU(cs);
CPUPPCState *env = &cp->env;
env->spr[SPR_LPCR] |= LPCR_ILE;
}
ret = H_SUCCESS;
break;
default:
ret = H_UNSUPPORTED_FLAG;
}
}
out:
return ret;
}
| [
"static target_ulong FUNC_0(PowerPCCPU *cpu, sPAPREnvironment *spapr,\ntarget_ulong opcode, target_ulong *args)\n{",
"CPUState *cs;",
"target_ulong mflags = args[0];",
"target_ulong resource = args[1];",
"target_ulong value1 = args[2];",
"target_ulong value2 = args[3];",
"target_ulong ret = H_P2;",
"if (resource == H_SET_MODE_ENDIAN) {",
"if (value1) {",
"ret = H_P3;",
"goto out;",
"}",
"if (value2) {",
"ret = H_P4;",
"goto out;",
"}",
"switch (mflags) {",
"case H_SET_MODE_ENDIAN_BIG:\nCPU_FOREACH(cs) {",
"PowerPCCPU *cp = POWERPC_CPU(cs);",
"CPUPPCState *env = &cp->env;",
"env->spr[SPR_LPCR] &= ~LPCR_ILE;",
"}",
"ret = H_SUCCESS;",
"break;",
"case H_SET_MODE_ENDIAN_LITTLE:\nCPU_FOREACH(cs) {",
"PowerPCCPU *cp = POWERPC_CPU(cs);",
"CPUPPCState *env = &cp->env;",
"env->spr[SPR_LPCR] |= LPCR_ILE;",
"}",
"ret = H_SUCCESS;",
"break;",
"default:\nret = H_UNSUPPORTED_FLAG;",
"}",
"}",
"out:\nreturn ret;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43,
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61,
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
79,
81
],
[
83
],
[
85
],
[
89,
91
],
[
93
]
]
|
15,684 | static int xan_wc3_decode_frame(XanContext *s) {
int width = s->avctx->width;
int height = s->avctx->height;
int total_pixels = width * height;
unsigned char opcode;
unsigned char flag = 0;
int size = 0;
int motion_x, motion_y;
int x, y;
unsigned char *opcode_buffer = s->buffer1;
unsigned char *opcode_buffer_end = s->buffer1 + s->buffer1_size;
int opcode_buffer_size = s->buffer1_size;
const unsigned char *imagedata_buffer = s->buffer2;
/* pointers to segments inside the compressed chunk */
const unsigned char *huffman_segment;
const unsigned char *size_segment;
const unsigned char *vector_segment;
const unsigned char *imagedata_segment;
int huffman_offset, size_offset, vector_offset, imagedata_offset, imagedata_size;
if (s->size < 8)
return AVERROR_INVALIDDATA;
huffman_offset = AV_RL16(&s->buf[0]);
size_offset = AV_RL16(&s->buf[2]);
vector_offset = AV_RL16(&s->buf[4]);
imagedata_offset = AV_RL16(&s->buf[6]);
if (huffman_offset >= s->size ||
size_offset >= s->size ||
vector_offset >= s->size ||
imagedata_offset >= s->size)
return AVERROR_INVALIDDATA;
huffman_segment = s->buf + huffman_offset;
size_segment = s->buf + size_offset;
vector_segment = s->buf + vector_offset;
imagedata_segment = s->buf + imagedata_offset;
if (xan_huffman_decode(opcode_buffer, opcode_buffer_size,
huffman_segment, s->size - huffman_offset) < 0)
return AVERROR_INVALIDDATA;
if (imagedata_segment[0] == 2) {
xan_unpack(s->buffer2, &imagedata_segment[1], s->buffer2_size);
imagedata_size = s->buffer2_size;
} else {
imagedata_size = s->size - imagedata_offset - 1;
imagedata_buffer = &imagedata_segment[1];
}
/* use the decoded data segments to build the frame */
x = y = 0;
while (total_pixels && opcode_buffer < opcode_buffer_end) {
opcode = *opcode_buffer++;
size = 0;
switch (opcode) {
case 0:
flag ^= 1;
continue;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
size = opcode;
break;
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
size += (opcode - 10);
break;
case 9:
case 19:
size = *size_segment++;
break;
case 10:
case 20:
size = AV_RB16(&size_segment[0]);
size_segment += 2;
break;
case 11:
case 21:
size = AV_RB24(size_segment);
size_segment += 3;
break;
}
if (size > total_pixels)
break;
if (opcode < 12) {
flag ^= 1;
if (flag) {
/* run of (size) pixels is unchanged from last frame */
xan_wc3_copy_pixel_run(s, x, y, size, 0, 0);
} else {
/* output a run of pixels from imagedata_buffer */
if (imagedata_size < size)
break;
xan_wc3_output_pixel_run(s, imagedata_buffer, x, y, size);
imagedata_buffer += size;
imagedata_size -= size;
}
} else {
/* run-based motion compensation from last frame */
motion_x = sign_extend(*vector_segment >> 4, 4);
motion_y = sign_extend(*vector_segment & 0xF, 4);
vector_segment++;
/* copy a run of pixels from the previous frame */
xan_wc3_copy_pixel_run(s, x, y, size, motion_x, motion_y);
flag = 0;
}
/* coordinate accounting */
total_pixels -= size;
y += (x + size) / width;
x = (x + size) % width;
}
return 0;
}
| true | FFmpeg | 3e0757c2a87c8cf3e452f67bca279001c64cedff | static int xan_wc3_decode_frame(XanContext *s) {
int width = s->avctx->width;
int height = s->avctx->height;
int total_pixels = width * height;
unsigned char opcode;
unsigned char flag = 0;
int size = 0;
int motion_x, motion_y;
int x, y;
unsigned char *opcode_buffer = s->buffer1;
unsigned char *opcode_buffer_end = s->buffer1 + s->buffer1_size;
int opcode_buffer_size = s->buffer1_size;
const unsigned char *imagedata_buffer = s->buffer2;
const unsigned char *huffman_segment;
const unsigned char *size_segment;
const unsigned char *vector_segment;
const unsigned char *imagedata_segment;
int huffman_offset, size_offset, vector_offset, imagedata_offset, imagedata_size;
if (s->size < 8)
return AVERROR_INVALIDDATA;
huffman_offset = AV_RL16(&s->buf[0]);
size_offset = AV_RL16(&s->buf[2]);
vector_offset = AV_RL16(&s->buf[4]);
imagedata_offset = AV_RL16(&s->buf[6]);
if (huffman_offset >= s->size ||
size_offset >= s->size ||
vector_offset >= s->size ||
imagedata_offset >= s->size)
return AVERROR_INVALIDDATA;
huffman_segment = s->buf + huffman_offset;
size_segment = s->buf + size_offset;
vector_segment = s->buf + vector_offset;
imagedata_segment = s->buf + imagedata_offset;
if (xan_huffman_decode(opcode_buffer, opcode_buffer_size,
huffman_segment, s->size - huffman_offset) < 0)
return AVERROR_INVALIDDATA;
if (imagedata_segment[0] == 2) {
xan_unpack(s->buffer2, &imagedata_segment[1], s->buffer2_size);
imagedata_size = s->buffer2_size;
} else {
imagedata_size = s->size - imagedata_offset - 1;
imagedata_buffer = &imagedata_segment[1];
}
x = y = 0;
while (total_pixels && opcode_buffer < opcode_buffer_end) {
opcode = *opcode_buffer++;
size = 0;
switch (opcode) {
case 0:
flag ^= 1;
continue;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
size = opcode;
break;
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
size += (opcode - 10);
break;
case 9:
case 19:
size = *size_segment++;
break;
case 10:
case 20:
size = AV_RB16(&size_segment[0]);
size_segment += 2;
break;
case 11:
case 21:
size = AV_RB24(size_segment);
size_segment += 3;
break;
}
if (size > total_pixels)
break;
if (opcode < 12) {
flag ^= 1;
if (flag) {
xan_wc3_copy_pixel_run(s, x, y, size, 0, 0);
} else {
if (imagedata_size < size)
break;
xan_wc3_output_pixel_run(s, imagedata_buffer, x, y, size);
imagedata_buffer += size;
imagedata_size -= size;
}
} else {
motion_x = sign_extend(*vector_segment >> 4, 4);
motion_y = sign_extend(*vector_segment & 0xF, 4);
vector_segment++;
xan_wc3_copy_pixel_run(s, x, y, size, motion_x, motion_y);
flag = 0;
}
total_pixels -= size;
y += (x + size) / width;
x = (x + size) % width;
}
return 0;
}
| {
"code": [
" xan_unpack(s->buffer2, &imagedata_segment[1], s->buffer2_size);"
],
"line_no": [
95
]
} | static int FUNC_0(XanContext *VAR_0) {
int VAR_1 = VAR_0->avctx->VAR_1;
int VAR_2 = VAR_0->avctx->VAR_2;
int VAR_3 = VAR_1 * VAR_2;
unsigned char VAR_4;
unsigned char VAR_5 = 0;
int VAR_6 = 0;
int VAR_7, VAR_8;
int VAR_9, VAR_10;
unsigned char *VAR_11 = VAR_0->buffer1;
unsigned char *VAR_12 = VAR_0->buffer1 + VAR_0->buffer1_size;
int VAR_13 = VAR_0->buffer1_size;
const unsigned char *VAR_14 = VAR_0->buffer2;
const unsigned char *VAR_15;
const unsigned char *VAR_16;
const unsigned char *VAR_17;
const unsigned char *VAR_18;
int VAR_19, VAR_20, VAR_21, VAR_22, VAR_23;
if (VAR_0->VAR_6 < 8)
return AVERROR_INVALIDDATA;
VAR_19 = AV_RL16(&VAR_0->buf[0]);
VAR_20 = AV_RL16(&VAR_0->buf[2]);
VAR_21 = AV_RL16(&VAR_0->buf[4]);
VAR_22 = AV_RL16(&VAR_0->buf[6]);
if (VAR_19 >= VAR_0->VAR_6 ||
VAR_20 >= VAR_0->VAR_6 ||
VAR_21 >= VAR_0->VAR_6 ||
VAR_22 >= VAR_0->VAR_6)
return AVERROR_INVALIDDATA;
VAR_15 = VAR_0->buf + VAR_19;
VAR_16 = VAR_0->buf + VAR_20;
VAR_17 = VAR_0->buf + VAR_21;
VAR_18 = VAR_0->buf + VAR_22;
if (xan_huffman_decode(VAR_11, VAR_13,
VAR_15, VAR_0->VAR_6 - VAR_19) < 0)
return AVERROR_INVALIDDATA;
if (VAR_18[0] == 2) {
xan_unpack(VAR_0->buffer2, &VAR_18[1], VAR_0->buffer2_size);
VAR_23 = VAR_0->buffer2_size;
} else {
VAR_23 = VAR_0->VAR_6 - VAR_22 - 1;
VAR_14 = &VAR_18[1];
}
VAR_9 = VAR_10 = 0;
while (VAR_3 && VAR_11 < VAR_12) {
VAR_4 = *VAR_11++;
VAR_6 = 0;
switch (VAR_4) {
case 0:
VAR_5 ^= 1;
continue;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
VAR_6 = VAR_4;
break;
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
VAR_6 += (VAR_4 - 10);
break;
case 9:
case 19:
VAR_6 = *VAR_16++;
break;
case 10:
case 20:
VAR_6 = AV_RB16(&VAR_16[0]);
VAR_16 += 2;
break;
case 11:
case 21:
VAR_6 = AV_RB24(VAR_16);
VAR_16 += 3;
break;
}
if (VAR_6 > VAR_3)
break;
if (VAR_4 < 12) {
VAR_5 ^= 1;
if (VAR_5) {
xan_wc3_copy_pixel_run(VAR_0, VAR_9, VAR_10, VAR_6, 0, 0);
} else {
if (VAR_23 < VAR_6)
break;
xan_wc3_output_pixel_run(VAR_0, VAR_14, VAR_9, VAR_10, VAR_6);
VAR_14 += VAR_6;
VAR_23 -= VAR_6;
}
} else {
VAR_7 = sign_extend(*VAR_17 >> 4, 4);
VAR_8 = sign_extend(*VAR_17 & 0xF, 4);
VAR_17++;
xan_wc3_copy_pixel_run(VAR_0, VAR_9, VAR_10, VAR_6, VAR_7, VAR_8);
VAR_5 = 0;
}
VAR_3 -= VAR_6;
VAR_10 += (VAR_9 + VAR_6) / VAR_1;
VAR_9 = (VAR_9 + VAR_6) % VAR_1;
}
return 0;
}
| [
"static int FUNC_0(XanContext *VAR_0) {",
"int VAR_1 = VAR_0->avctx->VAR_1;",
"int VAR_2 = VAR_0->avctx->VAR_2;",
"int VAR_3 = VAR_1 * VAR_2;",
"unsigned char VAR_4;",
"unsigned char VAR_5 = 0;",
"int VAR_6 = 0;",
"int VAR_7, VAR_8;",
"int VAR_9, VAR_10;",
"unsigned char *VAR_11 = VAR_0->buffer1;",
"unsigned char *VAR_12 = VAR_0->buffer1 + VAR_0->buffer1_size;",
"int VAR_13 = VAR_0->buffer1_size;",
"const unsigned char *VAR_14 = VAR_0->buffer2;",
"const unsigned char *VAR_15;",
"const unsigned char *VAR_16;",
"const unsigned char *VAR_17;",
"const unsigned char *VAR_18;",
"int VAR_19, VAR_20, VAR_21, VAR_22, VAR_23;",
"if (VAR_0->VAR_6 < 8)\nreturn AVERROR_INVALIDDATA;",
"VAR_19 = AV_RL16(&VAR_0->buf[0]);",
"VAR_20 = AV_RL16(&VAR_0->buf[2]);",
"VAR_21 = AV_RL16(&VAR_0->buf[4]);",
"VAR_22 = AV_RL16(&VAR_0->buf[6]);",
"if (VAR_19 >= VAR_0->VAR_6 ||\nVAR_20 >= VAR_0->VAR_6 ||\nVAR_21 >= VAR_0->VAR_6 ||\nVAR_22 >= VAR_0->VAR_6)\nreturn AVERROR_INVALIDDATA;",
"VAR_15 = VAR_0->buf + VAR_19;",
"VAR_16 = VAR_0->buf + VAR_20;",
"VAR_17 = VAR_0->buf + VAR_21;",
"VAR_18 = VAR_0->buf + VAR_22;",
"if (xan_huffman_decode(VAR_11, VAR_13,\nVAR_15, VAR_0->VAR_6 - VAR_19) < 0)\nreturn AVERROR_INVALIDDATA;",
"if (VAR_18[0] == 2) {",
"xan_unpack(VAR_0->buffer2, &VAR_18[1], VAR_0->buffer2_size);",
"VAR_23 = VAR_0->buffer2_size;",
"} else {",
"VAR_23 = VAR_0->VAR_6 - VAR_22 - 1;",
"VAR_14 = &VAR_18[1];",
"}",
"VAR_9 = VAR_10 = 0;",
"while (VAR_3 && VAR_11 < VAR_12) {",
"VAR_4 = *VAR_11++;",
"VAR_6 = 0;",
"switch (VAR_4) {",
"case 0:\nVAR_5 ^= 1;",
"continue;",
"case 1:\ncase 2:\ncase 3:\ncase 4:\ncase 5:\ncase 6:\ncase 7:\ncase 8:\nVAR_6 = VAR_4;",
"break;",
"case 12:\ncase 13:\ncase 14:\ncase 15:\ncase 16:\ncase 17:\ncase 18:\nVAR_6 += (VAR_4 - 10);",
"break;",
"case 9:\ncase 19:\nVAR_6 = *VAR_16++;",
"break;",
"case 10:\ncase 20:\nVAR_6 = AV_RB16(&VAR_16[0]);",
"VAR_16 += 2;",
"break;",
"case 11:\ncase 21:\nVAR_6 = AV_RB24(VAR_16);",
"VAR_16 += 3;",
"break;",
"}",
"if (VAR_6 > VAR_3)\nbreak;",
"if (VAR_4 < 12) {",
"VAR_5 ^= 1;",
"if (VAR_5) {",
"xan_wc3_copy_pixel_run(VAR_0, VAR_9, VAR_10, VAR_6, 0, 0);",
"} else {",
"if (VAR_23 < VAR_6)\nbreak;",
"xan_wc3_output_pixel_run(VAR_0, VAR_14, VAR_9, VAR_10, VAR_6);",
"VAR_14 += VAR_6;",
"VAR_23 -= VAR_6;",
"}",
"} else {",
"VAR_7 = sign_extend(*VAR_17 >> 4, 4);",
"VAR_8 = sign_extend(*VAR_17 & 0xF, 4);",
"VAR_17++;",
"xan_wc3_copy_pixel_run(VAR_0, VAR_9, VAR_10, VAR_6, VAR_7, VAR_8);",
"VAR_5 = 0;",
"}",
"VAR_3 -= VAR_6;",
"VAR_10 += (VAR_9 + VAR_6) / VAR_1;",
"VAR_9 = (VAR_9 + VAR_6) % VAR_1;",
"}",
"return 0;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47,
49
],
[
53
],
[
55
],
[
57
],
[
59
],
[
63,
65,
67,
69,
71
],
[
75
],
[
77
],
[
79
],
[
81
],
[
85,
87,
89
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
111
],
[
113
],
[
117
],
[
119
],
[
123
],
[
127,
129
],
[
131
],
[
135,
137,
139,
141,
143,
145,
147,
149,
151
],
[
153
],
[
157,
159,
161,
163,
165,
167,
169,
171
],
[
173
],
[
177,
179,
181
],
[
183
],
[
187,
189,
191
],
[
193
],
[
195
],
[
199,
201,
203
],
[
205
],
[
207
],
[
209
],
[
211,
213
],
[
217
],
[
219
],
[
221
],
[
225
],
[
227
],
[
231,
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
247
],
[
249
],
[
251
],
[
257
],
[
261
],
[
263
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
]
]
|
15,685 | uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
{
long tcg_temps[CPU_TEMP_BUF_NLONGS];
uintptr_t sp_value = (uintptr_t)(tcg_temps + CPU_TEMP_BUF_NLONGS);
uintptr_t next_tb = 0;
tci_reg[TCG_AREG0] = (tcg_target_ulong)env;
tci_reg[TCG_REG_CALL_STACK] = sp_value;
assert(tb_ptr);
for (;;) {
TCGOpcode opc = tb_ptr[0];
#if !defined(NDEBUG)
uint8_t op_size = tb_ptr[1];
uint8_t *old_code_ptr = tb_ptr;
#endif
tcg_target_ulong t0;
tcg_target_ulong t1;
tcg_target_ulong t2;
tcg_target_ulong label;
TCGCond condition;
target_ulong taddr;
#ifndef CONFIG_SOFTMMU
tcg_target_ulong host_addr;
#endif
uint8_t tmp8;
uint16_t tmp16;
uint32_t tmp32;
uint64_t tmp64;
#if TCG_TARGET_REG_BITS == 32
uint64_t v64;
#endif
#if defined(GETPC)
tci_tb_ptr = (uintptr_t)tb_ptr;
#endif
/* Skip opcode and size entry. */
tb_ptr += 2;
switch (opc) {
case INDEX_op_end:
case INDEX_op_nop:
break;
case INDEX_op_nop1:
case INDEX_op_nop2:
case INDEX_op_nop3:
case INDEX_op_nopn:
case INDEX_op_discard:
TODO();
break;
case INDEX_op_set_label:
TODO();
break;
case INDEX_op_call:
t0 = tci_read_ri(&tb_ptr);
#if TCG_TARGET_REG_BITS == 32
tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),
tci_read_reg(TCG_REG_R1),
tci_read_reg(TCG_REG_R2),
tci_read_reg(TCG_REG_R3),
tci_read_reg(TCG_REG_R5),
tci_read_reg(TCG_REG_R6),
tci_read_reg(TCG_REG_R7),
tci_read_reg(TCG_REG_R8),
tci_read_reg(TCG_REG_R9),
tci_read_reg(TCG_REG_R10));
tci_write_reg(TCG_REG_R0, tmp64);
tci_write_reg(TCG_REG_R1, tmp64 >> 32);
#else
tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),
tci_read_reg(TCG_REG_R1),
tci_read_reg(TCG_REG_R2),
tci_read_reg(TCG_REG_R3),
tci_read_reg(TCG_REG_R5));
tci_write_reg(TCG_REG_R0, tmp64);
#endif
break;
case INDEX_op_br:
label = tci_read_label(&tb_ptr);
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
case INDEX_op_setcond_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
condition = *tb_ptr++;
tci_write_reg32(t0, tci_compare32(t1, t2, condition));
break;
#if TCG_TARGET_REG_BITS == 32
case INDEX_op_setcond2_i32:
t0 = *tb_ptr++;
tmp64 = tci_read_r64(&tb_ptr);
v64 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
tci_write_reg32(t0, tci_compare64(tmp64, v64, condition));
break;
#elif TCG_TARGET_REG_BITS == 64
case INDEX_op_setcond_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
tci_write_reg64(t0, tci_compare64(t1, t2, condition));
break;
#endif
case INDEX_op_mov_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, t1);
break;
case INDEX_op_movi_i32:
t0 = *tb_ptr++;
t1 = tci_read_i32(&tb_ptr);
tci_write_reg32(t0, t1);
break;
/* Load/store operations (32 bit). */
case INDEX_op_ld8u_i32:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg8(t0, *(uint8_t *)(t1 + t2));
break;
case INDEX_op_ld8s_i32:
case INDEX_op_ld16u_i32:
TODO();
break;
case INDEX_op_ld16s_i32:
TODO();
break;
case INDEX_op_ld_i32:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg32(t0, *(uint32_t *)(t1 + t2));
break;
case INDEX_op_st8_i32:
t0 = tci_read_r8(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint8_t *)(t1 + t2) = t0;
break;
case INDEX_op_st16_i32:
t0 = tci_read_r16(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint16_t *)(t1 + t2) = t0;
break;
case INDEX_op_st_i32:
t0 = tci_read_r32(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
assert(t1 != sp_value || (int32_t)t2 < 0);
*(uint32_t *)(t1 + t2) = t0;
break;
/* Arithmetic operations (32 bit). */
case INDEX_op_add_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 + t2);
break;
case INDEX_op_sub_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 - t2);
break;
case INDEX_op_mul_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 * t2);
break;
#if TCG_TARGET_HAS_div_i32
case INDEX_op_div_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, (int32_t)t1 / (int32_t)t2);
break;
case INDEX_op_divu_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 / t2);
break;
case INDEX_op_rem_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, (int32_t)t1 % (int32_t)t2);
break;
case INDEX_op_remu_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 % t2);
break;
#elif TCG_TARGET_HAS_div2_i32
case INDEX_op_div2_i32:
case INDEX_op_divu2_i32:
TODO();
break;
#endif
case INDEX_op_and_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 & t2);
break;
case INDEX_op_or_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 | t2);
break;
case INDEX_op_xor_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 ^ t2);
break;
/* Shift/rotate operations (32 bit). */
case INDEX_op_shl_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 << t2);
break;
case INDEX_op_shr_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 >> t2);
break;
case INDEX_op_sar_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, ((int32_t)t1 >> t2));
break;
#if TCG_TARGET_HAS_rot_i32
case INDEX_op_rotl_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, rol32(t1, t2));
break;
case INDEX_op_rotr_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, ror32(t1, t2));
break;
#endif
#if TCG_TARGET_HAS_deposit_i32
case INDEX_op_deposit_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
t2 = tci_read_r32(&tb_ptr);
tmp16 = *tb_ptr++;
tmp8 = *tb_ptr++;
tmp32 = (((1 << tmp8) - 1) << tmp16);
tci_write_reg32(t0, (t1 & ~tmp32) | ((t2 << tmp16) & tmp32));
break;
#endif
case INDEX_op_brcond_i32:
t0 = tci_read_r32(&tb_ptr);
t1 = tci_read_ri32(&tb_ptr);
condition = *tb_ptr++;
label = tci_read_label(&tb_ptr);
if (tci_compare32(t0, t1, condition)) {
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
}
break;
#if TCG_TARGET_REG_BITS == 32
case INDEX_op_add2_i32:
t0 = *tb_ptr++;
t1 = *tb_ptr++;
tmp64 = tci_read_r64(&tb_ptr);
tmp64 += tci_read_r64(&tb_ptr);
tci_write_reg64(t1, t0, tmp64);
break;
case INDEX_op_sub2_i32:
t0 = *tb_ptr++;
t1 = *tb_ptr++;
tmp64 = tci_read_r64(&tb_ptr);
tmp64 -= tci_read_r64(&tb_ptr);
tci_write_reg64(t1, t0, tmp64);
break;
case INDEX_op_brcond2_i32:
tmp64 = tci_read_r64(&tb_ptr);
v64 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
label = tci_read_label(&tb_ptr);
if (tci_compare64(tmp64, v64, condition)) {
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
}
break;
case INDEX_op_mulu2_i32:
t0 = *tb_ptr++;
t1 = *tb_ptr++;
t2 = tci_read_r32(&tb_ptr);
tmp64 = tci_read_r32(&tb_ptr);
tci_write_reg64(t1, t0, t2 * tmp64);
break;
#endif /* TCG_TARGET_REG_BITS == 32 */
#if TCG_TARGET_HAS_ext8s_i32
case INDEX_op_ext8s_i32:
t0 = *tb_ptr++;
t1 = tci_read_r8s(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16s_i32
case INDEX_op_ext16s_i32:
t0 = *tb_ptr++;
t1 = tci_read_r16s(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext8u_i32
case INDEX_op_ext8u_i32:
t0 = *tb_ptr++;
t1 = tci_read_r8(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16u_i32
case INDEX_op_ext16u_i32:
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_bswap16_i32
case INDEX_op_bswap16_i32:
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg32(t0, bswap16(t1));
break;
#endif
#if TCG_TARGET_HAS_bswap32_i32
case INDEX_op_bswap32_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, bswap32(t1));
break;
#endif
#if TCG_TARGET_HAS_not_i32
case INDEX_op_not_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, ~t1);
break;
#endif
#if TCG_TARGET_HAS_neg_i32
case INDEX_op_neg_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, -t1);
break;
#endif
#if TCG_TARGET_REG_BITS == 64
case INDEX_op_mov_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, t1);
break;
case INDEX_op_movi_i64:
t0 = *tb_ptr++;
t1 = tci_read_i64(&tb_ptr);
tci_write_reg64(t0, t1);
break;
/* Load/store operations (64 bit). */
case INDEX_op_ld8u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg8(t0, *(uint8_t *)(t1 + t2));
break;
case INDEX_op_ld8s_i64:
case INDEX_op_ld16u_i64:
case INDEX_op_ld16s_i64:
TODO();
break;
case INDEX_op_ld32u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg32(t0, *(uint32_t *)(t1 + t2));
break;
case INDEX_op_ld32s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg32s(t0, *(int32_t *)(t1 + t2));
break;
case INDEX_op_ld_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg64(t0, *(uint64_t *)(t1 + t2));
break;
case INDEX_op_st8_i64:
t0 = tci_read_r8(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint8_t *)(t1 + t2) = t0;
break;
case INDEX_op_st16_i64:
t0 = tci_read_r16(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint16_t *)(t1 + t2) = t0;
break;
case INDEX_op_st32_i64:
t0 = tci_read_r32(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint32_t *)(t1 + t2) = t0;
break;
case INDEX_op_st_i64:
t0 = tci_read_r64(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
assert(t1 != sp_value || (int32_t)t2 < 0);
*(uint64_t *)(t1 + t2) = t0;
break;
/* Arithmetic operations (64 bit). */
case INDEX_op_add_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 + t2);
break;
case INDEX_op_sub_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 - t2);
break;
case INDEX_op_mul_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 * t2);
break;
#if TCG_TARGET_HAS_div_i64
case INDEX_op_div_i64:
case INDEX_op_divu_i64:
case INDEX_op_rem_i64:
case INDEX_op_remu_i64:
TODO();
break;
#elif TCG_TARGET_HAS_div2_i64
case INDEX_op_div2_i64:
case INDEX_op_divu2_i64:
TODO();
break;
#endif
case INDEX_op_and_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 & t2);
break;
case INDEX_op_or_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 | t2);
break;
case INDEX_op_xor_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 ^ t2);
break;
/* Shift/rotate operations (64 bit). */
case INDEX_op_shl_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 << t2);
break;
case INDEX_op_shr_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 >> t2);
break;
case INDEX_op_sar_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, ((int64_t)t1 >> t2));
break;
#if TCG_TARGET_HAS_rot_i64
case INDEX_op_rotl_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, rol64(t1, t2));
break;
case INDEX_op_rotr_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, ror64(t1, t2));
break;
#endif
#if TCG_TARGET_HAS_deposit_i64
case INDEX_op_deposit_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
t2 = tci_read_r64(&tb_ptr);
tmp16 = *tb_ptr++;
tmp8 = *tb_ptr++;
tmp64 = (((1ULL << tmp8) - 1) << tmp16);
tci_write_reg64(t0, (t1 & ~tmp64) | ((t2 << tmp16) & tmp64));
break;
#endif
case INDEX_op_brcond_i64:
t0 = tci_read_r64(&tb_ptr);
t1 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
label = tci_read_label(&tb_ptr);
if (tci_compare64(t0, t1, condition)) {
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
}
break;
#if TCG_TARGET_HAS_ext8u_i64
case INDEX_op_ext8u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r8(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext8s_i64
case INDEX_op_ext8s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r8s(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16s_i64
case INDEX_op_ext16s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r16s(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16u_i64
case INDEX_op_ext16u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext32s_i64
case INDEX_op_ext32s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r32s(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext32u_i64
case INDEX_op_ext32u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_bswap16_i64
case INDEX_op_bswap16_i64:
TODO();
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg64(t0, bswap16(t1));
break;
#endif
#if TCG_TARGET_HAS_bswap32_i64
case INDEX_op_bswap32_i64:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg64(t0, bswap32(t1));
break;
#endif
#if TCG_TARGET_HAS_bswap64_i64
case INDEX_op_bswap64_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, bswap64(t1));
break;
#endif
#if TCG_TARGET_HAS_not_i64
case INDEX_op_not_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, ~t1);
break;
#endif
#if TCG_TARGET_HAS_neg_i64
case INDEX_op_neg_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, -t1);
break;
#endif
#endif /* TCG_TARGET_REG_BITS == 64 */
/* QEMU specific operations. */
#if TARGET_LONG_BITS > TCG_TARGET_REG_BITS
case INDEX_op_debug_insn_start:
TODO();
break;
#else
case INDEX_op_debug_insn_start:
TODO();
break;
#endif
case INDEX_op_exit_tb:
next_tb = *(uint64_t *)tb_ptr;
goto exit;
break;
case INDEX_op_goto_tb:
t0 = tci_read_i32(&tb_ptr);
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr += (int32_t)t0;
continue;
case INDEX_op_qemu_ld8u:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp8 = *(uint8_t *)(host_addr + GUEST_BASE);
#endif
tci_write_reg8(t0, tmp8);
break;
case INDEX_op_qemu_ld8s:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp8 = *(uint8_t *)(host_addr + GUEST_BASE);
#endif
tci_write_reg8s(t0, tmp8);
break;
case INDEX_op_qemu_ld16u:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg16(t0, tmp16);
break;
case INDEX_op_qemu_ld16s:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg16s(t0, tmp16);
break;
#if TCG_TARGET_REG_BITS == 64
case INDEX_op_qemu_ld32u:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg32(t0, tmp32);
break;
case INDEX_op_qemu_ld32s:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg32s(t0, tmp32);
break;
#endif /* TCG_TARGET_REG_BITS == 64 */
case INDEX_op_qemu_ld32:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg32(t0, tmp32);
break;
case INDEX_op_qemu_ld64:
t0 = *tb_ptr++;
#if TCG_TARGET_REG_BITS == 32
t1 = *tb_ptr++;
#endif
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp64 = helper_ldq_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp64 = tswap64(*(uint64_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg(t0, tmp64);
#if TCG_TARGET_REG_BITS == 32
tci_write_reg(t1, tmp64 >> 32);
#endif
break;
case INDEX_op_qemu_st8:
t0 = tci_read_r8(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stb_mmu(env, taddr, t0, t2);
#else
host_addr = (tcg_target_ulong)taddr;
*(uint8_t *)(host_addr + GUEST_BASE) = t0;
#endif
break;
case INDEX_op_qemu_st16:
t0 = tci_read_r16(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stw_mmu(env, taddr, t0, t2);
#else
host_addr = (tcg_target_ulong)taddr;
*(uint16_t *)(host_addr + GUEST_BASE) = tswap16(t0);
#endif
break;
case INDEX_op_qemu_st32:
t0 = tci_read_r32(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stl_mmu(env, taddr, t0, t2);
#else
host_addr = (tcg_target_ulong)taddr;
*(uint32_t *)(host_addr + GUEST_BASE) = tswap32(t0);
#endif
break;
case INDEX_op_qemu_st64:
tmp64 = tci_read_r64(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stq_mmu(env, taddr, tmp64, t2);
#else
host_addr = (tcg_target_ulong)taddr;
*(uint64_t *)(host_addr + GUEST_BASE) = tswap64(tmp64);
#endif
break;
default:
TODO();
break;
}
assert(tb_ptr == old_code_ptr + op_size);
}
exit:
return next_tb;
}
| true | qemu | 1976cccec8a9965ff3fd6f026783a04f6b4959fd | uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
{
long tcg_temps[CPU_TEMP_BUF_NLONGS];
uintptr_t sp_value = (uintptr_t)(tcg_temps + CPU_TEMP_BUF_NLONGS);
uintptr_t next_tb = 0;
tci_reg[TCG_AREG0] = (tcg_target_ulong)env;
tci_reg[TCG_REG_CALL_STACK] = sp_value;
assert(tb_ptr);
for (;;) {
TCGOpcode opc = tb_ptr[0];
#if !defined(NDEBUG)
uint8_t op_size = tb_ptr[1];
uint8_t *old_code_ptr = tb_ptr;
#endif
tcg_target_ulong t0;
tcg_target_ulong t1;
tcg_target_ulong t2;
tcg_target_ulong label;
TCGCond condition;
target_ulong taddr;
#ifndef CONFIG_SOFTMMU
tcg_target_ulong host_addr;
#endif
uint8_t tmp8;
uint16_t tmp16;
uint32_t tmp32;
uint64_t tmp64;
#if TCG_TARGET_REG_BITS == 32
uint64_t v64;
#endif
#if defined(GETPC)
tci_tb_ptr = (uintptr_t)tb_ptr;
#endif
tb_ptr += 2;
switch (opc) {
case INDEX_op_end:
case INDEX_op_nop:
break;
case INDEX_op_nop1:
case INDEX_op_nop2:
case INDEX_op_nop3:
case INDEX_op_nopn:
case INDEX_op_discard:
TODO();
break;
case INDEX_op_set_label:
TODO();
break;
case INDEX_op_call:
t0 = tci_read_ri(&tb_ptr);
#if TCG_TARGET_REG_BITS == 32
tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),
tci_read_reg(TCG_REG_R1),
tci_read_reg(TCG_REG_R2),
tci_read_reg(TCG_REG_R3),
tci_read_reg(TCG_REG_R5),
tci_read_reg(TCG_REG_R6),
tci_read_reg(TCG_REG_R7),
tci_read_reg(TCG_REG_R8),
tci_read_reg(TCG_REG_R9),
tci_read_reg(TCG_REG_R10));
tci_write_reg(TCG_REG_R0, tmp64);
tci_write_reg(TCG_REG_R1, tmp64 >> 32);
#else
tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),
tci_read_reg(TCG_REG_R1),
tci_read_reg(TCG_REG_R2),
tci_read_reg(TCG_REG_R3),
tci_read_reg(TCG_REG_R5));
tci_write_reg(TCG_REG_R0, tmp64);
#endif
break;
case INDEX_op_br:
label = tci_read_label(&tb_ptr);
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
case INDEX_op_setcond_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
condition = *tb_ptr++;
tci_write_reg32(t0, tci_compare32(t1, t2, condition));
break;
#if TCG_TARGET_REG_BITS == 32
case INDEX_op_setcond2_i32:
t0 = *tb_ptr++;
tmp64 = tci_read_r64(&tb_ptr);
v64 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
tci_write_reg32(t0, tci_compare64(tmp64, v64, condition));
break;
#elif TCG_TARGET_REG_BITS == 64
case INDEX_op_setcond_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
tci_write_reg64(t0, tci_compare64(t1, t2, condition));
break;
#endif
case INDEX_op_mov_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, t1);
break;
case INDEX_op_movi_i32:
t0 = *tb_ptr++;
t1 = tci_read_i32(&tb_ptr);
tci_write_reg32(t0, t1);
break;
case INDEX_op_ld8u_i32:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg8(t0, *(uint8_t *)(t1 + t2));
break;
case INDEX_op_ld8s_i32:
case INDEX_op_ld16u_i32:
TODO();
break;
case INDEX_op_ld16s_i32:
TODO();
break;
case INDEX_op_ld_i32:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg32(t0, *(uint32_t *)(t1 + t2));
break;
case INDEX_op_st8_i32:
t0 = tci_read_r8(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint8_t *)(t1 + t2) = t0;
break;
case INDEX_op_st16_i32:
t0 = tci_read_r16(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint16_t *)(t1 + t2) = t0;
break;
case INDEX_op_st_i32:
t0 = tci_read_r32(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
assert(t1 != sp_value || (int32_t)t2 < 0);
*(uint32_t *)(t1 + t2) = t0;
break;
case INDEX_op_add_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 + t2);
break;
case INDEX_op_sub_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 - t2);
break;
case INDEX_op_mul_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 * t2);
break;
#if TCG_TARGET_HAS_div_i32
case INDEX_op_div_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, (int32_t)t1 / (int32_t)t2);
break;
case INDEX_op_divu_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 / t2);
break;
case INDEX_op_rem_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, (int32_t)t1 % (int32_t)t2);
break;
case INDEX_op_remu_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 % t2);
break;
#elif TCG_TARGET_HAS_div2_i32
case INDEX_op_div2_i32:
case INDEX_op_divu2_i32:
TODO();
break;
#endif
case INDEX_op_and_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 & t2);
break;
case INDEX_op_or_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 | t2);
break;
case INDEX_op_xor_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 ^ t2);
break;
case INDEX_op_shl_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 << t2);
break;
case INDEX_op_shr_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 >> t2);
break;
case INDEX_op_sar_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, ((int32_t)t1 >> t2));
break;
#if TCG_TARGET_HAS_rot_i32
case INDEX_op_rotl_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, rol32(t1, t2));
break;
case INDEX_op_rotr_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, ror32(t1, t2));
break;
#endif
#if TCG_TARGET_HAS_deposit_i32
case INDEX_op_deposit_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
t2 = tci_read_r32(&tb_ptr);
tmp16 = *tb_ptr++;
tmp8 = *tb_ptr++;
tmp32 = (((1 << tmp8) - 1) << tmp16);
tci_write_reg32(t0, (t1 & ~tmp32) | ((t2 << tmp16) & tmp32));
break;
#endif
case INDEX_op_brcond_i32:
t0 = tci_read_r32(&tb_ptr);
t1 = tci_read_ri32(&tb_ptr);
condition = *tb_ptr++;
label = tci_read_label(&tb_ptr);
if (tci_compare32(t0, t1, condition)) {
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
}
break;
#if TCG_TARGET_REG_BITS == 32
case INDEX_op_add2_i32:
t0 = *tb_ptr++;
t1 = *tb_ptr++;
tmp64 = tci_read_r64(&tb_ptr);
tmp64 += tci_read_r64(&tb_ptr);
tci_write_reg64(t1, t0, tmp64);
break;
case INDEX_op_sub2_i32:
t0 = *tb_ptr++;
t1 = *tb_ptr++;
tmp64 = tci_read_r64(&tb_ptr);
tmp64 -= tci_read_r64(&tb_ptr);
tci_write_reg64(t1, t0, tmp64);
break;
case INDEX_op_brcond2_i32:
tmp64 = tci_read_r64(&tb_ptr);
v64 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
label = tci_read_label(&tb_ptr);
if (tci_compare64(tmp64, v64, condition)) {
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
}
break;
case INDEX_op_mulu2_i32:
t0 = *tb_ptr++;
t1 = *tb_ptr++;
t2 = tci_read_r32(&tb_ptr);
tmp64 = tci_read_r32(&tb_ptr);
tci_write_reg64(t1, t0, t2 * tmp64);
break;
#endif
#if TCG_TARGET_HAS_ext8s_i32
case INDEX_op_ext8s_i32:
t0 = *tb_ptr++;
t1 = tci_read_r8s(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16s_i32
case INDEX_op_ext16s_i32:
t0 = *tb_ptr++;
t1 = tci_read_r16s(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext8u_i32
case INDEX_op_ext8u_i32:
t0 = *tb_ptr++;
t1 = tci_read_r8(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16u_i32
case INDEX_op_ext16u_i32:
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_bswap16_i32
case INDEX_op_bswap16_i32:
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg32(t0, bswap16(t1));
break;
#endif
#if TCG_TARGET_HAS_bswap32_i32
case INDEX_op_bswap32_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, bswap32(t1));
break;
#endif
#if TCG_TARGET_HAS_not_i32
case INDEX_op_not_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, ~t1);
break;
#endif
#if TCG_TARGET_HAS_neg_i32
case INDEX_op_neg_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, -t1);
break;
#endif
#if TCG_TARGET_REG_BITS == 64
case INDEX_op_mov_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, t1);
break;
case INDEX_op_movi_i64:
t0 = *tb_ptr++;
t1 = tci_read_i64(&tb_ptr);
tci_write_reg64(t0, t1);
break;
case INDEX_op_ld8u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg8(t0, *(uint8_t *)(t1 + t2));
break;
case INDEX_op_ld8s_i64:
case INDEX_op_ld16u_i64:
case INDEX_op_ld16s_i64:
TODO();
break;
case INDEX_op_ld32u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg32(t0, *(uint32_t *)(t1 + t2));
break;
case INDEX_op_ld32s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg32s(t0, *(int32_t *)(t1 + t2));
break;
case INDEX_op_ld_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg64(t0, *(uint64_t *)(t1 + t2));
break;
case INDEX_op_st8_i64:
t0 = tci_read_r8(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint8_t *)(t1 + t2) = t0;
break;
case INDEX_op_st16_i64:
t0 = tci_read_r16(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint16_t *)(t1 + t2) = t0;
break;
case INDEX_op_st32_i64:
t0 = tci_read_r32(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint32_t *)(t1 + t2) = t0;
break;
case INDEX_op_st_i64:
t0 = tci_read_r64(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
assert(t1 != sp_value || (int32_t)t2 < 0);
*(uint64_t *)(t1 + t2) = t0;
break;
case INDEX_op_add_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 + t2);
break;
case INDEX_op_sub_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 - t2);
break;
case INDEX_op_mul_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 * t2);
break;
#if TCG_TARGET_HAS_div_i64
case INDEX_op_div_i64:
case INDEX_op_divu_i64:
case INDEX_op_rem_i64:
case INDEX_op_remu_i64:
TODO();
break;
#elif TCG_TARGET_HAS_div2_i64
case INDEX_op_div2_i64:
case INDEX_op_divu2_i64:
TODO();
break;
#endif
case INDEX_op_and_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 & t2);
break;
case INDEX_op_or_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 | t2);
break;
case INDEX_op_xor_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 ^ t2);
break;
case INDEX_op_shl_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 << t2);
break;
case INDEX_op_shr_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 >> t2);
break;
case INDEX_op_sar_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, ((int64_t)t1 >> t2));
break;
#if TCG_TARGET_HAS_rot_i64
case INDEX_op_rotl_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, rol64(t1, t2));
break;
case INDEX_op_rotr_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, ror64(t1, t2));
break;
#endif
#if TCG_TARGET_HAS_deposit_i64
case INDEX_op_deposit_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
t2 = tci_read_r64(&tb_ptr);
tmp16 = *tb_ptr++;
tmp8 = *tb_ptr++;
tmp64 = (((1ULL << tmp8) - 1) << tmp16);
tci_write_reg64(t0, (t1 & ~tmp64) | ((t2 << tmp16) & tmp64));
break;
#endif
case INDEX_op_brcond_i64:
t0 = tci_read_r64(&tb_ptr);
t1 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
label = tci_read_label(&tb_ptr);
if (tci_compare64(t0, t1, condition)) {
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
}
break;
#if TCG_TARGET_HAS_ext8u_i64
case INDEX_op_ext8u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r8(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext8s_i64
case INDEX_op_ext8s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r8s(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16s_i64
case INDEX_op_ext16s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r16s(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16u_i64
case INDEX_op_ext16u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext32s_i64
case INDEX_op_ext32s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r32s(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext32u_i64
case INDEX_op_ext32u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_bswap16_i64
case INDEX_op_bswap16_i64:
TODO();
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg64(t0, bswap16(t1));
break;
#endif
#if TCG_TARGET_HAS_bswap32_i64
case INDEX_op_bswap32_i64:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg64(t0, bswap32(t1));
break;
#endif
#if TCG_TARGET_HAS_bswap64_i64
case INDEX_op_bswap64_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, bswap64(t1));
break;
#endif
#if TCG_TARGET_HAS_not_i64
case INDEX_op_not_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, ~t1);
break;
#endif
#if TCG_TARGET_HAS_neg_i64
case INDEX_op_neg_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, -t1);
break;
#endif
#endif
#if TARGET_LONG_BITS > TCG_TARGET_REG_BITS
case INDEX_op_debug_insn_start:
TODO();
break;
#else
case INDEX_op_debug_insn_start:
TODO();
break;
#endif
case INDEX_op_exit_tb:
next_tb = *(uint64_t *)tb_ptr;
goto exit;
break;
case INDEX_op_goto_tb:
t0 = tci_read_i32(&tb_ptr);
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr += (int32_t)t0;
continue;
case INDEX_op_qemu_ld8u:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp8 = *(uint8_t *)(host_addr + GUEST_BASE);
#endif
tci_write_reg8(t0, tmp8);
break;
case INDEX_op_qemu_ld8s:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp8 = *(uint8_t *)(host_addr + GUEST_BASE);
#endif
tci_write_reg8s(t0, tmp8);
break;
case INDEX_op_qemu_ld16u:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg16(t0, tmp16);
break;
case INDEX_op_qemu_ld16s:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg16s(t0, tmp16);
break;
#if TCG_TARGET_REG_BITS == 64
case INDEX_op_qemu_ld32u:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg32(t0, tmp32);
break;
case INDEX_op_qemu_ld32s:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg32s(t0, tmp32);
break;
#endif
case INDEX_op_qemu_ld32:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg32(t0, tmp32);
break;
case INDEX_op_qemu_ld64:
t0 = *tb_ptr++;
#if TCG_TARGET_REG_BITS == 32
t1 = *tb_ptr++;
#endif
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp64 = helper_ldq_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp64 = tswap64(*(uint64_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg(t0, tmp64);
#if TCG_TARGET_REG_BITS == 32
tci_write_reg(t1, tmp64 >> 32);
#endif
break;
case INDEX_op_qemu_st8:
t0 = tci_read_r8(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stb_mmu(env, taddr, t0, t2);
#else
host_addr = (tcg_target_ulong)taddr;
*(uint8_t *)(host_addr + GUEST_BASE) = t0;
#endif
break;
case INDEX_op_qemu_st16:
t0 = tci_read_r16(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stw_mmu(env, taddr, t0, t2);
#else
host_addr = (tcg_target_ulong)taddr;
*(uint16_t *)(host_addr + GUEST_BASE) = tswap16(t0);
#endif
break;
case INDEX_op_qemu_st32:
t0 = tci_read_r32(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stl_mmu(env, taddr, t0, t2);
#else
host_addr = (tcg_target_ulong)taddr;
*(uint32_t *)(host_addr + GUEST_BASE) = tswap32(t0);
#endif
break;
case INDEX_op_qemu_st64:
tmp64 = tci_read_r64(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stq_mmu(env, taddr, tmp64, t2);
#else
host_addr = (tcg_target_ulong)taddr;
*(uint64_t *)(host_addr + GUEST_BASE) = tswap64(tmp64);
#endif
break;
default:
TODO();
break;
}
assert(tb_ptr == old_code_ptr + op_size);
}
exit:
return next_tb;
}
| {
"code": [
" tci_write_reg32(t0, t1 << t2);",
" tci_write_reg32(t0, t1 >> t2);",
" tci_write_reg32(t0, ((int32_t)t1 >> t2));",
" tci_write_reg32(t0, rol32(t1, t2));",
" tci_write_reg32(t0, ror32(t1, t2));",
" tci_write_reg64(t0, t1 << t2);",
" tci_write_reg64(t0, t1 >> t2);",
" tci_write_reg64(t0, ((int64_t)t1 >> t2));",
" tci_write_reg64(t0, rol64(t1, t2));",
" tci_write_reg64(t0, ror64(t1, t2));"
],
"line_no": [
471,
483,
495,
509,
521,
1005,
1017,
1029,
1043,
1055
]
} | uintptr_t FUNC_0(CPUArchState *env, uint8_t *tb_ptr)
{
long VAR_0[CPU_TEMP_BUF_NLONGS];
uintptr_t sp_value = (uintptr_t)(VAR_0 + CPU_TEMP_BUF_NLONGS);
uintptr_t next_tb = 0;
tci_reg[TCG_AREG0] = (tcg_target_ulong)env;
tci_reg[TCG_REG_CALL_STACK] = sp_value;
assert(tb_ptr);
for (;;) {
TCGOpcode opc = tb_ptr[0];
#if !defined(NDEBUG)
uint8_t op_size = tb_ptr[1];
uint8_t *old_code_ptr = tb_ptr;
#endif
tcg_target_ulong t0;
tcg_target_ulong t1;
tcg_target_ulong t2;
tcg_target_ulong label;
TCGCond condition;
target_ulong taddr;
#ifndef CONFIG_SOFTMMU
tcg_target_ulong host_addr;
#endif
uint8_t tmp8;
uint16_t tmp16;
uint32_t tmp32;
uint64_t tmp64;
#if TCG_TARGET_REG_BITS == 32
uint64_t v64;
#endif
#if defined(GETPC)
tci_tb_ptr = (uintptr_t)tb_ptr;
#endif
tb_ptr += 2;
switch (opc) {
case INDEX_op_end:
case INDEX_op_nop:
break;
case INDEX_op_nop1:
case INDEX_op_nop2:
case INDEX_op_nop3:
case INDEX_op_nopn:
case INDEX_op_discard:
TODO();
break;
case INDEX_op_set_label:
TODO();
break;
case INDEX_op_call:
t0 = tci_read_ri(&tb_ptr);
#if TCG_TARGET_REG_BITS == 32
tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),
tci_read_reg(TCG_REG_R1),
tci_read_reg(TCG_REG_R2),
tci_read_reg(TCG_REG_R3),
tci_read_reg(TCG_REG_R5),
tci_read_reg(TCG_REG_R6),
tci_read_reg(TCG_REG_R7),
tci_read_reg(TCG_REG_R8),
tci_read_reg(TCG_REG_R9),
tci_read_reg(TCG_REG_R10));
tci_write_reg(TCG_REG_R0, tmp64);
tci_write_reg(TCG_REG_R1, tmp64 >> 32);
#else
tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),
tci_read_reg(TCG_REG_R1),
tci_read_reg(TCG_REG_R2),
tci_read_reg(TCG_REG_R3),
tci_read_reg(TCG_REG_R5));
tci_write_reg(TCG_REG_R0, tmp64);
#endif
break;
case INDEX_op_br:
label = tci_read_label(&tb_ptr);
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
case INDEX_op_setcond_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
condition = *tb_ptr++;
tci_write_reg32(t0, tci_compare32(t1, t2, condition));
break;
#if TCG_TARGET_REG_BITS == 32
case INDEX_op_setcond2_i32:
t0 = *tb_ptr++;
tmp64 = tci_read_r64(&tb_ptr);
v64 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
tci_write_reg32(t0, tci_compare64(tmp64, v64, condition));
break;
#elif TCG_TARGET_REG_BITS == 64
case INDEX_op_setcond_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
tci_write_reg64(t0, tci_compare64(t1, t2, condition));
break;
#endif
case INDEX_op_mov_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, t1);
break;
case INDEX_op_movi_i32:
t0 = *tb_ptr++;
t1 = tci_read_i32(&tb_ptr);
tci_write_reg32(t0, t1);
break;
case INDEX_op_ld8u_i32:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg8(t0, *(uint8_t *)(t1 + t2));
break;
case INDEX_op_ld8s_i32:
case INDEX_op_ld16u_i32:
TODO();
break;
case INDEX_op_ld16s_i32:
TODO();
break;
case INDEX_op_ld_i32:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg32(t0, *(uint32_t *)(t1 + t2));
break;
case INDEX_op_st8_i32:
t0 = tci_read_r8(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint8_t *)(t1 + t2) = t0;
break;
case INDEX_op_st16_i32:
t0 = tci_read_r16(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint16_t *)(t1 + t2) = t0;
break;
case INDEX_op_st_i32:
t0 = tci_read_r32(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
assert(t1 != sp_value || (int32_t)t2 < 0);
*(uint32_t *)(t1 + t2) = t0;
break;
case INDEX_op_add_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 + t2);
break;
case INDEX_op_sub_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 - t2);
break;
case INDEX_op_mul_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 * t2);
break;
#if TCG_TARGET_HAS_div_i32
case INDEX_op_div_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, (int32_t)t1 / (int32_t)t2);
break;
case INDEX_op_divu_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 / t2);
break;
case INDEX_op_rem_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, (int32_t)t1 % (int32_t)t2);
break;
case INDEX_op_remu_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 % t2);
break;
#elif TCG_TARGET_HAS_div2_i32
case INDEX_op_div2_i32:
case INDEX_op_divu2_i32:
TODO();
break;
#endif
case INDEX_op_and_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 & t2);
break;
case INDEX_op_or_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 | t2);
break;
case INDEX_op_xor_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 ^ t2);
break;
case INDEX_op_shl_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 << t2);
break;
case INDEX_op_shr_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 >> t2);
break;
case INDEX_op_sar_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, ((int32_t)t1 >> t2));
break;
#if TCG_TARGET_HAS_rot_i32
case INDEX_op_rotl_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, rol32(t1, t2));
break;
case INDEX_op_rotr_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, ror32(t1, t2));
break;
#endif
#if TCG_TARGET_HAS_deposit_i32
case INDEX_op_deposit_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
t2 = tci_read_r32(&tb_ptr);
tmp16 = *tb_ptr++;
tmp8 = *tb_ptr++;
tmp32 = (((1 << tmp8) - 1) << tmp16);
tci_write_reg32(t0, (t1 & ~tmp32) | ((t2 << tmp16) & tmp32));
break;
#endif
case INDEX_op_brcond_i32:
t0 = tci_read_r32(&tb_ptr);
t1 = tci_read_ri32(&tb_ptr);
condition = *tb_ptr++;
label = tci_read_label(&tb_ptr);
if (tci_compare32(t0, t1, condition)) {
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
}
break;
#if TCG_TARGET_REG_BITS == 32
case INDEX_op_add2_i32:
t0 = *tb_ptr++;
t1 = *tb_ptr++;
tmp64 = tci_read_r64(&tb_ptr);
tmp64 += tci_read_r64(&tb_ptr);
tci_write_reg64(t1, t0, tmp64);
break;
case INDEX_op_sub2_i32:
t0 = *tb_ptr++;
t1 = *tb_ptr++;
tmp64 = tci_read_r64(&tb_ptr);
tmp64 -= tci_read_r64(&tb_ptr);
tci_write_reg64(t1, t0, tmp64);
break;
case INDEX_op_brcond2_i32:
tmp64 = tci_read_r64(&tb_ptr);
v64 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
label = tci_read_label(&tb_ptr);
if (tci_compare64(tmp64, v64, condition)) {
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
}
break;
case INDEX_op_mulu2_i32:
t0 = *tb_ptr++;
t1 = *tb_ptr++;
t2 = tci_read_r32(&tb_ptr);
tmp64 = tci_read_r32(&tb_ptr);
tci_write_reg64(t1, t0, t2 * tmp64);
break;
#endif
#if TCG_TARGET_HAS_ext8s_i32
case INDEX_op_ext8s_i32:
t0 = *tb_ptr++;
t1 = tci_read_r8s(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16s_i32
case INDEX_op_ext16s_i32:
t0 = *tb_ptr++;
t1 = tci_read_r16s(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext8u_i32
case INDEX_op_ext8u_i32:
t0 = *tb_ptr++;
t1 = tci_read_r8(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16u_i32
case INDEX_op_ext16u_i32:
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_bswap16_i32
case INDEX_op_bswap16_i32:
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg32(t0, bswap16(t1));
break;
#endif
#if TCG_TARGET_HAS_bswap32_i32
case INDEX_op_bswap32_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, bswap32(t1));
break;
#endif
#if TCG_TARGET_HAS_not_i32
case INDEX_op_not_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, ~t1);
break;
#endif
#if TCG_TARGET_HAS_neg_i32
case INDEX_op_neg_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, -t1);
break;
#endif
#if TCG_TARGET_REG_BITS == 64
case INDEX_op_mov_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, t1);
break;
case INDEX_op_movi_i64:
t0 = *tb_ptr++;
t1 = tci_read_i64(&tb_ptr);
tci_write_reg64(t0, t1);
break;
case INDEX_op_ld8u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg8(t0, *(uint8_t *)(t1 + t2));
break;
case INDEX_op_ld8s_i64:
case INDEX_op_ld16u_i64:
case INDEX_op_ld16s_i64:
TODO();
break;
case INDEX_op_ld32u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg32(t0, *(uint32_t *)(t1 + t2));
break;
case INDEX_op_ld32s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg32s(t0, *(int32_t *)(t1 + t2));
break;
case INDEX_op_ld_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg64(t0, *(uint64_t *)(t1 + t2));
break;
case INDEX_op_st8_i64:
t0 = tci_read_r8(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint8_t *)(t1 + t2) = t0;
break;
case INDEX_op_st16_i64:
t0 = tci_read_r16(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint16_t *)(t1 + t2) = t0;
break;
case INDEX_op_st32_i64:
t0 = tci_read_r32(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint32_t *)(t1 + t2) = t0;
break;
case INDEX_op_st_i64:
t0 = tci_read_r64(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
assert(t1 != sp_value || (int32_t)t2 < 0);
*(uint64_t *)(t1 + t2) = t0;
break;
case INDEX_op_add_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 + t2);
break;
case INDEX_op_sub_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 - t2);
break;
case INDEX_op_mul_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 * t2);
break;
#if TCG_TARGET_HAS_div_i64
case INDEX_op_div_i64:
case INDEX_op_divu_i64:
case INDEX_op_rem_i64:
case INDEX_op_remu_i64:
TODO();
break;
#elif TCG_TARGET_HAS_div2_i64
case INDEX_op_div2_i64:
case INDEX_op_divu2_i64:
TODO();
break;
#endif
case INDEX_op_and_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 & t2);
break;
case INDEX_op_or_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 | t2);
break;
case INDEX_op_xor_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 ^ t2);
break;
case INDEX_op_shl_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 << t2);
break;
case INDEX_op_shr_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 >> t2);
break;
case INDEX_op_sar_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, ((int64_t)t1 >> t2));
break;
#if TCG_TARGET_HAS_rot_i64
case INDEX_op_rotl_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, rol64(t1, t2));
break;
case INDEX_op_rotr_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, ror64(t1, t2));
break;
#endif
#if TCG_TARGET_HAS_deposit_i64
case INDEX_op_deposit_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
t2 = tci_read_r64(&tb_ptr);
tmp16 = *tb_ptr++;
tmp8 = *tb_ptr++;
tmp64 = (((1ULL << tmp8) - 1) << tmp16);
tci_write_reg64(t0, (t1 & ~tmp64) | ((t2 << tmp16) & tmp64));
break;
#endif
case INDEX_op_brcond_i64:
t0 = tci_read_r64(&tb_ptr);
t1 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
label = tci_read_label(&tb_ptr);
if (tci_compare64(t0, t1, condition)) {
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
}
break;
#if TCG_TARGET_HAS_ext8u_i64
case INDEX_op_ext8u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r8(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext8s_i64
case INDEX_op_ext8s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r8s(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16s_i64
case INDEX_op_ext16s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r16s(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16u_i64
case INDEX_op_ext16u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext32s_i64
case INDEX_op_ext32s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r32s(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext32u_i64
case INDEX_op_ext32u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_bswap16_i64
case INDEX_op_bswap16_i64:
TODO();
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg64(t0, bswap16(t1));
break;
#endif
#if TCG_TARGET_HAS_bswap32_i64
case INDEX_op_bswap32_i64:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg64(t0, bswap32(t1));
break;
#endif
#if TCG_TARGET_HAS_bswap64_i64
case INDEX_op_bswap64_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, bswap64(t1));
break;
#endif
#if TCG_TARGET_HAS_not_i64
case INDEX_op_not_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, ~t1);
break;
#endif
#if TCG_TARGET_HAS_neg_i64
case INDEX_op_neg_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, -t1);
break;
#endif
#endif
#if TARGET_LONG_BITS > TCG_TARGET_REG_BITS
case INDEX_op_debug_insn_start:
TODO();
break;
#else
case INDEX_op_debug_insn_start:
TODO();
break;
#endif
case INDEX_op_exit_tb:
next_tb = *(uint64_t *)tb_ptr;
goto exit;
break;
case INDEX_op_goto_tb:
t0 = tci_read_i32(&tb_ptr);
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr += (int32_t)t0;
continue;
case INDEX_op_qemu_ld8u:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp8 = *(uint8_t *)(host_addr + GUEST_BASE);
#endif
tci_write_reg8(t0, tmp8);
break;
case INDEX_op_qemu_ld8s:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp8 = *(uint8_t *)(host_addr + GUEST_BASE);
#endif
tci_write_reg8s(t0, tmp8);
break;
case INDEX_op_qemu_ld16u:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg16(t0, tmp16);
break;
case INDEX_op_qemu_ld16s:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg16s(t0, tmp16);
break;
#if TCG_TARGET_REG_BITS == 64
case INDEX_op_qemu_ld32u:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg32(t0, tmp32);
break;
case INDEX_op_qemu_ld32s:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg32s(t0, tmp32);
break;
#endif
case INDEX_op_qemu_ld32:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg32(t0, tmp32);
break;
case INDEX_op_qemu_ld64:
t0 = *tb_ptr++;
#if TCG_TARGET_REG_BITS == 32
t1 = *tb_ptr++;
#endif
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp64 = helper_ldq_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
tmp64 = tswap64(*(uint64_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg(t0, tmp64);
#if TCG_TARGET_REG_BITS == 32
tci_write_reg(t1, tmp64 >> 32);
#endif
break;
case INDEX_op_qemu_st8:
t0 = tci_read_r8(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stb_mmu(env, taddr, t0, t2);
#else
host_addr = (tcg_target_ulong)taddr;
*(uint8_t *)(host_addr + GUEST_BASE) = t0;
#endif
break;
case INDEX_op_qemu_st16:
t0 = tci_read_r16(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stw_mmu(env, taddr, t0, t2);
#else
host_addr = (tcg_target_ulong)taddr;
*(uint16_t *)(host_addr + GUEST_BASE) = tswap16(t0);
#endif
break;
case INDEX_op_qemu_st32:
t0 = tci_read_r32(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stl_mmu(env, taddr, t0, t2);
#else
host_addr = (tcg_target_ulong)taddr;
*(uint32_t *)(host_addr + GUEST_BASE) = tswap32(t0);
#endif
break;
case INDEX_op_qemu_st64:
tmp64 = tci_read_r64(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stq_mmu(env, taddr, tmp64, t2);
#else
host_addr = (tcg_target_ulong)taddr;
*(uint64_t *)(host_addr + GUEST_BASE) = tswap64(tmp64);
#endif
break;
default:
TODO();
break;
}
assert(tb_ptr == old_code_ptr + op_size);
}
exit:
return next_tb;
}
| [
"uintptr_t FUNC_0(CPUArchState *env, uint8_t *tb_ptr)\n{",
"long VAR_0[CPU_TEMP_BUF_NLONGS];",
"uintptr_t sp_value = (uintptr_t)(VAR_0 + CPU_TEMP_BUF_NLONGS);",
"uintptr_t next_tb = 0;",
"tci_reg[TCG_AREG0] = (tcg_target_ulong)env;",
"tci_reg[TCG_REG_CALL_STACK] = sp_value;",
"assert(tb_ptr);",
"for (;;) {",
"TCGOpcode opc = tb_ptr[0];",
"#if !defined(NDEBUG)\nuint8_t op_size = tb_ptr[1];",
"uint8_t *old_code_ptr = tb_ptr;",
"#endif\ntcg_target_ulong t0;",
"tcg_target_ulong t1;",
"tcg_target_ulong t2;",
"tcg_target_ulong label;",
"TCGCond condition;",
"target_ulong taddr;",
"#ifndef CONFIG_SOFTMMU\ntcg_target_ulong host_addr;",
"#endif\nuint8_t tmp8;",
"uint16_t tmp16;",
"uint32_t tmp32;",
"uint64_t tmp64;",
"#if TCG_TARGET_REG_BITS == 32\nuint64_t v64;",
"#endif\n#if defined(GETPC)\ntci_tb_ptr = (uintptr_t)tb_ptr;",
"#endif\ntb_ptr += 2;",
"switch (opc) {",
"case INDEX_op_end:\ncase INDEX_op_nop:\nbreak;",
"case INDEX_op_nop1:\ncase INDEX_op_nop2:\ncase INDEX_op_nop3:\ncase INDEX_op_nopn:\ncase INDEX_op_discard:\nTODO();",
"break;",
"case INDEX_op_set_label:\nTODO();",
"break;",
"case INDEX_op_call:\nt0 = tci_read_ri(&tb_ptr);",
"#if TCG_TARGET_REG_BITS == 32\ntmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),\ntci_read_reg(TCG_REG_R1),\ntci_read_reg(TCG_REG_R2),\ntci_read_reg(TCG_REG_R3),\ntci_read_reg(TCG_REG_R5),\ntci_read_reg(TCG_REG_R6),\ntci_read_reg(TCG_REG_R7),\ntci_read_reg(TCG_REG_R8),\ntci_read_reg(TCG_REG_R9),\ntci_read_reg(TCG_REG_R10));",
"tci_write_reg(TCG_REG_R0, tmp64);",
"tci_write_reg(TCG_REG_R1, tmp64 >> 32);",
"#else\ntmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),\ntci_read_reg(TCG_REG_R1),\ntci_read_reg(TCG_REG_R2),\ntci_read_reg(TCG_REG_R3),\ntci_read_reg(TCG_REG_R5));",
"tci_write_reg(TCG_REG_R0, tmp64);",
"#endif\nbreak;",
"case INDEX_op_br:\nlabel = tci_read_label(&tb_ptr);",
"assert(tb_ptr == old_code_ptr + op_size);",
"tb_ptr = (uint8_t *)label;",
"continue;",
"case INDEX_op_setcond_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_r32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"condition = *tb_ptr++;",
"tci_write_reg32(t0, tci_compare32(t1, t2, condition));",
"break;",
"#if TCG_TARGET_REG_BITS == 32\ncase INDEX_op_setcond2_i32:\nt0 = *tb_ptr++;",
"tmp64 = tci_read_r64(&tb_ptr);",
"v64 = tci_read_ri64(&tb_ptr);",
"condition = *tb_ptr++;",
"tci_write_reg32(t0, tci_compare64(tmp64, v64, condition));",
"break;",
"#elif TCG_TARGET_REG_BITS == 64\ncase INDEX_op_setcond_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r64(&tb_ptr);",
"t2 = tci_read_ri64(&tb_ptr);",
"condition = *tb_ptr++;",
"tci_write_reg64(t0, tci_compare64(t1, t2, condition));",
"break;",
"#endif\ncase INDEX_op_mov_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_r32(&tb_ptr);",
"tci_write_reg32(t0, t1);",
"break;",
"case INDEX_op_movi_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_i32(&tb_ptr);",
"tci_write_reg32(t0, t1);",
"break;",
"case INDEX_op_ld8u_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_r(&tb_ptr);",
"t2 = tci_read_s32(&tb_ptr);",
"tci_write_reg8(t0, *(uint8_t *)(t1 + t2));",
"break;",
"case INDEX_op_ld8s_i32:\ncase INDEX_op_ld16u_i32:\nTODO();",
"break;",
"case INDEX_op_ld16s_i32:\nTODO();",
"break;",
"case INDEX_op_ld_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_r(&tb_ptr);",
"t2 = tci_read_s32(&tb_ptr);",
"tci_write_reg32(t0, *(uint32_t *)(t1 + t2));",
"break;",
"case INDEX_op_st8_i32:\nt0 = tci_read_r8(&tb_ptr);",
"t1 = tci_read_r(&tb_ptr);",
"t2 = tci_read_s32(&tb_ptr);",
"*(uint8_t *)(t1 + t2) = t0;",
"break;",
"case INDEX_op_st16_i32:\nt0 = tci_read_r16(&tb_ptr);",
"t1 = tci_read_r(&tb_ptr);",
"t2 = tci_read_s32(&tb_ptr);",
"*(uint16_t *)(t1 + t2) = t0;",
"break;",
"case INDEX_op_st_i32:\nt0 = tci_read_r32(&tb_ptr);",
"t1 = tci_read_r(&tb_ptr);",
"t2 = tci_read_s32(&tb_ptr);",
"assert(t1 != sp_value || (int32_t)t2 < 0);",
"*(uint32_t *)(t1 + t2) = t0;",
"break;",
"case INDEX_op_add_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, t1 + t2);",
"break;",
"case INDEX_op_sub_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, t1 - t2);",
"break;",
"case INDEX_op_mul_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, t1 * t2);",
"break;",
"#if TCG_TARGET_HAS_div_i32\ncase INDEX_op_div_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, (int32_t)t1 / (int32_t)t2);",
"break;",
"case INDEX_op_divu_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, t1 / t2);",
"break;",
"case INDEX_op_rem_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, (int32_t)t1 % (int32_t)t2);",
"break;",
"case INDEX_op_remu_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, t1 % t2);",
"break;",
"#elif TCG_TARGET_HAS_div2_i32\ncase INDEX_op_div2_i32:\ncase INDEX_op_divu2_i32:\nTODO();",
"break;",
"#endif\ncase INDEX_op_and_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, t1 & t2);",
"break;",
"case INDEX_op_or_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, t1 | t2);",
"break;",
"case INDEX_op_xor_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, t1 ^ t2);",
"break;",
"case INDEX_op_shl_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, t1 << t2);",
"break;",
"case INDEX_op_shr_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, t1 >> t2);",
"break;",
"case INDEX_op_sar_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, ((int32_t)t1 >> t2));",
"break;",
"#if TCG_TARGET_HAS_rot_i32\ncase INDEX_op_rotl_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, rol32(t1, t2));",
"break;",
"case INDEX_op_rotr_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri32(&tb_ptr);",
"t2 = tci_read_ri32(&tb_ptr);",
"tci_write_reg32(t0, ror32(t1, t2));",
"break;",
"#endif\n#if TCG_TARGET_HAS_deposit_i32\ncase INDEX_op_deposit_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_r32(&tb_ptr);",
"t2 = tci_read_r32(&tb_ptr);",
"tmp16 = *tb_ptr++;",
"tmp8 = *tb_ptr++;",
"tmp32 = (((1 << tmp8) - 1) << tmp16);",
"tci_write_reg32(t0, (t1 & ~tmp32) | ((t2 << tmp16) & tmp32));",
"break;",
"#endif\ncase INDEX_op_brcond_i32:\nt0 = tci_read_r32(&tb_ptr);",
"t1 = tci_read_ri32(&tb_ptr);",
"condition = *tb_ptr++;",
"label = tci_read_label(&tb_ptr);",
"if (tci_compare32(t0, t1, condition)) {",
"assert(tb_ptr == old_code_ptr + op_size);",
"tb_ptr = (uint8_t *)label;",
"continue;",
"}",
"break;",
"#if TCG_TARGET_REG_BITS == 32\ncase INDEX_op_add2_i32:\nt0 = *tb_ptr++;",
"t1 = *tb_ptr++;",
"tmp64 = tci_read_r64(&tb_ptr);",
"tmp64 += tci_read_r64(&tb_ptr);",
"tci_write_reg64(t1, t0, tmp64);",
"break;",
"case INDEX_op_sub2_i32:\nt0 = *tb_ptr++;",
"t1 = *tb_ptr++;",
"tmp64 = tci_read_r64(&tb_ptr);",
"tmp64 -= tci_read_r64(&tb_ptr);",
"tci_write_reg64(t1, t0, tmp64);",
"break;",
"case INDEX_op_brcond2_i32:\ntmp64 = tci_read_r64(&tb_ptr);",
"v64 = tci_read_ri64(&tb_ptr);",
"condition = *tb_ptr++;",
"label = tci_read_label(&tb_ptr);",
"if (tci_compare64(tmp64, v64, condition)) {",
"assert(tb_ptr == old_code_ptr + op_size);",
"tb_ptr = (uint8_t *)label;",
"continue;",
"}",
"break;",
"case INDEX_op_mulu2_i32:\nt0 = *tb_ptr++;",
"t1 = *tb_ptr++;",
"t2 = tci_read_r32(&tb_ptr);",
"tmp64 = tci_read_r32(&tb_ptr);",
"tci_write_reg64(t1, t0, t2 * tmp64);",
"break;",
"#endif\n#if TCG_TARGET_HAS_ext8s_i32\ncase INDEX_op_ext8s_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_r8s(&tb_ptr);",
"tci_write_reg32(t0, t1);",
"break;",
"#endif\n#if TCG_TARGET_HAS_ext16s_i32\ncase INDEX_op_ext16s_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_r16s(&tb_ptr);",
"tci_write_reg32(t0, t1);",
"break;",
"#endif\n#if TCG_TARGET_HAS_ext8u_i32\ncase INDEX_op_ext8u_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_r8(&tb_ptr);",
"tci_write_reg32(t0, t1);",
"break;",
"#endif\n#if TCG_TARGET_HAS_ext16u_i32\ncase INDEX_op_ext16u_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_r16(&tb_ptr);",
"tci_write_reg32(t0, t1);",
"break;",
"#endif\n#if TCG_TARGET_HAS_bswap16_i32\ncase INDEX_op_bswap16_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_r16(&tb_ptr);",
"tci_write_reg32(t0, bswap16(t1));",
"break;",
"#endif\n#if TCG_TARGET_HAS_bswap32_i32\ncase INDEX_op_bswap32_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_r32(&tb_ptr);",
"tci_write_reg32(t0, bswap32(t1));",
"break;",
"#endif\n#if TCG_TARGET_HAS_not_i32\ncase INDEX_op_not_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_r32(&tb_ptr);",
"tci_write_reg32(t0, ~t1);",
"break;",
"#endif\n#if TCG_TARGET_HAS_neg_i32\ncase INDEX_op_neg_i32:\nt0 = *tb_ptr++;",
"t1 = tci_read_r32(&tb_ptr);",
"tci_write_reg32(t0, -t1);",
"break;",
"#endif\n#if TCG_TARGET_REG_BITS == 64\ncase INDEX_op_mov_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r64(&tb_ptr);",
"tci_write_reg64(t0, t1);",
"break;",
"case INDEX_op_movi_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_i64(&tb_ptr);",
"tci_write_reg64(t0, t1);",
"break;",
"case INDEX_op_ld8u_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r(&tb_ptr);",
"t2 = tci_read_s32(&tb_ptr);",
"tci_write_reg8(t0, *(uint8_t *)(t1 + t2));",
"break;",
"case INDEX_op_ld8s_i64:\ncase INDEX_op_ld16u_i64:\ncase INDEX_op_ld16s_i64:\nTODO();",
"break;",
"case INDEX_op_ld32u_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r(&tb_ptr);",
"t2 = tci_read_s32(&tb_ptr);",
"tci_write_reg32(t0, *(uint32_t *)(t1 + t2));",
"break;",
"case INDEX_op_ld32s_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r(&tb_ptr);",
"t2 = tci_read_s32(&tb_ptr);",
"tci_write_reg32s(t0, *(int32_t *)(t1 + t2));",
"break;",
"case INDEX_op_ld_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r(&tb_ptr);",
"t2 = tci_read_s32(&tb_ptr);",
"tci_write_reg64(t0, *(uint64_t *)(t1 + t2));",
"break;",
"case INDEX_op_st8_i64:\nt0 = tci_read_r8(&tb_ptr);",
"t1 = tci_read_r(&tb_ptr);",
"t2 = tci_read_s32(&tb_ptr);",
"*(uint8_t *)(t1 + t2) = t0;",
"break;",
"case INDEX_op_st16_i64:\nt0 = tci_read_r16(&tb_ptr);",
"t1 = tci_read_r(&tb_ptr);",
"t2 = tci_read_s32(&tb_ptr);",
"*(uint16_t *)(t1 + t2) = t0;",
"break;",
"case INDEX_op_st32_i64:\nt0 = tci_read_r32(&tb_ptr);",
"t1 = tci_read_r(&tb_ptr);",
"t2 = tci_read_s32(&tb_ptr);",
"*(uint32_t *)(t1 + t2) = t0;",
"break;",
"case INDEX_op_st_i64:\nt0 = tci_read_r64(&tb_ptr);",
"t1 = tci_read_r(&tb_ptr);",
"t2 = tci_read_s32(&tb_ptr);",
"assert(t1 != sp_value || (int32_t)t2 < 0);",
"*(uint64_t *)(t1 + t2) = t0;",
"break;",
"case INDEX_op_add_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri64(&tb_ptr);",
"t2 = tci_read_ri64(&tb_ptr);",
"tci_write_reg64(t0, t1 + t2);",
"break;",
"case INDEX_op_sub_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri64(&tb_ptr);",
"t2 = tci_read_ri64(&tb_ptr);",
"tci_write_reg64(t0, t1 - t2);",
"break;",
"case INDEX_op_mul_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri64(&tb_ptr);",
"t2 = tci_read_ri64(&tb_ptr);",
"tci_write_reg64(t0, t1 * t2);",
"break;",
"#if TCG_TARGET_HAS_div_i64\ncase INDEX_op_div_i64:\ncase INDEX_op_divu_i64:\ncase INDEX_op_rem_i64:\ncase INDEX_op_remu_i64:\nTODO();",
"break;",
"#elif TCG_TARGET_HAS_div2_i64\ncase INDEX_op_div2_i64:\ncase INDEX_op_divu2_i64:\nTODO();",
"break;",
"#endif\ncase INDEX_op_and_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri64(&tb_ptr);",
"t2 = tci_read_ri64(&tb_ptr);",
"tci_write_reg64(t0, t1 & t2);",
"break;",
"case INDEX_op_or_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri64(&tb_ptr);",
"t2 = tci_read_ri64(&tb_ptr);",
"tci_write_reg64(t0, t1 | t2);",
"break;",
"case INDEX_op_xor_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri64(&tb_ptr);",
"t2 = tci_read_ri64(&tb_ptr);",
"tci_write_reg64(t0, t1 ^ t2);",
"break;",
"case INDEX_op_shl_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri64(&tb_ptr);",
"t2 = tci_read_ri64(&tb_ptr);",
"tci_write_reg64(t0, t1 << t2);",
"break;",
"case INDEX_op_shr_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri64(&tb_ptr);",
"t2 = tci_read_ri64(&tb_ptr);",
"tci_write_reg64(t0, t1 >> t2);",
"break;",
"case INDEX_op_sar_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri64(&tb_ptr);",
"t2 = tci_read_ri64(&tb_ptr);",
"tci_write_reg64(t0, ((int64_t)t1 >> t2));",
"break;",
"#if TCG_TARGET_HAS_rot_i64\ncase INDEX_op_rotl_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri64(&tb_ptr);",
"t2 = tci_read_ri64(&tb_ptr);",
"tci_write_reg64(t0, rol64(t1, t2));",
"break;",
"case INDEX_op_rotr_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_ri64(&tb_ptr);",
"t2 = tci_read_ri64(&tb_ptr);",
"tci_write_reg64(t0, ror64(t1, t2));",
"break;",
"#endif\n#if TCG_TARGET_HAS_deposit_i64\ncase INDEX_op_deposit_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r64(&tb_ptr);",
"t2 = tci_read_r64(&tb_ptr);",
"tmp16 = *tb_ptr++;",
"tmp8 = *tb_ptr++;",
"tmp64 = (((1ULL << tmp8) - 1) << tmp16);",
"tci_write_reg64(t0, (t1 & ~tmp64) | ((t2 << tmp16) & tmp64));",
"break;",
"#endif\ncase INDEX_op_brcond_i64:\nt0 = tci_read_r64(&tb_ptr);",
"t1 = tci_read_ri64(&tb_ptr);",
"condition = *tb_ptr++;",
"label = tci_read_label(&tb_ptr);",
"if (tci_compare64(t0, t1, condition)) {",
"assert(tb_ptr == old_code_ptr + op_size);",
"tb_ptr = (uint8_t *)label;",
"continue;",
"}",
"break;",
"#if TCG_TARGET_HAS_ext8u_i64\ncase INDEX_op_ext8u_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r8(&tb_ptr);",
"tci_write_reg64(t0, t1);",
"break;",
"#endif\n#if TCG_TARGET_HAS_ext8s_i64\ncase INDEX_op_ext8s_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r8s(&tb_ptr);",
"tci_write_reg64(t0, t1);",
"break;",
"#endif\n#if TCG_TARGET_HAS_ext16s_i64\ncase INDEX_op_ext16s_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r16s(&tb_ptr);",
"tci_write_reg64(t0, t1);",
"break;",
"#endif\n#if TCG_TARGET_HAS_ext16u_i64\ncase INDEX_op_ext16u_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r16(&tb_ptr);",
"tci_write_reg64(t0, t1);",
"break;",
"#endif\n#if TCG_TARGET_HAS_ext32s_i64\ncase INDEX_op_ext32s_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r32s(&tb_ptr);",
"tci_write_reg64(t0, t1);",
"break;",
"#endif\n#if TCG_TARGET_HAS_ext32u_i64\ncase INDEX_op_ext32u_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r32(&tb_ptr);",
"tci_write_reg64(t0, t1);",
"break;",
"#endif\n#if TCG_TARGET_HAS_bswap16_i64\ncase INDEX_op_bswap16_i64:\nTODO();",
"t0 = *tb_ptr++;",
"t1 = tci_read_r16(&tb_ptr);",
"tci_write_reg64(t0, bswap16(t1));",
"break;",
"#endif\n#if TCG_TARGET_HAS_bswap32_i64\ncase INDEX_op_bswap32_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r32(&tb_ptr);",
"tci_write_reg64(t0, bswap32(t1));",
"break;",
"#endif\n#if TCG_TARGET_HAS_bswap64_i64\ncase INDEX_op_bswap64_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r64(&tb_ptr);",
"tci_write_reg64(t0, bswap64(t1));",
"break;",
"#endif\n#if TCG_TARGET_HAS_not_i64\ncase INDEX_op_not_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r64(&tb_ptr);",
"tci_write_reg64(t0, ~t1);",
"break;",
"#endif\n#if TCG_TARGET_HAS_neg_i64\ncase INDEX_op_neg_i64:\nt0 = *tb_ptr++;",
"t1 = tci_read_r64(&tb_ptr);",
"tci_write_reg64(t0, -t1);",
"break;",
"#endif\n#endif\n#if TARGET_LONG_BITS > TCG_TARGET_REG_BITS\ncase INDEX_op_debug_insn_start:\nTODO();",
"break;",
"#else\ncase INDEX_op_debug_insn_start:\nTODO();",
"break;",
"#endif\ncase INDEX_op_exit_tb:\nnext_tb = *(uint64_t *)tb_ptr;",
"goto exit;",
"break;",
"case INDEX_op_goto_tb:\nt0 = tci_read_i32(&tb_ptr);",
"assert(tb_ptr == old_code_ptr + op_size);",
"tb_ptr += (int32_t)t0;",
"continue;",
"case INDEX_op_qemu_ld8u:\nt0 = *tb_ptr++;",
"taddr = tci_read_ulong(&tb_ptr);",
"#ifdef CONFIG_SOFTMMU\ntmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr));",
"#else\nhost_addr = (tcg_target_ulong)taddr;",
"tmp8 = *(uint8_t *)(host_addr + GUEST_BASE);",
"#endif\ntci_write_reg8(t0, tmp8);",
"break;",
"case INDEX_op_qemu_ld8s:\nt0 = *tb_ptr++;",
"taddr = tci_read_ulong(&tb_ptr);",
"#ifdef CONFIG_SOFTMMU\ntmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr));",
"#else\nhost_addr = (tcg_target_ulong)taddr;",
"tmp8 = *(uint8_t *)(host_addr + GUEST_BASE);",
"#endif\ntci_write_reg8s(t0, tmp8);",
"break;",
"case INDEX_op_qemu_ld16u:\nt0 = *tb_ptr++;",
"taddr = tci_read_ulong(&tb_ptr);",
"#ifdef CONFIG_SOFTMMU\ntmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr));",
"#else\nhost_addr = (tcg_target_ulong)taddr;",
"tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE));",
"#endif\ntci_write_reg16(t0, tmp16);",
"break;",
"case INDEX_op_qemu_ld16s:\nt0 = *tb_ptr++;",
"taddr = tci_read_ulong(&tb_ptr);",
"#ifdef CONFIG_SOFTMMU\ntmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr));",
"#else\nhost_addr = (tcg_target_ulong)taddr;",
"tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE));",
"#endif\ntci_write_reg16s(t0, tmp16);",
"break;",
"#if TCG_TARGET_REG_BITS == 64\ncase INDEX_op_qemu_ld32u:\nt0 = *tb_ptr++;",
"taddr = tci_read_ulong(&tb_ptr);",
"#ifdef CONFIG_SOFTMMU\ntmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));",
"#else\nhost_addr = (tcg_target_ulong)taddr;",
"tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));",
"#endif\ntci_write_reg32(t0, tmp32);",
"break;",
"case INDEX_op_qemu_ld32s:\nt0 = *tb_ptr++;",
"taddr = tci_read_ulong(&tb_ptr);",
"#ifdef CONFIG_SOFTMMU\ntmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));",
"#else\nhost_addr = (tcg_target_ulong)taddr;",
"tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));",
"#endif\ntci_write_reg32s(t0, tmp32);",
"break;",
"#endif\ncase INDEX_op_qemu_ld32:\nt0 = *tb_ptr++;",
"taddr = tci_read_ulong(&tb_ptr);",
"#ifdef CONFIG_SOFTMMU\ntmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));",
"#else\nhost_addr = (tcg_target_ulong)taddr;",
"tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));",
"#endif\ntci_write_reg32(t0, tmp32);",
"break;",
"case INDEX_op_qemu_ld64:\nt0 = *tb_ptr++;",
"#if TCG_TARGET_REG_BITS == 32\nt1 = *tb_ptr++;",
"#endif\ntaddr = tci_read_ulong(&tb_ptr);",
"#ifdef CONFIG_SOFTMMU\ntmp64 = helper_ldq_mmu(env, taddr, tci_read_i(&tb_ptr));",
"#else\nhost_addr = (tcg_target_ulong)taddr;",
"tmp64 = tswap64(*(uint64_t *)(host_addr + GUEST_BASE));",
"#endif\ntci_write_reg(t0, tmp64);",
"#if TCG_TARGET_REG_BITS == 32\ntci_write_reg(t1, tmp64 >> 32);",
"#endif\nbreak;",
"case INDEX_op_qemu_st8:\nt0 = tci_read_r8(&tb_ptr);",
"taddr = tci_read_ulong(&tb_ptr);",
"#ifdef CONFIG_SOFTMMU\nt2 = tci_read_i(&tb_ptr);",
"helper_stb_mmu(env, taddr, t0, t2);",
"#else\nhost_addr = (tcg_target_ulong)taddr;",
"*(uint8_t *)(host_addr + GUEST_BASE) = t0;",
"#endif\nbreak;",
"case INDEX_op_qemu_st16:\nt0 = tci_read_r16(&tb_ptr);",
"taddr = tci_read_ulong(&tb_ptr);",
"#ifdef CONFIG_SOFTMMU\nt2 = tci_read_i(&tb_ptr);",
"helper_stw_mmu(env, taddr, t0, t2);",
"#else\nhost_addr = (tcg_target_ulong)taddr;",
"*(uint16_t *)(host_addr + GUEST_BASE) = tswap16(t0);",
"#endif\nbreak;",
"case INDEX_op_qemu_st32:\nt0 = tci_read_r32(&tb_ptr);",
"taddr = tci_read_ulong(&tb_ptr);",
"#ifdef CONFIG_SOFTMMU\nt2 = tci_read_i(&tb_ptr);",
"helper_stl_mmu(env, taddr, t0, t2);",
"#else\nhost_addr = (tcg_target_ulong)taddr;",
"*(uint32_t *)(host_addr + GUEST_BASE) = tswap32(t0);",
"#endif\nbreak;",
"case INDEX_op_qemu_st64:\ntmp64 = tci_read_r64(&tb_ptr);",
"taddr = tci_read_ulong(&tb_ptr);",
"#ifdef CONFIG_SOFTMMU\nt2 = tci_read_i(&tb_ptr);",
"helper_stq_mmu(env, taddr, tmp64, t2);",
"#else\nhost_addr = (tcg_target_ulong)taddr;",
"*(uint64_t *)(host_addr + GUEST_BASE) = tswap64(tmp64);",
"#endif\nbreak;",
"default:\nTODO();",
"break;",
"}",
"assert(tb_ptr == old_code_ptr + op_size);",
"}",
"exit:\nreturn next_tb;",
"}"
]
| [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
1,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
| [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25,
27
],
[
29
],
[
31,
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45,
47
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
59,
61
],
[
63,
67,
69
],
[
71,
77
],
[
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
],
[
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
],
[
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
],
[
463,
465
],
[
467
],
[
469
],
[
471
],
[
473
],
[
475,
477
],
[
479
],
[
481
],
[
483
],
[
485
],
[
487,
489
],
[
491
],
[
493
],
[
495
],
[
497
],
[
499,
501,
503
],
[
505
],
[
507
],
[
509
],
[
511
],
[
513,
515
],
[
517
],
[
519
],
[
521
],
[
523
],
[
525,
527,
529,
531
],
[
533
],
[
535
],
[
537
],
[
539
],
[
541
],
[
543
],
[
545
],
[
547,
549,
551
],
[
553
],
[
555
],
[
557
],
[
559
],
[
561
],
[
563
],
[
565
],
[
567
],
[
569
],
[
571,
573,
575
],
[
577
],
[
579
],
[
581
],
[
583
],
[
585
],
[
587,
589
],
[
591
],
[
593
],
[
595
],
[
597
],
[
599
],
[
601,
603
],
[
605
],
[
607
],
[
609
],
[
611
],
[
613
],
[
615
],
[
617
],
[
619
],
[
621
],
[
623,
625
],
[
627
],
[
629
],
[
631
],
[
633
],
[
635
],
[
637,
639,
641,
643
],
[
645
],
[
647
],
[
649
],
[
651,
653,
655,
657
],
[
659
],
[
661
],
[
663
],
[
665,
667,
669,
671
],
[
673
],
[
675
],
[
677
],
[
679,
681,
683,
685
],
[
687
],
[
689
],
[
691
],
[
693,
695,
697,
699
],
[
701
],
[
703
],
[
705
],
[
707,
709,
711,
713
],
[
715
],
[
717
],
[
719
],
[
721,
723,
725,
727
],
[
729
],
[
731
],
[
733
],
[
735,
737,
739,
741
],
[
743
],
[
745
],
[
747
],
[
749,
751,
753,
755
],
[
757
],
[
759
],
[
761
],
[
763,
765
],
[
767
],
[
769
],
[
771
],
[
779,
781
],
[
783
],
[
785
],
[
787
],
[
789
],
[
791,
793,
795,
797
],
[
799
],
[
801,
803
],
[
805
],
[
807
],
[
809
],
[
811
],
[
813,
815
],
[
817
],
[
819
],
[
821
],
[
823
],
[
825,
827
],
[
829
],
[
831
],
[
833
],
[
835
],
[
837,
839
],
[
841
],
[
843
],
[
845
],
[
847
],
[
849,
851
],
[
853
],
[
855
],
[
857
],
[
859
],
[
861,
863
],
[
865
],
[
867
],
[
869
],
[
871
],
[
873,
875
],
[
877
],
[
879
],
[
881
],
[
883
],
[
885
],
[
893,
895
],
[
897
],
[
899
],
[
901
],
[
903
],
[
905,
907
],
[
909
],
[
911
],
[
913
],
[
915
],
[
917,
919
],
[
921
],
[
923
],
[
925
],
[
927
],
[
929,
931,
933,
935,
937,
939
],
[
941
],
[
943,
945,
947,
949
],
[
951
],
[
953,
955,
957
],
[
959
],
[
961
],
[
963
],
[
965
],
[
967,
969
],
[
971
],
[
973
],
[
975
],
[
977
],
[
979,
981
],
[
983
],
[
985
],
[
987
],
[
989
],
[
997,
999
],
[
1001
],
[
1003
],
[
1005
],
[
1007
],
[
1009,
1011
],
[
1013
],
[
1015
],
[
1017
],
[
1019
],
[
1021,
1023
],
[
1025
],
[
1027
],
[
1029
],
[
1031
],
[
1033,
1035,
1037
],
[
1039
],
[
1041
],
[
1043
],
[
1045
],
[
1047,
1049
],
[
1051
],
[
1053
],
[
1055
],
[
1057
],
[
1059,
1061,
1063,
1065
],
[
1067
],
[
1069
],
[
1071
],
[
1073
],
[
1075
],
[
1077
],
[
1079
],
[
1081,
1083,
1085
],
[
1087
],
[
1089
],
[
1091
],
[
1093
],
[
1095
],
[
1097
],
[
1099
],
[
1101
],
[
1103
],
[
1105,
1107,
1109
],
[
1111
],
[
1113
],
[
1115
],
[
1117,
1119,
1121,
1123
],
[
1125
],
[
1127
],
[
1129
],
[
1131,
1133,
1135,
1137
],
[
1139
],
[
1141
],
[
1143
],
[
1145,
1147,
1149,
1151
],
[
1153
],
[
1155
],
[
1157
],
[
1159,
1161,
1163,
1165
],
[
1167
],
[
1169
],
[
1171
],
[
1173,
1175,
1177,
1179
],
[
1181
],
[
1183
],
[
1185
],
[
1187,
1189,
1191,
1193
],
[
1195
],
[
1197
],
[
1199
],
[
1201
],
[
1203,
1205,
1207,
1209
],
[
1211
],
[
1213
],
[
1215
],
[
1217,
1219,
1221,
1223
],
[
1225
],
[
1227
],
[
1229
],
[
1231,
1233,
1235,
1237
],
[
1239
],
[
1241
],
[
1243
],
[
1245,
1247,
1249,
1251
],
[
1253
],
[
1255
],
[
1257
],
[
1259,
1261,
1269,
1271,
1273
],
[
1275
],
[
1277,
1279,
1281
],
[
1283
],
[
1285,
1287,
1289
],
[
1291
],
[
1293
],
[
1295,
1297
],
[
1299
],
[
1301
],
[
1303
],
[
1305,
1307
],
[
1309
],
[
1311,
1313
],
[
1315,
1317
],
[
1319
],
[
1321,
1323
],
[
1325
],
[
1327,
1329
],
[
1331
],
[
1333,
1335
],
[
1337,
1339
],
[
1341
],
[
1343,
1345
],
[
1347
],
[
1349,
1351
],
[
1353
],
[
1355,
1357
],
[
1359,
1361
],
[
1363
],
[
1365,
1367
],
[
1369
],
[
1371,
1373
],
[
1375
],
[
1377,
1379
],
[
1381,
1383
],
[
1385
],
[
1387,
1389
],
[
1391
],
[
1393,
1395,
1397
],
[
1399
],
[
1401,
1403
],
[
1405,
1407
],
[
1409
],
[
1411,
1413
],
[
1415
],
[
1417,
1419
],
[
1421
],
[
1423,
1425
],
[
1427,
1429
],
[
1431
],
[
1433,
1435
],
[
1437
],
[
1439,
1441,
1443
],
[
1445
],
[
1447,
1449
],
[
1451,
1453
],
[
1455
],
[
1457,
1459
],
[
1461
],
[
1463,
1465
],
[
1467,
1469
],
[
1471,
1473
],
[
1475,
1477
],
[
1479,
1481
],
[
1483
],
[
1485,
1487
],
[
1489,
1491
],
[
1493,
1495
],
[
1497,
1499
],
[
1501
],
[
1503,
1505
],
[
1507
],
[
1509,
1511
],
[
1513
],
[
1515,
1517
],
[
1519,
1521
],
[
1523
],
[
1525,
1527
],
[
1529
],
[
1531,
1533
],
[
1535
],
[
1537,
1539
],
[
1541,
1543
],
[
1545
],
[
1547,
1549
],
[
1551
],
[
1553,
1555
],
[
1557
],
[
1559,
1561
],
[
1563,
1565
],
[
1567
],
[
1569,
1571
],
[
1573
],
[
1575,
1577
],
[
1579
],
[
1581,
1583
],
[
1585,
1587
],
[
1589
],
[
1591
],
[
1593
],
[
1595
],
[
1597,
1599
],
[
1601
]
]
|
15,687 | static int vp9_raw_reorder_make_output(AVBSFContext *bsf,
AVPacket *out,
VP9RawReorderFrame *last_frame)
{
VP9RawReorderContext *ctx = bsf->priv_data;
VP9RawReorderFrame *next_output = last_frame,
*next_display = last_frame, *frame;
int s, err;
for (s = 0; s < FRAME_SLOTS; s++) {
frame = ctx->slot[s];
if (!frame)
continue;
if (frame->needs_output && (!next_output ||
frame->sequence < next_output->sequence))
next_output = frame;
if (frame->needs_display && (!next_display ||
frame->pts < next_display->pts))
next_display = frame;
}
if (!next_output && !next_display)
return AVERROR_EOF;
if (!next_display || (next_output &&
next_output->sequence < next_display->sequence))
frame = next_output;
else
frame = next_display;
if (frame->needs_output && frame->needs_display &&
next_output == next_display) {
av_log(bsf, AV_LOG_DEBUG, "Output and display frame "
"%"PRId64" (%"PRId64") in order.\n",
frame->sequence, frame->pts);
av_packet_move_ref(out, frame->packet);
frame->needs_output = frame->needs_display = 0;
} else if (frame->needs_output) {
if (frame->needs_display) {
av_log(bsf, AV_LOG_DEBUG, "Output frame %"PRId64" "
"(%"PRId64") for later display.\n",
frame->sequence, frame->pts);
} else {
av_log(bsf, AV_LOG_DEBUG, "Output unshown frame "
"%"PRId64" (%"PRId64") to keep order.\n",
frame->sequence, frame->pts);
}
av_packet_move_ref(out, frame->packet);
out->pts = out->dts;
frame->needs_output = 0;
} else {
PutBitContext pb;
av_assert0(!frame->needs_output && frame->needs_display);
if (frame->slots == 0) {
av_log(bsf, AV_LOG_ERROR, "Attempting to display frame "
"which is no longer available?\n");
frame->needs_display = 0;
return AVERROR_INVALIDDATA;
}
s = ff_ctz(frame->slots);
av_assert0(s < FRAME_SLOTS);
av_log(bsf, AV_LOG_DEBUG, "Display frame %"PRId64" "
"(%"PRId64") from slot %d.\n",
frame->sequence, frame->pts, s);
frame->packet = av_packet_alloc();
if (!frame->packet)
return AVERROR(ENOMEM);
err = av_new_packet(out, 2);
if (err < 0)
return err;
init_put_bits(&pb, out->data, 2);
// frame_marker
put_bits(&pb, 2, 2);
// profile_low_bit
put_bits(&pb, 1, frame->profile & 1);
// profile_high_bit
put_bits(&pb, 1, (frame->profile >> 1) & 1);
if (frame->profile == 3) {
// reserved_zero
put_bits(&pb, 1, 0);
}
// show_existing_frame
put_bits(&pb, 1, 1);
// frame_to_show_map_idx
put_bits(&pb, 3, s);
while (put_bits_count(&pb) < 16)
put_bits(&pb, 1, 0);
flush_put_bits(&pb);
out->pts = out->dts = frame->pts;
frame->needs_display = 0;
}
return 0;
}
| true | FFmpeg | b43b95f4789b6e60f9684918fd3c0a5f3f18aef6 | static int vp9_raw_reorder_make_output(AVBSFContext *bsf,
AVPacket *out,
VP9RawReorderFrame *last_frame)
{
VP9RawReorderContext *ctx = bsf->priv_data;
VP9RawReorderFrame *next_output = last_frame,
*next_display = last_frame, *frame;
int s, err;
for (s = 0; s < FRAME_SLOTS; s++) {
frame = ctx->slot[s];
if (!frame)
continue;
if (frame->needs_output && (!next_output ||
frame->sequence < next_output->sequence))
next_output = frame;
if (frame->needs_display && (!next_display ||
frame->pts < next_display->pts))
next_display = frame;
}
if (!next_output && !next_display)
return AVERROR_EOF;
if (!next_display || (next_output &&
next_output->sequence < next_display->sequence))
frame = next_output;
else
frame = next_display;
if (frame->needs_output && frame->needs_display &&
next_output == next_display) {
av_log(bsf, AV_LOG_DEBUG, "Output and display frame "
"%"PRId64" (%"PRId64") in order.\n",
frame->sequence, frame->pts);
av_packet_move_ref(out, frame->packet);
frame->needs_output = frame->needs_display = 0;
} else if (frame->needs_output) {
if (frame->needs_display) {
av_log(bsf, AV_LOG_DEBUG, "Output frame %"PRId64" "
"(%"PRId64") for later display.\n",
frame->sequence, frame->pts);
} else {
av_log(bsf, AV_LOG_DEBUG, "Output unshown frame "
"%"PRId64" (%"PRId64") to keep order.\n",
frame->sequence, frame->pts);
}
av_packet_move_ref(out, frame->packet);
out->pts = out->dts;
frame->needs_output = 0;
} else {
PutBitContext pb;
av_assert0(!frame->needs_output && frame->needs_display);
if (frame->slots == 0) {
av_log(bsf, AV_LOG_ERROR, "Attempting to display frame "
"which is no longer available?\n");
frame->needs_display = 0;
return AVERROR_INVALIDDATA;
}
s = ff_ctz(frame->slots);
av_assert0(s < FRAME_SLOTS);
av_log(bsf, AV_LOG_DEBUG, "Display frame %"PRId64" "
"(%"PRId64") from slot %d.\n",
frame->sequence, frame->pts, s);
frame->packet = av_packet_alloc();
if (!frame->packet)
return AVERROR(ENOMEM);
err = av_new_packet(out, 2);
if (err < 0)
return err;
init_put_bits(&pb, out->data, 2);
put_bits(&pb, 2, 2);
put_bits(&pb, 1, frame->profile & 1);
put_bits(&pb, 1, (frame->profile >> 1) & 1);
if (frame->profile == 3) {
put_bits(&pb, 1, 0);
}
put_bits(&pb, 1, 1);
put_bits(&pb, 3, s);
while (put_bits_count(&pb) < 16)
put_bits(&pb, 1, 0);
flush_put_bits(&pb);
out->pts = out->dts = frame->pts;
frame->needs_display = 0;
}
return 0;
}
| {
"code": [
" frame->packet = av_packet_alloc();",
" if (!frame->packet)",
" return AVERROR(ENOMEM);"
],
"line_no": [
147,
149,
151
]
} | static int FUNC_0(AVBSFContext *VAR_0,
AVPacket *VAR_1,
VP9RawReorderFrame *VAR_2)
{
VP9RawReorderContext *ctx = VAR_0->priv_data;
VP9RawReorderFrame *next_output = VAR_2,
*next_display = VAR_2, *frame;
int VAR_3, VAR_4;
for (VAR_3 = 0; VAR_3 < FRAME_SLOTS; VAR_3++) {
frame = ctx->slot[VAR_3];
if (!frame)
continue;
if (frame->needs_output && (!next_output ||
frame->sequence < next_output->sequence))
next_output = frame;
if (frame->needs_display && (!next_display ||
frame->pts < next_display->pts))
next_display = frame;
}
if (!next_output && !next_display)
return AVERROR_EOF;
if (!next_display || (next_output &&
next_output->sequence < next_display->sequence))
frame = next_output;
else
frame = next_display;
if (frame->needs_output && frame->needs_display &&
next_output == next_display) {
av_log(VAR_0, AV_LOG_DEBUG, "Output and display frame "
"%"PRId64" (%"PRId64") in order.\n",
frame->sequence, frame->pts);
av_packet_move_ref(VAR_1, frame->packet);
frame->needs_output = frame->needs_display = 0;
} else if (frame->needs_output) {
if (frame->needs_display) {
av_log(VAR_0, AV_LOG_DEBUG, "Output frame %"PRId64" "
"(%"PRId64") for later display.\n",
frame->sequence, frame->pts);
} else {
av_log(VAR_0, AV_LOG_DEBUG, "Output unshown frame "
"%"PRId64" (%"PRId64") to keep order.\n",
frame->sequence, frame->pts);
}
av_packet_move_ref(VAR_1, frame->packet);
VAR_1->pts = VAR_1->dts;
frame->needs_output = 0;
} else {
PutBitContext pb;
av_assert0(!frame->needs_output && frame->needs_display);
if (frame->slots == 0) {
av_log(VAR_0, AV_LOG_ERROR, "Attempting to display frame "
"which is no longer available?\n");
frame->needs_display = 0;
return AVERROR_INVALIDDATA;
}
VAR_3 = ff_ctz(frame->slots);
av_assert0(VAR_3 < FRAME_SLOTS);
av_log(VAR_0, AV_LOG_DEBUG, "Display frame %"PRId64" "
"(%"PRId64") from slot %d.\n",
frame->sequence, frame->pts, VAR_3);
frame->packet = av_packet_alloc();
if (!frame->packet)
return AVERROR(ENOMEM);
VAR_4 = av_new_packet(VAR_1, 2);
if (VAR_4 < 0)
return VAR_4;
init_put_bits(&pb, VAR_1->data, 2);
put_bits(&pb, 2, 2);
put_bits(&pb, 1, frame->profile & 1);
put_bits(&pb, 1, (frame->profile >> 1) & 1);
if (frame->profile == 3) {
put_bits(&pb, 1, 0);
}
put_bits(&pb, 1, 1);
put_bits(&pb, 3, VAR_3);
while (put_bits_count(&pb) < 16)
put_bits(&pb, 1, 0);
flush_put_bits(&pb);
VAR_1->pts = VAR_1->dts = frame->pts;
frame->needs_display = 0;
}
return 0;
}
| [
"static int FUNC_0(AVBSFContext *VAR_0,\nAVPacket *VAR_1,\nVP9RawReorderFrame *VAR_2)\n{",
"VP9RawReorderContext *ctx = VAR_0->priv_data;",
"VP9RawReorderFrame *next_output = VAR_2,\n*next_display = VAR_2, *frame;",
"int VAR_3, VAR_4;",
"for (VAR_3 = 0; VAR_3 < FRAME_SLOTS; VAR_3++) {",
"frame = ctx->slot[VAR_3];",
"if (!frame)\ncontinue;",
"if (frame->needs_output && (!next_output ||\nframe->sequence < next_output->sequence))\nnext_output = frame;",
"if (frame->needs_display && (!next_display ||\nframe->pts < next_display->pts))\nnext_display = frame;",
"}",
"if (!next_output && !next_display)\nreturn AVERROR_EOF;",
"if (!next_display || (next_output &&\nnext_output->sequence < next_display->sequence))\nframe = next_output;",
"else\nframe = next_display;",
"if (frame->needs_output && frame->needs_display &&\nnext_output == next_display) {",
"av_log(VAR_0, AV_LOG_DEBUG, \"Output and display frame \"\n\"%\"PRId64\" (%\"PRId64\") in order.\\n\",\nframe->sequence, frame->pts);",
"av_packet_move_ref(VAR_1, frame->packet);",
"frame->needs_output = frame->needs_display = 0;",
"} else if (frame->needs_output) {",
"if (frame->needs_display) {",
"av_log(VAR_0, AV_LOG_DEBUG, \"Output frame %\"PRId64\" \"\n\"(%\"PRId64\") for later display.\\n\",\nframe->sequence, frame->pts);",
"} else {",
"av_log(VAR_0, AV_LOG_DEBUG, \"Output unshown frame \"\n\"%\"PRId64\" (%\"PRId64\") to keep order.\\n\",\nframe->sequence, frame->pts);",
"}",
"av_packet_move_ref(VAR_1, frame->packet);",
"VAR_1->pts = VAR_1->dts;",
"frame->needs_output = 0;",
"} else {",
"PutBitContext pb;",
"av_assert0(!frame->needs_output && frame->needs_display);",
"if (frame->slots == 0) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Attempting to display frame \"\n\"which is no longer available?\\n\");",
"frame->needs_display = 0;",
"return AVERROR_INVALIDDATA;",
"}",
"VAR_3 = ff_ctz(frame->slots);",
"av_assert0(VAR_3 < FRAME_SLOTS);",
"av_log(VAR_0, AV_LOG_DEBUG, \"Display frame %\"PRId64\" \"\n\"(%\"PRId64\") from slot %d.\\n\",\nframe->sequence, frame->pts, VAR_3);",
"frame->packet = av_packet_alloc();",
"if (!frame->packet)\nreturn AVERROR(ENOMEM);",
"VAR_4 = av_new_packet(VAR_1, 2);",
"if (VAR_4 < 0)\nreturn VAR_4;",
"init_put_bits(&pb, VAR_1->data, 2);",
"put_bits(&pb, 2, 2);",
"put_bits(&pb, 1, frame->profile & 1);",
"put_bits(&pb, 1, (frame->profile >> 1) & 1);",
"if (frame->profile == 3) {",
"put_bits(&pb, 1, 0);",
"}",
"put_bits(&pb, 1, 1);",
"put_bits(&pb, 3, VAR_3);",
"while (put_bits_count(&pb) < 16)\nput_bits(&pb, 1, 0);",
"flush_put_bits(&pb);",
"VAR_1->pts = VAR_1->dts = frame->pts;",
"frame->needs_display = 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,
1,
1,
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
],
[
43,
45
],
[
49,
51,
53
],
[
55,
57
],
[
61,
63
],
[
65,
67,
69
],
[
73
],
[
77
],
[
79
],
[
81
],
[
83,
85,
87
],
[
89
],
[
91,
93,
95
],
[
97
],
[
101
],
[
103
],
[
107
],
[
109
],
[
111
],
[
115
],
[
119
],
[
121,
123
],
[
125
],
[
127
],
[
129
],
[
133
],
[
135
],
[
139,
141,
143
],
[
147
],
[
149,
151
],
[
155
],
[
157,
159
],
[
163
],
[
169
],
[
173
],
[
177
],
[
179
],
[
183
],
[
185
],
[
189
],
[
193
],
[
197,
199
],
[
203
],
[
205
],
[
209
],
[
211
],
[
215
],
[
217
]
]
|
15,688 | static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
int ecpl, int start_subband, int end_subband,
const uint8_t *default_band_struct,
int *num_bands, uint8_t *band_sizes)
{
int subbnd, bnd, n_subbands, n_bands=0;
uint8_t bnd_sz[22];
uint8_t coded_band_struct[22];
const uint8_t *band_struct;
n_subbands = end_subband - start_subband;
/* decode band structure from bitstream or use default */
if (!eac3 || get_bits1(gbc)) {
for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) {
coded_band_struct[subbnd] = get_bits1(gbc);
}
band_struct = coded_band_struct;
} else if (!blk) {
band_struct = &default_band_struct[start_subband+1];
} else {
/* no change in band structure */
return;
}
/* calculate number of bands and band sizes based on band structure.
note that the first 4 subbands in enhanced coupling span only 6 bins
instead of 12. */
if (num_bands || band_sizes ) {
n_bands = n_subbands;
bnd_sz[0] = ecpl ? 6 : 12;
for (bnd = 0, subbnd = 1; subbnd < n_subbands; subbnd++) {
int subbnd_size = (ecpl && subbnd < 4) ? 6 : 12;
if (band_struct[subbnd - 1]) {
n_bands--;
bnd_sz[bnd] += subbnd_size;
} else {
bnd_sz[++bnd] = subbnd_size;
}
}
}
/* set optional output params */
if (num_bands)
*num_bands = n_bands;
if (band_sizes)
memcpy(band_sizes, bnd_sz, n_bands);
}
| true | FFmpeg | 9351a156de724edb69ba6e1f05884fe806a13a21 | static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
int ecpl, int start_subband, int end_subband,
const uint8_t *default_band_struct,
int *num_bands, uint8_t *band_sizes)
{
int subbnd, bnd, n_subbands, n_bands=0;
uint8_t bnd_sz[22];
uint8_t coded_band_struct[22];
const uint8_t *band_struct;
n_subbands = end_subband - start_subband;
if (!eac3 || get_bits1(gbc)) {
for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) {
coded_band_struct[subbnd] = get_bits1(gbc);
}
band_struct = coded_band_struct;
} else if (!blk) {
band_struct = &default_band_struct[start_subband+1];
} else {
return;
}
if (num_bands || band_sizes ) {
n_bands = n_subbands;
bnd_sz[0] = ecpl ? 6 : 12;
for (bnd = 0, subbnd = 1; subbnd < n_subbands; subbnd++) {
int subbnd_size = (ecpl && subbnd < 4) ? 6 : 12;
if (band_struct[subbnd - 1]) {
n_bands--;
bnd_sz[bnd] += subbnd_size;
} else {
bnd_sz[++bnd] = subbnd_size;
}
}
}
if (num_bands)
*num_bands = n_bands;
if (band_sizes)
memcpy(band_sizes, bnd_sz, n_bands);
}
| {
"code": [
" int *num_bands, uint8_t *band_sizes)",
" uint8_t coded_band_struct[22];",
" const uint8_t *band_struct;",
" coded_band_struct[subbnd] = get_bits1(gbc);",
" band_struct = coded_band_struct;",
" } else if (!blk) {",
" band_struct = &default_band_struct[start_subband+1];",
" } else {"
],
"line_no": [
7,
15,
17,
31,
35,
37,
39,
41
]
} | static void FUNC_0(GetBitContext *VAR_0, int VAR_1, int VAR_2,
int VAR_3, int VAR_4, int VAR_5,
const uint8_t *VAR_6,
int *VAR_7, uint8_t *VAR_8)
{
int VAR_9, VAR_10, VAR_11, VAR_12=0;
uint8_t bnd_sz[22];
uint8_t coded_band_struct[22];
const uint8_t *VAR_13;
VAR_11 = VAR_5 - VAR_4;
if (!VAR_2 || get_bits1(VAR_0)) {
for (VAR_9 = 0; VAR_9 < VAR_11 - 1; VAR_9++) {
coded_band_struct[VAR_9] = get_bits1(VAR_0);
}
VAR_13 = coded_band_struct;
} else if (!VAR_1) {
VAR_13 = &VAR_6[VAR_4+1];
} else {
return;
}
if (VAR_7 || VAR_8 ) {
VAR_12 = VAR_11;
bnd_sz[0] = VAR_3 ? 6 : 12;
for (VAR_10 = 0, VAR_9 = 1; VAR_9 < VAR_11; VAR_9++) {
int VAR_14 = (VAR_3 && VAR_9 < 4) ? 6 : 12;
if (VAR_13[VAR_9 - 1]) {
VAR_12--;
bnd_sz[VAR_10] += VAR_14;
} else {
bnd_sz[++VAR_10] = VAR_14;
}
}
}
if (VAR_7)
*VAR_7 = VAR_12;
if (VAR_8)
memcpy(VAR_8, bnd_sz, VAR_12);
}
| [
"static void FUNC_0(GetBitContext *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int VAR_5,\nconst uint8_t *VAR_6,\nint *VAR_7, uint8_t *VAR_8)\n{",
"int VAR_9, VAR_10, VAR_11, VAR_12=0;",
"uint8_t bnd_sz[22];",
"uint8_t coded_band_struct[22];",
"const uint8_t *VAR_13;",
"VAR_11 = VAR_5 - VAR_4;",
"if (!VAR_2 || get_bits1(VAR_0)) {",
"for (VAR_9 = 0; VAR_9 < VAR_11 - 1; VAR_9++) {",
"coded_band_struct[VAR_9] = get_bits1(VAR_0);",
"}",
"VAR_13 = coded_band_struct;",
"} else if (!VAR_1) {",
"VAR_13 = &VAR_6[VAR_4+1];",
"} else {",
"return;",
"}",
"if (VAR_7 || VAR_8 ) {",
"VAR_12 = VAR_11;",
"bnd_sz[0] = VAR_3 ? 6 : 12;",
"for (VAR_10 = 0, VAR_9 = 1; VAR_9 < VAR_11; VAR_9++) {",
"int VAR_14 = (VAR_3 && VAR_9 < 4) ? 6 : 12;",
"if (VAR_13[VAR_9 - 1]) {",
"VAR_12--;",
"bnd_sz[VAR_10] += VAR_14;",
"} else {",
"bnd_sz[++VAR_10] = VAR_14;",
"}",
"}",
"}",
"if (VAR_7)\n*VAR_7 = VAR_12;",
"if (VAR_8)\nmemcpy(VAR_8, bnd_sz, VAR_12);",
"}"
]
| [
1,
0,
0,
1,
1,
0,
0,
0,
1,
0,
1,
1,
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
],
[
21
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
87,
89
],
[
91,
93
],
[
95
]
]
|
15,689 | static ExitStatus trans_fop_weww_0e(DisasContext *ctx, uint32_t insn,
const DisasInsn *di)
{
unsigned rt = assemble_rt64(insn);
unsigned rb = assemble_rb64(insn);
unsigned ra = assemble_ra64(insn);
return do_fop_weww(ctx, rt, ra, rb, di->f_weww);
}
| true | qemu | eff235eb2bcd7092901f4698a7907e742f3b7f2f | static ExitStatus trans_fop_weww_0e(DisasContext *ctx, uint32_t insn,
const DisasInsn *di)
{
unsigned rt = assemble_rt64(insn);
unsigned rb = assemble_rb64(insn);
unsigned ra = assemble_ra64(insn);
return do_fop_weww(ctx, rt, ra, rb, di->f_weww);
}
| {
"code": [
" return do_fop_weww(ctx, rt, ra, rb, di->f_weww);",
" return do_fop_weww(ctx, rt, ra, rb, di->f_weww);"
],
"line_no": [
13,
13
]
} | static ExitStatus FUNC_0(DisasContext *ctx, uint32_t insn,
const DisasInsn *di)
{
unsigned VAR_0 = assemble_rt64(insn);
unsigned VAR_1 = assemble_rb64(insn);
unsigned VAR_2 = assemble_ra64(insn);
return do_fop_weww(ctx, VAR_0, VAR_2, VAR_1, di->f_weww);
}
| [
"static ExitStatus FUNC_0(DisasContext *ctx, uint32_t insn,\nconst DisasInsn *di)\n{",
"unsigned VAR_0 = assemble_rt64(insn);",
"unsigned VAR_1 = assemble_rb64(insn);",
"unsigned VAR_2 = assemble_ra64(insn);",
"return do_fop_weww(ctx, VAR_0, VAR_2, VAR_1, di->f_weww);",
"}"
]
| [
0,
0,
0,
0,
1,
0
]
| [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
]
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.