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
|
|---|---|---|---|---|---|---|---|---|---|---|
17,333
|
static void test_validate_fail_struct(TestInputVisitorData *data,
const void *unused)
{
TestStruct *p = NULL;
Error *err = NULL;
Visitor *v;
v = validate_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo', 'extra': 42 }");
visit_type_TestStruct(v, &p, NULL, &err);
g_assert(err);
error_free(err);
if (p) {
g_free(p->string);
}
g_free(p);
}
| true
|
qemu
|
a12a5a1a0132527afe87c079e4aae4aad372bd94
|
static void test_validate_fail_struct(TestInputVisitorData *data,
const void *unused)
{
TestStruct *p = NULL;
Error *err = NULL;
Visitor *v;
v = validate_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo', 'extra': 42 }");
visit_type_TestStruct(v, &p, NULL, &err);
g_assert(err);
error_free(err);
if (p) {
g_free(p->string);
}
g_free(p);
}
|
{
"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": [
23,
21,
23,
21,
23,
21,
23,
21,
23,
21,
23,
21,
23,
21,
23,
21,
23,
21,
23,
21,
23,
21,
23,
21,
23,
21,
23,
21,
23
]
}
|
static void FUNC_0(TestInputVisitorData *VAR_0,
const void *VAR_1)
{
TestStruct *p = NULL;
Error *err = NULL;
Visitor *v;
v = validate_test_init(VAR_0, "{ 'integer': -42, 'boolean': true, 'string': 'foo', 'extra': 42 }");
visit_type_TestStruct(v, &p, NULL, &err);
g_assert(err);
error_free(err);
if (p) {
g_free(p->string);
}
g_free(p);
}
|
[
"static void FUNC_0(TestInputVisitorData *VAR_0,\nconst void *VAR_1)\n{",
"TestStruct *p = NULL;",
"Error *err = NULL;",
"Visitor *v;",
"v = validate_test_init(VAR_0, \"{ 'integer': -42, 'boolean': true, 'string': 'foo', 'extra': 42 }\");",
"visit_type_TestStruct(v, &p, NULL, &err);",
"g_assert(err);",
"error_free(err);",
"if (p) {",
"g_free(p->string);",
"}",
"g_free(p);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
]
] |
17,334
|
static int dv_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
unsigned state;
RawDVContext *c = s->priv_data;
c->dv_demux = dv_init_demux(s);
if (!c->dv_demux)
return -1;
state = get_be32(s->pb);
while ((state & 0xffffff7f) != 0x1f07003f) {
if (url_feof(s->pb)) {
av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");
return -1;
}
state = (state << 8) | get_byte(s->pb);
}
AV_WB32(c->buf, state);
if (get_buffer(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||
url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
return AVERROR(EIO);
c->dv_demux->sys = dv_frame_profile(c->buf);
if (!c->dv_demux->sys) {
av_log(s, AV_LOG_ERROR, "Can't determine profile of DV input stream.\n");
return -1;
}
s->bit_rate = av_rescale_q(c->dv_demux->sys->frame_size, (AVRational){8,1},
c->dv_demux->sys->time_base);
return 0;
}
| true
|
FFmpeg
|
d509c743b78da198af385fea362b632292cd00ad
|
static int dv_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
unsigned state;
RawDVContext *c = s->priv_data;
c->dv_demux = dv_init_demux(s);
if (!c->dv_demux)
return -1;
state = get_be32(s->pb);
while ((state & 0xffffff7f) != 0x1f07003f) {
if (url_feof(s->pb)) {
av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");
return -1;
}
state = (state << 8) | get_byte(s->pb);
}
AV_WB32(c->buf, state);
if (get_buffer(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||
url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
return AVERROR(EIO);
c->dv_demux->sys = dv_frame_profile(c->buf);
if (!c->dv_demux->sys) {
av_log(s, AV_LOG_ERROR, "Can't determine profile of DV input stream.\n");
return -1;
}
s->bit_rate = av_rescale_q(c->dv_demux->sys->frame_size, (AVRational){8,1},
c->dv_demux->sys->time_base);
return 0;
}
|
{
"code": [
" c->dv_demux->sys = dv_frame_profile(c->buf);"
],
"line_no": [
49
]
}
|
static int FUNC_0(AVFormatContext *VAR_0,
AVFormatParameters *VAR_1)
{
unsigned VAR_2;
RawDVContext *c = VAR_0->priv_data;
c->dv_demux = dv_init_demux(VAR_0);
if (!c->dv_demux)
return -1;
VAR_2 = get_be32(VAR_0->pb);
while ((VAR_2 & 0xffffff7f) != 0x1f07003f) {
if (url_feof(VAR_0->pb)) {
av_log(VAR_0, AV_LOG_ERROR, "Cannot find DV header.\n");
return -1;
}
VAR_2 = (VAR_2 << 8) | get_byte(VAR_0->pb);
}
AV_WB32(c->buf, VAR_2);
if (get_buffer(VAR_0->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||
url_fseek(VAR_0->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
return AVERROR(EIO);
c->dv_demux->sys = dv_frame_profile(c->buf);
if (!c->dv_demux->sys) {
av_log(VAR_0, AV_LOG_ERROR, "Can't determine profile of DV input stream.\n");
return -1;
}
VAR_0->bit_rate = av_rescale_q(c->dv_demux->sys->frame_size, (AVRational){8,1},
c->dv_demux->sys->time_base);
return 0;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0,\nAVFormatParameters *VAR_1)\n{",
"unsigned VAR_2;",
"RawDVContext *c = VAR_0->priv_data;",
"c->dv_demux = dv_init_demux(VAR_0);",
"if (!c->dv_demux)\nreturn -1;",
"VAR_2 = get_be32(VAR_0->pb);",
"while ((VAR_2 & 0xffffff7f) != 0x1f07003f) {",
"if (url_feof(VAR_0->pb)) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Cannot find DV header.\\n\");",
"return -1;",
"}",
"VAR_2 = (VAR_2 << 8) | get_byte(VAR_0->pb);",
"}",
"AV_WB32(c->buf, VAR_2);",
"if (get_buffer(VAR_0->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||\nurl_fseek(VAR_0->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)\nreturn AVERROR(EIO);",
"c->dv_demux->sys = dv_frame_profile(c->buf);",
"if (!c->dv_demux->sys) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Can't determine profile of DV input stream.\\n\");",
"return -1;",
"}",
"VAR_0->bit_rate = av_rescale_q(c->dv_demux->sys->frame_size, (AVRational){8,1},",
"c->dv_demux->sys->time_base);",
"return 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
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41,
43,
45
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
67
],
[
69
]
] |
17,335
|
int ff_mjpeg_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
MJpegDecodeContext *s = avctx->priv_data;
const uint8_t *buf_end, *buf_ptr;
int start_code;
AVFrame *picture = data;
s->got_picture = 0; // picture from previous image can not be reused
buf_ptr = buf;
buf_end = buf + buf_size;
while (buf_ptr < buf_end) {
/* find start next marker */
start_code = find_marker(&buf_ptr, buf_end);
{
/* EOF */
if (start_code < 0) {
goto the_end;
} else {
av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n", start_code, buf_end - buf_ptr);
if ((buf_end - buf_ptr) > s->buffer_size)
{
av_free(s->buffer);
s->buffer_size = buf_end-buf_ptr;
s->buffer = av_malloc(s->buffer_size + FF_INPUT_BUFFER_PADDING_SIZE);
av_log(avctx, AV_LOG_DEBUG, "buffer too small, expanding to %d bytes\n",
s->buffer_size);
/* unescape buffer of SOS, use special treatment for JPEG-LS */
if (start_code == SOS && !s->ls)
{
const uint8_t *src = buf_ptr;
uint8_t *dst = s->buffer;
while (src<buf_end)
{
uint8_t x = *(src++);
*(dst++) = x;
if (avctx->codec_id != CODEC_ID_THP)
{
if (x == 0xff) {
while (src < buf_end && x == 0xff)
x = *(src++);
if (x >= 0xd0 && x <= 0xd7)
*(dst++) = x;
else if (x)
init_get_bits(&s->gb, s->buffer, (dst - s->buffer)*8);
av_log(avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n",
(buf_end - buf_ptr) - (dst - s->buffer));
else if(start_code == SOS && s->ls){
const uint8_t *src = buf_ptr;
uint8_t *dst = s->buffer;
int bit_count = 0;
int t = 0, b = 0;
PutBitContext pb;
s->cur_scan++;
/* find marker */
while (src + t < buf_end){
uint8_t x = src[t++];
if (x == 0xff){
while((src + t < buf_end) && x == 0xff)
x = src[t++];
if (x & 0x80) {
t -= 2;
bit_count = t * 8;
init_put_bits(&pb, dst, t);
/* unescape bitstream */
while(b < t){
uint8_t x = src[b++];
put_bits(&pb, 8, x);
if(x == 0xFF){
x = src[b++];
put_bits(&pb, 7, x);
bit_count--;
flush_put_bits(&pb);
init_get_bits(&s->gb, dst, bit_count);
else
init_get_bits(&s->gb, buf_ptr, (buf_end - buf_ptr)*8);
s->start_code = start_code;
if(s->avctx->debug & FF_DEBUG_STARTCODE){
av_log(avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code);
/* process markers */
if (start_code >= 0xd0 && start_code <= 0xd7) {
av_log(avctx, AV_LOG_DEBUG, "restart marker: %d\n", start_code&0x0f);
/* APP fields */
} else if (start_code >= APP0 && start_code <= APP15) {
mjpeg_decode_app(s);
/* Comment */
} else if (start_code == COM){
mjpeg_decode_com(s);
switch(start_code) {
case SOI:
s->restart_interval = 0;
s->restart_count = 0;
/* nothing to do on SOI */
case DQT:
ff_mjpeg_decode_dqt(s);
case DHT:
if(ff_mjpeg_decode_dht(s) < 0){
av_log(avctx, AV_LOG_ERROR, "huffman table decode error\n");
return -1;
case SOF0:
s->lossless=0;
s->ls=0;
s->progressive=0;
if (ff_mjpeg_decode_sof(s) < 0)
return -1;
case SOF2:
s->lossless=0;
s->ls=0;
s->progressive=1;
if (ff_mjpeg_decode_sof(s) < 0)
return -1;
case SOF3:
s->lossless=1;
s->ls=0;
s->progressive=0;
if (ff_mjpeg_decode_sof(s) < 0)
return -1;
case SOF48:
s->lossless=1;
s->ls=1;
s->progressive=0;
if (ff_mjpeg_decode_sof(s) < 0)
return -1;
case LSE:
if (!CONFIG_JPEGLS_DECODER || ff_jpegls_decode_lse(s) < 0)
return -1;
case EOI:
s->cur_scan = 0;
if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
eoi_parser:
av_log(avctx, AV_LOG_WARNING, "Found EOI before any SOF, ignoring\n");
{
if (s->interlaced) {
s->bottom_field ^= 1;
/* if not bottom field, do not output image yet */
if (s->bottom_field == !s->interlace_polarity)
goto not_the_end;
*picture = s->picture;
*data_size = sizeof(AVFrame);
if(!s->lossless){
picture->quality= FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]);
picture->qstride= 0;
picture->qscale_table= s->qscale_table;
memset(picture->qscale_table, picture->quality, (s->width+15)/16);
if(avctx->debug & FF_DEBUG_QP)
av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", picture->quality);
picture->quality*= FF_QP2LAMBDA;
goto the_end;
case SOS:
ff_mjpeg_decode_sos(s);
/* buggy avid puts EOI every 10-20th frame */
/* if restart period is over process EOI */
if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
goto eoi_parser;
case DRI:
mjpeg_decode_dri(s);
case SOF1:
case SOF5:
case SOF6:
case SOF7:
case SOF9:
case SOF10:
case SOF11:
case SOF13:
case SOF14:
case SOF15:
case JPG:
av_log(avctx, AV_LOG_ERROR, "mjpeg: unsupported coding type (%x)\n", start_code);
// default:
// printf("mjpeg: unsupported marker (%x)\n", start_code);
// break;
not_the_end:
/* eof process start code */
buf_ptr += (get_bits_count(&s->gb)+7)/8;
av_log(avctx, AV_LOG_DEBUG, "marker parser used %d bytes (%d bits)\n",
(get_bits_count(&s->gb)+7)/8, get_bits_count(&s->gb));
the_end:
av_log(avctx, AV_LOG_DEBUG, "mjpeg decode frame unused %td bytes\n", buf_end - buf_ptr);
// return buf_end - buf_ptr;
return buf_ptr - buf;
| true
|
FFmpeg
|
643fd8a198ddb67225f5edd503f8f151d13635a3
|
int ff_mjpeg_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
MJpegDecodeContext *s = avctx->priv_data;
const uint8_t *buf_end, *buf_ptr;
int start_code;
AVFrame *picture = data;
s->got_picture = 0;
buf_ptr = buf;
buf_end = buf + buf_size;
while (buf_ptr < buf_end) {
start_code = find_marker(&buf_ptr, buf_end);
{
if (start_code < 0) {
goto the_end;
} else {
av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n", start_code, buf_end - buf_ptr);
if ((buf_end - buf_ptr) > s->buffer_size)
{
av_free(s->buffer);
s->buffer_size = buf_end-buf_ptr;
s->buffer = av_malloc(s->buffer_size + FF_INPUT_BUFFER_PADDING_SIZE);
av_log(avctx, AV_LOG_DEBUG, "buffer too small, expanding to %d bytes\n",
s->buffer_size);
if (start_code == SOS && !s->ls)
{
const uint8_t *src = buf_ptr;
uint8_t *dst = s->buffer;
while (src<buf_end)
{
uint8_t x = *(src++);
*(dst++) = x;
if (avctx->codec_id != CODEC_ID_THP)
{
if (x == 0xff) {
while (src < buf_end && x == 0xff)
x = *(src++);
if (x >= 0xd0 && x <= 0xd7)
*(dst++) = x;
else if (x)
init_get_bits(&s->gb, s->buffer, (dst - s->buffer)*8);
av_log(avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n",
(buf_end - buf_ptr) - (dst - s->buffer));
else if(start_code == SOS && s->ls){
const uint8_t *src = buf_ptr;
uint8_t *dst = s->buffer;
int bit_count = 0;
int t = 0, b = 0;
PutBitContext pb;
s->cur_scan++;
while (src + t < buf_end){
uint8_t x = src[t++];
if (x == 0xff){
while((src + t < buf_end) && x == 0xff)
x = src[t++];
if (x & 0x80) {
t -= 2;
bit_count = t * 8;
init_put_bits(&pb, dst, t);
while(b < t){
uint8_t x = src[b++];
put_bits(&pb, 8, x);
if(x == 0xFF){
x = src[b++];
put_bits(&pb, 7, x);
bit_count--;
flush_put_bits(&pb);
init_get_bits(&s->gb, dst, bit_count);
else
init_get_bits(&s->gb, buf_ptr, (buf_end - buf_ptr)*8);
s->start_code = start_code;
if(s->avctx->debug & FF_DEBUG_STARTCODE){
av_log(avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code);
if (start_code >= 0xd0 && start_code <= 0xd7) {
av_log(avctx, AV_LOG_DEBUG, "restart marker: %d\n", start_code&0x0f);
} else if (start_code >= APP0 && start_code <= APP15) {
mjpeg_decode_app(s);
} else if (start_code == COM){
mjpeg_decode_com(s);
switch(start_code) {
case SOI:
s->restart_interval = 0;
s->restart_count = 0;
case DQT:
ff_mjpeg_decode_dqt(s);
case DHT:
if(ff_mjpeg_decode_dht(s) < 0){
av_log(avctx, AV_LOG_ERROR, "huffman table decode error\n");
return -1;
case SOF0:
s->lossless=0;
s->ls=0;
s->progressive=0;
if (ff_mjpeg_decode_sof(s) < 0)
return -1;
case SOF2:
s->lossless=0;
s->ls=0;
s->progressive=1;
if (ff_mjpeg_decode_sof(s) < 0)
return -1;
case SOF3:
s->lossless=1;
s->ls=0;
s->progressive=0;
if (ff_mjpeg_decode_sof(s) < 0)
return -1;
case SOF48:
s->lossless=1;
s->ls=1;
s->progressive=0;
if (ff_mjpeg_decode_sof(s) < 0)
return -1;
case LSE:
if (!CONFIG_JPEGLS_DECODER || ff_jpegls_decode_lse(s) < 0)
return -1;
case EOI:
s->cur_scan = 0;
if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
eoi_parser:
av_log(avctx, AV_LOG_WARNING, "Found EOI before any SOF, ignoring\n");
{
if (s->interlaced) {
s->bottom_field ^= 1;
if (s->bottom_field == !s->interlace_polarity)
goto not_the_end;
*picture = s->picture;
*data_size = sizeof(AVFrame);
if(!s->lossless){
picture->quality= FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]);
picture->qstride= 0;
picture->qscale_table= s->qscale_table;
memset(picture->qscale_table, picture->quality, (s->width+15)/16);
if(avctx->debug & FF_DEBUG_QP)
av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", picture->quality);
picture->quality*= FF_QP2LAMBDA;
goto the_end;
case SOS:
ff_mjpeg_decode_sos(s);
if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
goto eoi_parser;
case DRI:
mjpeg_decode_dri(s);
case SOF1:
case SOF5:
case SOF6:
case SOF7:
case SOF9:
case SOF10:
case SOF11:
case SOF13:
case SOF14:
case SOF15:
case JPG:
av_log(avctx, AV_LOG_ERROR, "mjpeg: unsupported coding type (%x)\n", start_code);
not_the_end:
buf_ptr += (get_bits_count(&s->gb)+7)/8;
av_log(avctx, AV_LOG_DEBUG, "marker parser used %d bytes (%d bits)\n",
(get_bits_count(&s->gb)+7)/8, get_bits_count(&s->gb));
the_end:
av_log(avctx, AV_LOG_DEBUG, "mjpeg decode frame unused %td bytes\n", buf_end - buf_ptr);
return buf_ptr - buf;
|
{
"code": [],
"line_no": []
}
|
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;
MJpegDecodeContext *s = VAR_0->priv_data;
const uint8_t *VAR_6, *buf_ptr;
int VAR_7;
AVFrame *picture = VAR_1;
s->got_picture = 0;
buf_ptr = VAR_4;
VAR_6 = VAR_4 + VAR_5;
while (buf_ptr < VAR_6) {
VAR_7 = find_marker(&buf_ptr, VAR_6);
{
if (VAR_7 < 0) {
goto the_end;
} else {
av_log(VAR_0, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n", VAR_7, VAR_6 - buf_ptr);
if ((VAR_6 - buf_ptr) > s->buffer_size)
{
av_free(s->buffer);
s->buffer_size = VAR_6-buf_ptr;
s->buffer = av_malloc(s->buffer_size + FF_INPUT_BUFFER_PADDING_SIZE);
av_log(VAR_0, AV_LOG_DEBUG, "buffer too small, expanding to %d bytes\n",
s->buffer_size);
if (VAR_7 == SOS && !s->ls)
{
const uint8_t *VAR_8 = buf_ptr;
uint8_t *dst = s->buffer;
while (VAR_8<VAR_6)
{
uint8_t x = *(VAR_8++);
*(dst++) = x;
if (VAR_0->codec_id != CODEC_ID_THP)
{
if (x == 0xff) {
while (VAR_8 < VAR_6 && x == 0xff)
x = *(VAR_8++);
if (x >= 0xd0 && x <= 0xd7)
*(dst++) = x;
else if (x)
init_get_bits(&s->gb, s->buffer, (dst - s->buffer)*8);
av_log(VAR_0, AV_LOG_DEBUG, "escaping removed %td bytes\n",
(VAR_6 - buf_ptr) - (dst - s->buffer));
else if(VAR_7 == SOS && s->ls){
const uint8_t *VAR_8 = buf_ptr;
uint8_t *dst = s->buffer;
int bit_count = 0;
int t = 0, b = 0;
PutBitContext pb;
s->cur_scan++;
while (VAR_8 + t < VAR_6){
uint8_t x = VAR_8[t++];
if (x == 0xff){
while((VAR_8 + t < VAR_6) && x == 0xff)
x = VAR_8[t++];
if (x & 0x80) {
t -= 2;
bit_count = t * 8;
init_put_bits(&pb, dst, t);
while(b < t){
uint8_t x = VAR_8[b++];
put_bits(&pb, 8, x);
if(x == 0xFF){
x = VAR_8[b++];
put_bits(&pb, 7, x);
bit_count--;
flush_put_bits(&pb);
init_get_bits(&s->gb, dst, bit_count);
else
init_get_bits(&s->gb, buf_ptr, (VAR_6 - buf_ptr)*8);
s->VAR_7 = VAR_7;
if(s->VAR_0->debug & FF_DEBUG_STARTCODE){
av_log(VAR_0, AV_LOG_DEBUG, "startcode: %X\n", VAR_7);
if (VAR_7 >= 0xd0 && VAR_7 <= 0xd7) {
av_log(VAR_0, AV_LOG_DEBUG, "restart marker: %d\n", VAR_7&0x0f);
} else if (VAR_7 >= APP0 && VAR_7 <= APP15) {
mjpeg_decode_app(s);
} else if (VAR_7 == COM){
mjpeg_decode_com(s);
switch(VAR_7) {
case SOI:
s->restart_interval = 0;
s->restart_count = 0;
case DQT:
ff_mjpeg_decode_dqt(s);
case DHT:
if(ff_mjpeg_decode_dht(s) < 0){
av_log(VAR_0, AV_LOG_ERROR, "huffman table decode error\n");
return -1;
case SOF0:
s->lossless=0;
s->ls=0;
s->progressive=0;
if (ff_mjpeg_decode_sof(s) < 0)
return -1;
case SOF2:
s->lossless=0;
s->ls=0;
s->progressive=1;
if (ff_mjpeg_decode_sof(s) < 0)
return -1;
case SOF3:
s->lossless=1;
s->ls=0;
s->progressive=0;
if (ff_mjpeg_decode_sof(s) < 0)
return -1;
case SOF48:
s->lossless=1;
s->ls=1;
s->progressive=0;
if (ff_mjpeg_decode_sof(s) < 0)
return -1;
case LSE:
if (!CONFIG_JPEGLS_DECODER || ff_jpegls_decode_lse(s) < 0)
return -1;
case EOI:
s->cur_scan = 0;
if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
eoi_parser:
av_log(VAR_0, AV_LOG_WARNING, "Found EOI before any SOF, ignoring\n");
{
if (s->interlaced) {
s->bottom_field ^= 1;
if (s->bottom_field == !s->interlace_polarity)
goto not_the_end;
*picture = s->picture;
*VAR_2 = sizeof(AVFrame);
if(!s->lossless){
picture->quality= FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]);
picture->qstride= 0;
picture->qscale_table= s->qscale_table;
memset(picture->qscale_table, picture->quality, (s->width+15)/16);
if(VAR_0->debug & FF_DEBUG_QP)
av_log(VAR_0, AV_LOG_DEBUG, "QP: %d\n", picture->quality);
picture->quality*= FF_QP2LAMBDA;
goto the_end;
case SOS:
ff_mjpeg_decode_sos(s);
if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
goto eoi_parser;
case DRI:
mjpeg_decode_dri(s);
case SOF1:
case SOF5:
case SOF6:
case SOF7:
case SOF9:
case SOF10:
case SOF11:
case SOF13:
case SOF14:
case SOF15:
case JPG:
av_log(VAR_0, AV_LOG_ERROR, "mjpeg: unsupported coding type (%x)\n", VAR_7);
not_the_end:
buf_ptr += (get_bits_count(&s->gb)+7)/8;
av_log(VAR_0, AV_LOG_DEBUG, "marker parser used %d bytes (%d bits)\n",
(get_bits_count(&s->gb)+7)/8, get_bits_count(&s->gb));
the_end:
av_log(VAR_0, AV_LOG_DEBUG, "mjpeg decode frame unused %td bytes\n", VAR_6 - buf_ptr);
return buf_ptr - VAR_4;
|
[
"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;",
"MJpegDecodeContext *s = VAR_0->priv_data;",
"const uint8_t *VAR_6, *buf_ptr;",
"int VAR_7;",
"AVFrame *picture = VAR_1;",
"s->got_picture = 0;",
"buf_ptr = VAR_4;",
"VAR_6 = VAR_4 + VAR_5;",
"while (buf_ptr < VAR_6) {",
"VAR_7 = find_marker(&buf_ptr, VAR_6);",
"{",
"if (VAR_7 < 0) {",
"goto the_end;",
"} else {",
"av_log(VAR_0, AV_LOG_DEBUG, \"marker=%x avail_size_in_buf=%td\\n\", VAR_7, VAR_6 - buf_ptr);",
"if ((VAR_6 - buf_ptr) > s->buffer_size)\n{",
"av_free(s->buffer);",
"s->buffer_size = VAR_6-buf_ptr;",
"s->buffer = av_malloc(s->buffer_size + FF_INPUT_BUFFER_PADDING_SIZE);",
"av_log(VAR_0, AV_LOG_DEBUG, \"buffer too small, expanding to %d bytes\\n\",\ns->buffer_size);",
"if (VAR_7 == SOS && !s->ls)\n{",
"const uint8_t *VAR_8 = buf_ptr;",
"uint8_t *dst = s->buffer;",
"while (VAR_8<VAR_6)\n{",
"uint8_t x = *(VAR_8++);",
"*(dst++) = x;",
"if (VAR_0->codec_id != CODEC_ID_THP)\n{",
"if (x == 0xff) {",
"while (VAR_8 < VAR_6 && x == 0xff)\nx = *(VAR_8++);",
"if (x >= 0xd0 && x <= 0xd7)\n*(dst++) = x;",
"else if (x)\ninit_get_bits(&s->gb, s->buffer, (dst - s->buffer)*8);",
"av_log(VAR_0, AV_LOG_DEBUG, \"escaping removed %td bytes\\n\",\n(VAR_6 - buf_ptr) - (dst - s->buffer));",
"else if(VAR_7 == SOS && s->ls){",
"const uint8_t *VAR_8 = buf_ptr;",
"uint8_t *dst = s->buffer;",
"int bit_count = 0;",
"int t = 0, b = 0;",
"PutBitContext pb;",
"s->cur_scan++;",
"while (VAR_8 + t < VAR_6){",
"uint8_t x = VAR_8[t++];",
"if (x == 0xff){",
"while((VAR_8 + t < VAR_6) && x == 0xff)\nx = VAR_8[t++];",
"if (x & 0x80) {",
"t -= 2;",
"bit_count = t * 8;",
"init_put_bits(&pb, dst, t);",
"while(b < t){",
"uint8_t x = VAR_8[b++];",
"put_bits(&pb, 8, x);",
"if(x == 0xFF){",
"x = VAR_8[b++];",
"put_bits(&pb, 7, x);",
"bit_count--;",
"flush_put_bits(&pb);",
"init_get_bits(&s->gb, dst, bit_count);",
"else\ninit_get_bits(&s->gb, buf_ptr, (VAR_6 - buf_ptr)*8);",
"s->VAR_7 = VAR_7;",
"if(s->VAR_0->debug & FF_DEBUG_STARTCODE){",
"av_log(VAR_0, AV_LOG_DEBUG, \"startcode: %X\\n\", VAR_7);",
"if (VAR_7 >= 0xd0 && VAR_7 <= 0xd7) {",
"av_log(VAR_0, AV_LOG_DEBUG, \"restart marker: %d\\n\", VAR_7&0x0f);",
"} else if (VAR_7 >= APP0 && VAR_7 <= APP15) {",
"mjpeg_decode_app(s);",
"} else if (VAR_7 == COM){",
"mjpeg_decode_com(s);",
"switch(VAR_7) {",
"case SOI:\ns->restart_interval = 0;",
"s->restart_count = 0;",
"case DQT:\nff_mjpeg_decode_dqt(s);",
"case DHT:\nif(ff_mjpeg_decode_dht(s) < 0){",
"av_log(VAR_0, AV_LOG_ERROR, \"huffman table decode error\\n\");",
"return -1;",
"case SOF0:\ns->lossless=0;",
"s->ls=0;",
"s->progressive=0;",
"if (ff_mjpeg_decode_sof(s) < 0)\nreturn -1;",
"case SOF2:\ns->lossless=0;",
"s->ls=0;",
"s->progressive=1;",
"if (ff_mjpeg_decode_sof(s) < 0)\nreturn -1;",
"case SOF3:\ns->lossless=1;",
"s->ls=0;",
"s->progressive=0;",
"if (ff_mjpeg_decode_sof(s) < 0)\nreturn -1;",
"case SOF48:\ns->lossless=1;",
"s->ls=1;",
"s->progressive=0;",
"if (ff_mjpeg_decode_sof(s) < 0)\nreturn -1;",
"case LSE:\nif (!CONFIG_JPEGLS_DECODER || ff_jpegls_decode_lse(s) < 0)\nreturn -1;",
"case EOI:\ns->cur_scan = 0;",
"if ((s->buggy_avid && !s->interlaced) || s->restart_interval)\neoi_parser:\nav_log(VAR_0, AV_LOG_WARNING, \"Found EOI before any SOF, ignoring\\n\");",
"{",
"if (s->interlaced) {",
"s->bottom_field ^= 1;",
"if (s->bottom_field == !s->interlace_polarity)\ngoto not_the_end;",
"*picture = s->picture;",
"*VAR_2 = sizeof(AVFrame);",
"if(!s->lossless){",
"picture->quality= FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]);",
"picture->qstride= 0;",
"picture->qscale_table= s->qscale_table;",
"memset(picture->qscale_table, picture->quality, (s->width+15)/16);",
"if(VAR_0->debug & FF_DEBUG_QP)\nav_log(VAR_0, AV_LOG_DEBUG, \"QP: %d\\n\", picture->quality);",
"picture->quality*= FF_QP2LAMBDA;",
"goto the_end;",
"case SOS:\nff_mjpeg_decode_sos(s);",
"if ((s->buggy_avid && !s->interlaced) || s->restart_interval)\ngoto eoi_parser;",
"case DRI:\nmjpeg_decode_dri(s);",
"case SOF1:\ncase SOF5:\ncase SOF6:\ncase SOF7:\ncase SOF9:\ncase SOF10:\ncase SOF11:\ncase SOF13:\ncase SOF14:\ncase SOF15:\ncase JPG:\nav_log(VAR_0, AV_LOG_ERROR, \"mjpeg: unsupported coding type (%x)\\n\", VAR_7);",
"not_the_end:\nbuf_ptr += (get_bits_count(&s->gb)+7)/8;",
"av_log(VAR_0, AV_LOG_DEBUG, \"marker parser used %d bytes (%d bits)\\n\",\n(get_bits_count(&s->gb)+7)/8, get_bits_count(&s->gb));",
"the_end:\nav_log(VAR_0, AV_LOG_DEBUG, \"mjpeg decode frame unused %td bytes\\n\", VAR_6 - buf_ptr);",
"return buf_ptr - VAR_4;"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
59,
61
],
[
68,
70
],
[
72
],
[
74
],
[
78,
80
],
[
82
],
[
86
],
[
88,
90
],
[
92
],
[
94,
96
],
[
100,
102
],
[
104,
110
],
[
114,
116
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
133
],
[
139
],
[
141
],
[
143
],
[
145,
147
],
[
149
],
[
151
],
[
157
],
[
161
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
183
],
[
187
],
[
190,
192
],
[
196
],
[
198
],
[
200
],
[
207
],
[
209
],
[
213
],
[
215
],
[
219
],
[
221
],
[
226
],
[
228,
230
],
[
234
],
[
239,
241
],
[
244,
246
],
[
248
],
[
250
],
[
254,
256
],
[
258
],
[
260
],
[
262,
264
],
[
267,
269
],
[
271
],
[
273
],
[
275,
277
],
[
280,
282
],
[
284
],
[
286
],
[
288,
290
],
[
293,
295
],
[
297
],
[
299
],
[
301,
303
],
[
306,
308,
310
],
[
313,
315
],
[
317,
320,
323
],
[
327
],
[
329
],
[
331
],
[
335,
337
],
[
340
],
[
342
],
[
346
],
[
348
],
[
350
],
[
352
],
[
354
],
[
356,
358
],
[
360
],
[
365
],
[
369,
375
],
[
381,
383
],
[
386,
388
],
[
391,
393,
395,
397,
399,
401,
403,
405,
407,
409,
411,
413
],
[
425,
429
],
[
431,
433
],
[
438,
440
],
[
444
]
] |
17,339
|
static int raw_write(BlockDriverState *bs, int64_t sector_num,
const uint8_t *buf, int nb_sectors)
{
if (check_write_unsafe(bs, sector_num, buf, nb_sectors)) {
int ret;
ret = raw_write_scrubbed_bootsect(bs, buf);
if (ret < 0) {
return ret;
}
ret = bdrv_write(bs->file, 1, buf + 512, nb_sectors - 1);
if (ret < 0) {
return ret;
}
return ret + 512;
}
return bdrv_write(bs->file, sector_num, buf, nb_sectors);
}
| true
|
qemu
|
8b33d9eeba91422ee2d73b6936ad57262d18cf5a
|
static int raw_write(BlockDriverState *bs, int64_t sector_num,
const uint8_t *buf, int nb_sectors)
{
if (check_write_unsafe(bs, sector_num, buf, nb_sectors)) {
int ret;
ret = raw_write_scrubbed_bootsect(bs, buf);
if (ret < 0) {
return ret;
}
ret = bdrv_write(bs->file, 1, buf + 512, nb_sectors - 1);
if (ret < 0) {
return ret;
}
return ret + 512;
}
return bdrv_write(bs->file, sector_num, buf, nb_sectors);
}
|
{
"code": [
" if (check_write_unsafe(bs, sector_num, buf, nb_sectors)) {",
" int ret;",
" ret = raw_write_scrubbed_bootsect(bs, buf);",
" if (ret < 0) {",
" return ret;",
" ret = bdrv_write(bs->file, 1, buf + 512, nb_sectors - 1);",
" if (ret < 0) {",
" return ret;",
" return ret + 512;",
" int ret;",
" if (ret < 0) {"
],
"line_no": [
7,
9,
13,
15,
17,
23,
15,
17,
33,
9,
15
]
}
|
static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,
const uint8_t *VAR_2, int VAR_3)
{
if (check_write_unsafe(VAR_0, VAR_1, VAR_2, VAR_3)) {
int VAR_4;
VAR_4 = raw_write_scrubbed_bootsect(VAR_0, VAR_2);
if (VAR_4 < 0) {
return VAR_4;
}
VAR_4 = bdrv_write(VAR_0->file, 1, VAR_2 + 512, VAR_3 - 1);
if (VAR_4 < 0) {
return VAR_4;
}
return VAR_4 + 512;
}
return bdrv_write(VAR_0->file, VAR_1, VAR_2, VAR_3);
}
|
[
"static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nconst uint8_t *VAR_2, int VAR_3)\n{",
"if (check_write_unsafe(VAR_0, VAR_1, VAR_2, VAR_3)) {",
"int VAR_4;",
"VAR_4 = raw_write_scrubbed_bootsect(VAR_0, VAR_2);",
"if (VAR_4 < 0) {",
"return VAR_4;",
"}",
"VAR_4 = bdrv_write(VAR_0->file, 1, VAR_2 + 512, VAR_3 - 1);",
"if (VAR_4 < 0) {",
"return VAR_4;",
"}",
"return VAR_4 + 512;",
"}",
"return bdrv_write(VAR_0->file, VAR_1, VAR_2, VAR_3);",
"}"
] |
[
0,
1,
1,
1,
1,
1,
0,
1,
0,
0,
0,
1,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
39
],
[
41
]
] |
17,340
|
void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4],
const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component)
{
AVComponentDescriptor comp= desc->comp[c];
int plane= comp.plane;
int depth= comp.depth_minus1+1;
int mask = (1<<depth)-1;
int shift= comp.shift;
int step = comp.step_minus1+1;
int flags= desc->flags;
if (flags & PIX_FMT_BITSTREAM){
int skip = x*step + comp.offset_plus1-1;
const uint8_t *p = data[plane] + y*linesize[plane] + (skip>>3);
int shift = 8 - depth - (skip&7);
while(w--){
int val = (*p >> shift) & mask;
if(read_pal_component)
val= data[1][4*val + c];
shift -= step;
p -= shift>>3;
shift &= 7;
*dst++= val;
}
} else {
const uint8_t *p = data[plane]+ y*linesize[plane] + x*step + comp.offset_plus1-1;
while(w--){
int val = flags & PIX_FMT_BE ? AV_RB16(p) : AV_RL16(p);
val = (val>>shift) & mask;
if(read_pal_component)
val= data[1][4*val + c];
p+= step;
*dst++= val;
}
}
}
| true
|
FFmpeg
|
9525243f59f0a13e099612b66f7ba5d5d5293c70
|
void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4],
const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component)
{
AVComponentDescriptor comp= desc->comp[c];
int plane= comp.plane;
int depth= comp.depth_minus1+1;
int mask = (1<<depth)-1;
int shift= comp.shift;
int step = comp.step_minus1+1;
int flags= desc->flags;
if (flags & PIX_FMT_BITSTREAM){
int skip = x*step + comp.offset_plus1-1;
const uint8_t *p = data[plane] + y*linesize[plane] + (skip>>3);
int shift = 8 - depth - (skip&7);
while(w--){
int val = (*p >> shift) & mask;
if(read_pal_component)
val= data[1][4*val + c];
shift -= step;
p -= shift>>3;
shift &= 7;
*dst++= val;
}
} else {
const uint8_t *p = data[plane]+ y*linesize[plane] + x*step + comp.offset_plus1-1;
while(w--){
int val = flags & PIX_FMT_BE ? AV_RB16(p) : AV_RL16(p);
val = (val>>shift) & mask;
if(read_pal_component)
val= data[1][4*val + c];
p+= step;
*dst++= val;
}
}
}
|
{
"code": [
" int val = flags & PIX_FMT_BE ? AV_RB16(p) : AV_RL16(p);"
],
"line_no": [
59
]
}
|
void FUNC_0(uint16_t *VAR_0, const uint8_t *VAR_1[4], const int VAR_2[4],
const AVPixFmtDescriptor *VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8)
{
AVComponentDescriptor comp= VAR_3->comp[VAR_6];
int VAR_9= comp.VAR_9;
int VAR_10= comp.depth_minus1+1;
int VAR_11 = (1<<VAR_10)-1;
int VAR_17= comp.VAR_17;
int VAR_13 = comp.step_minus1+1;
int VAR_14= VAR_3->VAR_14;
if (VAR_14 & PIX_FMT_BITSTREAM){
int VAR_15 = VAR_4*VAR_13 + comp.offset_plus1-1;
const uint8_t *VAR_18 = VAR_1[VAR_9] + VAR_5*VAR_2[VAR_9] + (VAR_15>>3);
int VAR_17 = 8 - VAR_10 - (VAR_15&7);
while(VAR_7--){
int VAR_18 = (*VAR_18 >> VAR_17) & VAR_11;
if(VAR_8)
VAR_18= VAR_1[1][4*VAR_18 + VAR_6];
VAR_17 -= VAR_13;
VAR_18 -= VAR_17>>3;
VAR_17 &= 7;
*VAR_0++= VAR_18;
}
} else {
const uint8_t *VAR_18 = VAR_1[VAR_9]+ VAR_5*VAR_2[VAR_9] + VAR_4*VAR_13 + comp.offset_plus1-1;
while(VAR_7--){
int VAR_18 = VAR_14 & PIX_FMT_BE ? AV_RB16(VAR_18) : AV_RL16(VAR_18);
VAR_18 = (VAR_18>>VAR_17) & VAR_11;
if(VAR_8)
VAR_18= VAR_1[1][4*VAR_18 + VAR_6];
VAR_18+= VAR_13;
*VAR_0++= VAR_18;
}
}
}
|
[
"void FUNC_0(uint16_t *VAR_0, const uint8_t *VAR_1[4], const int VAR_2[4],\nconst AVPixFmtDescriptor *VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7, int VAR_8)\n{",
"AVComponentDescriptor comp= VAR_3->comp[VAR_6];",
"int VAR_9= comp.VAR_9;",
"int VAR_10= comp.depth_minus1+1;",
"int VAR_11 = (1<<VAR_10)-1;",
"int VAR_17= comp.VAR_17;",
"int VAR_13 = comp.step_minus1+1;",
"int VAR_14= VAR_3->VAR_14;",
"if (VAR_14 & PIX_FMT_BITSTREAM){",
"int VAR_15 = VAR_4*VAR_13 + comp.offset_plus1-1;",
"const uint8_t *VAR_18 = VAR_1[VAR_9] + VAR_5*VAR_2[VAR_9] + (VAR_15>>3);",
"int VAR_17 = 8 - VAR_10 - (VAR_15&7);",
"while(VAR_7--){",
"int VAR_18 = (*VAR_18 >> VAR_17) & VAR_11;",
"if(VAR_8)\nVAR_18= VAR_1[1][4*VAR_18 + VAR_6];",
"VAR_17 -= VAR_13;",
"VAR_18 -= VAR_17>>3;",
"VAR_17 &= 7;",
"*VAR_0++= VAR_18;",
"}",
"} else {",
"const uint8_t *VAR_18 = VAR_1[VAR_9]+ VAR_5*VAR_2[VAR_9] + VAR_4*VAR_13 + comp.offset_plus1-1;",
"while(VAR_7--){",
"int VAR_18 = VAR_14 & PIX_FMT_BE ? AV_RB16(VAR_18) : AV_RL16(VAR_18);",
"VAR_18 = (VAR_18>>VAR_17) & VAR_11;",
"if(VAR_8)\nVAR_18= VAR_1[1][4*VAR_18 + VAR_6];",
"VAR_18+= VAR_13;",
"*VAR_0++= VAR_18;",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37,
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63,
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
]
] |
17,342
|
void set_system_io_map(MemoryRegion *mr)
{
memory_region_transaction_begin();
address_space_io.root = mr;
memory_region_transaction_commit();
}
| true
|
qemu
|
8786db7cb96f8ce5c75c6e1e074319c9dca8d356
|
void set_system_io_map(MemoryRegion *mr)
{
memory_region_transaction_begin();
address_space_io.root = mr;
memory_region_transaction_commit();
}
|
{
"code": [
" memory_region_transaction_begin();",
" address_space_io.root = mr;",
" memory_region_transaction_commit();"
],
"line_no": [
5,
7,
9
]
}
|
void FUNC_0(MemoryRegion *VAR_0)
{
memory_region_transaction_begin();
address_space_io.root = VAR_0;
memory_region_transaction_commit();
}
|
[
"void FUNC_0(MemoryRegion *VAR_0)\n{",
"memory_region_transaction_begin();",
"address_space_io.root = VAR_0;",
"memory_region_transaction_commit();",
"}"
] |
[
0,
1,
1,
1,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
]
] |
17,343
|
int attribute_align_arg av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags)
{
BufferSinkContext *buf = ctx->priv;
AVFilterLink *inlink = ctx->inputs[0];
int ret;
AVFrame *cur_frame;
/* no picref available, fetch it from the filterchain */
if (!av_fifo_size(buf->fifo)) {
if (inlink->closed)
return AVERROR_EOF;
if (flags & AV_BUFFERSINK_FLAG_NO_REQUEST)
return AVERROR(EAGAIN);
if ((ret = ff_request_frame(inlink)) < 0)
return ret;
}
if (!av_fifo_size(buf->fifo))
return AVERROR(EINVAL);
if (flags & AV_BUFFERSINK_FLAG_PEEK) {
cur_frame = *((AVFrame **)av_fifo_peek2(buf->fifo, 0));
if ((ret = av_frame_ref(frame, cur_frame)) < 0)
return ret;
} else {
av_fifo_generic_read(buf->fifo, &cur_frame, sizeof(cur_frame), NULL);
av_frame_move_ref(frame, cur_frame);
av_frame_free(&cur_frame);
}
return 0;
}
| false
|
FFmpeg
|
807d4b635567e51108ea3a6a774336321c3250e5
|
int attribute_align_arg av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags)
{
BufferSinkContext *buf = ctx->priv;
AVFilterLink *inlink = ctx->inputs[0];
int ret;
AVFrame *cur_frame;
if (!av_fifo_size(buf->fifo)) {
if (inlink->closed)
return AVERROR_EOF;
if (flags & AV_BUFFERSINK_FLAG_NO_REQUEST)
return AVERROR(EAGAIN);
if ((ret = ff_request_frame(inlink)) < 0)
return ret;
}
if (!av_fifo_size(buf->fifo))
return AVERROR(EINVAL);
if (flags & AV_BUFFERSINK_FLAG_PEEK) {
cur_frame = *((AVFrame **)av_fifo_peek2(buf->fifo, 0));
if ((ret = av_frame_ref(frame, cur_frame)) < 0)
return ret;
} else {
av_fifo_generic_read(buf->fifo, &cur_frame, sizeof(cur_frame), NULL);
av_frame_move_ref(frame, cur_frame);
av_frame_free(&cur_frame);
}
return 0;
}
|
{
"code": [],
"line_no": []
}
|
int VAR_0 av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags)
{
BufferSinkContext *buf = ctx->priv;
AVFilterLink *inlink = ctx->inputs[0];
int ret;
AVFrame *cur_frame;
if (!av_fifo_size(buf->fifo)) {
if (inlink->closed)
return AVERROR_EOF;
if (flags & AV_BUFFERSINK_FLAG_NO_REQUEST)
return AVERROR(EAGAIN);
if ((ret = ff_request_frame(inlink)) < 0)
return ret;
}
if (!av_fifo_size(buf->fifo))
return AVERROR(EINVAL);
if (flags & AV_BUFFERSINK_FLAG_PEEK) {
cur_frame = *((AVFrame **)av_fifo_peek2(buf->fifo, 0));
if ((ret = av_frame_ref(frame, cur_frame)) < 0)
return ret;
} else {
av_fifo_generic_read(buf->fifo, &cur_frame, sizeof(cur_frame), NULL);
av_frame_move_ref(frame, cur_frame);
av_frame_free(&cur_frame);
}
return 0;
}
|
[
"int VAR_0 av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags)\n{",
"BufferSinkContext *buf = ctx->priv;",
"AVFilterLink *inlink = ctx->inputs[0];",
"int ret;",
"AVFrame *cur_frame;",
"if (!av_fifo_size(buf->fifo)) {",
"if (inlink->closed)\nreturn AVERROR_EOF;",
"if (flags & AV_BUFFERSINK_FLAG_NO_REQUEST)\nreturn AVERROR(EAGAIN);",
"if ((ret = ff_request_frame(inlink)) < 0)\nreturn ret;",
"}",
"if (!av_fifo_size(buf->fifo))\nreturn AVERROR(EINVAL);",
"if (flags & AV_BUFFERSINK_FLAG_PEEK) {",
"cur_frame = *((AVFrame **)av_fifo_peek2(buf->fifo, 0));",
"if ((ret = av_frame_ref(frame, cur_frame)) < 0)\nreturn ret;",
"} else {",
"av_fifo_generic_read(buf->fifo, &cur_frame, sizeof(cur_frame), NULL);",
"av_frame_move_ref(frame, cur_frame);",
"av_frame_free(&cur_frame);",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
17
],
[
19,
21
],
[
23,
25
],
[
27,
29
],
[
31
],
[
35,
37
],
[
41
],
[
43
],
[
45,
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
]
] |
17,344
|
static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S)
{
union {
float f;
uint32_t u;
} value;
int sign;
int exp = s->float_max_exp;
if (s->got_extra_bits) {
const int max_bits = 1 + 23 + 8 + 1;
const int left_bits = get_bits_left(&s->gb_extra_bits);
if (left_bits + 8 * FF_INPUT_BUFFER_PADDING_SIZE < max_bits)
return 0.0;
}
if (S) {
S <<= s->float_shift;
sign = S < 0;
if (sign)
S = -S;
if (S >= 0x1000000) {
if (s->got_extra_bits && get_bits1(&s->gb_extra_bits))
S = get_bits(&s->gb_extra_bits, 23);
else
S = 0;
exp = 255;
} else if (exp) {
int shift = 23 - av_log2(S);
exp = s->float_max_exp;
if (exp <= shift)
shift = --exp;
exp -= shift;
if (shift) {
S <<= shift;
if ((s->float_flag & WV_FLT_SHIFT_ONES) ||
(s->got_extra_bits && (s->float_flag & WV_FLT_SHIFT_SAME) &&
get_bits1(&s->gb_extra_bits))) {
S |= (1 << shift) - 1;
} else if (s->got_extra_bits &&
(s->float_flag & WV_FLT_SHIFT_SENT)) {
S |= get_bits(&s->gb_extra_bits, shift);
}
}
} else {
exp = s->float_max_exp;
}
S &= 0x7fffff;
} else {
sign = 0;
exp = 0;
if (s->got_extra_bits && (s->float_flag & WV_FLT_ZERO_SENT)) {
if (get_bits1(&s->gb_extra_bits)) {
S = get_bits(&s->gb_extra_bits, 23);
if (s->float_max_exp >= 25)
exp = get_bits(&s->gb_extra_bits, 8);
sign = get_bits1(&s->gb_extra_bits);
} else {
if (s->float_flag & WV_FLT_ZERO_SIGN)
sign = get_bits1(&s->gb_extra_bits);
}
}
}
*crc = *crc * 27 + S * 9 + exp * 3 + sign;
value.u = (sign << 31) | (exp << 23) | S;
return value.f;
}
| true
|
FFmpeg
|
f604eab30a7ec33e6d803a4d320ca9b453bde836
|
static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S)
{
union {
float f;
uint32_t u;
} value;
int sign;
int exp = s->float_max_exp;
if (s->got_extra_bits) {
const int max_bits = 1 + 23 + 8 + 1;
const int left_bits = get_bits_left(&s->gb_extra_bits);
if (left_bits + 8 * FF_INPUT_BUFFER_PADDING_SIZE < max_bits)
return 0.0;
}
if (S) {
S <<= s->float_shift;
sign = S < 0;
if (sign)
S = -S;
if (S >= 0x1000000) {
if (s->got_extra_bits && get_bits1(&s->gb_extra_bits))
S = get_bits(&s->gb_extra_bits, 23);
else
S = 0;
exp = 255;
} else if (exp) {
int shift = 23 - av_log2(S);
exp = s->float_max_exp;
if (exp <= shift)
shift = --exp;
exp -= shift;
if (shift) {
S <<= shift;
if ((s->float_flag & WV_FLT_SHIFT_ONES) ||
(s->got_extra_bits && (s->float_flag & WV_FLT_SHIFT_SAME) &&
get_bits1(&s->gb_extra_bits))) {
S |= (1 << shift) - 1;
} else if (s->got_extra_bits &&
(s->float_flag & WV_FLT_SHIFT_SENT)) {
S |= get_bits(&s->gb_extra_bits, shift);
}
}
} else {
exp = s->float_max_exp;
}
S &= 0x7fffff;
} else {
sign = 0;
exp = 0;
if (s->got_extra_bits && (s->float_flag & WV_FLT_ZERO_SENT)) {
if (get_bits1(&s->gb_extra_bits)) {
S = get_bits(&s->gb_extra_bits, 23);
if (s->float_max_exp >= 25)
exp = get_bits(&s->gb_extra_bits, 8);
sign = get_bits1(&s->gb_extra_bits);
} else {
if (s->float_flag & WV_FLT_ZERO_SIGN)
sign = get_bits1(&s->gb_extra_bits);
}
}
}
*crc = *crc * 27 + S * 9 + exp * 3 + sign;
value.u = (sign << 31) | (exp << 23) | S;
return value.f;
}
|
{
"code": [
" int sign;"
],
"line_no": [
15
]
}
|
static float FUNC_0(WavpackFrameContext *VAR_0, uint32_t *VAR_1, int VAR_2)
{
union {
float f;
uint32_t u;
} VAR_3;
int VAR_4;
int VAR_5 = VAR_0->float_max_exp;
if (VAR_0->got_extra_bits) {
const int VAR_6 = 1 + 23 + 8 + 1;
const int VAR_7 = get_bits_left(&VAR_0->gb_extra_bits);
if (VAR_7 + 8 * FF_INPUT_BUFFER_PADDING_SIZE < VAR_6)
return 0.0;
}
if (VAR_2) {
VAR_2 <<= VAR_0->float_shift;
VAR_4 = VAR_2 < 0;
if (VAR_4)
VAR_2 = -VAR_2;
if (VAR_2 >= 0x1000000) {
if (VAR_0->got_extra_bits && get_bits1(&VAR_0->gb_extra_bits))
VAR_2 = get_bits(&VAR_0->gb_extra_bits, 23);
else
VAR_2 = 0;
VAR_5 = 255;
} else if (VAR_5) {
int VAR_8 = 23 - av_log2(VAR_2);
VAR_5 = VAR_0->float_max_exp;
if (VAR_5 <= VAR_8)
VAR_8 = --VAR_5;
VAR_5 -= VAR_8;
if (VAR_8) {
VAR_2 <<= VAR_8;
if ((VAR_0->float_flag & WV_FLT_SHIFT_ONES) ||
(VAR_0->got_extra_bits && (VAR_0->float_flag & WV_FLT_SHIFT_SAME) &&
get_bits1(&VAR_0->gb_extra_bits))) {
VAR_2 |= (1 << VAR_8) - 1;
} else if (VAR_0->got_extra_bits &&
(VAR_0->float_flag & WV_FLT_SHIFT_SENT)) {
VAR_2 |= get_bits(&VAR_0->gb_extra_bits, VAR_8);
}
}
} else {
VAR_5 = VAR_0->float_max_exp;
}
VAR_2 &= 0x7fffff;
} else {
VAR_4 = 0;
VAR_5 = 0;
if (VAR_0->got_extra_bits && (VAR_0->float_flag & WV_FLT_ZERO_SENT)) {
if (get_bits1(&VAR_0->gb_extra_bits)) {
VAR_2 = get_bits(&VAR_0->gb_extra_bits, 23);
if (VAR_0->float_max_exp >= 25)
VAR_5 = get_bits(&VAR_0->gb_extra_bits, 8);
VAR_4 = get_bits1(&VAR_0->gb_extra_bits);
} else {
if (VAR_0->float_flag & WV_FLT_ZERO_SIGN)
VAR_4 = get_bits1(&VAR_0->gb_extra_bits);
}
}
}
*VAR_1 = *VAR_1 * 27 + VAR_2 * 9 + VAR_5 * 3 + VAR_4;
VAR_3.u = (VAR_4 << 31) | (VAR_5 << 23) | VAR_2;
return VAR_3.f;
}
|
[
"static float FUNC_0(WavpackFrameContext *VAR_0, uint32_t *VAR_1, int VAR_2)\n{",
"union {",
"float f;",
"uint32_t u;",
"} VAR_3;",
"int VAR_4;",
"int VAR_5 = VAR_0->float_max_exp;",
"if (VAR_0->got_extra_bits) {",
"const int VAR_6 = 1 + 23 + 8 + 1;",
"const int VAR_7 = get_bits_left(&VAR_0->gb_extra_bits);",
"if (VAR_7 + 8 * FF_INPUT_BUFFER_PADDING_SIZE < VAR_6)\nreturn 0.0;",
"}",
"if (VAR_2) {",
"VAR_2 <<= VAR_0->float_shift;",
"VAR_4 = VAR_2 < 0;",
"if (VAR_4)\nVAR_2 = -VAR_2;",
"if (VAR_2 >= 0x1000000) {",
"if (VAR_0->got_extra_bits && get_bits1(&VAR_0->gb_extra_bits))\nVAR_2 = get_bits(&VAR_0->gb_extra_bits, 23);",
"else\nVAR_2 = 0;",
"VAR_5 = 255;",
"} else if (VAR_5) {",
"int VAR_8 = 23 - av_log2(VAR_2);",
"VAR_5 = VAR_0->float_max_exp;",
"if (VAR_5 <= VAR_8)\nVAR_8 = --VAR_5;",
"VAR_5 -= VAR_8;",
"if (VAR_8) {",
"VAR_2 <<= VAR_8;",
"if ((VAR_0->float_flag & WV_FLT_SHIFT_ONES) ||\n(VAR_0->got_extra_bits && (VAR_0->float_flag & WV_FLT_SHIFT_SAME) &&\nget_bits1(&VAR_0->gb_extra_bits))) {",
"VAR_2 |= (1 << VAR_8) - 1;",
"} else if (VAR_0->got_extra_bits &&",
"(VAR_0->float_flag & WV_FLT_SHIFT_SENT)) {",
"VAR_2 |= get_bits(&VAR_0->gb_extra_bits, VAR_8);",
"}",
"}",
"} else {",
"VAR_5 = VAR_0->float_max_exp;",
"}",
"VAR_2 &= 0x7fffff;",
"} else {",
"VAR_4 = 0;",
"VAR_5 = 0;",
"if (VAR_0->got_extra_bits && (VAR_0->float_flag & WV_FLT_ZERO_SENT)) {",
"if (get_bits1(&VAR_0->gb_extra_bits)) {",
"VAR_2 = get_bits(&VAR_0->gb_extra_bits, 23);",
"if (VAR_0->float_max_exp >= 25)\nVAR_5 = get_bits(&VAR_0->gb_extra_bits, 8);",
"VAR_4 = get_bits1(&VAR_0->gb_extra_bits);",
"} else {",
"if (VAR_0->float_flag & WV_FLT_ZERO_SIGN)\nVAR_4 = get_bits1(&VAR_0->gb_extra_bits);",
"}",
"}",
"}",
"*VAR_1 = *VAR_1 * 27 + VAR_2 * 9 + VAR_5 * 3 + VAR_4;",
"VAR_3.u = (VAR_4 << 31) | (VAR_5 << 23) | VAR_2;",
"return VAR_3.f;",
"}"
] |
[
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,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
29,
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
43,
45
],
[
47
],
[
49,
51
],
[
53,
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65,
67
],
[
69
],
[
73
],
[
75
],
[
77,
79,
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115,
117
],
[
119
],
[
121
],
[
123,
125
],
[
127
],
[
129
],
[
131
],
[
135
],
[
139
],
[
141
],
[
143
]
] |
17,345
|
static gboolean ga_channel_open(GAChannel *c, const gchar *path, GAChannelMethod method)
{
int ret;
c->method = method;
switch (c->method) {
case GA_CHANNEL_VIRTIO_SERIAL: {
int fd = qemu_open(path, O_RDWR | O_NONBLOCK
#ifndef CONFIG_SOLARIS
| O_ASYNC
#endif
);
if (fd == -1) {
g_critical("error opening channel: %s", strerror(errno));
exit(EXIT_FAILURE);
}
#ifdef CONFIG_SOLARIS
ret = ioctl(fd, I_SETSIG, S_OUTPUT | S_INPUT | S_HIPRI);
if (ret == -1) {
g_critical("error setting event mask for channel: %s",
strerror(errno));
exit(EXIT_FAILURE);
}
#endif
ret = ga_channel_client_add(c, fd);
if (ret) {
g_critical("error adding channel to main loop");
return false;
}
break;
}
case GA_CHANNEL_ISA_SERIAL: {
struct termios tio;
int fd = qemu_open(path, O_RDWR | O_NOCTTY | O_NONBLOCK);
if (fd == -1) {
g_critical("error opening channel: %s", strerror(errno));
exit(EXIT_FAILURE);
}
tcgetattr(fd, &tio);
/* set up serial port for non-canonical, dumb byte streaming */
tio.c_iflag &= ~(IGNBRK | BRKINT | IGNPAR | PARMRK | INPCK | ISTRIP |
INLCR | IGNCR | ICRNL | IXON | IXOFF | IXANY |
IMAXBEL);
tio.c_oflag = 0;
tio.c_lflag = 0;
tio.c_cflag |= GA_CHANNEL_BAUDRATE_DEFAULT;
/* 1 available byte min or reads will block (we'll set non-blocking
* elsewhere, else we have to deal with read()=0 instead)
*/
tio.c_cc[VMIN] = 1;
tio.c_cc[VTIME] = 0;
/* flush everything waiting for read/xmit, it's garbage at this point */
tcflush(fd, TCIFLUSH);
tcsetattr(fd, TCSANOW, &tio);
ret = ga_channel_client_add(c, fd);
if (ret) {
g_error("error adding channel to main loop");
}
break;
}
case GA_CHANNEL_UNIX_LISTEN: {
Error *local_err = NULL;
int fd = unix_listen(path, NULL, strlen(path), &local_err);
if (local_err != NULL) {
g_critical("%s", error_get_pretty(local_err));
error_free(local_err);
return false;
}
ga_channel_listen_add(c, fd, true);
break;
}
default:
g_critical("error binding/listening to specified socket");
return false;
}
return true;
}
| true
|
qemu
|
d4f4a3efdf0a71621ae5351176f5f15b522d0026
|
static gboolean ga_channel_open(GAChannel *c, const gchar *path, GAChannelMethod method)
{
int ret;
c->method = method;
switch (c->method) {
case GA_CHANNEL_VIRTIO_SERIAL: {
int fd = qemu_open(path, O_RDWR | O_NONBLOCK
#ifndef CONFIG_SOLARIS
| O_ASYNC
#endif
);
if (fd == -1) {
g_critical("error opening channel: %s", strerror(errno));
exit(EXIT_FAILURE);
}
#ifdef CONFIG_SOLARIS
ret = ioctl(fd, I_SETSIG, S_OUTPUT | S_INPUT | S_HIPRI);
if (ret == -1) {
g_critical("error setting event mask for channel: %s",
strerror(errno));
exit(EXIT_FAILURE);
}
#endif
ret = ga_channel_client_add(c, fd);
if (ret) {
g_critical("error adding channel to main loop");
return false;
}
break;
}
case GA_CHANNEL_ISA_SERIAL: {
struct termios tio;
int fd = qemu_open(path, O_RDWR | O_NOCTTY | O_NONBLOCK);
if (fd == -1) {
g_critical("error opening channel: %s", strerror(errno));
exit(EXIT_FAILURE);
}
tcgetattr(fd, &tio);
tio.c_iflag &= ~(IGNBRK | BRKINT | IGNPAR | PARMRK | INPCK | ISTRIP |
INLCR | IGNCR | ICRNL | IXON | IXOFF | IXANY |
IMAXBEL);
tio.c_oflag = 0;
tio.c_lflag = 0;
tio.c_cflag |= GA_CHANNEL_BAUDRATE_DEFAULT;
tio.c_cc[VMIN] = 1;
tio.c_cc[VTIME] = 0;
tcflush(fd, TCIFLUSH);
tcsetattr(fd, TCSANOW, &tio);
ret = ga_channel_client_add(c, fd);
if (ret) {
g_error("error adding channel to main loop");
}
break;
}
case GA_CHANNEL_UNIX_LISTEN: {
Error *local_err = NULL;
int fd = unix_listen(path, NULL, strlen(path), &local_err);
if (local_err != NULL) {
g_critical("%s", error_get_pretty(local_err));
error_free(local_err);
return false;
}
ga_channel_listen_add(c, fd, true);
break;
}
default:
g_critical("error binding/listening to specified socket");
return false;
}
return true;
}
|
{
"code": [],
"line_no": []
}
|
static gboolean FUNC_0(GAChannel *c, const gchar *path, GAChannelMethod method)
{
int VAR_0;
c->method = method;
switch (c->method) {
case GA_CHANNEL_VIRTIO_SERIAL: {
int VAR_3 = qemu_open(path, O_RDWR | O_NONBLOCK
#ifndef CONFIG_SOLARIS
| O_ASYNC
#endif
);
if (VAR_3 == -1) {
g_critical("error opening channel: %s", strerror(errno));
exit(EXIT_FAILURE);
}
#ifdef CONFIG_SOLARIS
VAR_0 = ioctl(VAR_3, I_SETSIG, S_OUTPUT | S_INPUT | S_HIPRI);
if (VAR_0 == -1) {
g_critical("error setting event mask for channel: %s",
strerror(errno));
exit(EXIT_FAILURE);
}
#endif
VAR_0 = ga_channel_client_add(c, VAR_3);
if (VAR_0) {
g_critical("error adding channel to main loop");
return false;
}
break;
}
case GA_CHANNEL_ISA_SERIAL: {
struct termios VAR_2;
int VAR_3 = qemu_open(path, O_RDWR | O_NOCTTY | O_NONBLOCK);
if (VAR_3 == -1) {
g_critical("error opening channel: %s", strerror(errno));
exit(EXIT_FAILURE);
}
tcgetattr(VAR_3, &VAR_2);
VAR_2.c_iflag &= ~(IGNBRK | BRKINT | IGNPAR | PARMRK | INPCK | ISTRIP |
INLCR | IGNCR | ICRNL | IXON | IXOFF | IXANY |
IMAXBEL);
VAR_2.c_oflag = 0;
VAR_2.c_lflag = 0;
VAR_2.c_cflag |= GA_CHANNEL_BAUDRATE_DEFAULT;
VAR_2.c_cc[VMIN] = 1;
VAR_2.c_cc[VTIME] = 0;
tcflush(VAR_3, TCIFLUSH);
tcsetattr(VAR_3, TCSANOW, &VAR_2);
VAR_0 = ga_channel_client_add(c, VAR_3);
if (VAR_0) {
g_error("error adding channel to main loop");
}
break;
}
case GA_CHANNEL_UNIX_LISTEN: {
Error *local_err = NULL;
int VAR_3 = unix_listen(path, NULL, strlen(path), &local_err);
if (local_err != NULL) {
g_critical("%s", error_get_pretty(local_err));
error_free(local_err);
return false;
}
ga_channel_listen_add(c, VAR_3, true);
break;
}
default:
g_critical("error binding/listening to specified socket");
return false;
}
return true;
}
|
[
"static gboolean FUNC_0(GAChannel *c, const gchar *path, GAChannelMethod method)\n{",
"int VAR_0;",
"c->method = method;",
"switch (c->method) {",
"case GA_CHANNEL_VIRTIO_SERIAL: {",
"int VAR_3 = qemu_open(path, O_RDWR | O_NONBLOCK\n#ifndef CONFIG_SOLARIS\n| O_ASYNC\n#endif\n);",
"if (VAR_3 == -1) {",
"g_critical(\"error opening channel: %s\", strerror(errno));",
"exit(EXIT_FAILURE);",
"}",
"#ifdef CONFIG_SOLARIS\nVAR_0 = ioctl(VAR_3, I_SETSIG, S_OUTPUT | S_INPUT | S_HIPRI);",
"if (VAR_0 == -1) {",
"g_critical(\"error setting event mask for channel: %s\",\nstrerror(errno));",
"exit(EXIT_FAILURE);",
"}",
"#endif\nVAR_0 = ga_channel_client_add(c, VAR_3);",
"if (VAR_0) {",
"g_critical(\"error adding channel to main loop\");",
"return false;",
"}",
"break;",
"}",
"case GA_CHANNEL_ISA_SERIAL: {",
"struct termios VAR_2;",
"int VAR_3 = qemu_open(path, O_RDWR | O_NOCTTY | O_NONBLOCK);",
"if (VAR_3 == -1) {",
"g_critical(\"error opening channel: %s\", strerror(errno));",
"exit(EXIT_FAILURE);",
"}",
"tcgetattr(VAR_3, &VAR_2);",
"VAR_2.c_iflag &= ~(IGNBRK | BRKINT | IGNPAR | PARMRK | INPCK | ISTRIP |\nINLCR | IGNCR | ICRNL | IXON | IXOFF | IXANY |\nIMAXBEL);",
"VAR_2.c_oflag = 0;",
"VAR_2.c_lflag = 0;",
"VAR_2.c_cflag |= GA_CHANNEL_BAUDRATE_DEFAULT;",
"VAR_2.c_cc[VMIN] = 1;",
"VAR_2.c_cc[VTIME] = 0;",
"tcflush(VAR_3, TCIFLUSH);",
"tcsetattr(VAR_3, TCSANOW, &VAR_2);",
"VAR_0 = ga_channel_client_add(c, VAR_3);",
"if (VAR_0) {",
"g_error(\"error adding channel to main loop\");",
"}",
"break;",
"}",
"case GA_CHANNEL_UNIX_LISTEN: {",
"Error *local_err = NULL;",
"int VAR_3 = unix_listen(path, NULL, strlen(path), &local_err);",
"if (local_err != NULL) {",
"g_critical(\"%s\", error_get_pretty(local_err));",
"error_free(local_err);",
"return false;",
"}",
"ga_channel_listen_add(c, VAR_3, true);",
"break;",
"}",
"default:\ng_critical(\"error binding/listening to specified socket\");",
"return false;",
"}",
"return true;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15,
17,
19,
21,
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33,
35
],
[
37
],
[
39,
41
],
[
43
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
56
],
[
58
],
[
60
],
[
62
],
[
64
],
[
66
],
[
68
],
[
70
],
[
72
],
[
74
],
[
76
],
[
78
],
[
82,
84,
86
],
[
88
],
[
90
],
[
92
],
[
100
],
[
102
],
[
106
],
[
108
],
[
110
],
[
112
],
[
114
],
[
116
],
[
118
],
[
120
],
[
122
],
[
124
],
[
126
],
[
128
],
[
130
],
[
132
],
[
134
],
[
136
],
[
138
],
[
140
],
[
142
],
[
144,
146
],
[
148
],
[
150
],
[
154
],
[
156
]
] |
17,346
|
static void init_qxl_rom(PCIQXLDevice *d)
{
QXLRom *rom = memory_region_get_ram_ptr(&d->rom_bar);
QXLModes *modes = (QXLModes *)(rom + 1);
uint32_t ram_header_size;
uint32_t surface0_area_size;
uint32_t num_pages;
uint32_t fb, maxfb = 0;
int i;
memset(rom, 0, d->rom_size);
rom->magic = cpu_to_le32(QXL_ROM_MAGIC);
rom->id = cpu_to_le32(d->id);
rom->log_level = cpu_to_le32(d->guestdebug);
rom->modes_offset = cpu_to_le32(sizeof(QXLRom));
rom->slot_gen_bits = MEMSLOT_GENERATION_BITS;
rom->slot_id_bits = MEMSLOT_SLOT_BITS;
rom->slots_start = 1;
rom->slots_end = NUM_MEMSLOTS - 1;
rom->n_surfaces = cpu_to_le32(NUM_SURFACES);
modes->n_modes = cpu_to_le32(ARRAY_SIZE(qxl_modes));
for (i = 0; i < modes->n_modes; i++) {
fb = qxl_modes[i].y_res * qxl_modes[i].stride;
if (maxfb < fb) {
maxfb = fb;
}
modes->modes[i].id = cpu_to_le32(i);
modes->modes[i].x_res = cpu_to_le32(qxl_modes[i].x_res);
modes->modes[i].y_res = cpu_to_le32(qxl_modes[i].y_res);
modes->modes[i].bits = cpu_to_le32(qxl_modes[i].bits);
modes->modes[i].stride = cpu_to_le32(qxl_modes[i].stride);
modes->modes[i].x_mili = cpu_to_le32(qxl_modes[i].x_mili);
modes->modes[i].y_mili = cpu_to_le32(qxl_modes[i].y_mili);
modes->modes[i].orientation = cpu_to_le32(qxl_modes[i].orientation);
}
if (maxfb < VGA_RAM_SIZE && d->id == 0)
maxfb = VGA_RAM_SIZE;
ram_header_size = ALIGN(sizeof(QXLRam), 4096);
surface0_area_size = ALIGN(maxfb, 4096);
num_pages = d->vga.vram_size;
num_pages -= ram_header_size;
num_pages -= surface0_area_size;
num_pages = num_pages / TARGET_PAGE_SIZE;
rom->draw_area_offset = cpu_to_le32(0);
rom->surface0_area_size = cpu_to_le32(surface0_area_size);
rom->pages_offset = cpu_to_le32(surface0_area_size);
rom->num_pages = cpu_to_le32(num_pages);
rom->ram_header_offset = cpu_to_le32(d->vga.vram_size - ram_header_size);
d->shadow_rom = *rom;
d->rom = rom;
d->modes = modes;
}
| true
|
qemu
|
13d1fd44c46629aad672f192abbf02238c6cbf36
|
static void init_qxl_rom(PCIQXLDevice *d)
{
QXLRom *rom = memory_region_get_ram_ptr(&d->rom_bar);
QXLModes *modes = (QXLModes *)(rom + 1);
uint32_t ram_header_size;
uint32_t surface0_area_size;
uint32_t num_pages;
uint32_t fb, maxfb = 0;
int i;
memset(rom, 0, d->rom_size);
rom->magic = cpu_to_le32(QXL_ROM_MAGIC);
rom->id = cpu_to_le32(d->id);
rom->log_level = cpu_to_le32(d->guestdebug);
rom->modes_offset = cpu_to_le32(sizeof(QXLRom));
rom->slot_gen_bits = MEMSLOT_GENERATION_BITS;
rom->slot_id_bits = MEMSLOT_SLOT_BITS;
rom->slots_start = 1;
rom->slots_end = NUM_MEMSLOTS - 1;
rom->n_surfaces = cpu_to_le32(NUM_SURFACES);
modes->n_modes = cpu_to_le32(ARRAY_SIZE(qxl_modes));
for (i = 0; i < modes->n_modes; i++) {
fb = qxl_modes[i].y_res * qxl_modes[i].stride;
if (maxfb < fb) {
maxfb = fb;
}
modes->modes[i].id = cpu_to_le32(i);
modes->modes[i].x_res = cpu_to_le32(qxl_modes[i].x_res);
modes->modes[i].y_res = cpu_to_le32(qxl_modes[i].y_res);
modes->modes[i].bits = cpu_to_le32(qxl_modes[i].bits);
modes->modes[i].stride = cpu_to_le32(qxl_modes[i].stride);
modes->modes[i].x_mili = cpu_to_le32(qxl_modes[i].x_mili);
modes->modes[i].y_mili = cpu_to_le32(qxl_modes[i].y_mili);
modes->modes[i].orientation = cpu_to_le32(qxl_modes[i].orientation);
}
if (maxfb < VGA_RAM_SIZE && d->id == 0)
maxfb = VGA_RAM_SIZE;
ram_header_size = ALIGN(sizeof(QXLRam), 4096);
surface0_area_size = ALIGN(maxfb, 4096);
num_pages = d->vga.vram_size;
num_pages -= ram_header_size;
num_pages -= surface0_area_size;
num_pages = num_pages / TARGET_PAGE_SIZE;
rom->draw_area_offset = cpu_to_le32(0);
rom->surface0_area_size = cpu_to_le32(surface0_area_size);
rom->pages_offset = cpu_to_le32(surface0_area_size);
rom->num_pages = cpu_to_le32(num_pages);
rom->ram_header_offset = cpu_to_le32(d->vga.vram_size - ram_header_size);
d->shadow_rom = *rom;
d->rom = rom;
d->modes = modes;
}
|
{
"code": [
" uint32_t fb, maxfb = 0;",
" int i;",
" modes->n_modes = cpu_to_le32(ARRAY_SIZE(qxl_modes));",
" for (i = 0; i < modes->n_modes; i++) {",
" if (maxfb < fb) {",
" maxfb = fb;",
" modes->modes[i].id = cpu_to_le32(i);",
" modes->modes[i].x_res = cpu_to_le32(qxl_modes[i].x_res);",
" modes->modes[i].y_res = cpu_to_le32(qxl_modes[i].y_res);",
" modes->modes[i].bits = cpu_to_le32(qxl_modes[i].bits);",
" modes->modes[i].stride = cpu_to_le32(qxl_modes[i].stride);",
" modes->modes[i].x_mili = cpu_to_le32(qxl_modes[i].x_mili);",
" modes->modes[i].y_mili = cpu_to_le32(qxl_modes[i].y_mili);",
" modes->modes[i].orientation = cpu_to_le32(qxl_modes[i].orientation);",
" if (maxfb < VGA_RAM_SIZE && d->id == 0)",
" maxfb = VGA_RAM_SIZE;",
" surface0_area_size = ALIGN(maxfb, 4096);"
],
"line_no": [
15,
17,
47,
49,
53,
55,
59,
61,
63,
65,
67,
69,
71,
73,
77,
79,
85
]
}
|
static void FUNC_0(PCIQXLDevice *VAR_0)
{
QXLRom *rom = memory_region_get_ram_ptr(&VAR_0->rom_bar);
QXLModes *modes = (QXLModes *)(rom + 1);
uint32_t ram_header_size;
uint32_t surface0_area_size;
uint32_t num_pages;
uint32_t fb, maxfb = 0;
int VAR_1;
memset(rom, 0, VAR_0->rom_size);
rom->magic = cpu_to_le32(QXL_ROM_MAGIC);
rom->id = cpu_to_le32(VAR_0->id);
rom->log_level = cpu_to_le32(VAR_0->guestdebug);
rom->modes_offset = cpu_to_le32(sizeof(QXLRom));
rom->slot_gen_bits = MEMSLOT_GENERATION_BITS;
rom->slot_id_bits = MEMSLOT_SLOT_BITS;
rom->slots_start = 1;
rom->slots_end = NUM_MEMSLOTS - 1;
rom->n_surfaces = cpu_to_le32(NUM_SURFACES);
modes->n_modes = cpu_to_le32(ARRAY_SIZE(qxl_modes));
for (VAR_1 = 0; VAR_1 < modes->n_modes; VAR_1++) {
fb = qxl_modes[VAR_1].y_res * qxl_modes[VAR_1].stride;
if (maxfb < fb) {
maxfb = fb;
}
modes->modes[VAR_1].id = cpu_to_le32(VAR_1);
modes->modes[VAR_1].x_res = cpu_to_le32(qxl_modes[VAR_1].x_res);
modes->modes[VAR_1].y_res = cpu_to_le32(qxl_modes[VAR_1].y_res);
modes->modes[VAR_1].bits = cpu_to_le32(qxl_modes[VAR_1].bits);
modes->modes[VAR_1].stride = cpu_to_le32(qxl_modes[VAR_1].stride);
modes->modes[VAR_1].x_mili = cpu_to_le32(qxl_modes[VAR_1].x_mili);
modes->modes[VAR_1].y_mili = cpu_to_le32(qxl_modes[VAR_1].y_mili);
modes->modes[VAR_1].orientation = cpu_to_le32(qxl_modes[VAR_1].orientation);
}
if (maxfb < VGA_RAM_SIZE && VAR_0->id == 0)
maxfb = VGA_RAM_SIZE;
ram_header_size = ALIGN(sizeof(QXLRam), 4096);
surface0_area_size = ALIGN(maxfb, 4096);
num_pages = VAR_0->vga.vram_size;
num_pages -= ram_header_size;
num_pages -= surface0_area_size;
num_pages = num_pages / TARGET_PAGE_SIZE;
rom->draw_area_offset = cpu_to_le32(0);
rom->surface0_area_size = cpu_to_le32(surface0_area_size);
rom->pages_offset = cpu_to_le32(surface0_area_size);
rom->num_pages = cpu_to_le32(num_pages);
rom->ram_header_offset = cpu_to_le32(VAR_0->vga.vram_size - ram_header_size);
VAR_0->shadow_rom = *rom;
VAR_0->rom = rom;
VAR_0->modes = modes;
}
|
[
"static void FUNC_0(PCIQXLDevice *VAR_0)\n{",
"QXLRom *rom = memory_region_get_ram_ptr(&VAR_0->rom_bar);",
"QXLModes *modes = (QXLModes *)(rom + 1);",
"uint32_t ram_header_size;",
"uint32_t surface0_area_size;",
"uint32_t num_pages;",
"uint32_t fb, maxfb = 0;",
"int VAR_1;",
"memset(rom, 0, VAR_0->rom_size);",
"rom->magic = cpu_to_le32(QXL_ROM_MAGIC);",
"rom->id = cpu_to_le32(VAR_0->id);",
"rom->log_level = cpu_to_le32(VAR_0->guestdebug);",
"rom->modes_offset = cpu_to_le32(sizeof(QXLRom));",
"rom->slot_gen_bits = MEMSLOT_GENERATION_BITS;",
"rom->slot_id_bits = MEMSLOT_SLOT_BITS;",
"rom->slots_start = 1;",
"rom->slots_end = NUM_MEMSLOTS - 1;",
"rom->n_surfaces = cpu_to_le32(NUM_SURFACES);",
"modes->n_modes = cpu_to_le32(ARRAY_SIZE(qxl_modes));",
"for (VAR_1 = 0; VAR_1 < modes->n_modes; VAR_1++) {",
"fb = qxl_modes[VAR_1].y_res * qxl_modes[VAR_1].stride;",
"if (maxfb < fb) {",
"maxfb = fb;",
"}",
"modes->modes[VAR_1].id = cpu_to_le32(VAR_1);",
"modes->modes[VAR_1].x_res = cpu_to_le32(qxl_modes[VAR_1].x_res);",
"modes->modes[VAR_1].y_res = cpu_to_le32(qxl_modes[VAR_1].y_res);",
"modes->modes[VAR_1].bits = cpu_to_le32(qxl_modes[VAR_1].bits);",
"modes->modes[VAR_1].stride = cpu_to_le32(qxl_modes[VAR_1].stride);",
"modes->modes[VAR_1].x_mili = cpu_to_le32(qxl_modes[VAR_1].x_mili);",
"modes->modes[VAR_1].y_mili = cpu_to_le32(qxl_modes[VAR_1].y_mili);",
"modes->modes[VAR_1].orientation = cpu_to_le32(qxl_modes[VAR_1].orientation);",
"}",
"if (maxfb < VGA_RAM_SIZE && VAR_0->id == 0)\nmaxfb = VGA_RAM_SIZE;",
"ram_header_size = ALIGN(sizeof(QXLRam), 4096);",
"surface0_area_size = ALIGN(maxfb, 4096);",
"num_pages = VAR_0->vga.vram_size;",
"num_pages -= ram_header_size;",
"num_pages -= surface0_area_size;",
"num_pages = num_pages / TARGET_PAGE_SIZE;",
"rom->draw_area_offset = cpu_to_le32(0);",
"rom->surface0_area_size = cpu_to_le32(surface0_area_size);",
"rom->pages_offset = cpu_to_le32(surface0_area_size);",
"rom->num_pages = cpu_to_le32(num_pages);",
"rom->ram_header_offset = cpu_to_le32(VAR_0->vga.vram_size - ram_header_size);",
"VAR_0->shadow_rom = *rom;",
"VAR_0->rom = rom;",
"VAR_0->modes = modes;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
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
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77,
79
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
109
],
[
111
],
[
113
],
[
115
]
] |
17,347
|
roundAndPackFloat128(
flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2 STATUS_PARAM)
{
int8 roundingMode;
flag roundNearestEven, increment, isTiny;
roundingMode = STATUS(float_rounding_mode);
roundNearestEven = ( roundingMode == float_round_nearest_even );
increment = ( (int64_t) zSig2 < 0 );
if ( ! roundNearestEven ) {
if ( roundingMode == float_round_to_zero ) {
increment = 0;
}
else {
if ( zSign ) {
increment = ( roundingMode == float_round_down ) && zSig2;
}
else {
increment = ( roundingMode == float_round_up ) && zSig2;
}
}
}
if ( 0x7FFD <= (uint32_t) zExp ) {
if ( ( 0x7FFD < zExp )
|| ( ( zExp == 0x7FFD )
&& eq128(
LIT64( 0x0001FFFFFFFFFFFF ),
LIT64( 0xFFFFFFFFFFFFFFFF ),
zSig0,
zSig1
)
&& increment
)
) {
float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR);
if ( ( roundingMode == float_round_to_zero )
|| ( zSign && ( roundingMode == float_round_up ) )
|| ( ! zSign && ( roundingMode == float_round_down ) )
) {
return
packFloat128(
zSign,
0x7FFE,
LIT64( 0x0000FFFFFFFFFFFF ),
LIT64( 0xFFFFFFFFFFFFFFFF )
);
}
return packFloat128( zSign, 0x7FFF, 0, 0 );
}
if ( zExp < 0 ) {
if ( STATUS(flush_to_zero) ) return packFloat128( zSign, 0, 0, 0 );
isTiny =
( STATUS(float_detect_tininess) == float_tininess_before_rounding )
|| ( zExp < -1 )
|| ! increment
|| lt128(
zSig0,
zSig1,
LIT64( 0x0001FFFFFFFFFFFF ),
LIT64( 0xFFFFFFFFFFFFFFFF )
);
shift128ExtraRightJamming(
zSig0, zSig1, zSig2, - zExp, &zSig0, &zSig1, &zSig2 );
zExp = 0;
if ( isTiny && zSig2 ) float_raise( float_flag_underflow STATUS_VAR);
if ( roundNearestEven ) {
increment = ( (int64_t) zSig2 < 0 );
}
else {
if ( zSign ) {
increment = ( roundingMode == float_round_down ) && zSig2;
}
else {
increment = ( roundingMode == float_round_up ) && zSig2;
}
}
}
}
if ( zSig2 ) STATUS(float_exception_flags) |= float_flag_inexact;
if ( increment ) {
add128( zSig0, zSig1, 0, 1, &zSig0, &zSig1 );
zSig1 &= ~ ( ( zSig2 + zSig2 == 0 ) & roundNearestEven );
}
else {
if ( ( zSig0 | zSig1 ) == 0 ) zExp = 0;
}
return packFloat128( zSign, zExp, zSig0, zSig1 );
}
| true
|
qemu
|
e6afc87f804abee7d0479be5e8e31c56d885fafb
|
roundAndPackFloat128(
flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2 STATUS_PARAM)
{
int8 roundingMode;
flag roundNearestEven, increment, isTiny;
roundingMode = STATUS(float_rounding_mode);
roundNearestEven = ( roundingMode == float_round_nearest_even );
increment = ( (int64_t) zSig2 < 0 );
if ( ! roundNearestEven ) {
if ( roundingMode == float_round_to_zero ) {
increment = 0;
}
else {
if ( zSign ) {
increment = ( roundingMode == float_round_down ) && zSig2;
}
else {
increment = ( roundingMode == float_round_up ) && zSig2;
}
}
}
if ( 0x7FFD <= (uint32_t) zExp ) {
if ( ( 0x7FFD < zExp )
|| ( ( zExp == 0x7FFD )
&& eq128(
LIT64( 0x0001FFFFFFFFFFFF ),
LIT64( 0xFFFFFFFFFFFFFFFF ),
zSig0,
zSig1
)
&& increment
)
) {
float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR);
if ( ( roundingMode == float_round_to_zero )
|| ( zSign && ( roundingMode == float_round_up ) )
|| ( ! zSign && ( roundingMode == float_round_down ) )
) {
return
packFloat128(
zSign,
0x7FFE,
LIT64( 0x0000FFFFFFFFFFFF ),
LIT64( 0xFFFFFFFFFFFFFFFF )
);
}
return packFloat128( zSign, 0x7FFF, 0, 0 );
}
if ( zExp < 0 ) {
if ( STATUS(flush_to_zero) ) return packFloat128( zSign, 0, 0, 0 );
isTiny =
( STATUS(float_detect_tininess) == float_tininess_before_rounding )
|| ( zExp < -1 )
|| ! increment
|| lt128(
zSig0,
zSig1,
LIT64( 0x0001FFFFFFFFFFFF ),
LIT64( 0xFFFFFFFFFFFFFFFF )
);
shift128ExtraRightJamming(
zSig0, zSig1, zSig2, - zExp, &zSig0, &zSig1, &zSig2 );
zExp = 0;
if ( isTiny && zSig2 ) float_raise( float_flag_underflow STATUS_VAR);
if ( roundNearestEven ) {
increment = ( (int64_t) zSig2 < 0 );
}
else {
if ( zSign ) {
increment = ( roundingMode == float_round_down ) && zSig2;
}
else {
increment = ( roundingMode == float_round_up ) && zSig2;
}
}
}
}
if ( zSig2 ) STATUS(float_exception_flags) |= float_flag_inexact;
if ( increment ) {
add128( zSig0, zSig1, 0, 1, &zSig0, &zSig1 );
zSig1 &= ~ ( ( zSig2 + zSig2 == 0 ) & roundNearestEven );
}
else {
if ( ( zSig0 | zSig1 ) == 0 ) zExp = 0;
}
return packFloat128( zSign, zExp, zSig0, zSig1 );
}
|
{
"code": [
" if ( STATUS(flush_to_zero) ) return packFloat128( zSign, 0, 0, 0 );",
" if ( STATUS(flush_to_zero) ) return packFloat128( zSign, 0, 0, 0 );"
],
"line_no": [
101,
101
]
}
|
FUNC_0(
flag VAR_0, int32 VAR_1, uint64_t VAR_2, uint64_t VAR_3, uint64_t VAR_4 STATUS_PARAM)
{
int8 roundingMode;
flag roundNearestEven, increment, isTiny;
roundingMode = STATUS(float_rounding_mode);
roundNearestEven = ( roundingMode == float_round_nearest_even );
increment = ( (int64_t) VAR_4 < 0 );
if ( ! roundNearestEven ) {
if ( roundingMode == float_round_to_zero ) {
increment = 0;
}
else {
if ( VAR_0 ) {
increment = ( roundingMode == float_round_down ) && VAR_4;
}
else {
increment = ( roundingMode == float_round_up ) && VAR_4;
}
}
}
if ( 0x7FFD <= (uint32_t) VAR_1 ) {
if ( ( 0x7FFD < VAR_1 )
|| ( ( VAR_1 == 0x7FFD )
&& eq128(
LIT64( 0x0001FFFFFFFFFFFF ),
LIT64( 0xFFFFFFFFFFFFFFFF ),
VAR_2,
VAR_3
)
&& increment
)
) {
float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR);
if ( ( roundingMode == float_round_to_zero )
|| ( VAR_0 && ( roundingMode == float_round_up ) )
|| ( ! VAR_0 && ( roundingMode == float_round_down ) )
) {
return
packFloat128(
VAR_0,
0x7FFE,
LIT64( 0x0000FFFFFFFFFFFF ),
LIT64( 0xFFFFFFFFFFFFFFFF )
);
}
return packFloat128( VAR_0, 0x7FFF, 0, 0 );
}
if ( VAR_1 < 0 ) {
if ( STATUS(flush_to_zero) ) return packFloat128( VAR_0, 0, 0, 0 );
isTiny =
( STATUS(float_detect_tininess) == float_tininess_before_rounding )
|| ( VAR_1 < -1 )
|| ! increment
|| lt128(
VAR_2,
VAR_3,
LIT64( 0x0001FFFFFFFFFFFF ),
LIT64( 0xFFFFFFFFFFFFFFFF )
);
shift128ExtraRightJamming(
VAR_2, VAR_3, VAR_4, - VAR_1, &VAR_2, &VAR_3, &VAR_4 );
VAR_1 = 0;
if ( isTiny && VAR_4 ) float_raise( float_flag_underflow STATUS_VAR);
if ( roundNearestEven ) {
increment = ( (int64_t) VAR_4 < 0 );
}
else {
if ( VAR_0 ) {
increment = ( roundingMode == float_round_down ) && VAR_4;
}
else {
increment = ( roundingMode == float_round_up ) && VAR_4;
}
}
}
}
if ( VAR_4 ) STATUS(float_exception_flags) |= float_flag_inexact;
if ( increment ) {
add128( VAR_2, VAR_3, 0, 1, &VAR_2, &VAR_3 );
VAR_3 &= ~ ( ( VAR_4 + VAR_4 == 0 ) & roundNearestEven );
}
else {
if ( ( VAR_2 | VAR_3 ) == 0 ) VAR_1 = 0;
}
return packFloat128( VAR_0, VAR_1, VAR_2, VAR_3 );
}
|
[
"FUNC_0(\nflag VAR_0, int32 VAR_1, uint64_t VAR_2, uint64_t VAR_3, uint64_t VAR_4 STATUS_PARAM)\n{",
"int8 roundingMode;",
"flag roundNearestEven, increment, isTiny;",
"roundingMode = STATUS(float_rounding_mode);",
"roundNearestEven = ( roundingMode == float_round_nearest_even );",
"increment = ( (int64_t) VAR_4 < 0 );",
"if ( ! roundNearestEven ) {",
"if ( roundingMode == float_round_to_zero ) {",
"increment = 0;",
"}",
"else {",
"if ( VAR_0 ) {",
"increment = ( roundingMode == float_round_down ) && VAR_4;",
"}",
"else {",
"increment = ( roundingMode == float_round_up ) && VAR_4;",
"}",
"}",
"}",
"if ( 0x7FFD <= (uint32_t) VAR_1 ) {",
"if ( ( 0x7FFD < VAR_1 )\n|| ( ( VAR_1 == 0x7FFD )\n&& eq128(\nLIT64( 0x0001FFFFFFFFFFFF ),\nLIT64( 0xFFFFFFFFFFFFFFFF ),\nVAR_2,\nVAR_3\n)\n&& increment\n)\n) {",
"float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR);",
"if ( ( roundingMode == float_round_to_zero )\n|| ( VAR_0 && ( roundingMode == float_round_up ) )\n|| ( ! VAR_0 && ( roundingMode == float_round_down ) )\n) {",
"return\npackFloat128(\nVAR_0,\n0x7FFE,\nLIT64( 0x0000FFFFFFFFFFFF ),\nLIT64( 0xFFFFFFFFFFFFFFFF )\n);",
"}",
"return packFloat128( VAR_0, 0x7FFF, 0, 0 );",
"}",
"if ( VAR_1 < 0 ) {",
"if ( STATUS(flush_to_zero) ) return packFloat128( VAR_0, 0, 0, 0 );",
"isTiny =\n( STATUS(float_detect_tininess) == float_tininess_before_rounding )\n|| ( VAR_1 < -1 )\n|| ! increment\n|| lt128(\nVAR_2,\nVAR_3,\nLIT64( 0x0001FFFFFFFFFFFF ),\nLIT64( 0xFFFFFFFFFFFFFFFF )\n);",
"shift128ExtraRightJamming(\nVAR_2, VAR_3, VAR_4, - VAR_1, &VAR_2, &VAR_3, &VAR_4 );",
"VAR_1 = 0;",
"if ( isTiny && VAR_4 ) float_raise( float_flag_underflow STATUS_VAR);",
"if ( roundNearestEven ) {",
"increment = ( (int64_t) VAR_4 < 0 );",
"}",
"else {",
"if ( VAR_0 ) {",
"increment = ( roundingMode == float_round_down ) && VAR_4;",
"}",
"else {",
"increment = ( roundingMode == float_round_up ) && VAR_4;",
"}",
"}",
"}",
"}",
"if ( VAR_4 ) STATUS(float_exception_flags) |= float_flag_inexact;",
"if ( increment ) {",
"add128( VAR_2, VAR_3, 0, 1, &VAR_2, &VAR_3 );",
"VAR_3 &= ~ ( ( VAR_4 + VAR_4 == 0 ) & roundNearestEven );",
"}",
"else {",
"if ( ( VAR_2 | VAR_3 ) == 0 ) VAR_1 = 0;",
"}",
"return packFloat128( VAR_0, VAR_1, VAR_2, 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,
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
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47,
49,
51,
53,
55,
57,
59,
61,
63,
65,
67
],
[
69
],
[
71,
73,
75,
77
],
[
79,
81,
83,
85,
87,
89,
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103,
105,
107,
109,
111,
113,
115,
117,
119,
121
],
[
123,
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
177
]
] |
17,348
|
static inline void RENAME(yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc,
uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
unsigned int width, unsigned int height, int lumStride, int chromStride)
{
/* Y Plane */
memcpy(ydst, ysrc, width*height);
/* XXX: implement upscaling for U,V */
}
| true
|
FFmpeg
|
7f526efd17973ec6d2204f7a47b6923e2be31363
|
static inline void RENAME(yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc,
uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
unsigned int width, unsigned int height, int lumStride, int chromStride)
{
memcpy(ydst, ysrc, width*height);
}
|
{
"code": [
"\tunsigned int width, unsigned int height, int lumStride, int chromStride)"
],
"line_no": [
5
]
}
|
static inline void FUNC_0(yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc,
uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
unsigned int width, unsigned int height, int lumStride, int chromStride)
{
memcpy(ydst, ysrc, width*height);
}
|
[
"static inline void FUNC_0(yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc,\nuint8_t *ydst, uint8_t *udst, uint8_t *vdst,\nunsigned int width, unsigned int height, int lumStride, int chromStride)\n{",
"memcpy(ydst, ysrc, width*height);",
"}"
] |
[
1,
0,
0
] |
[
[
1,
3,
5,
7
],
[
11
],
[
17
]
] |
17,349
|
int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
int n, int coded, const uint8_t *scan_table)
{
int level, i, last, run, run_diff;
int dc_pred_dir;
RLTable *rl;
RL_VLC_ELEM *rl_vlc;
int qmul, qadd;
if (s->mb_intra) {
qmul=1;
qadd=0;
/* DC coef */
level = msmpeg4_decode_dc(s, n, &dc_pred_dir);
if (level < 0){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow- block: %d qscale: %d//\n", n, s->qscale);
if(s->inter_intra_pred) level=0;
else return -1;
}
if (n < 4) {
rl = &rl_table[s->rl_table_index];
if(level > 256*s->y_dc_scale){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ L qscale: %d//\n", s->qscale);
if(!s->inter_intra_pred) return -1;
}
} else {
rl = &rl_table[3 + s->rl_chroma_table_index];
if(level > 256*s->c_dc_scale){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ C qscale: %d//\n", s->qscale);
if(!s->inter_intra_pred) return -1;
}
}
block[0] = level;
run_diff = s->msmpeg4_version >= 4;
i = 0;
if (!coded) {
goto not_coded;
}
if (s->ac_pred) {
if (dc_pred_dir == 0)
scan_table = s->intra_v_scantable.permutated; /* left */
else
scan_table = s->intra_h_scantable.permutated; /* top */
} else {
scan_table = s->intra_scantable.permutated;
}
rl_vlc= rl->rl_vlc[0];
} else {
qmul = s->qscale << 1;
qadd = (s->qscale - 1) | 1;
i = -1;
rl = &rl_table[3 + s->rl_table_index];
if(s->msmpeg4_version==2)
run_diff = 0;
else
run_diff = 1;
if (!coded) {
s->block_last_index[n] = i;
return 0;
}
if(!scan_table)
scan_table = s->inter_scantable.permutated;
rl_vlc= rl->rl_vlc[s->qscale];
}
{
OPEN_READER(re, &s->gb);
for(;;) {
UPDATE_CACHE(re, &s->gb);
GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0);
if (level==0) {
int cache;
cache= GET_CACHE(re, &s->gb);
/* escape */
if (s->msmpeg4_version==1 || (cache&0x80000000)==0) {
if (s->msmpeg4_version==1 || (cache&0x40000000)==0) {
/* third escape */
if(s->msmpeg4_version!=1) LAST_SKIP_BITS(re, &s->gb, 2);
UPDATE_CACHE(re, &s->gb);
if(s->msmpeg4_version<=3){
last= SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);
run= SHOW_UBITS(re, &s->gb, 6); SKIP_CACHE(re, &s->gb, 6);
level= SHOW_SBITS(re, &s->gb, 8); LAST_SKIP_CACHE(re, &s->gb, 8);
SKIP_COUNTER(re, &s->gb, 1+6+8);
}else{
int sign;
last= SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
if(!s->esc3_level_length){
int ll;
//printf("ESC-3 %X at %d %d\n", show_bits(&s->gb, 24), s->mb_x, s->mb_y);
if(s->qscale<8){
ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3);
if(ll==0){
if(SHOW_UBITS(re, &s->gb, 1)) av_log(s->avctx, AV_LOG_ERROR, "cool a new vlc code ,contact the ffmpeg developers and upload the file\n");
SKIP_BITS(re, &s->gb, 1);
ll=8;
}
}else{
ll=2;
while(ll<8 && SHOW_UBITS(re, &s->gb, 1)==0){
ll++;
SKIP_BITS(re, &s->gb, 1);
}
if(ll<8) SKIP_BITS(re, &s->gb, 1);
}
s->esc3_level_length= ll;
s->esc3_run_length= SHOW_UBITS(re, &s->gb, 2) + 3; SKIP_BITS(re, &s->gb, 2);
//printf("level length:%d, run length: %d\n", ll, s->esc3_run_length);
UPDATE_CACHE(re, &s->gb);
}
run= SHOW_UBITS(re, &s->gb, s->esc3_run_length);
SKIP_BITS(re, &s->gb, s->esc3_run_length);
sign= SHOW_UBITS(re, &s->gb, 1);
SKIP_BITS(re, &s->gb, 1);
level= SHOW_UBITS(re, &s->gb, s->esc3_level_length);
SKIP_BITS(re, &s->gb, s->esc3_level_length);
if(sign) level= -level;
}
//printf("level: %d, run: %d at %d %d\n", level, run, s->mb_x, s->mb_y);
#if 0 // waste of time / this will detect very few errors
{
const int abs_level= FFABS(level);
const int run1= run - rl->max_run[last][abs_level] - run_diff;
if(abs_level<=MAX_LEVEL && run<=MAX_RUN){
if(abs_level <= rl->max_level[last][run]){
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n");
return DECODING_AC_LOST;
}
if(abs_level <= rl->max_level[last][run]*2){
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n");
return DECODING_AC_LOST;
}
if(run1>=0 && abs_level <= rl->max_level[last][run1]){
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n");
return DECODING_AC_LOST;
}
}
}
#endif
//level = level * qmul + (level>0) * qadd - (level<=0) * qadd ;
if (level>0) level= level * qmul + qadd;
else level= level * qmul - qadd;
#if 0 // waste of time too :(
if(level>2048 || level<-2048){
av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc\n");
return DECODING_AC_LOST;
}
#endif
i+= run + 1;
if(last) i+=192;
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC3 level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC3 i=%d run=%d level=%d\n", i, run, level);
#endif
} else {
/* second escape */
#if MIN_CACHE_BITS < 23
LAST_SKIP_BITS(re, &s->gb, 2);
UPDATE_CACHE(re, &s->gb);
#else
SKIP_BITS(re, &s->gb, 2);
#endif
GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
i+= run + rl->max_run[run>>7][level/qmul] + run_diff; //FIXME opt indexing
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC2 level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC2 i=%d run=%d level=%d\n", i, run, level);
#endif
}
} else {
/* first escape */
#if MIN_CACHE_BITS < 22
LAST_SKIP_BITS(re, &s->gb, 1);
UPDATE_CACHE(re, &s->gb);
#else
SKIP_BITS(re, &s->gb, 1);
#endif
GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
i+= run;
level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC1 level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC1 i=%d run=%d level=%d\n", i, run, level);
#endif
}
} else {
i+= run;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow i=%d run=%d level=%d\n", i, run, level);
#endif
}
if (i > 62){
i-= 192;
if(i&(~63)){
const int left= s->gb.size_in_bits - get_bits_count(&s->gb);
if(((i+192 == 64 && level/qmul==-1) || s->error_recognition<=1) && left>=0){
av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y);
break;
}else{
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
}
block[scan_table[i]] = level;
break;
}
block[scan_table[i]] = level;
}
CLOSE_READER(re, &s->gb);
}
not_coded:
if (s->mb_intra) {
mpeg4_pred_ac(s, block, n, dc_pred_dir);
if (s->ac_pred) {
i = 63; /* XXX: not optimal */
}
}
if(s->msmpeg4_version>=4 && i>0) i=63; //FIXME/XXX optimize
s->block_last_index[n] = i;
return 0;
}
| true
|
FFmpeg
|
a5037227501dc4f7528684beecee954360cbd7dd
|
int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
int n, int coded, const uint8_t *scan_table)
{
int level, i, last, run, run_diff;
int dc_pred_dir;
RLTable *rl;
RL_VLC_ELEM *rl_vlc;
int qmul, qadd;
if (s->mb_intra) {
qmul=1;
qadd=0;
level = msmpeg4_decode_dc(s, n, &dc_pred_dir);
if (level < 0){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow- block: %d qscale: %d
if(s->inter_intra_pred) level=0;
else return -1;
}
if (n < 4) {
rl = &rl_table[s->rl_table_index];
if(level > 256*s->y_dc_scale){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ L qscale: %d
if(!s->inter_intra_pred) return -1;
}
} else {
rl = &rl_table[3 + s->rl_chroma_table_index];
if(level > 256*s->c_dc_scale){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ C qscale: %d
if(!s->inter_intra_pred) return -1;
}
}
block[0] = level;
run_diff = s->msmpeg4_version >= 4;
i = 0;
if (!coded) {
goto not_coded;
}
if (s->ac_pred) {
if (dc_pred_dir == 0)
scan_table = s->intra_v_scantable.permutated;
else
scan_table = s->intra_h_scantable.permutated;
} else {
scan_table = s->intra_scantable.permutated;
}
rl_vlc= rl->rl_vlc[0];
} else {
qmul = s->qscale << 1;
qadd = (s->qscale - 1) | 1;
i = -1;
rl = &rl_table[3 + s->rl_table_index];
if(s->msmpeg4_version==2)
run_diff = 0;
else
run_diff = 1;
if (!coded) {
s->block_last_index[n] = i;
return 0;
}
if(!scan_table)
scan_table = s->inter_scantable.permutated;
rl_vlc= rl->rl_vlc[s->qscale];
}
{
OPEN_READER(re, &s->gb);
for(;;) {
UPDATE_CACHE(re, &s->gb);
GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0);
if (level==0) {
int cache;
cache= GET_CACHE(re, &s->gb);
if (s->msmpeg4_version==1 || (cache&0x80000000)==0) {
if (s->msmpeg4_version==1 || (cache&0x40000000)==0) {
if(s->msmpeg4_version!=1) LAST_SKIP_BITS(re, &s->gb, 2);
UPDATE_CACHE(re, &s->gb);
if(s->msmpeg4_version<=3){
last= SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);
run= SHOW_UBITS(re, &s->gb, 6); SKIP_CACHE(re, &s->gb, 6);
level= SHOW_SBITS(re, &s->gb, 8); LAST_SKIP_CACHE(re, &s->gb, 8);
SKIP_COUNTER(re, &s->gb, 1+6+8);
}else{
int sign;
last= SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
if(!s->esc3_level_length){
int ll;
if(s->qscale<8){
ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3);
if(ll==0){
if(SHOW_UBITS(re, &s->gb, 1)) av_log(s->avctx, AV_LOG_ERROR, "cool a new vlc code ,contact the ffmpeg developers and upload the file\n");
SKIP_BITS(re, &s->gb, 1);
ll=8;
}
}else{
ll=2;
while(ll<8 && SHOW_UBITS(re, &s->gb, 1)==0){
ll++;
SKIP_BITS(re, &s->gb, 1);
}
if(ll<8) SKIP_BITS(re, &s->gb, 1);
}
s->esc3_level_length= ll;
s->esc3_run_length= SHOW_UBITS(re, &s->gb, 2) + 3; SKIP_BITS(re, &s->gb, 2);
UPDATE_CACHE(re, &s->gb);
}
run= SHOW_UBITS(re, &s->gb, s->esc3_run_length);
SKIP_BITS(re, &s->gb, s->esc3_run_length);
sign= SHOW_UBITS(re, &s->gb, 1);
SKIP_BITS(re, &s->gb, 1);
level= SHOW_UBITS(re, &s->gb, s->esc3_level_length);
SKIP_BITS(re, &s->gb, s->esc3_level_length);
if(sign) level= -level;
}
#if 0
{
const int abs_level= FFABS(level);
const int run1= run - rl->max_run[last][abs_level] - run_diff;
if(abs_level<=MAX_LEVEL && run<=MAX_RUN){
if(abs_level <= rl->max_level[last][run]){
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n");
return DECODING_AC_LOST;
}
if(abs_level <= rl->max_level[last][run]*2){
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n");
return DECODING_AC_LOST;
}
if(run1>=0 && abs_level <= rl->max_level[last][run1]){
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n");
return DECODING_AC_LOST;
}
}
}
#endif
if (level>0) level= level * qmul + qadd;
else level= level * qmul - qadd;
#if 0
if(level>2048 || level<-2048){
av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc\n");
return DECODING_AC_LOST;
}
#endif
i+= run + 1;
if(last) i+=192;
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC3 level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC3 i=%d run=%d level=%d\n", i, run, level);
#endif
} else {
#if MIN_CACHE_BITS < 23
LAST_SKIP_BITS(re, &s->gb, 2);
UPDATE_CACHE(re, &s->gb);
#else
SKIP_BITS(re, &s->gb, 2);
#endif
GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
i+= run + rl->max_run[run>>7][level/qmul] + run_diff;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC2 level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC2 i=%d run=%d level=%d\n", i, run, level);
#endif
}
} else {
#if MIN_CACHE_BITS < 22
LAST_SKIP_BITS(re, &s->gb, 1);
UPDATE_CACHE(re, &s->gb);
#else
SKIP_BITS(re, &s->gb, 1);
#endif
GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
i+= run;
level = level + rl->max_level[run>>7][(run-1)&63] * qmul;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC1 level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC1 i=%d run=%d level=%d\n", i, run, level);
#endif
}
} else {
i+= run;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(re, &s->gb, 1);
#ifdef ERROR_DETAILS
if(run==66)
av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code level=%d\n", level);
else if((i>62 && i<192) || i>192+63)
av_log(s->avctx, AV_LOG_ERROR, "run overflow i=%d run=%d level=%d\n", i, run, level);
#endif
}
if (i > 62){
i-= 192;
if(i&(~63)){
const int left= s->gb.size_in_bits - get_bits_count(&s->gb);
if(((i+192 == 64 && level/qmul==-1) || s->error_recognition<=1) && left>=0){
av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y);
break;
}else{
av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
}
block[scan_table[i]] = level;
break;
}
block[scan_table[i]] = level;
}
CLOSE_READER(re, &s->gb);
}
not_coded:
if (s->mb_intra) {
mpeg4_pred_ac(s, block, n, dc_pred_dir);
if (s->ac_pred) {
i = 63;
}
}
if(s->msmpeg4_version>=4 && i>0) i=63;
s->block_last_index[n] = i;
return 0;
}
|
{
"code": [
" int dc_pred_dir;"
],
"line_no": [
9
]
}
|
int FUNC_0(MpegEncContext * VAR_0, DCTELEM * VAR_1,
int VAR_2, int VAR_3, const uint8_t *VAR_4)
{
int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;
int VAR_10;
RLTable *rl;
RL_VLC_ELEM *rl_vlc;
int VAR_11, VAR_12;
if (VAR_0->mb_intra) {
VAR_11=1;
VAR_12=0;
VAR_5 = msmpeg4_decode_dc(VAR_0, VAR_2, &VAR_10);
if (VAR_5 < 0){
av_log(VAR_0->avctx, AV_LOG_ERROR, "dc overflow- VAR_1: %d qscale: %d
if(VAR_0->inter_intra_pred) VAR_5=0;
else return -1;
}
if (VAR_2 < 4) {
rl = &rl_table[VAR_0->rl_table_index];
if(VAR_5 > 256*VAR_0->y_dc_scale){
av_log(VAR_0->avctx, AV_LOG_ERROR, "dc overflow+ L qscale: %d
if(!VAR_0->inter_intra_pred) return -1;
}
} else {
rl = &rl_table[3 + VAR_0->rl_chroma_table_index];
if(VAR_5 > 256*VAR_0->c_dc_scale){
av_log(VAR_0->avctx, AV_LOG_ERROR, "dc overflow+ C qscale: %d
if(!VAR_0->inter_intra_pred) return -1;
}
}
VAR_1[0] = VAR_5;
VAR_9 = VAR_0->msmpeg4_version >= 4;
VAR_6 = 0;
if (!VAR_3) {
goto not_coded;
}
if (VAR_0->ac_pred) {
if (VAR_10 == 0)
VAR_4 = VAR_0->intra_v_scantable.permutated;
else
VAR_4 = VAR_0->intra_h_scantable.permutated;
} else {
VAR_4 = VAR_0->intra_scantable.permutated;
}
rl_vlc= rl->rl_vlc[0];
} else {
VAR_11 = VAR_0->qscale << 1;
VAR_12 = (VAR_0->qscale - 1) | 1;
VAR_6 = -1;
rl = &rl_table[3 + VAR_0->rl_table_index];
if(VAR_0->msmpeg4_version==2)
VAR_9 = 0;
else
VAR_9 = 1;
if (!VAR_3) {
VAR_0->block_last_index[VAR_2] = VAR_6;
return 0;
}
if(!VAR_4)
VAR_4 = VAR_0->inter_scantable.permutated;
rl_vlc= rl->rl_vlc[VAR_0->qscale];
}
{
OPEN_READER(re, &VAR_0->gb);
for(;;) {
UPDATE_CACHE(re, &VAR_0->gb);
GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2, 0);
if (VAR_5==0) {
int VAR_13;
VAR_13= GET_CACHE(re, &VAR_0->gb);
if (VAR_0->msmpeg4_version==1 || (VAR_13&0x80000000)==0) {
if (VAR_0->msmpeg4_version==1 || (VAR_13&0x40000000)==0) {
if(VAR_0->msmpeg4_version!=1) LAST_SKIP_BITS(re, &VAR_0->gb, 2);
UPDATE_CACHE(re, &VAR_0->gb);
if(VAR_0->msmpeg4_version<=3){
VAR_7= SHOW_UBITS(re, &VAR_0->gb, 1); SKIP_CACHE(re, &VAR_0->gb, 1);
VAR_8= SHOW_UBITS(re, &VAR_0->gb, 6); SKIP_CACHE(re, &VAR_0->gb, 6);
VAR_5= SHOW_SBITS(re, &VAR_0->gb, 8); LAST_SKIP_CACHE(re, &VAR_0->gb, 8);
SKIP_COUNTER(re, &VAR_0->gb, 1+6+8);
}else{
int VAR_14;
VAR_7= SHOW_UBITS(re, &VAR_0->gb, 1); SKIP_BITS(re, &VAR_0->gb, 1);
if(!VAR_0->esc3_level_length){
int VAR_15;
if(VAR_0->qscale<8){
VAR_15= SHOW_UBITS(re, &VAR_0->gb, 3); SKIP_BITS(re, &VAR_0->gb, 3);
if(VAR_15==0){
if(SHOW_UBITS(re, &VAR_0->gb, 1)) av_log(VAR_0->avctx, AV_LOG_ERROR, "cool a new vlc code ,contact the ffmpeg developers and upload the file\VAR_2");
SKIP_BITS(re, &VAR_0->gb, 1);
VAR_15=8;
}
}else{
VAR_15=2;
while(VAR_15<8 && SHOW_UBITS(re, &VAR_0->gb, 1)==0){
VAR_15++;
SKIP_BITS(re, &VAR_0->gb, 1);
}
if(VAR_15<8) SKIP_BITS(re, &VAR_0->gb, 1);
}
VAR_0->esc3_level_length= VAR_15;
VAR_0->esc3_run_length= SHOW_UBITS(re, &VAR_0->gb, 2) + 3; SKIP_BITS(re, &VAR_0->gb, 2);
UPDATE_CACHE(re, &VAR_0->gb);
}
VAR_8= SHOW_UBITS(re, &VAR_0->gb, VAR_0->esc3_run_length);
SKIP_BITS(re, &VAR_0->gb, VAR_0->esc3_run_length);
VAR_14= SHOW_UBITS(re, &VAR_0->gb, 1);
SKIP_BITS(re, &VAR_0->gb, 1);
VAR_5= SHOW_UBITS(re, &VAR_0->gb, VAR_0->esc3_level_length);
SKIP_BITS(re, &VAR_0->gb, VAR_0->esc3_level_length);
if(VAR_14) VAR_5= -VAR_5;
}
#if 0
{
const int abs_level= FFABS(VAR_5);
const int run1= VAR_8 - rl->max_run[VAR_7][abs_level] - VAR_9;
if(abs_level<=MAX_LEVEL && VAR_8<=MAX_RUN){
if(abs_level <= rl->max_level[VAR_7][VAR_8]){
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\VAR_2");
return DECODING_AC_LOST;
}
if(abs_level <= rl->max_level[VAR_7][VAR_8]*2){
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\VAR_2");
return DECODING_AC_LOST;
}
if(run1>=0 && abs_level <= rl->max_level[VAR_7][run1]){
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\VAR_2");
return DECODING_AC_LOST;
}
}
}
#endif
if (VAR_5>0) VAR_5= VAR_5 * VAR_11 + VAR_12;
else VAR_5= VAR_5 * VAR_11 - VAR_12;
#if 0
if(VAR_5>2048 || VAR_5<-2048){
av_log(VAR_0->avctx, AV_LOG_ERROR, "|VAR_5| overflow in 3. esc\VAR_2");
return DECODING_AC_LOST;
}
#endif
VAR_6+= VAR_8 + 1;
if(VAR_7) VAR_6+=192;
#ifdef ERROR_DETAILS
if(VAR_8==66)
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal vlc code in ESC3 VAR_5=%d\VAR_2", VAR_5);
else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)
av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_8 overflow in ESC3 VAR_6=%d VAR_8=%d VAR_5=%d\VAR_2", VAR_6, VAR_8, VAR_5);
#endif
} else {
#if MIN_CACHE_BITS < 23
LAST_SKIP_BITS(re, &VAR_0->gb, 2);
UPDATE_CACHE(re, &VAR_0->gb);
#else
SKIP_BITS(re, &VAR_0->gb, 2);
#endif
GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
VAR_6+= VAR_8 + rl->max_run[VAR_8>>7][VAR_5/VAR_11] + VAR_9;
VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);
LAST_SKIP_BITS(re, &VAR_0->gb, 1);
#ifdef ERROR_DETAILS
if(VAR_8==66)
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal vlc code in ESC2 VAR_5=%d\VAR_2", VAR_5);
else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)
av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_8 overflow in ESC2 VAR_6=%d VAR_8=%d VAR_5=%d\VAR_2", VAR_6, VAR_8, VAR_5);
#endif
}
} else {
#if MIN_CACHE_BITS < 22
LAST_SKIP_BITS(re, &VAR_0->gb, 1);
UPDATE_CACHE(re, &VAR_0->gb);
#else
SKIP_BITS(re, &VAR_0->gb, 1);
#endif
GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
VAR_6+= VAR_8;
VAR_5 = VAR_5 + rl->max_level[VAR_8>>7][(VAR_8-1)&63] * VAR_11;
VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);
LAST_SKIP_BITS(re, &VAR_0->gb, 1);
#ifdef ERROR_DETAILS
if(VAR_8==66)
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal vlc code in ESC1 VAR_5=%d\VAR_2", VAR_5);
else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)
av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_8 overflow in ESC1 VAR_6=%d VAR_8=%d VAR_5=%d\VAR_2", VAR_6, VAR_8, VAR_5);
#endif
}
} else {
VAR_6+= VAR_8;
VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);
LAST_SKIP_BITS(re, &VAR_0->gb, 1);
#ifdef ERROR_DETAILS
if(VAR_8==66)
av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal vlc code VAR_5=%d\VAR_2", VAR_5);
else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)
av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_8 overflow VAR_6=%d VAR_8=%d VAR_5=%d\VAR_2", VAR_6, VAR_8, VAR_5);
#endif
}
if (VAR_6 > 62){
VAR_6-= 192;
if(VAR_6&(~63)){
const int VAR_16= VAR_0->gb.size_in_bits - get_bits_count(&VAR_0->gb);
if(((VAR_6+192 == 64 && VAR_5/VAR_11==-1) || VAR_0->error_recognition<=1) && VAR_16>=0){
av_log(VAR_0->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\VAR_2", VAR_0->mb_x, VAR_0->mb_y);
break;
}else{
av_log(VAR_0->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\VAR_2", VAR_0->mb_x, VAR_0->mb_y);
return -1;
}
}
VAR_1[VAR_4[VAR_6]] = VAR_5;
break;
}
VAR_1[VAR_4[VAR_6]] = VAR_5;
}
CLOSE_READER(re, &VAR_0->gb);
}
not_coded:
if (VAR_0->mb_intra) {
mpeg4_pred_ac(VAR_0, VAR_1, VAR_2, VAR_10);
if (VAR_0->ac_pred) {
VAR_6 = 63;
}
}
if(VAR_0->msmpeg4_version>=4 && VAR_6>0) VAR_6=63;
VAR_0->block_last_index[VAR_2] = VAR_6;
return 0;
}
|
[
"int FUNC_0(MpegEncContext * VAR_0, DCTELEM * VAR_1,\nint VAR_2, int VAR_3, const uint8_t *VAR_4)\n{",
"int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;",
"int VAR_10;",
"RLTable *rl;",
"RL_VLC_ELEM *rl_vlc;",
"int VAR_11, VAR_12;",
"if (VAR_0->mb_intra) {",
"VAR_11=1;",
"VAR_12=0;",
"VAR_5 = msmpeg4_decode_dc(VAR_0, VAR_2, &VAR_10);",
"if (VAR_5 < 0){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"dc overflow- VAR_1: %d qscale: %d\nif(VAR_0->inter_intra_pred) VAR_5=0;",
"else return -1;",
"}",
"if (VAR_2 < 4) {",
"rl = &rl_table[VAR_0->rl_table_index];",
"if(VAR_5 > 256*VAR_0->y_dc_scale){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"dc overflow+ L qscale: %d\nif(!VAR_0->inter_intra_pred) return -1;",
"}",
"} else {",
"rl = &rl_table[3 + VAR_0->rl_chroma_table_index];",
"if(VAR_5 > 256*VAR_0->c_dc_scale){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"dc overflow+ C qscale: %d\nif(!VAR_0->inter_intra_pred) return -1;",
"}",
"}",
"VAR_1[0] = VAR_5;",
"VAR_9 = VAR_0->msmpeg4_version >= 4;",
"VAR_6 = 0;",
"if (!VAR_3) {",
"goto not_coded;",
"}",
"if (VAR_0->ac_pred) {",
"if (VAR_10 == 0)\nVAR_4 = VAR_0->intra_v_scantable.permutated;",
"else\nVAR_4 = VAR_0->intra_h_scantable.permutated;",
"} else {",
"VAR_4 = VAR_0->intra_scantable.permutated;",
"}",
"rl_vlc= rl->rl_vlc[0];",
"} else {",
"VAR_11 = VAR_0->qscale << 1;",
"VAR_12 = (VAR_0->qscale - 1) | 1;",
"VAR_6 = -1;",
"rl = &rl_table[3 + VAR_0->rl_table_index];",
"if(VAR_0->msmpeg4_version==2)\nVAR_9 = 0;",
"else\nVAR_9 = 1;",
"if (!VAR_3) {",
"VAR_0->block_last_index[VAR_2] = VAR_6;",
"return 0;",
"}",
"if(!VAR_4)\nVAR_4 = VAR_0->inter_scantable.permutated;",
"rl_vlc= rl->rl_vlc[VAR_0->qscale];",
"}",
"{",
"OPEN_READER(re, &VAR_0->gb);",
"for(;;) {",
"UPDATE_CACHE(re, &VAR_0->gb);",
"GET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2, 0);",
"if (VAR_5==0) {",
"int VAR_13;",
"VAR_13= GET_CACHE(re, &VAR_0->gb);",
"if (VAR_0->msmpeg4_version==1 || (VAR_13&0x80000000)==0) {",
"if (VAR_0->msmpeg4_version==1 || (VAR_13&0x40000000)==0) {",
"if(VAR_0->msmpeg4_version!=1) LAST_SKIP_BITS(re, &VAR_0->gb, 2);",
"UPDATE_CACHE(re, &VAR_0->gb);",
"if(VAR_0->msmpeg4_version<=3){",
"VAR_7= SHOW_UBITS(re, &VAR_0->gb, 1); SKIP_CACHE(re, &VAR_0->gb, 1);",
"VAR_8= SHOW_UBITS(re, &VAR_0->gb, 6); SKIP_CACHE(re, &VAR_0->gb, 6);",
"VAR_5= SHOW_SBITS(re, &VAR_0->gb, 8); LAST_SKIP_CACHE(re, &VAR_0->gb, 8);",
"SKIP_COUNTER(re, &VAR_0->gb, 1+6+8);",
"}else{",
"int VAR_14;",
"VAR_7= SHOW_UBITS(re, &VAR_0->gb, 1); SKIP_BITS(re, &VAR_0->gb, 1);",
"if(!VAR_0->esc3_level_length){",
"int VAR_15;",
"if(VAR_0->qscale<8){",
"VAR_15= SHOW_UBITS(re, &VAR_0->gb, 3); SKIP_BITS(re, &VAR_0->gb, 3);",
"if(VAR_15==0){",
"if(SHOW_UBITS(re, &VAR_0->gb, 1)) av_log(VAR_0->avctx, AV_LOG_ERROR, \"cool a new vlc code ,contact the ffmpeg developers and upload the file\\VAR_2\");",
"SKIP_BITS(re, &VAR_0->gb, 1);",
"VAR_15=8;",
"}",
"}else{",
"VAR_15=2;",
"while(VAR_15<8 && SHOW_UBITS(re, &VAR_0->gb, 1)==0){",
"VAR_15++;",
"SKIP_BITS(re, &VAR_0->gb, 1);",
"}",
"if(VAR_15<8) SKIP_BITS(re, &VAR_0->gb, 1);",
"}",
"VAR_0->esc3_level_length= VAR_15;",
"VAR_0->esc3_run_length= SHOW_UBITS(re, &VAR_0->gb, 2) + 3; SKIP_BITS(re, &VAR_0->gb, 2);",
"UPDATE_CACHE(re, &VAR_0->gb);",
"}",
"VAR_8= SHOW_UBITS(re, &VAR_0->gb, VAR_0->esc3_run_length);",
"SKIP_BITS(re, &VAR_0->gb, VAR_0->esc3_run_length);",
"VAR_14= SHOW_UBITS(re, &VAR_0->gb, 1);",
"SKIP_BITS(re, &VAR_0->gb, 1);",
"VAR_5= SHOW_UBITS(re, &VAR_0->gb, VAR_0->esc3_level_length);",
"SKIP_BITS(re, &VAR_0->gb, VAR_0->esc3_level_length);",
"if(VAR_14) VAR_5= -VAR_5;",
"}",
"#if 0\n{",
"const int abs_level= FFABS(VAR_5);",
"const int run1= VAR_8 - rl->max_run[VAR_7][abs_level] - VAR_9;",
"if(abs_level<=MAX_LEVEL && VAR_8<=MAX_RUN){",
"if(abs_level <= rl->max_level[VAR_7][VAR_8]){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal 3. esc, vlc encoding possible\\VAR_2\");",
"return DECODING_AC_LOST;",
"}",
"if(abs_level <= rl->max_level[VAR_7][VAR_8]*2){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal 3. esc, esc 1 encoding possible\\VAR_2\");",
"return DECODING_AC_LOST;",
"}",
"if(run1>=0 && abs_level <= rl->max_level[VAR_7][run1]){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal 3. esc, esc 2 encoding possible\\VAR_2\");",
"return DECODING_AC_LOST;",
"}",
"}",
"}",
"#endif\nif (VAR_5>0) VAR_5= VAR_5 * VAR_11 + VAR_12;",
"else VAR_5= VAR_5 * VAR_11 - VAR_12;",
"#if 0\nif(VAR_5>2048 || VAR_5<-2048){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"|VAR_5| overflow in 3. esc\\VAR_2\");",
"return DECODING_AC_LOST;",
"}",
"#endif\nVAR_6+= VAR_8 + 1;",
"if(VAR_7) VAR_6+=192;",
"#ifdef ERROR_DETAILS\nif(VAR_8==66)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal vlc code in ESC3 VAR_5=%d\\VAR_2\", VAR_5);",
"else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_8 overflow in ESC3 VAR_6=%d VAR_8=%d VAR_5=%d\\VAR_2\", VAR_6, VAR_8, VAR_5);",
"#endif\n} else {",
"#if MIN_CACHE_BITS < 23\nLAST_SKIP_BITS(re, &VAR_0->gb, 2);",
"UPDATE_CACHE(re, &VAR_0->gb);",
"#else\nSKIP_BITS(re, &VAR_0->gb, 2);",
"#endif\nGET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2, 1);",
"VAR_6+= VAR_8 + rl->max_run[VAR_8>>7][VAR_5/VAR_11] + VAR_9;",
"VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);",
"LAST_SKIP_BITS(re, &VAR_0->gb, 1);",
"#ifdef ERROR_DETAILS\nif(VAR_8==66)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal vlc code in ESC2 VAR_5=%d\\VAR_2\", VAR_5);",
"else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_8 overflow in ESC2 VAR_6=%d VAR_8=%d VAR_5=%d\\VAR_2\", VAR_6, VAR_8, VAR_5);",
"#endif\n}",
"} else {",
"#if MIN_CACHE_BITS < 22\nLAST_SKIP_BITS(re, &VAR_0->gb, 1);",
"UPDATE_CACHE(re, &VAR_0->gb);",
"#else\nSKIP_BITS(re, &VAR_0->gb, 1);",
"#endif\nGET_RL_VLC(VAR_5, VAR_8, re, &VAR_0->gb, rl_vlc, TEX_VLC_BITS, 2, 1);",
"VAR_6+= VAR_8;",
"VAR_5 = VAR_5 + rl->max_level[VAR_8>>7][(VAR_8-1)&63] * VAR_11;",
"VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);",
"LAST_SKIP_BITS(re, &VAR_0->gb, 1);",
"#ifdef ERROR_DETAILS\nif(VAR_8==66)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal vlc code in ESC1 VAR_5=%d\\VAR_2\", VAR_5);",
"else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_8 overflow in ESC1 VAR_6=%d VAR_8=%d VAR_5=%d\\VAR_2\", VAR_6, VAR_8, VAR_5);",
"#endif\n}",
"} else {",
"VAR_6+= VAR_8;",
"VAR_5 = (VAR_5 ^ SHOW_SBITS(re, &VAR_0->gb, 1)) - SHOW_SBITS(re, &VAR_0->gb, 1);",
"LAST_SKIP_BITS(re, &VAR_0->gb, 1);",
"#ifdef ERROR_DETAILS\nif(VAR_8==66)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal vlc code VAR_5=%d\\VAR_2\", VAR_5);",
"else if((VAR_6>62 && VAR_6<192) || VAR_6>192+63)\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_8 overflow VAR_6=%d VAR_8=%d VAR_5=%d\\VAR_2\", VAR_6, VAR_8, VAR_5);",
"#endif\n}",
"if (VAR_6 > 62){",
"VAR_6-= 192;",
"if(VAR_6&(~63)){",
"const int VAR_16= VAR_0->gb.size_in_bits - get_bits_count(&VAR_0->gb);",
"if(((VAR_6+192 == 64 && VAR_5/VAR_11==-1) || VAR_0->error_recognition<=1) && VAR_16>=0){",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"ignoring overflow at %d %d\\VAR_2\", VAR_0->mb_x, VAR_0->mb_y);",
"break;",
"}else{",
"av_log(VAR_0->avctx, AV_LOG_ERROR, \"ac-tex damaged at %d %d\\VAR_2\", VAR_0->mb_x, VAR_0->mb_y);",
"return -1;",
"}",
"}",
"VAR_1[VAR_4[VAR_6]] = VAR_5;",
"break;",
"}",
"VAR_1[VAR_4[VAR_6]] = VAR_5;",
"}",
"CLOSE_READER(re, &VAR_0->gb);",
"}",
"not_coded:\nif (VAR_0->mb_intra) {",
"mpeg4_pred_ac(VAR_0, VAR_1, VAR_2, VAR_10);",
"if (VAR_0->ac_pred) {",
"VAR_6 = 63;",
"}",
"}",
"if(VAR_0->msmpeg4_version>=4 && VAR_6>0) VAR_6=63;",
"VAR_0->block_last_index[VAR_2] = VAR_6;",
"return 0;",
"}"
] |
[
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
29
],
[
33
],
[
35,
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61,
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85,
87
],
[
89,
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
113,
115
],
[
117,
119
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131,
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
157
],
[
159
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
221
],
[
223
],
[
227
],
[
229
],
[
231
],
[
233
],
[
237
],
[
239
],
[
243
],
[
245
],
[
247
],
[
249
],
[
253,
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
],
[
281
],
[
283
],
[
285
],
[
287
],
[
289
],
[
291,
295
],
[
297
],
[
299,
301
],
[
303
],
[
305
],
[
307
],
[
309,
311
],
[
313
],
[
315,
317,
319
],
[
321,
323
],
[
325,
327
],
[
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,
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
],
[
453
],
[
455
],
[
457
],
[
461
],
[
463
],
[
465
],
[
467
],
[
469,
471
],
[
473
],
[
475
],
[
477
],
[
479
],
[
481
],
[
483
],
[
485
],
[
489
],
[
491
]
] |
17,351
|
static void sub2video_copy_rect(uint8_t *dst, int dst_linesize, int w, int h,
AVSubtitleRect *r)
{
uint32_t *pal, *dst2;
uint8_t *src, *src2;
int x, y;
if (r->type != SUBTITLE_BITMAP) {
av_log(NULL, AV_LOG_WARNING, "sub2video: non-bitmap subtitle\n");
return;
}
if (r->x < 0 || r->x + r->w > w || r->y < 0 || r->y + r->h > h) {
av_log(NULL, AV_LOG_WARNING, "sub2video: rectangle overflowing\n");
return;
}
dst += r->y * dst_linesize + r->x * 4;
src = r->pict.data[0];
pal = (uint32_t *)r->pict.data[1];
for (y = 0; y < r->h; y++) {
dst2 = (uint32_t *)dst;
src2 = src;
for (x = 0; x < r->w; x++)
*(dst2++) = pal[*(src2++)];
dst += dst_linesize;
src += r->pict.linesize[0];
}
}
| true
|
FFmpeg
|
0ac83047f67bb56406c66d4ca664d3c0cb07c2f2
|
static void sub2video_copy_rect(uint8_t *dst, int dst_linesize, int w, int h,
AVSubtitleRect *r)
{
uint32_t *pal, *dst2;
uint8_t *src, *src2;
int x, y;
if (r->type != SUBTITLE_BITMAP) {
av_log(NULL, AV_LOG_WARNING, "sub2video: non-bitmap subtitle\n");
return;
}
if (r->x < 0 || r->x + r->w > w || r->y < 0 || r->y + r->h > h) {
av_log(NULL, AV_LOG_WARNING, "sub2video: rectangle overflowing\n");
return;
}
dst += r->y * dst_linesize + r->x * 4;
src = r->pict.data[0];
pal = (uint32_t *)r->pict.data[1];
for (y = 0; y < r->h; y++) {
dst2 = (uint32_t *)dst;
src2 = src;
for (x = 0; x < r->w; x++)
*(dst2++) = pal[*(src2++)];
dst += dst_linesize;
src += r->pict.linesize[0];
}
}
|
{
"code": [
" av_log(NULL, AV_LOG_WARNING, \"sub2video: rectangle overflowing\\n\");"
],
"line_no": [
25
]
}
|
static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3,
AVSubtitleRect *VAR_4)
{
uint32_t *pal, *dst2;
uint8_t *src, *src2;
int VAR_5, VAR_6;
if (VAR_4->type != SUBTITLE_BITMAP) {
av_log(NULL, AV_LOG_WARNING, "sub2video: non-bitmap subtitle\n");
return;
}
if (VAR_4->VAR_5 < 0 || VAR_4->VAR_5 + VAR_4->VAR_2 > VAR_2 || VAR_4->VAR_6 < 0 || VAR_4->VAR_6 + VAR_4->VAR_3 > VAR_3) {
av_log(NULL, AV_LOG_WARNING, "sub2video: rectangle overflowing\n");
return;
}
VAR_0 += VAR_4->VAR_6 * VAR_1 + VAR_4->VAR_5 * 4;
src = VAR_4->pict.data[0];
pal = (uint32_t *)VAR_4->pict.data[1];
for (VAR_6 = 0; VAR_6 < VAR_4->VAR_3; VAR_6++) {
dst2 = (uint32_t *)VAR_0;
src2 = src;
for (VAR_5 = 0; VAR_5 < VAR_4->VAR_2; VAR_5++)
*(dst2++) = pal[*(src2++)];
VAR_0 += VAR_1;
src += VAR_4->pict.linesize[0];
}
}
|
[
"static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3,\nAVSubtitleRect *VAR_4)\n{",
"uint32_t *pal, *dst2;",
"uint8_t *src, *src2;",
"int VAR_5, VAR_6;",
"if (VAR_4->type != SUBTITLE_BITMAP) {",
"av_log(NULL, AV_LOG_WARNING, \"sub2video: non-bitmap subtitle\\n\");",
"return;",
"}",
"if (VAR_4->VAR_5 < 0 || VAR_4->VAR_5 + VAR_4->VAR_2 > VAR_2 || VAR_4->VAR_6 < 0 || VAR_4->VAR_6 + VAR_4->VAR_3 > VAR_3) {",
"av_log(NULL, AV_LOG_WARNING, \"sub2video: rectangle overflowing\\n\");",
"return;",
"}",
"VAR_0 += VAR_4->VAR_6 * VAR_1 + VAR_4->VAR_5 * 4;",
"src = VAR_4->pict.data[0];",
"pal = (uint32_t *)VAR_4->pict.data[1];",
"for (VAR_6 = 0; VAR_6 < VAR_4->VAR_3; VAR_6++) {",
"dst2 = (uint32_t *)VAR_0;",
"src2 = src;",
"for (VAR_5 = 0; VAR_5 < VAR_4->VAR_2; VAR_5++)",
"*(dst2++) = pal[*(src2++)];",
"VAR_0 += VAR_1;",
"src += VAR_4->pict.linesize[0];",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
]
] |
17,352
|
SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avctx)
{
unsigned int num_formats = sizeof(ff_schro_video_formats) /
sizeof(ff_schro_video_formats[0]);
unsigned int idx = get_video_format_idx(avctx);
return (idx < num_formats) ? ff_schro_video_formats[idx] :
SCHRO_VIDEO_FORMAT_CUSTOM;
}
| true
|
FFmpeg
|
220b24c7c97dc033ceab1510549f66d0e7b52ef1
|
SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avctx)
{
unsigned int num_formats = sizeof(ff_schro_video_formats) /
sizeof(ff_schro_video_formats[0]);
unsigned int idx = get_video_format_idx(avctx);
return (idx < num_formats) ? ff_schro_video_formats[idx] :
SCHRO_VIDEO_FORMAT_CUSTOM;
}
|
{
"code": [
"SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avctx)",
" unsigned int num_formats = sizeof(ff_schro_video_formats) /",
" sizeof(ff_schro_video_formats[0]);",
" unsigned int idx = get_video_format_idx(avctx);",
" return (idx < num_formats) ? ff_schro_video_formats[idx] :",
" SCHRO_VIDEO_FORMAT_CUSTOM;"
],
"line_no": [
1,
5,
7,
11,
15,
17
]
}
|
SchroVideoFormatEnum FUNC_0(AVCodecContext *avctx)
{
unsigned int VAR_0 = sizeof(ff_schro_video_formats) /
sizeof(ff_schro_video_formats[0]);
unsigned int VAR_1 = get_video_format_idx(avctx);
return (VAR_1 < VAR_0) ? ff_schro_video_formats[VAR_1] :
SCHRO_VIDEO_FORMAT_CUSTOM;
}
|
[
"SchroVideoFormatEnum FUNC_0(AVCodecContext *avctx)\n{",
"unsigned int VAR_0 = sizeof(ff_schro_video_formats) /\nsizeof(ff_schro_video_formats[0]);",
"unsigned int VAR_1 = get_video_format_idx(avctx);",
"return (VAR_1 < VAR_0) ? ff_schro_video_formats[VAR_1] :\nSCHRO_VIDEO_FORMAT_CUSTOM;",
"}"
] |
[
1,
1,
1,
1,
0
] |
[
[
1,
3
],
[
5,
7
],
[
11
],
[
15,
17
],
[
19
]
] |
17,354
|
void qemu_console_copy(QemuConsole *con, int src_x, int src_y,
int dst_x, int dst_y, int w, int h)
{
assert(con->console_type == GRAPHIC_CONSOLE);
dpy_gfx_copy(con, src_x, src_y, dst_x, dst_y, w, h);
}
| true
|
qemu
|
50628d3479e4f9aa97e323506856e394fe7ad7a6
|
void qemu_console_copy(QemuConsole *con, int src_x, int src_y,
int dst_x, int dst_y, int w, int h)
{
assert(con->console_type == GRAPHIC_CONSOLE);
dpy_gfx_copy(con, src_x, src_y, dst_x, dst_y, w, h);
}
|
{
"code": [
"void qemu_console_copy(QemuConsole *con, int src_x, int src_y,",
"void qemu_console_copy(QemuConsole *con, int src_x, int src_y,",
" int dst_x, int dst_y, int w, int h)",
" assert(con->console_type == GRAPHIC_CONSOLE);",
" dpy_gfx_copy(con, src_x, src_y, dst_x, dst_y, w, h);"
],
"line_no": [
1,
1,
3,
7,
9
]
}
|
void FUNC_0(QemuConsole *VAR_0, int VAR_1, int VAR_2,
int VAR_3, int VAR_4, int VAR_5, int VAR_6)
{
assert(VAR_0->console_type == GRAPHIC_CONSOLE);
dpy_gfx_copy(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6);
}
|
[
"void FUNC_0(QemuConsole *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int VAR_5, int VAR_6)\n{",
"assert(VAR_0->console_type == GRAPHIC_CONSOLE);",
"dpy_gfx_copy(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6);",
"}"
] |
[
1,
1,
1,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
]
] |
17,356
|
static int aac_adtstoasc_init(AVBSFContext *ctx)
{
av_freep(&ctx->par_out->extradata);
ctx->par_out->extradata_size = 0;
return 0;
}
| false
|
FFmpeg
|
45d199d5b0b7f09eb9baa29929a3bd07ed46223b
|
static int aac_adtstoasc_init(AVBSFContext *ctx)
{
av_freep(&ctx->par_out->extradata);
ctx->par_out->extradata_size = 0;
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVBSFContext *VAR_0)
{
av_freep(&VAR_0->par_out->extradata);
VAR_0->par_out->extradata_size = 0;
return 0;
}
|
[
"static int FUNC_0(AVBSFContext *VAR_0)\n{",
"av_freep(&VAR_0->par_out->extradata);",
"VAR_0->par_out->extradata_size = 0;",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
]
] |
17,359
|
static int dmg_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
BDRVDMGState *s = bs->opaque;
uint64_t info_begin, info_end, last_in_offset, last_out_offset;
uint32_t count, tmp;
uint32_t max_compressed_size = 1, max_sectors_per_chunk = 1, i;
int64_t offset;
int ret;
bs->read_only = 1;
s->n_chunks = 0;
s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL;
/* read offset of info blocks */
offset = bdrv_getlength(bs->file);
if (offset < 0) {
ret = offset;
goto fail;
}
offset -= 0x1d8;
ret = read_uint64(bs, offset, &info_begin);
if (ret < 0) {
goto fail;
} else if (info_begin == 0) {
ret = -EINVAL;
goto fail;
}
ret = read_uint32(bs, info_begin, &tmp);
if (ret < 0) {
goto fail;
} else if (tmp != 0x100) {
ret = -EINVAL;
goto fail;
}
ret = read_uint32(bs, info_begin + 4, &count);
if (ret < 0) {
goto fail;
} else if (count == 0) {
ret = -EINVAL;
goto fail;
}
info_end = info_begin + count;
offset = info_begin + 0x100;
/* read offsets */
last_in_offset = last_out_offset = 0;
while (offset < info_end) {
uint32_t type;
ret = read_uint32(bs, offset, &count);
if (ret < 0) {
goto fail;
} else if (count == 0) {
ret = -EINVAL;
goto fail;
}
offset += 4;
ret = read_uint32(bs, offset, &type);
if (ret < 0) {
goto fail;
}
if (type == 0x6d697368 && count >= 244) {
size_t new_size;
uint32_t chunk_count;
offset += 4;
offset += 200;
chunk_count = (count - 204) / 40;
new_size = sizeof(uint64_t) * (s->n_chunks + chunk_count);
s->types = g_realloc(s->types, new_size / 2);
s->offsets = g_realloc(s->offsets, new_size);
s->lengths = g_realloc(s->lengths, new_size);
s->sectors = g_realloc(s->sectors, new_size);
s->sectorcounts = g_realloc(s->sectorcounts, new_size);
for (i = s->n_chunks; i < s->n_chunks + chunk_count; i++) {
ret = read_uint32(bs, offset, &s->types[i]);
if (ret < 0) {
goto fail;
}
offset += 4;
if (s->types[i] != 0x80000005 && s->types[i] != 1 &&
s->types[i] != 2) {
if (s->types[i] == 0xffffffff && i > 0) {
last_in_offset = s->offsets[i - 1] + s->lengths[i - 1];
last_out_offset = s->sectors[i - 1] +
s->sectorcounts[i - 1];
}
chunk_count--;
i--;
offset += 36;
continue;
}
offset += 4;
ret = read_uint64(bs, offset, &s->sectors[i]);
if (ret < 0) {
goto fail;
}
s->sectors[i] += last_out_offset;
offset += 8;
ret = read_uint64(bs, offset, &s->sectorcounts[i]);
if (ret < 0) {
goto fail;
}
offset += 8;
if (s->sectorcounts[i] > DMG_SECTORCOUNTS_MAX) {
error_report("sector count %" PRIu64 " for chunk %" PRIu32
" is larger than max (%u)",
s->sectorcounts[i], i, DMG_SECTORCOUNTS_MAX);
ret = -EINVAL;
goto fail;
}
ret = read_uint64(bs, offset, &s->offsets[i]);
if (ret < 0) {
goto fail;
}
s->offsets[i] += last_in_offset;
offset += 8;
ret = read_uint64(bs, offset, &s->lengths[i]);
if (ret < 0) {
goto fail;
}
offset += 8;
if (s->lengths[i] > DMG_LENGTHS_MAX) {
error_report("length %" PRIu64 " for chunk %" PRIu32
" is larger than max (%u)",
s->lengths[i], i, DMG_LENGTHS_MAX);
ret = -EINVAL;
goto fail;
}
update_max_chunk_size(s, i, &max_compressed_size,
&max_sectors_per_chunk);
}
s->n_chunks += chunk_count;
}
}
/* initialize zlib engine */
s->compressed_chunk = qemu_try_blockalign(bs->file,
max_compressed_size + 1);
s->uncompressed_chunk = qemu_try_blockalign(bs->file,
512 * max_sectors_per_chunk);
if (s->compressed_chunk == NULL || s->uncompressed_chunk == NULL) {
ret = -ENOMEM;
goto fail;
}
if (inflateInit(&s->zstream) != Z_OK) {
ret = -EINVAL;
goto fail;
}
s->current_chunk = s->n_chunks;
qemu_co_mutex_init(&s->lock);
return 0;
fail:
g_free(s->types);
g_free(s->offsets);
g_free(s->lengths);
g_free(s->sectors);
g_free(s->sectorcounts);
qemu_vfree(s->compressed_chunk);
qemu_vfree(s->uncompressed_chunk);
return ret;
}
| true
|
qemu
|
fa8354bd226617e2afcc45c27a74959c15291cc0
|
static int dmg_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
BDRVDMGState *s = bs->opaque;
uint64_t info_begin, info_end, last_in_offset, last_out_offset;
uint32_t count, tmp;
uint32_t max_compressed_size = 1, max_sectors_per_chunk = 1, i;
int64_t offset;
int ret;
bs->read_only = 1;
s->n_chunks = 0;
s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL;
offset = bdrv_getlength(bs->file);
if (offset < 0) {
ret = offset;
goto fail;
}
offset -= 0x1d8;
ret = read_uint64(bs, offset, &info_begin);
if (ret < 0) {
goto fail;
} else if (info_begin == 0) {
ret = -EINVAL;
goto fail;
}
ret = read_uint32(bs, info_begin, &tmp);
if (ret < 0) {
goto fail;
} else if (tmp != 0x100) {
ret = -EINVAL;
goto fail;
}
ret = read_uint32(bs, info_begin + 4, &count);
if (ret < 0) {
goto fail;
} else if (count == 0) {
ret = -EINVAL;
goto fail;
}
info_end = info_begin + count;
offset = info_begin + 0x100;
last_in_offset = last_out_offset = 0;
while (offset < info_end) {
uint32_t type;
ret = read_uint32(bs, offset, &count);
if (ret < 0) {
goto fail;
} else if (count == 0) {
ret = -EINVAL;
goto fail;
}
offset += 4;
ret = read_uint32(bs, offset, &type);
if (ret < 0) {
goto fail;
}
if (type == 0x6d697368 && count >= 244) {
size_t new_size;
uint32_t chunk_count;
offset += 4;
offset += 200;
chunk_count = (count - 204) / 40;
new_size = sizeof(uint64_t) * (s->n_chunks + chunk_count);
s->types = g_realloc(s->types, new_size / 2);
s->offsets = g_realloc(s->offsets, new_size);
s->lengths = g_realloc(s->lengths, new_size);
s->sectors = g_realloc(s->sectors, new_size);
s->sectorcounts = g_realloc(s->sectorcounts, new_size);
for (i = s->n_chunks; i < s->n_chunks + chunk_count; i++) {
ret = read_uint32(bs, offset, &s->types[i]);
if (ret < 0) {
goto fail;
}
offset += 4;
if (s->types[i] != 0x80000005 && s->types[i] != 1 &&
s->types[i] != 2) {
if (s->types[i] == 0xffffffff && i > 0) {
last_in_offset = s->offsets[i - 1] + s->lengths[i - 1];
last_out_offset = s->sectors[i - 1] +
s->sectorcounts[i - 1];
}
chunk_count--;
i--;
offset += 36;
continue;
}
offset += 4;
ret = read_uint64(bs, offset, &s->sectors[i]);
if (ret < 0) {
goto fail;
}
s->sectors[i] += last_out_offset;
offset += 8;
ret = read_uint64(bs, offset, &s->sectorcounts[i]);
if (ret < 0) {
goto fail;
}
offset += 8;
if (s->sectorcounts[i] > DMG_SECTORCOUNTS_MAX) {
error_report("sector count %" PRIu64 " for chunk %" PRIu32
" is larger than max (%u)",
s->sectorcounts[i], i, DMG_SECTORCOUNTS_MAX);
ret = -EINVAL;
goto fail;
}
ret = read_uint64(bs, offset, &s->offsets[i]);
if (ret < 0) {
goto fail;
}
s->offsets[i] += last_in_offset;
offset += 8;
ret = read_uint64(bs, offset, &s->lengths[i]);
if (ret < 0) {
goto fail;
}
offset += 8;
if (s->lengths[i] > DMG_LENGTHS_MAX) {
error_report("length %" PRIu64 " for chunk %" PRIu32
" is larger than max (%u)",
s->lengths[i], i, DMG_LENGTHS_MAX);
ret = -EINVAL;
goto fail;
}
update_max_chunk_size(s, i, &max_compressed_size,
&max_sectors_per_chunk);
}
s->n_chunks += chunk_count;
}
}
s->compressed_chunk = qemu_try_blockalign(bs->file,
max_compressed_size + 1);
s->uncompressed_chunk = qemu_try_blockalign(bs->file,
512 * max_sectors_per_chunk);
if (s->compressed_chunk == NULL || s->uncompressed_chunk == NULL) {
ret = -ENOMEM;
goto fail;
}
if (inflateInit(&s->zstream) != Z_OK) {
ret = -EINVAL;
goto fail;
}
s->current_chunk = s->n_chunks;
qemu_co_mutex_init(&s->lock);
return 0;
fail:
g_free(s->types);
g_free(s->offsets);
g_free(s->lengths);
g_free(s->sectors);
g_free(s->sectorcounts);
qemu_vfree(s->compressed_chunk);
qemu_vfree(s->uncompressed_chunk);
return ret;
}
|
{
"code": [
" offset = bdrv_getlength(bs->file);",
" offset -= 0x1d8;",
" ret = read_uint64(bs, offset, &info_begin);"
],
"line_no": [
31,
41,
45
]
}
|
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,
Error **VAR_3)
{
BDRVDMGState *s = VAR_0->opaque;
uint64_t info_begin, info_end, last_in_offset, last_out_offset;
uint32_t count, tmp;
uint32_t max_compressed_size = 1, max_sectors_per_chunk = 1, i;
int64_t offset;
int VAR_4;
VAR_0->read_only = 1;
s->n_chunks = 0;
s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL;
offset = bdrv_getlength(VAR_0->file);
if (offset < 0) {
VAR_4 = offset;
goto fail;
}
offset -= 0x1d8;
VAR_4 = read_uint64(VAR_0, offset, &info_begin);
if (VAR_4 < 0) {
goto fail;
} else if (info_begin == 0) {
VAR_4 = -EINVAL;
goto fail;
}
VAR_4 = read_uint32(VAR_0, info_begin, &tmp);
if (VAR_4 < 0) {
goto fail;
} else if (tmp != 0x100) {
VAR_4 = -EINVAL;
goto fail;
}
VAR_4 = read_uint32(VAR_0, info_begin + 4, &count);
if (VAR_4 < 0) {
goto fail;
} else if (count == 0) {
VAR_4 = -EINVAL;
goto fail;
}
info_end = info_begin + count;
offset = info_begin + 0x100;
last_in_offset = last_out_offset = 0;
while (offset < info_end) {
uint32_t type;
VAR_4 = read_uint32(VAR_0, offset, &count);
if (VAR_4 < 0) {
goto fail;
} else if (count == 0) {
VAR_4 = -EINVAL;
goto fail;
}
offset += 4;
VAR_4 = read_uint32(VAR_0, offset, &type);
if (VAR_4 < 0) {
goto fail;
}
if (type == 0x6d697368 && count >= 244) {
size_t new_size;
uint32_t chunk_count;
offset += 4;
offset += 200;
chunk_count = (count - 204) / 40;
new_size = sizeof(uint64_t) * (s->n_chunks + chunk_count);
s->types = g_realloc(s->types, new_size / 2);
s->offsets = g_realloc(s->offsets, new_size);
s->lengths = g_realloc(s->lengths, new_size);
s->sectors = g_realloc(s->sectors, new_size);
s->sectorcounts = g_realloc(s->sectorcounts, new_size);
for (i = s->n_chunks; i < s->n_chunks + chunk_count; i++) {
VAR_4 = read_uint32(VAR_0, offset, &s->types[i]);
if (VAR_4 < 0) {
goto fail;
}
offset += 4;
if (s->types[i] != 0x80000005 && s->types[i] != 1 &&
s->types[i] != 2) {
if (s->types[i] == 0xffffffff && i > 0) {
last_in_offset = s->offsets[i - 1] + s->lengths[i - 1];
last_out_offset = s->sectors[i - 1] +
s->sectorcounts[i - 1];
}
chunk_count--;
i--;
offset += 36;
continue;
}
offset += 4;
VAR_4 = read_uint64(VAR_0, offset, &s->sectors[i]);
if (VAR_4 < 0) {
goto fail;
}
s->sectors[i] += last_out_offset;
offset += 8;
VAR_4 = read_uint64(VAR_0, offset, &s->sectorcounts[i]);
if (VAR_4 < 0) {
goto fail;
}
offset += 8;
if (s->sectorcounts[i] > DMG_SECTORCOUNTS_MAX) {
error_report("sector count %" PRIu64 " for chunk %" PRIu32
" is larger than max (%u)",
s->sectorcounts[i], i, DMG_SECTORCOUNTS_MAX);
VAR_4 = -EINVAL;
goto fail;
}
VAR_4 = read_uint64(VAR_0, offset, &s->offsets[i]);
if (VAR_4 < 0) {
goto fail;
}
s->offsets[i] += last_in_offset;
offset += 8;
VAR_4 = read_uint64(VAR_0, offset, &s->lengths[i]);
if (VAR_4 < 0) {
goto fail;
}
offset += 8;
if (s->lengths[i] > DMG_LENGTHS_MAX) {
error_report("length %" PRIu64 " for chunk %" PRIu32
" is larger than max (%u)",
s->lengths[i], i, DMG_LENGTHS_MAX);
VAR_4 = -EINVAL;
goto fail;
}
update_max_chunk_size(s, i, &max_compressed_size,
&max_sectors_per_chunk);
}
s->n_chunks += chunk_count;
}
}
s->compressed_chunk = qemu_try_blockalign(VAR_0->file,
max_compressed_size + 1);
s->uncompressed_chunk = qemu_try_blockalign(VAR_0->file,
512 * max_sectors_per_chunk);
if (s->compressed_chunk == NULL || s->uncompressed_chunk == NULL) {
VAR_4 = -ENOMEM;
goto fail;
}
if (inflateInit(&s->zstream) != Z_OK) {
VAR_4 = -EINVAL;
goto fail;
}
s->current_chunk = s->n_chunks;
qemu_co_mutex_init(&s->lock);
return 0;
fail:
g_free(s->types);
g_free(s->offsets);
g_free(s->lengths);
g_free(s->sectors);
g_free(s->sectorcounts);
qemu_vfree(s->compressed_chunk);
qemu_vfree(s->uncompressed_chunk);
return VAR_4;
}
|
[
"static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{",
"BDRVDMGState *s = VAR_0->opaque;",
"uint64_t info_begin, info_end, last_in_offset, last_out_offset;",
"uint32_t count, tmp;",
"uint32_t max_compressed_size = 1, max_sectors_per_chunk = 1, i;",
"int64_t offset;",
"int VAR_4;",
"VAR_0->read_only = 1;",
"s->n_chunks = 0;",
"s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL;",
"offset = bdrv_getlength(VAR_0->file);",
"if (offset < 0) {",
"VAR_4 = offset;",
"goto fail;",
"}",
"offset -= 0x1d8;",
"VAR_4 = read_uint64(VAR_0, offset, &info_begin);",
"if (VAR_4 < 0) {",
"goto fail;",
"} else if (info_begin == 0) {",
"VAR_4 = -EINVAL;",
"goto fail;",
"}",
"VAR_4 = read_uint32(VAR_0, info_begin, &tmp);",
"if (VAR_4 < 0) {",
"goto fail;",
"} else if (tmp != 0x100) {",
"VAR_4 = -EINVAL;",
"goto fail;",
"}",
"VAR_4 = read_uint32(VAR_0, info_begin + 4, &count);",
"if (VAR_4 < 0) {",
"goto fail;",
"} else if (count == 0) {",
"VAR_4 = -EINVAL;",
"goto fail;",
"}",
"info_end = info_begin + count;",
"offset = info_begin + 0x100;",
"last_in_offset = last_out_offset = 0;",
"while (offset < info_end) {",
"uint32_t type;",
"VAR_4 = read_uint32(VAR_0, offset, &count);",
"if (VAR_4 < 0) {",
"goto fail;",
"} else if (count == 0) {",
"VAR_4 = -EINVAL;",
"goto fail;",
"}",
"offset += 4;",
"VAR_4 = read_uint32(VAR_0, offset, &type);",
"if (VAR_4 < 0) {",
"goto fail;",
"}",
"if (type == 0x6d697368 && count >= 244) {",
"size_t new_size;",
"uint32_t chunk_count;",
"offset += 4;",
"offset += 200;",
"chunk_count = (count - 204) / 40;",
"new_size = sizeof(uint64_t) * (s->n_chunks + chunk_count);",
"s->types = g_realloc(s->types, new_size / 2);",
"s->offsets = g_realloc(s->offsets, new_size);",
"s->lengths = g_realloc(s->lengths, new_size);",
"s->sectors = g_realloc(s->sectors, new_size);",
"s->sectorcounts = g_realloc(s->sectorcounts, new_size);",
"for (i = s->n_chunks; i < s->n_chunks + chunk_count; i++) {",
"VAR_4 = read_uint32(VAR_0, offset, &s->types[i]);",
"if (VAR_4 < 0) {",
"goto fail;",
"}",
"offset += 4;",
"if (s->types[i] != 0x80000005 && s->types[i] != 1 &&\ns->types[i] != 2) {",
"if (s->types[i] == 0xffffffff && i > 0) {",
"last_in_offset = s->offsets[i - 1] + s->lengths[i - 1];",
"last_out_offset = s->sectors[i - 1] +\ns->sectorcounts[i - 1];",
"}",
"chunk_count--;",
"i--;",
"offset += 36;",
"continue;",
"}",
"offset += 4;",
"VAR_4 = read_uint64(VAR_0, offset, &s->sectors[i]);",
"if (VAR_4 < 0) {",
"goto fail;",
"}",
"s->sectors[i] += last_out_offset;",
"offset += 8;",
"VAR_4 = read_uint64(VAR_0, offset, &s->sectorcounts[i]);",
"if (VAR_4 < 0) {",
"goto fail;",
"}",
"offset += 8;",
"if (s->sectorcounts[i] > DMG_SECTORCOUNTS_MAX) {",
"error_report(\"sector count %\" PRIu64 \" for chunk %\" PRIu32\n\" is larger than max (%u)\",\ns->sectorcounts[i], i, DMG_SECTORCOUNTS_MAX);",
"VAR_4 = -EINVAL;",
"goto fail;",
"}",
"VAR_4 = read_uint64(VAR_0, offset, &s->offsets[i]);",
"if (VAR_4 < 0) {",
"goto fail;",
"}",
"s->offsets[i] += last_in_offset;",
"offset += 8;",
"VAR_4 = read_uint64(VAR_0, offset, &s->lengths[i]);",
"if (VAR_4 < 0) {",
"goto fail;",
"}",
"offset += 8;",
"if (s->lengths[i] > DMG_LENGTHS_MAX) {",
"error_report(\"length %\" PRIu64 \" for chunk %\" PRIu32\n\" is larger than max (%u)\",\ns->lengths[i], i, DMG_LENGTHS_MAX);",
"VAR_4 = -EINVAL;",
"goto fail;",
"}",
"update_max_chunk_size(s, i, &max_compressed_size,\n&max_sectors_per_chunk);",
"}",
"s->n_chunks += chunk_count;",
"}",
"}",
"s->compressed_chunk = qemu_try_blockalign(VAR_0->file,\nmax_compressed_size + 1);",
"s->uncompressed_chunk = qemu_try_blockalign(VAR_0->file,\n512 * max_sectors_per_chunk);",
"if (s->compressed_chunk == NULL || s->uncompressed_chunk == NULL) {",
"VAR_4 = -ENOMEM;",
"goto fail;",
"}",
"if (inflateInit(&s->zstream) != Z_OK) {",
"VAR_4 = -EINVAL;",
"goto fail;",
"}",
"s->current_chunk = s->n_chunks;",
"qemu_co_mutex_init(&s->lock);",
"return 0;",
"fail:\ng_free(s->types);",
"g_free(s->offsets);",
"g_free(s->lengths);",
"g_free(s->sectors);",
"g_free(s->sectorcounts);",
"qemu_vfree(s->compressed_chunk);",
"qemu_vfree(s->uncompressed_chunk);",
"return VAR_4;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
95
],
[
101
],
[
103
],
[
105
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
127
],
[
129
],
[
131
],
[
133
],
[
137
],
[
139
],
[
141
],
[
145
],
[
147
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179,
181
],
[
183
],
[
185
],
[
187,
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
233
],
[
235,
237,
239
],
[
241
],
[
243
],
[
245
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
275
],
[
277,
279,
281
],
[
283
],
[
285
],
[
287
],
[
291,
293
],
[
295
],
[
297
],
[
299
],
[
301
],
[
307,
309
],
[
311,
313
],
[
315
],
[
317
],
[
319
],
[
321
],
[
325
],
[
327
],
[
329
],
[
331
],
[
335
],
[
339
],
[
341
],
[
345,
347
],
[
349
],
[
351
],
[
353
],
[
355
],
[
357
],
[
359
],
[
361
],
[
363
]
] |
17,360
|
static int ea_read_header(AVFormatContext *s)
{
EaDemuxContext *ea = s->priv_data;
AVStream *st;
if (process_ea_header(s)<=0)
return AVERROR(EIO);
if (init_video_stream(s, &ea->video) || init_video_stream(s, &ea->alpha))
return AVERROR(ENOMEM);
if (ea->audio_codec) {
if (ea->num_channels <= 0 || ea->num_channels > 2) {
av_log(s, AV_LOG_WARNING,
"Unsupported number of channels: %d\n", ea->num_channels);
ea->audio_codec = 0;
return 1;
}
if (ea->sample_rate <= 0) {
av_log(s, AV_LOG_ERROR,
"Unsupported sample rate: %d\n", ea->sample_rate);
ea->audio_codec = 0;
return 1;
}
if (ea->bytes <= 0) {
av_log(s, AV_LOG_ERROR,
"Invalid number of bytes per sample: %d\n", ea->bytes);
ea->audio_codec = AV_CODEC_ID_NONE;
return 1;
}
/* initialize the audio decoder stream */
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
avpriv_set_pts_info(st, 33, 1, ea->sample_rate);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = ea->audio_codec;
st->codecpar->codec_tag = 0; /* no tag */
st->codecpar->channels = ea->num_channels;
st->codecpar->sample_rate = ea->sample_rate;
st->codecpar->bits_per_coded_sample = ea->bytes * 8;
st->codecpar->bit_rate = (int64_t)st->codecpar->channels *
st->codecpar->sample_rate *
st->codecpar->bits_per_coded_sample / 4;
st->codecpar->block_align = st->codecpar->channels *
st->codecpar->bits_per_coded_sample;
ea->audio_stream_index = st->index;
st->start_time = 0;
}
return 1;
}
| true
|
FFmpeg
|
8812d047bc850ec0b6afec69ae2d716525b25128
|
static int ea_read_header(AVFormatContext *s)
{
EaDemuxContext *ea = s->priv_data;
AVStream *st;
if (process_ea_header(s)<=0)
return AVERROR(EIO);
if (init_video_stream(s, &ea->video) || init_video_stream(s, &ea->alpha))
return AVERROR(ENOMEM);
if (ea->audio_codec) {
if (ea->num_channels <= 0 || ea->num_channels > 2) {
av_log(s, AV_LOG_WARNING,
"Unsupported number of channels: %d\n", ea->num_channels);
ea->audio_codec = 0;
return 1;
}
if (ea->sample_rate <= 0) {
av_log(s, AV_LOG_ERROR,
"Unsupported sample rate: %d\n", ea->sample_rate);
ea->audio_codec = 0;
return 1;
}
if (ea->bytes <= 0) {
av_log(s, AV_LOG_ERROR,
"Invalid number of bytes per sample: %d\n", ea->bytes);
ea->audio_codec = AV_CODEC_ID_NONE;
return 1;
}
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
avpriv_set_pts_info(st, 33, 1, ea->sample_rate);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = ea->audio_codec;
st->codecpar->codec_tag = 0;
st->codecpar->channels = ea->num_channels;
st->codecpar->sample_rate = ea->sample_rate;
st->codecpar->bits_per_coded_sample = ea->bytes * 8;
st->codecpar->bit_rate = (int64_t)st->codecpar->channels *
st->codecpar->sample_rate *
st->codecpar->bits_per_coded_sample / 4;
st->codecpar->block_align = st->codecpar->channels *
st->codecpar->bits_per_coded_sample;
ea->audio_stream_index = st->index;
st->start_time = 0;
}
return 1;
}
|
{
"code": [
" if (ea->bytes <= 0) {"
],
"line_no": [
49
]
}
|
static int FUNC_0(AVFormatContext *VAR_0)
{
EaDemuxContext *ea = VAR_0->priv_data;
AVStream *st;
if (process_ea_header(VAR_0)<=0)
return AVERROR(EIO);
if (init_video_stream(VAR_0, &ea->video) || init_video_stream(VAR_0, &ea->alpha))
return AVERROR(ENOMEM);
if (ea->audio_codec) {
if (ea->num_channels <= 0 || ea->num_channels > 2) {
av_log(VAR_0, AV_LOG_WARNING,
"Unsupported number of channels: %d\n", ea->num_channels);
ea->audio_codec = 0;
return 1;
}
if (ea->sample_rate <= 0) {
av_log(VAR_0, AV_LOG_ERROR,
"Unsupported sample rate: %d\n", ea->sample_rate);
ea->audio_codec = 0;
return 1;
}
if (ea->bytes <= 0) {
av_log(VAR_0, AV_LOG_ERROR,
"Invalid number of bytes per sample: %d\n", ea->bytes);
ea->audio_codec = AV_CODEC_ID_NONE;
return 1;
}
st = avformat_new_stream(VAR_0, NULL);
if (!st)
return AVERROR(ENOMEM);
avpriv_set_pts_info(st, 33, 1, ea->sample_rate);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = ea->audio_codec;
st->codecpar->codec_tag = 0;
st->codecpar->channels = ea->num_channels;
st->codecpar->sample_rate = ea->sample_rate;
st->codecpar->bits_per_coded_sample = ea->bytes * 8;
st->codecpar->bit_rate = (int64_t)st->codecpar->channels *
st->codecpar->sample_rate *
st->codecpar->bits_per_coded_sample / 4;
st->codecpar->block_align = st->codecpar->channels *
st->codecpar->bits_per_coded_sample;
ea->audio_stream_index = st->index;
st->start_time = 0;
}
return 1;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0)\n{",
"EaDemuxContext *ea = VAR_0->priv_data;",
"AVStream *st;",
"if (process_ea_header(VAR_0)<=0)\nreturn AVERROR(EIO);",
"if (init_video_stream(VAR_0, &ea->video) || init_video_stream(VAR_0, &ea->alpha))\nreturn AVERROR(ENOMEM);",
"if (ea->audio_codec) {",
"if (ea->num_channels <= 0 || ea->num_channels > 2) {",
"av_log(VAR_0, AV_LOG_WARNING,\n\"Unsupported number of channels: %d\\n\", ea->num_channels);",
"ea->audio_codec = 0;",
"return 1;",
"}",
"if (ea->sample_rate <= 0) {",
"av_log(VAR_0, AV_LOG_ERROR,\n\"Unsupported sample rate: %d\\n\", ea->sample_rate);",
"ea->audio_codec = 0;",
"return 1;",
"}",
"if (ea->bytes <= 0) {",
"av_log(VAR_0, AV_LOG_ERROR,\n\"Invalid number of bytes per sample: %d\\n\", ea->bytes);",
"ea->audio_codec = AV_CODEC_ID_NONE;",
"return 1;",
"}",
"st = avformat_new_stream(VAR_0, NULL);",
"if (!st)\nreturn AVERROR(ENOMEM);",
"avpriv_set_pts_info(st, 33, 1, ea->sample_rate);",
"st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;",
"st->codecpar->codec_id = ea->audio_codec;",
"st->codecpar->codec_tag = 0;",
"st->codecpar->channels = ea->num_channels;",
"st->codecpar->sample_rate = ea->sample_rate;",
"st->codecpar->bits_per_coded_sample = ea->bytes * 8;",
"st->codecpar->bit_rate = (int64_t)st->codecpar->channels *\nst->codecpar->sample_rate *\nst->codecpar->bits_per_coded_sample / 4;",
"st->codecpar->block_align = st->codecpar->channels *\nst->codecpar->bits_per_coded_sample;",
"ea->audio_stream_index = st->index;",
"st->start_time = 0;",
"}",
"return 1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11,
13
],
[
17,
19
],
[
23
],
[
25
],
[
27,
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39,
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51,
53
],
[
55
],
[
57
],
[
59
],
[
65
],
[
67,
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85,
87,
89
],
[
91,
93
],
[
95
],
[
97
],
[
99
],
[
103
],
[
105
]
] |
17,361
|
static void armv7m_bitband_init(void)
{
DeviceState *dev;
dev = qdev_create(NULL, "ARM,bitband-memory");
qdev_prop_set_uint32(dev, "base", 0x20000000);
qdev_init(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x22000000);
dev = qdev_create(NULL, "ARM,bitband-memory");
qdev_prop_set_uint32(dev, "base", 0x40000000);
qdev_init(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x42000000);
}
| true
|
qemu
|
e23a1b33b53d25510320b26d9f154e19c6c99725
|
static void armv7m_bitband_init(void)
{
DeviceState *dev;
dev = qdev_create(NULL, "ARM,bitband-memory");
qdev_prop_set_uint32(dev, "base", 0x20000000);
qdev_init(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x22000000);
dev = qdev_create(NULL, "ARM,bitband-memory");
qdev_prop_set_uint32(dev, "base", 0x40000000);
qdev_init(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x42000000);
}
|
{
"code": [
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);",
" qdev_init(dev);"
],
"line_no": [
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13
]
}
|
static void FUNC_0(void)
{
DeviceState *dev;
dev = qdev_create(NULL, "ARM,bitband-memory");
qdev_prop_set_uint32(dev, "base", 0x20000000);
qdev_init(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x22000000);
dev = qdev_create(NULL, "ARM,bitband-memory");
qdev_prop_set_uint32(dev, "base", 0x40000000);
qdev_init(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x42000000);
}
|
[
"static void FUNC_0(void)\n{",
"DeviceState *dev;",
"dev = qdev_create(NULL, \"ARM,bitband-memory\");",
"qdev_prop_set_uint32(dev, \"base\", 0x20000000);",
"qdev_init(dev);",
"sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x22000000);",
"dev = qdev_create(NULL, \"ARM,bitband-memory\");",
"qdev_prop_set_uint32(dev, \"base\", 0x40000000);",
"qdev_init(dev);",
"sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x42000000);",
"}"
] |
[
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
]
] |
17,363
|
static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
{
unsigned int crc;
unsigned char packet[TS_PACKET_SIZE];
const unsigned char *buf_ptr;
unsigned char *q;
int first, b, len1, left;
crc = av_bswap32(av_crc(av_crc_get_table(AV_CRC_32_IEEE),
-1, buf, len - 4));
buf[len - 4] = (crc >> 24) & 0xff;
buf[len - 3] = (crc >> 16) & 0xff;
buf[len - 2] = (crc >> 8) & 0xff;
buf[len - 1] = crc & 0xff;
/* send each packet */
buf_ptr = buf;
while (len > 0) {
first = buf == buf_ptr;
q = packet;
*q++ = 0x47;
b = s->pid >> 8;
if (first)
b |= 0x40;
*q++ = b;
*q++ = s->pid;
s->cc = s->cc + 1 & 0xf;
*q++ = 0x10 | s->cc;
if (first)
*q++ = 0; /* 0 offset */
len1 = TS_PACKET_SIZE - (q - packet);
if (len1 > len)
len1 = len;
memcpy(q, buf_ptr, len1);
q += len1;
/* add known padding data */
left = TS_PACKET_SIZE - (q - packet);
if (left > 0)
memset(q, 0xff, left);
s->write_packet(s, packet);
buf_ptr += len1;
len -= len1;
| true
|
FFmpeg
|
a566c952f905639456966413fee0b5701867ddcd
|
static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
{
unsigned int crc;
unsigned char packet[TS_PACKET_SIZE];
const unsigned char *buf_ptr;
unsigned char *q;
int first, b, len1, left;
crc = av_bswap32(av_crc(av_crc_get_table(AV_CRC_32_IEEE),
-1, buf, len - 4));
buf[len - 4] = (crc >> 24) & 0xff;
buf[len - 3] = (crc >> 16) & 0xff;
buf[len - 2] = (crc >> 8) & 0xff;
buf[len - 1] = crc & 0xff;
buf_ptr = buf;
while (len > 0) {
first = buf == buf_ptr;
q = packet;
*q++ = 0x47;
b = s->pid >> 8;
if (first)
b |= 0x40;
*q++ = b;
*q++ = s->pid;
s->cc = s->cc + 1 & 0xf;
*q++ = 0x10 | s->cc;
if (first)
*q++ = 0;
len1 = TS_PACKET_SIZE - (q - packet);
if (len1 > len)
len1 = len;
memcpy(q, buf_ptr, len1);
q += len1;
left = TS_PACKET_SIZE - (q - packet);
if (left > 0)
memset(q, 0xff, left);
s->write_packet(s, packet);
buf_ptr += len1;
len -= len1;
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(MpegTSSection *VAR_0, uint8_t *VAR_1, int VAR_2)
{
unsigned int VAR_3;
unsigned char VAR_4[TS_PACKET_SIZE];
const unsigned char *VAR_5;
unsigned char *VAR_6;
int VAR_7, VAR_8, VAR_9, VAR_10;
VAR_3 = av_bswap32(av_crc(av_crc_get_table(AV_CRC_32_IEEE),
-1, VAR_1, VAR_2 - 4));
VAR_1[VAR_2 - 4] = (VAR_3 >> 24) & 0xff;
VAR_1[VAR_2 - 3] = (VAR_3 >> 16) & 0xff;
VAR_1[VAR_2 - 2] = (VAR_3 >> 8) & 0xff;
VAR_1[VAR_2 - 1] = VAR_3 & 0xff;
VAR_5 = VAR_1;
while (VAR_2 > 0) {
VAR_7 = VAR_1 == VAR_5;
VAR_6 = VAR_4;
*VAR_6++ = 0x47;
VAR_8 = VAR_0->pid >> 8;
if (VAR_7)
VAR_8 |= 0x40;
*VAR_6++ = VAR_8;
*VAR_6++ = VAR_0->pid;
VAR_0->cc = VAR_0->cc + 1 & 0xf;
*VAR_6++ = 0x10 | VAR_0->cc;
if (VAR_7)
*VAR_6++ = 0;
VAR_9 = TS_PACKET_SIZE - (VAR_6 - VAR_4);
if (VAR_9 > VAR_2)
VAR_9 = VAR_2;
memcpy(VAR_6, VAR_5, VAR_9);
VAR_6 += VAR_9;
VAR_10 = TS_PACKET_SIZE - (VAR_6 - VAR_4);
if (VAR_10 > 0)
memset(VAR_6, 0xff, VAR_10);
VAR_0->write_packet(VAR_0, VAR_4);
VAR_5 += VAR_9;
VAR_2 -= VAR_9;
|
[
"static void FUNC_0(MpegTSSection *VAR_0, uint8_t *VAR_1, int VAR_2)\n{",
"unsigned int VAR_3;",
"unsigned char VAR_4[TS_PACKET_SIZE];",
"const unsigned char *VAR_5;",
"unsigned char *VAR_6;",
"int VAR_7, VAR_8, VAR_9, VAR_10;",
"VAR_3 = av_bswap32(av_crc(av_crc_get_table(AV_CRC_32_IEEE),\n-1, VAR_1, VAR_2 - 4));",
"VAR_1[VAR_2 - 4] = (VAR_3 >> 24) & 0xff;",
"VAR_1[VAR_2 - 3] = (VAR_3 >> 16) & 0xff;",
"VAR_1[VAR_2 - 2] = (VAR_3 >> 8) & 0xff;",
"VAR_1[VAR_2 - 1] = VAR_3 & 0xff;",
"VAR_5 = VAR_1;",
"while (VAR_2 > 0) {",
"VAR_7 = VAR_1 == VAR_5;",
"VAR_6 = VAR_4;",
"*VAR_6++ = 0x47;",
"VAR_8 = VAR_0->pid >> 8;",
"if (VAR_7)\nVAR_8 |= 0x40;",
"*VAR_6++ = VAR_8;",
"*VAR_6++ = VAR_0->pid;",
"VAR_0->cc = VAR_0->cc + 1 & 0xf;",
"*VAR_6++ = 0x10 | VAR_0->cc;",
"if (VAR_7)\n*VAR_6++ = 0;",
"VAR_9 = TS_PACKET_SIZE - (VAR_6 - VAR_4);",
"if (VAR_9 > VAR_2)\nVAR_9 = VAR_2;",
"memcpy(VAR_6, VAR_5, VAR_9);",
"VAR_6 += VAR_9;",
"VAR_10 = TS_PACKET_SIZE - (VAR_6 - VAR_4);",
"if (VAR_10 > 0)\nmemset(VAR_6, 0xff, VAR_10);",
"VAR_0->write_packet(VAR_0, VAR_4);",
"VAR_5 += VAR_9;",
"VAR_2 -= VAR_9;"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17,
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
65,
67
],
[
69
],
[
71,
73
],
[
75
],
[
77
],
[
81
],
[
83,
85
],
[
89
],
[
93
],
[
95
]
] |
17,364
|
void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name)
{
memory_region_transaction_begin();
as->root = root;
as->current_map = g_new(FlatView, 1);
flatview_init(as->current_map);
as->ioeventfd_nb = 0;
as->ioeventfds = NULL;
QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link);
as->name = g_strdup(name ? name : "anonymous");
address_space_init_dispatch(as);
memory_region_update_pending |= root->enabled;
memory_region_transaction_commit();
}
| true
|
qemu
|
ac95190ea92f7625bb0065c2864321607b95c26b
|
void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name)
{
memory_region_transaction_begin();
as->root = root;
as->current_map = g_new(FlatView, 1);
flatview_init(as->current_map);
as->ioeventfd_nb = 0;
as->ioeventfds = NULL;
QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link);
as->name = g_strdup(name ? name : "anonymous");
address_space_init_dispatch(as);
memory_region_update_pending |= root->enabled;
memory_region_transaction_commit();
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(AddressSpace *VAR_0, MemoryRegion *VAR_1, const char *VAR_2)
{
memory_region_transaction_begin();
VAR_0->VAR_1 = VAR_1;
VAR_0->current_map = g_new(FlatView, 1);
flatview_init(VAR_0->current_map);
VAR_0->ioeventfd_nb = 0;
VAR_0->ioeventfds = NULL;
QTAILQ_INSERT_TAIL(&address_spaces, VAR_0, address_spaces_link);
VAR_0->VAR_2 = g_strdup(VAR_2 ? VAR_2 : "anonymous");
address_space_init_dispatch(VAR_0);
memory_region_update_pending |= VAR_1->enabled;
memory_region_transaction_commit();
}
|
[
"void FUNC_0(AddressSpace *VAR_0, MemoryRegion *VAR_1, const char *VAR_2)\n{",
"memory_region_transaction_begin();",
"VAR_0->VAR_1 = VAR_1;",
"VAR_0->current_map = g_new(FlatView, 1);",
"flatview_init(VAR_0->current_map);",
"VAR_0->ioeventfd_nb = 0;",
"VAR_0->ioeventfds = NULL;",
"QTAILQ_INSERT_TAIL(&address_spaces, VAR_0, address_spaces_link);",
"VAR_0->VAR_2 = g_strdup(VAR_2 ? VAR_2 : \"anonymous\");",
"address_space_init_dispatch(VAR_0);",
"memory_region_update_pending |= VAR_1->enabled;",
"memory_region_transaction_commit();",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
6
],
[
8
],
[
10
],
[
12
],
[
14
],
[
16
],
[
18
],
[
20
],
[
22
],
[
24
],
[
26
],
[
28
]
] |
17,365
|
static gboolean fd_trampoline(GIOChannel *chan, GIOCondition cond, gpointer opaque)
{
IOTrampoline *tramp = opaque;
if (tramp->opaque == NULL) {
return FALSE;
}
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;
}
| true
|
qemu
|
c82dc29a9112f34e0a51cad9a412cf6d9d05dfb2
|
static gboolean fd_trampoline(GIOChannel *chan, GIOCondition cond, gpointer opaque)
{
IOTrampoline *tramp = opaque;
if (tramp->opaque == NULL) {
return FALSE;
}
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": [
" if (tramp->opaque == NULL) {",
" return FALSE;"
],
"line_no": [
9,
11
]
}
|
static gboolean FUNC_0(GIOChannel *chan, GIOCondition cond, gpointer opaque)
{
IOTrampoline *tramp = opaque;
if (tramp->opaque == NULL) {
return FALSE;
}
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 (tramp->opaque == NULL) {",
"return FALSE;",
"}",
"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,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
]
] |
17,366
|
static void test_flush_event_notifier(void)
{
EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true };
event_notifier_init(&data.e, false);
aio_set_event_notifier(ctx, &data.e, event_ready_cb, event_active_cb);
g_assert(aio_poll(ctx, false));
g_assert_cmpint(data.n, ==, 0);
g_assert_cmpint(data.active, ==, 10);
event_notifier_set(&data.e);
g_assert(aio_poll(ctx, false));
g_assert_cmpint(data.n, ==, 1);
g_assert_cmpint(data.active, ==, 9);
g_assert(aio_poll(ctx, false));
wait_for_aio();
g_assert_cmpint(data.n, ==, 10);
g_assert_cmpint(data.active, ==, 0);
g_assert(!aio_poll(ctx, false));
aio_set_event_notifier(ctx, &data.e, NULL, NULL);
g_assert(!aio_poll(ctx, false));
event_notifier_cleanup(&data.e);
}
| true
|
qemu
|
24d1a6d9d5f5b3da868724dd3c6f56893e0693da
|
static void test_flush_event_notifier(void)
{
EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true };
event_notifier_init(&data.e, false);
aio_set_event_notifier(ctx, &data.e, event_ready_cb, event_active_cb);
g_assert(aio_poll(ctx, false));
g_assert_cmpint(data.n, ==, 0);
g_assert_cmpint(data.active, ==, 10);
event_notifier_set(&data.e);
g_assert(aio_poll(ctx, false));
g_assert_cmpint(data.n, ==, 1);
g_assert_cmpint(data.active, ==, 9);
g_assert(aio_poll(ctx, false));
wait_for_aio();
g_assert_cmpint(data.n, ==, 10);
g_assert_cmpint(data.active, ==, 0);
g_assert(!aio_poll(ctx, false));
aio_set_event_notifier(ctx, &data.e, NULL, NULL);
g_assert(!aio_poll(ctx, false));
event_notifier_cleanup(&data.e);
}
|
{
"code": [
" wait_for_aio();",
" wait_for_aio();"
],
"line_no": [
31,
31
]
}
|
static void FUNC_0(void)
{
EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true };
event_notifier_init(&data.e, false);
aio_set_event_notifier(ctx, &data.e, event_ready_cb, event_active_cb);
g_assert(aio_poll(ctx, false));
g_assert_cmpint(data.n, ==, 0);
g_assert_cmpint(data.active, ==, 10);
event_notifier_set(&data.e);
g_assert(aio_poll(ctx, false));
g_assert_cmpint(data.n, ==, 1);
g_assert_cmpint(data.active, ==, 9);
g_assert(aio_poll(ctx, false));
wait_for_aio();
g_assert_cmpint(data.n, ==, 10);
g_assert_cmpint(data.active, ==, 0);
g_assert(!aio_poll(ctx, false));
aio_set_event_notifier(ctx, &data.e, NULL, NULL);
g_assert(!aio_poll(ctx, false));
event_notifier_cleanup(&data.e);
}
|
[
"static void FUNC_0(void)\n{",
"EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true };",
"event_notifier_init(&data.e, false);",
"aio_set_event_notifier(ctx, &data.e, event_ready_cb, event_active_cb);",
"g_assert(aio_poll(ctx, false));",
"g_assert_cmpint(data.n, ==, 0);",
"g_assert_cmpint(data.active, ==, 10);",
"event_notifier_set(&data.e);",
"g_assert(aio_poll(ctx, false));",
"g_assert_cmpint(data.n, ==, 1);",
"g_assert_cmpint(data.active, ==, 9);",
"g_assert(aio_poll(ctx, false));",
"wait_for_aio();",
"g_assert_cmpint(data.n, ==, 10);",
"g_assert_cmpint(data.active, ==, 0);",
"g_assert(!aio_poll(ctx, false));",
"aio_set_event_notifier(ctx, &data.e, NULL, NULL);",
"g_assert(!aio_poll(ctx, false));",
"event_notifier_cleanup(&data.e);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
]
] |
17,368
|
static int protocol_client_auth_sasl_mechname(VncState *vs, uint8_t *data, size_t len)
{
char *mechname = malloc(len + 1);
if (!mechname) {
VNC_DEBUG("Out of memory reading mechname\n");
vnc_client_error(vs);
}
strncpy(mechname, (char*)data, len);
mechname[len] = '\0';
VNC_DEBUG("Got client mechname '%s' check against '%s'\n",
mechname, vs->sasl.mechlist);
if (strncmp(vs->sasl.mechlist, mechname, len) == 0) {
if (vs->sasl.mechlist[len] != '\0' &&
vs->sasl.mechlist[len] != ',') {
VNC_DEBUG("One %d", vs->sasl.mechlist[len]);
vnc_client_error(vs);
return -1;
}
} else {
char *offset = strstr(vs->sasl.mechlist, mechname);
VNC_DEBUG("Two %p\n", offset);
if (!offset) {
vnc_client_error(vs);
return -1;
}
VNC_DEBUG("Two '%s'\n", offset);
if (offset[-1] != ',' ||
(offset[len] != '\0'&&
offset[len] != ',')) {
vnc_client_error(vs);
return -1;
}
}
free(vs->sasl.mechlist);
vs->sasl.mechlist = mechname;
VNC_DEBUG("Validated mechname '%s'\n", mechname);
vnc_read_when(vs, protocol_client_auth_sasl_start_len, 4);
return 0;
}
| true
|
qemu
|
8ce7d35273352ebe19c871e6b32a52db77fa08c3
|
static int protocol_client_auth_sasl_mechname(VncState *vs, uint8_t *data, size_t len)
{
char *mechname = malloc(len + 1);
if (!mechname) {
VNC_DEBUG("Out of memory reading mechname\n");
vnc_client_error(vs);
}
strncpy(mechname, (char*)data, len);
mechname[len] = '\0';
VNC_DEBUG("Got client mechname '%s' check against '%s'\n",
mechname, vs->sasl.mechlist);
if (strncmp(vs->sasl.mechlist, mechname, len) == 0) {
if (vs->sasl.mechlist[len] != '\0' &&
vs->sasl.mechlist[len] != ',') {
VNC_DEBUG("One %d", vs->sasl.mechlist[len]);
vnc_client_error(vs);
return -1;
}
} else {
char *offset = strstr(vs->sasl.mechlist, mechname);
VNC_DEBUG("Two %p\n", offset);
if (!offset) {
vnc_client_error(vs);
return -1;
}
VNC_DEBUG("Two '%s'\n", offset);
if (offset[-1] != ',' ||
(offset[len] != '\0'&&
offset[len] != ',')) {
vnc_client_error(vs);
return -1;
}
}
free(vs->sasl.mechlist);
vs->sasl.mechlist = mechname;
VNC_DEBUG("Validated mechname '%s'\n", mechname);
vnc_read_when(vs, protocol_client_auth_sasl_start_len, 4);
return 0;
}
|
{
"code": [
" vnc_client_error(vs);",
" return -1;",
" vnc_client_error(vs);",
" return -1;",
" vnc_client_error(vs);",
" return -1;"
],
"line_no": [
33,
35,
33,
35,
33,
35
]
}
|
static int FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2)
{
char *VAR_3 = malloc(VAR_2 + 1);
if (!VAR_3) {
VNC_DEBUG("Out of memory reading VAR_3\n");
vnc_client_error(VAR_0);
}
strncpy(VAR_3, (char*)VAR_1, VAR_2);
VAR_3[VAR_2] = '\0';
VNC_DEBUG("Got client VAR_3 '%s' check against '%s'\n",
VAR_3, VAR_0->sasl.mechlist);
if (strncmp(VAR_0->sasl.mechlist, VAR_3, VAR_2) == 0) {
if (VAR_0->sasl.mechlist[VAR_2] != '\0' &&
VAR_0->sasl.mechlist[VAR_2] != ',') {
VNC_DEBUG("One %d", VAR_0->sasl.mechlist[VAR_2]);
vnc_client_error(VAR_0);
return -1;
}
} else {
char *VAR_4 = strstr(VAR_0->sasl.mechlist, VAR_3);
VNC_DEBUG("Two %p\n", VAR_4);
if (!VAR_4) {
vnc_client_error(VAR_0);
return -1;
}
VNC_DEBUG("Two '%s'\n", VAR_4);
if (VAR_4[-1] != ',' ||
(VAR_4[VAR_2] != '\0'&&
VAR_4[VAR_2] != ',')) {
vnc_client_error(VAR_0);
return -1;
}
}
free(VAR_0->sasl.mechlist);
VAR_0->sasl.mechlist = VAR_3;
VNC_DEBUG("Validated VAR_3 '%s'\n", VAR_3);
vnc_read_when(VAR_0, protocol_client_auth_sasl_start_len, 4);
return 0;
}
|
[
"static int FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2)\n{",
"char *VAR_3 = malloc(VAR_2 + 1);",
"if (!VAR_3) {",
"VNC_DEBUG(\"Out of memory reading VAR_3\\n\");",
"vnc_client_error(VAR_0);",
"}",
"strncpy(VAR_3, (char*)VAR_1, VAR_2);",
"VAR_3[VAR_2] = '\\0';",
"VNC_DEBUG(\"Got client VAR_3 '%s' check against '%s'\\n\",\nVAR_3, VAR_0->sasl.mechlist);",
"if (strncmp(VAR_0->sasl.mechlist, VAR_3, VAR_2) == 0) {",
"if (VAR_0->sasl.mechlist[VAR_2] != '\\0' &&\nVAR_0->sasl.mechlist[VAR_2] != ',') {",
"VNC_DEBUG(\"One %d\", VAR_0->sasl.mechlist[VAR_2]);",
"vnc_client_error(VAR_0);",
"return -1;",
"}",
"} else {",
"char *VAR_4 = strstr(VAR_0->sasl.mechlist, VAR_3);",
"VNC_DEBUG(\"Two %p\\n\", VAR_4);",
"if (!VAR_4) {",
"vnc_client_error(VAR_0);",
"return -1;",
"}",
"VNC_DEBUG(\"Two '%s'\\n\", VAR_4);",
"if (VAR_4[-1] != ',' ||\n(VAR_4[VAR_2] != '\\0'&&\nVAR_4[VAR_2] != ',')) {",
"vnc_client_error(VAR_0);",
"return -1;",
"}",
"}",
"free(VAR_0->sasl.mechlist);",
"VAR_0->sasl.mechlist = VAR_3;",
"VNC_DEBUG(\"Validated VAR_3 '%s'\\n\", VAR_3);",
"vnc_read_when(VAR_0, protocol_client_auth_sasl_start_len, 4);",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19,
21
],
[
25
],
[
27,
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55,
57,
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73
],
[
77
],
[
79
],
[
81
],
[
83
]
] |
17,369
|
static void qxl_send_events(PCIQXLDevice *d, uint32_t events)
{
uint32_t old_pending;
uint32_t le_events = cpu_to_le32(events);
trace_qxl_send_events(d->id, events);
assert(qemu_spice_display_is_running(&d->ssd));
old_pending = __sync_fetch_and_or(&d->ram->int_pending, le_events);
if ((old_pending & le_events) == le_events) {
return;
}
if (qemu_thread_is_self(&d->main)) {
qxl_update_irq(d);
} else {
if (write(d->pipe[1], d, 1) != 1) {
dprint(d, 1, "%s: write to pipe failed\n", __func__);
}
}
}
| true
|
qemu
|
511aefb0c60e3063ead76d4ba6aabf619eed18ef
|
static void qxl_send_events(PCIQXLDevice *d, uint32_t events)
{
uint32_t old_pending;
uint32_t le_events = cpu_to_le32(events);
trace_qxl_send_events(d->id, events);
assert(qemu_spice_display_is_running(&d->ssd));
old_pending = __sync_fetch_and_or(&d->ram->int_pending, le_events);
if ((old_pending & le_events) == le_events) {
return;
}
if (qemu_thread_is_self(&d->main)) {
qxl_update_irq(d);
} else {
if (write(d->pipe[1], d, 1) != 1) {
dprint(d, 1, "%s: write to pipe failed\n", __func__);
}
}
}
|
{
"code": [
" assert(qemu_spice_display_is_running(&d->ssd));"
],
"line_no": [
13
]
}
|
static void FUNC_0(PCIQXLDevice *VAR_0, uint32_t VAR_1)
{
uint32_t old_pending;
uint32_t le_events = cpu_to_le32(VAR_1);
trace_qxl_send_events(VAR_0->id, VAR_1);
assert(qemu_spice_display_is_running(&VAR_0->ssd));
old_pending = __sync_fetch_and_or(&VAR_0->ram->int_pending, le_events);
if ((old_pending & le_events) == le_events) {
return;
}
if (qemu_thread_is_self(&VAR_0->main)) {
qxl_update_irq(VAR_0);
} else {
if (write(VAR_0->pipe[1], VAR_0, 1) != 1) {
dprint(VAR_0, 1, "%s: write to pipe failed\n", __func__);
}
}
}
|
[
"static void FUNC_0(PCIQXLDevice *VAR_0, uint32_t VAR_1)\n{",
"uint32_t old_pending;",
"uint32_t le_events = cpu_to_le32(VAR_1);",
"trace_qxl_send_events(VAR_0->id, VAR_1);",
"assert(qemu_spice_display_is_running(&VAR_0->ssd));",
"old_pending = __sync_fetch_and_or(&VAR_0->ram->int_pending, le_events);",
"if ((old_pending & le_events) == le_events) {",
"return;",
"}",
"if (qemu_thread_is_self(&VAR_0->main)) {",
"qxl_update_irq(VAR_0);",
"} else {",
"if (write(VAR_0->pipe[1], VAR_0, 1) != 1) {",
"dprint(VAR_0, 1, \"%s: write to pipe failed\\n\", __func__);",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
]
] |
17,371
|
static void decode_blocks(SnowContext *s){
int x, y;
int w= s->b_width;
int h= s->b_height;
for(y=0; y<h; y++){
for(x=0; x<w; x++){
decode_q_branch(s, 0, x, y);
}
}
}
| true
|
FFmpeg
|
0af48e29f55a4e5824e6f7157ac94cf8b210aa84
|
static void decode_blocks(SnowContext *s){
int x, y;
int w= s->b_width;
int h= s->b_height;
for(y=0; y<h; y++){
for(x=0; x<w; x++){
decode_q_branch(s, 0, x, y);
}
}
}
|
{
"code": [
"static void decode_blocks(SnowContext *s){",
" decode_q_branch(s, 0, x, y);"
],
"line_no": [
1,
15
]
}
|
static void FUNC_0(SnowContext *VAR_0){
int VAR_1, VAR_2;
int VAR_3= VAR_0->b_width;
int VAR_4= VAR_0->b_height;
for(VAR_2=0; VAR_2<VAR_4; VAR_2++){
for(VAR_1=0; VAR_1<VAR_3; VAR_1++){
decode_q_branch(VAR_0, 0, VAR_1, VAR_2);
}
}
}
|
[
"static void FUNC_0(SnowContext *VAR_0){",
"int VAR_1, VAR_2;",
"int VAR_3= VAR_0->b_width;",
"int VAR_4= VAR_0->b_height;",
"for(VAR_2=0; VAR_2<VAR_4; VAR_2++){",
"for(VAR_1=0; VAR_1<VAR_3; VAR_1++){",
"decode_q_branch(VAR_0, 0, VAR_1, VAR_2);",
"}",
"}",
"}"
] |
[
1,
0,
0,
0,
0,
0,
1,
0,
0,
0
] |
[
[
1
],
[
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
]
] |
17,372
|
static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
{
VideoData *s = s1->priv_data;
int ret, first_index, last_index;
char buf[1024];
ByteIOContext pb1, *f = &pb1;
AVStream *st;
st = av_new_stream(s1, 0);
if (!st) {
av_free(s);
return -ENOMEM;
}
if (ap->image_format)
s->img_fmt = ap->image_format;
pstrcpy(s->path, sizeof(s->path), s1->filename);
s->img_number = 0;
s->img_count = 0;
/* find format */
if (s1->iformat->flags & AVFMT_NOFILE)
s->is_pipe = 0;
else
s->is_pipe = 1;
if (!ap->time_base.num) {
st->codec->time_base= (AVRational){1,25};
} else {
st->codec->time_base= ap->time_base;
}
if (!s->is_pipe) {
if (find_image_range(&first_index, &last_index, s->path) < 0)
goto fail;
s->img_first = first_index;
s->img_last = last_index;
s->img_number = first_index;
/* compute duration */
st->start_time = 0;
st->duration = last_index - first_index + 1;
if (get_frame_filename(buf, sizeof(buf), s->path, s->img_number) < 0)
goto fail;
if (url_fopen(f, buf, URL_RDONLY) < 0)
goto fail;
} else {
f = &s1->pb;
}
ret = av_read_image(f, s1->filename, s->img_fmt, read_header_alloc_cb, s);
if (ret < 0)
goto fail1;
if (!s->is_pipe) {
url_fclose(f);
} else {
url_fseek(f, 0, SEEK_SET);
}
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_RAWVIDEO;
st->codec->width = s->width;
st->codec->height = s->height;
st->codec->pix_fmt = s->pix_fmt;
s->img_size = avpicture_get_size(s->pix_fmt, (s->width+15)&(~15), (s->height+15)&(~15));
return 0;
fail1:
if (!s->is_pipe)
url_fclose(f);
fail:
av_free(s);
return AVERROR_IO;
}
| true
|
FFmpeg
|
94ede53e57e5864a1f94cb5cae25cd0b142212ae
|
static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
{
VideoData *s = s1->priv_data;
int ret, first_index, last_index;
char buf[1024];
ByteIOContext pb1, *f = &pb1;
AVStream *st;
st = av_new_stream(s1, 0);
if (!st) {
av_free(s);
return -ENOMEM;
}
if (ap->image_format)
s->img_fmt = ap->image_format;
pstrcpy(s->path, sizeof(s->path), s1->filename);
s->img_number = 0;
s->img_count = 0;
if (s1->iformat->flags & AVFMT_NOFILE)
s->is_pipe = 0;
else
s->is_pipe = 1;
if (!ap->time_base.num) {
st->codec->time_base= (AVRational){1,25};
} else {
st->codec->time_base= ap->time_base;
}
if (!s->is_pipe) {
if (find_image_range(&first_index, &last_index, s->path) < 0)
goto fail;
s->img_first = first_index;
s->img_last = last_index;
s->img_number = first_index;
st->start_time = 0;
st->duration = last_index - first_index + 1;
if (get_frame_filename(buf, sizeof(buf), s->path, s->img_number) < 0)
goto fail;
if (url_fopen(f, buf, URL_RDONLY) < 0)
goto fail;
} else {
f = &s1->pb;
}
ret = av_read_image(f, s1->filename, s->img_fmt, read_header_alloc_cb, s);
if (ret < 0)
goto fail1;
if (!s->is_pipe) {
url_fclose(f);
} else {
url_fseek(f, 0, SEEK_SET);
}
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_RAWVIDEO;
st->codec->width = s->width;
st->codec->height = s->height;
st->codec->pix_fmt = s->pix_fmt;
s->img_size = avpicture_get_size(s->pix_fmt, (s->width+15)&(~15), (s->height+15)&(~15));
return 0;
fail1:
if (!s->is_pipe)
url_fclose(f);
fail:
av_free(s);
return AVERROR_IO;
}
|
{
"code": [
" av_free(s);",
" av_free(s);"
],
"line_no": [
21,
145
]
}
|
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1)
{
VideoData *s = VAR_0->priv_data;
int VAR_2, VAR_3, VAR_4;
char VAR_5[1024];
ByteIOContext pb1, *f = &pb1;
AVStream *st;
st = av_new_stream(VAR_0, 0);
if (!st) {
av_free(s);
return -ENOMEM;
}
if (VAR_1->image_format)
s->img_fmt = VAR_1->image_format;
pstrcpy(s->path, sizeof(s->path), VAR_0->filename);
s->img_number = 0;
s->img_count = 0;
if (VAR_0->iformat->flags & AVFMT_NOFILE)
s->is_pipe = 0;
else
s->is_pipe = 1;
if (!VAR_1->time_base.num) {
st->codec->time_base= (AVRational){1,25};
} else {
st->codec->time_base= VAR_1->time_base;
}
if (!s->is_pipe) {
if (find_image_range(&VAR_3, &VAR_4, s->path) < 0)
goto fail;
s->img_first = VAR_3;
s->img_last = VAR_4;
s->img_number = VAR_3;
st->start_time = 0;
st->duration = VAR_4 - VAR_3 + 1;
if (get_frame_filename(VAR_5, sizeof(VAR_5), s->path, s->img_number) < 0)
goto fail;
if (url_fopen(f, VAR_5, URL_RDONLY) < 0)
goto fail;
} else {
f = &VAR_0->pb;
}
VAR_2 = av_read_image(f, VAR_0->filename, s->img_fmt, read_header_alloc_cb, s);
if (VAR_2 < 0)
goto fail1;
if (!s->is_pipe) {
url_fclose(f);
} else {
url_fseek(f, 0, SEEK_SET);
}
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_RAWVIDEO;
st->codec->width = s->width;
st->codec->height = s->height;
st->codec->pix_fmt = s->pix_fmt;
s->img_size = avpicture_get_size(s->pix_fmt, (s->width+15)&(~15), (s->height+15)&(~15));
return 0;
fail1:
if (!s->is_pipe)
url_fclose(f);
fail:
av_free(s);
return AVERROR_IO;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1)\n{",
"VideoData *s = VAR_0->priv_data;",
"int VAR_2, VAR_3, VAR_4;",
"char VAR_5[1024];",
"ByteIOContext pb1, *f = &pb1;",
"AVStream *st;",
"st = av_new_stream(VAR_0, 0);",
"if (!st) {",
"av_free(s);",
"return -ENOMEM;",
"}",
"if (VAR_1->image_format)\ns->img_fmt = VAR_1->image_format;",
"pstrcpy(s->path, sizeof(s->path), VAR_0->filename);",
"s->img_number = 0;",
"s->img_count = 0;",
"if (VAR_0->iformat->flags & AVFMT_NOFILE)\ns->is_pipe = 0;",
"else\ns->is_pipe = 1;",
"if (!VAR_1->time_base.num) {",
"st->codec->time_base= (AVRational){1,25};",
"} else {",
"st->codec->time_base= VAR_1->time_base;",
"}",
"if (!s->is_pipe) {",
"if (find_image_range(&VAR_3, &VAR_4, s->path) < 0)\ngoto fail;",
"s->img_first = VAR_3;",
"s->img_last = VAR_4;",
"s->img_number = VAR_3;",
"st->start_time = 0;",
"st->duration = VAR_4 - VAR_3 + 1;",
"if (get_frame_filename(VAR_5, sizeof(VAR_5), s->path, s->img_number) < 0)\ngoto fail;",
"if (url_fopen(f, VAR_5, URL_RDONLY) < 0)\ngoto fail;",
"} else {",
"f = &VAR_0->pb;",
"}",
"VAR_2 = av_read_image(f, VAR_0->filename, s->img_fmt, read_header_alloc_cb, s);",
"if (VAR_2 < 0)\ngoto fail1;",
"if (!s->is_pipe) {",
"url_fclose(f);",
"} else {",
"url_fseek(f, 0, SEEK_SET);",
"}",
"st->codec->codec_type = CODEC_TYPE_VIDEO;",
"st->codec->codec_id = CODEC_ID_RAWVIDEO;",
"st->codec->width = s->width;",
"st->codec->height = s->height;",
"st->codec->pix_fmt = s->pix_fmt;",
"s->img_size = avpicture_get_size(s->pix_fmt, (s->width+15)&(~15), (s->height+15)&(~15));",
"return 0;",
"fail1:\nif (!s->is_pipe)\nurl_fclose(f);",
"fail:\nav_free(s);",
"return AVERROR_IO;",
"}"
] |
[
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,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29,
31
],
[
35
],
[
37
],
[
39
],
[
45,
47
],
[
49,
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69,
71
],
[
73
],
[
75
],
[
77
],
[
81
],
[
83
],
[
85,
87
],
[
89,
91
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103,
105
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
135
],
[
137,
139,
141
],
[
143,
145
],
[
147
],
[
149
]
] |
17,373
|
static void mpeg4_encode_gop_header(MpegEncContext *s)
{
int hours, minutes, seconds;
int64_t time;
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, GOP_STARTCODE);
time = s->current_picture_ptr->f.pts;
if (s->reordered_input_picture[1])
time = FFMIN(time, s->reordered_input_picture[1]->f.pts);
time = time * s->avctx->time_base.num;
seconds = time / s->avctx->time_base.den;
minutes = seconds / 60;
seconds %= 60;
hours = minutes / 60;
minutes %= 60;
hours %= 24;
put_bits(&s->pb, 5, hours);
put_bits(&s->pb, 6, minutes);
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 6, seconds);
put_bits(&s->pb, 1, !!(s->flags & CODEC_FLAG_CLOSED_GOP));
put_bits(&s->pb, 1, 0); // broken link == NO
s->last_time_base = time / s->avctx->time_base.den;
ff_mpeg4_stuffing(&s->pb);
}
| true
|
FFmpeg
|
f6774f905fb3cfdc319523ac640be30b14c1bc55
|
static void mpeg4_encode_gop_header(MpegEncContext *s)
{
int hours, minutes, seconds;
int64_t time;
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, GOP_STARTCODE);
time = s->current_picture_ptr->f.pts;
if (s->reordered_input_picture[1])
time = FFMIN(time, s->reordered_input_picture[1]->f.pts);
time = time * s->avctx->time_base.num;
seconds = time / s->avctx->time_base.den;
minutes = seconds / 60;
seconds %= 60;
hours = minutes / 60;
minutes %= 60;
hours %= 24;
put_bits(&s->pb, 5, hours);
put_bits(&s->pb, 6, minutes);
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 6, seconds);
put_bits(&s->pb, 1, !!(s->flags & CODEC_FLAG_CLOSED_GOP));
put_bits(&s->pb, 1, 0);
s->last_time_base = time / s->avctx->time_base.den;
ff_mpeg4_stuffing(&s->pb);
}
|
{
"code": [
" time = s->current_picture_ptr->f.pts;",
" time = FFMIN(time, s->reordered_input_picture[1]->f.pts);"
],
"line_no": [
17,
21
]
}
|
static void FUNC_0(MpegEncContext *VAR_0)
{
int VAR_1, VAR_2, VAR_3;
int64_t time;
put_bits(&VAR_0->pb, 16, 0);
put_bits(&VAR_0->pb, 16, GOP_STARTCODE);
time = VAR_0->current_picture_ptr->f.pts;
if (VAR_0->reordered_input_picture[1])
time = FFMIN(time, VAR_0->reordered_input_picture[1]->f.pts);
time = time * VAR_0->avctx->time_base.num;
VAR_3 = time / VAR_0->avctx->time_base.den;
VAR_2 = VAR_3 / 60;
VAR_3 %= 60;
VAR_1 = VAR_2 / 60;
VAR_2 %= 60;
VAR_1 %= 24;
put_bits(&VAR_0->pb, 5, VAR_1);
put_bits(&VAR_0->pb, 6, VAR_2);
put_bits(&VAR_0->pb, 1, 1);
put_bits(&VAR_0->pb, 6, VAR_3);
put_bits(&VAR_0->pb, 1, !!(VAR_0->flags & CODEC_FLAG_CLOSED_GOP));
put_bits(&VAR_0->pb, 1, 0);
VAR_0->last_time_base = time / VAR_0->avctx->time_base.den;
ff_mpeg4_stuffing(&VAR_0->pb);
}
|
[
"static void FUNC_0(MpegEncContext *VAR_0)\n{",
"int VAR_1, VAR_2, VAR_3;",
"int64_t time;",
"put_bits(&VAR_0->pb, 16, 0);",
"put_bits(&VAR_0->pb, 16, GOP_STARTCODE);",
"time = VAR_0->current_picture_ptr->f.pts;",
"if (VAR_0->reordered_input_picture[1])\ntime = FFMIN(time, VAR_0->reordered_input_picture[1]->f.pts);",
"time = time * VAR_0->avctx->time_base.num;",
"VAR_3 = time / VAR_0->avctx->time_base.den;",
"VAR_2 = VAR_3 / 60;",
"VAR_3 %= 60;",
"VAR_1 = VAR_2 / 60;",
"VAR_2 %= 60;",
"VAR_1 %= 24;",
"put_bits(&VAR_0->pb, 5, VAR_1);",
"put_bits(&VAR_0->pb, 6, VAR_2);",
"put_bits(&VAR_0->pb, 1, 1);",
"put_bits(&VAR_0->pb, 6, VAR_3);",
"put_bits(&VAR_0->pb, 1, !!(VAR_0->flags & CODEC_FLAG_CLOSED_GOP));",
"put_bits(&VAR_0->pb, 1, 0);",
"VAR_0->last_time_base = time / VAR_0->avctx->time_base.den;",
"ff_mpeg4_stuffing(&VAR_0->pb);",
"}"
] |
[
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
17
],
[
19,
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
57
],
[
61
],
[
63
]
] |
17,374
|
static int av_encode(AVFormatContext **output_files,
int nb_output_files,
AVFormatContext **input_files,
int nb_input_files,
AVStreamMap *stream_maps, int nb_stream_maps)
{
int ret, i, j, k, n, nb_istreams = 0, nb_ostreams = 0;
AVFormatContext *is, *os;
AVCodecContext *codec, *icodec;
AVOutputStream *ost, **ost_table = NULL;
AVInputStream *ist, **ist_table = NULL;
AVInputFile *file_table;
AVFormatContext *stream_no_data;
int key;
file_table= (AVInputFile*) av_mallocz(nb_input_files * sizeof(AVInputFile));
if (!file_table)
goto fail;
/* input stream init */
j = 0;
for(i=0;i<nb_input_files;i++) {
is = input_files[i];
file_table[i].ist_index = j;
file_table[i].nb_streams = is->nb_streams;
j += is->nb_streams;
}
nb_istreams = j;
ist_table = av_mallocz(nb_istreams * sizeof(AVInputStream *));
if (!ist_table)
goto fail;
for(i=0;i<nb_istreams;i++) {
ist = av_mallocz(sizeof(AVInputStream));
if (!ist)
goto fail;
ist_table[i] = ist;
}
j = 0;
for(i=0;i<nb_input_files;i++) {
is = input_files[i];
for(k=0;k<is->nb_streams;k++) {
ist = ist_table[j++];
ist->st = is->streams[k];
ist->file_index = i;
ist->index = k;
ist->discard = 1; /* the stream is discarded by default
(changed later) */
if (ist->st->codec.rate_emu) {
ist->start = av_gettime();
ist->frame = 0;
}
}
}
/* output stream init */
nb_ostreams = 0;
for(i=0;i<nb_output_files;i++) {
os = output_files[i];
nb_ostreams += os->nb_streams;
}
if (nb_stream_maps > 0 && nb_stream_maps != nb_ostreams) {
fprintf(stderr, "Number of stream maps must match number of output streams\n");
exit(1);
}
/* Sanity check the mapping args -- do the input files & streams exist? */
for(i=0;i<nb_stream_maps;i++) {
int fi = stream_maps[i].file_index;
int si = stream_maps[i].stream_index;
if (fi < 0 || fi > nb_input_files - 1 ||
si < 0 || si > file_table[fi].nb_streams - 1) {
fprintf(stderr,"Could not find input stream #%d.%d\n", fi, si);
exit(1);
}
}
ost_table = av_mallocz(sizeof(AVOutputStream *) * nb_ostreams);
if (!ost_table)
goto fail;
for(i=0;i<nb_ostreams;i++) {
ost = av_mallocz(sizeof(AVOutputStream));
if (!ost)
goto fail;
ost_table[i] = ost;
}
n = 0;
for(k=0;k<nb_output_files;k++) {
os = output_files[k];
for(i=0;i<os->nb_streams;i++) {
int found;
ost = ost_table[n++];
ost->file_index = k;
ost->index = i;
ost->st = os->streams[i];
if (nb_stream_maps > 0) {
ost->source_index = file_table[stream_maps[n-1].file_index].ist_index +
stream_maps[n-1].stream_index;
/* Sanity check that the stream types match */
if (ist_table[ost->source_index]->st->codec.codec_type != ost->st->codec.codec_type) {
fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n",
stream_maps[n-1].file_index, stream_maps[n-1].stream_index,
ost->file_index, ost->index);
exit(1);
}
} else {
/* get corresponding input stream index : we select the first one with the right type */
found = 0;
for(j=0;j<nb_istreams;j++) {
ist = ist_table[j];
if (ist->discard &&
ist->st->codec.codec_type == ost->st->codec.codec_type) {
ost->source_index = j;
found = 1;
}
}
if (!found) {
/* try again and reuse existing stream */
for(j=0;j<nb_istreams;j++) {
ist = ist_table[j];
if (ist->st->codec.codec_type == ost->st->codec.codec_type) {
ost->source_index = j;
found = 1;
}
}
if (!found) {
fprintf(stderr, "Could not find input stream matching output stream #%d.%d\n",
ost->file_index, ost->index);
exit(1);
}
}
}
ist = ist_table[ost->source_index];
ist->discard = 0;
}
}
/* for each output stream, we compute the right encoding parameters */
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
ist = ist_table[ost->source_index];
codec = &ost->st->codec;
icodec = &ist->st->codec;
if (ost->st->stream_copy) {
/* if stream_copy is selected, no need to decode or encode */
codec->codec_id = icodec->codec_id;
codec->codec_type = icodec->codec_type;
codec->codec_tag = icodec->codec_tag;
codec->bit_rate = icodec->bit_rate;
switch(codec->codec_type) {
case CODEC_TYPE_AUDIO:
codec->sample_rate = icodec->sample_rate;
codec->channels = icodec->channels;
break;
case CODEC_TYPE_VIDEO:
codec->frame_rate = icodec->frame_rate;
codec->frame_rate_base = icodec->frame_rate_base;
codec->width = icodec->width;
codec->height = icodec->height;
break;
default:
av_abort();
}
} else {
switch(codec->codec_type) {
case CODEC_TYPE_AUDIO:
if (fifo_init(&ost->fifo, 2 * MAX_AUDIO_PACKET_SIZE))
goto fail;
if (codec->channels == icodec->channels &&
codec->sample_rate == icodec->sample_rate) {
ost->audio_resample = 0;
} else {
if (codec->channels != icodec->channels &&
icodec->codec_id == CODEC_ID_AC3) {
/* Special case for 5:1 AC3 input */
/* and mono or stereo output */
/* Request specific number of channels */
icodec->channels = codec->channels;
if (codec->sample_rate == icodec->sample_rate)
ost->audio_resample = 0;
else {
ost->audio_resample = 1;
ost->resample = audio_resample_init(codec->channels, icodec->channels,
codec->sample_rate,
icodec->sample_rate);
if(!ost->resample)
{
printf("Can't resample. Aborting.\n");
av_abort();
}
}
/* Request specific number of channels */
icodec->channels = codec->channels;
} else {
ost->audio_resample = 1;
ost->resample = audio_resample_init(codec->channels, icodec->channels,
codec->sample_rate,
icodec->sample_rate);
if(!ost->resample)
{
printf("Can't resample. Aborting.\n");
av_abort();
}
}
}
ist->decoding_needed = 1;
ost->encoding_needed = 1;
break;
case CODEC_TYPE_VIDEO:
if (codec->width == icodec->width &&
codec->height == icodec->height &&
frame_topBand == 0 &&
frame_bottomBand == 0 &&
frame_leftBand == 0 &&
frame_rightBand == 0)
{
ost->video_resample = 0;
ost->video_crop = 0;
} else if ((codec->width == icodec->width -
(frame_leftBand + frame_rightBand)) &&
(codec->height == icodec->height -
(frame_topBand + frame_bottomBand)))
{
ost->video_resample = 0;
ost->video_crop = 1;
ost->topBand = frame_topBand;
ost->leftBand = frame_leftBand;
} else {
ost->video_resample = 1;
ost->video_crop = 0; // cropping is handled as part of resample
if( avpicture_alloc( &ost->pict_tmp, PIX_FMT_YUV420P,
codec->width, codec->height ) )
goto fail;
ost->img_resample_ctx = img_resample_full_init(
ost->st->codec.width, ost->st->codec.height,
ist->st->codec.width, ist->st->codec.height,
frame_topBand, frame_bottomBand,
frame_leftBand, frame_rightBand);
}
ost->encoding_needed = 1;
ist->decoding_needed = 1;
break;
default:
av_abort();
}
/* two pass mode */
if (ost->encoding_needed &&
(codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) {
char logfilename[1024];
FILE *f;
int size;
char *logbuffer;
snprintf(logfilename, sizeof(logfilename), "%s-%d.log",
pass_logfilename ?
pass_logfilename : DEFAULT_PASS_LOGFILENAME, i);
if (codec->flags & CODEC_FLAG_PASS1) {
f = fopen(logfilename, "w");
if (!f) {
perror(logfilename);
exit(1);
}
ost->logfile = f;
} else {
/* read the log file */
f = fopen(logfilename, "r");
if (!f) {
perror(logfilename);
exit(1);
}
fseek(f, 0, SEEK_END);
size = ftell(f);
fseek(f, 0, SEEK_SET);
logbuffer = av_malloc(size + 1);
if (!logbuffer) {
fprintf(stderr, "Could not allocate log buffer\n");
exit(1);
}
size = fread(logbuffer, 1, size, f);
fclose(f);
logbuffer[size] = '\0';
codec->stats_in = logbuffer;
}
}
}
}
/* dump the file output parameters - cannot be done before in case
of stream copy */
for(i=0;i<nb_output_files;i++) {
dump_format(output_files[i], i, output_files[i]->filename, 1);
}
/* dump the stream mapping */
fprintf(stderr, "Stream mapping:\n");
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
fprintf(stderr, " Stream #%d.%d -> #%d.%d\n",
ist_table[ost->source_index]->file_index,
ist_table[ost->source_index]->index,
ost->file_index,
ost->index);
}
/* open each encoder */
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
if (ost->encoding_needed) {
AVCodec *codec;
codec = avcodec_find_encoder(ost->st->codec.codec_id);
if (!codec) {
fprintf(stderr, "Unsupported codec for output stream #%d.%d\n",
ost->file_index, ost->index);
exit(1);
}
if (avcodec_open(&ost->st->codec, codec) < 0) {
fprintf(stderr, "Error while opening codec for stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height\n",
ost->file_index, ost->index);
exit(1);
}
}
}
/* open each decoder */
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
if (ist->decoding_needed) {
AVCodec *codec;
codec = avcodec_find_decoder(ist->st->codec.codec_id);
if (!codec) {
fprintf(stderr, "Unsupported codec (id=%d) for input stream #%d.%d\n",
ist->st->codec.codec_id, ist->file_index, ist->index);
exit(1);
}
if (avcodec_open(&ist->st->codec, codec) < 0) {
fprintf(stderr, "Error while opening codec for input stream #%d.%d\n",
ist->file_index, ist->index);
exit(1);
}
//if (ist->st->codec.codec_type == CODEC_TYPE_VIDEO)
// ist->st->codec.flags |= CODEC_FLAG_REPEAT_FIELD;
}
}
/* init pts */
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
is = input_files[ist->file_index];
ist->pts = 0;
ist->next_pts = 0;
}
/* compute buffer size max (should use a complete heuristic) */
for(i=0;i<nb_input_files;i++) {
file_table[i].buffer_size_max = 2048;
}
/* open files and write file headers */
for(i=0;i<nb_output_files;i++) {
os = output_files[i];
if (av_write_header(os) < 0) {
fprintf(stderr, "Could not write header for output file #%d (incorrect codec paramters ?)\n", i);
ret = -EINVAL;
goto fail;
}
}
#ifndef CONFIG_WIN32
if ( !using_stdin )
fprintf(stderr, "Press [q] to stop encoding\n");
#endif
term_init();
stream_no_data = 0;
key = -1;
for(; received_sigterm == 0;) {
int file_index, ist_index;
AVPacket pkt;
double pts_min;
redo:
/* if 'q' pressed, exits */
if (!using_stdin) {
/* read_key() returns 0 on EOF */
key = read_key();
if (key == 'q')
break;
}
/* select the stream that we must read now by looking at the
smallest output pts */
file_index = -1;
pts_min = 1e10;
for(i=0;i<nb_ostreams;i++) {
double pts;
ost = ost_table[i];
os = output_files[ost->file_index];
ist = ist_table[ost->source_index];
pts = (double)ost->st->pts.val * os->pts_num / os->pts_den;
if (!file_table[ist->file_index].eof_reached &&
pts < pts_min) {
pts_min = pts;
file_index = ist->file_index;
}
}
/* if none, if is finished */
if (file_index < 0) {
break;
}
/* finish if recording time exhausted */
if (recording_time > 0 && pts_min >= (recording_time / 1000000.0))
break;
/* read a frame from it and output it in the fifo */
is = input_files[file_index];
if (av_read_frame(is, &pkt) < 0) {
file_table[file_index].eof_reached = 1;
continue;
}
if (!pkt.size) {
stream_no_data = is;
} else {
stream_no_data = 0;
}
if (do_pkt_dump) {
av_pkt_dump(stdout, &pkt, do_hex_dump);
}
/* the following test is needed in case new streams appear
dynamically in stream : we ignore them */
if (pkt.stream_index >= file_table[file_index].nb_streams)
goto discard_packet;
ist_index = file_table[file_index].ist_index + pkt.stream_index;
ist = ist_table[ist_index];
if (ist->discard)
goto discard_packet;
//fprintf(stderr,"read #%d.%d size=%d\n", ist->file_index, ist->index, pkt.size);
if (output_packet(ist, ist_index, ost_table, nb_ostreams, &pkt) < 0) {
fprintf(stderr, "Error while decoding stream #%d.%d\n",
ist->file_index, ist->index);
av_free_packet(&pkt);
goto redo;
}
discard_packet:
av_free_packet(&pkt);
/* dump report by using the output first video and audio streams */
print_report(output_files, ost_table, nb_ostreams, 0);
}
/* at the end of stream, we must flush the decoder buffers */
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
if (ist->decoding_needed) {
output_packet(ist, i, ost_table, nb_ostreams, NULL);
}
}
term_exit();
/* dump report by using the first video and audio streams */
print_report(output_files, ost_table, nb_ostreams, 1);
/* write the trailer if needed and close file */
for(i=0;i<nb_output_files;i++) {
os = output_files[i];
av_write_trailer(os);
}
/* close each encoder */
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
if (ost->encoding_needed) {
av_freep(&ost->st->codec.stats_in);
avcodec_close(&ost->st->codec);
}
}
/* close each decoder */
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
if (ist->decoding_needed) {
avcodec_close(&ist->st->codec);
}
}
/* finished ! */
ret = 0;
fail1:
av_free(file_table);
if (ist_table) {
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
av_free(ist);
}
av_free(ist_table);
}
if (ost_table) {
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
if (ost) {
if (ost->logfile) {
fclose(ost->logfile);
ost->logfile = NULL;
}
fifo_free(&ost->fifo); /* works even if fifo is not
initialized but set to zero */
av_free(ost->pict_tmp.data[0]);
if (ost->video_resample)
img_resample_close(ost->img_resample_ctx);
if (ost->audio_resample)
audio_resample_close(ost->resample);
av_free(ost);
}
}
av_free(ost_table);
}
return ret;
fail:
ret = -ENOMEM;
goto fail1;
}
| false
|
FFmpeg
|
b51469a0c54b30079eecc4891cc050778f343683
|
static int av_encode(AVFormatContext **output_files,
int nb_output_files,
AVFormatContext **input_files,
int nb_input_files,
AVStreamMap *stream_maps, int nb_stream_maps)
{
int ret, i, j, k, n, nb_istreams = 0, nb_ostreams = 0;
AVFormatContext *is, *os;
AVCodecContext *codec, *icodec;
AVOutputStream *ost, **ost_table = NULL;
AVInputStream *ist, **ist_table = NULL;
AVInputFile *file_table;
AVFormatContext *stream_no_data;
int key;
file_table= (AVInputFile*) av_mallocz(nb_input_files * sizeof(AVInputFile));
if (!file_table)
goto fail;
j = 0;
for(i=0;i<nb_input_files;i++) {
is = input_files[i];
file_table[i].ist_index = j;
file_table[i].nb_streams = is->nb_streams;
j += is->nb_streams;
}
nb_istreams = j;
ist_table = av_mallocz(nb_istreams * sizeof(AVInputStream *));
if (!ist_table)
goto fail;
for(i=0;i<nb_istreams;i++) {
ist = av_mallocz(sizeof(AVInputStream));
if (!ist)
goto fail;
ist_table[i] = ist;
}
j = 0;
for(i=0;i<nb_input_files;i++) {
is = input_files[i];
for(k=0;k<is->nb_streams;k++) {
ist = ist_table[j++];
ist->st = is->streams[k];
ist->file_index = i;
ist->index = k;
ist->discard = 1;
if (ist->st->codec.rate_emu) {
ist->start = av_gettime();
ist->frame = 0;
}
}
}
nb_ostreams = 0;
for(i=0;i<nb_output_files;i++) {
os = output_files[i];
nb_ostreams += os->nb_streams;
}
if (nb_stream_maps > 0 && nb_stream_maps != nb_ostreams) {
fprintf(stderr, "Number of stream maps must match number of output streams\n");
exit(1);
}
for(i=0;i<nb_stream_maps;i++) {
int fi = stream_maps[i].file_index;
int si = stream_maps[i].stream_index;
if (fi < 0 || fi > nb_input_files - 1 ||
si < 0 || si > file_table[fi].nb_streams - 1) {
fprintf(stderr,"Could not find input stream #%d.%d\n", fi, si);
exit(1);
}
}
ost_table = av_mallocz(sizeof(AVOutputStream *) * nb_ostreams);
if (!ost_table)
goto fail;
for(i=0;i<nb_ostreams;i++) {
ost = av_mallocz(sizeof(AVOutputStream));
if (!ost)
goto fail;
ost_table[i] = ost;
}
n = 0;
for(k=0;k<nb_output_files;k++) {
os = output_files[k];
for(i=0;i<os->nb_streams;i++) {
int found;
ost = ost_table[n++];
ost->file_index = k;
ost->index = i;
ost->st = os->streams[i];
if (nb_stream_maps > 0) {
ost->source_index = file_table[stream_maps[n-1].file_index].ist_index +
stream_maps[n-1].stream_index;
if (ist_table[ost->source_index]->st->codec.codec_type != ost->st->codec.codec_type) {
fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n",
stream_maps[n-1].file_index, stream_maps[n-1].stream_index,
ost->file_index, ost->index);
exit(1);
}
} else {
found = 0;
for(j=0;j<nb_istreams;j++) {
ist = ist_table[j];
if (ist->discard &&
ist->st->codec.codec_type == ost->st->codec.codec_type) {
ost->source_index = j;
found = 1;
}
}
if (!found) {
for(j=0;j<nb_istreams;j++) {
ist = ist_table[j];
if (ist->st->codec.codec_type == ost->st->codec.codec_type) {
ost->source_index = j;
found = 1;
}
}
if (!found) {
fprintf(stderr, "Could not find input stream matching output stream #%d.%d\n",
ost->file_index, ost->index);
exit(1);
}
}
}
ist = ist_table[ost->source_index];
ist->discard = 0;
}
}
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
ist = ist_table[ost->source_index];
codec = &ost->st->codec;
icodec = &ist->st->codec;
if (ost->st->stream_copy) {
codec->codec_id = icodec->codec_id;
codec->codec_type = icodec->codec_type;
codec->codec_tag = icodec->codec_tag;
codec->bit_rate = icodec->bit_rate;
switch(codec->codec_type) {
case CODEC_TYPE_AUDIO:
codec->sample_rate = icodec->sample_rate;
codec->channels = icodec->channels;
break;
case CODEC_TYPE_VIDEO:
codec->frame_rate = icodec->frame_rate;
codec->frame_rate_base = icodec->frame_rate_base;
codec->width = icodec->width;
codec->height = icodec->height;
break;
default:
av_abort();
}
} else {
switch(codec->codec_type) {
case CODEC_TYPE_AUDIO:
if (fifo_init(&ost->fifo, 2 * MAX_AUDIO_PACKET_SIZE))
goto fail;
if (codec->channels == icodec->channels &&
codec->sample_rate == icodec->sample_rate) {
ost->audio_resample = 0;
} else {
if (codec->channels != icodec->channels &&
icodec->codec_id == CODEC_ID_AC3) {
icodec->channels = codec->channels;
if (codec->sample_rate == icodec->sample_rate)
ost->audio_resample = 0;
else {
ost->audio_resample = 1;
ost->resample = audio_resample_init(codec->channels, icodec->channels,
codec->sample_rate,
icodec->sample_rate);
if(!ost->resample)
{
printf("Can't resample. Aborting.\n");
av_abort();
}
}
icodec->channels = codec->channels;
} else {
ost->audio_resample = 1;
ost->resample = audio_resample_init(codec->channels, icodec->channels,
codec->sample_rate,
icodec->sample_rate);
if(!ost->resample)
{
printf("Can't resample. Aborting.\n");
av_abort();
}
}
}
ist->decoding_needed = 1;
ost->encoding_needed = 1;
break;
case CODEC_TYPE_VIDEO:
if (codec->width == icodec->width &&
codec->height == icodec->height &&
frame_topBand == 0 &&
frame_bottomBand == 0 &&
frame_leftBand == 0 &&
frame_rightBand == 0)
{
ost->video_resample = 0;
ost->video_crop = 0;
} else if ((codec->width == icodec->width -
(frame_leftBand + frame_rightBand)) &&
(codec->height == icodec->height -
(frame_topBand + frame_bottomBand)))
{
ost->video_resample = 0;
ost->video_crop = 1;
ost->topBand = frame_topBand;
ost->leftBand = frame_leftBand;
} else {
ost->video_resample = 1;
ost->video_crop = 0;
if( avpicture_alloc( &ost->pict_tmp, PIX_FMT_YUV420P,
codec->width, codec->height ) )
goto fail;
ost->img_resample_ctx = img_resample_full_init(
ost->st->codec.width, ost->st->codec.height,
ist->st->codec.width, ist->st->codec.height,
frame_topBand, frame_bottomBand,
frame_leftBand, frame_rightBand);
}
ost->encoding_needed = 1;
ist->decoding_needed = 1;
break;
default:
av_abort();
}
if (ost->encoding_needed &&
(codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) {
char logfilename[1024];
FILE *f;
int size;
char *logbuffer;
snprintf(logfilename, sizeof(logfilename), "%s-%d.log",
pass_logfilename ?
pass_logfilename : DEFAULT_PASS_LOGFILENAME, i);
if (codec->flags & CODEC_FLAG_PASS1) {
f = fopen(logfilename, "w");
if (!f) {
perror(logfilename);
exit(1);
}
ost->logfile = f;
} else {
f = fopen(logfilename, "r");
if (!f) {
perror(logfilename);
exit(1);
}
fseek(f, 0, SEEK_END);
size = ftell(f);
fseek(f, 0, SEEK_SET);
logbuffer = av_malloc(size + 1);
if (!logbuffer) {
fprintf(stderr, "Could not allocate log buffer\n");
exit(1);
}
size = fread(logbuffer, 1, size, f);
fclose(f);
logbuffer[size] = '\0';
codec->stats_in = logbuffer;
}
}
}
}
for(i=0;i<nb_output_files;i++) {
dump_format(output_files[i], i, output_files[i]->filename, 1);
}
fprintf(stderr, "Stream mapping:\n");
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
fprintf(stderr, " Stream #%d.%d -> #%d.%d\n",
ist_table[ost->source_index]->file_index,
ist_table[ost->source_index]->index,
ost->file_index,
ost->index);
}
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
if (ost->encoding_needed) {
AVCodec *codec;
codec = avcodec_find_encoder(ost->st->codec.codec_id);
if (!codec) {
fprintf(stderr, "Unsupported codec for output stream #%d.%d\n",
ost->file_index, ost->index);
exit(1);
}
if (avcodec_open(&ost->st->codec, codec) < 0) {
fprintf(stderr, "Error while opening codec for stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height\n",
ost->file_index, ost->index);
exit(1);
}
}
}
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
if (ist->decoding_needed) {
AVCodec *codec;
codec = avcodec_find_decoder(ist->st->codec.codec_id);
if (!codec) {
fprintf(stderr, "Unsupported codec (id=%d) for input stream #%d.%d\n",
ist->st->codec.codec_id, ist->file_index, ist->index);
exit(1);
}
if (avcodec_open(&ist->st->codec, codec) < 0) {
fprintf(stderr, "Error while opening codec for input stream #%d.%d\n",
ist->file_index, ist->index);
exit(1);
}
}
}
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
is = input_files[ist->file_index];
ist->pts = 0;
ist->next_pts = 0;
}
for(i=0;i<nb_input_files;i++) {
file_table[i].buffer_size_max = 2048;
}
for(i=0;i<nb_output_files;i++) {
os = output_files[i];
if (av_write_header(os) < 0) {
fprintf(stderr, "Could not write header for output file #%d (incorrect codec paramters ?)\n", i);
ret = -EINVAL;
goto fail;
}
}
#ifndef CONFIG_WIN32
if ( !using_stdin )
fprintf(stderr, "Press [q] to stop encoding\n");
#endif
term_init();
stream_no_data = 0;
key = -1;
for(; received_sigterm == 0;) {
int file_index, ist_index;
AVPacket pkt;
double pts_min;
redo:
if (!using_stdin) {
key = read_key();
if (key == 'q')
break;
}
file_index = -1;
pts_min = 1e10;
for(i=0;i<nb_ostreams;i++) {
double pts;
ost = ost_table[i];
os = output_files[ost->file_index];
ist = ist_table[ost->source_index];
pts = (double)ost->st->pts.val * os->pts_num / os->pts_den;
if (!file_table[ist->file_index].eof_reached &&
pts < pts_min) {
pts_min = pts;
file_index = ist->file_index;
}
}
if (file_index < 0) {
break;
}
if (recording_time > 0 && pts_min >= (recording_time / 1000000.0))
break;
is = input_files[file_index];
if (av_read_frame(is, &pkt) < 0) {
file_table[file_index].eof_reached = 1;
continue;
}
if (!pkt.size) {
stream_no_data = is;
} else {
stream_no_data = 0;
}
if (do_pkt_dump) {
av_pkt_dump(stdout, &pkt, do_hex_dump);
}
if (pkt.stream_index >= file_table[file_index].nb_streams)
goto discard_packet;
ist_index = file_table[file_index].ist_index + pkt.stream_index;
ist = ist_table[ist_index];
if (ist->discard)
goto discard_packet;
if (output_packet(ist, ist_index, ost_table, nb_ostreams, &pkt) < 0) {
fprintf(stderr, "Error while decoding stream #%d.%d\n",
ist->file_index, ist->index);
av_free_packet(&pkt);
goto redo;
}
discard_packet:
av_free_packet(&pkt);
print_report(output_files, ost_table, nb_ostreams, 0);
}
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
if (ist->decoding_needed) {
output_packet(ist, i, ost_table, nb_ostreams, NULL);
}
}
term_exit();
print_report(output_files, ost_table, nb_ostreams, 1);
for(i=0;i<nb_output_files;i++) {
os = output_files[i];
av_write_trailer(os);
}
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
if (ost->encoding_needed) {
av_freep(&ost->st->codec.stats_in);
avcodec_close(&ost->st->codec);
}
}
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
if (ist->decoding_needed) {
avcodec_close(&ist->st->codec);
}
}
ret = 0;
fail1:
av_free(file_table);
if (ist_table) {
for(i=0;i<nb_istreams;i++) {
ist = ist_table[i];
av_free(ist);
}
av_free(ist_table);
}
if (ost_table) {
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
if (ost) {
if (ost->logfile) {
fclose(ost->logfile);
ost->logfile = NULL;
}
fifo_free(&ost->fifo);
av_free(ost->pict_tmp.data[0]);
if (ost->video_resample)
img_resample_close(ost->img_resample_ctx);
if (ost->audio_resample)
audio_resample_close(ost->resample);
av_free(ost);
}
}
av_free(ost_table);
}
return ret;
fail:
ret = -ENOMEM;
goto fail1;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVFormatContext **VAR_0,
int VAR_1,
AVFormatContext **VAR_2,
int VAR_3,
AVStreamMap *VAR_4, int VAR_5)
{
int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11 = 0, VAR_12 = 0;
AVFormatContext *is, *os;
AVCodecContext *codec, *icodec;
AVOutputStream *ost, **ost_table = NULL;
AVInputStream *ist, **ist_table = NULL;
AVInputFile *file_table;
AVFormatContext *stream_no_data;
int VAR_13;
file_table= (AVInputFile*) av_mallocz(VAR_3 * sizeof(AVInputFile));
if (!file_table)
goto fail;
VAR_8 = 0;
for(VAR_7=0;VAR_7<VAR_3;VAR_7++) {
is = VAR_2[VAR_7];
file_table[VAR_7].ist_index = VAR_8;
file_table[VAR_7].nb_streams = is->nb_streams;
VAR_8 += is->nb_streams;
}
VAR_11 = VAR_8;
ist_table = av_mallocz(VAR_11 * sizeof(AVInputStream *));
if (!ist_table)
goto fail;
for(VAR_7=0;VAR_7<VAR_11;VAR_7++) {
ist = av_mallocz(sizeof(AVInputStream));
if (!ist)
goto fail;
ist_table[VAR_7] = ist;
}
VAR_8 = 0;
for(VAR_7=0;VAR_7<VAR_3;VAR_7++) {
is = VAR_2[VAR_7];
for(VAR_9=0;VAR_9<is->nb_streams;VAR_9++) {
ist = ist_table[VAR_8++];
ist->st = is->streams[VAR_9];
ist->file_index = VAR_7;
ist->index = VAR_9;
ist->discard = 1;
if (ist->st->codec.rate_emu) {
ist->start = av_gettime();
ist->frame = 0;
}
}
}
VAR_12 = 0;
for(VAR_7=0;VAR_7<VAR_1;VAR_7++) {
os = VAR_0[VAR_7];
VAR_12 += os->nb_streams;
}
if (VAR_5 > 0 && VAR_5 != VAR_12) {
fprintf(stderr, "Number of stream maps must match number of output streams\VAR_10");
exit(1);
}
for(VAR_7=0;VAR_7<VAR_5;VAR_7++) {
int VAR_14 = VAR_4[VAR_7].file_index;
int VAR_15 = VAR_4[VAR_7].stream_index;
if (VAR_14 < 0 || VAR_14 > VAR_3 - 1 ||
VAR_15 < 0 || VAR_15 > file_table[VAR_14].nb_streams - 1) {
fprintf(stderr,"Could not find input stream #%d.%d\VAR_10", VAR_14, VAR_15);
exit(1);
}
}
ost_table = av_mallocz(sizeof(AVOutputStream *) * VAR_12);
if (!ost_table)
goto fail;
for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {
ost = av_mallocz(sizeof(AVOutputStream));
if (!ost)
goto fail;
ost_table[VAR_7] = ost;
}
VAR_10 = 0;
for(VAR_9=0;VAR_9<VAR_1;VAR_9++) {
os = VAR_0[VAR_9];
for(VAR_7=0;VAR_7<os->nb_streams;VAR_7++) {
int found;
ost = ost_table[VAR_10++];
ost->file_index = VAR_9;
ost->index = VAR_7;
ost->st = os->streams[VAR_7];
if (VAR_5 > 0) {
ost->source_index = file_table[VAR_4[VAR_10-1].file_index].ist_index +
VAR_4[VAR_10-1].stream_index;
if (ist_table[ost->source_index]->st->codec.codec_type != ost->st->codec.codec_type) {
fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\VAR_10",
VAR_4[VAR_10-1].file_index, VAR_4[VAR_10-1].stream_index,
ost->file_index, ost->index);
exit(1);
}
} else {
found = 0;
for(VAR_8=0;VAR_8<VAR_11;VAR_8++) {
ist = ist_table[VAR_8];
if (ist->discard &&
ist->st->codec.codec_type == ost->st->codec.codec_type) {
ost->source_index = VAR_8;
found = 1;
}
}
if (!found) {
for(VAR_8=0;VAR_8<VAR_11;VAR_8++) {
ist = ist_table[VAR_8];
if (ist->st->codec.codec_type == ost->st->codec.codec_type) {
ost->source_index = VAR_8;
found = 1;
}
}
if (!found) {
fprintf(stderr, "Could not find input stream matching output stream #%d.%d\VAR_10",
ost->file_index, ost->index);
exit(1);
}
}
}
ist = ist_table[ost->source_index];
ist->discard = 0;
}
}
for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {
ost = ost_table[VAR_7];
ist = ist_table[ost->source_index];
codec = &ost->st->codec;
icodec = &ist->st->codec;
if (ost->st->stream_copy) {
codec->codec_id = icodec->codec_id;
codec->codec_type = icodec->codec_type;
codec->codec_tag = icodec->codec_tag;
codec->bit_rate = icodec->bit_rate;
switch(codec->codec_type) {
case CODEC_TYPE_AUDIO:
codec->sample_rate = icodec->sample_rate;
codec->channels = icodec->channels;
break;
case CODEC_TYPE_VIDEO:
codec->frame_rate = icodec->frame_rate;
codec->frame_rate_base = icodec->frame_rate_base;
codec->width = icodec->width;
codec->height = icodec->height;
break;
default:
av_abort();
}
} else {
switch(codec->codec_type) {
case CODEC_TYPE_AUDIO:
if (fifo_init(&ost->fifo, 2 * MAX_AUDIO_PACKET_SIZE))
goto fail;
if (codec->channels == icodec->channels &&
codec->sample_rate == icodec->sample_rate) {
ost->audio_resample = 0;
} else {
if (codec->channels != icodec->channels &&
icodec->codec_id == CODEC_ID_AC3) {
icodec->channels = codec->channels;
if (codec->sample_rate == icodec->sample_rate)
ost->audio_resample = 0;
else {
ost->audio_resample = 1;
ost->resample = audio_resample_init(codec->channels, icodec->channels,
codec->sample_rate,
icodec->sample_rate);
if(!ost->resample)
{
printf("Can't resample. Aborting.\VAR_10");
av_abort();
}
}
icodec->channels = codec->channels;
} else {
ost->audio_resample = 1;
ost->resample = audio_resample_init(codec->channels, icodec->channels,
codec->sample_rate,
icodec->sample_rate);
if(!ost->resample)
{
printf("Can't resample. Aborting.\VAR_10");
av_abort();
}
}
}
ist->decoding_needed = 1;
ost->encoding_needed = 1;
break;
case CODEC_TYPE_VIDEO:
if (codec->width == icodec->width &&
codec->height == icodec->height &&
frame_topBand == 0 &&
frame_bottomBand == 0 &&
frame_leftBand == 0 &&
frame_rightBand == 0)
{
ost->video_resample = 0;
ost->video_crop = 0;
} else if ((codec->width == icodec->width -
(frame_leftBand + frame_rightBand)) &&
(codec->height == icodec->height -
(frame_topBand + frame_bottomBand)))
{
ost->video_resample = 0;
ost->video_crop = 1;
ost->topBand = frame_topBand;
ost->leftBand = frame_leftBand;
} else {
ost->video_resample = 1;
ost->video_crop = 0;
if( avpicture_alloc( &ost->pict_tmp, PIX_FMT_YUV420P,
codec->width, codec->height ) )
goto fail;
ost->img_resample_ctx = img_resample_full_init(
ost->st->codec.width, ost->st->codec.height,
ist->st->codec.width, ist->st->codec.height,
frame_topBand, frame_bottomBand,
frame_leftBand, frame_rightBand);
}
ost->encoding_needed = 1;
ist->decoding_needed = 1;
break;
default:
av_abort();
}
if (ost->encoding_needed &&
(codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) {
char VAR_16[1024];
FILE *f;
int VAR_17;
char *VAR_18;
snprintf(VAR_16, sizeof(VAR_16), "%s-%d.log",
pass_logfilename ?
pass_logfilename : DEFAULT_PASS_LOGFILENAME, VAR_7);
if (codec->flags & CODEC_FLAG_PASS1) {
f = fopen(VAR_16, "w");
if (!f) {
perror(VAR_16);
exit(1);
}
ost->logfile = f;
} else {
f = fopen(VAR_16, "r");
if (!f) {
perror(VAR_16);
exit(1);
}
fseek(f, 0, SEEK_END);
VAR_17 = ftell(f);
fseek(f, 0, SEEK_SET);
VAR_18 = av_malloc(VAR_17 + 1);
if (!VAR_18) {
fprintf(stderr, "Could not allocate log buffer\VAR_10");
exit(1);
}
VAR_17 = fread(VAR_18, 1, VAR_17, f);
fclose(f);
VAR_18[VAR_17] = '\0';
codec->stats_in = VAR_18;
}
}
}
}
for(VAR_7=0;VAR_7<VAR_1;VAR_7++) {
dump_format(VAR_0[VAR_7], VAR_7, VAR_0[VAR_7]->filename, 1);
}
fprintf(stderr, "Stream mapping:\VAR_10");
for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {
ost = ost_table[VAR_7];
fprintf(stderr, " Stream #%d.%d -> #%d.%d\VAR_10",
ist_table[ost->source_index]->file_index,
ist_table[ost->source_index]->index,
ost->file_index,
ost->index);
}
for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {
ost = ost_table[VAR_7];
if (ost->encoding_needed) {
AVCodec *codec;
codec = avcodec_find_encoder(ost->st->codec.codec_id);
if (!codec) {
fprintf(stderr, "Unsupported codec for output stream #%d.%d\VAR_10",
ost->file_index, ost->index);
exit(1);
}
if (avcodec_open(&ost->st->codec, codec) < 0) {
fprintf(stderr, "Error while opening codec for stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height\VAR_10",
ost->file_index, ost->index);
exit(1);
}
}
}
for(VAR_7=0;VAR_7<VAR_11;VAR_7++) {
ist = ist_table[VAR_7];
if (ist->decoding_needed) {
AVCodec *codec;
codec = avcodec_find_decoder(ist->st->codec.codec_id);
if (!codec) {
fprintf(stderr, "Unsupported codec (id=%d) for input stream #%d.%d\VAR_10",
ist->st->codec.codec_id, ist->file_index, ist->index);
exit(1);
}
if (avcodec_open(&ist->st->codec, codec) < 0) {
fprintf(stderr, "Error while opening codec for input stream #%d.%d\VAR_10",
ist->file_index, ist->index);
exit(1);
}
}
}
for(VAR_7=0;VAR_7<VAR_11;VAR_7++) {
ist = ist_table[VAR_7];
is = VAR_2[ist->file_index];
ist->pts = 0;
ist->next_pts = 0;
}
for(VAR_7=0;VAR_7<VAR_3;VAR_7++) {
file_table[VAR_7].buffer_size_max = 2048;
}
for(VAR_7=0;VAR_7<VAR_1;VAR_7++) {
os = VAR_0[VAR_7];
if (av_write_header(os) < 0) {
fprintf(stderr, "Could not write header for output file #%d (incorrect codec paramters ?)\VAR_10", VAR_7);
VAR_6 = -EINVAL;
goto fail;
}
}
#ifndef CONFIG_WIN32
if ( !using_stdin )
fprintf(stderr, "Press [q] to stop encoding\VAR_10");
#endif
term_init();
stream_no_data = 0;
VAR_13 = -1;
for(; received_sigterm == 0;) {
int file_index, ist_index;
AVPacket pkt;
double pts_min;
redo:
if (!using_stdin) {
VAR_13 = read_key();
if (VAR_13 == 'q')
break;
}
file_index = -1;
pts_min = 1e10;
for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {
double pts;
ost = ost_table[VAR_7];
os = VAR_0[ost->file_index];
ist = ist_table[ost->source_index];
pts = (double)ost->st->pts.val * os->pts_num / os->pts_den;
if (!file_table[ist->file_index].eof_reached &&
pts < pts_min) {
pts_min = pts;
file_index = ist->file_index;
}
}
if (file_index < 0) {
break;
}
if (recording_time > 0 && pts_min >= (recording_time / 1000000.0))
break;
is = VAR_2[file_index];
if (av_read_frame(is, &pkt) < 0) {
file_table[file_index].eof_reached = 1;
continue;
}
if (!pkt.VAR_17) {
stream_no_data = is;
} else {
stream_no_data = 0;
}
if (do_pkt_dump) {
av_pkt_dump(stdout, &pkt, do_hex_dump);
}
if (pkt.stream_index >= file_table[file_index].nb_streams)
goto discard_packet;
ist_index = file_table[file_index].ist_index + pkt.stream_index;
ist = ist_table[ist_index];
if (ist->discard)
goto discard_packet;
if (output_packet(ist, ist_index, ost_table, VAR_12, &pkt) < 0) {
fprintf(stderr, "Error while decoding stream #%d.%d\VAR_10",
ist->file_index, ist->index);
av_free_packet(&pkt);
goto redo;
}
discard_packet:
av_free_packet(&pkt);
print_report(VAR_0, ost_table, VAR_12, 0);
}
for(VAR_7=0;VAR_7<VAR_11;VAR_7++) {
ist = ist_table[VAR_7];
if (ist->decoding_needed) {
output_packet(ist, VAR_7, ost_table, VAR_12, NULL);
}
}
term_exit();
print_report(VAR_0, ost_table, VAR_12, 1);
for(VAR_7=0;VAR_7<VAR_1;VAR_7++) {
os = VAR_0[VAR_7];
av_write_trailer(os);
}
for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {
ost = ost_table[VAR_7];
if (ost->encoding_needed) {
av_freep(&ost->st->codec.stats_in);
avcodec_close(&ost->st->codec);
}
}
for(VAR_7=0;VAR_7<VAR_11;VAR_7++) {
ist = ist_table[VAR_7];
if (ist->decoding_needed) {
avcodec_close(&ist->st->codec);
}
}
VAR_6 = 0;
fail1:
av_free(file_table);
if (ist_table) {
for(VAR_7=0;VAR_7<VAR_11;VAR_7++) {
ist = ist_table[VAR_7];
av_free(ist);
}
av_free(ist_table);
}
if (ost_table) {
for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {
ost = ost_table[VAR_7];
if (ost) {
if (ost->logfile) {
fclose(ost->logfile);
ost->logfile = NULL;
}
fifo_free(&ost->fifo);
av_free(ost->pict_tmp.data[0]);
if (ost->video_resample)
img_resample_close(ost->img_resample_ctx);
if (ost->audio_resample)
audio_resample_close(ost->resample);
av_free(ost);
}
}
av_free(ost_table);
}
return VAR_6;
fail:
VAR_6 = -ENOMEM;
goto fail1;
}
|
[
"static int FUNC_0(AVFormatContext **VAR_0,\nint VAR_1,\nAVFormatContext **VAR_2,\nint VAR_3,\nAVStreamMap *VAR_4, int VAR_5)\n{",
"int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11 = 0, VAR_12 = 0;",
"AVFormatContext *is, *os;",
"AVCodecContext *codec, *icodec;",
"AVOutputStream *ost, **ost_table = NULL;",
"AVInputStream *ist, **ist_table = NULL;",
"AVInputFile *file_table;",
"AVFormatContext *stream_no_data;",
"int VAR_13;",
"file_table= (AVInputFile*) av_mallocz(VAR_3 * sizeof(AVInputFile));",
"if (!file_table)\ngoto fail;",
"VAR_8 = 0;",
"for(VAR_7=0;VAR_7<VAR_3;VAR_7++) {",
"is = VAR_2[VAR_7];",
"file_table[VAR_7].ist_index = VAR_8;",
"file_table[VAR_7].nb_streams = is->nb_streams;",
"VAR_8 += is->nb_streams;",
"}",
"VAR_11 = VAR_8;",
"ist_table = av_mallocz(VAR_11 * sizeof(AVInputStream *));",
"if (!ist_table)\ngoto fail;",
"for(VAR_7=0;VAR_7<VAR_11;VAR_7++) {",
"ist = av_mallocz(sizeof(AVInputStream));",
"if (!ist)\ngoto fail;",
"ist_table[VAR_7] = ist;",
"}",
"VAR_8 = 0;",
"for(VAR_7=0;VAR_7<VAR_3;VAR_7++) {",
"is = VAR_2[VAR_7];",
"for(VAR_9=0;VAR_9<is->nb_streams;VAR_9++) {",
"ist = ist_table[VAR_8++];",
"ist->st = is->streams[VAR_9];",
"ist->file_index = VAR_7;",
"ist->index = VAR_9;",
"ist->discard = 1;",
"if (ist->st->codec.rate_emu) {",
"ist->start = av_gettime();",
"ist->frame = 0;",
"}",
"}",
"}",
"VAR_12 = 0;",
"for(VAR_7=0;VAR_7<VAR_1;VAR_7++) {",
"os = VAR_0[VAR_7];",
"VAR_12 += os->nb_streams;",
"}",
"if (VAR_5 > 0 && VAR_5 != VAR_12) {",
"fprintf(stderr, \"Number of stream maps must match number of output streams\\VAR_10\");",
"exit(1);",
"}",
"for(VAR_7=0;VAR_7<VAR_5;VAR_7++) {",
"int VAR_14 = VAR_4[VAR_7].file_index;",
"int VAR_15 = VAR_4[VAR_7].stream_index;",
"if (VAR_14 < 0 || VAR_14 > VAR_3 - 1 ||\nVAR_15 < 0 || VAR_15 > file_table[VAR_14].nb_streams - 1) {",
"fprintf(stderr,\"Could not find input stream #%d.%d\\VAR_10\", VAR_14, VAR_15);",
"exit(1);",
"}",
"}",
"ost_table = av_mallocz(sizeof(AVOutputStream *) * VAR_12);",
"if (!ost_table)\ngoto fail;",
"for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {",
"ost = av_mallocz(sizeof(AVOutputStream));",
"if (!ost)\ngoto fail;",
"ost_table[VAR_7] = ost;",
"}",
"VAR_10 = 0;",
"for(VAR_9=0;VAR_9<VAR_1;VAR_9++) {",
"os = VAR_0[VAR_9];",
"for(VAR_7=0;VAR_7<os->nb_streams;VAR_7++) {",
"int found;",
"ost = ost_table[VAR_10++];",
"ost->file_index = VAR_9;",
"ost->index = VAR_7;",
"ost->st = os->streams[VAR_7];",
"if (VAR_5 > 0) {",
"ost->source_index = file_table[VAR_4[VAR_10-1].file_index].ist_index +\nVAR_4[VAR_10-1].stream_index;",
"if (ist_table[ost->source_index]->st->codec.codec_type != ost->st->codec.codec_type) {",
"fprintf(stderr, \"Codec type mismatch for mapping #%d.%d -> #%d.%d\\VAR_10\",\nVAR_4[VAR_10-1].file_index, VAR_4[VAR_10-1].stream_index,\nost->file_index, ost->index);",
"exit(1);",
"}",
"} else {",
"found = 0;",
"for(VAR_8=0;VAR_8<VAR_11;VAR_8++) {",
"ist = ist_table[VAR_8];",
"if (ist->discard &&\nist->st->codec.codec_type == ost->st->codec.codec_type) {",
"ost->source_index = VAR_8;",
"found = 1;",
"}",
"}",
"if (!found) {",
"for(VAR_8=0;VAR_8<VAR_11;VAR_8++) {",
"ist = ist_table[VAR_8];",
"if (ist->st->codec.codec_type == ost->st->codec.codec_type) {",
"ost->source_index = VAR_8;",
"found = 1;",
"}",
"}",
"if (!found) {",
"fprintf(stderr, \"Could not find input stream matching output stream #%d.%d\\VAR_10\",\nost->file_index, ost->index);",
"exit(1);",
"}",
"}",
"}",
"ist = ist_table[ost->source_index];",
"ist->discard = 0;",
"}",
"}",
"for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {",
"ost = ost_table[VAR_7];",
"ist = ist_table[ost->source_index];",
"codec = &ost->st->codec;",
"icodec = &ist->st->codec;",
"if (ost->st->stream_copy) {",
"codec->codec_id = icodec->codec_id;",
"codec->codec_type = icodec->codec_type;",
"codec->codec_tag = icodec->codec_tag;",
"codec->bit_rate = icodec->bit_rate;",
"switch(codec->codec_type) {",
"case CODEC_TYPE_AUDIO:\ncodec->sample_rate = icodec->sample_rate;",
"codec->channels = icodec->channels;",
"break;",
"case CODEC_TYPE_VIDEO:\ncodec->frame_rate = icodec->frame_rate;",
"codec->frame_rate_base = icodec->frame_rate_base;",
"codec->width = icodec->width;",
"codec->height = icodec->height;",
"break;",
"default:\nav_abort();",
"}",
"} else {",
"switch(codec->codec_type) {",
"case CODEC_TYPE_AUDIO:\nif (fifo_init(&ost->fifo, 2 * MAX_AUDIO_PACKET_SIZE))\ngoto fail;",
"if (codec->channels == icodec->channels &&\ncodec->sample_rate == icodec->sample_rate) {",
"ost->audio_resample = 0;",
"} else {",
"if (codec->channels != icodec->channels &&\nicodec->codec_id == CODEC_ID_AC3) {",
"icodec->channels = codec->channels;",
"if (codec->sample_rate == icodec->sample_rate)\nost->audio_resample = 0;",
"else {",
"ost->audio_resample = 1;",
"ost->resample = audio_resample_init(codec->channels, icodec->channels,\ncodec->sample_rate,\nicodec->sample_rate);",
"if(!ost->resample)\n{",
"printf(\"Can't resample. Aborting.\\VAR_10\");",
"av_abort();",
"}",
"}",
"icodec->channels = codec->channels;",
"} else {",
"ost->audio_resample = 1;",
"ost->resample = audio_resample_init(codec->channels, icodec->channels,\ncodec->sample_rate,\nicodec->sample_rate);",
"if(!ost->resample)\n{",
"printf(\"Can't resample. Aborting.\\VAR_10\");",
"av_abort();",
"}",
"}",
"}",
"ist->decoding_needed = 1;",
"ost->encoding_needed = 1;",
"break;",
"case CODEC_TYPE_VIDEO:\nif (codec->width == icodec->width &&\ncodec->height == icodec->height &&\nframe_topBand == 0 &&\nframe_bottomBand == 0 &&\nframe_leftBand == 0 &&\nframe_rightBand == 0)\n{",
"ost->video_resample = 0;",
"ost->video_crop = 0;",
"} else if ((codec->width == icodec->width -",
"(frame_leftBand + frame_rightBand)) &&\n(codec->height == icodec->height -\n(frame_topBand + frame_bottomBand)))\n{",
"ost->video_resample = 0;",
"ost->video_crop = 1;",
"ost->topBand = frame_topBand;",
"ost->leftBand = frame_leftBand;",
"} else {",
"ost->video_resample = 1;",
"ost->video_crop = 0;",
"if( avpicture_alloc( &ost->pict_tmp, PIX_FMT_YUV420P,\ncodec->width, codec->height ) )\ngoto fail;",
"ost->img_resample_ctx = img_resample_full_init(\nost->st->codec.width, ost->st->codec.height,\nist->st->codec.width, ist->st->codec.height,\nframe_topBand, frame_bottomBand,\nframe_leftBand, frame_rightBand);",
"}",
"ost->encoding_needed = 1;",
"ist->decoding_needed = 1;",
"break;",
"default:\nav_abort();",
"}",
"if (ost->encoding_needed &&\n(codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) {",
"char VAR_16[1024];",
"FILE *f;",
"int VAR_17;",
"char *VAR_18;",
"snprintf(VAR_16, sizeof(VAR_16), \"%s-%d.log\",\npass_logfilename ?\npass_logfilename : DEFAULT_PASS_LOGFILENAME, VAR_7);",
"if (codec->flags & CODEC_FLAG_PASS1) {",
"f = fopen(VAR_16, \"w\");",
"if (!f) {",
"perror(VAR_16);",
"exit(1);",
"}",
"ost->logfile = f;",
"} else {",
"f = fopen(VAR_16, \"r\");",
"if (!f) {",
"perror(VAR_16);",
"exit(1);",
"}",
"fseek(f, 0, SEEK_END);",
"VAR_17 = ftell(f);",
"fseek(f, 0, SEEK_SET);",
"VAR_18 = av_malloc(VAR_17 + 1);",
"if (!VAR_18) {",
"fprintf(stderr, \"Could not allocate log buffer\\VAR_10\");",
"exit(1);",
"}",
"VAR_17 = fread(VAR_18, 1, VAR_17, f);",
"fclose(f);",
"VAR_18[VAR_17] = '\\0';",
"codec->stats_in = VAR_18;",
"}",
"}",
"}",
"}",
"for(VAR_7=0;VAR_7<VAR_1;VAR_7++) {",
"dump_format(VAR_0[VAR_7], VAR_7, VAR_0[VAR_7]->filename, 1);",
"}",
"fprintf(stderr, \"Stream mapping:\\VAR_10\");",
"for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {",
"ost = ost_table[VAR_7];",
"fprintf(stderr, \" Stream #%d.%d -> #%d.%d\\VAR_10\",\nist_table[ost->source_index]->file_index,\nist_table[ost->source_index]->index,\nost->file_index,\nost->index);",
"}",
"for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {",
"ost = ost_table[VAR_7];",
"if (ost->encoding_needed) {",
"AVCodec *codec;",
"codec = avcodec_find_encoder(ost->st->codec.codec_id);",
"if (!codec) {",
"fprintf(stderr, \"Unsupported codec for output stream #%d.%d\\VAR_10\",\nost->file_index, ost->index);",
"exit(1);",
"}",
"if (avcodec_open(&ost->st->codec, codec) < 0) {",
"fprintf(stderr, \"Error while opening codec for stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height\\VAR_10\",\nost->file_index, ost->index);",
"exit(1);",
"}",
"}",
"}",
"for(VAR_7=0;VAR_7<VAR_11;VAR_7++) {",
"ist = ist_table[VAR_7];",
"if (ist->decoding_needed) {",
"AVCodec *codec;",
"codec = avcodec_find_decoder(ist->st->codec.codec_id);",
"if (!codec) {",
"fprintf(stderr, \"Unsupported codec (id=%d) for input stream #%d.%d\\VAR_10\",\nist->st->codec.codec_id, ist->file_index, ist->index);",
"exit(1);",
"}",
"if (avcodec_open(&ist->st->codec, codec) < 0) {",
"fprintf(stderr, \"Error while opening codec for input stream #%d.%d\\VAR_10\",\nist->file_index, ist->index);",
"exit(1);",
"}",
"}",
"}",
"for(VAR_7=0;VAR_7<VAR_11;VAR_7++) {",
"ist = ist_table[VAR_7];",
"is = VAR_2[ist->file_index];",
"ist->pts = 0;",
"ist->next_pts = 0;",
"}",
"for(VAR_7=0;VAR_7<VAR_3;VAR_7++) {",
"file_table[VAR_7].buffer_size_max = 2048;",
"}",
"for(VAR_7=0;VAR_7<VAR_1;VAR_7++) {",
"os = VAR_0[VAR_7];",
"if (av_write_header(os) < 0) {",
"fprintf(stderr, \"Could not write header for output file #%d (incorrect codec paramters ?)\\VAR_10\", VAR_7);",
"VAR_6 = -EINVAL;",
"goto fail;",
"}",
"}",
"#ifndef CONFIG_WIN32\nif ( !using_stdin )\nfprintf(stderr, \"Press [q] to stop encoding\\VAR_10\");",
"#endif\nterm_init();",
"stream_no_data = 0;",
"VAR_13 = -1;",
"for(; received_sigterm == 0;) {",
"int file_index, ist_index;",
"AVPacket pkt;",
"double pts_min;",
"redo:\nif (!using_stdin) {",
"VAR_13 = read_key();",
"if (VAR_13 == 'q')\nbreak;",
"}",
"file_index = -1;",
"pts_min = 1e10;",
"for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {",
"double pts;",
"ost = ost_table[VAR_7];",
"os = VAR_0[ost->file_index];",
"ist = ist_table[ost->source_index];",
"pts = (double)ost->st->pts.val * os->pts_num / os->pts_den;",
"if (!file_table[ist->file_index].eof_reached &&\npts < pts_min) {",
"pts_min = pts;",
"file_index = ist->file_index;",
"}",
"}",
"if (file_index < 0) {",
"break;",
"}",
"if (recording_time > 0 && pts_min >= (recording_time / 1000000.0))\nbreak;",
"is = VAR_2[file_index];",
"if (av_read_frame(is, &pkt) < 0) {",
"file_table[file_index].eof_reached = 1;",
"continue;",
"}",
"if (!pkt.VAR_17) {",
"stream_no_data = is;",
"} else {",
"stream_no_data = 0;",
"}",
"if (do_pkt_dump) {",
"av_pkt_dump(stdout, &pkt, do_hex_dump);",
"}",
"if (pkt.stream_index >= file_table[file_index].nb_streams)\ngoto discard_packet;",
"ist_index = file_table[file_index].ist_index + pkt.stream_index;",
"ist = ist_table[ist_index];",
"if (ist->discard)\ngoto discard_packet;",
"if (output_packet(ist, ist_index, ost_table, VAR_12, &pkt) < 0) {",
"fprintf(stderr, \"Error while decoding stream #%d.%d\\VAR_10\",\nist->file_index, ist->index);",
"av_free_packet(&pkt);",
"goto redo;",
"}",
"discard_packet:\nav_free_packet(&pkt);",
"print_report(VAR_0, ost_table, VAR_12, 0);",
"}",
"for(VAR_7=0;VAR_7<VAR_11;VAR_7++) {",
"ist = ist_table[VAR_7];",
"if (ist->decoding_needed) {",
"output_packet(ist, VAR_7, ost_table, VAR_12, NULL);",
"}",
"}",
"term_exit();",
"print_report(VAR_0, ost_table, VAR_12, 1);",
"for(VAR_7=0;VAR_7<VAR_1;VAR_7++) {",
"os = VAR_0[VAR_7];",
"av_write_trailer(os);",
"}",
"for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {",
"ost = ost_table[VAR_7];",
"if (ost->encoding_needed) {",
"av_freep(&ost->st->codec.stats_in);",
"avcodec_close(&ost->st->codec);",
"}",
"}",
"for(VAR_7=0;VAR_7<VAR_11;VAR_7++) {",
"ist = ist_table[VAR_7];",
"if (ist->decoding_needed) {",
"avcodec_close(&ist->st->codec);",
"}",
"}",
"VAR_6 = 0;",
"fail1:\nav_free(file_table);",
"if (ist_table) {",
"for(VAR_7=0;VAR_7<VAR_11;VAR_7++) {",
"ist = ist_table[VAR_7];",
"av_free(ist);",
"}",
"av_free(ist_table);",
"}",
"if (ost_table) {",
"for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {",
"ost = ost_table[VAR_7];",
"if (ost) {",
"if (ost->logfile) {",
"fclose(ost->logfile);",
"ost->logfile = NULL;",
"}",
"fifo_free(&ost->fifo);",
"av_free(ost->pict_tmp.data[0]);",
"if (ost->video_resample)\nimg_resample_close(ost->img_resample_ctx);",
"if (ost->audio_resample)\naudio_resample_close(ost->resample);",
"av_free(ost);",
"}",
"}",
"av_free(ost_table);",
"}",
"return VAR_6;",
"fail:\nVAR_6 = -ENOMEM;",
"goto fail1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
59
],
[
61,
63
],
[
67
],
[
69
],
[
71,
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
139
],
[
141
],
[
143
],
[
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
],
[
209
],
[
211,
213,
215
],
[
217
],
[
219
],
[
223
],
[
227
],
[
229
],
[
231
],
[
233,
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
247
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267,
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
],
[
281
],
[
283
],
[
285
],
[
291
],
[
293
],
[
295
],
[
299
],
[
301
],
[
305
],
[
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
319,
321
],
[
323
],
[
325
],
[
327,
329
],
[
331
],
[
333
],
[
335
],
[
337
],
[
339,
341
],
[
343
],
[
345
],
[
347
],
[
349,
351,
353
],
[
357,
359
],
[
361
],
[
363
],
[
365,
367
],
[
375
],
[
377,
379
],
[
381
],
[
383
],
[
385,
387,
389
],
[
391,
393
],
[
395
],
[
397
],
[
399
],
[
401
],
[
405
],
[
407
],
[
409
],
[
411,
413,
415
],
[
417,
419
],
[
421
],
[
423
],
[
425
],
[
427
],
[
429
],
[
431
],
[
433
],
[
435
],
[
437,
439,
441,
443,
445,
447,
449,
451
],
[
453
],
[
455
],
[
457
],
[
459,
461,
463,
465
],
[
467
],
[
469
],
[
471
],
[
473
],
[
475
],
[
477
],
[
479
],
[
481,
483,
485
],
[
489,
491,
493,
495,
497
],
[
499
],
[
501
],
[
503
],
[
505
],
[
507,
509
],
[
511
],
[
515,
517
],
[
519
],
[
521
],
[
523
],
[
525
],
[
529,
531,
533
],
[
535
],
[
537
],
[
539
],
[
541
],
[
543
],
[
545
],
[
547
],
[
549
],
[
553
],
[
555
],
[
557
],
[
559
],
[
561
],
[
563
],
[
565
],
[
567
],
[
569
],
[
571
],
[
573
],
[
575
],
[
577
],
[
579
],
[
581
],
[
583
],
[
585
],
[
587
],
[
589
],
[
591
],
[
593
],
[
601
],
[
603
],
[
605
],
[
611
],
[
613
],
[
615
],
[
617,
619,
621,
623,
625
],
[
627
],
[
633
],
[
635
],
[
637
],
[
639
],
[
641
],
[
643
],
[
645,
647
],
[
649
],
[
651
],
[
653
],
[
655,
657
],
[
659
],
[
661
],
[
663
],
[
665
],
[
671
],
[
673
],
[
675
],
[
677
],
[
679
],
[
681
],
[
683,
685
],
[
687
],
[
689
],
[
691
],
[
693,
695
],
[
697
],
[
699
],
[
705
],
[
707
],
[
713
],
[
715
],
[
717
],
[
719
],
[
721
],
[
723
],
[
729
],
[
731
],
[
733
],
[
739
],
[
741
],
[
743
],
[
745
],
[
747
],
[
749
],
[
751
],
[
753
],
[
757,
759,
761
],
[
763,
765
],
[
769
],
[
771
],
[
775
],
[
777
],
[
779
],
[
781
],
[
785,
789
],
[
793
],
[
795,
797
],
[
799
],
[
807
],
[
809
],
[
811
],
[
813
],
[
815
],
[
817
],
[
819
],
[
821
],
[
823,
825
],
[
827
],
[
829
],
[
831
],
[
833
],
[
837
],
[
839
],
[
841
],
[
847,
849
],
[
855
],
[
857
],
[
859
],
[
861
],
[
863
],
[
867
],
[
869
],
[
871
],
[
873
],
[
875
],
[
877
],
[
879
],
[
881
],
[
887,
889
],
[
891
],
[
893
],
[
895,
897
],
[
903
],
[
905,
907
],
[
909
],
[
911
],
[
913
],
[
917,
919
],
[
925
],
[
927
],
[
933
],
[
935
],
[
937
],
[
939
],
[
941
],
[
943
],
[
947
],
[
953
],
[
959
],
[
961
],
[
963
],
[
965
],
[
971
],
[
973
],
[
975
],
[
977
],
[
979
],
[
981
],
[
983
],
[
989
],
[
991
],
[
993
],
[
995
],
[
997
],
[
999
],
[
1007
],
[
1009,
1011
],
[
1015
],
[
1017
],
[
1019
],
[
1021
],
[
1023
],
[
1025
],
[
1027
],
[
1029
],
[
1031
],
[
1033
],
[
1035
],
[
1037
],
[
1039
],
[
1041
],
[
1043
],
[
1045
],
[
1049
],
[
1051,
1053
],
[
1055,
1057
],
[
1059
],
[
1061
],
[
1063
],
[
1065
],
[
1067
],
[
1069
],
[
1071,
1073
],
[
1075
],
[
1077
]
] |
17,377
|
static void vm_change_state_handler(void *opaque, int running,
RunState state)
{
GICv3ITSState *s = (GICv3ITSState *)opaque;
Error *err = NULL;
int ret;
if (running) {
return;
}
ret = kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
KVM_DEV_ARM_ITS_SAVE_TABLES, NULL, true, &err);
if (err) {
error_report_err(err);
}
if (ret < 0 && ret != -EFAULT) {
abort();
}
}
| true
|
qemu
|
8a7348b5d62d7ea16807e6bea54b448a0184bb0f
|
static void vm_change_state_handler(void *opaque, int running,
RunState state)
{
GICv3ITSState *s = (GICv3ITSState *)opaque;
Error *err = NULL;
int ret;
if (running) {
return;
}
ret = kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
KVM_DEV_ARM_ITS_SAVE_TABLES, NULL, true, &err);
if (err) {
error_report_err(err);
}
if (ret < 0 && ret != -EFAULT) {
abort();
}
}
|
{
"code": [
" int ret;",
" ret = kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,",
" KVM_DEV_ARM_ITS_SAVE_TABLES, NULL, true, &err);",
" if (ret < 0 && ret != -EFAULT) {",
" abort();"
],
"line_no": [
11,
23,
25,
33,
35
]
}
|
static void FUNC_0(void *VAR_0, int VAR_1,
RunState VAR_2)
{
GICv3ITSState *s = (GICv3ITSState *)VAR_0;
Error *err = NULL;
int VAR_3;
if (VAR_1) {
return;
}
VAR_3 = kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
KVM_DEV_ARM_ITS_SAVE_TABLES, NULL, true, &err);
if (err) {
error_report_err(err);
}
if (VAR_3 < 0 && VAR_3 != -EFAULT) {
abort();
}
}
|
[
"static void FUNC_0(void *VAR_0, int VAR_1,\nRunState VAR_2)\n{",
"GICv3ITSState *s = (GICv3ITSState *)VAR_0;",
"Error *err = NULL;",
"int VAR_3;",
"if (VAR_1) {",
"return;",
"}",
"VAR_3 = kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,\nKVM_DEV_ARM_ITS_SAVE_TABLES, NULL, true, &err);",
"if (err) {",
"error_report_err(err);",
"}",
"if (VAR_3 < 0 && VAR_3 != -EFAULT) {",
"abort();",
"}",
"}"
] |
[
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
1,
1,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
23,
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
]
] |
17,379
|
static uint8_t usb_linux_get_alt_setting(USBHostDevice *s,
uint8_t configuration, uint8_t interface)
{
char device_name[64], line[1024];
int alt_setting;
sprintf(device_name, "%d-%s:%d.%d", s->bus_num, s->port,
(int)configuration, (int)interface);
if (!usb_host_read_file(line, sizeof(line), "bAlternateSetting",
device_name)) {
/* Assume alt 0 on error */
return 0;
}
if (sscanf(line, "%d", &alt_setting) != 1) {
/* Assume alt 0 on error */
return 0;
}
return alt_setting;
}
| true
|
qemu
|
96dd9aac37d30f3425088f81523942e67b2d03ac
|
static uint8_t usb_linux_get_alt_setting(USBHostDevice *s,
uint8_t configuration, uint8_t interface)
{
char device_name[64], line[1024];
int alt_setting;
sprintf(device_name, "%d-%s:%d.%d", s->bus_num, s->port,
(int)configuration, (int)interface);
if (!usb_host_read_file(line, sizeof(line), "bAlternateSetting",
device_name)) {
return 0;
}
if (sscanf(line, "%d", &alt_setting) != 1) {
return 0;
}
return alt_setting;
}
|
{
"code": [
"static uint8_t usb_linux_get_alt_setting(USBHostDevice *s,",
" uint8_t configuration, uint8_t interface)",
" char device_name[64], line[1024];",
" int alt_setting;",
" sprintf(device_name, \"%d-%s:%d.%d\", s->bus_num, s->port,",
" (int)configuration, (int)interface);",
" if (!usb_host_read_file(line, sizeof(line), \"bAlternateSetting\",",
" device_name)) {",
" return 0;",
" if (sscanf(line, \"%d\", &alt_setting) != 1) {",
" return 0;",
" return alt_setting;",
" return 0;"
],
"line_no": [
1,
3,
7,
9,
13,
15,
19,
21,
25,
29,
25,
37,
25
]
}
|
static uint8_t FUNC_0(USBHostDevice *s,
uint8_t configuration, uint8_t interface)
{
char VAR_0[64], VAR_1[1024];
int VAR_2;
sprintf(VAR_0, "%d-%s:%d.%d", s->bus_num, s->port,
(int)configuration, (int)interface);
if (!usb_host_read_file(VAR_1, sizeof(VAR_1), "bAlternateSetting",
VAR_0)) {
return 0;
}
if (sscanf(VAR_1, "%d", &VAR_2) != 1) {
return 0;
}
return VAR_2;
}
|
[
"static uint8_t FUNC_0(USBHostDevice *s,\nuint8_t configuration, uint8_t interface)\n{",
"char VAR_0[64], VAR_1[1024];",
"int VAR_2;",
"sprintf(VAR_0, \"%d-%s:%d.%d\", s->bus_num, s->port,\n(int)configuration, (int)interface);",
"if (!usb_host_read_file(VAR_1, sizeof(VAR_1), \"bAlternateSetting\",\nVAR_0)) {",
"return 0;",
"}",
"if (sscanf(VAR_1, \"%d\", &VAR_2) != 1) {",
"return 0;",
"}",
"return VAR_2;",
"}"
] |
[
1,
1,
1,
1,
1,
1,
0,
1,
0,
0,
1,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
13,
15
],
[
19,
21
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
]
] |
17,380
|
static int append_extradata(APNGDemuxContext *ctx, AVIOContext *pb, int len)
{
int previous_size = ctx->extra_data_size;
int new_size, ret;
uint8_t *new_extradata;
if (previous_size > INT_MAX - len)
return AVERROR_INVALIDDATA;
new_size = previous_size + len;
new_extradata = av_realloc(ctx->extra_data, new_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!new_extradata)
return AVERROR(ENOMEM);
ctx->extra_data = new_extradata;
ctx->extra_data_size = new_size;
if ((ret = avio_read(pb, ctx->extra_data + previous_size, len)) < 0)
return ret;
return previous_size;
}
| true
|
FFmpeg
|
16c429166ddf1736972b6ccce84bd3509ec16a34
|
static int append_extradata(APNGDemuxContext *ctx, AVIOContext *pb, int len)
{
int previous_size = ctx->extra_data_size;
int new_size, ret;
uint8_t *new_extradata;
if (previous_size > INT_MAX - len)
return AVERROR_INVALIDDATA;
new_size = previous_size + len;
new_extradata = av_realloc(ctx->extra_data, new_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!new_extradata)
return AVERROR(ENOMEM);
ctx->extra_data = new_extradata;
ctx->extra_data_size = new_size;
if ((ret = avio_read(pb, ctx->extra_data + previous_size, len)) < 0)
return ret;
return previous_size;
}
|
{
"code": [
"static int append_extradata(APNGDemuxContext *ctx, AVIOContext *pb, int len)",
" int previous_size = ctx->extra_data_size;",
" new_extradata = av_realloc(ctx->extra_data, new_size + AV_INPUT_BUFFER_PADDING_SIZE);",
" ctx->extra_data = new_extradata;",
" ctx->extra_data_size = new_size;",
" if ((ret = avio_read(pb, ctx->extra_data + previous_size, len)) < 0)"
],
"line_no": [
1,
5,
21,
27,
29,
33
]
}
|
static int FUNC_0(APNGDemuxContext *VAR_0, AVIOContext *VAR_1, int VAR_2)
{
int VAR_3 = VAR_0->extra_data_size;
int VAR_4, VAR_5;
uint8_t *new_extradata;
if (VAR_3 > INT_MAX - VAR_2)
return AVERROR_INVALIDDATA;
VAR_4 = VAR_3 + VAR_2;
new_extradata = av_realloc(VAR_0->extra_data, VAR_4 + AV_INPUT_BUFFER_PADDING_SIZE);
if (!new_extradata)
return AVERROR(ENOMEM);
VAR_0->extra_data = new_extradata;
VAR_0->extra_data_size = VAR_4;
if ((VAR_5 = avio_read(VAR_1, VAR_0->extra_data + VAR_3, VAR_2)) < 0)
return VAR_5;
return VAR_3;
}
|
[
"static int FUNC_0(APNGDemuxContext *VAR_0, AVIOContext *VAR_1, int VAR_2)\n{",
"int VAR_3 = VAR_0->extra_data_size;",
"int VAR_4, VAR_5;",
"uint8_t *new_extradata;",
"if (VAR_3 > INT_MAX - VAR_2)\nreturn AVERROR_INVALIDDATA;",
"VAR_4 = VAR_3 + VAR_2;",
"new_extradata = av_realloc(VAR_0->extra_data, VAR_4 + AV_INPUT_BUFFER_PADDING_SIZE);",
"if (!new_extradata)\nreturn AVERROR(ENOMEM);",
"VAR_0->extra_data = new_extradata;",
"VAR_0->extra_data_size = VAR_4;",
"if ((VAR_5 = avio_read(VAR_1, VAR_0->extra_data + VAR_3, VAR_2)) < 0)\nreturn VAR_5;",
"return VAR_3;",
"}"
] |
[
1,
1,
0,
0,
0,
0,
1,
0,
1,
1,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13,
15
],
[
19
],
[
21
],
[
23,
25
],
[
27
],
[
29
],
[
33,
35
],
[
39
],
[
41
]
] |
17,382
|
void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, int mb_y)
{
const int bs = ctx->block_width_l2;
const int bw = 1 << bs;
int dct_y_offset = ctx->dct_y_offset;
int dct_uv_offset = ctx->dct_uv_offset;
int linesize = ctx->m.linesize;
int uvlinesize = ctx->m.uvlinesize;
const uint8_t *ptr_y = ctx->thread[0]->src[0] +
((mb_y << 4) * ctx->m.linesize) + (mb_x << bs + 1);
const uint8_t *ptr_u = ctx->thread[0]->src[1] +
((mb_y << 4) * ctx->m.uvlinesize) + (mb_x << bs + ctx->is_444);
const uint8_t *ptr_v = ctx->thread[0]->src[2] +
((mb_y << 4) * ctx->m.uvlinesize) + (mb_x << bs + ctx->is_444);
PixblockDSPContext *pdsp = &ctx->m.pdsp;
VideoDSPContext *vdsp = &ctx->m.vdsp;
if (ctx->bit_depth != 10 && vdsp->emulated_edge_mc && ((mb_x << 4) + 16 > ctx->m.avctx->width ||
(mb_y << 4) + 16 > ctx->m.avctx->height)) {
int y_w = ctx->m.avctx->width - (mb_x << 4);
int y_h = ctx->m.avctx->height - (mb_y << 4);
int uv_w = (y_w + 1) / 2;
int uv_h = y_h;
linesize = 16;
uvlinesize = 8;
vdsp->emulated_edge_mc(&ctx->edge_buf_y[0], ptr_y,
linesize, ctx->m.linesize,
linesize, 16,
0, 0, y_w, y_h);
vdsp->emulated_edge_mc(&ctx->edge_buf_uv[0][0], ptr_u,
uvlinesize, ctx->m.uvlinesize,
uvlinesize, 16,
0, 0, uv_w, uv_h);
vdsp->emulated_edge_mc(&ctx->edge_buf_uv[1][0], ptr_v,
uvlinesize, ctx->m.uvlinesize,
uvlinesize, 16,
0, 0, uv_w, uv_h);
dct_y_offset = bw * linesize;
dct_uv_offset = bw * uvlinesize;
ptr_y = &ctx->edge_buf_y[0];
ptr_u = &ctx->edge_buf_uv[0][0];
ptr_v = &ctx->edge_buf_uv[1][0];
} else if (ctx->bit_depth == 10 && vdsp->emulated_edge_mc && ((mb_x << 3) + 8 > ctx->m.avctx->width ||
(mb_y << 3) + 8 > ctx->m.avctx->height)) {
int y_w = ctx->m.avctx->width - (mb_x << 3);
int y_h = ctx->m.avctx->height - (mb_y << 3);
int uv_w = ctx->is_444 ? y_w : (y_w + 1) / 2;
int uv_h = y_h;
linesize = 16;
uvlinesize = 8 + 8 * ctx->is_444;
vdsp->emulated_edge_mc(&ctx->edge_buf_y[0], ptr_y,
linesize, ctx->m.linesize,
linesize / 2, 16,
0, 0, y_w, y_h);
vdsp->emulated_edge_mc(&ctx->edge_buf_uv[0][0], ptr_u,
uvlinesize, ctx->m.uvlinesize,
uvlinesize / 2, 16,
0, 0, uv_w, uv_h);
vdsp->emulated_edge_mc(&ctx->edge_buf_uv[1][0], ptr_v,
uvlinesize, ctx->m.uvlinesize,
uvlinesize / 2, 16,
0, 0, uv_w, uv_h);
dct_y_offset = bw * linesize;
dct_uv_offset = bw * uvlinesize;
ptr_y = &ctx->edge_buf_y[0];
ptr_u = &ctx->edge_buf_uv[0][0];
ptr_v = &ctx->edge_buf_uv[1][0];
}
if (!ctx->is_444) {
pdsp->get_pixels(ctx->blocks[0], ptr_y, linesize);
pdsp->get_pixels(ctx->blocks[1], ptr_y + bw, linesize);
pdsp->get_pixels(ctx->blocks[2], ptr_u, uvlinesize);
pdsp->get_pixels(ctx->blocks[3], ptr_v, uvlinesize);
if (mb_y + 1 == ctx->m.mb_height && ctx->m.avctx->height == 1080) {
if (ctx->interlaced) {
ctx->get_pixels_8x4_sym(ctx->blocks[4],
ptr_y + dct_y_offset,
linesize);
ctx->get_pixels_8x4_sym(ctx->blocks[5],
ptr_y + dct_y_offset + bw,
linesize);
ctx->get_pixels_8x4_sym(ctx->blocks[6],
ptr_u + dct_uv_offset,
uvlinesize);
ctx->get_pixels_8x4_sym(ctx->blocks[7],
ptr_v + dct_uv_offset,
uvlinesize);
} else {
ctx->bdsp.clear_block(ctx->blocks[4]);
ctx->bdsp.clear_block(ctx->blocks[5]);
ctx->bdsp.clear_block(ctx->blocks[6]);
ctx->bdsp.clear_block(ctx->blocks[7]);
}
} else {
pdsp->get_pixels(ctx->blocks[4],
ptr_y + dct_y_offset, linesize);
pdsp->get_pixels(ctx->blocks[5],
ptr_y + dct_y_offset + bw, linesize);
pdsp->get_pixels(ctx->blocks[6],
ptr_u + dct_uv_offset, uvlinesize);
pdsp->get_pixels(ctx->blocks[7],
ptr_v + dct_uv_offset, uvlinesize);
}
} else {
pdsp->get_pixels(ctx->blocks[0], ptr_y, linesize);
pdsp->get_pixels(ctx->blocks[1], ptr_y + bw, linesize);
pdsp->get_pixels(ctx->blocks[6], ptr_y + dct_y_offset, linesize);
pdsp->get_pixels(ctx->blocks[7], ptr_y + dct_y_offset + bw, linesize);
pdsp->get_pixels(ctx->blocks[2], ptr_u, uvlinesize);
pdsp->get_pixels(ctx->blocks[3], ptr_u + bw, uvlinesize);
pdsp->get_pixels(ctx->blocks[8], ptr_u + dct_uv_offset, uvlinesize);
pdsp->get_pixels(ctx->blocks[9], ptr_u + dct_uv_offset + bw, uvlinesize);
pdsp->get_pixels(ctx->blocks[4], ptr_v, uvlinesize);
pdsp->get_pixels(ctx->blocks[5], ptr_v + bw, uvlinesize);
pdsp->get_pixels(ctx->blocks[10], ptr_v + dct_uv_offset, uvlinesize);
pdsp->get_pixels(ctx->blocks[11], ptr_v + dct_uv_offset + bw, uvlinesize);
}
}
| true
|
FFmpeg
|
eec67f25224a48047da57be18b610b11b0fd0bfe
|
void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, int mb_y)
{
const int bs = ctx->block_width_l2;
const int bw = 1 << bs;
int dct_y_offset = ctx->dct_y_offset;
int dct_uv_offset = ctx->dct_uv_offset;
int linesize = ctx->m.linesize;
int uvlinesize = ctx->m.uvlinesize;
const uint8_t *ptr_y = ctx->thread[0]->src[0] +
((mb_y << 4) * ctx->m.linesize) + (mb_x << bs + 1);
const uint8_t *ptr_u = ctx->thread[0]->src[1] +
((mb_y << 4) * ctx->m.uvlinesize) + (mb_x << bs + ctx->is_444);
const uint8_t *ptr_v = ctx->thread[0]->src[2] +
((mb_y << 4) * ctx->m.uvlinesize) + (mb_x << bs + ctx->is_444);
PixblockDSPContext *pdsp = &ctx->m.pdsp;
VideoDSPContext *vdsp = &ctx->m.vdsp;
if (ctx->bit_depth != 10 && vdsp->emulated_edge_mc && ((mb_x << 4) + 16 > ctx->m.avctx->width ||
(mb_y << 4) + 16 > ctx->m.avctx->height)) {
int y_w = ctx->m.avctx->width - (mb_x << 4);
int y_h = ctx->m.avctx->height - (mb_y << 4);
int uv_w = (y_w + 1) / 2;
int uv_h = y_h;
linesize = 16;
uvlinesize = 8;
vdsp->emulated_edge_mc(&ctx->edge_buf_y[0], ptr_y,
linesize, ctx->m.linesize,
linesize, 16,
0, 0, y_w, y_h);
vdsp->emulated_edge_mc(&ctx->edge_buf_uv[0][0], ptr_u,
uvlinesize, ctx->m.uvlinesize,
uvlinesize, 16,
0, 0, uv_w, uv_h);
vdsp->emulated_edge_mc(&ctx->edge_buf_uv[1][0], ptr_v,
uvlinesize, ctx->m.uvlinesize,
uvlinesize, 16,
0, 0, uv_w, uv_h);
dct_y_offset = bw * linesize;
dct_uv_offset = bw * uvlinesize;
ptr_y = &ctx->edge_buf_y[0];
ptr_u = &ctx->edge_buf_uv[0][0];
ptr_v = &ctx->edge_buf_uv[1][0];
} else if (ctx->bit_depth == 10 && vdsp->emulated_edge_mc && ((mb_x << 3) + 8 > ctx->m.avctx->width ||
(mb_y << 3) + 8 > ctx->m.avctx->height)) {
int y_w = ctx->m.avctx->width - (mb_x << 3);
int y_h = ctx->m.avctx->height - (mb_y << 3);
int uv_w = ctx->is_444 ? y_w : (y_w + 1) / 2;
int uv_h = y_h;
linesize = 16;
uvlinesize = 8 + 8 * ctx->is_444;
vdsp->emulated_edge_mc(&ctx->edge_buf_y[0], ptr_y,
linesize, ctx->m.linesize,
linesize / 2, 16,
0, 0, y_w, y_h);
vdsp->emulated_edge_mc(&ctx->edge_buf_uv[0][0], ptr_u,
uvlinesize, ctx->m.uvlinesize,
uvlinesize / 2, 16,
0, 0, uv_w, uv_h);
vdsp->emulated_edge_mc(&ctx->edge_buf_uv[1][0], ptr_v,
uvlinesize, ctx->m.uvlinesize,
uvlinesize / 2, 16,
0, 0, uv_w, uv_h);
dct_y_offset = bw * linesize;
dct_uv_offset = bw * uvlinesize;
ptr_y = &ctx->edge_buf_y[0];
ptr_u = &ctx->edge_buf_uv[0][0];
ptr_v = &ctx->edge_buf_uv[1][0];
}
if (!ctx->is_444) {
pdsp->get_pixels(ctx->blocks[0], ptr_y, linesize);
pdsp->get_pixels(ctx->blocks[1], ptr_y + bw, linesize);
pdsp->get_pixels(ctx->blocks[2], ptr_u, uvlinesize);
pdsp->get_pixels(ctx->blocks[3], ptr_v, uvlinesize);
if (mb_y + 1 == ctx->m.mb_height && ctx->m.avctx->height == 1080) {
if (ctx->interlaced) {
ctx->get_pixels_8x4_sym(ctx->blocks[4],
ptr_y + dct_y_offset,
linesize);
ctx->get_pixels_8x4_sym(ctx->blocks[5],
ptr_y + dct_y_offset + bw,
linesize);
ctx->get_pixels_8x4_sym(ctx->blocks[6],
ptr_u + dct_uv_offset,
uvlinesize);
ctx->get_pixels_8x4_sym(ctx->blocks[7],
ptr_v + dct_uv_offset,
uvlinesize);
} else {
ctx->bdsp.clear_block(ctx->blocks[4]);
ctx->bdsp.clear_block(ctx->blocks[5]);
ctx->bdsp.clear_block(ctx->blocks[6]);
ctx->bdsp.clear_block(ctx->blocks[7]);
}
} else {
pdsp->get_pixels(ctx->blocks[4],
ptr_y + dct_y_offset, linesize);
pdsp->get_pixels(ctx->blocks[5],
ptr_y + dct_y_offset + bw, linesize);
pdsp->get_pixels(ctx->blocks[6],
ptr_u + dct_uv_offset, uvlinesize);
pdsp->get_pixels(ctx->blocks[7],
ptr_v + dct_uv_offset, uvlinesize);
}
} else {
pdsp->get_pixels(ctx->blocks[0], ptr_y, linesize);
pdsp->get_pixels(ctx->blocks[1], ptr_y + bw, linesize);
pdsp->get_pixels(ctx->blocks[6], ptr_y + dct_y_offset, linesize);
pdsp->get_pixels(ctx->blocks[7], ptr_y + dct_y_offset + bw, linesize);
pdsp->get_pixels(ctx->blocks[2], ptr_u, uvlinesize);
pdsp->get_pixels(ctx->blocks[3], ptr_u + bw, uvlinesize);
pdsp->get_pixels(ctx->blocks[8], ptr_u + dct_uv_offset, uvlinesize);
pdsp->get_pixels(ctx->blocks[9], ptr_u + dct_uv_offset + bw, uvlinesize);
pdsp->get_pixels(ctx->blocks[4], ptr_v, uvlinesize);
pdsp->get_pixels(ctx->blocks[5], ptr_v + bw, uvlinesize);
pdsp->get_pixels(ctx->blocks[10], ptr_v + dct_uv_offset, uvlinesize);
pdsp->get_pixels(ctx->blocks[11], ptr_v + dct_uv_offset + bw, uvlinesize);
}
}
|
{
"code": [
" } else if (ctx->bit_depth == 10 && vdsp->emulated_edge_mc && ((mb_x << 3) + 8 > ctx->m.avctx->width ||",
" (mb_y << 3) + 8 > ctx->m.avctx->height)) {",
" int y_w = ctx->m.avctx->width - (mb_x << 3);",
" int y_h = ctx->m.avctx->height - (mb_y << 3);",
" linesize = 16;",
" uvlinesize = 8 + 8 * ctx->is_444;",
" dct_y_offset = bw * linesize;",
" dct_uv_offset = bw * uvlinesize;"
],
"line_no": [
89,
91,
93,
95,
47,
103,
79,
81
]
}
|
void FUNC_0(DNXHDEncContext *VAR_0, int VAR_1, int VAR_2)
{
const int VAR_3 = VAR_0->block_width_l2;
const int VAR_4 = 1 << VAR_3;
int VAR_5 = VAR_0->VAR_5;
int VAR_6 = VAR_0->VAR_6;
int VAR_7 = VAR_0->m.VAR_7;
int VAR_8 = VAR_0->m.VAR_8;
const uint8_t *VAR_9 = VAR_0->thread[0]->src[0] +
((VAR_2 << 4) * VAR_0->m.VAR_7) + (VAR_1 << VAR_3 + 1);
const uint8_t *VAR_10 = VAR_0->thread[0]->src[1] +
((VAR_2 << 4) * VAR_0->m.VAR_8) + (VAR_1 << VAR_3 + VAR_0->is_444);
const uint8_t *VAR_11 = VAR_0->thread[0]->src[2] +
((VAR_2 << 4) * VAR_0->m.VAR_8) + (VAR_1 << VAR_3 + VAR_0->is_444);
PixblockDSPContext *pdsp = &VAR_0->m.pdsp;
VideoDSPContext *vdsp = &VAR_0->m.vdsp;
if (VAR_0->bit_depth != 10 && vdsp->emulated_edge_mc && ((VAR_1 << 4) + 16 > VAR_0->m.avctx->width ||
(VAR_2 << 4) + 16 > VAR_0->m.avctx->height)) {
int VAR_16 = VAR_0->m.avctx->width - (VAR_1 << 4);
int VAR_16 = VAR_0->m.avctx->height - (VAR_2 << 4);
int VAR_16 = (VAR_16 + 1) / 2;
int VAR_16 = VAR_16;
VAR_7 = 16;
VAR_8 = 8;
vdsp->emulated_edge_mc(&VAR_0->edge_buf_y[0], VAR_9,
VAR_7, VAR_0->m.VAR_7,
VAR_7, 16,
0, 0, VAR_16, VAR_16);
vdsp->emulated_edge_mc(&VAR_0->edge_buf_uv[0][0], VAR_10,
VAR_8, VAR_0->m.VAR_8,
VAR_8, 16,
0, 0, VAR_16, VAR_16);
vdsp->emulated_edge_mc(&VAR_0->edge_buf_uv[1][0], VAR_11,
VAR_8, VAR_0->m.VAR_8,
VAR_8, 16,
0, 0, VAR_16, VAR_16);
VAR_5 = VAR_4 * VAR_7;
VAR_6 = VAR_4 * VAR_8;
VAR_9 = &VAR_0->edge_buf_y[0];
VAR_10 = &VAR_0->edge_buf_uv[0][0];
VAR_11 = &VAR_0->edge_buf_uv[1][0];
} else if (VAR_0->bit_depth == 10 && vdsp->emulated_edge_mc && ((VAR_1 << 3) + 8 > VAR_0->m.avctx->width ||
(VAR_2 << 3) + 8 > VAR_0->m.avctx->height)) {
int VAR_16 = VAR_0->m.avctx->width - (VAR_1 << 3);
int VAR_16 = VAR_0->m.avctx->height - (VAR_2 << 3);
int VAR_16 = VAR_0->is_444 ? VAR_16 : (VAR_16 + 1) / 2;
int VAR_16 = VAR_16;
VAR_7 = 16;
VAR_8 = 8 + 8 * VAR_0->is_444;
vdsp->emulated_edge_mc(&VAR_0->edge_buf_y[0], VAR_9,
VAR_7, VAR_0->m.VAR_7,
VAR_7 / 2, 16,
0, 0, VAR_16, VAR_16);
vdsp->emulated_edge_mc(&VAR_0->edge_buf_uv[0][0], VAR_10,
VAR_8, VAR_0->m.VAR_8,
VAR_8 / 2, 16,
0, 0, VAR_16, VAR_16);
vdsp->emulated_edge_mc(&VAR_0->edge_buf_uv[1][0], VAR_11,
VAR_8, VAR_0->m.VAR_8,
VAR_8 / 2, 16,
0, 0, VAR_16, VAR_16);
VAR_5 = VAR_4 * VAR_7;
VAR_6 = VAR_4 * VAR_8;
VAR_9 = &VAR_0->edge_buf_y[0];
VAR_10 = &VAR_0->edge_buf_uv[0][0];
VAR_11 = &VAR_0->edge_buf_uv[1][0];
}
if (!VAR_0->is_444) {
pdsp->get_pixels(VAR_0->blocks[0], VAR_9, VAR_7);
pdsp->get_pixels(VAR_0->blocks[1], VAR_9 + VAR_4, VAR_7);
pdsp->get_pixels(VAR_0->blocks[2], VAR_10, VAR_8);
pdsp->get_pixels(VAR_0->blocks[3], VAR_11, VAR_8);
if (VAR_2 + 1 == VAR_0->m.mb_height && VAR_0->m.avctx->height == 1080) {
if (VAR_0->interlaced) {
VAR_0->get_pixels_8x4_sym(VAR_0->blocks[4],
VAR_9 + VAR_5,
VAR_7);
VAR_0->get_pixels_8x4_sym(VAR_0->blocks[5],
VAR_9 + VAR_5 + VAR_4,
VAR_7);
VAR_0->get_pixels_8x4_sym(VAR_0->blocks[6],
VAR_10 + VAR_6,
VAR_8);
VAR_0->get_pixels_8x4_sym(VAR_0->blocks[7],
VAR_11 + VAR_6,
VAR_8);
} else {
VAR_0->bdsp.clear_block(VAR_0->blocks[4]);
VAR_0->bdsp.clear_block(VAR_0->blocks[5]);
VAR_0->bdsp.clear_block(VAR_0->blocks[6]);
VAR_0->bdsp.clear_block(VAR_0->blocks[7]);
}
} else {
pdsp->get_pixels(VAR_0->blocks[4],
VAR_9 + VAR_5, VAR_7);
pdsp->get_pixels(VAR_0->blocks[5],
VAR_9 + VAR_5 + VAR_4, VAR_7);
pdsp->get_pixels(VAR_0->blocks[6],
VAR_10 + VAR_6, VAR_8);
pdsp->get_pixels(VAR_0->blocks[7],
VAR_11 + VAR_6, VAR_8);
}
} else {
pdsp->get_pixels(VAR_0->blocks[0], VAR_9, VAR_7);
pdsp->get_pixels(VAR_0->blocks[1], VAR_9 + VAR_4, VAR_7);
pdsp->get_pixels(VAR_0->blocks[6], VAR_9 + VAR_5, VAR_7);
pdsp->get_pixels(VAR_0->blocks[7], VAR_9 + VAR_5 + VAR_4, VAR_7);
pdsp->get_pixels(VAR_0->blocks[2], VAR_10, VAR_8);
pdsp->get_pixels(VAR_0->blocks[3], VAR_10 + VAR_4, VAR_8);
pdsp->get_pixels(VAR_0->blocks[8], VAR_10 + VAR_6, VAR_8);
pdsp->get_pixels(VAR_0->blocks[9], VAR_10 + VAR_6 + VAR_4, VAR_8);
pdsp->get_pixels(VAR_0->blocks[4], VAR_11, VAR_8);
pdsp->get_pixels(VAR_0->blocks[5], VAR_11 + VAR_4, VAR_8);
pdsp->get_pixels(VAR_0->blocks[10], VAR_11 + VAR_6, VAR_8);
pdsp->get_pixels(VAR_0->blocks[11], VAR_11 + VAR_6 + VAR_4, VAR_8);
}
}
|
[
"void FUNC_0(DNXHDEncContext *VAR_0, int VAR_1, int VAR_2)\n{",
"const int VAR_3 = VAR_0->block_width_l2;",
"const int VAR_4 = 1 << VAR_3;",
"int VAR_5 = VAR_0->VAR_5;",
"int VAR_6 = VAR_0->VAR_6;",
"int VAR_7 = VAR_0->m.VAR_7;",
"int VAR_8 = VAR_0->m.VAR_8;",
"const uint8_t *VAR_9 = VAR_0->thread[0]->src[0] +\n((VAR_2 << 4) * VAR_0->m.VAR_7) + (VAR_1 << VAR_3 + 1);",
"const uint8_t *VAR_10 = VAR_0->thread[0]->src[1] +\n((VAR_2 << 4) * VAR_0->m.VAR_8) + (VAR_1 << VAR_3 + VAR_0->is_444);",
"const uint8_t *VAR_11 = VAR_0->thread[0]->src[2] +\n((VAR_2 << 4) * VAR_0->m.VAR_8) + (VAR_1 << VAR_3 + VAR_0->is_444);",
"PixblockDSPContext *pdsp = &VAR_0->m.pdsp;",
"VideoDSPContext *vdsp = &VAR_0->m.vdsp;",
"if (VAR_0->bit_depth != 10 && vdsp->emulated_edge_mc && ((VAR_1 << 4) + 16 > VAR_0->m.avctx->width ||\n(VAR_2 << 4) + 16 > VAR_0->m.avctx->height)) {",
"int VAR_16 = VAR_0->m.avctx->width - (VAR_1 << 4);",
"int VAR_16 = VAR_0->m.avctx->height - (VAR_2 << 4);",
"int VAR_16 = (VAR_16 + 1) / 2;",
"int VAR_16 = VAR_16;",
"VAR_7 = 16;",
"VAR_8 = 8;",
"vdsp->emulated_edge_mc(&VAR_0->edge_buf_y[0], VAR_9,\nVAR_7, VAR_0->m.VAR_7,\nVAR_7, 16,\n0, 0, VAR_16, VAR_16);",
"vdsp->emulated_edge_mc(&VAR_0->edge_buf_uv[0][0], VAR_10,\nVAR_8, VAR_0->m.VAR_8,\nVAR_8, 16,\n0, 0, VAR_16, VAR_16);",
"vdsp->emulated_edge_mc(&VAR_0->edge_buf_uv[1][0], VAR_11,\nVAR_8, VAR_0->m.VAR_8,\nVAR_8, 16,\n0, 0, VAR_16, VAR_16);",
"VAR_5 = VAR_4 * VAR_7;",
"VAR_6 = VAR_4 * VAR_8;",
"VAR_9 = &VAR_0->edge_buf_y[0];",
"VAR_10 = &VAR_0->edge_buf_uv[0][0];",
"VAR_11 = &VAR_0->edge_buf_uv[1][0];",
"} else if (VAR_0->bit_depth == 10 && vdsp->emulated_edge_mc && ((VAR_1 << 3) + 8 > VAR_0->m.avctx->width ||",
"(VAR_2 << 3) + 8 > VAR_0->m.avctx->height)) {",
"int VAR_16 = VAR_0->m.avctx->width - (VAR_1 << 3);",
"int VAR_16 = VAR_0->m.avctx->height - (VAR_2 << 3);",
"int VAR_16 = VAR_0->is_444 ? VAR_16 : (VAR_16 + 1) / 2;",
"int VAR_16 = VAR_16;",
"VAR_7 = 16;",
"VAR_8 = 8 + 8 * VAR_0->is_444;",
"vdsp->emulated_edge_mc(&VAR_0->edge_buf_y[0], VAR_9,\nVAR_7, VAR_0->m.VAR_7,\nVAR_7 / 2, 16,\n0, 0, VAR_16, VAR_16);",
"vdsp->emulated_edge_mc(&VAR_0->edge_buf_uv[0][0], VAR_10,\nVAR_8, VAR_0->m.VAR_8,\nVAR_8 / 2, 16,\n0, 0, VAR_16, VAR_16);",
"vdsp->emulated_edge_mc(&VAR_0->edge_buf_uv[1][0], VAR_11,\nVAR_8, VAR_0->m.VAR_8,\nVAR_8 / 2, 16,\n0, 0, VAR_16, VAR_16);",
"VAR_5 = VAR_4 * VAR_7;",
"VAR_6 = VAR_4 * VAR_8;",
"VAR_9 = &VAR_0->edge_buf_y[0];",
"VAR_10 = &VAR_0->edge_buf_uv[0][0];",
"VAR_11 = &VAR_0->edge_buf_uv[1][0];",
"}",
"if (!VAR_0->is_444) {",
"pdsp->get_pixels(VAR_0->blocks[0], VAR_9, VAR_7);",
"pdsp->get_pixels(VAR_0->blocks[1], VAR_9 + VAR_4, VAR_7);",
"pdsp->get_pixels(VAR_0->blocks[2], VAR_10, VAR_8);",
"pdsp->get_pixels(VAR_0->blocks[3], VAR_11, VAR_8);",
"if (VAR_2 + 1 == VAR_0->m.mb_height && VAR_0->m.avctx->height == 1080) {",
"if (VAR_0->interlaced) {",
"VAR_0->get_pixels_8x4_sym(VAR_0->blocks[4],\nVAR_9 + VAR_5,\nVAR_7);",
"VAR_0->get_pixels_8x4_sym(VAR_0->blocks[5],\nVAR_9 + VAR_5 + VAR_4,\nVAR_7);",
"VAR_0->get_pixels_8x4_sym(VAR_0->blocks[6],\nVAR_10 + VAR_6,\nVAR_8);",
"VAR_0->get_pixels_8x4_sym(VAR_0->blocks[7],\nVAR_11 + VAR_6,\nVAR_8);",
"} else {",
"VAR_0->bdsp.clear_block(VAR_0->blocks[4]);",
"VAR_0->bdsp.clear_block(VAR_0->blocks[5]);",
"VAR_0->bdsp.clear_block(VAR_0->blocks[6]);",
"VAR_0->bdsp.clear_block(VAR_0->blocks[7]);",
"}",
"} else {",
"pdsp->get_pixels(VAR_0->blocks[4],\nVAR_9 + VAR_5, VAR_7);",
"pdsp->get_pixels(VAR_0->blocks[5],\nVAR_9 + VAR_5 + VAR_4, VAR_7);",
"pdsp->get_pixels(VAR_0->blocks[6],\nVAR_10 + VAR_6, VAR_8);",
"pdsp->get_pixels(VAR_0->blocks[7],\nVAR_11 + VAR_6, VAR_8);",
"}",
"} else {",
"pdsp->get_pixels(VAR_0->blocks[0], VAR_9, VAR_7);",
"pdsp->get_pixels(VAR_0->blocks[1], VAR_9 + VAR_4, VAR_7);",
"pdsp->get_pixels(VAR_0->blocks[6], VAR_9 + VAR_5, VAR_7);",
"pdsp->get_pixels(VAR_0->blocks[7], VAR_9 + VAR_5 + VAR_4, VAR_7);",
"pdsp->get_pixels(VAR_0->blocks[2], VAR_10, VAR_8);",
"pdsp->get_pixels(VAR_0->blocks[3], VAR_10 + VAR_4, VAR_8);",
"pdsp->get_pixels(VAR_0->blocks[8], VAR_10 + VAR_6, VAR_8);",
"pdsp->get_pixels(VAR_0->blocks[9], VAR_10 + VAR_6 + VAR_4, VAR_8);",
"pdsp->get_pixels(VAR_0->blocks[4], VAR_11, VAR_8);",
"pdsp->get_pixels(VAR_0->blocks[5], VAR_11 + VAR_4, VAR_8);",
"pdsp->get_pixels(VAR_0->blocks[10], VAR_11 + VAR_6, VAR_8);",
"pdsp->get_pixels(VAR_0->blocks[11], VAR_11 + VAR_6 + VAR_4, VAR_8);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
1,
0,
0,
0,
1,
1,
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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17,
19
],
[
21,
23
],
[
25,
27
],
[
29
],
[
31
],
[
35,
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53,
55,
57,
59
],
[
61,
63,
65,
67
],
[
69,
71,
73,
75
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
107,
109,
111,
113
],
[
115,
117,
119,
121
],
[
123,
125,
127,
129
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
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
],
[
231
],
[
233
],
[
235
],
[
237
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
]
] |
17,383
|
bool virtio_scsi_handle_event_vq(VirtIOSCSI *s, VirtQueue *vq)
{
virtio_scsi_acquire(s);
if (s->events_dropped) {
virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0);
virtio_scsi_release(s);
return true;
}
virtio_scsi_release(s);
return false;
}
| true
|
qemu
|
71407786054cad26de7ef66718b2a57a4bcb49b5
|
bool virtio_scsi_handle_event_vq(VirtIOSCSI *s, VirtQueue *vq)
{
virtio_scsi_acquire(s);
if (s->events_dropped) {
virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0);
virtio_scsi_release(s);
return true;
}
virtio_scsi_release(s);
return false;
}
|
{
"code": [
" virtio_scsi_acquire(s);",
" virtio_scsi_release(s);",
" virtio_scsi_acquire(s);",
" virtio_scsi_release(s);",
" virtio_scsi_acquire(s);",
" virtio_scsi_release(s);",
" virtio_scsi_acquire(s);",
" virtio_scsi_release(s);",
" virtio_scsi_release(s);"
],
"line_no": [
5,
17,
5,
17,
5,
17,
5,
11,
17
]
}
|
bool FUNC_0(VirtIOSCSI *s, VirtQueue *vq)
{
virtio_scsi_acquire(s);
if (s->events_dropped) {
virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0);
virtio_scsi_release(s);
return true;
}
virtio_scsi_release(s);
return false;
}
|
[
"bool FUNC_0(VirtIOSCSI *s, VirtQueue *vq)\n{",
"virtio_scsi_acquire(s);",
"if (s->events_dropped) {",
"virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0);",
"virtio_scsi_release(s);",
"return true;",
"}",
"virtio_scsi_release(s);",
"return false;",
"}"
] |
[
0,
1,
0,
0,
1,
0,
0,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
]
] |
17,384
|
static attribute_align_arg void *frame_worker_thread(void *arg)
{
PerThreadContext *p = arg;
FrameThreadContext *fctx = p->parent;
AVCodecContext *avctx = p->avctx;
AVCodec *codec = avctx->codec;
while (1) {
int i;
if (p->state == STATE_INPUT_READY && !fctx->die) {
pthread_mutex_lock(&p->mutex);
while (p->state == STATE_INPUT_READY && !fctx->die)
pthread_cond_wait(&p->input_cond, &p->mutex);
pthread_mutex_unlock(&p->mutex);
}
if (fctx->die) break;
if (!codec->update_thread_context && (avctx->thread_safe_callbacks || avctx->get_buffer == avcodec_default_get_buffer))
ff_thread_finish_setup(avctx);
pthread_mutex_lock(&p->mutex);
avcodec_get_frame_defaults(&p->frame);
p->got_frame = 0;
p->result = codec->decode(avctx, &p->frame, &p->got_frame, &p->avpkt);
if (p->state == STATE_SETTING_UP) ff_thread_finish_setup(avctx);
pthread_mutex_lock(&p->progress_mutex);
for (i = 0; i < MAX_BUFFERS; i++)
if (p->progress_used[i]) {
p->progress[i][0] = INT_MAX;
p->progress[i][1] = INT_MAX;
}
p->state = STATE_INPUT_READY;
pthread_cond_broadcast(&p->progress_cond);
pthread_cond_signal(&p->output_cond);
pthread_mutex_unlock(&p->progress_mutex);
pthread_mutex_unlock(&p->mutex);
}
return NULL;
}
| true
|
FFmpeg
|
18a7f7465e7e6b9c3688ffc23230ae7a0639a771
|
static attribute_align_arg void *frame_worker_thread(void *arg)
{
PerThreadContext *p = arg;
FrameThreadContext *fctx = p->parent;
AVCodecContext *avctx = p->avctx;
AVCodec *codec = avctx->codec;
while (1) {
int i;
if (p->state == STATE_INPUT_READY && !fctx->die) {
pthread_mutex_lock(&p->mutex);
while (p->state == STATE_INPUT_READY && !fctx->die)
pthread_cond_wait(&p->input_cond, &p->mutex);
pthread_mutex_unlock(&p->mutex);
}
if (fctx->die) break;
if (!codec->update_thread_context && (avctx->thread_safe_callbacks || avctx->get_buffer == avcodec_default_get_buffer))
ff_thread_finish_setup(avctx);
pthread_mutex_lock(&p->mutex);
avcodec_get_frame_defaults(&p->frame);
p->got_frame = 0;
p->result = codec->decode(avctx, &p->frame, &p->got_frame, &p->avpkt);
if (p->state == STATE_SETTING_UP) ff_thread_finish_setup(avctx);
pthread_mutex_lock(&p->progress_mutex);
for (i = 0; i < MAX_BUFFERS; i++)
if (p->progress_used[i]) {
p->progress[i][0] = INT_MAX;
p->progress[i][1] = INT_MAX;
}
p->state = STATE_INPUT_READY;
pthread_cond_broadcast(&p->progress_cond);
pthread_cond_signal(&p->output_cond);
pthread_mutex_unlock(&p->progress_mutex);
pthread_mutex_unlock(&p->mutex);
}
return NULL;
}
|
{
"code": [
" if (p->progress_used[i]) {"
],
"line_no": [
61
]
}
|
static attribute_align_arg void *FUNC_0(void *arg)
{
PerThreadContext *p = arg;
FrameThreadContext *fctx = p->parent;
AVCodecContext *avctx = p->avctx;
AVCodec *codec = avctx->codec;
while (1) {
int VAR_0;
if (p->state == STATE_INPUT_READY && !fctx->die) {
pthread_mutex_lock(&p->mutex);
while (p->state == STATE_INPUT_READY && !fctx->die)
pthread_cond_wait(&p->input_cond, &p->mutex);
pthread_mutex_unlock(&p->mutex);
}
if (fctx->die) break;
if (!codec->update_thread_context && (avctx->thread_safe_callbacks || avctx->get_buffer == avcodec_default_get_buffer))
ff_thread_finish_setup(avctx);
pthread_mutex_lock(&p->mutex);
avcodec_get_frame_defaults(&p->frame);
p->got_frame = 0;
p->result = codec->decode(avctx, &p->frame, &p->got_frame, &p->avpkt);
if (p->state == STATE_SETTING_UP) ff_thread_finish_setup(avctx);
pthread_mutex_lock(&p->progress_mutex);
for (VAR_0 = 0; VAR_0 < MAX_BUFFERS; VAR_0++)
if (p->progress_used[VAR_0]) {
p->progress[VAR_0][0] = INT_MAX;
p->progress[VAR_0][1] = INT_MAX;
}
p->state = STATE_INPUT_READY;
pthread_cond_broadcast(&p->progress_cond);
pthread_cond_signal(&p->output_cond);
pthread_mutex_unlock(&p->progress_mutex);
pthread_mutex_unlock(&p->mutex);
}
return NULL;
}
|
[
"static attribute_align_arg void *FUNC_0(void *arg)\n{",
"PerThreadContext *p = arg;",
"FrameThreadContext *fctx = p->parent;",
"AVCodecContext *avctx = p->avctx;",
"AVCodec *codec = avctx->codec;",
"while (1) {",
"int VAR_0;",
"if (p->state == STATE_INPUT_READY && !fctx->die) {",
"pthread_mutex_lock(&p->mutex);",
"while (p->state == STATE_INPUT_READY && !fctx->die)\npthread_cond_wait(&p->input_cond, &p->mutex);",
"pthread_mutex_unlock(&p->mutex);",
"}",
"if (fctx->die) break;",
"if (!codec->update_thread_context && (avctx->thread_safe_callbacks || avctx->get_buffer == avcodec_default_get_buffer))\nff_thread_finish_setup(avctx);",
"pthread_mutex_lock(&p->mutex);",
"avcodec_get_frame_defaults(&p->frame);",
"p->got_frame = 0;",
"p->result = codec->decode(avctx, &p->frame, &p->got_frame, &p->avpkt);",
"if (p->state == STATE_SETTING_UP) ff_thread_finish_setup(avctx);",
"pthread_mutex_lock(&p->progress_mutex);",
"for (VAR_0 = 0; VAR_0 < MAX_BUFFERS; VAR_0++)",
"if (p->progress_used[VAR_0]) {",
"p->progress[VAR_0][0] = INT_MAX;",
"p->progress[VAR_0][1] = INT_MAX;",
"}",
"p->state = STATE_INPUT_READY;",
"pthread_cond_broadcast(&p->progress_cond);",
"pthread_cond_signal(&p->output_cond);",
"pthread_mutex_unlock(&p->progress_mutex);",
"pthread_mutex_unlock(&p->mutex);",
"}",
"return NULL;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23,
25
],
[
27
],
[
29
],
[
33
],
[
37,
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
75
],
[
77
],
[
81
],
[
83
],
[
87
],
[
89
]
] |
17,385
|
static void gen_spr_970_pmu_sup(CPUPPCState *env)
{
spr_register(env, SPR_970_PMC7, "PMC7",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_970_PMC8, "PMC8",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
}
| true
|
qemu
|
83cc6f8c2f134ccff1a41ed86bbe3bc305e0c334
|
static void gen_spr_970_pmu_sup(CPUPPCState *env)
{
spr_register(env, SPR_970_PMC7, "PMC7",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_970_PMC8, "PMC8",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
}
|
{
"code": [
" SPR_NOACCESS, SPR_NOACCESS,",
" &spr_read_generic, &spr_write_generic,",
" 0x00000000);",
" SPR_NOACCESS, SPR_NOACCESS,",
" &spr_read_generic, &spr_write_generic,",
" 0x00000000);",
" SPR_NOACCESS, SPR_NOACCESS,",
" &spr_read_generic, &spr_write_generic,",
" 0x00000000);",
" SPR_NOACCESS, SPR_NOACCESS,",
" &spr_read_generic, &spr_write_generic,",
" 0x00000000);",
" SPR_NOACCESS, SPR_NOACCESS,",
" &spr_read_generic, &spr_write_generic,",
" 0x00000000);",
" SPR_NOACCESS, SPR_NOACCESS,",
" &spr_read_generic, &spr_write_generic,",
" 0x00000000);",
" SPR_NOACCESS, SPR_NOACCESS,",
" &spr_read_generic, &spr_write_generic,",
" 0x00000000);",
" SPR_NOACCESS, SPR_NOACCESS,",
" &spr_read_generic, &spr_write_generic,",
" 0x00000000);",
" SPR_NOACCESS, SPR_NOACCESS,",
" &spr_read_generic, &spr_write_generic,",
" 0x00000000);",
" SPR_NOACCESS, SPR_NOACCESS,",
" &spr_read_generic, &spr_write_generic,",
" 0x00000000);",
" SPR_NOACCESS, SPR_NOACCESS,",
" &spr_read_generic, &spr_write_generic,",
" 0x00000000);",
" spr_register(env, SPR_970_PMC7, \"PMC7\",",
" SPR_NOACCESS, SPR_NOACCESS,",
" &spr_read_generic, &spr_write_generic,",
" 0x00000000);",
" spr_register(env, SPR_970_PMC8, \"PMC8\",",
" SPR_NOACCESS, SPR_NOACCESS,",
" &spr_read_generic, &spr_write_generic,",
" 0x00000000);"
],
"line_no": [
7,
9,
11,
7,
9,
11,
7,
9,
11,
7,
9,
11,
7,
9,
11,
7,
9,
11,
7,
9,
11,
7,
9,
11,
7,
9,
11,
7,
9,
11,
7,
9,
11,
5,
7,
9,
11,
13,
7,
9,
11
]
}
|
static void FUNC_0(CPUPPCState *VAR_0)
{
spr_register(VAR_0, SPR_970_PMC7, "PMC7",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(VAR_0, SPR_970_PMC8, "PMC8",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
}
|
[
"static void FUNC_0(CPUPPCState *VAR_0)\n{",
"spr_register(VAR_0, SPR_970_PMC7, \"PMC7\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"spr_register(VAR_0, SPR_970_PMC8, \"PMC8\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);",
"}"
] |
[
0,
1,
1,
0
] |
[
[
1,
3
],
[
5,
7,
9,
11
],
[
13,
15,
17,
19
],
[
21
]
] |
17,387
|
static av_cold int hevc_sdp_parse_fmtp_config(AVFormatContext *s,
AVStream *stream,
PayloadContext *hevc_data,
char *attr, char *value)
{
/* profile-space: 0-3 */
/* profile-id: 0-31 */
if (!strcmp(attr, "profile-id")) {
hevc_data->profile_id = atoi(value);
av_dlog(s, "SDP: found profile-id: %d\n", hevc_data->profile_id);
}
/* tier-flag: 0-1 */
/* level-id: 0-255 */
/* interop-constraints: [base16] */
/* profile-compatibility-indicator: [base16] */
/* sprop-sub-layer-id: 0-6, defines highest possible value for TID, default: 6 */
/* recv-sub-layer-id: 0-6 */
/* max-recv-level-id: 0-255 */
/* tx-mode: MSM,SSM */
/* sprop-vps: [base64] */
/* sprop-sps: [base64] */
/* sprop-pps: [base64] */
/* sprop-sei: [base64] */
if (!strcmp(attr, "sprop-vps") || !strcmp(attr, "sprop-sps") ||
!strcmp(attr, "sprop-pps") || !strcmp(attr, "sprop-sei")) {
uint8_t **data_ptr;
int *size_ptr;
if (!strcmp(attr, "sprop-vps")) {
data_ptr = &hevc_data->vps;
size_ptr = &hevc_data->vps_size;
} else if (!strcmp(attr, "sprop-sps")) {
data_ptr = &hevc_data->sps;
size_ptr = &hevc_data->sps_size;
} else if (!strcmp(attr, "sprop-pps")) {
data_ptr = &hevc_data->pps;
size_ptr = &hevc_data->pps_size;
} else if (!strcmp(attr, "sprop-sei")) {
data_ptr = &hevc_data->sei;
size_ptr = &hevc_data->sei_size;
}
while (*value) {
char base64packet[1024];
uint8_t decoded_packet[1024];
int decoded_packet_size;
char *dst = base64packet;
while (*value && *value != ',' &&
(dst - base64packet) < sizeof(base64packet) - 1) {
*dst++ = *value++;
}
*dst++ = '\0';
if (*value == ',')
value++;
decoded_packet_size = av_base64_decode(decoded_packet, base64packet,
sizeof(decoded_packet));
if (decoded_packet_size > 0) {
uint8_t *tmp = av_realloc(*data_ptr, decoded_packet_size +
sizeof(start_sequence) + *size_ptr);
if (!tmp) {
av_log(s, AV_LOG_ERROR,
"Unable to allocate memory for extradata!\n");
return AVERROR(ENOMEM);
}
*data_ptr = tmp;
memcpy(*data_ptr + *size_ptr, start_sequence,
sizeof(start_sequence));
memcpy(*data_ptr + *size_ptr + sizeof(start_sequence),
decoded_packet, decoded_packet_size);
*size_ptr += sizeof(start_sequence) + decoded_packet_size;
}
}
}
/* max-lsr, max-lps, max-cpb, max-dpb, max-br, max-tr, max-tc */
/* max-fps */
/* sprop-max-don-diff: 0-32767
When the RTP stream depends on one or more other RTP
streams (in this case tx-mode MUST be equal to "MSM" and
MSM is in use), this parameter MUST be present and the
value MUST be greater than 0.
*/
if (!strcmp(attr, "sprop-max-don-diff")) {
if (atoi(value) > 0)
hevc_data->using_donl_field = 1;
av_dlog(s, "Found sprop-max-don-diff in SDP, DON field usage is: %d\n",
hevc_data->using_donl_field);
}
/* sprop-depack-buf-nalus: 0-32767 */
if (!strcmp(attr, "sprop-depack-buf-nalus")) {
if (atoi(value) > 0)
hevc_data->using_donl_field = 1;
av_dlog(s, "Found sprop-depack-buf-nalus in SDP, DON field usage is: %d\n",
hevc_data->using_donl_field);
}
/* sprop-depack-buf-bytes: 0-4294967295 */
/* depack-buf-cap */
/* sprop-segmentation-id: 0-3 */
/* sprop-spatial-segmentation-idc: [base16] */
/* dec-parallel-ca: */
/* include-dph */
return 0;
}
| true
|
FFmpeg
|
4adf75cade6905f33baeeaca559013467dc7d1ae
|
static av_cold int hevc_sdp_parse_fmtp_config(AVFormatContext *s,
AVStream *stream,
PayloadContext *hevc_data,
char *attr, char *value)
{
if (!strcmp(attr, "profile-id")) {
hevc_data->profile_id = atoi(value);
av_dlog(s, "SDP: found profile-id: %d\n", hevc_data->profile_id);
}
if (!strcmp(attr, "sprop-vps") || !strcmp(attr, "sprop-sps") ||
!strcmp(attr, "sprop-pps") || !strcmp(attr, "sprop-sei")) {
uint8_t **data_ptr;
int *size_ptr;
if (!strcmp(attr, "sprop-vps")) {
data_ptr = &hevc_data->vps;
size_ptr = &hevc_data->vps_size;
} else if (!strcmp(attr, "sprop-sps")) {
data_ptr = &hevc_data->sps;
size_ptr = &hevc_data->sps_size;
} else if (!strcmp(attr, "sprop-pps")) {
data_ptr = &hevc_data->pps;
size_ptr = &hevc_data->pps_size;
} else if (!strcmp(attr, "sprop-sei")) {
data_ptr = &hevc_data->sei;
size_ptr = &hevc_data->sei_size;
}
while (*value) {
char base64packet[1024];
uint8_t decoded_packet[1024];
int decoded_packet_size;
char *dst = base64packet;
while (*value && *value != ',' &&
(dst - base64packet) < sizeof(base64packet) - 1) {
*dst++ = *value++;
}
*dst++ = '\0';
if (*value == ',')
value++;
decoded_packet_size = av_base64_decode(decoded_packet, base64packet,
sizeof(decoded_packet));
if (decoded_packet_size > 0) {
uint8_t *tmp = av_realloc(*data_ptr, decoded_packet_size +
sizeof(start_sequence) + *size_ptr);
if (!tmp) {
av_log(s, AV_LOG_ERROR,
"Unable to allocate memory for extradata!\n");
return AVERROR(ENOMEM);
}
*data_ptr = tmp;
memcpy(*data_ptr + *size_ptr, start_sequence,
sizeof(start_sequence));
memcpy(*data_ptr + *size_ptr + sizeof(start_sequence),
decoded_packet, decoded_packet_size);
*size_ptr += sizeof(start_sequence) + decoded_packet_size;
}
}
}
if (!strcmp(attr, "sprop-max-don-diff")) {
if (atoi(value) > 0)
hevc_data->using_donl_field = 1;
av_dlog(s, "Found sprop-max-don-diff in SDP, DON field usage is: %d\n",
hevc_data->using_donl_field);
}
if (!strcmp(attr, "sprop-depack-buf-nalus")) {
if (atoi(value) > 0)
hevc_data->using_donl_field = 1;
av_dlog(s, "Found sprop-depack-buf-nalus in SDP, DON field usage is: %d\n",
hevc_data->using_donl_field);
}
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static av_cold int FUNC_0(AVFormatContext *s,
AVStream *stream,
PayloadContext *hevc_data,
char *attr, char *value)
{
if (!strcmp(attr, "profile-id")) {
hevc_data->profile_id = atoi(value);
av_dlog(s, "SDP: found profile-id: %d\n", hevc_data->profile_id);
}
if (!strcmp(attr, "sprop-vps") || !strcmp(attr, "sprop-sps") ||
!strcmp(attr, "sprop-pps") || !strcmp(attr, "sprop-sei")) {
uint8_t **data_ptr;
int *VAR_0;
if (!strcmp(attr, "sprop-vps")) {
data_ptr = &hevc_data->vps;
VAR_0 = &hevc_data->vps_size;
} else if (!strcmp(attr, "sprop-sps")) {
data_ptr = &hevc_data->sps;
VAR_0 = &hevc_data->sps_size;
} else if (!strcmp(attr, "sprop-pps")) {
data_ptr = &hevc_data->pps;
VAR_0 = &hevc_data->pps_size;
} else if (!strcmp(attr, "sprop-sei")) {
data_ptr = &hevc_data->sei;
VAR_0 = &hevc_data->sei_size;
}
while (*value) {
char VAR_1[1024];
uint8_t decoded_packet[1024];
int VAR_2;
char *VAR_3 = VAR_1;
while (*value && *value != ',' &&
(VAR_3 - VAR_1) < sizeof(VAR_1) - 1) {
*VAR_3++ = *value++;
}
*VAR_3++ = '\0';
if (*value == ',')
value++;
VAR_2 = av_base64_decode(decoded_packet, VAR_1,
sizeof(decoded_packet));
if (VAR_2 > 0) {
uint8_t *tmp = av_realloc(*data_ptr, VAR_2 +
sizeof(start_sequence) + *VAR_0);
if (!tmp) {
av_log(s, AV_LOG_ERROR,
"Unable to allocate memory for extradata!\n");
return AVERROR(ENOMEM);
}
*data_ptr = tmp;
memcpy(*data_ptr + *VAR_0, start_sequence,
sizeof(start_sequence));
memcpy(*data_ptr + *VAR_0 + sizeof(start_sequence),
decoded_packet, VAR_2);
*VAR_0 += sizeof(start_sequence) + VAR_2;
}
}
}
if (!strcmp(attr, "sprop-max-don-diff")) {
if (atoi(value) > 0)
hevc_data->using_donl_field = 1;
av_dlog(s, "Found sprop-max-don-diff in SDP, DON field usage is: %d\n",
hevc_data->using_donl_field);
}
if (!strcmp(attr, "sprop-depack-buf-nalus")) {
if (atoi(value) > 0)
hevc_data->using_donl_field = 1;
av_dlog(s, "Found sprop-depack-buf-nalus in SDP, DON field usage is: %d\n",
hevc_data->using_donl_field);
}
return 0;
}
|
[
"static av_cold int FUNC_0(AVFormatContext *s,\nAVStream *stream,\nPayloadContext *hevc_data,\nchar *attr, char *value)\n{",
"if (!strcmp(attr, \"profile-id\")) {",
"hevc_data->profile_id = atoi(value);",
"av_dlog(s, \"SDP: found profile-id: %d\\n\", hevc_data->profile_id);",
"}",
"if (!strcmp(attr, \"sprop-vps\") || !strcmp(attr, \"sprop-sps\") ||\n!strcmp(attr, \"sprop-pps\") || !strcmp(attr, \"sprop-sei\")) {",
"uint8_t **data_ptr;",
"int *VAR_0;",
"if (!strcmp(attr, \"sprop-vps\")) {",
"data_ptr = &hevc_data->vps;",
"VAR_0 = &hevc_data->vps_size;",
"} else if (!strcmp(attr, \"sprop-sps\")) {",
"data_ptr = &hevc_data->sps;",
"VAR_0 = &hevc_data->sps_size;",
"} else if (!strcmp(attr, \"sprop-pps\")) {",
"data_ptr = &hevc_data->pps;",
"VAR_0 = &hevc_data->pps_size;",
"} else if (!strcmp(attr, \"sprop-sei\")) {",
"data_ptr = &hevc_data->sei;",
"VAR_0 = &hevc_data->sei_size;",
"}",
"while (*value) {",
"char VAR_1[1024];",
"uint8_t decoded_packet[1024];",
"int VAR_2;",
"char *VAR_3 = VAR_1;",
"while (*value && *value != ',' &&\n(VAR_3 - VAR_1) < sizeof(VAR_1) - 1) {",
"*VAR_3++ = *value++;",
"}",
"*VAR_3++ = '\\0';",
"if (*value == ',')\nvalue++;",
"VAR_2 = av_base64_decode(decoded_packet, VAR_1,\nsizeof(decoded_packet));",
"if (VAR_2 > 0) {",
"uint8_t *tmp = av_realloc(*data_ptr, VAR_2 +\nsizeof(start_sequence) + *VAR_0);",
"if (!tmp) {",
"av_log(s, AV_LOG_ERROR,\n\"Unable to allocate memory for extradata!\\n\");",
"return AVERROR(ENOMEM);",
"}",
"*data_ptr = tmp;",
"memcpy(*data_ptr + *VAR_0, start_sequence,\nsizeof(start_sequence));",
"memcpy(*data_ptr + *VAR_0 + sizeof(start_sequence),\ndecoded_packet, VAR_2);",
"*VAR_0 += sizeof(start_sequence) + VAR_2;",
"}",
"}",
"}",
"if (!strcmp(attr, \"sprop-max-don-diff\")) {",
"if (atoi(value) > 0)\nhevc_data->using_donl_field = 1;",
"av_dlog(s, \"Found sprop-max-don-diff in SDP, DON field usage is: %d\\n\",\nhevc_data->using_donl_field);",
"}",
"if (!strcmp(attr, \"sprop-depack-buf-nalus\")) {",
"if (atoi(value) > 0)\nhevc_data->using_donl_field = 1;",
"av_dlog(s, \"Found sprop-depack-buf-nalus in SDP, DON field usage is: %d\\n\",\nhevc_data->using_donl_field);",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9
],
[
15
],
[
17
],
[
19
],
[
21
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97,
99
],
[
101
],
[
103
],
[
105
],
[
109,
111
],
[
115,
117
],
[
119
],
[
121,
123
],
[
125
],
[
127,
129
],
[
131
],
[
133
],
[
135
],
[
139,
141
],
[
143,
145
],
[
149
],
[
151
],
[
153
],
[
155
],
[
179
],
[
181,
183
],
[
185,
187
],
[
189
],
[
195
],
[
197,
199
],
[
201,
203
],
[
205
],
[
223
],
[
225
]
] |
17,389
|
static int svq3_decode_frame (AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size) {
MpegEncContext *const s = avctx->priv_data;
H264Context *const h = avctx->priv_data;
int m, mb_type;
unsigned char *extradata;
unsigned int size;
s->flags = avctx->flags;
s->flags2 = avctx->flags2;
s->unrestricted_mv = 1;
if (!s->context_initialized) {
s->width = avctx->width;
s->height = avctx->height;
h->pred4x4[DIAG_DOWN_LEFT_PRED] = pred4x4_down_left_svq3_c;
h->pred16x16[PLANE_PRED8x8] = pred16x16_plane_svq3_c;
h->halfpel_flag = 1;
h->thirdpel_flag = 1;
h->unknown_svq3_flag = 0;
h->chroma_qp = 4;
if (MPV_common_init (s) < 0)
return -1;
h->b_stride = 4*s->mb_width;
alloc_tables (h);
/* prowl for the "SEQH" marker in the extradata */
extradata = (unsigned char *)avctx->extradata;
for (m = 0; m < avctx->extradata_size; m++) {
if (!memcmp (extradata, "SEQH", 4))
break;
extradata++;
}
/* if a match was found, parse the extra data */
if (!memcmp (extradata, "SEQH", 4)) {
GetBitContext gb;
size = BE_32(&extradata[4]);
init_get_bits (&gb, extradata + 8, size);
/* 'frame size code' and optional 'width, height' */
if (get_bits (&gb, 3) == 7) {
get_bits (&gb, 12);
get_bits (&gb, 12);
}
h->halfpel_flag = get_bits1 (&gb);
h->thirdpel_flag = get_bits1 (&gb);
/* unknown fields */
get_bits1 (&gb);
get_bits1 (&gb);
get_bits1 (&gb);
get_bits1 (&gb);
s->low_delay = get_bits1 (&gb);
/* unknown field */
get_bits1 (&gb);
while (get_bits1 (&gb)) {
get_bits (&gb, 8);
}
h->unknown_svq3_flag = get_bits1 (&gb);
avctx->has_b_frames = !s->low_delay;
}
}
/* special case for last picture */
if (buf_size == 0) {
if (s->next_picture_ptr && !s->low_delay) {
*(AVFrame *) data = *(AVFrame *) &s->next_picture;
*data_size = sizeof(AVFrame);
}
return 0;
}
init_get_bits (&s->gb, buf, 8*buf_size);
s->mb_x = s->mb_y = 0;
if (svq3_decode_slice_header (h))
return -1;
s->pict_type = h->slice_type;
s->picture_number = h->slice_num;
if(avctx->debug&FF_DEBUG_PICT_INFO){
av_log(h->s.avctx, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d\n",
av_get_pict_type_char(s->pict_type), h->halfpel_flag, h->thirdpel_flag,
s->adaptive_quant, s->qscale
);
}
/* for hurry_up==5 */
s->current_picture.pict_type = s->pict_type;
s->current_picture.key_frame = (s->pict_type == I_TYPE);
/* skip b frames if we dont have reference frames */
if (s->last_picture_ptr == NULL && s->pict_type == B_TYPE) return 0;
/* skip b frames if we are in a hurry */
if (avctx->hurry_up && s->pict_type == B_TYPE) return 0;
/* skip everything if we are in a hurry >= 5 */
if (avctx->hurry_up >= 5) return 0;
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE)
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL)
return 0;
if (s->next_p_frame_damaged) {
if (s->pict_type == B_TYPE)
return 0;
else
s->next_p_frame_damaged = 0;
}
frame_start (h);
if (s->pict_type == B_TYPE) {
h->frame_num_offset = (h->slice_num - h->prev_frame_num);
if (h->frame_num_offset < 0) {
h->frame_num_offset += 256;
}
if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) {
av_log(h->s.avctx, AV_LOG_ERROR, "error in B-frame picture id\n");
return -1;
}
} else {
h->prev_frame_num = h->frame_num;
h->frame_num = h->slice_num;
h->prev_frame_num_offset = (h->frame_num - h->prev_frame_num);
if (h->prev_frame_num_offset < 0) {
h->prev_frame_num_offset += 256;
}
}
for(m=0; m<2; m++){
int i;
for(i=0; i<4; i++){
int j;
for(j=-1; j<4; j++)
h->ref_cache[m][scan8[0] + 8*i + j]= 1;
h->ref_cache[m][scan8[0] + 8*i + j]= PART_NOT_AVAILABLE;
}
}
for (s->mb_y=0; s->mb_y < s->mb_height; s->mb_y++) {
for (s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) {
if ( (get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits &&
((get_bits_count(&s->gb) & 7) == 0 || show_bits (&s->gb, (-get_bits_count(&s->gb) & 7)) == 0)) {
skip_bits(&s->gb, h->next_slice_index - get_bits_count(&s->gb));
s->gb.size_in_bits = 8*buf_size;
if (svq3_decode_slice_header (h))
return -1;
/* TODO: support s->mb_skip_run */
}
mb_type = svq3_get_ue_golomb (&s->gb);
if (s->pict_type == I_TYPE) {
mb_type += 8;
} else if (s->pict_type == B_TYPE && mb_type >= 4) {
mb_type += 4;
}
if (mb_type > 33 || svq3_decode_mb (h, mb_type)) {
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
return -1;
}
if (mb_type != 0) {
hl_decode_mb (h);
}
if (s->pict_type != B_TYPE && !s->low_delay) {
s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride] =
(s->pict_type == P_TYPE && mb_type < 8) ? (mb_type - 1) : -1;
}
}
ff_draw_horiz_band(s, 16*s->mb_y, 16);
}
MPV_frame_end(s);
if (s->pict_type == B_TYPE || s->low_delay) {
*(AVFrame *) data = *(AVFrame *) &s->current_picture;
} else {
*(AVFrame *) data = *(AVFrame *) &s->last_picture;
}
avctx->frame_number = s->picture_number - 1;
/* dont output the last pic after seeking */
if (s->last_picture_ptr || s->low_delay) {
*data_size = sizeof(AVFrame);
}
return buf_size;
}
| true
|
FFmpeg
|
63d33cf4390a9280b1ba42ee722f3140cf1cad3e
|
static int svq3_decode_frame (AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size) {
MpegEncContext *const s = avctx->priv_data;
H264Context *const h = avctx->priv_data;
int m, mb_type;
unsigned char *extradata;
unsigned int size;
s->flags = avctx->flags;
s->flags2 = avctx->flags2;
s->unrestricted_mv = 1;
if (!s->context_initialized) {
s->width = avctx->width;
s->height = avctx->height;
h->pred4x4[DIAG_DOWN_LEFT_PRED] = pred4x4_down_left_svq3_c;
h->pred16x16[PLANE_PRED8x8] = pred16x16_plane_svq3_c;
h->halfpel_flag = 1;
h->thirdpel_flag = 1;
h->unknown_svq3_flag = 0;
h->chroma_qp = 4;
if (MPV_common_init (s) < 0)
return -1;
h->b_stride = 4*s->mb_width;
alloc_tables (h);
extradata = (unsigned char *)avctx->extradata;
for (m = 0; m < avctx->extradata_size; m++) {
if (!memcmp (extradata, "SEQH", 4))
break;
extradata++;
}
if (!memcmp (extradata, "SEQH", 4)) {
GetBitContext gb;
size = BE_32(&extradata[4]);
init_get_bits (&gb, extradata + 8, size);
if (get_bits (&gb, 3) == 7) {
get_bits (&gb, 12);
get_bits (&gb, 12);
}
h->halfpel_flag = get_bits1 (&gb);
h->thirdpel_flag = get_bits1 (&gb);
get_bits1 (&gb);
get_bits1 (&gb);
get_bits1 (&gb);
get_bits1 (&gb);
s->low_delay = get_bits1 (&gb);
get_bits1 (&gb);
while (get_bits1 (&gb)) {
get_bits (&gb, 8);
}
h->unknown_svq3_flag = get_bits1 (&gb);
avctx->has_b_frames = !s->low_delay;
}
}
if (buf_size == 0) {
if (s->next_picture_ptr && !s->low_delay) {
*(AVFrame *) data = *(AVFrame *) &s->next_picture;
*data_size = sizeof(AVFrame);
}
return 0;
}
init_get_bits (&s->gb, buf, 8*buf_size);
s->mb_x = s->mb_y = 0;
if (svq3_decode_slice_header (h))
return -1;
s->pict_type = h->slice_type;
s->picture_number = h->slice_num;
if(avctx->debug&FF_DEBUG_PICT_INFO){
av_log(h->s.avctx, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d\n",
av_get_pict_type_char(s->pict_type), h->halfpel_flag, h->thirdpel_flag,
s->adaptive_quant, s->qscale
);
}
s->current_picture.pict_type = s->pict_type;
s->current_picture.key_frame = (s->pict_type == I_TYPE);
if (s->last_picture_ptr == NULL && s->pict_type == B_TYPE) return 0;
if (avctx->hurry_up && s->pict_type == B_TYPE) return 0;
if (avctx->hurry_up >= 5) return 0;
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE)
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL)
return 0;
if (s->next_p_frame_damaged) {
if (s->pict_type == B_TYPE)
return 0;
else
s->next_p_frame_damaged = 0;
}
frame_start (h);
if (s->pict_type == B_TYPE) {
h->frame_num_offset = (h->slice_num - h->prev_frame_num);
if (h->frame_num_offset < 0) {
h->frame_num_offset += 256;
}
if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) {
av_log(h->s.avctx, AV_LOG_ERROR, "error in B-frame picture id\n");
return -1;
}
} else {
h->prev_frame_num = h->frame_num;
h->frame_num = h->slice_num;
h->prev_frame_num_offset = (h->frame_num - h->prev_frame_num);
if (h->prev_frame_num_offset < 0) {
h->prev_frame_num_offset += 256;
}
}
for(m=0; m<2; m++){
int i;
for(i=0; i<4; i++){
int j;
for(j=-1; j<4; j++)
h->ref_cache[m][scan8[0] + 8*i + j]= 1;
h->ref_cache[m][scan8[0] + 8*i + j]= PART_NOT_AVAILABLE;
}
}
for (s->mb_y=0; s->mb_y < s->mb_height; s->mb_y++) {
for (s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) {
if ( (get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits &&
((get_bits_count(&s->gb) & 7) == 0 || show_bits (&s->gb, (-get_bits_count(&s->gb) & 7)) == 0)) {
skip_bits(&s->gb, h->next_slice_index - get_bits_count(&s->gb));
s->gb.size_in_bits = 8*buf_size;
if (svq3_decode_slice_header (h))
return -1;
}
mb_type = svq3_get_ue_golomb (&s->gb);
if (s->pict_type == I_TYPE) {
mb_type += 8;
} else if (s->pict_type == B_TYPE && mb_type >= 4) {
mb_type += 4;
}
if (mb_type > 33 || svq3_decode_mb (h, mb_type)) {
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
return -1;
}
if (mb_type != 0) {
hl_decode_mb (h);
}
if (s->pict_type != B_TYPE && !s->low_delay) {
s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride] =
(s->pict_type == P_TYPE && mb_type < 8) ? (mb_type - 1) : -1;
}
}
ff_draw_horiz_band(s, 16*s->mb_y, 16);
}
MPV_frame_end(s);
if (s->pict_type == B_TYPE || s->low_delay) {
*(AVFrame *) data = *(AVFrame *) &s->current_picture;
} else {
*(AVFrame *) data = *(AVFrame *) &s->last_picture;
}
avctx->frame_number = s->picture_number - 1;
if (s->last_picture_ptr || s->low_delay) {
*data_size = sizeof(AVFrame);
}
return buf_size;
}
|
{
"code": [
" init_get_bits (&gb, extradata + 8, size);"
],
"line_no": [
89
]
}
|
static int FUNC_0 (AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
uint8_t *VAR_3, int VAR_4) {
MpegEncContext *const s = VAR_0->priv_data;
H264Context *const h = VAR_0->priv_data;
int VAR_5, VAR_6;
unsigned char *VAR_7;
unsigned int VAR_8;
s->flags = VAR_0->flags;
s->flags2 = VAR_0->flags2;
s->unrestricted_mv = 1;
if (!s->context_initialized) {
s->width = VAR_0->width;
s->height = VAR_0->height;
h->pred4x4[DIAG_DOWN_LEFT_PRED] = pred4x4_down_left_svq3_c;
h->pred16x16[PLANE_PRED8x8] = pred16x16_plane_svq3_c;
h->halfpel_flag = 1;
h->thirdpel_flag = 1;
h->unknown_svq3_flag = 0;
h->chroma_qp = 4;
if (MPV_common_init (s) < 0)
return -1;
h->b_stride = 4*s->mb_width;
alloc_tables (h);
VAR_7 = (unsigned char *)VAR_0->VAR_7;
for (VAR_5 = 0; VAR_5 < VAR_0->extradata_size; VAR_5++) {
if (!memcmp (VAR_7, "SEQH", 4))
break;
VAR_7++;
}
if (!memcmp (VAR_7, "SEQH", 4)) {
GetBitContext gb;
VAR_8 = BE_32(&VAR_7[4]);
init_get_bits (&gb, VAR_7 + 8, VAR_8);
if (get_bits (&gb, 3) == 7) {
get_bits (&gb, 12);
get_bits (&gb, 12);
}
h->halfpel_flag = get_bits1 (&gb);
h->thirdpel_flag = get_bits1 (&gb);
get_bits1 (&gb);
get_bits1 (&gb);
get_bits1 (&gb);
get_bits1 (&gb);
s->low_delay = get_bits1 (&gb);
get_bits1 (&gb);
while (get_bits1 (&gb)) {
get_bits (&gb, 8);
}
h->unknown_svq3_flag = get_bits1 (&gb);
VAR_0->has_b_frames = !s->low_delay;
}
}
if (VAR_4 == 0) {
if (s->next_picture_ptr && !s->low_delay) {
*(AVFrame *) VAR_1 = *(AVFrame *) &s->next_picture;
*VAR_2 = sizeof(AVFrame);
}
return 0;
}
init_get_bits (&s->gb, VAR_3, 8*VAR_4);
s->mb_x = s->mb_y = 0;
if (svq3_decode_slice_header (h))
return -1;
s->pict_type = h->slice_type;
s->picture_number = h->slice_num;
if(VAR_0->debug&FF_DEBUG_PICT_INFO){
av_log(h->s.VAR_0, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d\n",
av_get_pict_type_char(s->pict_type), h->halfpel_flag, h->thirdpel_flag,
s->adaptive_quant, s->qscale
);
}
s->current_picture.pict_type = s->pict_type;
s->current_picture.key_frame = (s->pict_type == I_TYPE);
if (s->last_picture_ptr == NULL && s->pict_type == B_TYPE) return 0;
if (VAR_0->hurry_up && s->pict_type == B_TYPE) return 0;
if (VAR_0->hurry_up >= 5) return 0;
if( (VAR_0->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE)
||(VAR_0->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE)
|| VAR_0->skip_frame >= AVDISCARD_ALL)
return 0;
if (s->next_p_frame_damaged) {
if (s->pict_type == B_TYPE)
return 0;
else
s->next_p_frame_damaged = 0;
}
frame_start (h);
if (s->pict_type == B_TYPE) {
h->frame_num_offset = (h->slice_num - h->prev_frame_num);
if (h->frame_num_offset < 0) {
h->frame_num_offset += 256;
}
if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) {
av_log(h->s.VAR_0, AV_LOG_ERROR, "error in B-frame picture id\n");
return -1;
}
} else {
h->prev_frame_num = h->frame_num;
h->frame_num = h->slice_num;
h->prev_frame_num_offset = (h->frame_num - h->prev_frame_num);
if (h->prev_frame_num_offset < 0) {
h->prev_frame_num_offset += 256;
}
}
for(VAR_5=0; VAR_5<2; VAR_5++){
int VAR_9;
for(VAR_9=0; VAR_9<4; VAR_9++){
int VAR_10;
for(VAR_10=-1; VAR_10<4; VAR_10++)
h->ref_cache[VAR_5][scan8[0] + 8*VAR_9 + VAR_10]= 1;
h->ref_cache[VAR_5][scan8[0] + 8*VAR_9 + VAR_10]= PART_NOT_AVAILABLE;
}
}
for (s->mb_y=0; s->mb_y < s->mb_height; s->mb_y++) {
for (s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) {
if ( (get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits &&
((get_bits_count(&s->gb) & 7) == 0 || show_bits (&s->gb, (-get_bits_count(&s->gb) & 7)) == 0)) {
skip_bits(&s->gb, h->next_slice_index - get_bits_count(&s->gb));
s->gb.size_in_bits = 8*VAR_4;
if (svq3_decode_slice_header (h))
return -1;
}
VAR_6 = svq3_get_ue_golomb (&s->gb);
if (s->pict_type == I_TYPE) {
VAR_6 += 8;
} else if (s->pict_type == B_TYPE && VAR_6 >= 4) {
VAR_6 += 4;
}
if (VAR_6 > 33 || svq3_decode_mb (h, VAR_6)) {
av_log(h->s.VAR_0, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
return -1;
}
if (VAR_6 != 0) {
hl_decode_mb (h);
}
if (s->pict_type != B_TYPE && !s->low_delay) {
s->current_picture.VAR_6[s->mb_x + s->mb_y*s->mb_stride] =
(s->pict_type == P_TYPE && VAR_6 < 8) ? (VAR_6 - 1) : -1;
}
}
ff_draw_horiz_band(s, 16*s->mb_y, 16);
}
MPV_frame_end(s);
if (s->pict_type == B_TYPE || s->low_delay) {
*(AVFrame *) VAR_1 = *(AVFrame *) &s->current_picture;
} else {
*(AVFrame *) VAR_1 = *(AVFrame *) &s->last_picture;
}
VAR_0->frame_number = s->picture_number - 1;
if (s->last_picture_ptr || s->low_delay) {
*VAR_2 = sizeof(AVFrame);
}
return VAR_4;
}
|
[
"static int FUNC_0 (AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nuint8_t *VAR_3, int VAR_4) {",
"MpegEncContext *const s = VAR_0->priv_data;",
"H264Context *const h = VAR_0->priv_data;",
"int VAR_5, VAR_6;",
"unsigned char *VAR_7;",
"unsigned int VAR_8;",
"s->flags = VAR_0->flags;",
"s->flags2 = VAR_0->flags2;",
"s->unrestricted_mv = 1;",
"if (!s->context_initialized) {",
"s->width = VAR_0->width;",
"s->height = VAR_0->height;",
"h->pred4x4[DIAG_DOWN_LEFT_PRED] = pred4x4_down_left_svq3_c;",
"h->pred16x16[PLANE_PRED8x8] = pred16x16_plane_svq3_c;",
"h->halfpel_flag = 1;",
"h->thirdpel_flag = 1;",
"h->unknown_svq3_flag = 0;",
"h->chroma_qp = 4;",
"if (MPV_common_init (s) < 0)\nreturn -1;",
"h->b_stride = 4*s->mb_width;",
"alloc_tables (h);",
"VAR_7 = (unsigned char *)VAR_0->VAR_7;",
"for (VAR_5 = 0; VAR_5 < VAR_0->extradata_size; VAR_5++) {",
"if (!memcmp (VAR_7, \"SEQH\", 4))\nbreak;",
"VAR_7++;",
"}",
"if (!memcmp (VAR_7, \"SEQH\", 4)) {",
"GetBitContext gb;",
"VAR_8 = BE_32(&VAR_7[4]);",
"init_get_bits (&gb, VAR_7 + 8, VAR_8);",
"if (get_bits (&gb, 3) == 7) {",
"get_bits (&gb, 12);",
"get_bits (&gb, 12);",
"}",
"h->halfpel_flag = get_bits1 (&gb);",
"h->thirdpel_flag = get_bits1 (&gb);",
"get_bits1 (&gb);",
"get_bits1 (&gb);",
"get_bits1 (&gb);",
"get_bits1 (&gb);",
"s->low_delay = get_bits1 (&gb);",
"get_bits1 (&gb);",
"while (get_bits1 (&gb)) {",
"get_bits (&gb, 8);",
"}",
"h->unknown_svq3_flag = get_bits1 (&gb);",
"VAR_0->has_b_frames = !s->low_delay;",
"}",
"}",
"if (VAR_4 == 0) {",
"if (s->next_picture_ptr && !s->low_delay) {",
"*(AVFrame *) VAR_1 = *(AVFrame *) &s->next_picture;",
"*VAR_2 = sizeof(AVFrame);",
"}",
"return 0;",
"}",
"init_get_bits (&s->gb, VAR_3, 8*VAR_4);",
"s->mb_x = s->mb_y = 0;",
"if (svq3_decode_slice_header (h))\nreturn -1;",
"s->pict_type = h->slice_type;",
"s->picture_number = h->slice_num;",
"if(VAR_0->debug&FF_DEBUG_PICT_INFO){",
"av_log(h->s.VAR_0, AV_LOG_DEBUG, \"%c hpel:%d, tpel:%d aqp:%d qp:%d\\n\",\nav_get_pict_type_char(s->pict_type), h->halfpel_flag, h->thirdpel_flag,\ns->adaptive_quant, s->qscale\n);",
"}",
"s->current_picture.pict_type = s->pict_type;",
"s->current_picture.key_frame = (s->pict_type == I_TYPE);",
"if (s->last_picture_ptr == NULL && s->pict_type == B_TYPE) return 0;",
"if (VAR_0->hurry_up && s->pict_type == B_TYPE) return 0;",
"if (VAR_0->hurry_up >= 5) return 0;",
"if( (VAR_0->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE)\n||(VAR_0->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE)\n|| VAR_0->skip_frame >= AVDISCARD_ALL)\nreturn 0;",
"if (s->next_p_frame_damaged) {",
"if (s->pict_type == B_TYPE)\nreturn 0;",
"else\ns->next_p_frame_damaged = 0;",
"}",
"frame_start (h);",
"if (s->pict_type == B_TYPE) {",
"h->frame_num_offset = (h->slice_num - h->prev_frame_num);",
"if (h->frame_num_offset < 0) {",
"h->frame_num_offset += 256;",
"}",
"if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) {",
"av_log(h->s.VAR_0, AV_LOG_ERROR, \"error in B-frame picture id\\n\");",
"return -1;",
"}",
"} else {",
"h->prev_frame_num = h->frame_num;",
"h->frame_num = h->slice_num;",
"h->prev_frame_num_offset = (h->frame_num - h->prev_frame_num);",
"if (h->prev_frame_num_offset < 0) {",
"h->prev_frame_num_offset += 256;",
"}",
"}",
"for(VAR_5=0; VAR_5<2; VAR_5++){",
"int VAR_9;",
"for(VAR_9=0; VAR_9<4; VAR_9++){",
"int VAR_10;",
"for(VAR_10=-1; VAR_10<4; VAR_10++)",
"h->ref_cache[VAR_5][scan8[0] + 8*VAR_9 + VAR_10]= 1;",
"h->ref_cache[VAR_5][scan8[0] + 8*VAR_9 + VAR_10]= PART_NOT_AVAILABLE;",
"}",
"}",
"for (s->mb_y=0; s->mb_y < s->mb_height; s->mb_y++) {",
"for (s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) {",
"if ( (get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits &&\n((get_bits_count(&s->gb) & 7) == 0 || show_bits (&s->gb, (-get_bits_count(&s->gb) & 7)) == 0)) {",
"skip_bits(&s->gb, h->next_slice_index - get_bits_count(&s->gb));",
"s->gb.size_in_bits = 8*VAR_4;",
"if (svq3_decode_slice_header (h))\nreturn -1;",
"}",
"VAR_6 = svq3_get_ue_golomb (&s->gb);",
"if (s->pict_type == I_TYPE) {",
"VAR_6 += 8;",
"} else if (s->pict_type == B_TYPE && VAR_6 >= 4) {",
"VAR_6 += 4;",
"}",
"if (VAR_6 > 33 || svq3_decode_mb (h, VAR_6)) {",
"av_log(h->s.VAR_0, AV_LOG_ERROR, \"error while decoding MB %d %d\\n\", s->mb_x, s->mb_y);",
"return -1;",
"}",
"if (VAR_6 != 0) {",
"hl_decode_mb (h);",
"}",
"if (s->pict_type != B_TYPE && !s->low_delay) {",
"s->current_picture.VAR_6[s->mb_x + s->mb_y*s->mb_stride] =\n(s->pict_type == P_TYPE && VAR_6 < 8) ? (VAR_6 - 1) : -1;",
"}",
"}",
"ff_draw_horiz_band(s, 16*s->mb_y, 16);",
"}",
"MPV_frame_end(s);",
"if (s->pict_type == B_TYPE || s->low_delay) {",
"*(AVFrame *) VAR_1 = *(AVFrame *) &s->current_picture;",
"} else {",
"*(AVFrame *) VAR_1 = *(AVFrame *) &s->last_picture;",
"}",
"VAR_0->frame_number = s->picture_number - 1;",
"if (s->last_picture_ptr || s->low_delay) {",
"*VAR_2 = sizeof(AVFrame);",
"}",
"return VAR_4;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47,
49
],
[
53
],
[
57
],
[
63
],
[
65
],
[
67,
69
],
[
71
],
[
73
],
[
79
],
[
83
],
[
87
],
[
89
],
[
95
],
[
97
],
[
99
],
[
101
],
[
105
],
[
107
],
[
113
],
[
115
],
[
117
],
[
119
],
[
123
],
[
129
],
[
133
],
[
135
],
[
137
],
[
141
],
[
143
],
[
145
],
[
147
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
169
],
[
173
],
[
177,
179
],
[
183
],
[
185
],
[
189
],
[
191,
193,
195,
197
],
[
199
],
[
205
],
[
207
],
[
213
],
[
217
],
[
221
],
[
223,
225,
227,
229
],
[
233
],
[
235,
237
],
[
239,
241
],
[
243
],
[
247
],
[
251
],
[
253
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
281
],
[
283
],
[
285
],
[
287
],
[
291
],
[
293
],
[
295
],
[
297
],
[
299
],
[
301
],
[
303
],
[
305
],
[
307
],
[
311
],
[
313
],
[
317,
319
],
[
323
],
[
325
],
[
329,
331
],
[
337
],
[
341
],
[
345
],
[
347
],
[
349
],
[
351
],
[
353
],
[
355
],
[
357
],
[
359
],
[
361
],
[
365
],
[
367
],
[
369
],
[
373
],
[
375,
377
],
[
379
],
[
381
],
[
385
],
[
387
],
[
391
],
[
395
],
[
397
],
[
399
],
[
401
],
[
403
],
[
407
],
[
413
],
[
415
],
[
417
],
[
421
],
[
423
]
] |
17,390
|
static int qemu_rdma_reg_whole_ram_blocks(RDMAContext *rdma)
{
int i;
RDMALocalBlocks *local = &rdma->local_ram_blocks;
for (i = 0; i < local->nb_blocks; i++) {
local->block[i].mr =
ibv_reg_mr(rdma->pd,
local->block[i].local_host_addr,
local->block[i].length,
IBV_ACCESS_LOCAL_WRITE |
IBV_ACCESS_REMOTE_WRITE
);
if (!local->block[i].mr) {
perror("Failed to register local dest ram block!\n");
break;
}
rdma->total_registrations++;
}
if (i >= local->nb_blocks) {
return 0;
}
for (i--; i >= 0; i--) {
ibv_dereg_mr(local->block[i].mr);
rdma->total_registrations--;
}
return -1;
}
| true
|
qemu
|
60fe637bf0e4d7989e21e50f52526444765c63b4
|
static int qemu_rdma_reg_whole_ram_blocks(RDMAContext *rdma)
{
int i;
RDMALocalBlocks *local = &rdma->local_ram_blocks;
for (i = 0; i < local->nb_blocks; i++) {
local->block[i].mr =
ibv_reg_mr(rdma->pd,
local->block[i].local_host_addr,
local->block[i].length,
IBV_ACCESS_LOCAL_WRITE |
IBV_ACCESS_REMOTE_WRITE
);
if (!local->block[i].mr) {
perror("Failed to register local dest ram block!\n");
break;
}
rdma->total_registrations++;
}
if (i >= local->nb_blocks) {
return 0;
}
for (i--; i >= 0; i--) {
ibv_dereg_mr(local->block[i].mr);
rdma->total_registrations--;
}
return -1;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(RDMAContext *VAR_0)
{
int VAR_1;
RDMALocalBlocks *local = &VAR_0->local_ram_blocks;
for (VAR_1 = 0; VAR_1 < local->nb_blocks; VAR_1++) {
local->block[VAR_1].mr =
ibv_reg_mr(VAR_0->pd,
local->block[VAR_1].local_host_addr,
local->block[VAR_1].length,
IBV_ACCESS_LOCAL_WRITE |
IBV_ACCESS_REMOTE_WRITE
);
if (!local->block[VAR_1].mr) {
perror("Failed to register local dest ram block!\n");
break;
}
VAR_0->total_registrations++;
}
if (VAR_1 >= local->nb_blocks) {
return 0;
}
for (VAR_1--; VAR_1 >= 0; VAR_1--) {
ibv_dereg_mr(local->block[VAR_1].mr);
VAR_0->total_registrations--;
}
return -1;
}
|
[
"static int FUNC_0(RDMAContext *VAR_0)\n{",
"int VAR_1;",
"RDMALocalBlocks *local = &VAR_0->local_ram_blocks;",
"for (VAR_1 = 0; VAR_1 < local->nb_blocks; VAR_1++) {",
"local->block[VAR_1].mr =\nibv_reg_mr(VAR_0->pd,\nlocal->block[VAR_1].local_host_addr,\nlocal->block[VAR_1].length,\nIBV_ACCESS_LOCAL_WRITE |\nIBV_ACCESS_REMOTE_WRITE\n);",
"if (!local->block[VAR_1].mr) {",
"perror(\"Failed to register local dest ram block!\\n\");",
"break;",
"}",
"VAR_0->total_registrations++;",
"}",
"if (VAR_1 >= local->nb_blocks) {",
"return 0;",
"}",
"for (VAR_1--; VAR_1 >= 0; VAR_1--) {",
"ibv_dereg_mr(local->block[VAR_1].mr);",
"VAR_0->total_registrations--;",
"}",
"return -1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13,
15,
17,
19,
21,
23,
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
49
],
[
51
],
[
53
],
[
55
],
[
59
],
[
63
]
] |
17,391
|
static int encode_plane(AVCodecContext *avctx, uint8_t *src,
uint8_t *dst, int step, int stride,
int width, int height, PutByteContext *pb)
{
UtvideoContext *c = avctx->priv_data;
uint8_t lengths[256];
uint32_t counts[256] = { 0 };
HuffEntry he[256];
uint32_t offset = 0, slice_len = 0;
int i, sstart, send = 0;
int symbol;
/* Do prediction / make planes */
switch (c->frame_pred) {
case PRED_NONE:
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
write_plane(src + sstart * stride, dst + sstart * width,
step, stride, width, send - sstart);
}
break;
case PRED_LEFT:
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
left_predict(src + sstart * stride, dst + sstart * width,
step, stride, width, send - sstart);
}
break;
case PRED_MEDIAN:
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
median_predict(src + sstart * stride, dst + sstart * width,
step, stride, width, send - sstart);
}
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown prediction mode: %d\n",
c->frame_pred);
return AVERROR_OPTION_NOT_FOUND;
}
/* Count the usage of values */
count_usage(dst, width, height, counts);
/* Check for a special case where only one symbol was used */
for (symbol = 0; symbol < 256; symbol++) {
/* If non-zero count is found, see if it matches width * height */
if (counts[symbol]) {
/* Special case if only one symbol was used */
if (counts[symbol] == width * height) {
/*
* Write a zero for the single symbol
* used in the plane, else 0xFF.
*/
for (i = 0; i < 256; i++) {
if (i == symbol)
bytestream2_put_byte(pb, 0);
else
bytestream2_put_byte(pb, 0xFF);
}
/* Write zeroes for lengths */
for (i = 0; i < c->slices; i++)
bytestream2_put_le32(pb, 0);
/* And that's all for that plane folks */
return 0;
}
break;
}
}
/* Calculate huffman lengths */
calculate_code_lengths(lengths, counts);
/*
* Write the plane's header into the output packet:
* - huffman code lengths (256 bytes)
* - slice end offsets (gotten from the slice lengths)
*/
for (i = 0; i < 256; i++) {
bytestream2_put_byte(pb, lengths[i]);
he[i].len = lengths[i];
he[i].sym = i;
}
/* Calculate the huffman codes themselves */
calculate_codes(he);
send = 0;
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
/*
* Write the huffman codes to a buffer,
* get the offset in bits and convert to bytes.
*/
offset += write_huff_codes(dst + sstart * width, c->slice_bits,
width * (send - sstart), width,
send - sstart, he) >> 3;
slice_len = offset - slice_len;
/* Byteswap the written huffman codes */
c->dsp.bswap_buf((uint32_t *) c->slice_bits,
(uint32_t *) c->slice_bits,
slice_len >> 2);
/* Write the offset to the stream */
bytestream2_put_le32(pb, offset);
/* Seek to the data part of the packet */
bytestream2_seek_p(pb, 4 * (c->slices - i - 1) +
offset - slice_len, SEEK_CUR);
/* Write the slices' data into the output packet */
bytestream2_put_buffer(pb, c->slice_bits, slice_len);
/* Seek back to the slice offsets */
bytestream2_seek_p(pb, -4 * (c->slices - i - 1) - offset,
SEEK_CUR);
slice_len = offset;
}
/* And at the end seek to the end of written slice(s) */
bytestream2_seek_p(pb, offset, SEEK_CUR);
return 0;
}
| true
|
FFmpeg
|
f92f4935acd7d974adfd1deebdf1bb06cbe107ca
|
static int encode_plane(AVCodecContext *avctx, uint8_t *src,
uint8_t *dst, int step, int stride,
int width, int height, PutByteContext *pb)
{
UtvideoContext *c = avctx->priv_data;
uint8_t lengths[256];
uint32_t counts[256] = { 0 };
HuffEntry he[256];
uint32_t offset = 0, slice_len = 0;
int i, sstart, send = 0;
int symbol;
switch (c->frame_pred) {
case PRED_NONE:
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
write_plane(src + sstart * stride, dst + sstart * width,
step, stride, width, send - sstart);
}
break;
case PRED_LEFT:
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
left_predict(src + sstart * stride, dst + sstart * width,
step, stride, width, send - sstart);
}
break;
case PRED_MEDIAN:
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
median_predict(src + sstart * stride, dst + sstart * width,
step, stride, width, send - sstart);
}
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown prediction mode: %d\n",
c->frame_pred);
return AVERROR_OPTION_NOT_FOUND;
}
count_usage(dst, width, height, counts);
for (symbol = 0; symbol < 256; symbol++) {
if (counts[symbol]) {
if (counts[symbol] == width * height) {
for (i = 0; i < 256; i++) {
if (i == symbol)
bytestream2_put_byte(pb, 0);
else
bytestream2_put_byte(pb, 0xFF);
}
for (i = 0; i < c->slices; i++)
bytestream2_put_le32(pb, 0);
return 0;
}
break;
}
}
calculate_code_lengths(lengths, counts);
for (i = 0; i < 256; i++) {
bytestream2_put_byte(pb, lengths[i]);
he[i].len = lengths[i];
he[i].sym = i;
}
calculate_codes(he);
send = 0;
for (i = 0; i < c->slices; i++) {
sstart = send;
send = height * (i + 1) / c->slices;
offset += write_huff_codes(dst + sstart * width, c->slice_bits,
width * (send - sstart), width,
send - sstart, he) >> 3;
slice_len = offset - slice_len;
c->dsp.bswap_buf((uint32_t *) c->slice_bits,
(uint32_t *) c->slice_bits,
slice_len >> 2);
bytestream2_put_le32(pb, offset);
bytestream2_seek_p(pb, 4 * (c->slices - i - 1) +
offset - slice_len, SEEK_CUR);
bytestream2_put_buffer(pb, c->slice_bits, slice_len);
bytestream2_seek_p(pb, -4 * (c->slices - i - 1) - offset,
SEEK_CUR);
slice_len = offset;
}
bytestream2_seek_p(pb, offset, SEEK_CUR);
return 0;
}
|
{
"code": [
" break;",
" break;",
" uint32_t counts[256] = { 0 };",
" calculate_code_lengths(lengths, counts);"
],
"line_no": [
147,
147,
13,
157
]
}
|
static int FUNC_0(AVCodecContext *VAR_0, uint8_t *VAR_1,
uint8_t *VAR_2, int VAR_3, int VAR_4,
int VAR_5, int VAR_6, PutByteContext *VAR_7)
{
UtvideoContext *c = VAR_0->priv_data;
uint8_t lengths[256];
uint32_t counts[256] = { 0 };
HuffEntry he[256];
uint32_t offset = 0, slice_len = 0;
int VAR_8, VAR_9, VAR_10 = 0;
int VAR_11;
switch (c->frame_pred) {
case PRED_NONE:
for (VAR_8 = 0; VAR_8 < c->slices; VAR_8++) {
VAR_9 = VAR_10;
VAR_10 = VAR_6 * (VAR_8 + 1) / c->slices;
write_plane(VAR_1 + VAR_9 * VAR_4, VAR_2 + VAR_9 * VAR_5,
VAR_3, VAR_4, VAR_5, VAR_10 - VAR_9);
}
break;
case PRED_LEFT:
for (VAR_8 = 0; VAR_8 < c->slices; VAR_8++) {
VAR_9 = VAR_10;
VAR_10 = VAR_6 * (VAR_8 + 1) / c->slices;
left_predict(VAR_1 + VAR_9 * VAR_4, VAR_2 + VAR_9 * VAR_5,
VAR_3, VAR_4, VAR_5, VAR_10 - VAR_9);
}
break;
case PRED_MEDIAN:
for (VAR_8 = 0; VAR_8 < c->slices; VAR_8++) {
VAR_9 = VAR_10;
VAR_10 = VAR_6 * (VAR_8 + 1) / c->slices;
median_predict(VAR_1 + VAR_9 * VAR_4, VAR_2 + VAR_9 * VAR_5,
VAR_3, VAR_4, VAR_5, VAR_10 - VAR_9);
}
break;
default:
av_log(VAR_0, AV_LOG_ERROR, "Unknown prediction mode: %d\n",
c->frame_pred);
return AVERROR_OPTION_NOT_FOUND;
}
count_usage(VAR_2, VAR_5, VAR_6, counts);
for (VAR_11 = 0; VAR_11 < 256; VAR_11++) {
if (counts[VAR_11]) {
if (counts[VAR_11] == VAR_5 * VAR_6) {
for (VAR_8 = 0; VAR_8 < 256; VAR_8++) {
if (VAR_8 == VAR_11)
bytestream2_put_byte(VAR_7, 0);
else
bytestream2_put_byte(VAR_7, 0xFF);
}
for (VAR_8 = 0; VAR_8 < c->slices; VAR_8++)
bytestream2_put_le32(VAR_7, 0);
return 0;
}
break;
}
}
calculate_code_lengths(lengths, counts);
for (VAR_8 = 0; VAR_8 < 256; VAR_8++) {
bytestream2_put_byte(VAR_7, lengths[VAR_8]);
he[VAR_8].len = lengths[VAR_8];
he[VAR_8].sym = VAR_8;
}
calculate_codes(he);
VAR_10 = 0;
for (VAR_8 = 0; VAR_8 < c->slices; VAR_8++) {
VAR_9 = VAR_10;
VAR_10 = VAR_6 * (VAR_8 + 1) / c->slices;
offset += write_huff_codes(VAR_2 + VAR_9 * VAR_5, c->slice_bits,
VAR_5 * (VAR_10 - VAR_9), VAR_5,
VAR_10 - VAR_9, he) >> 3;
slice_len = offset - slice_len;
c->dsp.bswap_buf((uint32_t *) c->slice_bits,
(uint32_t *) c->slice_bits,
slice_len >> 2);
bytestream2_put_le32(VAR_7, offset);
bytestream2_seek_p(VAR_7, 4 * (c->slices - VAR_8 - 1) +
offset - slice_len, SEEK_CUR);
bytestream2_put_buffer(VAR_7, c->slice_bits, slice_len);
bytestream2_seek_p(VAR_7, -4 * (c->slices - VAR_8 - 1) - offset,
SEEK_CUR);
slice_len = offset;
}
bytestream2_seek_p(VAR_7, offset, SEEK_CUR);
return 0;
}
|
[
"static int FUNC_0(AVCodecContext *VAR_0, uint8_t *VAR_1,\nuint8_t *VAR_2, int VAR_3, int VAR_4,\nint VAR_5, int VAR_6, PutByteContext *VAR_7)\n{",
"UtvideoContext *c = VAR_0->priv_data;",
"uint8_t lengths[256];",
"uint32_t counts[256] = { 0 };",
"HuffEntry he[256];",
"uint32_t offset = 0, slice_len = 0;",
"int VAR_8, VAR_9, VAR_10 = 0;",
"int VAR_11;",
"switch (c->frame_pred) {",
"case PRED_NONE:\nfor (VAR_8 = 0; VAR_8 < c->slices; VAR_8++) {",
"VAR_9 = VAR_10;",
"VAR_10 = VAR_6 * (VAR_8 + 1) / c->slices;",
"write_plane(VAR_1 + VAR_9 * VAR_4, VAR_2 + VAR_9 * VAR_5,\nVAR_3, VAR_4, VAR_5, VAR_10 - VAR_9);",
"}",
"break;",
"case PRED_LEFT:\nfor (VAR_8 = 0; VAR_8 < c->slices; VAR_8++) {",
"VAR_9 = VAR_10;",
"VAR_10 = VAR_6 * (VAR_8 + 1) / c->slices;",
"left_predict(VAR_1 + VAR_9 * VAR_4, VAR_2 + VAR_9 * VAR_5,\nVAR_3, VAR_4, VAR_5, VAR_10 - VAR_9);",
"}",
"break;",
"case PRED_MEDIAN:\nfor (VAR_8 = 0; VAR_8 < c->slices; VAR_8++) {",
"VAR_9 = VAR_10;",
"VAR_10 = VAR_6 * (VAR_8 + 1) / c->slices;",
"median_predict(VAR_1 + VAR_9 * VAR_4, VAR_2 + VAR_9 * VAR_5,\nVAR_3, VAR_4, VAR_5, VAR_10 - VAR_9);",
"}",
"break;",
"default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unknown prediction mode: %d\\n\",\nc->frame_pred);",
"return AVERROR_OPTION_NOT_FOUND;",
"}",
"count_usage(VAR_2, VAR_5, VAR_6, counts);",
"for (VAR_11 = 0; VAR_11 < 256; VAR_11++) {",
"if (counts[VAR_11]) {",
"if (counts[VAR_11] == VAR_5 * VAR_6) {",
"for (VAR_8 = 0; VAR_8 < 256; VAR_8++) {",
"if (VAR_8 == VAR_11)\nbytestream2_put_byte(VAR_7, 0);",
"else\nbytestream2_put_byte(VAR_7, 0xFF);",
"}",
"for (VAR_8 = 0; VAR_8 < c->slices; VAR_8++)",
"bytestream2_put_le32(VAR_7, 0);",
"return 0;",
"}",
"break;",
"}",
"}",
"calculate_code_lengths(lengths, counts);",
"for (VAR_8 = 0; VAR_8 < 256; VAR_8++) {",
"bytestream2_put_byte(VAR_7, lengths[VAR_8]);",
"he[VAR_8].len = lengths[VAR_8];",
"he[VAR_8].sym = VAR_8;",
"}",
"calculate_codes(he);",
"VAR_10 = 0;",
"for (VAR_8 = 0; VAR_8 < c->slices; VAR_8++) {",
"VAR_9 = VAR_10;",
"VAR_10 = VAR_6 * (VAR_8 + 1) / c->slices;",
"offset += write_huff_codes(VAR_2 + VAR_9 * VAR_5, c->slice_bits,\nVAR_5 * (VAR_10 - VAR_9), VAR_5,\nVAR_10 - VAR_9, he) >> 3;",
"slice_len = offset - slice_len;",
"c->dsp.bswap_buf((uint32_t *) c->slice_bits,\n(uint32_t *) c->slice_bits,\nslice_len >> 2);",
"bytestream2_put_le32(VAR_7, offset);",
"bytestream2_seek_p(VAR_7, 4 * (c->slices - VAR_8 - 1) +\noffset - slice_len, SEEK_CUR);",
"bytestream2_put_buffer(VAR_7, c->slice_bits, slice_len);",
"bytestream2_seek_p(VAR_7, -4 * (c->slices - VAR_8 - 1) - offset,\nSEEK_CUR);",
"slice_len = offset;",
"}",
"bytestream2_seek_p(VAR_7, offset, SEEK_CUR);",
"return 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,
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
],
[
17
],
[
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,
85
],
[
87
],
[
89
],
[
95
],
[
101
],
[
105
],
[
109
],
[
119
],
[
121,
123
],
[
125,
127
],
[
129
],
[
135
],
[
137
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
157
],
[
171
],
[
173
],
[
177
],
[
179
],
[
181
],
[
187
],
[
191
],
[
193
],
[
195
],
[
197
],
[
209,
211,
213
],
[
217
],
[
223,
225,
227
],
[
233
],
[
239,
241
],
[
247
],
[
253,
255
],
[
259
],
[
261
],
[
267
],
[
271
],
[
273
]
] |
17,392
|
static void init_excp_4xx_real (CPUPPCState *env)
{
#if !defined(CONFIG_USER_ONLY)
env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000100;
env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
env->excp_vectors[POWERPC_EXCP_PIT] = 0x00001000;
env->excp_vectors[POWERPC_EXCP_FIT] = 0x00001010;
env->excp_vectors[POWERPC_EXCP_WDT] = 0x00001020;
env->excp_vectors[POWERPC_EXCP_DEBUG] = 0x00002000;
env->excp_prefix = 0x00000000;
env->ivor_mask = 0x0000FFF0;
env->ivpr_mask = 0xFFFF0000;
/* Hardware reset vector */
env->hreset_vector = 0xFFFFFFFCUL;
#endif
}
| true
|
qemu
|
faadf50e2962dd54175647a80bd6fc4319c91973
|
static void init_excp_4xx_real (CPUPPCState *env)
{
#if !defined(CONFIG_USER_ONLY)
env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000100;
env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
env->excp_vectors[POWERPC_EXCP_PIT] = 0x00001000;
env->excp_vectors[POWERPC_EXCP_FIT] = 0x00001010;
env->excp_vectors[POWERPC_EXCP_WDT] = 0x00001020;
env->excp_vectors[POWERPC_EXCP_DEBUG] = 0x00002000;
env->excp_prefix = 0x00000000;
env->ivor_mask = 0x0000FFF0;
env->ivpr_mask = 0xFFFF0000;
env->hreset_vector = 0xFFFFFFFCUL;
#endif
}
|
{
"code": [
"#endif",
" env->excp_prefix = 0x00000000;",
" env->ivor_mask = 0x0000FFF0;",
" env->ivpr_mask = 0xFFFF0000;",
" env->excp_prefix = 0x00000000;",
" env->ivor_mask = 0x0000FFF0;",
" env->ivpr_mask = 0xFFFF0000;",
" env->excp_prefix = 0x00000000;",
" env->ivpr_mask = 0xFFFF0000;",
"#if !defined(CONFIG_USER_ONLY)",
"#endif",
"#if !defined(CONFIG_USER_ONLY)",
"#endif",
"#if !defined(CONFIG_USER_ONLY)",
"#endif",
"#if !defined(CONFIG_USER_ONLY)",
"#endif",
"#endif"
],
"line_no": [
37,
27,
29,
31,
27,
29,
31,
27,
31,
5,
37,
5,
37,
5,
37,
5,
37,
37
]
}
|
static void FUNC_0 (CPUPPCState *VAR_0)
{
#if !defined(CONFIG_USER_ONLY)
VAR_0->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000100;
VAR_0->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
VAR_0->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
VAR_0->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
VAR_0->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
VAR_0->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
VAR_0->excp_vectors[POWERPC_EXCP_PIT] = 0x00001000;
VAR_0->excp_vectors[POWERPC_EXCP_FIT] = 0x00001010;
VAR_0->excp_vectors[POWERPC_EXCP_WDT] = 0x00001020;
VAR_0->excp_vectors[POWERPC_EXCP_DEBUG] = 0x00002000;
VAR_0->excp_prefix = 0x00000000;
VAR_0->ivor_mask = 0x0000FFF0;
VAR_0->ivpr_mask = 0xFFFF0000;
VAR_0->hreset_vector = 0xFFFFFFFCUL;
#endif
}
|
[
"static void FUNC_0 (CPUPPCState *VAR_0)\n{",
"#if !defined(CONFIG_USER_ONLY)\nVAR_0->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000100;",
"VAR_0->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;",
"VAR_0->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;",
"VAR_0->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;",
"VAR_0->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;",
"VAR_0->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;",
"VAR_0->excp_vectors[POWERPC_EXCP_PIT] = 0x00001000;",
"VAR_0->excp_vectors[POWERPC_EXCP_FIT] = 0x00001010;",
"VAR_0->excp_vectors[POWERPC_EXCP_WDT] = 0x00001020;",
"VAR_0->excp_vectors[POWERPC_EXCP_DEBUG] = 0x00002000;",
"VAR_0->excp_prefix = 0x00000000;",
"VAR_0->ivor_mask = 0x0000FFF0;",
"VAR_0->ivpr_mask = 0xFFFF0000;",
"VAR_0->hreset_vector = 0xFFFFFFFCUL;",
"#endif\n}"
] |
[
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
1
] |
[
[
1,
3
],
[
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37,
39
]
] |
17,393
|
static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf,
void *priv)
{
av_freep(&priv);
}
| true
|
FFmpeg
|
220b24c7c97dc033ceab1510549f66d0e7b52ef1
|
static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf,
void *priv)
{
av_freep(&priv);
}
|
{
"code": [
"static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf,",
" void *priv)",
" av_freep(&priv);"
],
"line_no": [
1,
3,
7
]
}
|
static void FUNC_0(SchroBuffer *VAR_0,
void *VAR_1)
{
av_freep(&VAR_1);
}
|
[
"static void FUNC_0(SchroBuffer *VAR_0,\nvoid *VAR_1)\n{",
"av_freep(&VAR_1);",
"}"
] |
[
1,
1,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
]
] |
17,394
|
void aio_set_dispatching(AioContext *ctx, bool dispatching)
{
ctx->dispatching = dispatching;
if (!dispatching) {
/* Write ctx->dispatching before reading e.g. bh->scheduled.
* Optimization: this is only needed when we're entering the "unsafe"
* phase where other threads must call event_notifier_set.
*/
smp_mb();
}
}
| true
|
qemu
|
eabc977973103527bbb8fed69c91cfaa6691f8ab
|
void aio_set_dispatching(AioContext *ctx, bool dispatching)
{
ctx->dispatching = dispatching;
if (!dispatching) {
smp_mb();
}
}
|
{
"code": [
"void aio_set_dispatching(AioContext *ctx, bool dispatching)",
" ctx->dispatching = dispatching;",
" if (!dispatching) {",
" smp_mb();"
],
"line_no": [
1,
5,
7,
17
]
}
|
void FUNC_0(AioContext *VAR_0, bool VAR_1)
{
VAR_0->VAR_1 = VAR_1;
if (!VAR_1) {
smp_mb();
}
}
|
[
"void FUNC_0(AioContext *VAR_0, bool VAR_1)\n{",
"VAR_0->VAR_1 = VAR_1;",
"if (!VAR_1) {",
"smp_mb();",
"}",
"}"
] |
[
1,
1,
1,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
17
],
[
19
],
[
21
]
] |
17,395
|
static int adx_encode_header(AVCodecContext *avctx,unsigned char *buf,size_t bufsize)
{
#if 0
struct {
uint32_t offset; /* 0x80000000 + sample start - 4 */
unsigned char unknown1[3]; /* 03 12 04 */
unsigned char channel; /* 1 or 2 */
uint32_t freq;
uint32_t size;
uint32_t unknown2; /* 01 f4 03 00 */
uint32_t unknown3; /* 00 00 00 00 */
uint32_t unknown4; /* 00 00 00 00 */
/* if loop
unknown3 00 15 00 01
unknown4 00 00 00 01
long loop_start_sample;
long loop_start_byte;
long loop_end_sample;
long loop_end_byte;
long
*/
} adxhdr; /* big endian */
/* offset-6 "(c)CRI" */
#endif
write_long(buf+0x00,0x80000000|0x20);
write_long(buf+0x04,0x03120400|avctx->channels);
write_long(buf+0x08,avctx->sample_rate);
write_long(buf+0x0c,0); /* FIXME: set after */
write_long(buf+0x10,0x01040300);
write_long(buf+0x14,0x00000000);
write_long(buf+0x18,0x00000000);
memcpy(buf+0x1c,"\0\0(c)CRI",8);
return 0x20+4;
}
| true
|
FFmpeg
|
f19af812a32c1398d48c3550d11dbc6aafbb2bfc
|
static int adx_encode_header(AVCodecContext *avctx,unsigned char *buf,size_t bufsize)
{
#if 0
struct {
uint32_t offset;
unsigned char unknown1[3];
unsigned char channel;
uint32_t freq;
uint32_t size;
uint32_t unknown2;
uint32_t unknown3;
uint32_t unknown4;
} adxhdr;
#endif
write_long(buf+0x00,0x80000000|0x20);
write_long(buf+0x04,0x03120400|avctx->channels);
write_long(buf+0x08,avctx->sample_rate);
write_long(buf+0x0c,0);
write_long(buf+0x10,0x01040300);
write_long(buf+0x14,0x00000000);
write_long(buf+0x18,0x00000000);
memcpy(buf+0x1c,"\0\0(c)CRI",8);
return 0x20+4;
}
|
{
"code": [
"\tstruct {",
"\t\tuint32_t freq;",
"\t\tuint32_t size;",
"\twrite_long(buf+0x00,0x80000000|0x20);",
"\twrite_long(buf+0x04,0x03120400|avctx->channels);",
"\twrite_long(buf+0x08,avctx->sample_rate);",
"\twrite_long(buf+0x10,0x01040300);",
"\twrite_long(buf+0x14,0x00000000);",
"\twrite_long(buf+0x18,0x00000000);",
"\tmemcpy(buf+0x1c,\"\\0\\0(c)CRI\",8);",
"\treturn 0x20+4;"
],
"line_no": [
7,
15,
17,
51,
53,
55,
59,
61,
63,
65,
67
]
}
|
static int FUNC_0(AVCodecContext *VAR_0,unsigned char *VAR_1,size_t VAR_2)
{
#if 0
struct {
uint32_t offset;
unsigned char unknown1[3];
unsigned char channel;
uint32_t freq;
uint32_t size;
uint32_t unknown2;
uint32_t unknown3;
uint32_t unknown4;
} adxhdr;
#endif
write_long(VAR_1+0x00,0x80000000|0x20);
write_long(VAR_1+0x04,0x03120400|VAR_0->channels);
write_long(VAR_1+0x08,VAR_0->sample_rate);
write_long(VAR_1+0x0c,0);
write_long(VAR_1+0x10,0x01040300);
write_long(VAR_1+0x14,0x00000000);
write_long(VAR_1+0x18,0x00000000);
memcpy(VAR_1+0x1c,"\0\0(c)CRI",8);
return 0x20+4;
}
|
[
"static int FUNC_0(AVCodecContext *VAR_0,unsigned char *VAR_1,size_t VAR_2)\n{",
"#if 0\nstruct {",
"uint32_t offset;",
"unsigned char unknown1[3];",
"unsigned char channel;",
"uint32_t freq;",
"uint32_t size;",
"uint32_t unknown2;",
"uint32_t unknown3;",
"uint32_t unknown4;",
"} adxhdr;",
"#endif\nwrite_long(VAR_1+0x00,0x80000000|0x20);",
"write_long(VAR_1+0x04,0x03120400|VAR_0->channels);",
"write_long(VAR_1+0x08,VAR_0->sample_rate);",
"write_long(VAR_1+0x0c,0);",
"write_long(VAR_1+0x10,0x01040300);",
"write_long(VAR_1+0x14,0x00000000);",
"write_long(VAR_1+0x18,0x00000000);",
"memcpy(VAR_1+0x1c,\"\\0\\0(c)CRI\",8);",
"return 0x20+4;",
"}"
] |
[
0,
1,
0,
0,
0,
1,
1,
0,
0,
0,
0,
1,
1,
1,
0,
1,
1,
1,
1,
1,
0
] |
[
[
1,
3
],
[
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
45
],
[
49,
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
]
] |
17,396
|
static vscsi_req *vscsi_find_req(VSCSIState *s, uint32_t tag)
{
if (tag >= VSCSI_REQ_LIMIT || !s->reqs[tag].active) {
return NULL;
}
return &s->reqs[tag];
}
| true
|
qemu
|
5c6c0e513600ba57c3e73b7151d3c0664438f7b5
|
static vscsi_req *vscsi_find_req(VSCSIState *s, uint32_t tag)
{
if (tag >= VSCSI_REQ_LIMIT || !s->reqs[tag].active) {
return NULL;
}
return &s->reqs[tag];
}
|
{
"code": [
" return NULL;",
" return NULL;",
"static vscsi_req *vscsi_find_req(VSCSIState *s, uint32_t tag)"
],
"line_no": [
7,
7,
1
]
}
|
static vscsi_req *FUNC_0(VSCSIState *s, uint32_t tag)
{
if (tag >= VSCSI_REQ_LIMIT || !s->reqs[tag].active) {
return NULL;
}
return &s->reqs[tag];
}
|
[
"static vscsi_req *FUNC_0(VSCSIState *s, uint32_t tag)\n{",
"if (tag >= VSCSI_REQ_LIMIT || !s->reqs[tag].active) {",
"return NULL;",
"}",
"return &s->reqs[tag];",
"}"
] |
[
1,
0,
1,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
]
] |
17,397
|
static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size)
{
const uint8_t *s = src;
const uint8_t *end;
#ifdef HAVE_MMX
const uint8_t *mm_end;
#endif
uint16_t *d = (uint16_t *)dst;
end = s + src_size;
#ifdef HAVE_MMX
__asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm __volatile(
"movq %0, %%mm7\n\t"
"movq %1, %%mm6\n\t"
::"m"(red_15mask),"m"(green_15mask));
mm_end = end - 15;
while(s < mm_end)
{
__asm __volatile(
PREFETCH" 32%1\n\t"
"movd %1, %%mm0\n\t"
"movd 3%1, %%mm3\n\t"
"punpckldq 6%1, %%mm0\n\t"
"punpckldq 9%1, %%mm3\n\t"
"movq %%mm0, %%mm1\n\t"
"movq %%mm0, %%mm2\n\t"
"movq %%mm3, %%mm4\n\t"
"movq %%mm3, %%mm5\n\t"
"psllq $7, %%mm0\n\t"
"psllq $7, %%mm3\n\t"
"pand %%mm7, %%mm0\n\t"
"pand %%mm7, %%mm3\n\t"
"psrlq $6, %%mm1\n\t"
"psrlq $6, %%mm4\n\t"
"pand %%mm6, %%mm1\n\t"
"pand %%mm6, %%mm4\n\t"
"psrlq $19, %%mm2\n\t"
"psrlq $19, %%mm5\n\t"
"pand %2, %%mm2\n\t"
"pand %2, %%mm5\n\t"
"por %%mm1, %%mm0\n\t"
"por %%mm4, %%mm3\n\t"
"por %%mm2, %%mm0\n\t"
"por %%mm5, %%mm3\n\t"
"psllq $16, %%mm3\n\t"
"por %%mm3, %%mm0\n\t"
MOVNTQ" %%mm0, %0\n\t"
:"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
d += 4;
s += 12;
}
__asm __volatile(SFENCE:::"memory");
__asm __volatile(EMMS:::"memory");
#endif
while(s < end)
{
const int r= *s++;
const int g= *s++;
const int b= *s++;
*d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
}
}
| true
|
FFmpeg
|
7f526efd17973ec6d2204f7a47b6923e2be31363
|
static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size)
{
const uint8_t *s = src;
const uint8_t *end;
#ifdef HAVE_MMX
const uint8_t *mm_end;
#endif
uint16_t *d = (uint16_t *)dst;
end = s + src_size;
#ifdef HAVE_MMX
__asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm __volatile(
"movq %0, %%mm7\n\t"
"movq %1, %%mm6\n\t"
::"m"(red_15mask),"m"(green_15mask));
mm_end = end - 15;
while(s < mm_end)
{
__asm __volatile(
PREFETCH" 32%1\n\t"
"movd %1, %%mm0\n\t"
"movd 3%1, %%mm3\n\t"
"punpckldq 6%1, %%mm0\n\t"
"punpckldq 9%1, %%mm3\n\t"
"movq %%mm0, %%mm1\n\t"
"movq %%mm0, %%mm2\n\t"
"movq %%mm3, %%mm4\n\t"
"movq %%mm3, %%mm5\n\t"
"psllq $7, %%mm0\n\t"
"psllq $7, %%mm3\n\t"
"pand %%mm7, %%mm0\n\t"
"pand %%mm7, %%mm3\n\t"
"psrlq $6, %%mm1\n\t"
"psrlq $6, %%mm4\n\t"
"pand %%mm6, %%mm1\n\t"
"pand %%mm6, %%mm4\n\t"
"psrlq $19, %%mm2\n\t"
"psrlq $19, %%mm5\n\t"
"pand %2, %%mm2\n\t"
"pand %2, %%mm5\n\t"
"por %%mm1, %%mm0\n\t"
"por %%mm4, %%mm3\n\t"
"por %%mm2, %%mm0\n\t"
"por %%mm5, %%mm3\n\t"
"psllq $16, %%mm3\n\t"
"por %%mm3, %%mm0\n\t"
MOVNTQ" %%mm0, %0\n\t"
:"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
d += 4;
s += 12;
}
__asm __volatile(SFENCE:::"memory");
__asm __volatile(EMMS:::"memory");
#endif
while(s < end)
{
const int r= *s++;
const int g= *s++;
const int b= *s++;
*d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
}
}
|
{
"code": [
"static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size)"
],
"line_no": [
1
]
}
|
static inline void FUNC_0(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size)
{
const uint8_t *VAR_0 = src;
const uint8_t *VAR_1;
#ifdef HAVE_MMX
const uint8_t *mm_end;
#endif
uint16_t *d = (uint16_t *)dst;
VAR_1 = VAR_0 + src_size;
#ifdef HAVE_MMX
__asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm __volatile(
"movq %0, %%mm7\n\t"
"movq %1, %%mm6\n\t"
::"m"(red_15mask),"m"(green_15mask));
mm_end = VAR_1 - 15;
while(VAR_0 < mm_end)
{
__asm __volatile(
PREFETCH" 32%1\n\t"
"movd %1, %%mm0\n\t"
"movd 3%1, %%mm3\n\t"
"punpckldq 6%1, %%mm0\n\t"
"punpckldq 9%1, %%mm3\n\t"
"movq %%mm0, %%mm1\n\t"
"movq %%mm0, %%mm2\n\t"
"movq %%mm3, %%mm4\n\t"
"movq %%mm3, %%mm5\n\t"
"psllq $7, %%mm0\n\t"
"psllq $7, %%mm3\n\t"
"pand %%mm7, %%mm0\n\t"
"pand %%mm7, %%mm3\n\t"
"psrlq $6, %%mm1\n\t"
"psrlq $6, %%mm4\n\t"
"pand %%mm6, %%mm1\n\t"
"pand %%mm6, %%mm4\n\t"
"psrlq $19, %%mm2\n\t"
"psrlq $19, %%mm5\n\t"
"pand %2, %%mm2\n\t"
"pand %2, %%mm5\n\t"
"por %%mm1, %%mm0\n\t"
"por %%mm4, %%mm3\n\t"
"por %%mm2, %%mm0\n\t"
"por %%mm5, %%mm3\n\t"
"psllq $16, %%mm3\n\t"
"por %%mm3, %%mm0\n\t"
MOVNTQ" %%mm0, %0\n\t"
:"=m"(*d):"m"(*VAR_0),"m"(blue_15mask):"memory");
d += 4;
VAR_0 += 12;
}
__asm __volatile(SFENCE:::"memory");
__asm __volatile(EMMS:::"memory");
#endif
while(VAR_0 < VAR_1)
{
const int VAR_2= *VAR_0++;
const int VAR_3= *VAR_0++;
const int VAR_4= *VAR_0++;
*d++ = (VAR_4>>3) | ((VAR_3&0xF8)<<2) | ((VAR_2&0xF8)<<7);
}
}
|
[
"static inline void FUNC_0(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size)\n{",
"const uint8_t *VAR_0 = src;",
"const uint8_t *VAR_1;",
"#ifdef HAVE_MMX\nconst uint8_t *mm_end;",
"#endif\nuint16_t *d = (uint16_t *)dst;",
"VAR_1 = VAR_0 + src_size;",
"#ifdef HAVE_MMX\n__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*src):\"memory\");",
"__asm __volatile(\n\"movq\t%0, %%mm7\\n\\t\"\n\"movq\t%1, %%mm6\\n\\t\"\n::\"m\"(red_15mask),\"m\"(green_15mask));",
"mm_end = VAR_1 - 15;",
"while(VAR_0 < mm_end)\n{",
"__asm __volatile(\nPREFETCH\" 32%1\\n\\t\"\n\"movd\t%1, %%mm0\\n\\t\"\n\"movd\t3%1, %%mm3\\n\\t\"\n\"punpckldq 6%1, %%mm0\\n\\t\"\n\"punpckldq 9%1, %%mm3\\n\\t\"\n\"movq\t%%mm0, %%mm1\\n\\t\"\n\"movq\t%%mm0, %%mm2\\n\\t\"\n\"movq\t%%mm3, %%mm4\\n\\t\"\n\"movq\t%%mm3, %%mm5\\n\\t\"\n\"psllq\t$7, %%mm0\\n\\t\"\n\"psllq\t$7, %%mm3\\n\\t\"\n\"pand\t%%mm7, %%mm0\\n\\t\"\n\"pand\t%%mm7, %%mm3\\n\\t\"\n\"psrlq\t$6, %%mm1\\n\\t\"\n\"psrlq\t$6, %%mm4\\n\\t\"\n\"pand\t%%mm6, %%mm1\\n\\t\"\n\"pand\t%%mm6, %%mm4\\n\\t\"\n\"psrlq\t$19, %%mm2\\n\\t\"\n\"psrlq\t$19, %%mm5\\n\\t\"\n\"pand\t%2, %%mm2\\n\\t\"\n\"pand\t%2, %%mm5\\n\\t\"\n\"por\t%%mm1, %%mm0\\n\\t\"\n\"por\t%%mm4, %%mm3\\n\\t\"\n\"por\t%%mm2, %%mm0\\n\\t\"\n\"por\t%%mm5, %%mm3\\n\\t\"\n\"psllq\t$16, %%mm3\\n\\t\"\n\"por\t%%mm3, %%mm0\\n\\t\"\nMOVNTQ\"\t%%mm0, %0\\n\\t\"\n:\"=m\"(*d):\"m\"(*VAR_0),\"m\"(blue_15mask):\"memory\");",
"d += 4;",
"VAR_0 += 12;",
"}",
"__asm __volatile(SFENCE:::\"memory\");",
"__asm __volatile(EMMS:::\"memory\");",
"#endif\nwhile(VAR_0 < VAR_1)\n{",
"const int VAR_2= *VAR_0++;",
"const int VAR_3= *VAR_0++;",
"const int VAR_4= *VAR_0++;",
"*d++ = (VAR_4>>3) | ((VAR_3&0xF8)<<2) | ((VAR_2&0xF8)<<7);",
"}",
"}"
] |
[
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,
15
],
[
17
],
[
19,
21
],
[
23,
25,
27,
29
],
[
31
],
[
33,
35
],
[
37,
39,
41,
43,
45,
47,
49,
51,
53,
55,
57,
59,
61,
63,
65,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91,
93,
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107,
109,
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
]
] |
17,399
|
static void read_tree(GetBitContext *gb, Tree *tree)
{
uint8_t tmp1[16], tmp2[16], *in = tmp1, *out = tmp2;
int i, t, len;
tree->vlc_num = get_bits(gb, 4);
if (!tree->vlc_num) {
for (i = 0; i < 16; i++)
tree->syms[i] = i;
return;
}
if (get_bits1(gb)) {
len = get_bits(gb, 3);
memset(tmp1, 0, sizeof(tmp1));
for (i = 0; i <= len; i++) {
tree->syms[i] = get_bits(gb, 4);
tmp1[tree->syms[i]] = 1;
}
for (i = 0; i < 16; i++)
if (!tmp1[i])
tree->syms[++len] = i;
} else {
len = get_bits(gb, 2);
for (i = 0; i < 16; i++)
in[i] = i;
for (i = 0; i <= len; i++) {
int size = 1 << i;
for (t = 0; t < 16; t += size << 1)
merge(gb, out + t, in + t, size);
FFSWAP(uint8_t*, in, out);
}
memcpy(tree->syms, in, 16);
}
}
| true
|
FFmpeg
|
254af56dd101bc756194dd080bb99e8f123500dd
|
static void read_tree(GetBitContext *gb, Tree *tree)
{
uint8_t tmp1[16], tmp2[16], *in = tmp1, *out = tmp2;
int i, t, len;
tree->vlc_num = get_bits(gb, 4);
if (!tree->vlc_num) {
for (i = 0; i < 16; i++)
tree->syms[i] = i;
return;
}
if (get_bits1(gb)) {
len = get_bits(gb, 3);
memset(tmp1, 0, sizeof(tmp1));
for (i = 0; i <= len; i++) {
tree->syms[i] = get_bits(gb, 4);
tmp1[tree->syms[i]] = 1;
}
for (i = 0; i < 16; i++)
if (!tmp1[i])
tree->syms[++len] = i;
} else {
len = get_bits(gb, 2);
for (i = 0; i < 16; i++)
in[i] = i;
for (i = 0; i <= len; i++) {
int size = 1 << i;
for (t = 0; t < 16; t += size << 1)
merge(gb, out + t, in + t, size);
FFSWAP(uint8_t*, in, out);
}
memcpy(tree->syms, in, 16);
}
}
|
{
"code": [
" for (i = 0; i < 16; i++)"
],
"line_no": [
15
]
}
|
static void FUNC_0(GetBitContext *VAR_0, Tree *VAR_1)
{
uint8_t tmp1[16], tmp2[16], *in = tmp1, *out = tmp2;
int VAR_2, VAR_3, VAR_4;
VAR_1->vlc_num = get_bits(VAR_0, 4);
if (!VAR_1->vlc_num) {
for (VAR_2 = 0; VAR_2 < 16; VAR_2++)
VAR_1->syms[VAR_2] = VAR_2;
return;
}
if (get_bits1(VAR_0)) {
VAR_4 = get_bits(VAR_0, 3);
memset(tmp1, 0, sizeof(tmp1));
for (VAR_2 = 0; VAR_2 <= VAR_4; VAR_2++) {
VAR_1->syms[VAR_2] = get_bits(VAR_0, 4);
tmp1[VAR_1->syms[VAR_2]] = 1;
}
for (VAR_2 = 0; VAR_2 < 16; VAR_2++)
if (!tmp1[VAR_2])
VAR_1->syms[++VAR_4] = VAR_2;
} else {
VAR_4 = get_bits(VAR_0, 2);
for (VAR_2 = 0; VAR_2 < 16; VAR_2++)
in[VAR_2] = VAR_2;
for (VAR_2 = 0; VAR_2 <= VAR_4; VAR_2++) {
int VAR_5 = 1 << VAR_2;
for (VAR_3 = 0; VAR_3 < 16; VAR_3 += VAR_5 << 1)
merge(VAR_0, out + VAR_3, in + VAR_3, VAR_5);
FFSWAP(uint8_t*, in, out);
}
memcpy(VAR_1->syms, in, 16);
}
}
|
[
"static void FUNC_0(GetBitContext *VAR_0, Tree *VAR_1)\n{",
"uint8_t tmp1[16], tmp2[16], *in = tmp1, *out = tmp2;",
"int VAR_2, VAR_3, VAR_4;",
"VAR_1->vlc_num = get_bits(VAR_0, 4);",
"if (!VAR_1->vlc_num) {",
"for (VAR_2 = 0; VAR_2 < 16; VAR_2++)",
"VAR_1->syms[VAR_2] = VAR_2;",
"return;",
"}",
"if (get_bits1(VAR_0)) {",
"VAR_4 = get_bits(VAR_0, 3);",
"memset(tmp1, 0, sizeof(tmp1));",
"for (VAR_2 = 0; VAR_2 <= VAR_4; VAR_2++) {",
"VAR_1->syms[VAR_2] = get_bits(VAR_0, 4);",
"tmp1[VAR_1->syms[VAR_2]] = 1;",
"}",
"for (VAR_2 = 0; VAR_2 < 16; VAR_2++)",
"if (!tmp1[VAR_2])\nVAR_1->syms[++VAR_4] = VAR_2;",
"} else {",
"VAR_4 = get_bits(VAR_0, 2);",
"for (VAR_2 = 0; VAR_2 < 16; VAR_2++)",
"in[VAR_2] = VAR_2;",
"for (VAR_2 = 0; VAR_2 <= VAR_4; VAR_2++) {",
"int VAR_5 = 1 << VAR_2;",
"for (VAR_3 = 0; VAR_3 < 16; VAR_3 += VAR_5 << 1)",
"merge(VAR_0, out + VAR_3, in + VAR_3, VAR_5);",
"FFSWAP(uint8_t*, in, out);",
"}",
"memcpy(VAR_1->syms, in, 16);",
"}",
"}"
] |
[
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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39,
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
]
] |
17,400
|
uint32_t ide_data_readl(void *opaque, uint32_t addr)
{
IDEBus *bus = opaque;
IDEState *s = idebus_active_if(bus);
uint8_t *p;
int ret;
/* PIO data access allowed only when DRQ bit is set. The result of a read
* during PIO in is indeterminate, return 0 and don't move forward. */
if (!(s->status & DRQ_STAT) || !ide_is_pio_out(s)) {
p = s->data_ptr;
ret = cpu_to_le32(*(uint32_t *)p);
p += 4;
s->data_ptr = p;
if (p >= s->data_end)
s->end_transfer_func(s);
return ret;
| true
|
qemu
|
d2ff85854512574e7209f295e87b0835d5b032c6
|
uint32_t ide_data_readl(void *opaque, uint32_t addr)
{
IDEBus *bus = opaque;
IDEState *s = idebus_active_if(bus);
uint8_t *p;
int ret;
if (!(s->status & DRQ_STAT) || !ide_is_pio_out(s)) {
p = s->data_ptr;
ret = cpu_to_le32(*(uint32_t *)p);
p += 4;
s->data_ptr = p;
if (p >= s->data_end)
s->end_transfer_func(s);
return ret;
|
{
"code": [],
"line_no": []
}
|
uint32_t FUNC_0(void *opaque, uint32_t addr)
{
IDEBus *bus = opaque;
IDEState *s = idebus_active_if(bus);
uint8_t *p;
int VAR_0;
if (!(s->status & DRQ_STAT) || !ide_is_pio_out(s)) {
p = s->data_ptr;
VAR_0 = cpu_to_le32(*(uint32_t *)p);
p += 4;
s->data_ptr = p;
if (p >= s->data_end)
s->end_transfer_func(s);
return VAR_0;
|
[
"uint32_t FUNC_0(void *opaque, uint32_t addr)\n{",
"IDEBus *bus = opaque;",
"IDEState *s = idebus_active_if(bus);",
"uint8_t *p;",
"int VAR_0;",
"if (!(s->status & DRQ_STAT) || !ide_is_pio_out(s)) {",
"p = s->data_ptr;",
"VAR_0 = cpu_to_le32(*(uint32_t *)p);",
"p += 4;",
"s->data_ptr = p;",
"if (p >= s->data_end)\ns->end_transfer_func(s);",
"return VAR_0;"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
2
],
[
3
],
[
4
],
[
5
],
[
6
],
[
9
],
[
10
],
[
11
],
[
12
],
[
13
],
[
14,
15
],
[
16
]
] |
17,401
|
void do_commit(Monitor *mon, const QDict *qdict)
{
const char *device = qdict_get_str(qdict, "device");
BlockDriverState *bs;
if (!strcmp(device, "all")) {
bdrv_commit_all();
} else {
int ret;
bs = bdrv_find(device);
if (!bs) {
qerror_report(QERR_DEVICE_NOT_FOUND, device);
return;
}
ret = bdrv_commit(bs);
if (ret == -EBUSY) {
qerror_report(QERR_DEVICE_IN_USE, device);
return;
}
}
}
| true
|
qemu
|
e88774971c33671477c9eb4a4cf1e65a047c9838
|
void do_commit(Monitor *mon, const QDict *qdict)
{
const char *device = qdict_get_str(qdict, "device");
BlockDriverState *bs;
if (!strcmp(device, "all")) {
bdrv_commit_all();
} else {
int ret;
bs = bdrv_find(device);
if (!bs) {
qerror_report(QERR_DEVICE_NOT_FOUND, device);
return;
}
ret = bdrv_commit(bs);
if (ret == -EBUSY) {
qerror_report(QERR_DEVICE_IN_USE, device);
return;
}
}
}
|
{
"code": [
" bdrv_commit_all();",
" int ret;"
],
"line_no": [
13,
17
]
}
|
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)
{
const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2");
BlockDriverState *bs;
if (!strcmp(VAR_2, "all")) {
bdrv_commit_all();
} else {
int VAR_3;
bs = bdrv_find(VAR_2);
if (!bs) {
qerror_report(QERR_DEVICE_NOT_FOUND, VAR_2);
return;
}
VAR_3 = bdrv_commit(bs);
if (VAR_3 == -EBUSY) {
qerror_report(QERR_DEVICE_IN_USE, VAR_2);
return;
}
}
}
|
[
"void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{",
"const char *VAR_2 = qdict_get_str(VAR_1, \"VAR_2\");",
"BlockDriverState *bs;",
"if (!strcmp(VAR_2, \"all\")) {",
"bdrv_commit_all();",
"} else {",
"int VAR_3;",
"bs = bdrv_find(VAR_2);",
"if (!bs) {",
"qerror_report(QERR_DEVICE_NOT_FOUND, VAR_2);",
"return;",
"}",
"VAR_3 = bdrv_commit(bs);",
"if (VAR_3 == -EBUSY) {",
"qerror_report(QERR_DEVICE_IN_USE, VAR_2);",
"return;",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
]
] |
17,403
|
void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
{
void (*start_frame)(AVFilterLink *, AVFilterPicRef *);
AVFilterPad *dst = &link_dpad(link);
if(!(start_frame = dst->start_frame))
start_frame = avfilter_default_start_frame;
/* prepare to copy the picture if it has insufficient permissions */
if((dst->min_perms & picref->perms) != dst->min_perms ||
dst->rej_perms & picref->perms) {
/*
av_log(link->dst, AV_LOG_INFO,
"frame copy needed (have perms %x, need %x, reject %x)\n",
picref->perms,
link_dpad(link).min_perms, link_dpad(link).rej_perms);
*/
link->cur_pic = avfilter_default_get_video_buffer(link, dst->min_perms);
link->srcpic = picref;
link->cur_pic->pts = link->srcpic->pts;
}
else
link->cur_pic = picref;
start_frame(link, link->cur_pic);
}
| true
|
FFmpeg
|
fe479c9d63f0743fa064ac2a5c019284ba88277a
|
void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
{
void (*start_frame)(AVFilterLink *, AVFilterPicRef *);
AVFilterPad *dst = &link_dpad(link);
if(!(start_frame = dst->start_frame))
start_frame = avfilter_default_start_frame;
if((dst->min_perms & picref->perms) != dst->min_perms ||
dst->rej_perms & picref->perms) {
link->cur_pic = avfilter_default_get_video_buffer(link, dst->min_perms);
link->srcpic = picref;
link->cur_pic->pts = link->srcpic->pts;
}
else
link->cur_pic = picref;
start_frame(link, link->cur_pic);
}
|
{
"code": [],
"line_no": []
}
|
VAR_4voidVAR_4 VAR_4avfilter_start_frameVAR_4(VAR_4AVFilterLinkVAR_4 *VAR_4VAR_0VAR_4, VAR_4AVFilterPicRefVAR_4 *VAR_4VAR_1VAR_4)
{
VAR_4voidVAR_4 (*VAR_4VAR_2VAR_4)(VAR_4AVFilterLinkVAR_4 *, VAR_4AVFilterPicRefVAR_4 *);
VAR_4AVFilterPadVAR_4 *VAR_4dstVAR_4 = &VAR_4link_dpadVAR_4(VAR_4VAR_0VAR_4);
VAR_4ifVAR_4(!(VAR_4VAR_2VAR_4 = VAR_4dstVAR_4->VAR_4VAR_2VAR_4))
VAR_4VAR_2VAR_4 = VAR_4avfilter_default_start_frameVAR_4;
VAR_4ifVAR_4((VAR_4dstVAR_4->VAR_4min_permsVAR_4 & VAR_4VAR_1VAR_4->VAR_4permsVAR_4) != VAR_4dstVAR_4->VAR_4min_permsVAR_4 ||
VAR_4dstVAR_4->VAR_4rej_permsVAR_4 & VAR_4VAR_1VAR_4->VAR_4permsVAR_4) {
VAR_4VAR_0VAR_4->VAR_4cur_picVAR_4 = VAR_4avfilter_default_get_video_bufferVAR_4(VAR_4VAR_0VAR_4, VAR_4dstVAR_4->VAR_4min_permsVAR_4);
VAR_4VAR_0VAR_4->VAR_4srcpicVAR_4 = VAR_4VAR_1VAR_4;
VAR_4VAR_0VAR_4->VAR_4cur_picVAR_4->VAR_4ptsVAR_4 = VAR_4VAR_0VAR_4->VAR_4srcpicVAR_4->VAR_4ptsVAR_4;
}
VAR_4elseVAR_4
VAR_4VAR_0VAR_4->VAR_4cur_picVAR_4 = VAR_4VAR_1VAR_4;
VAR_4VAR_2VAR_4(VAR_4VAR_0VAR_4, VAR_4VAR_0VAR_4->VAR_4cur_picVAR_4);
}
|
[
"VAR_4voidVAR_4 VAR_4avfilter_start_frameVAR_4(VAR_4AVFilterLinkVAR_4 *VAR_4VAR_0VAR_4, VAR_4AVFilterPicRefVAR_4 *VAR_4VAR_1VAR_4)\n{",
"VAR_4voidVAR_4 (*VAR_4VAR_2VAR_4)(VAR_4AVFilterLinkVAR_4 *, VAR_4AVFilterPicRefVAR_4 *);",
"VAR_4AVFilterPadVAR_4 *VAR_4dstVAR_4 = &VAR_4link_dpadVAR_4(VAR_4VAR_0VAR_4);",
"VAR_4ifVAR_4(!(VAR_4VAR_2VAR_4 = VAR_4dstVAR_4->VAR_4VAR_2VAR_4))\nVAR_4VAR_2VAR_4 = VAR_4avfilter_default_start_frameVAR_4;",
"VAR_4ifVAR_4((VAR_4dstVAR_4->VAR_4min_permsVAR_4 & VAR_4VAR_1VAR_4->VAR_4permsVAR_4) != VAR_4dstVAR_4->VAR_4min_permsVAR_4 ||\nVAR_4dstVAR_4->VAR_4rej_permsVAR_4 & VAR_4VAR_1VAR_4->VAR_4permsVAR_4) {",
"VAR_4VAR_0VAR_4->VAR_4cur_picVAR_4 = VAR_4avfilter_default_get_video_bufferVAR_4(VAR_4VAR_0VAR_4, VAR_4dstVAR_4->VAR_4min_permsVAR_4);",
"VAR_4VAR_0VAR_4->VAR_4srcpicVAR_4 = VAR_4VAR_1VAR_4;",
"VAR_4VAR_0VAR_4->VAR_4cur_picVAR_4->VAR_4ptsVAR_4 = VAR_4VAR_0VAR_4->VAR_4srcpicVAR_4->VAR_4ptsVAR_4;",
"}",
"VAR_4elseVAR_4\nVAR_4VAR_0VAR_4->VAR_4cur_picVAR_4 = VAR_4VAR_1VAR_4;",
"VAR_4VAR_2VAR_4(VAR_4VAR_0VAR_4, VAR_4VAR_0VAR_4->VAR_4cur_picVAR_4);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11,
13
],
[
19,
21
],
[
37
],
[
39
],
[
41
],
[
44
],
[
46,
48
],
[
52
],
[
54
]
] |
17,404
|
static void ffserver_apply_stream_config(AVCodecContext *enc, const AVDictionary *conf, AVDictionary **opts)
{
AVDictionaryEntry *e;
/* Return values from ffserver_set_*_param are ignored.
Values are initially parsed and checked before inserting to
AVDictionary. */
//video params
if ((e = av_dict_get(conf, "VideoBitRateRangeMin", NULL, 0)))
ffserver_set_int_param(&enc->rc_min_rate, e->value, 1000, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoBitRateRangeMax", NULL, 0)))
ffserver_set_int_param(&enc->rc_max_rate, e->value, 1000, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "Debug", NULL, 0)))
ffserver_set_int_param(&enc->debug, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(conf, "Strict", NULL, 0)))
ffserver_set_int_param(&enc->strict_std_compliance, e->value, 0,
INT_MIN, INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoBufferSize", NULL, 0)))
ffserver_set_int_param(&enc->rc_buffer_size, e->value, 8*1024,
INT_MIN, INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoBitRateTolerance", NULL, 0)))
ffserver_set_int_param(&enc->bit_rate_tolerance, e->value, 1000,
INT_MIN, INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoBitRate", NULL, 0)))
ffserver_set_int_param(&enc->bit_rate, e->value, 1000, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoSizeWidth", NULL, 0)))
ffserver_set_int_param(&enc->width, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoSizeHeight", NULL, 0)))
ffserver_set_int_param(&enc->height, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(conf, "PixelFormat", NULL, 0))) {
int val;
ffserver_set_int_param(&val, e->value, 0, INT_MIN, INT_MAX, NULL, 0,
NULL);
enc->pix_fmt = val;
}
if ((e = av_dict_get(conf, "VideoGopSize", NULL, 0)))
ffserver_set_int_param(&enc->gop_size, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoFrameRateNum", NULL, 0)))
ffserver_set_int_param(&enc->time_base.num, e->value, 0, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoFrameRateDen", NULL, 0)))
ffserver_set_int_param(&enc->time_base.den, e->value, 0, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoQDiff", NULL, 0)))
ffserver_set_int_param(&enc->max_qdiff, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoQMax", NULL, 0)))
ffserver_set_int_param(&enc->qmax, e->value, 0, INT_MIN, INT_MAX, NULL,
0, NULL);
if ((e = av_dict_get(conf, "VideoQMin", NULL, 0)))
ffserver_set_int_param(&enc->qmin, e->value, 0, INT_MIN, INT_MAX, NULL,
0, NULL);
if ((e = av_dict_get(conf, "LumiMask", NULL, 0)))
ffserver_set_float_param(&enc->lumi_masking, e->value, 0, -FLT_MAX,
FLT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "DarkMask", NULL, 0)))
ffserver_set_float_param(&enc->dark_masking, e->value, 0, -FLT_MAX,
FLT_MAX, NULL, 0, NULL);
if (av_dict_get(conf, "BitExact", NULL, 0))
enc->flags |= CODEC_FLAG_BITEXACT;
if (av_dict_get(conf, "DctFastint", NULL, 0))
enc->dct_algo = FF_DCT_FASTINT;
if (av_dict_get(conf, "IdctSimple", NULL, 0))
enc->idct_algo = FF_IDCT_SIMPLE;
if (av_dict_get(conf, "VideoHighQuality", NULL, 0))
enc->mb_decision = FF_MB_DECISION_BITS;
if ((e = av_dict_get(conf, "VideoTag", NULL, 0)))
enc->codec_tag = MKTAG(e->value[0], e->value[1], e->value[2], e->value[3]);
if (av_dict_get(conf, "Qscale", NULL, 0)) {
enc->flags |= CODEC_FLAG_QSCALE;
ffserver_set_int_param(&enc->global_quality, e->value, FF_QP2LAMBDA,
INT_MIN, INT_MAX, NULL, 0, NULL);
}
if (av_dict_get(conf, "Video4MotionVector", NULL, 0)) {
enc->mb_decision = FF_MB_DECISION_BITS; //FIXME remove
enc->flags |= CODEC_FLAG_4MV;
}
//audio params
if ((e = av_dict_get(conf, "AudioChannels", NULL, 0)))
ffserver_set_int_param(&enc->channels, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(conf, "AudioSampleRate", NULL, 0)))
ffserver_set_int_param(&enc->sample_rate, e->value, 0, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "AudioBitRate", NULL, 0)))
ffserver_set_int_param(&enc->bit_rate, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
av_opt_set_dict2(enc->priv_data, opts, AV_OPT_SEARCH_CHILDREN);
av_opt_set_dict2(enc, opts, AV_OPT_SEARCH_CHILDREN);
if (av_dict_count(*opts))
av_log(NULL, AV_LOG_ERROR, "Something went wrong, %d options not set!!!\n", av_dict_count(*opts));
}
| true
|
FFmpeg
|
3f07dd6e392bf35a478203dc60fcbd36dfdd42aa
|
static void ffserver_apply_stream_config(AVCodecContext *enc, const AVDictionary *conf, AVDictionary **opts)
{
AVDictionaryEntry *e;
if ((e = av_dict_get(conf, "VideoBitRateRangeMin", NULL, 0)))
ffserver_set_int_param(&enc->rc_min_rate, e->value, 1000, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoBitRateRangeMax", NULL, 0)))
ffserver_set_int_param(&enc->rc_max_rate, e->value, 1000, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "Debug", NULL, 0)))
ffserver_set_int_param(&enc->debug, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(conf, "Strict", NULL, 0)))
ffserver_set_int_param(&enc->strict_std_compliance, e->value, 0,
INT_MIN, INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoBufferSize", NULL, 0)))
ffserver_set_int_param(&enc->rc_buffer_size, e->value, 8*1024,
INT_MIN, INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoBitRateTolerance", NULL, 0)))
ffserver_set_int_param(&enc->bit_rate_tolerance, e->value, 1000,
INT_MIN, INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoBitRate", NULL, 0)))
ffserver_set_int_param(&enc->bit_rate, e->value, 1000, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoSizeWidth", NULL, 0)))
ffserver_set_int_param(&enc->width, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoSizeHeight", NULL, 0)))
ffserver_set_int_param(&enc->height, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(conf, "PixelFormat", NULL, 0))) {
int val;
ffserver_set_int_param(&val, e->value, 0, INT_MIN, INT_MAX, NULL, 0,
NULL);
enc->pix_fmt = val;
}
if ((e = av_dict_get(conf, "VideoGopSize", NULL, 0)))
ffserver_set_int_param(&enc->gop_size, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoFrameRateNum", NULL, 0)))
ffserver_set_int_param(&enc->time_base.num, e->value, 0, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoFrameRateDen", NULL, 0)))
ffserver_set_int_param(&enc->time_base.den, e->value, 0, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoQDiff", NULL, 0)))
ffserver_set_int_param(&enc->max_qdiff, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(conf, "VideoQMax", NULL, 0)))
ffserver_set_int_param(&enc->qmax, e->value, 0, INT_MIN, INT_MAX, NULL,
0, NULL);
if ((e = av_dict_get(conf, "VideoQMin", NULL, 0)))
ffserver_set_int_param(&enc->qmin, e->value, 0, INT_MIN, INT_MAX, NULL,
0, NULL);
if ((e = av_dict_get(conf, "LumiMask", NULL, 0)))
ffserver_set_float_param(&enc->lumi_masking, e->value, 0, -FLT_MAX,
FLT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "DarkMask", NULL, 0)))
ffserver_set_float_param(&enc->dark_masking, e->value, 0, -FLT_MAX,
FLT_MAX, NULL, 0, NULL);
if (av_dict_get(conf, "BitExact", NULL, 0))
enc->flags |= CODEC_FLAG_BITEXACT;
if (av_dict_get(conf, "DctFastint", NULL, 0))
enc->dct_algo = FF_DCT_FASTINT;
if (av_dict_get(conf, "IdctSimple", NULL, 0))
enc->idct_algo = FF_IDCT_SIMPLE;
if (av_dict_get(conf, "VideoHighQuality", NULL, 0))
enc->mb_decision = FF_MB_DECISION_BITS;
if ((e = av_dict_get(conf, "VideoTag", NULL, 0)))
enc->codec_tag = MKTAG(e->value[0], e->value[1], e->value[2], e->value[3]);
if (av_dict_get(conf, "Qscale", NULL, 0)) {
enc->flags |= CODEC_FLAG_QSCALE;
ffserver_set_int_param(&enc->global_quality, e->value, FF_QP2LAMBDA,
INT_MIN, INT_MAX, NULL, 0, NULL);
}
if (av_dict_get(conf, "Video4MotionVector", NULL, 0)) {
enc->mb_decision = FF_MB_DECISION_BITS;
enc->flags |= CODEC_FLAG_4MV;
}
if ((e = av_dict_get(conf, "AudioChannels", NULL, 0)))
ffserver_set_int_param(&enc->channels, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(conf, "AudioSampleRate", NULL, 0)))
ffserver_set_int_param(&enc->sample_rate, e->value, 0, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(conf, "AudioBitRate", NULL, 0)))
ffserver_set_int_param(&enc->bit_rate, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
av_opt_set_dict2(enc->priv_data, opts, AV_OPT_SEARCH_CHILDREN);
av_opt_set_dict2(enc, opts, AV_OPT_SEARCH_CHILDREN);
if (av_dict_count(*opts))
av_log(NULL, AV_LOG_ERROR, "Something went wrong, %d options not set!!!\n", av_dict_count(*opts));
}
|
{
"code": [
" if (av_dict_get(conf, \"Qscale\", NULL, 0)) {"
],
"line_no": [
153
]
}
|
static void FUNC_0(AVCodecContext *VAR_0, const AVDictionary *VAR_1, AVDictionary **VAR_2)
{
AVDictionaryEntry *e;
if ((e = av_dict_get(VAR_1, "VideoBitRateRangeMin", NULL, 0)))
ffserver_set_int_param(&VAR_0->rc_min_rate, e->value, 1000, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "VideoBitRateRangeMax", NULL, 0)))
ffserver_set_int_param(&VAR_0->rc_max_rate, e->value, 1000, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "Debug", NULL, 0)))
ffserver_set_int_param(&VAR_0->debug, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "Strict", NULL, 0)))
ffserver_set_int_param(&VAR_0->strict_std_compliance, e->value, 0,
INT_MIN, INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "VideoBufferSize", NULL, 0)))
ffserver_set_int_param(&VAR_0->rc_buffer_size, e->value, 8*1024,
INT_MIN, INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "VideoBitRateTolerance", NULL, 0)))
ffserver_set_int_param(&VAR_0->bit_rate_tolerance, e->value, 1000,
INT_MIN, INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "VideoBitRate", NULL, 0)))
ffserver_set_int_param(&VAR_0->bit_rate, e->value, 1000, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "VideoSizeWidth", NULL, 0)))
ffserver_set_int_param(&VAR_0->width, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "VideoSizeHeight", NULL, 0)))
ffserver_set_int_param(&VAR_0->height, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "PixelFormat", NULL, 0))) {
int VAR_3;
ffserver_set_int_param(&VAR_3, e->value, 0, INT_MIN, INT_MAX, NULL, 0,
NULL);
VAR_0->pix_fmt = VAR_3;
}
if ((e = av_dict_get(VAR_1, "VideoGopSize", NULL, 0)))
ffserver_set_int_param(&VAR_0->gop_size, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "VideoFrameRateNum", NULL, 0)))
ffserver_set_int_param(&VAR_0->time_base.num, e->value, 0, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "VideoFrameRateDen", NULL, 0)))
ffserver_set_int_param(&VAR_0->time_base.den, e->value, 0, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "VideoQDiff", NULL, 0)))
ffserver_set_int_param(&VAR_0->max_qdiff, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "VideoQMax", NULL, 0)))
ffserver_set_int_param(&VAR_0->qmax, e->value, 0, INT_MIN, INT_MAX, NULL,
0, NULL);
if ((e = av_dict_get(VAR_1, "VideoQMin", NULL, 0)))
ffserver_set_int_param(&VAR_0->qmin, e->value, 0, INT_MIN, INT_MAX, NULL,
0, NULL);
if ((e = av_dict_get(VAR_1, "LumiMask", NULL, 0)))
ffserver_set_float_param(&VAR_0->lumi_masking, e->value, 0, -FLT_MAX,
FLT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "DarkMask", NULL, 0)))
ffserver_set_float_param(&VAR_0->dark_masking, e->value, 0, -FLT_MAX,
FLT_MAX, NULL, 0, NULL);
if (av_dict_get(VAR_1, "BitExact", NULL, 0))
VAR_0->flags |= CODEC_FLAG_BITEXACT;
if (av_dict_get(VAR_1, "DctFastint", NULL, 0))
VAR_0->dct_algo = FF_DCT_FASTINT;
if (av_dict_get(VAR_1, "IdctSimple", NULL, 0))
VAR_0->idct_algo = FF_IDCT_SIMPLE;
if (av_dict_get(VAR_1, "VideoHighQuality", NULL, 0))
VAR_0->mb_decision = FF_MB_DECISION_BITS;
if ((e = av_dict_get(VAR_1, "VideoTag", NULL, 0)))
VAR_0->codec_tag = MKTAG(e->value[0], e->value[1], e->value[2], e->value[3]);
if (av_dict_get(VAR_1, "Qscale", NULL, 0)) {
VAR_0->flags |= CODEC_FLAG_QSCALE;
ffserver_set_int_param(&VAR_0->global_quality, e->value, FF_QP2LAMBDA,
INT_MIN, INT_MAX, NULL, 0, NULL);
}
if (av_dict_get(VAR_1, "Video4MotionVector", NULL, 0)) {
VAR_0->mb_decision = FF_MB_DECISION_BITS;
VAR_0->flags |= CODEC_FLAG_4MV;
}
if ((e = av_dict_get(VAR_1, "AudioChannels", NULL, 0)))
ffserver_set_int_param(&VAR_0->channels, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "AudioSampleRate", NULL, 0)))
ffserver_set_int_param(&VAR_0->sample_rate, e->value, 0, INT_MIN,
INT_MAX, NULL, 0, NULL);
if ((e = av_dict_get(VAR_1, "AudioBitRate", NULL, 0)))
ffserver_set_int_param(&VAR_0->bit_rate, e->value, 0, INT_MIN, INT_MAX,
NULL, 0, NULL);
av_opt_set_dict2(VAR_0->priv_data, VAR_2, AV_OPT_SEARCH_CHILDREN);
av_opt_set_dict2(VAR_0, VAR_2, AV_OPT_SEARCH_CHILDREN);
if (av_dict_count(*VAR_2))
av_log(NULL, AV_LOG_ERROR, "Something went wrong, %d options not set!!!\n", av_dict_count(*VAR_2));
}
|
[
"static void FUNC_0(AVCodecContext *VAR_0, const AVDictionary *VAR_1, AVDictionary **VAR_2)\n{",
"AVDictionaryEntry *e;",
"if ((e = av_dict_get(VAR_1, \"VideoBitRateRangeMin\", NULL, 0)))\nffserver_set_int_param(&VAR_0->rc_min_rate, e->value, 1000, INT_MIN,\nINT_MAX, NULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"VideoBitRateRangeMax\", NULL, 0)))\nffserver_set_int_param(&VAR_0->rc_max_rate, e->value, 1000, INT_MIN,\nINT_MAX, NULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"Debug\", NULL, 0)))\nffserver_set_int_param(&VAR_0->debug, e->value, 0, INT_MIN, INT_MAX,\nNULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"Strict\", NULL, 0)))\nffserver_set_int_param(&VAR_0->strict_std_compliance, e->value, 0,\nINT_MIN, INT_MAX, NULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"VideoBufferSize\", NULL, 0)))\nffserver_set_int_param(&VAR_0->rc_buffer_size, e->value, 8*1024,\nINT_MIN, INT_MAX, NULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"VideoBitRateTolerance\", NULL, 0)))\nffserver_set_int_param(&VAR_0->bit_rate_tolerance, e->value, 1000,\nINT_MIN, INT_MAX, NULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"VideoBitRate\", NULL, 0)))\nffserver_set_int_param(&VAR_0->bit_rate, e->value, 1000, INT_MIN,\nINT_MAX, NULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"VideoSizeWidth\", NULL, 0)))\nffserver_set_int_param(&VAR_0->width, e->value, 0, INT_MIN, INT_MAX,\nNULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"VideoSizeHeight\", NULL, 0)))\nffserver_set_int_param(&VAR_0->height, e->value, 0, INT_MIN, INT_MAX,\nNULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"PixelFormat\", NULL, 0))) {",
"int VAR_3;",
"ffserver_set_int_param(&VAR_3, e->value, 0, INT_MIN, INT_MAX, NULL, 0,\nNULL);",
"VAR_0->pix_fmt = VAR_3;",
"}",
"if ((e = av_dict_get(VAR_1, \"VideoGopSize\", NULL, 0)))\nffserver_set_int_param(&VAR_0->gop_size, e->value, 0, INT_MIN, INT_MAX,\nNULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"VideoFrameRateNum\", NULL, 0)))\nffserver_set_int_param(&VAR_0->time_base.num, e->value, 0, INT_MIN,\nINT_MAX, NULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"VideoFrameRateDen\", NULL, 0)))\nffserver_set_int_param(&VAR_0->time_base.den, e->value, 0, INT_MIN,\nINT_MAX, NULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"VideoQDiff\", NULL, 0)))\nffserver_set_int_param(&VAR_0->max_qdiff, e->value, 0, INT_MIN, INT_MAX,\nNULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"VideoQMax\", NULL, 0)))\nffserver_set_int_param(&VAR_0->qmax, e->value, 0, INT_MIN, INT_MAX, NULL,\n0, NULL);",
"if ((e = av_dict_get(VAR_1, \"VideoQMin\", NULL, 0)))\nffserver_set_int_param(&VAR_0->qmin, e->value, 0, INT_MIN, INT_MAX, NULL,\n0, NULL);",
"if ((e = av_dict_get(VAR_1, \"LumiMask\", NULL, 0)))\nffserver_set_float_param(&VAR_0->lumi_masking, e->value, 0, -FLT_MAX,\nFLT_MAX, NULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"DarkMask\", NULL, 0)))\nffserver_set_float_param(&VAR_0->dark_masking, e->value, 0, -FLT_MAX,\nFLT_MAX, NULL, 0, NULL);",
"if (av_dict_get(VAR_1, \"BitExact\", NULL, 0))\nVAR_0->flags |= CODEC_FLAG_BITEXACT;",
"if (av_dict_get(VAR_1, \"DctFastint\", NULL, 0))\nVAR_0->dct_algo = FF_DCT_FASTINT;",
"if (av_dict_get(VAR_1, \"IdctSimple\", NULL, 0))\nVAR_0->idct_algo = FF_IDCT_SIMPLE;",
"if (av_dict_get(VAR_1, \"VideoHighQuality\", NULL, 0))\nVAR_0->mb_decision = FF_MB_DECISION_BITS;",
"if ((e = av_dict_get(VAR_1, \"VideoTag\", NULL, 0)))\nVAR_0->codec_tag = MKTAG(e->value[0], e->value[1], e->value[2], e->value[3]);",
"if (av_dict_get(VAR_1, \"Qscale\", NULL, 0)) {",
"VAR_0->flags |= CODEC_FLAG_QSCALE;",
"ffserver_set_int_param(&VAR_0->global_quality, e->value, FF_QP2LAMBDA,\nINT_MIN, INT_MAX, NULL, 0, NULL);",
"}",
"if (av_dict_get(VAR_1, \"Video4MotionVector\", NULL, 0)) {",
"VAR_0->mb_decision = FF_MB_DECISION_BITS;",
"VAR_0->flags |= CODEC_FLAG_4MV;",
"}",
"if ((e = av_dict_get(VAR_1, \"AudioChannels\", NULL, 0)))\nffserver_set_int_param(&VAR_0->channels, e->value, 0, INT_MIN, INT_MAX,\nNULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"AudioSampleRate\", NULL, 0)))\nffserver_set_int_param(&VAR_0->sample_rate, e->value, 0, INT_MIN,\nINT_MAX, NULL, 0, NULL);",
"if ((e = av_dict_get(VAR_1, \"AudioBitRate\", NULL, 0)))\nffserver_set_int_param(&VAR_0->bit_rate, e->value, 0, INT_MIN, INT_MAX,\nNULL, 0, NULL);",
"av_opt_set_dict2(VAR_0->priv_data, VAR_2, AV_OPT_SEARCH_CHILDREN);",
"av_opt_set_dict2(VAR_0, VAR_2, AV_OPT_SEARCH_CHILDREN);",
"if (av_dict_count(*VAR_2))\nav_log(NULL, AV_LOG_ERROR, \"Something went wrong, %d options not set!!!\\n\", av_dict_count(*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,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
19,
21,
23
],
[
25,
27,
29
],
[
31,
33,
35
],
[
37,
39,
41
],
[
43,
45,
47
],
[
49,
51,
53
],
[
55,
57,
59
],
[
61,
63,
65
],
[
67,
69,
71
],
[
73
],
[
75
],
[
77,
79
],
[
81
],
[
83
],
[
85,
87,
89
],
[
91,
93,
95
],
[
97,
99,
101
],
[
103,
105,
107
],
[
109,
111,
113
],
[
115,
117,
119
],
[
121,
123,
125
],
[
127,
129,
131
],
[
133,
135
],
[
137,
139
],
[
141,
143
],
[
145,
147
],
[
149,
151
],
[
153
],
[
155
],
[
157,
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
173,
175,
177
],
[
179,
181,
183
],
[
185,
187,
189
],
[
193
],
[
195
],
[
199,
201
],
[
203
]
] |
17,405
|
static uint32_t grlib_gptimer_readl(void *opaque, target_phys_addr_t addr)
{
GPTimerUnit *unit = opaque;
target_phys_addr_t timer_addr;
int id;
uint32_t value = 0;
addr &= 0xff;
/* Unit registers */
switch (addr) {
case SCALER_OFFSET:
trace_grlib_gptimer_readl(-1, "scaler:", unit->scaler);
return unit->scaler;
case SCALER_RELOAD_OFFSET:
trace_grlib_gptimer_readl(-1, "reload:", unit->reload);
return unit->reload;
case CONFIG_OFFSET:
trace_grlib_gptimer_readl(-1, "config:", unit->config);
return unit->config;
default:
break;
}
timer_addr = (addr % TIMER_BASE);
id = (addr - TIMER_BASE) / TIMER_BASE;
if (id >= 0 && id < unit->nr_timers) {
/* GPTimer registers */
switch (timer_addr) {
case COUNTER_OFFSET:
value = ptimer_get_count(unit->timers[id].ptimer);
trace_grlib_gptimer_readl(id, "counter value:", value);
return value;
case COUNTER_RELOAD_OFFSET:
value = unit->timers[id].reload;
trace_grlib_gptimer_readl(id, "reload value:", value);
return value;
case CONFIG_OFFSET:
trace_grlib_gptimer_readl(id, "scaler value:",
unit->timers[id].config);
return unit->timers[id].config;
default:
break;
}
}
trace_grlib_gptimer_unknown_register("read", addr);
return 0;
}
| true
|
qemu
|
b4548fcc0314f5e118ed45b5774e9cd99f9a97d3
|
static uint32_t grlib_gptimer_readl(void *opaque, target_phys_addr_t addr)
{
GPTimerUnit *unit = opaque;
target_phys_addr_t timer_addr;
int id;
uint32_t value = 0;
addr &= 0xff;
switch (addr) {
case SCALER_OFFSET:
trace_grlib_gptimer_readl(-1, "scaler:", unit->scaler);
return unit->scaler;
case SCALER_RELOAD_OFFSET:
trace_grlib_gptimer_readl(-1, "reload:", unit->reload);
return unit->reload;
case CONFIG_OFFSET:
trace_grlib_gptimer_readl(-1, "config:", unit->config);
return unit->config;
default:
break;
}
timer_addr = (addr % TIMER_BASE);
id = (addr - TIMER_BASE) / TIMER_BASE;
if (id >= 0 && id < unit->nr_timers) {
switch (timer_addr) {
case COUNTER_OFFSET:
value = ptimer_get_count(unit->timers[id].ptimer);
trace_grlib_gptimer_readl(id, "counter value:", value);
return value;
case COUNTER_RELOAD_OFFSET:
value = unit->timers[id].reload;
trace_grlib_gptimer_readl(id, "reload value:", value);
return value;
case CONFIG_OFFSET:
trace_grlib_gptimer_readl(id, "scaler value:",
unit->timers[id].config);
return unit->timers[id].config;
default:
break;
}
}
trace_grlib_gptimer_unknown_register("read", addr);
return 0;
}
|
{
"code": [
" trace_grlib_gptimer_readl(-1, \"scaler:\", unit->scaler);",
" trace_grlib_gptimer_readl(-1, \"reload:\", unit->reload);",
" trace_grlib_gptimer_readl(-1, \"config:\", unit->config);",
" trace_grlib_gptimer_readl(id, \"counter value:\", value);",
" trace_grlib_gptimer_readl(id, \"reload value:\", value);",
" trace_grlib_gptimer_readl(id, \"scaler value:\",",
" unit->timers[id].config);",
" trace_grlib_gptimer_unknown_register(\"read\", addr);"
],
"line_no": [
25,
33,
41,
73,
83,
91,
93,
111
]
}
|
static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr)
{
GPTimerUnit *unit = opaque;
target_phys_addr_t timer_addr;
int VAR_0;
uint32_t value = 0;
addr &= 0xff;
switch (addr) {
case SCALER_OFFSET:
trace_grlib_gptimer_readl(-1, "scaler:", unit->scaler);
return unit->scaler;
case SCALER_RELOAD_OFFSET:
trace_grlib_gptimer_readl(-1, "reload:", unit->reload);
return unit->reload;
case CONFIG_OFFSET:
trace_grlib_gptimer_readl(-1, "config:", unit->config);
return unit->config;
default:
break;
}
timer_addr = (addr % TIMER_BASE);
VAR_0 = (addr - TIMER_BASE) / TIMER_BASE;
if (VAR_0 >= 0 && VAR_0 < unit->nr_timers) {
switch (timer_addr) {
case COUNTER_OFFSET:
value = ptimer_get_count(unit->timers[VAR_0].ptimer);
trace_grlib_gptimer_readl(VAR_0, "counter value:", value);
return value;
case COUNTER_RELOAD_OFFSET:
value = unit->timers[VAR_0].reload;
trace_grlib_gptimer_readl(VAR_0, "reload value:", value);
return value;
case CONFIG_OFFSET:
trace_grlib_gptimer_readl(VAR_0, "scaler value:",
unit->timers[VAR_0].config);
return unit->timers[VAR_0].config;
default:
break;
}
}
trace_grlib_gptimer_unknown_register("read", addr);
return 0;
}
|
[
"static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr)\n{",
"GPTimerUnit *unit = opaque;",
"target_phys_addr_t timer_addr;",
"int VAR_0;",
"uint32_t value = 0;",
"addr &= 0xff;",
"switch (addr) {",
"case SCALER_OFFSET:\ntrace_grlib_gptimer_readl(-1, \"scaler:\", unit->scaler);",
"return unit->scaler;",
"case SCALER_RELOAD_OFFSET:\ntrace_grlib_gptimer_readl(-1, \"reload:\", unit->reload);",
"return unit->reload;",
"case CONFIG_OFFSET:\ntrace_grlib_gptimer_readl(-1, \"config:\", unit->config);",
"return unit->config;",
"default:\nbreak;",
"}",
"timer_addr = (addr % TIMER_BASE);",
"VAR_0 = (addr - TIMER_BASE) / TIMER_BASE;",
"if (VAR_0 >= 0 && VAR_0 < unit->nr_timers) {",
"switch (timer_addr) {",
"case COUNTER_OFFSET:\nvalue = ptimer_get_count(unit->timers[VAR_0].ptimer);",
"trace_grlib_gptimer_readl(VAR_0, \"counter value:\", value);",
"return value;",
"case COUNTER_RELOAD_OFFSET:\nvalue = unit->timers[VAR_0].reload;",
"trace_grlib_gptimer_readl(VAR_0, \"reload value:\", value);",
"return value;",
"case CONFIG_OFFSET:\ntrace_grlib_gptimer_readl(VAR_0, \"scaler value:\",\nunit->timers[VAR_0].config);",
"return unit->timers[VAR_0].config;",
"default:\nbreak;",
"}",
"}",
"trace_grlib_gptimer_unknown_register(\"read\", addr);",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
1,
0,
1,
0,
0,
0,
0,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
21
],
[
23,
25
],
[
27
],
[
31,
33
],
[
35
],
[
39,
41
],
[
43
],
[
47,
49
],
[
51
],
[
55
],
[
57
],
[
61
],
[
67
],
[
69,
71
],
[
73
],
[
75
],
[
79,
81
],
[
83
],
[
85
],
[
89,
91,
93
],
[
95
],
[
99,
101
],
[
103
],
[
107
],
[
111
],
[
113
],
[
115
]
] |
17,406
|
static void new_subtitle_stream(AVFormatContext *oc, int file_idx)
{
AVStream *st;
AVOutputStream *ost;
AVCodec *codec=NULL;
AVCodecContext *subtitle_enc;
enum CodecID codec_id;
st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
if (!st) {
fprintf(stderr, "Could not alloc stream\n");
ffmpeg_exit(1);
}
ost = new_output_stream(oc, file_idx);
subtitle_enc = st->codec;
output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
if(!subtitle_stream_copy){
if (subtitle_codec_name) {
codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1,
avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance);
codec= output_codecs[nb_output_codecs-1] = avcodec_find_encoder_by_name(subtitle_codec_name);
} else {
codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_SUBTITLE);
codec = avcodec_find_encoder(codec_id);
}
}
avcodec_get_context_defaults3(st->codec, codec);
ost->bitstream_filters = subtitle_bitstream_filters;
subtitle_bitstream_filters= NULL;
subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
if(subtitle_codec_tag)
subtitle_enc->codec_tag= subtitle_codec_tag;
if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
if (subtitle_stream_copy) {
st->stream_copy = 1;
} else {
subtitle_enc->codec_id = codec_id;
set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);
}
if (subtitle_language) {
av_metadata_set2(&st->metadata, "language", subtitle_language, 0);
av_freep(&subtitle_language);
}
subtitle_disable = 0;
av_freep(&subtitle_codec_name);
subtitle_stream_copy = 0;
}
| true
|
FFmpeg
|
4618637aca3b771b0bfb8fe15f3a080dacf9f0c0
|
static void new_subtitle_stream(AVFormatContext *oc, int file_idx)
{
AVStream *st;
AVOutputStream *ost;
AVCodec *codec=NULL;
AVCodecContext *subtitle_enc;
enum CodecID codec_id;
st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
if (!st) {
fprintf(stderr, "Could not alloc stream\n");
ffmpeg_exit(1);
}
ost = new_output_stream(oc, file_idx);
subtitle_enc = st->codec;
output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
if(!subtitle_stream_copy){
if (subtitle_codec_name) {
codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1,
avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance);
codec= output_codecs[nb_output_codecs-1] = avcodec_find_encoder_by_name(subtitle_codec_name);
} else {
codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_SUBTITLE);
codec = avcodec_find_encoder(codec_id);
}
}
avcodec_get_context_defaults3(st->codec, codec);
ost->bitstream_filters = subtitle_bitstream_filters;
subtitle_bitstream_filters= NULL;
subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
if(subtitle_codec_tag)
subtitle_enc->codec_tag= subtitle_codec_tag;
if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
if (subtitle_stream_copy) {
st->stream_copy = 1;
} else {
subtitle_enc->codec_id = codec_id;
set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);
}
if (subtitle_language) {
av_metadata_set2(&st->metadata, "language", subtitle_language, 0);
av_freep(&subtitle_language);
}
subtitle_disable = 0;
av_freep(&subtitle_codec_name);
subtitle_stream_copy = 0;
}
|
{
"code": [
" enum CodecID codec_id;",
" enum CodecID codec_id;",
" enum CodecID codec_id;"
],
"line_no": [
13,
13,
13
]
}
|
static void FUNC_0(AVFormatContext *VAR_0, int VAR_1)
{
AVStream *st;
AVOutputStream *ost;
AVCodec *codec=NULL;
AVCodecContext *subtitle_enc;
enum CodecID VAR_2;
st = av_new_stream(VAR_0, VAR_0->nb_streams < nb_streamid_map ? streamid_map[VAR_0->nb_streams] : 0);
if (!st) {
fprintf(stderr, "Could not alloc stream\n");
ffmpeg_exit(1);
}
ost = new_output_stream(VAR_0, VAR_1);
subtitle_enc = st->codec;
output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
if(!subtitle_stream_copy){
if (subtitle_codec_name) {
VAR_2 = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1,
avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance);
codec= output_codecs[nb_output_codecs-1] = avcodec_find_encoder_by_name(subtitle_codec_name);
} else {
VAR_2 = av_guess_codec(VAR_0->oformat, NULL, VAR_0->filename, NULL, AVMEDIA_TYPE_SUBTITLE);
codec = avcodec_find_encoder(VAR_2);
}
}
avcodec_get_context_defaults3(st->codec, codec);
ost->bitstream_filters = subtitle_bitstream_filters;
subtitle_bitstream_filters= NULL;
subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
if(subtitle_codec_tag)
subtitle_enc->codec_tag= subtitle_codec_tag;
if (VAR_0->oformat->flags & AVFMT_GLOBALHEADER) {
subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
if (subtitle_stream_copy) {
st->stream_copy = 1;
} else {
subtitle_enc->VAR_2 = VAR_2;
set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);
}
if (subtitle_language) {
av_metadata_set2(&st->metadata, "language", subtitle_language, 0);
av_freep(&subtitle_language);
}
subtitle_disable = 0;
av_freep(&subtitle_codec_name);
subtitle_stream_copy = 0;
}
|
[
"static void FUNC_0(AVFormatContext *VAR_0, int VAR_1)\n{",
"AVStream *st;",
"AVOutputStream *ost;",
"AVCodec *codec=NULL;",
"AVCodecContext *subtitle_enc;",
"enum CodecID VAR_2;",
"st = av_new_stream(VAR_0, VAR_0->nb_streams < nb_streamid_map ? streamid_map[VAR_0->nb_streams] : 0);",
"if (!st) {",
"fprintf(stderr, \"Could not alloc stream\\n\");",
"ffmpeg_exit(1);",
"}",
"ost = new_output_stream(VAR_0, VAR_1);",
"subtitle_enc = st->codec;",
"output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);",
"if(!subtitle_stream_copy){",
"if (subtitle_codec_name) {",
"VAR_2 = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1,\navcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance);",
"codec= output_codecs[nb_output_codecs-1] = avcodec_find_encoder_by_name(subtitle_codec_name);",
"} else {",
"VAR_2 = av_guess_codec(VAR_0->oformat, NULL, VAR_0->filename, NULL, AVMEDIA_TYPE_SUBTITLE);",
"codec = avcodec_find_encoder(VAR_2);",
"}",
"}",
"avcodec_get_context_defaults3(st->codec, codec);",
"ost->bitstream_filters = subtitle_bitstream_filters;",
"subtitle_bitstream_filters= NULL;",
"subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;",
"if(subtitle_codec_tag)\nsubtitle_enc->codec_tag= subtitle_codec_tag;",
"if (VAR_0->oformat->flags & AVFMT_GLOBALHEADER) {",
"subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;",
"avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->flags |= CODEC_FLAG_GLOBAL_HEADER;",
"}",
"if (subtitle_stream_copy) {",
"st->stream_copy = 1;",
"} else {",
"subtitle_enc->VAR_2 = VAR_2;",
"set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);",
"}",
"if (subtitle_language) {",
"av_metadata_set2(&st->metadata, \"language\", subtitle_language, 0);",
"av_freep(&subtitle_language);",
"}",
"subtitle_disable = 0;",
"av_freep(&subtitle_codec_name);",
"subtitle_stream_copy = 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
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37,
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
63
],
[
67,
69
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
95
],
[
97
],
[
99
],
[
101
],
[
105
],
[
107
],
[
109
],
[
111
]
] |
17,408
|
static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width, enum PixelFormat srcFormat)
{
__asm__ volatile(
"movq 24+%4, %%mm6 \n\t"
"mov %3, %%"REG_a" \n\t"
"pxor %%mm7, %%mm7 \n\t"
"1: \n\t"
PREFETCH" 64(%0) \n\t"
"movd (%0), %%mm0 \n\t"
"movd 2(%0), %%mm1 \n\t"
"punpcklbw %%mm7, %%mm0 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm1, %%mm3 \n\t"
"pmaddwd %4, %%mm0 \n\t"
"pmaddwd 8+%4, %%mm1 \n\t"
"pmaddwd 16+%4, %%mm2 \n\t"
"pmaddwd %%mm6, %%mm3 \n\t"
"paddd %%mm1, %%mm0 \n\t"
"paddd %%mm3, %%mm2 \n\t"
"movd 6(%0), %%mm1 \n\t"
"movd 8(%0), %%mm3 \n\t"
"add $12, %0 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"punpcklbw %%mm7, %%mm3 \n\t"
"movq %%mm1, %%mm4 \n\t"
"movq %%mm3, %%mm5 \n\t"
"pmaddwd %4, %%mm1 \n\t"
"pmaddwd 8+%4, %%mm3 \n\t"
"pmaddwd 16+%4, %%mm4 \n\t"
"pmaddwd %%mm6, %%mm5 \n\t"
"paddd %%mm3, %%mm1 \n\t"
"paddd %%mm5, %%mm4 \n\t"
"movq "MANGLE(ff_bgr24toUVOffset)", %%mm3 \n\t"
"paddd %%mm3, %%mm0 \n\t"
"paddd %%mm3, %%mm2 \n\t"
"paddd %%mm3, %%mm1 \n\t"
"paddd %%mm3, %%mm4 \n\t"
"psrad $15, %%mm0 \n\t"
"psrad $15, %%mm2 \n\t"
"psrad $15, %%mm1 \n\t"
"psrad $15, %%mm4 \n\t"
"packssdw %%mm1, %%mm0 \n\t"
"packssdw %%mm4, %%mm2 \n\t"
"packuswb %%mm0, %%mm0 \n\t"
"packuswb %%mm2, %%mm2 \n\t"
"movd %%mm0, (%1, %%"REG_a") \n\t"
"movd %%mm2, (%2, %%"REG_a") \n\t"
"add $4, %%"REG_a" \n\t"
" js 1b \n\t"
: "+r" (src)
: "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "m"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0])
: "%"REG_a
);
}
| true
|
FFmpeg
|
c3ab0004ae4dffc32494ae84dd15cfaa909a7884
|
static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width, enum PixelFormat srcFormat)
{
__asm__ volatile(
"movq 24+%4, %%mm6 \n\t"
"mov %3, %%"REG_a" \n\t"
"pxor %%mm7, %%mm7 \n\t"
"1: \n\t"
PREFETCH" 64(%0) \n\t"
"movd (%0), %%mm0 \n\t"
"movd 2(%0), %%mm1 \n\t"
"punpcklbw %%mm7, %%mm0 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm1, %%mm3 \n\t"
"pmaddwd %4, %%mm0 \n\t"
"pmaddwd 8+%4, %%mm1 \n\t"
"pmaddwd 16+%4, %%mm2 \n\t"
"pmaddwd %%mm6, %%mm3 \n\t"
"paddd %%mm1, %%mm0 \n\t"
"paddd %%mm3, %%mm2 \n\t"
"movd 6(%0), %%mm1 \n\t"
"movd 8(%0), %%mm3 \n\t"
"add $12, %0 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"punpcklbw %%mm7, %%mm3 \n\t"
"movq %%mm1, %%mm4 \n\t"
"movq %%mm3, %%mm5 \n\t"
"pmaddwd %4, %%mm1 \n\t"
"pmaddwd 8+%4, %%mm3 \n\t"
"pmaddwd 16+%4, %%mm4 \n\t"
"pmaddwd %%mm6, %%mm5 \n\t"
"paddd %%mm3, %%mm1 \n\t"
"paddd %%mm5, %%mm4 \n\t"
"movq "MANGLE(ff_bgr24toUVOffset)", %%mm3 \n\t"
"paddd %%mm3, %%mm0 \n\t"
"paddd %%mm3, %%mm2 \n\t"
"paddd %%mm3, %%mm1 \n\t"
"paddd %%mm3, %%mm4 \n\t"
"psrad $15, %%mm0 \n\t"
"psrad $15, %%mm2 \n\t"
"psrad $15, %%mm1 \n\t"
"psrad $15, %%mm4 \n\t"
"packssdw %%mm1, %%mm0 \n\t"
"packssdw %%mm4, %%mm2 \n\t"
"packuswb %%mm0, %%mm0 \n\t"
"packuswb %%mm2, %%mm2 \n\t"
"movd %%mm0, (%1, %%"REG_a") \n\t"
"movd %%mm2, (%2, %%"REG_a") \n\t"
"add $4, %%"REG_a" \n\t"
" js 1b \n\t"
: "+r" (src)
: "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "m"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0])
: "%"REG_a
);
}
|
{
"code": [
"static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width, enum PixelFormat srcFormat)"
],
"line_no": [
1
]
}
|
static inline void FUNC_0(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width, enum PixelFormat srcFormat)
{
__asm__ volatile(
"movq 24+%4, %%mm6 \n\t"
"mov %3, %%"REG_a" \n\t"
"pxor %%mm7, %%mm7 \n\t"
"1: \n\t"
PREFETCH" 64(%0) \n\t"
"movd (%0), %%mm0 \n\t"
"movd 2(%0), %%mm1 \n\t"
"punpcklbw %%mm7, %%mm0 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm1, %%mm3 \n\t"
"pmaddwd %4, %%mm0 \n\t"
"pmaddwd 8+%4, %%mm1 \n\t"
"pmaddwd 16+%4, %%mm2 \n\t"
"pmaddwd %%mm6, %%mm3 \n\t"
"paddd %%mm1, %%mm0 \n\t"
"paddd %%mm3, %%mm2 \n\t"
"movd 6(%0), %%mm1 \n\t"
"movd 8(%0), %%mm3 \n\t"
"add $12, %0 \n\t"
"punpcklbw %%mm7, %%mm1 \n\t"
"punpcklbw %%mm7, %%mm3 \n\t"
"movq %%mm1, %%mm4 \n\t"
"movq %%mm3, %%mm5 \n\t"
"pmaddwd %4, %%mm1 \n\t"
"pmaddwd 8+%4, %%mm3 \n\t"
"pmaddwd 16+%4, %%mm4 \n\t"
"pmaddwd %%mm6, %%mm5 \n\t"
"paddd %%mm3, %%mm1 \n\t"
"paddd %%mm5, %%mm4 \n\t"
"movq "MANGLE(ff_bgr24toUVOffset)", %%mm3 \n\t"
"paddd %%mm3, %%mm0 \n\t"
"paddd %%mm3, %%mm2 \n\t"
"paddd %%mm3, %%mm1 \n\t"
"paddd %%mm3, %%mm4 \n\t"
"psrad $15, %%mm0 \n\t"
"psrad $15, %%mm2 \n\t"
"psrad $15, %%mm1 \n\t"
"psrad $15, %%mm4 \n\t"
"packssdw %%mm1, %%mm0 \n\t"
"packssdw %%mm4, %%mm2 \n\t"
"packuswb %%mm0, %%mm0 \n\t"
"packuswb %%mm2, %%mm2 \n\t"
"movd %%mm0, (%1, %%"REG_a") \n\t"
"movd %%mm2, (%2, %%"REG_a") \n\t"
"add $4, %%"REG_a" \n\t"
" js 1b \n\t"
: "+r" (src)
: "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "m"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0])
: "%"REG_a
);
}
|
[
"static inline void FUNC_0(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width, enum PixelFormat srcFormat)\n{",
"__asm__ volatile(\n\"movq 24+%4, %%mm6 \\n\\t\"\n\"mov %3, %%\"REG_a\" \\n\\t\"\n\"pxor %%mm7, %%mm7 \\n\\t\"\n\"1: \\n\\t\"\nPREFETCH\" 64(%0) \\n\\t\"\n\"movd (%0), %%mm0 \\n\\t\"\n\"movd 2(%0), %%mm1 \\n\\t\"\n\"punpcklbw %%mm7, %%mm0 \\n\\t\"\n\"punpcklbw %%mm7, %%mm1 \\n\\t\"\n\"movq %%mm0, %%mm2 \\n\\t\"\n\"movq %%mm1, %%mm3 \\n\\t\"\n\"pmaddwd %4, %%mm0 \\n\\t\"\n\"pmaddwd 8+%4, %%mm1 \\n\\t\"\n\"pmaddwd 16+%4, %%mm2 \\n\\t\"\n\"pmaddwd %%mm6, %%mm3 \\n\\t\"\n\"paddd %%mm1, %%mm0 \\n\\t\"\n\"paddd %%mm3, %%mm2 \\n\\t\"\n\"movd 6(%0), %%mm1 \\n\\t\"\n\"movd 8(%0), %%mm3 \\n\\t\"\n\"add $12, %0 \\n\\t\"\n\"punpcklbw %%mm7, %%mm1 \\n\\t\"\n\"punpcklbw %%mm7, %%mm3 \\n\\t\"\n\"movq %%mm1, %%mm4 \\n\\t\"\n\"movq %%mm3, %%mm5 \\n\\t\"\n\"pmaddwd %4, %%mm1 \\n\\t\"\n\"pmaddwd 8+%4, %%mm3 \\n\\t\"\n\"pmaddwd 16+%4, %%mm4 \\n\\t\"\n\"pmaddwd %%mm6, %%mm5 \\n\\t\"\n\"paddd %%mm3, %%mm1 \\n\\t\"\n\"paddd %%mm5, %%mm4 \\n\\t\"\n\"movq \"MANGLE(ff_bgr24toUVOffset)\", %%mm3 \\n\\t\"\n\"paddd %%mm3, %%mm0 \\n\\t\"\n\"paddd %%mm3, %%mm2 \\n\\t\"\n\"paddd %%mm3, %%mm1 \\n\\t\"\n\"paddd %%mm3, %%mm4 \\n\\t\"\n\"psrad $15, %%mm0 \\n\\t\"\n\"psrad $15, %%mm2 \\n\\t\"\n\"psrad $15, %%mm1 \\n\\t\"\n\"psrad $15, %%mm4 \\n\\t\"\n\"packssdw %%mm1, %%mm0 \\n\\t\"\n\"packssdw %%mm4, %%mm2 \\n\\t\"\n\"packuswb %%mm0, %%mm0 \\n\\t\"\n\"packuswb %%mm2, %%mm2 \\n\\t\"\n\"movd %%mm0, (%1, %%\"REG_a\") \\n\\t\"\n\"movd %%mm2, (%2, %%\"REG_a\") \\n\\t\"\n\"add $4, %%\"REG_a\" \\n\\t\"\n\" js 1b \\n\\t\"\n: \"+r\" (src)\n: \"r\" (dstU+width), \"r\" (dstV+width), \"g\" ((x86_reg)-width), \"m\"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0])\n: \"%\"REG_a\n);",
"}"
] |
[
1,
0,
0
] |
[
[
1,
3
],
[
5,
7,
9,
11,
13,
15,
17,
19,
21,
23,
25,
27,
29,
31,
33,
35,
37,
39,
43,
45,
47,
49,
51,
53,
55,
57,
59,
61,
63,
65,
67,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91,
93,
95,
97,
99,
101,
103,
105,
107,
109,
111
],
[
113
]
] |
17,409
|
static ram_addr_t find_ram_offset(ram_addr_t size)
{
RAMBlock *block, *next_block;
ram_addr_t offset, mingap = ULONG_MAX;
if (QLIST_EMPTY(&ram_list.blocks))
return 0;
QLIST_FOREACH(block, &ram_list.blocks, next) {
ram_addr_t end, next = ULONG_MAX;
end = block->offset + block->length;
QLIST_FOREACH(next_block, &ram_list.blocks, next) {
if (next_block->offset >= end) {
next = MIN(next, next_block->offset);
}
}
if (next - end >= size && next - end < mingap) {
offset = end;
mingap = next - end;
}
}
return offset;
}
| true
|
qemu
|
09d7ae9000fe27d1861cb0348cbf71563ded6148
|
static ram_addr_t find_ram_offset(ram_addr_t size)
{
RAMBlock *block, *next_block;
ram_addr_t offset, mingap = ULONG_MAX;
if (QLIST_EMPTY(&ram_list.blocks))
return 0;
QLIST_FOREACH(block, &ram_list.blocks, next) {
ram_addr_t end, next = ULONG_MAX;
end = block->offset + block->length;
QLIST_FOREACH(next_block, &ram_list.blocks, next) {
if (next_block->offset >= end) {
next = MIN(next, next_block->offset);
}
}
if (next - end >= size && next - end < mingap) {
offset = end;
mingap = next - end;
}
}
return offset;
}
|
{
"code": [
" ram_addr_t offset, mingap = ULONG_MAX;"
],
"line_no": [
7
]
}
|
static ram_addr_t FUNC_0(ram_addr_t size)
{
RAMBlock *block, *next_block;
ram_addr_t offset, mingap = ULONG_MAX;
if (QLIST_EMPTY(&ram_list.blocks))
return 0;
QLIST_FOREACH(block, &ram_list.blocks, next) {
ram_addr_t end, next = ULONG_MAX;
end = block->offset + block->length;
QLIST_FOREACH(next_block, &ram_list.blocks, next) {
if (next_block->offset >= end) {
next = MIN(next, next_block->offset);
}
}
if (next - end >= size && next - end < mingap) {
offset = end;
mingap = next - end;
}
}
return offset;
}
|
[
"static ram_addr_t FUNC_0(ram_addr_t size)\n{",
"RAMBlock *block, *next_block;",
"ram_addr_t offset, mingap = ULONG_MAX;",
"if (QLIST_EMPTY(&ram_list.blocks))\nreturn 0;",
"QLIST_FOREACH(block, &ram_list.blocks, next) {",
"ram_addr_t end, next = ULONG_MAX;",
"end = block->offset + block->length;",
"QLIST_FOREACH(next_block, &ram_list.blocks, next) {",
"if (next_block->offset >= end) {",
"next = MIN(next, next_block->offset);",
"}",
"}",
"if (next - end >= size && next - end < mingap) {",
"offset = end;",
"mingap = next - end;",
"}",
"}",
"return offset;",
"}"
] |
[
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11,
13
],
[
17
],
[
19
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
]
] |
17,410
|
static void guess_dc(MpegEncContext *s, int16_t *dc, int w,
int h, int stride, int is_luma)
{
int b_x, b_y;
int16_t (*col )[4] = av_malloc(stride*h*sizeof( int16_t)*4);
uint32_t (*dist)[4] = av_malloc(stride*h*sizeof(uint32_t)*4);
for(b_y=0; b_y<h; b_y++){
int color= 1024;
int distance= -1;
for(b_x=0; b_x<w; b_x++){
int mb_index_j= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride;
int error_j= s->error_status_table[mb_index_j];
int intra_j = IS_INTRA(s->current_picture.f.mb_type[mb_index_j]);
if(intra_j==0 || !(error_j&ER_DC_ERROR)){
color= dc[b_x + b_y*stride];
distance= b_x;
}
col [b_x + b_y*stride][1]= color;
dist[b_x + b_y*stride][1]= distance >= 0 ? b_x-distance : 9999;
}
color= 1024;
distance= -1;
for(b_x=w-1; b_x>=0; b_x--){
int mb_index_j= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride;
int error_j= s->error_status_table[mb_index_j];
int intra_j = IS_INTRA(s->current_picture.f.mb_type[mb_index_j]);
if(intra_j==0 || !(error_j&ER_DC_ERROR)){
color= dc[b_x + b_y*stride];
distance= b_x;
}
col [b_x + b_y*stride][0]= color;
dist[b_x + b_y*stride][0]= distance >= 0 ? distance-b_x : 9999;
}
}
for(b_x=0; b_x<w; b_x++){
int color= 1024;
int distance= -1;
for(b_y=0; b_y<h; b_y++){
int mb_index_j= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride;
int error_j= s->error_status_table[mb_index_j];
int intra_j = IS_INTRA(s->current_picture.f.mb_type[mb_index_j]);
if(intra_j==0 || !(error_j&ER_DC_ERROR)){
color= dc[b_x + b_y*stride];
distance= b_y;
}
col [b_x + b_y*stride][3]= color;
dist[b_x + b_y*stride][3]= distance >= 0 ? b_y-distance : 9999;
}
color= 1024;
distance= -1;
for(b_y=h-1; b_y>=0; b_y--){
int mb_index_j= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride;
int error_j= s->error_status_table[mb_index_j];
int intra_j = IS_INTRA(s->current_picture.f.mb_type[mb_index_j]);
if(intra_j==0 || !(error_j&ER_DC_ERROR)){
color= dc[b_x + b_y*stride];
distance= b_y;
}
col [b_x + b_y*stride][2]= color;
dist[b_x + b_y*stride][2]= distance >= 0 ? distance-b_y : 9999;
}
}
for (b_y = 0; b_y < h; b_y++) {
for (b_x = 0; b_x < w; b_x++) {
int mb_index, error, j;
int64_t guess, weight_sum;
mb_index = (b_x >> is_luma) + (b_y >> is_luma) * s->mb_stride;
error = s->error_status_table[mb_index];
if (IS_INTER(s->current_picture.f.mb_type[mb_index]))
continue; // inter
if (!(error & ER_DC_ERROR))
continue; // dc-ok
weight_sum = 0;
guess = 0;
for (j = 0; j < 4; j++) {
int64_t weight = 256 * 256 * 256 * 16 / dist[b_x + b_y*stride][j];
guess += weight*(int64_t)col[b_x + b_y*stride][j];
weight_sum += weight;
}
guess = (guess + weight_sum / 2) / weight_sum;
dc[b_x + b_y * stride] = guess;
}
}
av_freep(&col);
av_freep(&dist);
}
| true
|
FFmpeg
|
71c2a70cbfbb5fea6dffa5e462b0227565e29bcc
|
static void guess_dc(MpegEncContext *s, int16_t *dc, int w,
int h, int stride, int is_luma)
{
int b_x, b_y;
int16_t (*col )[4] = av_malloc(stride*h*sizeof( int16_t)*4);
uint32_t (*dist)[4] = av_malloc(stride*h*sizeof(uint32_t)*4);
for(b_y=0; b_y<h; b_y++){
int color= 1024;
int distance= -1;
for(b_x=0; b_x<w; b_x++){
int mb_index_j= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride;
int error_j= s->error_status_table[mb_index_j];
int intra_j = IS_INTRA(s->current_picture.f.mb_type[mb_index_j]);
if(intra_j==0 || !(error_j&ER_DC_ERROR)){
color= dc[b_x + b_y*stride];
distance= b_x;
}
col [b_x + b_y*stride][1]= color;
dist[b_x + b_y*stride][1]= distance >= 0 ? b_x-distance : 9999;
}
color= 1024;
distance= -1;
for(b_x=w-1; b_x>=0; b_x--){
int mb_index_j= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride;
int error_j= s->error_status_table[mb_index_j];
int intra_j = IS_INTRA(s->current_picture.f.mb_type[mb_index_j]);
if(intra_j==0 || !(error_j&ER_DC_ERROR)){
color= dc[b_x + b_y*stride];
distance= b_x;
}
col [b_x + b_y*stride][0]= color;
dist[b_x + b_y*stride][0]= distance >= 0 ? distance-b_x : 9999;
}
}
for(b_x=0; b_x<w; b_x++){
int color= 1024;
int distance= -1;
for(b_y=0; b_y<h; b_y++){
int mb_index_j= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride;
int error_j= s->error_status_table[mb_index_j];
int intra_j = IS_INTRA(s->current_picture.f.mb_type[mb_index_j]);
if(intra_j==0 || !(error_j&ER_DC_ERROR)){
color= dc[b_x + b_y*stride];
distance= b_y;
}
col [b_x + b_y*stride][3]= color;
dist[b_x + b_y*stride][3]= distance >= 0 ? b_y-distance : 9999;
}
color= 1024;
distance= -1;
for(b_y=h-1; b_y>=0; b_y--){
int mb_index_j= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride;
int error_j= s->error_status_table[mb_index_j];
int intra_j = IS_INTRA(s->current_picture.f.mb_type[mb_index_j]);
if(intra_j==0 || !(error_j&ER_DC_ERROR)){
color= dc[b_x + b_y*stride];
distance= b_y;
}
col [b_x + b_y*stride][2]= color;
dist[b_x + b_y*stride][2]= distance >= 0 ? distance-b_y : 9999;
}
}
for (b_y = 0; b_y < h; b_y++) {
for (b_x = 0; b_x < w; b_x++) {
int mb_index, error, j;
int64_t guess, weight_sum;
mb_index = (b_x >> is_luma) + (b_y >> is_luma) * s->mb_stride;
error = s->error_status_table[mb_index];
if (IS_INTER(s->current_picture.f.mb_type[mb_index]))
continue;
if (!(error & ER_DC_ERROR))
continue;
weight_sum = 0;
guess = 0;
for (j = 0; j < 4; j++) {
int64_t weight = 256 * 256 * 256 * 16 / dist[b_x + b_y*stride][j];
guess += weight*(int64_t)col[b_x + b_y*stride][j];
weight_sum += weight;
}
guess = (guess + weight_sum / 2) / weight_sum;
dc[b_x + b_y * stride] = guess;
}
}
av_freep(&col);
av_freep(&dist);
}
|
{
"code": [
" int64_t weight = 256 * 256 * 256 * 16 / dist[b_x + b_y*stride][j];"
],
"line_no": [
159
]
}
|
static void FUNC_0(MpegEncContext *VAR_0, int16_t *VAR_1, int VAR_2,
int VAR_3, int VAR_4, int VAR_5)
{
int VAR_6, VAR_7;
int16_t (*col )[4] = av_malloc(VAR_4*VAR_3*sizeof( int16_t)*4);
uint32_t (*dist)[4] = av_malloc(VAR_4*VAR_3*sizeof(uint32_t)*4);
for(VAR_7=0; VAR_7<VAR_3; VAR_7++){
int VAR_13= 1024;
int VAR_13= -1;
for(VAR_6=0; VAR_6<VAR_2; VAR_6++){
int VAR_13= (VAR_6>>VAR_5) + (VAR_7>>VAR_5)*VAR_0->mb_stride;
int VAR_13= VAR_0->error_status_table[VAR_13];
int VAR_13 = IS_INTRA(VAR_0->current_picture.f.mb_type[VAR_13]);
if(VAR_13==0 || !(VAR_13&ER_DC_ERROR)){
VAR_13= VAR_1[VAR_6 + VAR_7*VAR_4];
VAR_13= VAR_6;
}
col [VAR_6 + VAR_7*VAR_4][1]= VAR_13;
dist[VAR_6 + VAR_7*VAR_4][1]= VAR_13 >= 0 ? VAR_6-VAR_13 : 9999;
}
VAR_13= 1024;
VAR_13= -1;
for(VAR_6=VAR_2-1; VAR_6>=0; VAR_6--){
int VAR_13= (VAR_6>>VAR_5) + (VAR_7>>VAR_5)*VAR_0->mb_stride;
int VAR_13= VAR_0->error_status_table[VAR_13];
int VAR_13 = IS_INTRA(VAR_0->current_picture.f.mb_type[VAR_13]);
if(VAR_13==0 || !(VAR_13&ER_DC_ERROR)){
VAR_13= VAR_1[VAR_6 + VAR_7*VAR_4];
VAR_13= VAR_6;
}
col [VAR_6 + VAR_7*VAR_4][0]= VAR_13;
dist[VAR_6 + VAR_7*VAR_4][0]= VAR_13 >= 0 ? VAR_13-VAR_6 : 9999;
}
}
for(VAR_6=0; VAR_6<VAR_2; VAR_6++){
int VAR_13= 1024;
int VAR_13= -1;
for(VAR_7=0; VAR_7<VAR_3; VAR_7++){
int VAR_13= (VAR_6>>VAR_5) + (VAR_7>>VAR_5)*VAR_0->mb_stride;
int VAR_13= VAR_0->error_status_table[VAR_13];
int VAR_13 = IS_INTRA(VAR_0->current_picture.f.mb_type[VAR_13]);
if(VAR_13==0 || !(VAR_13&ER_DC_ERROR)){
VAR_13= VAR_1[VAR_6 + VAR_7*VAR_4];
VAR_13= VAR_7;
}
col [VAR_6 + VAR_7*VAR_4][3]= VAR_13;
dist[VAR_6 + VAR_7*VAR_4][3]= VAR_13 >= 0 ? VAR_7-VAR_13 : 9999;
}
VAR_13= 1024;
VAR_13= -1;
for(VAR_7=VAR_3-1; VAR_7>=0; VAR_7--){
int VAR_13= (VAR_6>>VAR_5) + (VAR_7>>VAR_5)*VAR_0->mb_stride;
int VAR_13= VAR_0->error_status_table[VAR_13];
int VAR_13 = IS_INTRA(VAR_0->current_picture.f.mb_type[VAR_13]);
if(VAR_13==0 || !(VAR_13&ER_DC_ERROR)){
VAR_13= VAR_1[VAR_6 + VAR_7*VAR_4];
VAR_13= VAR_7;
}
col [VAR_6 + VAR_7*VAR_4][2]= VAR_13;
dist[VAR_6 + VAR_7*VAR_4][2]= VAR_13 >= 0 ? VAR_13-VAR_7 : 9999;
}
}
for (VAR_7 = 0; VAR_7 < VAR_3; VAR_7++) {
for (VAR_6 = 0; VAR_6 < VAR_2; VAR_6++) {
int VAR_13, VAR_14, VAR_15;
int64_t guess, weight_sum;
VAR_13 = (VAR_6 >> VAR_5) + (VAR_7 >> VAR_5) * VAR_0->mb_stride;
VAR_14 = VAR_0->error_status_table[VAR_13];
if (IS_INTER(VAR_0->current_picture.f.mb_type[VAR_13]))
continue;
if (!(VAR_14 & ER_DC_ERROR))
continue;
weight_sum = 0;
guess = 0;
for (VAR_15 = 0; VAR_15 < 4; VAR_15++) {
int64_t weight = 256 * 256 * 256 * 16 / dist[VAR_6 + VAR_7*VAR_4][VAR_15];
guess += weight*(int64_t)col[VAR_6 + VAR_7*VAR_4][VAR_15];
weight_sum += weight;
}
guess = (guess + weight_sum / 2) / weight_sum;
VAR_1[VAR_6 + VAR_7 * VAR_4] = guess;
}
}
av_freep(&col);
av_freep(&dist);
}
|
[
"static void FUNC_0(MpegEncContext *VAR_0, int16_t *VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int VAR_5)\n{",
"int VAR_6, VAR_7;",
"int16_t (*col )[4] = av_malloc(VAR_4*VAR_3*sizeof( int16_t)*4);",
"uint32_t (*dist)[4] = av_malloc(VAR_4*VAR_3*sizeof(uint32_t)*4);",
"for(VAR_7=0; VAR_7<VAR_3; VAR_7++){",
"int VAR_13= 1024;",
"int VAR_13= -1;",
"for(VAR_6=0; VAR_6<VAR_2; VAR_6++){",
"int VAR_13= (VAR_6>>VAR_5) + (VAR_7>>VAR_5)*VAR_0->mb_stride;",
"int VAR_13= VAR_0->error_status_table[VAR_13];",
"int VAR_13 = IS_INTRA(VAR_0->current_picture.f.mb_type[VAR_13]);",
"if(VAR_13==0 || !(VAR_13&ER_DC_ERROR)){",
"VAR_13= VAR_1[VAR_6 + VAR_7*VAR_4];",
"VAR_13= VAR_6;",
"}",
"col [VAR_6 + VAR_7*VAR_4][1]= VAR_13;",
"dist[VAR_6 + VAR_7*VAR_4][1]= VAR_13 >= 0 ? VAR_6-VAR_13 : 9999;",
"}",
"VAR_13= 1024;",
"VAR_13= -1;",
"for(VAR_6=VAR_2-1; VAR_6>=0; VAR_6--){",
"int VAR_13= (VAR_6>>VAR_5) + (VAR_7>>VAR_5)*VAR_0->mb_stride;",
"int VAR_13= VAR_0->error_status_table[VAR_13];",
"int VAR_13 = IS_INTRA(VAR_0->current_picture.f.mb_type[VAR_13]);",
"if(VAR_13==0 || !(VAR_13&ER_DC_ERROR)){",
"VAR_13= VAR_1[VAR_6 + VAR_7*VAR_4];",
"VAR_13= VAR_6;",
"}",
"col [VAR_6 + VAR_7*VAR_4][0]= VAR_13;",
"dist[VAR_6 + VAR_7*VAR_4][0]= VAR_13 >= 0 ? VAR_13-VAR_6 : 9999;",
"}",
"}",
"for(VAR_6=0; VAR_6<VAR_2; VAR_6++){",
"int VAR_13= 1024;",
"int VAR_13= -1;",
"for(VAR_7=0; VAR_7<VAR_3; VAR_7++){",
"int VAR_13= (VAR_6>>VAR_5) + (VAR_7>>VAR_5)*VAR_0->mb_stride;",
"int VAR_13= VAR_0->error_status_table[VAR_13];",
"int VAR_13 = IS_INTRA(VAR_0->current_picture.f.mb_type[VAR_13]);",
"if(VAR_13==0 || !(VAR_13&ER_DC_ERROR)){",
"VAR_13= VAR_1[VAR_6 + VAR_7*VAR_4];",
"VAR_13= VAR_7;",
"}",
"col [VAR_6 + VAR_7*VAR_4][3]= VAR_13;",
"dist[VAR_6 + VAR_7*VAR_4][3]= VAR_13 >= 0 ? VAR_7-VAR_13 : 9999;",
"}",
"VAR_13= 1024;",
"VAR_13= -1;",
"for(VAR_7=VAR_3-1; VAR_7>=0; VAR_7--){",
"int VAR_13= (VAR_6>>VAR_5) + (VAR_7>>VAR_5)*VAR_0->mb_stride;",
"int VAR_13= VAR_0->error_status_table[VAR_13];",
"int VAR_13 = IS_INTRA(VAR_0->current_picture.f.mb_type[VAR_13]);",
"if(VAR_13==0 || !(VAR_13&ER_DC_ERROR)){",
"VAR_13= VAR_1[VAR_6 + VAR_7*VAR_4];",
"VAR_13= VAR_7;",
"}",
"col [VAR_6 + VAR_7*VAR_4][2]= VAR_13;",
"dist[VAR_6 + VAR_7*VAR_4][2]= VAR_13 >= 0 ? VAR_13-VAR_7 : 9999;",
"}",
"}",
"for (VAR_7 = 0; VAR_7 < VAR_3; VAR_7++) {",
"for (VAR_6 = 0; VAR_6 < VAR_2; VAR_6++) {",
"int VAR_13, VAR_14, VAR_15;",
"int64_t guess, weight_sum;",
"VAR_13 = (VAR_6 >> VAR_5) + (VAR_7 >> VAR_5) * VAR_0->mb_stride;",
"VAR_14 = VAR_0->error_status_table[VAR_13];",
"if (IS_INTER(VAR_0->current_picture.f.mb_type[VAR_13]))\ncontinue;",
"if (!(VAR_14 & ER_DC_ERROR))\ncontinue;",
"weight_sum = 0;",
"guess = 0;",
"for (VAR_15 = 0; VAR_15 < 4; VAR_15++) {",
"int64_t weight = 256 * 256 * 256 * 16 / dist[VAR_6 + VAR_7*VAR_4][VAR_15];",
"guess += weight*(int64_t)col[VAR_6 + VAR_7*VAR_4][VAR_15];",
"weight_sum += weight;",
"}",
"guess = (guess + weight_sum / 2) / weight_sum;",
"VAR_1[VAR_6 + VAR_7 * VAR_4] = guess;",
"}",
"}",
"av_freep(&col);",
"av_freep(&dist);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
143,
145
],
[
147,
149
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
]
] |
17,414
|
Coroutine *qemu_coroutine_create(CoroutineEntry *entry)
{
Coroutine *co = NULL;
if (CONFIG_COROUTINE_POOL) {
co = QSLIST_FIRST(&alloc_pool);
if (!co) {
if (release_pool_size > POOL_BATCH_SIZE) {
/* Slow path; a good place to register the destructor, too. */
if (!coroutine_pool_cleanup_notifier.notify) {
coroutine_pool_cleanup_notifier.notify = coroutine_pool_cleanup;
qemu_thread_atexit_add(&coroutine_pool_cleanup_notifier);
}
/* This is not exact; there could be a little skew between
* release_pool_size and the actual size of release_pool. But
* it is just a heuristic, it does not need to be perfect.
*/
alloc_pool_size = atomic_xchg(&release_pool_size, 0);
QSLIST_MOVE_ATOMIC(&alloc_pool, &release_pool);
co = QSLIST_FIRST(&alloc_pool);
}
}
if (co) {
QSLIST_REMOVE_HEAD(&alloc_pool, pool_next);
alloc_pool_size--;
}
}
if (!co) {
co = qemu_coroutine_new();
}
co->entry = entry;
QSIMPLEQ_INIT(&co->co_queue_wakeup);
return co;
}
| true
|
qemu
|
0b8b8753e4d94901627b3e86431230f2319215c4
|
Coroutine *qemu_coroutine_create(CoroutineEntry *entry)
{
Coroutine *co = NULL;
if (CONFIG_COROUTINE_POOL) {
co = QSLIST_FIRST(&alloc_pool);
if (!co) {
if (release_pool_size > POOL_BATCH_SIZE) {
if (!coroutine_pool_cleanup_notifier.notify) {
coroutine_pool_cleanup_notifier.notify = coroutine_pool_cleanup;
qemu_thread_atexit_add(&coroutine_pool_cleanup_notifier);
}
alloc_pool_size = atomic_xchg(&release_pool_size, 0);
QSLIST_MOVE_ATOMIC(&alloc_pool, &release_pool);
co = QSLIST_FIRST(&alloc_pool);
}
}
if (co) {
QSLIST_REMOVE_HEAD(&alloc_pool, pool_next);
alloc_pool_size--;
}
}
if (!co) {
co = qemu_coroutine_new();
}
co->entry = entry;
QSIMPLEQ_INIT(&co->co_queue_wakeup);
return co;
}
|
{
"code": [
"Coroutine *qemu_coroutine_create(CoroutineEntry *entry)"
],
"line_no": [
1
]
}
|
Coroutine *FUNC_0(CoroutineEntry *entry)
{
Coroutine *co = NULL;
if (CONFIG_COROUTINE_POOL) {
co = QSLIST_FIRST(&alloc_pool);
if (!co) {
if (release_pool_size > POOL_BATCH_SIZE) {
if (!coroutine_pool_cleanup_notifier.notify) {
coroutine_pool_cleanup_notifier.notify = coroutine_pool_cleanup;
qemu_thread_atexit_add(&coroutine_pool_cleanup_notifier);
}
alloc_pool_size = atomic_xchg(&release_pool_size, 0);
QSLIST_MOVE_ATOMIC(&alloc_pool, &release_pool);
co = QSLIST_FIRST(&alloc_pool);
}
}
if (co) {
QSLIST_REMOVE_HEAD(&alloc_pool, pool_next);
alloc_pool_size--;
}
}
if (!co) {
co = qemu_coroutine_new();
}
co->entry = entry;
QSIMPLEQ_INIT(&co->co_queue_wakeup);
return co;
}
|
[
"Coroutine *FUNC_0(CoroutineEntry *entry)\n{",
"Coroutine *co = NULL;",
"if (CONFIG_COROUTINE_POOL) {",
"co = QSLIST_FIRST(&alloc_pool);",
"if (!co) {",
"if (release_pool_size > POOL_BATCH_SIZE) {",
"if (!coroutine_pool_cleanup_notifier.notify) {",
"coroutine_pool_cleanup_notifier.notify = coroutine_pool_cleanup;",
"qemu_thread_atexit_add(&coroutine_pool_cleanup_notifier);",
"}",
"alloc_pool_size = atomic_xchg(&release_pool_size, 0);",
"QSLIST_MOVE_ATOMIC(&alloc_pool, &release_pool);",
"co = QSLIST_FIRST(&alloc_pool);",
"}",
"}",
"if (co) {",
"QSLIST_REMOVE_HEAD(&alloc_pool, pool_next);",
"alloc_pool_size--;",
"}",
"}",
"if (!co) {",
"co = qemu_coroutine_new();",
"}",
"co->entry = entry;",
"QSIMPLEQ_INIT(&co->co_queue_wakeup);",
"return co;",
"}"
] |
[
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
73
]
] |
17,415
|
static void pxa2xx_gpio_write(void *opaque,
target_phys_addr_t offset, uint32_t value)
{
struct pxa2xx_gpio_info_s *s = (struct pxa2xx_gpio_info_s *) opaque;
int bank;
offset -= s->base;
if (offset >= 0x200)
return;
bank = pxa2xx_gpio_regs[offset].bank;
switch (pxa2xx_gpio_regs[offset].reg) {
case GPDR: /* GPIO Pin-Direction registers */
s->dir[bank] = value;
pxa2xx_gpio_handler_update(s);
break;
case GPSR: /* GPIO Pin-Output Set registers */
s->olevel[bank] |= value;
pxa2xx_gpio_handler_update(s);
break;
case GPCR: /* GPIO Pin-Output Clear registers */
s->olevel[bank] &= ~value;
pxa2xx_gpio_handler_update(s);
break;
case GRER: /* GPIO Rising-Edge Detect Enable registers */
s->rising[bank] = value;
break;
case GFER: /* GPIO Falling-Edge Detect Enable registers */
s->falling[bank] = value;
break;
case GAFR_L: /* GPIO Alternate Function registers */
s->gafr[bank * 2] = value;
break;
case GAFR_U: /* GPIO Alternate Function registers */
s->gafr[bank * 2 + 1] = value;
break;
case GEDR: /* GPIO Edge Detect Status registers */
s->status[bank] &= ~value;
pxa2xx_gpio_irq_update(s);
break;
default:
cpu_abort(cpu_single_env,
"%s: Bad offset " REG_FMT "\n", __FUNCTION__, offset);
}
}
| true
|
qemu
|
2b76bdc965ba7b4f27133cb345101d9535ddaa79
|
static void pxa2xx_gpio_write(void *opaque,
target_phys_addr_t offset, uint32_t value)
{
struct pxa2xx_gpio_info_s *s = (struct pxa2xx_gpio_info_s *) opaque;
int bank;
offset -= s->base;
if (offset >= 0x200)
return;
bank = pxa2xx_gpio_regs[offset].bank;
switch (pxa2xx_gpio_regs[offset].reg) {
case GPDR:
s->dir[bank] = value;
pxa2xx_gpio_handler_update(s);
break;
case GPSR:
s->olevel[bank] |= value;
pxa2xx_gpio_handler_update(s);
break;
case GPCR:
s->olevel[bank] &= ~value;
pxa2xx_gpio_handler_update(s);
break;
case GRER:
s->rising[bank] = value;
break;
case GFER:
s->falling[bank] = value;
break;
case GAFR_L:
s->gafr[bank * 2] = value;
break;
case GAFR_U:
s->gafr[bank * 2 + 1] = value;
break;
case GEDR:
s->status[bank] &= ~value;
pxa2xx_gpio_irq_update(s);
break;
default:
cpu_abort(cpu_single_env,
"%s: Bad offset " REG_FMT "\n", __FUNCTION__, offset);
}
}
|
{
"code": [],
"line_no": []
}
|
static void FUNC_0(void *VAR_0,
target_phys_addr_t VAR_1, uint32_t VAR_2)
{
struct pxa2xx_gpio_info_s *VAR_3 = (struct pxa2xx_gpio_info_s *) VAR_0;
int VAR_4;
VAR_1 -= VAR_3->base;
if (VAR_1 >= 0x200)
return;
VAR_4 = pxa2xx_gpio_regs[VAR_1].VAR_4;
switch (pxa2xx_gpio_regs[VAR_1].reg) {
case GPDR:
VAR_3->dir[VAR_4] = VAR_2;
pxa2xx_gpio_handler_update(VAR_3);
break;
case GPSR:
VAR_3->olevel[VAR_4] |= VAR_2;
pxa2xx_gpio_handler_update(VAR_3);
break;
case GPCR:
VAR_3->olevel[VAR_4] &= ~VAR_2;
pxa2xx_gpio_handler_update(VAR_3);
break;
case GRER:
VAR_3->rising[VAR_4] = VAR_2;
break;
case GFER:
VAR_3->falling[VAR_4] = VAR_2;
break;
case GAFR_L:
VAR_3->gafr[VAR_4 * 2] = VAR_2;
break;
case GAFR_U:
VAR_3->gafr[VAR_4 * 2 + 1] = VAR_2;
break;
case GEDR:
VAR_3->status[VAR_4] &= ~VAR_2;
pxa2xx_gpio_irq_update(VAR_3);
break;
default:
cpu_abort(cpu_single_env,
"%VAR_3: Bad VAR_1 " REG_FMT "\n", __FUNCTION__, VAR_1);
}
}
|
[
"static void FUNC_0(void *VAR_0,\ntarget_phys_addr_t VAR_1, uint32_t VAR_2)\n{",
"struct pxa2xx_gpio_info_s *VAR_3 = (struct pxa2xx_gpio_info_s *) VAR_0;",
"int VAR_4;",
"VAR_1 -= VAR_3->base;",
"if (VAR_1 >= 0x200)\nreturn;",
"VAR_4 = pxa2xx_gpio_regs[VAR_1].VAR_4;",
"switch (pxa2xx_gpio_regs[VAR_1].reg) {",
"case GPDR:\nVAR_3->dir[VAR_4] = VAR_2;",
"pxa2xx_gpio_handler_update(VAR_3);",
"break;",
"case GPSR:\nVAR_3->olevel[VAR_4] |= VAR_2;",
"pxa2xx_gpio_handler_update(VAR_3);",
"break;",
"case GPCR:\nVAR_3->olevel[VAR_4] &= ~VAR_2;",
"pxa2xx_gpio_handler_update(VAR_3);",
"break;",
"case GRER:\nVAR_3->rising[VAR_4] = VAR_2;",
"break;",
"case GFER:\nVAR_3->falling[VAR_4] = VAR_2;",
"break;",
"case GAFR_L:\nVAR_3->gafr[VAR_4 * 2] = VAR_2;",
"break;",
"case GAFR_U:\nVAR_3->gafr[VAR_4 * 2 + 1] = VAR_2;",
"break;",
"case GEDR:\nVAR_3->status[VAR_4] &= ~VAR_2;",
"pxa2xx_gpio_irq_update(VAR_3);",
"break;",
"default:\ncpu_abort(cpu_single_env,\n\"%VAR_3: Bad VAR_1 \" REG_FMT \"\\n\", __FUNCTION__, VAR_1);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13,
15
],
[
19
],
[
21
],
[
23,
25
],
[
27
],
[
29
],
[
33,
35
],
[
37
],
[
40
],
[
44,
46
],
[
48
],
[
50
],
[
54,
56
],
[
58
],
[
62,
64
],
[
66
],
[
70,
72
],
[
74
],
[
78,
80
],
[
82
],
[
86,
88
],
[
90
],
[
92
],
[
96,
98,
100
],
[
102
],
[
104
]
] |
17,416
|
static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr)
{
AVFormatContext *s = nut->avf;
AVIOContext *bc = s->pb;
int64_t end;
uint64_t tmp;
nut->last_syncpoint_pos = avio_tell(bc) - 8;
end = get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE);
end += avio_tell(bc);
tmp = ffio_read_varlen(bc);
*back_ptr = nut->last_syncpoint_pos - 16 * ffio_read_varlen(bc);
if (*back_ptr < 0)
return -1;
ff_nut_reset_ts(nut, nut->time_base[tmp % nut->time_base_count],
tmp / nut->time_base_count);
if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n");
return -1;
}
*ts = tmp / s->nb_streams *
av_q2d(nut->time_base[tmp % s->nb_streams]) * AV_TIME_BASE;
ff_nut_add_sp(nut, nut->last_syncpoint_pos, *back_ptr, *ts);
return 0;
}
| true
|
FFmpeg
|
fb96ac469a1d375b473868984f832e3a7cdfc24c
|
static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr)
{
AVFormatContext *s = nut->avf;
AVIOContext *bc = s->pb;
int64_t end;
uint64_t tmp;
nut->last_syncpoint_pos = avio_tell(bc) - 8;
end = get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE);
end += avio_tell(bc);
tmp = ffio_read_varlen(bc);
*back_ptr = nut->last_syncpoint_pos - 16 * ffio_read_varlen(bc);
if (*back_ptr < 0)
return -1;
ff_nut_reset_ts(nut, nut->time_base[tmp % nut->time_base_count],
tmp / nut->time_base_count);
if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n");
return -1;
}
*ts = tmp / s->nb_streams *
av_q2d(nut->time_base[tmp % s->nb_streams]) * AV_TIME_BASE;
ff_nut_add_sp(nut, nut->last_syncpoint_pos, *back_ptr, *ts);
return 0;
}
|
{
"code": [
" *ts = tmp / s->nb_streams *",
" av_q2d(nut->time_base[tmp % s->nb_streams]) * AV_TIME_BASE;"
],
"line_no": [
51,
53
]
}
|
static int FUNC_0(NUTContext *VAR_0, int64_t *VAR_1, int64_t *VAR_2)
{
AVFormatContext *s = VAR_0->avf;
AVIOContext *bc = s->pb;
int64_t end;
uint64_t tmp;
VAR_0->last_syncpoint_pos = avio_tell(bc) - 8;
end = get_packetheader(VAR_0, bc, 1, SYNCPOINT_STARTCODE);
end += avio_tell(bc);
tmp = ffio_read_varlen(bc);
*VAR_2 = VAR_0->last_syncpoint_pos - 16 * ffio_read_varlen(bc);
if (*VAR_2 < 0)
return -1;
ff_nut_reset_ts(VAR_0, VAR_0->time_base[tmp % VAR_0->time_base_count],
tmp / VAR_0->time_base_count);
if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n");
return -1;
}
*VAR_1 = tmp / s->nb_streams *
av_q2d(VAR_0->time_base[tmp % s->nb_streams]) * AV_TIME_BASE;
ff_nut_add_sp(VAR_0, VAR_0->last_syncpoint_pos, *VAR_2, *VAR_1);
return 0;
}
|
[
"static int FUNC_0(NUTContext *VAR_0, int64_t *VAR_1, int64_t *VAR_2)\n{",
"AVFormatContext *s = VAR_0->avf;",
"AVIOContext *bc = s->pb;",
"int64_t end;",
"uint64_t tmp;",
"VAR_0->last_syncpoint_pos = avio_tell(bc) - 8;",
"end = get_packetheader(VAR_0, bc, 1, SYNCPOINT_STARTCODE);",
"end += avio_tell(bc);",
"tmp = ffio_read_varlen(bc);",
"*VAR_2 = VAR_0->last_syncpoint_pos - 16 * ffio_read_varlen(bc);",
"if (*VAR_2 < 0)\nreturn -1;",
"ff_nut_reset_ts(VAR_0, VAR_0->time_base[tmp % VAR_0->time_base_count],\ntmp / VAR_0->time_base_count);",
"if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {",
"av_log(s, AV_LOG_ERROR, \"sync point checksum mismatch\\n\");",
"return -1;",
"}",
"*VAR_1 = tmp / s->nb_streams *\nav_q2d(VAR_0->time_base[tmp % s->nb_streams]) * AV_TIME_BASE;",
"ff_nut_add_sp(VAR_0, VAR_0->last_syncpoint_pos, *VAR_2, *VAR_1);",
"return 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
],
[
11
],
[
15
],
[
19
],
[
21
],
[
25
],
[
27
],
[
29,
31
],
[
35,
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51,
53
],
[
55
],
[
59
],
[
61
]
] |
17,417
|
static void coroutine_fn v9fs_flush(void *opaque)
{
ssize_t err;
int16_t tag;
size_t offset = 7;
V9fsPDU *cancel_pdu;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
err = pdu_unmarshal(pdu, offset, "w", &tag);
if (err < 0) {
pdu_complete(pdu, err);
return;
}
trace_v9fs_flush(pdu->tag, pdu->id, tag);
QLIST_FOREACH(cancel_pdu, &s->active_list, next) {
if (cancel_pdu->tag == tag) {
break;
}
}
if (cancel_pdu) {
cancel_pdu->cancelled = 1;
/*
* Wait for pdu to complete.
*/
qemu_co_queue_wait(&cancel_pdu->complete, NULL);
cancel_pdu->cancelled = 0;
pdu_free(cancel_pdu);
}
pdu_complete(pdu, 7);
}
| true
|
qemu
|
d5f2af7b95b738b25272a98319b09540a0606d14
|
static void coroutine_fn v9fs_flush(void *opaque)
{
ssize_t err;
int16_t tag;
size_t offset = 7;
V9fsPDU *cancel_pdu;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
err = pdu_unmarshal(pdu, offset, "w", &tag);
if (err < 0) {
pdu_complete(pdu, err);
return;
}
trace_v9fs_flush(pdu->tag, pdu->id, tag);
QLIST_FOREACH(cancel_pdu, &s->active_list, next) {
if (cancel_pdu->tag == tag) {
break;
}
}
if (cancel_pdu) {
cancel_pdu->cancelled = 1;
qemu_co_queue_wait(&cancel_pdu->complete, NULL);
cancel_pdu->cancelled = 0;
pdu_free(cancel_pdu);
}
pdu_complete(pdu, 7);
}
|
{
"code": [
" V9fsPDU *cancel_pdu;",
" QLIST_FOREACH(cancel_pdu, &s->active_list, next) {",
" if (cancel_pdu->tag == tag) {",
" break;"
],
"line_no": [
11,
33,
35,
37
]
}
|
static void VAR_0 v9fs_flush(void *opaque)
{
ssize_t err;
int16_t tag;
size_t offset = 7;
V9fsPDU *cancel_pdu;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
err = pdu_unmarshal(pdu, offset, "w", &tag);
if (err < 0) {
pdu_complete(pdu, err);
return;
}
trace_v9fs_flush(pdu->tag, pdu->id, tag);
QLIST_FOREACH(cancel_pdu, &s->active_list, next) {
if (cancel_pdu->tag == tag) {
break;
}
}
if (cancel_pdu) {
cancel_pdu->cancelled = 1;
qemu_co_queue_wait(&cancel_pdu->complete, NULL);
cancel_pdu->cancelled = 0;
pdu_free(cancel_pdu);
}
pdu_complete(pdu, 7);
}
|
[
"static void VAR_0 v9fs_flush(void *opaque)\n{",
"ssize_t err;",
"int16_t tag;",
"size_t offset = 7;",
"V9fsPDU *cancel_pdu;",
"V9fsPDU *pdu = opaque;",
"V9fsState *s = pdu->s;",
"err = pdu_unmarshal(pdu, offset, \"w\", &tag);",
"if (err < 0) {",
"pdu_complete(pdu, err);",
"return;",
"}",
"trace_v9fs_flush(pdu->tag, pdu->id, tag);",
"QLIST_FOREACH(cancel_pdu, &s->active_list, next) {",
"if (cancel_pdu->tag == tag) {",
"break;",
"}",
"}",
"if (cancel_pdu) {",
"cancel_pdu->cancelled = 1;",
"qemu_co_queue_wait(&cancel_pdu->complete, NULL);",
"cancel_pdu->cancelled = 0;",
"pdu_free(cancel_pdu);",
"}",
"pdu_complete(pdu, 7);",
"}"
] |
[
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
]
] |
17,418
|
static inline void expand_category(COOKContext *q, int *category,
int *category_index)
{
int i;
for (i = 0; i < q->num_vectors; i++)
++category[category_index[i]];
}
| true
|
FFmpeg
|
442c3a8cb1785d74f8e2d7ab35b1862b7088436b
|
static inline void expand_category(COOKContext *q, int *category,
int *category_index)
{
int i;
for (i = 0; i < q->num_vectors; i++)
++category[category_index[i]];
}
|
{
"code": [
" ++category[category_index[i]];"
],
"line_no": [
11
]
}
|
static inline void FUNC_0(COOKContext *VAR_0, int *VAR_1,
int *VAR_2)
{
int VAR_3;
for (VAR_3 = 0; VAR_3 < VAR_0->num_vectors; VAR_3++)
++VAR_1[VAR_2[VAR_3]];
}
|
[
"static inline void FUNC_0(COOKContext *VAR_0, int *VAR_1,\nint *VAR_2)\n{",
"int VAR_3;",
"for (VAR_3 = 0; VAR_3 < VAR_0->num_vectors; VAR_3++)",
"++VAR_1[VAR_2[VAR_3]];",
"}"
] |
[
0,
0,
0,
1,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
]
] |
17,419
|
static int gif_encode_close(AVCodecContext *avctx)
{
GIFContext *s = avctx->priv_data;
av_frame_free(&avctx->coded_frame);
av_freep(&s->lzw);
av_freep(&s->buf);
return 0;
}
| false
|
FFmpeg
|
d6604b29ef544793479d7fb4e05ef6622bb3e534
|
static int gif_encode_close(AVCodecContext *avctx)
{
GIFContext *s = avctx->priv_data;
av_frame_free(&avctx->coded_frame);
av_freep(&s->lzw);
av_freep(&s->buf);
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVCodecContext *VAR_0)
{
GIFContext *s = VAR_0->priv_data;
av_frame_free(&VAR_0->coded_frame);
av_freep(&s->lzw);
av_freep(&s->buf);
return 0;
}
|
[
"static int FUNC_0(AVCodecContext *VAR_0)\n{",
"GIFContext *s = VAR_0->priv_data;",
"av_frame_free(&VAR_0->coded_frame);",
"av_freep(&s->lzw);",
"av_freep(&s->buf);",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
]
] |
17,420
|
static av_cold int vqa_decode_end(AVCodecContext *avctx)
{
VqaContext *s = avctx->priv_data;
av_free(s->codebook);
av_free(s->next_codebook_buffer);
av_free(s->decode_buffer);
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
return 0;
}
| false
|
FFmpeg
|
341404f753fdbcddebb9fbce51f2ef057cceb79c
|
static av_cold int vqa_decode_end(AVCodecContext *avctx)
{
VqaContext *s = avctx->priv_data;
av_free(s->codebook);
av_free(s->next_codebook_buffer);
av_free(s->decode_buffer);
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static av_cold int FUNC_0(AVCodecContext *avctx)
{
VqaContext *s = avctx->priv_data;
av_free(s->codebook);
av_free(s->next_codebook_buffer);
av_free(s->decode_buffer);
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
return 0;
}
|
[
"static av_cold int FUNC_0(AVCodecContext *avctx)\n{",
"VqaContext *s = avctx->priv_data;",
"av_free(s->codebook);",
"av_free(s->next_codebook_buffer);",
"av_free(s->decode_buffer);",
"if (s->frame.data[0])\navctx->release_buffer(avctx, &s->frame);",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
17,
19
],
[
23
],
[
25
]
] |
17,421
|
static av_cold int pam_encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
return 0;
}
| false
|
FFmpeg
|
d6604b29ef544793479d7fb4e05ef6622bb3e534
|
static av_cold int pam_encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static av_cold int FUNC_0(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
return 0;
}
|
[
"static av_cold int FUNC_0(AVCodecContext *avctx)\n{",
"avctx->coded_frame = av_frame_alloc();",
"if (!avctx->coded_frame)\nreturn AVERROR(ENOMEM);",
"avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;",
"avctx->coded_frame->key_frame = 1;",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7,
9
],
[
13
],
[
15
],
[
19
],
[
21
]
] |
17,422
|
static int write_l2_entries(BlockDriverState *bs, uint64_t *l2_table,
uint64_t l2_offset, int l2_index, int num)
{
int l2_start_index = l2_index & ~(L1_ENTRIES_PER_SECTOR - 1);
int start_offset = (8 * l2_index) & ~511;
int end_offset = (8 * (l2_index + num) + 511) & ~511;
size_t len = end_offset - start_offset;
int ret;
BLKDBG_EVENT(bs->file, BLKDBG_L2_UPDATE);
ret = bdrv_pwrite(bs->file, l2_offset + start_offset,
&l2_table[l2_start_index], len);
if (ret < 0) {
return ret;
}
return 0;
}
| true
|
qemu
|
8b3b720620a1137a1b794fc3ed64734236f94e06
|
static int write_l2_entries(BlockDriverState *bs, uint64_t *l2_table,
uint64_t l2_offset, int l2_index, int num)
{
int l2_start_index = l2_index & ~(L1_ENTRIES_PER_SECTOR - 1);
int start_offset = (8 * l2_index) & ~511;
int end_offset = (8 * (l2_index + num) + 511) & ~511;
size_t len = end_offset - start_offset;
int ret;
BLKDBG_EVENT(bs->file, BLKDBG_L2_UPDATE);
ret = bdrv_pwrite(bs->file, l2_offset + start_offset,
&l2_table[l2_start_index], len);
if (ret < 0) {
return ret;
}
return 0;
}
|
{
"code": [
" ret = bdrv_pwrite(bs->file, l2_offset + start_offset,"
],
"line_no": [
21
]
}
|
static int FUNC_0(BlockDriverState *VAR_0, uint64_t *VAR_1,
uint64_t VAR_2, int VAR_3, int VAR_4)
{
int VAR_5 = VAR_3 & ~(L1_ENTRIES_PER_SECTOR - 1);
int VAR_6 = (8 * VAR_3) & ~511;
int VAR_7 = (8 * (VAR_3 + VAR_4) + 511) & ~511;
size_t len = VAR_7 - VAR_6;
int VAR_8;
BLKDBG_EVENT(VAR_0->file, BLKDBG_L2_UPDATE);
VAR_8 = bdrv_pwrite(VAR_0->file, VAR_2 + VAR_6,
&VAR_1[VAR_5], len);
if (VAR_8 < 0) {
return VAR_8;
}
return 0;
}
|
[
"static int FUNC_0(BlockDriverState *VAR_0, uint64_t *VAR_1,\nuint64_t VAR_2, int VAR_3, int VAR_4)\n{",
"int VAR_5 = VAR_3 & ~(L1_ENTRIES_PER_SECTOR - 1);",
"int VAR_6 = (8 * VAR_3) & ~511;",
"int VAR_7 = (8 * (VAR_3 + VAR_4) + 511) & ~511;",
"size_t len = VAR_7 - VAR_6;",
"int VAR_8;",
"BLKDBG_EVENT(VAR_0->file, BLKDBG_L2_UPDATE);",
"VAR_8 = bdrv_pwrite(VAR_0->file, VAR_2 + VAR_6,\n&VAR_1[VAR_5], len);",
"if (VAR_8 < 0) {",
"return VAR_8;",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21,
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
]
] |
17,423
|
static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
int16_t *src2,
int height, int denom, int wx0, int wx1,
int ox0, int ox1, intptr_t mx, intptr_t my, int width)
{
int x, y;
pixel *src = (pixel*)_src;
ptrdiff_t srcstride = _srcstride / sizeof(pixel);
pixel *dst = (pixel *)_dst;
ptrdiff_t dststride = _dststride / sizeof(pixel);
const int8_t *filter = ff_hevc_qpel_filters[mx - 1];
int shift = 14 + 1 - BIT_DEPTH;
int log2Wd = denom + shift - 1;
ox0 = ox0 * (1 << (BIT_DEPTH - 8));
ox1 = ox1 * (1 << (BIT_DEPTH - 8));
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++)
dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
src += srcstride;
dst += dststride;
src2 += MAX_PB_SIZE;
}
}
| true
|
FFmpeg
|
d135f3c514ac1723256c8e0f5cdd466fe98a2578
|
static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
int16_t *src2,
int height, int denom, int wx0, int wx1,
int ox0, int ox1, intptr_t mx, intptr_t my, int width)
{
int x, y;
pixel *src = (pixel*)_src;
ptrdiff_t srcstride = _srcstride / sizeof(pixel);
pixel *dst = (pixel *)_dst;
ptrdiff_t dststride = _dststride / sizeof(pixel);
const int8_t *filter = ff_hevc_qpel_filters[mx - 1];
int shift = 14 + 1 - BIT_DEPTH;
int log2Wd = denom + shift - 1;
ox0 = ox0 * (1 << (BIT_DEPTH - 8));
ox1 = ox1 * (1 << (BIT_DEPTH - 8));
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++)
dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));
src += srcstride;
dst += dststride;
src2 += MAX_PB_SIZE;
}
}
|
{
"code": [
" ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));",
" ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));"
],
"line_no": [
43,
43
]
}
|
static void FUNC_0(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,
int16_t *src2,
int height, int denom, int wx0, int wx1,
int ox0, int ox1, intptr_t mx, intptr_t my, int width)
{
int VAR_0, VAR_1;
pixel *src = (pixel*)_src;
ptrdiff_t srcstride = _srcstride / sizeof(pixel);
pixel *dst = (pixel *)_dst;
ptrdiff_t dststride = _dststride / sizeof(pixel);
const int8_t *VAR_2 = ff_hevc_qpel_filters[mx - 1];
int VAR_3 = 14 + 1 - BIT_DEPTH;
int VAR_4 = denom + VAR_3 - 1;
ox0 = ox0 * (1 << (BIT_DEPTH - 8));
ox1 = ox1 * (1 << (BIT_DEPTH - 8));
for (VAR_1 = 0; VAR_1 < height; VAR_1++) {
for (VAR_0 = 0; VAR_0 < width; VAR_0++)
dst[VAR_0] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[VAR_0] * wx0 +
((ox0 + ox1 + 1) << VAR_4)) >> (VAR_4 + 1));
src += srcstride;
dst += dststride;
src2 += MAX_PB_SIZE;
}
}
|
[
"static void FUNC_0(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,\nint16_t *src2,\nint height, int denom, int wx0, int wx1,\nint ox0, int ox1, intptr_t mx, intptr_t my, int width)\n{",
"int VAR_0, VAR_1;",
"pixel *src = (pixel*)_src;",
"ptrdiff_t srcstride = _srcstride / sizeof(pixel);",
"pixel *dst = (pixel *)_dst;",
"ptrdiff_t dststride = _dststride / sizeof(pixel);",
"const int8_t *VAR_2 = ff_hevc_qpel_filters[mx - 1];",
"int VAR_3 = 14 + 1 - BIT_DEPTH;",
"int VAR_4 = denom + VAR_3 - 1;",
"ox0 = ox0 * (1 << (BIT_DEPTH - 8));",
"ox1 = ox1 * (1 << (BIT_DEPTH - 8));",
"for (VAR_1 = 0; VAR_1 < height; VAR_1++) {",
"for (VAR_0 = 0; VAR_0 < width; VAR_0++)",
"dst[VAR_0] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[VAR_0] * wx0 +\n((ox0 + ox1 + 1) << VAR_4)) >> (VAR_4 + 1));",
"src += srcstride;",
"dst += dststride;",
"src2 += MAX_PB_SIZE;",
"}",
"}"
] |
[
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
],
[
23
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41,
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
]
] |
17,424
|
void virtqueue_flush(VirtQueue *vq, unsigned int count)
{
uint16_t old, new;
/* Make sure buffer is written before we update index. */
smp_wmb();
trace_virtqueue_flush(vq, count);
old = vq->used_idx;
new = old + count;
vring_used_idx_set(vq, new);
if (unlikely((int16_t)(new - vq->signalled_used) < (uint16_t)(new - old)))
vq->signalled_used_valid = false;
| true
|
qemu
|
f5ed36635d8fa73feb66fe12b3b9c2ed90a1adbe
|
void virtqueue_flush(VirtQueue *vq, unsigned int count)
{
uint16_t old, new;
smp_wmb();
trace_virtqueue_flush(vq, count);
old = vq->used_idx;
new = old + count;
vring_used_idx_set(vq, new);
if (unlikely((int16_t)(new - vq->signalled_used) < (uint16_t)(new - old)))
vq->signalled_used_valid = false;
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(VirtQueue *VAR_0, unsigned int VAR_1)
{
uint16_t old, new;
smp_wmb();
trace_virtqueue_flush(VAR_0, VAR_1);
old = VAR_0->used_idx;
new = old + VAR_1;
vring_used_idx_set(VAR_0, new);
if (unlikely((int16_t)(new - VAR_0->signalled_used) < (uint16_t)(new - old)))
VAR_0->signalled_used_valid = false;
|
[
"void FUNC_0(VirtQueue *VAR_0, unsigned int VAR_1)\n{",
"uint16_t old, new;",
"smp_wmb();",
"trace_virtqueue_flush(VAR_0, VAR_1);",
"old = VAR_0->used_idx;",
"new = old + VAR_1;",
"vring_used_idx_set(VAR_0, new);",
"if (unlikely((int16_t)(new - VAR_0->signalled_used) < (uint16_t)(new - old)))\nVAR_0->signalled_used_valid = false;"
] |
[
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
2
],
[
3
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
10,
11
]
] |
17,425
|
static void xbr4x(AVFrame *input, AVFrame *output, const uint32_t *r2y)
{
const int nl = output->linesize[0]>>2;
const int nl1 = nl + nl;
const int nl2 = nl1 + nl;
uint32_t pprev;
uint32_t pprev2;
int x, y;
for (y = 0; y < input->height; y++) {
uint32_t * E = (uint32_t *)(output->data[0] + y * output->linesize[0] * 4);
/* middle. Offset of -8 is given */
uint32_t * sa2 = (uint32_t *)(input->data[0] + y * input->linesize[0] - 8);
/* up one */
uint32_t * sa1 = sa2 - (input->linesize[0]>>2);
/* up two */
uint32_t * sa0 = sa1 - (input->linesize[0]>>2);
/* down one */
uint32_t * sa3 = sa2 + (input->linesize[0]>>2);
/* down two */
uint32_t * sa4 = sa3 + (input->linesize[0]>>2);
if (y <= 1) {
sa0 = sa1;
if (y == 0) {
sa0 = sa1 = sa2;
}
}
if (y >= input->height - 2) {
sa4 = sa3;
if (y == input->height - 1) {
sa4 = sa3 = sa2;
}
}
pprev = pprev2 = 2;
for (x = 0; x < input->width; x++) {
uint32_t B1 = sa0[2];
uint32_t PB = sa1[2];
uint32_t PE = sa2[2];
uint32_t PH = sa3[2];
uint32_t H5 = sa4[2];
uint32_t A1 = sa0[pprev];
uint32_t PA = sa1[pprev];
uint32_t PD = sa2[pprev];
uint32_t PG = sa3[pprev];
uint32_t G5 = sa4[pprev];
uint32_t A0 = sa1[pprev2];
uint32_t D0 = sa2[pprev2];
uint32_t G0 = sa3[pprev2];
uint32_t C1 = 0;
uint32_t PC = 0;
uint32_t PF = 0;
uint32_t PI = 0;
uint32_t I5 = 0;
uint32_t C4 = 0;
uint32_t F4 = 0;
uint32_t I4 = 0;
if (x >= input->width - 2) {
if (x == input->width - 1) {
C1 = sa0[2];
PC = sa1[2];
PF = sa2[2];
PI = sa3[2];
I5 = sa4[2];
C4 = sa1[2];
F4 = sa2[2];
I4 = sa3[2];
} else {
C1 = sa0[3];
PC = sa1[3];
PF = sa2[3];
PI = sa3[3];
I5 = sa4[3];
C4 = sa1[3];
F4 = sa2[3];
I4 = sa3[3];
}
} else {
C1 = sa0[3];
PC = sa1[3];
PF = sa2[3];
PI = sa3[3];
I5 = sa4[3];
C4 = sa1[4];
F4 = sa2[4];
I4 = sa3[4];
}
E[0] = E[1] = E[2] = E[3] = PE;
E[nl] = E[nl+1] = E[nl+2] = E[nl+3] = PE; // 4, 5, 6, 7
E[nl1] = E[nl1+1] = E[nl1+2] = E[nl1+3] = PE; // 8, 9, 10, 11
E[nl2] = E[nl2+1] = E[nl2+2] = E[nl2+3] = PE; // 12, 13, 14, 15
FILT4(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, nl2+3, nl2+2, nl1+3, 3, nl+3, nl1+2, nl2+1, nl2, nl1+1, nl+2, 2, 1, nl+1, nl1, nl, 0);
FILT4(PE, PC, PF, PB, PI, PA, PH, PD, PG, I4, A1, I5, H5, A0, D0, B1, C1, F4, C4, G5, G0, 3, nl+3, 2, 0, 1, nl+2, nl1+3, nl2+3, nl1+2, nl+1, nl, nl1, nl1+1,nl2+2,nl2+1,nl2);
FILT4(PE, PA, PB, PD, PC, PG, PF, PH, PI, C1, G0, C4, F4, G5, H5, D0, A0, B1, A1, I4, I5, 0, 1, nl, nl2, nl1, nl+1, 2, 3, nl+2, nl1+1, nl2+1,nl2+2,nl1+2, nl+3,nl1+3,nl2+3);
FILT4(PE, PG, PD, PH, PA, PI, PB, PF, PC, A0, I5, A1, B1, I4, F4, H5, G5, D0, G0, C1, C4, nl2, nl1, nl2+1, nl2+3, nl2+2, nl1+1, nl, 0, nl+1, nl1+2, nl1+3, nl+3, nl+2, 1, 2, 3);
sa0 += 1;
sa1 += 1;
sa2 += 1;
sa3 += 1;
sa4 += 1;
E += 4;
if (pprev2){
pprev2--;
pprev = 1;
}
}
}
}
| true
|
FFmpeg
|
e0704840404381c7b976a35db4004deca4495a22
|
static void xbr4x(AVFrame *input, AVFrame *output, const uint32_t *r2y)
{
const int nl = output->linesize[0]>>2;
const int nl1 = nl + nl;
const int nl2 = nl1 + nl;
uint32_t pprev;
uint32_t pprev2;
int x, y;
for (y = 0; y < input->height; y++) {
uint32_t * E = (uint32_t *)(output->data[0] + y * output->linesize[0] * 4);
uint32_t * sa2 = (uint32_t *)(input->data[0] + y * input->linesize[0] - 8);
uint32_t * sa1 = sa2 - (input->linesize[0]>>2);
uint32_t * sa0 = sa1 - (input->linesize[0]>>2);
uint32_t * sa3 = sa2 + (input->linesize[0]>>2);
uint32_t * sa4 = sa3 + (input->linesize[0]>>2);
if (y <= 1) {
sa0 = sa1;
if (y == 0) {
sa0 = sa1 = sa2;
}
}
if (y >= input->height - 2) {
sa4 = sa3;
if (y == input->height - 1) {
sa4 = sa3 = sa2;
}
}
pprev = pprev2 = 2;
for (x = 0; x < input->width; x++) {
uint32_t B1 = sa0[2];
uint32_t PB = sa1[2];
uint32_t PE = sa2[2];
uint32_t PH = sa3[2];
uint32_t H5 = sa4[2];
uint32_t A1 = sa0[pprev];
uint32_t PA = sa1[pprev];
uint32_t PD = sa2[pprev];
uint32_t PG = sa3[pprev];
uint32_t G5 = sa4[pprev];
uint32_t A0 = sa1[pprev2];
uint32_t D0 = sa2[pprev2];
uint32_t G0 = sa3[pprev2];
uint32_t C1 = 0;
uint32_t PC = 0;
uint32_t PF = 0;
uint32_t PI = 0;
uint32_t I5 = 0;
uint32_t C4 = 0;
uint32_t F4 = 0;
uint32_t I4 = 0;
if (x >= input->width - 2) {
if (x == input->width - 1) {
C1 = sa0[2];
PC = sa1[2];
PF = sa2[2];
PI = sa3[2];
I5 = sa4[2];
C4 = sa1[2];
F4 = sa2[2];
I4 = sa3[2];
} else {
C1 = sa0[3];
PC = sa1[3];
PF = sa2[3];
PI = sa3[3];
I5 = sa4[3];
C4 = sa1[3];
F4 = sa2[3];
I4 = sa3[3];
}
} else {
C1 = sa0[3];
PC = sa1[3];
PF = sa2[3];
PI = sa3[3];
I5 = sa4[3];
C4 = sa1[4];
F4 = sa2[4];
I4 = sa3[4];
}
E[0] = E[1] = E[2] = E[3] = PE;
E[nl] = E[nl+1] = E[nl+2] = E[nl+3] = PE;
E[nl1] = E[nl1+1] = E[nl1+2] = E[nl1+3] = PE;
E[nl2] = E[nl2+1] = E[nl2+2] = E[nl2+3] = PE;
FILT4(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, nl2+3, nl2+2, nl1+3, 3, nl+3, nl1+2, nl2+1, nl2, nl1+1, nl+2, 2, 1, nl+1, nl1, nl, 0);
FILT4(PE, PC, PF, PB, PI, PA, PH, PD, PG, I4, A1, I5, H5, A0, D0, B1, C1, F4, C4, G5, G0, 3, nl+3, 2, 0, 1, nl+2, nl1+3, nl2+3, nl1+2, nl+1, nl, nl1, nl1+1,nl2+2,nl2+1,nl2);
FILT4(PE, PA, PB, PD, PC, PG, PF, PH, PI, C1, G0, C4, F4, G5, H5, D0, A0, B1, A1, I4, I5, 0, 1, nl, nl2, nl1, nl+1, 2, 3, nl+2, nl1+1, nl2+1,nl2+2,nl1+2, nl+3,nl1+3,nl2+3);
FILT4(PE, PG, PD, PH, PA, PI, PB, PF, PC, A0, I5, A1, B1, I4, F4, H5, G5, D0, G0, C1, C4, nl2, nl1, nl2+1, nl2+3, nl2+2, nl1+1, nl, 0, nl+1, nl1+2, nl1+3, nl+3, nl+2, 1, 2, 3);
sa0 += 1;
sa1 += 1;
sa2 += 1;
sa3 += 1;
sa4 += 1;
E += 4;
if (pprev2){
pprev2--;
pprev = 1;
}
}
}
}
|
{
"code": [
" pprev = pprev2 = 2;",
" uint32_t C1 = 0;",
" uint32_t PC = 0;",
" uint32_t PF = 0;",
" uint32_t PI = 0;",
" uint32_t I5 = 0;",
" uint32_t C4 = 0;",
" uint32_t F4 = 0;",
" uint32_t I4 = 0;",
" if (x >= input->width - 2) {",
" if (x == input->width - 1) {",
" C1 = sa0[2];",
" PC = sa1[2];",
" PF = sa2[2];",
" PI = sa3[2];",
" I5 = sa4[2];",
" C4 = sa1[2];",
" F4 = sa2[2];",
" I4 = sa3[2];",
" } else {",
" C1 = sa0[3];",
" PC = sa1[3];",
" PF = sa2[3];",
" PI = sa3[3];",
" I5 = sa4[3];",
" C4 = sa1[3];",
" F4 = sa2[3];",
" I4 = sa3[3];",
" } else {",
" C1 = sa0[3];",
" PC = sa1[3];",
" PF = sa2[3];",
" PI = sa3[3];",
" I5 = sa4[3];",
" C4 = sa1[4];",
" F4 = sa2[4];",
" I4 = sa3[4];",
" if (pprev2){",
" pprev2--;",
" pprev = 1;",
" uint32_t pprev;",
" uint32_t pprev2;",
" pprev = pprev2 = 2;",
" uint32_t C1 = 0;",
" uint32_t PC = 0;",
" uint32_t PF = 0;",
" uint32_t PI = 0;",
" uint32_t I5 = 0;",
" uint32_t C4 = 0;",
" uint32_t F4 = 0;",
" uint32_t I4 = 0;",
" C1 = sa0[2];",
" PC = sa1[2];",
" PF = sa2[2];",
" PI = sa3[2];",
" I5 = sa4[2];",
" C4 = sa1[2];",
" F4 = sa2[2];",
" I4 = sa3[2];",
" } else {",
" C1 = sa0[3];",
" PC = sa1[3];",
" PF = sa2[3];",
" PI = sa3[3];",
" I5 = sa4[3];",
" C4 = sa1[3];",
" F4 = sa2[3];",
" I4 = sa3[3];",
" } else {",
" C1 = sa0[3];",
" PC = sa1[3];",
" PF = sa2[3];",
" PI = sa3[3];",
" I5 = sa4[3];",
" C4 = sa1[4];",
" F4 = sa2[4];",
" I4 = sa3[4];",
" if (pprev2){",
" pprev2--;",
" pprev = 1;",
" uint32_t pprev;",
" uint32_t pprev2;",
" pprev = pprev2 = 2;",
" uint32_t C1 = 0;",
" uint32_t PC = 0;",
" uint32_t PF = 0;",
" uint32_t PI = 0;",
" uint32_t I5 = 0;",
" uint32_t C4 = 0;",
" uint32_t F4 = 0;",
" uint32_t I4 = 0;",
" if (x >= input->width - 2) {",
" if (x == input->width - 1) {",
" C1 = sa0[2];",
" PC = sa1[2];",
" PF = sa2[2];",
" PI = sa3[2];",
" I5 = sa4[2];",
" C4 = sa1[2];",
" F4 = sa2[2];",
" I4 = sa3[2];",
" } else {",
" C1 = sa0[3];",
" PC = sa1[3];",
" PF = sa2[3];",
" PI = sa3[3];",
" I5 = sa4[3];",
" C4 = sa1[3];",
" F4 = sa2[3];",
" I4 = sa3[3];",
" } else {",
" C1 = sa0[3];",
" PC = sa1[3];",
" PF = sa2[3];",
" PI = sa3[3];",
" I5 = sa4[3];",
" C4 = sa1[4];",
" F4 = sa2[4];",
" I4 = sa3[4];",
" if (pprev2){",
" pprev2--;",
" pprev = 1;"
],
"line_no": [
81,
119,
121,
123,
125,
127,
131,
133,
135,
139,
141,
143,
145,
147,
149,
151,
155,
157,
159,
161,
163,
165,
167,
169,
171,
175,
177,
179,
183,
185,
187,
189,
191,
193,
197,
199,
201,
243,
245,
247,
13,
15,
81,
119,
121,
123,
125,
127,
131,
133,
135,
143,
145,
147,
149,
151,
155,
157,
159,
161,
163,
165,
167,
169,
171,
175,
177,
179,
183,
185,
187,
189,
191,
193,
197,
199,
201,
243,
245,
247,
13,
15,
81,
119,
121,
123,
125,
127,
131,
133,
135,
139,
141,
143,
145,
147,
149,
151,
155,
157,
159,
161,
163,
165,
167,
169,
171,
175,
177,
179,
183,
185,
187,
189,
191,
193,
197,
199,
201,
243,
245,
247
]
}
|
static void FUNC_0(AVFrame *VAR_0, AVFrame *VAR_1, const uint32_t *VAR_2)
{
const int VAR_3 = VAR_1->linesize[0]>>2;
const int VAR_4 = VAR_3 + VAR_3;
const int VAR_5 = VAR_4 + VAR_3;
uint32_t pprev;
uint32_t pprev2;
int VAR_6, VAR_7;
for (VAR_7 = 0; VAR_7 < VAR_0->height; VAR_7++) {
uint32_t * E = (uint32_t *)(VAR_1->data[0] + VAR_7 * VAR_1->linesize[0] * 4);
uint32_t * sa2 = (uint32_t *)(VAR_0->data[0] + VAR_7 * VAR_0->linesize[0] - 8);
uint32_t * sa1 = sa2 - (VAR_0->linesize[0]>>2);
uint32_t * sa0 = sa1 - (VAR_0->linesize[0]>>2);
uint32_t * sa3 = sa2 + (VAR_0->linesize[0]>>2);
uint32_t * sa4 = sa3 + (VAR_0->linesize[0]>>2);
if (VAR_7 <= 1) {
sa0 = sa1;
if (VAR_7 == 0) {
sa0 = sa1 = sa2;
}
}
if (VAR_7 >= VAR_0->height - 2) {
sa4 = sa3;
if (VAR_7 == VAR_0->height - 1) {
sa4 = sa3 = sa2;
}
}
pprev = pprev2 = 2;
for (VAR_6 = 0; VAR_6 < VAR_0->width; VAR_6++) {
uint32_t B1 = sa0[2];
uint32_t PB = sa1[2];
uint32_t PE = sa2[2];
uint32_t PH = sa3[2];
uint32_t H5 = sa4[2];
uint32_t A1 = sa0[pprev];
uint32_t PA = sa1[pprev];
uint32_t PD = sa2[pprev];
uint32_t PG = sa3[pprev];
uint32_t G5 = sa4[pprev];
uint32_t A0 = sa1[pprev2];
uint32_t D0 = sa2[pprev2];
uint32_t G0 = sa3[pprev2];
uint32_t C1 = 0;
uint32_t PC = 0;
uint32_t PF = 0;
uint32_t PI = 0;
uint32_t I5 = 0;
uint32_t C4 = 0;
uint32_t F4 = 0;
uint32_t I4 = 0;
if (VAR_6 >= VAR_0->width - 2) {
if (VAR_6 == VAR_0->width - 1) {
C1 = sa0[2];
PC = sa1[2];
PF = sa2[2];
PI = sa3[2];
I5 = sa4[2];
C4 = sa1[2];
F4 = sa2[2];
I4 = sa3[2];
} else {
C1 = sa0[3];
PC = sa1[3];
PF = sa2[3];
PI = sa3[3];
I5 = sa4[3];
C4 = sa1[3];
F4 = sa2[3];
I4 = sa3[3];
}
} else {
C1 = sa0[3];
PC = sa1[3];
PF = sa2[3];
PI = sa3[3];
I5 = sa4[3];
C4 = sa1[4];
F4 = sa2[4];
I4 = sa3[4];
}
E[0] = E[1] = E[2] = E[3] = PE;
E[VAR_3] = E[VAR_3+1] = E[VAR_3+2] = E[VAR_3+3] = PE;
E[VAR_4] = E[VAR_4+1] = E[VAR_4+2] = E[VAR_4+3] = PE;
E[VAR_5] = E[VAR_5+1] = E[VAR_5+2] = E[VAR_5+3] = PE;
FILT4(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, VAR_5+3, VAR_5+2, VAR_4+3, 3, VAR_3+3, VAR_4+2, VAR_5+1, VAR_5, VAR_4+1, VAR_3+2, 2, 1, VAR_3+1, VAR_4, VAR_3, 0);
FILT4(PE, PC, PF, PB, PI, PA, PH, PD, PG, I4, A1, I5, H5, A0, D0, B1, C1, F4, C4, G5, G0, 3, VAR_3+3, 2, 0, 1, VAR_3+2, VAR_4+3, VAR_5+3, VAR_4+2, VAR_3+1, VAR_3, VAR_4, VAR_4+1,VAR_5+2,VAR_5+1,VAR_5);
FILT4(PE, PA, PB, PD, PC, PG, PF, PH, PI, C1, G0, C4, F4, G5, H5, D0, A0, B1, A1, I4, I5, 0, 1, VAR_3, VAR_5, VAR_4, VAR_3+1, 2, 3, VAR_3+2, VAR_4+1, VAR_5+1,VAR_5+2,VAR_4+2, VAR_3+3,VAR_4+3,VAR_5+3);
FILT4(PE, PG, PD, PH, PA, PI, PB, PF, PC, A0, I5, A1, B1, I4, F4, H5, G5, D0, G0, C1, C4, VAR_5, VAR_4, VAR_5+1, VAR_5+3, VAR_5+2, VAR_4+1, VAR_3, 0, VAR_3+1, VAR_4+2, VAR_4+3, VAR_3+3, VAR_3+2, 1, 2, 3);
sa0 += 1;
sa1 += 1;
sa2 += 1;
sa3 += 1;
sa4 += 1;
E += 4;
if (pprev2){
pprev2--;
pprev = 1;
}
}
}
}
|
[
"static void FUNC_0(AVFrame *VAR_0, AVFrame *VAR_1, const uint32_t *VAR_2)\n{",
"const int VAR_3 = VAR_1->linesize[0]>>2;",
"const int VAR_4 = VAR_3 + VAR_3;",
"const int VAR_5 = VAR_4 + VAR_3;",
"uint32_t pprev;",
"uint32_t pprev2;",
"int VAR_6, VAR_7;",
"for (VAR_7 = 0; VAR_7 < VAR_0->height; VAR_7++) {",
"uint32_t * E = (uint32_t *)(VAR_1->data[0] + VAR_7 * VAR_1->linesize[0] * 4);",
"uint32_t * sa2 = (uint32_t *)(VAR_0->data[0] + VAR_7 * VAR_0->linesize[0] - 8);",
"uint32_t * sa1 = sa2 - (VAR_0->linesize[0]>>2);",
"uint32_t * sa0 = sa1 - (VAR_0->linesize[0]>>2);",
"uint32_t * sa3 = sa2 + (VAR_0->linesize[0]>>2);",
"uint32_t * sa4 = sa3 + (VAR_0->linesize[0]>>2);",
"if (VAR_7 <= 1) {",
"sa0 = sa1;",
"if (VAR_7 == 0) {",
"sa0 = sa1 = sa2;",
"}",
"}",
"if (VAR_7 >= VAR_0->height - 2) {",
"sa4 = sa3;",
"if (VAR_7 == VAR_0->height - 1) {",
"sa4 = sa3 = sa2;",
"}",
"}",
"pprev = pprev2 = 2;",
"for (VAR_6 = 0; VAR_6 < VAR_0->width; VAR_6++) {",
"uint32_t B1 = sa0[2];",
"uint32_t PB = sa1[2];",
"uint32_t PE = sa2[2];",
"uint32_t PH = sa3[2];",
"uint32_t H5 = sa4[2];",
"uint32_t A1 = sa0[pprev];",
"uint32_t PA = sa1[pprev];",
"uint32_t PD = sa2[pprev];",
"uint32_t PG = sa3[pprev];",
"uint32_t G5 = sa4[pprev];",
"uint32_t A0 = sa1[pprev2];",
"uint32_t D0 = sa2[pprev2];",
"uint32_t G0 = sa3[pprev2];",
"uint32_t C1 = 0;",
"uint32_t PC = 0;",
"uint32_t PF = 0;",
"uint32_t PI = 0;",
"uint32_t I5 = 0;",
"uint32_t C4 = 0;",
"uint32_t F4 = 0;",
"uint32_t I4 = 0;",
"if (VAR_6 >= VAR_0->width - 2) {",
"if (VAR_6 == VAR_0->width - 1) {",
"C1 = sa0[2];",
"PC = sa1[2];",
"PF = sa2[2];",
"PI = sa3[2];",
"I5 = sa4[2];",
"C4 = sa1[2];",
"F4 = sa2[2];",
"I4 = sa3[2];",
"} else {",
"C1 = sa0[3];",
"PC = sa1[3];",
"PF = sa2[3];",
"PI = sa3[3];",
"I5 = sa4[3];",
"C4 = sa1[3];",
"F4 = sa2[3];",
"I4 = sa3[3];",
"}",
"} else {",
"C1 = sa0[3];",
"PC = sa1[3];",
"PF = sa2[3];",
"PI = sa3[3];",
"I5 = sa4[3];",
"C4 = sa1[4];",
"F4 = sa2[4];",
"I4 = sa3[4];",
"}",
"E[0] = E[1] = E[2] = E[3] = PE;",
"E[VAR_3] = E[VAR_3+1] = E[VAR_3+2] = E[VAR_3+3] = PE;",
"E[VAR_4] = E[VAR_4+1] = E[VAR_4+2] = E[VAR_4+3] = PE;",
"E[VAR_5] = E[VAR_5+1] = E[VAR_5+2] = E[VAR_5+3] = PE;",
"FILT4(PE, PI, PH, PF, PG, PC, PD, PB, PA, G5, C4, G0, D0, C1, B1, F4, I4, H5, I5, A0, A1, VAR_5+3, VAR_5+2, VAR_4+3, 3, VAR_3+3, VAR_4+2, VAR_5+1, VAR_5, VAR_4+1, VAR_3+2, 2, 1, VAR_3+1, VAR_4, VAR_3, 0);",
"FILT4(PE, PC, PF, PB, PI, PA, PH, PD, PG, I4, A1, I5, H5, A0, D0, B1, C1, F4, C4, G5, G0, 3, VAR_3+3, 2, 0, 1, VAR_3+2, VAR_4+3, VAR_5+3, VAR_4+2, VAR_3+1, VAR_3, VAR_4, VAR_4+1,VAR_5+2,VAR_5+1,VAR_5);",
"FILT4(PE, PA, PB, PD, PC, PG, PF, PH, PI, C1, G0, C4, F4, G5, H5, D0, A0, B1, A1, I4, I5, 0, 1, VAR_3, VAR_5, VAR_4, VAR_3+1, 2, 3, VAR_3+2, VAR_4+1, VAR_5+1,VAR_5+2,VAR_4+2, VAR_3+3,VAR_4+3,VAR_5+3);",
"FILT4(PE, PG, PD, PH, PA, PI, PB, PF, PC, A0, I5, A1, B1, I4, F4, H5, G5, D0, G0, C1, C4, VAR_5, VAR_4, VAR_5+1, VAR_5+3, VAR_5+2, VAR_4+1, VAR_3, 0, VAR_3+1, VAR_4+2, VAR_4+3, VAR_3+3, VAR_3+2, 1, 2, 3);",
"sa0 += 1;",
"sa1 += 1;",
"sa2 += 1;",
"sa3 += 1;",
"sa4 += 1;",
"E += 4;",
"if (pprev2){",
"pprev2--;",
"pprev = 1;",
"}",
"}",
"}",
"}"
] |
[
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
0,
0,
0
] |
[
[
1,
3
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
23
],
[
27
],
[
33
],
[
37
],
[
41
],
[
45
],
[
49
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
81
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
111
],
[
113
],
[
115
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
131
],
[
133
],
[
135
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
197
],
[
199
],
[
201
],
[
203
],
[
207
],
[
209
],
[
211
],
[
213
],
[
217
],
[
219
],
[
221
],
[
223
],
[
227
],
[
229
],
[
231
],
[
233
],
[
235
],
[
239
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
]
] |
17,426
|
const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length){
int i, si, di;
uint8_t *dst;
int bufidx;
// src[0]&0x80; //forbidden bit
h->nal_ref_idc= src[0]>>5;
h->nal_unit_type= src[0]&0x1F;
src++; length--;
#if HAVE_FAST_UNALIGNED
# if HAVE_FAST_64BIT
# define RS 7
for(i=0; i+1<length; i+=9){
if(!((~AV_RN64A(src+i) & (AV_RN64A(src+i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL))
# else
# define RS 3
for(i=0; i+1<length; i+=5){
if(!((~AV_RN32A(src+i) & (AV_RN32A(src+i) - 0x01000101U)) & 0x80008080U))
# endif
continue;
if(i>0 && !src[i]) i--;
while(src[i]) i++;
#else
# define RS 0
for(i=0; i+1<length; i+=2){
if(src[i]) continue;
if(i>0 && src[i-1]==0) i--;
#endif
if(i+2<length && src[i+1]==0 && src[i+2]<=3){
if(src[i+2]!=3){
/* startcode, so we must be past the end */
length=i;
}
break;
}
i-= RS;
}
if(i>=length-1){ //no escaped 0
*dst_length= length;
*consumed= length+1; //+1 for the header
return src;
}
bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0; // use second escape buffer for inter data
av_fast_malloc(&h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length+FF_INPUT_BUFFER_PADDING_SIZE);
dst= h->rbsp_buffer[bufidx];
if (dst == NULL){
return NULL;
}
//printf("decoding esc\n");
memcpy(dst, src, i);
si=di=i;
while(si+2<length){
//remove escapes (very rare 1:2^22)
if(src[si+2]>3){
dst[di++]= src[si++];
dst[di++]= src[si++];
}else if(src[si]==0 && src[si+1]==0){
if(src[si+2]==3){ //escape
dst[di++]= 0;
dst[di++]= 0;
si+=3;
continue;
}else //next start code
goto nsc;
}
dst[di++]= src[si++];
}
while(si<length)
dst[di++]= src[si++];
nsc:
memset(dst+di, 0, FF_INPUT_BUFFER_PADDING_SIZE);
*dst_length= di;
*consumed= si + 1;//+1 for the header
//FIXME store exact number of bits in the getbitcontext (it is needed for decoding)
return dst;
}
| true
|
FFmpeg
|
23f5cff92cdcfa55a735c458fcb5f95c0e0f3b1f
|
const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length){
int i, si, di;
uint8_t *dst;
int bufidx;
h->nal_ref_idc= src[0]>>5;
h->nal_unit_type= src[0]&0x1F;
src++; length--;
#if HAVE_FAST_UNALIGNED
# if HAVE_FAST_64BIT
# define RS 7
for(i=0; i+1<length; i+=9){
if(!((~AV_RN64A(src+i) & (AV_RN64A(src+i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL))
# else
# define RS 3
for(i=0; i+1<length; i+=5){
if(!((~AV_RN32A(src+i) & (AV_RN32A(src+i) - 0x01000101U)) & 0x80008080U))
# endif
continue;
if(i>0 && !src[i]) i--;
while(src[i]) i++;
#else
# define RS 0
for(i=0; i+1<length; i+=2){
if(src[i]) continue;
if(i>0 && src[i-1]==0) i--;
#endif
if(i+2<length && src[i+1]==0 && src[i+2]<=3){
if(src[i+2]!=3){
length=i;
}
break;
}
i-= RS;
}
if(i>=length-1){
*dst_length= length;
*consumed= length+1;
return src;
}
bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0;
av_fast_malloc(&h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length+FF_INPUT_BUFFER_PADDING_SIZE);
dst= h->rbsp_buffer[bufidx];
if (dst == NULL){
return NULL;
}
memcpy(dst, src, i);
si=di=i;
while(si+2<length){
if(src[si+2]>3){
dst[di++]= src[si++];
dst[di++]= src[si++];
}else if(src[si]==0 && src[si+1]==0){
if(src[si+2]==3){
dst[di++]= 0;
dst[di++]= 0;
si+=3;
continue;
}else
goto nsc;
}
dst[di++]= src[si++];
}
while(si<length)
dst[di++]= src[si++];
nsc:
memset(dst+di, 0, FF_INPUT_BUFFER_PADDING_SIZE);
*dst_length= di;
*consumed= si + 1;
return dst;
}
|
{
"code": [
" *dst_length= length;",
" return src;",
" av_fast_malloc(&h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length+FF_INPUT_BUFFER_PADDING_SIZE);"
],
"line_no": [
83,
87,
95
]
}
|
const uint8_t *FUNC_0(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length){
int VAR_0, VAR_1, VAR_2;
uint8_t *dst;
int VAR_3;
h->nal_ref_idc= src[0]>>5;
h->nal_unit_type= src[0]&0x1F;
src++; length--;
#if HAVE_FAST_UNALIGNED
# if HAVE_FAST_64BIT
# define RS 7
for(VAR_0=0; VAR_0+1<length; VAR_0+=9){
if(!((~AV_RN64A(src+VAR_0) & (AV_RN64A(src+VAR_0) - 0x0100010001000101ULL)) & 0x8000800080008080ULL))
# else
# define RS 3
for(VAR_0=0; VAR_0+1<length; VAR_0+=5){
if(!((~AV_RN32A(src+VAR_0) & (AV_RN32A(src+VAR_0) - 0x01000101U)) & 0x80008080U))
# endif
continue;
if(VAR_0>0 && !src[VAR_0]) VAR_0--;
while(src[VAR_0]) VAR_0++;
#else
# define RS 0
for(VAR_0=0; VAR_0+1<length; VAR_0+=2){
if(src[VAR_0]) continue;
if(VAR_0>0 && src[VAR_0-1]==0) VAR_0--;
#endif
if(VAR_0+2<length && src[VAR_0+1]==0 && src[VAR_0+2]<=3){
if(src[VAR_0+2]!=3){
length=VAR_0;
}
break;
}
VAR_0-= RS;
}
if(VAR_0>=length-1){
*dst_length= length;
*consumed= length+1;
return src;
}
VAR_3 = h->nal_unit_type == NAL_DPC ? 1 : 0;
av_fast_malloc(&h->rbsp_buffer[VAR_3], &h->rbsp_buffer_size[VAR_3], length+FF_INPUT_BUFFER_PADDING_SIZE);
dst= h->rbsp_buffer[VAR_3];
if (dst == NULL){
return NULL;
}
memcpy(dst, src, VAR_0);
VAR_1=VAR_2=VAR_0;
while(VAR_1+2<length){
if(src[VAR_1+2]>3){
dst[VAR_2++]= src[VAR_1++];
dst[VAR_2++]= src[VAR_1++];
}else if(src[VAR_1]==0 && src[VAR_1+1]==0){
if(src[VAR_1+2]==3){
dst[VAR_2++]= 0;
dst[VAR_2++]= 0;
VAR_1+=3;
continue;
}else
goto nsc;
}
dst[VAR_2++]= src[VAR_1++];
}
while(VAR_1<length)
dst[VAR_2++]= src[VAR_1++];
nsc:
memset(dst+VAR_2, 0, FF_INPUT_BUFFER_PADDING_SIZE);
*dst_length= VAR_2;
*consumed= VAR_1 + 1;
return dst;
}
|
[
"const uint8_t *FUNC_0(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length){",
"int VAR_0, VAR_1, VAR_2;",
"uint8_t *dst;",
"int VAR_3;",
"h->nal_ref_idc= src[0]>>5;",
"h->nal_unit_type= src[0]&0x1F;",
"src++; length--;",
"#if HAVE_FAST_UNALIGNED\n# if HAVE_FAST_64BIT\n# define RS 7\nfor(VAR_0=0; VAR_0+1<length; VAR_0+=9){",
"if(!((~AV_RN64A(src+VAR_0) & (AV_RN64A(src+VAR_0) - 0x0100010001000101ULL)) & 0x8000800080008080ULL))\n# else\n# define RS 3\nfor(VAR_0=0; VAR_0+1<length; VAR_0+=5){",
"if(!((~AV_RN32A(src+VAR_0) & (AV_RN32A(src+VAR_0) - 0x01000101U)) & 0x80008080U))\n# endif\ncontinue;",
"if(VAR_0>0 && !src[VAR_0]) VAR_0--;",
"while(src[VAR_0]) VAR_0++;",
"#else\n# define RS 0\nfor(VAR_0=0; VAR_0+1<length; VAR_0+=2){",
"if(src[VAR_0]) continue;",
"if(VAR_0>0 && src[VAR_0-1]==0) VAR_0--;",
"#endif\nif(VAR_0+2<length && src[VAR_0+1]==0 && src[VAR_0+2]<=3){",
"if(src[VAR_0+2]!=3){",
"length=VAR_0;",
"}",
"break;",
"}",
"VAR_0-= RS;",
"}",
"if(VAR_0>=length-1){",
"*dst_length= length;",
"*consumed= length+1;",
"return src;",
"}",
"VAR_3 = h->nal_unit_type == NAL_DPC ? 1 : 0;",
"av_fast_malloc(&h->rbsp_buffer[VAR_3], &h->rbsp_buffer_size[VAR_3], length+FF_INPUT_BUFFER_PADDING_SIZE);",
"dst= h->rbsp_buffer[VAR_3];",
"if (dst == NULL){",
"return NULL;",
"}",
"memcpy(dst, src, VAR_0);",
"VAR_1=VAR_2=VAR_0;",
"while(VAR_1+2<length){",
"if(src[VAR_1+2]>3){",
"dst[VAR_2++]= src[VAR_1++];",
"dst[VAR_2++]= src[VAR_1++];",
"}else if(src[VAR_1]==0 && src[VAR_1+1]==0){",
"if(src[VAR_1+2]==3){",
"dst[VAR_2++]= 0;",
"dst[VAR_2++]= 0;",
"VAR_1+=3;",
"continue;",
"}else",
"goto nsc;",
"}",
"dst[VAR_2++]= src[VAR_1++];",
"}",
"while(VAR_1<length)\ndst[VAR_2++]= src[VAR_1++];",
"nsc:\nmemset(dst+VAR_2, 0, FF_INPUT_BUFFER_PADDING_SIZE);",
"*dst_length= VAR_2;",
"*consumed= VAR_1 + 1;",
"return dst;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
0,
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
],
[
13
],
[
15
],
[
19
],
[
23,
25,
27,
29
],
[
31,
33,
35,
37
],
[
39,
41,
43
],
[
45
],
[
47
],
[
49,
51,
53
],
[
55
],
[
57
],
[
59,
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103
],
[
105
],
[
111
],
[
113
],
[
115
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
145
],
[
147
],
[
149,
151
],
[
153,
157
],
[
161
],
[
163
],
[
167
],
[
169
]
] |
17,427
|
static void dct_unquantize_mpeg2_mmx(MpegEncContext *s,
DCTELEM *block, int n, int qscale)
{
int nCoeffs;
const UINT16 *quant_matrix;
if(s->alternate_scan) nCoeffs= 64;
else nCoeffs= nCoeffs= zigzag_end[ s->block_last_index[n] ];
if (s->mb_intra) {
int block0;
if (n < 4)
block0 = block[0] * s->y_dc_scale;
else
block0 = block[0] * s->c_dc_scale;
quant_matrix = s->intra_matrix;
asm volatile(
"pcmpeqw %%mm7, %%mm7 \n\t"
"psrlw $15, %%mm7 \n\t"
"movd %2, %%mm6 \n\t"
"packssdw %%mm6, %%mm6 \n\t"
"packssdw %%mm6, %%mm6 \n\t"
"movl %3, %%eax \n\t"
".balign 16\n\t"
"1: \n\t"
"movq (%0, %%eax), %%mm0 \n\t"
"movq 8(%0, %%eax), %%mm1 \n\t"
"movq (%1, %%eax), %%mm4 \n\t"
"movq 8(%1, %%eax), %%mm5 \n\t"
"pmullw %%mm6, %%mm4 \n\t" // q=qscale*quant_matrix[i]
"pmullw %%mm6, %%mm5 \n\t" // q=qscale*quant_matrix[i]
"pxor %%mm2, %%mm2 \n\t"
"pxor %%mm3, %%mm3 \n\t"
"pcmpgtw %%mm0, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
"pcmpgtw %%mm1, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
"pxor %%mm2, %%mm0 \n\t"
"pxor %%mm3, %%mm1 \n\t"
"psubw %%mm2, %%mm0 \n\t" // abs(block[i])
"psubw %%mm3, %%mm1 \n\t" // abs(block[i])
"pmullw %%mm4, %%mm0 \n\t" // abs(block[i])*q
"pmullw %%mm5, %%mm1 \n\t" // abs(block[i])*q
"pxor %%mm4, %%mm4 \n\t"
"pxor %%mm5, %%mm5 \n\t" // FIXME slow
"pcmpeqw (%0, %%eax), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
"pcmpeqw 8(%0, %%eax), %%mm5 \n\t" // block[i] == 0 ? -1 : 0
"psraw $3, %%mm0 \n\t"
"psraw $3, %%mm1 \n\t"
"pxor %%mm2, %%mm0 \n\t"
"pxor %%mm3, %%mm1 \n\t"
"psubw %%mm2, %%mm0 \n\t"
"psubw %%mm3, %%mm1 \n\t"
"pandn %%mm0, %%mm4 \n\t"
"pandn %%mm1, %%mm5 \n\t"
"movq %%mm4, (%0, %%eax) \n\t"
"movq %%mm5, 8(%0, %%eax) \n\t"
"addl $16, %%eax \n\t"
"js 1b \n\t"
::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "g" (qscale), "g" (-2*nCoeffs)
: "%eax", "memory"
);
block[0]= block0;
//Note, we dont do mismatch control for intra as errors cannot accumulate
} else {
quant_matrix = s->non_intra_matrix;
asm volatile(
"pcmpeqw %%mm7, %%mm7 \n\t"
"psrlq $48, %%mm7 \n\t"
"movd %2, %%mm6 \n\t"
"packssdw %%mm6, %%mm6 \n\t"
"packssdw %%mm6, %%mm6 \n\t"
"movl %3, %%eax \n\t"
".balign 16\n\t"
"1: \n\t"
"movq (%0, %%eax), %%mm0 \n\t"
"movq 8(%0, %%eax), %%mm1 \n\t"
"movq (%1, %%eax), %%mm4 \n\t"
"movq 8(%1, %%eax), %%mm5 \n\t"
"pmullw %%mm6, %%mm4 \n\t" // q=qscale*quant_matrix[i]
"pmullw %%mm6, %%mm5 \n\t" // q=qscale*quant_matrix[i]
"pxor %%mm2, %%mm2 \n\t"
"pxor %%mm3, %%mm3 \n\t"
"pcmpgtw %%mm0, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
"pcmpgtw %%mm1, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
"pxor %%mm2, %%mm0 \n\t"
"pxor %%mm3, %%mm1 \n\t"
"psubw %%mm2, %%mm0 \n\t" // abs(block[i])
"psubw %%mm3, %%mm1 \n\t" // abs(block[i])
"paddw %%mm0, %%mm0 \n\t" // abs(block[i])*2
"paddw %%mm1, %%mm1 \n\t" // abs(block[i])*2
"pmullw %%mm4, %%mm0 \n\t" // abs(block[i])*2*q
"pmullw %%mm5, %%mm1 \n\t" // abs(block[i])*2*q
"paddw %%mm4, %%mm0 \n\t" // (abs(block[i])*2 + 1)*q
"paddw %%mm5, %%mm1 \n\t" // (abs(block[i])*2 + 1)*q
"pxor %%mm4, %%mm4 \n\t"
"pxor %%mm5, %%mm5 \n\t" // FIXME slow
"pcmpeqw (%0, %%eax), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
"pcmpeqw 8(%0, %%eax), %%mm5 \n\t" // block[i] == 0 ? -1 : 0
"psrlw $4, %%mm0 \n\t"
"psrlw $4, %%mm1 \n\t"
"pxor %%mm2, %%mm0 \n\t"
"pxor %%mm3, %%mm1 \n\t"
"psubw %%mm2, %%mm0 \n\t"
"psubw %%mm3, %%mm1 \n\t"
"pandn %%mm0, %%mm4 \n\t"
"pandn %%mm1, %%mm5 \n\t"
"pxor %%mm4, %%mm7 \n\t"
"pxor %%mm5, %%mm7 \n\t"
"movq %%mm4, (%0, %%eax) \n\t"
"movq %%mm5, 8(%0, %%eax) \n\t"
"addl $16, %%eax \n\t"
"js 1b \n\t"
"movd 124(%0, %3), %%mm0 \n\t"
"movq %%mm7, %%mm6 \n\t"
"psrlq $32, %%mm7 \n\t"
"pxor %%mm6, %%mm7 \n\t"
"movq %%mm7, %%mm6 \n\t"
"psrlq $16, %%mm7 \n\t"
"pxor %%mm6, %%mm7 \n\t"
"pslld $31, %%mm7 \n\t"
"psrlq $15, %%mm7 \n\t"
"pxor %%mm7, %%mm0 \n\t"
"movd %%mm0, 124(%0, %3) \n\t"
::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "g" (qscale), "r" (-2*nCoeffs)
: "%eax", "memory"
);
}
}
| true
|
FFmpeg
|
d7e9533aa06f4073a27812349b35ba5fede11ca1
|
static void dct_unquantize_mpeg2_mmx(MpegEncContext *s,
DCTELEM *block, int n, int qscale)
{
int nCoeffs;
const UINT16 *quant_matrix;
if(s->alternate_scan) nCoeffs= 64;
else nCoeffs= nCoeffs= zigzag_end[ s->block_last_index[n] ];
if (s->mb_intra) {
int block0;
if (n < 4)
block0 = block[0] * s->y_dc_scale;
else
block0 = block[0] * s->c_dc_scale;
quant_matrix = s->intra_matrix;
asm volatile(
"pcmpeqw %%mm7, %%mm7 \n\t"
"psrlw $15, %%mm7 \n\t"
"movd %2, %%mm6 \n\t"
"packssdw %%mm6, %%mm6 \n\t"
"packssdw %%mm6, %%mm6 \n\t"
"movl %3, %%eax \n\t"
".balign 16\n\t"
"1: \n\t"
"movq (%0, %%eax), %%mm0 \n\t"
"movq 8(%0, %%eax), %%mm1 \n\t"
"movq (%1, %%eax), %%mm4 \n\t"
"movq 8(%1, %%eax), %%mm5 \n\t"
"pmullw %%mm6, %%mm4 \n\t"
"pmullw %%mm6, %%mm5 \n\t"
"pxor %%mm2, %%mm2 \n\t"
"pxor %%mm3, %%mm3 \n\t"
"pcmpgtw %%mm0, %%mm2 \n\t"
"pcmpgtw %%mm1, %%mm3 \n\t"
"pxor %%mm2, %%mm0 \n\t"
"pxor %%mm3, %%mm1 \n\t"
"psubw %%mm2, %%mm0 \n\t"
"psubw %%mm3, %%mm1 \n\t"
"pmullw %%mm4, %%mm0 \n\t" *q
"pmullw %%mm5, %%mm1 \n\t" *q
"pxor %%mm4, %%mm4 \n\t"
"pxor %%mm5, %%mm5 \n\t"
"pcmpeqw (%0, %%eax), %%mm4 \n\t"
"pcmpeqw 8(%0, %%eax), %%mm5 \n\t"
"psraw $3, %%mm0 \n\t"
"psraw $3, %%mm1 \n\t"
"pxor %%mm2, %%mm0 \n\t"
"pxor %%mm3, %%mm1 \n\t"
"psubw %%mm2, %%mm0 \n\t"
"psubw %%mm3, %%mm1 \n\t"
"pandn %%mm0, %%mm4 \n\t"
"pandn %%mm1, %%mm5 \n\t"
"movq %%mm4, (%0, %%eax) \n\t"
"movq %%mm5, 8(%0, %%eax) \n\t"
"addl $16, %%eax \n\t"
"js 1b \n\t"
::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "g" (qscale), "g" (-2*nCoeffs)
: "%eax", "memory"
);
block[0]= block0;
} else {
quant_matrix = s->non_intra_matrix;
asm volatile(
"pcmpeqw %%mm7, %%mm7 \n\t"
"psrlq $48, %%mm7 \n\t"
"movd %2, %%mm6 \n\t"
"packssdw %%mm6, %%mm6 \n\t"
"packssdw %%mm6, %%mm6 \n\t"
"movl %3, %%eax \n\t"
".balign 16\n\t"
"1: \n\t"
"movq (%0, %%eax), %%mm0 \n\t"
"movq 8(%0, %%eax), %%mm1 \n\t"
"movq (%1, %%eax), %%mm4 \n\t"
"movq 8(%1, %%eax), %%mm5 \n\t"
"pmullw %%mm6, %%mm4 \n\t"
"pmullw %%mm6, %%mm5 \n\t"
"pxor %%mm2, %%mm2 \n\t"
"pxor %%mm3, %%mm3 \n\t"
"pcmpgtw %%mm0, %%mm2 \n\t"
"pcmpgtw %%mm1, %%mm3 \n\t"
"pxor %%mm2, %%mm0 \n\t"
"pxor %%mm3, %%mm1 \n\t"
"psubw %%mm2, %%mm0 \n\t"
"psubw %%mm3, %%mm1 \n\t"
"paddw %%mm0, %%mm0 \n\t" *2
"paddw %%mm1, %%mm1 \n\t" *2
"pmullw %%mm4, %%mm0 \n\t" *2*q
"pmullw %%mm5, %%mm1 \n\t" *2*q
"paddw %%mm4, %%mm0 \n\t"
"paddw %%mm5, %%mm1 \n\t"
"pxor %%mm4, %%mm4 \n\t"
"pxor %%mm5, %%mm5 \n\t"
"pcmpeqw (%0, %%eax), %%mm4 \n\t"
"pcmpeqw 8(%0, %%eax), %%mm5 \n\t"
"psrlw $4, %%mm0 \n\t"
"psrlw $4, %%mm1 \n\t"
"pxor %%mm2, %%mm0 \n\t"
"pxor %%mm3, %%mm1 \n\t"
"psubw %%mm2, %%mm0 \n\t"
"psubw %%mm3, %%mm1 \n\t"
"pandn %%mm0, %%mm4 \n\t"
"pandn %%mm1, %%mm5 \n\t"
"pxor %%mm4, %%mm7 \n\t"
"pxor %%mm5, %%mm7 \n\t"
"movq %%mm4, (%0, %%eax) \n\t"
"movq %%mm5, 8(%0, %%eax) \n\t"
"addl $16, %%eax \n\t"
"js 1b \n\t"
"movd 124(%0, %3), %%mm0 \n\t"
"movq %%mm7, %%mm6 \n\t"
"psrlq $32, %%mm7 \n\t"
"pxor %%mm6, %%mm7 \n\t"
"movq %%mm7, %%mm6 \n\t"
"psrlq $16, %%mm7 \n\t"
"pxor %%mm6, %%mm7 \n\t"
"pslld $31, %%mm7 \n\t"
"psrlq $15, %%mm7 \n\t"
"pxor %%mm7, %%mm0 \n\t"
"movd %%mm0, 124(%0, %3) \n\t"
::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "g" (qscale), "r" (-2*nCoeffs)
: "%eax", "memory"
);
}
}
|
{
"code": [
" quant_matrix = s->non_intra_matrix;",
" quant_matrix = s->non_intra_matrix;",
"\t);",
"\t);",
" } else {",
" } else {",
" quant_matrix = s->non_intra_matrix;",
" quant_matrix = s->non_intra_matrix;"
],
"line_no": [
131,
131,
257,
257,
129,
129,
131,
131
]
}
|
static void FUNC_0(MpegEncContext *VAR_0,
DCTELEM *VAR_1, int VAR_2, int VAR_3)
{
int VAR_4;
const UINT16 *VAR_5;
if(VAR_0->alternate_scan) VAR_4= 64;
else VAR_4= VAR_4= zigzag_end[ VAR_0->block_last_index[VAR_2] ];
if (VAR_0->mb_intra) {
int VAR_6;
if (VAR_2 < 4)
VAR_6 = VAR_1[0] * VAR_0->y_dc_scale;
else
VAR_6 = VAR_1[0] * VAR_0->c_dc_scale;
VAR_5 = VAR_0->intra_matrix;
asm volatile(
"pcmpeqw %%mm7, %%mm7 \VAR_2\t"
"psrlw $15, %%mm7 \VAR_2\t"
"movd %2, %%mm6 \VAR_2\t"
"packssdw %%mm6, %%mm6 \VAR_2\t"
"packssdw %%mm6, %%mm6 \VAR_2\t"
"movl %3, %%eax \VAR_2\t"
".balign 16\VAR_2\t"
"1: \VAR_2\t"
"movq (%0, %%eax), %%mm0 \VAR_2\t"
"movq 8(%0, %%eax), %%mm1 \VAR_2\t"
"movq (%1, %%eax), %%mm4 \VAR_2\t"
"movq 8(%1, %%eax), %%mm5 \VAR_2\t"
"pmullw %%mm6, %%mm4 \VAR_2\t"
"pmullw %%mm6, %%mm5 \VAR_2\t"
"pxor %%mm2, %%mm2 \VAR_2\t"
"pxor %%mm3, %%mm3 \VAR_2\t"
"pcmpgtw %%mm0, %%mm2 \VAR_2\t"
"pcmpgtw %%mm1, %%mm3 \VAR_2\t"
"pxor %%mm2, %%mm0 \VAR_2\t"
"pxor %%mm3, %%mm1 \VAR_2\t"
"psubw %%mm2, %%mm0 \VAR_2\t"
"psubw %%mm3, %%mm1 \VAR_2\t"
"pmullw %%mm4, %%mm0 \VAR_2\t" *q
"pmullw %%mm5, %%mm1 \VAR_2\t" *q
"pxor %%mm4, %%mm4 \VAR_2\t"
"pxor %%mm5, %%mm5 \VAR_2\t"
"pcmpeqw (%0, %%eax), %%mm4 \VAR_2\t"
"pcmpeqw 8(%0, %%eax), %%mm5 \VAR_2\t"
"psraw $3, %%mm0 \VAR_2\t"
"psraw $3, %%mm1 \VAR_2\t"
"pxor %%mm2, %%mm0 \VAR_2\t"
"pxor %%mm3, %%mm1 \VAR_2\t"
"psubw %%mm2, %%mm0 \VAR_2\t"
"psubw %%mm3, %%mm1 \VAR_2\t"
"pandn %%mm0, %%mm4 \VAR_2\t"
"pandn %%mm1, %%mm5 \VAR_2\t"
"movq %%mm4, (%0, %%eax) \VAR_2\t"
"movq %%mm5, 8(%0, %%eax) \VAR_2\t"
"addl $16, %%eax \VAR_2\t"
"js 1b \VAR_2\t"
::"r" (VAR_1+VAR_4), "r"(VAR_5+VAR_4), "g" (VAR_3), "g" (-2*VAR_4)
: "%eax", "memory"
);
VAR_1[0]= VAR_6;
} else {
VAR_5 = VAR_0->non_intra_matrix;
asm volatile(
"pcmpeqw %%mm7, %%mm7 \VAR_2\t"
"psrlq $48, %%mm7 \VAR_2\t"
"movd %2, %%mm6 \VAR_2\t"
"packssdw %%mm6, %%mm6 \VAR_2\t"
"packssdw %%mm6, %%mm6 \VAR_2\t"
"movl %3, %%eax \VAR_2\t"
".balign 16\VAR_2\t"
"1: \VAR_2\t"
"movq (%0, %%eax), %%mm0 \VAR_2\t"
"movq 8(%0, %%eax), %%mm1 \VAR_2\t"
"movq (%1, %%eax), %%mm4 \VAR_2\t"
"movq 8(%1, %%eax), %%mm5 \VAR_2\t"
"pmullw %%mm6, %%mm4 \VAR_2\t"
"pmullw %%mm6, %%mm5 \VAR_2\t"
"pxor %%mm2, %%mm2 \VAR_2\t"
"pxor %%mm3, %%mm3 \VAR_2\t"
"pcmpgtw %%mm0, %%mm2 \VAR_2\t"
"pcmpgtw %%mm1, %%mm3 \VAR_2\t"
"pxor %%mm2, %%mm0 \VAR_2\t"
"pxor %%mm3, %%mm1 \VAR_2\t"
"psubw %%mm2, %%mm0 \VAR_2\t"
"psubw %%mm3, %%mm1 \VAR_2\t"
"paddw %%mm0, %%mm0 \VAR_2\t" *2
"paddw %%mm1, %%mm1 \VAR_2\t" *2
"pmullw %%mm4, %%mm0 \VAR_2\t" *2*q
"pmullw %%mm5, %%mm1 \VAR_2\t" *2*q
"paddw %%mm4, %%mm0 \VAR_2\t"
"paddw %%mm5, %%mm1 \VAR_2\t"
"pxor %%mm4, %%mm4 \VAR_2\t"
"pxor %%mm5, %%mm5 \VAR_2\t"
"pcmpeqw (%0, %%eax), %%mm4 \VAR_2\t"
"pcmpeqw 8(%0, %%eax), %%mm5 \VAR_2\t"
"psrlw $4, %%mm0 \VAR_2\t"
"psrlw $4, %%mm1 \VAR_2\t"
"pxor %%mm2, %%mm0 \VAR_2\t"
"pxor %%mm3, %%mm1 \VAR_2\t"
"psubw %%mm2, %%mm0 \VAR_2\t"
"psubw %%mm3, %%mm1 \VAR_2\t"
"pandn %%mm0, %%mm4 \VAR_2\t"
"pandn %%mm1, %%mm5 \VAR_2\t"
"pxor %%mm4, %%mm7 \VAR_2\t"
"pxor %%mm5, %%mm7 \VAR_2\t"
"movq %%mm4, (%0, %%eax) \VAR_2\t"
"movq %%mm5, 8(%0, %%eax) \VAR_2\t"
"addl $16, %%eax \VAR_2\t"
"js 1b \VAR_2\t"
"movd 124(%0, %3), %%mm0 \VAR_2\t"
"movq %%mm7, %%mm6 \VAR_2\t"
"psrlq $32, %%mm7 \VAR_2\t"
"pxor %%mm6, %%mm7 \VAR_2\t"
"movq %%mm7, %%mm6 \VAR_2\t"
"psrlq $16, %%mm7 \VAR_2\t"
"pxor %%mm6, %%mm7 \VAR_2\t"
"pslld $31, %%mm7 \VAR_2\t"
"psrlq $15, %%mm7 \VAR_2\t"
"pxor %%mm7, %%mm0 \VAR_2\t"
"movd %%mm0, 124(%0, %3) \VAR_2\t"
::"r" (VAR_1+VAR_4), "r"(VAR_5+VAR_4), "g" (VAR_3), "r" (-2*VAR_4)
: "%eax", "memory"
);
}
}
|
[
"static void FUNC_0(MpegEncContext *VAR_0,\nDCTELEM *VAR_1, int VAR_2, int VAR_3)\n{",
"int VAR_4;",
"const UINT16 *VAR_5;",
"if(VAR_0->alternate_scan) VAR_4= 64;",
"else VAR_4= VAR_4= zigzag_end[ VAR_0->block_last_index[VAR_2] ];",
"if (VAR_0->mb_intra) {",
"int VAR_6;",
"if (VAR_2 < 4)\nVAR_6 = VAR_1[0] * VAR_0->y_dc_scale;",
"else\nVAR_6 = VAR_1[0] * VAR_0->c_dc_scale;",
"VAR_5 = VAR_0->intra_matrix;",
"asm volatile(\n\"pcmpeqw %%mm7, %%mm7\t\t\\VAR_2\\t\"\n\"psrlw $15, %%mm7\t\t\\VAR_2\\t\"\n\"movd %2, %%mm6\t\t\t\\VAR_2\\t\"\n\"packssdw %%mm6, %%mm6\t\t\\VAR_2\\t\"\n\"packssdw %%mm6, %%mm6\t\t\\VAR_2\\t\"\n\"movl %3, %%eax\t\t\t\\VAR_2\\t\"\n\".balign 16\\VAR_2\\t\"\n\"1:\t\t\t\t\\VAR_2\\t\"\n\"movq (%0, %%eax), %%mm0\t\\VAR_2\\t\"\n\"movq 8(%0, %%eax), %%mm1\t\\VAR_2\\t\"\n\"movq (%1, %%eax), %%mm4\t\\VAR_2\\t\"\n\"movq 8(%1, %%eax), %%mm5\t\\VAR_2\\t\"\n\"pmullw %%mm6, %%mm4\t\t\\VAR_2\\t\"\n\"pmullw %%mm6, %%mm5\t\t\\VAR_2\\t\"\n\"pxor %%mm2, %%mm2\t\t\\VAR_2\\t\"\n\"pxor %%mm3, %%mm3\t\t\\VAR_2\\t\"\n\"pcmpgtw %%mm0, %%mm2\t\t\\VAR_2\\t\"\n\"pcmpgtw %%mm1, %%mm3\t\t\\VAR_2\\t\"\n\"pxor %%mm2, %%mm0\t\t\\VAR_2\\t\"\n\"pxor %%mm3, %%mm1\t\t\\VAR_2\\t\"\n\"psubw %%mm2, %%mm0\t\t\\VAR_2\\t\"\n\"psubw %%mm3, %%mm1\t\t\\VAR_2\\t\"\n\"pmullw %%mm4, %%mm0\t\t\\VAR_2\\t\" *q\n\"pmullw %%mm5, %%mm1\t\t\\VAR_2\\t\" *q\n\"pxor %%mm4, %%mm4\t\t\\VAR_2\\t\"\n\"pxor %%mm5, %%mm5\t\t\\VAR_2\\t\"\n\"pcmpeqw (%0, %%eax), %%mm4\t\\VAR_2\\t\"\n\"pcmpeqw 8(%0, %%eax), %%mm5\t\\VAR_2\\t\"\n\"psraw $3, %%mm0\t\t\\VAR_2\\t\"\n\"psraw $3, %%mm1\t\t\\VAR_2\\t\"\n\"pxor %%mm2, %%mm0\t\t\\VAR_2\\t\"\n\"pxor %%mm3, %%mm1\t\t\\VAR_2\\t\"\n\"psubw %%mm2, %%mm0\t\t\\VAR_2\\t\"\n\"psubw %%mm3, %%mm1\t\t\\VAR_2\\t\"\n\"pandn %%mm0, %%mm4\t\t\\VAR_2\\t\"\n\"pandn %%mm1, %%mm5\t\t\\VAR_2\\t\"\n\"movq %%mm4, (%0, %%eax)\t\\VAR_2\\t\"\n\"movq %%mm5, 8(%0, %%eax)\t\\VAR_2\\t\"\n\"addl $16, %%eax\t\t\\VAR_2\\t\"\n\"js 1b\t\t\t\t\\VAR_2\\t\"\n::\"r\" (VAR_1+VAR_4), \"r\"(VAR_5+VAR_4), \"g\" (VAR_3), \"g\" (-2*VAR_4)\n: \"%eax\", \"memory\"\n);",
"VAR_1[0]= VAR_6;",
"} else {",
"VAR_5 = VAR_0->non_intra_matrix;",
"asm volatile(\n\"pcmpeqw %%mm7, %%mm7\t\t\\VAR_2\\t\"\n\"psrlq $48, %%mm7\t\t\\VAR_2\\t\"\n\"movd %2, %%mm6\t\t\t\\VAR_2\\t\"\n\"packssdw %%mm6, %%mm6\t\t\\VAR_2\\t\"\n\"packssdw %%mm6, %%mm6\t\t\\VAR_2\\t\"\n\"movl %3, %%eax\t\t\t\\VAR_2\\t\"\n\".balign 16\\VAR_2\\t\"\n\"1:\t\t\t\t\\VAR_2\\t\"\n\"movq (%0, %%eax), %%mm0\t\\VAR_2\\t\"\n\"movq 8(%0, %%eax), %%mm1\t\\VAR_2\\t\"\n\"movq (%1, %%eax), %%mm4\t\\VAR_2\\t\"\n\"movq 8(%1, %%eax), %%mm5\t\\VAR_2\\t\"\n\"pmullw %%mm6, %%mm4\t\t\\VAR_2\\t\"\n\"pmullw %%mm6, %%mm5\t\t\\VAR_2\\t\"\n\"pxor %%mm2, %%mm2\t\t\\VAR_2\\t\"\n\"pxor %%mm3, %%mm3\t\t\\VAR_2\\t\"\n\"pcmpgtw %%mm0, %%mm2\t\t\\VAR_2\\t\"\n\"pcmpgtw %%mm1, %%mm3\t\t\\VAR_2\\t\"\n\"pxor %%mm2, %%mm0\t\t\\VAR_2\\t\"\n\"pxor %%mm3, %%mm1\t\t\\VAR_2\\t\"\n\"psubw %%mm2, %%mm0\t\t\\VAR_2\\t\"\n\"psubw %%mm3, %%mm1\t\t\\VAR_2\\t\"\n\"paddw %%mm0, %%mm0\t\t\\VAR_2\\t\" *2\n\"paddw %%mm1, %%mm1\t\t\\VAR_2\\t\" *2\n\"pmullw %%mm4, %%mm0\t\t\\VAR_2\\t\" *2*q\n\"pmullw %%mm5, %%mm1\t\t\\VAR_2\\t\" *2*q\n\"paddw %%mm4, %%mm0\t\t\\VAR_2\\t\"\n\"paddw %%mm5, %%mm1\t\t\\VAR_2\\t\"\n\"pxor %%mm4, %%mm4\t\t\\VAR_2\\t\"\n\"pxor %%mm5, %%mm5\t\t\\VAR_2\\t\"\n\"pcmpeqw (%0, %%eax), %%mm4\t\\VAR_2\\t\"\n\"pcmpeqw 8(%0, %%eax), %%mm5\t\\VAR_2\\t\"\n\"psrlw $4, %%mm0\t\t\\VAR_2\\t\"\n\"psrlw $4, %%mm1\t\t\\VAR_2\\t\"\n\"pxor %%mm2, %%mm0\t\t\\VAR_2\\t\"\n\"pxor %%mm3, %%mm1\t\t\\VAR_2\\t\"\n\"psubw %%mm2, %%mm0\t\t\\VAR_2\\t\"\n\"psubw %%mm3, %%mm1\t\t\\VAR_2\\t\"\n\"pandn %%mm0, %%mm4\t\t\\VAR_2\\t\"\n\"pandn %%mm1, %%mm5\t\t\\VAR_2\\t\"\n\"pxor %%mm4, %%mm7\t\t\\VAR_2\\t\"\n\"pxor %%mm5, %%mm7\t\t\\VAR_2\\t\"\n\"movq %%mm4, (%0, %%eax)\t\\VAR_2\\t\"\n\"movq %%mm5, 8(%0, %%eax)\t\\VAR_2\\t\"\n\"addl $16, %%eax\t\t\\VAR_2\\t\"\n\"js 1b\t\t\t\t\\VAR_2\\t\"\n\"movd 124(%0, %3), %%mm0\t\\VAR_2\\t\"\n\"movq %%mm7, %%mm6\t\t\\VAR_2\\t\"\n\"psrlq $32, %%mm7\t\t\\VAR_2\\t\"\n\"pxor %%mm6, %%mm7\t\t\\VAR_2\\t\"\n\"movq %%mm7, %%mm6\t\t\\VAR_2\\t\"\n\"psrlq $16, %%mm7\t\t\\VAR_2\\t\"\n\"pxor %%mm6, %%mm7\t\t\\VAR_2\\t\"\n\"pslld $31, %%mm7\t\t\\VAR_2\\t\"\n\"psrlq $15, %%mm7\t\t\\VAR_2\\t\"\n\"pxor %%mm7, %%mm0\t\t\\VAR_2\\t\"\n\"movd %%mm0, 124(%0, %3)\t\\VAR_2\\t\"\n::\"r\" (VAR_1+VAR_4), \"r\"(VAR_5+VAR_4), \"g\" (VAR_3), \"r\" (-2*VAR_4)\n: \"%eax\", \"memory\"\n);",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23,
25
],
[
27,
29
],
[
31
],
[
33,
35,
37,
39,
41,
43,
45,
47,
49,
51,
53,
55,
57,
59,
61,
63,
65,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91,
93,
95,
97,
99,
101,
103,
105,
107,
109,
113,
115,
117,
119,
121
],
[
123
],
[
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,
225,
227,
229,
231,
233,
235,
237,
239,
241,
243,
245,
247,
249,
253,
255,
257
],
[
259
],
[
261
]
] |
17,429
|
static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
{
int i;
avio_wb32(pb, 24); /* size */
ffio_wfourcc(pb, "ACLR");
ffio_wfourcc(pb, "ACLR");
ffio_wfourcc(pb, "0001");
if (track->enc->color_range == AVCOL_RANGE_MPEG || /* Legal range (16-235) */
track->enc->color_range == AVCOL_RANGE_UNSPECIFIED) {
avio_wb32(pb, 1); /* Corresponds to 709 in official encoder */
} else { /* Full range (0-255) */
avio_wb32(pb, 2); /* Corresponds to RGB in official encoder */
}
avio_wb32(pb, 0); /* unknown */
avio_wb32(pb, 24); /* size */
ffio_wfourcc(pb, "APRG");
ffio_wfourcc(pb, "APRG");
ffio_wfourcc(pb, "0001");
avio_wb32(pb, 1); /* unknown */
avio_wb32(pb, 0); /* unknown */
avio_wb32(pb, 120); /* size */
ffio_wfourcc(pb, "ARES");
ffio_wfourcc(pb, "ARES");
ffio_wfourcc(pb, "0001");
avio_wb32(pb, AV_RB32(track->vos_data + 0x28)); /* dnxhd cid, some id ? */
avio_wb32(pb, track->enc->width);
/* values below are based on samples created with quicktime and avid codecs */
if (track->vos_data[5] & 2) { // interlaced
avio_wb32(pb, track->enc->height / 2);
avio_wb32(pb, 2); /* unknown */
avio_wb32(pb, 0); /* unknown */
avio_wb32(pb, 4); /* unknown */
} else {
avio_wb32(pb, track->enc->height);
avio_wb32(pb, 1); /* unknown */
avio_wb32(pb, 0); /* unknown */
if (track->enc->height == 1080)
avio_wb32(pb, 5); /* unknown */
else
avio_wb32(pb, 6); /* unknown */
}
/* padding */
for (i = 0; i < 10; i++)
avio_wb64(pb, 0);
/* extra padding for stsd needed */
avio_wb32(pb, 0);
return 0;
}
| true
|
FFmpeg
|
31c7c0e156975be615479948824c1528952c0731
|
static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
{
int i;
avio_wb32(pb, 24);
ffio_wfourcc(pb, "ACLR");
ffio_wfourcc(pb, "ACLR");
ffio_wfourcc(pb, "0001");
if (track->enc->color_range == AVCOL_RANGE_MPEG ||
track->enc->color_range == AVCOL_RANGE_UNSPECIFIED) {
avio_wb32(pb, 1);
} else {
avio_wb32(pb, 2);
}
avio_wb32(pb, 0);
avio_wb32(pb, 24);
ffio_wfourcc(pb, "APRG");
ffio_wfourcc(pb, "APRG");
ffio_wfourcc(pb, "0001");
avio_wb32(pb, 1);
avio_wb32(pb, 0);
avio_wb32(pb, 120);
ffio_wfourcc(pb, "ARES");
ffio_wfourcc(pb, "ARES");
ffio_wfourcc(pb, "0001");
avio_wb32(pb, AV_RB32(track->vos_data + 0x28));
avio_wb32(pb, track->enc->width);
if (track->vos_data[5] & 2) {
avio_wb32(pb, track->enc->height / 2);
avio_wb32(pb, 2);
avio_wb32(pb, 0);
avio_wb32(pb, 4);
} else {
avio_wb32(pb, track->enc->height);
avio_wb32(pb, 1);
avio_wb32(pb, 0);
if (track->enc->height == 1080)
avio_wb32(pb, 5);
else
avio_wb32(pb, 6);
}
for (i = 0; i < 10; i++)
avio_wb64(pb, 0);
avio_wb32(pb, 0);
return 0;
}
|
{
"code": [
" avio_wb32(pb, 0);"
],
"line_no": [
97
]
}
|
static int FUNC_0(AVIOContext *VAR_0, MOVTrack *VAR_1)
{
int VAR_2;
avio_wb32(VAR_0, 24);
ffio_wfourcc(VAR_0, "ACLR");
ffio_wfourcc(VAR_0, "ACLR");
ffio_wfourcc(VAR_0, "0001");
if (VAR_1->enc->color_range == AVCOL_RANGE_MPEG ||
VAR_1->enc->color_range == AVCOL_RANGE_UNSPECIFIED) {
avio_wb32(VAR_0, 1);
} else {
avio_wb32(VAR_0, 2);
}
avio_wb32(VAR_0, 0);
avio_wb32(VAR_0, 24);
ffio_wfourcc(VAR_0, "APRG");
ffio_wfourcc(VAR_0, "APRG");
ffio_wfourcc(VAR_0, "0001");
avio_wb32(VAR_0, 1);
avio_wb32(VAR_0, 0);
avio_wb32(VAR_0, 120);
ffio_wfourcc(VAR_0, "ARES");
ffio_wfourcc(VAR_0, "ARES");
ffio_wfourcc(VAR_0, "0001");
avio_wb32(VAR_0, AV_RB32(VAR_1->vos_data + 0x28));
avio_wb32(VAR_0, VAR_1->enc->width);
if (VAR_1->vos_data[5] & 2) {
avio_wb32(VAR_0, VAR_1->enc->height / 2);
avio_wb32(VAR_0, 2);
avio_wb32(VAR_0, 0);
avio_wb32(VAR_0, 4);
} else {
avio_wb32(VAR_0, VAR_1->enc->height);
avio_wb32(VAR_0, 1);
avio_wb32(VAR_0, 0);
if (VAR_1->enc->height == 1080)
avio_wb32(VAR_0, 5);
else
avio_wb32(VAR_0, 6);
}
for (VAR_2 = 0; VAR_2 < 10; VAR_2++)
avio_wb64(VAR_0, 0);
avio_wb32(VAR_0, 0);
return 0;
}
|
[
"static int FUNC_0(AVIOContext *VAR_0, MOVTrack *VAR_1)\n{",
"int VAR_2;",
"avio_wb32(VAR_0, 24);",
"ffio_wfourcc(VAR_0, \"ACLR\");",
"ffio_wfourcc(VAR_0, \"ACLR\");",
"ffio_wfourcc(VAR_0, \"0001\");",
"if (VAR_1->enc->color_range == AVCOL_RANGE_MPEG ||\nVAR_1->enc->color_range == AVCOL_RANGE_UNSPECIFIED) {",
"avio_wb32(VAR_0, 1);",
"} else {",
"avio_wb32(VAR_0, 2);",
"}",
"avio_wb32(VAR_0, 0);",
"avio_wb32(VAR_0, 24);",
"ffio_wfourcc(VAR_0, \"APRG\");",
"ffio_wfourcc(VAR_0, \"APRG\");",
"ffio_wfourcc(VAR_0, \"0001\");",
"avio_wb32(VAR_0, 1);",
"avio_wb32(VAR_0, 0);",
"avio_wb32(VAR_0, 120);",
"ffio_wfourcc(VAR_0, \"ARES\");",
"ffio_wfourcc(VAR_0, \"ARES\");",
"ffio_wfourcc(VAR_0, \"0001\");",
"avio_wb32(VAR_0, AV_RB32(VAR_1->vos_data + 0x28));",
"avio_wb32(VAR_0, VAR_1->enc->width);",
"if (VAR_1->vos_data[5] & 2) {",
"avio_wb32(VAR_0, VAR_1->enc->height / 2);",
"avio_wb32(VAR_0, 2);",
"avio_wb32(VAR_0, 0);",
"avio_wb32(VAR_0, 4);",
"} else {",
"avio_wb32(VAR_0, VAR_1->enc->height);",
"avio_wb32(VAR_0, 1);",
"avio_wb32(VAR_0, 0);",
"if (VAR_1->enc->height == 1080)\navio_wb32(VAR_0, 5);",
"else\navio_wb32(VAR_0, 6);",
"}",
"for (VAR_2 = 0; VAR_2 < 10; VAR_2++)",
"avio_wb64(VAR_0, 0);",
"avio_wb32(VAR_0, 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,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15,
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77,
79
],
[
81,
83
],
[
85
],
[
89
],
[
91
],
[
97
],
[
99
],
[
101
]
] |
17,430
|
static qemu_irq *icp_pic_init(uint32_t base,
qemu_irq parent_irq, qemu_irq parent_fiq)
{
icp_pic_state *s;
int iomemtype;
qemu_irq *qi;
s = (icp_pic_state *)qemu_mallocz(sizeof(icp_pic_state));
if (!s)
return NULL;
qi = qemu_allocate_irqs(icp_pic_set_irq, s, 32);
s->base = base;
s->parent_irq = parent_irq;
s->parent_fiq = parent_fiq;
iomemtype = cpu_register_io_memory(0, icp_pic_readfn,
icp_pic_writefn, s);
cpu_register_physical_memory(base, 0x007fffff, iomemtype);
/* ??? Save/restore. */
return qi;
}
| true
|
qemu
|
187337f8b0ec0813dd3876d1efe37d415fb81c2e
|
static qemu_irq *icp_pic_init(uint32_t base,
qemu_irq parent_irq, qemu_irq parent_fiq)
{
icp_pic_state *s;
int iomemtype;
qemu_irq *qi;
s = (icp_pic_state *)qemu_mallocz(sizeof(icp_pic_state));
if (!s)
return NULL;
qi = qemu_allocate_irqs(icp_pic_set_irq, s, 32);
s->base = base;
s->parent_irq = parent_irq;
s->parent_fiq = parent_fiq;
iomemtype = cpu_register_io_memory(0, icp_pic_readfn,
icp_pic_writefn, s);
cpu_register_physical_memory(base, 0x007fffff, iomemtype);
return qi;
}
|
{
"code": [
" cpu_register_physical_memory(base, 0x007fffff, iomemtype);",
" cpu_register_physical_memory(base, 0x007fffff, iomemtype);"
],
"line_no": [
33,
33
]
}
|
static qemu_irq *FUNC_0(uint32_t base,
qemu_irq parent_irq, qemu_irq parent_fiq)
{
icp_pic_state *s;
int VAR_0;
qemu_irq *qi;
s = (icp_pic_state *)qemu_mallocz(sizeof(icp_pic_state));
if (!s)
return NULL;
qi = qemu_allocate_irqs(icp_pic_set_irq, s, 32);
s->base = base;
s->parent_irq = parent_irq;
s->parent_fiq = parent_fiq;
VAR_0 = cpu_register_io_memory(0, icp_pic_readfn,
icp_pic_writefn, s);
cpu_register_physical_memory(base, 0x007fffff, VAR_0);
return qi;
}
|
[
"static qemu_irq *FUNC_0(uint32_t base,\nqemu_irq parent_irq, qemu_irq parent_fiq)\n{",
"icp_pic_state *s;",
"int VAR_0;",
"qemu_irq *qi;",
"s = (icp_pic_state *)qemu_mallocz(sizeof(icp_pic_state));",
"if (!s)\nreturn NULL;",
"qi = qemu_allocate_irqs(icp_pic_set_irq, s, 32);",
"s->base = base;",
"s->parent_irq = parent_irq;",
"s->parent_fiq = parent_fiq;",
"VAR_0 = cpu_register_io_memory(0, icp_pic_readfn,\nicp_pic_writefn, s);",
"cpu_register_physical_memory(base, 0x007fffff, VAR_0);",
"return qi;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17,
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29,
31
],
[
33
],
[
37
],
[
39
]
] |
17,431
|
static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
AVFrame *p)
{
int i, j;
uint8_t *pd = p->data[0];
uint8_t *pd_last = s->last_picture.f->data[0];
uint8_t *pd_last_region = s->dispose_op == APNG_DISPOSE_OP_PREVIOUS ?
s->previous_picture.f->data[0] : s->last_picture.f->data[0];
int ls = FFMIN(av_image_get_linesize(p->format, s->width, 0), s->width * s->bpp);
if (s->blend_op == APNG_BLEND_OP_OVER &&
avctx->pix_fmt != AV_PIX_FMT_RGBA && avctx->pix_fmt != AV_PIX_FMT_ARGB) {
avpriv_request_sample(avctx, "Blending with pixel format %s",
av_get_pix_fmt_name(avctx->pix_fmt));
return AVERROR_PATCHWELCOME;
}
ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
if (s->dispose_op == APNG_DISPOSE_OP_PREVIOUS)
ff_thread_await_progress(&s->previous_picture, INT_MAX, 0);
for (j = 0; j < s->y_offset; j++) {
for (i = 0; i < ls; i++)
pd[i] = pd_last[i];
pd += s->image_linesize;
pd_last += s->image_linesize;
}
if (s->dispose_op != APNG_DISPOSE_OP_BACKGROUND && s->blend_op == APNG_BLEND_OP_OVER) {
uint8_t ri, gi, bi, ai;
pd_last_region += s->y_offset * s->image_linesize;
if (avctx->pix_fmt == AV_PIX_FMT_RGBA) {
ri = 0;
gi = 1;
bi = 2;
ai = 3;
} else {
ri = 3;
gi = 2;
bi = 1;
ai = 0;
}
for (j = s->y_offset; j < s->y_offset + s->cur_h; j++) {
for (i = 0; i < s->x_offset * s->bpp; i++)
pd[i] = pd_last[i];
for (; i < (s->x_offset + s->cur_w) * s->bpp; i += s->bpp) {
uint8_t alpha = pd[i+ai];
/* output = alpha * foreground + (1-alpha) * background */
switch (alpha) {
case 0:
pd[i+ri] = pd_last_region[i+ri];
pd[i+gi] = pd_last_region[i+gi];
pd[i+bi] = pd_last_region[i+bi];
pd[i+ai] = 0xff;
break;
case 255:
break;
default:
pd[i+ri] = FAST_DIV255(alpha * pd[i+ri] + (255 - alpha) * pd_last_region[i+ri]);
pd[i+gi] = FAST_DIV255(alpha * pd[i+gi] + (255 - alpha) * pd_last_region[i+gi]);
pd[i+bi] = FAST_DIV255(alpha * pd[i+bi] + (255 - alpha) * pd_last_region[i+bi]);
pd[i+ai] = 0xff;
break;
}
}
for (; i < ls; i++)
pd[i] = pd_last[i];
pd += s->image_linesize;
pd_last += s->image_linesize;
pd_last_region += s->image_linesize;
}
} else {
for (j = s->y_offset; j < s->y_offset + s->cur_h; j++) {
for (i = 0; i < s->x_offset * s->bpp; i++)
pd[i] = pd_last[i];
for (i = (s->x_offset + s->cur_w) * s->bpp; i < ls; i++)
pd[i] = pd_last[i];
pd += s->image_linesize;
pd_last += s->image_linesize;
}
}
for (j = s->y_offset + s->cur_h; j < s->height; j++) {
for (i = 0; i < ls; i++)
pd[i] = pd_last[i];
pd += s->image_linesize;
pd_last += s->image_linesize;
}
return 0;
}
| false
|
FFmpeg
|
0f6931f4b60cf1e65fd9a5da791c8ee913053f52
|
static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
AVFrame *p)
{
int i, j;
uint8_t *pd = p->data[0];
uint8_t *pd_last = s->last_picture.f->data[0];
uint8_t *pd_last_region = s->dispose_op == APNG_DISPOSE_OP_PREVIOUS ?
s->previous_picture.f->data[0] : s->last_picture.f->data[0];
int ls = FFMIN(av_image_get_linesize(p->format, s->width, 0), s->width * s->bpp);
if (s->blend_op == APNG_BLEND_OP_OVER &&
avctx->pix_fmt != AV_PIX_FMT_RGBA && avctx->pix_fmt != AV_PIX_FMT_ARGB) {
avpriv_request_sample(avctx, "Blending with pixel format %s",
av_get_pix_fmt_name(avctx->pix_fmt));
return AVERROR_PATCHWELCOME;
}
ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
if (s->dispose_op == APNG_DISPOSE_OP_PREVIOUS)
ff_thread_await_progress(&s->previous_picture, INT_MAX, 0);
for (j = 0; j < s->y_offset; j++) {
for (i = 0; i < ls; i++)
pd[i] = pd_last[i];
pd += s->image_linesize;
pd_last += s->image_linesize;
}
if (s->dispose_op != APNG_DISPOSE_OP_BACKGROUND && s->blend_op == APNG_BLEND_OP_OVER) {
uint8_t ri, gi, bi, ai;
pd_last_region += s->y_offset * s->image_linesize;
if (avctx->pix_fmt == AV_PIX_FMT_RGBA) {
ri = 0;
gi = 1;
bi = 2;
ai = 3;
} else {
ri = 3;
gi = 2;
bi = 1;
ai = 0;
}
for (j = s->y_offset; j < s->y_offset + s->cur_h; j++) {
for (i = 0; i < s->x_offset * s->bpp; i++)
pd[i] = pd_last[i];
for (; i < (s->x_offset + s->cur_w) * s->bpp; i += s->bpp) {
uint8_t alpha = pd[i+ai];
switch (alpha) {
case 0:
pd[i+ri] = pd_last_region[i+ri];
pd[i+gi] = pd_last_region[i+gi];
pd[i+bi] = pd_last_region[i+bi];
pd[i+ai] = 0xff;
break;
case 255:
break;
default:
pd[i+ri] = FAST_DIV255(alpha * pd[i+ri] + (255 - alpha) * pd_last_region[i+ri]);
pd[i+gi] = FAST_DIV255(alpha * pd[i+gi] + (255 - alpha) * pd_last_region[i+gi]);
pd[i+bi] = FAST_DIV255(alpha * pd[i+bi] + (255 - alpha) * pd_last_region[i+bi]);
pd[i+ai] = 0xff;
break;
}
}
for (; i < ls; i++)
pd[i] = pd_last[i];
pd += s->image_linesize;
pd_last += s->image_linesize;
pd_last_region += s->image_linesize;
}
} else {
for (j = s->y_offset; j < s->y_offset + s->cur_h; j++) {
for (i = 0; i < s->x_offset * s->bpp; i++)
pd[i] = pd_last[i];
for (i = (s->x_offset + s->cur_w) * s->bpp; i < ls; i++)
pd[i] = pd_last[i];
pd += s->image_linesize;
pd_last += s->image_linesize;
}
}
for (j = s->y_offset + s->cur_h; j < s->height; j++) {
for (i = 0; i < ls; i++)
pd[i] = pd_last[i];
pd += s->image_linesize;
pd_last += s->image_linesize;
}
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVCodecContext *VAR_0, PNGDecContext *VAR_1,
AVFrame *VAR_2)
{
int VAR_3, VAR_4;
uint8_t *pd = VAR_2->data[0];
uint8_t *pd_last = VAR_1->last_picture.f->data[0];
uint8_t *pd_last_region = VAR_1->dispose_op == APNG_DISPOSE_OP_PREVIOUS ?
VAR_1->previous_picture.f->data[0] : VAR_1->last_picture.f->data[0];
int VAR_5 = FFMIN(av_image_get_linesize(VAR_2->format, VAR_1->width, 0), VAR_1->width * VAR_1->bpp);
if (VAR_1->blend_op == APNG_BLEND_OP_OVER &&
VAR_0->pix_fmt != AV_PIX_FMT_RGBA && VAR_0->pix_fmt != AV_PIX_FMT_ARGB) {
avpriv_request_sample(VAR_0, "Blending with pixel format %VAR_1",
av_get_pix_fmt_name(VAR_0->pix_fmt));
return AVERROR_PATCHWELCOME;
}
ff_thread_await_progress(&VAR_1->last_picture, INT_MAX, 0);
if (VAR_1->dispose_op == APNG_DISPOSE_OP_PREVIOUS)
ff_thread_await_progress(&VAR_1->previous_picture, INT_MAX, 0);
for (VAR_4 = 0; VAR_4 < VAR_1->y_offset; VAR_4++) {
for (VAR_3 = 0; VAR_3 < VAR_5; VAR_3++)
pd[VAR_3] = pd_last[VAR_3];
pd += VAR_1->image_linesize;
pd_last += VAR_1->image_linesize;
}
if (VAR_1->dispose_op != APNG_DISPOSE_OP_BACKGROUND && VAR_1->blend_op == APNG_BLEND_OP_OVER) {
uint8_t ri, gi, bi, ai;
pd_last_region += VAR_1->y_offset * VAR_1->image_linesize;
if (VAR_0->pix_fmt == AV_PIX_FMT_RGBA) {
ri = 0;
gi = 1;
bi = 2;
ai = 3;
} else {
ri = 3;
gi = 2;
bi = 1;
ai = 0;
}
for (VAR_4 = VAR_1->y_offset; VAR_4 < VAR_1->y_offset + VAR_1->cur_h; VAR_4++) {
for (VAR_3 = 0; VAR_3 < VAR_1->x_offset * VAR_1->bpp; VAR_3++)
pd[VAR_3] = pd_last[VAR_3];
for (; VAR_3 < (VAR_1->x_offset + VAR_1->cur_w) * VAR_1->bpp; VAR_3 += VAR_1->bpp) {
uint8_t alpha = pd[VAR_3+ai];
switch (alpha) {
case 0:
pd[VAR_3+ri] = pd_last_region[VAR_3+ri];
pd[VAR_3+gi] = pd_last_region[VAR_3+gi];
pd[VAR_3+bi] = pd_last_region[VAR_3+bi];
pd[VAR_3+ai] = 0xff;
break;
case 255:
break;
default:
pd[VAR_3+ri] = FAST_DIV255(alpha * pd[VAR_3+ri] + (255 - alpha) * pd_last_region[VAR_3+ri]);
pd[VAR_3+gi] = FAST_DIV255(alpha * pd[VAR_3+gi] + (255 - alpha) * pd_last_region[VAR_3+gi]);
pd[VAR_3+bi] = FAST_DIV255(alpha * pd[VAR_3+bi] + (255 - alpha) * pd_last_region[VAR_3+bi]);
pd[VAR_3+ai] = 0xff;
break;
}
}
for (; VAR_3 < VAR_5; VAR_3++)
pd[VAR_3] = pd_last[VAR_3];
pd += VAR_1->image_linesize;
pd_last += VAR_1->image_linesize;
pd_last_region += VAR_1->image_linesize;
}
} else {
for (VAR_4 = VAR_1->y_offset; VAR_4 < VAR_1->y_offset + VAR_1->cur_h; VAR_4++) {
for (VAR_3 = 0; VAR_3 < VAR_1->x_offset * VAR_1->bpp; VAR_3++)
pd[VAR_3] = pd_last[VAR_3];
for (VAR_3 = (VAR_1->x_offset + VAR_1->cur_w) * VAR_1->bpp; VAR_3 < VAR_5; VAR_3++)
pd[VAR_3] = pd_last[VAR_3];
pd += VAR_1->image_linesize;
pd_last += VAR_1->image_linesize;
}
}
for (VAR_4 = VAR_1->y_offset + VAR_1->cur_h; VAR_4 < VAR_1->height; VAR_4++) {
for (VAR_3 = 0; VAR_3 < VAR_5; VAR_3++)
pd[VAR_3] = pd_last[VAR_3];
pd += VAR_1->image_linesize;
pd_last += VAR_1->image_linesize;
}
return 0;
}
|
[
"static int FUNC_0(AVCodecContext *VAR_0, PNGDecContext *VAR_1,\nAVFrame *VAR_2)\n{",
"int VAR_3, VAR_4;",
"uint8_t *pd = VAR_2->data[0];",
"uint8_t *pd_last = VAR_1->last_picture.f->data[0];",
"uint8_t *pd_last_region = VAR_1->dispose_op == APNG_DISPOSE_OP_PREVIOUS ?\nVAR_1->previous_picture.f->data[0] : VAR_1->last_picture.f->data[0];",
"int VAR_5 = FFMIN(av_image_get_linesize(VAR_2->format, VAR_1->width, 0), VAR_1->width * VAR_1->bpp);",
"if (VAR_1->blend_op == APNG_BLEND_OP_OVER &&\nVAR_0->pix_fmt != AV_PIX_FMT_RGBA && VAR_0->pix_fmt != AV_PIX_FMT_ARGB) {",
"avpriv_request_sample(VAR_0, \"Blending with pixel format %VAR_1\",\nav_get_pix_fmt_name(VAR_0->pix_fmt));",
"return AVERROR_PATCHWELCOME;",
"}",
"ff_thread_await_progress(&VAR_1->last_picture, INT_MAX, 0);",
"if (VAR_1->dispose_op == APNG_DISPOSE_OP_PREVIOUS)\nff_thread_await_progress(&VAR_1->previous_picture, INT_MAX, 0);",
"for (VAR_4 = 0; VAR_4 < VAR_1->y_offset; VAR_4++) {",
"for (VAR_3 = 0; VAR_3 < VAR_5; VAR_3++)",
"pd[VAR_3] = pd_last[VAR_3];",
"pd += VAR_1->image_linesize;",
"pd_last += VAR_1->image_linesize;",
"}",
"if (VAR_1->dispose_op != APNG_DISPOSE_OP_BACKGROUND && VAR_1->blend_op == APNG_BLEND_OP_OVER) {",
"uint8_t ri, gi, bi, ai;",
"pd_last_region += VAR_1->y_offset * VAR_1->image_linesize;",
"if (VAR_0->pix_fmt == AV_PIX_FMT_RGBA) {",
"ri = 0;",
"gi = 1;",
"bi = 2;",
"ai = 3;",
"} else {",
"ri = 3;",
"gi = 2;",
"bi = 1;",
"ai = 0;",
"}",
"for (VAR_4 = VAR_1->y_offset; VAR_4 < VAR_1->y_offset + VAR_1->cur_h; VAR_4++) {",
"for (VAR_3 = 0; VAR_3 < VAR_1->x_offset * VAR_1->bpp; VAR_3++)",
"pd[VAR_3] = pd_last[VAR_3];",
"for (; VAR_3 < (VAR_1->x_offset + VAR_1->cur_w) * VAR_1->bpp; VAR_3 += VAR_1->bpp) {",
"uint8_t alpha = pd[VAR_3+ai];",
"switch (alpha) {",
"case 0:\npd[VAR_3+ri] = pd_last_region[VAR_3+ri];",
"pd[VAR_3+gi] = pd_last_region[VAR_3+gi];",
"pd[VAR_3+bi] = pd_last_region[VAR_3+bi];",
"pd[VAR_3+ai] = 0xff;",
"break;",
"case 255:\nbreak;",
"default:\npd[VAR_3+ri] = FAST_DIV255(alpha * pd[VAR_3+ri] + (255 - alpha) * pd_last_region[VAR_3+ri]);",
"pd[VAR_3+gi] = FAST_DIV255(alpha * pd[VAR_3+gi] + (255 - alpha) * pd_last_region[VAR_3+gi]);",
"pd[VAR_3+bi] = FAST_DIV255(alpha * pd[VAR_3+bi] + (255 - alpha) * pd_last_region[VAR_3+bi]);",
"pd[VAR_3+ai] = 0xff;",
"break;",
"}",
"}",
"for (; VAR_3 < VAR_5; VAR_3++)",
"pd[VAR_3] = pd_last[VAR_3];",
"pd += VAR_1->image_linesize;",
"pd_last += VAR_1->image_linesize;",
"pd_last_region += VAR_1->image_linesize;",
"}",
"} else {",
"for (VAR_4 = VAR_1->y_offset; VAR_4 < VAR_1->y_offset + VAR_1->cur_h; VAR_4++) {",
"for (VAR_3 = 0; VAR_3 < VAR_1->x_offset * VAR_1->bpp; VAR_3++)",
"pd[VAR_3] = pd_last[VAR_3];",
"for (VAR_3 = (VAR_1->x_offset + VAR_1->cur_w) * VAR_1->bpp; VAR_3 < VAR_5; VAR_3++)",
"pd[VAR_3] = pd_last[VAR_3];",
"pd += VAR_1->image_linesize;",
"pd_last += VAR_1->image_linesize;",
"}",
"}",
"for (VAR_4 = VAR_1->y_offset + VAR_1->cur_h; VAR_4 < VAR_1->height; VAR_4++) {",
"for (VAR_3 = 0; VAR_3 < VAR_5; VAR_3++)",
"pd[VAR_3] = pd_last[VAR_3];",
"pd += VAR_1->image_linesize;",
"pd_last += VAR_1->image_linesize;",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13,
15
],
[
17
],
[
21,
23
],
[
25,
27
],
[
29
],
[
31
],
[
35
],
[
37,
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
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
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
185
],
[
187
]
] |
17,432
|
static int nprobe(AVFormatContext *s, uint8_t *enc_header, int size, const uint8_t *n_val)
{
OMAContext *oc = s->priv_data;
uint32_t pos, taglen, datalen;
struct AVDES av_des;
if (!enc_header || !n_val)
return -1;
pos = OMA_ENC_HEADER_SIZE + oc->k_size;
if (!memcmp(&enc_header[pos], "EKB ", 4))
pos += 32;
if (AV_RB32(&enc_header[pos]) != oc->rid)
av_log(s, AV_LOG_DEBUG, "Mismatching RID\n");
taglen = AV_RB32(&enc_header[pos+32]);
datalen = AV_RB32(&enc_header[pos+36]) >> 4;
if(taglen + (((uint64_t)datalen)<<4) + 44 > size)
return -1;
pos += 44 + taglen;
av_des_init(&av_des, n_val, 192, 1);
while (datalen-- > 0) {
av_des_crypt(&av_des, oc->r_val, &enc_header[pos], 2, NULL, 1);
kset(s, oc->r_val, NULL, 16);
if (!rprobe(s, enc_header, oc->r_val))
return 0;
pos += 16;
}
return -1;
}
| false
|
FFmpeg
|
f1d6f013b2078140fb701978d720abecde7cd73f
|
static int nprobe(AVFormatContext *s, uint8_t *enc_header, int size, const uint8_t *n_val)
{
OMAContext *oc = s->priv_data;
uint32_t pos, taglen, datalen;
struct AVDES av_des;
if (!enc_header || !n_val)
return -1;
pos = OMA_ENC_HEADER_SIZE + oc->k_size;
if (!memcmp(&enc_header[pos], "EKB ", 4))
pos += 32;
if (AV_RB32(&enc_header[pos]) != oc->rid)
av_log(s, AV_LOG_DEBUG, "Mismatching RID\n");
taglen = AV_RB32(&enc_header[pos+32]);
datalen = AV_RB32(&enc_header[pos+36]) >> 4;
if(taglen + (((uint64_t)datalen)<<4) + 44 > size)
return -1;
pos += 44 + taglen;
av_des_init(&av_des, n_val, 192, 1);
while (datalen-- > 0) {
av_des_crypt(&av_des, oc->r_val, &enc_header[pos], 2, NULL, 1);
kset(s, oc->r_val, NULL, 16);
if (!rprobe(s, enc_header, oc->r_val))
return 0;
pos += 16;
}
return -1;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(AVFormatContext *VAR_0, uint8_t *VAR_1, int VAR_2, const uint8_t *VAR_3)
{
OMAContext *oc = VAR_0->priv_data;
uint32_t pos, taglen, datalen;
struct AVDES VAR_4;
if (!VAR_1 || !VAR_3)
return -1;
pos = OMA_ENC_HEADER_SIZE + oc->k_size;
if (!memcmp(&VAR_1[pos], "EKB ", 4))
pos += 32;
if (AV_RB32(&VAR_1[pos]) != oc->rid)
av_log(VAR_0, AV_LOG_DEBUG, "Mismatching RID\n");
taglen = AV_RB32(&VAR_1[pos+32]);
datalen = AV_RB32(&VAR_1[pos+36]) >> 4;
if(taglen + (((uint64_t)datalen)<<4) + 44 > VAR_2)
return -1;
pos += 44 + taglen;
av_des_init(&VAR_4, VAR_3, 192, 1);
while (datalen-- > 0) {
av_des_crypt(&VAR_4, oc->r_val, &VAR_1[pos], 2, NULL, 1);
kset(VAR_0, oc->r_val, NULL, 16);
if (!rprobe(VAR_0, VAR_1, oc->r_val))
return 0;
pos += 16;
}
return -1;
}
|
[
"static int FUNC_0(AVFormatContext *VAR_0, uint8_t *VAR_1, int VAR_2, const uint8_t *VAR_3)\n{",
"OMAContext *oc = VAR_0->priv_data;",
"uint32_t pos, taglen, datalen;",
"struct AVDES VAR_4;",
"if (!VAR_1 || !VAR_3)\nreturn -1;",
"pos = OMA_ENC_HEADER_SIZE + oc->k_size;",
"if (!memcmp(&VAR_1[pos], \"EKB \", 4))\npos += 32;",
"if (AV_RB32(&VAR_1[pos]) != oc->rid)\nav_log(VAR_0, AV_LOG_DEBUG, \"Mismatching RID\\n\");",
"taglen = AV_RB32(&VAR_1[pos+32]);",
"datalen = AV_RB32(&VAR_1[pos+36]) >> 4;",
"if(taglen + (((uint64_t)datalen)<<4) + 44 > VAR_2)\nreturn -1;",
"pos += 44 + taglen;",
"av_des_init(&VAR_4, VAR_3, 192, 1);",
"while (datalen-- > 0) {",
"av_des_crypt(&VAR_4, oc->r_val, &VAR_1[pos], 2, NULL, 1);",
"kset(VAR_0, oc->r_val, NULL, 16);",
"if (!rprobe(VAR_0, VAR_1, oc->r_val))\nreturn 0;",
"pos += 16;",
"}",
"return -1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13,
15
],
[
19
],
[
21,
23
],
[
27,
29
],
[
33
],
[
35
],
[
39,
41
],
[
45
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57,
59
],
[
61
],
[
63
],
[
67
],
[
69
]
] |
17,433
|
REORDER_OUT_50(int8, int8_t)
REORDER_OUT_51(int8, int8_t)
REORDER_OUT_71(int8, int8_t)
REORDER_OUT_50(int16, int16_t)
REORDER_OUT_51(int16, int16_t)
REORDER_OUT_71(int16, int16_t)
REORDER_OUT_50(int32, int32_t)
REORDER_OUT_51(int32, int32_t)
REORDER_OUT_71(int32, int32_t)
REORDER_OUT_50(f32, float)
REORDER_OUT_51(f32, float)
REORDER_OUT_71(f32, float)
#define FORMAT_I8 0
#define FORMAT_I16 1
#define FORMAT_I32 2
#define FORMAT_F32 3
#define PICK_REORDER(layout)\
switch(format) {\
case FORMAT_I8: s->reorder_func = alsa_reorder_int8_out_ ##layout; break;\
case FORMAT_I16: s->reorder_func = alsa_reorder_int16_out_ ##layout; break;\
case FORMAT_I32: s->reorder_func = alsa_reorder_int32_out_ ##layout; break;\
case FORMAT_F32: s->reorder_func = alsa_reorder_f32_out_ ##layout; break;\
}
static av_cold int find_reorder_func(AlsaData *s, int codec_id, int64_t layout, int out)
{
int format;
/* reordering input is not currently supported */
if (!out)
return AVERROR(ENOSYS);
/* reordering is not needed for QUAD or 2_2 layout */
if (layout == AV_CH_LAYOUT_QUAD || layout == AV_CH_LAYOUT_2_2)
return 0;
switch (codec_id) {
case CODEC_ID_PCM_S8:
case CODEC_ID_PCM_U8:
case CODEC_ID_PCM_ALAW:
case CODEC_ID_PCM_MULAW: format = FORMAT_I8; break;
case CODEC_ID_PCM_S16LE:
case CODEC_ID_PCM_S16BE:
case CODEC_ID_PCM_U16LE:
case CODEC_ID_PCM_U16BE: format = FORMAT_I16; break;
case CODEC_ID_PCM_S32LE:
case CODEC_ID_PCM_S32BE:
case CODEC_ID_PCM_U32LE:
case CODEC_ID_PCM_U32BE: format = FORMAT_I32; break;
case CODEC_ID_PCM_F32LE:
case CODEC_ID_PCM_F32BE: format = FORMAT_F32; break;
default: return AVERROR(ENOSYS);
}
if (layout == AV_CH_LAYOUT_5POINT0_BACK || layout == AV_CH_LAYOUT_5POINT0)
PICK_REORDER(50)
else if (layout == AV_CH_LAYOUT_5POINT1_BACK || layout == AV_CH_LAYOUT_5POINT1)
PICK_REORDER(51)
else if (layout == AV_CH_LAYOUT_7POINT1)
PICK_REORDER(71)
return s->reorder_func ? 0 : AVERROR(ENOSYS);
}
| false
|
FFmpeg
|
cc276c85d15272df6e44fb3252657a43cbd49555
|
REORDER_OUT_50(int8, int8_t)
REORDER_OUT_51(int8, int8_t)
REORDER_OUT_71(int8, int8_t)
REORDER_OUT_50(int16, int16_t)
REORDER_OUT_51(int16, int16_t)
REORDER_OUT_71(int16, int16_t)
REORDER_OUT_50(int32, int32_t)
REORDER_OUT_51(int32, int32_t)
REORDER_OUT_71(int32, int32_t)
REORDER_OUT_50(f32, float)
REORDER_OUT_51(f32, float)
REORDER_OUT_71(f32, float)
#define FORMAT_I8 0
#define FORMAT_I16 1
#define FORMAT_I32 2
#define FORMAT_F32 3
#define PICK_REORDER(layout)\
switch(format) {\
case FORMAT_I8: s->reorder_func = alsa_reorder_int8_out_ ##layout; break;\
case FORMAT_I16: s->reorder_func = alsa_reorder_int16_out_ ##layout; break;\
case FORMAT_I32: s->reorder_func = alsa_reorder_int32_out_ ##layout; break;\
case FORMAT_F32: s->reorder_func = alsa_reorder_f32_out_ ##layout; break;\
}
static av_cold int find_reorder_func(AlsaData *s, int codec_id, int64_t layout, int out)
{
int format;
if (!out)
return AVERROR(ENOSYS);
if (layout == AV_CH_LAYOUT_QUAD || layout == AV_CH_LAYOUT_2_2)
return 0;
switch (codec_id) {
case CODEC_ID_PCM_S8:
case CODEC_ID_PCM_U8:
case CODEC_ID_PCM_ALAW:
case CODEC_ID_PCM_MULAW: format = FORMAT_I8; break;
case CODEC_ID_PCM_S16LE:
case CODEC_ID_PCM_S16BE:
case CODEC_ID_PCM_U16LE:
case CODEC_ID_PCM_U16BE: format = FORMAT_I16; break;
case CODEC_ID_PCM_S32LE:
case CODEC_ID_PCM_S32BE:
case CODEC_ID_PCM_U32LE:
case CODEC_ID_PCM_U32BE: format = FORMAT_I32; break;
case CODEC_ID_PCM_F32LE:
case CODEC_ID_PCM_F32BE: format = FORMAT_F32; break;
default: return AVERROR(ENOSYS);
}
if (layout == AV_CH_LAYOUT_5POINT0_BACK || layout == AV_CH_LAYOUT_5POINT0)
PICK_REORDER(50)
else if (layout == AV_CH_LAYOUT_5POINT1_BACK || layout == AV_CH_LAYOUT_5POINT1)
PICK_REORDER(51)
else if (layout == AV_CH_LAYOUT_7POINT1)
PICK_REORDER(71)
return s->reorder_func ? 0 : AVERROR(ENOSYS);
}
|
{
"code": [],
"line_no": []
}
|
REORDER_OUT_50(int8, int8_t)
REORDER_OUT_51(int8, int8_t)
REORDER_OUT_71(int8, int8_t)
REORDER_OUT_50(int16, int16_t)
REORDER_OUT_51(int16, int16_t)
REORDER_OUT_71(int16, int16_t)
REORDER_OUT_50(int32, int32_t)
REORDER_OUT_51(int32, int32_t)
REORDER_OUT_71(int32, int32_t)
REORDER_OUT_50(f32, float)
REORDER_OUT_51(f32, float)
REORDER_OUT_71(f32, float)
#define FORMAT_I8 0
#define FORMAT_I16 1
#define FORMAT_I32 2
#define FORMAT_F32 3
#define PICK_REORDER(layout)\
switch(format) {\
case FORMAT_I8: s->reorder_func = alsa_reorder_int8_out_ ##layout; break;\
case FORMAT_I16: s->reorder_func = alsa_reorder_int16_out_ ##layout; break;\
case FORMAT_I32: s->reorder_func = alsa_reorder_int32_out_ ##layout; break;\
case FORMAT_F32: s->reorder_func = alsa_reorder_f32_out_ ##layout; break;\
}
static av_cold int find_reorder_func(AlsaData *s, int codec_id, int64_t layout, int out)
{
int format;
if (!out)
return AVERROR(ENOSYS);
if (layout == AV_CH_LAYOUT_QUAD || layout == AV_CH_LAYOUT_2_2)
return 0;
switch (codec_id) {
case CODEC_ID_PCM_S8:
case CODEC_ID_PCM_U8:
case CODEC_ID_PCM_ALAW:
case CODEC_ID_PCM_MULAW: format = FORMAT_I8; break;
case CODEC_ID_PCM_S16LE:
case CODEC_ID_PCM_S16BE:
case CODEC_ID_PCM_U16LE:
case CODEC_ID_PCM_U16BE: format = FORMAT_I16; break;
case CODEC_ID_PCM_S32LE:
case CODEC_ID_PCM_S32BE:
case CODEC_ID_PCM_U32LE:
case CODEC_ID_PCM_U32BE: format = FORMAT_I32; break;
case CODEC_ID_PCM_F32LE:
case CODEC_ID_PCM_F32BE: format = FORMAT_F32; break;
default: return AVERROR(ENOSYS);
}
if (layout == AV_CH_LAYOUT_5POINT0_BACK || layout == AV_CH_LAYOUT_5POINT0)
PICK_REORDER(50)
else if (layout == AV_CH_LAYOUT_5POINT1_BACK || layout == AV_CH_LAYOUT_5POINT1)
PICK_REORDER(51)
else if (layout == AV_CH_LAYOUT_7POINT1)
PICK_REORDER(71)
return s->reorder_func ? 0 : AVERROR(ENOSYS);
}
|
[
"REORDER_OUT_50(int8, int8_t)\nREORDER_OUT_51(int8, int8_t)\nREORDER_OUT_71(int8, int8_t)\nREORDER_OUT_50(int16, int16_t)\nREORDER_OUT_51(int16, int16_t)\nREORDER_OUT_71(int16, int16_t)\nREORDER_OUT_50(int32, int32_t)\nREORDER_OUT_51(int32, int32_t)\nREORDER_OUT_71(int32, int32_t)\nREORDER_OUT_50(f32, float)\nREORDER_OUT_51(f32, float)\nREORDER_OUT_71(f32, float)\n#define FORMAT_I8 0\n#define FORMAT_I16 1\n#define FORMAT_I32 2\n#define FORMAT_F32 3\n#define PICK_REORDER(layout)\\\nswitch(format) {\\",
"case FORMAT_I8: s->reorder_func = alsa_reorder_int8_out_ ##layout; break;\\",
"case FORMAT_I16: s->reorder_func = alsa_reorder_int16_out_ ##layout; break;\\",
"case FORMAT_I32: s->reorder_func = alsa_reorder_int32_out_ ##layout; break;\\",
"case FORMAT_F32: s->reorder_func = alsa_reorder_f32_out_ ##layout; break;\\",
"}",
"static av_cold int find_reorder_func(AlsaData *s, int codec_id, int64_t layout, int out)\n{",
"int format;",
"if (!out)\nreturn AVERROR(ENOSYS);",
"if (layout == AV_CH_LAYOUT_QUAD || layout == AV_CH_LAYOUT_2_2)\nreturn 0;",
"switch (codec_id) {",
"case CODEC_ID_PCM_S8:\ncase CODEC_ID_PCM_U8:\ncase CODEC_ID_PCM_ALAW:\ncase CODEC_ID_PCM_MULAW: format = FORMAT_I8; break;",
"case CODEC_ID_PCM_S16LE:\ncase CODEC_ID_PCM_S16BE:\ncase CODEC_ID_PCM_U16LE:\ncase CODEC_ID_PCM_U16BE: format = FORMAT_I16; break;",
"case CODEC_ID_PCM_S32LE:\ncase CODEC_ID_PCM_S32BE:\ncase CODEC_ID_PCM_U32LE:\ncase CODEC_ID_PCM_U32BE: format = FORMAT_I32; break;",
"case CODEC_ID_PCM_F32LE:\ncase CODEC_ID_PCM_F32BE: format = FORMAT_F32; break;",
"default: return AVERROR(ENOSYS);",
"}",
"if (layout == AV_CH_LAYOUT_5POINT0_BACK || layout == AV_CH_LAYOUT_5POINT0)\nPICK_REORDER(50)\nelse if (layout == AV_CH_LAYOUT_5POINT1_BACK || layout == AV_CH_LAYOUT_5POINT1)\nPICK_REORDER(51)\nelse if (layout == AV_CH_LAYOUT_7POINT1)\nPICK_REORDER(71)\nreturn s->reorder_func ? 0 : AVERROR(ENOSYS);",
"}"
] |
[
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,
37,
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53,
55
],
[
57
],
[
63,
65
],
[
71,
73
],
[
77
],
[
79,
81,
83,
85
],
[
87,
89,
91,
93
],
[
95,
97,
99,
101
],
[
103,
105
],
[
107
],
[
109
],
[
113,
115,
117,
119,
121,
123,
127
],
[
129
]
] |
17,434
|
static inline void RENAME(rgb24ToY)(uint8_t *dst, uint8_t *src, int width)
{
int i;
for(i=0; i<width; i++)
{
int r= src[i*3+0];
int g= src[i*3+1];
int b= src[i*3+2];
dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);
}
}
| true
|
FFmpeg
|
2da0d70d5eebe42f9fcd27ee554419ebe2a5da06
|
static inline void RENAME(rgb24ToY)(uint8_t *dst, uint8_t *src, int width)
{
int i;
for(i=0; i<width; i++)
{
int r= src[i*3+0];
int g= src[i*3+1];
int b= src[i*3+2];
dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);
}
}
|
{
"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++)",
"\t\tdst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\t\tint g= src[i*3+1];",
"\t\tdst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);",
"\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\tdst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\tint i;",
"\tfor(i=0; i<width; i++)",
"\t\tint r= src[i*3+0];",
"\t\tint g= src[i*3+1];",
"\t\tint b= src[i*3+2];",
"\t\tdst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);",
"\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;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;"
],
"line_no": [
5,
5,
5,
5,
7,
5,
7,
5,
7,
5,
7,
5,
7,
19,
5,
7,
5,
7,
13,
19,
5,
7,
5,
7,
5,
7,
5,
7,
5,
7,
5,
7,
19,
5,
7,
5,
7,
11,
13,
15,
19,
5,
7,
5,
7,
5,
7,
5,
7,
5,
7,
5,
7,
5,
7,
5,
5,
5,
5,
5
]
}
|
static inline void FUNC_0(rgb24ToY)(uint8_t *dst, uint8_t *src, int width)
{
int VAR_0;
for(VAR_0=0; VAR_0<width; VAR_0++)
{
int r= src[VAR_0*3+0];
int g= src[VAR_0*3+1];
int b= src[VAR_0*3+2];
dst[VAR_0]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);
}
}
|
[
"static inline void FUNC_0(rgb24ToY)(uint8_t *dst, uint8_t *src, int width)\n{",
"int VAR_0;",
"for(VAR_0=0; VAR_0<width; VAR_0++)",
"{",
"int r= src[VAR_0*3+0];",
"int g= src[VAR_0*3+1];",
"int b= src[VAR_0*3+2];",
"dst[VAR_0]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);",
"}",
"}"
] |
[
0,
1,
1,
0,
1,
1,
1,
1,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
]
] |
17,435
|
static void dcr_write_pob (void *opaque, int dcrn, uint32_t val)
{
ppc4xx_pob_t *pob;
pob = opaque;
switch (dcrn) {
case POB0_BEAR:
/* Read only */
break;
case POB0_BESR0:
case POB0_BESR1:
/* Write-clear */
pob->besr[dcrn - POB0_BESR0] &= ~val;
break;
}
}
| true
|
qemu
|
5a1972c8472fafd519a68b689fdcaf33ec857945
|
static void dcr_write_pob (void *opaque, int dcrn, uint32_t val)
{
ppc4xx_pob_t *pob;
pob = opaque;
switch (dcrn) {
case POB0_BEAR:
break;
case POB0_BESR0:
case POB0_BESR1:
pob->besr[dcrn - POB0_BESR0] &= ~val;
break;
}
}
|
{
"code": [
" pob->besr[dcrn - POB0_BESR0] &= ~val;"
],
"line_no": [
25
]
}
|
static void FUNC_0 (void *VAR_0, int VAR_1, uint32_t VAR_2)
{
ppc4xx_pob_t *pob;
pob = VAR_0;
switch (VAR_1) {
case POB0_BEAR:
break;
case POB0_BESR0:
case POB0_BESR1:
pob->besr[VAR_1 - POB0_BESR0] &= ~VAR_2;
break;
}
}
|
[
"static void FUNC_0 (void *VAR_0, int VAR_1, uint32_t VAR_2)\n{",
"ppc4xx_pob_t *pob;",
"pob = VAR_0;",
"switch (VAR_1) {",
"case POB0_BEAR:\nbreak;",
"case POB0_BESR0:\ncase POB0_BESR1:\npob->besr[VAR_1 - POB0_BESR0] &= ~VAR_2;",
"break;",
"}",
"}"
] |
[
0,
0,
0,
0,
0,
1,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13,
17
],
[
19,
21,
25
],
[
27
],
[
29
],
[
31
]
] |
17,436
|
static inline void yuv2yuvXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
{
//FIXME Optimize (just quickly writen not opti..)
int i;
for(i=0; i<dstW; i++)
{
int val=1<<18;
int j;
for(j=0; j<lumFilterSize; j++)
val += lumSrc[j][i] * lumFilter[j];
dest[i]= av_clip_uint8(val>>19);
}
if(uDest != NULL)
for(i=0; i<chrDstW; i++)
{
int u=1<<18;
int v=1<<18;
int j;
for(j=0; j<chrFilterSize; j++)
{
u += chrSrc[j][i] * chrFilter[j];
v += chrSrc[j][i + 2048] * chrFilter[j];
}
uDest[i]= av_clip_uint8(u>>19);
vDest[i]= av_clip_uint8(v>>19);
}
}
| true
|
FFmpeg
|
221b804f3491638ecf2eec1302c669ad2d9ec799
|
static inline void yuv2yuvXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
{
int i;
for(i=0; i<dstW; i++)
{
int val=1<<18;
int j;
for(j=0; j<lumFilterSize; j++)
val += lumSrc[j][i] * lumFilter[j];
dest[i]= av_clip_uint8(val>>19);
}
if(uDest != NULL)
for(i=0; i<chrDstW; i++)
{
int u=1<<18;
int v=1<<18;
int j;
for(j=0; j<chrFilterSize; j++)
{
u += chrSrc[j][i] * chrFilter[j];
v += chrSrc[j][i + 2048] * chrFilter[j];
}
uDest[i]= av_clip_uint8(u>>19);
vDest[i]= av_clip_uint8(v>>19);
}
}
|
{
"code": [
"\tint i;",
"\t\t\t\t int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,",
"\t\t\t\t uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)",
"\tint i;",
"\tfor(i=0; i<dstW; i++)",
"\t\tint val=1<<18;",
"\t\tint j;",
"\t\tfor(j=0; j<lumFilterSize; j++)",
"\t\t\tval += lumSrc[j][i] * lumFilter[j];",
"\t\tdest[i]= av_clip_uint8(val>>19);",
"\tif(uDest != NULL)",
"\t\tfor(i=0; i<chrDstW; i++)",
"\t\t\tint u=1<<18;",
"\t\t\tint v=1<<18;",
"\t\t\tint j;",
"\t\t\tfor(j=0; j<chrFilterSize; j++)",
"\t\t\t\tu += chrSrc[j][i] * chrFilter[j];",
"\t\t\t\tv += chrSrc[j][i + 2048] * chrFilter[j];",
"\t\t\tuDest[i]= av_clip_uint8(u>>19);",
"\t\t\tvDest[i]= av_clip_uint8(v>>19);",
"\tint i;",
"\tfor(i=0; i<dstW; i++)",
"\t\tint val=1<<18;",
"\t\tint j;",
"\t\tfor(j=0; j<lumFilterSize; j++)",
"\t\t\tval += lumSrc[j][i] * lumFilter[j];",
"\t\tdest[i]= av_clip_uint8(val>>19);",
"\t\tfor(i=0; i<chrDstW; i++)",
"\t\t\tint u=1<<18;",
"\t\t\tint v=1<<18;",
"\t\t\tint j;",
"\t\t\tfor(j=0; j<chrFilterSize; j++)",
"\t\t\t\tu += chrSrc[j][i] * chrFilter[j];",
"\t\t\t\tv += chrSrc[j][i + 2048] * chrFilter[j];",
"\t\tfor(i=0; i<chrDstW; i++)",
"\t\t\tint u=1<<18;",
"\t\t\tint v=1<<18;",
"\t\t\tint j;",
"\t\t\tfor(j=0; j<chrFilterSize; j++)",
"\t\t\t\tu += chrSrc[j][i] * chrFilter[j];",
"\t\t\t\tv += chrSrc[j][i + 2048] * chrFilter[j];",
"\t\t\t\t int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,",
"\tint i;",
"\tint i;",
"\t\t\tint j;",
"\t\t\tint j;",
"\tfor(i=0; i<dstW; i++)",
"\t\tint j;",
"\t\tint j;",
"\tfor(i=0; i<dstW; i++)",
"\t\tint j;",
"\tfor(i=0; i<dstW; i++)",
"\t\tint j;",
"\tfor(i=0; i<dstW; i++)",
"\t\tint j;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;",
"\tint i;"
],
"line_no": [
11,
3,
5,
11,
13,
17,
19,
21,
23,
27,
33,
35,
39,
41,
43,
45,
49,
51,
57,
59,
11,
13,
17,
19,
21,
23,
27,
35,
39,
41,
43,
45,
49,
51,
35,
39,
41,
43,
45,
49,
51,
3,
11,
11,
43,
43,
13,
19,
19,
13,
19,
13,
19,
13,
19,
11,
11,
11,
11,
11,
11,
11,
11,
11,
11,
11,
11
]
}
|
static inline void FUNC_0(int16_t *VAR_0, int16_t **VAR_1, int VAR_2,
int16_t *VAR_3, int16_t **VAR_4, int VAR_5,
uint8_t *VAR_6, uint8_t *VAR_7, uint8_t *VAR_8, int VAR_9, int VAR_10)
{
int VAR_11;
for(VAR_11=0; VAR_11<VAR_9; VAR_11++)
{
int VAR_12=1<<18;
int VAR_16;
for(VAR_16=0; VAR_16<VAR_2; VAR_16++)
VAR_12 += VAR_1[VAR_16][VAR_11] * VAR_0[VAR_16];
VAR_6[VAR_11]= av_clip_uint8(VAR_12>>19);
}
if(VAR_7 != NULL)
for(VAR_11=0; VAR_11<VAR_10; VAR_11++)
{
int VAR_14=1<<18;
int VAR_15=1<<18;
int VAR_16;
for(VAR_16=0; VAR_16<VAR_5; VAR_16++)
{
VAR_14 += VAR_4[VAR_16][VAR_11] * VAR_3[VAR_16];
VAR_15 += VAR_4[VAR_16][VAR_11 + 2048] * VAR_3[VAR_16];
}
VAR_7[VAR_11]= av_clip_uint8(VAR_14>>19);
VAR_8[VAR_11]= av_clip_uint8(VAR_15>>19);
}
}
|
[
"static inline void FUNC_0(int16_t *VAR_0, int16_t **VAR_1, int VAR_2,\nint16_t *VAR_3, int16_t **VAR_4, int VAR_5,\nuint8_t *VAR_6, uint8_t *VAR_7, uint8_t *VAR_8, int VAR_9, int VAR_10)\n{",
"int VAR_11;",
"for(VAR_11=0; VAR_11<VAR_9; VAR_11++)",
"{",
"int VAR_12=1<<18;",
"int VAR_16;",
"for(VAR_16=0; VAR_16<VAR_2; VAR_16++)",
"VAR_12 += VAR_1[VAR_16][VAR_11] * VAR_0[VAR_16];",
"VAR_6[VAR_11]= av_clip_uint8(VAR_12>>19);",
"}",
"if(VAR_7 != NULL)\nfor(VAR_11=0; VAR_11<VAR_10; VAR_11++)",
"{",
"int VAR_14=1<<18;",
"int VAR_15=1<<18;",
"int VAR_16;",
"for(VAR_16=0; VAR_16<VAR_5; VAR_16++)",
"{",
"VAR_14 += VAR_4[VAR_16][VAR_11] * VAR_3[VAR_16];",
"VAR_15 += VAR_4[VAR_16][VAR_11 + 2048] * VAR_3[VAR_16];",
"}",
"VAR_7[VAR_11]= av_clip_uint8(VAR_14>>19);",
"VAR_8[VAR_11]= av_clip_uint8(VAR_15>>19);",
"}",
"}"
] |
[
1,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1,
0,
0
] |
[
[
1,
3,
5,
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
33,
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
]
] |
17,437
|
static int mjpeg_decode_com(MJpegDecodeContext *s)
{
int i;
UINT8 *cbuf;
/* XXX: verify len field validity */
unsigned int len = get_bits(&s->gb, 16)-2;
cbuf = av_malloc(len+1);
for (i = 0; i < len; i++)
cbuf[i] = get_bits(&s->gb, 8);
if (cbuf[i-1] == '\n')
cbuf[i-1] = 0;
else
cbuf[i] = 0;
printf("mjpeg comment: '%s'\n", cbuf);
/* buggy avid, it puts EOI only at every 10th frame */
if (!strcmp(cbuf, "AVID"))
{
s->buggy_avid = 1;
// if (s->first_picture)
// printf("mjpeg: workarounding buggy AVID\n");
}
av_free(cbuf);
return 0;
}
| false
|
FFmpeg
|
dce778e0ea295db541e43b0850d3a7ef873996cc
|
static int mjpeg_decode_com(MJpegDecodeContext *s)
{
int i;
UINT8 *cbuf;
unsigned int len = get_bits(&s->gb, 16)-2;
cbuf = av_malloc(len+1);
for (i = 0; i < len; i++)
cbuf[i] = get_bits(&s->gb, 8);
if (cbuf[i-1] == '\n')
cbuf[i-1] = 0;
else
cbuf[i] = 0;
printf("mjpeg comment: '%s'\n", cbuf);
if (!strcmp(cbuf, "AVID"))
{
s->buggy_avid = 1;
}
av_free(cbuf);
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(MJpegDecodeContext *VAR_0)
{
int VAR_1;
UINT8 *cbuf;
unsigned int VAR_2 = get_bits(&VAR_0->gb, 16)-2;
cbuf = av_malloc(VAR_2+1);
for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++)
cbuf[VAR_1] = get_bits(&VAR_0->gb, 8);
if (cbuf[VAR_1-1] == '\n')
cbuf[VAR_1-1] = 0;
else
cbuf[VAR_1] = 0;
printf("mjpeg comment: '%VAR_0'\n", cbuf);
if (!strcmp(cbuf, "AVID"))
{
VAR_0->buggy_avid = 1;
}
av_free(cbuf);
return 0;
}
|
[
"static int FUNC_0(MJpegDecodeContext *VAR_0)\n{",
"int VAR_1;",
"UINT8 *cbuf;",
"unsigned int VAR_2 = get_bits(&VAR_0->gb, 16)-2;",
"cbuf = av_malloc(VAR_2+1);",
"for (VAR_1 = 0; VAR_1 < VAR_2; VAR_1++)",
"cbuf[VAR_1] = get_bits(&VAR_0->gb, 8);",
"if (cbuf[VAR_1-1] == '\\n')\ncbuf[VAR_1-1] = 0;",
"else\ncbuf[VAR_1] = 0;",
"printf(\"mjpeg comment: '%VAR_0'\\n\", cbuf);",
"if (!strcmp(cbuf, \"AVID\"))\n{",
"VAR_0->buggy_avid = 1;",
"}",
"av_free(cbuf);",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23,
25
],
[
27,
29
],
[
33
],
[
39,
41
],
[
43
],
[
49
],
[
53
],
[
57
],
[
59
]
] |
17,438
|
static int doTest(uint8_t *ref[4], int refStride[4], int w, int h, int srcFormat, int dstFormat,
int srcW, int srcH, int dstW, int dstH, int flags){
uint8_t *src[4] = {0};
uint8_t *dst[4] = {0};
uint8_t *out[4] = {0};
int srcStride[4], dstStride[4];
int i;
uint64_t ssdY, ssdU, ssdV, ssdA=0;
struct SwsContext *srcContext = NULL, *dstContext = NULL,
*outContext = NULL;
int res;
res = 0;
for (i=0; i<4; i++){
// avoid stride % bpp != 0
if (srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24)
srcStride[i]= srcW*3;
else if (srcFormat==PIX_FMT_RGB48BE || srcFormat==PIX_FMT_RGB48LE)
srcStride[i]= srcW*6;
else
srcStride[i]= srcW*4;
if (dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24)
dstStride[i]= dstW*3;
else if (dstFormat==PIX_FMT_RGB48BE || dstFormat==PIX_FMT_RGB48LE)
dstStride[i]= dstW*6;
else
dstStride[i]= dstW*4;
src[i]= (uint8_t*) malloc(srcStride[i]*srcH);
dst[i]= (uint8_t*) malloc(dstStride[i]*dstH);
out[i]= (uint8_t*) malloc(refStride[i]*h);
if (!src[i] || !dst[i] || !out[i]) {
perror("Malloc");
res = -1;
goto end;
}
}
srcContext= sws_getContext(w, h, PIX_FMT_YUVA420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);
if (!srcContext) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(PIX_FMT_YUVA420P),
sws_format_name(srcFormat));
res = -1;
goto end;
}
dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL);
if (!dstContext) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(srcFormat),
sws_format_name(dstFormat));
res = -1;
goto end;
}
outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUVA420P, flags, NULL, NULL, NULL);
if (!outContext) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(dstFormat),
sws_format_name(PIX_FMT_YUVA420P));
res = -1;
goto end;
}
// printf("test %X %X %X -> %X %X %X\n", (int)ref[0], (int)ref[1], (int)ref[2],
// (int)src[0], (int)src[1], (int)src[2]);
sws_scale(srcContext, ref, refStride, 0, h , src, srcStride);
sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride);
sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride);
ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h);
ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1);
ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1);
if (isALPHA(srcFormat) && isALPHA(dstFormat))
ssdA= getSSD(ref[3], out[3], refStride[3], refStride[3], w, h);
if (srcFormat == PIX_FMT_GRAY8 || dstFormat==PIX_FMT_GRAY8) ssdU=ssdV=0; //FIXME check that output is really gray
ssdY/= w*h;
ssdU/= w*h/4;
ssdV/= w*h/4;
ssdA/= w*h;
printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5"PRId64",%5"PRId64",%5"PRId64",%5"PRId64"\n",
sws_format_name(srcFormat), srcW, srcH,
sws_format_name(dstFormat), dstW, dstH,
flags, ssdY, ssdU, ssdV, ssdA);
fflush(stdout);
end:
sws_freeContext(srcContext);
sws_freeContext(dstContext);
sws_freeContext(outContext);
for (i=0; i<4; i++){
free(src[i]);
free(dst[i]);
free(out[i]);
}
return res;
}
| false
|
FFmpeg
|
f5a9c4ee50ce5d51c8f7f0f23f63f76bbf40a9a1
|
static int doTest(uint8_t *ref[4], int refStride[4], int w, int h, int srcFormat, int dstFormat,
int srcW, int srcH, int dstW, int dstH, int flags){
uint8_t *src[4] = {0};
uint8_t *dst[4] = {0};
uint8_t *out[4] = {0};
int srcStride[4], dstStride[4];
int i;
uint64_t ssdY, ssdU, ssdV, ssdA=0;
struct SwsContext *srcContext = NULL, *dstContext = NULL,
*outContext = NULL;
int res;
res = 0;
for (i=0; i<4; i++){
if (srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24)
srcStride[i]= srcW*3;
else if (srcFormat==PIX_FMT_RGB48BE || srcFormat==PIX_FMT_RGB48LE)
srcStride[i]= srcW*6;
else
srcStride[i]= srcW*4;
if (dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24)
dstStride[i]= dstW*3;
else if (dstFormat==PIX_FMT_RGB48BE || dstFormat==PIX_FMT_RGB48LE)
dstStride[i]= dstW*6;
else
dstStride[i]= dstW*4;
src[i]= (uint8_t*) malloc(srcStride[i]*srcH);
dst[i]= (uint8_t*) malloc(dstStride[i]*dstH);
out[i]= (uint8_t*) malloc(refStride[i]*h);
if (!src[i] || !dst[i] || !out[i]) {
perror("Malloc");
res = -1;
goto end;
}
}
srcContext= sws_getContext(w, h, PIX_FMT_YUVA420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);
if (!srcContext) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(PIX_FMT_YUVA420P),
sws_format_name(srcFormat));
res = -1;
goto end;
}
dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL);
if (!dstContext) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(srcFormat),
sws_format_name(dstFormat));
res = -1;
goto end;
}
outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUVA420P, flags, NULL, NULL, NULL);
if (!outContext) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(dstFormat),
sws_format_name(PIX_FMT_YUVA420P));
res = -1;
goto end;
}
sws_scale(srcContext, ref, refStride, 0, h , src, srcStride);
sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride);
sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride);
ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h);
ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1);
ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1);
if (isALPHA(srcFormat) && isALPHA(dstFormat))
ssdA= getSSD(ref[3], out[3], refStride[3], refStride[3], w, h);
if (srcFormat == PIX_FMT_GRAY8 || dstFormat==PIX_FMT_GRAY8) ssdU=ssdV=0;
ssdY/= w*h;
ssdU/= w*h/4;
ssdV/= w*h/4;
ssdA/= w*h;
printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5"PRId64",%5"PRId64",%5"PRId64",%5"PRId64"\n",
sws_format_name(srcFormat), srcW, srcH,
sws_format_name(dstFormat), dstW, dstH,
flags, ssdY, ssdU, ssdV, ssdA);
fflush(stdout);
end:
sws_freeContext(srcContext);
sws_freeContext(dstContext);
sws_freeContext(outContext);
for (i=0; i<4; i++){
free(src[i]);
free(dst[i]);
free(out[i]);
}
return res;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4], int VAR_2, int VAR_3, int VAR_4, int VAR_5,
int VAR_6, int VAR_7, int VAR_8, int VAR_9, int VAR_10){
uint8_t *src[4] = {0};
uint8_t *dst[4] = {0};
uint8_t *out[4] = {0};
int VAR_11[4], VAR_12[4];
int VAR_13;
uint64_t ssdY, ssdU, ssdV, ssdA=0;
struct SwsContext *VAR_14 = NULL, *VAR_15 = NULL,
*VAR_16 = NULL;
int VAR_17;
VAR_17 = 0;
for (VAR_13=0; VAR_13<4; VAR_13++){
if (VAR_4==PIX_FMT_RGB24 || VAR_4==PIX_FMT_BGR24)
VAR_11[VAR_13]= VAR_6*3;
else if (VAR_4==PIX_FMT_RGB48BE || VAR_4==PIX_FMT_RGB48LE)
VAR_11[VAR_13]= VAR_6*6;
else
VAR_11[VAR_13]= VAR_6*4;
if (VAR_5==PIX_FMT_RGB24 || VAR_5==PIX_FMT_BGR24)
VAR_12[VAR_13]= VAR_8*3;
else if (VAR_5==PIX_FMT_RGB48BE || VAR_5==PIX_FMT_RGB48LE)
VAR_12[VAR_13]= VAR_8*6;
else
VAR_12[VAR_13]= VAR_8*4;
src[VAR_13]= (uint8_t*) malloc(VAR_11[VAR_13]*VAR_7);
dst[VAR_13]= (uint8_t*) malloc(VAR_12[VAR_13]*VAR_9);
out[VAR_13]= (uint8_t*) malloc(VAR_1[VAR_13]*VAR_3);
if (!src[VAR_13] || !dst[VAR_13] || !out[VAR_13]) {
perror("Malloc");
VAR_17 = -1;
goto end;
}
}
VAR_14= sws_getContext(VAR_2, VAR_3, PIX_FMT_YUVA420P, VAR_6, VAR_7, VAR_4, VAR_10, NULL, NULL, NULL);
if (!VAR_14) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(PIX_FMT_YUVA420P),
sws_format_name(VAR_4));
VAR_17 = -1;
goto end;
}
VAR_15= sws_getContext(VAR_6, VAR_7, VAR_4, VAR_8, VAR_9, VAR_5, VAR_10, NULL, NULL, NULL);
if (!VAR_15) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(VAR_4),
sws_format_name(VAR_5));
VAR_17 = -1;
goto end;
}
VAR_16= sws_getContext(VAR_8, VAR_9, VAR_5, VAR_2, VAR_3, PIX_FMT_YUVA420P, VAR_10, NULL, NULL, NULL);
if (!VAR_16) {
fprintf(stderr, "Failed to get %s ---> %s\n",
sws_format_name(VAR_5),
sws_format_name(PIX_FMT_YUVA420P));
VAR_17 = -1;
goto end;
}
sws_scale(VAR_14, VAR_0, VAR_1, 0, VAR_3 , src, VAR_11);
sws_scale(VAR_15, src, VAR_11, 0, VAR_7, dst, VAR_12);
sws_scale(VAR_16, dst, VAR_12, 0, VAR_9, out, VAR_1);
ssdY= getSSD(VAR_0[0], out[0], VAR_1[0], VAR_1[0], VAR_2, VAR_3);
ssdU= getSSD(VAR_0[1], out[1], VAR_1[1], VAR_1[1], (VAR_2+1)>>1, (VAR_3+1)>>1);
ssdV= getSSD(VAR_0[2], out[2], VAR_1[2], VAR_1[2], (VAR_2+1)>>1, (VAR_3+1)>>1);
if (isALPHA(VAR_4) && isALPHA(VAR_5))
ssdA= getSSD(VAR_0[3], out[3], VAR_1[3], VAR_1[3], VAR_2, VAR_3);
if (VAR_4 == PIX_FMT_GRAY8 || VAR_5==PIX_FMT_GRAY8) ssdU=ssdV=0;
ssdY/= VAR_2*VAR_3;
ssdU/= VAR_2*VAR_3/4;
ssdV/= VAR_2*VAR_3/4;
ssdA/= VAR_2*VAR_3;
printf(" %s %dx%d -> %s %4dx%4d VAR_10=%2d SSD=%5"PRId64",%5"PRId64",%5"PRId64",%5"PRId64"\n",
sws_format_name(VAR_4), VAR_6, VAR_7,
sws_format_name(VAR_5), VAR_8, VAR_9,
VAR_10, ssdY, ssdU, ssdV, ssdA);
fflush(stdout);
end:
sws_freeContext(VAR_14);
sws_freeContext(VAR_15);
sws_freeContext(VAR_16);
for (VAR_13=0; VAR_13<4; VAR_13++){
free(src[VAR_13]);
free(dst[VAR_13]);
free(out[VAR_13]);
}
return VAR_17;
}
|
[
"static int FUNC_0(uint8_t *VAR_0[4], int VAR_1[4], int VAR_2, int VAR_3, int VAR_4, int VAR_5,\nint VAR_6, int VAR_7, int VAR_8, int VAR_9, int VAR_10){",
"uint8_t *src[4] = {0};",
"uint8_t *dst[4] = {0};",
"uint8_t *out[4] = {0};",
"int VAR_11[4], VAR_12[4];",
"int VAR_13;",
"uint64_t ssdY, ssdU, ssdV, ssdA=0;",
"struct SwsContext *VAR_14 = NULL, *VAR_15 = NULL,\n*VAR_16 = NULL;",
"int VAR_17;",
"VAR_17 = 0;",
"for (VAR_13=0; VAR_13<4; VAR_13++){",
"if (VAR_4==PIX_FMT_RGB24 || VAR_4==PIX_FMT_BGR24)\nVAR_11[VAR_13]= VAR_6*3;",
"else if (VAR_4==PIX_FMT_RGB48BE || VAR_4==PIX_FMT_RGB48LE)\nVAR_11[VAR_13]= VAR_6*6;",
"else\nVAR_11[VAR_13]= VAR_6*4;",
"if (VAR_5==PIX_FMT_RGB24 || VAR_5==PIX_FMT_BGR24)\nVAR_12[VAR_13]= VAR_8*3;",
"else if (VAR_5==PIX_FMT_RGB48BE || VAR_5==PIX_FMT_RGB48LE)\nVAR_12[VAR_13]= VAR_8*6;",
"else\nVAR_12[VAR_13]= VAR_8*4;",
"src[VAR_13]= (uint8_t*) malloc(VAR_11[VAR_13]*VAR_7);",
"dst[VAR_13]= (uint8_t*) malloc(VAR_12[VAR_13]*VAR_9);",
"out[VAR_13]= (uint8_t*) malloc(VAR_1[VAR_13]*VAR_3);",
"if (!src[VAR_13] || !dst[VAR_13] || !out[VAR_13]) {",
"perror(\"Malloc\");",
"VAR_17 = -1;",
"goto end;",
"}",
"}",
"VAR_14= sws_getContext(VAR_2, VAR_3, PIX_FMT_YUVA420P, VAR_6, VAR_7, VAR_4, VAR_10, NULL, NULL, NULL);",
"if (!VAR_14) {",
"fprintf(stderr, \"Failed to get %s ---> %s\\n\",\nsws_format_name(PIX_FMT_YUVA420P),\nsws_format_name(VAR_4));",
"VAR_17 = -1;",
"goto end;",
"}",
"VAR_15= sws_getContext(VAR_6, VAR_7, VAR_4, VAR_8, VAR_9, VAR_5, VAR_10, NULL, NULL, NULL);",
"if (!VAR_15) {",
"fprintf(stderr, \"Failed to get %s ---> %s\\n\",\nsws_format_name(VAR_4),\nsws_format_name(VAR_5));",
"VAR_17 = -1;",
"goto end;",
"}",
"VAR_16= sws_getContext(VAR_8, VAR_9, VAR_5, VAR_2, VAR_3, PIX_FMT_YUVA420P, VAR_10, NULL, NULL, NULL);",
"if (!VAR_16) {",
"fprintf(stderr, \"Failed to get %s ---> %s\\n\",\nsws_format_name(VAR_5),\nsws_format_name(PIX_FMT_YUVA420P));",
"VAR_17 = -1;",
"goto end;",
"}",
"sws_scale(VAR_14, VAR_0, VAR_1, 0, VAR_3 , src, VAR_11);",
"sws_scale(VAR_15, src, VAR_11, 0, VAR_7, dst, VAR_12);",
"sws_scale(VAR_16, dst, VAR_12, 0, VAR_9, out, VAR_1);",
"ssdY= getSSD(VAR_0[0], out[0], VAR_1[0], VAR_1[0], VAR_2, VAR_3);",
"ssdU= getSSD(VAR_0[1], out[1], VAR_1[1], VAR_1[1], (VAR_2+1)>>1, (VAR_3+1)>>1);",
"ssdV= getSSD(VAR_0[2], out[2], VAR_1[2], VAR_1[2], (VAR_2+1)>>1, (VAR_3+1)>>1);",
"if (isALPHA(VAR_4) && isALPHA(VAR_5))\nssdA= getSSD(VAR_0[3], out[3], VAR_1[3], VAR_1[3], VAR_2, VAR_3);",
"if (VAR_4 == PIX_FMT_GRAY8 || VAR_5==PIX_FMT_GRAY8) ssdU=ssdV=0;",
"ssdY/= VAR_2*VAR_3;",
"ssdU/= VAR_2*VAR_3/4;",
"ssdV/= VAR_2*VAR_3/4;",
"ssdA/= VAR_2*VAR_3;",
"printf(\" %s %dx%d -> %s %4dx%4d VAR_10=%2d SSD=%5\"PRId64\",%5\"PRId64\",%5\"PRId64\",%5\"PRId64\"\\n\",\nsws_format_name(VAR_4), VAR_6, VAR_7,\nsws_format_name(VAR_5), VAR_8, VAR_9,\nVAR_10, ssdY, ssdU, ssdV, ssdA);",
"fflush(stdout);",
"end:\nsws_freeContext(VAR_14);",
"sws_freeContext(VAR_15);",
"sws_freeContext(VAR_16);",
"for (VAR_13=0; VAR_13<4; VAR_13++){",
"free(src[VAR_13]);",
"free(dst[VAR_13]);",
"free(out[VAR_13]);",
"}",
"return VAR_17;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17,
19
],
[
21
],
[
25
],
[
27
],
[
31,
33
],
[
35,
37
],
[
39,
41
],
[
45,
47
],
[
49,
51
],
[
53,
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
75
],
[
77
],
[
81
],
[
83
],
[
85,
87,
89
],
[
91
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103,
105,
107
],
[
109
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121,
123,
125
],
[
127
],
[
131
],
[
133
],
[
141
],
[
143
],
[
145
],
[
149
],
[
151
],
[
153
],
[
155,
157
],
[
161
],
[
165
],
[
167
],
[
169
],
[
171
],
[
175,
177,
179,
181
],
[
183
],
[
187,
191
],
[
193
],
[
195
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
211
],
[
213
]
] |
17,440
|
static ram_addr_t get_start_block(DumpState *s)
{
RAMBlock *block;
if (!s->has_filter) {
s->block = QTAILQ_FIRST(&ram_list.blocks);
return 0;
}
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
if (block->offset >= s->begin + s->length ||
block->offset + block->length <= s->begin) {
/* This block is out of the range */
continue;
}
s->block = block;
if (s->begin > block->offset) {
s->start = s->begin - block->offset;
} else {
s->start = 0;
}
return s->start;
}
return -1;
}
| true
|
qemu
|
56c4bfb3f07f3107894c00281276aea4f5e8834d
|
static ram_addr_t get_start_block(DumpState *s)
{
RAMBlock *block;
if (!s->has_filter) {
s->block = QTAILQ_FIRST(&ram_list.blocks);
return 0;
}
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
if (block->offset >= s->begin + s->length ||
block->offset + block->length <= s->begin) {
continue;
}
s->block = block;
if (s->begin > block->offset) {
s->start = s->begin - block->offset;
} else {
s->start = 0;
}
return s->start;
}
return -1;
}
|
{
"code": [
" RAMBlock *block;",
" RAMBlock *block;",
" QTAILQ_FOREACH(block, &ram_list.blocks, next) {",
" s->block = block;",
" RAMBlock *block;",
" RAMBlock *block;",
" s->block = QTAILQ_FIRST(&ram_list.blocks);",
" QTAILQ_FOREACH(block, &ram_list.blocks, next) {",
" if (block->offset >= s->begin + s->length ||",
" block->offset + block->length <= s->begin) {",
" s->block = block;",
" if (s->begin > block->offset) {",
" s->start = s->begin - block->offset;",
" RAMBlock *block;",
" QTAILQ_FOREACH(block, &ram_list.blocks, next) {",
" RAMBlock *block;",
" QTAILQ_FOREACH(block, &ram_list.blocks, next) {",
" RAMBlock *block;"
],
"line_no": [
5,
5,
19,
33,
5,
5,
11,
19,
21,
23,
33,
35,
37,
5,
19,
5,
19,
5
]
}
|
static ram_addr_t FUNC_0(DumpState *s)
{
RAMBlock *block;
if (!s->has_filter) {
s->block = QTAILQ_FIRST(&ram_list.blocks);
return 0;
}
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
if (block->offset >= s->begin + s->length ||
block->offset + block->length <= s->begin) {
continue;
}
s->block = block;
if (s->begin > block->offset) {
s->start = s->begin - block->offset;
} else {
s->start = 0;
}
return s->start;
}
return -1;
}
|
[
"static ram_addr_t FUNC_0(DumpState *s)\n{",
"RAMBlock *block;",
"if (!s->has_filter) {",
"s->block = QTAILQ_FIRST(&ram_list.blocks);",
"return 0;",
"}",
"QTAILQ_FOREACH(block, &ram_list.blocks, next) {",
"if (block->offset >= s->begin + s->length ||\nblock->offset + block->length <= s->begin) {",
"continue;",
"}",
"s->block = block;",
"if (s->begin > block->offset) {",
"s->start = s->begin - block->offset;",
"} else {",
"s->start = 0;",
"}",
"return s->start;",
"}",
"return -1;",
"}"
] |
[
0,
1,
0,
1,
0,
0,
1,
1,
0,
0,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21,
23
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
]
] |
17,441
|
static int get_cluster_table(BlockDriverState *bs, uint64_t offset,
uint64_t **new_l2_table,
int *new_l2_index)
{
BDRVQcowState *s = bs->opaque;
unsigned int l1_index, l2_index;
uint64_t l2_offset;
uint64_t *l2_table = NULL;
int ret;
/* seek the the l2 offset in the l1 table */
l1_index = offset >> (s->l2_bits + s->cluster_bits);
if (l1_index >= s->l1_size) {
ret = qcow2_grow_l1_table(bs, l1_index + 1, false);
if (ret < 0) {
return ret;
}
}
l2_offset = s->l1_table[l1_index] & L1E_OFFSET_MASK;
/* seek the l2 table of the given l2 offset */
if (s->l1_table[l1_index] & QCOW_OFLAG_COPIED) {
/* load the l2 table in memory */
ret = l2_load(bs, l2_offset, &l2_table);
if (ret < 0) {
return ret;
}
} else {
/* First allocate a new L2 table (and do COW if needed) */
ret = l2_allocate(bs, l1_index, &l2_table);
if (ret < 0) {
return ret;
}
/* Then decrease the refcount of the old table */
if (l2_offset) {
qcow2_free_clusters(bs, l2_offset, s->l2_size * sizeof(uint64_t));
}
}
/* find the cluster offset for the given disk offset */
l2_index = (offset >> s->cluster_bits) & (s->l2_size - 1);
*new_l2_table = l2_table;
*new_l2_index = l2_index;
return 0;
}
| true
|
qemu
|
2cf7cfa1cde6672b8a35bbed3fbc989f28c05dce
|
static int get_cluster_table(BlockDriverState *bs, uint64_t offset,
uint64_t **new_l2_table,
int *new_l2_index)
{
BDRVQcowState *s = bs->opaque;
unsigned int l1_index, l2_index;
uint64_t l2_offset;
uint64_t *l2_table = NULL;
int ret;
l1_index = offset >> (s->l2_bits + s->cluster_bits);
if (l1_index >= s->l1_size) {
ret = qcow2_grow_l1_table(bs, l1_index + 1, false);
if (ret < 0) {
return ret;
}
}
l2_offset = s->l1_table[l1_index] & L1E_OFFSET_MASK;
if (s->l1_table[l1_index] & QCOW_OFLAG_COPIED) {
ret = l2_load(bs, l2_offset, &l2_table);
if (ret < 0) {
return ret;
}
} else {
ret = l2_allocate(bs, l1_index, &l2_table);
if (ret < 0) {
return ret;
}
if (l2_offset) {
qcow2_free_clusters(bs, l2_offset, s->l2_size * sizeof(uint64_t));
}
}
l2_index = (offset >> s->cluster_bits) & (s->l2_size - 1);
*new_l2_table = l2_table;
*new_l2_index = l2_index;
return 0;
}
|
{
"code": [
" unsigned int l1_index, l2_index;",
" unsigned int l1_index, l2_index;",
" uint64_t l2_offset;"
],
"line_no": [
11,
11,
13
]
}
|
static int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,
uint64_t **VAR_2,
int *VAR_3)
{
BDRVQcowState *s = VAR_0->opaque;
unsigned int VAR_4, VAR_5;
uint64_t l2_offset;
uint64_t *l2_table = NULL;
int VAR_6;
VAR_4 = VAR_1 >> (s->l2_bits + s->cluster_bits);
if (VAR_4 >= s->l1_size) {
VAR_6 = qcow2_grow_l1_table(VAR_0, VAR_4 + 1, false);
if (VAR_6 < 0) {
return VAR_6;
}
}
l2_offset = s->l1_table[VAR_4] & L1E_OFFSET_MASK;
if (s->l1_table[VAR_4] & QCOW_OFLAG_COPIED) {
VAR_6 = l2_load(VAR_0, l2_offset, &l2_table);
if (VAR_6 < 0) {
return VAR_6;
}
} else {
VAR_6 = l2_allocate(VAR_0, VAR_4, &l2_table);
if (VAR_6 < 0) {
return VAR_6;
}
if (l2_offset) {
qcow2_free_clusters(VAR_0, l2_offset, s->l2_size * sizeof(uint64_t));
}
}
VAR_5 = (VAR_1 >> s->cluster_bits) & (s->l2_size - 1);
*VAR_2 = l2_table;
*VAR_3 = VAR_5;
return 0;
}
|
[
"static int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,\nuint64_t **VAR_2,\nint *VAR_3)\n{",
"BDRVQcowState *s = VAR_0->opaque;",
"unsigned int VAR_4, VAR_5;",
"uint64_t l2_offset;",
"uint64_t *l2_table = NULL;",
"int VAR_6;",
"VAR_4 = VAR_1 >> (s->l2_bits + s->cluster_bits);",
"if (VAR_4 >= s->l1_size) {",
"VAR_6 = qcow2_grow_l1_table(VAR_0, VAR_4 + 1, false);",
"if (VAR_6 < 0) {",
"return VAR_6;",
"}",
"}",
"l2_offset = s->l1_table[VAR_4] & L1E_OFFSET_MASK;",
"if (s->l1_table[VAR_4] & QCOW_OFLAG_COPIED) {",
"VAR_6 = l2_load(VAR_0, l2_offset, &l2_table);",
"if (VAR_6 < 0) {",
"return VAR_6;",
"}",
"} else {",
"VAR_6 = l2_allocate(VAR_0, VAR_4, &l2_table);",
"if (VAR_6 < 0) {",
"return VAR_6;",
"}",
"if (l2_offset) {",
"qcow2_free_clusters(VAR_0, l2_offset, s->l2_size * sizeof(uint64_t));",
"}",
"}",
"VAR_5 = (VAR_1 >> s->cluster_bits) & (s->l2_size - 1);",
"*VAR_2 = l2_table;",
"*VAR_3 = VAR_5;",
"return 0;",
"}"
] |
[
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
49
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65
],
[
67
],
[
69
],
[
71
],
[
77
],
[
79
],
[
81
],
[
83
],
[
91
],
[
95
],
[
97
],
[
101
],
[
103
]
] |
17,442
|
static void gem_write(void *opaque, hwaddr offset, uint64_t val,
unsigned size)
{
CadenceGEMState *s = (CadenceGEMState *)opaque;
uint32_t readonly;
int i;
DB_PRINT("offset: 0x%04x write: 0x%08x ", (unsigned)offset, (unsigned)val);
offset >>= 2;
/* Squash bits which are read only in write value */
val &= ~(s->regs_ro[offset]);
/* Preserve (only) bits which are read only and wtc in register */
readonly = s->regs[offset] & (s->regs_ro[offset] | s->regs_w1c[offset]);
/* Copy register write to backing store */
s->regs[offset] = (val & ~s->regs_w1c[offset]) | readonly;
/* do w1c */
s->regs[offset] &= ~(s->regs_w1c[offset] & val);
/* Handle register write side effects */
switch (offset) {
case GEM_NWCTRL:
if (val & GEM_NWCTRL_RXENA) {
for (i = 0; i < s->num_priority_queues; ++i) {
gem_get_rx_desc(s, i);
}
}
if (val & GEM_NWCTRL_TXSTART) {
gem_transmit(s);
}
if (!(val & GEM_NWCTRL_TXENA)) {
/* Reset to start of Q when transmit disabled. */
for (i = 0; i < s->num_priority_queues; i++) {
s->tx_desc_addr[i] = s->regs[GEM_TXQBASE];
}
}
if (gem_can_receive(qemu_get_queue(s->nic))) {
qemu_flush_queued_packets(qemu_get_queue(s->nic));
}
break;
case GEM_TXSTATUS:
gem_update_int_status(s);
break;
case GEM_RXQBASE:
s->rx_desc_addr[0] = val;
break;
case GEM_RECEIVE_Q1_PTR ... GEM_RECEIVE_Q15_PTR:
s->rx_desc_addr[offset - GEM_RECEIVE_Q1_PTR + 1] = val;
break;
case GEM_TXQBASE:
s->tx_desc_addr[0] = val;
break;
case GEM_TRANSMIT_Q1_PTR ... GEM_TRANSMIT_Q15_PTR:
s->tx_desc_addr[offset - GEM_TRANSMIT_Q1_PTR + 1] = val;
break;
case GEM_RXSTATUS:
gem_update_int_status(s);
break;
case GEM_IER:
s->regs[GEM_IMR] &= ~val;
gem_update_int_status(s);
break;
case GEM_INT_Q1_ENABLE ... GEM_INT_Q7_ENABLE:
s->regs[GEM_INT_Q1_MASK + offset - GEM_INT_Q1_ENABLE] &= ~val;
gem_update_int_status(s);
break;
case GEM_INT_Q8_ENABLE ... GEM_INT_Q15_ENABLE:
s->regs[GEM_INT_Q8_MASK + offset - GEM_INT_Q8_ENABLE] &= ~val;
gem_update_int_status(s);
break;
case GEM_IDR:
s->regs[GEM_IMR] |= val;
gem_update_int_status(s);
break;
case GEM_INT_Q1_DISABLE ... GEM_INT_Q7_DISABLE:
s->regs[GEM_INT_Q1_MASK + offset - GEM_INT_Q1_DISABLE] |= val;
gem_update_int_status(s);
break;
case GEM_INT_Q8_DISABLE ... GEM_INT_Q15_DISABLE:
s->regs[GEM_INT_Q8_MASK + offset - GEM_INT_Q8_DISABLE] |= val;
gem_update_int_status(s);
break;
case GEM_SPADDR1LO:
case GEM_SPADDR2LO:
case GEM_SPADDR3LO:
case GEM_SPADDR4LO:
s->sar_active[(offset - GEM_SPADDR1LO) / 2] = false;
break;
case GEM_SPADDR1HI:
case GEM_SPADDR2HI:
case GEM_SPADDR3HI:
case GEM_SPADDR4HI:
s->sar_active[(offset - GEM_SPADDR1HI) / 2] = true;
break;
case GEM_PHYMNTNC:
if (val & GEM_PHYMNTNC_OP_W) {
uint32_t phy_addr, reg_num;
phy_addr = (val & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT;
if (phy_addr == BOARD_PHY_ADDRESS || phy_addr == 0) {
reg_num = (val & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT;
gem_phy_write(s, reg_num, val);
}
}
break;
}
DB_PRINT("newval: 0x%08x\n", s->regs[offset]);
}
| true
|
qemu
|
79b2ac8f28748b09816d09bd62a2b49ddc01ebeb
|
static void gem_write(void *opaque, hwaddr offset, uint64_t val,
unsigned size)
{
CadenceGEMState *s = (CadenceGEMState *)opaque;
uint32_t readonly;
int i;
DB_PRINT("offset: 0x%04x write: 0x%08x ", (unsigned)offset, (unsigned)val);
offset >>= 2;
val &= ~(s->regs_ro[offset]);
readonly = s->regs[offset] & (s->regs_ro[offset] | s->regs_w1c[offset]);
s->regs[offset] = (val & ~s->regs_w1c[offset]) | readonly;
s->regs[offset] &= ~(s->regs_w1c[offset] & val);
switch (offset) {
case GEM_NWCTRL:
if (val & GEM_NWCTRL_RXENA) {
for (i = 0; i < s->num_priority_queues; ++i) {
gem_get_rx_desc(s, i);
}
}
if (val & GEM_NWCTRL_TXSTART) {
gem_transmit(s);
}
if (!(val & GEM_NWCTRL_TXENA)) {
for (i = 0; i < s->num_priority_queues; i++) {
s->tx_desc_addr[i] = s->regs[GEM_TXQBASE];
}
}
if (gem_can_receive(qemu_get_queue(s->nic))) {
qemu_flush_queued_packets(qemu_get_queue(s->nic));
}
break;
case GEM_TXSTATUS:
gem_update_int_status(s);
break;
case GEM_RXQBASE:
s->rx_desc_addr[0] = val;
break;
case GEM_RECEIVE_Q1_PTR ... GEM_RECEIVE_Q15_PTR:
s->rx_desc_addr[offset - GEM_RECEIVE_Q1_PTR + 1] = val;
break;
case GEM_TXQBASE:
s->tx_desc_addr[0] = val;
break;
case GEM_TRANSMIT_Q1_PTR ... GEM_TRANSMIT_Q15_PTR:
s->tx_desc_addr[offset - GEM_TRANSMIT_Q1_PTR + 1] = val;
break;
case GEM_RXSTATUS:
gem_update_int_status(s);
break;
case GEM_IER:
s->regs[GEM_IMR] &= ~val;
gem_update_int_status(s);
break;
case GEM_INT_Q1_ENABLE ... GEM_INT_Q7_ENABLE:
s->regs[GEM_INT_Q1_MASK + offset - GEM_INT_Q1_ENABLE] &= ~val;
gem_update_int_status(s);
break;
case GEM_INT_Q8_ENABLE ... GEM_INT_Q15_ENABLE:
s->regs[GEM_INT_Q8_MASK + offset - GEM_INT_Q8_ENABLE] &= ~val;
gem_update_int_status(s);
break;
case GEM_IDR:
s->regs[GEM_IMR] |= val;
gem_update_int_status(s);
break;
case GEM_INT_Q1_DISABLE ... GEM_INT_Q7_DISABLE:
s->regs[GEM_INT_Q1_MASK + offset - GEM_INT_Q1_DISABLE] |= val;
gem_update_int_status(s);
break;
case GEM_INT_Q8_DISABLE ... GEM_INT_Q15_DISABLE:
s->regs[GEM_INT_Q8_MASK + offset - GEM_INT_Q8_DISABLE] |= val;
gem_update_int_status(s);
break;
case GEM_SPADDR1LO:
case GEM_SPADDR2LO:
case GEM_SPADDR3LO:
case GEM_SPADDR4LO:
s->sar_active[(offset - GEM_SPADDR1LO) / 2] = false;
break;
case GEM_SPADDR1HI:
case GEM_SPADDR2HI:
case GEM_SPADDR3HI:
case GEM_SPADDR4HI:
s->sar_active[(offset - GEM_SPADDR1HI) / 2] = true;
break;
case GEM_PHYMNTNC:
if (val & GEM_PHYMNTNC_OP_W) {
uint32_t phy_addr, reg_num;
phy_addr = (val & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT;
if (phy_addr == BOARD_PHY_ADDRESS || phy_addr == 0) {
reg_num = (val & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT;
gem_phy_write(s, reg_num, val);
}
}
break;
}
DB_PRINT("newval: 0x%08x\n", s->regs[offset]);
}
|
{
"code": [
" case GEM_RECEIVE_Q1_PTR ... GEM_RECEIVE_Q15_PTR:",
" case GEM_TRANSMIT_Q1_PTR ... GEM_TRANSMIT_Q15_PTR:",
" case GEM_INT_Q8_ENABLE ... GEM_INT_Q15_ENABLE:",
" s->regs[GEM_INT_Q8_MASK + offset - GEM_INT_Q8_ENABLE] &= ~val;",
" gem_update_int_status(s);",
" break;",
" case GEM_INT_Q8_DISABLE ... GEM_INT_Q15_DISABLE:",
" s->regs[GEM_INT_Q8_MASK + offset - GEM_INT_Q8_DISABLE] |= val;",
" gem_update_int_status(s);",
" break;"
],
"line_no": [
99,
111,
139,
141,
89,
83,
163,
165,
89,
83
]
}
|
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2,
unsigned VAR_3)
{
CadenceGEMState *s = (CadenceGEMState *)VAR_0;
uint32_t readonly;
int VAR_4;
DB_PRINT("VAR_1: 0x%04x write: 0x%08x ", (unsigned)VAR_1, (unsigned)VAR_2);
VAR_1 >>= 2;
VAR_2 &= ~(s->regs_ro[VAR_1]);
readonly = s->regs[VAR_1] & (s->regs_ro[VAR_1] | s->regs_w1c[VAR_1]);
s->regs[VAR_1] = (VAR_2 & ~s->regs_w1c[VAR_1]) | readonly;
s->regs[VAR_1] &= ~(s->regs_w1c[VAR_1] & VAR_2);
switch (VAR_1) {
case GEM_NWCTRL:
if (VAR_2 & GEM_NWCTRL_RXENA) {
for (VAR_4 = 0; VAR_4 < s->num_priority_queues; ++VAR_4) {
gem_get_rx_desc(s, VAR_4);
}
}
if (VAR_2 & GEM_NWCTRL_TXSTART) {
gem_transmit(s);
}
if (!(VAR_2 & GEM_NWCTRL_TXENA)) {
for (VAR_4 = 0; VAR_4 < s->num_priority_queues; VAR_4++) {
s->tx_desc_addr[VAR_4] = s->regs[GEM_TXQBASE];
}
}
if (gem_can_receive(qemu_get_queue(s->nic))) {
qemu_flush_queued_packets(qemu_get_queue(s->nic));
}
break;
case GEM_TXSTATUS:
gem_update_int_status(s);
break;
case GEM_RXQBASE:
s->rx_desc_addr[0] = VAR_2;
break;
case GEM_RECEIVE_Q1_PTR ... GEM_RECEIVE_Q15_PTR:
s->rx_desc_addr[VAR_1 - GEM_RECEIVE_Q1_PTR + 1] = VAR_2;
break;
case GEM_TXQBASE:
s->tx_desc_addr[0] = VAR_2;
break;
case GEM_TRANSMIT_Q1_PTR ... GEM_TRANSMIT_Q15_PTR:
s->tx_desc_addr[VAR_1 - GEM_TRANSMIT_Q1_PTR + 1] = VAR_2;
break;
case GEM_RXSTATUS:
gem_update_int_status(s);
break;
case GEM_IER:
s->regs[GEM_IMR] &= ~VAR_2;
gem_update_int_status(s);
break;
case GEM_INT_Q1_ENABLE ... GEM_INT_Q7_ENABLE:
s->regs[GEM_INT_Q1_MASK + VAR_1 - GEM_INT_Q1_ENABLE] &= ~VAR_2;
gem_update_int_status(s);
break;
case GEM_INT_Q8_ENABLE ... GEM_INT_Q15_ENABLE:
s->regs[GEM_INT_Q8_MASK + VAR_1 - GEM_INT_Q8_ENABLE] &= ~VAR_2;
gem_update_int_status(s);
break;
case GEM_IDR:
s->regs[GEM_IMR] |= VAR_2;
gem_update_int_status(s);
break;
case GEM_INT_Q1_DISABLE ... GEM_INT_Q7_DISABLE:
s->regs[GEM_INT_Q1_MASK + VAR_1 - GEM_INT_Q1_DISABLE] |= VAR_2;
gem_update_int_status(s);
break;
case GEM_INT_Q8_DISABLE ... GEM_INT_Q15_DISABLE:
s->regs[GEM_INT_Q8_MASK + VAR_1 - GEM_INT_Q8_DISABLE] |= VAR_2;
gem_update_int_status(s);
break;
case GEM_SPADDR1LO:
case GEM_SPADDR2LO:
case GEM_SPADDR3LO:
case GEM_SPADDR4LO:
s->sar_active[(VAR_1 - GEM_SPADDR1LO) / 2] = false;
break;
case GEM_SPADDR1HI:
case GEM_SPADDR2HI:
case GEM_SPADDR3HI:
case GEM_SPADDR4HI:
s->sar_active[(VAR_1 - GEM_SPADDR1HI) / 2] = true;
break;
case GEM_PHYMNTNC:
if (VAR_2 & GEM_PHYMNTNC_OP_W) {
uint32_t phy_addr, reg_num;
phy_addr = (VAR_2 & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT;
if (phy_addr == BOARD_PHY_ADDRESS || phy_addr == 0) {
reg_num = (VAR_2 & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT;
gem_phy_write(s, reg_num, VAR_2);
}
}
break;
}
DB_PRINT("newval: 0x%08x\n", s->regs[VAR_1]);
}
|
[
"static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2,\nunsigned VAR_3)\n{",
"CadenceGEMState *s = (CadenceGEMState *)VAR_0;",
"uint32_t readonly;",
"int VAR_4;",
"DB_PRINT(\"VAR_1: 0x%04x write: 0x%08x \", (unsigned)VAR_1, (unsigned)VAR_2);",
"VAR_1 >>= 2;",
"VAR_2 &= ~(s->regs_ro[VAR_1]);",
"readonly = s->regs[VAR_1] & (s->regs_ro[VAR_1] | s->regs_w1c[VAR_1]);",
"s->regs[VAR_1] = (VAR_2 & ~s->regs_w1c[VAR_1]) | readonly;",
"s->regs[VAR_1] &= ~(s->regs_w1c[VAR_1] & VAR_2);",
"switch (VAR_1) {",
"case GEM_NWCTRL:\nif (VAR_2 & GEM_NWCTRL_RXENA) {",
"for (VAR_4 = 0; VAR_4 < s->num_priority_queues; ++VAR_4) {",
"gem_get_rx_desc(s, VAR_4);",
"}",
"}",
"if (VAR_2 & GEM_NWCTRL_TXSTART) {",
"gem_transmit(s);",
"}",
"if (!(VAR_2 & GEM_NWCTRL_TXENA)) {",
"for (VAR_4 = 0; VAR_4 < s->num_priority_queues; VAR_4++) {",
"s->tx_desc_addr[VAR_4] = s->regs[GEM_TXQBASE];",
"}",
"}",
"if (gem_can_receive(qemu_get_queue(s->nic))) {",
"qemu_flush_queued_packets(qemu_get_queue(s->nic));",
"}",
"break;",
"case GEM_TXSTATUS:\ngem_update_int_status(s);",
"break;",
"case GEM_RXQBASE:\ns->rx_desc_addr[0] = VAR_2;",
"break;",
"case GEM_RECEIVE_Q1_PTR ... GEM_RECEIVE_Q15_PTR:\ns->rx_desc_addr[VAR_1 - GEM_RECEIVE_Q1_PTR + 1] = VAR_2;",
"break;",
"case GEM_TXQBASE:\ns->tx_desc_addr[0] = VAR_2;",
"break;",
"case GEM_TRANSMIT_Q1_PTR ... GEM_TRANSMIT_Q15_PTR:\ns->tx_desc_addr[VAR_1 - GEM_TRANSMIT_Q1_PTR + 1] = VAR_2;",
"break;",
"case GEM_RXSTATUS:\ngem_update_int_status(s);",
"break;",
"case GEM_IER:\ns->regs[GEM_IMR] &= ~VAR_2;",
"gem_update_int_status(s);",
"break;",
"case GEM_INT_Q1_ENABLE ... GEM_INT_Q7_ENABLE:\ns->regs[GEM_INT_Q1_MASK + VAR_1 - GEM_INT_Q1_ENABLE] &= ~VAR_2;",
"gem_update_int_status(s);",
"break;",
"case GEM_INT_Q8_ENABLE ... GEM_INT_Q15_ENABLE:\ns->regs[GEM_INT_Q8_MASK + VAR_1 - GEM_INT_Q8_ENABLE] &= ~VAR_2;",
"gem_update_int_status(s);",
"break;",
"case GEM_IDR:\ns->regs[GEM_IMR] |= VAR_2;",
"gem_update_int_status(s);",
"break;",
"case GEM_INT_Q1_DISABLE ... GEM_INT_Q7_DISABLE:\ns->regs[GEM_INT_Q1_MASK + VAR_1 - GEM_INT_Q1_DISABLE] |= VAR_2;",
"gem_update_int_status(s);",
"break;",
"case GEM_INT_Q8_DISABLE ... GEM_INT_Q15_DISABLE:\ns->regs[GEM_INT_Q8_MASK + VAR_1 - GEM_INT_Q8_DISABLE] |= VAR_2;",
"gem_update_int_status(s);",
"break;",
"case GEM_SPADDR1LO:\ncase GEM_SPADDR2LO:\ncase GEM_SPADDR3LO:\ncase GEM_SPADDR4LO:\ns->sar_active[(VAR_1 - GEM_SPADDR1LO) / 2] = false;",
"break;",
"case GEM_SPADDR1HI:\ncase GEM_SPADDR2HI:\ncase GEM_SPADDR3HI:\ncase GEM_SPADDR4HI:\ns->sar_active[(VAR_1 - GEM_SPADDR1HI) / 2] = true;",
"break;",
"case GEM_PHYMNTNC:\nif (VAR_2 & GEM_PHYMNTNC_OP_W) {",
"uint32_t phy_addr, reg_num;",
"phy_addr = (VAR_2 & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT;",
"if (phy_addr == BOARD_PHY_ADDRESS || phy_addr == 0) {",
"reg_num = (VAR_2 & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT;",
"gem_phy_write(s, reg_num, VAR_2);",
"}",
"}",
"break;",
"}",
"DB_PRINT(\"newval: 0x%08x\\n\", s->regs[VAR_1]);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
23
],
[
27
],
[
33
],
[
39
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
87,
89
],
[
91
],
[
93,
95
],
[
97
],
[
99,
101
],
[
103
],
[
105,
107
],
[
109
],
[
111,
113
],
[
115
],
[
117,
119
],
[
121
],
[
123,
125
],
[
127
],
[
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
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
221
],
[
223
]
] |
17,443
|
static int16_t g726_decode(G726Context* c, int I)
{
int dq, re_signal, pk0, fa1, i, tr, ylint, ylfrac, thr2, al, dq0;
Float11 f;
int I_sig= I >> (c->code_size - 1);
dq = inverse_quant(c, I);
/* Transition detect */
ylint = (c->yl >> 15);
ylfrac = (c->yl >> 10) & 0x1f;
thr2 = (ylint > 9) ? 0x1f << 10 : (0x20 + ylfrac) << ylint;
tr= (c->td == 1 && dq > ((3*thr2)>>2));
if (I_sig) /* get the sign */
dq = -dq;
re_signal = (int16_t)(c->se + dq);
/* Update second order predictor coefficient A2 and A1 */
pk0 = (c->sez + dq) ? sgn(c->sez + dq) : 0;
dq0 = dq ? sgn(dq) : 0;
if (tr) {
c->a[0] = 0;
c->a[1] = 0;
for (i=0; i<6; i++)
c->b[i] = 0;
} else {
/* This is a bit crazy, but it really is +255 not +256 */
fa1 = av_clip_intp2((-c->a[0]*c->pk[0]*pk0)>>5, 8);
c->a[1] += 128*pk0*c->pk[1] + fa1 - (c->a[1]>>7);
c->a[1] = av_clip(c->a[1], -12288, 12288);
c->a[0] += 64*3*pk0*c->pk[0] - (c->a[0] >> 8);
c->a[0] = av_clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]);
for (i=0; i<6; i++)
c->b[i] += 128*dq0*sgn(-c->dq[i].sign) - (c->b[i]>>8);
}
/* Update Dq and Sr and Pk */
c->pk[1] = c->pk[0];
c->pk[0] = pk0 ? pk0 : 1;
c->sr[1] = c->sr[0];
i2f(re_signal, &c->sr[0]);
for (i=5; i>0; i--)
c->dq[i] = c->dq[i-1];
i2f(dq, &c->dq[0]);
c->dq[0].sign = I_sig; /* Isn't it crazy ?!?! */
c->td = c->a[1] < -11776;
/* Update Ap */
c->dms += (c->tbls.F[I]<<4) + ((- c->dms) >> 5);
c->dml += (c->tbls.F[I]<<4) + ((- c->dml) >> 7);
if (tr)
c->ap = 256;
else {
c->ap += (-c->ap) >> 4;
if (c->y <= 1535 || c->td || abs((c->dms << 2) - c->dml) >= (c->dml >> 3))
c->ap += 0x20;
}
/* Update Yu and Yl */
c->yu = av_clip(c->y + c->tbls.W[I] + ((-c->y)>>5), 544, 5120);
c->yl += c->yu + ((-c->yl)>>6);
/* Next iteration for Y */
al = (c->ap >= 256) ? 1<<6 : c->ap >> 2;
c->y = (c->yl + (c->yu - (c->yl>>6))*al) >> 6;
/* Next iteration for SE and SEZ */
c->se = 0;
for (i=0; i<6; i++)
c->se += mult(i2f(c->b[i] >> 2, &f), &c->dq[i]);
c->sez = c->se >> 1;
for (i=0; i<2; i++)
c->se += mult(i2f(c->a[i] >> 2, &f), &c->sr[i]);
c->se >>= 1;
return av_clip(re_signal << 2, -0xffff, 0xffff);
}
| true
|
FFmpeg
|
c04aa148824f4fb7f4b70830ad3ca7a6cba8ab79
|
static int16_t g726_decode(G726Context* c, int I)
{
int dq, re_signal, pk0, fa1, i, tr, ylint, ylfrac, thr2, al, dq0;
Float11 f;
int I_sig= I >> (c->code_size - 1);
dq = inverse_quant(c, I);
ylint = (c->yl >> 15);
ylfrac = (c->yl >> 10) & 0x1f;
thr2 = (ylint > 9) ? 0x1f << 10 : (0x20 + ylfrac) << ylint;
tr= (c->td == 1 && dq > ((3*thr2)>>2));
if (I_sig)
dq = -dq;
re_signal = (int16_t)(c->se + dq);
pk0 = (c->sez + dq) ? sgn(c->sez + dq) : 0;
dq0 = dq ? sgn(dq) : 0;
if (tr) {
c->a[0] = 0;
c->a[1] = 0;
for (i=0; i<6; i++)
c->b[i] = 0;
} else {
fa1 = av_clip_intp2((-c->a[0]*c->pk[0]*pk0)>>5, 8);
c->a[1] += 128*pk0*c->pk[1] + fa1 - (c->a[1]>>7);
c->a[1] = av_clip(c->a[1], -12288, 12288);
c->a[0] += 64*3*pk0*c->pk[0] - (c->a[0] >> 8);
c->a[0] = av_clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]);
for (i=0; i<6; i++)
c->b[i] += 128*dq0*sgn(-c->dq[i].sign) - (c->b[i]>>8);
}
c->pk[1] = c->pk[0];
c->pk[0] = pk0 ? pk0 : 1;
c->sr[1] = c->sr[0];
i2f(re_signal, &c->sr[0]);
for (i=5; i>0; i--)
c->dq[i] = c->dq[i-1];
i2f(dq, &c->dq[0]);
c->dq[0].sign = I_sig;
c->td = c->a[1] < -11776;
c->dms += (c->tbls.F[I]<<4) + ((- c->dms) >> 5);
c->dml += (c->tbls.F[I]<<4) + ((- c->dml) >> 7);
if (tr)
c->ap = 256;
else {
c->ap += (-c->ap) >> 4;
if (c->y <= 1535 || c->td || abs((c->dms << 2) - c->dml) >= (c->dml >> 3))
c->ap += 0x20;
}
c->yu = av_clip(c->y + c->tbls.W[I] + ((-c->y)>>5), 544, 5120);
c->yl += c->yu + ((-c->yl)>>6);
al = (c->ap >= 256) ? 1<<6 : c->ap >> 2;
c->y = (c->yl + (c->yu - (c->yl>>6))*al) >> 6;
c->se = 0;
for (i=0; i<6; i++)
c->se += mult(i2f(c->b[i] >> 2, &f), &c->dq[i]);
c->sez = c->se >> 1;
for (i=0; i<2; i++)
c->se += mult(i2f(c->a[i] >> 2, &f), &c->sr[i]);
c->se >>= 1;
return av_clip(re_signal << 2, -0xffff, 0xffff);
}
|
{
"code": [
" return av_clip(re_signal << 2, -0xffff, 0xffff);"
],
"line_no": [
159
]
}
|
static int16_t FUNC_0(G726Context* c, int I)
{
int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;
Float11 f;
int VAR_11= I >> (c->code_size - 1);
VAR_0 = inverse_quant(c, I);
VAR_6 = (c->yl >> 15);
VAR_7 = (c->yl >> 10) & 0x1f;
VAR_8 = (VAR_6 > 9) ? 0x1f << 10 : (0x20 + VAR_7) << VAR_6;
VAR_5= (c->td == 1 && VAR_0 > ((3*VAR_8)>>2));
if (VAR_11)
VAR_0 = -VAR_0;
VAR_1 = (int16_t)(c->se + VAR_0);
VAR_2 = (c->sez + VAR_0) ? sgn(c->sez + VAR_0) : 0;
VAR_10 = VAR_0 ? sgn(VAR_0) : 0;
if (VAR_5) {
c->a[0] = 0;
c->a[1] = 0;
for (VAR_4=0; VAR_4<6; VAR_4++)
c->b[VAR_4] = 0;
} else {
VAR_3 = av_clip_intp2((-c->a[0]*c->pk[0]*VAR_2)>>5, 8);
c->a[1] += 128*VAR_2*c->pk[1] + VAR_3 - (c->a[1]>>7);
c->a[1] = av_clip(c->a[1], -12288, 12288);
c->a[0] += 64*3*VAR_2*c->pk[0] - (c->a[0] >> 8);
c->a[0] = av_clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]);
for (VAR_4=0; VAR_4<6; VAR_4++)
c->b[VAR_4] += 128*VAR_10*sgn(-c->VAR_0[VAR_4].sign) - (c->b[VAR_4]>>8);
}
c->pk[1] = c->pk[0];
c->pk[0] = VAR_2 ? VAR_2 : 1;
c->sr[1] = c->sr[0];
i2f(VAR_1, &c->sr[0]);
for (VAR_4=5; VAR_4>0; VAR_4--)
c->VAR_0[VAR_4] = c->VAR_0[VAR_4-1];
i2f(VAR_0, &c->VAR_0[0]);
c->VAR_0[0].sign = VAR_11;
c->td = c->a[1] < -11776;
c->dms += (c->tbls.F[I]<<4) + ((- c->dms) >> 5);
c->dml += (c->tbls.F[I]<<4) + ((- c->dml) >> 7);
if (VAR_5)
c->ap = 256;
else {
c->ap += (-c->ap) >> 4;
if (c->y <= 1535 || c->td || abs((c->dms << 2) - c->dml) >= (c->dml >> 3))
c->ap += 0x20;
}
c->yu = av_clip(c->y + c->tbls.W[I] + ((-c->y)>>5), 544, 5120);
c->yl += c->yu + ((-c->yl)>>6);
VAR_9 = (c->ap >= 256) ? 1<<6 : c->ap >> 2;
c->y = (c->yl + (c->yu - (c->yl>>6))*VAR_9) >> 6;
c->se = 0;
for (VAR_4=0; VAR_4<6; VAR_4++)
c->se += mult(i2f(c->b[VAR_4] >> 2, &f), &c->VAR_0[VAR_4]);
c->sez = c->se >> 1;
for (VAR_4=0; VAR_4<2; VAR_4++)
c->se += mult(i2f(c->a[VAR_4] >> 2, &f), &c->sr[VAR_4]);
c->se >>= 1;
return av_clip(VAR_1 << 2, -0xffff, 0xffff);
}
|
[
"static int16_t FUNC_0(G726Context* c, int I)\n{",
"int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;",
"Float11 f;",
"int VAR_11= I >> (c->code_size - 1);",
"VAR_0 = inverse_quant(c, I);",
"VAR_6 = (c->yl >> 15);",
"VAR_7 = (c->yl >> 10) & 0x1f;",
"VAR_8 = (VAR_6 > 9) ? 0x1f << 10 : (0x20 + VAR_7) << VAR_6;",
"VAR_5= (c->td == 1 && VAR_0 > ((3*VAR_8)>>2));",
"if (VAR_11)\nVAR_0 = -VAR_0;",
"VAR_1 = (int16_t)(c->se + VAR_0);",
"VAR_2 = (c->sez + VAR_0) ? sgn(c->sez + VAR_0) : 0;",
"VAR_10 = VAR_0 ? sgn(VAR_0) : 0;",
"if (VAR_5) {",
"c->a[0] = 0;",
"c->a[1] = 0;",
"for (VAR_4=0; VAR_4<6; VAR_4++)",
"c->b[VAR_4] = 0;",
"} else {",
"VAR_3 = av_clip_intp2((-c->a[0]*c->pk[0]*VAR_2)>>5, 8);",
"c->a[1] += 128*VAR_2*c->pk[1] + VAR_3 - (c->a[1]>>7);",
"c->a[1] = av_clip(c->a[1], -12288, 12288);",
"c->a[0] += 64*3*VAR_2*c->pk[0] - (c->a[0] >> 8);",
"c->a[0] = av_clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]);",
"for (VAR_4=0; VAR_4<6; VAR_4++)",
"c->b[VAR_4] += 128*VAR_10*sgn(-c->VAR_0[VAR_4].sign) - (c->b[VAR_4]>>8);",
"}",
"c->pk[1] = c->pk[0];",
"c->pk[0] = VAR_2 ? VAR_2 : 1;",
"c->sr[1] = c->sr[0];",
"i2f(VAR_1, &c->sr[0]);",
"for (VAR_4=5; VAR_4>0; VAR_4--)",
"c->VAR_0[VAR_4] = c->VAR_0[VAR_4-1];",
"i2f(VAR_0, &c->VAR_0[0]);",
"c->VAR_0[0].sign = VAR_11;",
"c->td = c->a[1] < -11776;",
"c->dms += (c->tbls.F[I]<<4) + ((- c->dms) >> 5);",
"c->dml += (c->tbls.F[I]<<4) + ((- c->dml) >> 7);",
"if (VAR_5)\nc->ap = 256;",
"else {",
"c->ap += (-c->ap) >> 4;",
"if (c->y <= 1535 || c->td || abs((c->dms << 2) - c->dml) >= (c->dml >> 3))\nc->ap += 0x20;",
"}",
"c->yu = av_clip(c->y + c->tbls.W[I] + ((-c->y)>>5), 544, 5120);",
"c->yl += c->yu + ((-c->yl)>>6);",
"VAR_9 = (c->ap >= 256) ? 1<<6 : c->ap >> 2;",
"c->y = (c->yl + (c->yu - (c->yl>>6))*VAR_9) >> 6;",
"c->se = 0;",
"for (VAR_4=0; VAR_4<6; VAR_4++)",
"c->se += mult(i2f(c->b[VAR_4] >> 2, &f), &c->VAR_0[VAR_4]);",
"c->sez = c->se >> 1;",
"for (VAR_4=0; VAR_4<2; VAR_4++)",
"c->se += mult(i2f(c->a[VAR_4] >> 2, &f), &c->sr[VAR_4]);",
"c->se >>= 1;",
"return av_clip(VAR_1 << 2, -0xffff, 0xffff);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29,
31
],
[
33
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73
],
[
75
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
99
],
[
105
],
[
107
],
[
109,
111
],
[
113
],
[
115
],
[
117,
119
],
[
121
],
[
127
],
[
129
],
[
135
],
[
137
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
159
],
[
161
]
] |
17,444
|
void pl050_init(uint32_t base, qemu_irq irq, int is_mouse)
{
int iomemtype;
pl050_state *s;
s = (pl050_state *)qemu_mallocz(sizeof(pl050_state));
iomemtype = cpu_register_io_memory(0, pl050_readfn,
pl050_writefn, s);
cpu_register_physical_memory(base, 0x00000fff, iomemtype);
s->base = base;
s->irq = irq;
s->is_mouse = is_mouse;
if (is_mouse)
s->dev = ps2_mouse_init(pl050_update, s);
else
s->dev = ps2_kbd_init(pl050_update, s);
/* ??? Save/restore. */
}
| true
|
qemu
|
187337f8b0ec0813dd3876d1efe37d415fb81c2e
|
void pl050_init(uint32_t base, qemu_irq irq, int is_mouse)
{
int iomemtype;
pl050_state *s;
s = (pl050_state *)qemu_mallocz(sizeof(pl050_state));
iomemtype = cpu_register_io_memory(0, pl050_readfn,
pl050_writefn, s);
cpu_register_physical_memory(base, 0x00000fff, iomemtype);
s->base = base;
s->irq = irq;
s->is_mouse = is_mouse;
if (is_mouse)
s->dev = ps2_mouse_init(pl050_update, s);
else
s->dev = ps2_kbd_init(pl050_update, s);
}
|
{
"code": [
" cpu_register_physical_memory(base, 0x00000fff, iomemtype);",
" cpu_register_physical_memory(base, 0x00000fff, iomemtype);",
" cpu_register_physical_memory(base, 0x00000fff, iomemtype);",
" cpu_register_physical_memory(base, 0x00000fff, iomemtype);",
" cpu_register_physical_memory(base, 0x00000fff, iomemtype);",
" cpu_register_physical_memory(base, 0x00000fff, iomemtype);",
" cpu_register_physical_memory(base, 0x00000fff, iomemtype);",
" cpu_register_physical_memory(base, 0x00000fff, iomemtype);",
" cpu_register_physical_memory(base, 0x00000fff, iomemtype);",
" cpu_register_physical_memory(base, 0x00000fff, iomemtype);",
" cpu_register_physical_memory(base, 0x00000fff, iomemtype);",
" cpu_register_physical_memory(base, 0x00000fff, iomemtype);"
],
"line_no": [
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17
]
}
|
void FUNC_0(uint32_t VAR_0, qemu_irq VAR_1, int VAR_2)
{
int VAR_3;
pl050_state *s;
s = (pl050_state *)qemu_mallocz(sizeof(pl050_state));
VAR_3 = cpu_register_io_memory(0, pl050_readfn,
pl050_writefn, s);
cpu_register_physical_memory(VAR_0, 0x00000fff, VAR_3);
s->VAR_0 = VAR_0;
s->VAR_1 = VAR_1;
s->VAR_2 = VAR_2;
if (VAR_2)
s->dev = ps2_mouse_init(pl050_update, s);
else
s->dev = ps2_kbd_init(pl050_update, s);
}
|
[
"void FUNC_0(uint32_t VAR_0, qemu_irq VAR_1, int VAR_2)\n{",
"int VAR_3;",
"pl050_state *s;",
"s = (pl050_state *)qemu_mallocz(sizeof(pl050_state));",
"VAR_3 = cpu_register_io_memory(0, pl050_readfn,\npl050_writefn, s);",
"cpu_register_physical_memory(VAR_0, 0x00000fff, VAR_3);",
"s->VAR_0 = VAR_0;",
"s->VAR_1 = VAR_1;",
"s->VAR_2 = VAR_2;",
"if (VAR_2)\ns->dev = ps2_mouse_init(pl050_update, s);",
"else\ns->dev = ps2_kbd_init(pl050_update, s);",
"}"
] |
[
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13,
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25,
27
],
[
29,
31
],
[
35
]
] |
17,445
|
static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
{
MatroskaCluster cluster = { 0 };
EbmlList *blocks_list;
MatroskaBlock *blocks;
int i, res;
int64_t pos = url_ftell(matroska->ctx->pb);
matroska->prev_pkt = NULL;
if (matroska->has_cluster_id){
/* For the first cluster we parse, its ID was already read as
part of matroska_read_header(), so don't read it again */
res = ebml_parse_id(matroska, matroska_clusters,
MATROSKA_ID_CLUSTER, &cluster);
pos -= 4; /* sizeof the ID which was already read */
matroska->has_cluster_id = 0;
} else
res = ebml_parse(matroska, matroska_clusters, &cluster);
blocks_list = &cluster.blocks;
blocks = blocks_list->elem;
for (i=0; i<blocks_list->nb_elem; i++)
if (blocks[i].bin.size > 0) {
int is_keyframe = blocks[i].non_simple ? !blocks[i].reference : -1;
res=matroska_parse_block(matroska,
blocks[i].bin.data, blocks[i].bin.size,
blocks[i].bin.pos, cluster.timecode,
blocks[i].duration, is_keyframe,
pos);
}
ebml_free(matroska_cluster, &cluster);
if (res < 0) matroska->done = 1;
return res;
}
| true
|
FFmpeg
|
37dd235658bc797667ec842abaed19169a36e6e5
|
static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
{
MatroskaCluster cluster = { 0 };
EbmlList *blocks_list;
MatroskaBlock *blocks;
int i, res;
int64_t pos = url_ftell(matroska->ctx->pb);
matroska->prev_pkt = NULL;
if (matroska->has_cluster_id){
res = ebml_parse_id(matroska, matroska_clusters,
MATROSKA_ID_CLUSTER, &cluster);
pos -= 4;
matroska->has_cluster_id = 0;
} else
res = ebml_parse(matroska, matroska_clusters, &cluster);
blocks_list = &cluster.blocks;
blocks = blocks_list->elem;
for (i=0; i<blocks_list->nb_elem; i++)
if (blocks[i].bin.size > 0) {
int is_keyframe = blocks[i].non_simple ? !blocks[i].reference : -1;
res=matroska_parse_block(matroska,
blocks[i].bin.data, blocks[i].bin.size,
blocks[i].bin.pos, cluster.timecode,
blocks[i].duration, is_keyframe,
pos);
}
ebml_free(matroska_cluster, &cluster);
if (res < 0) matroska->done = 1;
return res;
}
|
{
"code": [
" if (blocks[i].bin.size > 0) {"
],
"line_no": [
41
]
}
|
static int FUNC_0(MatroskaDemuxContext *VAR_0)
{
MatroskaCluster cluster = { 0 };
EbmlList *blocks_list;
MatroskaBlock *blocks;
int VAR_1, VAR_2;
int64_t pos = url_ftell(VAR_0->ctx->pb);
VAR_0->prev_pkt = NULL;
if (VAR_0->has_cluster_id){
VAR_2 = ebml_parse_id(VAR_0, matroska_clusters,
MATROSKA_ID_CLUSTER, &cluster);
pos -= 4;
VAR_0->has_cluster_id = 0;
} else
VAR_2 = ebml_parse(VAR_0, matroska_clusters, &cluster);
blocks_list = &cluster.blocks;
blocks = blocks_list->elem;
for (VAR_1=0; VAR_1<blocks_list->nb_elem; VAR_1++)
if (blocks[VAR_1].bin.size > 0) {
int is_keyframe = blocks[VAR_1].non_simple ? !blocks[VAR_1].reference : -1;
VAR_2=matroska_parse_block(VAR_0,
blocks[VAR_1].bin.data, blocks[VAR_1].bin.size,
blocks[VAR_1].bin.pos, cluster.timecode,
blocks[VAR_1].duration, is_keyframe,
pos);
}
ebml_free(matroska_cluster, &cluster);
if (VAR_2 < 0) VAR_0->done = 1;
return VAR_2;
}
|
[
"static int FUNC_0(MatroskaDemuxContext *VAR_0)\n{",
"MatroskaCluster cluster = { 0 };",
"EbmlList *blocks_list;",
"MatroskaBlock *blocks;",
"int VAR_1, VAR_2;",
"int64_t pos = url_ftell(VAR_0->ctx->pb);",
"VAR_0->prev_pkt = NULL;",
"if (VAR_0->has_cluster_id){",
"VAR_2 = ebml_parse_id(VAR_0, matroska_clusters,\nMATROSKA_ID_CLUSTER, &cluster);",
"pos -= 4;",
"VAR_0->has_cluster_id = 0;",
"} else",
"VAR_2 = ebml_parse(VAR_0, matroska_clusters, &cluster);",
"blocks_list = &cluster.blocks;",
"blocks = blocks_list->elem;",
"for (VAR_1=0; VAR_1<blocks_list->nb_elem; VAR_1++)",
"if (blocks[VAR_1].bin.size > 0) {",
"int is_keyframe = blocks[VAR_1].non_simple ? !blocks[VAR_1].reference : -1;",
"VAR_2=matroska_parse_block(VAR_0,\nblocks[VAR_1].bin.data, blocks[VAR_1].bin.size,\nblocks[VAR_1].bin.pos, cluster.timecode,\nblocks[VAR_1].duration, is_keyframe,\npos);",
"}",
"ebml_free(matroska_cluster, &cluster);",
"if (VAR_2 < 0) VAR_0->done = 1;",
"return VAR_2;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
23,
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45,
47,
49,
51,
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
]
] |
17,446
|
static av_cold void init_mdct_win(TwinContext *tctx)
{
int i,j;
const ModeTab *mtab = tctx->mtab;
int size_s = mtab->size / mtab->fmode[FT_SHORT].sub;
int size_m = mtab->size / mtab->fmode[FT_MEDIUM].sub;
int channels = tctx->avctx->channels;
float norm = channels == 1 ? 2. : 1.;
for (i = 0; i < 3; i++) {
int bsize = tctx->mtab->size/tctx->mtab->fmode[i].sub;
ff_mdct_init(&tctx->mdct_ctx[i], av_log2(bsize) + 1, 1,
-sqrt(norm/bsize) / (1<<15));
}
tctx->tmp_buf = av_malloc(mtab->size * sizeof(*tctx->tmp_buf));
tctx->spectrum = av_malloc(2*mtab->size*channels*sizeof(float));
tctx->curr_frame = av_malloc(2*mtab->size*channels*sizeof(float));
tctx->prev_frame = av_malloc(2*mtab->size*channels*sizeof(float));
for (i = 0; i < 3; i++) {
int m = 4*mtab->size/mtab->fmode[i].sub;
double freq = 2*M_PI/m;
tctx->cos_tabs[i] = av_malloc((m/4)*sizeof(*tctx->cos_tabs));
for (j = 0; j <= m/8; j++)
tctx->cos_tabs[i][j] = cos((2*j + 1)*freq);
for (j = 1; j < m/8; j++)
tctx->cos_tabs[i][m/4-j] = tctx->cos_tabs[i][j];
}
ff_init_ff_sine_windows(av_log2(size_m));
ff_init_ff_sine_windows(av_log2(size_s/2));
ff_init_ff_sine_windows(av_log2(mtab->size));
}
| true
|
FFmpeg
|
a8a6da4a0e059b2aab66627a96b63c3632c477c2
|
static av_cold void init_mdct_win(TwinContext *tctx)
{
int i,j;
const ModeTab *mtab = tctx->mtab;
int size_s = mtab->size / mtab->fmode[FT_SHORT].sub;
int size_m = mtab->size / mtab->fmode[FT_MEDIUM].sub;
int channels = tctx->avctx->channels;
float norm = channels == 1 ? 2. : 1.;
for (i = 0; i < 3; i++) {
int bsize = tctx->mtab->size/tctx->mtab->fmode[i].sub;
ff_mdct_init(&tctx->mdct_ctx[i], av_log2(bsize) + 1, 1,
-sqrt(norm/bsize) / (1<<15));
}
tctx->tmp_buf = av_malloc(mtab->size * sizeof(*tctx->tmp_buf));
tctx->spectrum = av_malloc(2*mtab->size*channels*sizeof(float));
tctx->curr_frame = av_malloc(2*mtab->size*channels*sizeof(float));
tctx->prev_frame = av_malloc(2*mtab->size*channels*sizeof(float));
for (i = 0; i < 3; i++) {
int m = 4*mtab->size/mtab->fmode[i].sub;
double freq = 2*M_PI/m;
tctx->cos_tabs[i] = av_malloc((m/4)*sizeof(*tctx->cos_tabs));
for (j = 0; j <= m/8; j++)
tctx->cos_tabs[i][j] = cos((2*j + 1)*freq);
for (j = 1; j < m/8; j++)
tctx->cos_tabs[i][m/4-j] = tctx->cos_tabs[i][j];
}
ff_init_ff_sine_windows(av_log2(size_m));
ff_init_ff_sine_windows(av_log2(size_s/2));
ff_init_ff_sine_windows(av_log2(mtab->size));
}
|
{
"code": [
"static av_cold void init_mdct_win(TwinContext *tctx)",
" int i,j;",
" ff_mdct_init(&tctx->mdct_ctx[i], av_log2(bsize) + 1, 1,",
" -sqrt(norm/bsize) / (1<<15));",
" tctx->tmp_buf = av_malloc(mtab->size * sizeof(*tctx->tmp_buf));",
" tctx->spectrum = av_malloc(2*mtab->size*channels*sizeof(float));",
" tctx->curr_frame = av_malloc(2*mtab->size*channels*sizeof(float));",
" tctx->prev_frame = av_malloc(2*mtab->size*channels*sizeof(float));",
" tctx->cos_tabs[i] = av_malloc((m/4)*sizeof(*tctx->cos_tabs));",
" for (i = 0; i < 3; i++) {"
],
"line_no": [
1,
5,
23,
25,
31,
35,
37,
39,
49,
19
]
}
|
static av_cold void FUNC_0(TwinContext *tctx)
{
int VAR_0,VAR_1;
const ModeTab *VAR_2 = tctx->VAR_2;
int VAR_3 = VAR_2->size / VAR_2->fmode[FT_SHORT].sub;
int VAR_4 = VAR_2->size / VAR_2->fmode[FT_MEDIUM].sub;
int VAR_5 = tctx->avctx->VAR_5;
float VAR_6 = VAR_5 == 1 ? 2. : 1.;
for (VAR_0 = 0; VAR_0 < 3; VAR_0++) {
int VAR_7 = tctx->VAR_2->size/tctx->VAR_2->fmode[VAR_0].sub;
ff_mdct_init(&tctx->mdct_ctx[VAR_0], av_log2(VAR_7) + 1, 1,
-sqrt(VAR_6/VAR_7) / (1<<15));
}
tctx->tmp_buf = av_malloc(VAR_2->size * sizeof(*tctx->tmp_buf));
tctx->spectrum = av_malloc(2*VAR_2->size*VAR_5*sizeof(float));
tctx->curr_frame = av_malloc(2*VAR_2->size*VAR_5*sizeof(float));
tctx->prev_frame = av_malloc(2*VAR_2->size*VAR_5*sizeof(float));
for (VAR_0 = 0; VAR_0 < 3; VAR_0++) {
int VAR_8 = 4*VAR_2->size/VAR_2->fmode[VAR_0].sub;
double VAR_9 = 2*M_PI/VAR_8;
tctx->cos_tabs[VAR_0] = av_malloc((VAR_8/4)*sizeof(*tctx->cos_tabs));
for (VAR_1 = 0; VAR_1 <= VAR_8/8; VAR_1++)
tctx->cos_tabs[VAR_0][VAR_1] = cos((2*VAR_1 + 1)*VAR_9);
for (VAR_1 = 1; VAR_1 < VAR_8/8; VAR_1++)
tctx->cos_tabs[VAR_0][VAR_8/4-VAR_1] = tctx->cos_tabs[VAR_0][VAR_1];
}
ff_init_ff_sine_windows(av_log2(VAR_4));
ff_init_ff_sine_windows(av_log2(VAR_3/2));
ff_init_ff_sine_windows(av_log2(VAR_2->size));
}
|
[
"static av_cold void FUNC_0(TwinContext *tctx)\n{",
"int VAR_0,VAR_1;",
"const ModeTab *VAR_2 = tctx->VAR_2;",
"int VAR_3 = VAR_2->size / VAR_2->fmode[FT_SHORT].sub;",
"int VAR_4 = VAR_2->size / VAR_2->fmode[FT_MEDIUM].sub;",
"int VAR_5 = tctx->avctx->VAR_5;",
"float VAR_6 = VAR_5 == 1 ? 2. : 1.;",
"for (VAR_0 = 0; VAR_0 < 3; VAR_0++) {",
"int VAR_7 = tctx->VAR_2->size/tctx->VAR_2->fmode[VAR_0].sub;",
"ff_mdct_init(&tctx->mdct_ctx[VAR_0], av_log2(VAR_7) + 1, 1,\n-sqrt(VAR_6/VAR_7) / (1<<15));",
"}",
"tctx->tmp_buf = av_malloc(VAR_2->size * sizeof(*tctx->tmp_buf));",
"tctx->spectrum = av_malloc(2*VAR_2->size*VAR_5*sizeof(float));",
"tctx->curr_frame = av_malloc(2*VAR_2->size*VAR_5*sizeof(float));",
"tctx->prev_frame = av_malloc(2*VAR_2->size*VAR_5*sizeof(float));",
"for (VAR_0 = 0; VAR_0 < 3; VAR_0++) {",
"int VAR_8 = 4*VAR_2->size/VAR_2->fmode[VAR_0].sub;",
"double VAR_9 = 2*M_PI/VAR_8;",
"tctx->cos_tabs[VAR_0] = av_malloc((VAR_8/4)*sizeof(*tctx->cos_tabs));",
"for (VAR_1 = 0; VAR_1 <= VAR_8/8; VAR_1++)",
"tctx->cos_tabs[VAR_0][VAR_1] = cos((2*VAR_1 + 1)*VAR_9);",
"for (VAR_1 = 1; VAR_1 < VAR_8/8; VAR_1++)",
"tctx->cos_tabs[VAR_0][VAR_8/4-VAR_1] = tctx->cos_tabs[VAR_0][VAR_1];",
"}",
"ff_init_ff_sine_windows(av_log2(VAR_4));",
"ff_init_ff_sine_windows(av_log2(VAR_3/2));",
"ff_init_ff_sine_windows(av_log2(VAR_2->size));",
"}"
] |
[
1,
1,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
1,
1,
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23,
25
],
[
27
],
[
31
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
67
],
[
69
],
[
71
],
[
73
]
] |
17,450
|
static MemTxResult memory_region_oldmmio_write_accessor(MemoryRegion *mr,
hwaddr addr,
uint64_t *value,
unsigned size,
unsigned shift,
uint64_t mask,
MemTxAttrs attrs)
{
uint64_t tmp;
tmp = (*value >> shift) & mask;
if (mr->subpage) {
trace_memory_region_subpage_write(get_cpu_index(), mr, addr, tmp, size);
} else if (TRACE_MEMORY_REGION_OPS_WRITE_ENABLED) {
hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr);
trace_memory_region_ops_write(get_cpu_index(), mr, abs_addr, tmp, size);
}
mr->ops->old_mmio.write[ctz32(size)](mr->opaque, addr, tmp);
return MEMTX_OK;
}
| true
|
qemu
|
f2d089425d43735b5369f70f3a36b712440578e5
|
static MemTxResult memory_region_oldmmio_write_accessor(MemoryRegion *mr,
hwaddr addr,
uint64_t *value,
unsigned size,
unsigned shift,
uint64_t mask,
MemTxAttrs attrs)
{
uint64_t tmp;
tmp = (*value >> shift) & mask;
if (mr->subpage) {
trace_memory_region_subpage_write(get_cpu_index(), mr, addr, tmp, size);
} else if (TRACE_MEMORY_REGION_OPS_WRITE_ENABLED) {
hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr);
trace_memory_region_ops_write(get_cpu_index(), mr, abs_addr, tmp, size);
}
mr->ops->old_mmio.write[ctz32(size)](mr->opaque, addr, tmp);
return MEMTX_OK;
}
|
{
"code": [],
"line_no": []
}
|
static MemTxResult FUNC_0(MemoryRegion *mr,
hwaddr addr,
uint64_t *value,
unsigned size,
unsigned shift,
uint64_t mask,
MemTxAttrs attrs)
{
uint64_t tmp;
tmp = (*value >> shift) & mask;
if (mr->subpage) {
trace_memory_region_subpage_write(get_cpu_index(), mr, addr, tmp, size);
} else if (TRACE_MEMORY_REGION_OPS_WRITE_ENABLED) {
hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr);
trace_memory_region_ops_write(get_cpu_index(), mr, abs_addr, tmp, size);
}
mr->ops->old_mmio.write[ctz32(size)](mr->opaque, addr, tmp);
return MEMTX_OK;
}
|
[
"static MemTxResult FUNC_0(MemoryRegion *mr,\nhwaddr addr,\nuint64_t *value,\nunsigned size,\nunsigned shift,\nuint64_t mask,\nMemTxAttrs attrs)\n{",
"uint64_t tmp;",
"tmp = (*value >> shift) & mask;",
"if (mr->subpage) {",
"trace_memory_region_subpage_write(get_cpu_index(), mr, addr, tmp, size);",
"} else if (TRACE_MEMORY_REGION_OPS_WRITE_ENABLED) {",
"hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr);",
"trace_memory_region_ops_write(get_cpu_index(), mr, abs_addr, tmp, size);",
"}",
"mr->ops->old_mmio.write[ctz32(size)](mr->opaque, addr, tmp);",
"return MEMTX_OK;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3,
5,
7,
9,
11,
13,
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
32
],
[
34
],
[
36
],
[
38
],
[
40
],
[
42
],
[
44
]
] |
17,451
|
static av_cold int aacPlus_encode_init(AVCodecContext *avctx)
{
aacPlusAudioContext *s = avctx->priv_data;
aacplusEncConfiguration *aacplus_cfg;
/* number of channels */
if (avctx->channels < 1 || avctx->channels > 2) {
av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed\n", avctx->channels);
return -1;
}
s->aacplus_handle = aacplusEncOpen(avctx->sample_rate, avctx->channels,
&s->samples_input, &s->max_output_bytes);
if(!s->aacplus_handle) {
av_log(avctx, AV_LOG_ERROR, "can't open encoder\n");
return -1;
}
/* check aacplus version */
aacplus_cfg = aacplusEncGetCurrentConfiguration(s->aacplus_handle);
/* put the options in the configuration struct */
if(avctx->profile != FF_PROFILE_AAC_LOW && avctx->profile != FF_PROFILE_UNKNOWN) {
av_log(avctx, AV_LOG_ERROR, "invalid AAC profile: %d, only LC supported\n", avctx->profile);
aacplusEncClose(s->aacplus_handle);
return -1;
}
aacplus_cfg->bitRate = avctx->bit_rate;
aacplus_cfg->bandWidth = avctx->cutoff;
aacplus_cfg->outputFormat = !(avctx->flags & CODEC_FLAG_GLOBAL_HEADER);
aacplus_cfg->inputFormat = avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? AACPLUS_INPUT_FLOAT : AACPLUS_INPUT_16BIT;
if (!aacplusEncSetConfiguration(s->aacplus_handle, aacplus_cfg)) {
av_log(avctx, AV_LOG_ERROR, "libaacplus doesn't support this output format!\n");
return -1;
}
avctx->frame_size = s->samples_input / avctx->channels;
/* Set decoder specific info */
avctx->extradata_size = 0;
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
unsigned char *buffer = NULL;
unsigned long decoder_specific_info_size;
if (aacplusEncGetDecoderSpecificInfo(s->aacplus_handle, &buffer,
&decoder_specific_info_size) == 1) {
avctx->extradata = av_malloc(decoder_specific_info_size + FF_INPUT_BUFFER_PADDING_SIZE);
avctx->extradata_size = decoder_specific_info_size;
memcpy(avctx->extradata, buffer, avctx->extradata_size);
}
free(buffer);
}
return 0;
}
| false
|
FFmpeg
|
963c58006f9ef2dc71f5f4b564e6d34892287c5e
|
static av_cold int aacPlus_encode_init(AVCodecContext *avctx)
{
aacPlusAudioContext *s = avctx->priv_data;
aacplusEncConfiguration *aacplus_cfg;
if (avctx->channels < 1 || avctx->channels > 2) {
av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed\n", avctx->channels);
return -1;
}
s->aacplus_handle = aacplusEncOpen(avctx->sample_rate, avctx->channels,
&s->samples_input, &s->max_output_bytes);
if(!s->aacplus_handle) {
av_log(avctx, AV_LOG_ERROR, "can't open encoder\n");
return -1;
}
aacplus_cfg = aacplusEncGetCurrentConfiguration(s->aacplus_handle);
if(avctx->profile != FF_PROFILE_AAC_LOW && avctx->profile != FF_PROFILE_UNKNOWN) {
av_log(avctx, AV_LOG_ERROR, "invalid AAC profile: %d, only LC supported\n", avctx->profile);
aacplusEncClose(s->aacplus_handle);
return -1;
}
aacplus_cfg->bitRate = avctx->bit_rate;
aacplus_cfg->bandWidth = avctx->cutoff;
aacplus_cfg->outputFormat = !(avctx->flags & CODEC_FLAG_GLOBAL_HEADER);
aacplus_cfg->inputFormat = avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? AACPLUS_INPUT_FLOAT : AACPLUS_INPUT_16BIT;
if (!aacplusEncSetConfiguration(s->aacplus_handle, aacplus_cfg)) {
av_log(avctx, AV_LOG_ERROR, "libaacplus doesn't support this output format!\n");
return -1;
}
avctx->frame_size = s->samples_input / avctx->channels;
avctx->extradata_size = 0;
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
unsigned char *buffer = NULL;
unsigned long decoder_specific_info_size;
if (aacplusEncGetDecoderSpecificInfo(s->aacplus_handle, &buffer,
&decoder_specific_info_size) == 1) {
avctx->extradata = av_malloc(decoder_specific_info_size + FF_INPUT_BUFFER_PADDING_SIZE);
avctx->extradata_size = decoder_specific_info_size;
memcpy(avctx->extradata, buffer, avctx->extradata_size);
}
free(buffer);
}
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static av_cold int FUNC_0(AVCodecContext *avctx)
{
aacPlusAudioContext *s = avctx->priv_data;
aacplusEncConfiguration *aacplus_cfg;
if (avctx->channels < 1 || avctx->channels > 2) {
av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed\n", avctx->channels);
return -1;
}
s->aacplus_handle = aacplusEncOpen(avctx->sample_rate, avctx->channels,
&s->samples_input, &s->max_output_bytes);
if(!s->aacplus_handle) {
av_log(avctx, AV_LOG_ERROR, "can't open encoder\n");
return -1;
}
aacplus_cfg = aacplusEncGetCurrentConfiguration(s->aacplus_handle);
if(avctx->profile != FF_PROFILE_AAC_LOW && avctx->profile != FF_PROFILE_UNKNOWN) {
av_log(avctx, AV_LOG_ERROR, "invalid AAC profile: %d, only LC supported\n", avctx->profile);
aacplusEncClose(s->aacplus_handle);
return -1;
}
aacplus_cfg->bitRate = avctx->bit_rate;
aacplus_cfg->bandWidth = avctx->cutoff;
aacplus_cfg->outputFormat = !(avctx->flags & CODEC_FLAG_GLOBAL_HEADER);
aacplus_cfg->inputFormat = avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? AACPLUS_INPUT_FLOAT : AACPLUS_INPUT_16BIT;
if (!aacplusEncSetConfiguration(s->aacplus_handle, aacplus_cfg)) {
av_log(avctx, AV_LOG_ERROR, "libaacplus doesn't support this output format!\n");
return -1;
}
avctx->frame_size = s->samples_input / avctx->channels;
avctx->extradata_size = 0;
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
unsigned char *VAR_0 = NULL;
unsigned long VAR_1;
if (aacplusEncGetDecoderSpecificInfo(s->aacplus_handle, &VAR_0,
&VAR_1) == 1) {
avctx->extradata = av_malloc(VAR_1 + FF_INPUT_BUFFER_PADDING_SIZE);
avctx->extradata_size = VAR_1;
memcpy(avctx->extradata, VAR_0, avctx->extradata_size);
}
free(VAR_0);
}
return 0;
}
|
[
"static av_cold int FUNC_0(AVCodecContext *avctx)\n{",
"aacPlusAudioContext *s = avctx->priv_data;",
"aacplusEncConfiguration *aacplus_cfg;",
"if (avctx->channels < 1 || avctx->channels > 2) {",
"av_log(avctx, AV_LOG_ERROR, \"encoding %d channel(s) is not allowed\\n\", avctx->channels);",
"return -1;",
"}",
"s->aacplus_handle = aacplusEncOpen(avctx->sample_rate, avctx->channels,\n&s->samples_input, &s->max_output_bytes);",
"if(!s->aacplus_handle) {",
"av_log(avctx, AV_LOG_ERROR, \"can't open encoder\\n\");",
"return -1;",
"}",
"aacplus_cfg = aacplusEncGetCurrentConfiguration(s->aacplus_handle);",
"if(avctx->profile != FF_PROFILE_AAC_LOW && avctx->profile != FF_PROFILE_UNKNOWN) {",
"av_log(avctx, AV_LOG_ERROR, \"invalid AAC profile: %d, only LC supported\\n\", avctx->profile);",
"aacplusEncClose(s->aacplus_handle);",
"return -1;",
"}",
"aacplus_cfg->bitRate = avctx->bit_rate;",
"aacplus_cfg->bandWidth = avctx->cutoff;",
"aacplus_cfg->outputFormat = !(avctx->flags & CODEC_FLAG_GLOBAL_HEADER);",
"aacplus_cfg->inputFormat = avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? AACPLUS_INPUT_FLOAT : AACPLUS_INPUT_16BIT;",
"if (!aacplusEncSetConfiguration(s->aacplus_handle, aacplus_cfg)) {",
"av_log(avctx, AV_LOG_ERROR, \"libaacplus doesn't support this output format!\\n\");",
"return -1;",
"}",
"avctx->frame_size = s->samples_input / avctx->channels;",
"avctx->extradata_size = 0;",
"if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {",
"unsigned char *VAR_0 = NULL;",
"unsigned long VAR_1;",
"if (aacplusEncGetDecoderSpecificInfo(s->aacplus_handle, &VAR_0,\n&VAR_1) == 1) {",
"avctx->extradata = av_malloc(VAR_1 + FF_INPUT_BUFFER_PADDING_SIZE);",
"avctx->extradata_size = VAR_1;",
"memcpy(avctx->extradata, VAR_0, avctx->extradata_size);",
"}",
"free(VAR_0);",
"}",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23,
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
39
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
75
],
[
81
],
[
83
],
[
87
],
[
89
],
[
93,
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
]
] |
17,453
|
static uint64_t get_v(ByteIOContext *bc)
{
uint64_t val = 0;
for(; bytes_left(bc) > 0; )
{
int tmp = get_byte(bc);
if (tmp&0x80)
val= (val<<7) + tmp - 0x80;
else
return (val<<7) + tmp;
}
return -1;
}
| false
|
FFmpeg
|
465e1dadbef7596a3eb87089a66bb4ecdc26d3c4
|
static uint64_t get_v(ByteIOContext *bc)
{
uint64_t val = 0;
for(; bytes_left(bc) > 0; )
{
int tmp = get_byte(bc);
if (tmp&0x80)
val= (val<<7) + tmp - 0x80;
else
return (val<<7) + tmp;
}
return -1;
}
|
{
"code": [],
"line_no": []
}
|
static uint64_t FUNC_0(ByteIOContext *bc)
{
uint64_t val = 0;
for(; bytes_left(bc) > 0; )
{
int tmp = get_byte(bc);
if (tmp&0x80)
val= (val<<7) + tmp - 0x80;
else
return (val<<7) + tmp;
}
return -1;
}
|
[
"static uint64_t FUNC_0(ByteIOContext *bc)\n{",
"uint64_t val = 0;",
"for(; bytes_left(bc) > 0; )",
"{",
"int tmp = get_byte(bc);",
"if (tmp&0x80)\nval= (val<<7) + tmp - 0x80;",
"else\nreturn (val<<7) + tmp;",
"}",
"return -1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
17,
19
],
[
21,
23
],
[
25
],
[
27
],
[
29
]
] |
17,455
|
static av_cold int libgsm_close(AVCodecContext *avctx) {
gsm_destroy(avctx->priv_data);
avctx->priv_data = NULL;
return 0;
}
| true
|
FFmpeg
|
916ff02261f79e759d996c76670958276276bf2a
|
static av_cold int libgsm_close(AVCodecContext *avctx) {
gsm_destroy(avctx->priv_data);
avctx->priv_data = NULL;
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static av_cold int FUNC_0(AVCodecContext *avctx) {
gsm_destroy(avctx->priv_data);
avctx->priv_data = NULL;
return 0;
}
|
[
"static av_cold int FUNC_0(AVCodecContext *avctx) {",
"gsm_destroy(avctx->priv_data);",
"avctx->priv_data = NULL;",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0
] |
[
[
1
],
[
4
],
[
6
],
[
8
],
[
10
]
] |
17,456
|
static int mov_open_dref(ByteIOContext **pb, char *src, MOVDref *ref)
{
/* try absolute path */
if (!url_fopen(pb, ref->path, URL_RDONLY))
return 0;
/* try relative path */
if (ref->nlvl_to > 0 && ref->nlvl_from > 0) {
char filename[1024];
char *src_path;
int i, l;
/* find a source dir */
src_path = strrchr(src, '/');
if (src_path)
src_path++;
else
src_path = src;
/* find a next level down to target */
for (i = 0, l = strlen(ref->path) - 1; l >= 0; l--)
if (ref->path[l] == '/') {
if (i == ref->nlvl_to - 1)
break;
else
i++;
}
/* compose filename if next level down to target was found */
if (i == ref->nlvl_to - 1) {
memcpy(filename, src, src_path - src);
filename[src_path - src] = 0;
for (i = 1; i < ref->nlvl_from; i++)
av_strlcat(filename, "../", 1024);
av_strlcat(filename, ref->path + l + 1, 1024);
if (!url_fopen(pb, filename, URL_RDONLY))
return 0;
}
}
return AVERROR(ENOENT);
};
| true
|
FFmpeg
|
6a2459059e469fdb835ff4abcbc3bae9781116b3
|
static int mov_open_dref(ByteIOContext **pb, char *src, MOVDref *ref)
{
if (!url_fopen(pb, ref->path, URL_RDONLY))
return 0;
if (ref->nlvl_to > 0 && ref->nlvl_from > 0) {
char filename[1024];
char *src_path;
int i, l;
src_path = strrchr(src, '/');
if (src_path)
src_path++;
else
src_path = src;
for (i = 0, l = strlen(ref->path) - 1; l >= 0; l--)
if (ref->path[l] == '/') {
if (i == ref->nlvl_to - 1)
break;
else
i++;
}
if (i == ref->nlvl_to - 1) {
memcpy(filename, src, src_path - src);
filename[src_path - src] = 0;
for (i = 1; i < ref->nlvl_from; i++)
av_strlcat(filename, "../", 1024);
av_strlcat(filename, ref->path + l + 1, 1024);
if (!url_fopen(pb, filename, URL_RDONLY))
return 0;
}
}
return AVERROR(ENOENT);
};
|
{
"code": [
" if (!url_fopen(pb, ref->path, URL_RDONLY))",
" return 0;"
],
"line_no": [
7,
9
]
}
|
static int FUNC_0(ByteIOContext **VAR_0, char *VAR_1, MOVDref *VAR_2)
{
if (!url_fopen(VAR_0, VAR_2->path, URL_RDONLY))
return 0;
if (VAR_2->nlvl_to > 0 && VAR_2->nlvl_from > 0) {
char VAR_3[1024];
char *VAR_4;
int VAR_5, VAR_6;
VAR_4 = strrchr(VAR_1, '/');
if (VAR_4)
VAR_4++;
else
VAR_4 = VAR_1;
for (VAR_5 = 0, VAR_6 = strlen(VAR_2->path) - 1; VAR_6 >= 0; VAR_6--)
if (VAR_2->path[VAR_6] == '/') {
if (VAR_5 == VAR_2->nlvl_to - 1)
break;
else
VAR_5++;
}
if (VAR_5 == VAR_2->nlvl_to - 1) {
memcpy(VAR_3, VAR_1, VAR_4 - VAR_1);
VAR_3[VAR_4 - VAR_1] = 0;
for (VAR_5 = 1; VAR_5 < VAR_2->nlvl_from; VAR_5++)
av_strlcat(VAR_3, "../", 1024);
av_strlcat(VAR_3, VAR_2->path + VAR_6 + 1, 1024);
if (!url_fopen(VAR_0, VAR_3, URL_RDONLY))
return 0;
}
}
return AVERROR(ENOENT);
};
|
[
"static int FUNC_0(ByteIOContext **VAR_0, char *VAR_1, MOVDref *VAR_2)\n{",
"if (!url_fopen(VAR_0, VAR_2->path, URL_RDONLY))\nreturn 0;",
"if (VAR_2->nlvl_to > 0 && VAR_2->nlvl_from > 0) {",
"char VAR_3[1024];",
"char *VAR_4;",
"int VAR_5, VAR_6;",
"VAR_4 = strrchr(VAR_1, '/');",
"if (VAR_4)\nVAR_4++;",
"else\nVAR_4 = VAR_1;",
"for (VAR_5 = 0, VAR_6 = strlen(VAR_2->path) - 1; VAR_6 >= 0; VAR_6--)",
"if (VAR_2->path[VAR_6] == '/') {",
"if (VAR_5 == VAR_2->nlvl_to - 1)\nbreak;",
"else\nVAR_5++;",
"}",
"if (VAR_5 == VAR_2->nlvl_to - 1) {",
"memcpy(VAR_3, VAR_1, VAR_4 - VAR_1);",
"VAR_3[VAR_4 - VAR_1] = 0;",
"for (VAR_5 = 1; VAR_5 < VAR_2->nlvl_from; VAR_5++)",
"av_strlcat(VAR_3, \"../\", 1024);",
"av_strlcat(VAR_3, VAR_2->path + VAR_6 + 1, 1024);",
"if (!url_fopen(VAR_0, VAR_3, URL_RDONLY))\nreturn 0;",
"}",
"}",
"return AVERROR(ENOENT);",
"};"
] |
[
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
7,
9
],
[
15
],
[
17
],
[
19
],
[
21
],
[
27
],
[
29,
31
],
[
33,
35
],
[
41
],
[
43
],
[
45,
47
],
[
49,
51
],
[
53
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
73
],
[
77,
79
],
[
81
],
[
83
],
[
87
],
[
89
]
] |
17,459
|
FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
hwaddr ctl_addr, hwaddr data_addr)
{
DeviceState *dev;
SysBusDevice *d;
FWCfgState *s;
dev = qdev_create(NULL, TYPE_FW_CFG);
qdev_prop_set_uint32(dev, "ctl_iobase", ctl_port);
qdev_prop_set_uint32(dev, "data_iobase", data_port);
d = SYS_BUS_DEVICE(dev);
s = FW_CFG(dev);
assert(!object_resolve_path(FW_CFG_PATH, NULL));
object_property_add_child(qdev_get_machine(), FW_CFG_NAME, OBJECT(s), NULL);
qdev_init_nofail(dev);
if (ctl_addr) {
sysbus_mmio_map(d, 0, ctl_addr);
}
if (data_addr) {
sysbus_mmio_map(d, 1, data_addr);
}
fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)"QEMU", 4);
fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);
fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC));
fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);
fw_cfg_bootsplash(s);
fw_cfg_reboot(s);
s->machine_ready.notify = fw_cfg_machine_ready;
qemu_add_machine_init_done_notifier(&s->machine_ready);
return s;
}
| true
|
qemu
|
5712db6ae5101db645f71edc393368cd59bfd314
|
FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
hwaddr ctl_addr, hwaddr data_addr)
{
DeviceState *dev;
SysBusDevice *d;
FWCfgState *s;
dev = qdev_create(NULL, TYPE_FW_CFG);
qdev_prop_set_uint32(dev, "ctl_iobase", ctl_port);
qdev_prop_set_uint32(dev, "data_iobase", data_port);
d = SYS_BUS_DEVICE(dev);
s = FW_CFG(dev);
assert(!object_resolve_path(FW_CFG_PATH, NULL));
object_property_add_child(qdev_get_machine(), FW_CFG_NAME, OBJECT(s), NULL);
qdev_init_nofail(dev);
if (ctl_addr) {
sysbus_mmio_map(d, 0, ctl_addr);
}
if (data_addr) {
sysbus_mmio_map(d, 1, data_addr);
}
fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)"QEMU", 4);
fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);
fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC));
fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);
fw_cfg_bootsplash(s);
fw_cfg_reboot(s);
s->machine_ready.notify = fw_cfg_machine_ready;
qemu_add_machine_init_done_notifier(&s->machine_ready);
return s;
}
|
{
"code": [
"FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,",
" hwaddr ctl_addr, hwaddr data_addr)",
" DeviceState *dev;",
" SysBusDevice *d;",
" FWCfgState *s;",
" dev = qdev_create(NULL, TYPE_FW_CFG);",
" qdev_prop_set_uint32(dev, \"ctl_iobase\", ctl_port);",
" qdev_prop_set_uint32(dev, \"data_iobase\", data_port);",
" d = SYS_BUS_DEVICE(dev);",
" s = FW_CFG(dev);",
" if (ctl_addr) {",
" sysbus_mmio_map(d, 0, ctl_addr);",
" if (data_addr) {",
" sysbus_mmio_map(d, 1, data_addr);",
" return s;"
],
"line_no": [
1,
3,
7,
9,
11,
15,
17,
19,
21,
25,
41,
43,
47,
49,
75
]
}
|
FWCfgState *FUNC_0(uint32_t ctl_port, uint32_t data_port,
hwaddr ctl_addr, hwaddr data_addr)
{
DeviceState *dev;
SysBusDevice *d;
FWCfgState *s;
dev = qdev_create(NULL, TYPE_FW_CFG);
qdev_prop_set_uint32(dev, "ctl_iobase", ctl_port);
qdev_prop_set_uint32(dev, "data_iobase", data_port);
d = SYS_BUS_DEVICE(dev);
s = FW_CFG(dev);
assert(!object_resolve_path(FW_CFG_PATH, NULL));
object_property_add_child(qdev_get_machine(), FW_CFG_NAME, OBJECT(s), NULL);
qdev_init_nofail(dev);
if (ctl_addr) {
sysbus_mmio_map(d, 0, ctl_addr);
}
if (data_addr) {
sysbus_mmio_map(d, 1, data_addr);
}
fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)"QEMU", 4);
fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);
fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC));
fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);
fw_cfg_bootsplash(s);
fw_cfg_reboot(s);
s->machine_ready.notify = fw_cfg_machine_ready;
qemu_add_machine_init_done_notifier(&s->machine_ready);
return s;
}
|
[
"FWCfgState *FUNC_0(uint32_t ctl_port, uint32_t data_port,\nhwaddr ctl_addr, hwaddr data_addr)\n{",
"DeviceState *dev;",
"SysBusDevice *d;",
"FWCfgState *s;",
"dev = qdev_create(NULL, TYPE_FW_CFG);",
"qdev_prop_set_uint32(dev, \"ctl_iobase\", ctl_port);",
"qdev_prop_set_uint32(dev, \"data_iobase\", data_port);",
"d = SYS_BUS_DEVICE(dev);",
"s = FW_CFG(dev);",
"assert(!object_resolve_path(FW_CFG_PATH, NULL));",
"object_property_add_child(qdev_get_machine(), FW_CFG_NAME, OBJECT(s), NULL);",
"qdev_init_nofail(dev);",
"if (ctl_addr) {",
"sysbus_mmio_map(d, 0, ctl_addr);",
"}",
"if (data_addr) {",
"sysbus_mmio_map(d, 1, data_addr);",
"}",
"fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)\"QEMU\", 4);",
"fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);",
"fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC));",
"fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);",
"fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);",
"fw_cfg_bootsplash(s);",
"fw_cfg_reboot(s);",
"s->machine_ready.notify = fw_cfg_machine_ready;",
"qemu_add_machine_init_done_notifier(&s->machine_ready);",
"return s;",
"}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
1,
1,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0
] |
[
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
29
],
[
33
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
75
],
[
77
]
] |
17,460
|
void qmp_block_passwd(bool has_device, const char *device,
bool has_node_name, const char *node_name,
const char *password, Error **errp)
{
Error *local_err = NULL;
BlockDriverState *bs;
int err;
bs = bdrv_lookup_bs(has_device ? device : NULL,
has_node_name ? node_name : NULL,
&local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
err = bdrv_set_key(bs, password);
if (err == -EINVAL) {
error_set(errp, QERR_DEVICE_NOT_ENCRYPTED, bdrv_get_device_name(bs));
return;
} else if (err < 0) {
error_set(errp, QERR_INVALID_PASSWORD);
return;
}
}
| true
|
qemu
|
e3442099a2794925dfbe83711cd204caf80eae60
|
void qmp_block_passwd(bool has_device, const char *device,
bool has_node_name, const char *node_name,
const char *password, Error **errp)
{
Error *local_err = NULL;
BlockDriverState *bs;
int err;
bs = bdrv_lookup_bs(has_device ? device : NULL,
has_node_name ? node_name : NULL,
&local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
err = bdrv_set_key(bs, password);
if (err == -EINVAL) {
error_set(errp, QERR_DEVICE_NOT_ENCRYPTED, bdrv_get_device_name(bs));
return;
} else if (err < 0) {
error_set(errp, QERR_INVALID_PASSWORD);
return;
}
}
|
{
"code": [],
"line_no": []
}
|
void FUNC_0(bool VAR_0, const char *VAR_1,
bool VAR_2, const char *VAR_3,
const char *VAR_4, Error **VAR_5)
{
Error *local_err = NULL;
BlockDriverState *bs;
int VAR_6;
bs = bdrv_lookup_bs(VAR_0 ? VAR_1 : NULL,
VAR_2 ? VAR_3 : NULL,
&local_err);
if (local_err) {
error_propagate(VAR_5, local_err);
return;
}
VAR_6 = bdrv_set_key(bs, VAR_4);
if (VAR_6 == -EINVAL) {
error_set(VAR_5, QERR_DEVICE_NOT_ENCRYPTED, bdrv_get_device_name(bs));
return;
} else if (VAR_6 < 0) {
error_set(VAR_5, QERR_INVALID_PASSWORD);
return;
}
}
|
[
"void FUNC_0(bool VAR_0, const char *VAR_1,\nbool VAR_2, const char *VAR_3,\nconst char *VAR_4, Error **VAR_5)\n{",
"Error *local_err = NULL;",
"BlockDriverState *bs;",
"int VAR_6;",
"bs = bdrv_lookup_bs(VAR_0 ? VAR_1 : NULL,\nVAR_2 ? VAR_3 : NULL,\n&local_err);",
"if (local_err) {",
"error_propagate(VAR_5, local_err);",
"return;",
"}",
"VAR_6 = bdrv_set_key(bs, VAR_4);",
"if (VAR_6 == -EINVAL) {",
"error_set(VAR_5, QERR_DEVICE_NOT_ENCRYPTED, bdrv_get_device_name(bs));",
"return;",
"} else if (VAR_6 < 0) {",
"error_set(VAR_5, QERR_INVALID_PASSWORD);",
"return;",
"}",
"}"
] |
[
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
]
] |
17,461
|
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
{
int ret;
switch (avctx->codec_type) {
case AVMEDIA_TYPE_VIDEO:
if (!frame->width)
frame->width = avctx->width;
if (!frame->height)
frame->height = avctx->height;
if (frame->format < 0)
frame->format = avctx->pix_fmt;
if (!frame->sample_aspect_ratio.num)
frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
return ret;
break;
case AVMEDIA_TYPE_AUDIO:
if (!frame->sample_rate)
frame->sample_rate = avctx->sample_rate;
if (frame->format < 0)
frame->format = avctx->sample_fmt;
if (!frame->channel_layout) {
if (avctx->channel_layout) {
if (av_get_channel_layout_nb_channels(avctx->channel_layout) !=
avctx->channels) {
av_log(avctx, AV_LOG_ERROR, "Inconsistent channel "
"configuration.\n");
return AVERROR(EINVAL);
}
frame->channel_layout = avctx->channel_layout;
} else {
if (avctx->channels > FF_SANE_NB_CHANNELS) {
av_log(avctx, AV_LOG_ERROR, "Too many channels: %d.\n",
avctx->channels);
return AVERROR(ENOSYS);
}
frame->channel_layout = av_get_default_channel_layout(avctx->channels);
if (!frame->channel_layout)
frame->channel_layout = (1ULL << avctx->channels) - 1;
}
}
break;
default: return AVERROR(EINVAL);
}
frame->pkt_pts = avctx->pkt ? avctx->pkt->pts : AV_NOPTS_VALUE;
frame->reordered_opaque = avctx->reordered_opaque;
#if FF_API_GET_BUFFER
/*
* Wrap an old get_buffer()-allocated buffer in an bunch of AVBuffers.
* We wrap each plane in its own AVBuffer. Each of those has a reference to
* a dummy AVBuffer as its private data, unreffing it on free.
* When all the planes are freed, the dummy buffer's free callback calls
* release_buffer().
*/
if (avctx->get_buffer) {
CompatReleaseBufPriv *priv = NULL;
AVBufferRef *dummy_buf = NULL;
int planes, i, ret;
if (flags & AV_GET_BUFFER_FLAG_REF)
frame->reference = 1;
ret = avctx->get_buffer(avctx, frame);
if (ret < 0)
return ret;
/* return if the buffers are already set up
* this would happen e.g. when a custom get_buffer() calls
* avcodec_default_get_buffer
*/
if (frame->buf[0])
return 0;
priv = av_mallocz(sizeof(*priv));
if (!priv) {
ret = AVERROR(ENOMEM);
goto fail;
}
priv->avctx = *avctx;
priv->frame = *frame;
dummy_buf = av_buffer_create(NULL, 0, compat_free_buffer, priv, 0);
if (!dummy_buf) {
ret = AVERROR(ENOMEM);
goto fail;
}
#define WRAP_PLANE(ref_out, data, data_size) \
do { \
AVBufferRef *dummy_ref = av_buffer_ref(dummy_buf); \
if (!dummy_ref) { \
ret = AVERROR(ENOMEM); \
goto fail; \
} \
ref_out = av_buffer_create(data, data_size, compat_release_buffer, \
dummy_ref, 0); \
if (!ref_out) { \
av_frame_unref(frame); \
ret = AVERROR(ENOMEM); \
goto fail; \
} \
} while (0)
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
if (!desc) {
ret = AVERROR(EINVAL);
goto fail;
}
planes = (desc->flags & PIX_FMT_PLANAR) ? desc->nb_components : 1;
for (i = 0; i < planes; i++) {
int h_shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
int plane_size = (frame->width >> h_shift) * frame->linesize[i];
WRAP_PLANE(frame->buf[i], frame->data[i], plane_size);
}
} else {
int planar = av_sample_fmt_is_planar(frame->format);
planes = planar ? avctx->channels : 1;
if (planes > FF_ARRAY_ELEMS(frame->buf)) {
frame->nb_extended_buf = planes - FF_ARRAY_ELEMS(frame->buf);
frame->extended_buf = av_malloc(sizeof(*frame->extended_buf) *
frame->nb_extended_buf);
if (!frame->extended_buf) {
ret = AVERROR(ENOMEM);
goto fail;
}
}
for (i = 0; i < FFMIN(planes, FF_ARRAY_ELEMS(frame->buf)); i++)
WRAP_PLANE(frame->buf[i], frame->extended_data[i], frame->linesize[0]);
for (i = 0; i < planes - FF_ARRAY_ELEMS(frame->buf); i++)
WRAP_PLANE(frame->extended_buf[i],
frame->extended_data[i + FF_ARRAY_ELEMS(frame->buf)],
frame->linesize[0]);
}
av_buffer_unref(&dummy_buf);
return 0;
fail:
avctx->release_buffer(avctx, frame);
av_freep(&priv);
av_buffer_unref(&dummy_buf);
return ret;
}
#endif
return avctx->get_buffer2(avctx, frame, flags);
}
| true
|
FFmpeg
|
669cc0f364d69aa9bd0153eb2f926abdd5d59575
|
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
{
int ret;
switch (avctx->codec_type) {
case AVMEDIA_TYPE_VIDEO:
if (!frame->width)
frame->width = avctx->width;
if (!frame->height)
frame->height = avctx->height;
if (frame->format < 0)
frame->format = avctx->pix_fmt;
if (!frame->sample_aspect_ratio.num)
frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
return ret;
break;
case AVMEDIA_TYPE_AUDIO:
if (!frame->sample_rate)
frame->sample_rate = avctx->sample_rate;
if (frame->format < 0)
frame->format = avctx->sample_fmt;
if (!frame->channel_layout) {
if (avctx->channel_layout) {
if (av_get_channel_layout_nb_channels(avctx->channel_layout) !=
avctx->channels) {
av_log(avctx, AV_LOG_ERROR, "Inconsistent channel "
"configuration.\n");
return AVERROR(EINVAL);
}
frame->channel_layout = avctx->channel_layout;
} else {
if (avctx->channels > FF_SANE_NB_CHANNELS) {
av_log(avctx, AV_LOG_ERROR, "Too many channels: %d.\n",
avctx->channels);
return AVERROR(ENOSYS);
}
frame->channel_layout = av_get_default_channel_layout(avctx->channels);
if (!frame->channel_layout)
frame->channel_layout = (1ULL << avctx->channels) - 1;
}
}
break;
default: return AVERROR(EINVAL);
}
frame->pkt_pts = avctx->pkt ? avctx->pkt->pts : AV_NOPTS_VALUE;
frame->reordered_opaque = avctx->reordered_opaque;
#if FF_API_GET_BUFFER
if (avctx->get_buffer) {
CompatReleaseBufPriv *priv = NULL;
AVBufferRef *dummy_buf = NULL;
int planes, i, ret;
if (flags & AV_GET_BUFFER_FLAG_REF)
frame->reference = 1;
ret = avctx->get_buffer(avctx, frame);
if (ret < 0)
return ret;
if (frame->buf[0])
return 0;
priv = av_mallocz(sizeof(*priv));
if (!priv) {
ret = AVERROR(ENOMEM);
goto fail;
}
priv->avctx = *avctx;
priv->frame = *frame;
dummy_buf = av_buffer_create(NULL, 0, compat_free_buffer, priv, 0);
if (!dummy_buf) {
ret = AVERROR(ENOMEM);
goto fail;
}
#define WRAP_PLANE(ref_out, data, data_size) \
do { \
AVBufferRef *dummy_ref = av_buffer_ref(dummy_buf); \
if (!dummy_ref) { \
ret = AVERROR(ENOMEM); \
goto fail; \
} \
ref_out = av_buffer_create(data, data_size, compat_release_buffer, \
dummy_ref, 0); \
if (!ref_out) { \
av_frame_unref(frame); \
ret = AVERROR(ENOMEM); \
goto fail; \
} \
} while (0)
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
if (!desc) {
ret = AVERROR(EINVAL);
goto fail;
}
planes = (desc->flags & PIX_FMT_PLANAR) ? desc->nb_components : 1;
for (i = 0; i < planes; i++) {
int h_shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
int plane_size = (frame->width >> h_shift) * frame->linesize[i];
WRAP_PLANE(frame->buf[i], frame->data[i], plane_size);
}
} else {
int planar = av_sample_fmt_is_planar(frame->format);
planes = planar ? avctx->channels : 1;
if (planes > FF_ARRAY_ELEMS(frame->buf)) {
frame->nb_extended_buf = planes - FF_ARRAY_ELEMS(frame->buf);
frame->extended_buf = av_malloc(sizeof(*frame->extended_buf) *
frame->nb_extended_buf);
if (!frame->extended_buf) {
ret = AVERROR(ENOMEM);
goto fail;
}
}
for (i = 0; i < FFMIN(planes, FF_ARRAY_ELEMS(frame->buf)); i++)
WRAP_PLANE(frame->buf[i], frame->extended_data[i], frame->linesize[0]);
for (i = 0; i < planes - FF_ARRAY_ELEMS(frame->buf); i++)
WRAP_PLANE(frame->extended_buf[i],
frame->extended_data[i + FF_ARRAY_ELEMS(frame->buf)],
frame->linesize[0]);
}
av_buffer_unref(&dummy_buf);
return 0;
fail:
avctx->release_buffer(avctx, frame);
av_freep(&priv);
av_buffer_unref(&dummy_buf);
return ret;
}
#endif
return avctx->get_buffer2(avctx, frame, flags);
}
|
{
"code": [
" for (i = 0; i < planes - FF_ARRAY_ELEMS(frame->buf); i++)"
],
"line_no": [
283
]
}
|
int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, int VAR_2)
{
int VAR_3;
switch (VAR_0->codec_type) {
case AVMEDIA_TYPE_VIDEO:
if (!VAR_1->width)
VAR_1->width = VAR_0->width;
if (!VAR_1->height)
VAR_1->height = VAR_0->height;
if (VAR_1->format < 0)
VAR_1->format = VAR_0->pix_fmt;
if (!VAR_1->sample_aspect_ratio.num)
VAR_1->sample_aspect_ratio = VAR_0->sample_aspect_ratio;
if ((VAR_3 = av_image_check_size(VAR_0->width, VAR_0->height, 0, VAR_0)) < 0)
return VAR_3;
break;
case AVMEDIA_TYPE_AUDIO:
if (!VAR_1->sample_rate)
VAR_1->sample_rate = VAR_0->sample_rate;
if (VAR_1->format < 0)
VAR_1->format = VAR_0->sample_fmt;
if (!VAR_1->channel_layout) {
if (VAR_0->channel_layout) {
if (av_get_channel_layout_nb_channels(VAR_0->channel_layout) !=
VAR_0->channels) {
av_log(VAR_0, AV_LOG_ERROR, "Inconsistent channel "
"configuration.\n");
return AVERROR(EINVAL);
}
VAR_1->channel_layout = VAR_0->channel_layout;
} else {
if (VAR_0->channels > FF_SANE_NB_CHANNELS) {
av_log(VAR_0, AV_LOG_ERROR, "Too many channels: %d.\n",
VAR_0->channels);
return AVERROR(ENOSYS);
}
VAR_1->channel_layout = av_get_default_channel_layout(VAR_0->channels);
if (!VAR_1->channel_layout)
VAR_1->channel_layout = (1ULL << VAR_0->channels) - 1;
}
}
break;
default: return AVERROR(EINVAL);
}
VAR_1->pkt_pts = VAR_0->pkt ? VAR_0->pkt->pts : AV_NOPTS_VALUE;
VAR_1->reordered_opaque = VAR_0->reordered_opaque;
#if FF_API_GET_BUFFER
if (VAR_0->get_buffer) {
CompatReleaseBufPriv *priv = NULL;
AVBufferRef *dummy_buf = NULL;
int planes, i, VAR_3;
if (VAR_2 & AV_GET_BUFFER_FLAG_REF)
VAR_1->reference = 1;
VAR_3 = VAR_0->get_buffer(VAR_0, VAR_1);
if (VAR_3 < 0)
return VAR_3;
if (VAR_1->buf[0])
return 0;
priv = av_mallocz(sizeof(*priv));
if (!priv) {
VAR_3 = AVERROR(ENOMEM);
goto fail;
}
priv->VAR_0 = *VAR_0;
priv->VAR_1 = *VAR_1;
dummy_buf = av_buffer_create(NULL, 0, compat_free_buffer, priv, 0);
if (!dummy_buf) {
VAR_3 = AVERROR(ENOMEM);
goto fail;
}
#define WRAP_PLANE(ref_out, data, data_size) \
do { \
AVBufferRef *dummy_ref = av_buffer_ref(dummy_buf); \
if (!dummy_ref) { \
VAR_3 = AVERROR(ENOMEM); \
goto fail; \
} \
ref_out = av_buffer_create(data, data_size, compat_release_buffer, \
dummy_ref, 0); \
if (!ref_out) { \
av_frame_unref(VAR_1); \
VAR_3 = AVERROR(ENOMEM); \
goto fail; \
} \
} while (0)
if (VAR_0->codec_type == AVMEDIA_TYPE_VIDEO) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(VAR_1->format);
if (!desc) {
VAR_3 = AVERROR(EINVAL);
goto fail;
}
planes = (desc->VAR_2 & PIX_FMT_PLANAR) ? desc->nb_components : 1;
for (i = 0; i < planes; i++) {
int h_shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
int plane_size = (VAR_1->width >> h_shift) * VAR_1->linesize[i];
WRAP_PLANE(VAR_1->buf[i], VAR_1->data[i], plane_size);
}
} else {
int planar = av_sample_fmt_is_planar(VAR_1->format);
planes = planar ? VAR_0->channels : 1;
if (planes > FF_ARRAY_ELEMS(VAR_1->buf)) {
VAR_1->nb_extended_buf = planes - FF_ARRAY_ELEMS(VAR_1->buf);
VAR_1->extended_buf = av_malloc(sizeof(*VAR_1->extended_buf) *
VAR_1->nb_extended_buf);
if (!VAR_1->extended_buf) {
VAR_3 = AVERROR(ENOMEM);
goto fail;
}
}
for (i = 0; i < FFMIN(planes, FF_ARRAY_ELEMS(VAR_1->buf)); i++)
WRAP_PLANE(VAR_1->buf[i], VAR_1->extended_data[i], VAR_1->linesize[0]);
for (i = 0; i < planes - FF_ARRAY_ELEMS(VAR_1->buf); i++)
WRAP_PLANE(VAR_1->extended_buf[i],
VAR_1->extended_data[i + FF_ARRAY_ELEMS(VAR_1->buf)],
VAR_1->linesize[0]);
}
av_buffer_unref(&dummy_buf);
return 0;
fail:
VAR_0->release_buffer(VAR_0, VAR_1);
av_freep(&priv);
av_buffer_unref(&dummy_buf);
return VAR_3;
}
#endif
return VAR_0->get_buffer2(VAR_0, VAR_1, VAR_2);
}
|
[
"int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, int VAR_2)\n{",
"int VAR_3;",
"switch (VAR_0->codec_type) {",
"case AVMEDIA_TYPE_VIDEO:\nif (!VAR_1->width)\nVAR_1->width = VAR_0->width;",
"if (!VAR_1->height)\nVAR_1->height = VAR_0->height;",
"if (VAR_1->format < 0)\nVAR_1->format = VAR_0->pix_fmt;",
"if (!VAR_1->sample_aspect_ratio.num)\nVAR_1->sample_aspect_ratio = VAR_0->sample_aspect_ratio;",
"if ((VAR_3 = av_image_check_size(VAR_0->width, VAR_0->height, 0, VAR_0)) < 0)\nreturn VAR_3;",
"break;",
"case AVMEDIA_TYPE_AUDIO:\nif (!VAR_1->sample_rate)\nVAR_1->sample_rate = VAR_0->sample_rate;",
"if (VAR_1->format < 0)\nVAR_1->format = VAR_0->sample_fmt;",
"if (!VAR_1->channel_layout) {",
"if (VAR_0->channel_layout) {",
"if (av_get_channel_layout_nb_channels(VAR_0->channel_layout) !=\nVAR_0->channels) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Inconsistent channel \"\n\"configuration.\\n\");",
"return AVERROR(EINVAL);",
"}",
"VAR_1->channel_layout = VAR_0->channel_layout;",
"} else {",
"if (VAR_0->channels > FF_SANE_NB_CHANNELS) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Too many channels: %d.\\n\",\nVAR_0->channels);",
"return AVERROR(ENOSYS);",
"}",
"VAR_1->channel_layout = av_get_default_channel_layout(VAR_0->channels);",
"if (!VAR_1->channel_layout)\nVAR_1->channel_layout = (1ULL << VAR_0->channels) - 1;",
"}",
"}",
"break;",
"default: return AVERROR(EINVAL);",
"}",
"VAR_1->pkt_pts = VAR_0->pkt ? VAR_0->pkt->pts : AV_NOPTS_VALUE;",
"VAR_1->reordered_opaque = VAR_0->reordered_opaque;",
"#if FF_API_GET_BUFFER\nif (VAR_0->get_buffer) {",
"CompatReleaseBufPriv *priv = NULL;",
"AVBufferRef *dummy_buf = NULL;",
"int planes, i, VAR_3;",
"if (VAR_2 & AV_GET_BUFFER_FLAG_REF)\nVAR_1->reference = 1;",
"VAR_3 = VAR_0->get_buffer(VAR_0, VAR_1);",
"if (VAR_3 < 0)\nreturn VAR_3;",
"if (VAR_1->buf[0])\nreturn 0;",
"priv = av_mallocz(sizeof(*priv));",
"if (!priv) {",
"VAR_3 = AVERROR(ENOMEM);",
"goto fail;",
"}",
"priv->VAR_0 = *VAR_0;",
"priv->VAR_1 = *VAR_1;",
"dummy_buf = av_buffer_create(NULL, 0, compat_free_buffer, priv, 0);",
"if (!dummy_buf) {",
"VAR_3 = AVERROR(ENOMEM);",
"goto fail;",
"}",
"#define WRAP_PLANE(ref_out, data, data_size) \\\ndo { \\",
"AVBufferRef *dummy_ref = av_buffer_ref(dummy_buf); \\",
"if (!dummy_ref) { \\",
"VAR_3 = AVERROR(ENOMEM); \\",
"goto fail; \\",
"} \\",
"ref_out = av_buffer_create(data, data_size, compat_release_buffer, \\\ndummy_ref, 0); \\",
"if (!ref_out) { \\",
"av_frame_unref(VAR_1); \\",
"VAR_3 = AVERROR(ENOMEM); \\",
"goto fail; \\",
"} \\",
"} while (0)",
"if (VAR_0->codec_type == AVMEDIA_TYPE_VIDEO) {",
"const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(VAR_1->format);",
"if (!desc) {",
"VAR_3 = AVERROR(EINVAL);",
"goto fail;",
"}",
"planes = (desc->VAR_2 & PIX_FMT_PLANAR) ? desc->nb_components : 1;",
"for (i = 0; i < planes; i++) {",
"int h_shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;",
"int plane_size = (VAR_1->width >> h_shift) * VAR_1->linesize[i];",
"WRAP_PLANE(VAR_1->buf[i], VAR_1->data[i], plane_size);",
"}",
"} else {",
"int planar = av_sample_fmt_is_planar(VAR_1->format);",
"planes = planar ? VAR_0->channels : 1;",
"if (planes > FF_ARRAY_ELEMS(VAR_1->buf)) {",
"VAR_1->nb_extended_buf = planes - FF_ARRAY_ELEMS(VAR_1->buf);",
"VAR_1->extended_buf = av_malloc(sizeof(*VAR_1->extended_buf) *\nVAR_1->nb_extended_buf);",
"if (!VAR_1->extended_buf) {",
"VAR_3 = AVERROR(ENOMEM);",
"goto fail;",
"}",
"}",
"for (i = 0; i < FFMIN(planes, FF_ARRAY_ELEMS(VAR_1->buf)); i++)",
"WRAP_PLANE(VAR_1->buf[i], VAR_1->extended_data[i], VAR_1->linesize[0]);",
"for (i = 0; i < planes - FF_ARRAY_ELEMS(VAR_1->buf); i++)",
"WRAP_PLANE(VAR_1->extended_buf[i],\nVAR_1->extended_data[i + FF_ARRAY_ELEMS(VAR_1->buf)],\nVAR_1->linesize[0]);",
"}",
"av_buffer_unref(&dummy_buf);",
"return 0;",
"fail:\nVAR_0->release_buffer(VAR_0, VAR_1);",
"av_freep(&priv);",
"av_buffer_unref(&dummy_buf);",
"return VAR_3;",
"}",
"#endif\nreturn VAR_0->get_buffer2(VAR_0, VAR_1, VAR_2);",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
9
],
[
11,
13,
15
],
[
17,
19
],
[
21,
23
],
[
25,
27
],
[
31,
33
],
[
35
],
[
37,
39,
41
],
[
43,
45
],
[
47
],
[
49
],
[
51,
53
],
[
55,
57
],
[
59
],
[
61
],
[
65
],
[
67
],
[
69
],
[
71,
73
],
[
75
],
[
77
],
[
81
],
[
83,
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
99
],
[
101
],
[
105,
121
],
[
123
],
[
125
],
[
127
],
[
131,
133
],
[
137
],
[
139,
141
],
[
153,
155
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
187,
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201,
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
219
],
[
221
],
[
225
],
[
227
],
[
229
],
[
231
],
[
233
],
[
237
],
[
239
],
[
241
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
257
],
[
259
],
[
261,
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273
],
[
277
],
[
279
],
[
283
],
[
285,
287,
289
],
[
291
],
[
295
],
[
299
],
[
303,
305
],
[
307
],
[
309
],
[
311
],
[
313
],
[
315,
319
],
[
321
]
] |
17,462
|
m_get(Slirp *slirp)
{
register struct mbuf *m;
int flags = 0;
DEBUG_CALL("m_get");
if (slirp->m_freelist.m_next == &slirp->m_freelist) {
m = (struct mbuf *)malloc(SLIRP_MSIZE);
if (m == NULL) goto end_error;
slirp->mbuf_alloced++;
if (slirp->mbuf_alloced > MBUF_THRESH)
flags = M_DOFREE;
m->slirp = slirp;
} else {
m = slirp->m_freelist.m_next;
remque(m);
}
/* Insert it in the used list */
insque(m,&slirp->m_usedlist);
m->m_flags = (flags | M_USEDLIST);
/* Initialise it */
m->m_size = SLIRP_MSIZE - sizeof(struct m_hdr);
m->m_data = m->m_dat;
m->m_len = 0;
m->m_nextpkt = NULL;
m->m_prevpkt = NULL;
end_error:
DEBUG_ARG("m = %lx", (long )m);
return m;
}
| true
|
qemu
|
53fae6d27f342a17bdc218dc51ccccebd99f3545
|
m_get(Slirp *slirp)
{
register struct mbuf *m;
int flags = 0;
DEBUG_CALL("m_get");
if (slirp->m_freelist.m_next == &slirp->m_freelist) {
m = (struct mbuf *)malloc(SLIRP_MSIZE);
if (m == NULL) goto end_error;
slirp->mbuf_alloced++;
if (slirp->mbuf_alloced > MBUF_THRESH)
flags = M_DOFREE;
m->slirp = slirp;
} else {
m = slirp->m_freelist.m_next;
remque(m);
}
insque(m,&slirp->m_usedlist);
m->m_flags = (flags | M_USEDLIST);
m->m_size = SLIRP_MSIZE - sizeof(struct m_hdr);
m->m_data = m->m_dat;
m->m_len = 0;
m->m_nextpkt = NULL;
m->m_prevpkt = NULL;
end_error:
DEBUG_ARG("m = %lx", (long )m);
return m;
}
|
{
"code": [
"\tm->m_size = SLIRP_MSIZE - sizeof(struct m_hdr);"
],
"line_no": [
49
]
}
|
FUNC_0(Slirp *VAR_0)
{
register struct mbuf *VAR_1;
int VAR_2 = 0;
DEBUG_CALL("FUNC_0");
if (VAR_0->m_freelist.m_next == &VAR_0->m_freelist) {
VAR_1 = (struct mbuf *)malloc(SLIRP_MSIZE);
if (VAR_1 == NULL) goto end_error;
VAR_0->mbuf_alloced++;
if (VAR_0->mbuf_alloced > MBUF_THRESH)
VAR_2 = M_DOFREE;
VAR_1->VAR_0 = VAR_0;
} else {
VAR_1 = VAR_0->m_freelist.m_next;
remque(VAR_1);
}
insque(VAR_1,&VAR_0->m_usedlist);
VAR_1->m_flags = (VAR_2 | M_USEDLIST);
VAR_1->m_size = SLIRP_MSIZE - sizeof(struct m_hdr);
VAR_1->m_data = VAR_1->m_dat;
VAR_1->m_len = 0;
VAR_1->m_nextpkt = NULL;
VAR_1->m_prevpkt = NULL;
end_error:
DEBUG_ARG("VAR_1 = %lx", (long )VAR_1);
return VAR_1;
}
|
[
"FUNC_0(Slirp *VAR_0)\n{",
"register struct mbuf *VAR_1;",
"int VAR_2 = 0;",
"DEBUG_CALL(\"FUNC_0\");",
"if (VAR_0->m_freelist.m_next == &VAR_0->m_freelist) {",
"VAR_1 = (struct mbuf *)malloc(SLIRP_MSIZE);",
"if (VAR_1 == NULL) goto end_error;",
"VAR_0->mbuf_alloced++;",
"if (VAR_0->mbuf_alloced > MBUF_THRESH)\nVAR_2 = M_DOFREE;",
"VAR_1->VAR_0 = VAR_0;",
"} else {",
"VAR_1 = VAR_0->m_freelist.m_next;",
"remque(VAR_1);",
"}",
"insque(VAR_1,&VAR_0->m_usedlist);",
"VAR_1->m_flags = (VAR_2 | M_USEDLIST);",
"VAR_1->m_size = SLIRP_MSIZE - sizeof(struct m_hdr);",
"VAR_1->m_data = VAR_1->m_dat;",
"VAR_1->m_len = 0;",
"VAR_1->m_nextpkt = NULL;",
"VAR_1->m_prevpkt = NULL;",
"end_error:\nDEBUG_ARG(\"VAR_1 = %lx\", (long )VAR_1);",
"return VAR_1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23,
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
41
],
[
43
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59,
61
],
[
63
],
[
65
]
] |
17,464
|
uint_fast16_t float64_to_uint16_round_to_zero(float64 a STATUS_PARAM)
{
int64_t v;
uint_fast16_t res;
v = float64_to_int64_round_to_zero(a STATUS_VAR);
if (v < 0) {
res = 0;
float_raise( float_flag_invalid STATUS_VAR);
} else if (v > 0xffff) {
res = 0xffff;
float_raise( float_flag_invalid STATUS_VAR);
} else {
res = v;
}
return res;
}
| true
|
qemu
|
f2e933d20d5fd6c38bda227359b79bcc81654f99
|
uint_fast16_t float64_to_uint16_round_to_zero(float64 a STATUS_PARAM)
{
int64_t v;
uint_fast16_t res;
v = float64_to_int64_round_to_zero(a STATUS_VAR);
if (v < 0) {
res = 0;
float_raise( float_flag_invalid STATUS_VAR);
} else if (v > 0xffff) {
res = 0xffff;
float_raise( float_flag_invalid STATUS_VAR);
} else {
res = v;
}
return res;
}
|
{
"code": [
" float_raise( float_flag_invalid STATUS_VAR);",
" float_raise( float_flag_invalid STATUS_VAR);",
" res = v;",
" float_raise( float_flag_invalid STATUS_VAR);",
" float_raise( float_flag_invalid STATUS_VAR);",
" res = v;",
" float_raise( float_flag_invalid STATUS_VAR);",
" float_raise( float_flag_invalid STATUS_VAR);",
" res = v;",
" float_raise( float_flag_invalid STATUS_VAR);",
" float_raise( float_flag_invalid STATUS_VAR);",
" res = v;"
],
"line_no": [
17,
17,
27,
17,
17,
27,
17,
17,
27,
17,
17,
27
]
}
|
uint_fast16_t FUNC_0(float64 a STATUS_PARAM)
{
int64_t v;
uint_fast16_t res;
v = float64_to_int64_round_to_zero(a STATUS_VAR);
if (v < 0) {
res = 0;
float_raise( float_flag_invalid STATUS_VAR);
} else if (v > 0xffff) {
res = 0xffff;
float_raise( float_flag_invalid STATUS_VAR);
} else {
res = v;
}
return res;
}
|
[
"uint_fast16_t FUNC_0(float64 a STATUS_PARAM)\n{",
"int64_t v;",
"uint_fast16_t res;",
"v = float64_to_int64_round_to_zero(a STATUS_VAR);",
"if (v < 0) {",
"res = 0;",
"float_raise( float_flag_invalid STATUS_VAR);",
"} else if (v > 0xffff) {",
"res = 0xffff;",
"float_raise( float_flag_invalid STATUS_VAR);",
"} else {",
"res = v;",
"}",
"return res;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
]
] |
17,465
|
static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) {
uint_fast16_t cb;
uint8_t *tmp_vlc_bits;
uint32_t *tmp_vlc_codes;
GetBitContext *gb=&vc->gb;
vc->codebook_count=get_bits(gb,8)+1;
AV_DEBUG(" Codebooks: %d \n", vc->codebook_count);
vc->codebooks=(vorbis_codebook *)av_mallocz(vc->codebook_count * sizeof(vorbis_codebook));
tmp_vlc_bits=(uint8_t *)av_mallocz(V_MAX_VLCS * sizeof(uint8_t));
tmp_vlc_codes=(uint32_t *)av_mallocz(V_MAX_VLCS * sizeof(uint32_t));
for(cb=0;cb<vc->codebook_count;++cb) {
vorbis_codebook *codebook_setup=&vc->codebooks[cb];
uint_fast8_t ordered;
uint_fast32_t t, used_entries=0;
uint_fast32_t entries;
AV_DEBUG(" %d. Codebook \n", cb);
if (get_bits(gb, 24)!=0x564342) {
av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook setup data corrupt. \n", cb);
goto error;
}
codebook_setup->dimensions=get_bits(gb, 16);
if (codebook_setup->dimensions>16) {
av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook's dimension is too large (%d). \n", cb, codebook_setup->dimensions);
goto error;
}
entries=get_bits(gb, 24);
if (entries>V_MAX_VLCS) {
av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook has too many entries (%"PRIdFAST32"). \n", cb, entries);
goto error;
}
ordered=get_bits1(gb);
AV_DEBUG(" codebook_dimensions %d, codebook_entries %d \n", codebook_setup->dimensions, entries);
if (!ordered) {
uint_fast16_t ce;
uint_fast8_t flag;
uint_fast8_t sparse=get_bits1(gb);
AV_DEBUG(" not ordered \n");
if (sparse) {
AV_DEBUG(" sparse \n");
used_entries=0;
for(ce=0;ce<entries;++ce) {
flag=get_bits1(gb);
if (flag) {
tmp_vlc_bits[ce]=get_bits(gb, 5)+1;
++used_entries;
}
else tmp_vlc_bits[ce]=0;
}
} else {
AV_DEBUG(" not sparse \n");
used_entries=entries;
for(ce=0;ce<entries;++ce) {
tmp_vlc_bits[ce]=get_bits(gb, 5)+1;
}
}
} else {
uint_fast16_t current_entry=0;
uint_fast8_t current_length=get_bits(gb, 5)+1;
AV_DEBUG(" ordered, current length: %d \n", current_length); //FIXME
used_entries=entries;
for(;current_entry<used_entries;++current_length) {
uint_fast16_t i, number;
AV_DEBUG(" number bits: %d ", ilog(entries - current_entry));
number=get_bits(gb, ilog(entries - current_entry));
AV_DEBUG(" number: %d \n", number);
for(i=current_entry;i<number+current_entry;++i) {
if (i<used_entries) tmp_vlc_bits[i]=current_length;
}
current_entry+=number;
}
if (current_entry>used_entries) {
av_log(vc->avccontext, AV_LOG_ERROR, " More codelengths than codes in codebook. \n");
goto error;
}
}
codebook_setup->lookup_type=get_bits(gb, 4);
AV_DEBUG(" lookup type: %d : %s \n", codebook_setup->lookup_type, codebook_setup->lookup_type ? "vq" : "no lookup" );
// If the codebook is used for (inverse) VQ, calculate codevectors.
if (codebook_setup->lookup_type==1) {
uint_fast16_t i, j, k;
uint_fast16_t codebook_lookup_values=ff_vorbis_nth_root(entries, codebook_setup->dimensions);
uint_fast16_t codebook_multiplicands[codebook_lookup_values];
float codebook_minimum_value=vorbisfloat2float(get_bits_long(gb, 32));
float codebook_delta_value=vorbisfloat2float(get_bits_long(gb, 32));
uint_fast8_t codebook_value_bits=get_bits(gb, 4)+1;
uint_fast8_t codebook_sequence_p=get_bits1(gb);
AV_DEBUG(" We expect %d numbers for building the codevectors. \n", codebook_lookup_values);
AV_DEBUG(" delta %f minmum %f \n", codebook_delta_value, codebook_minimum_value);
for(i=0;i<codebook_lookup_values;++i) {
codebook_multiplicands[i]=get_bits(gb, codebook_value_bits);
AV_DEBUG(" multiplicands*delta+minmum : %e \n", (float)codebook_multiplicands[i]*codebook_delta_value+codebook_minimum_value);
AV_DEBUG(" multiplicand %d \n", codebook_multiplicands[i]);
}
// Weed out unused vlcs and build codevector vector
codebook_setup->codevectors=(float *)av_mallocz(used_entries*codebook_setup->dimensions * sizeof(float));
for(j=0, i=0;i<entries;++i) {
uint_fast8_t dim=codebook_setup->dimensions;
if (tmp_vlc_bits[i]) {
float last=0.0;
uint_fast32_t lookup_offset=i;
#ifdef V_DEBUG
av_log(vc->avccontext, AV_LOG_INFO, "Lookup offset %d ,", i);
#endif
for(k=0;k<dim;++k) {
uint_fast32_t multiplicand_offset = lookup_offset % codebook_lookup_values;
codebook_setup->codevectors[j*dim+k]=codebook_multiplicands[multiplicand_offset]*codebook_delta_value+codebook_minimum_value+last;
if (codebook_sequence_p) {
last=codebook_setup->codevectors[j*dim+k];
}
lookup_offset/=codebook_lookup_values;
}
tmp_vlc_bits[j]=tmp_vlc_bits[i];
#ifdef V_DEBUG
av_log(vc->avccontext, AV_LOG_INFO, "real lookup offset %d, vector: ", j);
for(k=0;k<dim;++k) {
av_log(vc->avccontext, AV_LOG_INFO, " %f ", codebook_setup->codevectors[j*dim+k]);
}
av_log(vc->avccontext, AV_LOG_INFO, "\n");
#endif
++j;
}
}
if (j!=used_entries) {
av_log(vc->avccontext, AV_LOG_ERROR, "Bug in codevector vector building code. \n");
goto error;
}
entries=used_entries;
}
else if (codebook_setup->lookup_type>=2) {
av_log(vc->avccontext, AV_LOG_ERROR, "Codebook lookup type not supported. \n");
goto error;
}
// Initialize VLC table
if (ff_vorbis_len2vlc(tmp_vlc_bits, tmp_vlc_codes, entries)) {
av_log(vc->avccontext, AV_LOG_ERROR, " Invalid code lengths while generating vlcs. \n");
goto error;
}
codebook_setup->maxdepth=0;
for(t=0;t<entries;++t)
if (tmp_vlc_bits[t]>=codebook_setup->maxdepth) codebook_setup->maxdepth=tmp_vlc_bits[t];
if(codebook_setup->maxdepth > 3*V_NB_BITS) codebook_setup->nb_bits=V_NB_BITS2;
else codebook_setup->nb_bits=V_NB_BITS;
codebook_setup->maxdepth=(codebook_setup->maxdepth+codebook_setup->nb_bits-1)/codebook_setup->nb_bits;
if (init_vlc(&codebook_setup->vlc, codebook_setup->nb_bits, entries, tmp_vlc_bits, sizeof(*tmp_vlc_bits), sizeof(*tmp_vlc_bits), tmp_vlc_codes, sizeof(*tmp_vlc_codes), sizeof(*tmp_vlc_codes), INIT_VLC_LE)) {
av_log(vc->avccontext, AV_LOG_ERROR, " Error generating vlc tables. \n");
goto error;
}
}
av_free(tmp_vlc_bits);
av_free(tmp_vlc_codes);
return 0;
// Error:
error:
av_free(tmp_vlc_bits);
av_free(tmp_vlc_codes);
return 1;
}
| true
|
FFmpeg
|
975741e79cedc6033e5b02319792534a3a42c4ae
|
static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) {
uint_fast16_t cb;
uint8_t *tmp_vlc_bits;
uint32_t *tmp_vlc_codes;
GetBitContext *gb=&vc->gb;
vc->codebook_count=get_bits(gb,8)+1;
AV_DEBUG(" Codebooks: %d \n", vc->codebook_count);
vc->codebooks=(vorbis_codebook *)av_mallocz(vc->codebook_count * sizeof(vorbis_codebook));
tmp_vlc_bits=(uint8_t *)av_mallocz(V_MAX_VLCS * sizeof(uint8_t));
tmp_vlc_codes=(uint32_t *)av_mallocz(V_MAX_VLCS * sizeof(uint32_t));
for(cb=0;cb<vc->codebook_count;++cb) {
vorbis_codebook *codebook_setup=&vc->codebooks[cb];
uint_fast8_t ordered;
uint_fast32_t t, used_entries=0;
uint_fast32_t entries;
AV_DEBUG(" %d. Codebook \n", cb);
if (get_bits(gb, 24)!=0x564342) {
av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook setup data corrupt. \n", cb);
goto error;
}
codebook_setup->dimensions=get_bits(gb, 16);
if (codebook_setup->dimensions>16) {
av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook's dimension is too large (%d). \n", cb, codebook_setup->dimensions);
goto error;
}
entries=get_bits(gb, 24);
if (entries>V_MAX_VLCS) {
av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook has too many entries (%"PRIdFAST32"). \n", cb, entries);
goto error;
}
ordered=get_bits1(gb);
AV_DEBUG(" codebook_dimensions %d, codebook_entries %d \n", codebook_setup->dimensions, entries);
if (!ordered) {
uint_fast16_t ce;
uint_fast8_t flag;
uint_fast8_t sparse=get_bits1(gb);
AV_DEBUG(" not ordered \n");
if (sparse) {
AV_DEBUG(" sparse \n");
used_entries=0;
for(ce=0;ce<entries;++ce) {
flag=get_bits1(gb);
if (flag) {
tmp_vlc_bits[ce]=get_bits(gb, 5)+1;
++used_entries;
}
else tmp_vlc_bits[ce]=0;
}
} else {
AV_DEBUG(" not sparse \n");
used_entries=entries;
for(ce=0;ce<entries;++ce) {
tmp_vlc_bits[ce]=get_bits(gb, 5)+1;
}
}
} else {
uint_fast16_t current_entry=0;
uint_fast8_t current_length=get_bits(gb, 5)+1;
AV_DEBUG(" ordered, current length: %d \n", current_length);
used_entries=entries;
for(;current_entry<used_entries;++current_length) {
uint_fast16_t i, number;
AV_DEBUG(" number bits: %d ", ilog(entries - current_entry));
number=get_bits(gb, ilog(entries - current_entry));
AV_DEBUG(" number: %d \n", number);
for(i=current_entry;i<number+current_entry;++i) {
if (i<used_entries) tmp_vlc_bits[i]=current_length;
}
current_entry+=number;
}
if (current_entry>used_entries) {
av_log(vc->avccontext, AV_LOG_ERROR, " More codelengths than codes in codebook. \n");
goto error;
}
}
codebook_setup->lookup_type=get_bits(gb, 4);
AV_DEBUG(" lookup type: %d : %s \n", codebook_setup->lookup_type, codebook_setup->lookup_type ? "vq" : "no lookup" );
if (codebook_setup->lookup_type==1) {
uint_fast16_t i, j, k;
uint_fast16_t codebook_lookup_values=ff_vorbis_nth_root(entries, codebook_setup->dimensions);
uint_fast16_t codebook_multiplicands[codebook_lookup_values];
float codebook_minimum_value=vorbisfloat2float(get_bits_long(gb, 32));
float codebook_delta_value=vorbisfloat2float(get_bits_long(gb, 32));
uint_fast8_t codebook_value_bits=get_bits(gb, 4)+1;
uint_fast8_t codebook_sequence_p=get_bits1(gb);
AV_DEBUG(" We expect %d numbers for building the codevectors. \n", codebook_lookup_values);
AV_DEBUG(" delta %f minmum %f \n", codebook_delta_value, codebook_minimum_value);
for(i=0;i<codebook_lookup_values;++i) {
codebook_multiplicands[i]=get_bits(gb, codebook_value_bits);
AV_DEBUG(" multiplicands*delta+minmum : %e \n", (float)codebook_multiplicands[i]*codebook_delta_value+codebook_minimum_value);
AV_DEBUG(" multiplicand %d \n", codebook_multiplicands[i]);
}
codebook_setup->codevectors=(float *)av_mallocz(used_entries*codebook_setup->dimensions * sizeof(float));
for(j=0, i=0;i<entries;++i) {
uint_fast8_t dim=codebook_setup->dimensions;
if (tmp_vlc_bits[i]) {
float last=0.0;
uint_fast32_t lookup_offset=i;
#ifdef V_DEBUG
av_log(vc->avccontext, AV_LOG_INFO, "Lookup offset %d ,", i);
#endif
for(k=0;k<dim;++k) {
uint_fast32_t multiplicand_offset = lookup_offset % codebook_lookup_values;
codebook_setup->codevectors[j*dim+k]=codebook_multiplicands[multiplicand_offset]*codebook_delta_value+codebook_minimum_value+last;
if (codebook_sequence_p) {
last=codebook_setup->codevectors[j*dim+k];
}
lookup_offset/=codebook_lookup_values;
}
tmp_vlc_bits[j]=tmp_vlc_bits[i];
#ifdef V_DEBUG
av_log(vc->avccontext, AV_LOG_INFO, "real lookup offset %d, vector: ", j);
for(k=0;k<dim;++k) {
av_log(vc->avccontext, AV_LOG_INFO, " %f ", codebook_setup->codevectors[j*dim+k]);
}
av_log(vc->avccontext, AV_LOG_INFO, "\n");
#endif
++j;
}
}
if (j!=used_entries) {
av_log(vc->avccontext, AV_LOG_ERROR, "Bug in codevector vector building code. \n");
goto error;
}
entries=used_entries;
}
else if (codebook_setup->lookup_type>=2) {
av_log(vc->avccontext, AV_LOG_ERROR, "Codebook lookup type not supported. \n");
goto error;
}
if (ff_vorbis_len2vlc(tmp_vlc_bits, tmp_vlc_codes, entries)) {
av_log(vc->avccontext, AV_LOG_ERROR, " Invalid code lengths while generating vlcs. \n");
goto error;
}
codebook_setup->maxdepth=0;
for(t=0;t<entries;++t)
if (tmp_vlc_bits[t]>=codebook_setup->maxdepth) codebook_setup->maxdepth=tmp_vlc_bits[t];
if(codebook_setup->maxdepth > 3*V_NB_BITS) codebook_setup->nb_bits=V_NB_BITS2;
else codebook_setup->nb_bits=V_NB_BITS;
codebook_setup->maxdepth=(codebook_setup->maxdepth+codebook_setup->nb_bits-1)/codebook_setup->nb_bits;
if (init_vlc(&codebook_setup->vlc, codebook_setup->nb_bits, entries, tmp_vlc_bits, sizeof(*tmp_vlc_bits), sizeof(*tmp_vlc_bits), tmp_vlc_codes, sizeof(*tmp_vlc_codes), sizeof(*tmp_vlc_codes), INIT_VLC_LE)) {
av_log(vc->avccontext, AV_LOG_ERROR, " Error generating vlc tables. \n");
goto error;
}
}
av_free(tmp_vlc_bits);
av_free(tmp_vlc_codes);
return 0;
error:
av_free(tmp_vlc_bits);
av_free(tmp_vlc_codes);
return 1;
}
|
{
"code": [
" codebook_setup->codevectors=(float *)av_mallocz(used_entries*codebook_setup->dimensions * sizeof(float));"
],
"line_no": [
249
]
}
|
static int FUNC_0(vorbis_context *VAR_0) {
uint_fast16_t cb;
uint8_t *tmp_vlc_bits;
uint32_t *tmp_vlc_codes;
GetBitContext *gb=&VAR_0->gb;
VAR_0->codebook_count=get_bits(gb,8)+1;
AV_DEBUG(" Codebooks: %d \n", VAR_0->codebook_count);
VAR_0->codebooks=(vorbis_codebook *)av_mallocz(VAR_0->codebook_count * sizeof(vorbis_codebook));
tmp_vlc_bits=(uint8_t *)av_mallocz(V_MAX_VLCS * sizeof(uint8_t));
tmp_vlc_codes=(uint32_t *)av_mallocz(V_MAX_VLCS * sizeof(uint32_t));
for(cb=0;cb<VAR_0->codebook_count;++cb) {
vorbis_codebook *codebook_setup=&VAR_0->codebooks[cb];
uint_fast8_t ordered;
uint_fast32_t t, used_entries=0;
uint_fast32_t entries;
AV_DEBUG(" %d. Codebook \n", cb);
if (get_bits(gb, 24)!=0x564342) {
av_log(VAR_0->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook setup data corrupt. \n", cb);
goto error;
}
codebook_setup->dimensions=get_bits(gb, 16);
if (codebook_setup->dimensions>16) {
av_log(VAR_0->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook's dimension is too large (%d). \n", cb, codebook_setup->dimensions);
goto error;
}
entries=get_bits(gb, 24);
if (entries>V_MAX_VLCS) {
av_log(VAR_0->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook has too many entries (%"PRIdFAST32"). \n", cb, entries);
goto error;
}
ordered=get_bits1(gb);
AV_DEBUG(" codebook_dimensions %d, codebook_entries %d \n", codebook_setup->dimensions, entries);
if (!ordered) {
uint_fast16_t ce;
uint_fast8_t flag;
uint_fast8_t sparse=get_bits1(gb);
AV_DEBUG(" not ordered \n");
if (sparse) {
AV_DEBUG(" sparse \n");
used_entries=0;
for(ce=0;ce<entries;++ce) {
flag=get_bits1(gb);
if (flag) {
tmp_vlc_bits[ce]=get_bits(gb, 5)+1;
++used_entries;
}
else tmp_vlc_bits[ce]=0;
}
} else {
AV_DEBUG(" not sparse \n");
used_entries=entries;
for(ce=0;ce<entries;++ce) {
tmp_vlc_bits[ce]=get_bits(gb, 5)+1;
}
}
} else {
uint_fast16_t current_entry=0;
uint_fast8_t current_length=get_bits(gb, 5)+1;
AV_DEBUG(" ordered, current length: %d \n", current_length);
used_entries=entries;
for(;current_entry<used_entries;++current_length) {
uint_fast16_t i, number;
AV_DEBUG(" number bits: %d ", ilog(entries - current_entry));
number=get_bits(gb, ilog(entries - current_entry));
AV_DEBUG(" number: %d \n", number);
for(i=current_entry;i<number+current_entry;++i) {
if (i<used_entries) tmp_vlc_bits[i]=current_length;
}
current_entry+=number;
}
if (current_entry>used_entries) {
av_log(VAR_0->avccontext, AV_LOG_ERROR, " More codelengths than codes in codebook. \n");
goto error;
}
}
codebook_setup->lookup_type=get_bits(gb, 4);
AV_DEBUG(" lookup type: %d : %s \n", codebook_setup->lookup_type, codebook_setup->lookup_type ? "vq" : "no lookup" );
if (codebook_setup->lookup_type==1) {
uint_fast16_t i, j, k;
uint_fast16_t codebook_lookup_values=ff_vorbis_nth_root(entries, codebook_setup->dimensions);
uint_fast16_t codebook_multiplicands[codebook_lookup_values];
float codebook_minimum_value=vorbisfloat2float(get_bits_long(gb, 32));
float codebook_delta_value=vorbisfloat2float(get_bits_long(gb, 32));
uint_fast8_t codebook_value_bits=get_bits(gb, 4)+1;
uint_fast8_t codebook_sequence_p=get_bits1(gb);
AV_DEBUG(" We expect %d numbers for building the codevectors. \n", codebook_lookup_values);
AV_DEBUG(" delta %f minmum %f \n", codebook_delta_value, codebook_minimum_value);
for(i=0;i<codebook_lookup_values;++i) {
codebook_multiplicands[i]=get_bits(gb, codebook_value_bits);
AV_DEBUG(" multiplicands*delta+minmum : %e \n", (float)codebook_multiplicands[i]*codebook_delta_value+codebook_minimum_value);
AV_DEBUG(" multiplicand %d \n", codebook_multiplicands[i]);
}
codebook_setup->codevectors=(float *)av_mallocz(used_entries*codebook_setup->dimensions * sizeof(float));
for(j=0, i=0;i<entries;++i) {
uint_fast8_t dim=codebook_setup->dimensions;
if (tmp_vlc_bits[i]) {
float last=0.0;
uint_fast32_t lookup_offset=i;
#ifdef V_DEBUG
av_log(VAR_0->avccontext, AV_LOG_INFO, "Lookup offset %d ,", i);
#endif
for(k=0;k<dim;++k) {
uint_fast32_t multiplicand_offset = lookup_offset % codebook_lookup_values;
codebook_setup->codevectors[j*dim+k]=codebook_multiplicands[multiplicand_offset]*codebook_delta_value+codebook_minimum_value+last;
if (codebook_sequence_p) {
last=codebook_setup->codevectors[j*dim+k];
}
lookup_offset/=codebook_lookup_values;
}
tmp_vlc_bits[j]=tmp_vlc_bits[i];
#ifdef V_DEBUG
av_log(VAR_0->avccontext, AV_LOG_INFO, "real lookup offset %d, vector: ", j);
for(k=0;k<dim;++k) {
av_log(VAR_0->avccontext, AV_LOG_INFO, " %f ", codebook_setup->codevectors[j*dim+k]);
}
av_log(VAR_0->avccontext, AV_LOG_INFO, "\n");
#endif
++j;
}
}
if (j!=used_entries) {
av_log(VAR_0->avccontext, AV_LOG_ERROR, "Bug in codevector vector building code. \n");
goto error;
}
entries=used_entries;
}
else if (codebook_setup->lookup_type>=2) {
av_log(VAR_0->avccontext, AV_LOG_ERROR, "Codebook lookup type not supported. \n");
goto error;
}
if (ff_vorbis_len2vlc(tmp_vlc_bits, tmp_vlc_codes, entries)) {
av_log(VAR_0->avccontext, AV_LOG_ERROR, " Invalid code lengths while generating vlcs. \n");
goto error;
}
codebook_setup->maxdepth=0;
for(t=0;t<entries;++t)
if (tmp_vlc_bits[t]>=codebook_setup->maxdepth) codebook_setup->maxdepth=tmp_vlc_bits[t];
if(codebook_setup->maxdepth > 3*V_NB_BITS) codebook_setup->nb_bits=V_NB_BITS2;
else codebook_setup->nb_bits=V_NB_BITS;
codebook_setup->maxdepth=(codebook_setup->maxdepth+codebook_setup->nb_bits-1)/codebook_setup->nb_bits;
if (init_vlc(&codebook_setup->vlc, codebook_setup->nb_bits, entries, tmp_vlc_bits, sizeof(*tmp_vlc_bits), sizeof(*tmp_vlc_bits), tmp_vlc_codes, sizeof(*tmp_vlc_codes), sizeof(*tmp_vlc_codes), INIT_VLC_LE)) {
av_log(VAR_0->avccontext, AV_LOG_ERROR, " Error generating vlc tables. \n");
goto error;
}
}
av_free(tmp_vlc_bits);
av_free(tmp_vlc_codes);
return 0;
error:
av_free(tmp_vlc_bits);
av_free(tmp_vlc_codes);
return 1;
}
|
[
"static int FUNC_0(vorbis_context *VAR_0) {",
"uint_fast16_t cb;",
"uint8_t *tmp_vlc_bits;",
"uint32_t *tmp_vlc_codes;",
"GetBitContext *gb=&VAR_0->gb;",
"VAR_0->codebook_count=get_bits(gb,8)+1;",
"AV_DEBUG(\" Codebooks: %d \\n\", VAR_0->codebook_count);",
"VAR_0->codebooks=(vorbis_codebook *)av_mallocz(VAR_0->codebook_count * sizeof(vorbis_codebook));",
"tmp_vlc_bits=(uint8_t *)av_mallocz(V_MAX_VLCS * sizeof(uint8_t));",
"tmp_vlc_codes=(uint32_t *)av_mallocz(V_MAX_VLCS * sizeof(uint32_t));",
"for(cb=0;cb<VAR_0->codebook_count;++cb) {",
"vorbis_codebook *codebook_setup=&VAR_0->codebooks[cb];",
"uint_fast8_t ordered;",
"uint_fast32_t t, used_entries=0;",
"uint_fast32_t entries;",
"AV_DEBUG(\" %d. Codebook \\n\", cb);",
"if (get_bits(gb, 24)!=0x564342) {",
"av_log(VAR_0->avccontext, AV_LOG_ERROR, \" %\"PRIdFAST16\". Codebook setup data corrupt. \\n\", cb);",
"goto error;",
"}",
"codebook_setup->dimensions=get_bits(gb, 16);",
"if (codebook_setup->dimensions>16) {",
"av_log(VAR_0->avccontext, AV_LOG_ERROR, \" %\"PRIdFAST16\". Codebook's dimension is too large (%d). \\n\", cb, codebook_setup->dimensions);",
"goto error;",
"}",
"entries=get_bits(gb, 24);",
"if (entries>V_MAX_VLCS) {",
"av_log(VAR_0->avccontext, AV_LOG_ERROR, \" %\"PRIdFAST16\". Codebook has too many entries (%\"PRIdFAST32\"). \\n\", cb, entries);",
"goto error;",
"}",
"ordered=get_bits1(gb);",
"AV_DEBUG(\" codebook_dimensions %d, codebook_entries %d \\n\", codebook_setup->dimensions, entries);",
"if (!ordered) {",
"uint_fast16_t ce;",
"uint_fast8_t flag;",
"uint_fast8_t sparse=get_bits1(gb);",
"AV_DEBUG(\" not ordered \\n\");",
"if (sparse) {",
"AV_DEBUG(\" sparse \\n\");",
"used_entries=0;",
"for(ce=0;ce<entries;++ce) {",
"flag=get_bits1(gb);",
"if (flag) {",
"tmp_vlc_bits[ce]=get_bits(gb, 5)+1;",
"++used_entries;",
"}",
"else tmp_vlc_bits[ce]=0;",
"}",
"} else {",
"AV_DEBUG(\" not sparse \\n\");",
"used_entries=entries;",
"for(ce=0;ce<entries;++ce) {",
"tmp_vlc_bits[ce]=get_bits(gb, 5)+1;",
"}",
"}",
"} else {",
"uint_fast16_t current_entry=0;",
"uint_fast8_t current_length=get_bits(gb, 5)+1;",
"AV_DEBUG(\" ordered, current length: %d \\n\", current_length);",
"used_entries=entries;",
"for(;current_entry<used_entries;++current_length) {",
"uint_fast16_t i, number;",
"AV_DEBUG(\" number bits: %d \", ilog(entries - current_entry));",
"number=get_bits(gb, ilog(entries - current_entry));",
"AV_DEBUG(\" number: %d \\n\", number);",
"for(i=current_entry;i<number+current_entry;++i) {",
"if (i<used_entries) tmp_vlc_bits[i]=current_length;",
"}",
"current_entry+=number;",
"}",
"if (current_entry>used_entries) {",
"av_log(VAR_0->avccontext, AV_LOG_ERROR, \" More codelengths than codes in codebook. \\n\");",
"goto error;",
"}",
"}",
"codebook_setup->lookup_type=get_bits(gb, 4);",
"AV_DEBUG(\" lookup type: %d : %s \\n\", codebook_setup->lookup_type, codebook_setup->lookup_type ? \"vq\" : \"no lookup\" );",
"if (codebook_setup->lookup_type==1) {",
"uint_fast16_t i, j, k;",
"uint_fast16_t codebook_lookup_values=ff_vorbis_nth_root(entries, codebook_setup->dimensions);",
"uint_fast16_t codebook_multiplicands[codebook_lookup_values];",
"float codebook_minimum_value=vorbisfloat2float(get_bits_long(gb, 32));",
"float codebook_delta_value=vorbisfloat2float(get_bits_long(gb, 32));",
"uint_fast8_t codebook_value_bits=get_bits(gb, 4)+1;",
"uint_fast8_t codebook_sequence_p=get_bits1(gb);",
"AV_DEBUG(\" We expect %d numbers for building the codevectors. \\n\", codebook_lookup_values);",
"AV_DEBUG(\" delta %f minmum %f \\n\", codebook_delta_value, codebook_minimum_value);",
"for(i=0;i<codebook_lookup_values;++i) {",
"codebook_multiplicands[i]=get_bits(gb, codebook_value_bits);",
"AV_DEBUG(\" multiplicands*delta+minmum : %e \\n\", (float)codebook_multiplicands[i]*codebook_delta_value+codebook_minimum_value);",
"AV_DEBUG(\" multiplicand %d \\n\", codebook_multiplicands[i]);",
"}",
"codebook_setup->codevectors=(float *)av_mallocz(used_entries*codebook_setup->dimensions * sizeof(float));",
"for(j=0, i=0;i<entries;++i) {",
"uint_fast8_t dim=codebook_setup->dimensions;",
"if (tmp_vlc_bits[i]) {",
"float last=0.0;",
"uint_fast32_t lookup_offset=i;",
"#ifdef V_DEBUG\nav_log(VAR_0->avccontext, AV_LOG_INFO, \"Lookup offset %d ,\", i);",
"#endif\nfor(k=0;k<dim;++k) {",
"uint_fast32_t multiplicand_offset = lookup_offset % codebook_lookup_values;",
"codebook_setup->codevectors[j*dim+k]=codebook_multiplicands[multiplicand_offset]*codebook_delta_value+codebook_minimum_value+last;",
"if (codebook_sequence_p) {",
"last=codebook_setup->codevectors[j*dim+k];",
"}",
"lookup_offset/=codebook_lookup_values;",
"}",
"tmp_vlc_bits[j]=tmp_vlc_bits[i];",
"#ifdef V_DEBUG\nav_log(VAR_0->avccontext, AV_LOG_INFO, \"real lookup offset %d, vector: \", j);",
"for(k=0;k<dim;++k) {",
"av_log(VAR_0->avccontext, AV_LOG_INFO, \" %f \", codebook_setup->codevectors[j*dim+k]);",
"}",
"av_log(VAR_0->avccontext, AV_LOG_INFO, \"\\n\");",
"#endif\n++j;",
"}",
"}",
"if (j!=used_entries) {",
"av_log(VAR_0->avccontext, AV_LOG_ERROR, \"Bug in codevector vector building code. \\n\");",
"goto error;",
"}",
"entries=used_entries;",
"}",
"else if (codebook_setup->lookup_type>=2) {",
"av_log(VAR_0->avccontext, AV_LOG_ERROR, \"Codebook lookup type not supported. \\n\");",
"goto error;",
"}",
"if (ff_vorbis_len2vlc(tmp_vlc_bits, tmp_vlc_codes, entries)) {",
"av_log(VAR_0->avccontext, AV_LOG_ERROR, \" Invalid code lengths while generating vlcs. \\n\");",
"goto error;",
"}",
"codebook_setup->maxdepth=0;",
"for(t=0;t<entries;++t)",
"if (tmp_vlc_bits[t]>=codebook_setup->maxdepth) codebook_setup->maxdepth=tmp_vlc_bits[t];",
"if(codebook_setup->maxdepth > 3*V_NB_BITS) codebook_setup->nb_bits=V_NB_BITS2;",
"else codebook_setup->nb_bits=V_NB_BITS;",
"codebook_setup->maxdepth=(codebook_setup->maxdepth+codebook_setup->nb_bits-1)/codebook_setup->nb_bits;",
"if (init_vlc(&codebook_setup->vlc, codebook_setup->nb_bits, entries, tmp_vlc_bits, sizeof(*tmp_vlc_bits), sizeof(*tmp_vlc_bits), tmp_vlc_codes, sizeof(*tmp_vlc_codes), sizeof(*tmp_vlc_codes), INIT_VLC_LE)) {",
"av_log(VAR_0->avccontext, AV_LOG_ERROR, \" Error generating vlc tables. \\n\");",
"goto error;",
"}",
"}",
"av_free(tmp_vlc_bits);",
"av_free(tmp_vlc_codes);",
"return 0;",
"error:\nav_free(tmp_vlc_bits);",
"av_free(tmp_vlc_codes);",
"return 1;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
],
[
9
],
[
13
],
[
17
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
77
],
[
81
],
[
85
],
[
87
],
[
89
],
[
91
],
[
95
],
[
99
],
[
101
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
147
],
[
151
],
[
153
],
[
155
],
[
159
],
[
163
],
[
167
],
[
171
],
[
173
],
[
175
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
195
],
[
199
],
[
207
],
[
209
],
[
211
],
[
213
],
[
217
],
[
219
],
[
221
],
[
223
],
[
227
],
[
229
],
[
233
],
[
235
],
[
239
],
[
241
],
[
243
],
[
249
],
[
251
],
[
253
],
[
257
],
[
259
],
[
261
],
[
265,
267
],
[
269,
273
],
[
275
],
[
277
],
[
279
],
[
281
],
[
283
],
[
285
],
[
287
],
[
289
],
[
293,
295
],
[
297
],
[
299
],
[
301
],
[
303
],
[
305,
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
321
],
[
323
],
[
325
],
[
327
],
[
329
],
[
331
],
[
333
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347
],
[
349
],
[
351
],
[
355
],
[
357
],
[
361
],
[
365
],
[
367
],
[
369
],
[
371
],
[
373
],
[
377
],
[
379
],
[
381
],
[
387,
389
],
[
391
],
[
393
],
[
395
]
] |
17,466
|
static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
{
Picture *pic = NULL;
int64_t pts;
int i, display_picture_number = 0, ret;
int encoding_delay = s->max_b_frames ? s->max_b_frames
: (s->low_delay ? 0 : 1);
int flush_offset = 1;
int direct = 1;
if (pic_arg) {
pts = pic_arg->pts;
display_picture_number = s->input_picture_number++;
if (pts != AV_NOPTS_VALUE) {
if (s->user_specified_pts != AV_NOPTS_VALUE) {
int64_t last = s->user_specified_pts;
if (pts <= last) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid pts (%"PRId64") <= last (%"PRId64")\n",
pts, last);
return AVERROR(EINVAL);
}
if (!s->low_delay && display_picture_number == 1)
s->dts_delta = pts - last;
}
s->user_specified_pts = pts;
} else {
if (s->user_specified_pts != AV_NOPTS_VALUE) {
s->user_specified_pts =
pts = s->user_specified_pts + 1;
av_log(s->avctx, AV_LOG_INFO,
"Warning: AVFrame.pts=? trying to guess (%"PRId64")\n",
pts);
} else {
pts = display_picture_number;
}
}
if (!pic_arg->buf[0] ||
pic_arg->linesize[0] != s->linesize ||
pic_arg->linesize[1] != s->uvlinesize ||
pic_arg->linesize[2] != s->uvlinesize)
direct = 0;
if ((s->width & 15) || (s->height & 15))
direct = 0;
if (((intptr_t)(pic_arg->data[0])) & (STRIDE_ALIGN-1))
direct = 0;
if (s->linesize & (STRIDE_ALIGN-1))
direct = 0;
ff_dlog(s->avctx, "%d %d %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"\n", pic_arg->linesize[0],
pic_arg->linesize[1], s->linesize, s->uvlinesize);
i = ff_find_unused_picture(s->avctx, s->picture, direct);
if (i < 0)
return i;
pic = &s->picture[i];
pic->reference = 3;
if (direct) {
if ((ret = av_frame_ref(pic->f, pic_arg)) < 0)
return ret;
}
ret = alloc_picture(s, pic, direct);
if (ret < 0)
return ret;
if (!direct) {
if (pic->f->data[0] + INPLACE_OFFSET == pic_arg->data[0] &&
pic->f->data[1] + INPLACE_OFFSET == pic_arg->data[1] &&
pic->f->data[2] + INPLACE_OFFSET == pic_arg->data[2]) {
// empty
} else {
int h_chroma_shift, v_chroma_shift;
av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
&h_chroma_shift,
&v_chroma_shift);
for (i = 0; i < 3; i++) {
int src_stride = pic_arg->linesize[i];
int dst_stride = i ? s->uvlinesize : s->linesize;
int h_shift = i ? h_chroma_shift : 0;
int v_shift = i ? v_chroma_shift : 0;
int w = s->width >> h_shift;
int h = s->height >> v_shift;
uint8_t *src = pic_arg->data[i];
uint8_t *dst = pic->f->data[i];
int vpad = 16;
if ( s->codec_id == AV_CODEC_ID_MPEG2VIDEO
&& !s->progressive_sequence
&& FFALIGN(s->height, 32) - s->height > 16)
vpad = 32;
if (!s->avctx->rc_buffer_size)
dst += INPLACE_OFFSET;
if (src_stride == dst_stride)
memcpy(dst, src, src_stride * h);
else {
int h2 = h;
uint8_t *dst2 = dst;
while (h2--) {
memcpy(dst2, src, w);
dst2 += dst_stride;
src += src_stride;
}
}
if ((s->width & 15) || (s->height & (vpad-1))) {
s->mpvencdsp.draw_edges(dst, dst_stride,
w, h,
16 >> h_shift,
vpad >> v_shift,
EDGE_BOTTOM);
}
}
}
}
ret = av_frame_copy_props(pic->f, pic_arg);
if (ret < 0)
return ret;
pic->f->display_picture_number = display_picture_number;
pic->f->pts = pts; // we set this here to avoid modifying pic_arg
} else {
/* Flushing: When we have not received enough input frames,
* ensure s->input_picture[0] contains the first picture */
for (flush_offset = 0; flush_offset < encoding_delay + 1; flush_offset++)
if (s->input_picture[flush_offset])
break;
if (flush_offset <= 1)
flush_offset = 1;
else
encoding_delay = encoding_delay - flush_offset + 1;
}
/* shift buffer entries */
for (i = flush_offset; i < MAX_PICTURE_COUNT /*s->encoding_delay + 1*/; i++)
s->input_picture[i - flush_offset] = s->input_picture[i];
s->input_picture[encoding_delay] = (Picture*) pic;
return 0;
}
| true
|
FFmpeg
|
de0cd0ffc9e4b7780d0cae5f969aca4e3bdf7e48
|
static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
{
Picture *pic = NULL;
int64_t pts;
int i, display_picture_number = 0, ret;
int encoding_delay = s->max_b_frames ? s->max_b_frames
: (s->low_delay ? 0 : 1);
int flush_offset = 1;
int direct = 1;
if (pic_arg) {
pts = pic_arg->pts;
display_picture_number = s->input_picture_number++;
if (pts != AV_NOPTS_VALUE) {
if (s->user_specified_pts != AV_NOPTS_VALUE) {
int64_t last = s->user_specified_pts;
if (pts <= last) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid pts (%"PRId64") <= last (%"PRId64")\n",
pts, last);
return AVERROR(EINVAL);
}
if (!s->low_delay && display_picture_number == 1)
s->dts_delta = pts - last;
}
s->user_specified_pts = pts;
} else {
if (s->user_specified_pts != AV_NOPTS_VALUE) {
s->user_specified_pts =
pts = s->user_specified_pts + 1;
av_log(s->avctx, AV_LOG_INFO,
"Warning: AVFrame.pts=? trying to guess (%"PRId64")\n",
pts);
} else {
pts = display_picture_number;
}
}
if (!pic_arg->buf[0] ||
pic_arg->linesize[0] != s->linesize ||
pic_arg->linesize[1] != s->uvlinesize ||
pic_arg->linesize[2] != s->uvlinesize)
direct = 0;
if ((s->width & 15) || (s->height & 15))
direct = 0;
if (((intptr_t)(pic_arg->data[0])) & (STRIDE_ALIGN-1))
direct = 0;
if (s->linesize & (STRIDE_ALIGN-1))
direct = 0;
ff_dlog(s->avctx, "%d %d %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"\n", pic_arg->linesize[0],
pic_arg->linesize[1], s->linesize, s->uvlinesize);
i = ff_find_unused_picture(s->avctx, s->picture, direct);
if (i < 0)
return i;
pic = &s->picture[i];
pic->reference = 3;
if (direct) {
if ((ret = av_frame_ref(pic->f, pic_arg)) < 0)
return ret;
}
ret = alloc_picture(s, pic, direct);
if (ret < 0)
return ret;
if (!direct) {
if (pic->f->data[0] + INPLACE_OFFSET == pic_arg->data[0] &&
pic->f->data[1] + INPLACE_OFFSET == pic_arg->data[1] &&
pic->f->data[2] + INPLACE_OFFSET == pic_arg->data[2]) {
} else {
int h_chroma_shift, v_chroma_shift;
av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
&h_chroma_shift,
&v_chroma_shift);
for (i = 0; i < 3; i++) {
int src_stride = pic_arg->linesize[i];
int dst_stride = i ? s->uvlinesize : s->linesize;
int h_shift = i ? h_chroma_shift : 0;
int v_shift = i ? v_chroma_shift : 0;
int w = s->width >> h_shift;
int h = s->height >> v_shift;
uint8_t *src = pic_arg->data[i];
uint8_t *dst = pic->f->data[i];
int vpad = 16;
if ( s->codec_id == AV_CODEC_ID_MPEG2VIDEO
&& !s->progressive_sequence
&& FFALIGN(s->height, 32) - s->height > 16)
vpad = 32;
if (!s->avctx->rc_buffer_size)
dst += INPLACE_OFFSET;
if (src_stride == dst_stride)
memcpy(dst, src, src_stride * h);
else {
int h2 = h;
uint8_t *dst2 = dst;
while (h2--) {
memcpy(dst2, src, w);
dst2 += dst_stride;
src += src_stride;
}
}
if ((s->width & 15) || (s->height & (vpad-1))) {
s->mpvencdsp.draw_edges(dst, dst_stride,
w, h,
16 >> h_shift,
vpad >> v_shift,
EDGE_BOTTOM);
}
}
}
}
ret = av_frame_copy_props(pic->f, pic_arg);
if (ret < 0)
return ret;
pic->f->display_picture_number = display_picture_number;
pic->f->pts = pts;
} else {
for (flush_offset = 0; flush_offset < encoding_delay + 1; flush_offset++)
if (s->input_picture[flush_offset])
break;
if (flush_offset <= 1)
flush_offset = 1;
else
encoding_delay = encoding_delay - flush_offset + 1;
}
for (i = flush_offset; i < MAX_PICTURE_COUNT ; i++)
s->input_picture[i - flush_offset] = s->input_picture[i];
s->input_picture[encoding_delay] = (Picture*) pic;
return 0;
}
|
{
"code": [],
"line_no": []
}
|
static int FUNC_0(MpegEncContext *VAR_0, const AVFrame *VAR_1)
{
Picture *pic = NULL;
int64_t pts;
int VAR_2, VAR_3 = 0, VAR_4;
int VAR_5 = VAR_0->max_b_frames ? VAR_0->max_b_frames
: (VAR_0->low_delay ? 0 : 1);
int VAR_6 = 1;
int VAR_7 = 1;
if (VAR_1) {
pts = VAR_1->pts;
VAR_3 = VAR_0->input_picture_number++;
if (pts != AV_NOPTS_VALUE) {
if (VAR_0->user_specified_pts != AV_NOPTS_VALUE) {
int64_t last = VAR_0->user_specified_pts;
if (pts <= last) {
av_log(VAR_0->avctx, AV_LOG_ERROR,
"Invalid pts (%"PRId64") <= last (%"PRId64")\n",
pts, last);
return AVERROR(EINVAL);
}
if (!VAR_0->low_delay && VAR_3 == 1)
VAR_0->dts_delta = pts - last;
}
VAR_0->user_specified_pts = pts;
} else {
if (VAR_0->user_specified_pts != AV_NOPTS_VALUE) {
VAR_0->user_specified_pts =
pts = VAR_0->user_specified_pts + 1;
av_log(VAR_0->avctx, AV_LOG_INFO,
"Warning: AVFrame.pts=? trying to guess (%"PRId64")\n",
pts);
} else {
pts = VAR_3;
}
}
if (!VAR_1->buf[0] ||
VAR_1->linesize[0] != VAR_0->linesize ||
VAR_1->linesize[1] != VAR_0->uvlinesize ||
VAR_1->linesize[2] != VAR_0->uvlinesize)
VAR_7 = 0;
if ((VAR_0->width & 15) || (VAR_0->height & 15))
VAR_7 = 0;
if (((intptr_t)(VAR_1->data[0])) & (STRIDE_ALIGN-1))
VAR_7 = 0;
if (VAR_0->linesize & (STRIDE_ALIGN-1))
VAR_7 = 0;
ff_dlog(VAR_0->avctx, "%d %d %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"\n", VAR_1->linesize[0],
VAR_1->linesize[1], VAR_0->linesize, VAR_0->uvlinesize);
VAR_2 = ff_find_unused_picture(VAR_0->avctx, VAR_0->picture, VAR_7);
if (VAR_2 < 0)
return VAR_2;
pic = &VAR_0->picture[VAR_2];
pic->reference = 3;
if (VAR_7) {
if ((VAR_4 = av_frame_ref(pic->f, VAR_1)) < 0)
return VAR_4;
}
VAR_4 = alloc_picture(VAR_0, pic, VAR_7);
if (VAR_4 < 0)
return VAR_4;
if (!VAR_7) {
if (pic->f->data[0] + INPLACE_OFFSET == VAR_1->data[0] &&
pic->f->data[1] + INPLACE_OFFSET == VAR_1->data[1] &&
pic->f->data[2] + INPLACE_OFFSET == VAR_1->data[2]) {
} else {
int VAR_8, VAR_9;
av_pix_fmt_get_chroma_sub_sample(VAR_0->avctx->pix_fmt,
&VAR_8,
&VAR_9);
for (VAR_2 = 0; VAR_2 < 3; VAR_2++) {
int VAR_10 = VAR_1->linesize[VAR_2];
int VAR_11 = VAR_2 ? VAR_0->uvlinesize : VAR_0->linesize;
int VAR_12 = VAR_2 ? VAR_8 : 0;
int VAR_13 = VAR_2 ? VAR_9 : 0;
int VAR_14 = VAR_0->width >> VAR_12;
int VAR_15 = VAR_0->height >> VAR_13;
uint8_t *src = VAR_1->data[VAR_2];
uint8_t *dst = pic->f->data[VAR_2];
int VAR_16 = 16;
if ( VAR_0->codec_id == AV_CODEC_ID_MPEG2VIDEO
&& !VAR_0->progressive_sequence
&& FFALIGN(VAR_0->height, 32) - VAR_0->height > 16)
VAR_16 = 32;
if (!VAR_0->avctx->rc_buffer_size)
dst += INPLACE_OFFSET;
if (VAR_10 == VAR_11)
memcpy(dst, src, VAR_10 * VAR_15);
else {
int VAR_17 = VAR_15;
uint8_t *dst2 = dst;
while (VAR_17--) {
memcpy(dst2, src, VAR_14);
dst2 += VAR_11;
src += VAR_10;
}
}
if ((VAR_0->width & 15) || (VAR_0->height & (VAR_16-1))) {
VAR_0->mpvencdsp.draw_edges(dst, VAR_11,
VAR_14, VAR_15,
16 >> VAR_12,
VAR_16 >> VAR_13,
EDGE_BOTTOM);
}
}
}
}
VAR_4 = av_frame_copy_props(pic->f, VAR_1);
if (VAR_4 < 0)
return VAR_4;
pic->f->VAR_3 = VAR_3;
pic->f->pts = pts;
} else {
for (VAR_6 = 0; VAR_6 < VAR_5 + 1; VAR_6++)
if (VAR_0->input_picture[VAR_6])
break;
if (VAR_6 <= 1)
VAR_6 = 1;
else
VAR_5 = VAR_5 - VAR_6 + 1;
}
for (VAR_2 = VAR_6; VAR_2 < MAX_PICTURE_COUNT ; VAR_2++)
VAR_0->input_picture[VAR_2 - VAR_6] = VAR_0->input_picture[VAR_2];
VAR_0->input_picture[VAR_5] = (Picture*) pic;
return 0;
}
|
[
"static int FUNC_0(MpegEncContext *VAR_0, const AVFrame *VAR_1)\n{",
"Picture *pic = NULL;",
"int64_t pts;",
"int VAR_2, VAR_3 = 0, VAR_4;",
"int VAR_5 = VAR_0->max_b_frames ? VAR_0->max_b_frames\n: (VAR_0->low_delay ? 0 : 1);",
"int VAR_6 = 1;",
"int VAR_7 = 1;",
"if (VAR_1) {",
"pts = VAR_1->pts;",
"VAR_3 = VAR_0->input_picture_number++;",
"if (pts != AV_NOPTS_VALUE) {",
"if (VAR_0->user_specified_pts != AV_NOPTS_VALUE) {",
"int64_t last = VAR_0->user_specified_pts;",
"if (pts <= last) {",
"av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Invalid pts (%\"PRId64\") <= last (%\"PRId64\")\\n\",\npts, last);",
"return AVERROR(EINVAL);",
"}",
"if (!VAR_0->low_delay && VAR_3 == 1)\nVAR_0->dts_delta = pts - last;",
"}",
"VAR_0->user_specified_pts = pts;",
"} else {",
"if (VAR_0->user_specified_pts != AV_NOPTS_VALUE) {",
"VAR_0->user_specified_pts =\npts = VAR_0->user_specified_pts + 1;",
"av_log(VAR_0->avctx, AV_LOG_INFO,\n\"Warning: AVFrame.pts=? trying to guess (%\"PRId64\")\\n\",\npts);",
"} else {",
"pts = VAR_3;",
"}",
"}",
"if (!VAR_1->buf[0] ||\nVAR_1->linesize[0] != VAR_0->linesize ||\nVAR_1->linesize[1] != VAR_0->uvlinesize ||\nVAR_1->linesize[2] != VAR_0->uvlinesize)\nVAR_7 = 0;",
"if ((VAR_0->width & 15) || (VAR_0->height & 15))\nVAR_7 = 0;",
"if (((intptr_t)(VAR_1->data[0])) & (STRIDE_ALIGN-1))\nVAR_7 = 0;",
"if (VAR_0->linesize & (STRIDE_ALIGN-1))\nVAR_7 = 0;",
"ff_dlog(VAR_0->avctx, \"%d %d %\"PTRDIFF_SPECIFIER\" %\"PTRDIFF_SPECIFIER\"\\n\", VAR_1->linesize[0],\nVAR_1->linesize[1], VAR_0->linesize, VAR_0->uvlinesize);",
"VAR_2 = ff_find_unused_picture(VAR_0->avctx, VAR_0->picture, VAR_7);",
"if (VAR_2 < 0)\nreturn VAR_2;",
"pic = &VAR_0->picture[VAR_2];",
"pic->reference = 3;",
"if (VAR_7) {",
"if ((VAR_4 = av_frame_ref(pic->f, VAR_1)) < 0)\nreturn VAR_4;",
"}",
"VAR_4 = alloc_picture(VAR_0, pic, VAR_7);",
"if (VAR_4 < 0)\nreturn VAR_4;",
"if (!VAR_7) {",
"if (pic->f->data[0] + INPLACE_OFFSET == VAR_1->data[0] &&\npic->f->data[1] + INPLACE_OFFSET == VAR_1->data[1] &&\npic->f->data[2] + INPLACE_OFFSET == VAR_1->data[2]) {",
"} else {",
"int VAR_8, VAR_9;",
"av_pix_fmt_get_chroma_sub_sample(VAR_0->avctx->pix_fmt,\n&VAR_8,\n&VAR_9);",
"for (VAR_2 = 0; VAR_2 < 3; VAR_2++) {",
"int VAR_10 = VAR_1->linesize[VAR_2];",
"int VAR_11 = VAR_2 ? VAR_0->uvlinesize : VAR_0->linesize;",
"int VAR_12 = VAR_2 ? VAR_8 : 0;",
"int VAR_13 = VAR_2 ? VAR_9 : 0;",
"int VAR_14 = VAR_0->width >> VAR_12;",
"int VAR_15 = VAR_0->height >> VAR_13;",
"uint8_t *src = VAR_1->data[VAR_2];",
"uint8_t *dst = pic->f->data[VAR_2];",
"int VAR_16 = 16;",
"if ( VAR_0->codec_id == AV_CODEC_ID_MPEG2VIDEO\n&& !VAR_0->progressive_sequence\n&& FFALIGN(VAR_0->height, 32) - VAR_0->height > 16)\nVAR_16 = 32;",
"if (!VAR_0->avctx->rc_buffer_size)\ndst += INPLACE_OFFSET;",
"if (VAR_10 == VAR_11)\nmemcpy(dst, src, VAR_10 * VAR_15);",
"else {",
"int VAR_17 = VAR_15;",
"uint8_t *dst2 = dst;",
"while (VAR_17--) {",
"memcpy(dst2, src, VAR_14);",
"dst2 += VAR_11;",
"src += VAR_10;",
"}",
"}",
"if ((VAR_0->width & 15) || (VAR_0->height & (VAR_16-1))) {",
"VAR_0->mpvencdsp.draw_edges(dst, VAR_11,\nVAR_14, VAR_15,\n16 >> VAR_12,\nVAR_16 >> VAR_13,\nEDGE_BOTTOM);",
"}",
"}",
"}",
"}",
"VAR_4 = av_frame_copy_props(pic->f, VAR_1);",
"if (VAR_4 < 0)\nreturn VAR_4;",
"pic->f->VAR_3 = VAR_3;",
"pic->f->pts = pts;",
"} else {",
"for (VAR_6 = 0; VAR_6 < VAR_5 + 1; VAR_6++)",
"if (VAR_0->input_picture[VAR_6])\nbreak;",
"if (VAR_6 <= 1)\nVAR_6 = 1;",
"else\nVAR_5 = VAR_5 - VAR_6 + 1;",
"}",
"for (VAR_2 = VAR_6; VAR_2 < MAX_PICTURE_COUNT ; VAR_2++)",
"VAR_0->input_picture[VAR_2 - VAR_6] = VAR_0->input_picture[VAR_2];",
"VAR_0->input_picture[VAR_5] = (Picture*) pic;",
"return 0;",
"}"
] |
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] |
[
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11,
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39,
41,
43
],
[
45
],
[
47
],
[
51,
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63,
65
],
[
67,
69,
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
83,
85,
87,
89,
91
],
[
93,
95
],
[
97,
99
],
[
101,
103
],
[
107,
109
],
[
113
],
[
115,
117
],
[
121
],
[
123
],
[
127
],
[
129,
131
],
[
133
],
[
135
],
[
137,
139
],
[
143
],
[
145,
147,
149
],
[
153
],
[
155
],
[
157,
159,
161
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
187,
189,
191,
193
],
[
197,
199
],
[
203,
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227,
229,
231,
233,
235
],
[
237
],
[
239
],
[
242
],
[
244
],
[
246
],
[
248,
250
],
[
254
],
[
256
],
[
258
],
[
264
],
[
266,
268
],
[
272,
274
],
[
276,
278
],
[
280
],
[
286
],
[
288
],
[
292
],
[
296
],
[
298
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.