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
13,216
static int dnxhd_init_vlc(DNXHDContext *ctx, int cid) { if (cid != ctx->cid) { int index; if ((index = ff_dnxhd_get_cid_table(cid)) < 0) { av_log(ctx->avctx, AV_LOG_ERROR, "unsupported cid %d\n", cid); return -1; } if (ff_dnxhd_cid_table[index].bit_depth != ctx->bit_depth) { av_log(ctx->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n", ff_dnxhd_cid_table[index].bit_depth, ctx->bit_depth); return AVERROR_INVALIDDATA; } ctx->cid_table = &ff_dnxhd_cid_table[index]; ff_free_vlc(&ctx->ac_vlc); ff_free_vlc(&ctx->dc_vlc); ff_free_vlc(&ctx->run_vlc); init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257, ctx->cid_table->ac_bits, 1, 1, ctx->cid_table->ac_codes, 2, 2, 0); init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, ctx->bit_depth + 4, ctx->cid_table->dc_bits, 1, 1, ctx->cid_table->dc_codes, 1, 1, 0); init_vlc(&ctx->run_vlc, DNXHD_VLC_BITS, 62, ctx->cid_table->run_bits, 1, 1, ctx->cid_table->run_codes, 2, 2, 0); ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, ff_zigzag_direct); ctx->cid = cid; } return 0; }
true
FFmpeg
a99c273a3f91c3fd616b718c34a5848411ce0258
static int dnxhd_init_vlc(DNXHDContext *ctx, int cid) { if (cid != ctx->cid) { int index; if ((index = ff_dnxhd_get_cid_table(cid)) < 0) { av_log(ctx->avctx, AV_LOG_ERROR, "unsupported cid %d\n", cid); return -1; } if (ff_dnxhd_cid_table[index].bit_depth != ctx->bit_depth) { av_log(ctx->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n", ff_dnxhd_cid_table[index].bit_depth, ctx->bit_depth); return AVERROR_INVALIDDATA; } ctx->cid_table = &ff_dnxhd_cid_table[index]; ff_free_vlc(&ctx->ac_vlc); ff_free_vlc(&ctx->dc_vlc); ff_free_vlc(&ctx->run_vlc); init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257, ctx->cid_table->ac_bits, 1, 1, ctx->cid_table->ac_codes, 2, 2, 0); init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, ctx->bit_depth + 4, ctx->cid_table->dc_bits, 1, 1, ctx->cid_table->dc_codes, 1, 1, 0); init_vlc(&ctx->run_vlc, DNXHD_VLC_BITS, 62, ctx->cid_table->run_bits, 1, 1, ctx->cid_table->run_codes, 2, 2, 0); ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, ff_zigzag_direct); ctx->cid = cid; } return 0; }
{ "code": [ "static int dnxhd_init_vlc(DNXHDContext *ctx, int cid)" ], "line_no": [ 1 ] }
static int FUNC_0(DNXHDContext *VAR_0, int VAR_1) { if (VAR_1 != VAR_0->VAR_1) { int VAR_2; if ((VAR_2 = ff_dnxhd_get_cid_table(VAR_1)) < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "unsupported VAR_1 %d\n", VAR_1); return -1; } if (ff_dnxhd_cid_table[VAR_2].bit_depth != VAR_0->bit_depth) { av_log(VAR_0->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n", ff_dnxhd_cid_table[VAR_2].bit_depth, VAR_0->bit_depth); return AVERROR_INVALIDDATA; } VAR_0->cid_table = &ff_dnxhd_cid_table[VAR_2]; ff_free_vlc(&VAR_0->ac_vlc); ff_free_vlc(&VAR_0->dc_vlc); ff_free_vlc(&VAR_0->run_vlc); init_vlc(&VAR_0->ac_vlc, DNXHD_VLC_BITS, 257, VAR_0->cid_table->ac_bits, 1, 1, VAR_0->cid_table->ac_codes, 2, 2, 0); init_vlc(&VAR_0->dc_vlc, DNXHD_DC_VLC_BITS, VAR_0->bit_depth + 4, VAR_0->cid_table->dc_bits, 1, 1, VAR_0->cid_table->dc_codes, 1, 1, 0); init_vlc(&VAR_0->run_vlc, DNXHD_VLC_BITS, 62, VAR_0->cid_table->run_bits, 1, 1, VAR_0->cid_table->run_codes, 2, 2, 0); ff_init_scantable(VAR_0->dsp.idct_permutation, &VAR_0->scantable, ff_zigzag_direct); VAR_0->VAR_1 = VAR_1; } return 0; }
[ "static int FUNC_0(DNXHDContext *VAR_0, int VAR_1)\n{", "if (VAR_1 != VAR_0->VAR_1) {", "int VAR_2;", "if ((VAR_2 = ff_dnxhd_get_cid_table(VAR_1)) < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"unsupported VAR_1 %d\\n\", VAR_1);", "return -1;", "}", "if (ff_dnxhd_cid_table[VAR_2].bit_depth != VAR_0->bit_depth) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"bit depth mismatches %d %d\\n\", ff_dnxhd_cid_table[VAR_2].bit_depth, VAR_0->bit_depth);", "return AVERROR_INVALIDDATA;", "}", "VAR_0->cid_table = &ff_dnxhd_cid_table[VAR_2];", "ff_free_vlc(&VAR_0->ac_vlc);", "ff_free_vlc(&VAR_0->dc_vlc);", "ff_free_vlc(&VAR_0->run_vlc);", "init_vlc(&VAR_0->ac_vlc, DNXHD_VLC_BITS, 257,\nVAR_0->cid_table->ac_bits, 1, 1,\nVAR_0->cid_table->ac_codes, 2, 2, 0);", "init_vlc(&VAR_0->dc_vlc, DNXHD_DC_VLC_BITS, VAR_0->bit_depth + 4,\nVAR_0->cid_table->dc_bits, 1, 1,\nVAR_0->cid_table->dc_codes, 1, 1, 0);", "init_vlc(&VAR_0->run_vlc, DNXHD_VLC_BITS, 62,\nVAR_0->cid_table->run_bits, 1, 1,\nVAR_0->cid_table->run_codes, 2, 2, 0);", "ff_init_scantable(VAR_0->dsp.idct_permutation, &VAR_0->scantable, ff_zigzag_direct);", "VAR_0->VAR_1 = VAR_1;", "}", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41, 43 ], [ 45, 47, 49 ], [ 51, 53, 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ] ]
13,217
static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_codecid) { AVCodecContext *vcodec = vstream->codec; switch(flv_codecid) { case FLV_CODECID_H263 : vcodec->codec_id = CODEC_ID_FLV1 ; break; case FLV_CODECID_REALH263: vcodec->codec_id = CODEC_ID_H263 ; break; // Really mean it this time case FLV_CODECID_SCREEN: vcodec->codec_id = CODEC_ID_FLASHSV; break; case FLV_CODECID_SCREEN2: vcodec->codec_id = CODEC_ID_FLASHSV2; break; case FLV_CODECID_VP6 : vcodec->codec_id = CODEC_ID_VP6F ; case FLV_CODECID_VP6A : if(flv_codecid == FLV_CODECID_VP6A) vcodec->codec_id = CODEC_ID_VP6A; if(vcodec->extradata_size != 1) { vcodec->extradata_size = 1; vcodec->extradata = av_malloc(1); } vcodec->extradata[0] = avio_r8(s->pb); return 1; // 1 byte body size adjustment for flv_read_packet() case FLV_CODECID_H264: vcodec->codec_id = CODEC_ID_H264; return 3; // not 4, reading packet type will consume one byte case FLV_CODECID_MPEG4: vcodec->codec_id = CODEC_ID_MPEG4; return 3; default: av_log(s, AV_LOG_INFO, "Unsupported video codec (%x)\n", flv_codecid); vcodec->codec_tag = flv_codecid; } return 0; }
true
FFmpeg
c4ce8709676a6f0b41761093b0da08de72799ba9
static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_codecid) { AVCodecContext *vcodec = vstream->codec; switch(flv_codecid) { case FLV_CODECID_H263 : vcodec->codec_id = CODEC_ID_FLV1 ; break; case FLV_CODECID_REALH263: vcodec->codec_id = CODEC_ID_H263 ; break; case FLV_CODECID_SCREEN: vcodec->codec_id = CODEC_ID_FLASHSV; break; case FLV_CODECID_SCREEN2: vcodec->codec_id = CODEC_ID_FLASHSV2; break; case FLV_CODECID_VP6 : vcodec->codec_id = CODEC_ID_VP6F ; case FLV_CODECID_VP6A : if(flv_codecid == FLV_CODECID_VP6A) vcodec->codec_id = CODEC_ID_VP6A; if(vcodec->extradata_size != 1) { vcodec->extradata_size = 1; vcodec->extradata = av_malloc(1); } vcodec->extradata[0] = avio_r8(s->pb); return 1; case FLV_CODECID_H264: vcodec->codec_id = CODEC_ID_H264; return 3; case FLV_CODECID_MPEG4: vcodec->codec_id = CODEC_ID_MPEG4; return 3; default: av_log(s, AV_LOG_INFO, "Unsupported video codec (%x)\n", flv_codecid); vcodec->codec_tag = flv_codecid; } return 0; }
{ "code": [ " vcodec->extradata = av_malloc(1);" ], "line_no": [ 27 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, int VAR_2) { AVCodecContext *vcodec = VAR_1->codec; switch(VAR_2) { case FLV_CODECID_H263 : vcodec->codec_id = CODEC_ID_FLV1 ; break; case FLV_CODECID_REALH263: vcodec->codec_id = CODEC_ID_H263 ; break; case FLV_CODECID_SCREEN: vcodec->codec_id = CODEC_ID_FLASHSV; break; case FLV_CODECID_SCREEN2: vcodec->codec_id = CODEC_ID_FLASHSV2; break; case FLV_CODECID_VP6 : vcodec->codec_id = CODEC_ID_VP6F ; case FLV_CODECID_VP6A : if(VAR_2 == FLV_CODECID_VP6A) vcodec->codec_id = CODEC_ID_VP6A; if(vcodec->extradata_size != 1) { vcodec->extradata_size = 1; vcodec->extradata = av_malloc(1); } vcodec->extradata[0] = avio_r8(VAR_0->pb); return 1; case FLV_CODECID_H264: vcodec->codec_id = CODEC_ID_H264; return 3; case FLV_CODECID_MPEG4: vcodec->codec_id = CODEC_ID_MPEG4; return 3; default: av_log(VAR_0, AV_LOG_INFO, "Unsupported video codec (%x)\n", VAR_2); vcodec->codec_tag = VAR_2; } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, int VAR_2) {", "AVCodecContext *vcodec = VAR_1->codec;", "switch(VAR_2) {", "case FLV_CODECID_H263 : vcodec->codec_id = CODEC_ID_FLV1 ; break;", "case FLV_CODECID_REALH263: vcodec->codec_id = CODEC_ID_H263 ; break;", "case FLV_CODECID_SCREEN: vcodec->codec_id = CODEC_ID_FLASHSV; break;", "case FLV_CODECID_SCREEN2: vcodec->codec_id = CODEC_ID_FLASHSV2; break;", "case FLV_CODECID_VP6 : vcodec->codec_id = CODEC_ID_VP6F ;", "case FLV_CODECID_VP6A :\nif(VAR_2 == FLV_CODECID_VP6A)\nvcodec->codec_id = CODEC_ID_VP6A;", "if(vcodec->extradata_size != 1) {", "vcodec->extradata_size = 1;", "vcodec->extradata = av_malloc(1);", "}", "vcodec->extradata[0] = avio_r8(VAR_0->pb);", "return 1;", "case FLV_CODECID_H264:\nvcodec->codec_id = CODEC_ID_H264;", "return 3;", "case FLV_CODECID_MPEG4:\nvcodec->codec_id = CODEC_ID_MPEG4;", "return 3;", "default:\nav_log(VAR_0, AV_LOG_INFO, \"Unsupported video codec (%x)\\n\", VAR_2);", "vcodec->codec_tag = VAR_2;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ] ]
13,218
static void vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride, int mode, int rnd) { int i, j; uint8_t tmp[8*11], *tptr; int m, r; m = (mode & 3); r = rnd; src -= stride; tptr = tmp; for(j = 0; j < 11; j++) { for(i = 0; i < 8; i++) tptr[i] = vc1_mspel_filter(src + i, 1, m, r); src += stride; tptr += 8; } r = 1 - rnd; m = (mode >> 2) & 3; tptr = tmp + 8; for(j = 0; j < 8; j++) { for(i = 0; i < 8; i++) dst[i] = vc1_mspel_filter(tptr + i, 8, m, r); dst += stride; tptr += 8; } }
true
FFmpeg
a70c27e813346a11e5fff3d329ecba82fb76826a
static void vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride, int mode, int rnd) { int i, j; uint8_t tmp[8*11], *tptr; int m, r; m = (mode & 3); r = rnd; src -= stride; tptr = tmp; for(j = 0; j < 11; j++) { for(i = 0; i < 8; i++) tptr[i] = vc1_mspel_filter(src + i, 1, m, r); src += stride; tptr += 8; } r = 1 - rnd; m = (mode >> 2) & 3; tptr = tmp + 8; for(j = 0; j < 8; j++) { for(i = 0; i < 8; i++) dst[i] = vc1_mspel_filter(tptr + i, 8, m, r); dst += stride; tptr += 8; } }
{ "code": [ " tptr[i] = vc1_mspel_filter(src + i, 1, m, r);", " dst[i] = vc1_mspel_filter(tptr + i, 8, m, r);" ], "line_no": [ 25, 45 ] }
static void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3, int VAR_4) { int VAR_5, VAR_6; uint8_t tmp[8*11], *tptr; int VAR_7, VAR_8; VAR_7 = (VAR_3 & 3); VAR_8 = VAR_4; VAR_1 -= VAR_2; tptr = tmp; for(VAR_6 = 0; VAR_6 < 11; VAR_6++) { for(VAR_5 = 0; VAR_5 < 8; VAR_5++) tptr[VAR_5] = vc1_mspel_filter(VAR_1 + VAR_5, 1, VAR_7, VAR_8); VAR_1 += VAR_2; tptr += 8; } VAR_8 = 1 - VAR_4; VAR_7 = (VAR_3 >> 2) & 3; tptr = tmp + 8; for(VAR_6 = 0; VAR_6 < 8; VAR_6++) { for(VAR_5 = 0; VAR_5 < 8; VAR_5++) VAR_0[VAR_5] = vc1_mspel_filter(tptr + VAR_5, 8, VAR_7, VAR_8); VAR_0 += VAR_2; tptr += 8; } }
[ "static void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6;", "uint8_t tmp[8*11], *tptr;", "int VAR_7, VAR_8;", "VAR_7 = (VAR_3 & 3);", "VAR_8 = VAR_4;", "VAR_1 -= VAR_2;", "tptr = tmp;", "for(VAR_6 = 0; VAR_6 < 11; VAR_6++) {", "for(VAR_5 = 0; VAR_5 < 8; VAR_5++)", "tptr[VAR_5] = vc1_mspel_filter(VAR_1 + VAR_5, 1, VAR_7, VAR_8);", "VAR_1 += VAR_2;", "tptr += 8;", "}", "VAR_8 = 1 - VAR_4;", "VAR_7 = (VAR_3 >> 2) & 3;", "tptr = tmp + 8;", "for(VAR_6 = 0; VAR_6 < 8; VAR_6++) {", "for(VAR_5 = 0; VAR_5 < 8; VAR_5++)", "VAR_0[VAR_5] = vc1_mspel_filter(tptr + VAR_5, 8, VAR_7, VAR_8);", "VAR_0 += VAR_2;", "tptr += 8;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
13,219
static av_cold int bfi_decode_init(AVCodecContext *avctx) { BFIContext *bfi = avctx->priv_data; avctx->pix_fmt = AV_PIX_FMT_PAL8; bfi->dst = av_mallocz(avctx->width * avctx->height); return 0; }
true
FFmpeg
1a3d142f1f1e65f554cba84d8a515684ecb390d0
static av_cold int bfi_decode_init(AVCodecContext *avctx) { BFIContext *bfi = avctx->priv_data; avctx->pix_fmt = AV_PIX_FMT_PAL8; bfi->dst = av_mallocz(avctx->width * avctx->height); return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { BFIContext *bfi = avctx->priv_data; avctx->pix_fmt = AV_PIX_FMT_PAL8; bfi->dst = av_mallocz(avctx->width * avctx->height); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "BFIContext *bfi = avctx->priv_data;", "avctx->pix_fmt = AV_PIX_FMT_PAL8;", "bfi->dst = av_mallocz(avctx->width * avctx->height);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ] ]
13,220
static void vmxnet3_set_events(VMXNET3State *s, uint32_t val) { uint32_t events; VMW_CBPRN("Setting events: 0x%x", val); events = VMXNET3_READ_DRV_SHARED32(s->drv_shmem, ecr) | val; VMXNET3_WRITE_DRV_SHARED32(s->drv_shmem, ecr, events); }
true
qemu
c508277335e3b6b20cf18e6ea3a35c1fa835c64a
static void vmxnet3_set_events(VMXNET3State *s, uint32_t val) { uint32_t events; VMW_CBPRN("Setting events: 0x%x", val); events = VMXNET3_READ_DRV_SHARED32(s->drv_shmem, ecr) | val; VMXNET3_WRITE_DRV_SHARED32(s->drv_shmem, ecr, events); }
{ "code": [ " events = VMXNET3_READ_DRV_SHARED32(s->drv_shmem, ecr) | val;", " VMXNET3_WRITE_DRV_SHARED32(s->drv_shmem, ecr, events);", " VMXNET3_WRITE_DRV_SHARED32(s->drv_shmem, ecr, events);" ], "line_no": [ 11, 13, 13 ] }
static void FUNC_0(VMXNET3State *VAR_0, uint32_t VAR_1) { uint32_t events; VMW_CBPRN("Setting events: 0x%x", VAR_1); events = VMXNET3_READ_DRV_SHARED32(VAR_0->drv_shmem, ecr) | VAR_1; VMXNET3_WRITE_DRV_SHARED32(VAR_0->drv_shmem, ecr, events); }
[ "static void FUNC_0(VMXNET3State *VAR_0, uint32_t VAR_1)\n{", "uint32_t events;", "VMW_CBPRN(\"Setting events: 0x%x\", VAR_1);", "events = VMXNET3_READ_DRV_SHARED32(VAR_0->drv_shmem, ecr) | VAR_1;", "VMXNET3_WRITE_DRV_SHARED32(VAR_0->drv_shmem, ecr, events);", "}" ]
[ 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
13,221
static int qemu_rbd_send_pipe(BDRVRBDState *s, RADOSCB *rcb) { int ret = 0; while (1) { fd_set wfd; int fd = s->fds[RBD_FD_WRITE]; /* send the op pointer to the qemu thread that is responsible for the aio/op completion. Must do it in a qemu thread context */ ret = write(fd, (void *)&rcb, sizeof(rcb)); if (ret >= 0) { break; } if (errno == EINTR) { continue; } if (errno != EAGAIN) { break; } FD_ZERO(&wfd); FD_SET(fd, &wfd); do { ret = select(fd + 1, NULL, &wfd, NULL, NULL); } while (ret < 0 && errno == EINTR); } return ret; }
true
qemu
e04fb07fd1676e9facd7f3f878c1bbe03bccd26b
static int qemu_rbd_send_pipe(BDRVRBDState *s, RADOSCB *rcb) { int ret = 0; while (1) { fd_set wfd; int fd = s->fds[RBD_FD_WRITE]; ret = write(fd, (void *)&rcb, sizeof(rcb)); if (ret >= 0) { break; } if (errno == EINTR) { continue; } if (errno != EAGAIN) { break; } FD_ZERO(&wfd); FD_SET(fd, &wfd); do { ret = select(fd + 1, NULL, &wfd, NULL, NULL); } while (ret < 0 && errno == EINTR); } return ret; }
{ "code": [ "static int qemu_rbd_send_pipe(BDRVRBDState *s, RADOSCB *rcb)", " int ret = 0;", " while (1) {", " fd_set wfd;", " int fd = s->fds[RBD_FD_WRITE];", " ret = write(fd, (void *)&rcb, sizeof(rcb));", " if (ret >= 0) {", " break;", " if (errno == EINTR) {", " continue;", " if (errno != EAGAIN) {", " break;", " FD_ZERO(&wfd);", " FD_SET(fd, &wfd);", " do {", " ret = select(fd + 1, NULL, &wfd, NULL, NULL);", " } while (ret < 0 && errno == EINTR);", " return ret;" ], "line_no": [ 1, 5, 7, 9, 11, 19, 21, 23, 27, 29, 33, 23, 41, 43, 45, 47, 49, 55 ] }
static int FUNC_0(BDRVRBDState *VAR_0, RADOSCB *VAR_1) { int VAR_2 = 0; while (1) { fd_set wfd; int VAR_3 = VAR_0->fds[RBD_FD_WRITE]; VAR_2 = write(VAR_3, (void *)&VAR_1, sizeof(VAR_1)); if (VAR_2 >= 0) { break; } if (errno == EINTR) { continue; } if (errno != EAGAIN) { break; } FD_ZERO(&wfd); FD_SET(VAR_3, &wfd); do { VAR_2 = select(VAR_3 + 1, NULL, &wfd, NULL, NULL); } while (VAR_2 < 0 && errno == EINTR); } return VAR_2; }
[ "static int FUNC_0(BDRVRBDState *VAR_0, RADOSCB *VAR_1)\n{", "int VAR_2 = 0;", "while (1) {", "fd_set wfd;", "int VAR_3 = VAR_0->fds[RBD_FD_WRITE];", "VAR_2 = write(VAR_3, (void *)&VAR_1, sizeof(VAR_1));", "if (VAR_2 >= 0) {", "break;", "}", "if (errno == EINTR) {", "continue;", "}", "if (errno != EAGAIN) {", "break;", "}", "FD_ZERO(&wfd);", "FD_SET(VAR_3, &wfd);", "do {", "VAR_2 = select(VAR_3 + 1, NULL, &wfd, NULL, NULL);", "} while (VAR_2 < 0 && errno == EINTR);", "}", "return VAR_2;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ] ]
13,222
static void tcx_init(target_phys_addr_t addr, int vram_size, int width, int height, int depth) { DeviceState *dev; SysBusDevice *s; dev = qdev_create(NULL, "SUNW,tcx"); qdev_prop_set_taddr(dev, "addr", addr); qdev_prop_set_uint32(dev, "vram_size", vram_size); qdev_prop_set_uint16(dev, "width", width); qdev_prop_set_uint16(dev, "height", height); qdev_prop_set_uint16(dev, "depth", depth); qdev_init(dev); s = sysbus_from_qdev(dev); /* 8-bit plane */ sysbus_mmio_map(s, 0, addr + 0x00800000ULL); /* DAC */ sysbus_mmio_map(s, 1, addr + 0x00200000ULL); /* TEC (dummy) */ sysbus_mmio_map(s, 2, addr + 0x00700000ULL); /* THC 24 bit: NetBSD writes here even with 8-bit display: dummy */ sysbus_mmio_map(s, 3, addr + 0x00301000ULL); if (depth == 24) { /* 24-bit plane */ sysbus_mmio_map(s, 4, addr + 0x02000000ULL); /* Control plane */ sysbus_mmio_map(s, 5, addr + 0x0a000000ULL); } else { /* THC 8 bit (dummy) */ sysbus_mmio_map(s, 4, addr + 0x00300000ULL); } }
true
qemu
e23a1b33b53d25510320b26d9f154e19c6c99725
static void tcx_init(target_phys_addr_t addr, int vram_size, int width, int height, int depth) { DeviceState *dev; SysBusDevice *s; dev = qdev_create(NULL, "SUNW,tcx"); qdev_prop_set_taddr(dev, "addr", addr); qdev_prop_set_uint32(dev, "vram_size", vram_size); qdev_prop_set_uint16(dev, "width", width); qdev_prop_set_uint16(dev, "height", height); qdev_prop_set_uint16(dev, "depth", depth); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, addr + 0x00800000ULL); sysbus_mmio_map(s, 1, addr + 0x00200000ULL); sysbus_mmio_map(s, 2, addr + 0x00700000ULL); sysbus_mmio_map(s, 3, addr + 0x00301000ULL); if (depth == 24) { sysbus_mmio_map(s, 4, addr + 0x02000000ULL); sysbus_mmio_map(s, 5, addr + 0x0a000000ULL); } else { sysbus_mmio_map(s, 4, addr + 0x00300000ULL); } }
{ "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": [ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25 ] }
static void FUNC_0(target_phys_addr_t VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4) { DeviceState *dev; SysBusDevice *s; dev = qdev_create(NULL, "SUNW,tcx"); qdev_prop_set_taddr(dev, "VAR_0", VAR_0); qdev_prop_set_uint32(dev, "VAR_1", VAR_1); qdev_prop_set_uint16(dev, "VAR_2", VAR_2); qdev_prop_set_uint16(dev, "VAR_3", VAR_3); qdev_prop_set_uint16(dev, "VAR_4", VAR_4); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, VAR_0 + 0x00800000ULL); sysbus_mmio_map(s, 1, VAR_0 + 0x00200000ULL); sysbus_mmio_map(s, 2, VAR_0 + 0x00700000ULL); sysbus_mmio_map(s, 3, VAR_0 + 0x00301000ULL); if (VAR_4 == 24) { sysbus_mmio_map(s, 4, VAR_0 + 0x02000000ULL); sysbus_mmio_map(s, 5, VAR_0 + 0x0a000000ULL); } else { sysbus_mmio_map(s, 4, VAR_0 + 0x00300000ULL); } }
[ "static void FUNC_0(target_phys_addr_t VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4)\n{", "DeviceState *dev;", "SysBusDevice *s;", "dev = qdev_create(NULL, \"SUNW,tcx\");", "qdev_prop_set_taddr(dev, \"VAR_0\", VAR_0);", "qdev_prop_set_uint32(dev, \"VAR_1\", VAR_1);", "qdev_prop_set_uint16(dev, \"VAR_2\", VAR_2);", "qdev_prop_set_uint16(dev, \"VAR_3\", VAR_3);", "qdev_prop_set_uint16(dev, \"VAR_4\", VAR_4);", "qdev_init(dev);", "s = sysbus_from_qdev(dev);", "sysbus_mmio_map(s, 0, VAR_0 + 0x00800000ULL);", "sysbus_mmio_map(s, 1, VAR_0 + 0x00200000ULL);", "sysbus_mmio_map(s, 2, VAR_0 + 0x00700000ULL);", "sysbus_mmio_map(s, 3, VAR_0 + 0x00301000ULL);", "if (VAR_4 == 24) {", "sysbus_mmio_map(s, 4, VAR_0 + 0x02000000ULL);", "sysbus_mmio_map(s, 5, VAR_0 + 0x0a000000ULL);", "} else {", "sysbus_mmio_map(s, 4, VAR_0 + 0x00300000ULL);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 39 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ] ]
13,224
int kvm_init_vcpu(CPUState *env) { KVMState *s = kvm_state; long mmap_size; int ret; DPRINTF("kvm_init_vcpu\n"); ret = kvm_vm_ioctl(s, KVM_CREATE_VCPU, env->cpu_index); if (ret < 0) { DPRINTF("kvm_create_vcpu failed\n"); goto err; } env->kvm_fd = ret; env->kvm_state = s; mmap_size = kvm_ioctl(s, KVM_GET_VCPU_MMAP_SIZE, 0); if (mmap_size < 0) { DPRINTF("KVM_GET_VCPU_MMAP_SIZE failed\n"); goto err; } env->kvm_run = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, env->kvm_fd, 0); if (env->kvm_run == MAP_FAILED) { ret = -errno; DPRINTF("mmap'ing vcpu state failed\n"); goto err; } #ifdef KVM_CAP_COALESCED_MMIO if (s->coalesced_mmio && !s->coalesced_mmio_ring) { s->coalesced_mmio_ring = (void *)env->kvm_run + s->coalesced_mmio * PAGE_SIZE; } #endif ret = kvm_arch_init_vcpu(env); if (ret == 0) { qemu_register_reset(kvm_reset_vcpu, env); kvm_arch_reset_vcpu(env); } err: return ret; }
true
qemu
94a8d39afd8ccfdbf578af04c3385fdb5f545af1
int kvm_init_vcpu(CPUState *env) { KVMState *s = kvm_state; long mmap_size; int ret; DPRINTF("kvm_init_vcpu\n"); ret = kvm_vm_ioctl(s, KVM_CREATE_VCPU, env->cpu_index); if (ret < 0) { DPRINTF("kvm_create_vcpu failed\n"); goto err; } env->kvm_fd = ret; env->kvm_state = s; mmap_size = kvm_ioctl(s, KVM_GET_VCPU_MMAP_SIZE, 0); if (mmap_size < 0) { DPRINTF("KVM_GET_VCPU_MMAP_SIZE failed\n"); goto err; } env->kvm_run = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, env->kvm_fd, 0); if (env->kvm_run == MAP_FAILED) { ret = -errno; DPRINTF("mmap'ing vcpu state failed\n"); goto err; } #ifdef KVM_CAP_COALESCED_MMIO if (s->coalesced_mmio && !s->coalesced_mmio_ring) { s->coalesced_mmio_ring = (void *)env->kvm_run + s->coalesced_mmio * PAGE_SIZE; } #endif ret = kvm_arch_init_vcpu(env); if (ret == 0) { qemu_register_reset(kvm_reset_vcpu, env); kvm_arch_reset_vcpu(env); } err: return ret; }
{ "code": [ "#endif", "#endif", "#endif", "#ifdef KVM_CAP_COALESCED_MMIO", "#endif", "#ifdef KVM_CAP_COALESCED_MMIO", "#endif", "#ifdef KVM_CAP_COALESCED_MMIO", "#endif", "#ifdef KVM_CAP_COALESCED_MMIO", "#endif", " goto err;", "#ifdef KVM_CAP_COALESCED_MMIO", "#endif", "#ifdef KVM_CAP_COALESCED_MMIO", "#endif", " KVMState *s = kvm_state;", "#endif", "#endif", "#endif", "#endif", "#endif" ], "line_no": [ 73, 73, 73, 63, 73, 63, 73, 63, 73, 63, 73, 23, 63, 73, 63, 73, 5, 73, 73, 73, 73, 73 ] }
int FUNC_0(CPUState *VAR_0) { KVMState *s = kvm_state; long VAR_1; int VAR_2; DPRINTF("FUNC_0\n"); VAR_2 = kvm_vm_ioctl(s, KVM_CREATE_VCPU, VAR_0->cpu_index); if (VAR_2 < 0) { DPRINTF("kvm_create_vcpu failed\n"); goto err; } VAR_0->kvm_fd = VAR_2; VAR_0->kvm_state = s; VAR_1 = kvm_ioctl(s, KVM_GET_VCPU_MMAP_SIZE, 0); if (VAR_1 < 0) { DPRINTF("KVM_GET_VCPU_MMAP_SIZE failed\n"); goto err; } VAR_0->kvm_run = mmap(NULL, VAR_1, PROT_READ | PROT_WRITE, MAP_SHARED, VAR_0->kvm_fd, 0); if (VAR_0->kvm_run == MAP_FAILED) { VAR_2 = -errno; DPRINTF("mmap'ing vcpu state failed\n"); goto err; } #ifdef KVM_CAP_COALESCED_MMIO if (s->coalesced_mmio && !s->coalesced_mmio_ring) { s->coalesced_mmio_ring = (void *)VAR_0->kvm_run + s->coalesced_mmio * PAGE_SIZE; } #endif VAR_2 = kvm_arch_init_vcpu(VAR_0); if (VAR_2 == 0) { qemu_register_reset(kvm_reset_vcpu, VAR_0); kvm_arch_reset_vcpu(VAR_0); } err: return VAR_2; }
[ "int FUNC_0(CPUState *VAR_0)\n{", "KVMState *s = kvm_state;", "long VAR_1;", "int VAR_2;", "DPRINTF(\"FUNC_0\\n\");", "VAR_2 = kvm_vm_ioctl(s, KVM_CREATE_VCPU, VAR_0->cpu_index);", "if (VAR_2 < 0) {", "DPRINTF(\"kvm_create_vcpu failed\\n\");", "goto err;", "}", "VAR_0->kvm_fd = VAR_2;", "VAR_0->kvm_state = s;", "VAR_1 = kvm_ioctl(s, KVM_GET_VCPU_MMAP_SIZE, 0);", "if (VAR_1 < 0) {", "DPRINTF(\"KVM_GET_VCPU_MMAP_SIZE failed\\n\");", "goto err;", "}", "VAR_0->kvm_run = mmap(NULL, VAR_1, PROT_READ | PROT_WRITE, MAP_SHARED,\nVAR_0->kvm_fd, 0);", "if (VAR_0->kvm_run == MAP_FAILED) {", "VAR_2 = -errno;", "DPRINTF(\"mmap'ing vcpu state failed\\n\");", "goto err;", "}", "#ifdef KVM_CAP_COALESCED_MMIO\nif (s->coalesced_mmio && !s->coalesced_mmio_ring) {", "s->coalesced_mmio_ring =\n(void *)VAR_0->kvm_run + s->coalesced_mmio * PAGE_SIZE;", "}", "#endif\nVAR_2 = kvm_arch_init_vcpu(VAR_0);", "if (VAR_2 == 0) {", "qemu_register_reset(kvm_reset_vcpu, VAR_0);", "kvm_arch_reset_vcpu(VAR_0);", "}", "err:\nreturn VAR_2;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63, 65 ], [ 67, 69 ], [ 71 ], [ 73, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ] ]
13,226
static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused) { #if COMPILE_TEMPLATE_MMX assert(src1==src2); RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24); #else int i; assert(src1==src2); for (i=0; i<width; i++) { int r= src1[3*i + 0]; int g= src1[3*i + 1]; int b= src1[3*i + 2]; dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; } #endif }
true
FFmpeg
c3ab0004ae4dffc32494ae84dd15cfaa909a7884
static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused) { #if COMPILE_TEMPLATE_MMX assert(src1==src2); RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24); #else int i; assert(src1==src2); for (i=0; i<width; i++) { int r= src1[3*i + 0]; int g= src1[3*i + 1]; int b= src1[3*i + 2]; dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; } #endif }
{ "code": [ "static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)" ], "line_no": [ 1 ] }
static inline void FUNC_0(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused) { #if COMPILE_TEMPLATE_MMX assert(src1==src2); FUNC_0(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24); #else int VAR_0; assert(src1==src2); for (VAR_0=0; VAR_0<width; VAR_0++) { int r= src1[3*VAR_0 + 0]; int g= src1[3*VAR_0 + 1]; int b= src1[3*VAR_0 + 2]; dstU[VAR_0]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; dstV[VAR_0]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT; } #endif }
[ "static inline void FUNC_0(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)\n{", "#if COMPILE_TEMPLATE_MMX\nassert(src1==src2);", "FUNC_0(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24);", "#else\nint VAR_0;", "assert(src1==src2);", "for (VAR_0=0; VAR_0<width; VAR_0++) {", "int r= src1[3*VAR_0 + 0];", "int g= src1[3*VAR_0 + 1];", "int b= src1[3*VAR_0 + 2];", "dstU[VAR_0]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;", "dstV[VAR_0]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;", "}", "#endif\n}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ] ]
13,227
int net_init_tap(const NetClientOptions *opts, const char *name, NetClientState *peer) { const NetdevTapOptions *tap; int fd, vnet_hdr = 0, i = 0, queues; /* for the no-fd, no-helper case */ const char *script = NULL; /* suppress wrong "uninit'd use" gcc warning */ const char *downscript = NULL; const char *vhostfdname; char ifname[128]; assert(opts->kind == NET_CLIENT_OPTIONS_KIND_TAP); tap = opts->tap; queues = tap->has_queues ? tap->queues : 1; vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL; /* QEMU vlans does not support multiqueue tap, in this case peer is set. * For -netdev, peer is always NULL. */ if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) { error_report("Multiqueue tap cannot be used with QEMU vlans"); return -1; } if (tap->has_fd) { if (tap->has_ifname || tap->has_script || tap->has_downscript || tap->has_vnet_hdr || tap->has_helper || tap->has_queues || tap->has_fds) { error_report("ifname=, script=, downscript=, vnet_hdr=, " "helper=, queues=, and fds= are invalid with fd="); return -1; } fd = monitor_handle_fd_param(cur_mon, tap->fd); if (fd == -1) { return -1; } fcntl(fd, F_SETFL, O_NONBLOCK); vnet_hdr = tap_probe_vnet_hdr(fd); if (net_init_tap_one(tap, peer, "tap", name, NULL, script, downscript, vhostfdname, vnet_hdr, fd)) { return -1; } } else if (tap->has_fds) { char *fds[MAX_TAP_QUEUES]; char *vhost_fds[MAX_TAP_QUEUES]; int nfds, nvhosts; if (tap->has_ifname || tap->has_script || tap->has_downscript || tap->has_vnet_hdr || tap->has_helper || tap->has_queues || tap->has_fd) { error_report("ifname=, script=, downscript=, vnet_hdr=, " "helper=, queues=, and fd= are invalid with fds="); return -1; } nfds = get_fds(tap->fds, fds, MAX_TAP_QUEUES); if (tap->has_vhostfds) { nvhosts = get_fds(tap->vhostfds, vhost_fds, MAX_TAP_QUEUES); if (nfds != nvhosts) { error_report("The number of fds passed does not match the " "number of vhostfds passed"); return -1; } } for (i = 0; i < nfds; i++) { fd = monitor_handle_fd_param(cur_mon, fds[i]); if (fd == -1) { return -1; } fcntl(fd, F_SETFL, O_NONBLOCK); if (i == 0) { vnet_hdr = tap_probe_vnet_hdr(fd); } else if (vnet_hdr != tap_probe_vnet_hdr(fd)) { error_report("vnet_hdr not consistent across given tap fds"); return -1; } if (net_init_tap_one(tap, peer, "tap", name, ifname, script, downscript, tap->has_vhostfds ? vhost_fds[i] : NULL, vnet_hdr, fd)) { return -1; } } } else if (tap->has_helper) { if (tap->has_ifname || tap->has_script || tap->has_downscript || tap->has_vnet_hdr || tap->has_queues || tap->has_fds) { error_report("ifname=, script=, downscript=, and vnet_hdr= " "queues=, and fds= are invalid with helper="); return -1; } fd = net_bridge_run_helper(tap->helper, DEFAULT_BRIDGE_INTERFACE); if (fd == -1) { return -1; } fcntl(fd, F_SETFL, O_NONBLOCK); vnet_hdr = tap_probe_vnet_hdr(fd); if (net_init_tap_one(tap, peer, "bridge", name, ifname, script, downscript, vhostfdname, vnet_hdr, fd)) { return -1; } } else { script = tap->has_script ? tap->script : DEFAULT_NETWORK_SCRIPT; downscript = tap->has_downscript ? tap->downscript : DEFAULT_NETWORK_DOWN_SCRIPT; if (tap->has_ifname) { pstrcpy(ifname, sizeof ifname, tap->ifname); } else { ifname[0] = '\0'; } for (i = 0; i < queues; i++) { fd = net_tap_init(tap, &vnet_hdr, i >= 1 ? "no" : script, ifname, sizeof ifname, queues > 1); if (fd == -1) { return -1; } if (queues > 1 && i == 0 && !tap->has_ifname) { if (tap_fd_get_ifname(fd, ifname)) { error_report("Fail to get ifname"); return -1; } } if (net_init_tap_one(tap, peer, "tap", name, ifname, i >= 1 ? "no" : script, i >= 1 ? "no" : downscript, vhostfdname, vnet_hdr, fd)) { return -1; } } } return 0; }
true
qemu
c87826a878be05208c3906eb9d5e1f37cff5e98e
int net_init_tap(const NetClientOptions *opts, const char *name, NetClientState *peer) { const NetdevTapOptions *tap; int fd, vnet_hdr = 0, i = 0, queues; const char *script = NULL; const char *downscript = NULL; const char *vhostfdname; char ifname[128]; assert(opts->kind == NET_CLIENT_OPTIONS_KIND_TAP); tap = opts->tap; queues = tap->has_queues ? tap->queues : 1; vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL; if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) { error_report("Multiqueue tap cannot be used with QEMU vlans"); return -1; } if (tap->has_fd) { if (tap->has_ifname || tap->has_script || tap->has_downscript || tap->has_vnet_hdr || tap->has_helper || tap->has_queues || tap->has_fds) { error_report("ifname=, script=, downscript=, vnet_hdr=, " "helper=, queues=, and fds= are invalid with fd="); return -1; } fd = monitor_handle_fd_param(cur_mon, tap->fd); if (fd == -1) { return -1; } fcntl(fd, F_SETFL, O_NONBLOCK); vnet_hdr = tap_probe_vnet_hdr(fd); if (net_init_tap_one(tap, peer, "tap", name, NULL, script, downscript, vhostfdname, vnet_hdr, fd)) { return -1; } } else if (tap->has_fds) { char *fds[MAX_TAP_QUEUES]; char *vhost_fds[MAX_TAP_QUEUES]; int nfds, nvhosts; if (tap->has_ifname || tap->has_script || tap->has_downscript || tap->has_vnet_hdr || tap->has_helper || tap->has_queues || tap->has_fd) { error_report("ifname=, script=, downscript=, vnet_hdr=, " "helper=, queues=, and fd= are invalid with fds="); return -1; } nfds = get_fds(tap->fds, fds, MAX_TAP_QUEUES); if (tap->has_vhostfds) { nvhosts = get_fds(tap->vhostfds, vhost_fds, MAX_TAP_QUEUES); if (nfds != nvhosts) { error_report("The number of fds passed does not match the " "number of vhostfds passed"); return -1; } } for (i = 0; i < nfds; i++) { fd = monitor_handle_fd_param(cur_mon, fds[i]); if (fd == -1) { return -1; } fcntl(fd, F_SETFL, O_NONBLOCK); if (i == 0) { vnet_hdr = tap_probe_vnet_hdr(fd); } else if (vnet_hdr != tap_probe_vnet_hdr(fd)) { error_report("vnet_hdr not consistent across given tap fds"); return -1; } if (net_init_tap_one(tap, peer, "tap", name, ifname, script, downscript, tap->has_vhostfds ? vhost_fds[i] : NULL, vnet_hdr, fd)) { return -1; } } } else if (tap->has_helper) { if (tap->has_ifname || tap->has_script || tap->has_downscript || tap->has_vnet_hdr || tap->has_queues || tap->has_fds) { error_report("ifname=, script=, downscript=, and vnet_hdr= " "queues=, and fds= are invalid with helper="); return -1; } fd = net_bridge_run_helper(tap->helper, DEFAULT_BRIDGE_INTERFACE); if (fd == -1) { return -1; } fcntl(fd, F_SETFL, O_NONBLOCK); vnet_hdr = tap_probe_vnet_hdr(fd); if (net_init_tap_one(tap, peer, "bridge", name, ifname, script, downscript, vhostfdname, vnet_hdr, fd)) { return -1; } } else { script = tap->has_script ? tap->script : DEFAULT_NETWORK_SCRIPT; downscript = tap->has_downscript ? tap->downscript : DEFAULT_NETWORK_DOWN_SCRIPT; if (tap->has_ifname) { pstrcpy(ifname, sizeof ifname, tap->ifname); } else { ifname[0] = '\0'; } for (i = 0; i < queues; i++) { fd = net_tap_init(tap, &vnet_hdr, i >= 1 ? "no" : script, ifname, sizeof ifname, queues > 1); if (fd == -1) { return -1; } if (queues > 1 && i == 0 && !tap->has_ifname) { if (tap_fd_get_ifname(fd, ifname)) { error_report("Fail to get ifname"); return -1; } } if (net_init_tap_one(tap, peer, "tap", name, ifname, i >= 1 ? "no" : script, i >= 1 ? "no" : downscript, vhostfdname, vnet_hdr, fd)) { return -1; } } } return 0; }
{ "code": [ " tap->has_fds) {", " \"helper=, queues=, and fds= are invalid with fd=\");", " tap->has_fd) {", " \"helper=, queues=, and fd= are invalid with fds=\");", " tap->has_vnet_hdr || tap->has_queues || tap->has_fds) {", " \"queues=, and fds= are invalid with helper=\");" ], "line_no": [ 53, 57, 107, 111, 187, 191 ] }
int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1, NetClientState *VAR_2) { const NetdevTapOptions *VAR_3; int VAR_4, VAR_5 = 0, VAR_6 = 0, VAR_7; const char *VAR_8 = NULL; const char *VAR_9 = NULL; const char *VAR_10; char VAR_11[128]; assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_TAP); VAR_3 = VAR_0->VAR_3; VAR_7 = VAR_3->has_queues ? VAR_3->VAR_7 : 1; VAR_10 = VAR_3->has_vhostfd ? VAR_3->vhostfd : NULL; if (VAR_2 && (VAR_3->has_queues || VAR_3->has_fds || VAR_3->has_vhostfds)) { error_report("Multiqueue VAR_3 cannot be used with QEMU vlans"); return -1; } if (VAR_3->has_fd) { if (VAR_3->has_ifname || VAR_3->has_script || VAR_3->has_downscript || VAR_3->has_vnet_hdr || VAR_3->has_helper || VAR_3->has_queues || VAR_3->has_fds) { error_report("VAR_11=, VAR_8=, VAR_9=, VAR_5=, " "helper=, VAR_7=, and VAR_12= are invalid with VAR_4="); return -1; } VAR_4 = monitor_handle_fd_param(cur_mon, VAR_3->VAR_4); if (VAR_4 == -1) { return -1; } fcntl(VAR_4, F_SETFL, O_NONBLOCK); VAR_5 = tap_probe_vnet_hdr(VAR_4); if (net_init_tap_one(VAR_3, VAR_2, "VAR_3", VAR_1, NULL, VAR_8, VAR_9, VAR_10, VAR_5, VAR_4)) { return -1; } } else if (VAR_3->has_fds) { char *VAR_12[MAX_TAP_QUEUES]; char *VAR_13[MAX_TAP_QUEUES]; int VAR_14, VAR_15; if (VAR_3->has_ifname || VAR_3->has_script || VAR_3->has_downscript || VAR_3->has_vnet_hdr || VAR_3->has_helper || VAR_3->has_queues || VAR_3->has_fd) { error_report("VAR_11=, VAR_8=, VAR_9=, VAR_5=, " "helper=, VAR_7=, and VAR_4= are invalid with VAR_12="); return -1; } VAR_14 = get_fds(VAR_3->VAR_12, VAR_12, MAX_TAP_QUEUES); if (VAR_3->has_vhostfds) { VAR_15 = get_fds(VAR_3->vhostfds, VAR_13, MAX_TAP_QUEUES); if (VAR_14 != VAR_15) { error_report("The number of VAR_12 passed does not match the " "number of vhostfds passed"); return -1; } } for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) { VAR_4 = monitor_handle_fd_param(cur_mon, VAR_12[VAR_6]); if (VAR_4 == -1) { return -1; } fcntl(VAR_4, F_SETFL, O_NONBLOCK); if (VAR_6 == 0) { VAR_5 = tap_probe_vnet_hdr(VAR_4); } else if (VAR_5 != tap_probe_vnet_hdr(VAR_4)) { error_report("VAR_5 not consistent across given VAR_3 VAR_12"); return -1; } if (net_init_tap_one(VAR_3, VAR_2, "VAR_3", VAR_1, VAR_11, VAR_8, VAR_9, VAR_3->has_vhostfds ? VAR_13[VAR_6] : NULL, VAR_5, VAR_4)) { return -1; } } } else if (VAR_3->has_helper) { if (VAR_3->has_ifname || VAR_3->has_script || VAR_3->has_downscript || VAR_3->has_vnet_hdr || VAR_3->has_queues || VAR_3->has_fds) { error_report("VAR_11=, VAR_8=, VAR_9=, and VAR_5= " "VAR_7=, and VAR_12= are invalid with helper="); return -1; } VAR_4 = net_bridge_run_helper(VAR_3->helper, DEFAULT_BRIDGE_INTERFACE); if (VAR_4 == -1) { return -1; } fcntl(VAR_4, F_SETFL, O_NONBLOCK); VAR_5 = tap_probe_vnet_hdr(VAR_4); if (net_init_tap_one(VAR_3, VAR_2, "bridge", VAR_1, VAR_11, VAR_8, VAR_9, VAR_10, VAR_5, VAR_4)) { return -1; } } else { VAR_8 = VAR_3->has_script ? VAR_3->VAR_8 : DEFAULT_NETWORK_SCRIPT; VAR_9 = VAR_3->has_downscript ? VAR_3->VAR_9 : DEFAULT_NETWORK_DOWN_SCRIPT; if (VAR_3->has_ifname) { pstrcpy(VAR_11, sizeof VAR_11, VAR_3->VAR_11); } else { VAR_11[0] = '\0'; } for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++) { VAR_4 = net_tap_init(VAR_3, &VAR_5, VAR_6 >= 1 ? "no" : VAR_8, VAR_11, sizeof VAR_11, VAR_7 > 1); if (VAR_4 == -1) { return -1; } if (VAR_7 > 1 && VAR_6 == 0 && !VAR_3->has_ifname) { if (tap_fd_get_ifname(VAR_4, VAR_11)) { error_report("Fail to get VAR_11"); return -1; } } if (net_init_tap_one(VAR_3, VAR_2, "VAR_3", VAR_1, VAR_11, VAR_6 >= 1 ? "no" : VAR_8, VAR_6 >= 1 ? "no" : VAR_9, VAR_10, VAR_5, VAR_4)) { return -1; } } } return 0; }
[ "int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1,\nNetClientState *VAR_2)\n{", "const NetdevTapOptions *VAR_3;", "int VAR_4, VAR_5 = 0, VAR_6 = 0, VAR_7;", "const char *VAR_8 = NULL;", "const char *VAR_9 = NULL;", "const char *VAR_10;", "char VAR_11[128];", "assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_TAP);", "VAR_3 = VAR_0->VAR_3;", "VAR_7 = VAR_3->has_queues ? VAR_3->VAR_7 : 1;", "VAR_10 = VAR_3->has_vhostfd ? VAR_3->vhostfd : NULL;", "if (VAR_2 && (VAR_3->has_queues || VAR_3->has_fds || VAR_3->has_vhostfds)) {", "error_report(\"Multiqueue VAR_3 cannot be used with QEMU vlans\");", "return -1;", "}", "if (VAR_3->has_fd) {", "if (VAR_3->has_ifname || VAR_3->has_script || VAR_3->has_downscript ||\nVAR_3->has_vnet_hdr || VAR_3->has_helper || VAR_3->has_queues ||\nVAR_3->has_fds) {", "error_report(\"VAR_11=, VAR_8=, VAR_9=, VAR_5=, \"\n\"helper=, VAR_7=, and VAR_12= are invalid with VAR_4=\");", "return -1;", "}", "VAR_4 = monitor_handle_fd_param(cur_mon, VAR_3->VAR_4);", "if (VAR_4 == -1) {", "return -1;", "}", "fcntl(VAR_4, F_SETFL, O_NONBLOCK);", "VAR_5 = tap_probe_vnet_hdr(VAR_4);", "if (net_init_tap_one(VAR_3, VAR_2, \"VAR_3\", VAR_1, NULL,\nVAR_8, VAR_9,\nVAR_10, VAR_5, VAR_4)) {", "return -1;", "}", "} else if (VAR_3->has_fds) {", "char *VAR_12[MAX_TAP_QUEUES];", "char *VAR_13[MAX_TAP_QUEUES];", "int VAR_14, VAR_15;", "if (VAR_3->has_ifname || VAR_3->has_script || VAR_3->has_downscript ||\nVAR_3->has_vnet_hdr || VAR_3->has_helper || VAR_3->has_queues ||\nVAR_3->has_fd) {", "error_report(\"VAR_11=, VAR_8=, VAR_9=, VAR_5=, \"\n\"helper=, VAR_7=, and VAR_4= are invalid with VAR_12=\");", "return -1;", "}", "VAR_14 = get_fds(VAR_3->VAR_12, VAR_12, MAX_TAP_QUEUES);", "if (VAR_3->has_vhostfds) {", "VAR_15 = get_fds(VAR_3->vhostfds, VAR_13, MAX_TAP_QUEUES);", "if (VAR_14 != VAR_15) {", "error_report(\"The number of VAR_12 passed does not match the \"\n\"number of vhostfds passed\");", "return -1;", "}", "}", "for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {", "VAR_4 = monitor_handle_fd_param(cur_mon, VAR_12[VAR_6]);", "if (VAR_4 == -1) {", "return -1;", "}", "fcntl(VAR_4, F_SETFL, O_NONBLOCK);", "if (VAR_6 == 0) {", "VAR_5 = tap_probe_vnet_hdr(VAR_4);", "} else if (VAR_5 != tap_probe_vnet_hdr(VAR_4)) {", "error_report(\"VAR_5 not consistent across given VAR_3 VAR_12\");", "return -1;", "}", "if (net_init_tap_one(VAR_3, VAR_2, \"VAR_3\", VAR_1, VAR_11,\nVAR_8, VAR_9,\nVAR_3->has_vhostfds ? VAR_13[VAR_6] : NULL,\nVAR_5, VAR_4)) {", "return -1;", "}", "}", "} else if (VAR_3->has_helper) {", "if (VAR_3->has_ifname || VAR_3->has_script || VAR_3->has_downscript ||\nVAR_3->has_vnet_hdr || VAR_3->has_queues || VAR_3->has_fds) {", "error_report(\"VAR_11=, VAR_8=, VAR_9=, and VAR_5= \"\n\"VAR_7=, and VAR_12= are invalid with helper=\");", "return -1;", "}", "VAR_4 = net_bridge_run_helper(VAR_3->helper, DEFAULT_BRIDGE_INTERFACE);", "if (VAR_4 == -1) {", "return -1;", "}", "fcntl(VAR_4, F_SETFL, O_NONBLOCK);", "VAR_5 = tap_probe_vnet_hdr(VAR_4);", "if (net_init_tap_one(VAR_3, VAR_2, \"bridge\", VAR_1, VAR_11,\nVAR_8, VAR_9, VAR_10,\nVAR_5, VAR_4)) {", "return -1;", "}", "} else {", "VAR_8 = VAR_3->has_script ? VAR_3->VAR_8 : DEFAULT_NETWORK_SCRIPT;", "VAR_9 = VAR_3->has_downscript ? VAR_3->VAR_9 :\nDEFAULT_NETWORK_DOWN_SCRIPT;", "if (VAR_3->has_ifname) {", "pstrcpy(VAR_11, sizeof VAR_11, VAR_3->VAR_11);", "} else {", "VAR_11[0] = '\\0';", "}", "for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++) {", "VAR_4 = net_tap_init(VAR_3, &VAR_5, VAR_6 >= 1 ? \"no\" : VAR_8,\nVAR_11, sizeof VAR_11, VAR_7 > 1);", "if (VAR_4 == -1) {", "return -1;", "}", "if (VAR_7 > 1 && VAR_6 == 0 && !VAR_3->has_ifname) {", "if (tap_fd_get_ifname(VAR_4, VAR_11)) {", "error_report(\"Fail to get VAR_11\");", "return -1;", "}", "}", "if (net_init_tap_one(VAR_3, VAR_2, \"VAR_3\", VAR_1, VAR_11,\nVAR_6 >= 1 ? \"no\" : VAR_8,\nVAR_6 >= 1 ? \"no\" : VAR_9,\nVAR_10, VAR_5, VAR_4)) {", "return -1;", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49, 51, 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 79 ], [ 83, 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103, 105, 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169, 171, 173, 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185, 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 215, 217, 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229, 231 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 257 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 275, 277, 279, 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 293 ], [ 295 ] ]
13,228
static void spr_read_decr(DisasContext *ctx, int gprn, int sprn) { if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_load_decr(cpu_gpr[gprn], cpu_env); if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); gen_stop_exception(ctx); } }
true
qemu
c5a49c63fa26e8825ad101dfe86339ae4c216539
static void spr_read_decr(DisasContext *ctx, int gprn, int sprn) { if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_load_decr(cpu_gpr[gprn], cpu_env); if (ctx->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); gen_stop_exception(ctx); } }
{ "code": [ " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {", " if (ctx->tb->cflags & CF_USE_ICOUNT) {" ], "line_no": [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ] }
static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2) { if (VAR_0->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_load_decr(cpu_gpr[VAR_1], cpu_env); if (VAR_0->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); gen_stop_exception(VAR_0); } }
[ "static void FUNC_0(DisasContext *VAR_0, int VAR_1, int VAR_2)\n{", "if (VAR_0->tb->cflags & CF_USE_ICOUNT) {", "gen_io_start();", "}", "gen_helper_load_decr(cpu_gpr[VAR_1], cpu_env);", "if (VAR_0->tb->cflags & CF_USE_ICOUNT) {", "gen_io_end();", "gen_stop_exception(VAR_0);", "}", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
13,229
static double get_scene_score(AVFilterContext *ctx, AVFilterBufferRef *picref) { double ret = 0; SelectContext *select = ctx->priv; AVFilterBufferRef *prev_picref = select->prev_picref; if (prev_picref && picref->video->h == prev_picref->video->h && picref->video->w == prev_picref->video->w && picref->linesize[0] == prev_picref->linesize[0]) { int x, y; int64_t sad = 0; double mafd, diff; uint8_t *p1 = picref->data[0]; uint8_t *p2 = prev_picref->data[0]; const int linesize = picref->linesize[0]; for (y = 0; y < picref->video->h; y += 8) for (x = 0; x < linesize; x += 8) sad += select->c.sad[1](select, p1 + y * linesize + x, p2 + y * linesize + x, linesize, 8); emms_c(); mafd = sad / (picref->video->h * picref->video->w * 3); diff = fabs(mafd - select->prev_mafd); ret = av_clipf(FFMIN(mafd, diff) / 100., 0, 1); select->prev_mafd = mafd; avfilter_unref_buffer(prev_picref); } select->prev_picref = avfilter_ref_buffer(picref, ~0); return ret; }
true
FFmpeg
0852648301ad968bc7d79d000400e2b973bbb59a
static double get_scene_score(AVFilterContext *ctx, AVFilterBufferRef *picref) { double ret = 0; SelectContext *select = ctx->priv; AVFilterBufferRef *prev_picref = select->prev_picref; if (prev_picref && picref->video->h == prev_picref->video->h && picref->video->w == prev_picref->video->w && picref->linesize[0] == prev_picref->linesize[0]) { int x, y; int64_t sad = 0; double mafd, diff; uint8_t *p1 = picref->data[0]; uint8_t *p2 = prev_picref->data[0]; const int linesize = picref->linesize[0]; for (y = 0; y < picref->video->h; y += 8) for (x = 0; x < linesize; x += 8) sad += select->c.sad[1](select, p1 + y * linesize + x, p2 + y * linesize + x, linesize, 8); emms_c(); mafd = sad / (picref->video->h * picref->video->w * 3); diff = fabs(mafd - select->prev_mafd); ret = av_clipf(FFMIN(mafd, diff) / 100., 0, 1); select->prev_mafd = mafd; avfilter_unref_buffer(prev_picref); } select->prev_picref = avfilter_ref_buffer(picref, ~0); return ret; }
{ "code": [ " int x, y;", " for (y = 0; y < picref->video->h; y += 8)", " for (x = 0; x < linesize; x += 8)", " mafd = sad / (picref->video->h * picref->video->w * 3);" ], "line_no": [ 21, 35, 37, 49 ] }
static double FUNC_0(AVFilterContext *VAR_0, AVFilterBufferRef *VAR_1) { double VAR_2 = 0; SelectContext *select = VAR_0->priv; AVFilterBufferRef *prev_picref = select->prev_picref; if (prev_picref && VAR_1->video->h == prev_picref->video->h && VAR_1->video->w == prev_picref->video->w && VAR_1->VAR_7[0] == prev_picref->VAR_7[0]) { int VAR_3, VAR_4; int64_t sad = 0; double VAR_5, VAR_6; uint8_t *p1 = VAR_1->data[0]; uint8_t *p2 = prev_picref->data[0]; const int VAR_7 = VAR_1->VAR_7[0]; for (VAR_4 = 0; VAR_4 < VAR_1->video->h; VAR_4 += 8) for (VAR_3 = 0; VAR_3 < VAR_7; VAR_3 += 8) sad += select->c.sad[1](select, p1 + VAR_4 * VAR_7 + VAR_3, p2 + VAR_4 * VAR_7 + VAR_3, VAR_7, 8); emms_c(); VAR_5 = sad / (VAR_1->video->h * VAR_1->video->w * 3); VAR_6 = fabs(VAR_5 - select->prev_mafd); VAR_2 = av_clipf(FFMIN(VAR_5, VAR_6) / 100., 0, 1); select->prev_mafd = VAR_5; avfilter_unref_buffer(prev_picref); } select->prev_picref = avfilter_ref_buffer(VAR_1, ~0); return VAR_2; }
[ "static double FUNC_0(AVFilterContext *VAR_0, AVFilterBufferRef *VAR_1)\n{", "double VAR_2 = 0;", "SelectContext *select = VAR_0->priv;", "AVFilterBufferRef *prev_picref = select->prev_picref;", "if (prev_picref &&\nVAR_1->video->h == prev_picref->video->h &&\nVAR_1->video->w == prev_picref->video->w &&\nVAR_1->VAR_7[0] == prev_picref->VAR_7[0]) {", "int VAR_3, VAR_4;", "int64_t sad = 0;", "double VAR_5, VAR_6;", "uint8_t *p1 = VAR_1->data[0];", "uint8_t *p2 = prev_picref->data[0];", "const int VAR_7 = VAR_1->VAR_7[0];", "for (VAR_4 = 0; VAR_4 < VAR_1->video->h; VAR_4 += 8)", "for (VAR_3 = 0; VAR_3 < VAR_7; VAR_3 += 8)", "sad += select->c.sad[1](select,\np1 + VAR_4 * VAR_7 + VAR_3,\np2 + VAR_4 * VAR_7 + VAR_3,\nVAR_7, 8);", "emms_c();", "VAR_5 = sad / (VAR_1->video->h * VAR_1->video->w * 3);", "VAR_6 = fabs(VAR_5 - select->prev_mafd);", "VAR_2 = av_clipf(FFMIN(VAR_5, VAR_6) / 100., 0, 1);", "select->prev_mafd = VAR_5;", "avfilter_unref_buffer(prev_picref);", "}", "select->prev_picref = avfilter_ref_buffer(VAR_1, ~0);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15, 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39, 41, 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ] ]
13,231
static int do_req(int sockfd, AioContext *aio_context, SheepdogReq *hdr, void *data, unsigned int *wlen, unsigned int *rlen) { Coroutine *co; SheepdogReqCo srco = { .sockfd = sockfd, .aio_context = aio_context, .hdr = hdr, .data = data, .wlen = wlen, .rlen = rlen, .ret = 0, .finished = false, }; if (qemu_in_coroutine()) { do_co_req(&srco); } else { co = qemu_coroutine_create(do_co_req); qemu_coroutine_enter(co, &srco); while (!srco.finished) { aio_poll(aio_context, true); } } return srco.ret; }
true
qemu
0b8b8753e4d94901627b3e86431230f2319215c4
static int do_req(int sockfd, AioContext *aio_context, SheepdogReq *hdr, void *data, unsigned int *wlen, unsigned int *rlen) { Coroutine *co; SheepdogReqCo srco = { .sockfd = sockfd, .aio_context = aio_context, .hdr = hdr, .data = data, .wlen = wlen, .rlen = rlen, .ret = 0, .finished = false, }; if (qemu_in_coroutine()) { do_co_req(&srco); } else { co = qemu_coroutine_create(do_co_req); qemu_coroutine_enter(co, &srco); while (!srco.finished) { aio_poll(aio_context, true); } } return srco.ret; }
{ "code": [ " co = qemu_coroutine_create(do_co_req);", " qemu_coroutine_enter(co, &srco);" ], "line_no": [ 37, 39 ] }
static int FUNC_0(int VAR_0, AioContext *VAR_1, SheepdogReq *VAR_2, void *VAR_3, unsigned int *VAR_4, unsigned int *VAR_5) { Coroutine *co; SheepdogReqCo srco = { .VAR_0 = VAR_0, .VAR_1 = VAR_1, .VAR_2 = VAR_2, .VAR_3 = VAR_3, .VAR_4 = VAR_4, .VAR_5 = VAR_5, .ret = 0, .finished = false, }; if (qemu_in_coroutine()) { do_co_req(&srco); } else { co = qemu_coroutine_create(do_co_req); qemu_coroutine_enter(co, &srco); while (!srco.finished) { aio_poll(VAR_1, true); } } return srco.ret; }
[ "static int FUNC_0(int VAR_0, AioContext *VAR_1, SheepdogReq *VAR_2,\nvoid *VAR_3, unsigned int *VAR_4, unsigned int *VAR_5)\n{", "Coroutine *co;", "SheepdogReqCo srco = {", ".VAR_0 = VAR_0,\n.VAR_1 = VAR_1,\n.VAR_2 = VAR_2,\n.VAR_3 = VAR_3,\n.VAR_4 = VAR_4,\n.VAR_5 = VAR_5,\n.ret = 0,\n.finished = false,\n};", "if (qemu_in_coroutine()) {", "do_co_req(&srco);", "} else {", "co = qemu_coroutine_create(do_co_req);", "qemu_coroutine_enter(co, &srco);", "while (!srco.finished) {", "aio_poll(VAR_1, true);", "}", "}", "return srco.ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11, 13, 15, 17, 19, 21, 23, 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ] ]
13,232
static void gen_mtsrin(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } t0 = tcg_temp_new(); tcg_gen_shri_tl(t0, cpu_gpr[rB(ctx->opcode)], 28); tcg_gen_andi_tl(t0, t0, 0xF); gen_helper_store_sr(cpu_env, t0, cpu_gpr[rD(ctx->opcode)]); tcg_temp_free(t0); #endif }
true
qemu
9b2fadda3e0196ffd485adde4fe9cdd6fae35300
static void gen_mtsrin(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } t0 = tcg_temp_new(); tcg_gen_shri_tl(t0, cpu_gpr[rB(ctx->opcode)], 28); tcg_gen_andi_tl(t0, t0, 0xF); gen_helper_store_sr(cpu_env, t0, cpu_gpr[rD(ctx->opcode)]); tcg_temp_free(t0); #endif }
{ "code": [ " if (unlikely(ctx->pr)) {", " if (unlikely(ctx->pr)) {", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#endif", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif" ], "line_no": [ 13, 13, 5, 7, 9, 13, 15, 31, 5, 7, 9, 13, 15, 31, 31, 5, 7, 9, 13, 15, 13, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 31, 13, 31, 31, 31, 13, 31, 13, 31, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 5, 9, 13, 31, 13, 31, 5, 9, 13, 31, 5, 9, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 5, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31 ] }
static void FUNC_0(DisasContext *VAR_0) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG); #else TCGv t0; if (unlikely(VAR_0->pr)) { gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG); return; } t0 = tcg_temp_new(); tcg_gen_shri_tl(t0, cpu_gpr[rB(VAR_0->opcode)], 28); tcg_gen_andi_tl(t0, t0, 0xF); gen_helper_store_sr(cpu_env, t0, cpu_gpr[rD(VAR_0->opcode)]); tcg_temp_free(t0); #endif }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "#if defined(CONFIG_USER_ONLY)\ngen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG);", "#else\nTCGv t0;", "if (unlikely(VAR_0->pr)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG);", "return;", "}", "t0 = tcg_temp_new();", "tcg_gen_shri_tl(t0, cpu_gpr[rB(VAR_0->opcode)], 28);", "tcg_gen_andi_tl(t0, t0, 0xF);", "gen_helper_store_sr(cpu_env, t0, cpu_gpr[rD(VAR_0->opcode)]);", "tcg_temp_free(t0);", "#endif\n}" ]
[ 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ] ]
13,233
void s390_pci_iommu_enable(S390PCIBusDevice *pbdev) { uint64_t size = pbdev->pal - pbdev->pba + 1; memory_region_init_iommu(&pbdev->iommu_mr, OBJECT(&pbdev->mr), &s390_iommu_ops, "iommu-s390", size); memory_region_add_subregion(&pbdev->mr, pbdev->pba, &pbdev->iommu_mr); pbdev->iommu_enabled = true; }
true
qemu
f7c40aa1e7feb50bc4d4bc171fa811bdd9a93e51
void s390_pci_iommu_enable(S390PCIBusDevice *pbdev) { uint64_t size = pbdev->pal - pbdev->pba + 1; memory_region_init_iommu(&pbdev->iommu_mr, OBJECT(&pbdev->mr), &s390_iommu_ops, "iommu-s390", size); memory_region_add_subregion(&pbdev->mr, pbdev->pba, &pbdev->iommu_mr); pbdev->iommu_enabled = true; }
{ "code": [ " uint64_t size = pbdev->pal - pbdev->pba + 1;", " &s390_iommu_ops, \"iommu-s390\", size);", " memory_region_add_subregion(&pbdev->mr, pbdev->pba, &pbdev->iommu_mr);" ], "line_no": [ 5, 11, 13 ] }
void FUNC_0(S390PCIBusDevice *VAR_0) { uint64_t size = VAR_0->pal - VAR_0->pba + 1; memory_region_init_iommu(&VAR_0->iommu_mr, OBJECT(&VAR_0->mr), &s390_iommu_ops, "iommu-s390", size); memory_region_add_subregion(&VAR_0->mr, VAR_0->pba, &VAR_0->iommu_mr); VAR_0->iommu_enabled = true; }
[ "void FUNC_0(S390PCIBusDevice *VAR_0)\n{", "uint64_t size = VAR_0->pal - VAR_0->pba + 1;", "memory_region_init_iommu(&VAR_0->iommu_mr, OBJECT(&VAR_0->mr),\n&s390_iommu_ops, \"iommu-s390\", size);", "memory_region_add_subregion(&VAR_0->mr, VAR_0->pba, &VAR_0->iommu_mr);", "VAR_0->iommu_enabled = true;", "}" ]
[ 0, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ] ]
13,234
strdup(str) const char *str; { char *bptr; bptr = (char *)malloc(strlen(str)+1); strcpy(bptr, str); return bptr; }
true
qemu
2fd5d864099dd38b43b595e9e3375dad2f76049b
strdup(str) const char *str; { char *bptr; bptr = (char *)malloc(strlen(str)+1); strcpy(bptr, str); return bptr; }
{ "code": [ "strdup(str)", "\tconst char *str;", "\tchar *bptr;", "\tbptr = (char *)malloc(strlen(str)+1);", "\tstrcpy(bptr, str);", "\treturn bptr;" ], "line_no": [ 1, 3, 7, 11, 13, 17 ] }
FUNC_0(VAR_0) const char *VAR_0; { char *VAR_1; VAR_1 = (char *)malloc(strlen(VAR_0)+1); strcpy(VAR_1, VAR_0); return VAR_1; }
[ "FUNC_0(VAR_0)\nconst char *VAR_0;", "{", "char *VAR_1;", "VAR_1 = (char *)malloc(strlen(VAR_0)+1);", "strcpy(VAR_1, VAR_0);", "return VAR_1;", "}" ]
[ 1, 0, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ] ]
13,235
static void gen_tlbli_6xx(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } gen_helper_6xx_tlbi(cpu_env, cpu_gpr[rB(ctx->opcode)]); #endif }
true
qemu
9b2fadda3e0196ffd485adde4fe9cdd6fae35300
static void gen_tlbli_6xx(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } gen_helper_6xx_tlbi(cpu_env, cpu_gpr[rB(ctx->opcode)]); #endif }
{ "code": [ " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif" ], "line_no": [ 13, 7, 11, 13, 7, 11, 13, 7, 13, 5, 9, 11, 21, 5, 9, 11, 21, 21, 5, 9, 11, 7, 11, 13, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 11, 21, 7, 13, 21, 7, 11, 13, 21, 7, 13, 21, 7, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 11, 21, 11, 21, 11, 21, 11, 21, 5, 7, 9, 11, 13, 21, 7, 11, 13, 21, 5, 7, 9, 11, 13, 21, 5, 7, 9, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 5, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21, 7, 11, 13, 21 ] }
static void FUNC_0(DisasContext *VAR_0) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(VAR_0->pr)) { gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); return; } gen_helper_6xx_tlbi(cpu_env, cpu_gpr[rB(VAR_0->opcode)]); #endif }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "#if defined(CONFIG_USER_ONLY)\ngen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "#else\nif (unlikely(VAR_0->pr)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "return;", "}", "gen_helper_6xx_tlbi(cpu_env, cpu_gpr[rB(VAR_0->opcode)]);", "#endif\n}" ]
[ 0, 1, 1, 1, 0, 0, 0, 1 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ] ]
13,237
QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params, int permit_abbrev) { const char *firstname; char value[1024], *id = NULL; const char *p; QemuOpts *opts; assert(!permit_abbrev || list->implied_opt_name); firstname = permit_abbrev ? list->implied_opt_name : NULL; if (strncmp(params, "id=", 3) == 0) { get_opt_value(value, sizeof(value), params+3); id = qemu_strdup(value); } else if ((p = strstr(params, ",id=")) != NULL) { get_opt_value(value, sizeof(value), p+4); id = qemu_strdup(value); } opts = qemu_opts_create(list, id, 1); if (opts == NULL) return NULL; if (qemu_opts_do_parse(opts, params, firstname) != 0) { qemu_opts_del(opts); return NULL; } return opts; }
true
qemu
d510c5cf343eabd4d3a301f5730af724747b7055
QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params, int permit_abbrev) { const char *firstname; char value[1024], *id = NULL; const char *p; QemuOpts *opts; assert(!permit_abbrev || list->implied_opt_name); firstname = permit_abbrev ? list->implied_opt_name : NULL; if (strncmp(params, "id=", 3) == 0) { get_opt_value(value, sizeof(value), params+3); id = qemu_strdup(value); } else if ((p = strstr(params, ",id=")) != NULL) { get_opt_value(value, sizeof(value), p+4); id = qemu_strdup(value); } opts = qemu_opts_create(list, id, 1); if (opts == NULL) return NULL; if (qemu_opts_do_parse(opts, params, firstname) != 0) { qemu_opts_del(opts); return NULL; } return opts; }
{ "code": [ " id = qemu_strdup(value);", " id = qemu_strdup(value);" ], "line_no": [ 27, 27 ] }
QemuOpts *FUNC_0(QemuOptsList *list, const char *params, int permit_abbrev) { const char *VAR_0; char VAR_1[1024], *VAR_2 = NULL; const char *VAR_3; QemuOpts *opts; assert(!permit_abbrev || list->implied_opt_name); VAR_0 = permit_abbrev ? list->implied_opt_name : NULL; if (strncmp(params, "VAR_2=", 3) == 0) { get_opt_value(VAR_1, sizeof(VAR_1), params+3); VAR_2 = qemu_strdup(VAR_1); } else if ((VAR_3 = strstr(params, ",VAR_2=")) != NULL) { get_opt_value(VAR_1, sizeof(VAR_1), VAR_3+4); VAR_2 = qemu_strdup(VAR_1); } opts = qemu_opts_create(list, VAR_2, 1); if (opts == NULL) return NULL; if (qemu_opts_do_parse(opts, params, VAR_0) != 0) { qemu_opts_del(opts); return NULL; } return opts; }
[ "QemuOpts *FUNC_0(QemuOptsList *list, const char *params,\nint permit_abbrev)\n{", "const char *VAR_0;", "char VAR_1[1024], *VAR_2 = NULL;", "const char *VAR_3;", "QemuOpts *opts;", "assert(!permit_abbrev || list->implied_opt_name);", "VAR_0 = permit_abbrev ? list->implied_opt_name : NULL;", "if (strncmp(params, \"VAR_2=\", 3) == 0) {", "get_opt_value(VAR_1, sizeof(VAR_1), params+3);", "VAR_2 = qemu_strdup(VAR_1);", "} else if ((VAR_3 = strstr(params, \",VAR_2=\")) != NULL) {", "get_opt_value(VAR_1, sizeof(VAR_1), VAR_3+4);", "VAR_2 = qemu_strdup(VAR_1);", "}", "opts = qemu_opts_create(list, VAR_2, 1);", "if (opts == NULL)\nreturn NULL;", "if (qemu_opts_do_parse(opts, params, VAR_0) != 0) {", "qemu_opts_del(opts);", "return NULL;", "}", "return opts;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ] ]
13,238
static always_inline int get_segment (CPUState *env, mmu_ctx_t *ctx, target_ulong eaddr, int rw, int type) { target_phys_addr_t sdr, hash, mask, sdr_mask, htab_mask; target_ulong sr, vsid, vsid_mask, pgidx, page_mask; #if defined(TARGET_PPC64) int attr; #endif int ds, vsid_sh, sdr_sh, pr; int ret, ret2; pr = msr_pr; #if defined(TARGET_PPC64) if (env->mmu_model == POWERPC_MMU_64B) { #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "Check SLBs\n"); } #endif ret = slb_lookup(env, eaddr, &vsid, &page_mask, &attr); if (ret < 0) return ret; ctx->key = ((attr & 0x40) && (pr != 0)) || ((attr & 0x80) && (pr == 0)) ? 1 : 0; ds = 0; ctx->nx = attr & 0x20 ? 1 : 0; vsid_mask = 0x00003FFFFFFFFF80ULL; vsid_sh = 7; sdr_sh = 18; sdr_mask = 0x3FF80; } else #endif /* defined(TARGET_PPC64) */ { sr = env->sr[eaddr >> 28]; page_mask = 0x0FFFFFFF; ctx->key = (((sr & 0x20000000) && (pr != 0)) || ((sr & 0x40000000) && (pr == 0))) ? 1 : 0; ds = sr & 0x80000000 ? 1 : 0; ctx->nx = sr & 0x10000000 ? 1 : 0; vsid = sr & 0x00FFFFFF; vsid_mask = 0x01FFFFC0; vsid_sh = 6; sdr_sh = 16; sdr_mask = 0xFFC0; #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "Check segment v=0x" ADDRX " %d 0x" ADDRX " nip=0x" ADDRX " lr=0x" ADDRX " ir=%d dr=%d pr=%d %d t=%d\n", eaddr, (int)(eaddr >> 28), sr, env->nip, env->lr, (int)msr_ir, (int)msr_dr, pr != 0 ? 1 : 0, rw, type); } #endif } #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "pte segment: key=%d ds %d nx %d vsid " ADDRX "\n", ctx->key, ds, ctx->nx, vsid); } #endif ret = -1; if (!ds) { /* Check if instruction fetch is allowed, if needed */ if (type != ACCESS_CODE || ctx->nx == 0) { /* Page address translation */ /* Primary table address */ sdr = env->sdr1; pgidx = (eaddr & page_mask) >> TARGET_PAGE_BITS; #if defined(TARGET_PPC64) if (env->mmu_model == POWERPC_MMU_64B) { htab_mask = 0x0FFFFFFF >> (28 - (sdr & 0x1F)); /* XXX: this is false for 1 TB segments */ hash = ((vsid ^ pgidx) << vsid_sh) & vsid_mask; } else #endif { htab_mask = sdr & 0x000001FF; hash = ((vsid ^ pgidx) << vsid_sh) & vsid_mask; } mask = (htab_mask << sdr_sh) | sdr_mask; #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "sdr " PADDRX " sh %d hash " PADDRX " mask " PADDRX " " ADDRX "\n", sdr, sdr_sh, hash, mask, page_mask); } #endif ctx->pg_addr[0] = get_pgaddr(sdr, sdr_sh, hash, mask); /* Secondary table address */ hash = (~hash) & vsid_mask; #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "sdr " PADDRX " sh %d hash " PADDRX " mask " PADDRX "\n", sdr, sdr_sh, hash, mask); } #endif ctx->pg_addr[1] = get_pgaddr(sdr, sdr_sh, hash, mask); #if defined(TARGET_PPC64) if (env->mmu_model == POWERPC_MMU_64B) { /* Only 5 bits of the page index are used in the AVPN */ ctx->ptem = (vsid << 12) | ((pgidx >> 4) & 0x0F80); } else #endif { ctx->ptem = (vsid << 7) | (pgidx >> 10); } /* Initialize real address with an invalid value */ ctx->raddr = (target_ulong)-1; if (unlikely(env->mmu_model == POWERPC_MMU_SOFT_6xx || env->mmu_model == POWERPC_MMU_SOFT_74xx)) { /* Software TLB search */ ret = ppc6xx_tlb_check(env, ctx, eaddr, rw, type); } else { #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "0 sdr1=0x" PADDRX " vsid=0x%06x " "api=0x%04x hash=0x%07x pg_addr=0x" PADDRX "\n", sdr, (uint32_t)vsid, (uint32_t)pgidx, (uint32_t)hash, ctx->pg_addr[0]); } #endif /* Primary table lookup */ ret = find_pte(env, ctx, 0, rw, type); if (ret < 0) { /* Secondary table lookup */ #if defined (DEBUG_MMU) if (eaddr != 0xEFFFFFFF && loglevel != 0) { fprintf(logfile, "1 sdr1=0x" PADDRX " vsid=0x%06x api=0x%04x " "hash=0x%05x pg_addr=0x" PADDRX "\n", sdr, (uint32_t)vsid, (uint32_t)pgidx, (uint32_t)hash, ctx->pg_addr[1]); } #endif ret2 = find_pte(env, ctx, 1, rw, type); if (ret2 != -1) ret = ret2; } } #if defined (DUMP_PAGE_TABLES) if (loglevel != 0) { target_phys_addr_t curaddr; uint32_t a0, a1, a2, a3; fprintf(logfile, "Page table: " PADDRX " len " PADDRX "\n", sdr, mask + 0x80); for (curaddr = sdr; curaddr < (sdr + mask + 0x80); curaddr += 16) { a0 = ldl_phys(curaddr); a1 = ldl_phys(curaddr + 4); a2 = ldl_phys(curaddr + 8); a3 = ldl_phys(curaddr + 12); if (a0 != 0 || a1 != 0 || a2 != 0 || a3 != 0) { fprintf(logfile, PADDRX ": %08x %08x %08x %08x\n", curaddr, a0, a1, a2, a3); } } } #endif } else { #if defined (DEBUG_MMU) if (loglevel != 0) fprintf(logfile, "No access allowed\n"); #endif ret = -3; } } else { #if defined (DEBUG_MMU) if (loglevel != 0) fprintf(logfile, "direct store...\n"); #endif /* Direct-store segment : absolutely *BUGGY* for now */ switch (type) { case ACCESS_INT: /* Integer load/store : only access allowed */ break; case ACCESS_CODE: /* No code fetch is allowed in direct-store areas */ return -4; case ACCESS_FLOAT: /* Floating point load/store */ return -4; case ACCESS_RES: /* lwarx, ldarx or srwcx. */ return -4; case ACCESS_CACHE: /* dcba, dcbt, dcbtst, dcbf, dcbi, dcbst, dcbz, or icbi */ /* Should make the instruction do no-op. * As it already do no-op, it's quite easy :-) */ ctx->raddr = eaddr; return 0; case ACCESS_EXT: /* eciwx or ecowx */ return -4; default: if (logfile) { fprintf(logfile, "ERROR: instruction should not need " "address translation\n"); } return -4; } if ((rw == 1 || ctx->key != 1) && (rw == 0 || ctx->key != 0)) { ctx->raddr = eaddr; ret = 2; } else { ret = -2; } } return ret; }
true
qemu
6f2d8978728c48ca46f5c01835438508aace5c64
static always_inline int get_segment (CPUState *env, mmu_ctx_t *ctx, target_ulong eaddr, int rw, int type) { target_phys_addr_t sdr, hash, mask, sdr_mask, htab_mask; target_ulong sr, vsid, vsid_mask, pgidx, page_mask; #if defined(TARGET_PPC64) int attr; #endif int ds, vsid_sh, sdr_sh, pr; int ret, ret2; pr = msr_pr; #if defined(TARGET_PPC64) if (env->mmu_model == POWERPC_MMU_64B) { #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "Check SLBs\n"); } #endif ret = slb_lookup(env, eaddr, &vsid, &page_mask, &attr); if (ret < 0) return ret; ctx->key = ((attr & 0x40) && (pr != 0)) || ((attr & 0x80) && (pr == 0)) ? 1 : 0; ds = 0; ctx->nx = attr & 0x20 ? 1 : 0; vsid_mask = 0x00003FFFFFFFFF80ULL; vsid_sh = 7; sdr_sh = 18; sdr_mask = 0x3FF80; } else #endif { sr = env->sr[eaddr >> 28]; page_mask = 0x0FFFFFFF; ctx->key = (((sr & 0x20000000) && (pr != 0)) || ((sr & 0x40000000) && (pr == 0))) ? 1 : 0; ds = sr & 0x80000000 ? 1 : 0; ctx->nx = sr & 0x10000000 ? 1 : 0; vsid = sr & 0x00FFFFFF; vsid_mask = 0x01FFFFC0; vsid_sh = 6; sdr_sh = 16; sdr_mask = 0xFFC0; #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "Check segment v=0x" ADDRX " %d 0x" ADDRX " nip=0x" ADDRX " lr=0x" ADDRX " ir=%d dr=%d pr=%d %d t=%d\n", eaddr, (int)(eaddr >> 28), sr, env->nip, env->lr, (int)msr_ir, (int)msr_dr, pr != 0 ? 1 : 0, rw, type); } #endif } #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "pte segment: key=%d ds %d nx %d vsid " ADDRX "\n", ctx->key, ds, ctx->nx, vsid); } #endif ret = -1; if (!ds) { if (type != ACCESS_CODE || ctx->nx == 0) { sdr = env->sdr1; pgidx = (eaddr & page_mask) >> TARGET_PAGE_BITS; #if defined(TARGET_PPC64) if (env->mmu_model == POWERPC_MMU_64B) { htab_mask = 0x0FFFFFFF >> (28 - (sdr & 0x1F)); hash = ((vsid ^ pgidx) << vsid_sh) & vsid_mask; } else #endif { htab_mask = sdr & 0x000001FF; hash = ((vsid ^ pgidx) << vsid_sh) & vsid_mask; } mask = (htab_mask << sdr_sh) | sdr_mask; #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "sdr " PADDRX " sh %d hash " PADDRX " mask " PADDRX " " ADDRX "\n", sdr, sdr_sh, hash, mask, page_mask); } #endif ctx->pg_addr[0] = get_pgaddr(sdr, sdr_sh, hash, mask); hash = (~hash) & vsid_mask; #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "sdr " PADDRX " sh %d hash " PADDRX " mask " PADDRX "\n", sdr, sdr_sh, hash, mask); } #endif ctx->pg_addr[1] = get_pgaddr(sdr, sdr_sh, hash, mask); #if defined(TARGET_PPC64) if (env->mmu_model == POWERPC_MMU_64B) { ctx->ptem = (vsid << 12) | ((pgidx >> 4) & 0x0F80); } else #endif { ctx->ptem = (vsid << 7) | (pgidx >> 10); } ctx->raddr = (target_ulong)-1; if (unlikely(env->mmu_model == POWERPC_MMU_SOFT_6xx || env->mmu_model == POWERPC_MMU_SOFT_74xx)) { ret = ppc6xx_tlb_check(env, ctx, eaddr, rw, type); } else { #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "0 sdr1=0x" PADDRX " vsid=0x%06x " "api=0x%04x hash=0x%07x pg_addr=0x" PADDRX "\n", sdr, (uint32_t)vsid, (uint32_t)pgidx, (uint32_t)hash, ctx->pg_addr[0]); } #endif ret = find_pte(env, ctx, 0, rw, type); if (ret < 0) { #if defined (DEBUG_MMU) if (eaddr != 0xEFFFFFFF && loglevel != 0) { fprintf(logfile, "1 sdr1=0x" PADDRX " vsid=0x%06x api=0x%04x " "hash=0x%05x pg_addr=0x" PADDRX "\n", sdr, (uint32_t)vsid, (uint32_t)pgidx, (uint32_t)hash, ctx->pg_addr[1]); } #endif ret2 = find_pte(env, ctx, 1, rw, type); if (ret2 != -1) ret = ret2; } } #if defined (DUMP_PAGE_TABLES) if (loglevel != 0) { target_phys_addr_t curaddr; uint32_t a0, a1, a2, a3; fprintf(logfile, "Page table: " PADDRX " len " PADDRX "\n", sdr, mask + 0x80); for (curaddr = sdr; curaddr < (sdr + mask + 0x80); curaddr += 16) { a0 = ldl_phys(curaddr); a1 = ldl_phys(curaddr + 4); a2 = ldl_phys(curaddr + 8); a3 = ldl_phys(curaddr + 12); if (a0 != 0 || a1 != 0 || a2 != 0 || a3 != 0) { fprintf(logfile, PADDRX ": %08x %08x %08x %08x\n", curaddr, a0, a1, a2, a3); } } } #endif } else { #if defined (DEBUG_MMU) if (loglevel != 0) fprintf(logfile, "No access allowed\n"); #endif ret = -3; } } else { #if defined (DEBUG_MMU) if (loglevel != 0) fprintf(logfile, "direct store...\n"); #endif switch (type) { case ACCESS_INT: break; case ACCESS_CODE: return -4; case ACCESS_FLOAT: return -4; case ACCESS_RES: return -4; case ACCESS_CACHE: ctx->raddr = eaddr; return 0; case ACCESS_EXT: return -4; default: if (logfile) { fprintf(logfile, "ERROR: instruction should not need " "address translation\n"); } return -4; } if ((rw == 1 || ctx->key != 1) && (rw == 0 || ctx->key != 0)) { ctx->raddr = eaddr; ret = 2; } else { ret = -2; } } return ret; }
{ "code": [ " ctx->raddr = (target_ulong)-1;" ], "line_no": [ 217 ] }
static always_inline int FUNC_0 (CPUState *env, mmu_ctx_t *ctx, target_ulong eaddr, int rw, int type) { target_phys_addr_t sdr, hash, mask, sdr_mask, htab_mask; target_ulong sr, vsid, vsid_mask, pgidx, page_mask; #if defined(TARGET_PPC64) int attr; #endif int VAR_0, VAR_1, VAR_2, VAR_3; int VAR_4, VAR_5; VAR_3 = msr_pr; #if defined(TARGET_PPC64) if (env->mmu_model == POWERPC_MMU_64B) { #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "Check SLBs\n"); } #endif VAR_4 = slb_lookup(env, eaddr, &vsid, &page_mask, &attr); if (VAR_4 < 0) return VAR_4; ctx->key = ((attr & 0x40) && (VAR_3 != 0)) || ((attr & 0x80) && (VAR_3 == 0)) ? 1 : 0; VAR_0 = 0; ctx->nx = attr & 0x20 ? 1 : 0; vsid_mask = 0x00003FFFFFFFFF80ULL; VAR_1 = 7; VAR_2 = 18; sdr_mask = 0x3FF80; } else #endif { sr = env->sr[eaddr >> 28]; page_mask = 0x0FFFFFFF; ctx->key = (((sr & 0x20000000) && (VAR_3 != 0)) || ((sr & 0x40000000) && (VAR_3 == 0))) ? 1 : 0; VAR_0 = sr & 0x80000000 ? 1 : 0; ctx->nx = sr & 0x10000000 ? 1 : 0; vsid = sr & 0x00FFFFFF; vsid_mask = 0x01FFFFC0; VAR_1 = 6; VAR_2 = 16; sdr_mask = 0xFFC0; #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "Check segment v=0x" ADDRX " %d 0x" ADDRX " nip=0x" ADDRX " lr=0x" ADDRX " ir=%d dr=%d VAR_3=%d %d t=%d\n", eaddr, (int)(eaddr >> 28), sr, env->nip, env->lr, (int)msr_ir, (int)msr_dr, VAR_3 != 0 ? 1 : 0, rw, type); } #endif } #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "pte segment: key=%d VAR_0 %d nx %d vsid " ADDRX "\n", ctx->key, VAR_0, ctx->nx, vsid); } #endif VAR_4 = -1; if (!VAR_0) { if (type != ACCESS_CODE || ctx->nx == 0) { sdr = env->sdr1; pgidx = (eaddr & page_mask) >> TARGET_PAGE_BITS; #if defined(TARGET_PPC64) if (env->mmu_model == POWERPC_MMU_64B) { htab_mask = 0x0FFFFFFF >> (28 - (sdr & 0x1F)); hash = ((vsid ^ pgidx) << VAR_1) & vsid_mask; } else #endif { htab_mask = sdr & 0x000001FF; hash = ((vsid ^ pgidx) << VAR_1) & vsid_mask; } mask = (htab_mask << VAR_2) | sdr_mask; #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "sdr " PADDRX " sh %d hash " PADDRX " mask " PADDRX " " ADDRX "\n", sdr, VAR_2, hash, mask, page_mask); } #endif ctx->pg_addr[0] = get_pgaddr(sdr, VAR_2, hash, mask); hash = (~hash) & vsid_mask; #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "sdr " PADDRX " sh %d hash " PADDRX " mask " PADDRX "\n", sdr, VAR_2, hash, mask); } #endif ctx->pg_addr[1] = get_pgaddr(sdr, VAR_2, hash, mask); #if defined(TARGET_PPC64) if (env->mmu_model == POWERPC_MMU_64B) { ctx->ptem = (vsid << 12) | ((pgidx >> 4) & 0x0F80); } else #endif { ctx->ptem = (vsid << 7) | (pgidx >> 10); } ctx->raddr = (target_ulong)-1; if (unlikely(env->mmu_model == POWERPC_MMU_SOFT_6xx || env->mmu_model == POWERPC_MMU_SOFT_74xx)) { VAR_4 = ppc6xx_tlb_check(env, ctx, eaddr, rw, type); } else { #if defined (DEBUG_MMU) if (loglevel != 0) { fprintf(logfile, "0 sdr1=0x" PADDRX " vsid=0x%06x " "api=0x%04x hash=0x%07x pg_addr=0x" PADDRX "\n", sdr, (uint32_t)vsid, (uint32_t)pgidx, (uint32_t)hash, ctx->pg_addr[0]); } #endif VAR_4 = find_pte(env, ctx, 0, rw, type); if (VAR_4 < 0) { #if defined (DEBUG_MMU) if (eaddr != 0xEFFFFFFF && loglevel != 0) { fprintf(logfile, "1 sdr1=0x" PADDRX " vsid=0x%06x api=0x%04x " "hash=0x%05x pg_addr=0x" PADDRX "\n", sdr, (uint32_t)vsid, (uint32_t)pgidx, (uint32_t)hash, ctx->pg_addr[1]); } #endif VAR_5 = find_pte(env, ctx, 1, rw, type); if (VAR_5 != -1) VAR_4 = VAR_5; } } #if defined (DUMP_PAGE_TABLES) if (loglevel != 0) { target_phys_addr_t curaddr; uint32_t a0, a1, a2, a3; fprintf(logfile, "Page table: " PADDRX " len " PADDRX "\n", sdr, mask + 0x80); for (curaddr = sdr; curaddr < (sdr + mask + 0x80); curaddr += 16) { a0 = ldl_phys(curaddr); a1 = ldl_phys(curaddr + 4); a2 = ldl_phys(curaddr + 8); a3 = ldl_phys(curaddr + 12); if (a0 != 0 || a1 != 0 || a2 != 0 || a3 != 0) { fprintf(logfile, PADDRX ": %08x %08x %08x %08x\n", curaddr, a0, a1, a2, a3); } } } #endif } else { #if defined (DEBUG_MMU) if (loglevel != 0) fprintf(logfile, "No access allowed\n"); #endif VAR_4 = -3; } } else { #if defined (DEBUG_MMU) if (loglevel != 0) fprintf(logfile, "direct store...\n"); #endif switch (type) { case ACCESS_INT: break; case ACCESS_CODE: return -4; case ACCESS_FLOAT: return -4; case ACCESS_RES: return -4; case ACCESS_CACHE: ctx->raddr = eaddr; return 0; case ACCESS_EXT: return -4; default: if (logfile) { fprintf(logfile, "ERROR: instruction should not need " "address translation\n"); } return -4; } if ((rw == 1 || ctx->key != 1) && (rw == 0 || ctx->key != 0)) { ctx->raddr = eaddr; VAR_4 = 2; } else { VAR_4 = -2; } } return VAR_4; }
[ "static always_inline int FUNC_0 (CPUState *env, mmu_ctx_t *ctx,\ntarget_ulong eaddr, int rw, int type)\n{", "target_phys_addr_t sdr, hash, mask, sdr_mask, htab_mask;", "target_ulong sr, vsid, vsid_mask, pgidx, page_mask;", "#if defined(TARGET_PPC64)\nint attr;", "#endif\nint VAR_0, VAR_1, VAR_2, VAR_3;", "int VAR_4, VAR_5;", "VAR_3 = msr_pr;", "#if defined(TARGET_PPC64)\nif (env->mmu_model == POWERPC_MMU_64B) {", "#if defined (DEBUG_MMU)\nif (loglevel != 0) {", "fprintf(logfile, \"Check SLBs\\n\");", "}", "#endif\nVAR_4 = slb_lookup(env, eaddr, &vsid, &page_mask, &attr);", "if (VAR_4 < 0)\nreturn VAR_4;", "ctx->key = ((attr & 0x40) && (VAR_3 != 0)) ||\n((attr & 0x80) && (VAR_3 == 0)) ? 1 : 0;", "VAR_0 = 0;", "ctx->nx = attr & 0x20 ? 1 : 0;", "vsid_mask = 0x00003FFFFFFFFF80ULL;", "VAR_1 = 7;", "VAR_2 = 18;", "sdr_mask = 0x3FF80;", "} else", "#endif\n{", "sr = env->sr[eaddr >> 28];", "page_mask = 0x0FFFFFFF;", "ctx->key = (((sr & 0x20000000) && (VAR_3 != 0)) ||\n((sr & 0x40000000) && (VAR_3 == 0))) ? 1 : 0;", "VAR_0 = sr & 0x80000000 ? 1 : 0;", "ctx->nx = sr & 0x10000000 ? 1 : 0;", "vsid = sr & 0x00FFFFFF;", "vsid_mask = 0x01FFFFC0;", "VAR_1 = 6;", "VAR_2 = 16;", "sdr_mask = 0xFFC0;", "#if defined (DEBUG_MMU)\nif (loglevel != 0) {", "fprintf(logfile, \"Check segment v=0x\" ADDRX \" %d 0x\" ADDRX\n\" nip=0x\" ADDRX \" lr=0x\" ADDRX\n\" ir=%d dr=%d VAR_3=%d %d t=%d\\n\",\neaddr, (int)(eaddr >> 28), sr, env->nip,\nenv->lr, (int)msr_ir, (int)msr_dr, VAR_3 != 0 ? 1 : 0,\nrw, type);", "}", "#endif\n}", "#if defined (DEBUG_MMU)\nif (loglevel != 0) {", "fprintf(logfile, \"pte segment: key=%d VAR_0 %d nx %d vsid \" ADDRX \"\\n\",\nctx->key, VAR_0, ctx->nx, vsid);", "}", "#endif\nVAR_4 = -1;", "if (!VAR_0) {", "if (type != ACCESS_CODE || ctx->nx == 0) {", "sdr = env->sdr1;", "pgidx = (eaddr & page_mask) >> TARGET_PAGE_BITS;", "#if defined(TARGET_PPC64)\nif (env->mmu_model == POWERPC_MMU_64B) {", "htab_mask = 0x0FFFFFFF >> (28 - (sdr & 0x1F));", "hash = ((vsid ^ pgidx) << VAR_1) & vsid_mask;", "} else", "#endif\n{", "htab_mask = sdr & 0x000001FF;", "hash = ((vsid ^ pgidx) << VAR_1) & vsid_mask;", "}", "mask = (htab_mask << VAR_2) | sdr_mask;", "#if defined (DEBUG_MMU)\nif (loglevel != 0) {", "fprintf(logfile, \"sdr \" PADDRX \" sh %d hash \" PADDRX \" mask \"\nPADDRX \" \" ADDRX \"\\n\", sdr, VAR_2, hash, mask,\npage_mask);", "}", "#endif\nctx->pg_addr[0] = get_pgaddr(sdr, VAR_2, hash, mask);", "hash = (~hash) & vsid_mask;", "#if defined (DEBUG_MMU)\nif (loglevel != 0) {", "fprintf(logfile, \"sdr \" PADDRX \" sh %d hash \" PADDRX \" mask \"\nPADDRX \"\\n\", sdr, VAR_2, hash, mask);", "}", "#endif\nctx->pg_addr[1] = get_pgaddr(sdr, VAR_2, hash, mask);", "#if defined(TARGET_PPC64)\nif (env->mmu_model == POWERPC_MMU_64B) {", "ctx->ptem = (vsid << 12) | ((pgidx >> 4) & 0x0F80);", "} else", "#endif\n{", "ctx->ptem = (vsid << 7) | (pgidx >> 10);", "}", "ctx->raddr = (target_ulong)-1;", "if (unlikely(env->mmu_model == POWERPC_MMU_SOFT_6xx ||\nenv->mmu_model == POWERPC_MMU_SOFT_74xx)) {", "VAR_4 = ppc6xx_tlb_check(env, ctx, eaddr, rw, type);", "} else {", "#if defined (DEBUG_MMU)\nif (loglevel != 0) {", "fprintf(logfile, \"0 sdr1=0x\" PADDRX \" vsid=0x%06x \"\n\"api=0x%04x hash=0x%07x pg_addr=0x\" PADDRX \"\\n\",\nsdr, (uint32_t)vsid, (uint32_t)pgidx,\n(uint32_t)hash, ctx->pg_addr[0]);", "}", "#endif\nVAR_4 = find_pte(env, ctx, 0, rw, type);", "if (VAR_4 < 0) {", "#if defined (DEBUG_MMU)\nif (eaddr != 0xEFFFFFFF && loglevel != 0) {", "fprintf(logfile,\n\"1 sdr1=0x\" PADDRX \" vsid=0x%06x api=0x%04x \"\n\"hash=0x%05x pg_addr=0x\" PADDRX \"\\n\",\nsdr, (uint32_t)vsid, (uint32_t)pgidx,\n(uint32_t)hash, ctx->pg_addr[1]);", "}", "#endif\nVAR_5 = find_pte(env, ctx, 1, rw, type);", "if (VAR_5 != -1)\nVAR_4 = VAR_5;", "}", "}", "#if defined (DUMP_PAGE_TABLES)\nif (loglevel != 0) {", "target_phys_addr_t curaddr;", "uint32_t a0, a1, a2, a3;", "fprintf(logfile,\n\"Page table: \" PADDRX \" len \" PADDRX \"\\n\",\nsdr, mask + 0x80);", "for (curaddr = sdr; curaddr < (sdr + mask + 0x80);", "curaddr += 16) {", "a0 = ldl_phys(curaddr);", "a1 = ldl_phys(curaddr + 4);", "a2 = ldl_phys(curaddr + 8);", "a3 = ldl_phys(curaddr + 12);", "if (a0 != 0 || a1 != 0 || a2 != 0 || a3 != 0) {", "fprintf(logfile,\nPADDRX \": %08x %08x %08x %08x\\n\",\ncuraddr, a0, a1, a2, a3);", "}", "}", "}", "#endif\n} else {", "#if defined (DEBUG_MMU)\nif (loglevel != 0)\nfprintf(logfile, \"No access allowed\\n\");", "#endif\nVAR_4 = -3;", "}", "} else {", "#if defined (DEBUG_MMU)\nif (loglevel != 0)\nfprintf(logfile, \"direct store...\\n\");", "#endif\nswitch (type) {", "case ACCESS_INT:\nbreak;", "case ACCESS_CODE:\nreturn -4;", "case ACCESS_FLOAT:\nreturn -4;", "case ACCESS_RES:\nreturn -4;", "case ACCESS_CACHE:\nctx->raddr = eaddr;", "return 0;", "case ACCESS_EXT:\nreturn -4;", "default:\nif (logfile) {", "fprintf(logfile, \"ERROR: instruction should not need \"\n\"address translation\\n\");", "}", "return -4;", "}", "if ((rw == 1 || ctx->key != 1) && (rw == 0 || ctx->key != 0)) {", "ctx->raddr = eaddr;", "VAR_4 = 2;", "} else {", "VAR_4 = -2;", "}", "}", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 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 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167, 169, 171 ], [ 173 ], [ 175, 177 ], [ 181 ], [ 183, 185 ], [ 187, 189 ], [ 191 ], [ 193, 195 ], [ 197, 199 ], [ 203 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219, 221 ], [ 225 ], [ 227 ], [ 229, 231 ], [ 233, 235, 237, 239 ], [ 241 ], [ 243, 247 ], [ 249 ], [ 253, 255 ], [ 257, 259, 261, 263, 265 ], [ 267 ], [ 269, 271 ], [ 273, 275 ], [ 277 ], [ 279 ], [ 281, 283 ], [ 285 ], [ 287 ], [ 289, 291, 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309, 311, 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321, 323 ], [ 325, 327, 329 ], [ 331, 333 ], [ 335 ], [ 337 ], [ 339, 341, 343 ], [ 345, 349 ], [ 351, 355 ], [ 357, 361 ], [ 363, 367 ], [ 369, 373 ], [ 375, 385 ], [ 387 ], [ 389, 393 ], [ 395, 397 ], [ 399, 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 425 ], [ 427 ] ]
13,239
AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame, int perms) { AVFilterBufferRef *samplesref = avfilter_get_audio_buffer_ref_from_arrays((uint8_t **)frame->data, frame->linesize[0], perms, frame->nb_samples, frame->format, av_frame_get_channel_layout(frame)); if (!samplesref) return NULL; if (avfilter_copy_frame_props(samplesref, frame) < 0) { samplesref->buf->data[0] = NULL; avfilter_unref_bufferp(&samplesref); } return samplesref; }
true
FFmpeg
5a4eb6aa275e4c1b80e1e125a7901903e35219f2
AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame, int perms) { AVFilterBufferRef *samplesref = avfilter_get_audio_buffer_ref_from_arrays((uint8_t **)frame->data, frame->linesize[0], perms, frame->nb_samples, frame->format, av_frame_get_channel_layout(frame)); if (!samplesref) return NULL; if (avfilter_copy_frame_props(samplesref, frame) < 0) { samplesref->buf->data[0] = NULL; avfilter_unref_bufferp(&samplesref); } return samplesref; }
{ "code": [ " AVFilterBufferRef *samplesref =", " avfilter_get_audio_buffer_ref_from_arrays((uint8_t **)frame->data, frame->linesize[0], perms," ], "line_no": [ 7, 9 ] }
AVFilterBufferRef *FUNC_0(const AVFrame *frame, int perms) { AVFilterBufferRef *samplesref = avfilter_get_audio_buffer_ref_from_arrays((uint8_t **)frame->data, frame->linesize[0], perms, frame->nb_samples, frame->format, av_frame_get_channel_layout(frame)); if (!samplesref) return NULL; if (avfilter_copy_frame_props(samplesref, frame) < 0) { samplesref->buf->data[0] = NULL; avfilter_unref_bufferp(&samplesref); } return samplesref; }
[ "AVFilterBufferRef *FUNC_0(const AVFrame *frame,\nint perms)\n{", "AVFilterBufferRef *samplesref =\navfilter_get_audio_buffer_ref_from_arrays((uint8_t **)frame->data, frame->linesize[0], perms,\nframe->nb_samples, frame->format,\nav_frame_get_channel_layout(frame));", "if (!samplesref)\nreturn NULL;", "if (avfilter_copy_frame_props(samplesref, frame) < 0) {", "samplesref->buf->data[0] = NULL;", "avfilter_unref_bufferp(&samplesref);", "}", "return samplesref;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9, 11, 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
13,240
int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s) { Wmv2Context *const w = (Wmv2Context *) s; if (s->pict_type == AV_PICTURE_TYPE_I) { if (w->j_type_bit) w->j_type = get_bits1(&s->gb); else w->j_type = 0; // FIXME check if (!w->j_type) { if (w->per_mb_rl_bit) s->per_mb_rl_table = get_bits1(&s->gb); else s->per_mb_rl_table = 0; if (!s->per_mb_rl_table) { s->rl_chroma_table_index = decode012(&s->gb); s->rl_table_index = decode012(&s->gb); } s->dc_table_index = get_bits1(&s->gb); } s->inter_intra_pred = 0; s->no_rounding = 1; if (s->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n", s->qscale, s->rl_chroma_table_index, s->rl_table_index, s->dc_table_index, s->per_mb_rl_table, w->j_type); } } else { int cbp_index; w->j_type = 0; parse_mb_skip(w); cbp_index = decode012(&s->gb); w->cbp_table_index = wmv2_get_cbp_table_index(s, cbp_index); if (w->mspel_bit) s->mspel = get_bits1(&s->gb); else s->mspel = 0; // FIXME check if (w->abt_flag) { w->per_mb_abt = get_bits1(&s->gb) ^ 1; if (!w->per_mb_abt) w->abt_type = decode012(&s->gb); } if (w->per_mb_rl_bit) s->per_mb_rl_table = get_bits1(&s->gb); else s->per_mb_rl_table = 0; if (!s->per_mb_rl_table) { s->rl_table_index = decode012(&s->gb); s->rl_chroma_table_index = s->rl_table_index; } s->dc_table_index = get_bits1(&s->gb); s->mv_table_index = get_bits1(&s->gb); s->inter_intra_pred = 0; // (s->width * s->height < 320 * 240 && s->bit_rate <= II_BITRATE); s->no_rounding ^= 1; if (s->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(s->avctx, AV_LOG_DEBUG, "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d " "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n", s->rl_table_index, s->rl_chroma_table_index, s->dc_table_index, s->mv_table_index, s->per_mb_rl_table, s->qscale, s->mspel, w->per_mb_abt, w->abt_type, w->cbp_table_index, s->inter_intra_pred); } } s->esc3_level_length = 0; s->esc3_run_length = 0; s->picture_number++; // FIXME ? if (w->j_type) { ff_intrax8_decode_picture(&w->x8, &s->current_picture, &s->gb, &s->mb_x, &s->mb_y, 2 * s->qscale, (s->qscale - 1) | 1, s->loop_filter, s->low_delay); ff_er_add_slice(&w->s.er, 0, 0, (w->s.mb_x >> 1) - 1, (w->s.mb_y >> 1) - 1, ER_MB_END); return 1; } return 0; }
true
FFmpeg
65e0a7c473f23f1833538ffecf53c81fe500b5e4
int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s) { Wmv2Context *const w = (Wmv2Context *) s; if (s->pict_type == AV_PICTURE_TYPE_I) { if (w->j_type_bit) w->j_type = get_bits1(&s->gb); else w->j_type = 0; if (!w->j_type) { if (w->per_mb_rl_bit) s->per_mb_rl_table = get_bits1(&s->gb); else s->per_mb_rl_table = 0; if (!s->per_mb_rl_table) { s->rl_chroma_table_index = decode012(&s->gb); s->rl_table_index = decode012(&s->gb); } s->dc_table_index = get_bits1(&s->gb); } s->inter_intra_pred = 0; s->no_rounding = 1; if (s->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n", s->qscale, s->rl_chroma_table_index, s->rl_table_index, s->dc_table_index, s->per_mb_rl_table, w->j_type); } } else { int cbp_index; w->j_type = 0; parse_mb_skip(w); cbp_index = decode012(&s->gb); w->cbp_table_index = wmv2_get_cbp_table_index(s, cbp_index); if (w->mspel_bit) s->mspel = get_bits1(&s->gb); else s->mspel = 0; if (w->abt_flag) { w->per_mb_abt = get_bits1(&s->gb) ^ 1; if (!w->per_mb_abt) w->abt_type = decode012(&s->gb); } if (w->per_mb_rl_bit) s->per_mb_rl_table = get_bits1(&s->gb); else s->per_mb_rl_table = 0; if (!s->per_mb_rl_table) { s->rl_table_index = decode012(&s->gb); s->rl_chroma_table_index = s->rl_table_index; } s->dc_table_index = get_bits1(&s->gb); s->mv_table_index = get_bits1(&s->gb); s->inter_intra_pred = 0; s->no_rounding ^= 1; if (s->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(s->avctx, AV_LOG_DEBUG, "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d " "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n", s->rl_table_index, s->rl_chroma_table_index, s->dc_table_index, s->mv_table_index, s->per_mb_rl_table, s->qscale, s->mspel, w->per_mb_abt, w->abt_type, w->cbp_table_index, s->inter_intra_pred); } } s->esc3_level_length = 0; s->esc3_run_length = 0; s->picture_number++; if (w->j_type) { ff_intrax8_decode_picture(&w->x8, &s->current_picture, &s->gb, &s->mb_x, &s->mb_y, 2 * s->qscale, (s->qscale - 1) | 1, s->loop_filter, s->low_delay); ff_er_add_slice(&w->s.er, 0, 0, (w->s.mb_x >> 1) - 1, (w->s.mb_y >> 1) - 1, ER_MB_END); return 1; } return 0; }
{ "code": [ " parse_mb_skip(w);" ], "line_no": [ 71 ] }
int FUNC_0(MpegEncContext *VAR_0) { Wmv2Context *const w = (Wmv2Context *) VAR_0; if (VAR_0->pict_type == AV_PICTURE_TYPE_I) { if (w->j_type_bit) w->j_type = get_bits1(&VAR_0->gb); else w->j_type = 0; if (!w->j_type) { if (w->per_mb_rl_bit) VAR_0->per_mb_rl_table = get_bits1(&VAR_0->gb); else VAR_0->per_mb_rl_table = 0; if (!VAR_0->per_mb_rl_table) { VAR_0->rl_chroma_table_index = decode012(&VAR_0->gb); VAR_0->rl_table_index = decode012(&VAR_0->gb); } VAR_0->dc_table_index = get_bits1(&VAR_0->gb); } VAR_0->inter_intra_pred = 0; VAR_0->no_rounding = 1; if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n", VAR_0->qscale, VAR_0->rl_chroma_table_index, VAR_0->rl_table_index, VAR_0->dc_table_index, VAR_0->per_mb_rl_table, w->j_type); } } else { int VAR_1; w->j_type = 0; parse_mb_skip(w); VAR_1 = decode012(&VAR_0->gb); w->cbp_table_index = wmv2_get_cbp_table_index(VAR_0, VAR_1); if (w->mspel_bit) VAR_0->mspel = get_bits1(&VAR_0->gb); else VAR_0->mspel = 0; if (w->abt_flag) { w->per_mb_abt = get_bits1(&VAR_0->gb) ^ 1; if (!w->per_mb_abt) w->abt_type = decode012(&VAR_0->gb); } if (w->per_mb_rl_bit) VAR_0->per_mb_rl_table = get_bits1(&VAR_0->gb); else VAR_0->per_mb_rl_table = 0; if (!VAR_0->per_mb_rl_table) { VAR_0->rl_table_index = decode012(&VAR_0->gb); VAR_0->rl_chroma_table_index = VAR_0->rl_table_index; } VAR_0->dc_table_index = get_bits1(&VAR_0->gb); VAR_0->mv_table_index = get_bits1(&VAR_0->gb); VAR_0->inter_intra_pred = 0; VAR_0->no_rounding ^= 1; if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d " "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n", VAR_0->rl_table_index, VAR_0->rl_chroma_table_index, VAR_0->dc_table_index, VAR_0->mv_table_index, VAR_0->per_mb_rl_table, VAR_0->qscale, VAR_0->mspel, w->per_mb_abt, w->abt_type, w->cbp_table_index, VAR_0->inter_intra_pred); } } VAR_0->esc3_level_length = 0; VAR_0->esc3_run_length = 0; VAR_0->picture_number++; if (w->j_type) { ff_intrax8_decode_picture(&w->x8, &VAR_0->current_picture, &VAR_0->gb, &VAR_0->mb_x, &VAR_0->mb_y, 2 * VAR_0->qscale, (VAR_0->qscale - 1) | 1, VAR_0->loop_filter, VAR_0->low_delay); ff_er_add_slice(&w->VAR_0.er, 0, 0, (w->VAR_0.mb_x >> 1) - 1, (w->VAR_0.mb_y >> 1) - 1, ER_MB_END); return 1; } return 0; }
[ "int FUNC_0(MpegEncContext *VAR_0)\n{", "Wmv2Context *const w = (Wmv2Context *) VAR_0;", "if (VAR_0->pict_type == AV_PICTURE_TYPE_I) {", "if (w->j_type_bit)\nw->j_type = get_bits1(&VAR_0->gb);", "else\nw->j_type = 0;", "if (!w->j_type) {", "if (w->per_mb_rl_bit)\nVAR_0->per_mb_rl_table = get_bits1(&VAR_0->gb);", "else\nVAR_0->per_mb_rl_table = 0;", "if (!VAR_0->per_mb_rl_table) {", "VAR_0->rl_chroma_table_index = decode012(&VAR_0->gb);", "VAR_0->rl_table_index = decode012(&VAR_0->gb);", "}", "VAR_0->dc_table_index = get_bits1(&VAR_0->gb);", "}", "VAR_0->inter_intra_pred = 0;", "VAR_0->no_rounding = 1;", "if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG,\n\"qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \\n\",\nVAR_0->qscale, VAR_0->rl_chroma_table_index, VAR_0->rl_table_index,\nVAR_0->dc_table_index, VAR_0->per_mb_rl_table, w->j_type);", "}", "} else {", "int VAR_1;", "w->j_type = 0;", "parse_mb_skip(w);", "VAR_1 = decode012(&VAR_0->gb);", "w->cbp_table_index = wmv2_get_cbp_table_index(VAR_0, VAR_1);", "if (w->mspel_bit)\nVAR_0->mspel = get_bits1(&VAR_0->gb);", "else\nVAR_0->mspel = 0;", "if (w->abt_flag) {", "w->per_mb_abt = get_bits1(&VAR_0->gb) ^ 1;", "if (!w->per_mb_abt)\nw->abt_type = decode012(&VAR_0->gb);", "}", "if (w->per_mb_rl_bit)\nVAR_0->per_mb_rl_table = get_bits1(&VAR_0->gb);", "else\nVAR_0->per_mb_rl_table = 0;", "if (!VAR_0->per_mb_rl_table) {", "VAR_0->rl_table_index = decode012(&VAR_0->gb);", "VAR_0->rl_chroma_table_index = VAR_0->rl_table_index;", "}", "VAR_0->dc_table_index = get_bits1(&VAR_0->gb);", "VAR_0->mv_table_index = get_bits1(&VAR_0->gb);", "VAR_0->inter_intra_pred = 0;", "VAR_0->no_rounding ^= 1;", "if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) {", "av_log(VAR_0->avctx, AV_LOG_DEBUG,\n\"rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d \"\n\"per_mb_abt:%d abt_type:%d cbp:%d ii:%d\\n\",\nVAR_0->rl_table_index, VAR_0->rl_chroma_table_index,\nVAR_0->dc_table_index, VAR_0->mv_table_index,\nVAR_0->per_mb_rl_table, VAR_0->qscale, VAR_0->mspel,\nw->per_mb_abt, w->abt_type, w->cbp_table_index,\nVAR_0->inter_intra_pred);", "}", "}", "VAR_0->esc3_level_length = 0;", "VAR_0->esc3_run_length = 0;", "VAR_0->picture_number++;", "if (w->j_type) {", "ff_intrax8_decode_picture(&w->x8, &VAR_0->current_picture,\n&VAR_0->gb, &VAR_0->mb_x, &VAR_0->mb_y,\n2 * VAR_0->qscale, (VAR_0->qscale - 1) | 1,\nVAR_0->loop_filter, VAR_0->low_delay);", "ff_er_add_slice(&w->VAR_0.er, 0, 0,\n(w->VAR_0.mb_x >> 1) - 1, (w->VAR_0.mb_y >> 1) - 1,\nER_MB_END);", "return 1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 21 ], [ 23, 25 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83, 85 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 101, 103 ], [ 105, 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 133 ], [ 135, 137, 139, 141, 143, 145, 147, 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165, 167, 169, 171 ], [ 175, 177, 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ] ]
13,241
static void vp8_decode_flush_impl(AVCodecContext *avctx, int force, int is_close) { VP8Context *s = avctx->priv_data; int i; if (!avctx->is_copy || force) { for (i = 0; i < 5; i++) if (s->frames[i].data[0]) vp8_release_frame(s, &s->frames[i], is_close); } memset(s->framep, 0, sizeof(s->framep)); free_buffers(s); s->maps_are_invalid = 1; }
true
FFmpeg
bfa0f96586fe2c257cfa574ffb991da493a54da1
static void vp8_decode_flush_impl(AVCodecContext *avctx, int force, int is_close) { VP8Context *s = avctx->priv_data; int i; if (!avctx->is_copy || force) { for (i = 0; i < 5; i++) if (s->frames[i].data[0]) vp8_release_frame(s, &s->frames[i], is_close); } memset(s->framep, 0, sizeof(s->framep)); free_buffers(s); s->maps_are_invalid = 1; }
{ "code": [ "static void vp8_decode_flush_impl(AVCodecContext *avctx, int force, int is_close)", " if (!avctx->is_copy || force) {", " vp8_release_frame(s, &s->frames[i], is_close);", " free_buffers(s);", " s->maps_are_invalid = 1;" ], "line_no": [ 1, 11, 17, 25, 27 ] }
static void FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2) { VP8Context *s = VAR_0->priv_data; int VAR_3; if (!VAR_0->is_copy || VAR_1) { for (VAR_3 = 0; VAR_3 < 5; VAR_3++) if (s->frames[VAR_3].data[0]) vp8_release_frame(s, &s->frames[VAR_3], VAR_2); } memset(s->framep, 0, sizeof(s->framep)); free_buffers(s); s->maps_are_invalid = 1; }
[ "static void FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2)\n{", "VP8Context *s = VAR_0->priv_data;", "int VAR_3;", "if (!VAR_0->is_copy || VAR_1) {", "for (VAR_3 = 0; VAR_3 < 5; VAR_3++)", "if (s->frames[VAR_3].data[0])\nvp8_release_frame(s, &s->frames[VAR_3], VAR_2);", "}", "memset(s->framep, 0, sizeof(s->framep));", "free_buffers(s);", "s->maps_are_invalid = 1;", "}" ]
[ 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ] ]
13,242
static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts) { CharDriverState *chr; if (stdio_nb_clients >= STDIO_MAX_CLIENTS) { if (stdio_nb_clients == 0) { old_fd0_flags = fcntl(0, F_GETFL); tcgetattr (0, &oldtty); fcntl(0, F_SETFL, O_NONBLOCK); atexit(term_exit); chr = qemu_chr_open_fd(0, 1); chr->chr_close = qemu_chr_close_stdio; chr->chr_set_echo = qemu_chr_set_echo_stdio; qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr); stdio_nb_clients++; stdio_allow_signal = qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC); qemu_chr_fe_set_echo(chr, false); return chr;
true
qemu
ab51b1d568e02c80b1abf9016bda3a86dc1db389
static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts) { CharDriverState *chr; if (stdio_nb_clients >= STDIO_MAX_CLIENTS) { if (stdio_nb_clients == 0) { old_fd0_flags = fcntl(0, F_GETFL); tcgetattr (0, &oldtty); fcntl(0, F_SETFL, O_NONBLOCK); atexit(term_exit); chr = qemu_chr_open_fd(0, 1); chr->chr_close = qemu_chr_close_stdio; chr->chr_set_echo = qemu_chr_set_echo_stdio; qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr); stdio_nb_clients++; stdio_allow_signal = qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC); qemu_chr_fe_set_echo(chr, false); return chr;
{ "code": [], "line_no": [] }
static CharDriverState *FUNC_0(QemuOpts *opts) { CharDriverState *chr; if (stdio_nb_clients >= STDIO_MAX_CLIENTS) { if (stdio_nb_clients == 0) { old_fd0_flags = fcntl(0, F_GETFL); tcgetattr (0, &oldtty); fcntl(0, F_SETFL, O_NONBLOCK); atexit(term_exit); chr = qemu_chr_open_fd(0, 1); chr->chr_close = qemu_chr_close_stdio; chr->chr_set_echo = qemu_chr_set_echo_stdio; qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr); stdio_nb_clients++; stdio_allow_signal = qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC); qemu_chr_fe_set_echo(chr, false); return chr;
[ "static CharDriverState *FUNC_0(QemuOpts *opts)\n{", "CharDriverState *chr;", "if (stdio_nb_clients >= STDIO_MAX_CLIENTS) {", "if (stdio_nb_clients == 0) {", "old_fd0_flags = fcntl(0, F_GETFL);", "tcgetattr (0, &oldtty);", "fcntl(0, F_SETFL, O_NONBLOCK);", "atexit(term_exit);", "chr = qemu_chr_open_fd(0, 1);", "chr->chr_close = qemu_chr_close_stdio;", "chr->chr_set_echo = qemu_chr_set_echo_stdio;", "qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr);", "stdio_nb_clients++;", "stdio_allow_signal = qemu_opt_get_bool(opts, \"signal\",\ndisplay_type != DT_NOGRAPHIC);", "qemu_chr_fe_set_echo(chr, false);", "return chr;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 30 ], [ 32 ], [ 34 ], [ 36 ], [ 38 ], [ 40, 42 ], [ 44 ], [ 48 ] ]
13,243
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { LclContext * const c = (LclContext *)avctx->priv_data; unsigned char *encoded = (unsigned char *)buf; int pixel_ptr; int row, col; unsigned char *outptr; unsigned int width = avctx->width; // Real image width unsigned int height = avctx->height; // Real image height unsigned int mszh_dlen; unsigned char yq, y1q, uq, vq; int uqvq; unsigned int mthread_inlen, mthread_outlen; #ifdef CONFIG_ZLIB int zret; // Zlib return code #endif int len = buf_size; /* no supplementary picture */ if (buf_size == 0) return 0; if(c->pic.data[0]) avctx->release_buffer(avctx, &c->pic); c->pic.reference = 0; c->pic.buffer_hints = FF_BUFFER_HINTS_VALID; if(avctx->get_buffer(avctx, &c->pic) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } outptr = c->pic.data[0]; // Output image pointer /* Decompress frame */ switch (avctx->codec_id) { case CODEC_ID_MSZH: switch (c->compression) { case COMP_MSZH: if (c->flags & FLAG_MULTITHREAD) { mthread_inlen = *((unsigned int*)encoded); mthread_outlen = *((unsigned int*)(encoded+4)); mszh_dlen = mszh_decomp(encoded + 8, mthread_inlen, c->decomp_buf); if (mthread_outlen != mszh_dlen) { av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%d != %d)\n", mthread_outlen, mszh_dlen); } mszh_dlen = mszh_decomp(encoded + 8 + mthread_inlen, len - mthread_inlen, c->decomp_buf + mthread_outlen); if ((c->decomp_size - mthread_outlen) != mszh_dlen) { av_log(avctx, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %d)\n", c->decomp_size - mthread_outlen, mszh_dlen); } encoded = c->decomp_buf; len = c->decomp_size; } else { mszh_dlen = mszh_decomp(encoded, len, c->decomp_buf); if (c->decomp_size != mszh_dlen) { av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %d)\n", c->decomp_size, mszh_dlen); } encoded = c->decomp_buf; len = mszh_dlen; } break; case COMP_MSZH_NOCOMP: break; default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown MSZH compression in frame decoder.\n"); return -1; } break; case CODEC_ID_ZLIB: #ifdef CONFIG_ZLIB /* Using the original dll with normal compression (-1) and RGB format * gives a file with ZLIB fourcc, but frame is really uncompressed. * To be sure that's true check also frame size */ if ((c->compression == COMP_ZLIB_NORMAL) && (c->imgtype == IMGTYPE_RGB24) && (len == width * height * 3)) break; zret = inflateReset(&(c->zstream)); if (zret != Z_OK) { av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret); return -1; } if (c->flags & FLAG_MULTITHREAD) { mthread_inlen = *((unsigned int*)encoded); mthread_outlen = *((unsigned int*)(encoded+4)); c->zstream.next_in = encoded + 8; c->zstream.avail_in = mthread_inlen; c->zstream.next_out = c->decomp_buf; c->zstream.avail_out = mthread_outlen; zret = inflate(&(c->zstream), Z_FINISH); if ((zret != Z_OK) && (zret != Z_STREAM_END)) { av_log(avctx, AV_LOG_ERROR, "Mthread1 inflate error: %d\n", zret); return -1; } if (mthread_outlen != (unsigned int)(c->zstream.total_out)) { av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%u != %lu)\n", mthread_outlen, c->zstream.total_out); } zret = inflateReset(&(c->zstream)); if (zret != Z_OK) { av_log(avctx, AV_LOG_ERROR, "Mthread2 inflate reset error: %d\n", zret); return -1; } c->zstream.next_in = encoded + 8 + mthread_inlen; c->zstream.avail_in = len - mthread_inlen; c->zstream.next_out = c->decomp_buf + mthread_outlen; c->zstream.avail_out = mthread_outlen; zret = inflate(&(c->zstream), Z_FINISH); if ((zret != Z_OK) && (zret != Z_STREAM_END)) { av_log(avctx, AV_LOG_ERROR, "Mthread2 inflate error: %d\n", zret); return -1; } if ((c->decomp_size - mthread_outlen) != (unsigned int)(c->zstream.total_out)) { av_log(avctx, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %lu)\n", c->decomp_size - mthread_outlen, c->zstream.total_out); } } else { c->zstream.next_in = encoded; c->zstream.avail_in = len; c->zstream.next_out = c->decomp_buf; c->zstream.avail_out = c->decomp_size; zret = inflate(&(c->zstream), Z_FINISH); if ((zret != Z_OK) && (zret != Z_STREAM_END)) { av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", zret); return -1; } if (c->decomp_size != (unsigned int)(c->zstream.total_out)) { av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %lu)\n", c->decomp_size, c->zstream.total_out); } } encoded = c->decomp_buf; len = c->decomp_size;; #else av_log(avctx, AV_LOG_ERROR, "BUG! Zlib support not compiled in frame decoder.\n"); return -1; #endif break; default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown codec in frame decoder compression switch.\n"); return -1; } /* Apply PNG filter */ if ((avctx->codec_id == CODEC_ID_ZLIB) && (c->flags & FLAG_PNGFILTER)) { switch (c->imgtype) { case IMGTYPE_YUV111: case IMGTYPE_RGB24: for (row = 0; row < height; row++) { pixel_ptr = row * width * 3; yq = encoded[pixel_ptr++]; uqvq = encoded[pixel_ptr++]; uqvq+=(encoded[pixel_ptr++] << 8); for (col = 1; col < width; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; uqvq -= (encoded[pixel_ptr+1] | (encoded[pixel_ptr+2]<<8)); encoded[pixel_ptr+1] = (uqvq) & 0xff; encoded[pixel_ptr+2] = ((uqvq)>>8) & 0xff; pixel_ptr += 3; } } break; case IMGTYPE_YUV422: for (row = 0; row < height; row++) { pixel_ptr = row * width * 2; yq = uq = vq =0; for (col = 0; col < width/4; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; encoded[pixel_ptr+2] = yq -= encoded[pixel_ptr+2]; encoded[pixel_ptr+3] = yq -= encoded[pixel_ptr+3]; encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4]; encoded[pixel_ptr+5] = uq -= encoded[pixel_ptr+5]; encoded[pixel_ptr+6] = vq -= encoded[pixel_ptr+6]; encoded[pixel_ptr+7] = vq -= encoded[pixel_ptr+7]; pixel_ptr += 8; } } break; case IMGTYPE_YUV411: for (row = 0; row < height; row++) { pixel_ptr = row * width / 2 * 3; yq = uq = vq =0; for (col = 0; col < width/4; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; encoded[pixel_ptr+2] = yq -= encoded[pixel_ptr+2]; encoded[pixel_ptr+3] = yq -= encoded[pixel_ptr+3]; encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4]; encoded[pixel_ptr+5] = vq -= encoded[pixel_ptr+5]; pixel_ptr += 6; } } break; case IMGTYPE_YUV211: for (row = 0; row < height; row++) { pixel_ptr = row * width * 2; yq = uq = vq =0; for (col = 0; col < width/2; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; encoded[pixel_ptr+2] = uq -= encoded[pixel_ptr+2]; encoded[pixel_ptr+3] = vq -= encoded[pixel_ptr+3]; pixel_ptr += 4; } } break; case IMGTYPE_YUV420: for (row = 0; row < height/2; row++) { pixel_ptr = row * width * 3; yq = y1q = uq = vq =0; for (col = 0; col < width/2; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; encoded[pixel_ptr+2] = y1q -= encoded[pixel_ptr+2]; encoded[pixel_ptr+3] = y1q -= encoded[pixel_ptr+3]; encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4]; encoded[pixel_ptr+5] = vq -= encoded[pixel_ptr+5]; pixel_ptr += 6; } } break; default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in pngfilter switch.\n"); return -1; } } /* Convert colorspace */ switch (c->imgtype) { case IMGTYPE_YUV111: for (row = height - 1; row >= 0; row--) { pixel_ptr = row * c->pic.linesize[0]; for (col = 0; col < width; col++) { outptr[pixel_ptr++] = get_b(encoded[0], encoded[1]); outptr[pixel_ptr++] = get_g(encoded[0], encoded[1], encoded[2]); outptr[pixel_ptr++] = get_r(encoded[0], encoded[2]); encoded += 3; } } break; case IMGTYPE_YUV422: for (row = height - 1; row >= 0; row--) { pixel_ptr = row * c->pic.linesize[0]; for (col = 0; col < width/4; col++) { outptr[pixel_ptr++] = get_b(encoded[0], encoded[4]); outptr[pixel_ptr++] = get_g(encoded[0], encoded[4], encoded[6]); outptr[pixel_ptr++] = get_r(encoded[0], encoded[6]); outptr[pixel_ptr++] = get_b(encoded[1], encoded[4]); outptr[pixel_ptr++] = get_g(encoded[1], encoded[4], encoded[6]); outptr[pixel_ptr++] = get_r(encoded[1], encoded[6]); outptr[pixel_ptr++] = get_b(encoded[2], encoded[5]); outptr[pixel_ptr++] = get_g(encoded[2], encoded[5], encoded[7]); outptr[pixel_ptr++] = get_r(encoded[2], encoded[7]); outptr[pixel_ptr++] = get_b(encoded[3], encoded[5]); outptr[pixel_ptr++] = get_g(encoded[3], encoded[5], encoded[7]); outptr[pixel_ptr++] = get_r(encoded[3], encoded[7]); encoded += 8; } } break; case IMGTYPE_RGB24: for (row = height - 1; row >= 0; row--) { pixel_ptr = row * c->pic.linesize[0]; for (col = 0; col < width; col++) { outptr[pixel_ptr++] = encoded[0]; outptr[pixel_ptr++] = encoded[1]; outptr[pixel_ptr++] = encoded[2]; encoded += 3; } } break; case IMGTYPE_YUV411: for (row = height - 1; row >= 0; row--) { pixel_ptr = row * c->pic.linesize[0]; for (col = 0; col < width/4; col++) { outptr[pixel_ptr++] = get_b(encoded[0], encoded[4]); outptr[pixel_ptr++] = get_g(encoded[0], encoded[4], encoded[5]); outptr[pixel_ptr++] = get_r(encoded[0], encoded[5]); outptr[pixel_ptr++] = get_b(encoded[1], encoded[4]); outptr[pixel_ptr++] = get_g(encoded[1], encoded[4], encoded[5]); outptr[pixel_ptr++] = get_r(encoded[1], encoded[5]); outptr[pixel_ptr++] = get_b(encoded[2], encoded[4]); outptr[pixel_ptr++] = get_g(encoded[2], encoded[4], encoded[5]); outptr[pixel_ptr++] = get_r(encoded[2], encoded[5]); outptr[pixel_ptr++] = get_b(encoded[3], encoded[4]); outptr[pixel_ptr++] = get_g(encoded[3], encoded[4], encoded[5]); outptr[pixel_ptr++] = get_r(encoded[3], encoded[5]); encoded += 6; } } break; case IMGTYPE_YUV211: for (row = height - 1; row >= 0; row--) { pixel_ptr = row * c->pic.linesize[0]; for (col = 0; col < width/2; col++) { outptr[pixel_ptr++] = get_b(encoded[0], encoded[2]); outptr[pixel_ptr++] = get_g(encoded[0], encoded[2], encoded[3]); outptr[pixel_ptr++] = get_r(encoded[0], encoded[3]); outptr[pixel_ptr++] = get_b(encoded[1], encoded[2]); outptr[pixel_ptr++] = get_g(encoded[1], encoded[2], encoded[3]); outptr[pixel_ptr++] = get_r(encoded[1], encoded[3]); encoded += 4; } } break; case IMGTYPE_YUV420: for (row = height / 2 - 1; row >= 0; row--) { pixel_ptr = 2 * row * c->pic.linesize[0]; for (col = 0; col < width/2; col++) { outptr[pixel_ptr] = get_b(encoded[0], encoded[4]); outptr[pixel_ptr+1] = get_g(encoded[0], encoded[4], encoded[5]); outptr[pixel_ptr+2] = get_r(encoded[0], encoded[5]); outptr[pixel_ptr+3] = get_b(encoded[1], encoded[4]); outptr[pixel_ptr+4] = get_g(encoded[1], encoded[4], encoded[5]); outptr[pixel_ptr+5] = get_r(encoded[1], encoded[5]); outptr[pixel_ptr-c->pic.linesize[0]] = get_b(encoded[2], encoded[4]); outptr[pixel_ptr-c->pic.linesize[0]+1] = get_g(encoded[2], encoded[4], encoded[5]); outptr[pixel_ptr-c->pic.linesize[0]+2] = get_r(encoded[2], encoded[5]); outptr[pixel_ptr-c->pic.linesize[0]+3] = get_b(encoded[3], encoded[4]); outptr[pixel_ptr-c->pic.linesize[0]+4] = get_g(encoded[3], encoded[4], encoded[5]); outptr[pixel_ptr-c->pic.linesize[0]+5] = get_r(encoded[3], encoded[5]); pixel_ptr += 6; encoded += 6; } } break; default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in image decoder.\n"); return -1; } *data_size = sizeof(AVFrame); *(AVFrame*)data = c->pic; /* always report that the buffer was completely consumed */ return buf_size; }
true
FFmpeg
c31b81216619e6b3d986ce63c82357993e10e8e9
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { LclContext * const c = (LclContext *)avctx->priv_data; unsigned char *encoded = (unsigned char *)buf; int pixel_ptr; int row, col; unsigned char *outptr; unsigned int width = avctx->width; unsigned int height = avctx->height; unsigned int mszh_dlen; unsigned char yq, y1q, uq, vq; int uqvq; unsigned int mthread_inlen, mthread_outlen; #ifdef CONFIG_ZLIB int zret; #endif int len = buf_size; if (buf_size == 0) return 0; if(c->pic.data[0]) avctx->release_buffer(avctx, &c->pic); c->pic.reference = 0; c->pic.buffer_hints = FF_BUFFER_HINTS_VALID; if(avctx->get_buffer(avctx, &c->pic) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } outptr = c->pic.data[0]; switch (avctx->codec_id) { case CODEC_ID_MSZH: switch (c->compression) { case COMP_MSZH: if (c->flags & FLAG_MULTITHREAD) { mthread_inlen = *((unsigned int*)encoded); mthread_outlen = *((unsigned int*)(encoded+4)); mszh_dlen = mszh_decomp(encoded + 8, mthread_inlen, c->decomp_buf); if (mthread_outlen != mszh_dlen) { av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%d != %d)\n", mthread_outlen, mszh_dlen); } mszh_dlen = mszh_decomp(encoded + 8 + mthread_inlen, len - mthread_inlen, c->decomp_buf + mthread_outlen); if ((c->decomp_size - mthread_outlen) != mszh_dlen) { av_log(avctx, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %d)\n", c->decomp_size - mthread_outlen, mszh_dlen); } encoded = c->decomp_buf; len = c->decomp_size; } else { mszh_dlen = mszh_decomp(encoded, len, c->decomp_buf); if (c->decomp_size != mszh_dlen) { av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %d)\n", c->decomp_size, mszh_dlen); } encoded = c->decomp_buf; len = mszh_dlen; } break; case COMP_MSZH_NOCOMP: break; default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown MSZH compression in frame decoder.\n"); return -1; } break; case CODEC_ID_ZLIB: #ifdef CONFIG_ZLIB if ((c->compression == COMP_ZLIB_NORMAL) && (c->imgtype == IMGTYPE_RGB24) && (len == width * height * 3)) break; zret = inflateReset(&(c->zstream)); if (zret != Z_OK) { av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret); return -1; } if (c->flags & FLAG_MULTITHREAD) { mthread_inlen = *((unsigned int*)encoded); mthread_outlen = *((unsigned int*)(encoded+4)); c->zstream.next_in = encoded + 8; c->zstream.avail_in = mthread_inlen; c->zstream.next_out = c->decomp_buf; c->zstream.avail_out = mthread_outlen; zret = inflate(&(c->zstream), Z_FINISH); if ((zret != Z_OK) && (zret != Z_STREAM_END)) { av_log(avctx, AV_LOG_ERROR, "Mthread1 inflate error: %d\n", zret); return -1; } if (mthread_outlen != (unsigned int)(c->zstream.total_out)) { av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%u != %lu)\n", mthread_outlen, c->zstream.total_out); } zret = inflateReset(&(c->zstream)); if (zret != Z_OK) { av_log(avctx, AV_LOG_ERROR, "Mthread2 inflate reset error: %d\n", zret); return -1; } c->zstream.next_in = encoded + 8 + mthread_inlen; c->zstream.avail_in = len - mthread_inlen; c->zstream.next_out = c->decomp_buf + mthread_outlen; c->zstream.avail_out = mthread_outlen; zret = inflate(&(c->zstream), Z_FINISH); if ((zret != Z_OK) && (zret != Z_STREAM_END)) { av_log(avctx, AV_LOG_ERROR, "Mthread2 inflate error: %d\n", zret); return -1; } if ((c->decomp_size - mthread_outlen) != (unsigned int)(c->zstream.total_out)) { av_log(avctx, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %lu)\n", c->decomp_size - mthread_outlen, c->zstream.total_out); } } else { c->zstream.next_in = encoded; c->zstream.avail_in = len; c->zstream.next_out = c->decomp_buf; c->zstream.avail_out = c->decomp_size; zret = inflate(&(c->zstream), Z_FINISH); if ((zret != Z_OK) && (zret != Z_STREAM_END)) { av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", zret); return -1; } if (c->decomp_size != (unsigned int)(c->zstream.total_out)) { av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %lu)\n", c->decomp_size, c->zstream.total_out); } } encoded = c->decomp_buf; len = c->decomp_size;; #else av_log(avctx, AV_LOG_ERROR, "BUG! Zlib support not compiled in frame decoder.\n"); return -1; #endif break; default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown codec in frame decoder compression switch.\n"); return -1; } if ((avctx->codec_id == CODEC_ID_ZLIB) && (c->flags & FLAG_PNGFILTER)) { switch (c->imgtype) { case IMGTYPE_YUV111: case IMGTYPE_RGB24: for (row = 0; row < height; row++) { pixel_ptr = row * width * 3; yq = encoded[pixel_ptr++]; uqvq = encoded[pixel_ptr++]; uqvq+=(encoded[pixel_ptr++] << 8); for (col = 1; col < width; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; uqvq -= (encoded[pixel_ptr+1] | (encoded[pixel_ptr+2]<<8)); encoded[pixel_ptr+1] = (uqvq) & 0xff; encoded[pixel_ptr+2] = ((uqvq)>>8) & 0xff; pixel_ptr += 3; } } break; case IMGTYPE_YUV422: for (row = 0; row < height; row++) { pixel_ptr = row * width * 2; yq = uq = vq =0; for (col = 0; col < width/4; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; encoded[pixel_ptr+2] = yq -= encoded[pixel_ptr+2]; encoded[pixel_ptr+3] = yq -= encoded[pixel_ptr+3]; encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4]; encoded[pixel_ptr+5] = uq -= encoded[pixel_ptr+5]; encoded[pixel_ptr+6] = vq -= encoded[pixel_ptr+6]; encoded[pixel_ptr+7] = vq -= encoded[pixel_ptr+7]; pixel_ptr += 8; } } break; case IMGTYPE_YUV411: for (row = 0; row < height; row++) { pixel_ptr = row * width / 2 * 3; yq = uq = vq =0; for (col = 0; col < width/4; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; encoded[pixel_ptr+2] = yq -= encoded[pixel_ptr+2]; encoded[pixel_ptr+3] = yq -= encoded[pixel_ptr+3]; encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4]; encoded[pixel_ptr+5] = vq -= encoded[pixel_ptr+5]; pixel_ptr += 6; } } break; case IMGTYPE_YUV211: for (row = 0; row < height; row++) { pixel_ptr = row * width * 2; yq = uq = vq =0; for (col = 0; col < width/2; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; encoded[pixel_ptr+2] = uq -= encoded[pixel_ptr+2]; encoded[pixel_ptr+3] = vq -= encoded[pixel_ptr+3]; pixel_ptr += 4; } } break; case IMGTYPE_YUV420: for (row = 0; row < height/2; row++) { pixel_ptr = row * width * 3; yq = y1q = uq = vq =0; for (col = 0; col < width/2; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; encoded[pixel_ptr+2] = y1q -= encoded[pixel_ptr+2]; encoded[pixel_ptr+3] = y1q -= encoded[pixel_ptr+3]; encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4]; encoded[pixel_ptr+5] = vq -= encoded[pixel_ptr+5]; pixel_ptr += 6; } } break; default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in pngfilter switch.\n"); return -1; } } switch (c->imgtype) { case IMGTYPE_YUV111: for (row = height - 1; row >= 0; row--) { pixel_ptr = row * c->pic.linesize[0]; for (col = 0; col < width; col++) { outptr[pixel_ptr++] = get_b(encoded[0], encoded[1]); outptr[pixel_ptr++] = get_g(encoded[0], encoded[1], encoded[2]); outptr[pixel_ptr++] = get_r(encoded[0], encoded[2]); encoded += 3; } } break; case IMGTYPE_YUV422: for (row = height - 1; row >= 0; row--) { pixel_ptr = row * c->pic.linesize[0]; for (col = 0; col < width/4; col++) { outptr[pixel_ptr++] = get_b(encoded[0], encoded[4]); outptr[pixel_ptr++] = get_g(encoded[0], encoded[4], encoded[6]); outptr[pixel_ptr++] = get_r(encoded[0], encoded[6]); outptr[pixel_ptr++] = get_b(encoded[1], encoded[4]); outptr[pixel_ptr++] = get_g(encoded[1], encoded[4], encoded[6]); outptr[pixel_ptr++] = get_r(encoded[1], encoded[6]); outptr[pixel_ptr++] = get_b(encoded[2], encoded[5]); outptr[pixel_ptr++] = get_g(encoded[2], encoded[5], encoded[7]); outptr[pixel_ptr++] = get_r(encoded[2], encoded[7]); outptr[pixel_ptr++] = get_b(encoded[3], encoded[5]); outptr[pixel_ptr++] = get_g(encoded[3], encoded[5], encoded[7]); outptr[pixel_ptr++] = get_r(encoded[3], encoded[7]); encoded += 8; } } break; case IMGTYPE_RGB24: for (row = height - 1; row >= 0; row--) { pixel_ptr = row * c->pic.linesize[0]; for (col = 0; col < width; col++) { outptr[pixel_ptr++] = encoded[0]; outptr[pixel_ptr++] = encoded[1]; outptr[pixel_ptr++] = encoded[2]; encoded += 3; } } break; case IMGTYPE_YUV411: for (row = height - 1; row >= 0; row--) { pixel_ptr = row * c->pic.linesize[0]; for (col = 0; col < width/4; col++) { outptr[pixel_ptr++] = get_b(encoded[0], encoded[4]); outptr[pixel_ptr++] = get_g(encoded[0], encoded[4], encoded[5]); outptr[pixel_ptr++] = get_r(encoded[0], encoded[5]); outptr[pixel_ptr++] = get_b(encoded[1], encoded[4]); outptr[pixel_ptr++] = get_g(encoded[1], encoded[4], encoded[5]); outptr[pixel_ptr++] = get_r(encoded[1], encoded[5]); outptr[pixel_ptr++] = get_b(encoded[2], encoded[4]); outptr[pixel_ptr++] = get_g(encoded[2], encoded[4], encoded[5]); outptr[pixel_ptr++] = get_r(encoded[2], encoded[5]); outptr[pixel_ptr++] = get_b(encoded[3], encoded[4]); outptr[pixel_ptr++] = get_g(encoded[3], encoded[4], encoded[5]); outptr[pixel_ptr++] = get_r(encoded[3], encoded[5]); encoded += 6; } } break; case IMGTYPE_YUV211: for (row = height - 1; row >= 0; row--) { pixel_ptr = row * c->pic.linesize[0]; for (col = 0; col < width/2; col++) { outptr[pixel_ptr++] = get_b(encoded[0], encoded[2]); outptr[pixel_ptr++] = get_g(encoded[0], encoded[2], encoded[3]); outptr[pixel_ptr++] = get_r(encoded[0], encoded[3]); outptr[pixel_ptr++] = get_b(encoded[1], encoded[2]); outptr[pixel_ptr++] = get_g(encoded[1], encoded[2], encoded[3]); outptr[pixel_ptr++] = get_r(encoded[1], encoded[3]); encoded += 4; } } break; case IMGTYPE_YUV420: for (row = height / 2 - 1; row >= 0; row--) { pixel_ptr = 2 * row * c->pic.linesize[0]; for (col = 0; col < width/2; col++) { outptr[pixel_ptr] = get_b(encoded[0], encoded[4]); outptr[pixel_ptr+1] = get_g(encoded[0], encoded[4], encoded[5]); outptr[pixel_ptr+2] = get_r(encoded[0], encoded[5]); outptr[pixel_ptr+3] = get_b(encoded[1], encoded[4]); outptr[pixel_ptr+4] = get_g(encoded[1], encoded[4], encoded[5]); outptr[pixel_ptr+5] = get_r(encoded[1], encoded[5]); outptr[pixel_ptr-c->pic.linesize[0]] = get_b(encoded[2], encoded[4]); outptr[pixel_ptr-c->pic.linesize[0]+1] = get_g(encoded[2], encoded[4], encoded[5]); outptr[pixel_ptr-c->pic.linesize[0]+2] = get_r(encoded[2], encoded[5]); outptr[pixel_ptr-c->pic.linesize[0]+3] = get_b(encoded[3], encoded[4]); outptr[pixel_ptr-c->pic.linesize[0]+4] = get_g(encoded[3], encoded[4], encoded[5]); outptr[pixel_ptr-c->pic.linesize[0]+5] = get_r(encoded[3], encoded[5]); pixel_ptr += 6; encoded += 6; } } break; default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in image decoder.\n"); return -1; } *data_size = sizeof(AVFrame); *(AVFrame*)data = c->pic; return buf_size; }
{ "code": [ " int pixel_ptr;", " int len = buf_size;", " mszh_dlen = mszh_decomp(encoded + 8, mthread_inlen, c->decomp_buf);", " c->decomp_buf + mthread_outlen);", " if ((c->decomp_size - mthread_outlen) != mszh_dlen) {", " c->decomp_size - mthread_outlen, mszh_dlen);", " mszh_dlen = mszh_decomp(encoded, len, c->decomp_buf);", " c->zstream.avail_out = mthread_outlen; ", " c->zstream.avail_out = mthread_outlen; ", " if ((c->decomp_size - mthread_outlen) != (unsigned int)(c->zstream.total_out)) {", " c->decomp_size - mthread_outlen, c->zstream.total_out);" ], "line_no": [ 9, 33, 85, 97, 99, 103, 113, 183, 183, 231, 235 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, uint8_t *VAR_3, int VAR_4) { LclContext * const c = (LclContext *)VAR_0->priv_data; unsigned char *VAR_5 = (unsigned char *)VAR_3; int VAR_6; int VAR_7, VAR_8; unsigned char *VAR_9; unsigned int VAR_10 = VAR_0->VAR_10; unsigned int VAR_11 = VAR_0->VAR_11; unsigned int VAR_12; unsigned char VAR_13, VAR_14, VAR_15, VAR_16; int VAR_17; unsigned int VAR_18, VAR_19; #ifdef CONFIG_ZLIB int zret; #endif int VAR_20 = VAR_4; if (VAR_4 == 0) return 0; if(c->pic.VAR_1[0]) VAR_0->release_buffer(VAR_0, &c->pic); c->pic.reference = 0; c->pic.buffer_hints = FF_BUFFER_HINTS_VALID; if(VAR_0->get_buffer(VAR_0, &c->pic) < 0){ av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } VAR_9 = c->pic.VAR_1[0]; switch (VAR_0->codec_id) { case CODEC_ID_MSZH: switch (c->compression) { case COMP_MSZH: if (c->flags & FLAG_MULTITHREAD) { VAR_18 = *((unsigned int*)VAR_5); VAR_19 = *((unsigned int*)(VAR_5+4)); VAR_12 = mszh_decomp(VAR_5 + 8, VAR_18, c->decomp_buf); if (VAR_19 != VAR_12) { av_log(VAR_0, AV_LOG_ERROR, "Mthread1 decoded size differs (%d != %d)\n", VAR_19, VAR_12); } VAR_12 = mszh_decomp(VAR_5 + 8 + VAR_18, VAR_20 - VAR_18, c->decomp_buf + VAR_19); if ((c->decomp_size - VAR_19) != VAR_12) { av_log(VAR_0, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %d)\n", c->decomp_size - VAR_19, VAR_12); } VAR_5 = c->decomp_buf; VAR_20 = c->decomp_size; } else { VAR_12 = mszh_decomp(VAR_5, VAR_20, c->decomp_buf); if (c->decomp_size != VAR_12) { av_log(VAR_0, AV_LOG_ERROR, "Decoded size differs (%d != %d)\n", c->decomp_size, VAR_12); } VAR_5 = c->decomp_buf; VAR_20 = VAR_12; } break; case COMP_MSZH_NOCOMP: break; default: av_log(VAR_0, AV_LOG_ERROR, "BUG! Unknown MSZH compression in frame decoder.\n"); return -1; } break; case CODEC_ID_ZLIB: #ifdef CONFIG_ZLIB if ((c->compression == COMP_ZLIB_NORMAL) && (c->imgtype == IMGTYPE_RGB24) && (VAR_20 == VAR_10 * VAR_11 * 3)) break; zret = inflateReset(&(c->zstream)); if (zret != Z_OK) { av_log(VAR_0, AV_LOG_ERROR, "Inflate reset error: %d\n", zret); return -1; } if (c->flags & FLAG_MULTITHREAD) { VAR_18 = *((unsigned int*)VAR_5); VAR_19 = *((unsigned int*)(VAR_5+4)); c->zstream.next_in = VAR_5 + 8; c->zstream.avail_in = VAR_18; c->zstream.next_out = c->decomp_buf; c->zstream.avail_out = VAR_19; zret = inflate(&(c->zstream), Z_FINISH); if ((zret != Z_OK) && (zret != Z_STREAM_END)) { av_log(VAR_0, AV_LOG_ERROR, "Mthread1 inflate error: %d\n", zret); return -1; } if (VAR_19 != (unsigned int)(c->zstream.total_out)) { av_log(VAR_0, AV_LOG_ERROR, "Mthread1 decoded size differs (%u != %lu)\n", VAR_19, c->zstream.total_out); } zret = inflateReset(&(c->zstream)); if (zret != Z_OK) { av_log(VAR_0, AV_LOG_ERROR, "Mthread2 inflate reset error: %d\n", zret); return -1; } c->zstream.next_in = VAR_5 + 8 + VAR_18; c->zstream.avail_in = VAR_20 - VAR_18; c->zstream.next_out = c->decomp_buf + VAR_19; c->zstream.avail_out = VAR_19; zret = inflate(&(c->zstream), Z_FINISH); if ((zret != Z_OK) && (zret != Z_STREAM_END)) { av_log(VAR_0, AV_LOG_ERROR, "Mthread2 inflate error: %d\n", zret); return -1; } if ((c->decomp_size - VAR_19) != (unsigned int)(c->zstream.total_out)) { av_log(VAR_0, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %lu)\n", c->decomp_size - VAR_19, c->zstream.total_out); } } else { c->zstream.next_in = VAR_5; c->zstream.avail_in = VAR_20; c->zstream.next_out = c->decomp_buf; c->zstream.avail_out = c->decomp_size; zret = inflate(&(c->zstream), Z_FINISH); if ((zret != Z_OK) && (zret != Z_STREAM_END)) { av_log(VAR_0, AV_LOG_ERROR, "Inflate error: %d\n", zret); return -1; } if (c->decomp_size != (unsigned int)(c->zstream.total_out)) { av_log(VAR_0, AV_LOG_ERROR, "Decoded size differs (%d != %lu)\n", c->decomp_size, c->zstream.total_out); } } VAR_5 = c->decomp_buf; VAR_20 = c->decomp_size;; #else av_log(VAR_0, AV_LOG_ERROR, "BUG! Zlib support not compiled in frame decoder.\n"); return -1; #endif break; default: av_log(VAR_0, AV_LOG_ERROR, "BUG! Unknown codec in frame decoder compression switch.\n"); return -1; } if ((VAR_0->codec_id == CODEC_ID_ZLIB) && (c->flags & FLAG_PNGFILTER)) { switch (c->imgtype) { case IMGTYPE_YUV111: case IMGTYPE_RGB24: for (VAR_7 = 0; VAR_7 < VAR_11; VAR_7++) { VAR_6 = VAR_7 * VAR_10 * 3; VAR_13 = VAR_5[VAR_6++]; VAR_17 = VAR_5[VAR_6++]; VAR_17+=(VAR_5[VAR_6++] << 8); for (VAR_8 = 1; VAR_8 < VAR_10; VAR_8++) { VAR_5[VAR_6] = VAR_13 -= VAR_5[VAR_6]; VAR_17 -= (VAR_5[VAR_6+1] | (VAR_5[VAR_6+2]<<8)); VAR_5[VAR_6+1] = (VAR_17) & 0xff; VAR_5[VAR_6+2] = ((VAR_17)>>8) & 0xff; VAR_6 += 3; } } break; case IMGTYPE_YUV422: for (VAR_7 = 0; VAR_7 < VAR_11; VAR_7++) { VAR_6 = VAR_7 * VAR_10 * 2; VAR_13 = VAR_15 = VAR_16 =0; for (VAR_8 = 0; VAR_8 < VAR_10/4; VAR_8++) { VAR_5[VAR_6] = VAR_13 -= VAR_5[VAR_6]; VAR_5[VAR_6+1] = VAR_13 -= VAR_5[VAR_6+1]; VAR_5[VAR_6+2] = VAR_13 -= VAR_5[VAR_6+2]; VAR_5[VAR_6+3] = VAR_13 -= VAR_5[VAR_6+3]; VAR_5[VAR_6+4] = VAR_15 -= VAR_5[VAR_6+4]; VAR_5[VAR_6+5] = VAR_15 -= VAR_5[VAR_6+5]; VAR_5[VAR_6+6] = VAR_16 -= VAR_5[VAR_6+6]; VAR_5[VAR_6+7] = VAR_16 -= VAR_5[VAR_6+7]; VAR_6 += 8; } } break; case IMGTYPE_YUV411: for (VAR_7 = 0; VAR_7 < VAR_11; VAR_7++) { VAR_6 = VAR_7 * VAR_10 / 2 * 3; VAR_13 = VAR_15 = VAR_16 =0; for (VAR_8 = 0; VAR_8 < VAR_10/4; VAR_8++) { VAR_5[VAR_6] = VAR_13 -= VAR_5[VAR_6]; VAR_5[VAR_6+1] = VAR_13 -= VAR_5[VAR_6+1]; VAR_5[VAR_6+2] = VAR_13 -= VAR_5[VAR_6+2]; VAR_5[VAR_6+3] = VAR_13 -= VAR_5[VAR_6+3]; VAR_5[VAR_6+4] = VAR_15 -= VAR_5[VAR_6+4]; VAR_5[VAR_6+5] = VAR_16 -= VAR_5[VAR_6+5]; VAR_6 += 6; } } break; case IMGTYPE_YUV211: for (VAR_7 = 0; VAR_7 < VAR_11; VAR_7++) { VAR_6 = VAR_7 * VAR_10 * 2; VAR_13 = VAR_15 = VAR_16 =0; for (VAR_8 = 0; VAR_8 < VAR_10/2; VAR_8++) { VAR_5[VAR_6] = VAR_13 -= VAR_5[VAR_6]; VAR_5[VAR_6+1] = VAR_13 -= VAR_5[VAR_6+1]; VAR_5[VAR_6+2] = VAR_15 -= VAR_5[VAR_6+2]; VAR_5[VAR_6+3] = VAR_16 -= VAR_5[VAR_6+3]; VAR_6 += 4; } } break; case IMGTYPE_YUV420: for (VAR_7 = 0; VAR_7 < VAR_11/2; VAR_7++) { VAR_6 = VAR_7 * VAR_10 * 3; VAR_13 = VAR_14 = VAR_15 = VAR_16 =0; for (VAR_8 = 0; VAR_8 < VAR_10/2; VAR_8++) { VAR_5[VAR_6] = VAR_13 -= VAR_5[VAR_6]; VAR_5[VAR_6+1] = VAR_13 -= VAR_5[VAR_6+1]; VAR_5[VAR_6+2] = VAR_14 -= VAR_5[VAR_6+2]; VAR_5[VAR_6+3] = VAR_14 -= VAR_5[VAR_6+3]; VAR_5[VAR_6+4] = VAR_15 -= VAR_5[VAR_6+4]; VAR_5[VAR_6+5] = VAR_16 -= VAR_5[VAR_6+5]; VAR_6 += 6; } } break; default: av_log(VAR_0, AV_LOG_ERROR, "BUG! Unknown imagetype in pngfilter switch.\n"); return -1; } } switch (c->imgtype) { case IMGTYPE_YUV111: for (VAR_7 = VAR_11 - 1; VAR_7 >= 0; VAR_7--) { VAR_6 = VAR_7 * c->pic.linesize[0]; for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8++) { VAR_9[VAR_6++] = get_b(VAR_5[0], VAR_5[1]); VAR_9[VAR_6++] = get_g(VAR_5[0], VAR_5[1], VAR_5[2]); VAR_9[VAR_6++] = get_r(VAR_5[0], VAR_5[2]); VAR_5 += 3; } } break; case IMGTYPE_YUV422: for (VAR_7 = VAR_11 - 1; VAR_7 >= 0; VAR_7--) { VAR_6 = VAR_7 * c->pic.linesize[0]; for (VAR_8 = 0; VAR_8 < VAR_10/4; VAR_8++) { VAR_9[VAR_6++] = get_b(VAR_5[0], VAR_5[4]); VAR_9[VAR_6++] = get_g(VAR_5[0], VAR_5[4], VAR_5[6]); VAR_9[VAR_6++] = get_r(VAR_5[0], VAR_5[6]); VAR_9[VAR_6++] = get_b(VAR_5[1], VAR_5[4]); VAR_9[VAR_6++] = get_g(VAR_5[1], VAR_5[4], VAR_5[6]); VAR_9[VAR_6++] = get_r(VAR_5[1], VAR_5[6]); VAR_9[VAR_6++] = get_b(VAR_5[2], VAR_5[5]); VAR_9[VAR_6++] = get_g(VAR_5[2], VAR_5[5], VAR_5[7]); VAR_9[VAR_6++] = get_r(VAR_5[2], VAR_5[7]); VAR_9[VAR_6++] = get_b(VAR_5[3], VAR_5[5]); VAR_9[VAR_6++] = get_g(VAR_5[3], VAR_5[5], VAR_5[7]); VAR_9[VAR_6++] = get_r(VAR_5[3], VAR_5[7]); VAR_5 += 8; } } break; case IMGTYPE_RGB24: for (VAR_7 = VAR_11 - 1; VAR_7 >= 0; VAR_7--) { VAR_6 = VAR_7 * c->pic.linesize[0]; for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8++) { VAR_9[VAR_6++] = VAR_5[0]; VAR_9[VAR_6++] = VAR_5[1]; VAR_9[VAR_6++] = VAR_5[2]; VAR_5 += 3; } } break; case IMGTYPE_YUV411: for (VAR_7 = VAR_11 - 1; VAR_7 >= 0; VAR_7--) { VAR_6 = VAR_7 * c->pic.linesize[0]; for (VAR_8 = 0; VAR_8 < VAR_10/4; VAR_8++) { VAR_9[VAR_6++] = get_b(VAR_5[0], VAR_5[4]); VAR_9[VAR_6++] = get_g(VAR_5[0], VAR_5[4], VAR_5[5]); VAR_9[VAR_6++] = get_r(VAR_5[0], VAR_5[5]); VAR_9[VAR_6++] = get_b(VAR_5[1], VAR_5[4]); VAR_9[VAR_6++] = get_g(VAR_5[1], VAR_5[4], VAR_5[5]); VAR_9[VAR_6++] = get_r(VAR_5[1], VAR_5[5]); VAR_9[VAR_6++] = get_b(VAR_5[2], VAR_5[4]); VAR_9[VAR_6++] = get_g(VAR_5[2], VAR_5[4], VAR_5[5]); VAR_9[VAR_6++] = get_r(VAR_5[2], VAR_5[5]); VAR_9[VAR_6++] = get_b(VAR_5[3], VAR_5[4]); VAR_9[VAR_6++] = get_g(VAR_5[3], VAR_5[4], VAR_5[5]); VAR_9[VAR_6++] = get_r(VAR_5[3], VAR_5[5]); VAR_5 += 6; } } break; case IMGTYPE_YUV211: for (VAR_7 = VAR_11 - 1; VAR_7 >= 0; VAR_7--) { VAR_6 = VAR_7 * c->pic.linesize[0]; for (VAR_8 = 0; VAR_8 < VAR_10/2; VAR_8++) { VAR_9[VAR_6++] = get_b(VAR_5[0], VAR_5[2]); VAR_9[VAR_6++] = get_g(VAR_5[0], VAR_5[2], VAR_5[3]); VAR_9[VAR_6++] = get_r(VAR_5[0], VAR_5[3]); VAR_9[VAR_6++] = get_b(VAR_5[1], VAR_5[2]); VAR_9[VAR_6++] = get_g(VAR_5[1], VAR_5[2], VAR_5[3]); VAR_9[VAR_6++] = get_r(VAR_5[1], VAR_5[3]); VAR_5 += 4; } } break; case IMGTYPE_YUV420: for (VAR_7 = VAR_11 / 2 - 1; VAR_7 >= 0; VAR_7--) { VAR_6 = 2 * VAR_7 * c->pic.linesize[0]; for (VAR_8 = 0; VAR_8 < VAR_10/2; VAR_8++) { VAR_9[VAR_6] = get_b(VAR_5[0], VAR_5[4]); VAR_9[VAR_6+1] = get_g(VAR_5[0], VAR_5[4], VAR_5[5]); VAR_9[VAR_6+2] = get_r(VAR_5[0], VAR_5[5]); VAR_9[VAR_6+3] = get_b(VAR_5[1], VAR_5[4]); VAR_9[VAR_6+4] = get_g(VAR_5[1], VAR_5[4], VAR_5[5]); VAR_9[VAR_6+5] = get_r(VAR_5[1], VAR_5[5]); VAR_9[VAR_6-c->pic.linesize[0]] = get_b(VAR_5[2], VAR_5[4]); VAR_9[VAR_6-c->pic.linesize[0]+1] = get_g(VAR_5[2], VAR_5[4], VAR_5[5]); VAR_9[VAR_6-c->pic.linesize[0]+2] = get_r(VAR_5[2], VAR_5[5]); VAR_9[VAR_6-c->pic.linesize[0]+3] = get_b(VAR_5[3], VAR_5[4]); VAR_9[VAR_6-c->pic.linesize[0]+4] = get_g(VAR_5[3], VAR_5[4], VAR_5[5]); VAR_9[VAR_6-c->pic.linesize[0]+5] = get_r(VAR_5[3], VAR_5[5]); VAR_6 += 6; VAR_5 += 6; } } break; default: av_log(VAR_0, AV_LOG_ERROR, "BUG! Unknown imagetype in image decoder.\n"); return -1; } *VAR_2 = sizeof(AVFrame); *(AVFrame*)VAR_1 = c->pic; return VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, uint8_t *VAR_3, int VAR_4)\n{", "LclContext * const c = (LclContext *)VAR_0->priv_data;", "unsigned char *VAR_5 = (unsigned char *)VAR_3;", "int VAR_6;", "int VAR_7, VAR_8;", "unsigned char *VAR_9;", "unsigned int VAR_10 = VAR_0->VAR_10;", "unsigned int VAR_11 = VAR_0->VAR_11;", "unsigned int VAR_12;", "unsigned char VAR_13, VAR_14, VAR_15, VAR_16;", "int VAR_17;", "unsigned int VAR_18, VAR_19;", "#ifdef CONFIG_ZLIB\nint zret;", "#endif\nint VAR_20 = VAR_4;", "if (VAR_4 == 0)\nreturn 0;", "if(c->pic.VAR_1[0])\nVAR_0->release_buffer(VAR_0, &c->pic);", "c->pic.reference = 0;", "c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;", "if(VAR_0->get_buffer(VAR_0, &c->pic) < 0){", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return -1;", "}", "VAR_9 = c->pic.VAR_1[0];", "switch (VAR_0->codec_id) {", "case CODEC_ID_MSZH:\nswitch (c->compression) {", "case COMP_MSZH:\nif (c->flags & FLAG_MULTITHREAD) {", "VAR_18 = *((unsigned int*)VAR_5);", "VAR_19 = *((unsigned int*)(VAR_5+4));", "VAR_12 = mszh_decomp(VAR_5 + 8, VAR_18, c->decomp_buf);", "if (VAR_19 != VAR_12) {", "av_log(VAR_0, AV_LOG_ERROR, \"Mthread1 decoded size differs (%d != %d)\\n\",\nVAR_19, VAR_12);", "}", "VAR_12 = mszh_decomp(VAR_5 + 8 + VAR_18, VAR_20 - VAR_18,\nc->decomp_buf + VAR_19);", "if ((c->decomp_size - VAR_19) != VAR_12) {", "av_log(VAR_0, AV_LOG_ERROR, \"Mthread2 decoded size differs (%d != %d)\\n\",\nc->decomp_size - VAR_19, VAR_12);", "}", "VAR_5 = c->decomp_buf;", "VAR_20 = c->decomp_size;", "} else {", "VAR_12 = mszh_decomp(VAR_5, VAR_20, c->decomp_buf);", "if (c->decomp_size != VAR_12) {", "av_log(VAR_0, AV_LOG_ERROR, \"Decoded size differs (%d != %d)\\n\",\nc->decomp_size, VAR_12);", "}", "VAR_5 = c->decomp_buf;", "VAR_20 = VAR_12;", "}", "break;", "case COMP_MSZH_NOCOMP:\nbreak;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"BUG! Unknown MSZH compression in frame decoder.\\n\");", "return -1;", "}", "break;", "case CODEC_ID_ZLIB:\n#ifdef CONFIG_ZLIB\nif ((c->compression == COMP_ZLIB_NORMAL) && (c->imgtype == IMGTYPE_RGB24) &&\n(VAR_20 == VAR_10 * VAR_11 * 3))\nbreak;", "zret = inflateReset(&(c->zstream));", "if (zret != Z_OK) {", "av_log(VAR_0, AV_LOG_ERROR, \"Inflate reset error: %d\\n\", zret);", "return -1;", "}", "if (c->flags & FLAG_MULTITHREAD) {", "VAR_18 = *((unsigned int*)VAR_5);", "VAR_19 = *((unsigned int*)(VAR_5+4));", "c->zstream.next_in = VAR_5 + 8;", "c->zstream.avail_in = VAR_18;", "c->zstream.next_out = c->decomp_buf;", "c->zstream.avail_out = VAR_19;", "zret = inflate(&(c->zstream), Z_FINISH);", "if ((zret != Z_OK) && (zret != Z_STREAM_END)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Mthread1 inflate error: %d\\n\", zret);", "return -1;", "}", "if (VAR_19 != (unsigned int)(c->zstream.total_out)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Mthread1 decoded size differs (%u != %lu)\\n\",\nVAR_19, c->zstream.total_out);", "}", "zret = inflateReset(&(c->zstream));", "if (zret != Z_OK) {", "av_log(VAR_0, AV_LOG_ERROR, \"Mthread2 inflate reset error: %d\\n\", zret);", "return -1;", "}", "c->zstream.next_in = VAR_5 + 8 + VAR_18;", "c->zstream.avail_in = VAR_20 - VAR_18;", "c->zstream.next_out = c->decomp_buf + VAR_19;", "c->zstream.avail_out = VAR_19;", "zret = inflate(&(c->zstream), Z_FINISH);", "if ((zret != Z_OK) && (zret != Z_STREAM_END)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Mthread2 inflate error: %d\\n\", zret);", "return -1;", "}", "if ((c->decomp_size - VAR_19) != (unsigned int)(c->zstream.total_out)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Mthread2 decoded size differs (%d != %lu)\\n\",\nc->decomp_size - VAR_19, c->zstream.total_out);", "}", "} else {", "c->zstream.next_in = VAR_5;", "c->zstream.avail_in = VAR_20;", "c->zstream.next_out = c->decomp_buf;", "c->zstream.avail_out = c->decomp_size;", "zret = inflate(&(c->zstream), Z_FINISH);", "if ((zret != Z_OK) && (zret != Z_STREAM_END)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Inflate error: %d\\n\", zret);", "return -1;", "}", "if (c->decomp_size != (unsigned int)(c->zstream.total_out)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Decoded size differs (%d != %lu)\\n\",\nc->decomp_size, c->zstream.total_out);", "}", "}", "VAR_5 = c->decomp_buf;", "VAR_20 = c->decomp_size;;", "#else\nav_log(VAR_0, AV_LOG_ERROR, \"BUG! Zlib support not compiled in frame decoder.\\n\");", "return -1;", "#endif\nbreak;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"BUG! Unknown codec in frame decoder compression switch.\\n\");", "return -1;", "}", "if ((VAR_0->codec_id == CODEC_ID_ZLIB) && (c->flags & FLAG_PNGFILTER)) {", "switch (c->imgtype) {", "case IMGTYPE_YUV111:\ncase IMGTYPE_RGB24:\nfor (VAR_7 = 0; VAR_7 < VAR_11; VAR_7++) {", "VAR_6 = VAR_7 * VAR_10 * 3;", "VAR_13 = VAR_5[VAR_6++];", "VAR_17 = VAR_5[VAR_6++];", "VAR_17+=(VAR_5[VAR_6++] << 8);", "for (VAR_8 = 1; VAR_8 < VAR_10; VAR_8++) {", "VAR_5[VAR_6] = VAR_13 -= VAR_5[VAR_6];", "VAR_17 -= (VAR_5[VAR_6+1] | (VAR_5[VAR_6+2]<<8));", "VAR_5[VAR_6+1] = (VAR_17) & 0xff;", "VAR_5[VAR_6+2] = ((VAR_17)>>8) & 0xff;", "VAR_6 += 3;", "}", "}", "break;", "case IMGTYPE_YUV422:\nfor (VAR_7 = 0; VAR_7 < VAR_11; VAR_7++) {", "VAR_6 = VAR_7 * VAR_10 * 2;", "VAR_13 = VAR_15 = VAR_16 =0;", "for (VAR_8 = 0; VAR_8 < VAR_10/4; VAR_8++) {", "VAR_5[VAR_6] = VAR_13 -= VAR_5[VAR_6];", "VAR_5[VAR_6+1] = VAR_13 -= VAR_5[VAR_6+1];", "VAR_5[VAR_6+2] = VAR_13 -= VAR_5[VAR_6+2];", "VAR_5[VAR_6+3] = VAR_13 -= VAR_5[VAR_6+3];", "VAR_5[VAR_6+4] = VAR_15 -= VAR_5[VAR_6+4];", "VAR_5[VAR_6+5] = VAR_15 -= VAR_5[VAR_6+5];", "VAR_5[VAR_6+6] = VAR_16 -= VAR_5[VAR_6+6];", "VAR_5[VAR_6+7] = VAR_16 -= VAR_5[VAR_6+7];", "VAR_6 += 8;", "}", "}", "break;", "case IMGTYPE_YUV411:\nfor (VAR_7 = 0; VAR_7 < VAR_11; VAR_7++) {", "VAR_6 = VAR_7 * VAR_10 / 2 * 3;", "VAR_13 = VAR_15 = VAR_16 =0;", "for (VAR_8 = 0; VAR_8 < VAR_10/4; VAR_8++) {", "VAR_5[VAR_6] = VAR_13 -= VAR_5[VAR_6];", "VAR_5[VAR_6+1] = VAR_13 -= VAR_5[VAR_6+1];", "VAR_5[VAR_6+2] = VAR_13 -= VAR_5[VAR_6+2];", "VAR_5[VAR_6+3] = VAR_13 -= VAR_5[VAR_6+3];", "VAR_5[VAR_6+4] = VAR_15 -= VAR_5[VAR_6+4];", "VAR_5[VAR_6+5] = VAR_16 -= VAR_5[VAR_6+5];", "VAR_6 += 6;", "}", "}", "break;", "case IMGTYPE_YUV211:\nfor (VAR_7 = 0; VAR_7 < VAR_11; VAR_7++) {", "VAR_6 = VAR_7 * VAR_10 * 2;", "VAR_13 = VAR_15 = VAR_16 =0;", "for (VAR_8 = 0; VAR_8 < VAR_10/2; VAR_8++) {", "VAR_5[VAR_6] = VAR_13 -= VAR_5[VAR_6];", "VAR_5[VAR_6+1] = VAR_13 -= VAR_5[VAR_6+1];", "VAR_5[VAR_6+2] = VAR_15 -= VAR_5[VAR_6+2];", "VAR_5[VAR_6+3] = VAR_16 -= VAR_5[VAR_6+3];", "VAR_6 += 4;", "}", "}", "break;", "case IMGTYPE_YUV420:\nfor (VAR_7 = 0; VAR_7 < VAR_11/2; VAR_7++) {", "VAR_6 = VAR_7 * VAR_10 * 3;", "VAR_13 = VAR_14 = VAR_15 = VAR_16 =0;", "for (VAR_8 = 0; VAR_8 < VAR_10/2; VAR_8++) {", "VAR_5[VAR_6] = VAR_13 -= VAR_5[VAR_6];", "VAR_5[VAR_6+1] = VAR_13 -= VAR_5[VAR_6+1];", "VAR_5[VAR_6+2] = VAR_14 -= VAR_5[VAR_6+2];", "VAR_5[VAR_6+3] = VAR_14 -= VAR_5[VAR_6+3];", "VAR_5[VAR_6+4] = VAR_15 -= VAR_5[VAR_6+4];", "VAR_5[VAR_6+5] = VAR_16 -= VAR_5[VAR_6+5];", "VAR_6 += 6;", "}", "}", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"BUG! Unknown imagetype in pngfilter switch.\\n\");", "return -1;", "}", "}", "switch (c->imgtype) {", "case IMGTYPE_YUV111:\nfor (VAR_7 = VAR_11 - 1; VAR_7 >= 0; VAR_7--) {", "VAR_6 = VAR_7 * c->pic.linesize[0];", "for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8++) {", "VAR_9[VAR_6++] = get_b(VAR_5[0], VAR_5[1]);", "VAR_9[VAR_6++] = get_g(VAR_5[0], VAR_5[1], VAR_5[2]);", "VAR_9[VAR_6++] = get_r(VAR_5[0], VAR_5[2]);", "VAR_5 += 3;", "}", "}", "break;", "case IMGTYPE_YUV422:\nfor (VAR_7 = VAR_11 - 1; VAR_7 >= 0; VAR_7--) {", "VAR_6 = VAR_7 * c->pic.linesize[0];", "for (VAR_8 = 0; VAR_8 < VAR_10/4; VAR_8++) {", "VAR_9[VAR_6++] = get_b(VAR_5[0], VAR_5[4]);", "VAR_9[VAR_6++] = get_g(VAR_5[0], VAR_5[4], VAR_5[6]);", "VAR_9[VAR_6++] = get_r(VAR_5[0], VAR_5[6]);", "VAR_9[VAR_6++] = get_b(VAR_5[1], VAR_5[4]);", "VAR_9[VAR_6++] = get_g(VAR_5[1], VAR_5[4], VAR_5[6]);", "VAR_9[VAR_6++] = get_r(VAR_5[1], VAR_5[6]);", "VAR_9[VAR_6++] = get_b(VAR_5[2], VAR_5[5]);", "VAR_9[VAR_6++] = get_g(VAR_5[2], VAR_5[5], VAR_5[7]);", "VAR_9[VAR_6++] = get_r(VAR_5[2], VAR_5[7]);", "VAR_9[VAR_6++] = get_b(VAR_5[3], VAR_5[5]);", "VAR_9[VAR_6++] = get_g(VAR_5[3], VAR_5[5], VAR_5[7]);", "VAR_9[VAR_6++] = get_r(VAR_5[3], VAR_5[7]);", "VAR_5 += 8;", "}", "}", "break;", "case IMGTYPE_RGB24:\nfor (VAR_7 = VAR_11 - 1; VAR_7 >= 0; VAR_7--) {", "VAR_6 = VAR_7 * c->pic.linesize[0];", "for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8++) {", "VAR_9[VAR_6++] = VAR_5[0];", "VAR_9[VAR_6++] = VAR_5[1];", "VAR_9[VAR_6++] = VAR_5[2];", "VAR_5 += 3;", "}", "}", "break;", "case IMGTYPE_YUV411:\nfor (VAR_7 = VAR_11 - 1; VAR_7 >= 0; VAR_7--) {", "VAR_6 = VAR_7 * c->pic.linesize[0];", "for (VAR_8 = 0; VAR_8 < VAR_10/4; VAR_8++) {", "VAR_9[VAR_6++] = get_b(VAR_5[0], VAR_5[4]);", "VAR_9[VAR_6++] = get_g(VAR_5[0], VAR_5[4], VAR_5[5]);", "VAR_9[VAR_6++] = get_r(VAR_5[0], VAR_5[5]);", "VAR_9[VAR_6++] = get_b(VAR_5[1], VAR_5[4]);", "VAR_9[VAR_6++] = get_g(VAR_5[1], VAR_5[4], VAR_5[5]);", "VAR_9[VAR_6++] = get_r(VAR_5[1], VAR_5[5]);", "VAR_9[VAR_6++] = get_b(VAR_5[2], VAR_5[4]);", "VAR_9[VAR_6++] = get_g(VAR_5[2], VAR_5[4], VAR_5[5]);", "VAR_9[VAR_6++] = get_r(VAR_5[2], VAR_5[5]);", "VAR_9[VAR_6++] = get_b(VAR_5[3], VAR_5[4]);", "VAR_9[VAR_6++] = get_g(VAR_5[3], VAR_5[4], VAR_5[5]);", "VAR_9[VAR_6++] = get_r(VAR_5[3], VAR_5[5]);", "VAR_5 += 6;", "}", "}", "break;", "case IMGTYPE_YUV211:\nfor (VAR_7 = VAR_11 - 1; VAR_7 >= 0; VAR_7--) {", "VAR_6 = VAR_7 * c->pic.linesize[0];", "for (VAR_8 = 0; VAR_8 < VAR_10/2; VAR_8++) {", "VAR_9[VAR_6++] = get_b(VAR_5[0], VAR_5[2]);", "VAR_9[VAR_6++] = get_g(VAR_5[0], VAR_5[2], VAR_5[3]);", "VAR_9[VAR_6++] = get_r(VAR_5[0], VAR_5[3]);", "VAR_9[VAR_6++] = get_b(VAR_5[1], VAR_5[2]);", "VAR_9[VAR_6++] = get_g(VAR_5[1], VAR_5[2], VAR_5[3]);", "VAR_9[VAR_6++] = get_r(VAR_5[1], VAR_5[3]);", "VAR_5 += 4;", "}", "}", "break;", "case IMGTYPE_YUV420:\nfor (VAR_7 = VAR_11 / 2 - 1; VAR_7 >= 0; VAR_7--) {", "VAR_6 = 2 * VAR_7 * c->pic.linesize[0];", "for (VAR_8 = 0; VAR_8 < VAR_10/2; VAR_8++) {", "VAR_9[VAR_6] = get_b(VAR_5[0], VAR_5[4]);", "VAR_9[VAR_6+1] = get_g(VAR_5[0], VAR_5[4], VAR_5[5]);", "VAR_9[VAR_6+2] = get_r(VAR_5[0], VAR_5[5]);", "VAR_9[VAR_6+3] = get_b(VAR_5[1], VAR_5[4]);", "VAR_9[VAR_6+4] = get_g(VAR_5[1], VAR_5[4], VAR_5[5]);", "VAR_9[VAR_6+5] = get_r(VAR_5[1], VAR_5[5]);", "VAR_9[VAR_6-c->pic.linesize[0]] = get_b(VAR_5[2], VAR_5[4]);", "VAR_9[VAR_6-c->pic.linesize[0]+1] = get_g(VAR_5[2], VAR_5[4], VAR_5[5]);", "VAR_9[VAR_6-c->pic.linesize[0]+2] = get_r(VAR_5[2], VAR_5[5]);", "VAR_9[VAR_6-c->pic.linesize[0]+3] = get_b(VAR_5[3], VAR_5[4]);", "VAR_9[VAR_6-c->pic.linesize[0]+4] = get_g(VAR_5[3], VAR_5[4], VAR_5[5]);", "VAR_9[VAR_6-c->pic.linesize[0]+5] = get_r(VAR_5[3], VAR_5[5]);", "VAR_6 += 6;", "VAR_5 += 6;", "}", "}", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"BUG! Unknown imagetype in image decoder.\\n\");", "return -1;", "}", "*VAR_2 = sizeof(AVFrame);", "*(AVFrame*)VAR_1 = c->pic;", "return VAR_4;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31, 33 ], [ 39, 41 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 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, 155, 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273, 275 ], [ 277 ], [ 279, 281 ], [ 283, 285 ], [ 287 ], [ 289 ], [ 297 ], [ 299 ], [ 301, 303, 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333, 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367, 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397, 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423, 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453, 455 ], [ 457 ], [ 459 ], [ 461 ], [ 467 ], [ 469, 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491, 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531, 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553, 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 591 ], [ 593, 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621, 623 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663, 665 ], [ 667 ], [ 669 ], [ 673 ], [ 675 ], [ 681 ], [ 683 ] ]
13,244
static int ram_save_host_page(RAMState *rs, PageSearchStatus *pss, bool last_stage) { int tmppages, pages = 0; size_t pagesize_bits = qemu_ram_pagesize(pss->block) >> TARGET_PAGE_BITS; do { tmppages = ram_save_target_page(rs, pss, last_stage); if (tmppages < 0) { return tmppages; } pages += tmppages; pss->page++; } while (pss->page & (pagesize_bits - 1)); /* The offset we leave with is the last one we looked at */ pss->page--; return pages; }
true
qemu
1eb3fc0a0b61b5d22adee2a9add3162a6c03a47e
static int ram_save_host_page(RAMState *rs, PageSearchStatus *pss, bool last_stage) { int tmppages, pages = 0; size_t pagesize_bits = qemu_ram_pagesize(pss->block) >> TARGET_PAGE_BITS; do { tmppages = ram_save_target_page(rs, pss, last_stage); if (tmppages < 0) { return tmppages; } pages += tmppages; pss->page++; } while (pss->page & (pagesize_bits - 1)); pss->page--; return pages; }
{ "code": [ " } while (pss->page & (pagesize_bits - 1));" ], "line_no": [ 31 ] }
static int FUNC_0(RAMState *VAR_0, PageSearchStatus *VAR_1, bool VAR_2) { int VAR_3, VAR_4 = 0; size_t pagesize_bits = qemu_ram_pagesize(VAR_1->block) >> TARGET_PAGE_BITS; do { VAR_3 = ram_save_target_page(VAR_0, VAR_1, VAR_2); if (VAR_3 < 0) { return VAR_3; } VAR_4 += VAR_3; VAR_1->page++; } while (VAR_1->page & (pagesize_bits - 1)); VAR_1->page--; return VAR_4; }
[ "static int FUNC_0(RAMState *VAR_0, PageSearchStatus *VAR_1,\nbool VAR_2)\n{", "int VAR_3, VAR_4 = 0;", "size_t pagesize_bits =\nqemu_ram_pagesize(VAR_1->block) >> TARGET_PAGE_BITS;", "do {", "VAR_3 = ram_save_target_page(VAR_0, VAR_1, VAR_2);", "if (VAR_3 < 0) {", "return VAR_3;", "}", "VAR_4 += VAR_3;", "VAR_1->page++;", "} while (VAR_1->page & (pagesize_bits - 1));", "VAR_1->page--;", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 37 ], [ 39 ], [ 41 ] ]
13,245
static int qemu_rdma_exchange_recv(RDMAContext *rdma, RDMAControlHeader *head, int expecting) { RDMAControlHeader ready = { .len = 0, .type = RDMA_CONTROL_READY, .repeat = 1, }; int ret; /* * Inform the source that we're ready to receive a message. */ ret = qemu_rdma_post_send_control(rdma, NULL, &ready); if (ret < 0) { fprintf(stderr, "Failed to send control buffer!\n"); return ret; } /* * Block and wait for the message. */ ret = qemu_rdma_exchange_get_response(rdma, head, expecting, RDMA_WRID_READY); if (ret < 0) { return ret; } qemu_rdma_move_header(rdma, RDMA_WRID_READY, head); /* * Post a new RECV work request to replace the one we just consumed. */ ret = qemu_rdma_post_recv_control(rdma, RDMA_WRID_READY); if (ret) { fprintf(stderr, "rdma migration: error posting second control recv!"); return ret; } return 0; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static int qemu_rdma_exchange_recv(RDMAContext *rdma, RDMAControlHeader *head, int expecting) { RDMAControlHeader ready = { .len = 0, .type = RDMA_CONTROL_READY, .repeat = 1, }; int ret; ret = qemu_rdma_post_send_control(rdma, NULL, &ready); if (ret < 0) { fprintf(stderr, "Failed to send control buffer!\n"); return ret; } ret = qemu_rdma_exchange_get_response(rdma, head, expecting, RDMA_WRID_READY); if (ret < 0) { return ret; } qemu_rdma_move_header(rdma, RDMA_WRID_READY, head); ret = qemu_rdma_post_recv_control(rdma, RDMA_WRID_READY); if (ret) { fprintf(stderr, "rdma migration: error posting second control recv!"); return ret; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(RDMAContext *VAR_0, RDMAControlHeader *VAR_1, int VAR_2) { RDMAControlHeader ready = { .len = 0, .type = RDMA_CONTROL_READY, .repeat = 1, }; int VAR_3; VAR_3 = qemu_rdma_post_send_control(VAR_0, NULL, &ready); if (VAR_3 < 0) { fprintf(stderr, "Failed to send control buffer!\n"); return VAR_3; } VAR_3 = qemu_rdma_exchange_get_response(VAR_0, VAR_1, VAR_2, RDMA_WRID_READY); if (VAR_3 < 0) { return VAR_3; } qemu_rdma_move_header(VAR_0, RDMA_WRID_READY, VAR_1); VAR_3 = qemu_rdma_post_recv_control(VAR_0, RDMA_WRID_READY); if (VAR_3) { fprintf(stderr, "VAR_0 migration: error posting second control recv!"); return VAR_3; } return 0; }
[ "static int FUNC_0(RDMAContext *VAR_0, RDMAControlHeader *VAR_1,\nint VAR_2)\n{", "RDMAControlHeader ready = {", ".len = 0,\n.type = RDMA_CONTROL_READY,\n.repeat = 1,\n};", "int VAR_3;", "VAR_3 = qemu_rdma_post_send_control(VAR_0, NULL, &ready);", "if (VAR_3 < 0) {", "fprintf(stderr, \"Failed to send control buffer!\\n\");", "return VAR_3;", "}", "VAR_3 = qemu_rdma_exchange_get_response(VAR_0, VAR_1,\nVAR_2, RDMA_WRID_READY);", "if (VAR_3 < 0) {", "return VAR_3;", "}", "qemu_rdma_move_header(VAR_0, RDMA_WRID_READY, VAR_1);", "VAR_3 = qemu_rdma_post_recv_control(VAR_0, RDMA_WRID_READY);", "if (VAR_3) {", "fprintf(stderr, \"VAR_0 migration: error posting second control recv!\");", "return VAR_3;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11, 13, 15 ], [ 17 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ] ]
13,246
static int qxl_track_command(PCIQXLDevice *qxl, struct QXLCommandExt *ext) { switch (le32_to_cpu(ext->cmd.type)) { case QXL_CMD_SURFACE: { QXLSurfaceCmd *cmd = qxl_phys2virt(qxl, ext->cmd.data, ext->group_id); if (!cmd) { uint32_t id = le32_to_cpu(cmd->surface_id); if (id >= qxl->ssd.num_surfaces) { qxl_set_guest_bug(qxl, "QXL_CMD_SURFACE id %d >= %d", id, qxl->ssd.num_surfaces); qemu_mutex_lock(&qxl->track_lock); if (cmd->type == QXL_SURFACE_CMD_CREATE) { qxl->guest_surfaces.cmds[id] = ext->cmd.data; qxl->guest_surfaces.count++; if (qxl->guest_surfaces.max < qxl->guest_surfaces.count) qxl->guest_surfaces.max = qxl->guest_surfaces.count; if (cmd->type == QXL_SURFACE_CMD_DESTROY) { qxl->guest_surfaces.cmds[id] = 0; qxl->guest_surfaces.count--; qemu_mutex_unlock(&qxl->track_lock); break; case QXL_CMD_CURSOR: { QXLCursorCmd *cmd = qxl_phys2virt(qxl, ext->cmd.data, ext->group_id); if (!cmd) { if (cmd->type == QXL_CURSOR_SET) { qemu_mutex_lock(&qxl->track_lock); qxl->guest_cursor = ext->cmd.data; qemu_mutex_unlock(&qxl->track_lock); break; return 0;
true
qemu
48f4ba671bbb3dd212002d57b72a23375f51619b
static int qxl_track_command(PCIQXLDevice *qxl, struct QXLCommandExt *ext) { switch (le32_to_cpu(ext->cmd.type)) { case QXL_CMD_SURFACE: { QXLSurfaceCmd *cmd = qxl_phys2virt(qxl, ext->cmd.data, ext->group_id); if (!cmd) { uint32_t id = le32_to_cpu(cmd->surface_id); if (id >= qxl->ssd.num_surfaces) { qxl_set_guest_bug(qxl, "QXL_CMD_SURFACE id %d >= %d", id, qxl->ssd.num_surfaces); qemu_mutex_lock(&qxl->track_lock); if (cmd->type == QXL_SURFACE_CMD_CREATE) { qxl->guest_surfaces.cmds[id] = ext->cmd.data; qxl->guest_surfaces.count++; if (qxl->guest_surfaces.max < qxl->guest_surfaces.count) qxl->guest_surfaces.max = qxl->guest_surfaces.count; if (cmd->type == QXL_SURFACE_CMD_DESTROY) { qxl->guest_surfaces.cmds[id] = 0; qxl->guest_surfaces.count--; qemu_mutex_unlock(&qxl->track_lock); break; case QXL_CMD_CURSOR: { QXLCursorCmd *cmd = qxl_phys2virt(qxl, ext->cmd.data, ext->group_id); if (!cmd) { if (cmd->type == QXL_CURSOR_SET) { qemu_mutex_lock(&qxl->track_lock); qxl->guest_cursor = ext->cmd.data; qemu_mutex_unlock(&qxl->track_lock); break; return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(PCIQXLDevice *VAR_0, struct QXLCommandExt *VAR_1) { switch (le32_to_cpu(VAR_1->cmd.type)) { case QXL_CMD_SURFACE: { QXLSurfaceCmd *cmd = qxl_phys2virt(VAR_0, VAR_1->cmd.data, VAR_1->group_id); if (!cmd) { uint32_t id = le32_to_cpu(cmd->surface_id); if (id >= VAR_0->ssd.num_surfaces) { qxl_set_guest_bug(VAR_0, "QXL_CMD_SURFACE id %d >= %d", id, VAR_0->ssd.num_surfaces); qemu_mutex_lock(&VAR_0->track_lock); if (cmd->type == QXL_SURFACE_CMD_CREATE) { VAR_0->guest_surfaces.cmds[id] = VAR_1->cmd.data; VAR_0->guest_surfaces.count++; if (VAR_0->guest_surfaces.max < VAR_0->guest_surfaces.count) VAR_0->guest_surfaces.max = VAR_0->guest_surfaces.count; if (cmd->type == QXL_SURFACE_CMD_DESTROY) { VAR_0->guest_surfaces.cmds[id] = 0; VAR_0->guest_surfaces.count--; qemu_mutex_unlock(&VAR_0->track_lock); break; case QXL_CMD_CURSOR: { QXLCursorCmd *cmd = qxl_phys2virt(VAR_0, VAR_1->cmd.data, VAR_1->group_id); if (!cmd) { if (cmd->type == QXL_CURSOR_SET) { qemu_mutex_lock(&VAR_0->track_lock); VAR_0->guest_cursor = VAR_1->cmd.data; qemu_mutex_unlock(&VAR_0->track_lock); break; return 0;
[ "static int FUNC_0(PCIQXLDevice *VAR_0, struct QXLCommandExt *VAR_1)\n{", "switch (le32_to_cpu(VAR_1->cmd.type)) {", "case QXL_CMD_SURFACE:\n{", "QXLSurfaceCmd *cmd = qxl_phys2virt(VAR_0, VAR_1->cmd.data, VAR_1->group_id);", "if (!cmd) {", "uint32_t id = le32_to_cpu(cmd->surface_id);", "if (id >= VAR_0->ssd.num_surfaces) {", "qxl_set_guest_bug(VAR_0, \"QXL_CMD_SURFACE id %d >= %d\", id,\nVAR_0->ssd.num_surfaces);", "qemu_mutex_lock(&VAR_0->track_lock);", "if (cmd->type == QXL_SURFACE_CMD_CREATE) {", "VAR_0->guest_surfaces.cmds[id] = VAR_1->cmd.data;", "VAR_0->guest_surfaces.count++;", "if (VAR_0->guest_surfaces.max < VAR_0->guest_surfaces.count)\nVAR_0->guest_surfaces.max = VAR_0->guest_surfaces.count;", "if (cmd->type == QXL_SURFACE_CMD_DESTROY) {", "VAR_0->guest_surfaces.cmds[id] = 0;", "VAR_0->guest_surfaces.count--;", "qemu_mutex_unlock(&VAR_0->track_lock);", "break;", "case QXL_CMD_CURSOR:\n{", "QXLCursorCmd *cmd = qxl_phys2virt(VAR_0, VAR_1->cmd.data, VAR_1->group_id);", "if (!cmd) {", "if (cmd->type == QXL_CURSOR_SET) {", "qemu_mutex_lock(&VAR_0->track_lock);", "VAR_0->guest_cursor = VAR_1->cmd.data;", "qemu_mutex_unlock(&VAR_0->track_lock);", "break;", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 15 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 50 ], [ 52 ], [ 54 ], [ 57 ], [ 59 ], [ 62, 64 ], [ 66 ], [ 70 ], [ 74 ], [ 76 ], [ 78 ], [ 80 ], [ 83 ], [ 87 ] ]
13,247
int tcp_fconnect(struct socket *so) { Slirp *slirp = so->slirp; int ret=0; DEBUG_CALL("tcp_fconnect"); DEBUG_ARG("so = %lx", (long )so); if( (ret=so->s=socket(AF_INET,SOCK_STREAM,0)) >= 0) { int opt, s=so->s; struct sockaddr_in addr; fd_nonblock(s); opt = 1; setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(opt )); opt = 1; setsockopt(s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(opt )); addr.sin_family = AF_INET; if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) == slirp->vnetwork_addr.s_addr) { /* It's an alias */ if (so->so_faddr.s_addr == slirp->vnameserver_addr.s_addr) { if (get_dns_addr(&addr.sin_addr) < 0) addr.sin_addr = loopback_addr; } else { addr.sin_addr = loopback_addr; } } else addr.sin_addr = so->so_faddr; addr.sin_port = so->so_fport; DEBUG_MISC((dfd, " connect()ing, addr.sin_port=%d, " "addr.sin_addr.s_addr=%.16s\n", ntohs(addr.sin_port), inet_ntoa(addr.sin_addr))); /* We don't care what port we get */ ret = connect(s,(struct sockaddr *)&addr,sizeof (addr)); /* * If it's not in progress, it failed, so we just return 0, * without clearing SS_NOFDREF */ soisfconnecting(so); } return(ret); }
true
qemu
40ff6d7e8dceca227e7f8a3e8e0d58b2c66d19b4
int tcp_fconnect(struct socket *so) { Slirp *slirp = so->slirp; int ret=0; DEBUG_CALL("tcp_fconnect"); DEBUG_ARG("so = %lx", (long )so); if( (ret=so->s=socket(AF_INET,SOCK_STREAM,0)) >= 0) { int opt, s=so->s; struct sockaddr_in addr; fd_nonblock(s); opt = 1; setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(opt )); opt = 1; setsockopt(s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(opt )); addr.sin_family = AF_INET; if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) == slirp->vnetwork_addr.s_addr) { if (so->so_faddr.s_addr == slirp->vnameserver_addr.s_addr) { if (get_dns_addr(&addr.sin_addr) < 0) addr.sin_addr = loopback_addr; } else { addr.sin_addr = loopback_addr; } } else addr.sin_addr = so->so_faddr; addr.sin_port = so->so_fport; DEBUG_MISC((dfd, " connect()ing, addr.sin_port=%d, " "addr.sin_addr.s_addr=%.16s\n", ntohs(addr.sin_port), inet_ntoa(addr.sin_addr))); ret = connect(s,(struct sockaddr *)&addr,sizeof (addr)); soisfconnecting(so); } return(ret); }
{ "code": [ " if( (ret=so->s=socket(AF_INET,SOCK_STREAM,0)) >= 0) {" ], "line_no": [ 17 ] }
int FUNC_0(struct socket *VAR_0) { Slirp *slirp = VAR_0->slirp; int VAR_1=0; DEBUG_CALL("FUNC_0"); DEBUG_ARG("VAR_0 = %lx", (long )VAR_0); if( (VAR_1=VAR_0->VAR_3=socket(AF_INET,SOCK_STREAM,0)) >= 0) { int VAR_2, VAR_3=VAR_0->VAR_3; struct sockaddr_in VAR_4; fd_nonblock(VAR_3); VAR_2 = 1; setsockopt(VAR_3,SOL_SOCKET,SO_REUSEADDR,(char *)&VAR_2,sizeof(VAR_2 )); VAR_2 = 1; setsockopt(VAR_3,SOL_SOCKET,SO_OOBINLINE,(char *)&VAR_2,sizeof(VAR_2 )); VAR_4.sin_family = AF_INET; if ((VAR_0->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) == slirp->vnetwork_addr.s_addr) { if (VAR_0->so_faddr.s_addr == slirp->vnameserver_addr.s_addr) { if (get_dns_addr(&VAR_4.sin_addr) < 0) VAR_4.sin_addr = loopback_addr; } else { VAR_4.sin_addr = loopback_addr; } } else VAR_4.sin_addr = VAR_0->so_faddr; VAR_4.sin_port = VAR_0->so_fport; DEBUG_MISC((dfd, " connect()ing, VAR_4.sin_port=%d, " "VAR_4.sin_addr.s_addr=%.16s\n", ntohs(VAR_4.sin_port), inet_ntoa(VAR_4.sin_addr))); VAR_1 = connect(VAR_3,(struct sockaddr *)&VAR_4,sizeof (VAR_4)); soisfconnecting(VAR_0); } return(VAR_1); }
[ "int FUNC_0(struct socket *VAR_0)\n{", "Slirp *slirp = VAR_0->slirp;", "int VAR_1=0;", "DEBUG_CALL(\"FUNC_0\");", "DEBUG_ARG(\"VAR_0 = %lx\", (long )VAR_0);", "if( (VAR_1=VAR_0->VAR_3=socket(AF_INET,SOCK_STREAM,0)) >= 0) {", "int VAR_2, VAR_3=VAR_0->VAR_3;", "struct sockaddr_in VAR_4;", "fd_nonblock(VAR_3);", "VAR_2 = 1;", "setsockopt(VAR_3,SOL_SOCKET,SO_REUSEADDR,(char *)&VAR_2,sizeof(VAR_2 ));", "VAR_2 = 1;", "setsockopt(VAR_3,SOL_SOCKET,SO_OOBINLINE,(char *)&VAR_2,sizeof(VAR_2 ));", "VAR_4.sin_family = AF_INET;", "if ((VAR_0->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) ==\nslirp->vnetwork_addr.s_addr) {", "if (VAR_0->so_faddr.s_addr == slirp->vnameserver_addr.s_addr) {", "if (get_dns_addr(&VAR_4.sin_addr) < 0)\nVAR_4.sin_addr = loopback_addr;", "} else {", "VAR_4.sin_addr = loopback_addr;", "}", "} else", "VAR_4.sin_addr = VAR_0->so_faddr;", "VAR_4.sin_port = VAR_0->so_fport;", "DEBUG_MISC((dfd, \" connect()ing, VAR_4.sin_port=%d, \"\n\"VAR_4.sin_addr.s_addr=%.16s\\n\",\nntohs(VAR_4.sin_port), inet_ntoa(VAR_4.sin_addr)));", "VAR_1 = connect(VAR_3,(struct sockaddr *)&VAR_4,sizeof (VAR_4));", "soisfconnecting(VAR_0);", "}", "return(VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67, 69 ], [ 73 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ] ]
13,249
static void cloop_close(BlockDriverState *bs) { BDRVCloopState *s = bs->opaque; if (s->n_blocks > 0) { g_free(s->offsets); } g_free(s->compressed_block); g_free(s->uncompressed_block); inflateEnd(&s->zstream); }
true
qemu
42d43d35d907579179a39c924d169da924786f65
static void cloop_close(BlockDriverState *bs) { BDRVCloopState *s = bs->opaque; if (s->n_blocks > 0) { g_free(s->offsets); } g_free(s->compressed_block); g_free(s->uncompressed_block); inflateEnd(&s->zstream); }
{ "code": [ " if (s->n_blocks > 0) {", " g_free(s->offsets);" ], "line_no": [ 7, 9 ] }
static void FUNC_0(BlockDriverState *VAR_0) { BDRVCloopState *s = VAR_0->opaque; if (s->n_blocks > 0) { g_free(s->offsets); } g_free(s->compressed_block); g_free(s->uncompressed_block); inflateEnd(&s->zstream); }
[ "static void FUNC_0(BlockDriverState *VAR_0)\n{", "BDRVCloopState *s = VAR_0->opaque;", "if (s->n_blocks > 0) {", "g_free(s->offsets);", "}", "g_free(s->compressed_block);", "g_free(s->uncompressed_block);", "inflateEnd(&s->zstream);", "}" ]
[ 0, 0, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
13,251
PROTO4(_pack_2ch_) PROTO4(_pack_6ch_) PROTO4(_pack_8ch_) PROTO4(_unpack_2ch_) PROTO4(_unpack_6ch_) av_cold void swri_audio_convert_init_x86(struct AudioConvert *ac, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels){ int mm_flags = av_get_cpu_flags(); ac->simd_f= NULL; //FIXME add memcpy case #define MULTI_CAPS_FUNC(flag, cap) \ if (EXTERNAL_##flag(mm_flags)) {\ if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16P)\ ac->simd_f = ff_int16_to_int32_a_ ## cap;\ if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32P)\ ac->simd_f = ff_int32_to_int16_a_ ## cap;\ } MULTI_CAPS_FUNC(MMX, mmx) MULTI_CAPS_FUNC(SSE2, sse2) if(EXTERNAL_MMX(mm_flags)) { if(channels == 6) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_float_to_float_a_mmx; } } if(EXTERNAL_SSE(mm_flags)) { if(channels == 6) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_float_to_float_a_sse; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_6ch_float_to_float_a_sse; } } if(EXTERNAL_SSE2(mm_flags)) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16P) ac->simd_f = ff_int16_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_float_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_float_to_int16_a_sse2; if(channels == 2) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_2ch_int32_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S16P) ac->simd_f = ff_pack_2ch_int16_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16P) ac->simd_f = ff_pack_2ch_int16_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_2ch_int32_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_2ch_int32_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_2ch_int32_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_2ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_2ch_float_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S16P) ac->simd_f = ff_pack_2ch_int16_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_2ch_float_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_2ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT) ac->simd_f = ff_unpack_2ch_float_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLT) ac->simd_f = ff_unpack_2ch_float_to_int16_a_sse2; } if(channels == 6) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_6ch_float_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_6ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT) ac->simd_f = ff_unpack_6ch_float_to_int32_a_sse2; } if(channels == 8) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_8ch_float_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_8ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_8ch_float_to_int32_a_sse2; } } if(EXTERNAL_SSSE3(mm_flags)) { if(channels == 2) { if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_int16_a_ssse3; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_int32_a_ssse3; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_float_a_ssse3; } } if(EXTERNAL_AVX(mm_flags)) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_int32_to_float_a_avx; if(channels == 6) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_float_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_int32_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_6ch_float_to_int32_a_avx; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_6ch_float_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_6ch_int32_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT) ac->simd_f = ff_unpack_6ch_float_to_int32_a_avx; } if(channels == 8) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_8ch_float_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_8ch_int32_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_8ch_float_to_int32_a_avx; } } if(EXTERNAL_AVX2(mm_flags)) { if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_float_to_int32_a_avx2; } }
false
FFmpeg
c16e99e3b3c02edcf33245468731d414eab97dac
PROTO4(_pack_2ch_) PROTO4(_pack_6ch_) PROTO4(_pack_8ch_) PROTO4(_unpack_2ch_) PROTO4(_unpack_6ch_) av_cold void swri_audio_convert_init_x86(struct AudioConvert *ac, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels){ int mm_flags = av_get_cpu_flags(); ac->simd_f= NULL; #define MULTI_CAPS_FUNC(flag, cap) \ if (EXTERNAL_##flag(mm_flags)) {\ if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16P)\ ac->simd_f = ff_int16_to_int32_a_ ## cap;\ if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32P)\ ac->simd_f = ff_int32_to_int16_a_ ## cap;\ } MULTI_CAPS_FUNC(MMX, mmx) MULTI_CAPS_FUNC(SSE2, sse2) if(EXTERNAL_MMX(mm_flags)) { if(channels == 6) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_float_to_float_a_mmx; } } if(EXTERNAL_SSE(mm_flags)) { if(channels == 6) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_float_to_float_a_sse; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_6ch_float_to_float_a_sse; } } if(EXTERNAL_SSE2(mm_flags)) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16P) ac->simd_f = ff_int16_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_float_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_float_to_int16_a_sse2; if(channels == 2) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_2ch_int32_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S16P) ac->simd_f = ff_pack_2ch_int16_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16P) ac->simd_f = ff_pack_2ch_int16_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_2ch_int32_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_2ch_int32_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_2ch_int32_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_2ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_2ch_float_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S16P) ac->simd_f = ff_pack_2ch_int16_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_2ch_float_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_2ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT) ac->simd_f = ff_unpack_2ch_float_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLT) ac->simd_f = ff_unpack_2ch_float_to_int16_a_sse2; } if(channels == 6) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_6ch_float_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_6ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT) ac->simd_f = ff_unpack_6ch_float_to_int32_a_sse2; } if(channels == 8) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_8ch_float_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_8ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_8ch_float_to_int32_a_sse2; } } if(EXTERNAL_SSSE3(mm_flags)) { if(channels == 2) { if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_int16_a_ssse3; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_int32_a_ssse3; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_float_a_ssse3; } } if(EXTERNAL_AVX(mm_flags)) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_int32_to_float_a_avx; if(channels == 6) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_float_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_int32_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_6ch_float_to_int32_a_avx; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_6ch_float_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_6ch_int32_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT) ac->simd_f = ff_unpack_6ch_float_to_int32_a_avx; } if(channels == 8) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_8ch_float_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_8ch_int32_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_8ch_float_to_int32_a_avx; } } if(EXTERNAL_AVX2(mm_flags)) { if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_float_to_int32_a_avx2; } }
{ "code": [], "line_no": [] }
PROTO4(_pack_2ch_) PROTO4(_pack_6ch_) PROTO4(_pack_8ch_) PROTO4(_unpack_2ch_) PROTO4(_unpack_6ch_) av_cold void swri_audio_convert_init_x86(struct AudioConvert *ac, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels){ int mm_flags = av_get_cpu_flags(); ac->simd_f= NULL; #define MULTI_CAPS_FUNC(flag, cap) \ if (EXTERNAL_##flag(mm_flags)) {\ if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16P)\ ac->simd_f = ff_int16_to_int32_a_ ## cap;\ if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32P)\ ac->simd_f = ff_int32_to_int16_a_ ## cap;\ } MULTI_CAPS_FUNC(MMX, mmx) MULTI_CAPS_FUNC(SSE2, sse2) if(EXTERNAL_MMX(mm_flags)) { if(channels == 6) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_float_to_float_a_mmx; } } if(EXTERNAL_SSE(mm_flags)) { if(channels == 6) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_float_to_float_a_sse; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_6ch_float_to_float_a_sse; } } if(EXTERNAL_SSE2(mm_flags)) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16P) ac->simd_f = ff_int16_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_float_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_float_to_int16_a_sse2; if(channels == 2) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_2ch_int32_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S16P) ac->simd_f = ff_pack_2ch_int16_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16P) ac->simd_f = ff_pack_2ch_int16_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_2ch_int32_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_2ch_int32_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_2ch_int32_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_2ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_2ch_float_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S16P) ac->simd_f = ff_pack_2ch_int16_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_2ch_float_to_int16_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_2ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT) ac->simd_f = ff_unpack_2ch_float_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLT) ac->simd_f = ff_unpack_2ch_float_to_int16_a_sse2; } if(channels == 6) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_6ch_float_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_6ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT) ac->simd_f = ff_unpack_6ch_float_to_int32_a_sse2; } if(channels == 8) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_8ch_float_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_8ch_int32_to_float_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_8ch_float_to_int32_a_sse2; } } if(EXTERNAL_SSSE3(mm_flags)) { if(channels == 2) { if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_int16_a_ssse3; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_int32_a_ssse3; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16) ac->simd_f = ff_unpack_2ch_int16_to_float_a_ssse3; } } if(EXTERNAL_AVX(mm_flags)) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_int32_to_float_a_avx; if(channels == 6) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_float_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_6ch_int32_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_6ch_float_to_int32_a_avx; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_6ch_float_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32) ac->simd_f = ff_unpack_6ch_int32_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT) ac->simd_f = ff_unpack_6ch_float_to_int32_a_avx; } if(channels == 8) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_8ch_float_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_pack_8ch_int32_to_float_a_avx; if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_pack_8ch_float_to_int32_a_avx; } } if(EXTERNAL_AVX2(mm_flags)) { if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_float_to_int32_a_avx2; } }
[ "PROTO4(_pack_2ch_)\nPROTO4(_pack_6ch_)\nPROTO4(_pack_8ch_)\nPROTO4(_unpack_2ch_)\nPROTO4(_unpack_6ch_)\nav_cold void swri_audio_convert_init_x86(struct AudioConvert *ac,\nenum AVSampleFormat out_fmt,\nenum AVSampleFormat in_fmt,\nint channels){", "int mm_flags = av_get_cpu_flags();", "ac->simd_f= NULL;", "#define MULTI_CAPS_FUNC(flag, cap) \\\nif (EXTERNAL_##flag(mm_flags)) {\\", "if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16P)\\\nac->simd_f = ff_int16_to_int32_a_ ## cap;\\", "if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32P)\\\nac->simd_f = ff_int32_to_int16_a_ ## cap;\\", "}", "MULTI_CAPS_FUNC(MMX, mmx)\nMULTI_CAPS_FUNC(SSE2, sse2)\nif(EXTERNAL_MMX(mm_flags)) {", "if(channels == 6) {", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_pack_6ch_float_to_float_a_mmx;", "}", "}", "if(EXTERNAL_SSE(mm_flags)) {", "if(channels == 6) {", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_pack_6ch_float_to_float_a_sse;", "if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32)\nac->simd_f = ff_unpack_6ch_float_to_float_a_sse;", "}", "}", "if(EXTERNAL_SSE2(mm_flags)) {", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_int32_to_float_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16P)\nac->simd_f = ff_int16_to_float_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP)\nac->simd_f = ff_float_to_int32_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLTP)\nac->simd_f = ff_float_to_int16_a_sse2;", "if(channels == 2) {", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_pack_2ch_int32_to_int32_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S16P)\nac->simd_f = ff_pack_2ch_int16_to_int16_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16P)\nac->simd_f = ff_pack_2ch_int16_to_int32_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_pack_2ch_int32_to_int16_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32)\nac->simd_f = ff_unpack_2ch_int32_to_int32_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S16)\nac->simd_f = ff_unpack_2ch_int16_to_int16_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16)\nac->simd_f = ff_unpack_2ch_int16_to_int32_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32)\nac->simd_f = ff_unpack_2ch_int32_to_int16_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_pack_2ch_int32_to_float_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)\nac->simd_f = ff_pack_2ch_float_to_int32_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S16P)\nac->simd_f = ff_pack_2ch_int16_to_float_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP)\nac->simd_f = ff_pack_2ch_float_to_int16_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32)\nac->simd_f = ff_unpack_2ch_int32_to_float_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT)\nac->simd_f = ff_unpack_2ch_float_to_int32_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16)\nac->simd_f = ff_unpack_2ch_int16_to_float_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLT)\nac->simd_f = ff_unpack_2ch_float_to_int16_a_sse2;", "}", "if(channels == 6) {", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_pack_6ch_int32_to_float_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)\nac->simd_f = ff_pack_6ch_float_to_int32_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32)\nac->simd_f = ff_unpack_6ch_int32_to_float_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT)\nac->simd_f = ff_unpack_6ch_float_to_int32_a_sse2;", "}", "if(channels == 8) {", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_pack_8ch_float_to_float_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_pack_8ch_int32_to_float_a_sse2;", "if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)\nac->simd_f = ff_pack_8ch_float_to_int32_a_sse2;", "}", "}", "if(EXTERNAL_SSSE3(mm_flags)) {", "if(channels == 2) {", "if( out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S16)\nac->simd_f = ff_unpack_2ch_int16_to_int16_a_ssse3;", "if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16)\nac->simd_f = ff_unpack_2ch_int16_to_int32_a_ssse3;", "if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16)\nac->simd_f = ff_unpack_2ch_int16_to_float_a_ssse3;", "}", "}", "if(EXTERNAL_AVX(mm_flags)) {", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_int32_to_float_a_avx;", "if(channels == 6) {", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_pack_6ch_float_to_float_a_avx;", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_pack_6ch_int32_to_float_a_avx;", "if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)\nac->simd_f = ff_pack_6ch_float_to_int32_a_avx;", "if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S32)\nac->simd_f = ff_unpack_6ch_float_to_float_a_avx;", "if( out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32)\nac->simd_f = ff_unpack_6ch_int32_to_float_a_avx;", "if( out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLT)\nac->simd_f = ff_unpack_6ch_float_to_int32_a_avx;", "}", "if(channels == 8) {", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_pack_8ch_float_to_float_a_avx;", "if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P)\nac->simd_f = ff_pack_8ch_int32_to_float_a_avx;", "if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP)\nac->simd_f = ff_pack_8ch_float_to_int32_a_avx;", "}", "}", "if(EXTERNAL_AVX2(mm_flags)) {", "if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP)\nac->simd_f = ff_float_to_int32_a_avx2;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 33, 35 ], [ 37, 39 ], [ 41, 43 ], [ 45 ], [ 49, 51, 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91, 93 ], [ 95, 97 ], [ 99, 101 ], [ 105 ], [ 107, 109 ], [ 111, 113 ], [ 115, 117 ], [ 119, 121 ], [ 125, 127 ], [ 129, 131 ], [ 133, 135 ], [ 137, 139 ], [ 143, 145 ], [ 147, 149 ], [ 151, 153 ], [ 155, 157 ], [ 159, 161 ], [ 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 ], [ 219 ], [ 221, 223 ], [ 225, 227 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 245, 247 ], [ 249, 251 ], [ 253, 255 ], [ 259, 261 ], [ 263, 265 ], [ 267, 269 ], [ 271 ], [ 273 ], [ 275, 277 ], [ 279, 281 ], [ 283, 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293, 295 ], [ 297 ], [ 299 ] ]
13,252
int ff_unlock_avcodec(const AVCodec *codec) { _Bool exp = 1; if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) return 0; av_assert0(atomic_compare_exchange_strong(&ff_avcodec_locked, &exp, 0)); atomic_fetch_add(&entangled_thread_counter, -1); if (lockmgr_cb) { if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE)) return -1; } return 0; }
false
FFmpeg
fd542b6f2026f1aa163882ee0283958598a97c31
int ff_unlock_avcodec(const AVCodec *codec) { _Bool exp = 1; if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) return 0; av_assert0(atomic_compare_exchange_strong(&ff_avcodec_locked, &exp, 0)); atomic_fetch_add(&entangled_thread_counter, -1); if (lockmgr_cb) { if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE)) return -1; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(const AVCodec *VAR_0) { _Bool VAR_1 = 1; if (VAR_0->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !VAR_0->init) return 0; av_assert0(atomic_compare_exchange_strong(&ff_avcodec_locked, &VAR_1, 0)); atomic_fetch_add(&entangled_thread_counter, -1); if (lockmgr_cb) { if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE)) return -1; } return 0; }
[ "int FUNC_0(const AVCodec *VAR_0)\n{", "_Bool VAR_1 = 1;", "if (VAR_0->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !VAR_0->init)\nreturn 0;", "av_assert0(atomic_compare_exchange_strong(&ff_avcodec_locked, &VAR_1, 0));", "atomic_fetch_add(&entangled_thread_counter, -1);", "if (lockmgr_cb) {", "if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE))\nreturn -1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 27 ], [ 29 ] ]
13,253
static int ivi_decode_coded_blocks(GetBitContext *gb, IVIBandDesc *band, ivi_mc_func mc, int mv_x, int mv_y, int *prev_dc, int is_intra, int mc_type, uint32_t quant, int offs, AVCodecContext *avctx) { const uint16_t *base_tab = is_intra ? band->intra_base : band->inter_base; RVMapDesc *rvmap = band->rv_map; uint8_t col_flags[8]; int32_t trvec[64]; uint32_t sym = 0, lo, hi, q; int pos, run, val; int blk_size = band->blk_size; int num_coeffs = blk_size * blk_size; int col_mask = blk_size - 1; int scan_pos = -1; int min_size = band->pitch * (band->transform_size - 1) + band->transform_size; int buf_size = band->pitch * band->aheight - offs; if (min_size > buf_size) return AVERROR_INVALIDDATA; if (!band->scan) { av_log(avctx, AV_LOG_ERROR, "Scan pattern is not set.\n"); return AVERROR_INVALIDDATA; } /* zero transform vector */ memset(trvec, 0, num_coeffs * sizeof(trvec[0])); /* zero column flags */ memset(col_flags, 0, sizeof(col_flags)); while (scan_pos <= num_coeffs) { sym = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1); if (sym == rvmap->eob_sym) break; /* End of block */ /* Escape - run/val explicitly coded using 3 vlc codes */ if (sym == rvmap->esc_sym) { run = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1; lo = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1); hi = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1); /* merge them and convert into signed val */ val = IVI_TOSIGNED((hi << 6) | lo); } else { if (sym >= 256U) { av_log(avctx, AV_LOG_ERROR, "Invalid sym encountered: %d.\n", sym); return AVERROR_INVALIDDATA; } run = rvmap->runtab[sym]; val = rvmap->valtab[sym]; } /* de-zigzag and dequantize */ scan_pos += run; if (scan_pos >= num_coeffs || scan_pos < 0) break; pos = band->scan[scan_pos]; if (!val) av_dlog(avctx, "Val = 0 encountered!\n"); q = (base_tab[pos] * quant) >> 9; if (q > 1) val = val * q + FFSIGN(val) * (((q ^ 1) - 1) >> 1); trvec[pos] = val; /* track columns containing non-zero coeffs */ col_flags[pos & col_mask] |= !!val; } if (scan_pos < 0 || scan_pos >= num_coeffs && sym != rvmap->eob_sym) return AVERROR_INVALIDDATA; /* corrupt block data */ /* undoing DC coeff prediction for intra-blocks */ if (is_intra && band->is_2d_trans) { *prev_dc += trvec[0]; trvec[0] = *prev_dc; col_flags[0] |= !!*prev_dc; } /* apply inverse transform */ band->inv_transform(trvec, band->buf + offs, band->pitch, col_flags); /* apply motion compensation */ if (!is_intra) return ivi_mc(mc, band->buf, band->ref_buf, offs, mv_x, mv_y, band->pitch, mc_type); return 0; }
false
FFmpeg
25a6666f6c07c6ac8449a63d7fbce0dfd29c54cd
static int ivi_decode_coded_blocks(GetBitContext *gb, IVIBandDesc *band, ivi_mc_func mc, int mv_x, int mv_y, int *prev_dc, int is_intra, int mc_type, uint32_t quant, int offs, AVCodecContext *avctx) { const uint16_t *base_tab = is_intra ? band->intra_base : band->inter_base; RVMapDesc *rvmap = band->rv_map; uint8_t col_flags[8]; int32_t trvec[64]; uint32_t sym = 0, lo, hi, q; int pos, run, val; int blk_size = band->blk_size; int num_coeffs = blk_size * blk_size; int col_mask = blk_size - 1; int scan_pos = -1; int min_size = band->pitch * (band->transform_size - 1) + band->transform_size; int buf_size = band->pitch * band->aheight - offs; if (min_size > buf_size) return AVERROR_INVALIDDATA; if (!band->scan) { av_log(avctx, AV_LOG_ERROR, "Scan pattern is not set.\n"); return AVERROR_INVALIDDATA; } memset(trvec, 0, num_coeffs * sizeof(trvec[0])); memset(col_flags, 0, sizeof(col_flags)); while (scan_pos <= num_coeffs) { sym = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1); if (sym == rvmap->eob_sym) break; if (sym == rvmap->esc_sym) { run = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1; lo = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1); hi = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1); val = IVI_TOSIGNED((hi << 6) | lo); } else { if (sym >= 256U) { av_log(avctx, AV_LOG_ERROR, "Invalid sym encountered: %d.\n", sym); return AVERROR_INVALIDDATA; } run = rvmap->runtab[sym]; val = rvmap->valtab[sym]; } scan_pos += run; if (scan_pos >= num_coeffs || scan_pos < 0) break; pos = band->scan[scan_pos]; if (!val) av_dlog(avctx, "Val = 0 encountered!\n"); q = (base_tab[pos] * quant) >> 9; if (q > 1) val = val * q + FFSIGN(val) * (((q ^ 1) - 1) >> 1); trvec[pos] = val; col_flags[pos & col_mask] |= !!val; } if (scan_pos < 0 || scan_pos >= num_coeffs && sym != rvmap->eob_sym) return AVERROR_INVALIDDATA; if (is_intra && band->is_2d_trans) { *prev_dc += trvec[0]; trvec[0] = *prev_dc; col_flags[0] |= !!*prev_dc; } band->inv_transform(trvec, band->buf + offs, band->pitch, col_flags); if (!is_intra) return ivi_mc(mc, band->buf, band->ref_buf, offs, mv_x, mv_y, band->pitch, mc_type); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(GetBitContext *VAR_0, IVIBandDesc *VAR_1, ivi_mc_func VAR_2, int VAR_3, int VAR_4, int *VAR_5, int VAR_6, int VAR_7, uint32_t VAR_8, int VAR_9, AVCodecContext *VAR_10) { const uint16_t *VAR_11 = VAR_6 ? VAR_1->intra_base : VAR_1->inter_base; RVMapDesc *rvmap = VAR_1->rv_map; uint8_t col_flags[8]; int32_t trvec[64]; uint32_t sym = 0, lo, hi, q; int VAR_12, VAR_13, VAR_14; int VAR_15 = VAR_1->VAR_15; int VAR_16 = VAR_15 * VAR_15; int VAR_17 = VAR_15 - 1; int VAR_18 = -1; int VAR_19 = VAR_1->pitch * (VAR_1->transform_size - 1) + VAR_1->transform_size; int VAR_20 = VAR_1->pitch * VAR_1->aheight - VAR_9; if (VAR_19 > VAR_20) return AVERROR_INVALIDDATA; if (!VAR_1->scan) { av_log(VAR_10, AV_LOG_ERROR, "Scan pattern is not set.\n"); return AVERROR_INVALIDDATA; } memset(trvec, 0, VAR_16 * sizeof(trvec[0])); memset(col_flags, 0, sizeof(col_flags)); while (VAR_18 <= VAR_16) { sym = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1); if (sym == rvmap->eob_sym) break; if (sym == rvmap->esc_sym) { VAR_13 = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1; lo = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1); hi = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1); VAR_14 = IVI_TOSIGNED((hi << 6) | lo); } else { if (sym >= 256U) { av_log(VAR_10, AV_LOG_ERROR, "Invalid sym encountered: %d.\n", sym); return AVERROR_INVALIDDATA; } VAR_13 = rvmap->runtab[sym]; VAR_14 = rvmap->valtab[sym]; } VAR_18 += VAR_13; if (VAR_18 >= VAR_16 || VAR_18 < 0) break; VAR_12 = VAR_1->scan[VAR_18]; if (!VAR_14) av_dlog(VAR_10, "Val = 0 encountered!\n"); q = (VAR_11[VAR_12] * VAR_8) >> 9; if (q > 1) VAR_14 = VAR_14 * q + FFSIGN(VAR_14) * (((q ^ 1) - 1) >> 1); trvec[VAR_12] = VAR_14; col_flags[VAR_12 & VAR_17] |= !!VAR_14; } if (VAR_18 < 0 || VAR_18 >= VAR_16 && sym != rvmap->eob_sym) return AVERROR_INVALIDDATA; if (VAR_6 && VAR_1->is_2d_trans) { *VAR_5 += trvec[0]; trvec[0] = *VAR_5; col_flags[0] |= !!*VAR_5; } VAR_1->inv_transform(trvec, VAR_1->buf + VAR_9, VAR_1->pitch, col_flags); if (!VAR_6) return ivi_mc(VAR_2, VAR_1->buf, VAR_1->ref_buf, VAR_9, VAR_3, VAR_4, VAR_1->pitch, VAR_7); return 0; }
[ "static int FUNC_0(GetBitContext *VAR_0, IVIBandDesc *VAR_1,\nivi_mc_func VAR_2, int VAR_3, int VAR_4,\nint *VAR_5, int VAR_6, int VAR_7,\nuint32_t VAR_8, int VAR_9,\nAVCodecContext *VAR_10)\n{", "const uint16_t *VAR_11 = VAR_6 ? VAR_1->intra_base : VAR_1->inter_base;", "RVMapDesc *rvmap = VAR_1->rv_map;", "uint8_t col_flags[8];", "int32_t trvec[64];", "uint32_t sym = 0, lo, hi, q;", "int VAR_12, VAR_13, VAR_14;", "int VAR_15 = VAR_1->VAR_15;", "int VAR_16 = VAR_15 * VAR_15;", "int VAR_17 = VAR_15 - 1;", "int VAR_18 = -1;", "int VAR_19 = VAR_1->pitch * (VAR_1->transform_size - 1) +\nVAR_1->transform_size;", "int VAR_20 = VAR_1->pitch * VAR_1->aheight - VAR_9;", "if (VAR_19 > VAR_20)\nreturn AVERROR_INVALIDDATA;", "if (!VAR_1->scan) {", "av_log(VAR_10, AV_LOG_ERROR, \"Scan pattern is not set.\\n\");", "return AVERROR_INVALIDDATA;", "}", "memset(trvec, 0, VAR_16 * sizeof(trvec[0]));", "memset(col_flags, 0, sizeof(col_flags));", "while (VAR_18 <= VAR_16) {", "sym = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table,\nIVI_VLC_BITS, 1);", "if (sym == rvmap->eob_sym)\nbreak;", "if (sym == rvmap->esc_sym) {", "VAR_13 = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1;", "lo = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1);", "hi = get_vlc2(VAR_0, VAR_1->blk_vlc.tab->table, IVI_VLC_BITS, 1);", "VAR_14 = IVI_TOSIGNED((hi << 6) | lo);", "} else {", "if (sym >= 256U) {", "av_log(VAR_10, AV_LOG_ERROR, \"Invalid sym encountered: %d.\\n\", sym);", "return AVERROR_INVALIDDATA;", "}", "VAR_13 = rvmap->runtab[sym];", "VAR_14 = rvmap->valtab[sym];", "}", "VAR_18 += VAR_13;", "if (VAR_18 >= VAR_16 || VAR_18 < 0)\nbreak;", "VAR_12 = VAR_1->scan[VAR_18];", "if (!VAR_14)\nav_dlog(VAR_10, \"Val = 0 encountered!\\n\");", "q = (VAR_11[VAR_12] * VAR_8) >> 9;", "if (q > 1)\nVAR_14 = VAR_14 * q + FFSIGN(VAR_14) * (((q ^ 1) - 1) >> 1);", "trvec[VAR_12] = VAR_14;", "col_flags[VAR_12 & VAR_17] |= !!VAR_14;", "}", "if (VAR_18 < 0 || VAR_18 >= VAR_16 && sym != rvmap->eob_sym)\nreturn AVERROR_INVALIDDATA;", "if (VAR_6 && VAR_1->is_2d_trans) {", "*VAR_5 += trvec[0];", "trvec[0] = *VAR_5;", "col_flags[0] |= !!*VAR_5;", "}", "VAR_1->inv_transform(trvec, VAR_1->buf + VAR_9,\nVAR_1->pitch, col_flags);", "if (!VAR_6)\nreturn ivi_mc(VAR_2, VAR_1->buf, VAR_1->ref_buf, VAR_9, VAR_3, VAR_4,\nVAR_1->pitch, VAR_7);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 59 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71, 73 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 121, 123 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 137 ], [ 139 ], [ 143, 145 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 165, 167 ], [ 173, 175, 177 ], [ 181 ], [ 183 ] ]
13,254
static void continue_send(IPMIBmcExtern *ibe) { if (ibe->outlen == 0) { goto check_reset; } send: ibe->outpos += qemu_chr_fe_write(ibe->chr, ibe->outbuf + ibe->outpos, ibe->outlen - ibe->outpos); if (ibe->outpos < ibe->outlen) { /* Not fully transmitted, try again in a 10ms */ timer_mod_ns(ibe->extern_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 10000000); } else { /* Sent */ ibe->outlen = 0; ibe->outpos = 0; if (!ibe->sending_cmd) { ibe->waiting_rsp = true; } else { ibe->sending_cmd = false; } check_reset: if (ibe->connected && ibe->send_reset) { /* Send the reset */ ibe->outbuf[0] = VM_CMD_RESET; ibe->outbuf[1] = VM_CMD_CHAR; ibe->outlen = 2; ibe->outpos = 0; ibe->send_reset = false; ibe->sending_cmd = true; goto send; } if (ibe->waiting_rsp) { /* Make sure we get a response within 4 seconds. */ timer_mod_ns(ibe->extern_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 4000000000ULL); } } return; }
true
qemu
b72981b910097b31f4d0b9c111a2d2cfd9ee585b
static void continue_send(IPMIBmcExtern *ibe) { if (ibe->outlen == 0) { goto check_reset; } send: ibe->outpos += qemu_chr_fe_write(ibe->chr, ibe->outbuf + ibe->outpos, ibe->outlen - ibe->outpos); if (ibe->outpos < ibe->outlen) { timer_mod_ns(ibe->extern_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 10000000); } else { ibe->outlen = 0; ibe->outpos = 0; if (!ibe->sending_cmd) { ibe->waiting_rsp = true; } else { ibe->sending_cmd = false; } check_reset: if (ibe->connected && ibe->send_reset) { ibe->outbuf[0] = VM_CMD_RESET; ibe->outbuf[1] = VM_CMD_CHAR; ibe->outlen = 2; ibe->outpos = 0; ibe->send_reset = false; ibe->sending_cmd = true; goto send; } if (ibe->waiting_rsp) { timer_mod_ns(ibe->extern_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 4000000000ULL); } } return; }
{ "code": [ " ibe->outpos += qemu_chr_fe_write(ibe->chr, ibe->outbuf + ibe->outpos,", " ibe->outlen - ibe->outpos);" ], "line_no": [ 13, 15 ] }
static void FUNC_0(IPMIBmcExtern *VAR_0) { if (VAR_0->outlen == 0) { goto check_reset; } send: VAR_0->outpos += qemu_chr_fe_write(VAR_0->chr, VAR_0->outbuf + VAR_0->outpos, VAR_0->outlen - VAR_0->outpos); if (VAR_0->outpos < VAR_0->outlen) { timer_mod_ns(VAR_0->extern_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 10000000); } else { VAR_0->outlen = 0; VAR_0->outpos = 0; if (!VAR_0->sending_cmd) { VAR_0->waiting_rsp = true; } else { VAR_0->sending_cmd = false; } check_reset: if (VAR_0->connected && VAR_0->send_reset) { VAR_0->outbuf[0] = VM_CMD_RESET; VAR_0->outbuf[1] = VM_CMD_CHAR; VAR_0->outlen = 2; VAR_0->outpos = 0; VAR_0->send_reset = false; VAR_0->sending_cmd = true; goto send; } if (VAR_0->waiting_rsp) { timer_mod_ns(VAR_0->extern_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 4000000000ULL); } } return; }
[ "static void FUNC_0(IPMIBmcExtern *VAR_0)\n{", "if (VAR_0->outlen == 0) {", "goto check_reset;", "}", "send:\nVAR_0->outpos += qemu_chr_fe_write(VAR_0->chr, VAR_0->outbuf + VAR_0->outpos,\nVAR_0->outlen - VAR_0->outpos);", "if (VAR_0->outpos < VAR_0->outlen) {", "timer_mod_ns(VAR_0->extern_timer,\nqemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 10000000);", "} else {", "VAR_0->outlen = 0;", "VAR_0->outpos = 0;", "if (!VAR_0->sending_cmd) {", "VAR_0->waiting_rsp = true;", "} else {", "VAR_0->sending_cmd = false;", "}", "check_reset:\nif (VAR_0->connected && VAR_0->send_reset) {", "VAR_0->outbuf[0] = VM_CMD_RESET;", "VAR_0->outbuf[1] = VM_CMD_CHAR;", "VAR_0->outlen = 2;", "VAR_0->outpos = 0;", "VAR_0->send_reset = false;", "VAR_0->sending_cmd = true;", "goto send;", "}", "if (VAR_0->waiting_rsp) {", "timer_mod_ns(VAR_0->extern_timer,\nqemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 4000000000ULL);", "}", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13, 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ] ]
13,255
static void sdhci_do_adma(SDHCIState *s) { unsigned int n, begin, length; const uint16_t block_size = s->blksize & 0x0fff; ADMADescr dscr; int i; for (i = 0; i < SDHC_ADMA_DESCS_PER_DELAY; ++i) { s->admaerr &= ~SDHC_ADMAERR_LENGTH_MISMATCH; get_adma_description(s, &dscr); DPRINT_L2("ADMA loop: addr=" TARGET_FMT_plx ", len=%d, attr=%x\n", dscr.addr, dscr.length, dscr.attr); if ((dscr.attr & SDHC_ADMA_ATTR_VALID) == 0) { /* Indicate that error occurred in ST_FDS state */ s->admaerr &= ~SDHC_ADMAERR_STATE_MASK; s->admaerr |= SDHC_ADMAERR_STATE_ST_FDS; /* Generate ADMA error interrupt */ if (s->errintstsen & SDHC_EISEN_ADMAERR) { s->errintsts |= SDHC_EIS_ADMAERR; s->norintsts |= SDHC_NIS_ERR; } sdhci_update_irq(s); return; } length = dscr.length ? dscr.length : 65536; switch (dscr.attr & SDHC_ADMA_ATTR_ACT_MASK) { case SDHC_ADMA_ATTR_ACT_TRAN: /* data transfer */ if (s->trnmod & SDHC_TRNS_READ) { while (length) { if (s->data_count == 0) { for (n = 0; n < block_size; n++) { s->fifo_buffer[n] = sdbus_read_data(&s->sdbus); } } begin = s->data_count; if ((length + begin) < block_size) { s->data_count = length + begin; length = 0; } else { s->data_count = block_size; length -= block_size - begin; } dma_memory_write(&address_space_memory, dscr.addr, &s->fifo_buffer[begin], s->data_count - begin); dscr.addr += s->data_count - begin; if (s->data_count == block_size) { s->data_count = 0; if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) { s->blkcnt--; if (s->blkcnt == 0) { break; } } } } } else { while (length) { begin = s->data_count; if ((length + begin) < block_size) { s->data_count = length + begin; length = 0; } else { s->data_count = block_size; length -= block_size - begin; } dma_memory_read(&address_space_memory, dscr.addr, &s->fifo_buffer[begin], s->data_count - begin); dscr.addr += s->data_count - begin; if (s->data_count == block_size) { for (n = 0; n < block_size; n++) { sdbus_write_data(&s->sdbus, s->fifo_buffer[n]); } s->data_count = 0; if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) { s->blkcnt--; if (s->blkcnt == 0) { break; } } } } } s->admasysaddr += dscr.incr; break; case SDHC_ADMA_ATTR_ACT_LINK: /* link to next descriptor table */ s->admasysaddr = dscr.addr; DPRINT_L1("ADMA link: admasysaddr=0x%" PRIx64 "\n", s->admasysaddr); break; default: s->admasysaddr += dscr.incr; break; } if (dscr.attr & SDHC_ADMA_ATTR_INT) { DPRINT_L1("ADMA interrupt: admasysaddr=0x%" PRIx64 "\n", s->admasysaddr); if (s->norintstsen & SDHC_NISEN_DMA) { s->norintsts |= SDHC_NIS_DMA; } sdhci_update_irq(s); } /* ADMA transfer terminates if blkcnt == 0 or by END attribute */ if (((s->trnmod & SDHC_TRNS_BLK_CNT_EN) && (s->blkcnt == 0)) || (dscr.attr & SDHC_ADMA_ATTR_END)) { DPRINT_L2("ADMA transfer completed\n"); if (length || ((dscr.attr & SDHC_ADMA_ATTR_END) && (s->trnmod & SDHC_TRNS_BLK_CNT_EN) && s->blkcnt != 0)) { ERRPRINT("SD/MMC host ADMA length mismatch\n"); s->admaerr |= SDHC_ADMAERR_LENGTH_MISMATCH | SDHC_ADMAERR_STATE_ST_TFR; if (s->errintstsen & SDHC_EISEN_ADMAERR) { ERRPRINT("Set ADMA error flag\n"); s->errintsts |= SDHC_EIS_ADMAERR; s->norintsts |= SDHC_NIS_ERR; } sdhci_update_irq(s); } sdhci_end_transfer(s); return; } } /* we have unfinished business - reschedule to continue ADMA */ timer_mod(s->transfer_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + SDHC_TRANSFER_DELAY); }
true
qemu
8be487d8f184f2f721cabeac559fb7a6cba18c95
static void sdhci_do_adma(SDHCIState *s) { unsigned int n, begin, length; const uint16_t block_size = s->blksize & 0x0fff; ADMADescr dscr; int i; for (i = 0; i < SDHC_ADMA_DESCS_PER_DELAY; ++i) { s->admaerr &= ~SDHC_ADMAERR_LENGTH_MISMATCH; get_adma_description(s, &dscr); DPRINT_L2("ADMA loop: addr=" TARGET_FMT_plx ", len=%d, attr=%x\n", dscr.addr, dscr.length, dscr.attr); if ((dscr.attr & SDHC_ADMA_ATTR_VALID) == 0) { s->admaerr &= ~SDHC_ADMAERR_STATE_MASK; s->admaerr |= SDHC_ADMAERR_STATE_ST_FDS; if (s->errintstsen & SDHC_EISEN_ADMAERR) { s->errintsts |= SDHC_EIS_ADMAERR; s->norintsts |= SDHC_NIS_ERR; } sdhci_update_irq(s); return; } length = dscr.length ? dscr.length : 65536; switch (dscr.attr & SDHC_ADMA_ATTR_ACT_MASK) { case SDHC_ADMA_ATTR_ACT_TRAN: if (s->trnmod & SDHC_TRNS_READ) { while (length) { if (s->data_count == 0) { for (n = 0; n < block_size; n++) { s->fifo_buffer[n] = sdbus_read_data(&s->sdbus); } } begin = s->data_count; if ((length + begin) < block_size) { s->data_count = length + begin; length = 0; } else { s->data_count = block_size; length -= block_size - begin; } dma_memory_write(&address_space_memory, dscr.addr, &s->fifo_buffer[begin], s->data_count - begin); dscr.addr += s->data_count - begin; if (s->data_count == block_size) { s->data_count = 0; if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) { s->blkcnt--; if (s->blkcnt == 0) { break; } } } } } else { while (length) { begin = s->data_count; if ((length + begin) < block_size) { s->data_count = length + begin; length = 0; } else { s->data_count = block_size; length -= block_size - begin; } dma_memory_read(&address_space_memory, dscr.addr, &s->fifo_buffer[begin], s->data_count - begin); dscr.addr += s->data_count - begin; if (s->data_count == block_size) { for (n = 0; n < block_size; n++) { sdbus_write_data(&s->sdbus, s->fifo_buffer[n]); } s->data_count = 0; if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) { s->blkcnt--; if (s->blkcnt == 0) { break; } } } } } s->admasysaddr += dscr.incr; break; case SDHC_ADMA_ATTR_ACT_LINK: s->admasysaddr = dscr.addr; DPRINT_L1("ADMA link: admasysaddr=0x%" PRIx64 "\n", s->admasysaddr); break; default: s->admasysaddr += dscr.incr; break; } if (dscr.attr & SDHC_ADMA_ATTR_INT) { DPRINT_L1("ADMA interrupt: admasysaddr=0x%" PRIx64 "\n", s->admasysaddr); if (s->norintstsen & SDHC_NISEN_DMA) { s->norintsts |= SDHC_NIS_DMA; } sdhci_update_irq(s); } if (((s->trnmod & SDHC_TRNS_BLK_CNT_EN) && (s->blkcnt == 0)) || (dscr.attr & SDHC_ADMA_ATTR_END)) { DPRINT_L2("ADMA transfer completed\n"); if (length || ((dscr.attr & SDHC_ADMA_ATTR_END) && (s->trnmod & SDHC_TRNS_BLK_CNT_EN) && s->blkcnt != 0)) { ERRPRINT("SD/MMC host ADMA length mismatch\n"); s->admaerr |= SDHC_ADMAERR_LENGTH_MISMATCH | SDHC_ADMAERR_STATE_ST_TFR; if (s->errintstsen & SDHC_EISEN_ADMAERR) { ERRPRINT("Set ADMA error flag\n"); s->errintsts |= SDHC_EIS_ADMAERR; s->norintsts |= SDHC_NIS_ERR; } sdhci_update_irq(s); } sdhci_end_transfer(s); return; } } timer_mod(s->transfer_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + SDHC_TRANSFER_DELAY); }
{ "code": [ " ADMADescr dscr;", " DPRINT_L2(\"ADMA loop: addr=\" TARGET_FMT_plx \", len=%d, attr=%x\\n\",", " dscr.addr, dscr.length, dscr.attr);", " DPRINT_L1(\"ADMA link: admasysaddr=0x%\" PRIx64 \"\\n\",", " s->admasysaddr);", " DPRINT_L1(\"ADMA interrupt: admasysaddr=0x%\" PRIx64 \"\\n\",", " s->admasysaddr);", " DPRINT_L2(\"ADMA transfer completed\\n\");", " ERRPRINT(\"SD/MMC host ADMA length mismatch\\n\");", " ERRPRINT(\"Set ADMA error flag\\n\");" ], "line_no": [ 9, 23, 25, 191, 193, 209, 193, 233, 241, 249 ] }
static void FUNC_0(SDHCIState *VAR_0) { unsigned int VAR_1, VAR_2, VAR_3; const uint16_t VAR_4 = VAR_0->blksize & 0x0fff; ADMADescr dscr; int VAR_5; for (VAR_5 = 0; VAR_5 < SDHC_ADMA_DESCS_PER_DELAY; ++VAR_5) { VAR_0->admaerr &= ~SDHC_ADMAERR_LENGTH_MISMATCH; get_adma_description(VAR_0, &dscr); DPRINT_L2("ADMA loop: addr=" TARGET_FMT_plx ", len=%d, attr=%x\VAR_1", dscr.addr, dscr.VAR_3, dscr.attr); if ((dscr.attr & SDHC_ADMA_ATTR_VALID) == 0) { VAR_0->admaerr &= ~SDHC_ADMAERR_STATE_MASK; VAR_0->admaerr |= SDHC_ADMAERR_STATE_ST_FDS; if (VAR_0->errintstsen & SDHC_EISEN_ADMAERR) { VAR_0->errintsts |= SDHC_EIS_ADMAERR; VAR_0->norintsts |= SDHC_NIS_ERR; } sdhci_update_irq(VAR_0); return; } VAR_3 = dscr.VAR_3 ? dscr.VAR_3 : 65536; switch (dscr.attr & SDHC_ADMA_ATTR_ACT_MASK) { case SDHC_ADMA_ATTR_ACT_TRAN: if (VAR_0->trnmod & SDHC_TRNS_READ) { while (VAR_3) { if (VAR_0->data_count == 0) { for (VAR_1 = 0; VAR_1 < VAR_4; VAR_1++) { VAR_0->fifo_buffer[VAR_1] = sdbus_read_data(&VAR_0->sdbus); } } VAR_2 = VAR_0->data_count; if ((VAR_3 + VAR_2) < VAR_4) { VAR_0->data_count = VAR_3 + VAR_2; VAR_3 = 0; } else { VAR_0->data_count = VAR_4; VAR_3 -= VAR_4 - VAR_2; } dma_memory_write(&address_space_memory, dscr.addr, &VAR_0->fifo_buffer[VAR_2], VAR_0->data_count - VAR_2); dscr.addr += VAR_0->data_count - VAR_2; if (VAR_0->data_count == VAR_4) { VAR_0->data_count = 0; if (VAR_0->trnmod & SDHC_TRNS_BLK_CNT_EN) { VAR_0->blkcnt--; if (VAR_0->blkcnt == 0) { break; } } } } } else { while (VAR_3) { VAR_2 = VAR_0->data_count; if ((VAR_3 + VAR_2) < VAR_4) { VAR_0->data_count = VAR_3 + VAR_2; VAR_3 = 0; } else { VAR_0->data_count = VAR_4; VAR_3 -= VAR_4 - VAR_2; } dma_memory_read(&address_space_memory, dscr.addr, &VAR_0->fifo_buffer[VAR_2], VAR_0->data_count - VAR_2); dscr.addr += VAR_0->data_count - VAR_2; if (VAR_0->data_count == VAR_4) { for (VAR_1 = 0; VAR_1 < VAR_4; VAR_1++) { sdbus_write_data(&VAR_0->sdbus, VAR_0->fifo_buffer[VAR_1]); } VAR_0->data_count = 0; if (VAR_0->trnmod & SDHC_TRNS_BLK_CNT_EN) { VAR_0->blkcnt--; if (VAR_0->blkcnt == 0) { break; } } } } } VAR_0->admasysaddr += dscr.incr; break; case SDHC_ADMA_ATTR_ACT_LINK: VAR_0->admasysaddr = dscr.addr; DPRINT_L1("ADMA link: admasysaddr=0x%" PRIx64 "\VAR_1", VAR_0->admasysaddr); break; default: VAR_0->admasysaddr += dscr.incr; break; } if (dscr.attr & SDHC_ADMA_ATTR_INT) { DPRINT_L1("ADMA interrupt: admasysaddr=0x%" PRIx64 "\VAR_1", VAR_0->admasysaddr); if (VAR_0->norintstsen & SDHC_NISEN_DMA) { VAR_0->norintsts |= SDHC_NIS_DMA; } sdhci_update_irq(VAR_0); } if (((VAR_0->trnmod & SDHC_TRNS_BLK_CNT_EN) && (VAR_0->blkcnt == 0)) || (dscr.attr & SDHC_ADMA_ATTR_END)) { DPRINT_L2("ADMA transfer completed\VAR_1"); if (VAR_3 || ((dscr.attr & SDHC_ADMA_ATTR_END) && (VAR_0->trnmod & SDHC_TRNS_BLK_CNT_EN) && VAR_0->blkcnt != 0)) { ERRPRINT("SD/MMC host ADMA VAR_3 mismatch\VAR_1"); VAR_0->admaerr |= SDHC_ADMAERR_LENGTH_MISMATCH | SDHC_ADMAERR_STATE_ST_TFR; if (VAR_0->errintstsen & SDHC_EISEN_ADMAERR) { ERRPRINT("Set ADMA error flag\VAR_1"); VAR_0->errintsts |= SDHC_EIS_ADMAERR; VAR_0->norintsts |= SDHC_NIS_ERR; } sdhci_update_irq(VAR_0); } sdhci_end_transfer(VAR_0); return; } } timer_mod(VAR_0->transfer_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + SDHC_TRANSFER_DELAY); }
[ "static void FUNC_0(SDHCIState *VAR_0)\n{", "unsigned int VAR_1, VAR_2, VAR_3;", "const uint16_t VAR_4 = VAR_0->blksize & 0x0fff;", "ADMADescr dscr;", "int VAR_5;", "for (VAR_5 = 0; VAR_5 < SDHC_ADMA_DESCS_PER_DELAY; ++VAR_5) {", "VAR_0->admaerr &= ~SDHC_ADMAERR_LENGTH_MISMATCH;", "get_adma_description(VAR_0, &dscr);", "DPRINT_L2(\"ADMA loop: addr=\" TARGET_FMT_plx \", len=%d, attr=%x\\VAR_1\",\ndscr.addr, dscr.VAR_3, dscr.attr);", "if ((dscr.attr & SDHC_ADMA_ATTR_VALID) == 0) {", "VAR_0->admaerr &= ~SDHC_ADMAERR_STATE_MASK;", "VAR_0->admaerr |= SDHC_ADMAERR_STATE_ST_FDS;", "if (VAR_0->errintstsen & SDHC_EISEN_ADMAERR) {", "VAR_0->errintsts |= SDHC_EIS_ADMAERR;", "VAR_0->norintsts |= SDHC_NIS_ERR;", "}", "sdhci_update_irq(VAR_0);", "return;", "}", "VAR_3 = dscr.VAR_3 ? dscr.VAR_3 : 65536;", "switch (dscr.attr & SDHC_ADMA_ATTR_ACT_MASK) {", "case SDHC_ADMA_ATTR_ACT_TRAN:\nif (VAR_0->trnmod & SDHC_TRNS_READ) {", "while (VAR_3) {", "if (VAR_0->data_count == 0) {", "for (VAR_1 = 0; VAR_1 < VAR_4; VAR_1++) {", "VAR_0->fifo_buffer[VAR_1] = sdbus_read_data(&VAR_0->sdbus);", "}", "}", "VAR_2 = VAR_0->data_count;", "if ((VAR_3 + VAR_2) < VAR_4) {", "VAR_0->data_count = VAR_3 + VAR_2;", "VAR_3 = 0;", "} else {", "VAR_0->data_count = VAR_4;", "VAR_3 -= VAR_4 - VAR_2;", "}", "dma_memory_write(&address_space_memory, dscr.addr,\n&VAR_0->fifo_buffer[VAR_2],\nVAR_0->data_count - VAR_2);", "dscr.addr += VAR_0->data_count - VAR_2;", "if (VAR_0->data_count == VAR_4) {", "VAR_0->data_count = 0;", "if (VAR_0->trnmod & SDHC_TRNS_BLK_CNT_EN) {", "VAR_0->blkcnt--;", "if (VAR_0->blkcnt == 0) {", "break;", "}", "}", "}", "}", "} else {", "while (VAR_3) {", "VAR_2 = VAR_0->data_count;", "if ((VAR_3 + VAR_2) < VAR_4) {", "VAR_0->data_count = VAR_3 + VAR_2;", "VAR_3 = 0;", "} else {", "VAR_0->data_count = VAR_4;", "VAR_3 -= VAR_4 - VAR_2;", "}", "dma_memory_read(&address_space_memory, dscr.addr,\n&VAR_0->fifo_buffer[VAR_2],\nVAR_0->data_count - VAR_2);", "dscr.addr += VAR_0->data_count - VAR_2;", "if (VAR_0->data_count == VAR_4) {", "for (VAR_1 = 0; VAR_1 < VAR_4; VAR_1++) {", "sdbus_write_data(&VAR_0->sdbus, VAR_0->fifo_buffer[VAR_1]);", "}", "VAR_0->data_count = 0;", "if (VAR_0->trnmod & SDHC_TRNS_BLK_CNT_EN) {", "VAR_0->blkcnt--;", "if (VAR_0->blkcnt == 0) {", "break;", "}", "}", "}", "}", "}", "VAR_0->admasysaddr += dscr.incr;", "break;", "case SDHC_ADMA_ATTR_ACT_LINK:\nVAR_0->admasysaddr = dscr.addr;", "DPRINT_L1(\"ADMA link: admasysaddr=0x%\" PRIx64 \"\\VAR_1\",\nVAR_0->admasysaddr);", "break;", "default:\nVAR_0->admasysaddr += dscr.incr;", "break;", "}", "if (dscr.attr & SDHC_ADMA_ATTR_INT) {", "DPRINT_L1(\"ADMA interrupt: admasysaddr=0x%\" PRIx64 \"\\VAR_1\",\nVAR_0->admasysaddr);", "if (VAR_0->norintstsen & SDHC_NISEN_DMA) {", "VAR_0->norintsts |= SDHC_NIS_DMA;", "}", "sdhci_update_irq(VAR_0);", "}", "if (((VAR_0->trnmod & SDHC_TRNS_BLK_CNT_EN) &&\n(VAR_0->blkcnt == 0)) || (dscr.attr & SDHC_ADMA_ATTR_END)) {", "DPRINT_L2(\"ADMA transfer completed\\VAR_1\");", "if (VAR_3 || ((dscr.attr & SDHC_ADMA_ATTR_END) &&\n(VAR_0->trnmod & SDHC_TRNS_BLK_CNT_EN) &&\nVAR_0->blkcnt != 0)) {", "ERRPRINT(\"SD/MMC host ADMA VAR_3 mismatch\\VAR_1\");", "VAR_0->admaerr |= SDHC_ADMAERR_LENGTH_MISMATCH |\nSDHC_ADMAERR_STATE_ST_TFR;", "if (VAR_0->errintstsen & SDHC_EISEN_ADMAERR) {", "ERRPRINT(\"Set ADMA error flag\\VAR_1\");", "VAR_0->errintsts |= SDHC_EIS_ADMAERR;", "VAR_0->norintsts |= SDHC_NIS_ERR;", "}", "sdhci_update_irq(VAR_0);", "}", "sdhci_end_transfer(VAR_0);", "return;", "}", "}", "timer_mod(VAR_0->transfer_timer,\nqemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + SDHC_TRANSFER_DELAY);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 29 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 149, 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191, 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221 ], [ 223 ], [ 229, 231 ], [ 233 ], [ 235, 237, 239 ], [ 241 ], [ 243, 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 271 ], [ 277, 279 ], [ 281 ] ]
13,256
static int copy_sectors(BlockDriverState *bs, uint64_t start_sect, uint64_t cluster_offset, int n_start, int n_end) { BDRVQcowState *s = bs->opaque; int n, ret; void *buf; /* * If this is the last cluster and it is only partially used, we must only * copy until the end of the image, or bdrv_check_request will fail for the * bdrv_read/write calls below. */ if (start_sect + n_end > bs->total_sectors) { n_end = bs->total_sectors - start_sect; } n = n_end - n_start; if (n <= 0) { return 0; } buf = qemu_blockalign(bs, n * BDRV_SECTOR_SIZE); BLKDBG_EVENT(bs->file, BLKDBG_COW_READ); ret = bdrv_read(bs, start_sect + n_start, buf, n); if (ret < 0) { goto out; } if (s->crypt_method) { qcow2_encrypt_sectors(s, start_sect + n_start, buf, buf, n, 1, &s->aes_encrypt_key); } BLKDBG_EVENT(bs->file, BLKDBG_COW_WRITE); ret = bdrv_write(bs->file, (cluster_offset >> 9) + n_start, buf, n); if (ret < 0) { goto out; } ret = 0; out: qemu_vfree(buf); return ret; }
true
qemu
aef4acb6616ab7fb5c105660aa8a2cee4e250e75
static int copy_sectors(BlockDriverState *bs, uint64_t start_sect, uint64_t cluster_offset, int n_start, int n_end) { BDRVQcowState *s = bs->opaque; int n, ret; void *buf; if (start_sect + n_end > bs->total_sectors) { n_end = bs->total_sectors - start_sect; } n = n_end - n_start; if (n <= 0) { return 0; } buf = qemu_blockalign(bs, n * BDRV_SECTOR_SIZE); BLKDBG_EVENT(bs->file, BLKDBG_COW_READ); ret = bdrv_read(bs, start_sect + n_start, buf, n); if (ret < 0) { goto out; } if (s->crypt_method) { qcow2_encrypt_sectors(s, start_sect + n_start, buf, buf, n, 1, &s->aes_encrypt_key); } BLKDBG_EVENT(bs->file, BLKDBG_COW_WRITE); ret = bdrv_write(bs->file, (cluster_offset >> 9) + n_start, buf, n); if (ret < 0) { goto out; } ret = 0; out: qemu_vfree(buf); return ret; }
{ "code": [ "static int copy_sectors(BlockDriverState *bs, uint64_t start_sect,", " uint64_t cluster_offset, int n_start, int n_end)", " void *buf;", " buf = qemu_blockalign(bs, n * BDRV_SECTOR_SIZE);", " ret = bdrv_read(bs, start_sect + n_start, buf, n);", " buf, buf, n, 1,", " ret = bdrv_write(bs->file, (cluster_offset >> 9) + n_start, buf, n);", " qemu_vfree(buf);" ], "line_no": [ 1, 3, 11, 43, 49, 63, 73, 87 ] }
static int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint64_t VAR_2, int VAR_3, int VAR_4) { BDRVQcowState *s = VAR_0->opaque; int VAR_5, VAR_6; void *VAR_7; if (VAR_1 + VAR_4 > VAR_0->total_sectors) { VAR_4 = VAR_0->total_sectors - VAR_1; } VAR_5 = VAR_4 - VAR_3; if (VAR_5 <= 0) { return 0; } VAR_7 = qemu_blockalign(VAR_0, VAR_5 * BDRV_SECTOR_SIZE); BLKDBG_EVENT(VAR_0->file, BLKDBG_COW_READ); VAR_6 = bdrv_read(VAR_0, VAR_1 + VAR_3, VAR_7, VAR_5); if (VAR_6 < 0) { goto out; } if (s->crypt_method) { qcow2_encrypt_sectors(s, VAR_1 + VAR_3, VAR_7, VAR_7, VAR_5, 1, &s->aes_encrypt_key); } BLKDBG_EVENT(VAR_0->file, BLKDBG_COW_WRITE); VAR_6 = bdrv_write(VAR_0->file, (VAR_2 >> 9) + VAR_3, VAR_7, VAR_5); if (VAR_6 < 0) { goto out; } VAR_6 = 0; out: qemu_vfree(VAR_7); return VAR_6; }
[ "static int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,\nuint64_t VAR_2, int VAR_3, int VAR_4)\n{", "BDRVQcowState *s = VAR_0->opaque;", "int VAR_5, VAR_6;", "void *VAR_7;", "if (VAR_1 + VAR_4 > VAR_0->total_sectors) {", "VAR_4 = VAR_0->total_sectors - VAR_1;", "}", "VAR_5 = VAR_4 - VAR_3;", "if (VAR_5 <= 0) {", "return 0;", "}", "VAR_7 = qemu_blockalign(VAR_0, VAR_5 * BDRV_SECTOR_SIZE);", "BLKDBG_EVENT(VAR_0->file, BLKDBG_COW_READ);", "VAR_6 = bdrv_read(VAR_0, VAR_1 + VAR_3, VAR_7, VAR_5);", "if (VAR_6 < 0) {", "goto out;", "}", "if (s->crypt_method) {", "qcow2_encrypt_sectors(s, VAR_1 + VAR_3,\nVAR_7, VAR_7, VAR_5, 1,\n&s->aes_encrypt_key);", "}", "BLKDBG_EVENT(VAR_0->file, BLKDBG_COW_WRITE);", "VAR_6 = bdrv_write(VAR_0->file, (VAR_2 >> 9) + VAR_3, VAR_7, VAR_5);", "if (VAR_6 < 0) {", "goto out;", "}", "VAR_6 = 0;", "out:\nqemu_vfree(VAR_7);", "return VAR_6;", "}" ]
[ 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61, 63, 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ] ]
13,257
void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, unsigned size, MMUAccessType access_type, int mmu_idx, MemTxAttrs attrs, MemTxResult response, uintptr_t retaddr) { ARMCPU *cpu = ARM_CPU(cs); ARMMMUFaultInfo fi = {}; /* now we have a real cpu fault */ cpu_restore_state(cs, retaddr); /* The EA bit in syndromes and fault status registers is an * IMPDEF classification of external aborts. ARM implementations * usually use this to indicate AXI bus Decode error (0) or * Slave error (1); in QEMU we follow that. */ fi.ea = (response != MEMTX_DECODE_ERROR); fi.type = ARMFault_SyncExternal; deliver_fault(cpu, addr, access_type, mmu_idx, &fi); }
true
qemu
3b39d734141a71296d08af3d4c32f872fafd782e
void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, unsigned size, MMUAccessType access_type, int mmu_idx, MemTxAttrs attrs, MemTxResult response, uintptr_t retaddr) { ARMCPU *cpu = ARM_CPU(cs); ARMMMUFaultInfo fi = {}; cpu_restore_state(cs, retaddr); fi.ea = (response != MEMTX_DECODE_ERROR); fi.type = ARMFault_SyncExternal; deliver_fault(cpu, addr, access_type, mmu_idx, &fi); }
{ "code": [ " fi.ea = (response != MEMTX_DECODE_ERROR);" ], "line_no": [ 35 ] }
void FUNC_0(CPUState *VAR_0, hwaddr VAR_1, vaddr VAR_2, unsigned VAR_3, MMUAccessType VAR_4, int VAR_5, MemTxAttrs VAR_6, MemTxResult VAR_7, uintptr_t VAR_8) { ARMCPU *cpu = ARM_CPU(VAR_0); ARMMMUFaultInfo fi = {}; cpu_restore_state(VAR_0, VAR_8); fi.ea = (VAR_7 != MEMTX_DECODE_ERROR); fi.type = ARMFault_SyncExternal; deliver_fault(cpu, VAR_2, VAR_4, VAR_5, &fi); }
[ "void FUNC_0(CPUState *VAR_0, hwaddr VAR_1,\nvaddr VAR_2, unsigned VAR_3,\nMMUAccessType VAR_4,\nint VAR_5, MemTxAttrs VAR_6,\nMemTxResult VAR_7, uintptr_t VAR_8)\n{", "ARMCPU *cpu = ARM_CPU(VAR_0);", "ARMMMUFaultInfo fi = {};", "cpu_restore_state(VAR_0, VAR_8);", "fi.ea = (VAR_7 != MEMTX_DECODE_ERROR);", "fi.type = ARMFault_SyncExternal;", "deliver_fault(cpu, VAR_2, VAR_4, VAR_5, &fi);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 21 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
13,258
static int truemotion1_decode_header(TrueMotion1Context *s) { int i, ret; int width_shift = 0; int new_pix_fmt; struct frame_header header; uint8_t header_buffer[128] = { 0 }; /* logical maximum size of the header */ const uint8_t *sel_vector_table; header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f; if (s->buf[0] < 0x10) { av_log(s->avctx, AV_LOG_ERROR, "invalid header size (%d)\n", s->buf[0]); /* unscramble the header bytes with a XOR operation */ for (i = 1; i < header.header_size; i++) header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1]; header.compression = header_buffer[0]; header.deltaset = header_buffer[1]; header.vectable = header_buffer[2]; header.ysize = AV_RL16(&header_buffer[3]); header.xsize = AV_RL16(&header_buffer[5]); header.checksum = AV_RL16(&header_buffer[7]); header.version = header_buffer[9]; header.header_type = header_buffer[10]; header.flags = header_buffer[11]; header.control = header_buffer[12]; /* Version 2 */ if (header.version >= 2) { if (header.header_type > 3) { av_log(s->avctx, AV_LOG_ERROR, "invalid header type (%d)\n", header.header_type); } else if ((header.header_type == 2) || (header.header_type == 3)) { s->flags = header.flags; if (!(s->flags & FLAG_INTERFRAME)) s->flags |= FLAG_KEYFRAME; } else s->flags = FLAG_KEYFRAME; } else /* Version 1 */ s->flags = FLAG_KEYFRAME; if (s->flags & FLAG_SPRITE) { avpriv_request_sample(s->avctx, "Frame with sprite"); /* FIXME header.width, height, xoffset and yoffset aren't initialized */ return AVERROR_PATCHWELCOME; } else { s->w = header.xsize; s->h = header.ysize; if (header.header_type < 2) { if ((s->w < 213) && (s->h >= 176)) { s->flags |= FLAG_INTERPOLATED; avpriv_request_sample(s->avctx, "Interpolated frame"); if (header.compression >= 17) { av_log(s->avctx, AV_LOG_ERROR, "invalid compression type (%d)\n", header.compression); if ((header.deltaset != s->last_deltaset) || (header.vectable != s->last_vectable)) select_delta_tables(s, header.deltaset); if ((header.compression & 1) && header.header_type) sel_vector_table = pc_tbl2; else { if (header.vectable > 0 && header.vectable < 4) sel_vector_table = tables[header.vectable - 1]; else { av_log(s->avctx, AV_LOG_ERROR, "invalid vector table id (%d)\n", header.vectable); if (compression_types[header.compression].algorithm == ALGO_RGB24H) { new_pix_fmt = AV_PIX_FMT_RGB32; width_shift = 1; } else new_pix_fmt = AV_PIX_FMT_RGB555; // RGB565 is supported as well s->w >>= width_shift; if (s->w != s->avctx->width || s->h != s->avctx->height || new_pix_fmt != s->avctx->pix_fmt) { av_frame_unref(s->frame); s->avctx->sample_aspect_ratio = (AVRational){ 1 << width_shift, 1 }; s->avctx->pix_fmt = new_pix_fmt; if ((ret = ff_set_dimensions(s->avctx, s->w, s->h)) < 0) return ret; av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int)); /* There is 1 change bit per 4 pixels, so each change byte represents * 32 pixels; divide width by 4 to obtain the number of change bits and * then round up to the nearest byte. */ s->mb_change_bits_row_size = ((s->avctx->width >> (2 - width_shift)) + 7) >> 3; if ((header.deltaset != s->last_deltaset) || (header.vectable != s->last_vectable)) { if (compression_types[header.compression].algorithm == ALGO_RGB24H) gen_vector_table24(s, sel_vector_table); else if (s->avctx->pix_fmt == AV_PIX_FMT_RGB555) gen_vector_table15(s, sel_vector_table); else gen_vector_table16(s, sel_vector_table); /* set up pointers to the other key data chunks */ s->mb_change_bits = s->buf + header.header_size; if (s->flags & FLAG_KEYFRAME) { /* no change bits specified for a keyframe; only index bytes */ s->index_stream = s->mb_change_bits; } else { /* one change bit per 4x4 block */ s->index_stream = s->mb_change_bits + (s->mb_change_bits_row_size * (s->avctx->height >> 2)); s->index_stream_size = s->size - (s->index_stream - s->buf); s->last_deltaset = header.deltaset; s->last_vectable = header.vectable; s->compression = header.compression; s->block_width = compression_types[header.compression].block_width; s->block_height = compression_types[header.compression].block_height; s->block_type = compression_types[header.compression].block_type; if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "tables: %d / %d c:%d %dx%d t:%d %s%s%s%s\n", s->last_deltaset, s->last_vectable, s->compression, s->block_width, s->block_height, s->block_type, s->flags & FLAG_KEYFRAME ? " KEY" : "", s->flags & FLAG_INTERFRAME ? " INTER" : "", s->flags & FLAG_SPRITE ? " SPRITE" : "", s->flags & FLAG_INTERPOLATED ? " INTERPOL" : ""); return header.header_size;
true
FFmpeg
2240e2078d53d3cfce8ff1dda64e58fa72038602
static int truemotion1_decode_header(TrueMotion1Context *s) { int i, ret; int width_shift = 0; int new_pix_fmt; struct frame_header header; uint8_t header_buffer[128] = { 0 }; const uint8_t *sel_vector_table; header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f; if (s->buf[0] < 0x10) { av_log(s->avctx, AV_LOG_ERROR, "invalid header size (%d)\n", s->buf[0]); for (i = 1; i < header.header_size; i++) header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1]; header.compression = header_buffer[0]; header.deltaset = header_buffer[1]; header.vectable = header_buffer[2]; header.ysize = AV_RL16(&header_buffer[3]); header.xsize = AV_RL16(&header_buffer[5]); header.checksum = AV_RL16(&header_buffer[7]); header.version = header_buffer[9]; header.header_type = header_buffer[10]; header.flags = header_buffer[11]; header.control = header_buffer[12]; if (header.version >= 2) { if (header.header_type > 3) { av_log(s->avctx, AV_LOG_ERROR, "invalid header type (%d)\n", header.header_type); } else if ((header.header_type == 2) || (header.header_type == 3)) { s->flags = header.flags; if (!(s->flags & FLAG_INTERFRAME)) s->flags |= FLAG_KEYFRAME; } else s->flags = FLAG_KEYFRAME; } else s->flags = FLAG_KEYFRAME; if (s->flags & FLAG_SPRITE) { avpriv_request_sample(s->avctx, "Frame with sprite"); return AVERROR_PATCHWELCOME; } else { s->w = header.xsize; s->h = header.ysize; if (header.header_type < 2) { if ((s->w < 213) && (s->h >= 176)) { s->flags |= FLAG_INTERPOLATED; avpriv_request_sample(s->avctx, "Interpolated frame"); if (header.compression >= 17) { av_log(s->avctx, AV_LOG_ERROR, "invalid compression type (%d)\n", header.compression); if ((header.deltaset != s->last_deltaset) || (header.vectable != s->last_vectable)) select_delta_tables(s, header.deltaset); if ((header.compression & 1) && header.header_type) sel_vector_table = pc_tbl2; else { if (header.vectable > 0 && header.vectable < 4) sel_vector_table = tables[header.vectable - 1]; else { av_log(s->avctx, AV_LOG_ERROR, "invalid vector table id (%d)\n", header.vectable); if (compression_types[header.compression].algorithm == ALGO_RGB24H) { new_pix_fmt = AV_PIX_FMT_RGB32; width_shift = 1; } else new_pix_fmt = AV_PIX_FMT_RGB555; s->w >>= width_shift; if (s->w != s->avctx->width || s->h != s->avctx->height || new_pix_fmt != s->avctx->pix_fmt) { av_frame_unref(s->frame); s->avctx->sample_aspect_ratio = (AVRational){ 1 << width_shift, 1 }; s->avctx->pix_fmt = new_pix_fmt; if ((ret = ff_set_dimensions(s->avctx, s->w, s->h)) < 0) return ret; av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int)); s->mb_change_bits_row_size = ((s->avctx->width >> (2 - width_shift)) + 7) >> 3; if ((header.deltaset != s->last_deltaset) || (header.vectable != s->last_vectable)) { if (compression_types[header.compression].algorithm == ALGO_RGB24H) gen_vector_table24(s, sel_vector_table); else if (s->avctx->pix_fmt == AV_PIX_FMT_RGB555) gen_vector_table15(s, sel_vector_table); else gen_vector_table16(s, sel_vector_table); s->mb_change_bits = s->buf + header.header_size; if (s->flags & FLAG_KEYFRAME) { s->index_stream = s->mb_change_bits; } else { s->index_stream = s->mb_change_bits + (s->mb_change_bits_row_size * (s->avctx->height >> 2)); s->index_stream_size = s->size - (s->index_stream - s->buf); s->last_deltaset = header.deltaset; s->last_vectable = header.vectable; s->compression = header.compression; s->block_width = compression_types[header.compression].block_width; s->block_height = compression_types[header.compression].block_height; s->block_type = compression_types[header.compression].block_type; if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "tables: %d / %d c:%d %dx%d t:%d %s%s%s%s\n", s->last_deltaset, s->last_vectable, s->compression, s->block_width, s->block_height, s->block_type, s->flags & FLAG_KEYFRAME ? " KEY" : "", s->flags & FLAG_INTERFRAME ? " INTER" : "", s->flags & FLAG_SPRITE ? " SPRITE" : "", s->flags & FLAG_INTERPOLATED ? " INTERPOL" : ""); return header.header_size;
{ "code": [], "line_no": [] }
static int FUNC_0(TrueMotion1Context *VAR_0) { int VAR_1, VAR_2; int VAR_3 = 0; int VAR_4; struct frame_header VAR_5; uint8_t header_buffer[128] = { 0 }; const uint8_t *VAR_6; VAR_5.header_size = ((VAR_0->buf[0] >> 5) | (VAR_0->buf[0] << 3)) & 0x7f; if (VAR_0->buf[0] < 0x10) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid VAR_5 size (%d)\n", VAR_0->buf[0]); for (VAR_1 = 1; VAR_1 < VAR_5.header_size; VAR_1++) header_buffer[VAR_1 - 1] = VAR_0->buf[VAR_1] ^ VAR_0->buf[VAR_1 + 1]; VAR_5.compression = header_buffer[0]; VAR_5.deltaset = header_buffer[1]; VAR_5.vectable = header_buffer[2]; VAR_5.ysize = AV_RL16(&header_buffer[3]); VAR_5.xsize = AV_RL16(&header_buffer[5]); VAR_5.checksum = AV_RL16(&header_buffer[7]); VAR_5.version = header_buffer[9]; VAR_5.header_type = header_buffer[10]; VAR_5.flags = header_buffer[11]; VAR_5.control = header_buffer[12]; if (VAR_5.version >= 2) { if (VAR_5.header_type > 3) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid VAR_5 type (%d)\n", VAR_5.header_type); } else if ((VAR_5.header_type == 2) || (VAR_5.header_type == 3)) { VAR_0->flags = VAR_5.flags; if (!(VAR_0->flags & FLAG_INTERFRAME)) VAR_0->flags |= FLAG_KEYFRAME; } else VAR_0->flags = FLAG_KEYFRAME; } else VAR_0->flags = FLAG_KEYFRAME; if (VAR_0->flags & FLAG_SPRITE) { avpriv_request_sample(VAR_0->avctx, "Frame with sprite"); return AVERROR_PATCHWELCOME; } else { VAR_0->w = VAR_5.xsize; VAR_0->h = VAR_5.ysize; if (VAR_5.header_type < 2) { if ((VAR_0->w < 213) && (VAR_0->h >= 176)) { VAR_0->flags |= FLAG_INTERPOLATED; avpriv_request_sample(VAR_0->avctx, "Interpolated frame"); if (VAR_5.compression >= 17) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid compression type (%d)\n", VAR_5.compression); if ((VAR_5.deltaset != VAR_0->last_deltaset) || (VAR_5.vectable != VAR_0->last_vectable)) select_delta_tables(VAR_0, VAR_5.deltaset); if ((VAR_5.compression & 1) && VAR_5.header_type) VAR_6 = pc_tbl2; else { if (VAR_5.vectable > 0 && VAR_5.vectable < 4) VAR_6 = tables[VAR_5.vectable - 1]; else { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid vector table id (%d)\n", VAR_5.vectable); if (compression_types[VAR_5.compression].algorithm == ALGO_RGB24H) { VAR_4 = AV_PIX_FMT_RGB32; VAR_3 = 1; } else VAR_4 = AV_PIX_FMT_RGB555; VAR_0->w >>= VAR_3; if (VAR_0->w != VAR_0->avctx->width || VAR_0->h != VAR_0->avctx->height || VAR_4 != VAR_0->avctx->pix_fmt) { av_frame_unref(VAR_0->frame); VAR_0->avctx->sample_aspect_ratio = (AVRational){ 1 << VAR_3, 1 }; VAR_0->avctx->pix_fmt = VAR_4; if ((VAR_2 = ff_set_dimensions(VAR_0->avctx, VAR_0->w, VAR_0->h)) < 0) return VAR_2; av_fast_malloc(&VAR_0->vert_pred, &VAR_0->vert_pred_size, VAR_0->avctx->width * sizeof(unsigned int)); VAR_0->mb_change_bits_row_size = ((VAR_0->avctx->width >> (2 - VAR_3)) + 7) >> 3; if ((VAR_5.deltaset != VAR_0->last_deltaset) || (VAR_5.vectable != VAR_0->last_vectable)) { if (compression_types[VAR_5.compression].algorithm == ALGO_RGB24H) gen_vector_table24(VAR_0, VAR_6); else if (VAR_0->avctx->pix_fmt == AV_PIX_FMT_RGB555) gen_vector_table15(VAR_0, VAR_6); else gen_vector_table16(VAR_0, VAR_6); VAR_0->mb_change_bits = VAR_0->buf + VAR_5.header_size; if (VAR_0->flags & FLAG_KEYFRAME) { VAR_0->index_stream = VAR_0->mb_change_bits; } else { VAR_0->index_stream = VAR_0->mb_change_bits + (VAR_0->mb_change_bits_row_size * (VAR_0->avctx->height >> 2)); VAR_0->index_stream_size = VAR_0->size - (VAR_0->index_stream - VAR_0->buf); VAR_0->last_deltaset = VAR_5.deltaset; VAR_0->last_vectable = VAR_5.vectable; VAR_0->compression = VAR_5.compression; VAR_0->block_width = compression_types[VAR_5.compression].block_width; VAR_0->block_height = compression_types[VAR_5.compression].block_height; VAR_0->block_type = compression_types[VAR_5.compression].block_type; if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) av_log(VAR_0->avctx, AV_LOG_INFO, "tables: %d / %d c:%d %dx%d t:%d %VAR_0%VAR_0%VAR_0%VAR_0\n", VAR_0->last_deltaset, VAR_0->last_vectable, VAR_0->compression, VAR_0->block_width, VAR_0->block_height, VAR_0->block_type, VAR_0->flags & FLAG_KEYFRAME ? " KEY" : "", VAR_0->flags & FLAG_INTERFRAME ? " INTER" : "", VAR_0->flags & FLAG_SPRITE ? " SPRITE" : "", VAR_0->flags & FLAG_INTERPOLATED ? " INTERPOL" : ""); return VAR_5.header_size;
[ "static int FUNC_0(TrueMotion1Context *VAR_0)\n{", "int VAR_1, VAR_2;", "int VAR_3 = 0;", "int VAR_4;", "struct frame_header VAR_5;", "uint8_t header_buffer[128] = { 0 };", "const uint8_t *VAR_6;", "VAR_5.header_size = ((VAR_0->buf[0] >> 5) | (VAR_0->buf[0] << 3)) & 0x7f;", "if (VAR_0->buf[0] < 0x10)\n{", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid VAR_5 size (%d)\\n\", VAR_0->buf[0]);", "for (VAR_1 = 1; VAR_1 < VAR_5.header_size; VAR_1++)", "header_buffer[VAR_1 - 1] = VAR_0->buf[VAR_1] ^ VAR_0->buf[VAR_1 + 1];", "VAR_5.compression = header_buffer[0];", "VAR_5.deltaset = header_buffer[1];", "VAR_5.vectable = header_buffer[2];", "VAR_5.ysize = AV_RL16(&header_buffer[3]);", "VAR_5.xsize = AV_RL16(&header_buffer[5]);", "VAR_5.checksum = AV_RL16(&header_buffer[7]);", "VAR_5.version = header_buffer[9];", "VAR_5.header_type = header_buffer[10];", "VAR_5.flags = header_buffer[11];", "VAR_5.control = header_buffer[12];", "if (VAR_5.version >= 2)\n{", "if (VAR_5.header_type > 3)\n{", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid VAR_5 type (%d)\\n\", VAR_5.header_type);", "} else if ((VAR_5.header_type == 2) || (VAR_5.header_type == 3)) {", "VAR_0->flags = VAR_5.flags;", "if (!(VAR_0->flags & FLAG_INTERFRAME))\nVAR_0->flags |= FLAG_KEYFRAME;", "} else", "VAR_0->flags = FLAG_KEYFRAME;", "} else", "VAR_0->flags = FLAG_KEYFRAME;", "if (VAR_0->flags & FLAG_SPRITE) {", "avpriv_request_sample(VAR_0->avctx, \"Frame with sprite\");", "return AVERROR_PATCHWELCOME;", "} else {", "VAR_0->w = VAR_5.xsize;", "VAR_0->h = VAR_5.ysize;", "if (VAR_5.header_type < 2) {", "if ((VAR_0->w < 213) && (VAR_0->h >= 176))\n{", "VAR_0->flags |= FLAG_INTERPOLATED;", "avpriv_request_sample(VAR_0->avctx, \"Interpolated frame\");", "if (VAR_5.compression >= 17) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid compression type (%d)\\n\", VAR_5.compression);", "if ((VAR_5.deltaset != VAR_0->last_deltaset) ||\n(VAR_5.vectable != VAR_0->last_vectable))\nselect_delta_tables(VAR_0, VAR_5.deltaset);", "if ((VAR_5.compression & 1) && VAR_5.header_type)\nVAR_6 = pc_tbl2;", "else {", "if (VAR_5.vectable > 0 && VAR_5.vectable < 4)\nVAR_6 = tables[VAR_5.vectable - 1];", "else {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"invalid vector table id (%d)\\n\", VAR_5.vectable);", "if (compression_types[VAR_5.compression].algorithm == ALGO_RGB24H) {", "VAR_4 = AV_PIX_FMT_RGB32;", "VAR_3 = 1;", "} else", "VAR_4 = AV_PIX_FMT_RGB555;", "VAR_0->w >>= VAR_3;", "if (VAR_0->w != VAR_0->avctx->width || VAR_0->h != VAR_0->avctx->height ||\nVAR_4 != VAR_0->avctx->pix_fmt) {", "av_frame_unref(VAR_0->frame);", "VAR_0->avctx->sample_aspect_ratio = (AVRational){ 1 << VAR_3, 1 };", "VAR_0->avctx->pix_fmt = VAR_4;", "if ((VAR_2 = ff_set_dimensions(VAR_0->avctx, VAR_0->w, VAR_0->h)) < 0)\nreturn VAR_2;", "av_fast_malloc(&VAR_0->vert_pred, &VAR_0->vert_pred_size, VAR_0->avctx->width * sizeof(unsigned int));", "VAR_0->mb_change_bits_row_size = ((VAR_0->avctx->width >> (2 - VAR_3)) + 7) >> 3;", "if ((VAR_5.deltaset != VAR_0->last_deltaset) || (VAR_5.vectable != VAR_0->last_vectable))\n{", "if (compression_types[VAR_5.compression].algorithm == ALGO_RGB24H)\ngen_vector_table24(VAR_0, VAR_6);", "else\nif (VAR_0->avctx->pix_fmt == AV_PIX_FMT_RGB555)\ngen_vector_table15(VAR_0, VAR_6);", "else\ngen_vector_table16(VAR_0, VAR_6);", "VAR_0->mb_change_bits = VAR_0->buf + VAR_5.header_size;", "if (VAR_0->flags & FLAG_KEYFRAME) {", "VAR_0->index_stream = VAR_0->mb_change_bits;", "} else {", "VAR_0->index_stream = VAR_0->mb_change_bits +\n(VAR_0->mb_change_bits_row_size * (VAR_0->avctx->height >> 2));", "VAR_0->index_stream_size = VAR_0->size - (VAR_0->index_stream - VAR_0->buf);", "VAR_0->last_deltaset = VAR_5.deltaset;", "VAR_0->last_vectable = VAR_5.vectable;", "VAR_0->compression = VAR_5.compression;", "VAR_0->block_width = compression_types[VAR_5.compression].block_width;", "VAR_0->block_height = compression_types[VAR_5.compression].block_height;", "VAR_0->block_type = compression_types[VAR_5.compression].block_type;", "if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)\nav_log(VAR_0->avctx, AV_LOG_INFO, \"tables: %d / %d c:%d %dx%d t:%d %VAR_0%VAR_0%VAR_0%VAR_0\\n\",\nVAR_0->last_deltaset, VAR_0->last_vectable, VAR_0->compression, VAR_0->block_width,\nVAR_0->block_height, VAR_0->block_type,\nVAR_0->flags & FLAG_KEYFRAME ? \" KEY\" : \"\",\nVAR_0->flags & FLAG_INTERFRAME ? \" INTER\" : \"\",\nVAR_0->flags & FLAG_SPRITE ? \" SPRITE\" : \"\",\nVAR_0->flags & FLAG_INTERPOLATED ? \" INTERPOL\" : \"\");", "return VAR_5.header_size;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10, 11 ], [ 12 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 27, 28 ], [ 29, 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34, 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48, 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54, 55, 56 ], [ 57, 58 ], [ 59 ], [ 60, 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65 ], [ 66 ], [ 67 ], [ 68 ], [ 69 ], [ 70, 71 ], [ 72 ], [ 73 ], [ 74 ], [ 75, 76 ], [ 77 ], [ 81 ], [ 82, 83 ], [ 84, 85 ], [ 86, 87, 88 ], [ 89, 90 ], [ 92 ], [ 93 ], [ 95 ], [ 96 ], [ 98, 99 ], [ 100 ], [ 101 ], [ 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107, 108, 109, 110, 111, 112, 113, 114 ], [ 115 ] ]
13,259
static av_always_inline void RENAME(decode_line)(FFV1Context *s, int w, TYPE *sample[2], int plane_index, int bits) { PlaneContext *const p = &s->plane[plane_index]; RangeCoder *const c = &s->c; int x; int run_count = 0; int run_mode = 0; int run_index = s->run_index; if (s->slice_coding_mode == 1) { int i; for (x = 0; x < w; x++) { int v = 0; for (i=0; i<bits; i++) { uint8_t state = 128; v += v + get_rac(c, &state); } sample[1][x] = v; } return; } for (x = 0; x < w; x++) { int diff, context, sign; context = RENAME(get_context)(p, sample[1] + x, sample[0] + x, sample[1] + x); if (context < 0) { context = -context; sign = 1; } else sign = 0; av_assert2(context < p->context_count); if (s->ac != AC_GOLOMB_RICE) { diff = get_symbol_inline(c, p->state[context], 1); } else { if (context == 0 && run_mode == 0) run_mode = 1; if (run_mode) { if (run_count == 0 && run_mode == 1) { if (get_bits1(&s->gb)) { run_count = 1 << ff_log2_run[run_index]; if (x + run_count <= w) run_index++; } else { if (ff_log2_run[run_index]) run_count = get_bits(&s->gb, ff_log2_run[run_index]); else run_count = 0; if (run_index) run_index--; run_mode = 2; } } run_count--; if (run_count < 0) { run_mode = 0; run_count = 0; diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); if (diff >= 0) diff++; } else diff = 0; } else diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); ff_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n", run_count, run_index, run_mode, x, get_bits_count(&s->gb)); } if (sign) diff = -diff; sample[1][x] = av_mod_uintp2(RENAME(predict)(sample[1] + x, sample[0] + x) + (SUINT)diff, bits); } s->run_index = run_index; }
true
FFmpeg
4de4308d2aa3bfaa286ab566caf087d523cf9a85
static av_always_inline void RENAME(decode_line)(FFV1Context *s, int w, TYPE *sample[2], int plane_index, int bits) { PlaneContext *const p = &s->plane[plane_index]; RangeCoder *const c = &s->c; int x; int run_count = 0; int run_mode = 0; int run_index = s->run_index; if (s->slice_coding_mode == 1) { int i; for (x = 0; x < w; x++) { int v = 0; for (i=0; i<bits; i++) { uint8_t state = 128; v += v + get_rac(c, &state); } sample[1][x] = v; } return; } for (x = 0; x < w; x++) { int diff, context, sign; context = RENAME(get_context)(p, sample[1] + x, sample[0] + x, sample[1] + x); if (context < 0) { context = -context; sign = 1; } else sign = 0; av_assert2(context < p->context_count); if (s->ac != AC_GOLOMB_RICE) { diff = get_symbol_inline(c, p->state[context], 1); } else { if (context == 0 && run_mode == 0) run_mode = 1; if (run_mode) { if (run_count == 0 && run_mode == 1) { if (get_bits1(&s->gb)) { run_count = 1 << ff_log2_run[run_index]; if (x + run_count <= w) run_index++; } else { if (ff_log2_run[run_index]) run_count = get_bits(&s->gb, ff_log2_run[run_index]); else run_count = 0; if (run_index) run_index--; run_mode = 2; } } run_count--; if (run_count < 0) { run_mode = 0; run_count = 0; diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); if (diff >= 0) diff++; } else diff = 0; } else diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); ff_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n", run_count, run_index, run_mode, x, get_bits_count(&s->gb)); } if (sign) diff = -diff; sample[1][x] = av_mod_uintp2(RENAME(predict)(sample[1] + x, sample[0] + x) + (SUINT)diff, bits); } s->run_index = run_index; }
{ "code": [ " diff = -diff;" ], "line_no": [ 153 ] }
static av_always_inline void FUNC_0(decode_line)(FFV1Context *s, int w, TYPE *sample[2], int plane_index, int bits) { PlaneContext *const p = &s->plane[plane_index]; RangeCoder *const c = &s->c; int VAR_0; int VAR_1 = 0; int VAR_2 = 0; int VAR_3 = s->VAR_3; if (s->slice_coding_mode == 1) { int VAR_4; for (VAR_0 = 0; VAR_0 < w; VAR_0++) { int v = 0; for (VAR_4=0; VAR_4<bits; VAR_4++) { uint8_t state = 128; v += v + get_rac(c, &state); } sample[1][VAR_0] = v; } return; } for (VAR_0 = 0; VAR_0 < w; VAR_0++) { int diff, context, sign; context = FUNC_0(get_context)(p, sample[1] + VAR_0, sample[0] + VAR_0, sample[1] + VAR_0); if (context < 0) { context = -context; sign = 1; } else sign = 0; av_assert2(context < p->context_count); if (s->ac != AC_GOLOMB_RICE) { diff = get_symbol_inline(c, p->state[context], 1); } else { if (context == 0 && VAR_2 == 0) VAR_2 = 1; if (VAR_2) { if (VAR_1 == 0 && VAR_2 == 1) { if (get_bits1(&s->gb)) { VAR_1 = 1 << ff_log2_run[VAR_3]; if (VAR_0 + VAR_1 <= w) VAR_3++; } else { if (ff_log2_run[VAR_3]) VAR_1 = get_bits(&s->gb, ff_log2_run[VAR_3]); else VAR_1 = 0; if (VAR_3) VAR_3--; VAR_2 = 2; } } VAR_1--; if (VAR_1 < 0) { VAR_2 = 0; VAR_1 = 0; diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); if (diff >= 0) diff++; } else diff = 0; } else diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); ff_dlog(s->avctx, "count:%d index:%d, mode:%d, VAR_0:%d pos:%d\n", VAR_1, VAR_3, VAR_2, VAR_0, get_bits_count(&s->gb)); } if (sign) diff = -diff; sample[1][VAR_0] = av_mod_uintp2(FUNC_0(predict)(sample[1] + VAR_0, sample[0] + VAR_0) + (SUINT)diff, bits); } s->VAR_3 = VAR_3; }
[ "static av_always_inline void FUNC_0(decode_line)(FFV1Context *s, int w,\nTYPE *sample[2],\nint plane_index, int bits)\n{", "PlaneContext *const p = &s->plane[plane_index];", "RangeCoder *const c = &s->c;", "int VAR_0;", "int VAR_1 = 0;", "int VAR_2 = 0;", "int VAR_3 = s->VAR_3;", "if (s->slice_coding_mode == 1) {", "int VAR_4;", "for (VAR_0 = 0; VAR_0 < w; VAR_0++) {", "int v = 0;", "for (VAR_4=0; VAR_4<bits; VAR_4++) {", "uint8_t state = 128;", "v += v + get_rac(c, &state);", "}", "sample[1][VAR_0] = v;", "}", "return;", "}", "for (VAR_0 = 0; VAR_0 < w; VAR_0++) {", "int diff, context, sign;", "context = FUNC_0(get_context)(p, sample[1] + VAR_0, sample[0] + VAR_0, sample[1] + VAR_0);", "if (context < 0) {", "context = -context;", "sign = 1;", "} else", "sign = 0;", "av_assert2(context < p->context_count);", "if (s->ac != AC_GOLOMB_RICE) {", "diff = get_symbol_inline(c, p->state[context], 1);", "} else {", "if (context == 0 && VAR_2 == 0)\nVAR_2 = 1;", "if (VAR_2) {", "if (VAR_1 == 0 && VAR_2 == 1) {", "if (get_bits1(&s->gb)) {", "VAR_1 = 1 << ff_log2_run[VAR_3];", "if (VAR_0 + VAR_1 <= w)\nVAR_3++;", "} else {", "if (ff_log2_run[VAR_3])\nVAR_1 = get_bits(&s->gb, ff_log2_run[VAR_3]);", "else\nVAR_1 = 0;", "if (VAR_3)\nVAR_3--;", "VAR_2 = 2;", "}", "}", "VAR_1--;", "if (VAR_1 < 0) {", "VAR_2 = 0;", "VAR_1 = 0;", "diff = get_vlc_symbol(&s->gb, &p->vlc_state[context],\nbits);", "if (diff >= 0)\ndiff++;", "} else", "diff = 0;", "} else", "diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits);", "ff_dlog(s->avctx, \"count:%d index:%d, mode:%d, VAR_0:%d pos:%d\\n\",\nVAR_1, VAR_3, VAR_2, VAR_0, get_bits_count(&s->gb));", "}", "if (sign)\ndiff = -diff;", "sample[1][VAR_0] = av_mod_uintp2(FUNC_0(predict)(sample[1] + VAR_0, sample[0] + VAR_0) + (SUINT)diff, bits);", "}", "s->VAR_3 = VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99, 101 ], [ 103, 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143, 145 ], [ 147 ], [ 151, 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ] ]
13,260
static int bochs_open(BlockDriverState *bs, int flags) { BDRVBochsState *s = bs->opaque; int i; struct bochs_header bochs; struct bochs_header_v1 header_v1; bs->read_only = 1; // no write support yet if (bdrv_pread(bs->file, 0, &bochs, sizeof(bochs)) != sizeof(bochs)) { goto fail; } if (strcmp(bochs.magic, HEADER_MAGIC) || strcmp(bochs.type, REDOLOG_TYPE) || strcmp(bochs.subtype, GROWING_TYPE) || ((le32_to_cpu(bochs.version) != HEADER_VERSION) && (le32_to_cpu(bochs.version) != HEADER_V1))) { return -EMEDIUMTYPE; } if (le32_to_cpu(bochs.version) == HEADER_V1) { memcpy(&header_v1, &bochs, sizeof(bochs)); bs->total_sectors = le64_to_cpu(header_v1.extra.redolog.disk) / 512; } else { bs->total_sectors = le64_to_cpu(bochs.extra.redolog.disk) / 512; } s->catalog_size = le32_to_cpu(bochs.extra.redolog.catalog); s->catalog_bitmap = g_malloc(s->catalog_size * 4); if (bdrv_pread(bs->file, le32_to_cpu(bochs.header), s->catalog_bitmap, s->catalog_size * 4) != s->catalog_size * 4) goto fail; for (i = 0; i < s->catalog_size; i++) le32_to_cpus(&s->catalog_bitmap[i]); s->data_offset = le32_to_cpu(bochs.header) + (s->catalog_size * 4); s->bitmap_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.bitmap) - 1) / 512; s->extent_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.extent) - 1) / 512; s->extent_size = le32_to_cpu(bochs.extra.redolog.extent); qemu_co_mutex_init(&s->lock); return 0; fail: return -1; }
true
qemu
5b7d7dfd198f06ec5edd0c857291c5035c5c060f
static int bochs_open(BlockDriverState *bs, int flags) { BDRVBochsState *s = bs->opaque; int i; struct bochs_header bochs; struct bochs_header_v1 header_v1; bs->read_only = 1; if (bdrv_pread(bs->file, 0, &bochs, sizeof(bochs)) != sizeof(bochs)) { goto fail; } if (strcmp(bochs.magic, HEADER_MAGIC) || strcmp(bochs.type, REDOLOG_TYPE) || strcmp(bochs.subtype, GROWING_TYPE) || ((le32_to_cpu(bochs.version) != HEADER_VERSION) && (le32_to_cpu(bochs.version) != HEADER_V1))) { return -EMEDIUMTYPE; } if (le32_to_cpu(bochs.version) == HEADER_V1) { memcpy(&header_v1, &bochs, sizeof(bochs)); bs->total_sectors = le64_to_cpu(header_v1.extra.redolog.disk) / 512; } else { bs->total_sectors = le64_to_cpu(bochs.extra.redolog.disk) / 512; } s->catalog_size = le32_to_cpu(bochs.extra.redolog.catalog); s->catalog_bitmap = g_malloc(s->catalog_size * 4); if (bdrv_pread(bs->file, le32_to_cpu(bochs.header), s->catalog_bitmap, s->catalog_size * 4) != s->catalog_size * 4) goto fail; for (i = 0; i < s->catalog_size; i++) le32_to_cpus(&s->catalog_bitmap[i]); s->data_offset = le32_to_cpu(bochs.header) + (s->catalog_size * 4); s->bitmap_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.bitmap) - 1) / 512; s->extent_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.extent) - 1) / 512; s->extent_size = le32_to_cpu(bochs.extra.redolog.extent); qemu_co_mutex_init(&s->lock); return 0; fail: return -1; }
{ "code": [ " if (bdrv_pread(bs->file, 0, &bochs, sizeof(bochs)) != sizeof(bochs)) {", " goto fail;", " if (bdrv_pread(bs->file, le32_to_cpu(bochs.header), s->catalog_bitmap,", " s->catalog_size * 4) != s->catalog_size * 4)", "\tgoto fail;", " fail:", " return -1;" ], "line_no": [ 19, 21, 61, 63, 65, 91, 93 ] }
static int FUNC_0(BlockDriverState *VAR_0, int VAR_1) { BDRVBochsState *s = VAR_0->opaque; int VAR_2; struct bochs_header VAR_3; struct bochs_header_v1 VAR_4; VAR_0->read_only = 1; if (bdrv_pread(VAR_0->file, 0, &VAR_3, sizeof(VAR_3)) != sizeof(VAR_3)) { goto fail; } if (strcmp(VAR_3.magic, HEADER_MAGIC) || strcmp(VAR_3.type, REDOLOG_TYPE) || strcmp(VAR_3.subtype, GROWING_TYPE) || ((le32_to_cpu(VAR_3.version) != HEADER_VERSION) && (le32_to_cpu(VAR_3.version) != HEADER_V1))) { return -EMEDIUMTYPE; } if (le32_to_cpu(VAR_3.version) == HEADER_V1) { memcpy(&VAR_4, &VAR_3, sizeof(VAR_3)); VAR_0->total_sectors = le64_to_cpu(VAR_4.extra.redolog.disk) / 512; } else { VAR_0->total_sectors = le64_to_cpu(VAR_3.extra.redolog.disk) / 512; } s->catalog_size = le32_to_cpu(VAR_3.extra.redolog.catalog); s->catalog_bitmap = g_malloc(s->catalog_size * 4); if (bdrv_pread(VAR_0->file, le32_to_cpu(VAR_3.header), s->catalog_bitmap, s->catalog_size * 4) != s->catalog_size * 4) goto fail; for (VAR_2 = 0; VAR_2 < s->catalog_size; VAR_2++) le32_to_cpus(&s->catalog_bitmap[VAR_2]); s->data_offset = le32_to_cpu(VAR_3.header) + (s->catalog_size * 4); s->bitmap_blocks = 1 + (le32_to_cpu(VAR_3.extra.redolog.bitmap) - 1) / 512; s->extent_blocks = 1 + (le32_to_cpu(VAR_3.extra.redolog.extent) - 1) / 512; s->extent_size = le32_to_cpu(VAR_3.extra.redolog.extent); qemu_co_mutex_init(&s->lock); return 0; fail: return -1; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int VAR_1)\n{", "BDRVBochsState *s = VAR_0->opaque;", "int VAR_2;", "struct bochs_header VAR_3;", "struct bochs_header_v1 VAR_4;", "VAR_0->read_only = 1;", "if (bdrv_pread(VAR_0->file, 0, &VAR_3, sizeof(VAR_3)) != sizeof(VAR_3)) {", "goto fail;", "}", "if (strcmp(VAR_3.magic, HEADER_MAGIC) ||\nstrcmp(VAR_3.type, REDOLOG_TYPE) ||\nstrcmp(VAR_3.subtype, GROWING_TYPE) ||\n((le32_to_cpu(VAR_3.version) != HEADER_VERSION) &&\n(le32_to_cpu(VAR_3.version) != HEADER_V1))) {", "return -EMEDIUMTYPE;", "}", "if (le32_to_cpu(VAR_3.version) == HEADER_V1) {", "memcpy(&VAR_4, &VAR_3, sizeof(VAR_3));", "VAR_0->total_sectors = le64_to_cpu(VAR_4.extra.redolog.disk) / 512;", "} else {", "VAR_0->total_sectors = le64_to_cpu(VAR_3.extra.redolog.disk) / 512;", "}", "s->catalog_size = le32_to_cpu(VAR_3.extra.redolog.catalog);", "s->catalog_bitmap = g_malloc(s->catalog_size * 4);", "if (bdrv_pread(VAR_0->file, le32_to_cpu(VAR_3.header), s->catalog_bitmap,\ns->catalog_size * 4) != s->catalog_size * 4)\ngoto fail;", "for (VAR_2 = 0; VAR_2 < s->catalog_size; VAR_2++)", "le32_to_cpus(&s->catalog_bitmap[VAR_2]);", "s->data_offset = le32_to_cpu(VAR_3.header) + (s->catalog_size * 4);", "s->bitmap_blocks = 1 + (le32_to_cpu(VAR_3.extra.redolog.bitmap) - 1) / 512;", "s->extent_blocks = 1 + (le32_to_cpu(VAR_3.extra.redolog.extent) - 1) / 512;", "s->extent_size = le32_to_cpu(VAR_3.extra.redolog.extent);", "qemu_co_mutex_init(&s->lock);", "return 0;", "fail:\nreturn -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29, 31, 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61, 63, 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ], [ 83 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ] ]
13,261
static void set_alarm (m48t59_t *NVRAM, struct tm *tm) { NVRAM->alarm = mktime(tm); if (NVRAM->alrm_timer != NULL) { qemu_del_timer(NVRAM->alrm_timer); NVRAM->alrm_timer = NULL; } if (NVRAM->alarm - time(NULL) > 0) qemu_mod_timer(NVRAM->alrm_timer, NVRAM->alarm * 1000); }
true
qemu
868d585aced5457218b3443398d08594d9c3ba6d
static void set_alarm (m48t59_t *NVRAM, struct tm *tm) { NVRAM->alarm = mktime(tm); if (NVRAM->alrm_timer != NULL) { qemu_del_timer(NVRAM->alrm_timer); NVRAM->alrm_timer = NULL; } if (NVRAM->alarm - time(NULL) > 0) qemu_mod_timer(NVRAM->alrm_timer, NVRAM->alarm * 1000); }
{ "code": [ "\tNVRAM->alrm_timer = NULL;", " if (NVRAM->alarm - time(NULL) > 0)", "\tqemu_mod_timer(NVRAM->alrm_timer, NVRAM->alarm * 1000);" ], "line_no": [ 11, 15, 17 ] }
static void FUNC_0 (m48t59_t *VAR_0, struct VAR_1 *VAR_1) { VAR_0->alarm = mktime(VAR_1); if (VAR_0->alrm_timer != NULL) { qemu_del_timer(VAR_0->alrm_timer); VAR_0->alrm_timer = NULL; } if (VAR_0->alarm - time(NULL) > 0) qemu_mod_timer(VAR_0->alrm_timer, VAR_0->alarm * 1000); }
[ "static void FUNC_0 (m48t59_t *VAR_0, struct VAR_1 *VAR_1)\n{", "VAR_0->alarm = mktime(VAR_1);", "if (VAR_0->alrm_timer != NULL) {", "qemu_del_timer(VAR_0->alrm_timer);", "VAR_0->alrm_timer = NULL;", "}", "if (VAR_0->alarm - time(NULL) > 0)\nqemu_mod_timer(VAR_0->alrm_timer, VAR_0->alarm * 1000);", "}" ]
[ 0, 0, 0, 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ] ]
13,262
static void i440fx_pcihost_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(klass); hc->root_bus_path = i440fx_pcihost_root_bus_path; dc->realize = i440fx_pcihost_realize; dc->fw_name = "pci"; dc->props = i440fx_props; }
true
qemu
bf8d492405feaee2c1685b3b9d5e03228ed3e47f
static void i440fx_pcihost_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(klass); hc->root_bus_path = i440fx_pcihost_root_bus_path; dc->realize = i440fx_pcihost_realize; dc->fw_name = "pci"; dc->props = i440fx_props; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(VAR_0); hc->root_bus_path = i440fx_pcihost_root_bus_path; dc->realize = i440fx_pcihost_realize; dc->fw_name = "pci"; dc->props = i440fx_props; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(VAR_0);", "hc->root_bus_path = i440fx_pcihost_root_bus_path;", "dc->realize = i440fx_pcihost_realize;", "dc->fw_name = \"pci\";", "dc->props = i440fx_props;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ] ]
13,263
static void init_parse_context(OptionParseContext *octx, const OptionGroupDef *groups, int nb_groups) { static const OptionGroupDef global_group = { "global" }; int i; memset(octx, 0, sizeof(*octx)); octx->nb_groups = nb_groups; octx->groups = av_mallocz(sizeof(*octx->groups) * octx->nb_groups); if (!octx->groups) exit(1); for (i = 0; i < octx->nb_groups; i++) octx->groups[i].group_def = &groups[i]; octx->global_opts.group_def = &global_group; octx->global_opts.arg = ""; init_opts(); }
true
FFmpeg
636ced8e1dc8248a1353b416240b93d70ad03edb
static void init_parse_context(OptionParseContext *octx, const OptionGroupDef *groups, int nb_groups) { static const OptionGroupDef global_group = { "global" }; int i; memset(octx, 0, sizeof(*octx)); octx->nb_groups = nb_groups; octx->groups = av_mallocz(sizeof(*octx->groups) * octx->nb_groups); if (!octx->groups) exit(1); for (i = 0; i < octx->nb_groups; i++) octx->groups[i].group_def = &groups[i]; octx->global_opts.group_def = &global_group; octx->global_opts.arg = ""; init_opts(); }
{ "code": [ " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);", " exit(1);" ], "line_no": [ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23 ] }
static void FUNC_0(OptionParseContext *VAR_0, const OptionGroupDef *VAR_1, int VAR_2) { static const OptionGroupDef VAR_3 = { "global" }; int VAR_4; memset(VAR_0, 0, sizeof(*VAR_0)); VAR_0->VAR_2 = VAR_2; VAR_0->VAR_1 = av_mallocz(sizeof(*VAR_0->VAR_1) * VAR_0->VAR_2); if (!VAR_0->VAR_1) exit(1); for (VAR_4 = 0; VAR_4 < VAR_0->VAR_2; VAR_4++) VAR_0->VAR_1[VAR_4].group_def = &VAR_1[VAR_4]; VAR_0->global_opts.group_def = &VAR_3; VAR_0->global_opts.arg = ""; init_opts(); }
[ "static void FUNC_0(OptionParseContext *VAR_0,\nconst OptionGroupDef *VAR_1, int VAR_2)\n{", "static const OptionGroupDef VAR_3 = { \"global\" };", "int VAR_4;", "memset(VAR_0, 0, sizeof(*VAR_0));", "VAR_0->VAR_2 = VAR_2;", "VAR_0->VAR_1 = av_mallocz(sizeof(*VAR_0->VAR_1) * VAR_0->VAR_2);", "if (!VAR_0->VAR_1)\nexit(1);", "for (VAR_4 = 0; VAR_4 < VAR_0->VAR_2; VAR_4++)", "VAR_0->VAR_1[VAR_4].group_def = &VAR_1[VAR_4];", "VAR_0->global_opts.group_def = &VAR_3;", "VAR_0->global_opts.arg = \"\";", "init_opts();", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ] ]
13,264
int ff_mov_read_chan(AVFormatContext *s, AVStream *st, int64_t size) { AVIOContext *pb = s->pb; uint32_t layout_tag, bitmap, num_descr, label_mask; int i; if (size < 12) return AVERROR_INVALIDDATA; layout_tag = avio_rb32(pb); bitmap = avio_rb32(pb); num_descr = avio_rb32(pb); av_dlog(s, "chan: layout=%u bitmap=%u num_descr=%u\n", layout_tag, bitmap, num_descr); if (size < 12ULL + num_descr * 20ULL) return 0; label_mask = 0; for (i = 0; i < num_descr; i++) { uint32_t label; label = avio_rb32(pb); // mChannelLabel avio_rb32(pb); // mChannelFlags avio_rl32(pb); // mCoordinates[0] avio_rl32(pb); // mCoordinates[1] avio_rl32(pb); // mCoordinates[2] if (layout_tag == 0) { uint32_t mask_incr = mov_get_channel_label(label); if (mask_incr == 0) { label_mask = 0; break; } label_mask |= mask_incr; } } if (layout_tag == 0) st->codec->channel_layout = label_mask; else st->codec->channel_layout = ff_mov_get_channel_layout(layout_tag, bitmap); return 0; }
true
FFmpeg
9afb7061f938831248942050cfdb449e014ed427
int ff_mov_read_chan(AVFormatContext *s, AVStream *st, int64_t size) { AVIOContext *pb = s->pb; uint32_t layout_tag, bitmap, num_descr, label_mask; int i; if (size < 12) return AVERROR_INVALIDDATA; layout_tag = avio_rb32(pb); bitmap = avio_rb32(pb); num_descr = avio_rb32(pb); av_dlog(s, "chan: layout=%u bitmap=%u num_descr=%u\n", layout_tag, bitmap, num_descr); if (size < 12ULL + num_descr * 20ULL) return 0; label_mask = 0; for (i = 0; i < num_descr; i++) { uint32_t label; label = avio_rb32(pb); avio_rb32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); if (layout_tag == 0) { uint32_t mask_incr = mov_get_channel_label(label); if (mask_incr == 0) { label_mask = 0; break; } label_mask |= mask_incr; } } if (layout_tag == 0) st->codec->channel_layout = label_mask; else st->codec->channel_layout = ff_mov_get_channel_layout(layout_tag, bitmap); return 0; }
{ "code": [ "int ff_mov_read_chan(AVFormatContext *s, AVStream *st, int64_t size)", " AVIOContext *pb = s->pb;" ], "line_no": [ 1, 5 ] }
int FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, int64_t VAR_2) { AVIOContext *pb = VAR_0->pb; uint32_t layout_tag, bitmap, num_descr, label_mask; int VAR_3; if (VAR_2 < 12) return AVERROR_INVALIDDATA; layout_tag = avio_rb32(pb); bitmap = avio_rb32(pb); num_descr = avio_rb32(pb); av_dlog(VAR_0, "chan: layout=%u bitmap=%u num_descr=%u\n", layout_tag, bitmap, num_descr); if (VAR_2 < 12ULL + num_descr * 20ULL) return 0; label_mask = 0; for (VAR_3 = 0; VAR_3 < num_descr; VAR_3++) { uint32_t label; label = avio_rb32(pb); avio_rb32(pb); avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); if (layout_tag == 0) { uint32_t mask_incr = mov_get_channel_label(label); if (mask_incr == 0) { label_mask = 0; break; } label_mask |= mask_incr; } } if (layout_tag == 0) VAR_1->codec->channel_layout = label_mask; else VAR_1->codec->channel_layout = ff_mov_get_channel_layout(layout_tag, bitmap); return 0; }
[ "int FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, int64_t VAR_2)\n{", "AVIOContext *pb = VAR_0->pb;", "uint32_t layout_tag, bitmap, num_descr, label_mask;", "int VAR_3;", "if (VAR_2 < 12)\nreturn AVERROR_INVALIDDATA;", "layout_tag = avio_rb32(pb);", "bitmap = avio_rb32(pb);", "num_descr = avio_rb32(pb);", "av_dlog(VAR_0, \"chan: layout=%u bitmap=%u num_descr=%u\\n\",\nlayout_tag, bitmap, num_descr);", "if (VAR_2 < 12ULL + num_descr * 20ULL)\nreturn 0;", "label_mask = 0;", "for (VAR_3 = 0; VAR_3 < num_descr; VAR_3++) {", "uint32_t label;", "label = avio_rb32(pb);", "avio_rb32(pb);", "avio_rl32(pb);", "avio_rl32(pb);", "avio_rl32(pb);", "if (layout_tag == 0) {", "uint32_t mask_incr = mov_get_channel_label(label);", "if (mask_incr == 0) {", "label_mask = 0;", "break;", "}", "label_mask |= mask_incr;", "}", "}", "if (layout_tag == 0)\nVAR_1->codec->channel_layout = label_mask;", "else\nVAR_1->codec->channel_layout = ff_mov_get_channel_layout(layout_tag, bitmap);", "return 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 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77, 79 ], [ 83 ], [ 85 ] ]
13,265
void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, uint32_t ramsize, const char *initrd_filename, const char *dtb_filename, void (*machine_cpu_reset)(MicroBlazeCPU *)) { QemuOpts *machine_opts; const char *kernel_filename; const char *kernel_cmdline; const char *dtb_arg; machine_opts = qemu_get_machine_opts(); kernel_filename = qemu_opt_get(machine_opts, "kernel"); kernel_cmdline = qemu_opt_get(machine_opts, "append"); dtb_arg = qemu_opt_get(machine_opts, "dtb"); if (dtb_arg) { /* Preference a -dtb argument */ dtb_filename = dtb_arg; } else { /* default to pcbios dtb as passed by machine_init */ dtb_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename); } boot_info.machine_cpu_reset = machine_cpu_reset; qemu_register_reset(main_cpu_reset, cpu); if (kernel_filename) { int kernel_size; uint64_t entry, low, high; uint32_t base32; int big_endian = 0; #ifdef TARGET_WORDS_BIGENDIAN big_endian = 1; #endif /* Boots a kernel elf binary. */ kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, &low, &high, big_endian, ELF_MACHINE, 0); base32 = entry; if (base32 == 0xc0000000) { kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, &entry, NULL, NULL, big_endian, ELF_MACHINE, 0); } /* Always boot into physical ram. */ boot_info.bootstrap_pc = ddr_base + (entry & 0x0fffffff); /* If it wasn't an ELF image, try an u-boot image. */ if (kernel_size < 0) { hwaddr uentry, loadaddr; kernel_size = load_uimage(kernel_filename, &uentry, &loadaddr, 0); boot_info.bootstrap_pc = uentry; high = (loadaddr + kernel_size + 3) & ~3; } /* Not an ELF image nor an u-boot image, try a RAW image. */ if (kernel_size < 0) { kernel_size = load_image_targphys(kernel_filename, ddr_base, ram_size); boot_info.bootstrap_pc = ddr_base; high = (ddr_base + kernel_size + 3) & ~3; } if (initrd_filename) { int initrd_size; uint32_t initrd_offset; high = ROUND_UP(high + kernel_size, 4); boot_info.initrd_start = high; initrd_offset = boot_info.initrd_start - ddr_base; initrd_size = load_ramdisk(initrd_filename, boot_info.initrd_start, ram_size - initrd_offset); if (initrd_size < 0) { initrd_size = load_image_targphys(initrd_filename, boot_info.initrd_start, ram_size - initrd_offset); } if (initrd_size < 0) { error_report("qemu: could not load initrd '%s'\n", initrd_filename); exit(EXIT_FAILURE); } boot_info.initrd_end = boot_info.initrd_start + initrd_size; high = ROUND_UP(high + initrd_size, 4); } boot_info.cmdline = high + 4096; if (kernel_cmdline && strlen(kernel_cmdline)) { pstrcpy_targphys("cmdline", boot_info.cmdline, 256, kernel_cmdline); } /* Provide a device-tree. */ boot_info.fdt = boot_info.cmdline + 4096; microblaze_load_dtb(boot_info.fdt, ram_size, boot_info.initrd_start, boot_info.initrd_end, kernel_cmdline, dtb_filename); } }
true
qemu
e5bfd64050e81774b6bf71ab5dd064f7bcef0c4c
void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base, uint32_t ramsize, const char *initrd_filename, const char *dtb_filename, void (*machine_cpu_reset)(MicroBlazeCPU *)) { QemuOpts *machine_opts; const char *kernel_filename; const char *kernel_cmdline; const char *dtb_arg; machine_opts = qemu_get_machine_opts(); kernel_filename = qemu_opt_get(machine_opts, "kernel"); kernel_cmdline = qemu_opt_get(machine_opts, "append"); dtb_arg = qemu_opt_get(machine_opts, "dtb"); if (dtb_arg) { dtb_filename = dtb_arg; } else { dtb_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename); } boot_info.machine_cpu_reset = machine_cpu_reset; qemu_register_reset(main_cpu_reset, cpu); if (kernel_filename) { int kernel_size; uint64_t entry, low, high; uint32_t base32; int big_endian = 0; #ifdef TARGET_WORDS_BIGENDIAN big_endian = 1; #endif kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, &low, &high, big_endian, ELF_MACHINE, 0); base32 = entry; if (base32 == 0xc0000000) { kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, &entry, NULL, NULL, big_endian, ELF_MACHINE, 0); } boot_info.bootstrap_pc = ddr_base + (entry & 0x0fffffff); if (kernel_size < 0) { hwaddr uentry, loadaddr; kernel_size = load_uimage(kernel_filename, &uentry, &loadaddr, 0); boot_info.bootstrap_pc = uentry; high = (loadaddr + kernel_size + 3) & ~3; } if (kernel_size < 0) { kernel_size = load_image_targphys(kernel_filename, ddr_base, ram_size); boot_info.bootstrap_pc = ddr_base; high = (ddr_base + kernel_size + 3) & ~3; } if (initrd_filename) { int initrd_size; uint32_t initrd_offset; high = ROUND_UP(high + kernel_size, 4); boot_info.initrd_start = high; initrd_offset = boot_info.initrd_start - ddr_base; initrd_size = load_ramdisk(initrd_filename, boot_info.initrd_start, ram_size - initrd_offset); if (initrd_size < 0) { initrd_size = load_image_targphys(initrd_filename, boot_info.initrd_start, ram_size - initrd_offset); } if (initrd_size < 0) { error_report("qemu: could not load initrd '%s'\n", initrd_filename); exit(EXIT_FAILURE); } boot_info.initrd_end = boot_info.initrd_start + initrd_size; high = ROUND_UP(high + initrd_size, 4); } boot_info.cmdline = high + 4096; if (kernel_cmdline && strlen(kernel_cmdline)) { pstrcpy_targphys("cmdline", boot_info.cmdline, 256, kernel_cmdline); } boot_info.fdt = boot_info.cmdline + 4096; microblaze_load_dtb(boot_info.fdt, ram_size, boot_info.initrd_start, boot_info.initrd_end, kernel_cmdline, dtb_filename); } }
{ "code": [ " boot_info.bootstrap_pc = ddr_base + (entry & 0x0fffffff);" ], "line_no": [ 91 ] }
VAR_6voidVAR_6 VAR_6microblaze_load_kernelVAR_6(VAR_6MicroBlazeCPUVAR_6 *VAR_6VAR_0VAR_6, VAR_6hwaddrVAR_6 VAR_6VAR_1VAR_6, VAR_6uint32_tVAR_6 VAR_6VAR_2VAR_6, VAR_6constVAR_6 VAR_6charVAR_6 *VAR_6VAR_3VAR_6, VAR_6constVAR_6 VAR_6charVAR_6 *VAR_6VAR_4VAR_6, VAR_6voidVAR_6 (*VAR_6VAR_5VAR_6)(VAR_6MicroBlazeCPUVAR_6 *)) { VAR_6QemuOptsVAR_6 *VAR_6machine_optsVAR_6; VAR_6constVAR_6 VAR_6charVAR_6 *VAR_6kernel_filenameVAR_6; VAR_6constVAR_6 VAR_6charVAR_6 *VAR_6kernel_cmdlineVAR_6; VAR_6constVAR_6 VAR_6charVAR_6 *VAR_6dtb_argVAR_6; VAR_6machine_optsVAR_6 = VAR_6qemu_get_machine_optsVAR_6(); VAR_6kernel_filenameVAR_6 = VAR_6qemu_opt_getVAR_6(VAR_6machine_optsVAR_6, "VAR_6kernelVAR_6"); VAR_6kernel_cmdlineVAR_6 = VAR_6qemu_opt_getVAR_6(VAR_6machine_optsVAR_6, "VAR_6appendVAR_6"); VAR_6dtb_argVAR_6 = VAR_6qemu_opt_getVAR_6(VAR_6machine_optsVAR_6, "VAR_6dtbVAR_6"); VAR_6ifVAR_6 (VAR_6dtb_argVAR_6) { VAR_6VAR_4VAR_6 = VAR_6dtb_argVAR_6; } VAR_6elseVAR_6 { VAR_6VAR_4VAR_6 = VAR_6qemu_find_fileVAR_6(VAR_6QEMU_FILE_TYPE_BIOSVAR_6, VAR_6VAR_4VAR_6); } VAR_6boot_infoVAR_6.VAR_6VAR_5VAR_6 = VAR_6VAR_5VAR_6; VAR_6qemu_register_resetVAR_6(VAR_6main_cpu_resetVAR_6, VAR_6VAR_0VAR_6); VAR_6ifVAR_6 (VAR_6kernel_filenameVAR_6) { VAR_6intVAR_6 VAR_6kernel_sizeVAR_6; VAR_6uint64_tVAR_6 VAR_6entryVAR_6, VAR_6lowVAR_6, VAR_6highVAR_6; VAR_6uint32_tVAR_6 VAR_6base32VAR_6; VAR_6intVAR_6 VAR_6big_endianVAR_6 = VAR_60VAR_6; #VAR_6ifdefVAR_6 VAR_6TARGET_WORDS_BIGENDIANVAR_6 VAR_6big_endianVAR_6 = VAR_61VAR_6; #VAR_6endifVAR_6 VAR_6kernel_sizeVAR_6 = VAR_6load_elfVAR_6(VAR_6kernel_filenameVAR_6, VAR_6NULLVAR_6, VAR_6NULLVAR_6, &VAR_6entryVAR_6, &VAR_6lowVAR_6, &VAR_6highVAR_6, VAR_6big_endianVAR_6, VAR_6ELF_MACHINEVAR_6, VAR_60VAR_6); VAR_6base32VAR_6 = VAR_6entryVAR_6; VAR_6ifVAR_6 (VAR_6base32VAR_6 == VAR_60xc0000000VAR_6) { VAR_6kernel_sizeVAR_6 = VAR_6load_elfVAR_6(VAR_6kernel_filenameVAR_6, VAR_6translate_kernel_addressVAR_6, VAR_6NULLVAR_6, &VAR_6entryVAR_6, VAR_6NULLVAR_6, VAR_6NULLVAR_6, VAR_6big_endianVAR_6, VAR_6ELF_MACHINEVAR_6, VAR_60VAR_6); } VAR_6boot_infoVAR_6.VAR_6bootstrap_pcVAR_6 = VAR_6VAR_1VAR_6 + (VAR_6entryVAR_6 & VAR_60x0fffffffVAR_6); VAR_6ifVAR_6 (VAR_6kernel_sizeVAR_6 < VAR_60VAR_6) { VAR_6hwaddrVAR_6 VAR_6uentryVAR_6, VAR_6loadaddrVAR_6; VAR_6kernel_sizeVAR_6 = VAR_6load_uimageVAR_6(VAR_6kernel_filenameVAR_6, &VAR_6uentryVAR_6, &VAR_6loadaddrVAR_6, VAR_60VAR_6); VAR_6boot_infoVAR_6.VAR_6bootstrap_pcVAR_6 = VAR_6uentryVAR_6; VAR_6highVAR_6 = (VAR_6loadaddrVAR_6 + VAR_6kernel_sizeVAR_6 + VAR_63VAR_6) & ~VAR_63VAR_6; } VAR_6ifVAR_6 (VAR_6kernel_sizeVAR_6 < VAR_60VAR_6) { VAR_6kernel_sizeVAR_6 = VAR_6load_image_targphysVAR_6(VAR_6kernel_filenameVAR_6, VAR_6VAR_1VAR_6, VAR_6ram_sizeVAR_6); VAR_6boot_infoVAR_6.VAR_6bootstrap_pcVAR_6 = VAR_6VAR_1VAR_6; VAR_6highVAR_6 = (VAR_6VAR_1VAR_6 + VAR_6kernel_sizeVAR_6 + VAR_63VAR_6) & ~VAR_63VAR_6; } VAR_6ifVAR_6 (VAR_6VAR_3VAR_6) { VAR_6intVAR_6 VAR_6initrd_sizeVAR_6; VAR_6uint32_tVAR_6 VAR_6initrd_offsetVAR_6; VAR_6highVAR_6 = VAR_6ROUND_UPVAR_6(VAR_6highVAR_6 + VAR_6kernel_sizeVAR_6, VAR_64VAR_6); VAR_6boot_infoVAR_6.VAR_6initrd_startVAR_6 = VAR_6highVAR_6; VAR_6initrd_offsetVAR_6 = VAR_6boot_infoVAR_6.VAR_6initrd_startVAR_6 - VAR_6VAR_1VAR_6; VAR_6initrd_sizeVAR_6 = VAR_6load_ramdiskVAR_6(VAR_6VAR_3VAR_6, VAR_6boot_infoVAR_6.VAR_6initrd_startVAR_6, VAR_6ram_sizeVAR_6 - VAR_6initrd_offsetVAR_6); VAR_6ifVAR_6 (VAR_6initrd_sizeVAR_6 < VAR_60VAR_6) { VAR_6initrd_sizeVAR_6 = VAR_6load_image_targphysVAR_6(VAR_6VAR_3VAR_6, VAR_6boot_infoVAR_6.VAR_6initrd_startVAR_6, VAR_6ram_sizeVAR_6 - VAR_6initrd_offsetVAR_6); } VAR_6ifVAR_6 (VAR_6initrd_sizeVAR_6 < VAR_60VAR_6) { VAR_6error_reportVAR_6("VAR_6qemuVAR_6: VAR_6couldVAR_6 VAR_6notVAR_6 VAR_6loadVAR_6 VAR_6initrdVAR_6 '%VAR_6sVAR_6'\VAR_6nVAR_6", VAR_6VAR_3VAR_6); VAR_6exitVAR_6(VAR_6EXIT_FAILUREVAR_6); } VAR_6boot_infoVAR_6.VAR_6initrd_endVAR_6 = VAR_6boot_infoVAR_6.VAR_6initrd_startVAR_6 + VAR_6initrd_sizeVAR_6; VAR_6highVAR_6 = VAR_6ROUND_UPVAR_6(VAR_6highVAR_6 + VAR_6initrd_sizeVAR_6, VAR_64VAR_6); } VAR_6boot_infoVAR_6.VAR_6cmdlineVAR_6 = VAR_6highVAR_6 + VAR_64096VAR_6; VAR_6ifVAR_6 (VAR_6kernel_cmdlineVAR_6 && VAR_6strlenVAR_6(VAR_6kernel_cmdlineVAR_6)) { VAR_6pstrcpy_targphysVAR_6("VAR_6cmdlineVAR_6", VAR_6boot_infoVAR_6.VAR_6cmdlineVAR_6, VAR_6256VAR_6, VAR_6kernel_cmdlineVAR_6); } VAR_6boot_infoVAR_6.VAR_6fdtVAR_6 = VAR_6boot_infoVAR_6.VAR_6cmdlineVAR_6 + VAR_64096VAR_6; VAR_6microblaze_load_dtbVAR_6(VAR_6boot_infoVAR_6.VAR_6fdtVAR_6, VAR_6ram_sizeVAR_6, VAR_6boot_infoVAR_6.VAR_6initrd_startVAR_6, VAR_6boot_infoVAR_6.VAR_6initrd_endVAR_6, VAR_6kernel_cmdlineVAR_6, VAR_6VAR_4VAR_6); } }
[ "VAR_6voidVAR_6 VAR_6microblaze_load_kernelVAR_6(VAR_6MicroBlazeCPUVAR_6 *VAR_6VAR_0VAR_6, VAR_6hwaddrVAR_6 VAR_6VAR_1VAR_6,\nVAR_6uint32_tVAR_6 VAR_6VAR_2VAR_6,\nVAR_6constVAR_6 VAR_6charVAR_6 *VAR_6VAR_3VAR_6,\nVAR_6constVAR_6 VAR_6charVAR_6 *VAR_6VAR_4VAR_6,\nVAR_6voidVAR_6 (*VAR_6VAR_5VAR_6)(VAR_6MicroBlazeCPUVAR_6 *))\n{", "VAR_6QemuOptsVAR_6 *VAR_6machine_optsVAR_6;", "VAR_6constVAR_6 VAR_6charVAR_6 *VAR_6kernel_filenameVAR_6;", "VAR_6constVAR_6 VAR_6charVAR_6 *VAR_6kernel_cmdlineVAR_6;", "VAR_6constVAR_6 VAR_6charVAR_6 *VAR_6dtb_argVAR_6;", "VAR_6machine_optsVAR_6 = VAR_6qemu_get_machine_optsVAR_6();", "VAR_6kernel_filenameVAR_6 = VAR_6qemu_opt_getVAR_6(VAR_6machine_optsVAR_6, \"VAR_6kernelVAR_6\");", "VAR_6kernel_cmdlineVAR_6 = VAR_6qemu_opt_getVAR_6(VAR_6machine_optsVAR_6, \"VAR_6appendVAR_6\");", "VAR_6dtb_argVAR_6 = VAR_6qemu_opt_getVAR_6(VAR_6machine_optsVAR_6, \"VAR_6dtbVAR_6\");", "VAR_6ifVAR_6 (VAR_6dtb_argVAR_6) {", "VAR_6VAR_4VAR_6 = VAR_6dtb_argVAR_6;", "} VAR_6elseVAR_6 {", "VAR_6VAR_4VAR_6 = VAR_6qemu_find_fileVAR_6(VAR_6QEMU_FILE_TYPE_BIOSVAR_6, VAR_6VAR_4VAR_6);", "}", "VAR_6boot_infoVAR_6.VAR_6VAR_5VAR_6 = VAR_6VAR_5VAR_6;", "VAR_6qemu_register_resetVAR_6(VAR_6main_cpu_resetVAR_6, VAR_6VAR_0VAR_6);", "VAR_6ifVAR_6 (VAR_6kernel_filenameVAR_6) {", "VAR_6intVAR_6 VAR_6kernel_sizeVAR_6;", "VAR_6uint64_tVAR_6 VAR_6entryVAR_6, VAR_6lowVAR_6, VAR_6highVAR_6;", "VAR_6uint32_tVAR_6 VAR_6base32VAR_6;", "VAR_6intVAR_6 VAR_6big_endianVAR_6 = VAR_60VAR_6;", "#VAR_6ifdefVAR_6 VAR_6TARGET_WORDS_BIGENDIANVAR_6\nVAR_6big_endianVAR_6 = VAR_61VAR_6;", "#VAR_6endifVAR_6\nVAR_6kernel_sizeVAR_6 = VAR_6load_elfVAR_6(VAR_6kernel_filenameVAR_6, VAR_6NULLVAR_6, VAR_6NULLVAR_6,\n&VAR_6entryVAR_6, &VAR_6lowVAR_6, &VAR_6highVAR_6,\nVAR_6big_endianVAR_6, VAR_6ELF_MACHINEVAR_6, VAR_60VAR_6);", "VAR_6base32VAR_6 = VAR_6entryVAR_6;", "VAR_6ifVAR_6 (VAR_6base32VAR_6 == VAR_60xc0000000VAR_6) {", "VAR_6kernel_sizeVAR_6 = VAR_6load_elfVAR_6(VAR_6kernel_filenameVAR_6, VAR_6translate_kernel_addressVAR_6,\nVAR_6NULLVAR_6, &VAR_6entryVAR_6, VAR_6NULLVAR_6, VAR_6NULLVAR_6,\nVAR_6big_endianVAR_6, VAR_6ELF_MACHINEVAR_6, VAR_60VAR_6);", "}", "VAR_6boot_infoVAR_6.VAR_6bootstrap_pcVAR_6 = VAR_6VAR_1VAR_6 + (VAR_6entryVAR_6 & VAR_60x0fffffffVAR_6);", "VAR_6ifVAR_6 (VAR_6kernel_sizeVAR_6 < VAR_60VAR_6) {", "VAR_6hwaddrVAR_6 VAR_6uentryVAR_6, VAR_6loadaddrVAR_6;", "VAR_6kernel_sizeVAR_6 = VAR_6load_uimageVAR_6(VAR_6kernel_filenameVAR_6, &VAR_6uentryVAR_6, &VAR_6loadaddrVAR_6, VAR_60VAR_6);", "VAR_6boot_infoVAR_6.VAR_6bootstrap_pcVAR_6 = VAR_6uentryVAR_6;", "VAR_6highVAR_6 = (VAR_6loadaddrVAR_6 + VAR_6kernel_sizeVAR_6 + VAR_63VAR_6) & ~VAR_63VAR_6;", "}", "VAR_6ifVAR_6 (VAR_6kernel_sizeVAR_6 < VAR_60VAR_6) {", "VAR_6kernel_sizeVAR_6 = VAR_6load_image_targphysVAR_6(VAR_6kernel_filenameVAR_6, VAR_6VAR_1VAR_6,\nVAR_6ram_sizeVAR_6);", "VAR_6boot_infoVAR_6.VAR_6bootstrap_pcVAR_6 = VAR_6VAR_1VAR_6;", "VAR_6highVAR_6 = (VAR_6VAR_1VAR_6 + VAR_6kernel_sizeVAR_6 + VAR_63VAR_6) & ~VAR_63VAR_6;", "}", "VAR_6ifVAR_6 (VAR_6VAR_3VAR_6) {", "VAR_6intVAR_6 VAR_6initrd_sizeVAR_6;", "VAR_6uint32_tVAR_6 VAR_6initrd_offsetVAR_6;", "VAR_6highVAR_6 = VAR_6ROUND_UPVAR_6(VAR_6highVAR_6 + VAR_6kernel_sizeVAR_6, VAR_64VAR_6);", "VAR_6boot_infoVAR_6.VAR_6initrd_startVAR_6 = VAR_6highVAR_6;", "VAR_6initrd_offsetVAR_6 = VAR_6boot_infoVAR_6.VAR_6initrd_startVAR_6 - VAR_6VAR_1VAR_6;", "VAR_6initrd_sizeVAR_6 = VAR_6load_ramdiskVAR_6(VAR_6VAR_3VAR_6,\nVAR_6boot_infoVAR_6.VAR_6initrd_startVAR_6,\nVAR_6ram_sizeVAR_6 - VAR_6initrd_offsetVAR_6);", "VAR_6ifVAR_6 (VAR_6initrd_sizeVAR_6 < VAR_60VAR_6) {", "VAR_6initrd_sizeVAR_6 = VAR_6load_image_targphysVAR_6(VAR_6VAR_3VAR_6,\nVAR_6boot_infoVAR_6.VAR_6initrd_startVAR_6,\nVAR_6ram_sizeVAR_6 - VAR_6initrd_offsetVAR_6);", "}", "VAR_6ifVAR_6 (VAR_6initrd_sizeVAR_6 < VAR_60VAR_6) {", "VAR_6error_reportVAR_6(\"VAR_6qemuVAR_6: VAR_6couldVAR_6 VAR_6notVAR_6 VAR_6loadVAR_6 VAR_6initrdVAR_6 '%VAR_6sVAR_6'\\VAR_6nVAR_6\",\nVAR_6VAR_3VAR_6);", "VAR_6exitVAR_6(VAR_6EXIT_FAILUREVAR_6);", "}", "VAR_6boot_infoVAR_6.VAR_6initrd_endVAR_6 = VAR_6boot_infoVAR_6.VAR_6initrd_startVAR_6 + VAR_6initrd_sizeVAR_6;", "VAR_6highVAR_6 = VAR_6ROUND_UPVAR_6(VAR_6highVAR_6 + VAR_6initrd_sizeVAR_6, VAR_64VAR_6);", "}", "VAR_6boot_infoVAR_6.VAR_6cmdlineVAR_6 = VAR_6highVAR_6 + VAR_64096VAR_6;", "VAR_6ifVAR_6 (VAR_6kernel_cmdlineVAR_6 && VAR_6strlenVAR_6(VAR_6kernel_cmdlineVAR_6)) {", "VAR_6pstrcpy_targphysVAR_6(\"VAR_6cmdlineVAR_6\", VAR_6boot_infoVAR_6.VAR_6cmdlineVAR_6, VAR_6256VAR_6, VAR_6kernel_cmdlineVAR_6);", "}", "VAR_6boot_infoVAR_6.VAR_6fdtVAR_6 = VAR_6boot_infoVAR_6.VAR_6cmdlineVAR_6 + VAR_64096VAR_6;", "VAR_6microblaze_load_dtbVAR_6(VAR_6boot_infoVAR_6.VAR_6fdtVAR_6, VAR_6ram_sizeVAR_6,\nVAR_6boot_infoVAR_6.VAR_6initrd_startVAR_6,\nVAR_6boot_infoVAR_6.VAR_6initrd_endVAR_6,\nVAR_6kernel_cmdlineVAR_6,\nVAR_6VAR_4VAR_6);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63 ], [ 65, 71, 73, 75 ], [ 77 ], [ 79 ], [ 81, 83, 85 ], [ 87 ], [ 91 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 145, 147, 149 ], [ 151 ], [ 153, 155, 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191, 193, 195, 197, 199 ], [ 201 ], [ 205 ] ]
13,266
static int kvm_ppc_register_host_cpu_type(void) { TypeInfo type_info = { .name = TYPE_HOST_POWERPC_CPU, .class_init = kvmppc_host_cpu_class_init, }; PowerPCCPUClass *pvr_pcc; DeviceClass *dc; int i; pvr_pcc = kvm_ppc_get_host_cpu_class(); if (pvr_pcc == NULL) { return -1; } type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc)); type_register(&type_info); #if defined(TARGET_PPC64) type_info.name = g_strdup_printf("%s-"TYPE_SPAPR_CPU_CORE, "host"); type_info.parent = TYPE_SPAPR_CPU_CORE, type_info.instance_size = sizeof(sPAPRCPUCore); type_info.instance_init = NULL; type_info.class_init = spapr_cpu_core_class_init; type_info.class_data = (void *) "host"; type_register(&type_info); g_free((void *)type_info.name); #endif /* * Update generic CPU family class alias (e.g. on a POWER8NVL host, * we want "POWER8" to be a "family" alias that points to the current * host CPU type, too) */ dc = DEVICE_CLASS(ppc_cpu_get_family_class(pvr_pcc)); for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) { if (strcmp(ppc_cpu_aliases[i].alias, dc->desc) == 0) { ObjectClass *oc = OBJECT_CLASS(pvr_pcc); char *suffix; ppc_cpu_aliases[i].model = g_strdup(object_class_get_name(oc)); suffix = strstr(ppc_cpu_aliases[i].model, "-"TYPE_POWERPC_CPU); if (suffix) { *suffix = 0; } ppc_cpu_aliases[i].oc = oc; break; } } return 0; }
true
qemu
92e926e1e37aea7e1632535b6611ed4f62414af1
static int kvm_ppc_register_host_cpu_type(void) { TypeInfo type_info = { .name = TYPE_HOST_POWERPC_CPU, .class_init = kvmppc_host_cpu_class_init, }; PowerPCCPUClass *pvr_pcc; DeviceClass *dc; int i; pvr_pcc = kvm_ppc_get_host_cpu_class(); if (pvr_pcc == NULL) { return -1; } type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc)); type_register(&type_info); #if defined(TARGET_PPC64) type_info.name = g_strdup_printf("%s-"TYPE_SPAPR_CPU_CORE, "host"); type_info.parent = TYPE_SPAPR_CPU_CORE, type_info.instance_size = sizeof(sPAPRCPUCore); type_info.instance_init = NULL; type_info.class_init = spapr_cpu_core_class_init; type_info.class_data = (void *) "host"; type_register(&type_info); g_free((void *)type_info.name); #endif dc = DEVICE_CLASS(ppc_cpu_get_family_class(pvr_pcc)); for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) { if (strcmp(ppc_cpu_aliases[i].alias, dc->desc) == 0) { ObjectClass *oc = OBJECT_CLASS(pvr_pcc); char *suffix; ppc_cpu_aliases[i].model = g_strdup(object_class_get_name(oc)); suffix = strstr(ppc_cpu_aliases[i].model, "-"TYPE_POWERPC_CPU); if (suffix) { *suffix = 0; } ppc_cpu_aliases[i].oc = oc; break; } } return 0; }
{ "code": [ " ObjectClass *oc = OBJECT_CLASS(pvr_pcc);" ], "line_no": [ 73 ] }
static int FUNC_0(void) { TypeInfo type_info = { .name = TYPE_HOST_POWERPC_CPU, .class_init = kvmppc_host_cpu_class_init, }; PowerPCCPUClass *pvr_pcc; DeviceClass *dc; int VAR_0; pvr_pcc = kvm_ppc_get_host_cpu_class(); if (pvr_pcc == NULL) { return -1; } type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc)); type_register(&type_info); #if defined(TARGET_PPC64) type_info.name = g_strdup_printf("%s-"TYPE_SPAPR_CPU_CORE, "host"); type_info.parent = TYPE_SPAPR_CPU_CORE, type_info.instance_size = sizeof(sPAPRCPUCore); type_info.instance_init = NULL; type_info.class_init = spapr_cpu_core_class_init; type_info.class_data = (void *) "host"; type_register(&type_info); g_free((void *)type_info.name); #endif dc = DEVICE_CLASS(ppc_cpu_get_family_class(pvr_pcc)); for (VAR_0 = 0; ppc_cpu_aliases[VAR_0].alias != NULL; VAR_0++) { if (strcmp(ppc_cpu_aliases[VAR_0].alias, dc->desc) == 0) { ObjectClass *oc = OBJECT_CLASS(pvr_pcc); char *suffix; ppc_cpu_aliases[VAR_0].model = g_strdup(object_class_get_name(oc)); suffix = strstr(ppc_cpu_aliases[VAR_0].model, "-"TYPE_POWERPC_CPU); if (suffix) { *suffix = 0; } ppc_cpu_aliases[VAR_0].oc = oc; break; } } return 0; }
[ "static int FUNC_0(void)\n{", "TypeInfo type_info = {", ".name = TYPE_HOST_POWERPC_CPU,\n.class_init = kvmppc_host_cpu_class_init,\n};", "PowerPCCPUClass *pvr_pcc;", "DeviceClass *dc;", "int VAR_0;", "pvr_pcc = kvm_ppc_get_host_cpu_class();", "if (pvr_pcc == NULL) {", "return -1;", "}", "type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));", "type_register(&type_info);", "#if defined(TARGET_PPC64)\ntype_info.name = g_strdup_printf(\"%s-\"TYPE_SPAPR_CPU_CORE, \"host\");", "type_info.parent = TYPE_SPAPR_CPU_CORE,\ntype_info.instance_size = sizeof(sPAPRCPUCore);", "type_info.instance_init = NULL;", "type_info.class_init = spapr_cpu_core_class_init;", "type_info.class_data = (void *) \"host\";", "type_register(&type_info);", "g_free((void *)type_info.name);", "#endif\ndc = DEVICE_CLASS(ppc_cpu_get_family_class(pvr_pcc));", "for (VAR_0 = 0; ppc_cpu_aliases[VAR_0].alias != NULL; VAR_0++) {", "if (strcmp(ppc_cpu_aliases[VAR_0].alias, dc->desc) == 0) {", "ObjectClass *oc = OBJECT_CLASS(pvr_pcc);", "char *suffix;", "ppc_cpu_aliases[VAR_0].model = g_strdup(object_class_get_name(oc));", "suffix = strstr(ppc_cpu_aliases[VAR_0].model, \"-\"TYPE_POWERPC_CPU);", "if (suffix) {", "*suffix = 0;", "}", "ppc_cpu_aliases[VAR_0].oc = oc;", "break;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ] ]
13,267
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, pts_set; 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"); /* 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); 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; } 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", 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); /* 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); 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 { uint8_t *buf; ost->video_resample = 1; ost->video_crop = 0; // cropping is handled as part of resample buf = av_malloc((codec->width * codec->height * 3) / 2); if (!buf) goto fail; ost->pict_tmp.data[0] = buf; ost->pict_tmp.data[1] = ost->pict_tmp.data[0] + (codec->width * codec->height); ost->pict_tmp.data[2] = ost->pict_tmp.data[1] + (codec->width * codec->height) / 4; ost->pict_tmp.linesize[0] = codec->width; ost->pict_tmp.linesize[1] = codec->width / 2; ost->pict_tmp.linesize[2] = codec->width / 2; 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); ost->logfile = f; } else { /* read the log file */ f = fopen(logfilename, "r"); if (!f) { perror(logfilename); 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"); 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", 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", /* 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); 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); //if (ist->st->codec.codec_type == CODEC_TYPE_VIDEO) // ist->st->codec.flags |= CODEC_FLAG_REPEAT_FIELD; ist->frame_decoded = 1; /* init pts */ for(i=0;i<nb_istreams;i++) { ist = ist_table[i]; /* 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 (!do_play) { fprintf(stderr, "Press [q] to stop encoding\n"); } else { fprintf(stderr, "Press [q] to stop playing\n"); #endif term_init(); stream_no_data = 0; key = -1; for(;;) { int file_index, ist_index; AVPacket pkt; uint8_t *ptr; int len; uint8_t *data_buf; int data_size, got_picture; AVPicture picture; short samples[AVCODEC_MAX_AUDIO_FRAME_SIZE / 2]; void *buffer_to_free; double pts_min; redo: /* if 'q' pressed, exits */ if (key) { /* 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 packet from it and output it in the fifo */ is = input_files[file_index]; if (av_read_packet(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_hex_dump) { printf("stream #%d, size=%d:\n", pkt.stream_index, pkt.size); av_hex_dump(pkt.data, pkt.size); /* 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; // printf("read #%d.%d size=%d\n", ist->file_index, ist->index, pkt.size); len = pkt.size; ptr = pkt.data; pts_set = 0; while (len > 0) { int64_t ipts; ipts = AV_NOPTS_VALUE; /* decode the packet if needed */ data_buf = NULL; /* fail safe */ data_size = 0; if (ist->decoding_needed) { /* NOTE1: we only take into account the PTS if a new frame has begun (MPEG semantics) */ /* NOTE2: even if the fraction is not initialized, av_frac_set can be used to set the integer part */ if (ist->frame_decoded && pkt.pts != AV_NOPTS_VALUE && !pts_set) { ipts = pkt.pts; ist->frame_decoded = 0; pts_set = 1; switch(ist->st->codec.codec_type) { case CODEC_TYPE_AUDIO: /* XXX: could avoid copy if PCM 16 bits with same endianness as CPU */ ret = avcodec_decode_audio(&ist->st->codec, samples, &data_size, ptr, len); if (ret < 0) goto fail_decode; /* Some bug in mpeg audio decoder gives */ /* data_size < 0, it seems they are overflows */ if (data_size <= 0) { /* no audio frame */ ptr += ret; len -= ret; continue; data_buf = (uint8_t *)samples; break; case CODEC_TYPE_VIDEO: { AVFrame big_picture; data_size = (ist->st->codec.width * ist->st->codec.height * 3) / 2; ret = avcodec_decode_video(&ist->st->codec, &big_picture, &got_picture, ptr, len); picture= *(AVPicture*)&big_picture; ist->st->quality= big_picture.quality; if (ret < 0) { fail_decode: fprintf(stderr, "Error while decoding stream #%d.%d\n", ist->file_index, ist->index); av_free_packet(&pkt); goto redo; if (!got_picture) { /* no picture yet */ ptr += ret; len -= ret; continue; break; default: goto fail_decode; } else { data_buf = ptr; data_size = len; ret = len; ptr += ret; len -= ret; buffer_to_free = 0; if (ist->st->codec.codec_type == CODEC_TYPE_VIDEO) { pre_process_video_frame(ist, &picture, &buffer_to_free); ist->frame_decoded = 1; /* frame rate emulation */ if (ist->st->codec.rate_emu) { int64_t pts = av_rescale((int64_t) ist->frame * ist->st->codec.frame_rate_base, 1000000, ist->st->codec.frame_rate); int64_t now = av_gettime() - ist->start; if (pts > now) usleep(pts - now); ist->frame++; #if 0 /* mpeg PTS deordering : if it is a P or I frame, the PTS is the one of the next displayed one */ /* XXX: add mpeg4 too ? */ if (ist->st->codec.codec_id == CODEC_ID_MPEG1VIDEO) { if (ist->st->codec.pict_type != B_TYPE) { int64_t tmp; tmp = ist->last_ip_pts; ist->last_ip_pts = ist->frac_pts.val; ist->frac_pts.val = tmp; #endif /* transcode raw format, encode packets and output them */ for(i=0;i<nb_ostreams;i++) { int frame_size; ost = ost_table[i]; if (ost->source_index == ist_index) { os = output_files[ost->file_index]; if (ipts != AV_NOPTS_VALUE) { #if 0 printf("%d: got pts=%f %f\n", i, pkt.pts / 90000.0, (ipts - ost->st->pts.val) / 90000.0); #endif /* set the input output pts pairs */ ost->sync_ipts = (double)ipts * is->pts_num / is->pts_den; /* XXX: take into account the various fifos, in particular for audio */ ost->sync_opts = ost->st->pts.val; //printf("ipts=%lld sync_ipts=%f sync_opts=%lld pts.val=%lld pkt.pts=%lld\n", ipts, ost->sync_ipts, ost->sync_opts, ost->st->pts.val, pkt.pts); } else { //printf("pts.val=%lld\n", ost->st->pts.val); ost->sync_ipts = AV_NOPTS_VALUE; if (ost->encoding_needed) { switch(ost->st->codec.codec_type) { case CODEC_TYPE_AUDIO: do_audio_out(os, ost, ist, data_buf, data_size); break; case CODEC_TYPE_VIDEO: /* find an audio stream for synchro */ { int i; AVOutputStream *audio_sync, *ost1; audio_sync = NULL; for(i=0;i<nb_ostreams;i++) { ost1 = ost_table[i]; if (ost1->file_index == ost->file_index && ost1->st->codec.codec_type == CODEC_TYPE_AUDIO) { audio_sync = ost1; break; do_video_out(os, ost, ist, &picture, &frame_size, audio_sync); if (do_vstats && frame_size) do_video_stats(os, ost, frame_size); break; default: av_abort(); } else { AVFrame avframe; /* no reencoding needed : output the packet directly */ /* force the input stream PTS */ memset(&avframe, 0, sizeof(AVFrame)); ost->st->codec.coded_frame= &avframe; avframe.key_frame = pkt.flags & PKT_FLAG_KEY; av_write_frame(os, ost->index, data_buf, data_size); ost->st->codec.frame_number++; ost->frame_number++; av_free(buffer_to_free); ipts = AV_NOPTS_VALUE; 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); term_exit(); /* dump report by using the first video and audio streams */ print_report(output_files, ost_table, nb_ostreams, 1); /* 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); /* write the trailer if needed and close file */ for(i=0;i<nb_output_files;i++) { os = output_files[i]; av_write_trailer(os); /* 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;
true
FFmpeg
bd0739804640939fea4fb6f1f625b82432d46947
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, pts_set; 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"); 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); 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; } 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", 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); icodec->channels = codec->channels; } else { ost->audio_resample = 1; ost->resample = audio_resample_init(codec->channels, icodec->channels, codec->sample_rate, icodec->sample_rate); 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 { uint8_t *buf; ost->video_resample = 1; ost->video_crop = 0; buf = av_malloc((codec->width * codec->height * 3) / 2); if (!buf) goto fail; ost->pict_tmp.data[0] = buf; ost->pict_tmp.data[1] = ost->pict_tmp.data[0] + (codec->width * codec->height); ost->pict_tmp.data[2] = ost->pict_tmp.data[1] + (codec->width * codec->height) / 4; ost->pict_tmp.linesize[0] = codec->width; ost->pict_tmp.linesize[1] = codec->width / 2; ost->pict_tmp.linesize[2] = codec->width / 2; 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); ost->logfile = f; } else { f = fopen(logfilename, "r"); if (!f) { perror(logfilename); 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"); 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", 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", 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); 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); ist->frame_decoded = 1; for(i=0;i<nb_istreams;i++) { ist = ist_table[i]; 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 (!do_play) { fprintf(stderr, "Press [q] to stop encoding\n"); } else { fprintf(stderr, "Press [q] to stop playing\n"); #endif term_init(); stream_no_data = 0; key = -1; for(;;) { int file_index, ist_index; AVPacket pkt; uint8_t *ptr; int len; uint8_t *data_buf; int data_size, got_picture; AVPicture picture; short samples[AVCODEC_MAX_AUDIO_FRAME_SIZE / 2]; void *buffer_to_free; double pts_min; redo: if (key) { 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_packet(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_hex_dump) { printf("stream #%d, size=%d:\n", pkt.stream_index, pkt.size); av_hex_dump(pkt.data, pkt.size); 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; len = pkt.size; ptr = pkt.data; pts_set = 0; while (len > 0) { int64_t ipts; ipts = AV_NOPTS_VALUE; data_buf = NULL; data_size = 0; if (ist->decoding_needed) { if (ist->frame_decoded && pkt.pts != AV_NOPTS_VALUE && !pts_set) { ipts = pkt.pts; ist->frame_decoded = 0; pts_set = 1; switch(ist->st->codec.codec_type) { case CODEC_TYPE_AUDIO: ret = avcodec_decode_audio(&ist->st->codec, samples, &data_size, ptr, len); if (ret < 0) goto fail_decode; if (data_size <= 0) { ptr += ret; len -= ret; continue; data_buf = (uint8_t *)samples; break; case CODEC_TYPE_VIDEO: { AVFrame big_picture; data_size = (ist->st->codec.width * ist->st->codec.height * 3) / 2; ret = avcodec_decode_video(&ist->st->codec, &big_picture, &got_picture, ptr, len); picture= *(AVPicture*)&big_picture; ist->st->quality= big_picture.quality; if (ret < 0) { fail_decode: fprintf(stderr, "Error while decoding stream #%d.%d\n", ist->file_index, ist->index); av_free_packet(&pkt); goto redo; if (!got_picture) { ptr += ret; len -= ret; continue; break; default: goto fail_decode; } else { data_buf = ptr; data_size = len; ret = len; ptr += ret; len -= ret; buffer_to_free = 0; if (ist->st->codec.codec_type == CODEC_TYPE_VIDEO) { pre_process_video_frame(ist, &picture, &buffer_to_free); ist->frame_decoded = 1; if (ist->st->codec.rate_emu) { int64_t pts = av_rescale((int64_t) ist->frame * ist->st->codec.frame_rate_base, 1000000, ist->st->codec.frame_rate); int64_t now = av_gettime() - ist->start; if (pts > now) usleep(pts - now); ist->frame++; #if 0 if (ist->st->codec.codec_id == CODEC_ID_MPEG1VIDEO) { if (ist->st->codec.pict_type != B_TYPE) { int64_t tmp; tmp = ist->last_ip_pts; ist->last_ip_pts = ist->frac_pts.val; ist->frac_pts.val = tmp; #endif for(i=0;i<nb_ostreams;i++) { int frame_size; ost = ost_table[i]; if (ost->source_index == ist_index) { os = output_files[ost->file_index]; if (ipts != AV_NOPTS_VALUE) { #if 0 printf("%d: got pts=%f %f\n", i, pkt.pts / 90000.0, (ipts - ost->st->pts.val) / 90000.0); #endif ost->sync_ipts = (double)ipts * is->pts_num / is->pts_den; ost->sync_opts = ost->st->pts.val; } else { ost->sync_ipts = AV_NOPTS_VALUE; if (ost->encoding_needed) { switch(ost->st->codec.codec_type) { case CODEC_TYPE_AUDIO: do_audio_out(os, ost, ist, data_buf, data_size); break; case CODEC_TYPE_VIDEO: { int i; AVOutputStream *audio_sync, *ost1; audio_sync = NULL; for(i=0;i<nb_ostreams;i++) { ost1 = ost_table[i]; if (ost1->file_index == ost->file_index && ost1->st->codec.codec_type == CODEC_TYPE_AUDIO) { audio_sync = ost1; break; do_video_out(os, ost, ist, &picture, &frame_size, audio_sync); if (do_vstats && frame_size) do_video_stats(os, ost, frame_size); break; default: av_abort(); } else { AVFrame avframe; memset(&avframe, 0, sizeof(AVFrame)); ost->st->codec.coded_frame= &avframe; avframe.key_frame = pkt.flags & PKT_FLAG_KEY; av_write_frame(os, ost->index, data_buf, data_size); ost->st->codec.frame_number++; ost->frame_number++; av_free(buffer_to_free); ipts = AV_NOPTS_VALUE; discard_packet: av_free_packet(&pkt); print_report(output_files, ost_table, nb_ostreams, 0); term_exit(); print_report(output_files, ost_table, nb_ostreams, 1); 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); for(i=0;i<nb_output_files;i++) { os = output_files[i]; av_write_trailer(os); 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, VAR_13; 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_14; 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"); for(VAR_7=0;VAR_7<VAR_5;VAR_7++) { int fi = VAR_4[VAR_7].file_index; int si = VAR_4[VAR_7].stream_index; if (fi < 0 || fi > VAR_3 - 1 || si < 0 || si > file_table[fi].nb_streams - 1) { fprintf(stderr,"Could not find input stream #%d.%d\VAR_10", fi, si); 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; } 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", 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); icodec->channels = codec->channels; } else { ost->audio_resample = 1; ost->resample = audio_resample_init(codec->channels, icodec->channels, codec->sample_rate, icodec->sample_rate); 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 { uint8_t *buf; ost->video_resample = 1; ost->video_crop = 0; buf = av_malloc((codec->width * codec->height * 3) / 2); if (!buf) goto fail; ost->pict_tmp.data[0] = buf; ost->pict_tmp.data[1] = ost->pict_tmp.data[0] + (codec->width * codec->height); ost->pict_tmp.data[2] = ost->pict_tmp.data[1] + (codec->width * codec->height) / 4; ost->pict_tmp.linesize[0] = codec->width; ost->pict_tmp.linesize[1] = codec->width / 2; ost->pict_tmp.linesize[2] = codec->width / 2; 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, VAR_7); if (codec->flags & CODEC_FLAG_PASS1) { f = fopen(logfilename, "w"); if (!f) { perror(logfilename); ost->logfile = f; } else { f = fopen(logfilename, "r"); if (!f) { perror(logfilename); 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\VAR_10"); fread(logbuffer, 1, size, f); fclose(f); logbuffer[size] = '\0'; codec->stats_in = logbuffer; 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", 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", 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); 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); ist->frame_decoded = 1; for(VAR_7=0;VAR_7<VAR_11;VAR_7++) { ist = ist_table[VAR_7]; 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 (!do_play) { fprintf(stderr, "Press [q] to stop encoding\VAR_10"); } else { fprintf(stderr, "Press [q] to stop playing\VAR_10"); #endif term_init(); stream_no_data = 0; VAR_14 = -1; for(;;) { int file_index, ist_index; AVPacket pkt; uint8_t *ptr; int len; uint8_t *data_buf; int data_size, got_picture; AVPicture picture; short samples[AVCODEC_MAX_AUDIO_FRAME_SIZE / 2]; void *buffer_to_free; double pts_min; redo: if (VAR_14) { VAR_14 = read_key(); if (VAR_14 == '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_packet(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_hex_dump) { printf("stream #%d, size=%d:\VAR_10", pkt.stream_index, pkt.size); av_hex_dump(pkt.data, pkt.size); 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; len = pkt.size; ptr = pkt.data; VAR_13 = 0; while (len > 0) { int64_t ipts; ipts = AV_NOPTS_VALUE; data_buf = NULL; data_size = 0; if (ist->decoding_needed) { if (ist->frame_decoded && pkt.pts != AV_NOPTS_VALUE && !VAR_13) { ipts = pkt.pts; ist->frame_decoded = 0; VAR_13 = 1; switch(ist->st->codec.codec_type) { case CODEC_TYPE_AUDIO: VAR_6 = avcodec_decode_audio(&ist->st->codec, samples, &data_size, ptr, len); if (VAR_6 < 0) goto fail_decode; if (data_size <= 0) { ptr += VAR_6; len -= VAR_6; continue; data_buf = (uint8_t *)samples; break; case CODEC_TYPE_VIDEO: { AVFrame big_picture; data_size = (ist->st->codec.width * ist->st->codec.height * 3) / 2; VAR_6 = avcodec_decode_video(&ist->st->codec, &big_picture, &got_picture, ptr, len); picture= *(AVPicture*)&big_picture; ist->st->quality= big_picture.quality; if (VAR_6 < 0) { fail_decode: fprintf(stderr, "Error while decoding stream #%d.%d\VAR_10", ist->file_index, ist->index); av_free_packet(&pkt); goto redo; if (!got_picture) { ptr += VAR_6; len -= VAR_6; continue; break; default: goto fail_decode; } else { data_buf = ptr; data_size = len; VAR_6 = len; ptr += VAR_6; len -= VAR_6; buffer_to_free = 0; if (ist->st->codec.codec_type == CODEC_TYPE_VIDEO) { pre_process_video_frame(ist, &picture, &buffer_to_free); ist->frame_decoded = 1; if (ist->st->codec.rate_emu) { int64_t pts = av_rescale((int64_t) ist->frame * ist->st->codec.frame_rate_base, 1000000, ist->st->codec.frame_rate); int64_t now = av_gettime() - ist->start; if (pts > now) usleep(pts - now); ist->frame++; #if 0 if (ist->st->codec.codec_id == CODEC_ID_MPEG1VIDEO) { if (ist->st->codec.pict_type != B_TYPE) { int64_t tmp; tmp = ist->last_ip_pts; ist->last_ip_pts = ist->frac_pts.val; ist->frac_pts.val = tmp; #endif for(VAR_7=0;VAR_7<VAR_12;VAR_7++) { int frame_size; ost = ost_table[VAR_7]; if (ost->source_index == ist_index) { os = VAR_0[ost->file_index]; if (ipts != AV_NOPTS_VALUE) { #if 0 printf("%d: got pts=%f %f\VAR_10", VAR_7, pkt.pts / 90000.0, (ipts - ost->st->pts.val) / 90000.0); #endif ost->sync_ipts = (double)ipts * is->pts_num / is->pts_den; ost->sync_opts = ost->st->pts.val; } else { ost->sync_ipts = AV_NOPTS_VALUE; if (ost->encoding_needed) { switch(ost->st->codec.codec_type) { case CODEC_TYPE_AUDIO: do_audio_out(os, ost, ist, data_buf, data_size); break; case CODEC_TYPE_VIDEO: { int VAR_7; AVOutputStream *audio_sync, *ost1; audio_sync = NULL; for(VAR_7=0;VAR_7<VAR_12;VAR_7++) { ost1 = ost_table[VAR_7]; if (ost1->file_index == ost->file_index && ost1->st->codec.codec_type == CODEC_TYPE_AUDIO) { audio_sync = ost1; break; do_video_out(os, ost, ist, &picture, &frame_size, audio_sync); if (do_vstats && frame_size) do_video_stats(os, ost, frame_size); break; default: av_abort(); } else { AVFrame avframe; memset(&avframe, 0, sizeof(AVFrame)); ost->st->codec.coded_frame= &avframe; avframe.key_frame = pkt.flags & PKT_FLAG_KEY; av_write_frame(os, ost->index, data_buf, data_size); ost->st->codec.frame_number++; ost->frame_number++; av_free(buffer_to_free); ipts = AV_NOPTS_VALUE; discard_packet: av_free_packet(&pkt); print_report(VAR_0, ost_table, VAR_12, 0); term_exit(); print_report(VAR_0, ost_table, VAR_12, 1); 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); for(VAR_7=0;VAR_7<VAR_1;VAR_7++) { os = VAR_0[VAR_7]; av_write_trailer(os); 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, VAR_13;", "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_14;", "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\");", "for(VAR_7=0;VAR_7<VAR_5;VAR_7++) {", "int fi = VAR_4[VAR_7].file_index;", "int si = VAR_4[VAR_7].stream_index;", "if (fi < 0 || fi > VAR_3 - 1 ||\nsi < 0 || si > file_table[fi].nb_streams - 1) {", "fprintf(stderr,\"Could not find input stream #%d.%d\\VAR_10\", fi, si);", "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;", "} 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\",\nist = 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);", "icodec->channels = codec->channels;", "} else {", "ost->audio_resample = 1;", "ost->resample = audio_resample_init(codec->channels, icodec->channels,\ncodec->sample_rate,\nicodec->sample_rate);", "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 {", "uint8_t *buf;", "ost->video_resample = 1;", "ost->video_crop = 0;", "buf = av_malloc((codec->width * codec->height * 3) / 2);", "if (!buf)\ngoto fail;", "ost->pict_tmp.data[0] = buf;", "ost->pict_tmp.data[1] = ost->pict_tmp.data[0] + (codec->width * codec->height);", "ost->pict_tmp.data[2] = ost->pict_tmp.data[1] + (codec->width * codec->height) / 4;", "ost->pict_tmp.linesize[0] = codec->width;", "ost->pict_tmp.linesize[1] = codec->width / 2;", "ost->pict_tmp.linesize[2] = codec->width / 2;", "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 logfilename[1024];", "FILE *f;", "int size;", "char *logbuffer;", "snprintf(logfilename, sizeof(logfilename), \"%s-%d.log\",\npass_logfilename ?\npass_logfilename : DEFAULT_PASS_LOGFILENAME, VAR_7);", "if (codec->flags & CODEC_FLAG_PASS1) {", "f = fopen(logfilename, \"w\");", "if (!f) {", "perror(logfilename);", "ost->logfile = f;", "} else {", "f = fopen(logfilename, \"r\");", "if (!f) {", "perror(logfilename);", "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\\VAR_10\");", "fread(logbuffer, 1, size, f);", "fclose(f);", "logbuffer[size] = '\\0';", "codec->stats_in = logbuffer;", "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\",\nif (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\",\nfor(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);", "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);", "ist->frame_decoded = 1;", "for(VAR_7=0;VAR_7<VAR_11;VAR_7++) {", "ist = ist_table[VAR_7];", "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 (!do_play) {", "fprintf(stderr, \"Press [q] to stop encoding\\VAR_10\");", "} else {", "fprintf(stderr, \"Press [q] to stop playing\\VAR_10\");", "#endif\nterm_init();", "stream_no_data = 0;", "VAR_14 = -1;", "for(;;) {", "int file_index, ist_index;", "AVPacket pkt;", "uint8_t *ptr;", "int len;", "uint8_t *data_buf;", "int data_size, got_picture;", "AVPicture picture;", "short samples[AVCODEC_MAX_AUDIO_FRAME_SIZE / 2];", "void *buffer_to_free;", "double pts_min;", "redo:\nif (VAR_14) {", "VAR_14 = read_key();", "if (VAR_14 == '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_packet(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_hex_dump) {", "printf(\"stream #%d, size=%d:\\VAR_10\", pkt.stream_index, pkt.size);", "av_hex_dump(pkt.data, pkt.size);", "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;", "len = pkt.size;", "ptr = pkt.data;", "VAR_13 = 0;", "while (len > 0) {", "int64_t ipts;", "ipts = AV_NOPTS_VALUE;", "data_buf = NULL;", "data_size = 0;", "if (ist->decoding_needed) {", "if (ist->frame_decoded &&\npkt.pts != AV_NOPTS_VALUE &&\n!VAR_13) {", "ipts = pkt.pts;", "ist->frame_decoded = 0;", "VAR_13 = 1;", "switch(ist->st->codec.codec_type) {", "case CODEC_TYPE_AUDIO:\nVAR_6 = avcodec_decode_audio(&ist->st->codec, samples, &data_size,\nptr, len);", "if (VAR_6 < 0)\ngoto fail_decode;", "if (data_size <= 0) {", "ptr += VAR_6;", "len -= VAR_6;", "continue;", "data_buf = (uint8_t *)samples;", "break;", "case CODEC_TYPE_VIDEO:\n{", "AVFrame big_picture;", "data_size = (ist->st->codec.width * ist->st->codec.height * 3) / 2;", "VAR_6 = avcodec_decode_video(&ist->st->codec,\n&big_picture, &got_picture, ptr, len);", "picture= *(AVPicture*)&big_picture;", "ist->st->quality= big_picture.quality;", "if (VAR_6 < 0) {", "fail_decode:\nfprintf(stderr, \"Error while decoding stream #%d.%d\\VAR_10\",\nist->file_index, ist->index);", "av_free_packet(&pkt);", "goto redo;", "if (!got_picture) {", "ptr += VAR_6;", "len -= VAR_6;", "continue;", "break;", "default:\ngoto fail_decode;", "} else {", "data_buf = ptr;", "data_size = len;", "VAR_6 = len;", "ptr += VAR_6;", "len -= VAR_6;", "buffer_to_free = 0;", "if (ist->st->codec.codec_type == CODEC_TYPE_VIDEO) {", "pre_process_video_frame(ist, &picture, &buffer_to_free);", "ist->frame_decoded = 1;", "if (ist->st->codec.rate_emu) {", "int64_t pts = av_rescale((int64_t) ist->frame * ist->st->codec.frame_rate_base, 1000000, ist->st->codec.frame_rate);", "int64_t now = av_gettime() - ist->start;", "if (pts > now)\nusleep(pts - now);", "ist->frame++;", "#if 0\nif (ist->st->codec.codec_id == CODEC_ID_MPEG1VIDEO) {", "if (ist->st->codec.pict_type != B_TYPE) {", "int64_t tmp;", "tmp = ist->last_ip_pts;", "ist->last_ip_pts = ist->frac_pts.val;", "ist->frac_pts.val = tmp;", "#endif\nfor(VAR_7=0;VAR_7<VAR_12;VAR_7++) {", "int frame_size;", "ost = ost_table[VAR_7];", "if (ost->source_index == ist_index) {", "os = VAR_0[ost->file_index];", "if (ipts != AV_NOPTS_VALUE) {", "#if 0\nprintf(\"%d: got pts=%f %f\\VAR_10\",\nVAR_7, pkt.pts / 90000.0,\n(ipts - ost->st->pts.val) / 90000.0);", "#endif\nost->sync_ipts = (double)ipts * is->pts_num /\nis->pts_den;", "ost->sync_opts = ost->st->pts.val;", "} else {", "ost->sync_ipts = AV_NOPTS_VALUE;", "if (ost->encoding_needed) {", "switch(ost->st->codec.codec_type) {", "case CODEC_TYPE_AUDIO:\ndo_audio_out(os, ost, ist, data_buf, data_size);", "break;", "case CODEC_TYPE_VIDEO:\n{", "int VAR_7;", "AVOutputStream *audio_sync, *ost1;", "audio_sync = NULL;", "for(VAR_7=0;VAR_7<VAR_12;VAR_7++) {", "ost1 = ost_table[VAR_7];", "if (ost1->file_index == ost->file_index &&\nost1->st->codec.codec_type == CODEC_TYPE_AUDIO) {", "audio_sync = ost1;", "break;", "do_video_out(os, ost, ist, &picture, &frame_size, audio_sync);", "if (do_vstats && frame_size)\ndo_video_stats(os, ost, frame_size);", "break;", "default:\nav_abort();", "} else {", "AVFrame avframe;", "memset(&avframe, 0, sizeof(AVFrame));", "ost->st->codec.coded_frame= &avframe;", "avframe.key_frame = pkt.flags & PKT_FLAG_KEY;", "av_write_frame(os, ost->index, data_buf, data_size);", "ost->st->codec.frame_number++;", "ost->frame_number++;", "av_free(buffer_to_free);", "ipts = AV_NOPTS_VALUE;", "discard_packet:\nav_free_packet(&pkt);", "print_report(VAR_0, ost_table, VAR_12, 0);", "term_exit();", "print_report(VAR_0, ost_table, VAR_12, 1);", "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);", "for(VAR_7=0;VAR_7<VAR_1;VAR_7++) {", "os = VAR_0[VAR_7];", "av_write_trailer(os);", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4, 5, 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16, 17 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27, 28 ], [ 29 ], [ 30 ], [ 31, 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ], [ 44 ], [ 45 ], [ 46 ], [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 55 ], [ 56 ], [ 57 ], [ 58, 59 ], [ 60 ], [ 61 ], [ 62, 63 ], [ 64 ], [ 65 ], [ 66, 67 ], [ 68 ], [ 69 ], [ 70 ], [ 71 ], [ 72 ], [ 73 ], [ 74 ], [ 75 ], [ 76 ], [ 77 ], [ 78 ], [ 79, 80 ], [ 81 ], [ 83 ], [ 84 ], [ 85 ], [ 86, 87 ], [ 88 ], [ 89 ], [ 90 ], [ 92 ], [ 93 ], [ 94 ], [ 95 ], [ 96 ], [ 97 ], [ 98, 99 ], [ 100 ], [ 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 109 ], [ 110 ], [ 111 ], [ 112 ], [ 113 ], [ 114, 115 ], [ 116 ], [ 117 ], [ 118, 119 ], [ 120 ], [ 121 ], [ 122 ], [ 123 ], [ 124, 125 ], [ 126 ], [ 127 ], [ 128, 129, 130 ], [ 131, 132 ], [ 133 ], [ 134 ], [ 135, 136 ], [ 140 ], [ 141, 142 ], [ 143 ], [ 144 ], [ 145, 146, 147 ], [ 149 ], [ 150 ], [ 151 ], [ 152, 153, 154 ], [ 155 ], [ 156 ], [ 157 ], [ 158, 159, 160, 161, 162, 163, 164, 165 ], [ 166 ], [ 167 ], [ 168 ], [ 169, 170, 171, 172 ], [ 173 ], [ 174 ], [ 175 ], [ 176 ], [ 177 ], [ 178 ], [ 179 ], [ 180 ], [ 181 ], [ 182, 183 ], [ 184 ], [ 185 ], [ 186 ], [ 187 ], [ 188 ], [ 189 ], [ 190, 191, 192, 193, 194 ], [ 195 ], [ 196 ], [ 197 ], [ 198, 199 ], [ 201, 202 ], [ 203 ], [ 204 ], [ 205 ], [ 206 ], [ 207, 208, 209 ], [ 210 ], [ 211 ], [ 212 ], [ 213 ], [ 214 ], [ 215 ], [ 217 ], [ 218 ], [ 219 ], [ 220 ], [ 221 ], [ 222 ], [ 223 ], [ 224 ], [ 225 ], [ 226 ], [ 227 ], [ 228 ], [ 229 ], [ 232 ], [ 233 ], [ 235 ], [ 236 ], [ 237 ], [ 238, 239, 240, 241, 242 ], [ 244 ], [ 245 ], [ 246 ], [ 247 ], [ 248 ], [ 249 ], [ 250, 251 ], [ 252, 254 ], [ 255 ], [ 256 ], [ 257 ], [ 258 ], [ 259 ], [ 260, 261 ], [ 262 ], [ 263, 264 ], [ 267 ], [ 269 ], [ 270 ], [ 272 ], [ 273 ], [ 275 ], [ 276 ], [ 277 ], [ 278 ], [ 279 ], [ 280 ], [ 281, 282 ], [ 283 ], [ 284 ], [ 285 ], [ 286, 287 ], [ 288 ], [ 289 ], [ 290 ], [ 291 ], [ 292 ], [ 293 ], [ 294 ], [ 295 ], [ 296 ], [ 297 ], [ 298 ], [ 299 ], [ 300 ], [ 301, 303 ], [ 305 ], [ 306, 307 ], [ 310 ], [ 311 ], [ 312 ], [ 313 ], [ 314 ], [ 315 ], [ 316 ], [ 317 ], [ 318, 319 ], [ 320 ], [ 321 ], [ 323 ], [ 324 ], [ 326, 327 ], [ 329 ], [ 330 ], [ 331 ], [ 332 ], [ 333 ], [ 334 ], [ 335 ], [ 336 ], [ 337 ], [ 338 ], [ 339 ], [ 342, 343 ], [ 344 ], [ 345 ], [ 346, 347 ], [ 349 ], [ 350 ], [ 351 ], [ 352 ], [ 353 ], [ 354 ], [ 356 ], [ 357 ], [ 358 ], [ 363, 364, 365 ], [ 366 ], [ 367 ], [ 368 ], [ 369 ], [ 370, 373, 374 ], [ 375, 376 ], [ 379 ], [ 381 ], [ 382 ], [ 383 ], [ 384 ], [ 385 ], [ 386, 387 ], [ 388 ], [ 389 ], [ 390, 391 ], [ 392 ], [ 393 ], [ 394 ], [ 395, 396, 397 ], [ 398 ], [ 399 ], [ 400 ], [ 402 ], [ 403 ], [ 404 ], [ 405 ], [ 406, 407 ], [ 408 ], [ 409 ], [ 410 ], [ 411 ], [ 412 ], [ 413 ], [ 414 ], [ 415 ], [ 416 ], [ 417 ], [ 419 ], [ 420 ], [ 421 ], [ 422, 423 ], [ 424 ], [ 425, 429 ], [ 430 ], [ 431 ], [ 432 ], [ 433 ], [ 434 ], [ 435, 437 ], [ 438 ], [ 439 ], [ 440 ], [ 441 ], [ 442 ], [ 443, 444, 445, 446 ], [ 447, 449, 450 ], [ 453 ], [ 455 ], [ 457 ], [ 458 ], [ 459 ], [ 460, 461 ], [ 462 ], [ 463, 465 ], [ 466 ], [ 467 ], [ 468 ], [ 469 ], [ 470 ], [ 471, 472 ], [ 473 ], [ 474 ], [ 475 ], [ 476, 477 ], [ 478 ], [ 479, 480 ], [ 481 ], [ 482 ], [ 485 ], [ 486 ], [ 487 ], [ 488 ], [ 489 ], [ 490 ], [ 491 ], [ 492 ], [ 493, 494 ], [ 496 ], [ 497 ], [ 499 ], [ 501 ], [ 502 ], [ 503 ], [ 504 ], [ 505 ], [ 507 ], [ 508 ], [ 509 ], [ 510 ], [ 512 ], [ 513 ], [ 514 ], [ 516 ], [ 517, 518 ], [ 519 ], [ 520 ], [ 521 ], [ 522 ], [ 523 ], [ 524 ], [ 525 ], [ 526 ], [ 527 ], [ 528 ], [ 529 ], [ 530 ], [ 531 ], [ 533 ], [ 534, 535 ], [ 536, 537 ], [ 538 ], [ 539 ], [ 540 ], [ 541, 542 ], [ 543 ] ]
13,269
static void RENAME(mix8to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, integer len){ int i; for(i=0; i<len; i++) { INTER t = in[2][i]*coeffp[0*8+2] + in[3][i]*coeffp[0*8+3]; out[0][i] = R(t + in[0][i]*(INTER)coeffp[0*8+0] + in[4][i]*(INTER)coeffp[0*8+4] + in[6][i]*(INTER)coeffp[0*8+6]); out[1][i] = R(t + in[1][i]*(INTER)coeffp[1*8+1] + in[5][i]*(INTER)coeffp[1*8+5] + in[7][i]*(INTER)coeffp[1*8+7]); } }
true
FFmpeg
d62030ffcaf14dd801918fe26e670d68fdc21984
static void RENAME(mix8to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, integer len){ int i; for(i=0; i<len; i++) { INTER t = in[2][i]*coeffp[0*8+2] + in[3][i]*coeffp[0*8+3]; out[0][i] = R(t + in[0][i]*(INTER)coeffp[0*8+0] + in[4][i]*(INTER)coeffp[0*8+4] + in[6][i]*(INTER)coeffp[0*8+6]); out[1][i] = R(t + in[1][i]*(INTER)coeffp[1*8+1] + in[5][i]*(INTER)coeffp[1*8+5] + in[7][i]*(INTER)coeffp[1*8+7]); } }
{ "code": [ " INTER t = in[2][i]*coeffp[0*8+2] + in[3][i]*coeffp[0*8+3];" ], "line_no": [ 9 ] }
static void FUNC_0(mix8to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, integer len){ int VAR_0; for(VAR_0=0; VAR_0<len; VAR_0++) { INTER t = in[2][VAR_0]*coeffp[0*8+2] + in[3][VAR_0]*coeffp[0*8+3]; out[0][VAR_0] = R(t + in[0][VAR_0]*(INTER)coeffp[0*8+0] + in[4][VAR_0]*(INTER)coeffp[0*8+4] + in[6][VAR_0]*(INTER)coeffp[0*8+6]); out[1][VAR_0] = R(t + in[1][VAR_0]*(INTER)coeffp[1*8+1] + in[5][VAR_0]*(INTER)coeffp[1*8+5] + in[7][VAR_0]*(INTER)coeffp[1*8+7]); } }
[ "static void FUNC_0(mix8to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, integer len){", "int VAR_0;", "for(VAR_0=0; VAR_0<len; VAR_0++) {", "INTER t = in[2][VAR_0]*coeffp[0*8+2] + in[3][VAR_0]*coeffp[0*8+3];", "out[0][VAR_0] = R(t + in[0][VAR_0]*(INTER)coeffp[0*8+0] + in[4][VAR_0]*(INTER)coeffp[0*8+4] + in[6][VAR_0]*(INTER)coeffp[0*8+6]);", "out[1][VAR_0] = R(t + in[1][VAR_0]*(INTER)coeffp[1*8+1] + in[5][VAR_0]*(INTER)coeffp[1*8+5] + in[7][VAR_0]*(INTER)coeffp[1*8+7]);", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
13,271
static CharDriverState *qemu_chr_open_pp_fd(int fd, ChardevCommon *backend, Error **errp) { CharDriverState *chr; ParallelCharDriver *drv; if (ioctl(fd, PPCLAIM) < 0) { error_setg_errno(errp, errno, "not a parallel port"); close(fd); return NULL; } drv = g_new0(ParallelCharDriver, 1); drv->fd = fd; drv->mode = IEEE1284_MODE_COMPAT; chr = qemu_chr_alloc(backend, errp); if (!chr) { return NULL; } chr->chr_write = null_chr_write; chr->chr_ioctl = pp_ioctl; chr->chr_close = pp_close; chr->opaque = drv; return chr; }
true
qemu
27ef9cb0e77eda46618ea084adffa63ebde5be80
static CharDriverState *qemu_chr_open_pp_fd(int fd, ChardevCommon *backend, Error **errp) { CharDriverState *chr; ParallelCharDriver *drv; if (ioctl(fd, PPCLAIM) < 0) { error_setg_errno(errp, errno, "not a parallel port"); close(fd); return NULL; } drv = g_new0(ParallelCharDriver, 1); drv->fd = fd; drv->mode = IEEE1284_MODE_COMPAT; chr = qemu_chr_alloc(backend, errp); if (!chr) { return NULL; } chr->chr_write = null_chr_write; chr->chr_ioctl = pp_ioctl; chr->chr_close = pp_close; chr->opaque = drv; return chr; }
{ "code": [ " drv = g_new0(ParallelCharDriver, 1);", " drv->fd = fd;", " drv->mode = IEEE1284_MODE_COMPAT;", " chr->opaque = drv;" ], "line_no": [ 27, 29, 31, 49 ] }
static CharDriverState *FUNC_0(int fd, ChardevCommon *backend, Error **errp) { CharDriverState *chr; ParallelCharDriver *drv; if (ioctl(fd, PPCLAIM) < 0) { error_setg_errno(errp, errno, "not a parallel port"); close(fd); return NULL; } drv = g_new0(ParallelCharDriver, 1); drv->fd = fd; drv->mode = IEEE1284_MODE_COMPAT; chr = qemu_chr_alloc(backend, errp); if (!chr) { return NULL; } chr->chr_write = null_chr_write; chr->chr_ioctl = pp_ioctl; chr->chr_close = pp_close; chr->opaque = drv; return chr; }
[ "static CharDriverState *FUNC_0(int fd,\nChardevCommon *backend,\nError **errp)\n{", "CharDriverState *chr;", "ParallelCharDriver *drv;", "if (ioctl(fd, PPCLAIM) < 0) {", "error_setg_errno(errp, errno, \"not a parallel port\");", "close(fd);", "return NULL;", "}", "drv = g_new0(ParallelCharDriver, 1);", "drv->fd = fd;", "drv->mode = IEEE1284_MODE_COMPAT;", "chr = qemu_chr_alloc(backend, errp);", "if (!chr) {", "return NULL;", "}", "chr->chr_write = null_chr_write;", "chr->chr_ioctl = pp_ioctl;", "chr->chr_close = pp_close;", "chr->opaque = drv;", "return chr;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
13,272
static void pprint_data(V9fsPDU *pdu, int rx, size_t *offsetp, const char *name) { struct iovec *sg = get_sg(pdu, rx); size_t offset = *offsetp; unsigned int count; int32_t size; int total, i, j; ssize_t len; if (rx) { count = pdu->elem.in_num; } else count = pdu->elem.out_num; }
true
qemu
069d89b8a8dc5a9af4733bca14763b45bbb2546f
static void pprint_data(V9fsPDU *pdu, int rx, size_t *offsetp, const char *name) { struct iovec *sg = get_sg(pdu, rx); size_t offset = *offsetp; unsigned int count; int32_t size; int total, i, j; ssize_t len; if (rx) { count = pdu->elem.in_num; } else count = pdu->elem.out_num; }
{ "code": [ " } else" ], "line_no": [ 23 ] }
static void FUNC_0(V9fsPDU *VAR_0, int VAR_1, size_t *VAR_2, const char *VAR_3) { struct iovec *VAR_4 = get_sg(VAR_0, VAR_1); size_t offset = *VAR_2; unsigned int VAR_5; int32_t size; int VAR_6, VAR_7, VAR_8; ssize_t len; if (VAR_1) { VAR_5 = VAR_0->elem.in_num; } else VAR_5 = VAR_0->elem.out_num; }
[ "static void FUNC_0(V9fsPDU *VAR_0, int VAR_1, size_t *VAR_2, const char *VAR_3)\n{", "struct iovec *VAR_4 = get_sg(VAR_0, VAR_1);", "size_t offset = *VAR_2;", "unsigned int VAR_5;", "int32_t size;", "int VAR_6, VAR_7, VAR_8;", "ssize_t len;", "if (VAR_1) {", "VAR_5 = VAR_0->elem.in_num;", "} else", "VAR_5 = VAR_0->elem.out_num;", "}" ]
[ 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 ] ]
13,274
static void put_audio_specific_config(AVCodecContext *avctx) { PutBitContext pb; AACEncContext *s = avctx->priv_data; init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8); put_bits(&pb, 5, 2); //object type - AAC-LC put_bits(&pb, 4, s->samplerate_index); //sample rate index put_bits(&pb, 4, s->channels); //GASpecificConfig put_bits(&pb, 1, 0); //frame length - 1024 samples put_bits(&pb, 1, 0); //does not depend on core coder put_bits(&pb, 1, 0); //is not extension //Explicitly Mark SBR absent put_bits(&pb, 11, 0x2b7); //sync extension put_bits(&pb, 5, AOT_SBR); put_bits(&pb, 1, 0); flush_put_bits(&pb); }
true
FFmpeg
50833c9f7b4e1922197a8955669f8ab3589c8cef
static void put_audio_specific_config(AVCodecContext *avctx) { PutBitContext pb; AACEncContext *s = avctx->priv_data; init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8); put_bits(&pb, 5, 2); put_bits(&pb, 4, s->samplerate_index); put_bits(&pb, 4, s->channels); put_bits(&pb, 1, 0); put_bits(&pb, 1, 0); put_bits(&pb, 1, 0); put_bits(&pb, 11, 0x2b7); put_bits(&pb, 5, AOT_SBR); put_bits(&pb, 1, 0); flush_put_bits(&pb); }
{ "code": [ " init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);" ], "line_no": [ 11 ] }
static void FUNC_0(AVCodecContext *VAR_0) { PutBitContext pb; AACEncContext *s = VAR_0->priv_data; init_put_bits(&pb, VAR_0->extradata, VAR_0->extradata_size*8); put_bits(&pb, 5, 2); put_bits(&pb, 4, s->samplerate_index); put_bits(&pb, 4, s->channels); put_bits(&pb, 1, 0); put_bits(&pb, 1, 0); put_bits(&pb, 1, 0); put_bits(&pb, 11, 0x2b7); put_bits(&pb, 5, AOT_SBR); put_bits(&pb, 1, 0); flush_put_bits(&pb); }
[ "static void FUNC_0(AVCodecContext *VAR_0)\n{", "PutBitContext pb;", "AACEncContext *s = VAR_0->priv_data;", "init_put_bits(&pb, VAR_0->extradata, VAR_0->extradata_size*8);", "put_bits(&pb, 5, 2);", "put_bits(&pb, 4, s->samplerate_index);", "put_bits(&pb, 4, s->channels);", "put_bits(&pb, 1, 0);", "put_bits(&pb, 1, 0);", "put_bits(&pb, 1, 0);", "put_bits(&pb, 11, 0x2b7);", "put_bits(&pb, 5, AOT_SBR);", "put_bits(&pb, 1, 0);", "flush_put_bits(&pb);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
13,275
static void error_setv(Error **errp, ErrorClass err_class, const char *fmt, va_list ap) { Error *err; int saved_errno = errno; if (errp == NULL) { return; } assert(*errp == NULL); err = g_malloc0(sizeof(*err)); err->msg = g_strdup_vprintf(fmt, ap); err->err_class = err_class; if (errp == &error_abort) { error_report_err(err); abort(); } *errp = err; errno = saved_errno; }
true
qemu
1e9b65bb1bad51735cab6c861c29b592dccabf0e
static void error_setv(Error **errp, ErrorClass err_class, const char *fmt, va_list ap) { Error *err; int saved_errno = errno; if (errp == NULL) { return; } assert(*errp == NULL); err = g_malloc0(sizeof(*err)); err->msg = g_strdup_vprintf(fmt, ap); err->err_class = err_class; if (errp == &error_abort) { error_report_err(err); abort(); } *errp = err; errno = saved_errno; }
{ "code": [ "static void error_setv(Error **errp, ErrorClass err_class,", " const char *fmt, va_list ap)", " error_report_err(err);", " abort();", " abort();" ], "line_no": [ 1, 3, 33, 35, 35 ] }
static void FUNC_0(Error **VAR_0, ErrorClass VAR_1, const char *VAR_2, va_list VAR_3) { Error *err; int VAR_4 = errno; if (VAR_0 == NULL) { return; } assert(*VAR_0 == NULL); err = g_malloc0(sizeof(*err)); err->msg = g_strdup_vprintf(VAR_2, VAR_3); err->VAR_1 = VAR_1; if (VAR_0 == &error_abort) { error_report_err(err); abort(); } *VAR_0 = err; errno = VAR_4; }
[ "static void FUNC_0(Error **VAR_0, ErrorClass VAR_1,\nconst char *VAR_2, va_list VAR_3)\n{", "Error *err;", "int VAR_4 = errno;", "if (VAR_0 == NULL) {", "return;", "}", "assert(*VAR_0 == NULL);", "err = g_malloc0(sizeof(*err));", "err->msg = g_strdup_vprintf(VAR_2, VAR_3);", "err->VAR_1 = VAR_1;", "if (VAR_0 == &error_abort) {", "error_report_err(err);", "abort();", "}", "*VAR_0 = err;", "errno = VAR_4;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ] ]
13,276
static QObject *qdict_get_obj(const QDict *qdict, const char *key, QType type) { QObject *obj; obj = qdict_get(qdict, key); assert(obj != NULL); assert(qobject_type(obj) == type); return obj; }
true
qemu
b25f23e7dbc6bc0dcda010222a4f178669d1aedc
static QObject *qdict_get_obj(const QDict *qdict, const char *key, QType type) { QObject *obj; obj = qdict_get(qdict, key); assert(obj != NULL); assert(qobject_type(obj) == type); return obj; }
{ "code": [ "static QObject *qdict_get_obj(const QDict *qdict, const char *key, QType type)", " QObject *obj;", " obj = qdict_get(qdict, key);", " assert(obj != NULL);", " assert(qobject_type(obj) == type);", " return obj;" ], "line_no": [ 1, 5, 9, 11, 13, 17 ] }
static QObject *FUNC_0(const QDict *qdict, const char *key, QType type) { QObject *obj; obj = qdict_get(qdict, key); assert(obj != NULL); assert(qobject_type(obj) == type); return obj; }
[ "static QObject *FUNC_0(const QDict *qdict, const char *key, QType type)\n{", "QObject *obj;", "obj = qdict_get(qdict, key);", "assert(obj != NULL);", "assert(qobject_type(obj) == type);", "return obj;", "}" ]
[ 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ] ]
13,277
static av_cold int libschroedinger_encode_init(AVCodecContext *avctx) { SchroEncoderParams *p_schro_params = avctx->priv_data; SchroVideoFormatEnum preset; /* Initialize the libraries that libschroedinger depends on. */ schro_init(); /* Create an encoder object. */ p_schro_params->encoder = schro_encoder_new(); if (!p_schro_params->encoder) { av_log(avctx, AV_LOG_ERROR, "Unrecoverable Error: schro_encoder_new failed. "); return -1; } /* Initialize the format. */ preset = ff_get_schro_video_format_preset(avctx); p_schro_params->format = schro_encoder_get_video_format(p_schro_params->encoder); schro_video_format_set_std_video_format(p_schro_params->format, preset); p_schro_params->format->width = avctx->width; p_schro_params->format->height = avctx->height; if (set_chroma_format(avctx) == -1) return -1; if (avctx->color_primaries == AVCOL_PRI_BT709) { p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_HDTV; } else if (avctx->color_primaries == AVCOL_PRI_BT470BG) { p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_SDTV_625; } else if (avctx->color_primaries == AVCOL_PRI_SMPTE170M) { p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_SDTV_525; } if (avctx->colorspace == AVCOL_SPC_BT709) { p_schro_params->format->colour_matrix = SCHRO_COLOUR_MATRIX_HDTV; } else if (avctx->colorspace == AVCOL_SPC_BT470BG) { p_schro_params->format->colour_matrix = SCHRO_COLOUR_MATRIX_SDTV; } if (avctx->color_trc == AVCOL_TRC_BT709) { p_schro_params->format->transfer_function = SCHRO_TRANSFER_CHAR_TV_GAMMA; } if (ff_get_schro_frame_format(p_schro_params->format->chroma_format, &p_schro_params->frame_format) == -1) { av_log(avctx, AV_LOG_ERROR, "This codec currently supports only planar YUV 4:2:0, 4:2:2" " and 4:4:4 formats.\n"); return -1; } p_schro_params->format->frame_rate_numerator = avctx->time_base.den; p_schro_params->format->frame_rate_denominator = avctx->time_base.num; p_schro_params->frame_size = av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1); if (!avctx->gop_size) { schro_encoder_setting_set_double(p_schro_params->encoder, "gop_structure", SCHRO_ENCODER_GOP_INTRA_ONLY); #if FF_API_CODER_TYPE FF_DISABLE_DEPRECATION_WARNINGS if (avctx->coder_type != FF_CODER_TYPE_VLC) p_schro_params->noarith = 0; FF_ENABLE_DEPRECATION_WARNINGS #endif schro_encoder_setting_set_double(p_schro_params->encoder, "enable_noarith", p_schro_params->noarith); } else { schro_encoder_setting_set_double(p_schro_params->encoder, "au_distance", avctx->gop_size); avctx->has_b_frames = 1; p_schro_params->dts = -1; } /* FIXME - Need to handle SCHRO_ENCODER_RATE_CONTROL_LOW_DELAY. */ if (avctx->flags & AV_CODEC_FLAG_QSCALE) { if (!avctx->global_quality) { /* lossless coding */ schro_encoder_setting_set_double(p_schro_params->encoder, "rate_control", SCHRO_ENCODER_RATE_CONTROL_LOSSLESS); } else { int quality; schro_encoder_setting_set_double(p_schro_params->encoder, "rate_control", SCHRO_ENCODER_RATE_CONTROL_CONSTANT_QUALITY); quality = avctx->global_quality / FF_QP2LAMBDA; if (quality > 10) quality = 10; schro_encoder_setting_set_double(p_schro_params->encoder, "quality", quality); } } else { schro_encoder_setting_set_double(p_schro_params->encoder, "rate_control", SCHRO_ENCODER_RATE_CONTROL_CONSTANT_BITRATE); schro_encoder_setting_set_double(p_schro_params->encoder, "bitrate", avctx->bit_rate); } if (avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) /* All material can be coded as interlaced or progressive irrespective of the type of source material. */ schro_encoder_setting_set_double(p_schro_params->encoder, "interlaced_coding", 1); schro_encoder_setting_set_double(p_schro_params->encoder, "open_gop", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)); /* FIXME: Signal range hardcoded to 8-bit data until both libschroedinger * and libdirac support other bit-depth data. */ schro_video_format_set_std_signal_range(p_schro_params->format, SCHRO_SIGNAL_RANGE_8BIT_VIDEO); /* Set the encoder format. */ schro_encoder_set_video_format(p_schro_params->encoder, p_schro_params->format); /* Set the debug level. */ schro_debug_set_level(avctx->debug); schro_encoder_start(p_schro_params->encoder); /* Initialize the encoded frame queue. */ ff_schro_queue_init(&p_schro_params->enc_frame_queue); return 0; }
true
FFmpeg
220b24c7c97dc033ceab1510549f66d0e7b52ef1
static av_cold int libschroedinger_encode_init(AVCodecContext *avctx) { SchroEncoderParams *p_schro_params = avctx->priv_data; SchroVideoFormatEnum preset; schro_init(); p_schro_params->encoder = schro_encoder_new(); if (!p_schro_params->encoder) { av_log(avctx, AV_LOG_ERROR, "Unrecoverable Error: schro_encoder_new failed. "); return -1; } preset = ff_get_schro_video_format_preset(avctx); p_schro_params->format = schro_encoder_get_video_format(p_schro_params->encoder); schro_video_format_set_std_video_format(p_schro_params->format, preset); p_schro_params->format->width = avctx->width; p_schro_params->format->height = avctx->height; if (set_chroma_format(avctx) == -1) return -1; if (avctx->color_primaries == AVCOL_PRI_BT709) { p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_HDTV; } else if (avctx->color_primaries == AVCOL_PRI_BT470BG) { p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_SDTV_625; } else if (avctx->color_primaries == AVCOL_PRI_SMPTE170M) { p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_SDTV_525; } if (avctx->colorspace == AVCOL_SPC_BT709) { p_schro_params->format->colour_matrix = SCHRO_COLOUR_MATRIX_HDTV; } else if (avctx->colorspace == AVCOL_SPC_BT470BG) { p_schro_params->format->colour_matrix = SCHRO_COLOUR_MATRIX_SDTV; } if (avctx->color_trc == AVCOL_TRC_BT709) { p_schro_params->format->transfer_function = SCHRO_TRANSFER_CHAR_TV_GAMMA; } if (ff_get_schro_frame_format(p_schro_params->format->chroma_format, &p_schro_params->frame_format) == -1) { av_log(avctx, AV_LOG_ERROR, "This codec currently supports only planar YUV 4:2:0, 4:2:2" " and 4:4:4 formats.\n"); return -1; } p_schro_params->format->frame_rate_numerator = avctx->time_base.den; p_schro_params->format->frame_rate_denominator = avctx->time_base.num; p_schro_params->frame_size = av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1); if (!avctx->gop_size) { schro_encoder_setting_set_double(p_schro_params->encoder, "gop_structure", SCHRO_ENCODER_GOP_INTRA_ONLY); #if FF_API_CODER_TYPE FF_DISABLE_DEPRECATION_WARNINGS if (avctx->coder_type != FF_CODER_TYPE_VLC) p_schro_params->noarith = 0; FF_ENABLE_DEPRECATION_WARNINGS #endif schro_encoder_setting_set_double(p_schro_params->encoder, "enable_noarith", p_schro_params->noarith); } else { schro_encoder_setting_set_double(p_schro_params->encoder, "au_distance", avctx->gop_size); avctx->has_b_frames = 1; p_schro_params->dts = -1; } if (avctx->flags & AV_CODEC_FLAG_QSCALE) { if (!avctx->global_quality) { schro_encoder_setting_set_double(p_schro_params->encoder, "rate_control", SCHRO_ENCODER_RATE_CONTROL_LOSSLESS); } else { int quality; schro_encoder_setting_set_double(p_schro_params->encoder, "rate_control", SCHRO_ENCODER_RATE_CONTROL_CONSTANT_QUALITY); quality = avctx->global_quality / FF_QP2LAMBDA; if (quality > 10) quality = 10; schro_encoder_setting_set_double(p_schro_params->encoder, "quality", quality); } } else { schro_encoder_setting_set_double(p_schro_params->encoder, "rate_control", SCHRO_ENCODER_RATE_CONTROL_CONSTANT_BITRATE); schro_encoder_setting_set_double(p_schro_params->encoder, "bitrate", avctx->bit_rate); } if (avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) schro_encoder_setting_set_double(p_schro_params->encoder, "interlaced_coding", 1); schro_encoder_setting_set_double(p_schro_params->encoder, "open_gop", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)); schro_video_format_set_std_signal_range(p_schro_params->format, SCHRO_SIGNAL_RANGE_8BIT_VIDEO); schro_encoder_set_video_format(p_schro_params->encoder, p_schro_params->format); schro_debug_set_level(avctx->debug); schro_encoder_start(p_schro_params->encoder); ff_schro_queue_init(&p_schro_params->enc_frame_queue); return 0; }
{ "code": [ " return -1;", " return 0;", " schro_init();", " schro_debug_set_level(avctx->debug);", " return -1;", " return 0;", " if (ff_get_schro_frame_format(p_schro_params->format->chroma_format,", " &p_schro_params->frame_format) == -1) {", " av_log(avctx, AV_LOG_ERROR,", "FF_DISABLE_DEPRECATION_WARNINGS", "FF_ENABLE_DEPRECATION_WARNINGS", "#endif", " } else {", " return 0;", " SchroEncoderParams *p_schro_params = avctx->priv_data;", "static av_cold int libschroedinger_encode_init(AVCodecContext *avctx)", " SchroEncoderParams *p_schro_params = avctx->priv_data;", " SchroVideoFormatEnum preset;", " schro_init();", " p_schro_params->encoder = schro_encoder_new();", " if (!p_schro_params->encoder) {", " av_log(avctx, AV_LOG_ERROR,", " \"Unrecoverable Error: schro_encoder_new failed. \");", " return -1;", " preset = ff_get_schro_video_format_preset(avctx);", " p_schro_params->format =", " schro_encoder_get_video_format(p_schro_params->encoder);", " schro_video_format_set_std_video_format(p_schro_params->format, preset);", " p_schro_params->format->width = avctx->width;", " p_schro_params->format->height = avctx->height;", " if (set_chroma_format(avctx) == -1)", " return -1;", " if (avctx->color_primaries == AVCOL_PRI_BT709) {", " p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_HDTV;", " } else if (avctx->color_primaries == AVCOL_PRI_BT470BG) {", " p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_SDTV_625;", " } else if (avctx->color_primaries == AVCOL_PRI_SMPTE170M) {", " p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_SDTV_525;", " if (avctx->colorspace == AVCOL_SPC_BT709) {", " p_schro_params->format->colour_matrix = SCHRO_COLOUR_MATRIX_HDTV;", " } else if (avctx->colorspace == AVCOL_SPC_BT470BG) {", " p_schro_params->format->colour_matrix = SCHRO_COLOUR_MATRIX_SDTV;", " if (avctx->color_trc == AVCOL_TRC_BT709) {", " p_schro_params->format->transfer_function = SCHRO_TRANSFER_CHAR_TV_GAMMA;", " if (ff_get_schro_frame_format(p_schro_params->format->chroma_format,", " &p_schro_params->frame_format) == -1) {", " av_log(avctx, AV_LOG_ERROR,", " \"This codec currently supports only planar YUV 4:2:0, 4:2:2\"", " \" and 4:4:4 formats.\\n\");", " return -1;", " p_schro_params->format->frame_rate_numerator = avctx->time_base.den;", " p_schro_params->format->frame_rate_denominator = avctx->time_base.num;", " p_schro_params->frame_size = av_image_get_buffer_size(avctx->pix_fmt,", " avctx->width,", " avctx->height, 1);", " if (!avctx->gop_size) {", " schro_encoder_setting_set_double(p_schro_params->encoder,", " \"gop_structure\",", " SCHRO_ENCODER_GOP_INTRA_ONLY);", "#if FF_API_CODER_TYPE", "FF_DISABLE_DEPRECATION_WARNINGS", " if (avctx->coder_type != FF_CODER_TYPE_VLC)", " p_schro_params->noarith = 0;", "FF_ENABLE_DEPRECATION_WARNINGS", "#endif", " schro_encoder_setting_set_double(p_schro_params->encoder,", " \"enable_noarith\",", " p_schro_params->noarith);", " } else {", " schro_encoder_setting_set_double(p_schro_params->encoder,", " \"au_distance\", avctx->gop_size);", " avctx->has_b_frames = 1;", " p_schro_params->dts = -1;", " if (avctx->flags & AV_CODEC_FLAG_QSCALE) {", " if (!avctx->global_quality) {", " schro_encoder_setting_set_double(p_schro_params->encoder,", " \"rate_control\",", " SCHRO_ENCODER_RATE_CONTROL_LOSSLESS);", " } else {", " int quality;", " schro_encoder_setting_set_double(p_schro_params->encoder,", " \"rate_control\",", " SCHRO_ENCODER_RATE_CONTROL_CONSTANT_QUALITY);", " quality = avctx->global_quality / FF_QP2LAMBDA;", " if (quality > 10)", " quality = 10;", " schro_encoder_setting_set_double(p_schro_params->encoder,", " \"quality\", quality);", " } else {", " schro_encoder_setting_set_double(p_schro_params->encoder,", " \"rate_control\",", " SCHRO_ENCODER_RATE_CONTROL_CONSTANT_BITRATE);", " schro_encoder_setting_set_double(p_schro_params->encoder,", " \"bitrate\", avctx->bit_rate);", " if (avctx->flags & AV_CODEC_FLAG_INTERLACED_ME)", " schro_encoder_setting_set_double(p_schro_params->encoder,", " \"interlaced_coding\", 1);", " schro_encoder_setting_set_double(p_schro_params->encoder, \"open_gop\",", " !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP));", " schro_video_format_set_std_signal_range(p_schro_params->format,", " SCHRO_SIGNAL_RANGE_8BIT_VIDEO);", " schro_encoder_set_video_format(p_schro_params->encoder,", " p_schro_params->format);", " schro_debug_set_level(avctx->debug);", " schro_encoder_start(p_schro_params->encoder);", " ff_schro_queue_init(&p_schro_params->enc_frame_queue);", " return 0;", " SchroEncoderParams *p_schro_params = avctx->priv_data;", " SchroEncoderParams *p_schro_params = avctx->priv_data;", " } else {", "FF_DISABLE_DEPRECATION_WARNINGS", "FF_ENABLE_DEPRECATION_WARNINGS", "#endif", " SchroEncoderParams *p_schro_params = avctx->priv_data;", " return 0;" ], "line_no": [ 29, 271, 13, 259, 29, 271, 93, 95, 25, 135, 141, 143, 151, 271, 5, 1, 5, 7, 13, 19, 23, 25, 27, 29, 37, 39, 41, 43, 45, 47, 51, 29, 57, 59, 61, 63, 65, 67, 73, 75, 77, 79, 85, 87, 93, 95, 25, 99, 101, 29, 109, 111, 115, 117, 119, 123, 125, 127, 129, 133, 135, 137, 139, 141, 143, 125, 147, 149, 151, 125, 155, 157, 159, 167, 169, 173, 175, 177, 179, 181, 173, 175, 187, 191, 193, 195, 173, 199, 151, 125, 207, 209, 125, 215, 221, 125, 229, 233, 235, 243, 245, 251, 253, 259, 263, 269, 271, 5, 5, 151, 135, 141, 143, 5, 271 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { SchroEncoderParams *p_schro_params = avctx->priv_data; SchroVideoFormatEnum preset; schro_init(); p_schro_params->encoder = schro_encoder_new(); if (!p_schro_params->encoder) { av_log(avctx, AV_LOG_ERROR, "Unrecoverable Error: schro_encoder_new failed. "); return -1; } preset = ff_get_schro_video_format_preset(avctx); p_schro_params->format = schro_encoder_get_video_format(p_schro_params->encoder); schro_video_format_set_std_video_format(p_schro_params->format, preset); p_schro_params->format->width = avctx->width; p_schro_params->format->height = avctx->height; if (set_chroma_format(avctx) == -1) return -1; if (avctx->color_primaries == AVCOL_PRI_BT709) { p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_HDTV; } else if (avctx->color_primaries == AVCOL_PRI_BT470BG) { p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_SDTV_625; } else if (avctx->color_primaries == AVCOL_PRI_SMPTE170M) { p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_SDTV_525; } if (avctx->colorspace == AVCOL_SPC_BT709) { p_schro_params->format->colour_matrix = SCHRO_COLOUR_MATRIX_HDTV; } else if (avctx->colorspace == AVCOL_SPC_BT470BG) { p_schro_params->format->colour_matrix = SCHRO_COLOUR_MATRIX_SDTV; } if (avctx->color_trc == AVCOL_TRC_BT709) { p_schro_params->format->transfer_function = SCHRO_TRANSFER_CHAR_TV_GAMMA; } if (ff_get_schro_frame_format(p_schro_params->format->chroma_format, &p_schro_params->frame_format) == -1) { av_log(avctx, AV_LOG_ERROR, "This codec currently supports only planar YUV 4:2:0, 4:2:2" " and 4:4:4 formats.\n"); return -1; } p_schro_params->format->frame_rate_numerator = avctx->time_base.den; p_schro_params->format->frame_rate_denominator = avctx->time_base.num; p_schro_params->frame_size = av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1); if (!avctx->gop_size) { schro_encoder_setting_set_double(p_schro_params->encoder, "gop_structure", SCHRO_ENCODER_GOP_INTRA_ONLY); #if FF_API_CODER_TYPE FF_DISABLE_DEPRECATION_WARNINGS if (avctx->coder_type != FF_CODER_TYPE_VLC) p_schro_params->noarith = 0; FF_ENABLE_DEPRECATION_WARNINGS #endif schro_encoder_setting_set_double(p_schro_params->encoder, "enable_noarith", p_schro_params->noarith); } else { schro_encoder_setting_set_double(p_schro_params->encoder, "au_distance", avctx->gop_size); avctx->has_b_frames = 1; p_schro_params->dts = -1; } if (avctx->flags & AV_CODEC_FLAG_QSCALE) { if (!avctx->global_quality) { schro_encoder_setting_set_double(p_schro_params->encoder, "rate_control", SCHRO_ENCODER_RATE_CONTROL_LOSSLESS); } else { int VAR_0; schro_encoder_setting_set_double(p_schro_params->encoder, "rate_control", SCHRO_ENCODER_RATE_CONTROL_CONSTANT_QUALITY); VAR_0 = avctx->global_quality / FF_QP2LAMBDA; if (VAR_0 > 10) VAR_0 = 10; schro_encoder_setting_set_double(p_schro_params->encoder, "VAR_0", VAR_0); } } else { schro_encoder_setting_set_double(p_schro_params->encoder, "rate_control", SCHRO_ENCODER_RATE_CONTROL_CONSTANT_BITRATE); schro_encoder_setting_set_double(p_schro_params->encoder, "bitrate", avctx->bit_rate); } if (avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) schro_encoder_setting_set_double(p_schro_params->encoder, "interlaced_coding", 1); schro_encoder_setting_set_double(p_schro_params->encoder, "open_gop", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)); schro_video_format_set_std_signal_range(p_schro_params->format, SCHRO_SIGNAL_RANGE_8BIT_VIDEO); schro_encoder_set_video_format(p_schro_params->encoder, p_schro_params->format); schro_debug_set_level(avctx->debug); schro_encoder_start(p_schro_params->encoder); ff_schro_queue_init(&p_schro_params->enc_frame_queue); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "SchroEncoderParams *p_schro_params = avctx->priv_data;", "SchroVideoFormatEnum preset;", "schro_init();", "p_schro_params->encoder = schro_encoder_new();", "if (!p_schro_params->encoder) {", "av_log(avctx, AV_LOG_ERROR,\n\"Unrecoverable Error: schro_encoder_new failed. \");", "return -1;", "}", "preset = ff_get_schro_video_format_preset(avctx);", "p_schro_params->format =\nschro_encoder_get_video_format(p_schro_params->encoder);", "schro_video_format_set_std_video_format(p_schro_params->format, preset);", "p_schro_params->format->width = avctx->width;", "p_schro_params->format->height = avctx->height;", "if (set_chroma_format(avctx) == -1)\nreturn -1;", "if (avctx->color_primaries == AVCOL_PRI_BT709) {", "p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_HDTV;", "} else if (avctx->color_primaries == AVCOL_PRI_BT470BG) {", "p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_SDTV_625;", "} else if (avctx->color_primaries == AVCOL_PRI_SMPTE170M) {", "p_schro_params->format->colour_primaries = SCHRO_COLOUR_PRIMARY_SDTV_525;", "}", "if (avctx->colorspace == AVCOL_SPC_BT709) {", "p_schro_params->format->colour_matrix = SCHRO_COLOUR_MATRIX_HDTV;", "} else if (avctx->colorspace == AVCOL_SPC_BT470BG) {", "p_schro_params->format->colour_matrix = SCHRO_COLOUR_MATRIX_SDTV;", "}", "if (avctx->color_trc == AVCOL_TRC_BT709) {", "p_schro_params->format->transfer_function = SCHRO_TRANSFER_CHAR_TV_GAMMA;", "}", "if (ff_get_schro_frame_format(p_schro_params->format->chroma_format,\n&p_schro_params->frame_format) == -1) {", "av_log(avctx, AV_LOG_ERROR,\n\"This codec currently supports only planar YUV 4:2:0, 4:2:2\"\n\" and 4:4:4 formats.\\n\");", "return -1;", "}", "p_schro_params->format->frame_rate_numerator = avctx->time_base.den;", "p_schro_params->format->frame_rate_denominator = avctx->time_base.num;", "p_schro_params->frame_size = av_image_get_buffer_size(avctx->pix_fmt,\navctx->width,\navctx->height, 1);", "if (!avctx->gop_size) {", "schro_encoder_setting_set_double(p_schro_params->encoder,\n\"gop_structure\",\nSCHRO_ENCODER_GOP_INTRA_ONLY);", "#if FF_API_CODER_TYPE\nFF_DISABLE_DEPRECATION_WARNINGS\nif (avctx->coder_type != FF_CODER_TYPE_VLC)\np_schro_params->noarith = 0;", "FF_ENABLE_DEPRECATION_WARNINGS\n#endif\nschro_encoder_setting_set_double(p_schro_params->encoder,\n\"enable_noarith\",\np_schro_params->noarith);", "} else {", "schro_encoder_setting_set_double(p_schro_params->encoder,\n\"au_distance\", avctx->gop_size);", "avctx->has_b_frames = 1;", "p_schro_params->dts = -1;", "}", "if (avctx->flags & AV_CODEC_FLAG_QSCALE) {", "if (!avctx->global_quality) {", "schro_encoder_setting_set_double(p_schro_params->encoder,\n\"rate_control\",\nSCHRO_ENCODER_RATE_CONTROL_LOSSLESS);", "} else {", "int VAR_0;", "schro_encoder_setting_set_double(p_schro_params->encoder,\n\"rate_control\",\nSCHRO_ENCODER_RATE_CONTROL_CONSTANT_QUALITY);", "VAR_0 = avctx->global_quality / FF_QP2LAMBDA;", "if (VAR_0 > 10)\nVAR_0 = 10;", "schro_encoder_setting_set_double(p_schro_params->encoder,\n\"VAR_0\", VAR_0);", "}", "} else {", "schro_encoder_setting_set_double(p_schro_params->encoder,\n\"rate_control\",\nSCHRO_ENCODER_RATE_CONTROL_CONSTANT_BITRATE);", "schro_encoder_setting_set_double(p_schro_params->encoder,\n\"bitrate\", avctx->bit_rate);", "}", "if (avctx->flags & AV_CODEC_FLAG_INTERLACED_ME)\nschro_encoder_setting_set_double(p_schro_params->encoder,\n\"interlaced_coding\", 1);", "schro_encoder_setting_set_double(p_schro_params->encoder, \"open_gop\",\n!(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP));", "schro_video_format_set_std_signal_range(p_schro_params->format,\nSCHRO_SIGNAL_RANGE_8BIT_VIDEO);", "schro_encoder_set_video_format(p_schro_params->encoder,\np_schro_params->format);", "schro_debug_set_level(avctx->debug);", "schro_encoder_start(p_schro_params->encoder);", "ff_schro_queue_init(&p_schro_params->enc_frame_queue);", "return 0;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 93, 95 ], [ 97, 99, 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 115, 117, 119 ], [ 123 ], [ 125, 127, 129 ], [ 133, 135, 137, 139 ], [ 141, 143, 145, 147, 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 167 ], [ 169 ], [ 173, 175, 177 ], [ 179 ], [ 181 ], [ 183, 185, 187 ], [ 191 ], [ 193, 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205, 207, 209 ], [ 213, 215 ], [ 217 ], [ 221, 227, 229 ], [ 233, 235 ], [ 243, 245 ], [ 251, 253 ], [ 259 ], [ 263 ], [ 269 ], [ 271 ], [ 273 ] ]
13,279
static int dca_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int channel_mask; int channel_layout; int lfe_samples; int num_core_channels = 0; int i, ret; float **samples_flt; float *src_chan; float *dst_chan; DCAContext *s = avctx->priv_data; int core_ss_end; int channels, full_channels; float scale; int achan; int chset; int mask; int lavc; int posn; int j, k; int endch; s->xch_present = 0; s->dca_buffer_size = ff_dca_convert_bitstream(buf, buf_size, s->dca_buffer, DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE); if (s->dca_buffer_size == AVERROR_INVALIDDATA) { av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n"); } init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); if ((ret = dca_parse_frame_header(s)) < 0) { //seems like the frame is corrupt, try with the next one return ret; } //set AVCodec values with parsed data avctx->sample_rate = s->sample_rate; avctx->bit_rate = s->bit_rate; s->profile = FF_PROFILE_DTS; for (i = 0; i < (s->sample_blocks / 8); i++) { if ((ret = dca_decode_block(s, 0, i))) { av_log(avctx, AV_LOG_ERROR, "error decoding block\n"); return ret; } } /* record number of core channels incase less than max channels are requested */ num_core_channels = s->prim_channels; if (s->ext_coding) s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr]; else s->core_ext_mask = 0; core_ss_end = FFMIN(s->frame_size, s->dca_buffer_size) * 8; /* only scan for extensions if ext_descr was unknown or indicated a * supported XCh extension */ if (s->core_ext_mask < 0 || s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) { /* if ext_descr was unknown, clear s->core_ext_mask so that the * extensions scan can fill it up */ s->core_ext_mask = FFMAX(s->core_ext_mask, 0); /* extensions start at 32-bit boundaries into bitstream */ skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); while (core_ss_end - get_bits_count(&s->gb) >= 32) { uint32_t bits = get_bits_long(&s->gb, 32); switch (bits) { case 0x5a5a5a5a: { int ext_amode, xch_fsize; s->xch_base_channel = s->prim_channels; /* validate sync word using XCHFSIZE field */ xch_fsize = show_bits(&s->gb, 10); if ((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize) && (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize + 1)) continue; /* skip length-to-end-of-frame field for the moment */ skip_bits(&s->gb, 10); s->core_ext_mask |= DCA_EXT_XCH; /* extension amode(number of channels in extension) should be 1 */ /* AFAIK XCh is not used for more channels */ if ((ext_amode = get_bits(&s->gb, 4)) != 1) { av_log(avctx, AV_LOG_ERROR, "XCh extension amode %d not" " supported!\n", ext_amode); continue; } if (s->xch_base_channel < 2) { av_log_ask_for_sample(avctx, "XCh with fewer than 2 base channels is not supported\n"); continue; } /* much like core primary audio coding header */ dca_parse_audio_coding_header(s, s->xch_base_channel, 0); for (i = 0; i < (s->sample_blocks / 8); i++) if ((ret = dca_decode_block(s, s->xch_base_channel, i))) { av_log(avctx, AV_LOG_ERROR, "error decoding XCh extension\n"); continue; } s->xch_present = 1; break; } case 0x47004a03: /* XXCh: extended channels */ /* usually found either in core or HD part in DTS-HD HRA streams, * but not in DTS-ES which contains XCh extensions instead */ s->core_ext_mask |= DCA_EXT_XXCH; dca_xxch_decode_frame(s); break; case 0x1d95f262: { int fsize96 = show_bits(&s->gb, 12) + 1; if (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + fsize96) continue; av_log(avctx, AV_LOG_DEBUG, "X96 extension found at %d bits\n", get_bits_count(&s->gb)); skip_bits(&s->gb, 12); av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", fsize96); av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4)); s->core_ext_mask |= DCA_EXT_X96; break; } } skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); } } else { /* no supported extensions, skip the rest of the core substream */ skip_bits_long(&s->gb, core_ss_end - get_bits_count(&s->gb)); } if (s->core_ext_mask & DCA_EXT_X96) s->profile = FF_PROFILE_DTS_96_24; else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) s->profile = FF_PROFILE_DTS_ES; /* check for ExSS (HD part) */ if (s->dca_buffer_size - s->frame_size > 32 && get_bits_long(&s->gb, 32) == DCA_HD_MARKER) dca_exss_parse_header(s); avctx->profile = s->profile; full_channels = channels = s->prim_channels + !!s->lfe; /* If we have XXCH then the channel layout is managed differently */ /* note that XLL will also have another way to do things */ if (!(s->core_ext_mask & DCA_EXT_XXCH) || (s->core_ext_mask & DCA_EXT_XXCH && avctx->request_channels > 0 && avctx->request_channels < num_core_channels + !!s->lfe + s->xxch_chset_nch[0])) { /* xxx should also do MA extensions */ if (s->amode < 16) { avctx->channel_layout = dca_core_channel_layout[s->amode]; if (s->xch_present && (!avctx->request_channels || avctx->request_channels > num_core_channels + !!s->lfe)) { avctx->channel_layout |= AV_CH_BACK_CENTER; if (s->lfe) { avctx->channel_layout |= AV_CH_LOW_FREQUENCY; s->channel_order_tab = dca_channel_reorder_lfe_xch[s->amode]; } else { s->channel_order_tab = dca_channel_reorder_nolfe_xch[s->amode]; } } else { channels = num_core_channels + !!s->lfe; s->xch_present = 0; /* disable further xch processing */ if (s->lfe) { avctx->channel_layout |= AV_CH_LOW_FREQUENCY; s->channel_order_tab = dca_channel_reorder_lfe[s->amode]; } else s->channel_order_tab = dca_channel_reorder_nolfe[s->amode]; } if (channels > !!s->lfe && s->channel_order_tab[channels - 1 - !!s->lfe] < 0) if (av_get_channel_layout_nb_channels(avctx->channel_layout) != channels) { av_log(avctx, AV_LOG_ERROR, "Number of channels %d mismatches layout %d\n", channels, av_get_channel_layout_nb_channels(avctx->channel_layout)); } if (avctx->request_channels == 2 && s->prim_channels > 2) { channels = 2; s->output = DCA_STEREO; avctx->channel_layout = AV_CH_LAYOUT_STEREO; } else if (avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE) { static const int8_t dca_channel_order_native[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; s->channel_order_tab = dca_channel_order_native; } s->lfe_index = dca_lfe_index[s->amode]; } else { av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n", s->amode); } s->xxch_dmix_embedded = 0; } else { /* we only get here if an XXCH channel set can be added to the mix */ channel_mask = s->xxch_core_spkmask; if (avctx->request_channels > 0 && avctx->request_channels < s->prim_channels) { channels = num_core_channels + !!s->lfe; for (i = 0; i < s->xxch_chset && channels + s->xxch_chset_nch[i] <= avctx->request_channels; i++) { channels += s->xxch_chset_nch[i]; channel_mask |= s->xxch_spk_masks[i]; } } else { channels = s->prim_channels + !!s->lfe; for (i = 0; i < s->xxch_chset; i++) { channel_mask |= s->xxch_spk_masks[i]; } } /* Given the DTS spec'ed channel mask, generate an avcodec version */ channel_layout = 0; for (i = 0; i < s->xxch_nbits_spk_mask; ++i) { if (channel_mask & (1 << i)) { channel_layout |= map_xxch_to_native[i]; } } /* make sure that we have managed to get equivelant dts/avcodec channel * masks in some sense -- unfortunately some channels could overlap */ if (av_popcount(channel_mask) != av_popcount(channel_layout)) { av_log(avctx, AV_LOG_DEBUG, "DTS-XXCH: Inconsistant avcodec/dts channel layouts\n"); } avctx->channel_layout = channel_layout; if (!(avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE)) { /* Estimate DTS --> avcodec ordering table */ for (chset = -1, j = 0; chset < s->xxch_chset; ++chset) { mask = chset >= 0 ? s->xxch_spk_masks[chset] : s->xxch_core_spkmask; for (i = 0; i < s->xxch_nbits_spk_mask; i++) { if (mask & ~(DCA_XXCH_LFE1 | DCA_XXCH_LFE2) & (1 << i)) { lavc = map_xxch_to_native[i]; posn = av_popcount(channel_layout & (lavc - 1)); s->xxch_order_tab[j++] = posn; } } } s->lfe_index = av_popcount(channel_layout & (AV_CH_LOW_FREQUENCY-1)); } else { /* native ordering */ for (i = 0; i < channels; i++) s->xxch_order_tab[i] = i; s->lfe_index = channels - 1; } s->channel_order_tab = s->xxch_order_tab; } if (avctx->channels != channels) { if (avctx->channels) av_log(avctx, AV_LOG_INFO, "Number of channels changed in DCA decoder (%d -> %d)\n", avctx->channels, channels); avctx->channels = channels; } /* get output buffer */ s->frame.nb_samples = 256 * (s->sample_blocks / 8); if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } samples_flt = (float **) s->frame.extended_data; /* allocate buffer for extra channels if downmixing */ if (avctx->channels < full_channels) { ret = av_samples_get_buffer_size(NULL, full_channels - channels, s->frame.nb_samples, avctx->sample_fmt, 0); if (ret < 0) return ret; av_fast_malloc(&s->extra_channels_buffer, &s->extra_channels_buffer_size, ret); if (!s->extra_channels_buffer) return AVERROR(ENOMEM); ret = av_samples_fill_arrays((uint8_t **)s->extra_channels, NULL, s->extra_channels_buffer, full_channels - channels, s->frame.nb_samples, avctx->sample_fmt, 0); if (ret < 0) return ret; } /* filter to get final output */ for (i = 0; i < (s->sample_blocks / 8); i++) { int ch; for (ch = 0; ch < channels; ch++) s->samples_chanptr[ch] = samples_flt[ch] + i * 256; for (; ch < full_channels; ch++) s->samples_chanptr[ch] = s->extra_channels[ch - channels] + i * 256; dca_filter_channels(s, i); /* If this was marked as a DTS-ES stream we need to subtract back- */ /* channel from SL & SR to remove matrixed back-channel signal */ if ((s->source_pcm_res & 1) && s->xch_present) { float *back_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel]]; float *lt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 2]]; float *rt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 1]]; s->fdsp.vector_fmac_scalar(lt_chan, back_chan, -M_SQRT1_2, 256); s->fdsp.vector_fmac_scalar(rt_chan, back_chan, -M_SQRT1_2, 256); } /* If stream contains XXCH, we might need to undo an embedded downmix */ if (s->xxch_dmix_embedded) { /* Loop over channel sets in turn */ ch = num_core_channels; for (chset = 0; chset < s->xxch_chset; chset++) { endch = ch + s->xxch_chset_nch[chset]; mask = s->xxch_dmix_embedded; /* undo downmix */ for (j = ch; j < endch; j++) { if (mask & (1 << j)) { /* this channel has been mixed-out */ src_chan = s->samples_chanptr[s->channel_order_tab[j]]; for (k = 0; k < endch; k++) { achan = s->channel_order_tab[k]; scale = s->xxch_dmix_coeff[j][k]; if (scale != 0.0) { dst_chan = s->samples_chanptr[achan]; s->fdsp.vector_fmac_scalar(dst_chan, src_chan, -scale, 256); } } } } /* if a downmix has been embedded then undo the pre-scaling */ if ((mask & (1 << ch)) && s->xxch_dmix_sf[chset] != 1.0f) { scale = s->xxch_dmix_sf[chset]; for (j = 0; j < ch; j++) { src_chan = s->samples_chanptr[s->channel_order_tab[j]]; for (k = 0; k < 256; k++) src_chan[k] *= scale; } /* LFE channel is always part of core, scale if it exists */ if (s->lfe) { src_chan = s->samples_chanptr[s->lfe_index]; for (k = 0; k < 256; k++) src_chan[k] *= scale; } } ch = endch; } } } /* update lfe history */ lfe_samples = 2 * s->lfe * (s->sample_blocks / 8); for (i = 0; i < 2 * s->lfe * 4; i++) s->lfe_data[i] = s->lfe_data[i + lfe_samples]; *got_frame_ptr = 1; *(AVFrame *) data = s->frame; return buf_size; }
true
FFmpeg
02d6d053396626ff5b3390e48a9933e0d4164b28
static int dca_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int channel_mask; int channel_layout; int lfe_samples; int num_core_channels = 0; int i, ret; float **samples_flt; float *src_chan; float *dst_chan; DCAContext *s = avctx->priv_data; int core_ss_end; int channels, full_channels; float scale; int achan; int chset; int mask; int lavc; int posn; int j, k; int endch; s->xch_present = 0; s->dca_buffer_size = ff_dca_convert_bitstream(buf, buf_size, s->dca_buffer, DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE); if (s->dca_buffer_size == AVERROR_INVALIDDATA) { av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n"); } init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); if ((ret = dca_parse_frame_header(s)) < 0) { return ret; } avctx->sample_rate = s->sample_rate; avctx->bit_rate = s->bit_rate; s->profile = FF_PROFILE_DTS; for (i = 0; i < (s->sample_blocks / 8); i++) { if ((ret = dca_decode_block(s, 0, i))) { av_log(avctx, AV_LOG_ERROR, "error decoding block\n"); return ret; } } num_core_channels = s->prim_channels; if (s->ext_coding) s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr]; else s->core_ext_mask = 0; core_ss_end = FFMIN(s->frame_size, s->dca_buffer_size) * 8; if (s->core_ext_mask < 0 || s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) { s->core_ext_mask = FFMAX(s->core_ext_mask, 0); skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); while (core_ss_end - get_bits_count(&s->gb) >= 32) { uint32_t bits = get_bits_long(&s->gb, 32); switch (bits) { case 0x5a5a5a5a: { int ext_amode, xch_fsize; s->xch_base_channel = s->prim_channels; xch_fsize = show_bits(&s->gb, 10); if ((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize) && (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize + 1)) continue; skip_bits(&s->gb, 10); s->core_ext_mask |= DCA_EXT_XCH; if ((ext_amode = get_bits(&s->gb, 4)) != 1) { av_log(avctx, AV_LOG_ERROR, "XCh extension amode %d not" " supported!\n", ext_amode); continue; } if (s->xch_base_channel < 2) { av_log_ask_for_sample(avctx, "XCh with fewer than 2 base channels is not supported\n"); continue; } dca_parse_audio_coding_header(s, s->xch_base_channel, 0); for (i = 0; i < (s->sample_blocks / 8); i++) if ((ret = dca_decode_block(s, s->xch_base_channel, i))) { av_log(avctx, AV_LOG_ERROR, "error decoding XCh extension\n"); continue; } s->xch_present = 1; break; } case 0x47004a03: s->core_ext_mask |= DCA_EXT_XXCH; dca_xxch_decode_frame(s); break; case 0x1d95f262: { int fsize96 = show_bits(&s->gb, 12) + 1; if (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + fsize96) continue; av_log(avctx, AV_LOG_DEBUG, "X96 extension found at %d bits\n", get_bits_count(&s->gb)); skip_bits(&s->gb, 12); av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", fsize96); av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4)); s->core_ext_mask |= DCA_EXT_X96; break; } } skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); } } else { skip_bits_long(&s->gb, core_ss_end - get_bits_count(&s->gb)); } if (s->core_ext_mask & DCA_EXT_X96) s->profile = FF_PROFILE_DTS_96_24; else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) s->profile = FF_PROFILE_DTS_ES; if (s->dca_buffer_size - s->frame_size > 32 && get_bits_long(&s->gb, 32) == DCA_HD_MARKER) dca_exss_parse_header(s); avctx->profile = s->profile; full_channels = channels = s->prim_channels + !!s->lfe; if (!(s->core_ext_mask & DCA_EXT_XXCH) || (s->core_ext_mask & DCA_EXT_XXCH && avctx->request_channels > 0 && avctx->request_channels < num_core_channels + !!s->lfe + s->xxch_chset_nch[0])) { if (s->amode < 16) { avctx->channel_layout = dca_core_channel_layout[s->amode]; if (s->xch_present && (!avctx->request_channels || avctx->request_channels > num_core_channels + !!s->lfe)) { avctx->channel_layout |= AV_CH_BACK_CENTER; if (s->lfe) { avctx->channel_layout |= AV_CH_LOW_FREQUENCY; s->channel_order_tab = dca_channel_reorder_lfe_xch[s->amode]; } else { s->channel_order_tab = dca_channel_reorder_nolfe_xch[s->amode]; } } else { channels = num_core_channels + !!s->lfe; s->xch_present = 0; if (s->lfe) { avctx->channel_layout |= AV_CH_LOW_FREQUENCY; s->channel_order_tab = dca_channel_reorder_lfe[s->amode]; } else s->channel_order_tab = dca_channel_reorder_nolfe[s->amode]; } if (channels > !!s->lfe && s->channel_order_tab[channels - 1 - !!s->lfe] < 0) if (av_get_channel_layout_nb_channels(avctx->channel_layout) != channels) { av_log(avctx, AV_LOG_ERROR, "Number of channels %d mismatches layout %d\n", channels, av_get_channel_layout_nb_channels(avctx->channel_layout)); } if (avctx->request_channels == 2 && s->prim_channels > 2) { channels = 2; s->output = DCA_STEREO; avctx->channel_layout = AV_CH_LAYOUT_STEREO; } else if (avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE) { static const int8_t dca_channel_order_native[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; s->channel_order_tab = dca_channel_order_native; } s->lfe_index = dca_lfe_index[s->amode]; } else { av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n", s->amode); } s->xxch_dmix_embedded = 0; } else { channel_mask = s->xxch_core_spkmask; if (avctx->request_channels > 0 && avctx->request_channels < s->prim_channels) { channels = num_core_channels + !!s->lfe; for (i = 0; i < s->xxch_chset && channels + s->xxch_chset_nch[i] <= avctx->request_channels; i++) { channels += s->xxch_chset_nch[i]; channel_mask |= s->xxch_spk_masks[i]; } } else { channels = s->prim_channels + !!s->lfe; for (i = 0; i < s->xxch_chset; i++) { channel_mask |= s->xxch_spk_masks[i]; } } channel_layout = 0; for (i = 0; i < s->xxch_nbits_spk_mask; ++i) { if (channel_mask & (1 << i)) { channel_layout |= map_xxch_to_native[i]; } } if (av_popcount(channel_mask) != av_popcount(channel_layout)) { av_log(avctx, AV_LOG_DEBUG, "DTS-XXCH: Inconsistant avcodec/dts channel layouts\n"); } avctx->channel_layout = channel_layout; if (!(avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE)) { for (chset = -1, j = 0; chset < s->xxch_chset; ++chset) { mask = chset >= 0 ? s->xxch_spk_masks[chset] : s->xxch_core_spkmask; for (i = 0; i < s->xxch_nbits_spk_mask; i++) { if (mask & ~(DCA_XXCH_LFE1 | DCA_XXCH_LFE2) & (1 << i)) { lavc = map_xxch_to_native[i]; posn = av_popcount(channel_layout & (lavc - 1)); s->xxch_order_tab[j++] = posn; } } } s->lfe_index = av_popcount(channel_layout & (AV_CH_LOW_FREQUENCY-1)); } else { for (i = 0; i < channels; i++) s->xxch_order_tab[i] = i; s->lfe_index = channels - 1; } s->channel_order_tab = s->xxch_order_tab; } if (avctx->channels != channels) { if (avctx->channels) av_log(avctx, AV_LOG_INFO, "Number of channels changed in DCA decoder (%d -> %d)\n", avctx->channels, channels); avctx->channels = channels; } s->frame.nb_samples = 256 * (s->sample_blocks / 8); if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } samples_flt = (float **) s->frame.extended_data; if (avctx->channels < full_channels) { ret = av_samples_get_buffer_size(NULL, full_channels - channels, s->frame.nb_samples, avctx->sample_fmt, 0); if (ret < 0) return ret; av_fast_malloc(&s->extra_channels_buffer, &s->extra_channels_buffer_size, ret); if (!s->extra_channels_buffer) return AVERROR(ENOMEM); ret = av_samples_fill_arrays((uint8_t **)s->extra_channels, NULL, s->extra_channels_buffer, full_channels - channels, s->frame.nb_samples, avctx->sample_fmt, 0); if (ret < 0) return ret; } for (i = 0; i < (s->sample_blocks / 8); i++) { int ch; for (ch = 0; ch < channels; ch++) s->samples_chanptr[ch] = samples_flt[ch] + i * 256; for (; ch < full_channels; ch++) s->samples_chanptr[ch] = s->extra_channels[ch - channels] + i * 256; dca_filter_channels(s, i); if ((s->source_pcm_res & 1) && s->xch_present) { float *back_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel]]; float *lt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 2]]; float *rt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 1]]; s->fdsp.vector_fmac_scalar(lt_chan, back_chan, -M_SQRT1_2, 256); s->fdsp.vector_fmac_scalar(rt_chan, back_chan, -M_SQRT1_2, 256); } if (s->xxch_dmix_embedded) { ch = num_core_channels; for (chset = 0; chset < s->xxch_chset; chset++) { endch = ch + s->xxch_chset_nch[chset]; mask = s->xxch_dmix_embedded; for (j = ch; j < endch; j++) { if (mask & (1 << j)) { src_chan = s->samples_chanptr[s->channel_order_tab[j]]; for (k = 0; k < endch; k++) { achan = s->channel_order_tab[k]; scale = s->xxch_dmix_coeff[j][k]; if (scale != 0.0) { dst_chan = s->samples_chanptr[achan]; s->fdsp.vector_fmac_scalar(dst_chan, src_chan, -scale, 256); } } } } if ((mask & (1 << ch)) && s->xxch_dmix_sf[chset] != 1.0f) { scale = s->xxch_dmix_sf[chset]; for (j = 0; j < ch; j++) { src_chan = s->samples_chanptr[s->channel_order_tab[j]]; for (k = 0; k < 256; k++) src_chan[k] *= scale; } if (s->lfe) { src_chan = s->samples_chanptr[s->lfe_index]; for (k = 0; k < 256; k++) src_chan[k] *= scale; } } ch = endch; } } } lfe_samples = 2 * s->lfe * (s->sample_blocks / 8); for (i = 0; i < 2 * s->lfe * 4; i++) s->lfe_data[i] = s->lfe_data[i + lfe_samples]; *got_frame_ptr = 1; *(AVFrame *) data = s->frame; return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; int VAR_6; int VAR_7; int VAR_8; int VAR_9 = 0; int VAR_10, VAR_11; float **VAR_12; float *VAR_13; float *VAR_14; DCAContext *s = VAR_0->priv_data; int VAR_15; int VAR_16, VAR_17; float VAR_18; int VAR_19; int VAR_20; int VAR_21; int VAR_22; int VAR_23; int VAR_24, VAR_25; int VAR_26; s->xch_present = 0; s->dca_buffer_size = ff_dca_convert_bitstream(VAR_4, VAR_5, s->dca_buffer, DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE); if (s->dca_buffer_size == AVERROR_INVALIDDATA) { av_log(VAR_0, AV_LOG_ERROR, "Not a valid DCA frame\n"); } init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); if ((VAR_11 = dca_parse_frame_header(s)) < 0) { return VAR_11; } VAR_0->sample_rate = s->sample_rate; VAR_0->bit_rate = s->bit_rate; s->profile = FF_PROFILE_DTS; for (VAR_10 = 0; VAR_10 < (s->sample_blocks / 8); VAR_10++) { if ((VAR_11 = dca_decode_block(s, 0, VAR_10))) { av_log(VAR_0, AV_LOG_ERROR, "error decoding block\n"); return VAR_11; } } VAR_9 = s->prim_channels; if (s->ext_coding) s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr]; else s->core_ext_mask = 0; VAR_15 = FFMIN(s->frame_size, s->dca_buffer_size) * 8; if (s->core_ext_mask < 0 || s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) { s->core_ext_mask = FFMAX(s->core_ext_mask, 0); skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); while (VAR_15 - get_bits_count(&s->gb) >= 32) { uint32_t bits = get_bits_long(&s->gb, 32); switch (bits) { case 0x5a5a5a5a: { int VAR_27, VAR_28; s->xch_base_channel = s->prim_channels; VAR_28 = show_bits(&s->gb, 10); if ((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + VAR_28) && (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + VAR_28 + 1)) continue; skip_bits(&s->gb, 10); s->core_ext_mask |= DCA_EXT_XCH; if ((VAR_27 = get_bits(&s->gb, 4)) != 1) { av_log(VAR_0, AV_LOG_ERROR, "XCh extension amode %d not" " supported!\n", VAR_27); continue; } if (s->xch_base_channel < 2) { av_log_ask_for_sample(VAR_0, "XCh with fewer than 2 base VAR_16 is not supported\n"); continue; } dca_parse_audio_coding_header(s, s->xch_base_channel, 0); for (VAR_10 = 0; VAR_10 < (s->sample_blocks / 8); VAR_10++) if ((VAR_11 = dca_decode_block(s, s->xch_base_channel, VAR_10))) { av_log(VAR_0, AV_LOG_ERROR, "error decoding XCh extension\n"); continue; } s->xch_present = 1; break; } case 0x47004a03: s->core_ext_mask |= DCA_EXT_XXCH; dca_xxch_decode_frame(s); break; case 0x1d95f262: { int VAR_29 = show_bits(&s->gb, 12) + 1; if (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + VAR_29) continue; av_log(VAR_0, AV_LOG_DEBUG, "X96 extension found at %d bits\n", get_bits_count(&s->gb)); skip_bits(&s->gb, 12); av_log(VAR_0, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", VAR_29); av_log(VAR_0, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4)); s->core_ext_mask |= DCA_EXT_X96; break; } } skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); } } else { skip_bits_long(&s->gb, VAR_15 - get_bits_count(&s->gb)); } if (s->core_ext_mask & DCA_EXT_X96) s->profile = FF_PROFILE_DTS_96_24; else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) s->profile = FF_PROFILE_DTS_ES; if (s->dca_buffer_size - s->frame_size > 32 && get_bits_long(&s->gb, 32) == DCA_HD_MARKER) dca_exss_parse_header(s); VAR_0->profile = s->profile; VAR_17 = VAR_16 = s->prim_channels + !!s->lfe; if (!(s->core_ext_mask & DCA_EXT_XXCH) || (s->core_ext_mask & DCA_EXT_XXCH && VAR_0->request_channels > 0 && VAR_0->request_channels < VAR_9 + !!s->lfe + s->xxch_chset_nch[0])) { if (s->amode < 16) { VAR_0->VAR_7 = dca_core_channel_layout[s->amode]; if (s->xch_present && (!VAR_0->request_channels || VAR_0->request_channels > VAR_9 + !!s->lfe)) { VAR_0->VAR_7 |= AV_CH_BACK_CENTER; if (s->lfe) { VAR_0->VAR_7 |= AV_CH_LOW_FREQUENCY; s->channel_order_tab = dca_channel_reorder_lfe_xch[s->amode]; } else { s->channel_order_tab = dca_channel_reorder_nolfe_xch[s->amode]; } } else { VAR_16 = VAR_9 + !!s->lfe; s->xch_present = 0; if (s->lfe) { VAR_0->VAR_7 |= AV_CH_LOW_FREQUENCY; s->channel_order_tab = dca_channel_reorder_lfe[s->amode]; } else s->channel_order_tab = dca_channel_reorder_nolfe[s->amode]; } if (VAR_16 > !!s->lfe && s->channel_order_tab[VAR_16 - 1 - !!s->lfe] < 0) if (av_get_channel_layout_nb_channels(VAR_0->VAR_7) != VAR_16) { av_log(VAR_0, AV_LOG_ERROR, "Number of VAR_16 %d mismatches layout %d\n", VAR_16, av_get_channel_layout_nb_channels(VAR_0->VAR_7)); } if (VAR_0->request_channels == 2 && s->prim_channels > 2) { VAR_16 = 2; s->output = DCA_STEREO; VAR_0->VAR_7 = AV_CH_LAYOUT_STEREO; } else if (VAR_0->request_channel_layout & AV_CH_LAYOUT_NATIVE) { static const int8_t VAR_30[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; s->channel_order_tab = VAR_30; } s->lfe_index = dca_lfe_index[s->amode]; } else { av_log(VAR_0, AV_LOG_ERROR, "Non standard configuration %d !\n", s->amode); } s->xxch_dmix_embedded = 0; } else { VAR_6 = s->xxch_core_spkmask; if (VAR_0->request_channels > 0 && VAR_0->request_channels < s->prim_channels) { VAR_16 = VAR_9 + !!s->lfe; for (VAR_10 = 0; VAR_10 < s->xxch_chset && VAR_16 + s->xxch_chset_nch[VAR_10] <= VAR_0->request_channels; VAR_10++) { VAR_16 += s->xxch_chset_nch[VAR_10]; VAR_6 |= s->xxch_spk_masks[VAR_10]; } } else { VAR_16 = s->prim_channels + !!s->lfe; for (VAR_10 = 0; VAR_10 < s->xxch_chset; VAR_10++) { VAR_6 |= s->xxch_spk_masks[VAR_10]; } } VAR_7 = 0; for (VAR_10 = 0; VAR_10 < s->xxch_nbits_spk_mask; ++VAR_10) { if (VAR_6 & (1 << VAR_10)) { VAR_7 |= map_xxch_to_native[VAR_10]; } } if (av_popcount(VAR_6) != av_popcount(VAR_7)) { av_log(VAR_0, AV_LOG_DEBUG, "DTS-XXCH: Inconsistant avcodec/dts channel layouts\n"); } VAR_0->VAR_7 = VAR_7; if (!(VAR_0->request_channel_layout & AV_CH_LAYOUT_NATIVE)) { for (VAR_20 = -1, VAR_24 = 0; VAR_20 < s->xxch_chset; ++VAR_20) { VAR_21 = VAR_20 >= 0 ? s->xxch_spk_masks[VAR_20] : s->xxch_core_spkmask; for (VAR_10 = 0; VAR_10 < s->xxch_nbits_spk_mask; VAR_10++) { if (VAR_21 & ~(DCA_XXCH_LFE1 | DCA_XXCH_LFE2) & (1 << VAR_10)) { VAR_22 = map_xxch_to_native[VAR_10]; VAR_23 = av_popcount(VAR_7 & (VAR_22 - 1)); s->xxch_order_tab[VAR_24++] = VAR_23; } } } s->lfe_index = av_popcount(VAR_7 & (AV_CH_LOW_FREQUENCY-1)); } else { for (VAR_10 = 0; VAR_10 < VAR_16; VAR_10++) s->xxch_order_tab[VAR_10] = VAR_10; s->lfe_index = VAR_16 - 1; } s->channel_order_tab = s->xxch_order_tab; } if (VAR_0->VAR_16 != VAR_16) { if (VAR_0->VAR_16) av_log(VAR_0, AV_LOG_INFO, "Number of VAR_16 changed in DCA decoder (%d -> %d)\n", VAR_0->VAR_16, VAR_16); VAR_0->VAR_16 = VAR_16; } s->frame.nb_samples = 256 * (s->sample_blocks / 8); if ((VAR_11 = ff_get_buffer(VAR_0, &s->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_11; } VAR_12 = (float **) s->frame.extended_data; if (VAR_0->VAR_16 < VAR_17) { VAR_11 = av_samples_get_buffer_size(NULL, VAR_17 - VAR_16, s->frame.nb_samples, VAR_0->sample_fmt, 0); if (VAR_11 < 0) return VAR_11; av_fast_malloc(&s->extra_channels_buffer, &s->extra_channels_buffer_size, VAR_11); if (!s->extra_channels_buffer) return AVERROR(ENOMEM); VAR_11 = av_samples_fill_arrays((uint8_t **)s->extra_channels, NULL, s->extra_channels_buffer, VAR_17 - VAR_16, s->frame.nb_samples, VAR_0->sample_fmt, 0); if (VAR_11 < 0) return VAR_11; } for (VAR_10 = 0; VAR_10 < (s->sample_blocks / 8); VAR_10++) { int ch; for (ch = 0; ch < VAR_16; ch++) s->samples_chanptr[ch] = VAR_12[ch] + VAR_10 * 256; for (; ch < VAR_17; ch++) s->samples_chanptr[ch] = s->extra_channels[ch - VAR_16] + VAR_10 * 256; dca_filter_channels(s, VAR_10); if ((s->source_pcm_res & 1) && s->xch_present) { float *back_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel]]; float *lt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 2]]; float *rt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 1]]; s->fdsp.vector_fmac_scalar(lt_chan, back_chan, -M_SQRT1_2, 256); s->fdsp.vector_fmac_scalar(rt_chan, back_chan, -M_SQRT1_2, 256); } if (s->xxch_dmix_embedded) { ch = VAR_9; for (VAR_20 = 0; VAR_20 < s->xxch_chset; VAR_20++) { VAR_26 = ch + s->xxch_chset_nch[VAR_20]; VAR_21 = s->xxch_dmix_embedded; for (VAR_24 = ch; VAR_24 < VAR_26; VAR_24++) { if (VAR_21 & (1 << VAR_24)) { VAR_13 = s->samples_chanptr[s->channel_order_tab[VAR_24]]; for (VAR_25 = 0; VAR_25 < VAR_26; VAR_25++) { VAR_19 = s->channel_order_tab[VAR_25]; VAR_18 = s->xxch_dmix_coeff[VAR_24][VAR_25]; if (VAR_18 != 0.0) { VAR_14 = s->samples_chanptr[VAR_19]; s->fdsp.vector_fmac_scalar(VAR_14, VAR_13, -VAR_18, 256); } } } } if ((VAR_21 & (1 << ch)) && s->xxch_dmix_sf[VAR_20] != 1.0f) { VAR_18 = s->xxch_dmix_sf[VAR_20]; for (VAR_24 = 0; VAR_24 < ch; VAR_24++) { VAR_13 = s->samples_chanptr[s->channel_order_tab[VAR_24]]; for (VAR_25 = 0; VAR_25 < 256; VAR_25++) VAR_13[VAR_25] *= VAR_18; } if (s->lfe) { VAR_13 = s->samples_chanptr[s->lfe_index]; for (VAR_25 = 0; VAR_25 < 256; VAR_25++) VAR_13[VAR_25] *= VAR_18; } } ch = VAR_26; } } } VAR_8 = 2 * s->lfe * (s->sample_blocks / 8); for (VAR_10 = 0; VAR_10 < 2 * s->lfe * 4; VAR_10++) s->lfe_data[VAR_10] = s->lfe_data[VAR_10 + VAR_8]; *VAR_2 = 1; *(AVFrame *) VAR_1 = s->frame; return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "int VAR_6;", "int VAR_7;", "int VAR_8;", "int VAR_9 = 0;", "int VAR_10, VAR_11;", "float **VAR_12;", "float *VAR_13;", "float *VAR_14;", "DCAContext *s = VAR_0->priv_data;", "int VAR_15;", "int VAR_16, VAR_17;", "float VAR_18;", "int VAR_19;", "int VAR_20;", "int VAR_21;", "int VAR_22;", "int VAR_23;", "int VAR_24, VAR_25;", "int VAR_26;", "s->xch_present = 0;", "s->dca_buffer_size = ff_dca_convert_bitstream(VAR_4, VAR_5, s->dca_buffer,\nDCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE);", "if (s->dca_buffer_size == AVERROR_INVALIDDATA) {", "av_log(VAR_0, AV_LOG_ERROR, \"Not a valid DCA frame\\n\");", "}", "init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8);", "if ((VAR_11 = dca_parse_frame_header(s)) < 0) {", "return VAR_11;", "}", "VAR_0->sample_rate = s->sample_rate;", "VAR_0->bit_rate = s->bit_rate;", "s->profile = FF_PROFILE_DTS;", "for (VAR_10 = 0; VAR_10 < (s->sample_blocks / 8); VAR_10++) {", "if ((VAR_11 = dca_decode_block(s, 0, VAR_10))) {", "av_log(VAR_0, AV_LOG_ERROR, \"error decoding block\\n\");", "return VAR_11;", "}", "}", "VAR_9 = s->prim_channels;", "if (s->ext_coding)\ns->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr];", "else\ns->core_ext_mask = 0;", "VAR_15 = FFMIN(s->frame_size, s->dca_buffer_size) * 8;", "if (s->core_ext_mask < 0 || s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) {", "s->core_ext_mask = FFMAX(s->core_ext_mask, 0);", "skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);", "while (VAR_15 - get_bits_count(&s->gb) >= 32) {", "uint32_t bits = get_bits_long(&s->gb, 32);", "switch (bits) {", "case 0x5a5a5a5a: {", "int VAR_27, VAR_28;", "s->xch_base_channel = s->prim_channels;", "VAR_28 = show_bits(&s->gb, 10);", "if ((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + VAR_28) &&\n(s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + VAR_28 + 1))\ncontinue;", "skip_bits(&s->gb, 10);", "s->core_ext_mask |= DCA_EXT_XCH;", "if ((VAR_27 = get_bits(&s->gb, 4)) != 1) {", "av_log(VAR_0, AV_LOG_ERROR, \"XCh extension amode %d not\"\n\" supported!\\n\", VAR_27);", "continue;", "}", "if (s->xch_base_channel < 2) {", "av_log_ask_for_sample(VAR_0, \"XCh with fewer than 2 base VAR_16 is not supported\\n\");", "continue;", "}", "dca_parse_audio_coding_header(s, s->xch_base_channel, 0);", "for (VAR_10 = 0; VAR_10 < (s->sample_blocks / 8); VAR_10++)", "if ((VAR_11 = dca_decode_block(s, s->xch_base_channel, VAR_10))) {", "av_log(VAR_0, AV_LOG_ERROR, \"error decoding XCh extension\\n\");", "continue;", "}", "s->xch_present = 1;", "break;", "}", "case 0x47004a03:\ns->core_ext_mask |= DCA_EXT_XXCH;", "dca_xxch_decode_frame(s);", "break;", "case 0x1d95f262: {", "int VAR_29 = show_bits(&s->gb, 12) + 1;", "if (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + VAR_29)\ncontinue;", "av_log(VAR_0, AV_LOG_DEBUG, \"X96 extension found at %d bits\\n\",\nget_bits_count(&s->gb));", "skip_bits(&s->gb, 12);", "av_log(VAR_0, AV_LOG_DEBUG, \"FSIZE96 = %d bytes\\n\", VAR_29);", "av_log(VAR_0, AV_LOG_DEBUG, \"REVNO = %d\\n\", get_bits(&s->gb, 4));", "s->core_ext_mask |= DCA_EXT_X96;", "break;", "}", "}", "skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);", "}", "} else {", "skip_bits_long(&s->gb, VAR_15 - get_bits_count(&s->gb));", "}", "if (s->core_ext_mask & DCA_EXT_X96)\ns->profile = FF_PROFILE_DTS_96_24;", "else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH))\ns->profile = FF_PROFILE_DTS_ES;", "if (s->dca_buffer_size - s->frame_size > 32 &&\nget_bits_long(&s->gb, 32) == DCA_HD_MARKER)\ndca_exss_parse_header(s);", "VAR_0->profile = s->profile;", "VAR_17 = VAR_16 = s->prim_channels + !!s->lfe;", "if (!(s->core_ext_mask & DCA_EXT_XXCH)\n|| (s->core_ext_mask & DCA_EXT_XXCH && VAR_0->request_channels > 0\n&& VAR_0->request_channels\n< VAR_9 + !!s->lfe + s->xxch_chset_nch[0]))\n{", "if (s->amode < 16) {", "VAR_0->VAR_7 = dca_core_channel_layout[s->amode];", "if (s->xch_present && (!VAR_0->request_channels ||\nVAR_0->request_channels\n> VAR_9 + !!s->lfe)) {", "VAR_0->VAR_7 |= AV_CH_BACK_CENTER;", "if (s->lfe) {", "VAR_0->VAR_7 |= AV_CH_LOW_FREQUENCY;", "s->channel_order_tab = dca_channel_reorder_lfe_xch[s->amode];", "} else {", "s->channel_order_tab = dca_channel_reorder_nolfe_xch[s->amode];", "}", "} else {", "VAR_16 = VAR_9 + !!s->lfe;", "s->xch_present = 0;", "if (s->lfe) {", "VAR_0->VAR_7 |= AV_CH_LOW_FREQUENCY;", "s->channel_order_tab = dca_channel_reorder_lfe[s->amode];", "} else", "s->channel_order_tab = dca_channel_reorder_nolfe[s->amode];", "}", "if (VAR_16 > !!s->lfe &&\ns->channel_order_tab[VAR_16 - 1 - !!s->lfe] < 0)\nif (av_get_channel_layout_nb_channels(VAR_0->VAR_7) != VAR_16) {", "av_log(VAR_0, AV_LOG_ERROR, \"Number of VAR_16 %d mismatches layout %d\\n\", VAR_16, av_get_channel_layout_nb_channels(VAR_0->VAR_7));", "}", "if (VAR_0->request_channels == 2 && s->prim_channels > 2) {", "VAR_16 = 2;", "s->output = DCA_STEREO;", "VAR_0->VAR_7 = AV_CH_LAYOUT_STEREO;", "}", "else if (VAR_0->request_channel_layout & AV_CH_LAYOUT_NATIVE) {", "static const int8_t VAR_30[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };", "s->channel_order_tab = VAR_30;", "}", "s->lfe_index = dca_lfe_index[s->amode];", "} else {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Non standard configuration %d !\\n\", s->amode);", "}", "s->xxch_dmix_embedded = 0;", "} else {", "VAR_6 = s->xxch_core_spkmask;", "if (VAR_0->request_channels > 0\n&& VAR_0->request_channels < s->prim_channels) {", "VAR_16 = VAR_9 + !!s->lfe;", "for (VAR_10 = 0; VAR_10 < s->xxch_chset && VAR_16 + s->xxch_chset_nch[VAR_10]", "<= VAR_0->request_channels; VAR_10++) {", "VAR_16 += s->xxch_chset_nch[VAR_10];", "VAR_6 |= s->xxch_spk_masks[VAR_10];", "}", "} else {", "VAR_16 = s->prim_channels + !!s->lfe;", "for (VAR_10 = 0; VAR_10 < s->xxch_chset; VAR_10++) {", "VAR_6 |= s->xxch_spk_masks[VAR_10];", "}", "}", "VAR_7 = 0;", "for (VAR_10 = 0; VAR_10 < s->xxch_nbits_spk_mask; ++VAR_10) {", "if (VAR_6 & (1 << VAR_10)) {", "VAR_7 |= map_xxch_to_native[VAR_10];", "}", "}", "if (av_popcount(VAR_6) != av_popcount(VAR_7)) {", "av_log(VAR_0, AV_LOG_DEBUG,\n\"DTS-XXCH: Inconsistant avcodec/dts channel layouts\\n\");", "}", "VAR_0->VAR_7 = VAR_7;", "if (!(VAR_0->request_channel_layout & AV_CH_LAYOUT_NATIVE)) {", "for (VAR_20 = -1, VAR_24 = 0; VAR_20 < s->xxch_chset; ++VAR_20) {", "VAR_21 = VAR_20 >= 0 ? s->xxch_spk_masks[VAR_20]\n: s->xxch_core_spkmask;", "for (VAR_10 = 0; VAR_10 < s->xxch_nbits_spk_mask; VAR_10++) {", "if (VAR_21 & ~(DCA_XXCH_LFE1 | DCA_XXCH_LFE2) & (1 << VAR_10)) {", "VAR_22 = map_xxch_to_native[VAR_10];", "VAR_23 = av_popcount(VAR_7 & (VAR_22 - 1));", "s->xxch_order_tab[VAR_24++] = VAR_23;", "}", "}", "}", "s->lfe_index = av_popcount(VAR_7 & (AV_CH_LOW_FREQUENCY-1));", "} else {", "for (VAR_10 = 0; VAR_10 < VAR_16; VAR_10++)", "s->xxch_order_tab[VAR_10] = VAR_10;", "s->lfe_index = VAR_16 - 1;", "}", "s->channel_order_tab = s->xxch_order_tab;", "}", "if (VAR_0->VAR_16 != VAR_16) {", "if (VAR_0->VAR_16)\nav_log(VAR_0, AV_LOG_INFO, \"Number of VAR_16 changed in DCA decoder (%d -> %d)\\n\", VAR_0->VAR_16, VAR_16);", "VAR_0->VAR_16 = VAR_16;", "}", "s->frame.nb_samples = 256 * (s->sample_blocks / 8);", "if ((VAR_11 = ff_get_buffer(VAR_0, &s->frame)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return VAR_11;", "}", "VAR_12 = (float **) s->frame.extended_data;", "if (VAR_0->VAR_16 < VAR_17) {", "VAR_11 = av_samples_get_buffer_size(NULL, VAR_17 - VAR_16,\ns->frame.nb_samples,\nVAR_0->sample_fmt, 0);", "if (VAR_11 < 0)\nreturn VAR_11;", "av_fast_malloc(&s->extra_channels_buffer,\n&s->extra_channels_buffer_size, VAR_11);", "if (!s->extra_channels_buffer)\nreturn AVERROR(ENOMEM);", "VAR_11 = av_samples_fill_arrays((uint8_t **)s->extra_channels, NULL,\ns->extra_channels_buffer,\nVAR_17 - VAR_16,\ns->frame.nb_samples, VAR_0->sample_fmt, 0);", "if (VAR_11 < 0)\nreturn VAR_11;", "}", "for (VAR_10 = 0; VAR_10 < (s->sample_blocks / 8); VAR_10++) {", "int ch;", "for (ch = 0; ch < VAR_16; ch++)", "s->samples_chanptr[ch] = VAR_12[ch] + VAR_10 * 256;", "for (; ch < VAR_17; ch++)", "s->samples_chanptr[ch] = s->extra_channels[ch - VAR_16] + VAR_10 * 256;", "dca_filter_channels(s, VAR_10);", "if ((s->source_pcm_res & 1) && s->xch_present) {", "float *back_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel]];", "float *lt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 2]];", "float *rt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 1]];", "s->fdsp.vector_fmac_scalar(lt_chan, back_chan, -M_SQRT1_2, 256);", "s->fdsp.vector_fmac_scalar(rt_chan, back_chan, -M_SQRT1_2, 256);", "}", "if (s->xxch_dmix_embedded) {", "ch = VAR_9;", "for (VAR_20 = 0; VAR_20 < s->xxch_chset; VAR_20++) {", "VAR_26 = ch + s->xxch_chset_nch[VAR_20];", "VAR_21 = s->xxch_dmix_embedded;", "for (VAR_24 = ch; VAR_24 < VAR_26; VAR_24++) {", "if (VAR_21 & (1 << VAR_24)) {", "VAR_13 = s->samples_chanptr[s->channel_order_tab[VAR_24]];", "for (VAR_25 = 0; VAR_25 < VAR_26; VAR_25++) {", "VAR_19 = s->channel_order_tab[VAR_25];", "VAR_18 = s->xxch_dmix_coeff[VAR_24][VAR_25];", "if (VAR_18 != 0.0) {", "VAR_14 = s->samples_chanptr[VAR_19];", "s->fdsp.vector_fmac_scalar(VAR_14, VAR_13,\n-VAR_18, 256);", "}", "}", "}", "}", "if ((VAR_21 & (1 << ch)) && s->xxch_dmix_sf[VAR_20] != 1.0f) {", "VAR_18 = s->xxch_dmix_sf[VAR_20];", "for (VAR_24 = 0; VAR_24 < ch; VAR_24++) {", "VAR_13 = s->samples_chanptr[s->channel_order_tab[VAR_24]];", "for (VAR_25 = 0; VAR_25 < 256; VAR_25++)", "VAR_13[VAR_25] *= VAR_18;", "}", "if (s->lfe) {", "VAR_13 = s->samples_chanptr[s->lfe_index];", "for (VAR_25 = 0; VAR_25 < 256; VAR_25++)", "VAR_13[VAR_25] *= VAR_18;", "}", "}", "ch = VAR_26;", "}", "}", "}", "VAR_8 = 2 * s->lfe * (s->sample_blocks / 8);", "for (VAR_10 = 0; VAR_10 < 2 * s->lfe * 4; VAR_10++)", "s->lfe_data[VAR_10] = s->lfe_data[VAR_10 + VAR_8];", "*VAR_2 = 1;", "*(AVFrame *) VAR_1 = s->frame;", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 64 ], [ 68 ], [ 70 ], [ 74 ], [ 76 ], [ 80 ], [ 82 ], [ 86 ], [ 90 ], [ 92 ], [ 94 ], [ 96 ], [ 98 ], [ 100 ], [ 106 ], [ 110, 112 ], [ 114, 116 ], [ 120 ], [ 128 ], [ 136 ], [ 142 ], [ 146 ], [ 148 ], [ 152 ], [ 154 ], [ 156 ], [ 160 ], [ 166 ], [ 168, 170, 172 ], [ 178 ], [ 182 ], [ 190 ], [ 192, 194 ], [ 196 ], [ 198 ], [ 202 ], [ 204 ], [ 206 ], [ 208 ], [ 214 ], [ 218 ], [ 220 ], [ 222 ], [ 224 ], [ 226 ], [ 230 ], [ 232 ], [ 234 ], [ 236, 244 ], [ 246 ], [ 248 ], [ 252 ], [ 254 ], [ 256, 258 ], [ 262, 264 ], [ 266 ], [ 268 ], [ 270 ], [ 274 ], [ 276 ], [ 278 ], [ 280 ], [ 284 ], [ 286 ], [ 288 ], [ 292 ], [ 294 ], [ 298, 300 ], [ 302, 304 ], [ 310, 312, 314 ], [ 318 ], [ 322 ], [ 330, 332, 334, 336, 338 ], [ 340 ], [ 342 ], [ 346, 348, 350 ], [ 352 ], [ 354 ], [ 356 ], [ 358 ], [ 360 ], [ 362 ], [ 364 ], [ 368 ], [ 370 ], [ 372 ], [ 374 ], [ 376 ], [ 378 ], [ 380 ], [ 382 ], [ 384 ], [ 388, 390, 395 ], [ 397 ], [ 400 ], [ 404 ], [ 406 ], [ 408 ], [ 410 ], [ 412 ], [ 414 ], [ 416 ], [ 418 ], [ 420 ], [ 422 ], [ 424 ], [ 426, 428 ], [ 431 ], [ 435 ], [ 437 ], [ 441 ], [ 445, 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 495 ], [ 497, 499 ], [ 502 ], [ 506 ], [ 510 ], [ 514 ], [ 516, 518 ], [ 520 ], [ 522 ], [ 524 ], [ 526 ], [ 528 ], [ 530 ], [ 532 ], [ 534 ], [ 538 ], [ 540 ], [ 542 ], [ 544 ], [ 548 ], [ 550 ], [ 554 ], [ 556 ], [ 560 ], [ 562, 564 ], [ 566 ], [ 568 ], [ 574 ], [ 576 ], [ 578 ], [ 580 ], [ 582 ], [ 584 ], [ 590 ], [ 592, 594, 596 ], [ 598, 600 ], [ 604, 606 ], [ 608, 610 ], [ 614, 616, 618, 620 ], [ 622, 624 ], [ 626 ], [ 632 ], [ 634 ], [ 638 ], [ 640 ], [ 642 ], [ 644 ], [ 648 ], [ 656 ], [ 658 ], [ 660 ], [ 662 ], [ 664 ], [ 666 ], [ 668 ], [ 674 ], [ 678 ], [ 680 ], [ 682 ], [ 684 ], [ 690 ], [ 692 ], [ 694 ], [ 696 ], [ 698 ], [ 700 ], [ 702 ], [ 704 ], [ 706, 708 ], [ 710 ], [ 712 ], [ 714 ], [ 716 ], [ 722 ], [ 724 ], [ 728 ], [ 730 ], [ 732 ], [ 734 ], [ 736 ], [ 742 ], [ 744 ], [ 746 ], [ 748 ], [ 750 ], [ 752 ], [ 756 ], [ 758 ], [ 762 ], [ 764 ], [ 770 ], [ 772 ], [ 774 ], [ 778 ], [ 780 ], [ 784 ], [ 786 ] ]
13,280
static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride, const uint8_t *src, int size, int lines) { int c, line, pixels, code, ret; const uint8_t *ssrc = src; int width = ((s->width * s->bpp) + 7) >> 3; if (size <= 0) return AVERROR_INVALIDDATA; if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE) { #if CONFIG_ZLIB return tiff_unpack_zlib(s, dst, stride, src, size, width, lines); #else av_log(s->avctx, AV_LOG_ERROR, "zlib support not enabled, " "deflate compression not supported\n"); return AVERROR(ENOSYS); #endif } if (s->compr == TIFF_LZW) { if ((ret = ff_lzw_decode_init(s->lzw, 8, src, size, FF_LZW_TIFF)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "Error initializing LZW decoder\n"); return ret; } } if (s->compr == TIFF_CCITT_RLE || s->compr == TIFF_G3 || s->compr == TIFF_G4) { return tiff_unpack_fax(s, dst, stride, src, size, lines); } for (line = 0; line < lines; line++) { if (src - ssrc > size) { av_log(s->avctx, AV_LOG_ERROR, "Source data overread\n"); return AVERROR_INVALIDDATA; } switch (s->compr) { case TIFF_RAW: if (ssrc + size - src < width) return AVERROR_INVALIDDATA; if (!s->fill_order) { memcpy(dst, src, width); } else { int i; for (i = 0; i < width; i++) dst[i] = ff_reverse[src[i]]; } src += width; break; case TIFF_PACKBITS: for (pixels = 0; pixels < width;) { code = (int8_t) *src++; if (code >= 0) { code++; if (pixels + code > width) { av_log(s->avctx, AV_LOG_ERROR, "Copy went out of bounds\n"); return AVERROR_INVALIDDATA; } memcpy(dst + pixels, src, code); src += code; pixels += code; } else if (code != -128) { // -127..-1 code = (-code) + 1; if (pixels + code > width) { av_log(s->avctx, AV_LOG_ERROR, "Run went out of bounds\n"); return AVERROR_INVALIDDATA; } c = *src++; memset(dst + pixels, c, code); pixels += code; } } break; case TIFF_LZW: pixels = ff_lzw_decode(s->lzw, dst, width); if (pixels < width) { av_log(s->avctx, AV_LOG_ERROR, "Decoded only %i bytes of %i\n", pixels, width); return AVERROR_INVALIDDATA; } break; } dst += stride; } return 0; }
true
FFmpeg
9c2216976907336dfae0e8e38a4d70ca2465a92c
static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride, const uint8_t *src, int size, int lines) { int c, line, pixels, code, ret; const uint8_t *ssrc = src; int width = ((s->width * s->bpp) + 7) >> 3; if (size <= 0) return AVERROR_INVALIDDATA; if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE) { #if CONFIG_ZLIB return tiff_unpack_zlib(s, dst, stride, src, size, width, lines); #else av_log(s->avctx, AV_LOG_ERROR, "zlib support not enabled, " "deflate compression not supported\n"); return AVERROR(ENOSYS); #endif } if (s->compr == TIFF_LZW) { if ((ret = ff_lzw_decode_init(s->lzw, 8, src, size, FF_LZW_TIFF)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "Error initializing LZW decoder\n"); return ret; } } if (s->compr == TIFF_CCITT_RLE || s->compr == TIFF_G3 || s->compr == TIFF_G4) { return tiff_unpack_fax(s, dst, stride, src, size, lines); } for (line = 0; line < lines; line++) { if (src - ssrc > size) { av_log(s->avctx, AV_LOG_ERROR, "Source data overread\n"); return AVERROR_INVALIDDATA; } switch (s->compr) { case TIFF_RAW: if (ssrc + size - src < width) return AVERROR_INVALIDDATA; if (!s->fill_order) { memcpy(dst, src, width); } else { int i; for (i = 0; i < width; i++) dst[i] = ff_reverse[src[i]]; } src += width; break; case TIFF_PACKBITS: for (pixels = 0; pixels < width;) { code = (int8_t) *src++; if (code >= 0) { code++; if (pixels + code > width) { av_log(s->avctx, AV_LOG_ERROR, "Copy went out of bounds\n"); return AVERROR_INVALIDDATA; } memcpy(dst + pixels, src, code); src += code; pixels += code; } else if (code != -128) { code = (-code) + 1; if (pixels + code > width) { av_log(s->avctx, AV_LOG_ERROR, "Run went out of bounds\n"); return AVERROR_INVALIDDATA; } c = *src++; memset(dst + pixels, c, code); pixels += code; } } break; case TIFF_LZW: pixels = ff_lzw_decode(s->lzw, dst, width); if (pixels < width) { av_log(s->avctx, AV_LOG_ERROR, "Decoded only %i bytes of %i\n", pixels, width); return AVERROR_INVALIDDATA; } break; } dst += stride; } return 0; }
{ "code": [ " if (pixels + code > width) {" ], "line_no": [ 109 ] }
static int FUNC_0(TiffContext *VAR_0, uint8_t *VAR_1, int VAR_2, const uint8_t *VAR_3, int VAR_4, int VAR_5) { int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; const uint8_t *VAR_11 = VAR_3; int VAR_12 = ((VAR_0->VAR_12 * VAR_0->bpp) + 7) >> 3; if (VAR_4 <= 0) return AVERROR_INVALIDDATA; if (VAR_0->compr == TIFF_DEFLATE || VAR_0->compr == TIFF_ADOBE_DEFLATE) { #if CONFIG_ZLIB return tiff_unpack_zlib(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_12, VAR_5); #else av_log(VAR_0->avctx, AV_LOG_ERROR, "zlib support not enabled, " "deflate compression not supported\n"); return AVERROR(ENOSYS); #endif } if (VAR_0->compr == TIFF_LZW) { if ((VAR_10 = ff_lzw_decode_init(VAR_0->lzw, 8, VAR_3, VAR_4, FF_LZW_TIFF)) < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Error initializing LZW decoder\n"); return VAR_10; } } if (VAR_0->compr == TIFF_CCITT_RLE || VAR_0->compr == TIFF_G3 || VAR_0->compr == TIFF_G4) { return tiff_unpack_fax(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); } for (VAR_7 = 0; VAR_7 < VAR_5; VAR_7++) { if (VAR_3 - VAR_11 > VAR_4) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Source data overread\n"); return AVERROR_INVALIDDATA; } switch (VAR_0->compr) { case TIFF_RAW: if (VAR_11 + VAR_4 - VAR_3 < VAR_12) return AVERROR_INVALIDDATA; if (!VAR_0->fill_order) { memcpy(VAR_1, VAR_3, VAR_12); } else { int VAR_13; for (VAR_13 = 0; VAR_13 < VAR_12; VAR_13++) VAR_1[VAR_13] = ff_reverse[VAR_3[VAR_13]]; } VAR_3 += VAR_12; break; case TIFF_PACKBITS: for (VAR_8 = 0; VAR_8 < VAR_12;) { VAR_9 = (int8_t) *VAR_3++; if (VAR_9 >= 0) { VAR_9++; if (VAR_8 + VAR_9 > VAR_12) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Copy went out of bounds\n"); return AVERROR_INVALIDDATA; } memcpy(VAR_1 + VAR_8, VAR_3, VAR_9); VAR_3 += VAR_9; VAR_8 += VAR_9; } else if (VAR_9 != -128) { VAR_9 = (-VAR_9) + 1; if (VAR_8 + VAR_9 > VAR_12) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Run went out of bounds\n"); return AVERROR_INVALIDDATA; } VAR_6 = *VAR_3++; memset(VAR_1 + VAR_8, VAR_6, VAR_9); VAR_8 += VAR_9; } } break; case TIFF_LZW: VAR_8 = ff_lzw_decode(VAR_0->lzw, VAR_1, VAR_12); if (VAR_8 < VAR_12) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Decoded only %VAR_13 bytes of %VAR_13\n", VAR_8, VAR_12); return AVERROR_INVALIDDATA; } break; } VAR_1 += VAR_2; } return 0; }
[ "static int FUNC_0(TiffContext *VAR_0, uint8_t *VAR_1, int VAR_2,\nconst uint8_t *VAR_3, int VAR_4, int VAR_5)\n{", "int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "const uint8_t *VAR_11 = VAR_3;", "int VAR_12 = ((VAR_0->VAR_12 * VAR_0->bpp) + 7) >> 3;", "if (VAR_4 <= 0)\nreturn AVERROR_INVALIDDATA;", "if (VAR_0->compr == TIFF_DEFLATE || VAR_0->compr == TIFF_ADOBE_DEFLATE) {", "#if CONFIG_ZLIB\nreturn tiff_unpack_zlib(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_12, VAR_5);", "#else\nav_log(VAR_0->avctx, AV_LOG_ERROR,\n\"zlib support not enabled, \"\n\"deflate compression not supported\\n\");", "return AVERROR(ENOSYS);", "#endif\n}", "if (VAR_0->compr == TIFF_LZW) {", "if ((VAR_10 = ff_lzw_decode_init(VAR_0->lzw, 8, VAR_3, VAR_4, FF_LZW_TIFF)) < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Error initializing LZW decoder\\n\");", "return VAR_10;", "}", "}", "if (VAR_0->compr == TIFF_CCITT_RLE ||\nVAR_0->compr == TIFF_G3 ||\nVAR_0->compr == TIFF_G4) {", "return tiff_unpack_fax(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5);", "}", "for (VAR_7 = 0; VAR_7 < VAR_5; VAR_7++) {", "if (VAR_3 - VAR_11 > VAR_4) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Source data overread\\n\");", "return AVERROR_INVALIDDATA;", "}", "switch (VAR_0->compr) {", "case TIFF_RAW:\nif (VAR_11 + VAR_4 - VAR_3 < VAR_12)\nreturn AVERROR_INVALIDDATA;", "if (!VAR_0->fill_order) {", "memcpy(VAR_1, VAR_3, VAR_12);", "} else {", "int VAR_13;", "for (VAR_13 = 0; VAR_13 < VAR_12; VAR_13++)", "VAR_1[VAR_13] = ff_reverse[VAR_3[VAR_13]];", "}", "VAR_3 += VAR_12;", "break;", "case TIFF_PACKBITS:\nfor (VAR_8 = 0; VAR_8 < VAR_12;) {", "VAR_9 = (int8_t) *VAR_3++;", "if (VAR_9 >= 0) {", "VAR_9++;", "if (VAR_8 + VAR_9 > VAR_12) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Copy went out of bounds\\n\");", "return AVERROR_INVALIDDATA;", "}", "memcpy(VAR_1 + VAR_8, VAR_3, VAR_9);", "VAR_3 += VAR_9;", "VAR_8 += VAR_9;", "} else if (VAR_9 != -128) {", "VAR_9 = (-VAR_9) + 1;", "if (VAR_8 + VAR_9 > VAR_12) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Run went out of bounds\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_6 = *VAR_3++;", "memset(VAR_1 + VAR_8, VAR_6, VAR_9);", "VAR_8 += VAR_9;", "}", "}", "break;", "case TIFF_LZW:\nVAR_8 = ff_lzw_decode(VAR_0->lzw, VAR_1, VAR_12);", "if (VAR_8 < VAR_12) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Decoded only %VAR_13 bytes of %VAR_13\\n\",\nVAR_8, VAR_12);", "return AVERROR_INVALIDDATA;", "}", "break;", "}", "VAR_1 += VAR_2;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 23, 25 ], [ 27, 29, 31, 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ] ]
13,281
AVBitStreamFilterContext *av_bitstream_filter_init(const char *name){ AVBitStreamFilter *bsf= first_bitstream_filter; while(bsf){ if(!strcmp(name, bsf->name)){ AVBitStreamFilterContext *bsfc= av_mallocz(sizeof(AVBitStreamFilterContext)); bsfc->filter= bsf; bsfc->priv_data= av_mallocz(bsf->priv_data_size); return bsfc; } bsf= bsf->next; } return NULL; }
true
FFmpeg
e7d4a2a721ae863488f6a3814f9dcdbc6e8f5166
AVBitStreamFilterContext *av_bitstream_filter_init(const char *name){ AVBitStreamFilter *bsf= first_bitstream_filter; while(bsf){ if(!strcmp(name, bsf->name)){ AVBitStreamFilterContext *bsfc= av_mallocz(sizeof(AVBitStreamFilterContext)); bsfc->filter= bsf; bsfc->priv_data= av_mallocz(bsf->priv_data_size); return bsfc; } bsf= bsf->next; } return NULL; }
{ "code": [ " bsfc->priv_data= av_mallocz(bsf->priv_data_size);" ], "line_no": [ 15 ] }
AVBitStreamFilterContext *FUNC_0(const char *name){ AVBitStreamFilter *bsf= first_bitstream_filter; while(bsf){ if(!strcmp(name, bsf->name)){ AVBitStreamFilterContext *bsfc= av_mallocz(sizeof(AVBitStreamFilterContext)); bsfc->filter= bsf; bsfc->priv_data= av_mallocz(bsf->priv_data_size); return bsfc; } bsf= bsf->next; } return NULL; }
[ "AVBitStreamFilterContext *FUNC_0(const char *name){", "AVBitStreamFilter *bsf= first_bitstream_filter;", "while(bsf){", "if(!strcmp(name, bsf->name)){", "AVBitStreamFilterContext *bsfc= av_mallocz(sizeof(AVBitStreamFilterContext));", "bsfc->filter= bsf;", "bsfc->priv_data= av_mallocz(bsf->priv_data_size);", "return bsfc;", "}", "bsf= bsf->next;", "}", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
13,283
void ff_avg_h264_qpel8_mc22_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_mid_and_aver_dst_8w_msa(src - (2 * stride) - 2, stride, dst, stride, 8); }
false
FFmpeg
1181d93231e9b807965724587d363c1cfd5a1d0d
void ff_avg_h264_qpel8_mc22_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_mid_and_aver_dst_8w_msa(src - (2 * stride) - 2, stride, dst, stride, 8); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, ptrdiff_t VAR_2) { avc_luma_mid_and_aver_dst_8w_msa(VAR_1 - (2 * VAR_2) - 2, VAR_2, VAR_0, VAR_2, 8); }
[ "void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{", "avc_luma_mid_and_aver_dst_8w_msa(VAR_1 - (2 * VAR_2) - 2,\nVAR_2, VAR_0, VAR_2, 8);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ] ]
13,284
static int ac3_decode_init(AVCodecContext *avctx) { AC3DecodeContext *ctx = avctx->priv_data; ac3_common_init(); ff_mdct_init(&ctx->imdct_ctx_256, 8, 1); ff_mdct_init(&ctx->imdct_ctx_512, 9, 1); ctx->samples = av_mallocz(6 * 256 * sizeof (float)); if (!ctx->samples) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate memory for samples\n"); return -1; } dither_seed(&ctx->state, 0); return 0; }
false
FFmpeg
0058584580b87feb47898e60e4b80c7f425882ad
static int ac3_decode_init(AVCodecContext *avctx) { AC3DecodeContext *ctx = avctx->priv_data; ac3_common_init(); ff_mdct_init(&ctx->imdct_ctx_256, 8, 1); ff_mdct_init(&ctx->imdct_ctx_512, 9, 1); ctx->samples = av_mallocz(6 * 256 * sizeof (float)); if (!ctx->samples) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate memory for samples\n"); return -1; } dither_seed(&ctx->state, 0); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0) { AC3DecodeContext *ctx = VAR_0->priv_data; ac3_common_init(); ff_mdct_init(&ctx->imdct_ctx_256, 8, 1); ff_mdct_init(&ctx->imdct_ctx_512, 9, 1); ctx->samples = av_mallocz(6 * 256 * sizeof (float)); if (!ctx->samples) { av_log(VAR_0, AV_LOG_ERROR, "Cannot allocate memory for samples\n"); return -1; } dither_seed(&ctx->state, 0); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "AC3DecodeContext *ctx = VAR_0->priv_data;", "ac3_common_init();", "ff_mdct_init(&ctx->imdct_ctx_256, 8, 1);", "ff_mdct_init(&ctx->imdct_ctx_512, 9, 1);", "ctx->samples = av_mallocz(6 * 256 * sizeof (float));", "if (!ctx->samples) {", "av_log(VAR_0, AV_LOG_ERROR, \"Cannot allocate memory for samples\\n\");", "return -1;", "}", "dither_seed(&ctx->state, 0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ] ]
13,285
static av_cold int flashsv_encode_init(AVCodecContext *avctx) { FlashSVContext *s = avctx->priv_data; s->avctx = avctx; if (avctx->width > 4095 || avctx->height > 4095) { av_log(avctx, AV_LOG_ERROR, "Input dimensions too large, input must be max 4096x4096 !\n"); return AVERROR_INVALIDDATA; } // Needed if zlib unused or init aborted before deflateInit memset(&s->zstream, 0, sizeof(z_stream)); s->last_key_frame = 0; s->image_width = avctx->width; s->image_height = avctx->height; s->tmpblock = av_mallocz(3 * 256 * 256); s->encbuffer = av_mallocz(s->image_width * s->image_height * 3); if (!s->tmpblock || !s->encbuffer) { av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n"); return AVERROR(ENOMEM); } avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) { flashsv_encode_end(avctx); return AVERROR(ENOMEM); } return 0; }
false
FFmpeg
d6604b29ef544793479d7fb4e05ef6622bb3e534
static av_cold int flashsv_encode_init(AVCodecContext *avctx) { FlashSVContext *s = avctx->priv_data; s->avctx = avctx; if (avctx->width > 4095 || avctx->height > 4095) { av_log(avctx, AV_LOG_ERROR, "Input dimensions too large, input must be max 4096x4096 !\n"); return AVERROR_INVALIDDATA; } memset(&s->zstream, 0, sizeof(z_stream)); s->last_key_frame = 0; s->image_width = avctx->width; s->image_height = avctx->height; s->tmpblock = av_mallocz(3 * 256 * 256); s->encbuffer = av_mallocz(s->image_width * s->image_height * 3); if (!s->tmpblock || !s->encbuffer) { av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n"); return AVERROR(ENOMEM); } avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) { flashsv_encode_end(avctx); return AVERROR(ENOMEM); } return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { FlashSVContext *s = avctx->priv_data; s->avctx = avctx; if (avctx->width > 4095 || avctx->height > 4095) { av_log(avctx, AV_LOG_ERROR, "Input dimensions too large, input must be max 4096x4096 !\n"); return AVERROR_INVALIDDATA; } memset(&s->zstream, 0, sizeof(z_stream)); s->last_key_frame = 0; s->image_width = avctx->width; s->image_height = avctx->height; s->tmpblock = av_mallocz(3 * 256 * 256); s->encbuffer = av_mallocz(s->image_width * s->image_height * 3); if (!s->tmpblock || !s->encbuffer) { av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n"); return AVERROR(ENOMEM); } avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) { flashsv_encode_end(avctx); return AVERROR(ENOMEM); } return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "FlashSVContext *s = avctx->priv_data;", "s->avctx = avctx;", "if (avctx->width > 4095 || avctx->height > 4095) {", "av_log(avctx, AV_LOG_ERROR,\n\"Input dimensions too large, input must be max 4096x4096 !\\n\");", "return AVERROR_INVALIDDATA;", "}", "memset(&s->zstream, 0, sizeof(z_stream));", "s->last_key_frame = 0;", "s->image_width = avctx->width;", "s->image_height = avctx->height;", "s->tmpblock = av_mallocz(3 * 256 * 256);", "s->encbuffer = av_mallocz(s->image_width * s->image_height * 3);", "if (!s->tmpblock || !s->encbuffer) {", "av_log(avctx, AV_LOG_ERROR, \"Memory allocation failed.\\n\");", "return AVERROR(ENOMEM);", "}", "avctx->coded_frame = av_frame_alloc();", "if (!avctx->coded_frame) {", "flashsv_encode_end(avctx);", "return AVERROR(ENOMEM);", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ] ]
13,286
static int subtitle_thread(void *arg) { VideoState *is = arg; Frame *sp; int got_subtitle; double pts; int i; for (;;) { if (!(sp = frame_queue_peek_writable(&is->subpq))) return 0; if ((got_subtitle = decoder_decode_frame(&is->subdec, NULL, &sp->sub)) < 0) break; pts = 0; if (got_subtitle && sp->sub.format == 0) { if (sp->sub.pts != AV_NOPTS_VALUE) pts = sp->sub.pts / (double)AV_TIME_BASE; sp->pts = pts; sp->serial = is->subdec.pkt_serial; for (i = 0; i < sp->sub.num_rects; i++) { int in_w = sp->sub.rects[i]->w; int in_h = sp->sub.rects[i]->h; int subw = is->subdec.avctx->width ? is->subdec.avctx->width : is->viddec_width; int subh = is->subdec.avctx->height ? is->subdec.avctx->height : is->viddec_height; int out_w = is->viddec_width ? in_w * is->viddec_width / subw : in_w; int out_h = is->viddec_height ? in_h * is->viddec_height / subh : in_h; AVPicture newpic; //can not use avpicture_alloc as it is not compatible with avsubtitle_free() av_image_fill_linesizes(newpic.linesize, AV_PIX_FMT_YUVA420P, out_w); newpic.data[0] = av_malloc(newpic.linesize[0] * out_h); newpic.data[3] = av_malloc(newpic.linesize[3] * out_h); newpic.data[1] = av_malloc(newpic.linesize[1] * ((out_h+1)/2)); newpic.data[2] = av_malloc(newpic.linesize[2] * ((out_h+1)/2)); is->sub_convert_ctx = sws_getCachedContext(is->sub_convert_ctx, in_w, in_h, AV_PIX_FMT_PAL8, out_w, out_h, AV_PIX_FMT_YUVA420P, sws_flags, NULL, NULL, NULL); if (!is->sub_convert_ctx || !newpic.data[0] || !newpic.data[3] || !newpic.data[1] || !newpic.data[2] ) { av_log(NULL, AV_LOG_FATAL, "Cannot initialize the sub conversion context\n"); exit(1); } sws_scale(is->sub_convert_ctx, (void*)sp->sub.rects[i]->pict.data, sp->sub.rects[i]->pict.linesize, 0, in_h, newpic.data, newpic.linesize); av_free(sp->sub.rects[i]->pict.data[0]); av_free(sp->sub.rects[i]->pict.data[1]); sp->sub.rects[i]->pict = newpic; sp->sub.rects[i]->w = out_w; sp->sub.rects[i]->h = out_h; sp->sub.rects[i]->x = sp->sub.rects[i]->x * out_w / in_w; sp->sub.rects[i]->y = sp->sub.rects[i]->y * out_h / in_h; } /* now we can update the picture count */ frame_queue_push(&is->subpq); } else if (got_subtitle) { avsubtitle_free(&sp->sub); } } return 0; }
false
FFmpeg
03037a4aad8b92c00ef2f115605ad20fc4410fe5
static int subtitle_thread(void *arg) { VideoState *is = arg; Frame *sp; int got_subtitle; double pts; int i; for (;;) { if (!(sp = frame_queue_peek_writable(&is->subpq))) return 0; if ((got_subtitle = decoder_decode_frame(&is->subdec, NULL, &sp->sub)) < 0) break; pts = 0; if (got_subtitle && sp->sub.format == 0) { if (sp->sub.pts != AV_NOPTS_VALUE) pts = sp->sub.pts / (double)AV_TIME_BASE; sp->pts = pts; sp->serial = is->subdec.pkt_serial; for (i = 0; i < sp->sub.num_rects; i++) { int in_w = sp->sub.rects[i]->w; int in_h = sp->sub.rects[i]->h; int subw = is->subdec.avctx->width ? is->subdec.avctx->width : is->viddec_width; int subh = is->subdec.avctx->height ? is->subdec.avctx->height : is->viddec_height; int out_w = is->viddec_width ? in_w * is->viddec_width / subw : in_w; int out_h = is->viddec_height ? in_h * is->viddec_height / subh : in_h; AVPicture newpic; av_image_fill_linesizes(newpic.linesize, AV_PIX_FMT_YUVA420P, out_w); newpic.data[0] = av_malloc(newpic.linesize[0] * out_h); newpic.data[3] = av_malloc(newpic.linesize[3] * out_h); newpic.data[1] = av_malloc(newpic.linesize[1] * ((out_h+1)/2)); newpic.data[2] = av_malloc(newpic.linesize[2] * ((out_h+1)/2)); is->sub_convert_ctx = sws_getCachedContext(is->sub_convert_ctx, in_w, in_h, AV_PIX_FMT_PAL8, out_w, out_h, AV_PIX_FMT_YUVA420P, sws_flags, NULL, NULL, NULL); if (!is->sub_convert_ctx || !newpic.data[0] || !newpic.data[3] || !newpic.data[1] || !newpic.data[2] ) { av_log(NULL, AV_LOG_FATAL, "Cannot initialize the sub conversion context\n"); exit(1); } sws_scale(is->sub_convert_ctx, (void*)sp->sub.rects[i]->pict.data, sp->sub.rects[i]->pict.linesize, 0, in_h, newpic.data, newpic.linesize); av_free(sp->sub.rects[i]->pict.data[0]); av_free(sp->sub.rects[i]->pict.data[1]); sp->sub.rects[i]->pict = newpic; sp->sub.rects[i]->w = out_w; sp->sub.rects[i]->h = out_h; sp->sub.rects[i]->x = sp->sub.rects[i]->x * out_w / in_w; sp->sub.rects[i]->y = sp->sub.rects[i]->y * out_h / in_h; } frame_queue_push(&is->subpq); } else if (got_subtitle) { avsubtitle_free(&sp->sub); } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0) { VideoState *is = VAR_0; Frame *sp; int VAR_1; double VAR_2; int VAR_3; for (;;) { if (!(sp = frame_queue_peek_writable(&is->subpq))) return 0; if ((VAR_1 = decoder_decode_frame(&is->subdec, NULL, &sp->sub)) < 0) break; VAR_2 = 0; if (VAR_1 && sp->sub.format == 0) { if (sp->sub.VAR_2 != AV_NOPTS_VALUE) VAR_2 = sp->sub.VAR_2 / (double)AV_TIME_BASE; sp->VAR_2 = VAR_2; sp->serial = is->subdec.pkt_serial; for (VAR_3 = 0; VAR_3 < sp->sub.num_rects; VAR_3++) { int in_w = sp->sub.rects[VAR_3]->w; int in_h = sp->sub.rects[VAR_3]->h; int subw = is->subdec.avctx->width ? is->subdec.avctx->width : is->viddec_width; int subh = is->subdec.avctx->height ? is->subdec.avctx->height : is->viddec_height; int out_w = is->viddec_width ? in_w * is->viddec_width / subw : in_w; int out_h = is->viddec_height ? in_h * is->viddec_height / subh : in_h; AVPicture newpic; av_image_fill_linesizes(newpic.linesize, AV_PIX_FMT_YUVA420P, out_w); newpic.data[0] = av_malloc(newpic.linesize[0] * out_h); newpic.data[3] = av_malloc(newpic.linesize[3] * out_h); newpic.data[1] = av_malloc(newpic.linesize[1] * ((out_h+1)/2)); newpic.data[2] = av_malloc(newpic.linesize[2] * ((out_h+1)/2)); is->sub_convert_ctx = sws_getCachedContext(is->sub_convert_ctx, in_w, in_h, AV_PIX_FMT_PAL8, out_w, out_h, AV_PIX_FMT_YUVA420P, sws_flags, NULL, NULL, NULL); if (!is->sub_convert_ctx || !newpic.data[0] || !newpic.data[3] || !newpic.data[1] || !newpic.data[2] ) { av_log(NULL, AV_LOG_FATAL, "Cannot initialize the sub conversion context\n"); exit(1); } sws_scale(is->sub_convert_ctx, (void*)sp->sub.rects[VAR_3]->pict.data, sp->sub.rects[VAR_3]->pict.linesize, 0, in_h, newpic.data, newpic.linesize); av_free(sp->sub.rects[VAR_3]->pict.data[0]); av_free(sp->sub.rects[VAR_3]->pict.data[1]); sp->sub.rects[VAR_3]->pict = newpic; sp->sub.rects[VAR_3]->w = out_w; sp->sub.rects[VAR_3]->h = out_h; sp->sub.rects[VAR_3]->x = sp->sub.rects[VAR_3]->x * out_w / in_w; sp->sub.rects[VAR_3]->y = sp->sub.rects[VAR_3]->y * out_h / in_h; } frame_queue_push(&is->subpq); } else if (VAR_1) { avsubtitle_free(&sp->sub); } } return 0; }
[ "static int FUNC_0(void *VAR_0)\n{", "VideoState *is = VAR_0;", "Frame *sp;", "int VAR_1;", "double VAR_2;", "int VAR_3;", "for (;;) {", "if (!(sp = frame_queue_peek_writable(&is->subpq)))\nreturn 0;", "if ((VAR_1 = decoder_decode_frame(&is->subdec, NULL, &sp->sub)) < 0)\nbreak;", "VAR_2 = 0;", "if (VAR_1 && sp->sub.format == 0) {", "if (sp->sub.VAR_2 != AV_NOPTS_VALUE)\nVAR_2 = sp->sub.VAR_2 / (double)AV_TIME_BASE;", "sp->VAR_2 = VAR_2;", "sp->serial = is->subdec.pkt_serial;", "for (VAR_3 = 0; VAR_3 < sp->sub.num_rects; VAR_3++)", "{", "int in_w = sp->sub.rects[VAR_3]->w;", "int in_h = sp->sub.rects[VAR_3]->h;", "int subw = is->subdec.avctx->width ? is->subdec.avctx->width : is->viddec_width;", "int subh = is->subdec.avctx->height ? is->subdec.avctx->height : is->viddec_height;", "int out_w = is->viddec_width ? in_w * is->viddec_width / subw : in_w;", "int out_h = is->viddec_height ? in_h * is->viddec_height / subh : in_h;", "AVPicture newpic;", "av_image_fill_linesizes(newpic.linesize, AV_PIX_FMT_YUVA420P, out_w);", "newpic.data[0] = av_malloc(newpic.linesize[0] * out_h);", "newpic.data[3] = av_malloc(newpic.linesize[3] * out_h);", "newpic.data[1] = av_malloc(newpic.linesize[1] * ((out_h+1)/2));", "newpic.data[2] = av_malloc(newpic.linesize[2] * ((out_h+1)/2));", "is->sub_convert_ctx = sws_getCachedContext(is->sub_convert_ctx,\nin_w, in_h, AV_PIX_FMT_PAL8, out_w, out_h,\nAV_PIX_FMT_YUVA420P, sws_flags, NULL, NULL, NULL);", "if (!is->sub_convert_ctx || !newpic.data[0] || !newpic.data[3] ||\n!newpic.data[1] || !newpic.data[2]\n) {", "av_log(NULL, AV_LOG_FATAL, \"Cannot initialize the sub conversion context\\n\");", "exit(1);", "}", "sws_scale(is->sub_convert_ctx,\n(void*)sp->sub.rects[VAR_3]->pict.data, sp->sub.rects[VAR_3]->pict.linesize,\n0, in_h, newpic.data, newpic.linesize);", "av_free(sp->sub.rects[VAR_3]->pict.data[0]);", "av_free(sp->sub.rects[VAR_3]->pict.data[1]);", "sp->sub.rects[VAR_3]->pict = newpic;", "sp->sub.rects[VAR_3]->w = out_w;", "sp->sub.rects[VAR_3]->h = out_h;", "sp->sub.rects[VAR_3]->x = sp->sub.rects[VAR_3]->x * out_w / in_w;", "sp->sub.rects[VAR_3]->y = sp->sub.rects[VAR_3]->y * out_h / in_h;", "}", "frame_queue_push(&is->subpq);", "} else if (VAR_1) {", "avsubtitle_free(&sp->sub);", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 25, 27 ], [ 31 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83, 85 ], [ 87, 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101, 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ] ]
13,287
static int vb_decode_framedata(VBDecContext *c, const uint8_t *buf, int offset) { uint8_t *prev, *cur; int blk, blocks, t, blk2; int blocktypes = 0; int x, y, a, b; int pattype, pattern; const int width = c->avctx->width; uint8_t *pstart = c->prev_frame; uint8_t *pend = c->prev_frame + width*c->avctx->height; prev = c->prev_frame + offset; cur = c->frame; blocks = (c->avctx->width >> 2) * (c->avctx->height >> 2); blk2 = 0; for(blk = 0; blk < blocks; blk++){ if(!(blk & 3)) blocktypes = bytestream_get_byte(&buf); switch(blocktypes & 0xC0){ case 0x00: //skip for(y = 0; y < 4; y++) if(check_line(prev + y*width, pstart, pend)) memcpy(cur + y*width, prev + y*width, 4); else memset(cur + y*width, 0, 4); break; case 0x40: t = bytestream_get_byte(&buf); if(!t){ //raw block for(y = 0; y < 4; y++) memcpy(cur + y*width, buf + y*4, 4); buf += 16; }else{ // motion compensation x = ((t & 0xF)^8) - 8; y = ((t >> 4) ^8) - 8; t = x + y*width; for(y = 0; y < 4; y++) if(check_line(prev + t + y*width, pstart, pend)) memcpy(cur + y*width, prev + t + y*width, 4); else memset(cur + y*width, 0, 4); } break; case 0x80: // fill t = bytestream_get_byte(&buf); for(y = 0; y < 4; y++) memset(cur + y*width, t, 4); break; case 0xC0: // pattern fill t = bytestream_get_byte(&buf); pattype = t >> 6; pattern = vb_patterns[t & 0x3F]; switch(pattype){ case 0: a = bytestream_get_byte(&buf); b = bytestream_get_byte(&buf); for(y = 0; y < 4; y++) for(x = 0; x < 4; x++, pattern >>= 1) cur[x + y*width] = (pattern & 1) ? b : a; break; case 1: pattern = ~pattern; case 2: a = bytestream_get_byte(&buf); for(y = 0; y < 4; y++) for(x = 0; x < 4; x++, pattern >>= 1) if(pattern & 1 && check_pixel(prev + x + y*width, pstart, pend)) cur[x + y*width] = prev[x + y*width]; else cur[x + y*width] = a; break; case 3: av_log(c->avctx, AV_LOG_ERROR, "Invalid opcode seen @%d\n",blk); return -1; } break; } blocktypes <<= 2; cur += 4; prev += 4; blk2++; if(blk2 == (width >> 2)){ blk2 = 0; cur += width * 3; prev += width * 3; } } return 0; }
false
FFmpeg
57835fc1aeaf0b3bbc0816b123a931ea39de758b
static int vb_decode_framedata(VBDecContext *c, const uint8_t *buf, int offset) { uint8_t *prev, *cur; int blk, blocks, t, blk2; int blocktypes = 0; int x, y, a, b; int pattype, pattern; const int width = c->avctx->width; uint8_t *pstart = c->prev_frame; uint8_t *pend = c->prev_frame + width*c->avctx->height; prev = c->prev_frame + offset; cur = c->frame; blocks = (c->avctx->width >> 2) * (c->avctx->height >> 2); blk2 = 0; for(blk = 0; blk < blocks; blk++){ if(!(blk & 3)) blocktypes = bytestream_get_byte(&buf); switch(blocktypes & 0xC0){ case 0x00: for(y = 0; y < 4; y++) if(check_line(prev + y*width, pstart, pend)) memcpy(cur + y*width, prev + y*width, 4); else memset(cur + y*width, 0, 4); break; case 0x40: t = bytestream_get_byte(&buf); if(!t){ for(y = 0; y < 4; y++) memcpy(cur + y*width, buf + y*4, 4); buf += 16; }else{ x = ((t & 0xF)^8) - 8; y = ((t >> 4) ^8) - 8; t = x + y*width; for(y = 0; y < 4; y++) if(check_line(prev + t + y*width, pstart, pend)) memcpy(cur + y*width, prev + t + y*width, 4); else memset(cur + y*width, 0, 4); } break; case 0x80: t = bytestream_get_byte(&buf); for(y = 0; y < 4; y++) memset(cur + y*width, t, 4); break; case 0xC0: t = bytestream_get_byte(&buf); pattype = t >> 6; pattern = vb_patterns[t & 0x3F]; switch(pattype){ case 0: a = bytestream_get_byte(&buf); b = bytestream_get_byte(&buf); for(y = 0; y < 4; y++) for(x = 0; x < 4; x++, pattern >>= 1) cur[x + y*width] = (pattern & 1) ? b : a; break; case 1: pattern = ~pattern; case 2: a = bytestream_get_byte(&buf); for(y = 0; y < 4; y++) for(x = 0; x < 4; x++, pattern >>= 1) if(pattern & 1 && check_pixel(prev + x + y*width, pstart, pend)) cur[x + y*width] = prev[x + y*width]; else cur[x + y*width] = a; break; case 3: av_log(c->avctx, AV_LOG_ERROR, "Invalid opcode seen @%d\n",blk); return -1; } break; } blocktypes <<= 2; cur += 4; prev += 4; blk2++; if(blk2 == (width >> 2)){ blk2 = 0; cur += width * 3; prev += width * 3; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VBDecContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { uint8_t *prev, *cur; int VAR_3, VAR_4, VAR_5, VAR_6; int VAR_7 = 0; int VAR_8, VAR_9, VAR_10, VAR_11; int VAR_12, VAR_13; const int VAR_14 = VAR_0->avctx->VAR_14; uint8_t *pstart = VAR_0->prev_frame; uint8_t *pend = VAR_0->prev_frame + VAR_14*VAR_0->avctx->height; prev = VAR_0->prev_frame + VAR_2; cur = VAR_0->frame; VAR_4 = (VAR_0->avctx->VAR_14 >> 2) * (VAR_0->avctx->height >> 2); VAR_6 = 0; for(VAR_3 = 0; VAR_3 < VAR_4; VAR_3++){ if(!(VAR_3 & 3)) VAR_7 = bytestream_get_byte(&VAR_1); switch(VAR_7 & 0xC0){ case 0x00: for(VAR_9 = 0; VAR_9 < 4; VAR_9++) if(check_line(prev + VAR_9*VAR_14, pstart, pend)) memcpy(cur + VAR_9*VAR_14, prev + VAR_9*VAR_14, 4); else memset(cur + VAR_9*VAR_14, 0, 4); break; case 0x40: VAR_5 = bytestream_get_byte(&VAR_1); if(!VAR_5){ for(VAR_9 = 0; VAR_9 < 4; VAR_9++) memcpy(cur + VAR_9*VAR_14, VAR_1 + VAR_9*4, 4); VAR_1 += 16; }else{ VAR_8 = ((VAR_5 & 0xF)^8) - 8; VAR_9 = ((VAR_5 >> 4) ^8) - 8; VAR_5 = VAR_8 + VAR_9*VAR_14; for(VAR_9 = 0; VAR_9 < 4; VAR_9++) if(check_line(prev + VAR_5 + VAR_9*VAR_14, pstart, pend)) memcpy(cur + VAR_9*VAR_14, prev + VAR_5 + VAR_9*VAR_14, 4); else memset(cur + VAR_9*VAR_14, 0, 4); } break; case 0x80: VAR_5 = bytestream_get_byte(&VAR_1); for(VAR_9 = 0; VAR_9 < 4; VAR_9++) memset(cur + VAR_9*VAR_14, VAR_5, 4); break; case 0xC0: VAR_5 = bytestream_get_byte(&VAR_1); VAR_12 = VAR_5 >> 6; VAR_13 = vb_patterns[VAR_5 & 0x3F]; switch(VAR_12){ case 0: VAR_10 = bytestream_get_byte(&VAR_1); VAR_11 = bytestream_get_byte(&VAR_1); for(VAR_9 = 0; VAR_9 < 4; VAR_9++) for(VAR_8 = 0; VAR_8 < 4; VAR_8++, VAR_13 >>= 1) cur[VAR_8 + VAR_9*VAR_14] = (VAR_13 & 1) ? VAR_11 : VAR_10; break; case 1: VAR_13 = ~VAR_13; case 2: VAR_10 = bytestream_get_byte(&VAR_1); for(VAR_9 = 0; VAR_9 < 4; VAR_9++) for(VAR_8 = 0; VAR_8 < 4; VAR_8++, VAR_13 >>= 1) if(VAR_13 & 1 && check_pixel(prev + VAR_8 + VAR_9*VAR_14, pstart, pend)) cur[VAR_8 + VAR_9*VAR_14] = prev[VAR_8 + VAR_9*VAR_14]; else cur[VAR_8 + VAR_9*VAR_14] = VAR_10; break; case 3: av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid opcode seen @%d\n",VAR_3); return -1; } break; } VAR_7 <<= 2; cur += 4; prev += 4; VAR_6++; if(VAR_6 == (VAR_14 >> 2)){ VAR_6 = 0; cur += VAR_14 * 3; prev += VAR_14 * 3; } } return 0; }
[ "static int FUNC_0(VBDecContext *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "uint8_t *prev, *cur;", "int VAR_3, VAR_4, VAR_5, VAR_6;", "int VAR_7 = 0;", "int VAR_8, VAR_9, VAR_10, VAR_11;", "int VAR_12, VAR_13;", "const int VAR_14 = VAR_0->avctx->VAR_14;", "uint8_t *pstart = VAR_0->prev_frame;", "uint8_t *pend = VAR_0->prev_frame + VAR_14*VAR_0->avctx->height;", "prev = VAR_0->prev_frame + VAR_2;", "cur = VAR_0->frame;", "VAR_4 = (VAR_0->avctx->VAR_14 >> 2) * (VAR_0->avctx->height >> 2);", "VAR_6 = 0;", "for(VAR_3 = 0; VAR_3 < VAR_4; VAR_3++){", "if(!(VAR_3 & 3))\nVAR_7 = bytestream_get_byte(&VAR_1);", "switch(VAR_7 & 0xC0){", "case 0x00:\nfor(VAR_9 = 0; VAR_9 < 4; VAR_9++)", "if(check_line(prev + VAR_9*VAR_14, pstart, pend))\nmemcpy(cur + VAR_9*VAR_14, prev + VAR_9*VAR_14, 4);", "else\nmemset(cur + VAR_9*VAR_14, 0, 4);", "break;", "case 0x40:\nVAR_5 = bytestream_get_byte(&VAR_1);", "if(!VAR_5){", "for(VAR_9 = 0; VAR_9 < 4; VAR_9++)", "memcpy(cur + VAR_9*VAR_14, VAR_1 + VAR_9*4, 4);", "VAR_1 += 16;", "}else{", "VAR_8 = ((VAR_5 & 0xF)^8) - 8;", "VAR_9 = ((VAR_5 >> 4) ^8) - 8;", "VAR_5 = VAR_8 + VAR_9*VAR_14;", "for(VAR_9 = 0; VAR_9 < 4; VAR_9++)", "if(check_line(prev + VAR_5 + VAR_9*VAR_14, pstart, pend))\nmemcpy(cur + VAR_9*VAR_14, prev + VAR_5 + VAR_9*VAR_14, 4);", "else\nmemset(cur + VAR_9*VAR_14, 0, 4);", "}", "break;", "case 0x80:\nVAR_5 = bytestream_get_byte(&VAR_1);", "for(VAR_9 = 0; VAR_9 < 4; VAR_9++)", "memset(cur + VAR_9*VAR_14, VAR_5, 4);", "break;", "case 0xC0:\nVAR_5 = bytestream_get_byte(&VAR_1);", "VAR_12 = VAR_5 >> 6;", "VAR_13 = vb_patterns[VAR_5 & 0x3F];", "switch(VAR_12){", "case 0:\nVAR_10 = bytestream_get_byte(&VAR_1);", "VAR_11 = bytestream_get_byte(&VAR_1);", "for(VAR_9 = 0; VAR_9 < 4; VAR_9++)", "for(VAR_8 = 0; VAR_8 < 4; VAR_8++, VAR_13 >>= 1)", "cur[VAR_8 + VAR_9*VAR_14] = (VAR_13 & 1) ? VAR_11 : VAR_10;", "break;", "case 1:\nVAR_13 = ~VAR_13;", "case 2:\nVAR_10 = bytestream_get_byte(&VAR_1);", "for(VAR_9 = 0; VAR_9 < 4; VAR_9++)", "for(VAR_8 = 0; VAR_8 < 4; VAR_8++, VAR_13 >>= 1)", "if(VAR_13 & 1 && check_pixel(prev + VAR_8 + VAR_9*VAR_14, pstart, pend))\ncur[VAR_8 + VAR_9*VAR_14] = prev[VAR_8 + VAR_9*VAR_14];", "else\ncur[VAR_8 + VAR_9*VAR_14] = VAR_10;", "break;", "case 3:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid opcode seen @%d\\n\",VAR_3);", "return -1;", "}", "break;", "}", "VAR_7 <<= 2;", "cur += 4;", "prev += 4;", "VAR_6++;", "if(VAR_6 == (VAR_14 >> 2)){", "VAR_6 = 0;", "cur += VAR_14 * 3;", "prev += VAR_14 * 3;", "}", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 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 ] ]
13,288
static void pre_calc_cosmod(DCAContext * s) { int i, j, k; static int cosmod_inited = 0; if(cosmod_inited) return; for (j = 0, k = 0; k < 16; k++) for (i = 0; i < 16; i++) cos_mod[j++] = cos((2 * i + 1) * (2 * k + 1) * M_PI / 64); for (k = 0; k < 16; k++) for (i = 0; i < 16; i++) cos_mod[j++] = cos((i) * (2 * k + 1) * M_PI / 32); for (k = 0; k < 16; k++) cos_mod[j++] = 0.25 / (2 * cos((2 * k + 1) * M_PI / 128)); for (k = 0; k < 16; k++) cos_mod[j++] = -0.25 / (2.0 * sin((2 * k + 1) * M_PI / 128)); cosmod_inited = 1; }
false
FFmpeg
5e53486545726987ab4482321d4dcf7e23e7652f
static void pre_calc_cosmod(DCAContext * s) { int i, j, k; static int cosmod_inited = 0; if(cosmod_inited) return; for (j = 0, k = 0; k < 16; k++) for (i = 0; i < 16; i++) cos_mod[j++] = cos((2 * i + 1) * (2 * k + 1) * M_PI / 64); for (k = 0; k < 16; k++) for (i = 0; i < 16; i++) cos_mod[j++] = cos((i) * (2 * k + 1) * M_PI / 32); for (k = 0; k < 16; k++) cos_mod[j++] = 0.25 / (2 * cos((2 * k + 1) * M_PI / 128)); for (k = 0; k < 16; k++) cos_mod[j++] = -0.25 / (2.0 * sin((2 * k + 1) * M_PI / 128)); cosmod_inited = 1; }
{ "code": [], "line_no": [] }
static void FUNC_0(DCAContext * VAR_0) { int VAR_1, VAR_2, VAR_3; static int VAR_4 = 0; if(VAR_4) return; for (VAR_2 = 0, VAR_3 = 0; VAR_3 < 16; VAR_3++) for (VAR_1 = 0; VAR_1 < 16; VAR_1++) cos_mod[VAR_2++] = cos((2 * VAR_1 + 1) * (2 * VAR_3 + 1) * M_PI / 64); for (VAR_3 = 0; VAR_3 < 16; VAR_3++) for (VAR_1 = 0; VAR_1 < 16; VAR_1++) cos_mod[VAR_2++] = cos((VAR_1) * (2 * VAR_3 + 1) * M_PI / 32); for (VAR_3 = 0; VAR_3 < 16; VAR_3++) cos_mod[VAR_2++] = 0.25 / (2 * cos((2 * VAR_3 + 1) * M_PI / 128)); for (VAR_3 = 0; VAR_3 < 16; VAR_3++) cos_mod[VAR_2++] = -0.25 / (2.0 * sin((2 * VAR_3 + 1) * M_PI / 128)); VAR_4 = 1; }
[ "static void FUNC_0(DCAContext * VAR_0)\n{", "int VAR_1, VAR_2, VAR_3;", "static int VAR_4 = 0;", "if(VAR_4) return;", "for (VAR_2 = 0, VAR_3 = 0; VAR_3 < 16; VAR_3++)", "for (VAR_1 = 0; VAR_1 < 16; VAR_1++)", "cos_mod[VAR_2++] = cos((2 * VAR_1 + 1) * (2 * VAR_3 + 1) * M_PI / 64);", "for (VAR_3 = 0; VAR_3 < 16; VAR_3++)", "for (VAR_1 = 0; VAR_1 < 16; VAR_1++)", "cos_mod[VAR_2++] = cos((VAR_1) * (2 * VAR_3 + 1) * M_PI / 32);", "for (VAR_3 = 0; VAR_3 < 16; VAR_3++)", "cos_mod[VAR_2++] = 0.25 / (2 * cos((2 * VAR_3 + 1) * M_PI / 128));", "for (VAR_3 = 0; VAR_3 < 16; VAR_3++)", "cos_mod[VAR_2++] = -0.25 / (2.0 * sin((2 * VAR_3 + 1) * M_PI / 128));", "VAR_4 = 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ] ]
13,289
static int RENAME(dct_quantize)(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow) { int level=0, last_non_zero_p1, q; //=0 is cuz gcc says uninitalized ... const uint16_t *qmat, *bias; static __align8 int16_t temp_block[64]; //s->fdct (block); ff_fdct_mmx (block); //cant be anything else ... if (s->mb_intra) { int dummy; if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; /* note: block[0] is assumed to be positive */ if (!s->h263_aic) { #if 1 asm volatile ( "imul %%ecx \n\t" : "=d" (level), "=a"(dummy) : "a" ((block[0]>>2) + q), "c" (inverse[q<<1]) ); #else asm volatile ( "xorl %%edx, %%edx \n\t" "divw %%cx \n\t" "movzwl %%ax, %%eax \n\t" : "=a" (level) : "a" ((block[0]>>2) + q), "c" (q<<1) : "%edx" ); #endif } else /* For AIC we skip quant/dequant of INTRADC */ level = (block[0] + 4)>>3; block[0]=0; //avoid fake overflow // temp_block[0] = (block[0] + (q >> 1)) / q; last_non_zero_p1 = 1; bias = s->q_intra_matrix16_bias[qscale]; qmat = s->q_intra_matrix16[qscale]; } else { last_non_zero_p1 = 0; bias = s->q_inter_matrix16_bias[qscale]; qmat = s->q_inter_matrix16[qscale]; } if(s->out_format == FMT_H263 && s->mpeg_quant==0){ /* PROLOGUE */ asm volatile( "movd %%eax, %%mm3 \n\t" // last_non_zero_p1 SPREADW(%%mm3) "pxor %%mm7, %%mm7 \n\t" // 0 "pxor %%mm4, %%mm4 \n\t" // 0 "movq (%1), %%mm5 \n\t" // qmat[0] "pxor %%mm6, %%mm6 \n\t" "psubw (%2), %%mm6 \n\t" // -bias[0] "movl $-128, %%eax \n\t" : "+a" (last_non_zero_p1) : "r" (qmat), "r" (bias) ); /* CORE */ asm volatile( ".balign 16 \n\t" "1: \n\t" "pxor %%mm1, %%mm1 \n\t" // 0 "movq (%1, %%eax), %%mm0 \n\t" // block[i] "pcmpgtw %%mm0, %%mm1 \n\t" // block[i] <= 0 ? 0xFF : 0x00 "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" // ABS(block[i]) "psubusw %%mm6, %%mm0 \n\t" // ABS(block[i]) + bias[0] "pmulhw %%mm5, %%mm0 \n\t" // (ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16 "por %%mm0, %%mm4 \n\t" "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i]) "movq %%mm0, (%3, %%eax) \n\t" "pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00 "movq (%2, %%eax), %%mm1 \n\t" "movq %%mm7, (%1, %%eax) \n\t" // 0 "pandn %%mm1, %%mm0 \n\t" PMAXW(%%mm0, %%mm3) "addl $8, %%eax \n\t" " js 1b \n\t" : "+a" (last_non_zero_p1) : "r" (block+64), "r" (inv_zigzag_direct16+64), "r" (temp_block+64) ); /* EPILOGUE */ asm volatile( "movq %%mm3, %%mm0 \n\t" "psrlq $32, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movq %%mm3, %%mm0 \n\t" "psrlq $16, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movd %%mm3, %%eax \n\t" "movzbl %%al, %%eax \n\t" // last_non_zero_p1 "movd %2, %%mm1 \n\t" // max_qcoeff SPREADW(%%mm1) "psubusw %%mm1, %%mm4 \n\t" "packuswb %%mm4, %%mm4 \n\t" "movd %%mm4, %1 \n\t" // *overflow : "+a" (last_non_zero_p1), "=r" (*overflow) : "r" (s->max_qcoeff) ); }else{ // FMT_H263 asm volatile( "pushl %%ebp \n\t" "pushl %%ebx \n\t" "movl %0, %%ebp \n\t" "movl (%%ebp), %%ebx \n\t" "movd %%ebx, %%mm3 \n\t" // last_non_zero_p1 SPREADW(%%mm3) "pxor %%mm7, %%mm7 \n\t" // 0 "pxor %%mm4, %%mm4 \n\t" // 0 "movl $-128, %%ebx \n\t" ".balign 16 \n\t" "1: \n\t" "pxor %%mm1, %%mm1 \n\t" // 0 "movq (%1, %%ebx), %%mm0 \n\t" // block[i] "pcmpgtw %%mm0, %%mm1 \n\t" // block[i] <= 0 ? 0xFF : 0x00 "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" // ABS(block[i]) "movq (%3, %%ebx), %%mm6 \n\t" // bias[0] "paddusw %%mm6, %%mm0 \n\t" // ABS(block[i]) + bias[0] "movq (%2, %%ebx), %%mm5 \n\t" // qmat[i] "pmulhw %%mm5, %%mm0 \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16 "por %%mm0, %%mm4 \n\t" "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i]) "movq %%mm0, (%5, %%ebx) \n\t" "pcmpeqw %%mm7, %%mm0 \n\t" // out==0 ? 0xFF : 0x00 "movq (%4, %%ebx), %%mm1 \n\t" "movq %%mm7, (%1, %%ebx) \n\t" // 0 "pandn %%mm1, %%mm0 \n\t" PMAXW(%%mm0, %%mm3) "addl $8, %%ebx \n\t" " js 1b \n\t" "movq %%mm3, %%mm0 \n\t" "psrlq $32, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movq %%mm3, %%mm0 \n\t" "psrlq $16, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movd %%mm3, %%ebx \n\t" "movzbl %%bl, %%ebx \n\t" // last_non_zero_p1 "movl %%ebx, (%%ebp) \n\t" "popl %%ebx \n\t" "popl %%ebp \n\t" : : "m" (last_non_zero_p1), "r" (block+64), "r" (qmat+64), "r" (bias+64), "r" (inv_zigzag_direct16+64), "r" (temp_block+64) ); // note the asm is split cuz gcc doesnt like that many operands ... asm volatile( "movd %1, %%mm1 \n\t" // max_qcoeff SPREADW(%%mm1) "psubusw %%mm1, %%mm4 \n\t" "packuswb %%mm4, %%mm4 \n\t" "movd %%mm4, %0 \n\t" // *overflow : "=r" (*overflow) : "r" (s->max_qcoeff) ); } if(s->mb_intra) block[0]= level; else block[0]= temp_block[0]; if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){ if(last_non_zero_p1 <= 1) goto end; block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08]; block[0x20] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02]; block[0x09] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11]; block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12]; block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04]; block[0x0C] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13]; block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21]; block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30]; block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14]; block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06]; block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E]; block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A]; block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38]; block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32]; block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16]; block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17]; block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25]; block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D]; block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36]; block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37]; block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){ if(last_non_zero_p1 <= 1) goto end; block[0x04] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02]; block[0x05] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x1C] = temp_block[0x19]; block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B]; block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13]; block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14]; block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E]; block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A]; block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32]; block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25]; block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B]; block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D]; block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else{ if(last_non_zero_p1 <= 1) goto end; block[0x01] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02]; block[0x03] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x19] = temp_block[0x19]; block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B]; block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13]; block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14]; block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E]; block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A]; block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32]; block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25]; block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D]; block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C]; block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; } end: /* for(i=0; i<last_non_zero_p1; i++) { int j= zigzag_direct_noperm[i]; block[block_permute_op(j)]= temp_block[j]; } */ return last_non_zero_p1 - 1; }
false
FFmpeg
d04fdff1617dd2bc1e24b940b6ed590d3188522b
static int RENAME(dct_quantize)(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow) { int level=0, last_non_zero_p1, q; const uint16_t *qmat, *bias; static __align8 int16_t temp_block[64]; ff_fdct_mmx (block); if (s->mb_intra) { int dummy; if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; if (!s->h263_aic) { #if 1 asm volatile ( "imul %%ecx \n\t" : "=d" (level), "=a"(dummy) : "a" ((block[0]>>2) + q), "c" (inverse[q<<1]) ); #else asm volatile ( "xorl %%edx, %%edx \n\t" "divw %%cx \n\t" "movzwl %%ax, %%eax \n\t" : "=a" (level) : "a" ((block[0]>>2) + q), "c" (q<<1) : "%edx" ); #endif } else level = (block[0] + 4)>>3; block[0]=0; last_non_zero_p1 = 1; bias = s->q_intra_matrix16_bias[qscale]; qmat = s->q_intra_matrix16[qscale]; } else { last_non_zero_p1 = 0; bias = s->q_inter_matrix16_bias[qscale]; qmat = s->q_inter_matrix16[qscale]; } if(s->out_format == FMT_H263 && s->mpeg_quant==0){ asm volatile( "movd %%eax, %%mm3 \n\t" SPREADW(%%mm3) "pxor %%mm7, %%mm7 \n\t" "pxor %%mm4, %%mm4 \n\t" "movq (%1), %%mm5 \n\t" "pxor %%mm6, %%mm6 \n\t" "psubw (%2), %%mm6 \n\t" "movl $-128, %%eax \n\t" : "+a" (last_non_zero_p1) : "r" (qmat), "r" (bias) ); asm volatile( ".balign 16 \n\t" "1: \n\t" "pxor %%mm1, %%mm1 \n\t" "movq (%1, %%eax), %%mm0 \n\t" "pcmpgtw %%mm0, %%mm1 \n\t" <= 0 ? 0xFF : 0x00 "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" "psubusw %%mm6, %%mm0 \n\t" + bias[0] "pmulhw %%mm5, %%mm0 \n\t" "por %%mm0, %%mm4 \n\t" "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" "movq %%mm0, (%3, %%eax) \n\t" "pcmpeqw %%mm7, %%mm0 \n\t" "movq (%2, %%eax), %%mm1 \n\t" "movq %%mm7, (%1, %%eax) \n\t" "pandn %%mm1, %%mm0 \n\t" PMAXW(%%mm0, %%mm3) "addl $8, %%eax \n\t" " js 1b \n\t" : "+a" (last_non_zero_p1) : "r" (block+64), "r" (inv_zigzag_direct16+64), "r" (temp_block+64) ); asm volatile( "movq %%mm3, %%mm0 \n\t" "psrlq $32, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movq %%mm3, %%mm0 \n\t" "psrlq $16, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movd %%mm3, %%eax \n\t" "movzbl %%al, %%eax \n\t" "movd %2, %%mm1 \n\t" SPREADW(%%mm1) "psubusw %%mm1, %%mm4 \n\t" "packuswb %%mm4, %%mm4 \n\t" "movd %%mm4, %1 \n\t" : "+a" (last_non_zero_p1), "=r" (*overflow) : "r" (s->max_qcoeff) ); }else{ asm volatile( "pushl %%ebp \n\t" "pushl %%ebx \n\t" "movl %0, %%ebp \n\t" "movl (%%ebp), %%ebx \n\t" "movd %%ebx, %%mm3 \n\t" SPREADW(%%mm3) "pxor %%mm7, %%mm7 \n\t" "pxor %%mm4, %%mm4 \n\t" "movl $-128, %%ebx \n\t" ".balign 16 \n\t" "1: \n\t" "pxor %%mm1, %%mm1 \n\t" "movq (%1, %%ebx), %%mm0 \n\t" "pcmpgtw %%mm0, %%mm1 \n\t" <= 0 ? 0xFF : 0x00 "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" "movq (%3, %%ebx), %%mm6 \n\t" "paddusw %%mm6, %%mm0 \n\t" + bias[0] "movq (%2, %%ebx), %%mm5 \n\t" "pmulhw %%mm5, %%mm0 \n\t" "por %%mm0, %%mm4 \n\t" "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" "movq %%mm0, (%5, %%ebx) \n\t" "pcmpeqw %%mm7, %%mm0 \n\t" "movq (%4, %%ebx), %%mm1 \n\t" "movq %%mm7, (%1, %%ebx) \n\t" "pandn %%mm1, %%mm0 \n\t" PMAXW(%%mm0, %%mm3) "addl $8, %%ebx \n\t" " js 1b \n\t" "movq %%mm3, %%mm0 \n\t" "psrlq $32, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movq %%mm3, %%mm0 \n\t" "psrlq $16, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movd %%mm3, %%ebx \n\t" "movzbl %%bl, %%ebx \n\t" "movl %%ebx, (%%ebp) \n\t" "popl %%ebx \n\t" "popl %%ebp \n\t" : : "m" (last_non_zero_p1), "r" (block+64), "r" (qmat+64), "r" (bias+64), "r" (inv_zigzag_direct16+64), "r" (temp_block+64) ); asm volatile( "movd %1, %%mm1 \n\t" SPREADW(%%mm1) "psubusw %%mm1, %%mm4 \n\t" "packuswb %%mm4, %%mm4 \n\t" "movd %%mm4, %0 \n\t" : "=r" (*overflow) : "r" (s->max_qcoeff) ); } if(s->mb_intra) block[0]= level; else block[0]= temp_block[0]; if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){ if(last_non_zero_p1 <= 1) goto end; block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08]; block[0x20] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02]; block[0x09] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11]; block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12]; block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04]; block[0x0C] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13]; block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21]; block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30]; block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14]; block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06]; block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E]; block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A]; block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38]; block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32]; block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16]; block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17]; block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25]; block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D]; block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36]; block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37]; block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){ if(last_non_zero_p1 <= 1) goto end; block[0x04] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02]; block[0x05] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x1C] = temp_block[0x19]; block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B]; block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13]; block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14]; block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E]; block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A]; block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32]; block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25]; block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B]; block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D]; block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else{ if(last_non_zero_p1 <= 1) goto end; block[0x01] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02]; block[0x03] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x19] = temp_block[0x19]; block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B]; block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13]; block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14]; block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E]; block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A]; block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32]; block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25]; block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D]; block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C]; block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; } end: return last_non_zero_p1 - 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(dct_quantize)(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow) { int VAR_0=0, VAR_1, VAR_2; const uint16_t *VAR_3, *bias; static __align8 VAR_4 temp_block[64]; ff_fdct_mmx (block); if (s->mb_intra) { int VAR_5; if (n < 4) VAR_2 = s->y_dc_scale; else VAR_2 = s->c_dc_scale; if (!s->h263_aic) { #if 1 asm volatile ( "imul %%ecx \n\t" : "=d" (VAR_0), "=a"(VAR_5) : "a" ((block[0]>>2) + VAR_2), "c" (inverse[VAR_2<<1]) ); #else asm volatile ( "xorl %%edx, %%edx \n\t" "divw %%cx \n\t" "movzwl %%ax, %%eax \n\t" : "=a" (VAR_0) : "a" ((block[0]>>2) + VAR_2), "c" (VAR_2<<1) : "%edx" ); #endif } else VAR_0 = (block[0] + 4)>>3; block[0]=0; VAR_1 = 1; bias = s->q_intra_matrix16_bias[qscale]; VAR_3 = s->q_intra_matrix16[qscale]; } else { VAR_1 = 0; bias = s->q_inter_matrix16_bias[qscale]; VAR_3 = s->q_inter_matrix16[qscale]; } if(s->out_format == FMT_H263 && s->mpeg_quant==0){ asm volatile( "movd %%eax, %%mm3 \n\t" SPREADW(%%mm3) "pxor %%mm7, %%mm7 \n\t" "pxor %%mm4, %%mm4 \n\t" "movq (%1), %%mm5 \n\t" "pxor %%mm6, %%mm6 \n\t" "psubw (%2), %%mm6 \n\t" "movl $-128, %%eax \n\t" : "+a" (VAR_1) : "r" (VAR_3), "r" (bias) ); asm volatile( ".balign 16 \n\t" "1: \n\t" "pxor %%mm1, %%mm1 \n\t" "movq (%1, %%eax), %%mm0 \n\t" "pcmpgtw %%mm0, %%mm1 \n\t" <= 0 ? 0xFF : 0x00 "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" "psubusw %%mm6, %%mm0 \n\t" + bias[0] "pmulhw %%mm5, %%mm0 \n\t" "por %%mm0, %%mm4 \n\t" "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" "movq %%mm0, (%3, %%eax) \n\t" "pcmpeqw %%mm7, %%mm0 \n\t" "movq (%2, %%eax), %%mm1 \n\t" "movq %%mm7, (%1, %%eax) \n\t" "pandn %%mm1, %%mm0 \n\t" PMAXW(%%mm0, %%mm3) "addl $8, %%eax \n\t" " js 1b \n\t" : "+a" (VAR_1) : "r" (block+64), "r" (inv_zigzag_direct16+64), "r" (temp_block+64) ); asm volatile( "movq %%mm3, %%mm0 \n\t" "psrlq $32, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movq %%mm3, %%mm0 \n\t" "psrlq $16, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movd %%mm3, %%eax \n\t" "movzbl %%al, %%eax \n\t" "movd %2, %%mm1 \n\t" SPREADW(%%mm1) "psubusw %%mm1, %%mm4 \n\t" "packuswb %%mm4, %%mm4 \n\t" "movd %%mm4, %1 \n\t" : "+a" (VAR_1), "=r" (*overflow) : "r" (s->max_qcoeff) ); }else{ asm volatile( "pushl %%ebp \n\t" "pushl %%ebx \n\t" "movl %0, %%ebp \n\t" "movl (%%ebp), %%ebx \n\t" "movd %%ebx, %%mm3 \n\t" SPREADW(%%mm3) "pxor %%mm7, %%mm7 \n\t" "pxor %%mm4, %%mm4 \n\t" "movl $-128, %%ebx \n\t" ".balign 16 \n\t" "1: \n\t" "pxor %%mm1, %%mm1 \n\t" "movq (%1, %%ebx), %%mm0 \n\t" "pcmpgtw %%mm0, %%mm1 \n\t" <= 0 ? 0xFF : 0x00 "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" "movq (%3, %%ebx), %%mm6 \n\t" "paddusw %%mm6, %%mm0 \n\t" + bias[0] "movq (%2, %%ebx), %%mm5 \n\t" "pmulhw %%mm5, %%mm0 \n\t" "por %%mm0, %%mm4 \n\t" "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" "movq %%mm0, (%5, %%ebx) \n\t" "pcmpeqw %%mm7, %%mm0 \n\t" "movq (%4, %%ebx), %%mm1 \n\t" "movq %%mm7, (%1, %%ebx) \n\t" "pandn %%mm1, %%mm0 \n\t" PMAXW(%%mm0, %%mm3) "addl $8, %%ebx \n\t" " js 1b \n\t" "movq %%mm3, %%mm0 \n\t" "psrlq $32, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movq %%mm3, %%mm0 \n\t" "psrlq $16, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movd %%mm3, %%ebx \n\t" "movzbl %%bl, %%ebx \n\t" "movl %%ebx, (%%ebp) \n\t" "popl %%ebx \n\t" "popl %%ebp \n\t" : : "m" (VAR_1), "r" (block+64), "r" (VAR_3+64), "r" (bias+64), "r" (inv_zigzag_direct16+64), "r" (temp_block+64) ); asm volatile( "movd %1, %%mm1 \n\t" SPREADW(%%mm1) "psubusw %%mm1, %%mm4 \n\t" "packuswb %%mm4, %%mm4 \n\t" "movd %%mm4, %0 \n\t" : "=r" (*overflow) : "r" (s->max_qcoeff) ); } if(s->mb_intra) block[0]= VAR_0; else block[0]= temp_block[0]; if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){ if(VAR_1 <= 1) goto end; block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08]; block[0x20] = temp_block[0x10]; if(VAR_1 <= 4) goto end; block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02]; block[0x09] = temp_block[0x03]; if(VAR_1 <= 7) goto end; block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11]; block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20]; if(VAR_1 <= 11) goto end; block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12]; block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04]; block[0x0C] = temp_block[0x05]; if(VAR_1 <= 16) goto end; block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13]; block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21]; block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30]; block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22]; if(VAR_1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14]; block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06]; block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E]; block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C]; if(VAR_1 <= 32) goto end; block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A]; block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38]; block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32]; block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24]; if(VAR_1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16]; block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17]; block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25]; block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33]; if(VAR_1 <= 48) goto end; block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D]; block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E]; if(VAR_1 <= 56) goto end; block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36]; block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37]; block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){ if(VAR_1 <= 1) goto end; block[0x04] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(VAR_1 <= 4) goto end; block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02]; block[0x05] = temp_block[0x03]; if(VAR_1 <= 7) goto end; block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(VAR_1 <= 11) goto end; block[0x1C] = temp_block[0x19]; block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B]; block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05]; if(VAR_1 <= 16) goto end; block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13]; block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22]; if(VAR_1 <= 24) goto end; block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14]; block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E]; block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C]; if(VAR_1 <= 32) goto end; block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A]; block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32]; block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24]; if(VAR_1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25]; block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33]; if(VAR_1 <= 48) goto end; block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B]; block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D]; block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E]; if(VAR_1 <= 56) goto end; block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else{ if(VAR_1 <= 1) goto end; block[0x01] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(VAR_1 <= 4) goto end; block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02]; block[0x03] = temp_block[0x03]; if(VAR_1 <= 7) goto end; block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(VAR_1 <= 11) goto end; block[0x19] = temp_block[0x19]; block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B]; block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05]; if(VAR_1 <= 16) goto end; block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13]; block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22]; if(VAR_1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14]; block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E]; block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C]; if(VAR_1 <= 32) goto end; block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A]; block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32]; block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24]; if(VAR_1 <= 40) goto end; block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25]; block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33]; if(VAR_1 <= 48) goto end; block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D]; block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E]; if(VAR_1 <= 56) goto end; block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C]; block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; } end: return VAR_1 - 1; }
[ "static int FUNC_0(dct_quantize)(MpegEncContext *s,\nDCTELEM *block, int n,\nint qscale, int *overflow)\n{", "int VAR_0=0, VAR_1, VAR_2;", "const uint16_t *VAR_3, *bias;", "static __align8 VAR_4 temp_block[64];", "ff_fdct_mmx (block);", "if (s->mb_intra) {", "int VAR_5;", "if (n < 4)\nVAR_2 = s->y_dc_scale;", "else\nVAR_2 = s->c_dc_scale;", "if (!s->h263_aic) {", "#if 1\nasm volatile (\n\"imul %%ecx\t\t\\n\\t\"\n: \"=d\" (VAR_0), \"=a\"(VAR_5)\n: \"a\" ((block[0]>>2) + VAR_2), \"c\" (inverse[VAR_2<<1])\n);", "#else\nasm volatile (\n\"xorl %%edx, %%edx\t\\n\\t\"\n\"divw %%cx\t\t\\n\\t\"\n\"movzwl %%ax, %%eax\t\\n\\t\"\n: \"=a\" (VAR_0)\n: \"a\" ((block[0]>>2) + VAR_2), \"c\" (VAR_2<<1)\n: \"%edx\"\n);", "#endif\n} else", "VAR_0 = (block[0] + 4)>>3;", "block[0]=0;", "VAR_1 = 1;", "bias = s->q_intra_matrix16_bias[qscale];", "VAR_3 = s->q_intra_matrix16[qscale];", "} else {", "VAR_1 = 0;", "bias = s->q_inter_matrix16_bias[qscale];", "VAR_3 = s->q_inter_matrix16[qscale];", "}", "if(s->out_format == FMT_H263 && s->mpeg_quant==0){", "asm volatile(\n\"movd %%eax, %%mm3\t\t\t\\n\\t\"\nSPREADW(%%mm3)\n\"pxor %%mm7, %%mm7\t\t\t\\n\\t\"\n\"pxor %%mm4, %%mm4\t\t\t\\n\\t\"\n\"movq (%1), %%mm5\t\t\t\\n\\t\"\n\"pxor %%mm6, %%mm6\t\t\t\\n\\t\"\n\"psubw (%2), %%mm6\t\t\t\\n\\t\"\n\"movl $-128, %%eax\t\t\t\\n\\t\"\n: \"+a\" (VAR_1)\n: \"r\" (VAR_3), \"r\" (bias)\n);", "asm volatile(\n\".balign 16\t\t\t\t\\n\\t\"\n\"1:\t\t\t\t\t\\n\\t\"\n\"pxor %%mm1, %%mm1\t\t\t\\n\\t\"\n\"movq (%1, %%eax), %%mm0\t\t\\n\\t\"\n\"pcmpgtw %%mm0, %%mm1\t\t\\n\\t\" <= 0 ? 0xFF : 0x00\n\"pxor %%mm1, %%mm0\t\t\t\\n\\t\"\n\"psubw %%mm1, %%mm0\t\t\t\\n\\t\"\n\"psubusw %%mm6, %%mm0\t\t\\n\\t\" + bias[0]\n\"pmulhw %%mm5, %%mm0\t\t\\n\\t\"\n\"por %%mm0, %%mm4\t\t\t\\n\\t\"\n\"pxor %%mm1, %%mm0\t\t\t\\n\\t\"\n\"psubw %%mm1, %%mm0\t\t\t\\n\\t\"\n\"movq %%mm0, (%3, %%eax)\t\t\\n\\t\"\n\"pcmpeqw %%mm7, %%mm0\t\t\\n\\t\"\n\"movq (%2, %%eax), %%mm1\t\t\\n\\t\"\n\"movq %%mm7, (%1, %%eax)\t\t\\n\\t\"\n\"pandn %%mm1, %%mm0\t\t\t\\n\\t\"\nPMAXW(%%mm0, %%mm3)\n\"addl $8, %%eax\t\t\t\\n\\t\"\n\" js 1b\t\t\t\t\\n\\t\"\n: \"+a\" (VAR_1)\n: \"r\" (block+64), \"r\" (inv_zigzag_direct16+64), \"r\" (temp_block+64)\n);", "asm volatile(\n\"movq %%mm3, %%mm0\t\t\t\\n\\t\"\n\"psrlq $32, %%mm3\t\t\t\\n\\t\"\nPMAXW(%%mm0, %%mm3)\n\"movq %%mm3, %%mm0\t\t\t\\n\\t\"\n\"psrlq $16, %%mm3\t\t\t\\n\\t\"\nPMAXW(%%mm0, %%mm3)\n\"movd %%mm3, %%eax\t\t\t\\n\\t\"\n\"movzbl %%al, %%eax\t\t\t\\n\\t\"\n\"movd %2, %%mm1\t\t\t\\n\\t\"\nSPREADW(%%mm1)\n\"psubusw %%mm1, %%mm4\t\t\\n\\t\"\n\"packuswb %%mm4, %%mm4\t\t\\n\\t\"\n\"movd %%mm4, %1\t\t\t\\n\\t\"\n: \"+a\" (VAR_1), \"=r\" (*overflow)\n: \"r\" (s->max_qcoeff)\n);", "}else{", "asm volatile(\n\"pushl %%ebp\t\t\t\t\\n\\t\"\n\"pushl %%ebx\t\t\t\t\\n\\t\"\n\"movl %0, %%ebp\t\t\t\t\\n\\t\"\n\"movl (%%ebp), %%ebx\t\t\\n\\t\"\n\"movd %%ebx, %%mm3\t\t\t\\n\\t\"\nSPREADW(%%mm3)\n\"pxor %%mm7, %%mm7\t\t\t\\n\\t\"\n\"pxor %%mm4, %%mm4\t\t\t\\n\\t\"\n\"movl $-128, %%ebx\t\t\t\\n\\t\"\n\".balign 16\t\t\t\t\\n\\t\"\n\"1:\t\t\t\t\t\\n\\t\"\n\"pxor %%mm1, %%mm1\t\t\t\\n\\t\"\n\"movq (%1, %%ebx), %%mm0\t\t\\n\\t\"\n\"pcmpgtw %%mm0, %%mm1\t\t\\n\\t\" <= 0 ? 0xFF : 0x00\n\"pxor %%mm1, %%mm0\t\t\t\\n\\t\"\n\"psubw %%mm1, %%mm0\t\t\t\\n\\t\"\n\"movq (%3, %%ebx), %%mm6\t\t\\n\\t\"\n\"paddusw %%mm6, %%mm0\t\t\\n\\t\" + bias[0]\n\"movq (%2, %%ebx), %%mm5\t\t\\n\\t\"\n\"pmulhw %%mm5, %%mm0\t\t\\n\\t\"\n\"por %%mm0, %%mm4\t\t\t\\n\\t\"\n\"pxor %%mm1, %%mm0\t\t\t\\n\\t\"\n\"psubw %%mm1, %%mm0\t\t\t\\n\\t\"\n\"movq %%mm0, (%5, %%ebx)\t\t\\n\\t\"\n\"pcmpeqw %%mm7, %%mm0\t\t\\n\\t\"\n\"movq (%4, %%ebx), %%mm1\t\t\\n\\t\"\n\"movq %%mm7, (%1, %%ebx)\t\t\\n\\t\"\n\"pandn %%mm1, %%mm0\t\t\t\\n\\t\"\nPMAXW(%%mm0, %%mm3)\n\"addl $8, %%ebx\t\t\t\\n\\t\"\n\" js 1b\t\t\t\t\\n\\t\"\n\"movq %%mm3, %%mm0\t\t\t\\n\\t\"\n\"psrlq $32, %%mm3\t\t\t\\n\\t\"\nPMAXW(%%mm0, %%mm3)\n\"movq %%mm3, %%mm0\t\t\t\\n\\t\"\n\"psrlq $16, %%mm3\t\t\t\\n\\t\"\nPMAXW(%%mm0, %%mm3)\n\"movd %%mm3, %%ebx\t\t\t\\n\\t\"\n\"movzbl %%bl, %%ebx\t\t\t\\n\\t\"\n\"movl %%ebx, (%%ebp)\t\t\\n\\t\"\n\"popl %%ebx\t\t\t\t\t\\n\\t\"\n\"popl %%ebp\t\t\t\t\t\\n\\t\"\n:\n: \"m\" (VAR_1),\n\"r\" (block+64), \"r\" (VAR_3+64), \"r\" (bias+64),\n\"r\" (inv_zigzag_direct16+64), \"r\" (temp_block+64)\n);", "asm volatile(\n\"movd %1, %%mm1\t\t\t\\n\\t\"\nSPREADW(%%mm1)\n\"psubusw %%mm1, %%mm4\t\t\\n\\t\"\n\"packuswb %%mm4, %%mm4\t\t\\n\\t\"\n\"movd %%mm4, %0\t\t\t\\n\\t\"\n: \"=r\" (*overflow)\n: \"r\" (s->max_qcoeff)\n);", "}", "if(s->mb_intra) block[0]= VAR_0;", "else block[0]= temp_block[0];", "if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){", "if(VAR_1 <= 1) goto end;", "block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08];", "block[0x20] = temp_block[0x10];", "if(VAR_1 <= 4) goto end;", "block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02];", "block[0x09] = temp_block[0x03];", "if(VAR_1 <= 7) goto end;", "block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11];", "block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20];", "if(VAR_1 <= 11) goto end;", "block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12];", "block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04];", "block[0x0C] = temp_block[0x05];", "if(VAR_1 <= 16) goto end;", "block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13];", "block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21];", "block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30];", "block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22];", "if(VAR_1 <= 24) goto end;", "block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14];", "block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06];", "block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E];", "block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C];", "if(VAR_1 <= 32) goto end;", "block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A];", "block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38];", "block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32];", "block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24];", "if(VAR_1 <= 40) goto end;", "block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16];", "block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17];", "block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25];", "block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33];", "if(VAR_1 <= 48) goto end;", "block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];", "block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D];", "block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];", "block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E];", "if(VAR_1 <= 56) goto end;", "block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C];", "block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36];", "block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37];", "block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];", "}else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){", "if(VAR_1 <= 1) goto end;", "block[0x04] = temp_block[0x01];", "block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];", "if(VAR_1 <= 4) goto end;", "block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02];", "block[0x05] = temp_block[0x03];", "if(VAR_1 <= 7) goto end;", "block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11];", "block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];", "if(VAR_1 <= 11) goto end;", "block[0x1C] = temp_block[0x19];", "block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B];", "block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05];", "if(VAR_1 <= 16) goto end;", "block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13];", "block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21];", "block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];", "block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22];", "if(VAR_1 <= 24) goto end;", "block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14];", "block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06];", "block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E];", "block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C];", "if(VAR_1 <= 32) goto end;", "block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A];", "block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38];", "block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32];", "block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24];", "if(VAR_1 <= 40) goto end;", "block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16];", "block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];", "block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25];", "block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33];", "if(VAR_1 <= 48) goto end;", "block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B];", "block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D];", "block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];", "block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E];", "if(VAR_1 <= 56) goto end;", "block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C];", "block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36];", "block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];", "block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];", "}else{", "if(VAR_1 <= 1) goto end;", "block[0x01] = temp_block[0x01];", "block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];", "if(VAR_1 <= 4) goto end;", "block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02];", "block[0x03] = temp_block[0x03];", "if(VAR_1 <= 7) goto end;", "block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11];", "block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];", "if(VAR_1 <= 11) goto end;", "block[0x19] = temp_block[0x19];", "block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B];", "block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05];", "if(VAR_1 <= 16) goto end;", "block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13];", "block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21];", "block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];", "block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22];", "if(VAR_1 <= 24) goto end;", "block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14];", "block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06];", "block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E];", "block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C];", "if(VAR_1 <= 32) goto end;", "block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A];", "block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38];", "block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32];", "block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24];", "if(VAR_1 <= 40) goto end;", "block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16];", "block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];", "block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25];", "block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33];", "if(VAR_1 <= 48) goto end;", "block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];", "block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D];", "block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];", "block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E];", "if(VAR_1 <= 56) goto end;", "block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C];", "block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36];", "block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];", "block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];", "}", "end:\nreturn VAR_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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31, 33 ], [ 37 ], [ 39, 41, 43, 45, 47, 49 ], [ 51, 53, 55, 57, 59, 61, 63, 65, 67 ], [ 69, 71 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127 ], [ 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177 ], [ 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213 ], [ 215 ], [ 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, 267, 269, 271, 273, 275, 277, 279, 281, 283, 285, 287, 289, 291, 293, 295, 297, 299, 301, 303, 305, 307, 309, 311 ], [ 315, 317, 319, 321, 323, 325, 327, 329, 331 ], [ 333 ], [ 337 ], [ 339 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609, 627 ], [ 629 ] ]
13,290
void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, int line_size) { int i; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; /* read the pixels */ for(i=0;i<8;i++) { pixels[0] = cm[block[0]]; pixels[1] = cm[block[1]]; pixels[2] = cm[block[2]]; pixels[3] = cm[block[3]]; pixels[4] = cm[block[4]]; pixels[5] = cm[block[5]]; pixels[6] = cm[block[6]]; pixels[7] = cm[block[7]]; pixels += line_size; block += 8; } }
true
FFmpeg
c23acbaed40101c677dfcfbbfe0d2c230a8e8f44
void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels, int line_size) { int i; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; for(i=0;i<8;i++) { pixels[0] = cm[block[0]]; pixels[1] = cm[block[1]]; pixels[2] = cm[block[2]]; pixels[3] = cm[block[3]]; pixels[4] = cm[block[4]]; pixels[5] = cm[block[5]]; pixels[6] = cm[block[6]]; pixels[7] = cm[block[7]]; pixels += line_size; block += 8; } }
{ "code": [ " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " pixels[0] = cm[block[0]];", " pixels[1] = cm[block[1]];", " pixels[2] = cm[block[2]];", " pixels[3] = cm[block[3]];", " pixels[4] = cm[block[4]];", " pixels[5] = cm[block[5]];", " pixels[6] = cm[block[6]];", " pixels[7] = cm[block[7]];", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " pixels[0] = cm[block[0]];", " pixels[1] = cm[block[1]];", " pixels[2] = cm[block[2]];", " pixels[3] = cm[block[3]];", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " pixels[0] = cm[block[0]];", " pixels[1] = cm[block[1]];", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;" ], "line_no": [ 9, 17, 19, 21, 23, 25, 27, 29, 31, 9, 17, 19, 21, 23, 9, 17, 19, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 ] }
void FUNC_0(const DCTELEM *VAR_0, uint8_t *restrict VAR_1, int VAR_2) { int VAR_3; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; for(VAR_3=0;VAR_3<8;VAR_3++) { VAR_1[0] = cm[VAR_0[0]]; VAR_1[1] = cm[VAR_0[1]]; VAR_1[2] = cm[VAR_0[2]]; VAR_1[3] = cm[VAR_0[3]]; VAR_1[4] = cm[VAR_0[4]]; VAR_1[5] = cm[VAR_0[5]]; VAR_1[6] = cm[VAR_0[6]]; VAR_1[7] = cm[VAR_0[7]]; VAR_1 += VAR_2; VAR_0 += 8; } }
[ "void FUNC_0(const DCTELEM *VAR_0, uint8_t *restrict VAR_1,\nint VAR_2)\n{", "int VAR_3;", "uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", "for(VAR_3=0;VAR_3<8;VAR_3++) {", "VAR_1[0] = cm[VAR_0[0]];", "VAR_1[1] = cm[VAR_0[1]];", "VAR_1[2] = cm[VAR_0[2]];", "VAR_1[3] = cm[VAR_0[3]];", "VAR_1[4] = cm[VAR_0[4]];", "VAR_1[5] = cm[VAR_0[5]];", "VAR_1[6] = cm[VAR_0[6]];", "VAR_1[7] = cm[VAR_0[7]];", "VAR_1 += VAR_2;", "VAR_0 += 8;", "}", "}" ]
[ 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
13,292
int has_altivec(void) { #ifdef __AMIGAOS4__ ULONG result = 0; extern struct ExecIFace *IExec; IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); if (result == VECTORTYPE_ALTIVEC) return 1; #elif __APPLE__ int sels[2] = {CTL_HW, HW_VECTORUNIT}; int has_vu = 0; size_t len = sizeof(has_vu); int err; err = sysctl(sels, 2, &has_vu, &len, NULL, 0); if (err == 0) return (has_vu != 0); #else // since we were compiled for altivec, just assume we have it // until someone comes up with a proper way (not involving signal hacks). #endif /* __AMIGAOS4__ */ }
true
FFmpeg
b8659d94b76c9b90c0aff3c5c01bfd2be6324e93
int has_altivec(void) { #ifdef __AMIGAOS4__ ULONG result = 0; extern struct ExecIFace *IExec; IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); if (result == VECTORTYPE_ALTIVEC) return 1; #elif __APPLE__ int sels[2] = {CTL_HW, HW_VECTORUNIT}; int has_vu = 0; size_t len = sizeof(has_vu); int err; err = sysctl(sels, 2, &has_vu, &len, NULL, 0); if (err == 0) return (has_vu != 0); #else #endif }
{ "code": [], "line_no": [] }
int FUNC_0(void) { #ifdef __AMIGAOS4__ ULONG result = 0; extern struct ExecIFace *IExec; IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); if (result == VECTORTYPE_ALTIVEC) return 1; #elif __APPLE__ int VAR_0[2] = {CTL_HW, HW_VECTORUNIT}; int VAR_1 = 0; size_t len = sizeof(VAR_1); int VAR_2; VAR_2 = sysctl(VAR_0, 2, &VAR_1, &len, NULL, 0); if (VAR_2 == 0) return (VAR_1 != 0); #else #endif }
[ "int FUNC_0(void)\n{", "#ifdef __AMIGAOS4__\nULONG result = 0;", "extern struct ExecIFace *IExec;", "IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE);", "if (result == VECTORTYPE_ALTIVEC) return 1;", "#elif __APPLE__\nint VAR_0[2] = {CTL_HW, HW_VECTORUNIT};", "int VAR_1 = 0;", "size_t len = sizeof(VAR_1);", "int VAR_2;", "VAR_2 = sysctl(VAR_0, 2, &VAR_1, &len, NULL, 0);", "if (VAR_2 == 0) return (VAR_1 != 0);", "#else\n#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 18, 20 ], [ 22 ], [ 24 ], [ 26 ], [ 30 ], [ 34 ], [ 49, 56, 58 ] ]
13,294
static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe) { GetBitContext gb; PutBitContext pb; AACADTSHeaderInfo hdr; AACBSFContext *ctx = bsfc->priv_data; init_get_bits(&gb, buf, AAC_ADTS_HEADER_SIZE*8); *poutbuf = (uint8_t*) buf; *poutbuf_size = buf_size; if (avctx->extradata) if (show_bits(&gb, 12) != 0xfff) return 0; if (avpriv_aac_parse_header(&gb, &hdr) < 0) { av_log(avctx, AV_LOG_ERROR, "Error parsing ADTS frame header!\n"); return -1; } if (!hdr.crc_absent && hdr.num_aac_frames > 1) { avpriv_report_missing_feature(avctx, "Multiple RDBs per frame with CRC"); return AVERROR_PATCHWELCOME; } buf += AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent; buf_size -= AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent; if (!ctx->first_frame_done) { int pce_size = 0; uint8_t pce_data[MAX_PCE_SIZE]; if (!hdr.chan_config) { init_get_bits(&gb, buf, buf_size * 8); if (get_bits(&gb, 3) != 5) { avpriv_report_missing_feature(avctx, "PCE-based channel configuration " "without PCE as first syntax " "element"); return AVERROR_PATCHWELCOME; } init_put_bits(&pb, pce_data, MAX_PCE_SIZE); pce_size = avpriv_copy_pce_data(&pb, &gb)/8; flush_put_bits(&pb); buf_size -= get_bits_count(&gb)/8; buf += get_bits_count(&gb)/8; } avctx->extradata_size = 2 + pce_size; avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); init_put_bits(&pb, avctx->extradata, avctx->extradata_size); put_bits(&pb, 5, hdr.object_type); put_bits(&pb, 4, hdr.sampling_index); put_bits(&pb, 4, hdr.chan_config); put_bits(&pb, 1, 0); //frame length - 1024 samples put_bits(&pb, 1, 0); //does not depend on core coder put_bits(&pb, 1, 0); //is not extension flush_put_bits(&pb); if (pce_size) { memcpy(avctx->extradata + 2, pce_data, pce_size); } ctx->first_frame_done = 1; } *poutbuf = (uint8_t*) buf; *poutbuf_size = buf_size; return 0; }
true
FFmpeg
889afca369ef3a939c68592ef2b1a1756667ce21
static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe) { GetBitContext gb; PutBitContext pb; AACADTSHeaderInfo hdr; AACBSFContext *ctx = bsfc->priv_data; init_get_bits(&gb, buf, AAC_ADTS_HEADER_SIZE*8); *poutbuf = (uint8_t*) buf; *poutbuf_size = buf_size; if (avctx->extradata) if (show_bits(&gb, 12) != 0xfff) return 0; if (avpriv_aac_parse_header(&gb, &hdr) < 0) { av_log(avctx, AV_LOG_ERROR, "Error parsing ADTS frame header!\n"); return -1; } if (!hdr.crc_absent && hdr.num_aac_frames > 1) { avpriv_report_missing_feature(avctx, "Multiple RDBs per frame with CRC"); return AVERROR_PATCHWELCOME; } buf += AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent; buf_size -= AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent; if (!ctx->first_frame_done) { int pce_size = 0; uint8_t pce_data[MAX_PCE_SIZE]; if (!hdr.chan_config) { init_get_bits(&gb, buf, buf_size * 8); if (get_bits(&gb, 3) != 5) { avpriv_report_missing_feature(avctx, "PCE-based channel configuration " "without PCE as first syntax " "element"); return AVERROR_PATCHWELCOME; } init_put_bits(&pb, pce_data, MAX_PCE_SIZE); pce_size = avpriv_copy_pce_data(&pb, &gb)/8; flush_put_bits(&pb); buf_size -= get_bits_count(&gb)/8; buf += get_bits_count(&gb)/8; } avctx->extradata_size = 2 + pce_size; avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); init_put_bits(&pb, avctx->extradata, avctx->extradata_size); put_bits(&pb, 5, hdr.object_type); put_bits(&pb, 4, hdr.sampling_index); put_bits(&pb, 4, hdr.chan_config); put_bits(&pb, 1, 0); put_bits(&pb, 1, 0); put_bits(&pb, 1, 0); flush_put_bits(&pb); if (pce_size) { memcpy(avctx->extradata + 2, pce_data, pce_size); } ctx->first_frame_done = 1; } *poutbuf = (uint8_t*) buf; *poutbuf_size = buf_size; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVBitStreamFilterContext *VAR_0, AVCodecContext *VAR_1, const char *VAR_2, uint8_t **VAR_3, int *VAR_4, const uint8_t *VAR_5, int VAR_6, int VAR_7) { GetBitContext gb; PutBitContext pb; AACADTSHeaderInfo hdr; AACBSFContext *ctx = VAR_0->priv_data; init_get_bits(&gb, VAR_5, AAC_ADTS_HEADER_SIZE*8); *VAR_3 = (uint8_t*) VAR_5; *VAR_4 = VAR_6; if (VAR_1->extradata) if (show_bits(&gb, 12) != 0xfff) return 0; if (avpriv_aac_parse_header(&gb, &hdr) < 0) { av_log(VAR_1, AV_LOG_ERROR, "Error parsing ADTS frame header!\n"); return -1; } if (!hdr.crc_absent && hdr.num_aac_frames > 1) { avpriv_report_missing_feature(VAR_1, "Multiple RDBs per frame with CRC"); return AVERROR_PATCHWELCOME; } VAR_5 += AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent; VAR_6 -= AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent; if (!ctx->first_frame_done) { int VAR_8 = 0; uint8_t pce_data[MAX_PCE_SIZE]; if (!hdr.chan_config) { init_get_bits(&gb, VAR_5, VAR_6 * 8); if (get_bits(&gb, 3) != 5) { avpriv_report_missing_feature(VAR_1, "PCE-based channel configuration " "without PCE as first syntax " "element"); return AVERROR_PATCHWELCOME; } init_put_bits(&pb, pce_data, MAX_PCE_SIZE); VAR_8 = avpriv_copy_pce_data(&pb, &gb)/8; flush_put_bits(&pb); VAR_6 -= get_bits_count(&gb)/8; VAR_5 += get_bits_count(&gb)/8; } VAR_1->extradata_size = 2 + VAR_8; VAR_1->extradata = av_mallocz(VAR_1->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); init_put_bits(&pb, VAR_1->extradata, VAR_1->extradata_size); put_bits(&pb, 5, hdr.object_type); put_bits(&pb, 4, hdr.sampling_index); put_bits(&pb, 4, hdr.chan_config); put_bits(&pb, 1, 0); put_bits(&pb, 1, 0); put_bits(&pb, 1, 0); flush_put_bits(&pb); if (VAR_8) { memcpy(VAR_1->extradata + 2, pce_data, VAR_8); } ctx->first_frame_done = 1; } *VAR_3 = (uint8_t*) VAR_5; *VAR_4 = VAR_6; return 0; }
[ "static int FUNC_0(AVBitStreamFilterContext *VAR_0,\nAVCodecContext *VAR_1, const char *VAR_2,\nuint8_t **VAR_3, int *VAR_4,\nconst uint8_t *VAR_5, int VAR_6,\nint VAR_7)\n{", "GetBitContext gb;", "PutBitContext pb;", "AACADTSHeaderInfo hdr;", "AACBSFContext *ctx = VAR_0->priv_data;", "init_get_bits(&gb, VAR_5, AAC_ADTS_HEADER_SIZE*8);", "*VAR_3 = (uint8_t*) VAR_5;", "*VAR_4 = VAR_6;", "if (VAR_1->extradata)\nif (show_bits(&gb, 12) != 0xfff)\nreturn 0;", "if (avpriv_aac_parse_header(&gb, &hdr) < 0) {", "av_log(VAR_1, AV_LOG_ERROR, \"Error parsing ADTS frame header!\\n\");", "return -1;", "}", "if (!hdr.crc_absent && hdr.num_aac_frames > 1) {", "avpriv_report_missing_feature(VAR_1,\n\"Multiple RDBs per frame with CRC\");", "return AVERROR_PATCHWELCOME;", "}", "VAR_5 += AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent;", "VAR_6 -= AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent;", "if (!ctx->first_frame_done) {", "int VAR_8 = 0;", "uint8_t pce_data[MAX_PCE_SIZE];", "if (!hdr.chan_config) {", "init_get_bits(&gb, VAR_5, VAR_6 * 8);", "if (get_bits(&gb, 3) != 5) {", "avpriv_report_missing_feature(VAR_1,\n\"PCE-based channel configuration \"\n\"without PCE as first syntax \"\n\"element\");", "return AVERROR_PATCHWELCOME;", "}", "init_put_bits(&pb, pce_data, MAX_PCE_SIZE);", "VAR_8 = avpriv_copy_pce_data(&pb, &gb)/8;", "flush_put_bits(&pb);", "VAR_6 -= get_bits_count(&gb)/8;", "VAR_5 += get_bits_count(&gb)/8;", "}", "VAR_1->extradata_size = 2 + VAR_8;", "VAR_1->extradata = av_mallocz(VAR_1->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);", "init_put_bits(&pb, VAR_1->extradata, VAR_1->extradata_size);", "put_bits(&pb, 5, hdr.object_type);", "put_bits(&pb, 4, hdr.sampling_index);", "put_bits(&pb, 4, hdr.chan_config);", "put_bits(&pb, 1, 0);", "put_bits(&pb, 1, 0);", "put_bits(&pb, 1, 0);", "flush_put_bits(&pb);", "if (VAR_8) {", "memcpy(VAR_1->extradata + 2, pce_data, VAR_8);", "}", "ctx->first_frame_done = 1;", "}", "*VAR_3 = (uint8_t*) VAR_5;", "*VAR_4 = VAR_6;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 35, 37, 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85, 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 108 ], [ 110 ], [ 114 ], [ 116 ], [ 118 ], [ 120 ], [ 122 ], [ 124 ], [ 126 ], [ 128 ], [ 130 ], [ 132 ], [ 134 ], [ 138 ], [ 140 ], [ 144 ], [ 146 ], [ 150 ], [ 152 ] ]
13,295
static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *buf_end){ unsigned char *frame0_end = s->last_frame.data[0] + s->avctx->width*s->last_frame.linesize[0]; int num_mvs; int num_blocks_raw; int num_blocks_packed; int vector_bits; int i,j,x,y; GetBitContext gb; int mvbits; const unsigned char *blocks_raw; if(buf+12>buf_end) return -1; num_mvs = AV_RL16(&buf[0]); num_blocks_raw = AV_RL16(&buf[2]); num_blocks_packed = AV_RL16(&buf[4]); vector_bits = AV_RL16(&buf[6]); buf += 12; /* allocate codebook buffers as neccessary */ if (num_mvs > s->num_mvs) { s->mv_codebook = av_realloc(s->mv_codebook, num_mvs*2*sizeof(int)); s->num_mvs = num_mvs; } if (num_blocks_packed > s->num_blocks_packed) { s->block_codebook = av_realloc(s->block_codebook, num_blocks_packed*16*sizeof(unsigned char)); s->num_blocks_packed = num_blocks_packed; } /* read motion vectors */ mvbits = (num_mvs*2*10+31) & ~31; if (buf+(mvbits>>3)+16*num_blocks_raw+8*num_blocks_packed>buf_end) return -1; init_get_bits(&gb, buf, mvbits); for (i=0; i<num_mvs; i++) { s->mv_codebook[i][0] = get_sbits(&gb, 10); s->mv_codebook[i][1] = get_sbits(&gb, 10); } buf += mvbits>>3; /* note ptr to uncompressed blocks */ blocks_raw = buf; buf += num_blocks_raw*16; /* read compressed blocks */ init_get_bits(&gb, buf, (buf_end-buf)<<3); for (i=0; i<num_blocks_packed; i++) { int tmp[4]; for(j=0; j<4; j++) tmp[j] = get_bits(&gb, 8); for(j=0; j<16; j++) s->block_codebook[i][15-j] = tmp[get_bits(&gb, 2)]; } if (get_bits_left(&gb) < vector_bits * (s->avctx->height/4) * (s->avctx->width/4)) return -1; /* read vectors and build frame */ for(y=0; y<s->avctx->height/4; y++) for(x=0; x<s->avctx->width/4; x++) { unsigned int vector = get_bits(&gb, vector_bits); const unsigned char *src; int src_stride; if (vector < num_mvs) { src = s->last_frame.data[0] + (y*4 + s->mv_codebook[vector][1])*s->last_frame.linesize[0] + x*4 + s->mv_codebook[vector][0]; src_stride = s->last_frame.linesize[0]; if (src+3*src_stride+3>=frame0_end) continue; }else{ int offset = vector - num_mvs; if (offset<num_blocks_raw) src = blocks_raw + 16*offset; else if (offset-num_blocks_raw<num_blocks_packed) src = s->block_codebook[offset-num_blocks_raw]; else continue; src_stride = 4; } for(j=0; j<4; j++) for(i=0; i<4; i++) s->frame.data[0][ (y*4+j)*s->frame.linesize[0] + (x*4+i) ] = src[j*src_stride + i]; } return 0; }
true
FFmpeg
09302a897d1990b1338f049fcd29638d736b8823
static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *buf_end){ unsigned char *frame0_end = s->last_frame.data[0] + s->avctx->width*s->last_frame.linesize[0]; int num_mvs; int num_blocks_raw; int num_blocks_packed; int vector_bits; int i,j,x,y; GetBitContext gb; int mvbits; const unsigned char *blocks_raw; if(buf+12>buf_end) return -1; num_mvs = AV_RL16(&buf[0]); num_blocks_raw = AV_RL16(&buf[2]); num_blocks_packed = AV_RL16(&buf[4]); vector_bits = AV_RL16(&buf[6]); buf += 12; if (num_mvs > s->num_mvs) { s->mv_codebook = av_realloc(s->mv_codebook, num_mvs*2*sizeof(int)); s->num_mvs = num_mvs; } if (num_blocks_packed > s->num_blocks_packed) { s->block_codebook = av_realloc(s->block_codebook, num_blocks_packed*16*sizeof(unsigned char)); s->num_blocks_packed = num_blocks_packed; } mvbits = (num_mvs*2*10+31) & ~31; if (buf+(mvbits>>3)+16*num_blocks_raw+8*num_blocks_packed>buf_end) return -1; init_get_bits(&gb, buf, mvbits); for (i=0; i<num_mvs; i++) { s->mv_codebook[i][0] = get_sbits(&gb, 10); s->mv_codebook[i][1] = get_sbits(&gb, 10); } buf += mvbits>>3; blocks_raw = buf; buf += num_blocks_raw*16; init_get_bits(&gb, buf, (buf_end-buf)<<3); for (i=0; i<num_blocks_packed; i++) { int tmp[4]; for(j=0; j<4; j++) tmp[j] = get_bits(&gb, 8); for(j=0; j<16; j++) s->block_codebook[i][15-j] = tmp[get_bits(&gb, 2)]; } if (get_bits_left(&gb) < vector_bits * (s->avctx->height/4) * (s->avctx->width/4)) return -1; for(y=0; y<s->avctx->height/4; y++) for(x=0; x<s->avctx->width/4; x++) { unsigned int vector = get_bits(&gb, vector_bits); const unsigned char *src; int src_stride; if (vector < num_mvs) { src = s->last_frame.data[0] + (y*4 + s->mv_codebook[vector][1])*s->last_frame.linesize[0] + x*4 + s->mv_codebook[vector][0]; src_stride = s->last_frame.linesize[0]; if (src+3*src_stride+3>=frame0_end) continue; }else{ int offset = vector - num_mvs; if (offset<num_blocks_raw) src = blocks_raw + 16*offset; else if (offset-num_blocks_raw<num_blocks_packed) src = s->block_codebook[offset-num_blocks_raw]; else continue; src_stride = 4; } for(j=0; j<4; j++) for(i=0; i<4; i++) s->frame.data[0][ (y*4+j)*s->frame.linesize[0] + (x*4+i) ] = src[j*src_stride + i]; } return 0; }
{ "code": [ " unsigned char *frame0_end = s->last_frame.data[0] + s->avctx->width*s->last_frame.linesize[0];", " if (src+3*src_stride+3>=frame0_end)" ], "line_no": [ 3, 149 ] }
static int FUNC_0(TgvContext * VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2){ unsigned char *VAR_3 = VAR_0->last_frame.data[0] + VAR_0->avctx->width*VAR_0->last_frame.linesize[0]; int VAR_4; int VAR_5; int VAR_6; int VAR_7; int VAR_8,VAR_9,VAR_10,VAR_11; GetBitContext gb; int VAR_12; const unsigned char *VAR_13; if(VAR_1+12>VAR_2) return -1; VAR_4 = AV_RL16(&VAR_1[0]); VAR_5 = AV_RL16(&VAR_1[2]); VAR_6 = AV_RL16(&VAR_1[4]); VAR_7 = AV_RL16(&VAR_1[6]); VAR_1 += 12; if (VAR_4 > VAR_0->VAR_4) { VAR_0->mv_codebook = av_realloc(VAR_0->mv_codebook, VAR_4*2*sizeof(int)); VAR_0->VAR_4 = VAR_4; } if (VAR_6 > VAR_0->VAR_6) { VAR_0->block_codebook = av_realloc(VAR_0->block_codebook, VAR_6*16*sizeof(unsigned char)); VAR_0->VAR_6 = VAR_6; } VAR_12 = (VAR_4*2*10+31) & ~31; if (VAR_1+(VAR_12>>3)+16*VAR_5+8*VAR_6>VAR_2) return -1; init_get_bits(&gb, VAR_1, VAR_12); for (VAR_8=0; VAR_8<VAR_4; VAR_8++) { VAR_0->mv_codebook[VAR_8][0] = get_sbits(&gb, 10); VAR_0->mv_codebook[VAR_8][1] = get_sbits(&gb, 10); } VAR_1 += VAR_12>>3; VAR_13 = VAR_1; VAR_1 += VAR_5*16; init_get_bits(&gb, VAR_1, (VAR_2-VAR_1)<<3); for (VAR_8=0; VAR_8<VAR_6; VAR_8++) { int VAR_14[4]; for(VAR_9=0; VAR_9<4; VAR_9++) VAR_14[VAR_9] = get_bits(&gb, 8); for(VAR_9=0; VAR_9<16; VAR_9++) VAR_0->block_codebook[VAR_8][15-VAR_9] = VAR_14[get_bits(&gb, 2)]; } if (get_bits_left(&gb) < VAR_7 * (VAR_0->avctx->height/4) * (VAR_0->avctx->width/4)) return -1; for(VAR_11=0; VAR_11<VAR_0->avctx->height/4; VAR_11++) for(VAR_10=0; VAR_10<VAR_0->avctx->width/4; VAR_10++) { unsigned int vector = get_bits(&gb, VAR_7); const unsigned char *src; int src_stride; if (vector < VAR_4) { src = VAR_0->last_frame.data[0] + (VAR_11*4 + VAR_0->mv_codebook[vector][1])*VAR_0->last_frame.linesize[0] + VAR_10*4 + VAR_0->mv_codebook[vector][0]; src_stride = VAR_0->last_frame.linesize[0]; if (src+3*src_stride+3>=VAR_3) continue; }else{ int offset = vector - VAR_4; if (offset<VAR_5) src = VAR_13 + 16*offset; else if (offset-VAR_5<VAR_6) src = VAR_0->block_codebook[offset-VAR_5]; else continue; src_stride = 4; } for(VAR_9=0; VAR_9<4; VAR_9++) for(VAR_8=0; VAR_8<4; VAR_8++) VAR_0->frame.data[0][ (VAR_11*4+VAR_9)*VAR_0->frame.linesize[0] + (VAR_10*4+VAR_8) ] = src[VAR_9*src_stride + VAR_8]; } return 0; }
[ "static int FUNC_0(TgvContext * VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2){", "unsigned char *VAR_3 = VAR_0->last_frame.data[0] + VAR_0->avctx->width*VAR_0->last_frame.linesize[0];", "int VAR_4;", "int VAR_5;", "int VAR_6;", "int VAR_7;", "int VAR_8,VAR_9,VAR_10,VAR_11;", "GetBitContext gb;", "int VAR_12;", "const unsigned char *VAR_13;", "if(VAR_1+12>VAR_2)\nreturn -1;", "VAR_4 = AV_RL16(&VAR_1[0]);", "VAR_5 = AV_RL16(&VAR_1[2]);", "VAR_6 = AV_RL16(&VAR_1[4]);", "VAR_7 = AV_RL16(&VAR_1[6]);", "VAR_1 += 12;", "if (VAR_4 > VAR_0->VAR_4) {", "VAR_0->mv_codebook = av_realloc(VAR_0->mv_codebook, VAR_4*2*sizeof(int));", "VAR_0->VAR_4 = VAR_4;", "}", "if (VAR_6 > VAR_0->VAR_6) {", "VAR_0->block_codebook = av_realloc(VAR_0->block_codebook, VAR_6*16*sizeof(unsigned char));", "VAR_0->VAR_6 = VAR_6;", "}", "VAR_12 = (VAR_4*2*10+31) & ~31;", "if (VAR_1+(VAR_12>>3)+16*VAR_5+8*VAR_6>VAR_2)\nreturn -1;", "init_get_bits(&gb, VAR_1, VAR_12);", "for (VAR_8=0; VAR_8<VAR_4; VAR_8++) {", "VAR_0->mv_codebook[VAR_8][0] = get_sbits(&gb, 10);", "VAR_0->mv_codebook[VAR_8][1] = get_sbits(&gb, 10);", "}", "VAR_1 += VAR_12>>3;", "VAR_13 = VAR_1;", "VAR_1 += VAR_5*16;", "init_get_bits(&gb, VAR_1, (VAR_2-VAR_1)<<3);", "for (VAR_8=0; VAR_8<VAR_6; VAR_8++) {", "int VAR_14[4];", "for(VAR_9=0; VAR_9<4; VAR_9++)", "VAR_14[VAR_9] = get_bits(&gb, 8);", "for(VAR_9=0; VAR_9<16; VAR_9++)", "VAR_0->block_codebook[VAR_8][15-VAR_9] = VAR_14[get_bits(&gb, 2)];", "}", "if (get_bits_left(&gb) < VAR_7 *\n(VAR_0->avctx->height/4) * (VAR_0->avctx->width/4))\nreturn -1;", "for(VAR_11=0; VAR_11<VAR_0->avctx->height/4; VAR_11++)", "for(VAR_10=0; VAR_10<VAR_0->avctx->width/4; VAR_10++) {", "unsigned int vector = get_bits(&gb, VAR_7);", "const unsigned char *src;", "int src_stride;", "if (vector < VAR_4) {", "src = VAR_0->last_frame.data[0] +\n(VAR_11*4 + VAR_0->mv_codebook[vector][1])*VAR_0->last_frame.linesize[0] +\nVAR_10*4 + VAR_0->mv_codebook[vector][0];", "src_stride = VAR_0->last_frame.linesize[0];", "if (src+3*src_stride+3>=VAR_3)\ncontinue;", "}else{", "int offset = vector - VAR_4;", "if (offset<VAR_5)\nsrc = VAR_13 + 16*offset;", "else if (offset-VAR_5<VAR_6)\nsrc = VAR_0->block_codebook[offset-VAR_5];", "else\ncontinue;", "src_stride = 4;", "}", "for(VAR_9=0; VAR_9<4; VAR_9++)", "for(VAR_8=0; VAR_8<4; VAR_8++)", "VAR_0->frame.data[0][ (VAR_11*4+VAR_9)*VAR_0->frame.linesize[0] + (VAR_10*4+VAR_8) ] =\nsrc[VAR_9*src_stride + VAR_8];", "}", "return 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 69, 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 91 ], [ 93 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119, 121 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141, 143, 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161, 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 187 ], [ 189 ] ]
13,296
static void generic_loader_realize(DeviceState *dev, Error **errp) { GenericLoaderState *s = GENERIC_LOADER(dev); hwaddr entry; int big_endian; int size = 0; s->set_pc = false; /* Perform some error checking on the user's options */ if (s->data || s->data_len || s->data_be) { /* User is loading memory values */ if (s->file) { error_setg(errp, "Specifying a file is not supported when loading " "memory values"); return; } else if (s->force_raw) { error_setg(errp, "Specifying force-raw is not supported when " "loading memory values"); return; } else if (!s->data_len) { /* We can't check for !data here as a value of 0 is still valid. */ error_setg(errp, "Both data and data-len must be specified"); return; } else if (s->data_len > 8) { error_setg(errp, "data-len cannot be greater then 8 bytes"); return; } } else if (s->file || s->force_raw) { /* User is loading an image */ if (s->data || s->data_len || s->data_be) { error_setg(errp, "data can not be specified when loading an " "image"); return; } /* The user specified a file, only set the PC if they also specified * a CPU to use. */ if (s->cpu_num != CPU_NONE) { s->set_pc = true; } } else if (s->addr) { /* User is setting the PC */ if (s->data || s->data_len || s->data_be) { error_setg(errp, "data can not be specified when setting a " "program counter"); return; } else if (!s->cpu_num) { error_setg(errp, "cpu_num must be specified when setting a " "program counter"); return; } s->set_pc = true; } else { /* Did the user specify anything? */ error_setg(errp, "please include valid arguments"); return; } qemu_register_reset(generic_loader_reset, dev); if (s->cpu_num != CPU_NONE) { s->cpu = qemu_get_cpu(s->cpu_num); if (!s->cpu) { error_setg(errp, "Specified boot CPU#%d is nonexistent", s->cpu_num); return; } } else { s->cpu = first_cpu; } #ifdef TARGET_WORDS_BIGENDIAN big_endian = 1; #else big_endian = 0; #endif if (s->file) { if (!s->force_raw) { size = load_elf_as(s->file, NULL, NULL, &entry, NULL, NULL, big_endian, 0, 0, 0, s->cpu->as); if (size < 0) { size = load_uimage_as(s->file, &entry, NULL, NULL, NULL, NULL, s->cpu->as); } } if (size < 0 || s->force_raw) { /* Default to the maximum size being the machine's ram size */ size = load_image_targphys_as(s->file, s->addr, ram_size, s->cpu->as); } else { s->addr = entry; } if (size < 0) { error_setg(errp, "Cannot load specified image %s", s->file); return; } } /* Convert the data endiannes */ if (s->data_be) { s->data = cpu_to_be64(s->data); } else { s->data = cpu_to_le64(s->data); } }
true
qemu
6516367fc0803d079384e0ad370856ac328bef30
static void generic_loader_realize(DeviceState *dev, Error **errp) { GenericLoaderState *s = GENERIC_LOADER(dev); hwaddr entry; int big_endian; int size = 0; s->set_pc = false; if (s->data || s->data_len || s->data_be) { if (s->file) { error_setg(errp, "Specifying a file is not supported when loading " "memory values"); return; } else if (s->force_raw) { error_setg(errp, "Specifying force-raw is not supported when " "loading memory values"); return; } else if (!s->data_len) { error_setg(errp, "Both data and data-len must be specified"); return; } else if (s->data_len > 8) { error_setg(errp, "data-len cannot be greater then 8 bytes"); return; } } else if (s->file || s->force_raw) { if (s->data || s->data_len || s->data_be) { error_setg(errp, "data can not be specified when loading an " "image"); return; } if (s->cpu_num != CPU_NONE) { s->set_pc = true; } } else if (s->addr) { if (s->data || s->data_len || s->data_be) { error_setg(errp, "data can not be specified when setting a " "program counter"); return; } else if (!s->cpu_num) { error_setg(errp, "cpu_num must be specified when setting a " "program counter"); return; } s->set_pc = true; } else { error_setg(errp, "please include valid arguments"); return; } qemu_register_reset(generic_loader_reset, dev); if (s->cpu_num != CPU_NONE) { s->cpu = qemu_get_cpu(s->cpu_num); if (!s->cpu) { error_setg(errp, "Specified boot CPU#%d is nonexistent", s->cpu_num); return; } } else { s->cpu = first_cpu; } #ifdef TARGET_WORDS_BIGENDIAN big_endian = 1; #else big_endian = 0; #endif if (s->file) { if (!s->force_raw) { size = load_elf_as(s->file, NULL, NULL, &entry, NULL, NULL, big_endian, 0, 0, 0, s->cpu->as); if (size < 0) { size = load_uimage_as(s->file, &entry, NULL, NULL, NULL, NULL, s->cpu->as); } } if (size < 0 || s->force_raw) { size = load_image_targphys_as(s->file, s->addr, ram_size, s->cpu->as); } else { s->addr = entry; } if (size < 0) { error_setg(errp, "Cannot load specified image %s", s->file); return; } } if (s->data_be) { s->data = cpu_to_be64(s->data); } else { s->data = cpu_to_le64(s->data); } }
{ "code": [ " big_endian, 0, 0, 0, s->cpu->as);", " s->cpu->as);", " size = load_image_targphys_as(s->file, s->addr, ram_size,", " s->cpu->as);" ], "line_no": [ 163, 171, 183, 185 ] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { GenericLoaderState *s = GENERIC_LOADER(VAR_0); hwaddr entry; int VAR_2; int VAR_3 = 0; s->set_pc = false; if (s->data || s->data_len || s->data_be) { if (s->file) { error_setg(VAR_1, "Specifying a file is not supported when loading " "memory values"); return; } else if (s->force_raw) { error_setg(VAR_1, "Specifying force-raw is not supported when " "loading memory values"); return; } else if (!s->data_len) { error_setg(VAR_1, "Both data and data-len must be specified"); return; } else if (s->data_len > 8) { error_setg(VAR_1, "data-len cannot be greater then 8 bytes"); return; } } else if (s->file || s->force_raw) { if (s->data || s->data_len || s->data_be) { error_setg(VAR_1, "data can not be specified when loading an " "image"); return; } if (s->cpu_num != CPU_NONE) { s->set_pc = true; } } else if (s->addr) { if (s->data || s->data_len || s->data_be) { error_setg(VAR_1, "data can not be specified when setting a " "program counter"); return; } else if (!s->cpu_num) { error_setg(VAR_1, "cpu_num must be specified when setting a " "program counter"); return; } s->set_pc = true; } else { error_setg(VAR_1, "please include valid arguments"); return; } qemu_register_reset(generic_loader_reset, VAR_0); if (s->cpu_num != CPU_NONE) { s->cpu = qemu_get_cpu(s->cpu_num); if (!s->cpu) { error_setg(VAR_1, "Specified boot CPU#%d is nonexistent", s->cpu_num); return; } } else { s->cpu = first_cpu; } #ifdef TARGET_WORDS_BIGENDIAN VAR_2 = 1; #else VAR_2 = 0; #endif if (s->file) { if (!s->force_raw) { VAR_3 = load_elf_as(s->file, NULL, NULL, &entry, NULL, NULL, VAR_2, 0, 0, 0, s->cpu->as); if (VAR_3 < 0) { VAR_3 = load_uimage_as(s->file, &entry, NULL, NULL, NULL, NULL, s->cpu->as); } } if (VAR_3 < 0 || s->force_raw) { VAR_3 = load_image_targphys_as(s->file, s->addr, ram_size, s->cpu->as); } else { s->addr = entry; } if (VAR_3 < 0) { error_setg(VAR_1, "Cannot load specified image %s", s->file); return; } } if (s->data_be) { s->data = cpu_to_be64(s->data); } else { s->data = cpu_to_le64(s->data); } }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "GenericLoaderState *s = GENERIC_LOADER(VAR_0);", "hwaddr entry;", "int VAR_2;", "int VAR_3 = 0;", "s->set_pc = false;", "if (s->data || s->data_len || s->data_be) {", "if (s->file) {", "error_setg(VAR_1, \"Specifying a file is not supported when loading \"\n\"memory values\");", "return;", "} else if (s->force_raw) {", "error_setg(VAR_1, \"Specifying force-raw is not supported when \"\n\"loading memory values\");", "return;", "} else if (!s->data_len) {", "error_setg(VAR_1, \"Both data and data-len must be specified\");", "return;", "} else if (s->data_len > 8) {", "error_setg(VAR_1, \"data-len cannot be greater then 8 bytes\");", "return;", "}", "} else if (s->file || s->force_raw) {", "if (s->data || s->data_len || s->data_be) {", "error_setg(VAR_1, \"data can not be specified when loading an \"\n\"image\");", "return;", "}", "if (s->cpu_num != CPU_NONE) {", "s->set_pc = true;", "}", "} else if (s->addr) {", "if (s->data || s->data_len || s->data_be) {", "error_setg(VAR_1, \"data can not be specified when setting a \"\n\"program counter\");", "return;", "} else if (!s->cpu_num) {", "error_setg(VAR_1, \"cpu_num must be specified when setting a \"\n\"program counter\");", "return;", "}", "s->set_pc = true;", "} else {", "error_setg(VAR_1, \"please include valid arguments\");", "return;", "}", "qemu_register_reset(generic_loader_reset, VAR_0);", "if (s->cpu_num != CPU_NONE) {", "s->cpu = qemu_get_cpu(s->cpu_num);", "if (!s->cpu) {", "error_setg(VAR_1, \"Specified boot CPU#%d is nonexistent\",\ns->cpu_num);", "return;", "}", "} else {", "s->cpu = first_cpu;", "}", "#ifdef TARGET_WORDS_BIGENDIAN\nVAR_2 = 1;", "#else\nVAR_2 = 0;", "#endif\nif (s->file) {", "if (!s->force_raw) {", "VAR_3 = load_elf_as(s->file, NULL, NULL, &entry, NULL, NULL,\nVAR_2, 0, 0, 0, s->cpu->as);", "if (VAR_3 < 0) {", "VAR_3 = load_uimage_as(s->file, &entry, NULL, NULL, NULL, NULL,\ns->cpu->as);", "}", "}", "if (VAR_3 < 0 || s->force_raw) {", "VAR_3 = load_image_targphys_as(s->file, s->addr, ram_size,\ns->cpu->as);", "} else {", "s->addr = entry;", "}", "if (VAR_3 < 0) {", "error_setg(VAR_1, \"Cannot load specified image %s\", s->file);", "return;", "}", "}", "if (s->data_be) {", "s->data = cpu_to_be64(s->data);", "} else {", "s->data = cpu_to_le64(s->data);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145, 147 ], [ 149, 151 ], [ 153, 157 ], [ 159 ], [ 161, 163 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 179 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ] ]
13,297
static inline void RENAME(nvXXtoUV)(uint8_t *dst1, uint8_t *dst2, const uint8_t *src, long width) { #if COMPILE_TEMPLATE_MMX __asm__ volatile( "movq "MANGLE(bm01010101)", %%mm4 \n\t" "mov %0, %%"REG_a" \n\t" "1: \n\t" "movq (%1, %%"REG_a",2), %%mm0 \n\t" "movq 8(%1, %%"REG_a",2), %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm1, %%mm3 \n\t" "pand %%mm4, %%mm0 \n\t" "pand %%mm4, %%mm1 \n\t" "psrlw $8, %%mm2 \n\t" "psrlw $8, %%mm3 \n\t" "packuswb %%mm1, %%mm0 \n\t" "packuswb %%mm3, %%mm2 \n\t" "movq %%mm0, (%2, %%"REG_a") \n\t" "movq %%mm2, (%3, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst1+width), "r" (dst2+width) : "%"REG_a ); #else int i; for (i = 0; i < width; i++) { dst1[i] = src[2*i+0]; dst2[i] = src[2*i+1]; } #endif }
false
FFmpeg
d1adad3cca407f493c3637e20ecd4f7124e69212
static inline void RENAME(nvXXtoUV)(uint8_t *dst1, uint8_t *dst2, const uint8_t *src, long width) { #if COMPILE_TEMPLATE_MMX __asm__ volatile( "movq "MANGLE(bm01010101)", %%mm4 \n\t" "mov %0, %%"REG_a" \n\t" "1: \n\t" "movq (%1, %%"REG_a",2), %%mm0 \n\t" "movq 8(%1, %%"REG_a",2), %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm1, %%mm3 \n\t" "pand %%mm4, %%mm0 \n\t" "pand %%mm4, %%mm1 \n\t" "psrlw $8, %%mm2 \n\t" "psrlw $8, %%mm3 \n\t" "packuswb %%mm1, %%mm0 \n\t" "packuswb %%mm3, %%mm2 \n\t" "movq %%mm0, (%2, %%"REG_a") \n\t" "movq %%mm2, (%3, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst1+width), "r" (dst2+width) : "%"REG_a ); #else int i; for (i = 0; i < width; i++) { dst1[i] = src[2*i+0]; dst2[i] = src[2*i+1]; } #endif }
{ "code": [], "line_no": [] }
static inline void FUNC_0(nvXXtoUV)(uint8_t *dst1, uint8_t *dst2, const uint8_t *src, long width) { #if COMPILE_TEMPLATE_MMX __asm__ volatile( "movq "MANGLE(bm01010101)", %%mm4 \n\t" "mov %0, %%"REG_a" \n\t" "1: \n\t" "movq (%1, %%"REG_a",2), %%mm0 \n\t" "movq 8(%1, %%"REG_a",2), %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm1, %%mm3 \n\t" "pand %%mm4, %%mm0 \n\t" "pand %%mm4, %%mm1 \n\t" "psrlw $8, %%mm2 \n\t" "psrlw $8, %%mm3 \n\t" "packuswb %%mm1, %%mm0 \n\t" "packuswb %%mm3, %%mm2 \n\t" "movq %%mm0, (%2, %%"REG_a") \n\t" "movq %%mm2, (%3, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst1+width), "r" (dst2+width) : "%"REG_a ); #else int VAR_0; for (VAR_0 = 0; VAR_0 < width; VAR_0++) { dst1[VAR_0] = src[2*VAR_0+0]; dst2[VAR_0] = src[2*VAR_0+1]; } #endif }
[ "static inline void FUNC_0(nvXXtoUV)(uint8_t *dst1, uint8_t *dst2,\nconst uint8_t *src, long width)\n{", "#if COMPILE_TEMPLATE_MMX\n__asm__ volatile(\n\"movq \"MANGLE(bm01010101)\", %%mm4 \\n\\t\"\n\"mov %0, %%\"REG_a\" \\n\\t\"\n\"1: \\n\\t\"\n\"movq (%1, %%\"REG_a\",2), %%mm0 \\n\\t\"\n\"movq 8(%1, %%\"REG_a\",2), %%mm1 \\n\\t\"\n\"movq %%mm0, %%mm2 \\n\\t\"\n\"movq %%mm1, %%mm3 \\n\\t\"\n\"pand %%mm4, %%mm0 \\n\\t\"\n\"pand %%mm4, %%mm1 \\n\\t\"\n\"psrlw $8, %%mm2 \\n\\t\"\n\"psrlw $8, %%mm3 \\n\\t\"\n\"packuswb %%mm1, %%mm0 \\n\\t\"\n\"packuswb %%mm3, %%mm2 \\n\\t\"\n\"movq %%mm0, (%2, %%\"REG_a\") \\n\\t\"\n\"movq %%mm2, (%3, %%\"REG_a\") \\n\\t\"\n\"add $8, %%\"REG_a\" \\n\\t\"\n\" js 1b \\n\\t\"\n: : \"g\" ((x86_reg)-width), \"r\" (src+width*2), \"r\" (dst1+width), \"r\" (dst2+width)\n: \"%\"REG_a\n);", "#else\nint VAR_0;", "for (VAR_0 = 0; VAR_0 < width; VAR_0++) {", "dst1[VAR_0] = src[2*VAR_0+0];", "dst2[VAR_0] = src[2*VAR_0+1];", "}", "#endif\n}" ]
[ 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 ] ]
13,298
static int mpc7_decode_init(AVCodecContext * avctx) { int i, j; MPCContext *c = avctx->priv_data; GetBitContext gb; uint8_t buf[16]; static int vlc_inited = 0; if(avctx->extradata_size < 16){ av_log(avctx, AV_LOG_ERROR, "Too small extradata size (%i)!\n", avctx->extradata_size); return -1; } memset(c->oldDSCF, 0, sizeof(c->oldDSCF)); av_init_random(0xDEADBEEF, &c->rnd); dsputil_init(&c->dsp, avctx); c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4); ff_mpc_init(); init_get_bits(&gb, buf, 128); c->IS = get_bits1(&gb); c->MSS = get_bits1(&gb); c->maxbands = get_bits(&gb, 6); if(c->maxbands >= BANDS){ av_log(avctx, AV_LOG_ERROR, "Too many bands: %i\n", c->maxbands); return -1; } skip_bits(&gb, 88); c->gapless = get_bits1(&gb); c->lastframelen = get_bits(&gb, 11); av_log(avctx, AV_LOG_DEBUG, "IS: %d, MSS: %d, TG: %d, LFL: %d, bands: %d\n", c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands); c->frames_to_skip = 0; if(vlc_inited) return 0; av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n"); if(init_vlc(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE, &mpc7_scfi[1], 2, 1, &mpc7_scfi[0], 2, 1, INIT_VLC_USE_STATIC)){ av_log(avctx, AV_LOG_ERROR, "Cannot init SCFI VLC\n"); return -1; } if(init_vlc(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE, &mpc7_dscf[1], 2, 1, &mpc7_dscf[0], 2, 1, INIT_VLC_USE_STATIC)){ av_log(avctx, AV_LOG_ERROR, "Cannot init DSCF VLC\n"); return -1; } if(init_vlc(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE, &mpc7_hdr[1], 2, 1, &mpc7_hdr[0], 2, 1, INIT_VLC_USE_STATIC)){ av_log(avctx, AV_LOG_ERROR, "Cannot init HDR VLC\n"); return -1; } for(i = 0; i < MPC7_QUANT_VLC_TABLES; i++){ for(j = 0; j < 2; j++){ if(init_vlc(&quant_vlc[i][j], 9, mpc7_quant_vlc_sizes[i], &mpc7_quant_vlc[i][j][1], 4, 2, &mpc7_quant_vlc[i][j][0], 4, 2, INIT_VLC_USE_STATIC)){ av_log(avctx, AV_LOG_ERROR, "Cannot init QUANT VLC %i,%i\n",i,j); return -1; } } } vlc_inited = 1; return 0; }
false
FFmpeg
5e53486545726987ab4482321d4dcf7e23e7652f
static int mpc7_decode_init(AVCodecContext * avctx) { int i, j; MPCContext *c = avctx->priv_data; GetBitContext gb; uint8_t buf[16]; static int vlc_inited = 0; if(avctx->extradata_size < 16){ av_log(avctx, AV_LOG_ERROR, "Too small extradata size (%i)!\n", avctx->extradata_size); return -1; } memset(c->oldDSCF, 0, sizeof(c->oldDSCF)); av_init_random(0xDEADBEEF, &c->rnd); dsputil_init(&c->dsp, avctx); c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4); ff_mpc_init(); init_get_bits(&gb, buf, 128); c->IS = get_bits1(&gb); c->MSS = get_bits1(&gb); c->maxbands = get_bits(&gb, 6); if(c->maxbands >= BANDS){ av_log(avctx, AV_LOG_ERROR, "Too many bands: %i\n", c->maxbands); return -1; } skip_bits(&gb, 88); c->gapless = get_bits1(&gb); c->lastframelen = get_bits(&gb, 11); av_log(avctx, AV_LOG_DEBUG, "IS: %d, MSS: %d, TG: %d, LFL: %d, bands: %d\n", c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands); c->frames_to_skip = 0; if(vlc_inited) return 0; av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n"); if(init_vlc(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE, &mpc7_scfi[1], 2, 1, &mpc7_scfi[0], 2, 1, INIT_VLC_USE_STATIC)){ av_log(avctx, AV_LOG_ERROR, "Cannot init SCFI VLC\n"); return -1; } if(init_vlc(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE, &mpc7_dscf[1], 2, 1, &mpc7_dscf[0], 2, 1, INIT_VLC_USE_STATIC)){ av_log(avctx, AV_LOG_ERROR, "Cannot init DSCF VLC\n"); return -1; } if(init_vlc(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE, &mpc7_hdr[1], 2, 1, &mpc7_hdr[0], 2, 1, INIT_VLC_USE_STATIC)){ av_log(avctx, AV_LOG_ERROR, "Cannot init HDR VLC\n"); return -1; } for(i = 0; i < MPC7_QUANT_VLC_TABLES; i++){ for(j = 0; j < 2; j++){ if(init_vlc(&quant_vlc[i][j], 9, mpc7_quant_vlc_sizes[i], &mpc7_quant_vlc[i][j][1], 4, 2, &mpc7_quant_vlc[i][j][0], 4, 2, INIT_VLC_USE_STATIC)){ av_log(avctx, AV_LOG_ERROR, "Cannot init QUANT VLC %i,%i\n",i,j); return -1; } } } vlc_inited = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext * VAR_0) { int VAR_1, VAR_2; MPCContext *c = VAR_0->priv_data; GetBitContext gb; uint8_t buf[16]; static int VAR_3 = 0; if(VAR_0->extradata_size < 16){ av_log(VAR_0, AV_LOG_ERROR, "Too small extradata size (%VAR_1)!\n", VAR_0->extradata_size); return -1; } memset(c->oldDSCF, 0, sizeof(c->oldDSCF)); av_init_random(0xDEADBEEF, &c->rnd); dsputil_init(&c->dsp, VAR_0); c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)VAR_0->extradata, 4); ff_mpc_init(); init_get_bits(&gb, buf, 128); c->IS = get_bits1(&gb); c->MSS = get_bits1(&gb); c->maxbands = get_bits(&gb, 6); if(c->maxbands >= BANDS){ av_log(VAR_0, AV_LOG_ERROR, "Too many bands: %VAR_1\n", c->maxbands); return -1; } skip_bits(&gb, 88); c->gapless = get_bits1(&gb); c->lastframelen = get_bits(&gb, 11); av_log(VAR_0, AV_LOG_DEBUG, "IS: %d, MSS: %d, TG: %d, LFL: %d, bands: %d\n", c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands); c->frames_to_skip = 0; if(VAR_3) return 0; av_log(VAR_0, AV_LOG_DEBUG, "Initing VLC\n"); if(init_vlc(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE, &mpc7_scfi[1], 2, 1, &mpc7_scfi[0], 2, 1, INIT_VLC_USE_STATIC)){ av_log(VAR_0, AV_LOG_ERROR, "Cannot init SCFI VLC\n"); return -1; } if(init_vlc(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE, &mpc7_dscf[1], 2, 1, &mpc7_dscf[0], 2, 1, INIT_VLC_USE_STATIC)){ av_log(VAR_0, AV_LOG_ERROR, "Cannot init DSCF VLC\n"); return -1; } if(init_vlc(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE, &mpc7_hdr[1], 2, 1, &mpc7_hdr[0], 2, 1, INIT_VLC_USE_STATIC)){ av_log(VAR_0, AV_LOG_ERROR, "Cannot init HDR VLC\n"); return -1; } for(VAR_1 = 0; VAR_1 < MPC7_QUANT_VLC_TABLES; VAR_1++){ for(VAR_2 = 0; VAR_2 < 2; VAR_2++){ if(init_vlc(&quant_vlc[VAR_1][VAR_2], 9, mpc7_quant_vlc_sizes[VAR_1], &mpc7_quant_vlc[VAR_1][VAR_2][1], 4, 2, &mpc7_quant_vlc[VAR_1][VAR_2][0], 4, 2, INIT_VLC_USE_STATIC)){ av_log(VAR_0, AV_LOG_ERROR, "Cannot init QUANT VLC %VAR_1,%VAR_1\n",VAR_1,VAR_2); return -1; } } } VAR_3 = 1; return 0; }
[ "static int FUNC_0(AVCodecContext * VAR_0)\n{", "int VAR_1, VAR_2;", "MPCContext *c = VAR_0->priv_data;", "GetBitContext gb;", "uint8_t buf[16];", "static int VAR_3 = 0;", "if(VAR_0->extradata_size < 16){", "av_log(VAR_0, AV_LOG_ERROR, \"Too small extradata size (%VAR_1)!\\n\", VAR_0->extradata_size);", "return -1;", "}", "memset(c->oldDSCF, 0, sizeof(c->oldDSCF));", "av_init_random(0xDEADBEEF, &c->rnd);", "dsputil_init(&c->dsp, VAR_0);", "c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)VAR_0->extradata, 4);", "ff_mpc_init();", "init_get_bits(&gb, buf, 128);", "c->IS = get_bits1(&gb);", "c->MSS = get_bits1(&gb);", "c->maxbands = get_bits(&gb, 6);", "if(c->maxbands >= BANDS){", "av_log(VAR_0, AV_LOG_ERROR, \"Too many bands: %VAR_1\\n\", c->maxbands);", "return -1;", "}", "skip_bits(&gb, 88);", "c->gapless = get_bits1(&gb);", "c->lastframelen = get_bits(&gb, 11);", "av_log(VAR_0, AV_LOG_DEBUG, \"IS: %d, MSS: %d, TG: %d, LFL: %d, bands: %d\\n\",\nc->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands);", "c->frames_to_skip = 0;", "if(VAR_3) return 0;", "av_log(VAR_0, AV_LOG_DEBUG, \"Initing VLC\\n\");", "if(init_vlc(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE,\n&mpc7_scfi[1], 2, 1,\n&mpc7_scfi[0], 2, 1, INIT_VLC_USE_STATIC)){", "av_log(VAR_0, AV_LOG_ERROR, \"Cannot init SCFI VLC\\n\");", "return -1;", "}", "if(init_vlc(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE,\n&mpc7_dscf[1], 2, 1,\n&mpc7_dscf[0], 2, 1, INIT_VLC_USE_STATIC)){", "av_log(VAR_0, AV_LOG_ERROR, \"Cannot init DSCF VLC\\n\");", "return -1;", "}", "if(init_vlc(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE,\n&mpc7_hdr[1], 2, 1,\n&mpc7_hdr[0], 2, 1, INIT_VLC_USE_STATIC)){", "av_log(VAR_0, AV_LOG_ERROR, \"Cannot init HDR VLC\\n\");", "return -1;", "}", "for(VAR_1 = 0; VAR_1 < MPC7_QUANT_VLC_TABLES; VAR_1++){", "for(VAR_2 = 0; VAR_2 < 2; VAR_2++){", "if(init_vlc(&quant_vlc[VAR_1][VAR_2], 9, mpc7_quant_vlc_sizes[VAR_1],\n&mpc7_quant_vlc[VAR_1][VAR_2][1], 4, 2,\n&mpc7_quant_vlc[VAR_1][VAR_2][0], 4, 2, INIT_VLC_USE_STATIC)){", "av_log(VAR_0, AV_LOG_ERROR, \"Cannot init QUANT VLC %VAR_1,%VAR_1\\n\",VAR_1,VAR_2);", "return -1;", "}", "}", "}", "VAR_3 = 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71, 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ] ]
13,299
void ff_vp3_idct_altivec(DCTELEM block[64]) { IDCT_START IDCT_1D(NOP, NOP) TRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7); IDCT_1D(ADD8, SHIFT4) vec_st(b0, 0x00, block); vec_st(b1, 0x10, block); vec_st(b2, 0x20, block); vec_st(b3, 0x30, block); vec_st(b4, 0x40, block); vec_st(b5, 0x50, block); vec_st(b6, 0x60, block); vec_st(b7, 0x70, block); }
false
FFmpeg
28f9ab7029bd1a02f659995919f899f84ee7361b
void ff_vp3_idct_altivec(DCTELEM block[64]) { IDCT_START IDCT_1D(NOP, NOP) TRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7); IDCT_1D(ADD8, SHIFT4) vec_st(b0, 0x00, block); vec_st(b1, 0x10, block); vec_st(b2, 0x20, block); vec_st(b3, 0x30, block); vec_st(b4, 0x40, block); vec_st(b5, 0x50, block); vec_st(b6, 0x60, block); vec_st(b7, 0x70, block); }
{ "code": [], "line_no": [] }
void FUNC_0(DCTELEM VAR_0[64]) { IDCT_START IDCT_1D(NOP, NOP) TRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7); IDCT_1D(ADD8, SHIFT4) vec_st(b0, 0x00, VAR_0); vec_st(b1, 0x10, VAR_0); vec_st(b2, 0x20, VAR_0); vec_st(b3, 0x30, VAR_0); vec_st(b4, 0x40, VAR_0); vec_st(b5, 0x50, VAR_0); vec_st(b6, 0x60, VAR_0); vec_st(b7, 0x70, VAR_0); }
[ "void FUNC_0(DCTELEM VAR_0[64])\n{", "IDCT_START\nIDCT_1D(NOP, NOP)\nTRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7);", "IDCT_1D(ADD8, SHIFT4)\nvec_st(b0, 0x00, VAR_0);", "vec_st(b1, 0x10, VAR_0);", "vec_st(b2, 0x20, VAR_0);", "vec_st(b3, 0x30, VAR_0);", "vec_st(b4, 0x40, VAR_0);", "vec_st(b5, 0x50, VAR_0);", "vec_st(b6, 0x60, VAR_0);", "vec_st(b7, 0x70, VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 9, 11 ], [ 13, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
13,300
static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, j, entries, ctts_count = 0; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ entries = avio_rb32(pb); av_log(c->fc, AV_LOG_TRACE, "track[%u].ctts.entries = %u\n", c->fc->nb_streams - 1, entries); if (!entries) return 0; if (entries >= UINT_MAX / sizeof(*sc->ctts_data)) return AVERROR_INVALIDDATA; av_freep(&sc->ctts_data); sc->ctts_data = av_fast_realloc(NULL, &sc->ctts_allocated_size, entries * sizeof(*sc->ctts_data)); if (!sc->ctts_data) return AVERROR(ENOMEM); for (i = 0; i < entries && !pb->eof_reached; i++) { int count =avio_rb32(pb); int duration =avio_rb32(pb); if (count <= 0) { av_log(c->fc, AV_LOG_TRACE, "ignoring CTTS entry with count=%d duration=%d\n", count, duration); continue; } /* Expand entries such that we have a 1-1 mapping with samples. */ for (j = 0; j < count; j++) add_ctts_entry(&sc->ctts_data, &ctts_count, &sc->ctts_allocated_size, 1, duration); av_log(c->fc, AV_LOG_TRACE, "count=%d, duration=%d\n", count, duration); if (FFNABS(duration) < -(1<<28) && i+2<entries) { av_log(c->fc, AV_LOG_WARNING, "CTTS invalid\n"); av_freep(&sc->ctts_data); sc->ctts_count = 0; return 0; } if (i+2<entries) mov_update_dts_shift(sc, duration); } sc->ctts_count = ctts_count; if (pb->eof_reached) return AVERROR_EOF; av_log(c->fc, AV_LOG_TRACE, "dts shift %d\n", sc->dts_shift); return 0; }
false
FFmpeg
2d015d3bf9fed59c65a3819a35fedbb8b7dde623
static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, j, entries, ctts_count = 0; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); avio_rb24(pb); entries = avio_rb32(pb); av_log(c->fc, AV_LOG_TRACE, "track[%u].ctts.entries = %u\n", c->fc->nb_streams - 1, entries); if (!entries) return 0; if (entries >= UINT_MAX / sizeof(*sc->ctts_data)) return AVERROR_INVALIDDATA; av_freep(&sc->ctts_data); sc->ctts_data = av_fast_realloc(NULL, &sc->ctts_allocated_size, entries * sizeof(*sc->ctts_data)); if (!sc->ctts_data) return AVERROR(ENOMEM); for (i = 0; i < entries && !pb->eof_reached; i++) { int count =avio_rb32(pb); int duration =avio_rb32(pb); if (count <= 0) { av_log(c->fc, AV_LOG_TRACE, "ignoring CTTS entry with count=%d duration=%d\n", count, duration); continue; } for (j = 0; j < count; j++) add_ctts_entry(&sc->ctts_data, &ctts_count, &sc->ctts_allocated_size, 1, duration); av_log(c->fc, AV_LOG_TRACE, "count=%d, duration=%d\n", count, duration); if (FFNABS(duration) < -(1<<28) && i+2<entries) { av_log(c->fc, AV_LOG_WARNING, "CTTS invalid\n"); av_freep(&sc->ctts_data); sc->ctts_count = 0; return 0; } if (i+2<entries) mov_update_dts_shift(sc, duration); } sc->ctts_count = ctts_count; if (pb->eof_reached) return AVERROR_EOF; av_log(c->fc, AV_LOG_TRACE, "dts shift %d\n", sc->dts_shift); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st; MOVStreamContext *sc; unsigned int VAR_3, VAR_4, VAR_5, VAR_6 = 0; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; sc = st->priv_data; avio_r8(VAR_1); avio_rb24(VAR_1); VAR_5 = avio_rb32(VAR_1); av_log(VAR_0->fc, AV_LOG_TRACE, "track[%u].ctts.VAR_5 = %u\n", VAR_0->fc->nb_streams - 1, VAR_5); if (!VAR_5) return 0; if (VAR_5 >= UINT_MAX / sizeof(*sc->ctts_data)) return AVERROR_INVALIDDATA; av_freep(&sc->ctts_data); sc->ctts_data = av_fast_realloc(NULL, &sc->ctts_allocated_size, VAR_5 * sizeof(*sc->ctts_data)); if (!sc->ctts_data) return AVERROR(ENOMEM); for (VAR_3 = 0; VAR_3 < VAR_5 && !VAR_1->eof_reached; VAR_3++) { int count =avio_rb32(VAR_1); int duration =avio_rb32(VAR_1); if (count <= 0) { av_log(VAR_0->fc, AV_LOG_TRACE, "ignoring CTTS entry with count=%d duration=%d\n", count, duration); continue; } for (VAR_4 = 0; VAR_4 < count; VAR_4++) add_ctts_entry(&sc->ctts_data, &VAR_6, &sc->ctts_allocated_size, 1, duration); av_log(VAR_0->fc, AV_LOG_TRACE, "count=%d, duration=%d\n", count, duration); if (FFNABS(duration) < -(1<<28) && VAR_3+2<VAR_5) { av_log(VAR_0->fc, AV_LOG_WARNING, "CTTS invalid\n"); av_freep(&sc->ctts_data); sc->VAR_6 = 0; return 0; } if (VAR_3+2<VAR_5) mov_update_dts_shift(sc, duration); } sc->VAR_6 = VAR_6; if (VAR_1->eof_reached) return AVERROR_EOF; av_log(VAR_0->fc, AV_LOG_TRACE, "dts shift %d\n", sc->dts_shift); return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st;", "MOVStreamContext *sc;", "unsigned int VAR_3, VAR_4, VAR_5, VAR_6 = 0;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "sc = st->priv_data;", "avio_r8(VAR_1);", "avio_rb24(VAR_1);", "VAR_5 = avio_rb32(VAR_1);", "av_log(VAR_0->fc, AV_LOG_TRACE, \"track[%u].ctts.VAR_5 = %u\\n\", VAR_0->fc->nb_streams - 1, VAR_5);", "if (!VAR_5)\nreturn 0;", "if (VAR_5 >= UINT_MAX / sizeof(*sc->ctts_data))\nreturn AVERROR_INVALIDDATA;", "av_freep(&sc->ctts_data);", "sc->ctts_data = av_fast_realloc(NULL, &sc->ctts_allocated_size, VAR_5 * sizeof(*sc->ctts_data));", "if (!sc->ctts_data)\nreturn AVERROR(ENOMEM);", "for (VAR_3 = 0; VAR_3 < VAR_5 && !VAR_1->eof_reached; VAR_3++) {", "int count =avio_rb32(VAR_1);", "int duration =avio_rb32(VAR_1);", "if (count <= 0) {", "av_log(VAR_0->fc, AV_LOG_TRACE,\n\"ignoring CTTS entry with count=%d duration=%d\\n\",\ncount, duration);", "continue;", "}", "for (VAR_4 = 0; VAR_4 < count; VAR_4++)", "add_ctts_entry(&sc->ctts_data, &VAR_6, &sc->ctts_allocated_size, 1, duration);", "av_log(VAR_0->fc, AV_LOG_TRACE, \"count=%d, duration=%d\\n\",\ncount, duration);", "if (FFNABS(duration) < -(1<<28) && VAR_3+2<VAR_5) {", "av_log(VAR_0->fc, AV_LOG_WARNING, \"CTTS invalid\\n\");", "av_freep(&sc->ctts_data);", "sc->VAR_6 = 0;", "return 0;", "}", "if (VAR_3+2<VAR_5)\nmov_update_dts_shift(sc, duration);", "}", "sc->VAR_6 = VAR_6;", "if (VAR_1->eof_reached)\nreturn AVERROR_EOF;", "av_log(VAR_0->fc, AV_LOG_TRACE, \"dts shift %d\\n\", sc->dts_shift);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63, 65, 67 ], [ 69 ], [ 71 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103, 105 ], [ 107 ], [ 111 ], [ 115, 117 ], [ 121 ], [ 125 ], [ 127 ] ]
13,301
static void gen_mfsrin(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } t0 = tcg_temp_new(); tcg_gen_shri_tl(t0, cpu_gpr[rB(ctx->opcode)], 28); tcg_gen_andi_tl(t0, t0, 0xF); gen_helper_load_sr(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); tcg_temp_free(t0); #endif }
true
qemu
9b2fadda3e0196ffd485adde4fe9cdd6fae35300
static void gen_mfsrin(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } t0 = tcg_temp_new(); tcg_gen_shri_tl(t0, cpu_gpr[rB(ctx->opcode)], 28); tcg_gen_andi_tl(t0, t0, 0xF); gen_helper_load_sr(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); tcg_temp_free(t0); #endif }
{ "code": [ " if (unlikely(ctx->pr)) {", " if (unlikely(ctx->pr)) {", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#endif", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif" ], "line_no": [ 13, 13, 5, 7, 9, 13, 15, 31, 5, 7, 9, 13, 15, 31, 31, 5, 7, 9, 13, 15, 13, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 31, 13, 31, 31, 31, 13, 31, 13, 31, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 7, 13, 15, 31, 5, 9, 13, 31, 13, 31, 5, 9, 13, 31, 5, 9, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 5, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31, 13, 31 ] }
static void FUNC_0(DisasContext *VAR_0) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG); #else TCGv t0; if (unlikely(VAR_0->pr)) { gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG); return; } t0 = tcg_temp_new(); tcg_gen_shri_tl(t0, cpu_gpr[rB(VAR_0->opcode)], 28); tcg_gen_andi_tl(t0, t0, 0xF); gen_helper_load_sr(cpu_gpr[rD(VAR_0->opcode)], cpu_env, t0); tcg_temp_free(t0); #endif }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "#if defined(CONFIG_USER_ONLY)\ngen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG);", "#else\nTCGv t0;", "if (unlikely(VAR_0->pr)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG);", "return;", "}", "t0 = tcg_temp_new();", "tcg_gen_shri_tl(t0, cpu_gpr[rB(VAR_0->opcode)], 28);", "tcg_gen_andi_tl(t0, t0, 0xF);", "gen_helper_load_sr(cpu_gpr[rD(VAR_0->opcode)], cpu_env, t0);", "tcg_temp_free(t0);", "#endif\n}" ]
[ 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ] ]
13,304
void qemu_sem_wait(QemuSemaphore *sem) { #if defined(__APPLE__) || defined(__NetBSD__) pthread_mutex_lock(&sem->lock); --sem->count; while (sem->count < 0) { pthread_cond_wait(&sem->cond, &sem->lock); } pthread_mutex_unlock(&sem->lock); #else int rc; do { rc = sem_wait(&sem->sem); } while (rc == -1 && errno == EINTR); if (rc < 0) { error_exit(errno, __func__); } #endif }
true
qemu
79761c6681f0d1cc1c027116fcb4382d41ed3ece
void qemu_sem_wait(QemuSemaphore *sem) { #if defined(__APPLE__) || defined(__NetBSD__) pthread_mutex_lock(&sem->lock); --sem->count; while (sem->count < 0) { pthread_cond_wait(&sem->cond, &sem->lock); } pthread_mutex_unlock(&sem->lock); #else int rc; do { rc = sem_wait(&sem->sem); } while (rc == -1 && errno == EINTR); if (rc < 0) { error_exit(errno, __func__); } #endif }
{ "code": [ " --sem->count;", " while (sem->count < 0) {", " --sem->count;", " while (sem->count < 0) {", " pthread_cond_wait(&sem->cond, &sem->lock);", " int rc;" ], "line_no": [ 9, 11, 9, 11, 13, 21 ] }
void FUNC_0(QemuSemaphore *VAR_0) { #if defined(__APPLE__) || defined(__NetBSD__) pthread_mutex_lock(&VAR_0->lock); --VAR_0->count; while (VAR_0->count < 0) { pthread_cond_wait(&VAR_0->cond, &VAR_0->lock); } pthread_mutex_unlock(&VAR_0->lock); #else int rc; do { rc = sem_wait(&VAR_0->VAR_0); } while (rc == -1 && errno == EINTR); if (rc < 0) { error_exit(errno, __func__); } #endif }
[ "void FUNC_0(QemuSemaphore *VAR_0)\n{", "#if defined(__APPLE__) || defined(__NetBSD__)\npthread_mutex_lock(&VAR_0->lock);", "--VAR_0->count;", "while (VAR_0->count < 0) {", "pthread_cond_wait(&VAR_0->cond, &VAR_0->lock);", "}", "pthread_mutex_unlock(&VAR_0->lock);", "#else\nint rc;", "do {", "rc = sem_wait(&VAR_0->VAR_0);", "} while (rc == -1 && errno == EINTR);", "if (rc < 0) {", "error_exit(errno, __func__);", "}", "#endif\n}" ]
[ 0, 0, 1, 1, 1, 0, 0, 1, 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 ] ]
13,305
static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags) { int isv34, tlen, unsync; char tag[5]; int64_t next, end = avio_tell(s->pb) + len; int taghdrlen; const char *reason = NULL; AVIOContext pb; unsigned char *buffer = NULL; int buffer_size = 0; switch (version) { case 2: if (flags & 0x40) { reason = "compression"; goto error; } isv34 = 0; taghdrlen = 6; break; case 3: case 4: isv34 = 1; taghdrlen = 10; break; default: reason = "version"; goto error; } unsync = flags & 0x80; if (isv34 && flags & 0x40) /* Extended header present, just skip over it */ avio_skip(s->pb, get_size(s->pb, 4)); while (len >= taghdrlen) { unsigned int tflags; int tunsync = 0; if (isv34) { avio_read(s->pb, tag, 4); tag[4] = 0; if(version==3){ tlen = avio_rb32(s->pb); }else tlen = get_size(s->pb, 4); tflags = avio_rb16(s->pb); tunsync = tflags & ID3v2_FLAG_UNSYNCH; } else { avio_read(s->pb, tag, 3); tag[3] = 0; tlen = avio_rb24(s->pb); } len -= taghdrlen + tlen; if (len < 0) break; next = avio_tell(s->pb) + tlen; if (tflags & ID3v2_FLAG_DATALEN) { avio_rb32(s->pb); tlen -= 4; } if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) { av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag); avio_skip(s->pb, tlen); } else if (tag[0] == 'T') { if (unsync || tunsync) { int i, j; av_fast_malloc(&buffer, &buffer_size, tlen); for (i = 0, j = 0; i < tlen; i++, j++) { buffer[j] = avio_r8(s->pb); if (j > 0 && !buffer[j] && buffer[j - 1] == 0xff) { /* Unsynchronised byte, skip it */ j--; } } ffio_init_context(&pb, buffer, j, 0, NULL, NULL, NULL, NULL); read_ttag(s, &pb, j, tag); } else { read_ttag(s, s->pb, tlen, tag); } } else if (!tag[0]) { if (tag[1]) av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); avio_skip(s->pb, tlen); break; } /* Skip to end of tag */ avio_seek(s->pb, next, SEEK_SET); } if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */ end += 10; error: if (reason) av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason); avio_seek(s->pb, end, SEEK_SET); av_free(buffer); return; }
false
FFmpeg
c5f4c0fd5c791ba97eb266cc30ae2172c10feb20
static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags) { int isv34, tlen, unsync; char tag[5]; int64_t next, end = avio_tell(s->pb) + len; int taghdrlen; const char *reason = NULL; AVIOContext pb; unsigned char *buffer = NULL; int buffer_size = 0; switch (version) { case 2: if (flags & 0x40) { reason = "compression"; goto error; } isv34 = 0; taghdrlen = 6; break; case 3: case 4: isv34 = 1; taghdrlen = 10; break; default: reason = "version"; goto error; } unsync = flags & 0x80; if (isv34 && flags & 0x40) avio_skip(s->pb, get_size(s->pb, 4)); while (len >= taghdrlen) { unsigned int tflags; int tunsync = 0; if (isv34) { avio_read(s->pb, tag, 4); tag[4] = 0; if(version==3){ tlen = avio_rb32(s->pb); }else tlen = get_size(s->pb, 4); tflags = avio_rb16(s->pb); tunsync = tflags & ID3v2_FLAG_UNSYNCH; } else { avio_read(s->pb, tag, 3); tag[3] = 0; tlen = avio_rb24(s->pb); } len -= taghdrlen + tlen; if (len < 0) break; next = avio_tell(s->pb) + tlen; if (tflags & ID3v2_FLAG_DATALEN) { avio_rb32(s->pb); tlen -= 4; } if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) { av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag); avio_skip(s->pb, tlen); } else if (tag[0] == 'T') { if (unsync || tunsync) { int i, j; av_fast_malloc(&buffer, &buffer_size, tlen); for (i = 0, j = 0; i < tlen; i++, j++) { buffer[j] = avio_r8(s->pb); if (j > 0 && !buffer[j] && buffer[j - 1] == 0xff) { j--; } } ffio_init_context(&pb, buffer, j, 0, NULL, NULL, NULL, NULL); read_ttag(s, &pb, j, tag); } else { read_ttag(s, s->pb, tlen, tag); } } else if (!tag[0]) { if (tag[1]) av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); avio_skip(s->pb, tlen); break; } avio_seek(s->pb, next, SEEK_SET); } if (version == 4 && flags & 0x10) end += 10; error: if (reason) av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason); avio_seek(s->pb, end, SEEK_SET); av_free(buffer); return; }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, int VAR_1, uint8_t VAR_2, uint8_t VAR_3) { int VAR_4, VAR_5, VAR_6; char VAR_7[5]; int64_t next, end = avio_tell(VAR_0->pb) + VAR_1; int VAR_8; const char *VAR_9 = NULL; AVIOContext pb; unsigned char *VAR_10 = NULL; int VAR_11 = 0; switch (VAR_2) { case 2: if (VAR_3 & 0x40) { VAR_9 = "compression"; goto error; } VAR_4 = 0; VAR_8 = 6; break; case 3: case 4: VAR_4 = 1; VAR_8 = 10; break; default: VAR_9 = "VAR_2"; goto error; } VAR_6 = VAR_3 & 0x80; if (VAR_4 && VAR_3 & 0x40) avio_skip(VAR_0->pb, get_size(VAR_0->pb, 4)); while (VAR_1 >= VAR_8) { unsigned int VAR_12; int VAR_13 = 0; if (VAR_4) { avio_read(VAR_0->pb, VAR_7, 4); VAR_7[4] = 0; if(VAR_2==3){ VAR_5 = avio_rb32(VAR_0->pb); }else VAR_5 = get_size(VAR_0->pb, 4); VAR_12 = avio_rb16(VAR_0->pb); VAR_13 = VAR_12 & ID3v2_FLAG_UNSYNCH; } else { avio_read(VAR_0->pb, VAR_7, 3); VAR_7[3] = 0; VAR_5 = avio_rb24(VAR_0->pb); } VAR_1 -= VAR_8 + VAR_5; if (VAR_1 < 0) break; next = avio_tell(VAR_0->pb) + VAR_5; if (VAR_12 & ID3v2_FLAG_DATALEN) { avio_rb32(VAR_0->pb); VAR_5 -= 4; } if (VAR_12 & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) { av_log(VAR_0, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %VAR_0.\n", VAR_7); avio_skip(VAR_0->pb, VAR_5); } else if (VAR_7[0] == 'T') { if (VAR_6 || VAR_13) { int VAR_14, VAR_15; av_fast_malloc(&VAR_10, &VAR_11, VAR_5); for (VAR_14 = 0, VAR_15 = 0; VAR_14 < VAR_5; VAR_14++, VAR_15++) { VAR_10[VAR_15] = avio_r8(VAR_0->pb); if (VAR_15 > 0 && !VAR_10[VAR_15] && VAR_10[VAR_15 - 1] == 0xff) { VAR_15--; } } ffio_init_context(&pb, VAR_10, VAR_15, 0, NULL, NULL, NULL, NULL); read_ttag(VAR_0, &pb, VAR_15, VAR_7); } else { read_ttag(VAR_0, VAR_0->pb, VAR_5, VAR_7); } } else if (!VAR_7[0]) { if (VAR_7[1]) av_log(VAR_0, AV_LOG_WARNING, "invalid frame id, assuming padding"); avio_skip(VAR_0->pb, VAR_5); break; } avio_seek(VAR_0->pb, next, SEEK_SET); } if (VAR_2 == 4 && VAR_3 & 0x10) end += 10; error: if (VAR_9) av_log(VAR_0, AV_LOG_INFO, "ID3v2.%d VAR_7 skipped, cannot handle %VAR_0\n", VAR_2, VAR_9); avio_seek(VAR_0->pb, end, SEEK_SET); av_free(VAR_10); return; }
[ "static void FUNC_0(AVFormatContext *VAR_0, int VAR_1, uint8_t VAR_2, uint8_t VAR_3)\n{", "int VAR_4, VAR_5, VAR_6;", "char VAR_7[5];", "int64_t next, end = avio_tell(VAR_0->pb) + VAR_1;", "int VAR_8;", "const char *VAR_9 = NULL;", "AVIOContext pb;", "unsigned char *VAR_10 = NULL;", "int VAR_11 = 0;", "switch (VAR_2) {", "case 2:\nif (VAR_3 & 0x40) {", "VAR_9 = \"compression\";", "goto error;", "}", "VAR_4 = 0;", "VAR_8 = 6;", "break;", "case 3:\ncase 4:\nVAR_4 = 1;", "VAR_8 = 10;", "break;", "default:\nVAR_9 = \"VAR_2\";", "goto error;", "}", "VAR_6 = VAR_3 & 0x80;", "if (VAR_4 && VAR_3 & 0x40)\navio_skip(VAR_0->pb, get_size(VAR_0->pb, 4));", "while (VAR_1 >= VAR_8) {", "unsigned int VAR_12;", "int VAR_13 = 0;", "if (VAR_4) {", "avio_read(VAR_0->pb, VAR_7, 4);", "VAR_7[4] = 0;", "if(VAR_2==3){", "VAR_5 = avio_rb32(VAR_0->pb);", "}else", "VAR_5 = get_size(VAR_0->pb, 4);", "VAR_12 = avio_rb16(VAR_0->pb);", "VAR_13 = VAR_12 & ID3v2_FLAG_UNSYNCH;", "} else {", "avio_read(VAR_0->pb, VAR_7, 3);", "VAR_7[3] = 0;", "VAR_5 = avio_rb24(VAR_0->pb);", "}", "VAR_1 -= VAR_8 + VAR_5;", "if (VAR_1 < 0)\nbreak;", "next = avio_tell(VAR_0->pb) + VAR_5;", "if (VAR_12 & ID3v2_FLAG_DATALEN) {", "avio_rb32(VAR_0->pb);", "VAR_5 -= 4;", "}", "if (VAR_12 & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) {", "av_log(VAR_0, AV_LOG_WARNING, \"Skipping encrypted/compressed ID3v2 frame %VAR_0.\\n\", VAR_7);", "avio_skip(VAR_0->pb, VAR_5);", "} else if (VAR_7[0] == 'T') {", "if (VAR_6 || VAR_13) {", "int VAR_14, VAR_15;", "av_fast_malloc(&VAR_10, &VAR_11, VAR_5);", "for (VAR_14 = 0, VAR_15 = 0; VAR_14 < VAR_5; VAR_14++, VAR_15++) {", "VAR_10[VAR_15] = avio_r8(VAR_0->pb);", "if (VAR_15 > 0 && !VAR_10[VAR_15] && VAR_10[VAR_15 - 1] == 0xff) {", "VAR_15--;", "}", "}", "ffio_init_context(&pb, VAR_10, VAR_15, 0, NULL, NULL, NULL, NULL);", "read_ttag(VAR_0, &pb, VAR_15, VAR_7);", "} else {", "read_ttag(VAR_0, VAR_0->pb, VAR_5, VAR_7);", "}", "}", "else if (!VAR_7[0]) {", "if (VAR_7[1])\nav_log(VAR_0, AV_LOG_WARNING, \"invalid frame id, assuming padding\");", "avio_skip(VAR_0->pb, VAR_5);", "break;", "}", "avio_seek(VAR_0->pb, next, SEEK_SET);", "}", "if (VAR_2 == 4 && VAR_3 & 0x10)\nend += 10;", "error:\nif (VAR_9)\nav_log(VAR_0, AV_LOG_INFO, \"ID3v2.%d VAR_7 skipped, cannot handle %VAR_0\\n\", VAR_2, VAR_9);", "avio_seek(VAR_0->pb, end, SEEK_SET);", "av_free(VAR_10);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45, 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 65 ], [ 69, 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115, 117 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 195, 197 ], [ 201, 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ] ]
13,306
void palette8torgb24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) { long i; /* writes 1 byte o much and might cause alignment issues on some architectures? for(i=0; i<num_pixels; i++) ((unsigned *)(&dst[i*3])) = ((unsigned *)palette)[ src[i] ]; */ for(i=0; i<num_pixels; i++) { //FIXME slow? dst[0]= palette[ src[i]*4+2 ]; dst[1]= palette[ src[i]*4+1 ]; dst[2]= palette[ src[i]*4+0 ]; dst+= 3; } }
true
FFmpeg
6e42e6c4b410dbef8b593c2d796a5dad95f89ee4
void palette8torgb24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) { long i; for(i=0; i<num_pixels; i++) { dst[0]= palette[ src[i]*4+2 ]; dst[1]= palette[ src[i]*4+1 ]; dst[2]= palette[ src[i]*4+0 ]; dst+= 3; } }
{ "code": [ "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tfor(i=0; i<num_pixels; i++)", "\t\tdst[0]= palette[ src[i]*4+2 ];", "\t\tdst[1]= palette[ src[i]*4+1 ];", "\t\tdst[2]= palette[ src[i]*4+0 ];", "\t\tdst+= 3;", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tfor(i=0; i<num_pixels; i++)", "\t\tdst[1]= palette[ src[i]*4+1 ];", "\t\tdst+= 3;", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)", "\tlong i;", "\tfor(i=0; i<num_pixels; i++)" ], "line_no": [ 5, 17, 17, 5, 17, 5, 17, 17, 23, 25, 27, 29, 5, 17, 17, 25, 29, 5, 17, 5, 17, 5, 17, 5, 17, 5, 17, 5, 5, 17, 5, 17, 5, 17, 5, 17, 5, 17 ] }
void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, long VAR_2, const uint8_t *VAR_3) { long VAR_4; for(VAR_4=0; VAR_4<VAR_2; VAR_4++) { VAR_1[0]= VAR_3[ VAR_0[VAR_4]*4+2 ]; VAR_1[1]= VAR_3[ VAR_0[VAR_4]*4+1 ]; VAR_1[2]= VAR_3[ VAR_0[VAR_4]*4+0 ]; VAR_1+= 3; } }
[ "void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, long VAR_2, const uint8_t *VAR_3)\n{", "long VAR_4;", "for(VAR_4=0; VAR_4<VAR_2; VAR_4++)", "{", "VAR_1[0]= VAR_3[ VAR_0[VAR_4]*4+2 ];", "VAR_1[1]= VAR_3[ VAR_0[VAR_4]*4+1 ];", "VAR_1[2]= VAR_3[ VAR_0[VAR_4]*4+0 ];", "VAR_1+= 3;", "}", "}" ]
[ 0, 1, 1, 0, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
13,308
static int m25p80_init(SSISlave *ss) { DriveInfo *dinfo; Flash *s = M25P80(ss); M25P80Class *mc = M25P80_GET_CLASS(s); s->pi = mc->pi; s->size = s->pi->sector_size * s->pi->n_sectors; s->dirty_page = -1; s->storage = blk_blockalign(s->blk, s->size); /* FIXME use a qdev drive property instead of drive_get_next() */ dinfo = drive_get_next(IF_MTD); if (dinfo) { DB_PRINT_L(0, "Binding to IF_MTD drive\n"); s->blk = blk_by_legacy_dinfo(dinfo); blk_attach_dev_nofail(s->blk, s); /* FIXME: Move to late init */ if (blk_read(s->blk, 0, s->storage, DIV_ROUND_UP(s->size, BDRV_SECTOR_SIZE))) { fprintf(stderr, "Failed to initialize SPI flash!\n"); return 1; } } else { DB_PRINT_L(0, "No BDRV - binding to RAM\n"); memset(s->storage, 0xFF, s->size); } return 0; }
true
qemu
c485cf9c9277ca9b3d5227c99a13c374e812f42b
static int m25p80_init(SSISlave *ss) { DriveInfo *dinfo; Flash *s = M25P80(ss); M25P80Class *mc = M25P80_GET_CLASS(s); s->pi = mc->pi; s->size = s->pi->sector_size * s->pi->n_sectors; s->dirty_page = -1; s->storage = blk_blockalign(s->blk, s->size); dinfo = drive_get_next(IF_MTD); if (dinfo) { DB_PRINT_L(0, "Binding to IF_MTD drive\n"); s->blk = blk_by_legacy_dinfo(dinfo); blk_attach_dev_nofail(s->blk, s); if (blk_read(s->blk, 0, s->storage, DIV_ROUND_UP(s->size, BDRV_SECTOR_SIZE))) { fprintf(stderr, "Failed to initialize SPI flash!\n"); return 1; } } else { DB_PRINT_L(0, "No BDRV - binding to RAM\n"); memset(s->storage, 0xFF, s->size); } return 0; }
{ "code": [ " s->storage = blk_blockalign(s->blk, s->size);" ], "line_no": [ 21 ] }
static int FUNC_0(SSISlave *VAR_0) { DriveInfo *dinfo; Flash *s = M25P80(VAR_0); M25P80Class *mc = M25P80_GET_CLASS(s); s->pi = mc->pi; s->size = s->pi->sector_size * s->pi->n_sectors; s->dirty_page = -1; s->storage = blk_blockalign(s->blk, s->size); dinfo = drive_get_next(IF_MTD); if (dinfo) { DB_PRINT_L(0, "Binding to IF_MTD drive\n"); s->blk = blk_by_legacy_dinfo(dinfo); blk_attach_dev_nofail(s->blk, s); if (blk_read(s->blk, 0, s->storage, DIV_ROUND_UP(s->size, BDRV_SECTOR_SIZE))) { fprintf(stderr, "Failed to initialize SPI flash!\n"); return 1; } } else { DB_PRINT_L(0, "No BDRV - binding to RAM\n"); memset(s->storage, 0xFF, s->size); } return 0; }
[ "static int FUNC_0(SSISlave *VAR_0)\n{", "DriveInfo *dinfo;", "Flash *s = M25P80(VAR_0);", "M25P80Class *mc = M25P80_GET_CLASS(s);", "s->pi = mc->pi;", "s->size = s->pi->sector_size * s->pi->n_sectors;", "s->dirty_page = -1;", "s->storage = blk_blockalign(s->blk, s->size);", "dinfo = drive_get_next(IF_MTD);", "if (dinfo) {", "DB_PRINT_L(0, \"Binding to IF_MTD drive\\n\");", "s->blk = blk_by_legacy_dinfo(dinfo);", "blk_attach_dev_nofail(s->blk, s);", "if (blk_read(s->blk, 0, s->storage,\nDIV_ROUND_UP(s->size, BDRV_SECTOR_SIZE))) {", "fprintf(stderr, \"Failed to initialize SPI flash!\\n\");", "return 1;", "}", "} else {", "DB_PRINT_L(0, \"No BDRV - binding to RAM\\n\");", "memset(s->storage, 0xFF, s->size);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
13,309
void visit_start_list(Visitor *v, const char *name, GenericList **list, size_t size, Error **errp) { Error *err = NULL; assert(!list || size >= sizeof(GenericList)); v->start_list(v, name, list, size, &err); if (list && v->type == VISITOR_INPUT) { assert(!(err && *list)); } error_propagate(errp, err); }
true
qemu
a15fcc3cf69ee3d408f60d6cc316488d2b0249b4
void visit_start_list(Visitor *v, const char *name, GenericList **list, size_t size, Error **errp) { Error *err = NULL; assert(!list || size >= sizeof(GenericList)); v->start_list(v, name, list, size, &err); if (list && v->type == VISITOR_INPUT) { assert(!(err && *list)); } error_propagate(errp, err); }
{ "code": [ " if (list && v->type == VISITOR_INPUT) {" ], "line_no": [ 15 ] }
void FUNC_0(Visitor *VAR_0, const char *VAR_1, GenericList **VAR_2, size_t VAR_3, Error **VAR_4) { Error *err = NULL; assert(!VAR_2 || VAR_3 >= sizeof(GenericList)); VAR_0->start_list(VAR_0, VAR_1, VAR_2, VAR_3, &err); if (VAR_2 && VAR_0->type == VISITOR_INPUT) { assert(!(err && *VAR_2)); } error_propagate(VAR_4, err); }
[ "void FUNC_0(Visitor *VAR_0, const char *VAR_1, GenericList **VAR_2,\nsize_t VAR_3, Error **VAR_4)\n{", "Error *err = NULL;", "assert(!VAR_2 || VAR_3 >= sizeof(GenericList));", "VAR_0->start_list(VAR_0, VAR_1, VAR_2, VAR_3, &err);", "if (VAR_2 && VAR_0->type == VISITOR_INPUT) {", "assert(!(err && *VAR_2));", "}", "error_propagate(VAR_4, err);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
13,310
static unsigned __stdcall win32_start_routine(void *arg) { struct QemuThreadData data = *(struct QemuThreadData *) arg; QemuThread *thread = data.thread; free(arg); TlsSetValue(qemu_thread_tls_index, thread); /* * Use DuplicateHandle instead of assigning thread->thread in the * creating thread to avoid races. It's simpler this way than with * synchronization. */ DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &thread->thread, 0, FALSE, DUPLICATE_SAME_ACCESS); qemu_thread_exit(data.start_routine(data.arg)); abort(); }
true
qemu
403e633126b7a781ecd48a29e3355770d46bbf1a
static unsigned __stdcall win32_start_routine(void *arg) { struct QemuThreadData data = *(struct QemuThreadData *) arg; QemuThread *thread = data.thread; free(arg); TlsSetValue(qemu_thread_tls_index, thread); DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &thread->thread, 0, FALSE, DUPLICATE_SAME_ACCESS); qemu_thread_exit(data.start_routine(data.arg)); abort(); }
{ "code": [ " struct QemuThreadData data = *(struct QemuThreadData *) arg;", " QemuThread *thread = data.thread;", " free(arg);", " TlsSetValue(qemu_thread_tls_index, thread);", " DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),", " GetCurrentProcess(), &thread->thread,", " 0, FALSE, DUPLICATE_SAME_ACCESS);", " qemu_thread_exit(data.start_routine(data.arg));" ], "line_no": [ 5, 7, 11, 13, 27, 29, 31, 35 ] }
static unsigned __stdcall FUNC_0(void *VAR_0) { struct QemuThreadData VAR_1 = *(struct QemuThreadData *) VAR_0; QemuThread *thread = VAR_1.thread; free(VAR_0); TlsSetValue(qemu_thread_tls_index, thread); DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &thread->thread, 0, FALSE, DUPLICATE_SAME_ACCESS); qemu_thread_exit(VAR_1.start_routine(VAR_1.VAR_0)); abort(); }
[ "static unsigned __stdcall FUNC_0(void *VAR_0)\n{", "struct QemuThreadData VAR_1 = *(struct QemuThreadData *) VAR_0;", "QemuThread *thread = VAR_1.thread;", "free(VAR_0);", "TlsSetValue(qemu_thread_tls_index, thread);", "DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),\nGetCurrentProcess(), &thread->thread,\n0, FALSE, DUPLICATE_SAME_ACCESS);", "qemu_thread_exit(VAR_1.start_routine(VAR_1.VAR_0));", "abort();", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 27, 29, 31 ], [ 35 ], [ 37 ], [ 39 ] ]
13,312
static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; unsigned int i, entries; get_byte(pb); /* version */ get_be24(pb); /* flags */ entries = get_be32(pb); dprintf(c->fc, "keyframe_count = %d\n", entries); if(entries >= UINT_MAX / sizeof(int)) return -1; sc->keyframes = av_malloc(entries * sizeof(int)); if (!sc->keyframes) return AVERROR(ENOMEM); sc->keyframe_count = entries; for(i=0; i<entries; i++) { sc->keyframes[i] = get_be32(pb); //dprintf(c->fc, "keyframes[]=%d\n", sc->keyframes[i]); } return 0; }
false
FFmpeg
6a63ff19b6a7fe3bc32c7fb4a62fca8f65786432
static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; unsigned int i, entries; get_byte(pb); get_be24(pb); entries = get_be32(pb); dprintf(c->fc, "keyframe_count = %d\n", entries); if(entries >= UINT_MAX / sizeof(int)) return -1; sc->keyframes = av_malloc(entries * sizeof(int)); if (!sc->keyframes) return AVERROR(ENOMEM); sc->keyframe_count = entries; for(i=0; i<entries; i++) { sc->keyframes[i] = get_be32(pb); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; unsigned int VAR_3, VAR_4; get_byte(VAR_1); get_be24(VAR_1); VAR_4 = get_be32(VAR_1); dprintf(VAR_0->fc, "keyframe_count = %d\n", VAR_4); if(VAR_4 >= UINT_MAX / sizeof(int)) return -1; sc->keyframes = av_malloc(VAR_4 * sizeof(int)); if (!sc->keyframes) return AVERROR(ENOMEM); sc->keyframe_count = VAR_4; for(VAR_3=0; VAR_3<VAR_4; VAR_3++) { sc->keyframes[VAR_3] = get_be32(VAR_1); } return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "MOVStreamContext *sc = st->priv_data;", "unsigned int VAR_3, VAR_4;", "get_byte(VAR_1);", "get_be24(VAR_1);", "VAR_4 = get_be32(VAR_1);", "dprintf(VAR_0->fc, \"keyframe_count = %d\\n\", VAR_4);", "if(VAR_4 >= UINT_MAX / sizeof(int))\nreturn -1;", "sc->keyframes = av_malloc(VAR_4 * sizeof(int));", "if (!sc->keyframes)\nreturn AVERROR(ENOMEM);", "sc->keyframe_count = VAR_4;", "for(VAR_3=0; VAR_3<VAR_4; VAR_3++) {", "sc->keyframes[VAR_3] = get_be32(VAR_1);", "}", "return 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 ], [ 23 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ] ]
13,313
static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f, OpusRangeCoder *rc, int band, float *bits, float lambda) { int i, b = 0; uint32_t cm[2] = { (1 << f->blocks) - 1, (1 << f->blocks) - 1 }; const int band_size = ff_celt_freq_range[band] << f->size; float buf[176 * 2], lowband_scratch[176], norm1[176], norm2[176]; float dist, cost, err_x = 0.0f, err_y = 0.0f; float *X = buf; float *X_orig = f->block[0].coeffs + (ff_celt_freq_bands[band] << f->size); float *Y = (f->channels == 2) ? &buf[176] : NULL; float *Y_orig = f->block[1].coeffs + (ff_celt_freq_bands[band] << f->size); OPUS_RC_CHECKPOINT_SPAWN(rc); memcpy(X, X_orig, band_size*sizeof(float)); if (Y) memcpy(Y, Y_orig, band_size*sizeof(float)); f->remaining2 = ((f->framebits << 3) - f->anticollapse_needed) - opus_rc_tell_frac(rc) - 1; if (band <= f->coded_bands - 1) { int curr_balance = f->remaining / FFMIN(3, f->coded_bands - band); b = av_clip_uintp2(FFMIN(f->remaining2 + 1, f->pulses[band] + curr_balance), 14); } if (f->dual_stereo) { pvq->encode_band(pvq, f, rc, band, X, NULL, band_size, b / 2, f->blocks, NULL, f->size, norm1, 0, 1.0f, lowband_scratch, cm[0]); pvq->encode_band(pvq, f, rc, band, Y, NULL, band_size, b / 2, f->blocks, NULL, f->size, norm2, 0, 1.0f, lowband_scratch, cm[1]); } else { pvq->encode_band(pvq, f, rc, band, X, Y, band_size, b, f->blocks, NULL, f->size, norm1, 0, 1.0f, lowband_scratch, cm[0] | cm[1]); } for (i = 0; i < band_size; i++) { err_x += (X[i] - X_orig[i])*(X[i] - X_orig[i]); err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]); } dist = sqrtf(err_x) + sqrtf(err_y); cost = OPUS_RC_CHECKPOINT_BITS(rc)/8.0f; *bits += cost; OPUS_RC_CHECKPOINT_ROLLBACK(rc); return lambda*dist*cost; }
true
FFmpeg
6e0723470bea258ceb72ee4c4916cf8f80337f92
static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f, OpusRangeCoder *rc, int band, float *bits, float lambda) { int i, b = 0; uint32_t cm[2] = { (1 << f->blocks) - 1, (1 << f->blocks) - 1 }; const int band_size = ff_celt_freq_range[band] << f->size; float buf[176 * 2], lowband_scratch[176], norm1[176], norm2[176]; float dist, cost, err_x = 0.0f, err_y = 0.0f; float *X = buf; float *X_orig = f->block[0].coeffs + (ff_celt_freq_bands[band] << f->size); float *Y = (f->channels == 2) ? &buf[176] : NULL; float *Y_orig = f->block[1].coeffs + (ff_celt_freq_bands[band] << f->size); OPUS_RC_CHECKPOINT_SPAWN(rc); memcpy(X, X_orig, band_size*sizeof(float)); if (Y) memcpy(Y, Y_orig, band_size*sizeof(float)); f->remaining2 = ((f->framebits << 3) - f->anticollapse_needed) - opus_rc_tell_frac(rc) - 1; if (band <= f->coded_bands - 1) { int curr_balance = f->remaining / FFMIN(3, f->coded_bands - band); b = av_clip_uintp2(FFMIN(f->remaining2 + 1, f->pulses[band] + curr_balance), 14); } if (f->dual_stereo) { pvq->encode_band(pvq, f, rc, band, X, NULL, band_size, b / 2, f->blocks, NULL, f->size, norm1, 0, 1.0f, lowband_scratch, cm[0]); pvq->encode_band(pvq, f, rc, band, Y, NULL, band_size, b / 2, f->blocks, NULL, f->size, norm2, 0, 1.0f, lowband_scratch, cm[1]); } else { pvq->encode_band(pvq, f, rc, band, X, Y, band_size, b, f->blocks, NULL, f->size, norm1, 0, 1.0f, lowband_scratch, cm[0] | cm[1]); } for (i = 0; i < band_size; i++) { err_x += (X[i] - X_orig[i])*(X[i] - X_orig[i]); err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]); } dist = sqrtf(err_x) + sqrtf(err_y); cost = OPUS_RC_CHECKPOINT_BITS(rc)/8.0f; *bits += cost; OPUS_RC_CHECKPOINT_ROLLBACK(rc); return lambda*dist*cost; }
{ "code": [ " err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]);" ], "line_no": [ 75 ] }
static float FUNC_0(CeltPVQ *VAR_0, CeltFrame *VAR_1, OpusRangeCoder *VAR_2, int VAR_3, float *VAR_4, float VAR_5) { int VAR_6, VAR_7 = 0; uint32_t cm[2] = { (1 << VAR_1->blocks) - 1, (1 << VAR_1->blocks) - 1 }; const int VAR_8 = ff_celt_freq_range[VAR_3] << VAR_1->size; float VAR_9[176 * 2], VAR_10[176], VAR_11[176], VAR_12[176]; float VAR_13, VAR_14, VAR_15 = 0.0f, VAR_16 = 0.0f; float *VAR_17 = VAR_9; float *VAR_18 = VAR_1->block[0].coeffs + (ff_celt_freq_bands[VAR_3] << VAR_1->size); float *VAR_19 = (VAR_1->channels == 2) ? &VAR_9[176] : NULL; float *VAR_20 = VAR_1->block[1].coeffs + (ff_celt_freq_bands[VAR_3] << VAR_1->size); OPUS_RC_CHECKPOINT_SPAWN(VAR_2); memcpy(VAR_17, VAR_18, VAR_8*sizeof(float)); if (VAR_19) memcpy(VAR_19, VAR_20, VAR_8*sizeof(float)); VAR_1->remaining2 = ((VAR_1->framebits << 3) - VAR_1->anticollapse_needed) - opus_rc_tell_frac(VAR_2) - 1; if (VAR_3 <= VAR_1->coded_bands - 1) { int VAR_21 = VAR_1->remaining / FFMIN(3, VAR_1->coded_bands - VAR_3); VAR_7 = av_clip_uintp2(FFMIN(VAR_1->remaining2 + 1, VAR_1->pulses[VAR_3] + VAR_21), 14); } if (VAR_1->dual_stereo) { VAR_0->encode_band(VAR_0, VAR_1, VAR_2, VAR_3, VAR_17, NULL, VAR_8, VAR_7 / 2, VAR_1->blocks, NULL, VAR_1->size, VAR_11, 0, 1.0f, VAR_10, cm[0]); VAR_0->encode_band(VAR_0, VAR_1, VAR_2, VAR_3, VAR_19, NULL, VAR_8, VAR_7 / 2, VAR_1->blocks, NULL, VAR_1->size, VAR_12, 0, 1.0f, VAR_10, cm[1]); } else { VAR_0->encode_band(VAR_0, VAR_1, VAR_2, VAR_3, VAR_17, VAR_19, VAR_8, VAR_7, VAR_1->blocks, NULL, VAR_1->size, VAR_11, 0, 1.0f, VAR_10, cm[0] | cm[1]); } for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) { VAR_15 += (VAR_17[VAR_6] - VAR_18[VAR_6])*(VAR_17[VAR_6] - VAR_18[VAR_6]); VAR_16 += (VAR_19[VAR_6] - VAR_20[VAR_6])*(VAR_19[VAR_6] - VAR_20[VAR_6]); } VAR_13 = sqrtf(VAR_15) + sqrtf(VAR_16); VAR_14 = OPUS_RC_CHECKPOINT_BITS(VAR_2)/8.0f; *VAR_4 += VAR_14; OPUS_RC_CHECKPOINT_ROLLBACK(VAR_2); return VAR_5*VAR_13*VAR_14; }
[ "static float FUNC_0(CeltPVQ *VAR_0, CeltFrame *VAR_1, OpusRangeCoder *VAR_2, int VAR_3,\nfloat *VAR_4, float VAR_5)\n{", "int VAR_6, VAR_7 = 0;", "uint32_t cm[2] = { (1 << VAR_1->blocks) - 1, (1 << VAR_1->blocks) - 1 };", "const int VAR_8 = ff_celt_freq_range[VAR_3] << VAR_1->size;", "float VAR_9[176 * 2], VAR_10[176], VAR_11[176], VAR_12[176];", "float VAR_13, VAR_14, VAR_15 = 0.0f, VAR_16 = 0.0f;", "float *VAR_17 = VAR_9;", "float *VAR_18 = VAR_1->block[0].coeffs + (ff_celt_freq_bands[VAR_3] << VAR_1->size);", "float *VAR_19 = (VAR_1->channels == 2) ? &VAR_9[176] : NULL;", "float *VAR_20 = VAR_1->block[1].coeffs + (ff_celt_freq_bands[VAR_3] << VAR_1->size);", "OPUS_RC_CHECKPOINT_SPAWN(VAR_2);", "memcpy(VAR_17, VAR_18, VAR_8*sizeof(float));", "if (VAR_19)\nmemcpy(VAR_19, VAR_20, VAR_8*sizeof(float));", "VAR_1->remaining2 = ((VAR_1->framebits << 3) - VAR_1->anticollapse_needed) - opus_rc_tell_frac(VAR_2) - 1;", "if (VAR_3 <= VAR_1->coded_bands - 1) {", "int VAR_21 = VAR_1->remaining / FFMIN(3, VAR_1->coded_bands - VAR_3);", "VAR_7 = av_clip_uintp2(FFMIN(VAR_1->remaining2 + 1, VAR_1->pulses[VAR_3] + VAR_21), 14);", "}", "if (VAR_1->dual_stereo) {", "VAR_0->encode_band(VAR_0, VAR_1, VAR_2, VAR_3, VAR_17, NULL, VAR_8, VAR_7 / 2, VAR_1->blocks, NULL,\nVAR_1->size, VAR_11, 0, 1.0f, VAR_10, cm[0]);", "VAR_0->encode_band(VAR_0, VAR_1, VAR_2, VAR_3, VAR_19, NULL, VAR_8, VAR_7 / 2, VAR_1->blocks, NULL,\nVAR_1->size, VAR_12, 0, 1.0f, VAR_10, cm[1]);", "} else {", "VAR_0->encode_band(VAR_0, VAR_1, VAR_2, VAR_3, VAR_17, VAR_19, VAR_8, VAR_7, VAR_1->blocks, NULL, VAR_1->size,\nVAR_11, 0, 1.0f, VAR_10, cm[0] | cm[1]);", "}", "for (VAR_6 = 0; VAR_6 < VAR_8; VAR_6++) {", "VAR_15 += (VAR_17[VAR_6] - VAR_18[VAR_6])*(VAR_17[VAR_6] - VAR_18[VAR_6]);", "VAR_16 += (VAR_19[VAR_6] - VAR_20[VAR_6])*(VAR_19[VAR_6] - VAR_20[VAR_6]);", "}", "VAR_13 = sqrtf(VAR_15) + sqrtf(VAR_16);", "VAR_14 = OPUS_RC_CHECKPOINT_BITS(VAR_2)/8.0f;", "*VAR_4 += VAR_14;", "OPUS_RC_CHECKPOINT_ROLLBACK(VAR_2);", "return VAR_5*VAR_13*VAR_14;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51, 53 ], [ 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 93 ], [ 95 ] ]
13,314
static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags) { AVStream *st = s->streams[0]; // video stream R3DContext *r3d = s->priv_data; int frame_num; if (!st->codec->time_base.num || !st->time_base.den) return -1; frame_num = sample_time*st->codec->time_base.den/ ((int64_t)st->codec->time_base.num*st->time_base.den); av_dlog(s, "seek frame num %d timestamp %"PRId64"\n", frame_num, sample_time); if (frame_num < r3d->video_offsets_count) { avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET); } else { av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num); return -1; } return 0; }
true
FFmpeg
c7b08bc0a71f9e54e0d5036a8195648b41bd3933
static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags) { AVStream *st = s->streams[0]; R3DContext *r3d = s->priv_data; int frame_num; if (!st->codec->time_base.num || !st->time_base.den) return -1; frame_num = sample_time*st->codec->time_base.den/ ((int64_t)st->codec->time_base.num*st->time_base.den); av_dlog(s, "seek frame num %d timestamp %"PRId64"\n", frame_num, sample_time); if (frame_num < r3d->video_offsets_count) { avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET); } else { av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num); return -1; } return 0; }
{ "code": [ " avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET);" ], "line_no": [ 31 ] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3) { AVStream *st = VAR_0->streams[0]; R3DContext *r3d = VAR_0->priv_data; int VAR_4; if (!st->codec->time_base.num || !st->time_base.den) return -1; VAR_4 = VAR_2*st->codec->time_base.den/ ((int64_t)st->codec->time_base.num*st->time_base.den); av_dlog(VAR_0, "seek frame num %d timestamp %"PRId64"\n", VAR_4, VAR_2); if (VAR_4 < r3d->video_offsets_count) { avio_seek(VAR_0->pb, r3d->video_offsets_count, SEEK_SET); } else { av_log(VAR_0, AV_LOG_ERROR, "could not seek to frame %d\n", VAR_4); return -1; } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3)\n{", "AVStream *st = VAR_0->streams[0];", "R3DContext *r3d = VAR_0->priv_data;", "int VAR_4;", "if (!st->codec->time_base.num || !st->time_base.den)\nreturn -1;", "VAR_4 = VAR_2*st->codec->time_base.den/\n((int64_t)st->codec->time_base.num*st->time_base.den);", "av_dlog(VAR_0, \"seek frame num %d timestamp %\"PRId64\"\\n\",\nVAR_4, VAR_2);", "if (VAR_4 < r3d->video_offsets_count) {", "avio_seek(VAR_0->pb, r3d->video_offsets_count, SEEK_SET);", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"could not seek to frame %d\\n\", VAR_4);", "return -1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19, 21 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ] ]
13,315
m48t59_t *m48t59_init (qemu_irq IRQ, target_phys_addr_t mem_base, uint32_t io_base, uint16_t size, int type) { DeviceState *dev; SysBusDevice *s; M48t59SysBusState *d; dev = qdev_create(NULL, "m48t59"); qdev_prop_set_uint32(dev, "type", type); qdev_prop_set_uint32(dev, "size", size); qdev_prop_set_uint32(dev, "io_base", io_base); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_connect_irq(s, 0, IRQ); if (io_base != 0) { register_ioport_read(io_base, 0x04, 1, NVRAM_readb, s); register_ioport_write(io_base, 0x04, 1, NVRAM_writeb, s); } if (mem_base != 0) { sysbus_mmio_map(s, 0, mem_base); } d = FROM_SYSBUS(M48t59SysBusState, s); return &d->state; }
true
qemu
e23a1b33b53d25510320b26d9f154e19c6c99725
m48t59_t *m48t59_init (qemu_irq IRQ, target_phys_addr_t mem_base, uint32_t io_base, uint16_t size, int type) { DeviceState *dev; SysBusDevice *s; M48t59SysBusState *d; dev = qdev_create(NULL, "m48t59"); qdev_prop_set_uint32(dev, "type", type); qdev_prop_set_uint32(dev, "size", size); qdev_prop_set_uint32(dev, "io_base", io_base); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_connect_irq(s, 0, IRQ); if (io_base != 0) { register_ioport_read(io_base, 0x04, 1, NVRAM_readb, s); register_ioport_write(io_base, 0x04, 1, NVRAM_writeb, s); } if (mem_base != 0) { sysbus_mmio_map(s, 0, mem_base); } d = FROM_SYSBUS(M48t59SysBusState, s); return &d->state; }
{ "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": [ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25 ] }
m48t59_t *FUNC_0 (qemu_irq IRQ, target_phys_addr_t mem_base, uint32_t io_base, uint16_t size, int type) { DeviceState *dev; SysBusDevice *s; M48t59SysBusState *d; dev = qdev_create(NULL, "m48t59"); qdev_prop_set_uint32(dev, "type", type); qdev_prop_set_uint32(dev, "size", size); qdev_prop_set_uint32(dev, "io_base", io_base); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_connect_irq(s, 0, IRQ); if (io_base != 0) { register_ioport_read(io_base, 0x04, 1, NVRAM_readb, s); register_ioport_write(io_base, 0x04, 1, NVRAM_writeb, s); } if (mem_base != 0) { sysbus_mmio_map(s, 0, mem_base); } d = FROM_SYSBUS(M48t59SysBusState, s); return &d->state; }
[ "m48t59_t *FUNC_0 (qemu_irq IRQ, target_phys_addr_t mem_base,\nuint32_t io_base, uint16_t size,\nint type)\n{", "DeviceState *dev;", "SysBusDevice *s;", "M48t59SysBusState *d;", "dev = qdev_create(NULL, \"m48t59\");", "qdev_prop_set_uint32(dev, \"type\", type);", "qdev_prop_set_uint32(dev, \"size\", size);", "qdev_prop_set_uint32(dev, \"io_base\", io_base);", "qdev_init(dev);", "s = sysbus_from_qdev(dev);", "sysbus_connect_irq(s, 0, IRQ);", "if (io_base != 0) {", "register_ioport_read(io_base, 0x04, 1, NVRAM_readb, s);", "register_ioport_write(io_base, 0x04, 1, NVRAM_writeb, s);", "}", "if (mem_base != 0) {", "sysbus_mmio_map(s, 0, mem_base);", "}", "d = FROM_SYSBUS(M48t59SysBusState, s);", "return &d->state;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 51 ], [ 53 ] ]
13,317
static int decode_frame_header(ProresContext *ctx, const uint8_t *buf, const int data_size, AVCodecContext *avctx) { int hdr_size, width, height, flags; int version; const uint8_t *ptr; hdr_size = AV_RB16(buf); av_dlog(avctx, "header size %d\n", hdr_size); if (hdr_size > data_size) { av_log(avctx, AV_LOG_ERROR, "error, wrong header size\n"); version = AV_RB16(buf + 2); av_dlog(avctx, "%.4s version %d\n", buf+4, version); if (version > 1) { av_log(avctx, AV_LOG_ERROR, "unsupported version: %d\n", version); width = AV_RB16(buf + 8); height = AV_RB16(buf + 10); if (width != avctx->width || height != avctx->height) { av_log(avctx, AV_LOG_ERROR, "picture resolution change: %dx%d -> %dx%d\n", avctx->width, avctx->height, width, height); ctx->frame_type = (buf[12] >> 2) & 3; av_dlog(avctx, "frame type %d\n", ctx->frame_type); if (ctx->frame_type == 0) { ctx->scan = ctx->progressive_scan; // permuted } else { ctx->scan = ctx->interlaced_scan; // permuted ctx->frame.interlaced_frame = 1; ctx->frame.top_field_first = ctx->frame_type == 1; avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : AV_PIX_FMT_YUV422P10; ptr = buf + 20; flags = buf[19]; av_dlog(avctx, "flags %x\n", flags); if (flags & 2) { permute(ctx->qmat_luma, ctx->prodsp.idct_permutation, ptr); ptr += 64; } else { memset(ctx->qmat_luma, 4, 64); if (flags & 1) { permute(ctx->qmat_chroma, ctx->prodsp.idct_permutation, ptr); } else { memset(ctx->qmat_chroma, 4, 64); return hdr_size;
true
FFmpeg
c871244306f92fecaaed8a97f47ba54d46eb0cd5
static int decode_frame_header(ProresContext *ctx, const uint8_t *buf, const int data_size, AVCodecContext *avctx) { int hdr_size, width, height, flags; int version; const uint8_t *ptr; hdr_size = AV_RB16(buf); av_dlog(avctx, "header size %d\n", hdr_size); if (hdr_size > data_size) { av_log(avctx, AV_LOG_ERROR, "error, wrong header size\n"); version = AV_RB16(buf + 2); av_dlog(avctx, "%.4s version %d\n", buf+4, version); if (version > 1) { av_log(avctx, AV_LOG_ERROR, "unsupported version: %d\n", version); width = AV_RB16(buf + 8); height = AV_RB16(buf + 10); if (width != avctx->width || height != avctx->height) { av_log(avctx, AV_LOG_ERROR, "picture resolution change: %dx%d -> %dx%d\n", avctx->width, avctx->height, width, height); ctx->frame_type = (buf[12] >> 2) & 3; av_dlog(avctx, "frame type %d\n", ctx->frame_type); if (ctx->frame_type == 0) { ctx->scan = ctx->progressive_scan; } else { ctx->scan = ctx->interlaced_scan; ctx->frame.interlaced_frame = 1; ctx->frame.top_field_first = ctx->frame_type == 1; avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : AV_PIX_FMT_YUV422P10; ptr = buf + 20; flags = buf[19]; av_dlog(avctx, "flags %x\n", flags); if (flags & 2) { permute(ctx->qmat_luma, ctx->prodsp.idct_permutation, ptr); ptr += 64; } else { memset(ctx->qmat_luma, 4, 64); if (flags & 1) { permute(ctx->qmat_chroma, ctx->prodsp.idct_permutation, ptr); } else { memset(ctx->qmat_chroma, 4, 64); return hdr_size;
{ "code": [], "line_no": [] }
static int FUNC_0(ProresContext *VAR_0, const uint8_t *VAR_1, const int VAR_2, AVCodecContext *VAR_3) { int VAR_4, VAR_5, VAR_6, VAR_7; int VAR_8; const uint8_t *VAR_9; VAR_4 = AV_RB16(VAR_1); av_dlog(VAR_3, "header size %d\n", VAR_4); if (VAR_4 > VAR_2) { av_log(VAR_3, AV_LOG_ERROR, "error, wrong header size\n"); VAR_8 = AV_RB16(VAR_1 + 2); av_dlog(VAR_3, "%.4s VAR_8 %d\n", VAR_1+4, VAR_8); if (VAR_8 > 1) { av_log(VAR_3, AV_LOG_ERROR, "unsupported VAR_8: %d\n", VAR_8); VAR_5 = AV_RB16(VAR_1 + 8); VAR_6 = AV_RB16(VAR_1 + 10); if (VAR_5 != VAR_3->VAR_5 || VAR_6 != VAR_3->VAR_6) { av_log(VAR_3, AV_LOG_ERROR, "picture resolution change: %dx%d -> %dx%d\n", VAR_3->VAR_5, VAR_3->VAR_6, VAR_5, VAR_6); VAR_0->frame_type = (VAR_1[12] >> 2) & 3; av_dlog(VAR_3, "frame type %d\n", VAR_0->frame_type); if (VAR_0->frame_type == 0) { VAR_0->scan = VAR_0->progressive_scan; } else { VAR_0->scan = VAR_0->interlaced_scan; VAR_0->frame.interlaced_frame = 1; VAR_0->frame.top_field_first = VAR_0->frame_type == 1; VAR_3->pix_fmt = (VAR_1[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : AV_PIX_FMT_YUV422P10; VAR_9 = VAR_1 + 20; VAR_7 = VAR_1[19]; av_dlog(VAR_3, "VAR_7 %x\n", VAR_7); if (VAR_7 & 2) { permute(VAR_0->qmat_luma, VAR_0->prodsp.idct_permutation, VAR_9); VAR_9 += 64; } else { memset(VAR_0->qmat_luma, 4, 64); if (VAR_7 & 1) { permute(VAR_0->qmat_chroma, VAR_0->prodsp.idct_permutation, VAR_9); } else { memset(VAR_0->qmat_chroma, 4, 64); return VAR_4;
[ "static int FUNC_0(ProresContext *VAR_0, const uint8_t *VAR_1,\nconst int VAR_2, AVCodecContext *VAR_3)\n{", "int VAR_4, VAR_5, VAR_6, VAR_7;", "int VAR_8;", "const uint8_t *VAR_9;", "VAR_4 = AV_RB16(VAR_1);", "av_dlog(VAR_3, \"header size %d\\n\", VAR_4);", "if (VAR_4 > VAR_2) {", "av_log(VAR_3, AV_LOG_ERROR, \"error, wrong header size\\n\");", "VAR_8 = AV_RB16(VAR_1 + 2);", "av_dlog(VAR_3, \"%.4s VAR_8 %d\\n\", VAR_1+4, VAR_8);", "if (VAR_8 > 1) {", "av_log(VAR_3, AV_LOG_ERROR, \"unsupported VAR_8: %d\\n\", VAR_8);", "VAR_5 = AV_RB16(VAR_1 + 8);", "VAR_6 = AV_RB16(VAR_1 + 10);", "if (VAR_5 != VAR_3->VAR_5 || VAR_6 != VAR_3->VAR_6) {", "av_log(VAR_3, AV_LOG_ERROR, \"picture resolution change: %dx%d -> %dx%d\\n\",\nVAR_3->VAR_5, VAR_3->VAR_6, VAR_5, VAR_6);", "VAR_0->frame_type = (VAR_1[12] >> 2) & 3;", "av_dlog(VAR_3, \"frame type %d\\n\", VAR_0->frame_type);", "if (VAR_0->frame_type == 0) {", "VAR_0->scan = VAR_0->progressive_scan;", "} else {", "VAR_0->scan = VAR_0->interlaced_scan;", "VAR_0->frame.interlaced_frame = 1;", "VAR_0->frame.top_field_first = VAR_0->frame_type == 1;", "VAR_3->pix_fmt = (VAR_1[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : AV_PIX_FMT_YUV422P10;", "VAR_9 = VAR_1 + 20;", "VAR_7 = VAR_1[19];", "av_dlog(VAR_3, \"VAR_7 %x\\n\", VAR_7);", "if (VAR_7 & 2) {", "permute(VAR_0->qmat_luma, VAR_0->prodsp.idct_permutation, VAR_9);", "VAR_9 += 64;", "} else {", "memset(VAR_0->qmat_luma, 4, 64);", "if (VAR_7 & 1) {", "permute(VAR_0->qmat_chroma, VAR_0->prodsp.idct_permutation, VAR_9);", "} else {", "memset(VAR_0->qmat_chroma, 4, 64);", "return VAR_4;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 76 ], [ 80 ], [ 82 ], [ 84 ], [ 88 ], [ 94 ], [ 96 ], [ 98 ], [ 100 ], [ 105 ], [ 111 ], [ 113 ], [ 115 ], [ 120 ] ]
13,318
static inline int GetCode(GifState * s) { int c, sizbuf; uint8_t *ptr; while (s->bbits < s->cursize) { ptr = s->pbuf; if (ptr >= s->ebuf) { if (!s->eob_reached) { sizbuf = get_byte(s->f); s->ebuf = s->buf + sizbuf; s->pbuf = s->buf; if (sizbuf > 0) { get_buffer(s->f, s->buf, sizbuf); } else { s->eob_reached = 1; } } ptr = s->pbuf; } s->bbuf |= ptr[0] << s->bbits; ptr++; s->pbuf = ptr; s->bbits += 8; } c = s->bbuf & s->curmask; s->bbuf >>= s->cursize; s->bbits -= s->cursize; return c; }
true
FFmpeg
0b54f3c0878a3acaa9142e4f24942e762d97e350
static inline int GetCode(GifState * s) { int c, sizbuf; uint8_t *ptr; while (s->bbits < s->cursize) { ptr = s->pbuf; if (ptr >= s->ebuf) { if (!s->eob_reached) { sizbuf = get_byte(s->f); s->ebuf = s->buf + sizbuf; s->pbuf = s->buf; if (sizbuf > 0) { get_buffer(s->f, s->buf, sizbuf); } else { s->eob_reached = 1; } } ptr = s->pbuf; } s->bbuf |= ptr[0] << s->bbits; ptr++; s->pbuf = ptr; s->bbits += 8; } c = s->bbuf & s->curmask; s->bbuf >>= s->cursize; s->bbits -= s->cursize; return c; }
{ "code": [ "static inline int GetCode(GifState * s)", " int c, sizbuf;", " uint8_t *ptr;", " while (s->bbits < s->cursize) {", " ptr = s->pbuf;", " if (ptr >= s->ebuf) {", " if (!s->eob_reached) {", " sizbuf = get_byte(s->f);", " s->ebuf = s->buf + sizbuf;", " s->pbuf = s->buf;", " if (sizbuf > 0) {", " get_buffer(s->f, s->buf, sizbuf);", " } else {", " s->eob_reached = 1;", " ptr = s->pbuf;", " s->bbuf |= ptr[0] << s->bbits;", " ptr++;", " s->pbuf = ptr;", " s->bbits += 8;", " c = s->bbuf & s->curmask;", " s->bbuf >>= s->cursize;", " s->bbits -= s->cursize;", " return c;" ], "line_no": [ 1, 5, 7, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 37, 41, 43, 45, 47, 51, 53, 55, 57 ] }
static inline int FUNC_0(GifState * VAR_0) { int VAR_1, VAR_2; uint8_t *ptr; while (VAR_0->bbits < VAR_0->cursize) { ptr = VAR_0->pbuf; if (ptr >= VAR_0->ebuf) { if (!VAR_0->eob_reached) { VAR_2 = get_byte(VAR_0->f); VAR_0->ebuf = VAR_0->buf + VAR_2; VAR_0->pbuf = VAR_0->buf; if (VAR_2 > 0) { get_buffer(VAR_0->f, VAR_0->buf, VAR_2); } else { VAR_0->eob_reached = 1; } } ptr = VAR_0->pbuf; } VAR_0->bbuf |= ptr[0] << VAR_0->bbits; ptr++; VAR_0->pbuf = ptr; VAR_0->bbits += 8; } VAR_1 = VAR_0->bbuf & VAR_0->curmask; VAR_0->bbuf >>= VAR_0->cursize; VAR_0->bbits -= VAR_0->cursize; return VAR_1; }
[ "static inline int FUNC_0(GifState * VAR_0)\n{", "int VAR_1, VAR_2;", "uint8_t *ptr;", "while (VAR_0->bbits < VAR_0->cursize) {", "ptr = VAR_0->pbuf;", "if (ptr >= VAR_0->ebuf) {", "if (!VAR_0->eob_reached) {", "VAR_2 = get_byte(VAR_0->f);", "VAR_0->ebuf = VAR_0->buf + VAR_2;", "VAR_0->pbuf = VAR_0->buf;", "if (VAR_2 > 0) {", "get_buffer(VAR_0->f, VAR_0->buf, VAR_2);", "} else {", "VAR_0->eob_reached = 1;", "}", "}", "ptr = VAR_0->pbuf;", "}", "VAR_0->bbuf |= ptr[0] << VAR_0->bbits;", "ptr++;", "VAR_0->pbuf = ptr;", "VAR_0->bbits += 8;", "}", "VAR_1 = VAR_0->bbuf & VAR_0->curmask;", "VAR_0->bbuf >>= VAR_0->cursize;", "VAR_0->bbits -= VAR_0->cursize;", "return VAR_1;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 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 ] ]
13,319
static void filter(SPPContext *p, uint8_t *dst, uint8_t *src, int dst_linesize, int src_linesize, int width, int height, const uint8_t *qp_table, int qp_stride, int is_luma, int sample_bytes) { int x, y, i; const int count = 1 << p->log2_count; const int linesize = is_luma ? p->temp_linesize : FFALIGN(width+16, 16); DECLARE_ALIGNED(16, uint64_t, block_align)[32]; int16_t *block = (int16_t *)block_align; int16_t *block2 = (int16_t *)(block_align + 16); uint16_t *psrc16 = (uint16_t*)p->src; for (y = 0; y < height; y++) { int index = 8 + 8*linesize + y*linesize; memcpy(p->src + index*sample_bytes, src + y*src_linesize, width*sample_bytes); if (sample_bytes == 1) { for (x = 0; x < 8; x++) { p->src[index - x - 1] = p->src[index + x ]; p->src[index + width + x ] = p->src[index + width - x - 1]; } } else { for (x = 0; x < 8; x++) { psrc16[index - x - 1] = psrc16[index + x ]; psrc16[index + width + x ] = psrc16[index + width - x - 1]; } } } for (y = 0; y < 8; y++) { memcpy(p->src + ( 7-y)*linesize * sample_bytes, p->src + ( y+8)*linesize * sample_bytes, linesize * sample_bytes); memcpy(p->src + (height+8+y)*linesize * sample_bytes, p->src + (height-y+7)*linesize * sample_bytes, linesize * sample_bytes); } for (y = 0; y < height + 8; y += 8) { memset(p->temp + (8 + y) * linesize, 0, 8 * linesize * sizeof(*p->temp)); for (x = 0; x < width + 8; x += 8) { int qp; if (p->qp) { qp = p->qp; } else{ const int qps = 3 + is_luma; qp = qp_table[(FFMIN(x, width - 1) >> qps) + (FFMIN(y, height - 1) >> qps) * qp_stride]; qp = FFMAX(1, norm_qscale(qp, p->qscale_type)); } for (i = 0; i < count; i++) { const int x1 = x + offset[i + count - 1][0]; const int y1 = y + offset[i + count - 1][1]; const int index = x1 + y1*linesize; p->dct->get_pixels(block, p->src + sample_bytes*index, sample_bytes*linesize); p->dct->fdct(block); p->requantize(block2, block, qp, p->dct->idct_permutation); p->dct->idct(block2); add_block(p->temp + index, linesize, block2); } } if (y) { if (sample_bytes == 1) { p->store_slice(dst + (y - 8) * dst_linesize, p->temp + 8 + y*linesize, dst_linesize, linesize, width, FFMIN(8, height + 8 - y), MAX_LEVEL - p->log2_count, ldither); } else { store_slice16_c((uint16_t*)(dst + (y - 8) * dst_linesize), p->temp + 8 + y*linesize, dst_linesize/2, linesize, width, FFMIN(8, height + 8 - y), MAX_LEVEL - p->log2_count, ldither); } } } }
true
FFmpeg
1ac5abb1d062b6ca983d494068bb9fd30390a941
static void filter(SPPContext *p, uint8_t *dst, uint8_t *src, int dst_linesize, int src_linesize, int width, int height, const uint8_t *qp_table, int qp_stride, int is_luma, int sample_bytes) { int x, y, i; const int count = 1 << p->log2_count; const int linesize = is_luma ? p->temp_linesize : FFALIGN(width+16, 16); DECLARE_ALIGNED(16, uint64_t, block_align)[32]; int16_t *block = (int16_t *)block_align; int16_t *block2 = (int16_t *)(block_align + 16); uint16_t *psrc16 = (uint16_t*)p->src; for (y = 0; y < height; y++) { int index = 8 + 8*linesize + y*linesize; memcpy(p->src + index*sample_bytes, src + y*src_linesize, width*sample_bytes); if (sample_bytes == 1) { for (x = 0; x < 8; x++) { p->src[index - x - 1] = p->src[index + x ]; p->src[index + width + x ] = p->src[index + width - x - 1]; } } else { for (x = 0; x < 8; x++) { psrc16[index - x - 1] = psrc16[index + x ]; psrc16[index + width + x ] = psrc16[index + width - x - 1]; } } } for (y = 0; y < 8; y++) { memcpy(p->src + ( 7-y)*linesize * sample_bytes, p->src + ( y+8)*linesize * sample_bytes, linesize * sample_bytes); memcpy(p->src + (height+8+y)*linesize * sample_bytes, p->src + (height-y+7)*linesize * sample_bytes, linesize * sample_bytes); } for (y = 0; y < height + 8; y += 8) { memset(p->temp + (8 + y) * linesize, 0, 8 * linesize * sizeof(*p->temp)); for (x = 0; x < width + 8; x += 8) { int qp; if (p->qp) { qp = p->qp; } else{ const int qps = 3 + is_luma; qp = qp_table[(FFMIN(x, width - 1) >> qps) + (FFMIN(y, height - 1) >> qps) * qp_stride]; qp = FFMAX(1, norm_qscale(qp, p->qscale_type)); } for (i = 0; i < count; i++) { const int x1 = x + offset[i + count - 1][0]; const int y1 = y + offset[i + count - 1][1]; const int index = x1 + y1*linesize; p->dct->get_pixels(block, p->src + sample_bytes*index, sample_bytes*linesize); p->dct->fdct(block); p->requantize(block2, block, qp, p->dct->idct_permutation); p->dct->idct(block2); add_block(p->temp + index, linesize, block2); } } if (y) { if (sample_bytes == 1) { p->store_slice(dst + (y - 8) * dst_linesize, p->temp + 8 + y*linesize, dst_linesize, linesize, width, FFMIN(8, height + 8 - y), MAX_LEVEL - p->log2_count, ldither); } else { store_slice16_c((uint16_t*)(dst + (y - 8) * dst_linesize), p->temp + 8 + y*linesize, dst_linesize/2, linesize, width, FFMIN(8, height + 8 - y), MAX_LEVEL - p->log2_count, ldither); } } } }
{ "code": [ " const uint8_t *qp_table, int qp_stride, int is_luma, int sample_bytes)", " ldither);" ], "line_no": [ 5, 131 ] }
static void FUNC_0(SPPContext *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, const uint8_t *VAR_7, int VAR_8, int VAR_9, int VAR_10) { int VAR_11, VAR_12, VAR_13; const int VAR_14 = 1 << VAR_0->log2_count; const int VAR_15 = VAR_9 ? VAR_0->temp_linesize : FFALIGN(VAR_5+16, 16); DECLARE_ALIGNED(16, uint64_t, block_align)[32]; int16_t *block = (int16_t *)block_align; int16_t *block2 = (int16_t *)(block_align + 16); uint16_t *psrc16 = (uint16_t*)VAR_0->VAR_2; for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++) { int VAR_21 = 8 + 8*VAR_15 + VAR_12*VAR_15; memcpy(VAR_0->VAR_2 + VAR_21*VAR_10, VAR_2 + VAR_12*VAR_4, VAR_5*VAR_10); if (VAR_10 == 1) { for (VAR_11 = 0; VAR_11 < 8; VAR_11++) { VAR_0->VAR_2[VAR_21 - VAR_11 - 1] = VAR_0->VAR_2[VAR_21 + VAR_11 ]; VAR_0->VAR_2[VAR_21 + VAR_5 + VAR_11 ] = VAR_0->VAR_2[VAR_21 + VAR_5 - VAR_11 - 1]; } } else { for (VAR_11 = 0; VAR_11 < 8; VAR_11++) { psrc16[VAR_21 - VAR_11 - 1] = psrc16[VAR_21 + VAR_11 ]; psrc16[VAR_21 + VAR_5 + VAR_11 ] = psrc16[VAR_21 + VAR_5 - VAR_11 - 1]; } } } for (VAR_12 = 0; VAR_12 < 8; VAR_12++) { memcpy(VAR_0->VAR_2 + ( 7-VAR_12)*VAR_15 * VAR_10, VAR_0->VAR_2 + ( VAR_12+8)*VAR_15 * VAR_10, VAR_15 * VAR_10); memcpy(VAR_0->VAR_2 + (VAR_6+8+VAR_12)*VAR_15 * VAR_10, VAR_0->VAR_2 + (VAR_6-VAR_12+7)*VAR_15 * VAR_10, VAR_15 * VAR_10); } for (VAR_12 = 0; VAR_12 < VAR_6 + 8; VAR_12 += 8) { memset(VAR_0->temp + (8 + VAR_12) * VAR_15, 0, 8 * VAR_15 * sizeof(*VAR_0->temp)); for (VAR_11 = 0; VAR_11 < VAR_5 + 8; VAR_11 += 8) { int VAR_17; if (VAR_0->VAR_17) { VAR_17 = VAR_0->VAR_17; } else{ const int VAR_18 = 3 + VAR_9; VAR_17 = VAR_7[(FFMIN(VAR_11, VAR_5 - 1) >> VAR_18) + (FFMIN(VAR_12, VAR_6 - 1) >> VAR_18) * VAR_8]; VAR_17 = FFMAX(1, norm_qscale(VAR_17, VAR_0->qscale_type)); } for (VAR_13 = 0; VAR_13 < VAR_14; VAR_13++) { const int VAR_19 = VAR_11 + offset[VAR_13 + VAR_14 - 1][0]; const int VAR_20 = VAR_12 + offset[VAR_13 + VAR_14 - 1][1]; const int VAR_21 = VAR_19 + VAR_20*VAR_15; VAR_0->dct->get_pixels(block, VAR_0->VAR_2 + VAR_10*VAR_21, VAR_10*VAR_15); VAR_0->dct->fdct(block); VAR_0->requantize(block2, block, VAR_17, VAR_0->dct->idct_permutation); VAR_0->dct->idct(block2); add_block(VAR_0->temp + VAR_21, VAR_15, block2); } } if (VAR_12) { if (VAR_10 == 1) { VAR_0->store_slice(VAR_1 + (VAR_12 - 8) * VAR_3, VAR_0->temp + 8 + VAR_12*VAR_15, VAR_3, VAR_15, VAR_5, FFMIN(8, VAR_6 + 8 - VAR_12), MAX_LEVEL - VAR_0->log2_count, ldither); } else { store_slice16_c((uint16_t*)(VAR_1 + (VAR_12 - 8) * VAR_3), VAR_0->temp + 8 + VAR_12*VAR_15, VAR_3/2, VAR_15, VAR_5, FFMIN(8, VAR_6 + 8 - VAR_12), MAX_LEVEL - VAR_0->log2_count, ldither); } } } }
[ "static void FUNC_0(SPPContext *VAR_0, uint8_t *VAR_1, uint8_t *VAR_2,\nint VAR_3, int VAR_4, int VAR_5, int VAR_6,\nconst uint8_t *VAR_7, int VAR_8, int VAR_9, int VAR_10)\n{", "int VAR_11, VAR_12, VAR_13;", "const int VAR_14 = 1 << VAR_0->log2_count;", "const int VAR_15 = VAR_9 ? VAR_0->temp_linesize : FFALIGN(VAR_5+16, 16);", "DECLARE_ALIGNED(16, uint64_t, block_align)[32];", "int16_t *block = (int16_t *)block_align;", "int16_t *block2 = (int16_t *)(block_align + 16);", "uint16_t *psrc16 = (uint16_t*)VAR_0->VAR_2;", "for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++) {", "int VAR_21 = 8 + 8*VAR_15 + VAR_12*VAR_15;", "memcpy(VAR_0->VAR_2 + VAR_21*VAR_10, VAR_2 + VAR_12*VAR_4, VAR_5*VAR_10);", "if (VAR_10 == 1) {", "for (VAR_11 = 0; VAR_11 < 8; VAR_11++) {", "VAR_0->VAR_2[VAR_21 - VAR_11 - 1] = VAR_0->VAR_2[VAR_21 + VAR_11 ];", "VAR_0->VAR_2[VAR_21 + VAR_5 + VAR_11 ] = VAR_0->VAR_2[VAR_21 + VAR_5 - VAR_11 - 1];", "}", "} else {", "for (VAR_11 = 0; VAR_11 < 8; VAR_11++) {", "psrc16[VAR_21 - VAR_11 - 1] = psrc16[VAR_21 + VAR_11 ];", "psrc16[VAR_21 + VAR_5 + VAR_11 ] = psrc16[VAR_21 + VAR_5 - VAR_11 - 1];", "}", "}", "}", "for (VAR_12 = 0; VAR_12 < 8; VAR_12++) {", "memcpy(VAR_0->VAR_2 + ( 7-VAR_12)*VAR_15 * VAR_10, VAR_0->VAR_2 + ( VAR_12+8)*VAR_15 * VAR_10, VAR_15 * VAR_10);", "memcpy(VAR_0->VAR_2 + (VAR_6+8+VAR_12)*VAR_15 * VAR_10, VAR_0->VAR_2 + (VAR_6-VAR_12+7)*VAR_15 * VAR_10, VAR_15 * VAR_10);", "}", "for (VAR_12 = 0; VAR_12 < VAR_6 + 8; VAR_12 += 8) {", "memset(VAR_0->temp + (8 + VAR_12) * VAR_15, 0, 8 * VAR_15 * sizeof(*VAR_0->temp));", "for (VAR_11 = 0; VAR_11 < VAR_5 + 8; VAR_11 += 8) {", "int VAR_17;", "if (VAR_0->VAR_17) {", "VAR_17 = VAR_0->VAR_17;", "} else{", "const int VAR_18 = 3 + VAR_9;", "VAR_17 = VAR_7[(FFMIN(VAR_11, VAR_5 - 1) >> VAR_18) + (FFMIN(VAR_12, VAR_6 - 1) >> VAR_18) * VAR_8];", "VAR_17 = FFMAX(1, norm_qscale(VAR_17, VAR_0->qscale_type));", "}", "for (VAR_13 = 0; VAR_13 < VAR_14; VAR_13++) {", "const int VAR_19 = VAR_11 + offset[VAR_13 + VAR_14 - 1][0];", "const int VAR_20 = VAR_12 + offset[VAR_13 + VAR_14 - 1][1];", "const int VAR_21 = VAR_19 + VAR_20*VAR_15;", "VAR_0->dct->get_pixels(block, VAR_0->VAR_2 + VAR_10*VAR_21, VAR_10*VAR_15);", "VAR_0->dct->fdct(block);", "VAR_0->requantize(block2, block, VAR_17, VAR_0->dct->idct_permutation);", "VAR_0->dct->idct(block2);", "add_block(VAR_0->temp + VAR_21, VAR_15, block2);", "}", "}", "if (VAR_12) {", "if (VAR_10 == 1) {", "VAR_0->store_slice(VAR_1 + (VAR_12 - 8) * VAR_3, VAR_0->temp + 8 + VAR_12*VAR_15,\nVAR_3, VAR_15, VAR_5,\nFFMIN(8, VAR_6 + 8 - VAR_12), MAX_LEVEL - VAR_0->log2_count,\nldither);", "} else {", "store_slice16_c((uint16_t*)(VAR_1 + (VAR_12 - 8) * VAR_3), VAR_0->temp + 8 + VAR_12*VAR_15,\nVAR_3/2, VAR_15, VAR_5,\nFFMIN(8, VAR_6 + 8 - VAR_12), MAX_LEVEL - VAR_0->log2_count,\nldither);", "}", "}", "}", "}" ]
[ 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, 1, 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 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 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 ] ]
13,320
static int vp8_alloc_frame(VP8Context *s, AVFrame *f) { int ret; if ((ret = ff_thread_get_buffer(s->avctx, f)) < 0) return ret; if (!s->maps_are_invalid && s->num_maps_to_be_freed) { f->ref_index[0] = s->segmentation_maps[--s->num_maps_to_be_freed]; } else if (!(f->ref_index[0] = av_mallocz(s->mb_width * s->mb_height))) { ff_thread_release_buffer(s->avctx, f); return AVERROR(ENOMEM); } return 0; }
true
FFmpeg
bfa0f96586fe2c257cfa574ffb991da493a54da1
static int vp8_alloc_frame(VP8Context *s, AVFrame *f) { int ret; if ((ret = ff_thread_get_buffer(s->avctx, f)) < 0) return ret; if (!s->maps_are_invalid && s->num_maps_to_be_freed) { f->ref_index[0] = s->segmentation_maps[--s->num_maps_to_be_freed]; } else if (!(f->ref_index[0] = av_mallocz(s->mb_width * s->mb_height))) { ff_thread_release_buffer(s->avctx, f); return AVERROR(ENOMEM); } return 0; }
{ "code": [ " if (!s->maps_are_invalid && s->num_maps_to_be_freed) {" ], "line_no": [ 11 ] }
static int FUNC_0(VP8Context *VAR_0, AVFrame *VAR_1) { int VAR_2; if ((VAR_2 = ff_thread_get_buffer(VAR_0->avctx, VAR_1)) < 0) return VAR_2; if (!VAR_0->maps_are_invalid && VAR_0->num_maps_to_be_freed) { VAR_1->ref_index[0] = VAR_0->segmentation_maps[--VAR_0->num_maps_to_be_freed]; } else if (!(VAR_1->ref_index[0] = av_mallocz(VAR_0->mb_width * VAR_0->mb_height))) { ff_thread_release_buffer(VAR_0->avctx, VAR_1); return AVERROR(ENOMEM); } return 0; }
[ "static int FUNC_0(VP8Context *VAR_0, AVFrame *VAR_1)\n{", "int VAR_2;", "if ((VAR_2 = ff_thread_get_buffer(VAR_0->avctx, VAR_1)) < 0)\nreturn VAR_2;", "if (!VAR_0->maps_are_invalid && VAR_0->num_maps_to_be_freed) {", "VAR_1->ref_index[0] = VAR_0->segmentation_maps[--VAR_0->num_maps_to_be_freed];", "} else if (!(VAR_1->ref_index[0] = av_mallocz(VAR_0->mb_width * VAR_0->mb_height))) {", "ff_thread_release_buffer(VAR_0->avctx, VAR_1);", "return AVERROR(ENOMEM);", "}", "return 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
13,321
static int64_t read_ts(const char *s) { int hh, mm, ss, ms; if (sscanf(s, "%u:%u:%u.%u", &hh, &mm, &ss, &ms) == 4) return (hh*3600 + mm*60 + ss) * 1000 + ms; if (sscanf(s, "%u:%u.%u", &mm, &ss, &ms) == 3) return ( mm*60 + ss) * 1000 + ms; return AV_NOPTS_VALUE; }
true
FFmpeg
99a520000d376d60cd30fae97bfaaf13d50ee26c
static int64_t read_ts(const char *s) { int hh, mm, ss, ms; if (sscanf(s, "%u:%u:%u.%u", &hh, &mm, &ss, &ms) == 4) return (hh*3600 + mm*60 + ss) * 1000 + ms; if (sscanf(s, "%u:%u.%u", &mm, &ss, &ms) == 3) return ( mm*60 + ss) * 1000 + ms; return AV_NOPTS_VALUE; }
{ "code": [ " if (sscanf(s, \"%u:%u:%u.%u\", &hh, &mm, &ss, &ms) == 4) return (hh*3600 + mm*60 + ss) * 1000 + ms;", " if (sscanf(s, \"%u:%u.%u\", &mm, &ss, &ms) == 3) return ( mm*60 + ss) * 1000 + ms;" ], "line_no": [ 7, 9 ] }
static int64_t FUNC_0(const char *s) { int VAR_0, VAR_1, VAR_2, VAR_3; if (sscanf(s, "%u:%u:%u.%u", &VAR_0, &VAR_1, &VAR_2, &VAR_3) == 4) return (VAR_0*3600 + VAR_1*60 + VAR_2) * 1000 + VAR_3; if (sscanf(s, "%u:%u.%u", &VAR_1, &VAR_2, &VAR_3) == 3) return ( VAR_1*60 + VAR_2) * 1000 + VAR_3; return AV_NOPTS_VALUE; }
[ "static int64_t FUNC_0(const char *s)\n{", "int VAR_0, VAR_1, VAR_2, VAR_3;", "if (sscanf(s, \"%u:%u:%u.%u\", &VAR_0, &VAR_1, &VAR_2, &VAR_3) == 4) return (VAR_0*3600 + VAR_1*60 + VAR_2) * 1000 + VAR_3;", "if (sscanf(s, \"%u:%u.%u\", &VAR_1, &VAR_2, &VAR_3) == 3) return ( VAR_1*60 + VAR_2) * 1000 + VAR_3;", "return AV_NOPTS_VALUE;", "}" ]
[ 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
13,322
static void i82374_init(I82374State *s) { DMA_init(1, NULL); memset(s->commands, 0, sizeof(s->commands)); }
true
qemu
049a9f7b946fe1d3ff97127f8905881dbb78cb00
static void i82374_init(I82374State *s) { DMA_init(1, NULL); memset(s->commands, 0, sizeof(s->commands)); }
{ "code": [ " DMA_init(1, NULL);" ], "line_no": [ 5 ] }
static void FUNC_0(I82374State *VAR_0) { DMA_init(1, NULL); memset(VAR_0->commands, 0, sizeof(VAR_0->commands)); }
[ "static void FUNC_0(I82374State *VAR_0)\n{", "DMA_init(1, NULL);", "memset(VAR_0->commands, 0, sizeof(VAR_0->commands));", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
13,323
static void qxl_destroy_primary(PCIQXLDevice *d) { if (d->mode == QXL_MODE_UNDEFINED) { return; } dprint(d, 1, "%s\n", __FUNCTION__); d->mode = QXL_MODE_UNDEFINED; d->ssd.worker->destroy_primary_surface(d->ssd.worker, 0); }
true
qemu
17268d54be2e15b0d8ccfc4102bc48c84299b027
static void qxl_destroy_primary(PCIQXLDevice *d) { if (d->mode == QXL_MODE_UNDEFINED) { return; } dprint(d, 1, "%s\n", __FUNCTION__); d->mode = QXL_MODE_UNDEFINED; d->ssd.worker->destroy_primary_surface(d->ssd.worker, 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(PCIQXLDevice *VAR_0) { if (VAR_0->mode == QXL_MODE_UNDEFINED) { return; } dprint(VAR_0, 1, "%s\n", __FUNCTION__); VAR_0->mode = QXL_MODE_UNDEFINED; VAR_0->ssd.worker->destroy_primary_surface(VAR_0->ssd.worker, 0); }
[ "static void FUNC_0(PCIQXLDevice *VAR_0)\n{", "if (VAR_0->mode == QXL_MODE_UNDEFINED) {", "return;", "}", "dprint(VAR_0, 1, \"%s\\n\", __FUNCTION__);", "VAR_0->mode = QXL_MODE_UNDEFINED;", "VAR_0->ssd.worker->destroy_primary_surface(VAR_0->ssd.worker, 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 20 ], [ 23 ] ]
13,325
void isa_ne2000_init(int base, int irq, NICInfo *nd) { ISADevice *dev; qemu_check_nic_model(nd, "ne2k_isa"); dev = isa_create("ne2k_isa"); dev->qdev.nd = nd; /* hack alert */ qdev_prop_set_uint32(&dev->qdev, "iobase", base); qdev_prop_set_uint32(&dev->qdev, "irq", irq); qdev_init(&dev->qdev); }
true
qemu
e23a1b33b53d25510320b26d9f154e19c6c99725
void isa_ne2000_init(int base, int irq, NICInfo *nd) { ISADevice *dev; qemu_check_nic_model(nd, "ne2k_isa"); dev = isa_create("ne2k_isa"); dev->qdev.nd = nd; qdev_prop_set_uint32(&dev->qdev, "iobase", base); qdev_prop_set_uint32(&dev->qdev, "irq", irq); qdev_init(&dev->qdev); }
{ "code": [ " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);", " qdev_init(&dev->qdev);" ], "line_no": [ 21, 21, 21, 21, 21, 21, 21, 21 ] }
void FUNC_0(int VAR_0, int VAR_1, NICInfo *VAR_2) { ISADevice *dev; qemu_check_nic_model(VAR_2, "ne2k_isa"); dev = isa_create("ne2k_isa"); dev->qdev.VAR_2 = VAR_2; qdev_prop_set_uint32(&dev->qdev, "iobase", VAR_0); qdev_prop_set_uint32(&dev->qdev, "VAR_1", VAR_1); qdev_init(&dev->qdev); }
[ "void FUNC_0(int VAR_0, int VAR_1, NICInfo *VAR_2)\n{", "ISADevice *dev;", "qemu_check_nic_model(VAR_2, \"ne2k_isa\");", "dev = isa_create(\"ne2k_isa\");", "dev->qdev.VAR_2 = VAR_2;", "qdev_prop_set_uint32(&dev->qdev, \"iobase\", VAR_0);", "qdev_prop_set_uint32(&dev->qdev, \"VAR_1\", VAR_1);", "qdev_init(&dev->qdev);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
13,326
static int allocate_buffers(ShortenContext *s) { int i, chan, err; for (chan = 0; chan < s->channels; chan++) { if (FFMAX(1, s->nmean) >= UINT_MAX / sizeof(int32_t)) { av_log(s->avctx, AV_LOG_ERROR, "nmean too large\n"); return AVERROR_INVALIDDATA; } if (s->blocksize + s->nwrap >= UINT_MAX / sizeof(int32_t) || s->blocksize + s->nwrap <= (unsigned)s->nwrap) { av_log(s->avctx, AV_LOG_ERROR, "s->blocksize + s->nwrap too large\n"); return AVERROR_INVALIDDATA; } if ((err = av_reallocp_array(&s->offset[chan], sizeof(int32_t), FFMAX(1, s->nmean))) < 0) return err; if ((err = av_reallocp_array(&s->decoded_base[chan], (s->blocksize + s->nwrap), sizeof(s->decoded_base[0][0]))) < 0) return err; for (i = 0; i < s->nwrap; i++) s->decoded_base[chan][i] = 0; s->decoded[chan] = s->decoded_base[chan] + s->nwrap; } if ((err = av_reallocp_array(&s->coeffs, s->nwrap, sizeof(*s->coeffs))) < 0) return err; return 0; }
true
FFmpeg
2d15588124ab1d4c0612cab66f02a716f1509211
static int allocate_buffers(ShortenContext *s) { int i, chan, err; for (chan = 0; chan < s->channels; chan++) { if (FFMAX(1, s->nmean) >= UINT_MAX / sizeof(int32_t)) { av_log(s->avctx, AV_LOG_ERROR, "nmean too large\n"); return AVERROR_INVALIDDATA; } if (s->blocksize + s->nwrap >= UINT_MAX / sizeof(int32_t) || s->blocksize + s->nwrap <= (unsigned)s->nwrap) { av_log(s->avctx, AV_LOG_ERROR, "s->blocksize + s->nwrap too large\n"); return AVERROR_INVALIDDATA; } if ((err = av_reallocp_array(&s->offset[chan], sizeof(int32_t), FFMAX(1, s->nmean))) < 0) return err; if ((err = av_reallocp_array(&s->decoded_base[chan], (s->blocksize + s->nwrap), sizeof(s->decoded_base[0][0]))) < 0) return err; for (i = 0; i < s->nwrap; i++) s->decoded_base[chan][i] = 0; s->decoded[chan] = s->decoded_base[chan] + s->nwrap; } if ((err = av_reallocp_array(&s->coeffs, s->nwrap, sizeof(*s->coeffs))) < 0) return err; return 0; }
{ "code": [ " if (s->blocksize + s->nwrap >= UINT_MAX / sizeof(int32_t) ||", " s->blocksize + s->nwrap <= (unsigned)s->nwrap) {" ], "line_no": [ 19, 21 ] }
static int FUNC_0(ShortenContext *VAR_0) { int VAR_1, VAR_2, VAR_3; for (VAR_2 = 0; VAR_2 < VAR_0->channels; VAR_2++) { if (FFMAX(1, VAR_0->nmean) >= UINT_MAX / sizeof(int32_t)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "nmean too large\n"); return AVERROR_INVALIDDATA; } if (VAR_0->blocksize + VAR_0->nwrap >= UINT_MAX / sizeof(int32_t) || VAR_0->blocksize + VAR_0->nwrap <= (unsigned)VAR_0->nwrap) { av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_0->blocksize + VAR_0->nwrap too large\n"); return AVERROR_INVALIDDATA; } if ((VAR_3 = av_reallocp_array(&VAR_0->offset[VAR_2], sizeof(int32_t), FFMAX(1, VAR_0->nmean))) < 0) return VAR_3; if ((VAR_3 = av_reallocp_array(&VAR_0->decoded_base[VAR_2], (VAR_0->blocksize + VAR_0->nwrap), sizeof(VAR_0->decoded_base[0][0]))) < 0) return VAR_3; for (VAR_1 = 0; VAR_1 < VAR_0->nwrap; VAR_1++) VAR_0->decoded_base[VAR_2][VAR_1] = 0; VAR_0->decoded[VAR_2] = VAR_0->decoded_base[VAR_2] + VAR_0->nwrap; } if ((VAR_3 = av_reallocp_array(&VAR_0->coeffs, VAR_0->nwrap, sizeof(*VAR_0->coeffs))) < 0) return VAR_3; return 0; }
[ "static int FUNC_0(ShortenContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3;", "for (VAR_2 = 0; VAR_2 < VAR_0->channels; VAR_2++) {", "if (FFMAX(1, VAR_0->nmean) >= UINT_MAX / sizeof(int32_t)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"nmean too large\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (VAR_0->blocksize + VAR_0->nwrap >= UINT_MAX / sizeof(int32_t) ||\nVAR_0->blocksize + VAR_0->nwrap <= (unsigned)VAR_0->nwrap) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"VAR_0->blocksize + VAR_0->nwrap too large\\n\");", "return AVERROR_INVALIDDATA;", "}", "if ((VAR_3 = av_reallocp_array(&VAR_0->offset[VAR_2],\nsizeof(int32_t),\nFFMAX(1, VAR_0->nmean))) < 0)\nreturn VAR_3;", "if ((VAR_3 = av_reallocp_array(&VAR_0->decoded_base[VAR_2], (VAR_0->blocksize + VAR_0->nwrap),\nsizeof(VAR_0->decoded_base[0][0]))) < 0)\nreturn VAR_3;", "for (VAR_1 = 0; VAR_1 < VAR_0->nwrap; VAR_1++)", "VAR_0->decoded_base[VAR_2][VAR_1] = 0;", "VAR_0->decoded[VAR_2] = VAR_0->decoded_base[VAR_2] + VAR_0->nwrap;", "}", "if ((VAR_3 = av_reallocp_array(&VAR_0->coeffs, VAR_0->nwrap, sizeof(*VAR_0->coeffs))) < 0)\nreturn VAR_3;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 33, 35, 37, 39 ], [ 43, 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 65 ], [ 67 ] ]
13,327
static av_always_inline int rv40_loop_filter_strength(uint8_t *src, int step, int stride, int beta, int beta2, int edge, int *p1, int *q1) { int sum_p1p0 = 0, sum_q1q0 = 0, sum_p1p2 = 0, sum_q1q2 = 0; int strong0 = 0, strong1 = 0; uint8_t *ptr; int i; for (i = 0, ptr = src; i < 4; i++, ptr += stride) { sum_p1p0 += ptr[-2*step] - ptr[-1*step]; sum_q1q0 += ptr[ 1*step] - ptr[ 0*step]; } *p1 = FFABS(sum_p1p0) < (beta << 2); *q1 = FFABS(sum_q1q0) < (beta << 2); if(!*p1 && !*q1) return 0; if (!edge) return 0; for (i = 0, ptr = src; i < 4; i++, ptr += stride) { sum_p1p2 += ptr[-2*step] - ptr[-3*step]; sum_q1q2 += ptr[ 1*step] - ptr[ 2*step]; } strong0 = *p1 && (FFABS(sum_p1p2) < beta2); strong1 = *q1 && (FFABS(sum_q1q2) < beta2); return strong0 && strong1; }
true
FFmpeg
3ab9a2a5577d445252724af4067d2a7c8a378efa
static av_always_inline int rv40_loop_filter_strength(uint8_t *src, int step, int stride, int beta, int beta2, int edge, int *p1, int *q1) { int sum_p1p0 = 0, sum_q1q0 = 0, sum_p1p2 = 0, sum_q1q2 = 0; int strong0 = 0, strong1 = 0; uint8_t *ptr; int i; for (i = 0, ptr = src; i < 4; i++, ptr += stride) { sum_p1p0 += ptr[-2*step] - ptr[-1*step]; sum_q1q0 += ptr[ 1*step] - ptr[ 0*step]; } *p1 = FFABS(sum_p1p0) < (beta << 2); *q1 = FFABS(sum_q1q0) < (beta << 2); if(!*p1 && !*q1) return 0; if (!edge) return 0; for (i = 0, ptr = src; i < 4; i++, ptr += stride) { sum_p1p2 += ptr[-2*step] - ptr[-3*step]; sum_q1q2 += ptr[ 1*step] - ptr[ 2*step]; } strong0 = *p1 && (FFABS(sum_p1p2) < beta2); strong1 = *q1 && (FFABS(sum_q1q2) < beta2); return strong0 && strong1; }
{ "code": [ " int step, int stride," ], "line_no": [ 3 ] }
static av_always_inline int FUNC_0(uint8_t *src, int step, int stride, int beta, int beta2, int edge, int *p1, int *q1) { int VAR_0 = 0, VAR_1 = 0, VAR_2 = 0, VAR_3 = 0; int VAR_4 = 0, VAR_5 = 0; uint8_t *ptr; int VAR_6; for (VAR_6 = 0, ptr = src; VAR_6 < 4; VAR_6++, ptr += stride) { VAR_0 += ptr[-2*step] - ptr[-1*step]; VAR_1 += ptr[ 1*step] - ptr[ 0*step]; } *p1 = FFABS(VAR_0) < (beta << 2); *q1 = FFABS(VAR_1) < (beta << 2); if(!*p1 && !*q1) return 0; if (!edge) return 0; for (VAR_6 = 0, ptr = src; VAR_6 < 4; VAR_6++, ptr += stride) { VAR_2 += ptr[-2*step] - ptr[-3*step]; VAR_3 += ptr[ 1*step] - ptr[ 2*step]; } VAR_4 = *p1 && (FFABS(VAR_2) < beta2); VAR_5 = *q1 && (FFABS(VAR_3) < beta2); return VAR_4 && VAR_5; }
[ "static av_always_inline int FUNC_0(uint8_t *src,\nint step, int stride,\nint beta, int beta2,\nint edge,\nint *p1, int *q1)\n{", "int VAR_0 = 0, VAR_1 = 0, VAR_2 = 0, VAR_3 = 0;", "int VAR_4 = 0, VAR_5 = 0;", "uint8_t *ptr;", "int VAR_6;", "for (VAR_6 = 0, ptr = src; VAR_6 < 4; VAR_6++, ptr += stride) {", "VAR_0 += ptr[-2*step] - ptr[-1*step];", "VAR_1 += ptr[ 1*step] - ptr[ 0*step];", "}", "*p1 = FFABS(VAR_0) < (beta << 2);", "*q1 = FFABS(VAR_1) < (beta << 2);", "if(!*p1 && !*q1)\nreturn 0;", "if (!edge)\nreturn 0;", "for (VAR_6 = 0, ptr = src; VAR_6 < 4; VAR_6++, ptr += stride) {", "VAR_2 += ptr[-2*step] - ptr[-3*step];", "VAR_3 += ptr[ 1*step] - ptr[ 2*step];", "}", "VAR_4 = *p1 && (FFABS(VAR_2) < beta2);", "VAR_5 = *q1 && (FFABS(VAR_3) < beta2);", "return VAR_4 && VAR_5;", "}" ]
[ 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 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ] ]
13,328
static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce, int win, int group_len, const float lambda) { BandCodingPath path[120][CB_TOT_ALL]; int w, swb, cb, start, size; int i, j; const int max_sfb = sce->ics.max_sfb; const int run_bits = sce->ics.num_windows == 1 ? 5 : 3; const int run_esc = (1 << run_bits) - 1; int idx, ppos, count; int stackrun[120], stackcb[120], stack_len; float next_minrd = INFINITY; int next_mincb = 0; abs_pow34_v(s->scoefs, sce->coeffs, 1024); start = win*128; for (cb = 0; cb < CB_TOT_ALL; cb++) { path[0][cb].cost = 0.0f; path[0][cb].prev_idx = -1; path[0][cb].run = 0; } for (swb = 0; swb < max_sfb; swb++) { size = sce->ics.swb_sizes[swb]; if (sce->zeroes[win*16 + swb]) { for (cb = 0; cb < CB_TOT_ALL; cb++) { path[swb+1][cb].prev_idx = cb; path[swb+1][cb].cost = path[swb][cb].cost; path[swb+1][cb].run = path[swb][cb].run + 1; } } else { float minrd = next_minrd; int mincb = next_mincb; next_minrd = INFINITY; next_mincb = 0; for (cb = 0; cb < CB_TOT_ALL; cb++) { float cost_stay_here, cost_get_here; float rd = 0.0f; if (cb >= 12 && sce->band_type[win*16+swb] < aac_cb_out_map[cb] || cb < aac_cb_in_map[sce->band_type[win*16+swb]] && sce->band_type[win*16+swb] > aac_cb_out_map[cb]) { path[swb+1][cb].prev_idx = -1; path[swb+1][cb].cost = INFINITY; path[swb+1][cb].run = path[swb][cb].run + 1; continue; } for (w = 0; w < group_len; w++) { FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(win+w)*16+swb]; rd += quantize_band_cost(s, sce->coeffs + start + w*128, s->scoefs + start + w*128, size, sce->sf_idx[(win+w)*16+swb], aac_cb_out_map[cb], lambda / band->threshold, INFINITY, NULL, 0); } cost_stay_here = path[swb][cb].cost + rd; cost_get_here = minrd + rd + run_bits + 4; if ( run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run] != run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run+1]) cost_stay_here += run_bits; if (cost_get_here < cost_stay_here) { path[swb+1][cb].prev_idx = mincb; path[swb+1][cb].cost = cost_get_here; path[swb+1][cb].run = 1; } else { path[swb+1][cb].prev_idx = cb; path[swb+1][cb].cost = cost_stay_here; path[swb+1][cb].run = path[swb][cb].run + 1; } if (path[swb+1][cb].cost < next_minrd) { next_minrd = path[swb+1][cb].cost; next_mincb = cb; } } } start += sce->ics.swb_sizes[swb]; } //convert resulting path from backward-linked list stack_len = 0; idx = 0; for (cb = 1; cb < CB_TOT_ALL; cb++) if (path[max_sfb][cb].cost < path[max_sfb][idx].cost) idx = cb; ppos = max_sfb; while (ppos > 0) { av_assert1(idx >= 0); cb = idx; stackrun[stack_len] = path[ppos][cb].run; stackcb [stack_len] = cb; idx = path[ppos-path[ppos][cb].run+1][cb].prev_idx; ppos -= path[ppos][cb].run; stack_len++; } //perform actual band info encoding start = 0; for (i = stack_len - 1; i >= 0; i--) { cb = aac_cb_out_map[stackcb[i]]; put_bits(&s->pb, 4, cb); count = stackrun[i]; memset(sce->zeroes + win*16 + start, !cb, count); //XXX: memset when band_type is also uint8_t for (j = 0; j < count; j++) { sce->band_type[win*16 + start] = cb; start++; } while (count >= run_esc) { put_bits(&s->pb, run_bits, run_esc); count -= run_esc; } put_bits(&s->pb, run_bits, count); } }
true
FFmpeg
32be264cea542b4dc721b10092bf1dfe511a28ee
static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce, int win, int group_len, const float lambda) { BandCodingPath path[120][CB_TOT_ALL]; int w, swb, cb, start, size; int i, j; const int max_sfb = sce->ics.max_sfb; const int run_bits = sce->ics.num_windows == 1 ? 5 : 3; const int run_esc = (1 << run_bits) - 1; int idx, ppos, count; int stackrun[120], stackcb[120], stack_len; float next_minrd = INFINITY; int next_mincb = 0; abs_pow34_v(s->scoefs, sce->coeffs, 1024); start = win*128; for (cb = 0; cb < CB_TOT_ALL; cb++) { path[0][cb].cost = 0.0f; path[0][cb].prev_idx = -1; path[0][cb].run = 0; } for (swb = 0; swb < max_sfb; swb++) { size = sce->ics.swb_sizes[swb]; if (sce->zeroes[win*16 + swb]) { for (cb = 0; cb < CB_TOT_ALL; cb++) { path[swb+1][cb].prev_idx = cb; path[swb+1][cb].cost = path[swb][cb].cost; path[swb+1][cb].run = path[swb][cb].run + 1; } } else { float minrd = next_minrd; int mincb = next_mincb; next_minrd = INFINITY; next_mincb = 0; for (cb = 0; cb < CB_TOT_ALL; cb++) { float cost_stay_here, cost_get_here; float rd = 0.0f; if (cb >= 12 && sce->band_type[win*16+swb] < aac_cb_out_map[cb] || cb < aac_cb_in_map[sce->band_type[win*16+swb]] && sce->band_type[win*16+swb] > aac_cb_out_map[cb]) { path[swb+1][cb].prev_idx = -1; path[swb+1][cb].cost = INFINITY; path[swb+1][cb].run = path[swb][cb].run + 1; continue; } for (w = 0; w < group_len; w++) { FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(win+w)*16+swb]; rd += quantize_band_cost(s, sce->coeffs + start + w*128, s->scoefs + start + w*128, size, sce->sf_idx[(win+w)*16+swb], aac_cb_out_map[cb], lambda / band->threshold, INFINITY, NULL, 0); } cost_stay_here = path[swb][cb].cost + rd; cost_get_here = minrd + rd + run_bits + 4; if ( run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run] != run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run+1]) cost_stay_here += run_bits; if (cost_get_here < cost_stay_here) { path[swb+1][cb].prev_idx = mincb; path[swb+1][cb].cost = cost_get_here; path[swb+1][cb].run = 1; } else { path[swb+1][cb].prev_idx = cb; path[swb+1][cb].cost = cost_stay_here; path[swb+1][cb].run = path[swb][cb].run + 1; } if (path[swb+1][cb].cost < next_minrd) { next_minrd = path[swb+1][cb].cost; next_mincb = cb; } } } start += sce->ics.swb_sizes[swb]; } stack_len = 0; idx = 0; for (cb = 1; cb < CB_TOT_ALL; cb++) if (path[max_sfb][cb].cost < path[max_sfb][idx].cost) idx = cb; ppos = max_sfb; while (ppos > 0) { av_assert1(idx >= 0); cb = idx; stackrun[stack_len] = path[ppos][cb].run; stackcb [stack_len] = cb; idx = path[ppos-path[ppos][cb].run+1][cb].prev_idx; ppos -= path[ppos][cb].run; stack_len++; } start = 0; for (i = stack_len - 1; i >= 0; i--) { cb = aac_cb_out_map[stackcb[i]]; put_bits(&s->pb, 4, cb); count = stackrun[i]; memset(sce->zeroes + win*16 + start, !cb, count); for (j = 0; j < count; j++) { sce->band_type[win*16 + start] = cb; start++; } while (count >= run_esc) { put_bits(&s->pb, run_bits, run_esc); count -= run_esc; } put_bits(&s->pb, run_bits, count); } }
{ "code": [ " rd += quantize_band_cost(s, sce->coeffs + start + w*128,", " s->scoefs + start + w*128, size," ], "line_no": [ 93, 95 ] }
static void FUNC_0(AACEncContext *VAR_0, SingleChannelElement *VAR_1, int VAR_2, int VAR_3, const float VAR_4) { BandCodingPath path[120][CB_TOT_ALL]; int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10, VAR_11; const int VAR_12 = VAR_1->ics.VAR_12; const int VAR_13 = VAR_1->ics.num_windows == 1 ? 5 : 3; const int VAR_14 = (1 << VAR_13) - 1; int VAR_15, VAR_16, VAR_17; int VAR_18[120], VAR_19[120], VAR_20; float VAR_21 = INFINITY; int VAR_22 = 0; abs_pow34_v(VAR_0->scoefs, VAR_1->coeffs, 1024); VAR_8 = VAR_2*128; for (VAR_7 = 0; VAR_7 < CB_TOT_ALL; VAR_7++) { path[0][VAR_7].cost = 0.0f; path[0][VAR_7].prev_idx = -1; path[0][VAR_7].run = 0; } for (VAR_6 = 0; VAR_6 < VAR_12; VAR_6++) { VAR_9 = VAR_1->ics.swb_sizes[VAR_6]; if (VAR_1->zeroes[VAR_2*16 + VAR_6]) { for (VAR_7 = 0; VAR_7 < CB_TOT_ALL; VAR_7++) { path[VAR_6+1][VAR_7].prev_idx = VAR_7; path[VAR_6+1][VAR_7].cost = path[VAR_6][VAR_7].cost; path[VAR_6+1][VAR_7].run = path[VAR_6][VAR_7].run + 1; } } else { float VAR_23 = VAR_21; int VAR_24 = VAR_22; VAR_21 = INFINITY; VAR_22 = 0; for (VAR_7 = 0; VAR_7 < CB_TOT_ALL; VAR_7++) { float cost_stay_here, cost_get_here; float rd = 0.0f; if (VAR_7 >= 12 && VAR_1->band_type[VAR_2*16+VAR_6] < aac_cb_out_map[VAR_7] || VAR_7 < aac_cb_in_map[VAR_1->band_type[VAR_2*16+VAR_6]] && VAR_1->band_type[VAR_2*16+VAR_6] > aac_cb_out_map[VAR_7]) { path[VAR_6+1][VAR_7].prev_idx = -1; path[VAR_6+1][VAR_7].cost = INFINITY; path[VAR_6+1][VAR_7].run = path[VAR_6][VAR_7].run + 1; continue; } for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5++) { FFPsyBand *band = &VAR_0->psy.ch[VAR_0->cur_channel].psy_bands[(VAR_2+VAR_5)*16+VAR_6]; rd += quantize_band_cost(VAR_0, VAR_1->coeffs + VAR_8 + VAR_5*128, VAR_0->scoefs + VAR_8 + VAR_5*128, VAR_9, VAR_1->sf_idx[(VAR_2+VAR_5)*16+VAR_6], aac_cb_out_map[VAR_7], VAR_4 / band->threshold, INFINITY, NULL, 0); } cost_stay_here = path[VAR_6][VAR_7].cost + rd; cost_get_here = VAR_23 + rd + VAR_13 + 4; if ( run_value_bits[VAR_1->ics.num_windows == 8][path[VAR_6][VAR_7].run] != run_value_bits[VAR_1->ics.num_windows == 8][path[VAR_6][VAR_7].run+1]) cost_stay_here += VAR_13; if (cost_get_here < cost_stay_here) { path[VAR_6+1][VAR_7].prev_idx = VAR_24; path[VAR_6+1][VAR_7].cost = cost_get_here; path[VAR_6+1][VAR_7].run = 1; } else { path[VAR_6+1][VAR_7].prev_idx = VAR_7; path[VAR_6+1][VAR_7].cost = cost_stay_here; path[VAR_6+1][VAR_7].run = path[VAR_6][VAR_7].run + 1; } if (path[VAR_6+1][VAR_7].cost < VAR_21) { VAR_21 = path[VAR_6+1][VAR_7].cost; VAR_22 = VAR_7; } } } VAR_8 += VAR_1->ics.swb_sizes[VAR_6]; } VAR_20 = 0; VAR_15 = 0; for (VAR_7 = 1; VAR_7 < CB_TOT_ALL; VAR_7++) if (path[VAR_12][VAR_7].cost < path[VAR_12][VAR_15].cost) VAR_15 = VAR_7; VAR_16 = VAR_12; while (VAR_16 > 0) { av_assert1(VAR_15 >= 0); VAR_7 = VAR_15; VAR_18[VAR_20] = path[VAR_16][VAR_7].run; VAR_19 [VAR_20] = VAR_7; VAR_15 = path[VAR_16-path[VAR_16][VAR_7].run+1][VAR_7].prev_idx; VAR_16 -= path[VAR_16][VAR_7].run; VAR_20++; } VAR_8 = 0; for (VAR_10 = VAR_20 - 1; VAR_10 >= 0; VAR_10--) { VAR_7 = aac_cb_out_map[VAR_19[VAR_10]]; put_bits(&VAR_0->pb, 4, VAR_7); VAR_17 = VAR_18[VAR_10]; memset(VAR_1->zeroes + VAR_2*16 + VAR_8, !VAR_7, VAR_17); for (VAR_11 = 0; VAR_11 < VAR_17; VAR_11++) { VAR_1->band_type[VAR_2*16 + VAR_8] = VAR_7; VAR_8++; } while (VAR_17 >= VAR_14) { put_bits(&VAR_0->pb, VAR_13, VAR_14); VAR_17 -= VAR_14; } put_bits(&VAR_0->pb, VAR_13, VAR_17); } }
[ "static void FUNC_0(AACEncContext *VAR_0, SingleChannelElement *VAR_1,\nint VAR_2, int VAR_3, const float VAR_4)\n{", "BandCodingPath path[120][CB_TOT_ALL];", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "int VAR_10, VAR_11;", "const int VAR_12 = VAR_1->ics.VAR_12;", "const int VAR_13 = VAR_1->ics.num_windows == 1 ? 5 : 3;", "const int VAR_14 = (1 << VAR_13) - 1;", "int VAR_15, VAR_16, VAR_17;", "int VAR_18[120], VAR_19[120], VAR_20;", "float VAR_21 = INFINITY;", "int VAR_22 = 0;", "abs_pow34_v(VAR_0->scoefs, VAR_1->coeffs, 1024);", "VAR_8 = VAR_2*128;", "for (VAR_7 = 0; VAR_7 < CB_TOT_ALL; VAR_7++) {", "path[0][VAR_7].cost = 0.0f;", "path[0][VAR_7].prev_idx = -1;", "path[0][VAR_7].run = 0;", "}", "for (VAR_6 = 0; VAR_6 < VAR_12; VAR_6++) {", "VAR_9 = VAR_1->ics.swb_sizes[VAR_6];", "if (VAR_1->zeroes[VAR_2*16 + VAR_6]) {", "for (VAR_7 = 0; VAR_7 < CB_TOT_ALL; VAR_7++) {", "path[VAR_6+1][VAR_7].prev_idx = VAR_7;", "path[VAR_6+1][VAR_7].cost = path[VAR_6][VAR_7].cost;", "path[VAR_6+1][VAR_7].run = path[VAR_6][VAR_7].run + 1;", "}", "} else {", "float VAR_23 = VAR_21;", "int VAR_24 = VAR_22;", "VAR_21 = INFINITY;", "VAR_22 = 0;", "for (VAR_7 = 0; VAR_7 < CB_TOT_ALL; VAR_7++) {", "float cost_stay_here, cost_get_here;", "float rd = 0.0f;", "if (VAR_7 >= 12 && VAR_1->band_type[VAR_2*16+VAR_6] < aac_cb_out_map[VAR_7] ||\nVAR_7 < aac_cb_in_map[VAR_1->band_type[VAR_2*16+VAR_6]] && VAR_1->band_type[VAR_2*16+VAR_6] > aac_cb_out_map[VAR_7]) {", "path[VAR_6+1][VAR_7].prev_idx = -1;", "path[VAR_6+1][VAR_7].cost = INFINITY;", "path[VAR_6+1][VAR_7].run = path[VAR_6][VAR_7].run + 1;", "continue;", "}", "for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5++) {", "FFPsyBand *band = &VAR_0->psy.ch[VAR_0->cur_channel].psy_bands[(VAR_2+VAR_5)*16+VAR_6];", "rd += quantize_band_cost(VAR_0, VAR_1->coeffs + VAR_8 + VAR_5*128,\nVAR_0->scoefs + VAR_8 + VAR_5*128, VAR_9,\nVAR_1->sf_idx[(VAR_2+VAR_5)*16+VAR_6], aac_cb_out_map[VAR_7],\nVAR_4 / band->threshold, INFINITY, NULL, 0);", "}", "cost_stay_here = path[VAR_6][VAR_7].cost + rd;", "cost_get_here = VAR_23 + rd + VAR_13 + 4;", "if ( run_value_bits[VAR_1->ics.num_windows == 8][path[VAR_6][VAR_7].run]\n!= run_value_bits[VAR_1->ics.num_windows == 8][path[VAR_6][VAR_7].run+1])\ncost_stay_here += VAR_13;", "if (cost_get_here < cost_stay_here) {", "path[VAR_6+1][VAR_7].prev_idx = VAR_24;", "path[VAR_6+1][VAR_7].cost = cost_get_here;", "path[VAR_6+1][VAR_7].run = 1;", "} else {", "path[VAR_6+1][VAR_7].prev_idx = VAR_7;", "path[VAR_6+1][VAR_7].cost = cost_stay_here;", "path[VAR_6+1][VAR_7].run = path[VAR_6][VAR_7].run + 1;", "}", "if (path[VAR_6+1][VAR_7].cost < VAR_21) {", "VAR_21 = path[VAR_6+1][VAR_7].cost;", "VAR_22 = VAR_7;", "}", "}", "}", "VAR_8 += VAR_1->ics.swb_sizes[VAR_6];", "}", "VAR_20 = 0;", "VAR_15 = 0;", "for (VAR_7 = 1; VAR_7 < CB_TOT_ALL; VAR_7++)", "if (path[VAR_12][VAR_7].cost < path[VAR_12][VAR_15].cost)\nVAR_15 = VAR_7;", "VAR_16 = VAR_12;", "while (VAR_16 > 0) {", "av_assert1(VAR_15 >= 0);", "VAR_7 = VAR_15;", "VAR_18[VAR_20] = path[VAR_16][VAR_7].run;", "VAR_19 [VAR_20] = VAR_7;", "VAR_15 = path[VAR_16-path[VAR_16][VAR_7].run+1][VAR_7].prev_idx;", "VAR_16 -= path[VAR_16][VAR_7].run;", "VAR_20++;", "}", "VAR_8 = 0;", "for (VAR_10 = VAR_20 - 1; VAR_10 >= 0; VAR_10--) {", "VAR_7 = aac_cb_out_map[VAR_19[VAR_10]];", "put_bits(&VAR_0->pb, 4, VAR_7);", "VAR_17 = VAR_18[VAR_10];", "memset(VAR_1->zeroes + VAR_2*16 + VAR_8, !VAR_7, VAR_17);", "for (VAR_11 = 0; VAR_11 < VAR_17; VAR_11++) {", "VAR_1->band_type[VAR_2*16 + VAR_8] = VAR_7;", "VAR_8++;", "}", "while (VAR_17 >= VAR_14) {", "put_bits(&VAR_0->pb, VAR_13, VAR_14);", "VAR_17 -= VAR_14;", "}", "put_bits(&VAR_0->pb, VAR_13, 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, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95, 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 151 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ] ]
13,329
callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time) { AVFormatContext *s = priv_data; struct dshow_ctx *ctx = s->priv_data; AVPacketList **ppktl, *pktl_next; // dump_videohdr(s, vdhdr); WaitForSingleObject(ctx->mutex, INFINITE); if(shall_we_drop(s, index)) goto fail; pktl_next = av_mallocz(sizeof(AVPacketList)); if(!pktl_next) goto fail; if(av_new_packet(&pktl_next->pkt, buf_size) < 0) { av_free(pktl_next); goto fail; } pktl_next->pkt.stream_index = index; pktl_next->pkt.pts = time; memcpy(pktl_next->pkt.data, buf, buf_size); for(ppktl = &ctx->pktl ; *ppktl ; ppktl = &(*ppktl)->next); *ppktl = pktl_next; ctx->curbufsize[index] += buf_size; SetEvent(ctx->event[1]); ReleaseMutex(ctx->mutex); return; fail: ReleaseMutex(ctx->mutex); return; }
true
FFmpeg
773eb74babe07bc5c97c32aa564efc40e2d4b00c
callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time) { AVFormatContext *s = priv_data; struct dshow_ctx *ctx = s->priv_data; AVPacketList **ppktl, *pktl_next; WaitForSingleObject(ctx->mutex, INFINITE); if(shall_we_drop(s, index)) goto fail; pktl_next = av_mallocz(sizeof(AVPacketList)); if(!pktl_next) goto fail; if(av_new_packet(&pktl_next->pkt, buf_size) < 0) { av_free(pktl_next); goto fail; } pktl_next->pkt.stream_index = index; pktl_next->pkt.pts = time; memcpy(pktl_next->pkt.data, buf, buf_size); for(ppktl = &ctx->pktl ; *ppktl ; ppktl = &(*ppktl)->next); *ppktl = pktl_next; ctx->curbufsize[index] += buf_size; SetEvent(ctx->event[1]); ReleaseMutex(ctx->mutex); return; fail: ReleaseMutex(ctx->mutex); return; }
{ "code": [ "callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time)", " if(shall_we_drop(s, index))" ], "line_no": [ 1, 21 ] }
FUNC_0(void *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3, int64_t VAR_4) { AVFormatContext *s = VAR_0; struct dshow_ctx *VAR_5 = s->VAR_0; AVPacketList **ppktl, *pktl_next; WaitForSingleObject(VAR_5->mutex, INFINITE); if(shall_we_drop(s, VAR_1)) goto fail; pktl_next = av_mallocz(sizeof(AVPacketList)); if(!pktl_next) goto fail; if(av_new_packet(&pktl_next->pkt, VAR_3) < 0) { av_free(pktl_next); goto fail; } pktl_next->pkt.stream_index = VAR_1; pktl_next->pkt.pts = VAR_4; memcpy(pktl_next->pkt.data, VAR_2, VAR_3); for(ppktl = &VAR_5->pktl ; *ppktl ; ppktl = &(*ppktl)->next); *ppktl = pktl_next; VAR_5->curbufsize[VAR_1] += VAR_3; SetEvent(VAR_5->event[1]); ReleaseMutex(VAR_5->mutex); return; fail: ReleaseMutex(VAR_5->mutex); return; }
[ "FUNC_0(void *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3, int64_t VAR_4)\n{", "AVFormatContext *s = VAR_0;", "struct dshow_ctx *VAR_5 = s->VAR_0;", "AVPacketList **ppktl, *pktl_next;", "WaitForSingleObject(VAR_5->mutex, INFINITE);", "if(shall_we_drop(s, VAR_1))\ngoto fail;", "pktl_next = av_mallocz(sizeof(AVPacketList));", "if(!pktl_next)\ngoto fail;", "if(av_new_packet(&pktl_next->pkt, VAR_3) < 0) {", "av_free(pktl_next);", "goto fail;", "}", "pktl_next->pkt.stream_index = VAR_1;", "pktl_next->pkt.pts = VAR_4;", "memcpy(pktl_next->pkt.data, VAR_2, VAR_3);", "for(ppktl = &VAR_5->pktl ; *ppktl ; ppktl = &(*ppktl)->next);", "*ppktl = pktl_next;", "VAR_5->curbufsize[VAR_1] += VAR_3;", "SetEvent(VAR_5->event[1]);", "ReleaseMutex(VAR_5->mutex);", "return;", "fail:\nReleaseMutex(VAR_5->mutex);", "return;", "}" ]
[ 1, 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 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ] ]
13,330
void fw_cfg_add_string(FWCfgState *s, uint16_t key, const char *value) { size_t sz = strlen(value) + 1; return fw_cfg_add_bytes(s, key, (uint8_t *)g_memdup(value, sz), sz); }
true
qemu
089da572b956ef0f8f5b8d5917358e07892a77c2
void fw_cfg_add_string(FWCfgState *s, uint16_t key, const char *value) { size_t sz = strlen(value) + 1; return fw_cfg_add_bytes(s, key, (uint8_t *)g_memdup(value, sz), sz); }
{ "code": [ " return fw_cfg_add_bytes(s, key, (uint8_t *)g_memdup(value, sz), sz);" ], "line_no": [ 9 ] }
void FUNC_0(FWCfgState *VAR_0, uint16_t VAR_1, const char *VAR_2) { size_t sz = strlen(VAR_2) + 1; return fw_cfg_add_bytes(VAR_0, VAR_1, (uint8_t *)g_memdup(VAR_2, sz), sz); }
[ "void FUNC_0(FWCfgState *VAR_0, uint16_t VAR_1, const char *VAR_2)\n{", "size_t sz = strlen(VAR_2) + 1;", "return fw_cfg_add_bytes(VAR_0, VAR_1, (uint8_t *)g_memdup(VAR_2, sz), sz);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
13,331
static void ide_flush_cache(IDEState *s) { if (s->blk == NULL) { ide_flush_cb(s, 0); return; } s->status |= BUSY_STAT; ide_set_retry(s); block_acct_start(blk_get_stats(s->blk), &s->acct, 0, BLOCK_ACCT_FLUSH); s->pio_aiocb = blk_aio_flush(s->blk, ide_flush_cb, s); }
true
qemu
4da97120d51a4383aa96d741a2b837f8c4bbcd0b
static void ide_flush_cache(IDEState *s) { if (s->blk == NULL) { ide_flush_cb(s, 0); return; } s->status |= BUSY_STAT; ide_set_retry(s); block_acct_start(blk_get_stats(s->blk), &s->acct, 0, BLOCK_ACCT_FLUSH); s->pio_aiocb = blk_aio_flush(s->blk, ide_flush_cb, s); }
{ "code": [ " s->pio_aiocb = blk_aio_flush(s->blk, ide_flush_cb, s);" ], "line_no": [ 21 ] }
static void FUNC_0(IDEState *VAR_0) { if (VAR_0->blk == NULL) { ide_flush_cb(VAR_0, 0); return; } VAR_0->status |= BUSY_STAT; ide_set_retry(VAR_0); block_acct_start(blk_get_stats(VAR_0->blk), &VAR_0->acct, 0, BLOCK_ACCT_FLUSH); VAR_0->pio_aiocb = blk_aio_flush(VAR_0->blk, ide_flush_cb, VAR_0); }
[ "static void FUNC_0(IDEState *VAR_0)\n{", "if (VAR_0->blk == NULL) {", "ide_flush_cb(VAR_0, 0);", "return;", "}", "VAR_0->status |= BUSY_STAT;", "ide_set_retry(VAR_0);", "block_acct_start(blk_get_stats(VAR_0->blk), &VAR_0->acct, 0, BLOCK_ACCT_FLUSH);", "VAR_0->pio_aiocb = blk_aio_flush(VAR_0->blk, ide_flush_cb, VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
13,332
void helper_st_asi(target_ulong addr, target_ulong val, int asi, int size) { #ifdef DEBUG_ASI dump_asi("write", addr, asi, size, val); #endif asi &= 0xff; if ((asi < 0x80 && (env->pstate & PS_PRIV) == 0) || ((env->def->features & CPU_FEATURE_HYPV) && asi >= 0x30 && asi < 0x80 && !(env->hpstate & HS_PRIV))) raise_exception(TT_PRIV_ACT); helper_check_align(addr, size - 1); /* Convert to little endian */ switch (asi) { case 0x0c: // Nucleus Little Endian (LE) case 0x18: // As if user primary LE case 0x19: // As if user secondary LE case 0x1c: // Bypass LE case 0x1d: // Bypass, non-cacheable LE case 0x88: // Primary LE case 0x89: // Secondary LE switch(size) { case 2: val = bswap16(val); break; case 4: val = bswap32(val); break; case 8: val = bswap64(val); break; default: break; } default: break; } switch(asi) { case 0x10: // As if user primary case 0x11: // As if user secondary case 0x18: // As if user primary LE case 0x19: // As if user secondary LE case 0x80: // Primary case 0x81: // Secondary case 0x88: // Primary LE case 0x89: // Secondary LE case 0xe2: // UA2007 Primary block init case 0xe3: // UA2007 Secondary block init if ((asi & 0x80) && (env->pstate & PS_PRIV)) { if ((env->def->features & CPU_FEATURE_HYPV) && env->hpstate & HS_PRIV) { switch(size) { case 1: stb_hypv(addr, val); break; case 2: stw_hypv(addr, val); break; case 4: stl_hypv(addr, val); break; case 8: default: stq_hypv(addr, val); break; } } else { /* secondary space access has lowest asi bit equal to 1 */ if (asi & 1) { switch(size) { case 1: stb_kernel_secondary(addr, val); break; case 2: stw_kernel_secondary(addr, val); break; case 4: stl_kernel_secondary(addr, val); break; case 8: default: stq_kernel_secondary(addr, val); break; } } else { switch(size) { case 1: stb_kernel(addr, val); break; case 2: stw_kernel(addr, val); break; case 4: stl_kernel(addr, val); break; case 8: default: stq_kernel(addr, val); break; } } } } else { /* secondary space access has lowest asi bit equal to 1 */ if (asi & 1) { switch(size) { case 1: stb_user_secondary(addr, val); break; case 2: stw_user_secondary(addr, val); break; case 4: stl_user_secondary(addr, val); break; case 8: default: stq_user_secondary(addr, val); break; } } else { switch(size) { case 1: stb_user(addr, val); break; case 2: stw_user(addr, val); break; case 4: stl_user(addr, val); break; case 8: default: stq_user(addr, val); break; } } } break; case 0x14: // Bypass case 0x15: // Bypass, non-cacheable case 0x1c: // Bypass LE case 0x1d: // Bypass, non-cacheable LE { switch(size) { case 1: stb_phys(addr, val); break; case 2: stw_phys(addr, val); break; case 4: stl_phys(addr, val); break; case 8: default: stq_phys(addr, val); break; } } return; case 0x24: // Nucleus quad LDD 128 bit atomic case 0x2c: // Nucleus quad LDD 128 bit atomic LE // Only ldda allowed raise_exception(TT_ILL_INSN); return; case 0x04: // Nucleus case 0x0c: // Nucleus Little Endian (LE) { switch(size) { case 1: stb_nucleus(addr, val); break; case 2: stw_nucleus(addr, val); break; case 4: stl_nucleus(addr, val); break; default: case 8: stq_nucleus(addr, val); break; } break; } case 0x4a: // UPA config // XXX return; case 0x45: // LSU { uint64_t oldreg; oldreg = env->lsu; env->lsu = val & (DMMU_E | IMMU_E); // Mappings generated during D/I MMU disabled mode are // invalid in normal mode if (oldreg != env->lsu) { DPRINTF_MMU("LSU change: 0x%" PRIx64 " -> 0x%" PRIx64 "\n", oldreg, env->lsu); #ifdef DEBUG_MMU dump_mmu(env); #endif tlb_flush(env, 1); } return; } case 0x50: // I-MMU regs { int reg = (addr >> 3) & 0xf; uint64_t oldreg; oldreg = env->immuregs[reg]; switch(reg) { case 0: // RO return; case 1: // Not in I-MMU case 2: return; case 3: // SFSR if ((val & 1) == 0) val = 0; // Clear SFSR env->immu.sfsr = val; break; case 4: // RO return; case 5: // TSB access DPRINTF_MMU("immu TSB write: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", env->immu.tsb, val); env->immu.tsb = val; break; case 6: // Tag access env->immu.tag_access = val; break; case 7: case 8: return; default: break; } if (oldreg != env->immuregs[reg]) { DPRINTF_MMU("immu change reg[%d]: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", reg, oldreg, env->immuregs[reg]); } #ifdef DEBUG_MMU dump_mmu(env); #endif return; } case 0x54: // I-MMU data in replace_tlb_1bit_lru(env->itlb, env->immu.tag_access, val, "immu", env); return; case 0x55: // I-MMU data access { // TODO: auto demap unsigned int i = (addr >> 3) & 0x3f; replace_tlb_entry(&env->itlb[i], env->immu.tag_access, val, env); #ifdef DEBUG_MMU DPRINTF_MMU("immu data access replaced entry [%i]\n", i); dump_mmu(env); #endif return; } case 0x57: // I-MMU demap demap_tlb(env->itlb, addr, "immu", env); return; case 0x58: // D-MMU regs { int reg = (addr >> 3) & 0xf; uint64_t oldreg; oldreg = env->dmmuregs[reg]; switch(reg) { case 0: // RO case 4: return; case 3: // SFSR if ((val & 1) == 0) { val = 0; // Clear SFSR, Fault address env->dmmu.sfar = 0; } env->dmmu.sfsr = val; break; case 1: // Primary context env->dmmu.mmu_primary_context = val; break; case 2: // Secondary context env->dmmu.mmu_secondary_context = val; break; case 5: // TSB access DPRINTF_MMU("dmmu TSB write: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", env->dmmu.tsb, val); env->dmmu.tsb = val; break; case 6: // Tag access env->dmmu.tag_access = val; break; case 7: // Virtual Watchpoint case 8: // Physical Watchpoint default: env->dmmuregs[reg] = val; break; } if (oldreg != env->dmmuregs[reg]) { DPRINTF_MMU("dmmu change reg[%d]: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", reg, oldreg, env->dmmuregs[reg]); } #ifdef DEBUG_MMU dump_mmu(env); #endif return; } case 0x5c: // D-MMU data in replace_tlb_1bit_lru(env->dtlb, env->dmmu.tag_access, val, "dmmu", env); return; case 0x5d: // D-MMU data access { unsigned int i = (addr >> 3) & 0x3f; replace_tlb_entry(&env->dtlb[i], env->dmmu.tag_access, val, env); #ifdef DEBUG_MMU DPRINTF_MMU("dmmu data access replaced entry [%i]\n", i); dump_mmu(env); #endif return; } case 0x5f: // D-MMU demap demap_tlb(env->dtlb, addr, "dmmu", env); return; case 0x49: // Interrupt data receive // XXX return; case 0x46: // D-cache data case 0x47: // D-cache tag access case 0x4b: // E-cache error enable case 0x4c: // E-cache asynchronous fault status case 0x4d: // E-cache asynchronous fault address case 0x4e: // E-cache tag data case 0x66: // I-cache instruction access case 0x67: // I-cache tag access case 0x6e: // I-cache predecode case 0x6f: // I-cache LRU etc. case 0x76: // E-cache tag case 0x7e: // E-cache tag return; case 0x51: // I-MMU 8k TSB pointer, RO case 0x52: // I-MMU 64k TSB pointer, RO case 0x56: // I-MMU tag read, RO case 0x59: // D-MMU 8k TSB pointer, RO case 0x5a: // D-MMU 64k TSB pointer, RO case 0x5b: // D-MMU data pointer, RO case 0x5e: // D-MMU tag read, RO case 0x48: // Interrupt dispatch, RO case 0x7f: // Incoming interrupt vector, RO case 0x82: // Primary no-fault, RO case 0x83: // Secondary no-fault, RO case 0x8a: // Primary no-fault LE, RO case 0x8b: // Secondary no-fault LE, RO default: do_unassigned_access(addr, 1, 0, 1, size); return; } }
true
qemu
2aae2b8e0abd58e76d616bcbe93c6966d06d0188
void helper_st_asi(target_ulong addr, target_ulong val, int asi, int size) { #ifdef DEBUG_ASI dump_asi("write", addr, asi, size, val); #endif asi &= 0xff; if ((asi < 0x80 && (env->pstate & PS_PRIV) == 0) || ((env->def->features & CPU_FEATURE_HYPV) && asi >= 0x30 && asi < 0x80 && !(env->hpstate & HS_PRIV))) raise_exception(TT_PRIV_ACT); helper_check_align(addr, size - 1); switch (asi) { case 0x0c: case 0x18: case 0x19: case 0x1c: case 0x1d: case 0x88: case 0x89: switch(size) { case 2: val = bswap16(val); break; case 4: val = bswap32(val); break; case 8: val = bswap64(val); break; default: break; } default: break; } switch(asi) { case 0x10: case 0x11: case 0x18: case 0x19: case 0x80: case 0x81: case 0x88: case 0x89: case 0xe2: case 0xe3: if ((asi & 0x80) && (env->pstate & PS_PRIV)) { if ((env->def->features & CPU_FEATURE_HYPV) && env->hpstate & HS_PRIV) { switch(size) { case 1: stb_hypv(addr, val); break; case 2: stw_hypv(addr, val); break; case 4: stl_hypv(addr, val); break; case 8: default: stq_hypv(addr, val); break; } } else { if (asi & 1) { switch(size) { case 1: stb_kernel_secondary(addr, val); break; case 2: stw_kernel_secondary(addr, val); break; case 4: stl_kernel_secondary(addr, val); break; case 8: default: stq_kernel_secondary(addr, val); break; } } else { switch(size) { case 1: stb_kernel(addr, val); break; case 2: stw_kernel(addr, val); break; case 4: stl_kernel(addr, val); break; case 8: default: stq_kernel(addr, val); break; } } } } else { if (asi & 1) { switch(size) { case 1: stb_user_secondary(addr, val); break; case 2: stw_user_secondary(addr, val); break; case 4: stl_user_secondary(addr, val); break; case 8: default: stq_user_secondary(addr, val); break; } } else { switch(size) { case 1: stb_user(addr, val); break; case 2: stw_user(addr, val); break; case 4: stl_user(addr, val); break; case 8: default: stq_user(addr, val); break; } } } break; case 0x14: case 0x15: , non-cacheable case 0x1c: case 0x1d: { switch(size) { case 1: stb_phys(addr, val); break; case 2: stw_phys(addr, val); break; case 4: stl_phys(addr, val); break; case 8: default: stq_phys(addr, val); break; } } return; case 0x24: case 0x2c: LE raise_exception(TT_ILL_INSN); return; case 0x04: case 0x0c: { switch(size) { case 1: stb_nucleus(addr, val); break; case 2: stw_nucleus(addr, val); break; case 4: stl_nucleus(addr, val); break; default: case 8: stq_nucleus(addr, val); break; } break; } case 0x4a: return; case 0x45: { uint64_t oldreg; oldreg = env->lsu; env->lsu = val & (DMMU_E | IMMU_E); if (oldreg != env->lsu) { DPRINTF_MMU("LSU change: 0x%" PRIx64 " -> 0x%" PRIx64 "\n", oldreg, env->lsu); #ifdef DEBUG_MMU dump_mmu(env); #endif tlb_flush(env, 1); } return; } case 0x50: { int reg = (addr >> 3) & 0xf; uint64_t oldreg; oldreg = env->immuregs[reg]; switch(reg) { case 0: return; case 1: case 2: return; case 3: if ((val & 1) == 0) val = 0; env->immu.sfsr = val; break; case 4: return; case 5: DPRINTF_MMU("immu TSB write: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", env->immu.tsb, val); env->immu.tsb = val; break; case 6: env->immu.tag_access = val; break; case 7: case 8: return; default: break; } if (oldreg != env->immuregs[reg]) { DPRINTF_MMU("immu change reg[%d]: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", reg, oldreg, env->immuregs[reg]); } #ifdef DEBUG_MMU dump_mmu(env); #endif return; } case 0x54: replace_tlb_1bit_lru(env->itlb, env->immu.tag_access, val, "immu", env); return; case 0x55: { unsigned int i = (addr >> 3) & 0x3f; replace_tlb_entry(&env->itlb[i], env->immu.tag_access, val, env); #ifdef DEBUG_MMU DPRINTF_MMU("immu data access replaced entry [%i]\n", i); dump_mmu(env); #endif return; } case 0x57: demap_tlb(env->itlb, addr, "immu", env); return; case 0x58: { int reg = (addr >> 3) & 0xf; uint64_t oldreg; oldreg = env->dmmuregs[reg]; switch(reg) { case 0: case 4: return; case 3: if ((val & 1) == 0) { val = 0; , Fault address env->dmmu.sfar = 0; } env->dmmu.sfsr = val; break; case 1: context env->dmmu.mmu_primary_context = val; break; case 2: context env->dmmu.mmu_secondary_context = val; break; case 5: DPRINTF_MMU("dmmu TSB write: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", env->dmmu.tsb, val); env->dmmu.tsb = val; break; case 6: env->dmmu.tag_access = val; break; case 7: case 8: default: env->dmmuregs[reg] = val; break; } if (oldreg != env->dmmuregs[reg]) { DPRINTF_MMU("dmmu change reg[%d]: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", reg, oldreg, env->dmmuregs[reg]); } #ifdef DEBUG_MMU dump_mmu(env); #endif return; } case 0x5c: replace_tlb_1bit_lru(env->dtlb, env->dmmu.tag_access, val, "dmmu", env); return; case 0x5d: { unsigned int i = (addr >> 3) & 0x3f; replace_tlb_entry(&env->dtlb[i], env->dmmu.tag_access, val, env); #ifdef DEBUG_MMU DPRINTF_MMU("dmmu data access replaced entry [%i]\n", i); dump_mmu(env); #endif return; } case 0x5f: demap_tlb(env->dtlb, addr, "dmmu", env); return; case 0x49: return; case 0x46: case 0x47: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x66: case 0x67: case 0x6e: case 0x6f: case 0x76: case 0x7e: return; case 0x51: case 0x52: case 0x56: case 0x59: case 0x5a: case 0x5b: case 0x5e: case 0x48: case 0x7f: case 0x82: no-fault, RO case 0x83: no-fault, RO case 0x8a: no-fault LE, RO case 0x8b: no-fault LE, RO default: do_unassigned_access(addr, 1, 0, 1, size); return; } }
{ "code": [ "#endif", "#endif", "#endif", " || ((env->def->features & CPU_FEATURE_HYPV)", " if ((env->def->features & CPU_FEATURE_HYPV)", " && env->hpstate & HS_PRIV) {", " || ((env->def->features & CPU_FEATURE_HYPV)", " if ((env->def->features & CPU_FEATURE_HYPV)", " && env->hpstate & HS_PRIV) {", " || ((env->def->features & CPU_FEATURE_HYPV)" ], "line_no": [ 9, 9, 9, 19, 107, 109, 19, 107, 109, 19 ] }
void FUNC_0(target_ulong VAR_0, target_ulong VAR_1, int VAR_2, int VAR_3) { #ifdef DEBUG_ASI dump_asi("write", VAR_0, VAR_2, VAR_3, VAR_1); #endif VAR_2 &= 0xff; if ((VAR_2 < 0x80 && (env->pstate & PS_PRIV) == 0) || ((env->def->features & CPU_FEATURE_HYPV) && VAR_2 >= 0x30 && VAR_2 < 0x80 && !(env->hpstate & HS_PRIV))) raise_exception(TT_PRIV_ACT); helper_check_align(VAR_0, VAR_3 - 1); switch (VAR_2) { case 0x0c: case 0x18: case 0x19: case 0x1c: case 0x1d: case 0x88: case 0x89: switch(VAR_3) { case 2: VAR_1 = bswap16(VAR_1); break; case 4: VAR_1 = bswap32(VAR_1); break; case 8: VAR_1 = bswap64(VAR_1); break; default: break; } default: break; } switch(VAR_2) { case 0x10: case 0x11: case 0x18: case 0x19: case 0x80: case 0x81: case 0x88: case 0x89: case 0xe2: case 0xe3: if ((VAR_2 & 0x80) && (env->pstate & PS_PRIV)) { if ((env->def->features & CPU_FEATURE_HYPV) && env->hpstate & HS_PRIV) { switch(VAR_3) { case 1: stb_hypv(VAR_0, VAR_1); break; case 2: stw_hypv(VAR_0, VAR_1); break; case 4: stl_hypv(VAR_0, VAR_1); break; case 8: default: stq_hypv(VAR_0, VAR_1); break; } } else { if (VAR_2 & 1) { switch(VAR_3) { case 1: stb_kernel_secondary(VAR_0, VAR_1); break; case 2: stw_kernel_secondary(VAR_0, VAR_1); break; case 4: stl_kernel_secondary(VAR_0, VAR_1); break; case 8: default: stq_kernel_secondary(VAR_0, VAR_1); break; } } else { switch(VAR_3) { case 1: stb_kernel(VAR_0, VAR_1); break; case 2: stw_kernel(VAR_0, VAR_1); break; case 4: stl_kernel(VAR_0, VAR_1); break; case 8: default: stq_kernel(VAR_0, VAR_1); break; } } } } else { if (VAR_2 & 1) { switch(VAR_3) { case 1: stb_user_secondary(VAR_0, VAR_1); break; case 2: stw_user_secondary(VAR_0, VAR_1); break; case 4: stl_user_secondary(VAR_0, VAR_1); break; case 8: default: stq_user_secondary(VAR_0, VAR_1); break; } } else { switch(VAR_3) { case 1: stb_user(VAR_0, VAR_1); break; case 2: stw_user(VAR_0, VAR_1); break; case 4: stl_user(VAR_0, VAR_1); break; case 8: default: stq_user(VAR_0, VAR_1); break; } } } break; case 0x14: case 0x15: , non-cacheable case 0x1c: case 0x1d: { switch(VAR_3) { case 1: stb_phys(VAR_0, VAR_1); break; case 2: stw_phys(VAR_0, VAR_1); break; case 4: stl_phys(VAR_0, VAR_1); break; case 8: default: stq_phys(VAR_0, VAR_1); break; } } return; case 0x24: case 0x2c: LE raise_exception(TT_ILL_INSN); return; case 0x04: case 0x0c: { switch(VAR_3) { case 1: stb_nucleus(VAR_0, VAR_1); break; case 2: stw_nucleus(VAR_0, VAR_1); break; case 4: stl_nucleus(VAR_0, VAR_1); break; default: case 8: stq_nucleus(VAR_0, VAR_1); break; } break; } case 0x4a: return; case 0x45: { uint64_t oldreg; oldreg = env->lsu; env->lsu = VAR_1 & (DMMU_E | IMMU_E); if (oldreg != env->lsu) { DPRINTF_MMU("LSU change: 0x%" PRIx64 " -> 0x%" PRIx64 "\n", oldreg, env->lsu); #ifdef DEBUG_MMU dump_mmu(env); #endif tlb_flush(env, 1); } return; } case 0x50: { int VAR_6 = (VAR_0 >> 3) & 0xf; uint64_t oldreg; oldreg = env->immuregs[VAR_6]; switch(VAR_6) { case 0: return; case 1: case 2: return; case 3: if ((VAR_1 & 1) == 0) VAR_1 = 0; env->immu.sfsr = VAR_1; break; case 4: return; case 5: DPRINTF_MMU("immu TSB write: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", env->immu.tsb, VAR_1); env->immu.tsb = VAR_1; break; case 6: env->immu.tag_access = VAR_1; break; case 7: case 8: return; default: break; } if (oldreg != env->immuregs[VAR_6]) { DPRINTF_MMU("immu change VAR_6[%d]: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", VAR_6, oldreg, env->immuregs[VAR_6]); } #ifdef DEBUG_MMU dump_mmu(env); #endif return; } case 0x54: replace_tlb_1bit_lru(env->itlb, env->immu.tag_access, VAR_1, "immu", env); return; case 0x55: { unsigned int VAR_6 = (VAR_0 >> 3) & 0x3f; replace_tlb_entry(&env->itlb[VAR_6], env->immu.tag_access, VAR_1, env); #ifdef DEBUG_MMU DPRINTF_MMU("immu data access replaced entry [%VAR_6]\n", VAR_6); dump_mmu(env); #endif return; } case 0x57: demap_tlb(env->itlb, VAR_0, "immu", env); return; case 0x58: { int VAR_6 = (VAR_0 >> 3) & 0xf; uint64_t oldreg; oldreg = env->dmmuregs[VAR_6]; switch(VAR_6) { case 0: case 4: return; case 3: if ((VAR_1 & 1) == 0) { VAR_1 = 0; , Fault address env->dmmu.sfar = 0; } env->dmmu.sfsr = VAR_1; break; case 1: context env->dmmu.mmu_primary_context = VAR_1; break; case 2: context env->dmmu.mmu_secondary_context = VAR_1; break; case 5: DPRINTF_MMU("dmmu TSB write: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", env->dmmu.tsb, VAR_1); env->dmmu.tsb = VAR_1; break; case 6: env->dmmu.tag_access = VAR_1; break; case 7: case 8: default: env->dmmuregs[VAR_6] = VAR_1; break; } if (oldreg != env->dmmuregs[VAR_6]) { DPRINTF_MMU("dmmu change VAR_6[%d]: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", VAR_6, oldreg, env->dmmuregs[VAR_6]); } #ifdef DEBUG_MMU dump_mmu(env); #endif return; } case 0x5c: replace_tlb_1bit_lru(env->dtlb, env->dmmu.tag_access, VAR_1, "dmmu", env); return; case 0x5d: { unsigned int VAR_6 = (VAR_0 >> 3) & 0x3f; replace_tlb_entry(&env->dtlb[VAR_6], env->dmmu.tag_access, VAR_1, env); #ifdef DEBUG_MMU DPRINTF_MMU("dmmu data access replaced entry [%VAR_6]\n", VAR_6); dump_mmu(env); #endif return; } case 0x5f: demap_tlb(env->dtlb, VAR_0, "dmmu", env); return; case 0x49: return; case 0x46: case 0x47: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x66: case 0x67: case 0x6e: case 0x6f: case 0x76: case 0x7e: return; case 0x51: case 0x52: case 0x56: case 0x59: case 0x5a: case 0x5b: case 0x5e: case 0x48: case 0x7f: case 0x82: no-fault, RO case 0x83: no-fault, RO case 0x8a: no-fault LE, RO case 0x8b: no-fault LE, RO default: do_unassigned_access(VAR_0, 1, 0, 1, VAR_3); return; } }
[ "void FUNC_0(target_ulong VAR_0, target_ulong VAR_1, int VAR_2, int VAR_3)\n{", "#ifdef DEBUG_ASI\ndump_asi(\"write\", VAR_0, VAR_2, VAR_3, VAR_1);", "#endif\nVAR_2 &= 0xff;", "if ((VAR_2 < 0x80 && (env->pstate & PS_PRIV) == 0)\n|| ((env->def->features & CPU_FEATURE_HYPV)\n&& VAR_2 >= 0x30 && VAR_2 < 0x80\n&& !(env->hpstate & HS_PRIV)))\nraise_exception(TT_PRIV_ACT);", "helper_check_align(VAR_0, VAR_3 - 1);", "switch (VAR_2) {", "case 0x0c:\ncase 0x18:\ncase 0x19:\ncase 0x1c:\ncase 0x1d:\ncase 0x88:\ncase 0x89:\nswitch(VAR_3) {", "case 2:\nVAR_1 = bswap16(VAR_1);", "break;", "case 4:\nVAR_1 = bswap32(VAR_1);", "break;", "case 8:\nVAR_1 = bswap64(VAR_1);", "break;", "default:\nbreak;", "}", "default:\nbreak;", "}", "switch(VAR_2) {", "case 0x10:\ncase 0x11:\ncase 0x18:\ncase 0x19:\ncase 0x80:\ncase 0x81:\ncase 0x88:\ncase 0x89:\ncase 0xe2:\ncase 0xe3:\nif ((VAR_2 & 0x80) && (env->pstate & PS_PRIV)) {", "if ((env->def->features & CPU_FEATURE_HYPV)\n&& env->hpstate & HS_PRIV) {", "switch(VAR_3) {", "case 1:\nstb_hypv(VAR_0, VAR_1);", "break;", "case 2:\nstw_hypv(VAR_0, VAR_1);", "break;", "case 4:\nstl_hypv(VAR_0, VAR_1);", "break;", "case 8:\ndefault:\nstq_hypv(VAR_0, VAR_1);", "break;", "}", "} else {", "if (VAR_2 & 1) {", "switch(VAR_3) {", "case 1:\nstb_kernel_secondary(VAR_0, VAR_1);", "break;", "case 2:\nstw_kernel_secondary(VAR_0, VAR_1);", "break;", "case 4:\nstl_kernel_secondary(VAR_0, VAR_1);", "break;", "case 8:\ndefault:\nstq_kernel_secondary(VAR_0, VAR_1);", "break;", "}", "} else {", "switch(VAR_3) {", "case 1:\nstb_kernel(VAR_0, VAR_1);", "break;", "case 2:\nstw_kernel(VAR_0, VAR_1);", "break;", "case 4:\nstl_kernel(VAR_0, VAR_1);", "break;", "case 8:\ndefault:\nstq_kernel(VAR_0, VAR_1);", "break;", "}", "}", "}", "} else {", "if (VAR_2 & 1) {", "switch(VAR_3) {", "case 1:\nstb_user_secondary(VAR_0, VAR_1);", "break;", "case 2:\nstw_user_secondary(VAR_0, VAR_1);", "break;", "case 4:\nstl_user_secondary(VAR_0, VAR_1);", "break;", "case 8:\ndefault:\nstq_user_secondary(VAR_0, VAR_1);", "break;", "}", "} else {", "switch(VAR_3) {", "case 1:\nstb_user(VAR_0, VAR_1);", "break;", "case 2:\nstw_user(VAR_0, VAR_1);", "break;", "case 4:\nstl_user(VAR_0, VAR_1);", "break;", "case 8:\ndefault:\nstq_user(VAR_0, VAR_1);", "break;", "}", "}", "}", "break;", "case 0x14:\ncase 0x15: , non-cacheable\ncase 0x1c:\ncase 0x1d:\n{", "switch(VAR_3) {", "case 1:\nstb_phys(VAR_0, VAR_1);", "break;", "case 2:\nstw_phys(VAR_0, VAR_1);", "break;", "case 4:\nstl_phys(VAR_0, VAR_1);", "break;", "case 8:\ndefault:\nstq_phys(VAR_0, VAR_1);", "break;", "}", "}", "return;", "case 0x24:\ncase 0x2c: LE\nraise_exception(TT_ILL_INSN);", "return;", "case 0x04:\ncase 0x0c:\n{", "switch(VAR_3) {", "case 1:\nstb_nucleus(VAR_0, VAR_1);", "break;", "case 2:\nstw_nucleus(VAR_0, VAR_1);", "break;", "case 4:\nstl_nucleus(VAR_0, VAR_1);", "break;", "default:\ncase 8:\nstq_nucleus(VAR_0, VAR_1);", "break;", "}", "break;", "}", "case 0x4a:\nreturn;", "case 0x45:\n{", "uint64_t oldreg;", "oldreg = env->lsu;", "env->lsu = VAR_1 & (DMMU_E | IMMU_E);", "if (oldreg != env->lsu) {", "DPRINTF_MMU(\"LSU change: 0x%\" PRIx64 \" -> 0x%\" PRIx64 \"\\n\",\noldreg, env->lsu);", "#ifdef DEBUG_MMU\ndump_mmu(env);", "#endif\ntlb_flush(env, 1);", "}", "return;", "}", "case 0x50:\n{", "int VAR_6 = (VAR_0 >> 3) & 0xf;", "uint64_t oldreg;", "oldreg = env->immuregs[VAR_6];", "switch(VAR_6) {", "case 0:\nreturn;", "case 1:\ncase 2:\nreturn;", "case 3:\nif ((VAR_1 & 1) == 0)\nVAR_1 = 0;", "env->immu.sfsr = VAR_1;", "break;", "case 4:\nreturn;", "case 5:\nDPRINTF_MMU(\"immu TSB write: 0x%016\" PRIx64 \" -> 0x%016\"\nPRIx64 \"\\n\", env->immu.tsb, VAR_1);", "env->immu.tsb = VAR_1;", "break;", "case 6:\nenv->immu.tag_access = VAR_1;", "break;", "case 7:\ncase 8:\nreturn;", "default:\nbreak;", "}", "if (oldreg != env->immuregs[VAR_6]) {", "DPRINTF_MMU(\"immu change VAR_6[%d]: 0x%016\" PRIx64 \" -> 0x%016\"\nPRIx64 \"\\n\", VAR_6, oldreg, env->immuregs[VAR_6]);", "}", "#ifdef DEBUG_MMU\ndump_mmu(env);", "#endif\nreturn;", "}", "case 0x54:\nreplace_tlb_1bit_lru(env->itlb, env->immu.tag_access, VAR_1, \"immu\", env);", "return;", "case 0x55:\n{", "unsigned int VAR_6 = (VAR_0 >> 3) & 0x3f;", "replace_tlb_entry(&env->itlb[VAR_6], env->immu.tag_access, VAR_1, env);", "#ifdef DEBUG_MMU\nDPRINTF_MMU(\"immu data access replaced entry [%VAR_6]\\n\", VAR_6);", "dump_mmu(env);", "#endif\nreturn;", "}", "case 0x57:\ndemap_tlb(env->itlb, VAR_0, \"immu\", env);", "return;", "case 0x58:\n{", "int VAR_6 = (VAR_0 >> 3) & 0xf;", "uint64_t oldreg;", "oldreg = env->dmmuregs[VAR_6];", "switch(VAR_6) {", "case 0:\ncase 4:\nreturn;", "case 3:\nif ((VAR_1 & 1) == 0) {", "VAR_1 = 0; , Fault address", "env->dmmu.sfar = 0;", "}", "env->dmmu.sfsr = VAR_1;", "break;", "case 1: context\nenv->dmmu.mmu_primary_context = VAR_1;", "break;", "case 2: context\nenv->dmmu.mmu_secondary_context = VAR_1;", "break;", "case 5:\nDPRINTF_MMU(\"dmmu TSB write: 0x%016\" PRIx64 \" -> 0x%016\"\nPRIx64 \"\\n\", env->dmmu.tsb, VAR_1);", "env->dmmu.tsb = VAR_1;", "break;", "case 6:\nenv->dmmu.tag_access = VAR_1;", "break;", "case 7:\ncase 8:\ndefault:\nenv->dmmuregs[VAR_6] = VAR_1;", "break;", "}", "if (oldreg != env->dmmuregs[VAR_6]) {", "DPRINTF_MMU(\"dmmu change VAR_6[%d]: 0x%016\" PRIx64 \" -> 0x%016\"\nPRIx64 \"\\n\", VAR_6, oldreg, env->dmmuregs[VAR_6]);", "}", "#ifdef DEBUG_MMU\ndump_mmu(env);", "#endif\nreturn;", "}", "case 0x5c:\nreplace_tlb_1bit_lru(env->dtlb, env->dmmu.tag_access, VAR_1, \"dmmu\", env);", "return;", "case 0x5d:\n{", "unsigned int VAR_6 = (VAR_0 >> 3) & 0x3f;", "replace_tlb_entry(&env->dtlb[VAR_6], env->dmmu.tag_access, VAR_1, env);", "#ifdef DEBUG_MMU\nDPRINTF_MMU(\"dmmu data access replaced entry [%VAR_6]\\n\", VAR_6);", "dump_mmu(env);", "#endif\nreturn;", "}", "case 0x5f:\ndemap_tlb(env->dtlb, VAR_0, \"dmmu\", env);", "return;", "case 0x49:\nreturn;", "case 0x46:\ncase 0x47:\ncase 0x4b:\ncase 0x4c:\ncase 0x4d:\ncase 0x4e:\ncase 0x66:\ncase 0x67:\ncase 0x6e:\ncase 0x6f:\ncase 0x76:\ncase 0x7e:\nreturn;", "case 0x51:\ncase 0x52:\ncase 0x56:\ncase 0x59:\ncase 0x5a:\ncase 0x5b:\ncase 0x5e:\ncase 0x48:\ncase 0x7f:\ncase 0x82: no-fault, RO\ncase 0x83: no-fault, RO\ncase 0x8a: no-fault LE, RO\ncase 0x8b: no-fault LE, RO\ndefault:\ndo_unassigned_access(VAR_0, 1, 0, 1, VAR_3);", "return;", "}", "}" ]
[ 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 13 ], [ 17, 19, 21, 23, 25 ], [ 29 ], [ 33 ], [ 35, 37, 39, 41, 43, 45, 47, 49 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 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 ], [ 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 ], [ 217 ], [ 219 ], [ 221, 223 ], [ 225 ], [ 227, 229 ], [ 231 ], [ 233, 235 ], [ 237 ], [ 239, 241, 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259, 261 ], [ 263 ], [ 265, 267 ], [ 269 ], [ 271, 273, 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287, 289, 291, 293, 295 ], [ 297 ], [ 299, 301 ], [ 303 ], [ 305, 307 ], [ 309 ], [ 311, 313 ], [ 315 ], [ 317, 319, 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331, 333, 337 ], [ 339 ], [ 341, 343, 345 ], [ 347 ], [ 349, 351 ], [ 353 ], [ 355, 357 ], [ 359 ], [ 361, 363 ], [ 365 ], [ 367, 369, 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 383, 387 ], [ 389, 391 ], [ 393 ], [ 397 ], [ 399 ], [ 405 ], [ 407, 409 ], [ 411, 413 ], [ 415, 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425, 427 ], [ 429 ], [ 431 ], [ 435 ], [ 437 ], [ 439, 441 ], [ 443, 445, 447 ], [ 449, 451, 453 ], [ 455 ], [ 457 ], [ 459, 461 ], [ 463, 465, 467 ], [ 469 ], [ 471 ], [ 473, 475 ], [ 477 ], [ 479, 481, 483 ], [ 485, 487 ], [ 489 ], [ 493 ], [ 495, 497 ], [ 499 ], [ 501, 503 ], [ 505, 507 ], [ 509 ], [ 511, 513 ], [ 515 ], [ 517, 519 ], [ 525 ], [ 529 ], [ 533, 535 ], [ 537 ], [ 539, 541 ], [ 543 ], [ 545, 547 ], [ 549 ], [ 551, 553 ], [ 555 ], [ 557 ], [ 561 ], [ 563 ], [ 565, 567, 569 ], [ 571, 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585, 587 ], [ 589 ], [ 591, 593 ], [ 595 ], [ 597, 599, 601 ], [ 603 ], [ 605 ], [ 607, 609 ], [ 611 ], [ 613, 615, 617, 619 ], [ 621 ], [ 623 ], [ 627 ], [ 629, 631 ], [ 633 ], [ 635, 637 ], [ 639, 641 ], [ 643 ], [ 645, 647 ], [ 649 ], [ 651, 653 ], [ 655 ], [ 659 ], [ 663, 665 ], [ 667 ], [ 669, 671 ], [ 673 ], [ 675, 677 ], [ 679 ], [ 681, 685 ], [ 687, 689, 691, 693, 695, 697, 699, 701, 703, 705, 707, 709, 711 ], [ 713, 715, 717, 719, 721, 723, 725, 727, 729, 731, 733, 735, 737, 739, 741 ], [ 743 ], [ 745 ], [ 747 ] ]
13,333
static int xan_decode_frame_type0(AVCodecContext *avctx, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; XanContext *s = avctx->priv_data; uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer; unsigned chroma_off, corr_off; int cur, last, size; int i, j; int ret; corr_off = AV_RL32(buf + 8); chroma_off = AV_RL32(buf + 4); if ((ret = xan_decode_chroma(avctx, avpkt)) != 0) return ret; size = avpkt->size - 4; if (corr_off >= avpkt->size) { av_log(avctx, AV_LOG_WARNING, "Ignoring invalid correction block position\n"); corr_off = 0; } if (corr_off) size = corr_off; if (chroma_off) size = FFMIN(size, chroma_off); ret = xan_unpack_luma(buf + 12, size, src, s->buffer_size >> 1); if (ret) { av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n"); return ret; } ybuf = s->y_buffer; last = *src++; ybuf[0] = last << 1; for (j = 1; j < avctx->width - 1; j += 2) { cur = (last + *src++) & 0x1F; ybuf[j] = last + cur; ybuf[j+1] = cur << 1; last = cur; } ybuf[j] = last << 1; prev_buf = ybuf; ybuf += avctx->width; for (i = 1; i < avctx->height; i++) { last = ((prev_buf[0] >> 1) + *src++) & 0x1F; ybuf[0] = last << 1; for (j = 1; j < avctx->width - 1; j += 2) { cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F; ybuf[j] = last + cur; ybuf[j+1] = cur << 1; last = cur; } ybuf[j] = last << 1; prev_buf = ybuf; ybuf += avctx->width; } if (corr_off) { int corr_end, dec_size; corr_end = avpkt->size; if (chroma_off > corr_off) corr_end = chroma_off; dec_size = xan_unpack(s->scratch_buffer, s->buffer_size, avpkt->data + 8 + corr_off, corr_end - corr_off); if (dec_size < 0) dec_size = 0; for (i = 0; i < dec_size; i++) s->y_buffer[i*2+1] = (s->y_buffer[i*2+1] + (s->scratch_buffer[i] << 1)) & 0x3F; } src = s->y_buffer; ybuf = s->pic.data[0]; for (j = 0; j < avctx->height; j++) { for (i = 0; i < avctx->width; i++) ybuf[i] = (src[i] << 2) | (src[i] >> 3); src += avctx->width; ybuf += s->pic.linesize[0]; } return 0; }
true
FFmpeg
55188278169c3a1838334d7aa47a1f7a40741690
static int xan_decode_frame_type0(AVCodecContext *avctx, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; XanContext *s = avctx->priv_data; uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer; unsigned chroma_off, corr_off; int cur, last, size; int i, j; int ret; corr_off = AV_RL32(buf + 8); chroma_off = AV_RL32(buf + 4); if ((ret = xan_decode_chroma(avctx, avpkt)) != 0) return ret; size = avpkt->size - 4; if (corr_off >= avpkt->size) { av_log(avctx, AV_LOG_WARNING, "Ignoring invalid correction block position\n"); corr_off = 0; } if (corr_off) size = corr_off; if (chroma_off) size = FFMIN(size, chroma_off); ret = xan_unpack_luma(buf + 12, size, src, s->buffer_size >> 1); if (ret) { av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n"); return ret; } ybuf = s->y_buffer; last = *src++; ybuf[0] = last << 1; for (j = 1; j < avctx->width - 1; j += 2) { cur = (last + *src++) & 0x1F; ybuf[j] = last + cur; ybuf[j+1] = cur << 1; last = cur; } ybuf[j] = last << 1; prev_buf = ybuf; ybuf += avctx->width; for (i = 1; i < avctx->height; i++) { last = ((prev_buf[0] >> 1) + *src++) & 0x1F; ybuf[0] = last << 1; for (j = 1; j < avctx->width - 1; j += 2) { cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F; ybuf[j] = last + cur; ybuf[j+1] = cur << 1; last = cur; } ybuf[j] = last << 1; prev_buf = ybuf; ybuf += avctx->width; } if (corr_off) { int corr_end, dec_size; corr_end = avpkt->size; if (chroma_off > corr_off) corr_end = chroma_off; dec_size = xan_unpack(s->scratch_buffer, s->buffer_size, avpkt->data + 8 + corr_off, corr_end - corr_off); if (dec_size < 0) dec_size = 0; for (i = 0; i < dec_size; i++) s->y_buffer[i*2+1] = (s->y_buffer[i*2+1] + (s->scratch_buffer[i] << 1)) & 0x3F; } src = s->y_buffer; ybuf = s->pic.data[0]; for (j = 0; j < avctx->height; j++) { for (i = 0; i < avctx->width; i++) ybuf[i] = (src[i] << 2) | (src[i] >> 3); src += avctx->width; ybuf += s->pic.linesize[0]; } return 0; }
{ "code": [ " const uint8_t *buf = avpkt->data;", " chroma_off = AV_RL32(buf + 4);", "static int xan_decode_frame_type0(AVCodecContext *avctx, AVPacket *avpkt)", " const uint8_t *buf = avpkt->data;", " int cur, last, size;", " corr_off = AV_RL32(buf + 8);", " chroma_off = AV_RL32(buf + 4);", " if ((ret = xan_decode_chroma(avctx, avpkt)) != 0)", " size = avpkt->size - 4;", " if (corr_off >= avpkt->size) {", " if (corr_off)", " size = corr_off;", " if (chroma_off)", " size = FFMIN(size, chroma_off);", " ret = xan_unpack_luma(buf + 12, size, src, s->buffer_size >> 1);", " corr_end = avpkt->size;", " dec_size = xan_unpack(s->scratch_buffer, s->buffer_size,", " avpkt->data + 8 + corr_off,", " corr_end - corr_off);", " const uint8_t *buf = avpkt->data;", " if ((ret = xan_decode_chroma(avctx, avpkt)) != 0)" ], "line_no": [ 5, 23, 1, 5, 13, 21, 23, 27, 33, 35, 43, 45, 47, 49, 51, 123, 129, 131, 133, 5, 27 ] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1) { const uint8_t *VAR_2 = VAR_1->data; XanContext *s = VAR_0->priv_data; uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer; unsigned VAR_3, VAR_4; int VAR_5, VAR_6, VAR_7; int VAR_8, VAR_9; int VAR_10; VAR_4 = AV_RL32(VAR_2 + 8); VAR_3 = AV_RL32(VAR_2 + 4); if ((VAR_10 = xan_decode_chroma(VAR_0, VAR_1)) != 0) return VAR_10; VAR_7 = VAR_1->VAR_7 - 4; if (VAR_4 >= VAR_1->VAR_7) { av_log(VAR_0, AV_LOG_WARNING, "Ignoring invalid correction block position\n"); VAR_4 = 0; } if (VAR_4) VAR_7 = VAR_4; if (VAR_3) VAR_7 = FFMIN(VAR_7, VAR_3); VAR_10 = xan_unpack_luma(VAR_2 + 12, VAR_7, src, s->buffer_size >> 1); if (VAR_10) { av_log(VAR_0, AV_LOG_ERROR, "Luma decoding failed\n"); return VAR_10; } ybuf = s->y_buffer; VAR_6 = *src++; ybuf[0] = VAR_6 << 1; for (VAR_9 = 1; VAR_9 < VAR_0->width - 1; VAR_9 += 2) { VAR_5 = (VAR_6 + *src++) & 0x1F; ybuf[VAR_9] = VAR_6 + VAR_5; ybuf[VAR_9+1] = VAR_5 << 1; VAR_6 = VAR_5; } ybuf[VAR_9] = VAR_6 << 1; prev_buf = ybuf; ybuf += VAR_0->width; for (VAR_8 = 1; VAR_8 < VAR_0->height; VAR_8++) { VAR_6 = ((prev_buf[0] >> 1) + *src++) & 0x1F; ybuf[0] = VAR_6 << 1; for (VAR_9 = 1; VAR_9 < VAR_0->width - 1; VAR_9 += 2) { VAR_5 = ((prev_buf[VAR_9 + 1] >> 1) + *src++) & 0x1F; ybuf[VAR_9] = VAR_6 + VAR_5; ybuf[VAR_9+1] = VAR_5 << 1; VAR_6 = VAR_5; } ybuf[VAR_9] = VAR_6 << 1; prev_buf = ybuf; ybuf += VAR_0->width; } if (VAR_4) { int VAR_11, VAR_12; VAR_11 = VAR_1->VAR_7; if (VAR_3 > VAR_4) VAR_11 = VAR_3; VAR_12 = xan_unpack(s->scratch_buffer, s->buffer_size, VAR_1->data + 8 + VAR_4, VAR_11 - VAR_4); if (VAR_12 < 0) VAR_12 = 0; for (VAR_8 = 0; VAR_8 < VAR_12; VAR_8++) s->y_buffer[VAR_8*2+1] = (s->y_buffer[VAR_8*2+1] + (s->scratch_buffer[VAR_8] << 1)) & 0x3F; } src = s->y_buffer; ybuf = s->pic.data[0]; for (VAR_9 = 0; VAR_9 < VAR_0->height; VAR_9++) { for (VAR_8 = 0; VAR_8 < VAR_0->width; VAR_8++) ybuf[VAR_8] = (src[VAR_8] << 2) | (src[VAR_8] >> 3); src += VAR_0->width; ybuf += s->pic.linesize[0]; } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1)\n{", "const uint8_t *VAR_2 = VAR_1->data;", "XanContext *s = VAR_0->priv_data;", "uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer;", "unsigned VAR_3, VAR_4;", "int VAR_5, VAR_6, VAR_7;", "int VAR_8, VAR_9;", "int VAR_10;", "VAR_4 = AV_RL32(VAR_2 + 8);", "VAR_3 = AV_RL32(VAR_2 + 4);", "if ((VAR_10 = xan_decode_chroma(VAR_0, VAR_1)) != 0)\nreturn VAR_10;", "VAR_7 = VAR_1->VAR_7 - 4;", "if (VAR_4 >= VAR_1->VAR_7) {", "av_log(VAR_0, AV_LOG_WARNING, \"Ignoring invalid correction block position\\n\");", "VAR_4 = 0;", "}", "if (VAR_4)\nVAR_7 = VAR_4;", "if (VAR_3)\nVAR_7 = FFMIN(VAR_7, VAR_3);", "VAR_10 = xan_unpack_luma(VAR_2 + 12, VAR_7, src, s->buffer_size >> 1);", "if (VAR_10) {", "av_log(VAR_0, AV_LOG_ERROR, \"Luma decoding failed\\n\");", "return VAR_10;", "}", "ybuf = s->y_buffer;", "VAR_6 = *src++;", "ybuf[0] = VAR_6 << 1;", "for (VAR_9 = 1; VAR_9 < VAR_0->width - 1; VAR_9 += 2) {", "VAR_5 = (VAR_6 + *src++) & 0x1F;", "ybuf[VAR_9] = VAR_6 + VAR_5;", "ybuf[VAR_9+1] = VAR_5 << 1;", "VAR_6 = VAR_5;", "}", "ybuf[VAR_9] = VAR_6 << 1;", "prev_buf = ybuf;", "ybuf += VAR_0->width;", "for (VAR_8 = 1; VAR_8 < VAR_0->height; VAR_8++) {", "VAR_6 = ((prev_buf[0] >> 1) + *src++) & 0x1F;", "ybuf[0] = VAR_6 << 1;", "for (VAR_9 = 1; VAR_9 < VAR_0->width - 1; VAR_9 += 2) {", "VAR_5 = ((prev_buf[VAR_9 + 1] >> 1) + *src++) & 0x1F;", "ybuf[VAR_9] = VAR_6 + VAR_5;", "ybuf[VAR_9+1] = VAR_5 << 1;", "VAR_6 = VAR_5;", "}", "ybuf[VAR_9] = VAR_6 << 1;", "prev_buf = ybuf;", "ybuf += VAR_0->width;", "}", "if (VAR_4) {", "int VAR_11, VAR_12;", "VAR_11 = VAR_1->VAR_7;", "if (VAR_3 > VAR_4)\nVAR_11 = VAR_3;", "VAR_12 = xan_unpack(s->scratch_buffer, s->buffer_size,\nVAR_1->data + 8 + VAR_4,\nVAR_11 - VAR_4);", "if (VAR_12 < 0)\nVAR_12 = 0;", "for (VAR_8 = 0; VAR_8 < VAR_12; VAR_8++)", "s->y_buffer[VAR_8*2+1] = (s->y_buffer[VAR_8*2+1] + (s->scratch_buffer[VAR_8] << 1)) & 0x3F;", "}", "src = s->y_buffer;", "ybuf = s->pic.data[0];", "for (VAR_9 = 0; VAR_9 < VAR_0->height; VAR_9++) {", "for (VAR_8 = 0; VAR_8 < VAR_0->width; VAR_8++)", "ybuf[VAR_8] = (src[VAR_8] << 2) | (src[VAR_8] >> 3);", "src += VAR_0->width;", "ybuf += s->pic.linesize[0];", "}", "return 0;", "}" ]
[ 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 123 ], [ 125, 127 ], [ 129, 131, 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ] ]
13,335
static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { DeviceState *dev = DEVICE(obj); Error *local_err = NULL; Property *prop = opaque; CharBackend *be = qdev_get_prop_ptr(dev, prop); CharDriverState *s; char *str; if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); return; } visit_type_str(v, name, &str, &local_err); if (local_err) { error_propagate(errp, local_err); return; } if (!*str) { g_free(str); be->chr = NULL; return; } s = qemu_chr_find(str); g_free(str); if (s == NULL) { error_setg(errp, "Property '%s.%s' can't find value '%s'", object_get_typename(obj), prop->name, str); return; } if (!qemu_chr_fe_init(be, s, errp)) { error_prepend(errp, "Property '%s.%s' can't take value '%s': ", object_get_typename(obj), prop->name, str); return; } }
true
qemu
2209401fa73e176ed093167b8f60aba797f25d49
static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { DeviceState *dev = DEVICE(obj); Error *local_err = NULL; Property *prop = opaque; CharBackend *be = qdev_get_prop_ptr(dev, prop); CharDriverState *s; char *str; if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); return; } visit_type_str(v, name, &str, &local_err); if (local_err) { error_propagate(errp, local_err); return; } if (!*str) { g_free(str); be->chr = NULL; return; } s = qemu_chr_find(str); g_free(str); if (s == NULL) { error_setg(errp, "Property '%s.%s' can't find value '%s'", object_get_typename(obj), prop->name, str); return; } if (!qemu_chr_fe_init(be, s, errp)) { error_prepend(errp, "Property '%s.%s' can't take value '%s': ", object_get_typename(obj), prop->name, str); return; } }
{ "code": [ " g_free(str);", " if (!qemu_chr_fe_init(be, s, errp)) {" ], "line_no": [ 57, 71 ] }
static void FUNC_0(Object *VAR_0, Visitor *VAR_1, const char *VAR_2, void *VAR_3, Error **VAR_4) { DeviceState *dev = DEVICE(VAR_0); Error *local_err = NULL; Property *prop = VAR_3; CharBackend *be = qdev_get_prop_ptr(dev, prop); CharDriverState *s; char *VAR_5; if (dev->realized) { qdev_prop_set_after_realize(dev, VAR_2, VAR_4); return; } visit_type_str(VAR_1, VAR_2, &VAR_5, &local_err); if (local_err) { error_propagate(VAR_4, local_err); return; } if (!*VAR_5) { g_free(VAR_5); be->chr = NULL; return; } s = qemu_chr_find(VAR_5); g_free(VAR_5); if (s == NULL) { error_setg(VAR_4, "Property '%s.%s' can't find value '%s'", object_get_typename(VAR_0), prop->VAR_2, VAR_5); return; } if (!qemu_chr_fe_init(be, s, VAR_4)) { error_prepend(VAR_4, "Property '%s.%s' can't take value '%s': ", object_get_typename(VAR_0), prop->VAR_2, VAR_5); return; } }
[ "static void FUNC_0(Object *VAR_0, Visitor *VAR_1, const char *VAR_2, void *VAR_3,\nError **VAR_4)\n{", "DeviceState *dev = DEVICE(VAR_0);", "Error *local_err = NULL;", "Property *prop = VAR_3;", "CharBackend *be = qdev_get_prop_ptr(dev, prop);", "CharDriverState *s;", "char *VAR_5;", "if (dev->realized) {", "qdev_prop_set_after_realize(dev, VAR_2, VAR_4);", "return;", "}", "visit_type_str(VAR_1, VAR_2, &VAR_5, &local_err);", "if (local_err) {", "error_propagate(VAR_4, local_err);", "return;", "}", "if (!*VAR_5) {", "g_free(VAR_5);", "be->chr = NULL;", "return;", "}", "s = qemu_chr_find(VAR_5);", "g_free(VAR_5);", "if (s == NULL) {", "error_setg(VAR_4, \"Property '%s.%s' can't find value '%s'\",\nobject_get_typename(VAR_0), prop->VAR_2, VAR_5);", "return;", "}", "if (!qemu_chr_fe_init(be, s, VAR_4)) {", "error_prepend(VAR_4, \"Property '%s.%s' can't take value '%s': \",\nobject_get_typename(VAR_0), prop->VAR_2, VAR_5);", "return;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ] ]