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
10,577
static int xan_decode_frame_type1(AVCodecContext *avctx) { XanContext *s = avctx->priv_data; uint8_t *ybuf, *src = s->scratch_buffer; int cur, last; int i, j; int ret; if ((ret = xan_decode_chroma(avctx, bytestream2_get_le32(&s->gb))) != 0) return ret; bytestream2_seek(&s->gb, 16, SEEK_SET); ret = xan_unpack_luma(s, src, s->buffer_size >> 1); if (ret) { av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n"); return ret; } ybuf = s->y_buffer; for (i = 0; i < avctx->height; i++) { last = (ybuf[0] + (*src++ << 1)) & 0x3F; ybuf[0] = last; for (j = 1; j < avctx->width - 1; j += 2) { cur = (ybuf[j + 1] + (*src++ << 1)) & 0x3F; ybuf[j] = (last + cur) >> 1; ybuf[j+1] = cur; last = cur; } ybuf[j] = last; ybuf += avctx->width; } 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; }
false
FFmpeg
77693c541a541661357a0edd5bbaae69c64b2039
static int xan_decode_frame_type1(AVCodecContext *avctx) { XanContext *s = avctx->priv_data; uint8_t *ybuf, *src = s->scratch_buffer; int cur, last; int i, j; int ret; if ((ret = xan_decode_chroma(avctx, bytestream2_get_le32(&s->gb))) != 0) return ret; bytestream2_seek(&s->gb, 16, SEEK_SET); ret = xan_unpack_luma(s, src, s->buffer_size >> 1); if (ret) { av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n"); return ret; } ybuf = s->y_buffer; for (i = 0; i < avctx->height; i++) { last = (ybuf[0] + (*src++ << 1)) & 0x3F; ybuf[0] = last; for (j = 1; j < avctx->width - 1; j += 2) { cur = (ybuf[j + 1] + (*src++ << 1)) & 0x3F; ybuf[j] = (last + cur) >> 1; ybuf[j+1] = cur; last = cur; } ybuf[j] = last; ybuf += avctx->width; } 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": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0) { XanContext *s = VAR_0->priv_data; uint8_t *ybuf, *src = s->scratch_buffer; int VAR_1, VAR_2; int VAR_3, VAR_4; int VAR_5; if ((VAR_5 = xan_decode_chroma(VAR_0, bytestream2_get_le32(&s->gb))) != 0) return VAR_5; bytestream2_seek(&s->gb, 16, SEEK_SET); VAR_5 = xan_unpack_luma(s, src, s->buffer_size >> 1); if (VAR_5) { av_log(VAR_0, AV_LOG_ERROR, "Luma decoding failed\n"); return VAR_5; } ybuf = s->y_buffer; for (VAR_3 = 0; VAR_3 < VAR_0->height; VAR_3++) { VAR_2 = (ybuf[0] + (*src++ << 1)) & 0x3F; ybuf[0] = VAR_2; for (VAR_4 = 1; VAR_4 < VAR_0->width - 1; VAR_4 += 2) { VAR_1 = (ybuf[VAR_4 + 1] + (*src++ << 1)) & 0x3F; ybuf[VAR_4] = (VAR_2 + VAR_1) >> 1; ybuf[VAR_4+1] = VAR_1; VAR_2 = VAR_1; } ybuf[VAR_4] = VAR_2; ybuf += VAR_0->width; } src = s->y_buffer; ybuf = s->pic.data[0]; for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) { for (VAR_3 = 0; VAR_3 < VAR_0->width; VAR_3++) ybuf[VAR_3] = (src[VAR_3] << 2) | (src[VAR_3] >> 3); src += VAR_0->width; ybuf += s->pic.linesize[0]; } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "XanContext *s = VAR_0->priv_data;", "uint8_t *ybuf, *src = s->scratch_buffer;", "int VAR_1, VAR_2;", "int VAR_3, VAR_4;", "int VAR_5;", "if ((VAR_5 = xan_decode_chroma(VAR_0, bytestream2_get_le32(&s->gb))) != 0)\nreturn VAR_5;", "bytestream2_seek(&s->gb, 16, SEEK_SET);", "VAR_5 = xan_unpack_luma(s, src,\ns->buffer_size >> 1);", "if (VAR_5) {", "av_log(VAR_0, AV_LOG_ERROR, \"Luma decoding failed\\n\");", "return VAR_5;", "}", "ybuf = s->y_buffer;", "for (VAR_3 = 0; VAR_3 < VAR_0->height; VAR_3++) {", "VAR_2 = (ybuf[0] + (*src++ << 1)) & 0x3F;", "ybuf[0] = VAR_2;", "for (VAR_4 = 1; VAR_4 < VAR_0->width - 1; VAR_4 += 2) {", "VAR_1 = (ybuf[VAR_4 + 1] + (*src++ << 1)) & 0x3F;", "ybuf[VAR_4] = (VAR_2 + VAR_1) >> 1;", "ybuf[VAR_4+1] = VAR_1;", "VAR_2 = VAR_1;", "}", "ybuf[VAR_4] = VAR_2;", "ybuf += VAR_0->width;", "}", "src = s->y_buffer;", "ybuf = s->pic.data[0];", "for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) {", "for (VAR_3 = 0; VAR_3 < VAR_0->width; VAR_3++)", "ybuf[VAR_3] = (src[VAR_3] << 2) | (src[VAR_3] >> 3);", "src += VAR_0->width;", "ybuf += s->pic.linesize[0];", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 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 ], [ 85 ], [ 87 ] ]
10,578
static void vtd_context_device_invalidate(IntelIOMMUState *s, uint16_t source_id, uint16_t func_mask) { uint16_t mask; VTDAddressSpace **pvtd_as; VTDAddressSpace *vtd_as; uint16_t devfn; uint16_t devfn_it; switch (func_mask & 3) { case 0: mask = 0; /* No bits in the SID field masked */ break; case 1: mask = 4; /* Mask bit 2 in the SID field */ break; case 2: mask = 6; /* Mask bit 2:1 in the SID field */ break; case 3: mask = 7; /* Mask bit 2:0 in the SID field */ break; } VTD_DPRINTF(INV, "device-selective invalidation source 0x%"PRIx16 " mask %"PRIu16, source_id, mask); pvtd_as = s->address_spaces[VTD_SID_TO_BUS(source_id)]; if (pvtd_as) { devfn = VTD_SID_TO_DEVFN(source_id); for (devfn_it = 0; devfn_it < VTD_PCI_DEVFN_MAX; ++devfn_it) { vtd_as = pvtd_as[devfn_it]; if (vtd_as && ((devfn_it & mask) == (devfn & mask))) { VTD_DPRINTF(INV, "invalidate context-cahce of devfn 0x%"PRIx16, devfn_it); vtd_as->context_cache_entry.context_cache_gen = 0; } } } }
false
qemu
7df953bd456da45f761064974820ab5c3fd7b2aa
static void vtd_context_device_invalidate(IntelIOMMUState *s, uint16_t source_id, uint16_t func_mask) { uint16_t mask; VTDAddressSpace **pvtd_as; VTDAddressSpace *vtd_as; uint16_t devfn; uint16_t devfn_it; switch (func_mask & 3) { case 0: mask = 0; break; case 1: mask = 4; break; case 2: mask = 6; break; case 3: mask = 7; break; } VTD_DPRINTF(INV, "device-selective invalidation source 0x%"PRIx16 " mask %"PRIu16, source_id, mask); pvtd_as = s->address_spaces[VTD_SID_TO_BUS(source_id)]; if (pvtd_as) { devfn = VTD_SID_TO_DEVFN(source_id); for (devfn_it = 0; devfn_it < VTD_PCI_DEVFN_MAX; ++devfn_it) { vtd_as = pvtd_as[devfn_it]; if (vtd_as && ((devfn_it & mask) == (devfn & mask))) { VTD_DPRINTF(INV, "invalidate context-cahce of devfn 0x%"PRIx16, devfn_it); vtd_as->context_cache_entry.context_cache_gen = 0; } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(IntelIOMMUState *VAR_0, uint16_t VAR_1, uint16_t VAR_2) { uint16_t mask; VTDAddressSpace **pvtd_as; VTDAddressSpace *vtd_as; uint16_t devfn; uint16_t devfn_it; switch (VAR_2 & 3) { case 0: mask = 0; break; case 1: mask = 4; break; case 2: mask = 6; break; case 3: mask = 7; break; } VTD_DPRINTF(INV, "device-selective invalidation source 0x%"PRIx16 " mask %"PRIu16, VAR_1, mask); pvtd_as = VAR_0->address_spaces[VTD_SID_TO_BUS(VAR_1)]; if (pvtd_as) { devfn = VTD_SID_TO_DEVFN(VAR_1); for (devfn_it = 0; devfn_it < VTD_PCI_DEVFN_MAX; ++devfn_it) { vtd_as = pvtd_as[devfn_it]; if (vtd_as && ((devfn_it & mask) == (devfn & mask))) { VTD_DPRINTF(INV, "invalidate context-cahce of devfn 0x%"PRIx16, devfn_it); vtd_as->context_cache_entry.context_cache_gen = 0; } } } }
[ "static void FUNC_0(IntelIOMMUState *VAR_0,\nuint16_t VAR_1,\nuint16_t VAR_2)\n{", "uint16_t mask;", "VTDAddressSpace **pvtd_as;", "VTDAddressSpace *vtd_as;", "uint16_t devfn;", "uint16_t devfn_it;", "switch (VAR_2 & 3) {", "case 0:\nmask = 0;", "break;", "case 1:\nmask = 4;", "break;", "case 2:\nmask = 6;", "break;", "case 3:\nmask = 7;", "break;", "}", "VTD_DPRINTF(INV, \"device-selective invalidation source 0x%\"PRIx16\n\" mask %\"PRIu16, VAR_1, mask);", "pvtd_as = VAR_0->address_spaces[VTD_SID_TO_BUS(VAR_1)];", "if (pvtd_as) {", "devfn = VTD_SID_TO_DEVFN(VAR_1);", "for (devfn_it = 0; devfn_it < VTD_PCI_DEVFN_MAX; ++devfn_it) {", "vtd_as = pvtd_as[devfn_it];", "if (vtd_as && ((devfn_it & mask) == (devfn & mask))) {", "VTD_DPRINTF(INV, \"invalidate context-cahce of devfn 0x%\"PRIx16,\ndevfn_it);", "vtd_as->context_cache_entry.context_cache_gen = 0;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ] ]
10,580
static int raw_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVRawState *s = bs->opaque; int access_flags; DWORD overlapped; QemuOpts *opts; Error *local_err = NULL; const char *filename; int ret; s->type = FTYPE_FILE; opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } filename = qemu_opt_get(opts, "filename"); raw_parse_flags(flags, &access_flags, &overlapped); if (filename[0] && filename[1] == ':') { snprintf(s->drive_path, sizeof(s->drive_path), "%c:\\", filename[0]); } else if (filename[0] == '\\' && filename[1] == '\\') { s->drive_path[0] = 0; } else { /* Relative path. */ char buf[MAX_PATH]; GetCurrentDirectory(MAX_PATH, buf); snprintf(s->drive_path, sizeof(s->drive_path), "%c:\\", buf[0]); } s->hfile = CreateFile(filename, access_flags, FILE_SHARE_READ, NULL, OPEN_EXISTING, overlapped, NULL); if (s->hfile == INVALID_HANDLE_VALUE) { int err = GetLastError(); if (err == ERROR_ACCESS_DENIED) { ret = -EACCES; } else { ret = -EINVAL; } goto fail; } if (flags & BDRV_O_NATIVE_AIO) { s->aio = win32_aio_init(); if (s->aio == NULL) { CloseHandle(s->hfile); error_setg(errp, "Could not initialize AIO"); ret = -EINVAL; goto fail; } ret = win32_aio_attach(s->aio, s->hfile); if (ret < 0) { win32_aio_cleanup(s->aio); CloseHandle(s->hfile); error_setg_errno(errp, -ret, "Could not enable AIO"); goto fail; } win32_aio_attach_aio_context(s->aio, bdrv_get_aio_context(bs)); } raw_probe_alignment(bs); ret = 0; fail: qemu_opts_del(opts); return ret; }
false
qemu
2914a1de992118286f5280eddf4f4e6060a8e00b
static int raw_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVRawState *s = bs->opaque; int access_flags; DWORD overlapped; QemuOpts *opts; Error *local_err = NULL; const char *filename; int ret; s->type = FTYPE_FILE; opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } filename = qemu_opt_get(opts, "filename"); raw_parse_flags(flags, &access_flags, &overlapped); if (filename[0] && filename[1] == ':') { snprintf(s->drive_path, sizeof(s->drive_path), "%c:\\", filename[0]); } else if (filename[0] == '\\' && filename[1] == '\\') { s->drive_path[0] = 0; } else { char buf[MAX_PATH]; GetCurrentDirectory(MAX_PATH, buf); snprintf(s->drive_path, sizeof(s->drive_path), "%c:\\", buf[0]); } s->hfile = CreateFile(filename, access_flags, FILE_SHARE_READ, NULL, OPEN_EXISTING, overlapped, NULL); if (s->hfile == INVALID_HANDLE_VALUE) { int err = GetLastError(); if (err == ERROR_ACCESS_DENIED) { ret = -EACCES; } else { ret = -EINVAL; } goto fail; } if (flags & BDRV_O_NATIVE_AIO) { s->aio = win32_aio_init(); if (s->aio == NULL) { CloseHandle(s->hfile); error_setg(errp, "Could not initialize AIO"); ret = -EINVAL; goto fail; } ret = win32_aio_attach(s->aio, s->hfile); if (ret < 0) { win32_aio_cleanup(s->aio); CloseHandle(s->hfile); error_setg_errno(errp, -ret, "Could not enable AIO"); goto fail; } win32_aio_attach_aio_context(s->aio, bdrv_get_aio_context(bs)); } raw_probe_alignment(bs); ret = 0; fail: qemu_opts_del(opts); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2, Error **VAR_3) { BDRVRawState *s = VAR_0->opaque; int VAR_4; DWORD overlapped; QemuOpts *opts; Error *local_err = NULL; const char *VAR_5; int VAR_6; s->type = FTYPE_FILE; opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, VAR_1, &local_err); if (local_err) { error_propagate(VAR_3, local_err); VAR_6 = -EINVAL; goto fail; } VAR_5 = qemu_opt_get(opts, "VAR_5"); raw_parse_flags(VAR_2, &VAR_4, &overlapped); if (VAR_5[0] && VAR_5[1] == ':') { snprintf(s->drive_path, sizeof(s->drive_path), "%c:\\", VAR_5[0]); } else if (VAR_5[0] == '\\' && VAR_5[1] == '\\') { s->drive_path[0] = 0; } else { char VAR_7[MAX_PATH]; GetCurrentDirectory(MAX_PATH, VAR_7); snprintf(s->drive_path, sizeof(s->drive_path), "%c:\\", VAR_7[0]); } s->hfile = CreateFile(VAR_5, VAR_4, FILE_SHARE_READ, NULL, OPEN_EXISTING, overlapped, NULL); if (s->hfile == INVALID_HANDLE_VALUE) { int VAR_8 = GetLastError(); if (VAR_8 == ERROR_ACCESS_DENIED) { VAR_6 = -EACCES; } else { VAR_6 = -EINVAL; } goto fail; } if (VAR_2 & BDRV_O_NATIVE_AIO) { s->aio = win32_aio_init(); if (s->aio == NULL) { CloseHandle(s->hfile); error_setg(VAR_3, "Could not initialize AIO"); VAR_6 = -EINVAL; goto fail; } VAR_6 = win32_aio_attach(s->aio, s->hfile); if (VAR_6 < 0) { win32_aio_cleanup(s->aio); CloseHandle(s->hfile); error_setg_errno(VAR_3, -VAR_6, "Could not enable AIO"); goto fail; } win32_aio_attach_aio_context(s->aio, bdrv_get_aio_context(VAR_0)); } raw_probe_alignment(VAR_0); VAR_6 = 0; fail: qemu_opts_del(opts); return VAR_6; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{", "BDRVRawState *s = VAR_0->opaque;", "int VAR_4;", "DWORD overlapped;", "QemuOpts *opts;", "Error *local_err = NULL;", "const char *VAR_5;", "int VAR_6;", "s->type = FTYPE_FILE;", "opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort);", "qemu_opts_absorb_qdict(opts, VAR_1, &local_err);", "if (local_err) {", "error_propagate(VAR_3, local_err);", "VAR_6 = -EINVAL;", "goto fail;", "}", "VAR_5 = qemu_opt_get(opts, \"VAR_5\");", "raw_parse_flags(VAR_2, &VAR_4, &overlapped);", "if (VAR_5[0] && VAR_5[1] == ':') {", "snprintf(s->drive_path, sizeof(s->drive_path), \"%c:\\\\\", VAR_5[0]);", "} else if (VAR_5[0] == '\\\\' && VAR_5[1] == '\\\\') {", "s->drive_path[0] = 0;", "} else {", "char VAR_7[MAX_PATH];", "GetCurrentDirectory(MAX_PATH, VAR_7);", "snprintf(s->drive_path, sizeof(s->drive_path), \"%c:\\\\\", VAR_7[0]);", "}", "s->hfile = CreateFile(VAR_5, VAR_4,\nFILE_SHARE_READ, NULL,\nOPEN_EXISTING, overlapped, NULL);", "if (s->hfile == INVALID_HANDLE_VALUE) {", "int VAR_8 = GetLastError();", "if (VAR_8 == ERROR_ACCESS_DENIED) {", "VAR_6 = -EACCES;", "} else {", "VAR_6 = -EINVAL;", "}", "goto fail;", "}", "if (VAR_2 & BDRV_O_NATIVE_AIO) {", "s->aio = win32_aio_init();", "if (s->aio == NULL) {", "CloseHandle(s->hfile);", "error_setg(VAR_3, \"Could not initialize AIO\");", "VAR_6 = -EINVAL;", "goto fail;", "}", "VAR_6 = win32_aio_attach(s->aio, s->hfile);", "if (VAR_6 < 0) {", "win32_aio_cleanup(s->aio);", "CloseHandle(s->hfile);", "error_setg_errno(VAR_3, -VAR_6, \"Could not enable AIO\");", "goto fail;", "}", "win32_aio_attach_aio_context(s->aio, bdrv_get_aio_context(VAR_0));", "}", "raw_probe_alignment(VAR_0);", "VAR_6 = 0;", "fail:\nqemu_opts_del(opts);", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75, 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151 ] ]
10,581
static struct omap_watchdog_timer_s *omap_wd_timer_init(MemoryRegion *memory, target_phys_addr_t base, qemu_irq irq, omap_clk clk) { struct omap_watchdog_timer_s *s = (struct omap_watchdog_timer_s *) g_malloc0(sizeof(struct omap_watchdog_timer_s)); s->timer.irq = irq; s->timer.clk = clk; s->timer.timer = qemu_new_timer_ns(vm_clock, omap_timer_tick, &s->timer); omap_wd_timer_reset(s); omap_timer_clk_setup(&s->timer); memory_region_init_io(&s->iomem, &omap_wd_timer_ops, s, "omap-wd-timer", 0x100); memory_region_add_subregion(memory, base, &s->iomem); return s; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static struct omap_watchdog_timer_s *omap_wd_timer_init(MemoryRegion *memory, target_phys_addr_t base, qemu_irq irq, omap_clk clk) { struct omap_watchdog_timer_s *s = (struct omap_watchdog_timer_s *) g_malloc0(sizeof(struct omap_watchdog_timer_s)); s->timer.irq = irq; s->timer.clk = clk; s->timer.timer = qemu_new_timer_ns(vm_clock, omap_timer_tick, &s->timer); omap_wd_timer_reset(s); omap_timer_clk_setup(&s->timer); memory_region_init_io(&s->iomem, &omap_wd_timer_ops, s, "omap-wd-timer", 0x100); memory_region_add_subregion(memory, base, &s->iomem); return s; }
{ "code": [], "line_no": [] }
static struct omap_watchdog_timer_s *FUNC_0(MemoryRegion *VAR_0, target_phys_addr_t VAR_1, qemu_irq VAR_2, omap_clk VAR_3) { struct omap_watchdog_timer_s *VAR_4 = (struct omap_watchdog_timer_s *) g_malloc0(sizeof(struct omap_watchdog_timer_s)); VAR_4->timer.VAR_2 = VAR_2; VAR_4->timer.VAR_3 = VAR_3; VAR_4->timer.timer = qemu_new_timer_ns(vm_clock, omap_timer_tick, &VAR_4->timer); omap_wd_timer_reset(VAR_4); omap_timer_clk_setup(&VAR_4->timer); memory_region_init_io(&VAR_4->iomem, &omap_wd_timer_ops, VAR_4, "omap-wd-timer", 0x100); memory_region_add_subregion(VAR_0, VAR_1, &VAR_4->iomem); return VAR_4; }
[ "static struct omap_watchdog_timer_s *FUNC_0(MemoryRegion *VAR_0,\ntarget_phys_addr_t VAR_1,\nqemu_irq VAR_2, omap_clk VAR_3)\n{", "struct omap_watchdog_timer_s *VAR_4 = (struct omap_watchdog_timer_s *)\ng_malloc0(sizeof(struct omap_watchdog_timer_s));", "VAR_4->timer.VAR_2 = VAR_2;", "VAR_4->timer.VAR_3 = VAR_3;", "VAR_4->timer.timer = qemu_new_timer_ns(vm_clock, omap_timer_tick, &VAR_4->timer);", "omap_wd_timer_reset(VAR_4);", "omap_timer_clk_setup(&VAR_4->timer);", "memory_region_init_io(&VAR_4->iomem, &omap_wd_timer_ops, VAR_4,\n\"omap-wd-timer\", 0x100);", "memory_region_add_subregion(VAR_0, VAR_1, &VAR_4->iomem);", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 31 ], [ 35 ], [ 37 ] ]
10,582
void qmp_block_job_cancel(const char *device, bool has_force, bool force, Error **errp) { BlockJob *job = find_block_job(device); if (!has_force) { force = false; } if (!job) { error_set(errp, QERR_BLOCK_JOB_NOT_ACTIVE, device); return; } if (job->paused && !force) { error_setg(errp, "The block job for device '%s' is currently paused", device); return; } trace_qmp_block_job_cancel(job); block_job_cancel(job); }
false
qemu
3d948cdf3760b52238038626a7ffa7d30913060b
void qmp_block_job_cancel(const char *device, bool has_force, bool force, Error **errp) { BlockJob *job = find_block_job(device); if (!has_force) { force = false; } if (!job) { error_set(errp, QERR_BLOCK_JOB_NOT_ACTIVE, device); return; } if (job->paused && !force) { error_setg(errp, "The block job for device '%s' is currently paused", device); return; } trace_qmp_block_job_cancel(job); block_job_cancel(job); }
{ "code": [], "line_no": [] }
void FUNC_0(const char *VAR_0, bool VAR_1, bool VAR_2, Error **VAR_3) { BlockJob *job = find_block_job(VAR_0); if (!VAR_1) { VAR_2 = false; } if (!job) { error_set(VAR_3, QERR_BLOCK_JOB_NOT_ACTIVE, VAR_0); return; } if (job->paused && !VAR_2) { error_setg(VAR_3, "The block job for VAR_0 '%s' is currently paused", VAR_0); return; } trace_qmp_block_job_cancel(job); block_job_cancel(job); }
[ "void FUNC_0(const char *VAR_0,\nbool VAR_1, bool VAR_2, Error **VAR_3)\n{", "BlockJob *job = find_block_job(VAR_0);", "if (!VAR_1) {", "VAR_2 = false;", "}", "if (!job) {", "error_set(VAR_3, QERR_BLOCK_JOB_NOT_ACTIVE, VAR_0);", "return;", "}", "if (job->paused && !VAR_2) {", "error_setg(VAR_3, \"The block job for VAR_0 '%s' is currently paused\",\nVAR_0);", "return;", "}", "trace_qmp_block_job_cancel(job);", "block_job_cancel(job);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ] ]
10,584
static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc, int fd, int fs, int base, int index) { const char *opn = "extended float load/store"; int store = 0; TCGv t0 = tcg_temp_new(); if (base == 0) { gen_load_gpr(t0, index); } else if (index == 0) { gen_load_gpr(t0, base); } else { gen_load_gpr(t0, index); gen_op_addr_add(ctx, t0, cpu_gpr[base]); } /* Don't do NOP if destination is zero: we must perform the actual memory access. */ save_cpu_state(ctx, 0); switch (opc) { case OPC_LWXC1: check_cop1x(ctx); { TCGv_i32 fp0 = tcg_temp_new_i32(); tcg_gen_qemu_ld32s(t0, t0, ctx->mem_idx); tcg_gen_trunc_tl_i32(fp0, t0); gen_store_fpr32(fp0, fd); tcg_temp_free_i32(fp0); } opn = "lwxc1"; break; case OPC_LDXC1: check_cop1x(ctx); check_cp1_registers(ctx, fd); { TCGv_i64 fp0 = tcg_temp_new_i64(); tcg_gen_qemu_ld64(fp0, t0, ctx->mem_idx); gen_store_fpr64(ctx, fp0, fd); tcg_temp_free_i64(fp0); } opn = "ldxc1"; break; case OPC_LUXC1: check_cp1_64bitmode(ctx); tcg_gen_andi_tl(t0, t0, ~0x7); { TCGv_i64 fp0 = tcg_temp_new_i64(); tcg_gen_qemu_ld64(fp0, t0, ctx->mem_idx); gen_store_fpr64(ctx, fp0, fd); tcg_temp_free_i64(fp0); } opn = "luxc1"; break; case OPC_SWXC1: check_cop1x(ctx); { TCGv_i32 fp0 = tcg_temp_new_i32(); TCGv t1 = tcg_temp_new(); gen_load_fpr32(fp0, fs); tcg_gen_extu_i32_tl(t1, fp0); tcg_gen_qemu_st32(t1, t0, ctx->mem_idx); tcg_temp_free_i32(fp0); tcg_temp_free_i32(t1); } opn = "swxc1"; store = 1; break; case OPC_SDXC1: check_cop1x(ctx); check_cp1_registers(ctx, fs); { TCGv_i64 fp0 = tcg_temp_new_i64(); gen_load_fpr64(ctx, fp0, fs); tcg_gen_qemu_st64(fp0, t0, ctx->mem_idx); tcg_temp_free_i64(fp0); } opn = "sdxc1"; store = 1; break; case OPC_SUXC1: check_cp1_64bitmode(ctx); tcg_gen_andi_tl(t0, t0, ~0x7); { TCGv_i64 fp0 = tcg_temp_new_i64(); gen_load_fpr64(ctx, fp0, fs); tcg_gen_qemu_st64(fp0, t0, ctx->mem_idx); tcg_temp_free_i64(fp0); } opn = "suxc1"; store = 1; break; } tcg_temp_free(t0); MIPS_DEBUG("%s %s, %s(%s)", opn, fregnames[store ? fs : fd], regnames[index], regnames[base]); }
false
qemu
007ac6faed12abdd4113e2460ba4464aacb7f4dd
static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc, int fd, int fs, int base, int index) { const char *opn = "extended float load/store"; int store = 0; TCGv t0 = tcg_temp_new(); if (base == 0) { gen_load_gpr(t0, index); } else if (index == 0) { gen_load_gpr(t0, base); } else { gen_load_gpr(t0, index); gen_op_addr_add(ctx, t0, cpu_gpr[base]); } save_cpu_state(ctx, 0); switch (opc) { case OPC_LWXC1: check_cop1x(ctx); { TCGv_i32 fp0 = tcg_temp_new_i32(); tcg_gen_qemu_ld32s(t0, t0, ctx->mem_idx); tcg_gen_trunc_tl_i32(fp0, t0); gen_store_fpr32(fp0, fd); tcg_temp_free_i32(fp0); } opn = "lwxc1"; break; case OPC_LDXC1: check_cop1x(ctx); check_cp1_registers(ctx, fd); { TCGv_i64 fp0 = tcg_temp_new_i64(); tcg_gen_qemu_ld64(fp0, t0, ctx->mem_idx); gen_store_fpr64(ctx, fp0, fd); tcg_temp_free_i64(fp0); } opn = "ldxc1"; break; case OPC_LUXC1: check_cp1_64bitmode(ctx); tcg_gen_andi_tl(t0, t0, ~0x7); { TCGv_i64 fp0 = tcg_temp_new_i64(); tcg_gen_qemu_ld64(fp0, t0, ctx->mem_idx); gen_store_fpr64(ctx, fp0, fd); tcg_temp_free_i64(fp0); } opn = "luxc1"; break; case OPC_SWXC1: check_cop1x(ctx); { TCGv_i32 fp0 = tcg_temp_new_i32(); TCGv t1 = tcg_temp_new(); gen_load_fpr32(fp0, fs); tcg_gen_extu_i32_tl(t1, fp0); tcg_gen_qemu_st32(t1, t0, ctx->mem_idx); tcg_temp_free_i32(fp0); tcg_temp_free_i32(t1); } opn = "swxc1"; store = 1; break; case OPC_SDXC1: check_cop1x(ctx); check_cp1_registers(ctx, fs); { TCGv_i64 fp0 = tcg_temp_new_i64(); gen_load_fpr64(ctx, fp0, fs); tcg_gen_qemu_st64(fp0, t0, ctx->mem_idx); tcg_temp_free_i64(fp0); } opn = "sdxc1"; store = 1; break; case OPC_SUXC1: check_cp1_64bitmode(ctx); tcg_gen_andi_tl(t0, t0, ~0x7); { TCGv_i64 fp0 = tcg_temp_new_i64(); gen_load_fpr64(ctx, fp0, fs); tcg_gen_qemu_st64(fp0, t0, ctx->mem_idx); tcg_temp_free_i64(fp0); } opn = "suxc1"; store = 1; break; } tcg_temp_free(t0); MIPS_DEBUG("%s %s, %s(%s)", opn, fregnames[store ? fs : fd], regnames[index], regnames[base]); }
{ "code": [], "line_no": [] }
static void FUNC_0 (DisasContext *VAR_0, uint32_t VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5) { const char *VAR_6 = "extended float load/VAR_7"; int VAR_7 = 0; TCGv t0 = tcg_temp_new(); if (VAR_4 == 0) { gen_load_gpr(t0, VAR_5); } else if (VAR_5 == 0) { gen_load_gpr(t0, VAR_4); } else { gen_load_gpr(t0, VAR_5); gen_op_addr_add(VAR_0, t0, cpu_gpr[VAR_4]); } save_cpu_state(VAR_0, 0); switch (VAR_1) { case OPC_LWXC1: check_cop1x(VAR_0); { TCGv_i32 fp0 = tcg_temp_new_i32(); tcg_gen_qemu_ld32s(t0, t0, VAR_0->mem_idx); tcg_gen_trunc_tl_i32(fp0, t0); gen_store_fpr32(fp0, VAR_2); tcg_temp_free_i32(fp0); } VAR_6 = "lwxc1"; break; case OPC_LDXC1: check_cop1x(VAR_0); check_cp1_registers(VAR_0, VAR_2); { TCGv_i64 fp0 = tcg_temp_new_i64(); tcg_gen_qemu_ld64(fp0, t0, VAR_0->mem_idx); gen_store_fpr64(VAR_0, fp0, VAR_2); tcg_temp_free_i64(fp0); } VAR_6 = "ldxc1"; break; case OPC_LUXC1: check_cp1_64bitmode(VAR_0); tcg_gen_andi_tl(t0, t0, ~0x7); { TCGv_i64 fp0 = tcg_temp_new_i64(); tcg_gen_qemu_ld64(fp0, t0, VAR_0->mem_idx); gen_store_fpr64(VAR_0, fp0, VAR_2); tcg_temp_free_i64(fp0); } VAR_6 = "luxc1"; break; case OPC_SWXC1: check_cop1x(VAR_0); { TCGv_i32 fp0 = tcg_temp_new_i32(); TCGv t1 = tcg_temp_new(); gen_load_fpr32(fp0, VAR_3); tcg_gen_extu_i32_tl(t1, fp0); tcg_gen_qemu_st32(t1, t0, VAR_0->mem_idx); tcg_temp_free_i32(fp0); tcg_temp_free_i32(t1); } VAR_6 = "swxc1"; VAR_7 = 1; break; case OPC_SDXC1: check_cop1x(VAR_0); check_cp1_registers(VAR_0, VAR_3); { TCGv_i64 fp0 = tcg_temp_new_i64(); gen_load_fpr64(VAR_0, fp0, VAR_3); tcg_gen_qemu_st64(fp0, t0, VAR_0->mem_idx); tcg_temp_free_i64(fp0); } VAR_6 = "sdxc1"; VAR_7 = 1; break; case OPC_SUXC1: check_cp1_64bitmode(VAR_0); tcg_gen_andi_tl(t0, t0, ~0x7); { TCGv_i64 fp0 = tcg_temp_new_i64(); gen_load_fpr64(VAR_0, fp0, VAR_3); tcg_gen_qemu_st64(fp0, t0, VAR_0->mem_idx); tcg_temp_free_i64(fp0); } VAR_6 = "suxc1"; VAR_7 = 1; break; } tcg_temp_free(t0); MIPS_DEBUG("%s %s, %s(%s)", VAR_6, fregnames[VAR_7 ? VAR_3 : VAR_2], regnames[VAR_5], regnames[VAR_4]); }
[ "static void FUNC_0 (DisasContext *VAR_0, uint32_t VAR_1,\nint VAR_2, int VAR_3, int VAR_4, int VAR_5)\n{", "const char *VAR_6 = \"extended float load/VAR_7\";", "int VAR_7 = 0;", "TCGv t0 = tcg_temp_new();", "if (VAR_4 == 0) {", "gen_load_gpr(t0, VAR_5);", "} else if (VAR_5 == 0) {", "gen_load_gpr(t0, VAR_4);", "} else {", "gen_load_gpr(t0, VAR_5);", "gen_op_addr_add(VAR_0, t0, cpu_gpr[VAR_4]);", "}", "save_cpu_state(VAR_0, 0);", "switch (VAR_1) {", "case OPC_LWXC1:\ncheck_cop1x(VAR_0);", "{", "TCGv_i32 fp0 = tcg_temp_new_i32();", "tcg_gen_qemu_ld32s(t0, t0, VAR_0->mem_idx);", "tcg_gen_trunc_tl_i32(fp0, t0);", "gen_store_fpr32(fp0, VAR_2);", "tcg_temp_free_i32(fp0);", "}", "VAR_6 = \"lwxc1\";", "break;", "case OPC_LDXC1:\ncheck_cop1x(VAR_0);", "check_cp1_registers(VAR_0, VAR_2);", "{", "TCGv_i64 fp0 = tcg_temp_new_i64();", "tcg_gen_qemu_ld64(fp0, t0, VAR_0->mem_idx);", "gen_store_fpr64(VAR_0, fp0, VAR_2);", "tcg_temp_free_i64(fp0);", "}", "VAR_6 = \"ldxc1\";", "break;", "case OPC_LUXC1:\ncheck_cp1_64bitmode(VAR_0);", "tcg_gen_andi_tl(t0, t0, ~0x7);", "{", "TCGv_i64 fp0 = tcg_temp_new_i64();", "tcg_gen_qemu_ld64(fp0, t0, VAR_0->mem_idx);", "gen_store_fpr64(VAR_0, fp0, VAR_2);", "tcg_temp_free_i64(fp0);", "}", "VAR_6 = \"luxc1\";", "break;", "case OPC_SWXC1:\ncheck_cop1x(VAR_0);", "{", "TCGv_i32 fp0 = tcg_temp_new_i32();", "TCGv t1 = tcg_temp_new();", "gen_load_fpr32(fp0, VAR_3);", "tcg_gen_extu_i32_tl(t1, fp0);", "tcg_gen_qemu_st32(t1, t0, VAR_0->mem_idx);", "tcg_temp_free_i32(fp0);", "tcg_temp_free_i32(t1);", "}", "VAR_6 = \"swxc1\";", "VAR_7 = 1;", "break;", "case OPC_SDXC1:\ncheck_cop1x(VAR_0);", "check_cp1_registers(VAR_0, VAR_3);", "{", "TCGv_i64 fp0 = tcg_temp_new_i64();", "gen_load_fpr64(VAR_0, fp0, VAR_3);", "tcg_gen_qemu_st64(fp0, t0, VAR_0->mem_idx);", "tcg_temp_free_i64(fp0);", "}", "VAR_6 = \"sdxc1\";", "VAR_7 = 1;", "break;", "case OPC_SUXC1:\ncheck_cp1_64bitmode(VAR_0);", "tcg_gen_andi_tl(t0, t0, ~0x7);", "{", "TCGv_i64 fp0 = tcg_temp_new_i64();", "gen_load_fpr64(VAR_0, fp0, VAR_3);", "tcg_gen_qemu_st64(fp0, t0, VAR_0->mem_idx);", "tcg_temp_free_i64(fp0);", "}", "VAR_6 = \"suxc1\";", "VAR_7 = 1;", "break;", "}", "tcg_temp_free(t0);", "MIPS_DEBUG(\"%s %s, %s(%s)\", VAR_6, fregnames[VAR_7 ? VAR_3 : VAR_2],\nregnames[VAR_5], regnames[VAR_4]);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201 ] ]
10,585
static ioreq_t *cpu_get_ioreq(XenIOState *state) { int i; evtchn_port_t port; port = xc_evtchn_pending(state->xce_handle); if (port == state->bufioreq_local_port) { timer_mod(state->buffered_io_timer, BUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); return NULL; } if (port != -1) { for (i = 0; i < max_cpus; i++) { if (state->ioreq_local_port[i] == port) { break; } } if (i == max_cpus) { hw_error("Fatal error while trying to get io event!\n"); } /* unmask the wanted port again */ xc_evtchn_unmask(state->xce_handle, port); /* get the io packet from shared memory */ state->send_vcpu = i; return cpu_get_ioreq_from_shared_memory(state, i); } /* read error or read nothing */ return NULL; }
false
qemu
a2db2a1edd06a50b8a862c654cf993368cf9f1d9
static ioreq_t *cpu_get_ioreq(XenIOState *state) { int i; evtchn_port_t port; port = xc_evtchn_pending(state->xce_handle); if (port == state->bufioreq_local_port) { timer_mod(state->buffered_io_timer, BUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); return NULL; } if (port != -1) { for (i = 0; i < max_cpus; i++) { if (state->ioreq_local_port[i] == port) { break; } } if (i == max_cpus) { hw_error("Fatal error while trying to get io event!\n"); } xc_evtchn_unmask(state->xce_handle, port); state->send_vcpu = i; return cpu_get_ioreq_from_shared_memory(state, i); } return NULL; }
{ "code": [], "line_no": [] }
static ioreq_t *FUNC_0(XenIOState *state) { int VAR_0; evtchn_port_t port; port = xc_evtchn_pending(state->xce_handle); if (port == state->bufioreq_local_port) { timer_mod(state->buffered_io_timer, BUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); return NULL; } if (port != -1) { for (VAR_0 = 0; VAR_0 < max_cpus; VAR_0++) { if (state->ioreq_local_port[VAR_0] == port) { break; } } if (VAR_0 == max_cpus) { hw_error("Fatal error while trying to get io event!\n"); } xc_evtchn_unmask(state->xce_handle, port); state->send_vcpu = VAR_0; return cpu_get_ioreq_from_shared_memory(state, VAR_0); } return NULL; }
[ "static ioreq_t *FUNC_0(XenIOState *state)\n{", "int VAR_0;", "evtchn_port_t port;", "port = xc_evtchn_pending(state->xce_handle);", "if (port == state->bufioreq_local_port) {", "timer_mod(state->buffered_io_timer,\nBUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIME));", "return NULL;", "}", "if (port != -1) {", "for (VAR_0 = 0; VAR_0 < max_cpus; VAR_0++) {", "if (state->ioreq_local_port[VAR_0] == port) {", "break;", "}", "}", "if (VAR_0 == max_cpus) {", "hw_error(\"Fatal error while trying to get io event!\\n\");", "}", "xc_evtchn_unmask(state->xce_handle, port);", "state->send_vcpu = VAR_0;", "return cpu_get_ioreq_from_shared_memory(state, VAR_0);", "}", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 67 ] ]
10,586
BlockDriverAIOCB *bdrv_aio_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { BlockDriver *drv = bs->drv; BlockDriverAIOCB *ret; if (!drv) return NULL; /* XXX: we assume that nb_sectors == 0 is suppored by the async read */ if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { memcpy(buf, bs->boot_sector_data, 512); sector_num++; nb_sectors--; buf += 512; } ret = drv->bdrv_aio_read(bs, sector_num, buf, nb_sectors, cb, opaque); if (ret) { /* Update stats even though technically transfer has not happened. */ bs->rd_bytes += (unsigned) nb_sectors * SECTOR_SIZE; bs->rd_ops ++; } return ret; }
false
qemu
4fc9af53d88c0a2a810704a06cb39a7182982e4e
BlockDriverAIOCB *bdrv_aio_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { BlockDriver *drv = bs->drv; BlockDriverAIOCB *ret; if (!drv) return NULL; if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { memcpy(buf, bs->boot_sector_data, 512); sector_num++; nb_sectors--; buf += 512; } ret = drv->bdrv_aio_read(bs, sector_num, buf, nb_sectors, cb, opaque); if (ret) { bs->rd_bytes += (unsigned) nb_sectors * SECTOR_SIZE; bs->rd_ops ++; } return ret; }
{ "code": [], "line_no": [] }
BlockDriverAIOCB *FUNC_0(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { BlockDriver *drv = bs->drv; BlockDriverAIOCB *ret; if (!drv) return NULL; if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { memcpy(buf, bs->boot_sector_data, 512); sector_num++; nb_sectors--; buf += 512; } ret = drv->FUNC_0(bs, sector_num, buf, nb_sectors, cb, opaque); if (ret) { bs->rd_bytes += (unsigned) nb_sectors * SECTOR_SIZE; bs->rd_ops ++; } return ret; }
[ "BlockDriverAIOCB *FUNC_0(BlockDriverState *bs, int64_t sector_num,\nuint8_t *buf, int nb_sectors,\nBlockDriverCompletionFunc *cb, void *opaque)\n{", "BlockDriver *drv = bs->drv;", "BlockDriverAIOCB *ret;", "if (!drv)\nreturn NULL;", "if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {", "memcpy(buf, bs->boot_sector_data, 512);", "sector_num++;", "nb_sectors--;", "buf += 512;", "}", "ret = drv->FUNC_0(bs, sector_num, buf, nb_sectors, cb, opaque);", "if (ret) {", "bs->rd_bytes += (unsigned) nb_sectors * SECTOR_SIZE;", "bs->rd_ops ++;", "}", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
10,587
static void tcp_chr_tls_init(Chardev *chr) { SocketChardev *s = SOCKET_CHARDEV(chr); QIOChannelTLS *tioc; Error *err = NULL; gchar *name; if (s->is_listen) { tioc = qio_channel_tls_new_server( s->ioc, s->tls_creds, NULL, /* XXX Use an ACL */ &err); } else { tioc = qio_channel_tls_new_client( s->ioc, s->tls_creds, s->addr->u.inet.data->host, &err); } if (tioc == NULL) { error_free(err); tcp_chr_disconnect(chr); return; } name = g_strdup_printf("chardev-tls-%s-%s", s->is_listen ? "server" : "client", chr->label); qio_channel_set_name(QIO_CHANNEL(tioc), name); g_free(name); object_unref(OBJECT(s->ioc)); s->ioc = QIO_CHANNEL(tioc); qio_channel_tls_handshake(tioc, tcp_chr_tls_handshake, chr, NULL); }
false
qemu
bd269ebc82fbaa5fe7ce5bc7c1770ac8acecd884
static void tcp_chr_tls_init(Chardev *chr) { SocketChardev *s = SOCKET_CHARDEV(chr); QIOChannelTLS *tioc; Error *err = NULL; gchar *name; if (s->is_listen) { tioc = qio_channel_tls_new_server( s->ioc, s->tls_creds, NULL, &err); } else { tioc = qio_channel_tls_new_client( s->ioc, s->tls_creds, s->addr->u.inet.data->host, &err); } if (tioc == NULL) { error_free(err); tcp_chr_disconnect(chr); return; } name = g_strdup_printf("chardev-tls-%s-%s", s->is_listen ? "server" : "client", chr->label); qio_channel_set_name(QIO_CHANNEL(tioc), name); g_free(name); object_unref(OBJECT(s->ioc)); s->ioc = QIO_CHANNEL(tioc); qio_channel_tls_handshake(tioc, tcp_chr_tls_handshake, chr, NULL); }
{ "code": [], "line_no": [] }
static void FUNC_0(Chardev *VAR_0) { SocketChardev *s = SOCKET_CHARDEV(VAR_0); QIOChannelTLS *tioc; Error *err = NULL; gchar *name; if (s->is_listen) { tioc = qio_channel_tls_new_server( s->ioc, s->tls_creds, NULL, &err); } else { tioc = qio_channel_tls_new_client( s->ioc, s->tls_creds, s->addr->u.inet.data->host, &err); } if (tioc == NULL) { error_free(err); tcp_chr_disconnect(VAR_0); return; } name = g_strdup_printf("chardev-tls-%s-%s", s->is_listen ? "server" : "client", VAR_0->label); qio_channel_set_name(QIO_CHANNEL(tioc), name); g_free(name); object_unref(OBJECT(s->ioc)); s->ioc = QIO_CHANNEL(tioc); qio_channel_tls_handshake(tioc, tcp_chr_tls_handshake, VAR_0, NULL); }
[ "static void FUNC_0(Chardev *VAR_0)\n{", "SocketChardev *s = SOCKET_CHARDEV(VAR_0);", "QIOChannelTLS *tioc;", "Error *err = NULL;", "gchar *name;", "if (s->is_listen) {", "tioc = qio_channel_tls_new_server(\ns->ioc, s->tls_creds,\nNULL,\n&err);", "} else {", "tioc = qio_channel_tls_new_client(\ns->ioc, s->tls_creds,\ns->addr->u.inet.data->host,\n&err);", "}", "if (tioc == NULL) {", "error_free(err);", "tcp_chr_disconnect(VAR_0);", "return;", "}", "name = g_strdup_printf(\"chardev-tls-%s-%s\",\ns->is_listen ? \"server\" : \"client\",\nVAR_0->label);", "qio_channel_set_name(QIO_CHANNEL(tioc), name);", "g_free(name);", "object_unref(OBJECT(s->ioc));", "s->ioc = QIO_CHANNEL(tioc);", "qio_channel_tls_handshake(tioc,\ntcp_chr_tls_handshake,\nVAR_0,\nNULL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19, 21, 23 ], [ 25 ], [ 27, 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63, 65, 67, 69 ], [ 71 ] ]
10,588
static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info, int *need_next_header, int *new_frame_start) { GetBitContext bits; int size, rdb, ch, sr; union { uint64_t u64; uint8_t u8[8]; } tmp; tmp.u64 = be2me_64(state); init_get_bits(&bits, tmp.u8+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8); if(get_bits(&bits, 12) != 0xfff) return 0; skip_bits1(&bits); /* id */ skip_bits(&bits, 2); /* layer */ skip_bits1(&bits); /* protection_absent */ skip_bits(&bits, 2); /* profile_objecttype */ sr = get_bits(&bits, 4); /* sample_frequency_index */ if(!ff_mpeg4audio_sample_rates[sr]) return 0; skip_bits1(&bits); /* private_bit */ ch = get_bits(&bits, 3); /* channel_configuration */ if(!ff_mpeg4audio_channels[ch]) return 0; skip_bits1(&bits); /* original/copy */ skip_bits1(&bits); /* home */ /* adts_variable_header */ skip_bits1(&bits); /* copyright_identification_bit */ skip_bits1(&bits); /* copyright_identification_start */ size = get_bits(&bits, 13); /* aac_frame_length */ if(size < AAC_HEADER_SIZE) return 0; skip_bits(&bits, 11); /* adts_buffer_fullness */ rdb = get_bits(&bits, 2); /* number_of_raw_data_blocks_in_frame */ hdr_info->channels = ff_mpeg4audio_channels[ch]; hdr_info->sample_rate = ff_mpeg4audio_sample_rates[sr]; hdr_info->samples = (rdb + 1) * 1024; hdr_info->bit_rate = size * 8 * hdr_info->sample_rate / hdr_info->samples; *need_next_header = 0; *new_frame_start = 1; return size; }
false
FFmpeg
158b39126d59f07069e0da07e0658111967c6179
static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info, int *need_next_header, int *new_frame_start) { GetBitContext bits; int size, rdb, ch, sr; union { uint64_t u64; uint8_t u8[8]; } tmp; tmp.u64 = be2me_64(state); init_get_bits(&bits, tmp.u8+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8); if(get_bits(&bits, 12) != 0xfff) return 0; skip_bits1(&bits); skip_bits(&bits, 2); skip_bits1(&bits); skip_bits(&bits, 2); sr = get_bits(&bits, 4); if(!ff_mpeg4audio_sample_rates[sr]) return 0; skip_bits1(&bits); ch = get_bits(&bits, 3); if(!ff_mpeg4audio_channels[ch]) return 0; skip_bits1(&bits); skip_bits1(&bits); skip_bits1(&bits); skip_bits1(&bits); size = get_bits(&bits, 13); if(size < AAC_HEADER_SIZE) return 0; skip_bits(&bits, 11); rdb = get_bits(&bits, 2); hdr_info->channels = ff_mpeg4audio_channels[ch]; hdr_info->sample_rate = ff_mpeg4audio_sample_rates[sr]; hdr_info->samples = (rdb + 1) * 1024; hdr_info->bit_rate = size * 8 * hdr_info->sample_rate / hdr_info->samples; *need_next_header = 0; *new_frame_start = 1; return size; }
{ "code": [], "line_no": [] }
static int FUNC_0(uint64_t VAR_0, AACAC3ParseContext *VAR_1, int *VAR_2, int *VAR_3) { GetBitContext bits; int VAR_4, VAR_5, VAR_6, VAR_7; union { uint64_t u64; uint8_t u8[8]; } VAR_8; VAR_8.u64 = be2me_64(VAR_0); init_get_bits(&bits, VAR_8.u8+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8); if(get_bits(&bits, 12) != 0xfff) return 0; skip_bits1(&bits); skip_bits(&bits, 2); skip_bits1(&bits); skip_bits(&bits, 2); VAR_7 = get_bits(&bits, 4); if(!ff_mpeg4audio_sample_rates[VAR_7]) return 0; skip_bits1(&bits); VAR_6 = get_bits(&bits, 3); if(!ff_mpeg4audio_channels[VAR_6]) return 0; skip_bits1(&bits); skip_bits1(&bits); skip_bits1(&bits); skip_bits1(&bits); VAR_4 = get_bits(&bits, 13); if(VAR_4 < AAC_HEADER_SIZE) return 0; skip_bits(&bits, 11); VAR_5 = get_bits(&bits, 2); VAR_1->channels = ff_mpeg4audio_channels[VAR_6]; VAR_1->sample_rate = ff_mpeg4audio_sample_rates[VAR_7]; VAR_1->samples = (VAR_5 + 1) * 1024; VAR_1->bit_rate = VAR_4 * 8 * VAR_1->sample_rate / VAR_1->samples; *VAR_2 = 0; *VAR_3 = 1; return VAR_4; }
[ "static int FUNC_0(uint64_t VAR_0, AACAC3ParseContext *VAR_1,\nint *VAR_2, int *VAR_3)\n{", "GetBitContext bits;", "int VAR_4, VAR_5, VAR_6, VAR_7;", "union {", "uint64_t u64;", "uint8_t u8[8];", "} VAR_8;", "VAR_8.u64 = be2me_64(VAR_0);", "init_get_bits(&bits, VAR_8.u8+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8);", "if(get_bits(&bits, 12) != 0xfff)\nreturn 0;", "skip_bits1(&bits);", "skip_bits(&bits, 2);", "skip_bits1(&bits);", "skip_bits(&bits, 2);", "VAR_7 = get_bits(&bits, 4);", "if(!ff_mpeg4audio_sample_rates[VAR_7])\nreturn 0;", "skip_bits1(&bits);", "VAR_6 = get_bits(&bits, 3);", "if(!ff_mpeg4audio_channels[VAR_6])\nreturn 0;", "skip_bits1(&bits);", "skip_bits1(&bits);", "skip_bits1(&bits);", "skip_bits1(&bits);", "VAR_4 = get_bits(&bits, 13);", "if(VAR_4 < AAC_HEADER_SIZE)\nreturn 0;", "skip_bits(&bits, 11);", "VAR_5 = get_bits(&bits, 2);", "VAR_1->channels = ff_mpeg4audio_channels[VAR_6];", "VAR_1->sample_rate = ff_mpeg4audio_sample_rates[VAR_7];", "VAR_1->samples = (VAR_5 + 1) * 1024;", "VAR_1->bit_rate = VAR_4 * 8 * VAR_1->sample_rate / VAR_1->samples;", "*VAR_2 = 0;", "*VAR_3 = 1;", "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 ]
[ [ 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 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ] ]
10,589
static int local_post_create_passthrough(FsContext *fs_ctx, const char *path, FsCred *credp) { char buffer[PATH_MAX]; if (chmod(rpath(fs_ctx, path, buffer), credp->fc_mode & 07777) < 0) { return -1; } if (lchown(rpath(fs_ctx, path, buffer), credp->fc_uid, credp->fc_gid) < 0) { /* * If we fail to change ownership and if we are * using security model none. Ignore the error */ if ((fs_ctx->export_flags & V9FS_SEC_MASK) != V9FS_SM_NONE) { return -1; } } return 0; }
true
qemu
2d40564aaab3a99fe6ce00fc0fc893c02e9443ec
static int local_post_create_passthrough(FsContext *fs_ctx, const char *path, FsCred *credp) { char buffer[PATH_MAX]; if (chmod(rpath(fs_ctx, path, buffer), credp->fc_mode & 07777) < 0) { return -1; } if (lchown(rpath(fs_ctx, path, buffer), credp->fc_uid, credp->fc_gid) < 0) { if ((fs_ctx->export_flags & V9FS_SEC_MASK) != V9FS_SM_NONE) { return -1; } } return 0; }
{ "code": [ " if (chmod(rpath(fs_ctx, path, buffer), credp->fc_mode & 07777) < 0) {", " return -1;" ], "line_no": [ 11, 13 ] }
static int FUNC_0(FsContext *VAR_0, const char *VAR_1, FsCred *VAR_2) { char VAR_3[PATH_MAX]; if (chmod(rpath(VAR_0, VAR_1, VAR_3), VAR_2->fc_mode & 07777) < 0) { return -1; } if (lchown(rpath(VAR_0, VAR_1, VAR_3), VAR_2->fc_uid, VAR_2->fc_gid) < 0) { if ((VAR_0->export_flags & V9FS_SEC_MASK) != V9FS_SM_NONE) { return -1; } } return 0; }
[ "static int FUNC_0(FsContext *VAR_0, const char *VAR_1,\nFsCred *VAR_2)\n{", "char VAR_3[PATH_MAX];", "if (chmod(rpath(VAR_0, VAR_1, VAR_3), VAR_2->fc_mode & 07777) < 0) {", "return -1;", "}", "if (lchown(rpath(VAR_0, VAR_1, VAR_3), VAR_2->fc_uid,\nVAR_2->fc_gid) < 0) {", "if ((VAR_0->export_flags & V9FS_SEC_MASK) != V9FS_SM_NONE) {", "return -1;", "}", "}", "return 0;", "}" ]
[ 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
10,591
void vga_reset(void *opaque) { VGAState *s = (VGAState *) opaque; s->lfb_addr = 0; s->lfb_end = 0; s->map_addr = 0; s->map_end = 0; s->lfb_vram_mapped = 0; s->bios_offset = 0; s->bios_size = 0; s->sr_index = 0; memset(s->sr, '\0', sizeof(s->sr)); s->gr_index = 0; memset(s->gr, '\0', sizeof(s->gr)); s->ar_index = 0; memset(s->ar, '\0', sizeof(s->ar)); s->ar_flip_flop = 0; s->cr_index = 0; memset(s->cr, '\0', sizeof(s->cr)); s->msr = 0; s->fcr = 0; s->st00 = 0; s->st01 = 0; s->dac_state = 0; s->dac_sub_index = 0; s->dac_read_index = 0; s->dac_write_index = 0; memset(s->dac_cache, '\0', sizeof(s->dac_cache)); s->dac_8bit = 0; memset(s->palette, '\0', sizeof(s->palette)); s->bank_offset = 0; #ifdef CONFIG_BOCHS_VBE s->vbe_index = 0; memset(s->vbe_regs, '\0', sizeof(s->vbe_regs)); s->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID0; s->vbe_start_addr = 0; s->vbe_line_offset = 0; s->vbe_bank_mask = (s->vram_size >> 16) - 1; #endif memset(s->font_offsets, '\0', sizeof(s->font_offsets)); s->graphic_mode = -1; /* force full update */ s->shift_control = 0; s->double_scan = 0; s->line_offset = 0; s->line_compare = 0; s->start_addr = 0; s->plane_updated = 0; s->last_cw = 0; s->last_ch = 0; s->last_width = 0; s->last_height = 0; s->last_scr_width = 0; s->last_scr_height = 0; s->cursor_start = 0; s->cursor_end = 0; s->cursor_offset = 0; memset(s->invalidated_y_table, '\0', sizeof(s->invalidated_y_table)); memset(s->last_palette, '\0', sizeof(s->last_palette)); memset(s->last_ch_attr, '\0', sizeof(s->last_ch_attr)); switch (vga_retrace_method) { case VGA_RETRACE_DUMB: break; case VGA_RETRACE_PRECISE: memset(&s->retrace_info, 0, sizeof (s->retrace_info)); break; } }
true
qemu
9586fefefe383a9aa25ad99bde9a6b240309ca33
void vga_reset(void *opaque) { VGAState *s = (VGAState *) opaque; s->lfb_addr = 0; s->lfb_end = 0; s->map_addr = 0; s->map_end = 0; s->lfb_vram_mapped = 0; s->bios_offset = 0; s->bios_size = 0; s->sr_index = 0; memset(s->sr, '\0', sizeof(s->sr)); s->gr_index = 0; memset(s->gr, '\0', sizeof(s->gr)); s->ar_index = 0; memset(s->ar, '\0', sizeof(s->ar)); s->ar_flip_flop = 0; s->cr_index = 0; memset(s->cr, '\0', sizeof(s->cr)); s->msr = 0; s->fcr = 0; s->st00 = 0; s->st01 = 0; s->dac_state = 0; s->dac_sub_index = 0; s->dac_read_index = 0; s->dac_write_index = 0; memset(s->dac_cache, '\0', sizeof(s->dac_cache)); s->dac_8bit = 0; memset(s->palette, '\0', sizeof(s->palette)); s->bank_offset = 0; #ifdef CONFIG_BOCHS_VBE s->vbe_index = 0; memset(s->vbe_regs, '\0', sizeof(s->vbe_regs)); s->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID0; s->vbe_start_addr = 0; s->vbe_line_offset = 0; s->vbe_bank_mask = (s->vram_size >> 16) - 1; #endif memset(s->font_offsets, '\0', sizeof(s->font_offsets)); s->graphic_mode = -1; s->shift_control = 0; s->double_scan = 0; s->line_offset = 0; s->line_compare = 0; s->start_addr = 0; s->plane_updated = 0; s->last_cw = 0; s->last_ch = 0; s->last_width = 0; s->last_height = 0; s->last_scr_width = 0; s->last_scr_height = 0; s->cursor_start = 0; s->cursor_end = 0; s->cursor_offset = 0; memset(s->invalidated_y_table, '\0', sizeof(s->invalidated_y_table)); memset(s->last_palette, '\0', sizeof(s->last_palette)); memset(s->last_ch_attr, '\0', sizeof(s->last_ch_attr)); switch (vga_retrace_method) { case VGA_RETRACE_DUMB: break; case VGA_RETRACE_PRECISE: memset(&s->retrace_info, 0, sizeof (s->retrace_info)); break; } }
{ "code": [], "line_no": [] }
void FUNC_0(void *VAR_0) { VGAState *s = (VGAState *) VAR_0; s->lfb_addr = 0; s->lfb_end = 0; s->map_addr = 0; s->map_end = 0; s->lfb_vram_mapped = 0; s->bios_offset = 0; s->bios_size = 0; s->sr_index = 0; memset(s->sr, '\0', sizeof(s->sr)); s->gr_index = 0; memset(s->gr, '\0', sizeof(s->gr)); s->ar_index = 0; memset(s->ar, '\0', sizeof(s->ar)); s->ar_flip_flop = 0; s->cr_index = 0; memset(s->cr, '\0', sizeof(s->cr)); s->msr = 0; s->fcr = 0; s->st00 = 0; s->st01 = 0; s->dac_state = 0; s->dac_sub_index = 0; s->dac_read_index = 0; s->dac_write_index = 0; memset(s->dac_cache, '\0', sizeof(s->dac_cache)); s->dac_8bit = 0; memset(s->palette, '\0', sizeof(s->palette)); s->bank_offset = 0; #ifdef CONFIG_BOCHS_VBE s->vbe_index = 0; memset(s->vbe_regs, '\0', sizeof(s->vbe_regs)); s->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID0; s->vbe_start_addr = 0; s->vbe_line_offset = 0; s->vbe_bank_mask = (s->vram_size >> 16) - 1; #endif memset(s->font_offsets, '\0', sizeof(s->font_offsets)); s->graphic_mode = -1; s->shift_control = 0; s->double_scan = 0; s->line_offset = 0; s->line_compare = 0; s->start_addr = 0; s->plane_updated = 0; s->last_cw = 0; s->last_ch = 0; s->last_width = 0; s->last_height = 0; s->last_scr_width = 0; s->last_scr_height = 0; s->cursor_start = 0; s->cursor_end = 0; s->cursor_offset = 0; memset(s->invalidated_y_table, '\0', sizeof(s->invalidated_y_table)); memset(s->last_palette, '\0', sizeof(s->last_palette)); memset(s->last_ch_attr, '\0', sizeof(s->last_ch_attr)); switch (vga_retrace_method) { case VGA_RETRACE_DUMB: break; case VGA_RETRACE_PRECISE: memset(&s->retrace_info, 0, sizeof (s->retrace_info)); break; } }
[ "void FUNC_0(void *VAR_0)\n{", "VGAState *s = (VGAState *) VAR_0;", "s->lfb_addr = 0;", "s->lfb_end = 0;", "s->map_addr = 0;", "s->map_end = 0;", "s->lfb_vram_mapped = 0;", "s->bios_offset = 0;", "s->bios_size = 0;", "s->sr_index = 0;", "memset(s->sr, '\\0', sizeof(s->sr));", "s->gr_index = 0;", "memset(s->gr, '\\0', sizeof(s->gr));", "s->ar_index = 0;", "memset(s->ar, '\\0', sizeof(s->ar));", "s->ar_flip_flop = 0;", "s->cr_index = 0;", "memset(s->cr, '\\0', sizeof(s->cr));", "s->msr = 0;", "s->fcr = 0;", "s->st00 = 0;", "s->st01 = 0;", "s->dac_state = 0;", "s->dac_sub_index = 0;", "s->dac_read_index = 0;", "s->dac_write_index = 0;", "memset(s->dac_cache, '\\0', sizeof(s->dac_cache));", "s->dac_8bit = 0;", "memset(s->palette, '\\0', sizeof(s->palette));", "s->bank_offset = 0;", "#ifdef CONFIG_BOCHS_VBE\ns->vbe_index = 0;", "memset(s->vbe_regs, '\\0', sizeof(s->vbe_regs));", "s->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID0;", "s->vbe_start_addr = 0;", "s->vbe_line_offset = 0;", "s->vbe_bank_mask = (s->vram_size >> 16) - 1;", "#endif\nmemset(s->font_offsets, '\\0', sizeof(s->font_offsets));", "s->graphic_mode = -1;", "s->shift_control = 0;", "s->double_scan = 0;", "s->line_offset = 0;", "s->line_compare = 0;", "s->start_addr = 0;", "s->plane_updated = 0;", "s->last_cw = 0;", "s->last_ch = 0;", "s->last_width = 0;", "s->last_height = 0;", "s->last_scr_width = 0;", "s->last_scr_height = 0;", "s->cursor_start = 0;", "s->cursor_end = 0;", "s->cursor_offset = 0;", "memset(s->invalidated_y_table, '\\0', sizeof(s->invalidated_y_table));", "memset(s->last_palette, '\\0', sizeof(s->last_palette));", "memset(s->last_ch_attr, '\\0', sizeof(s->last_ch_attr));", "switch (vga_retrace_method) {", "case VGA_RETRACE_DUMB:\nbreak;", "case VGA_RETRACE_PRECISE:\nmemset(&s->retrace_info, 0, sizeof (s->retrace_info));", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ] ]
10,593
void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_t *segment, uint8_t *ref, int layout, int is_vp7) { VP56RangeCoder *c = &s->c; static const char *vp7_feature_name[] = { "q-index", "lf-delta", "partial-golden-update", "blit-pitch" }; if (is_vp7) { int i; *segment = 0; for (i = 0; i < 4; i++) { if (s->feature_enabled[i]) { if (vp56_rac_get_prob_branchy(c, s->feature_present_prob[i])) { int index = vp8_rac_get_tree(c, vp7_feature_index_tree, s->feature_index_prob[i]); av_log(s->avctx, AV_LOG_WARNING, "Feature %s present in macroblock (value 0x%x)\n", vp7_feature_name[i], s->feature_value[i][index]); } } } } else if (s->segmentation.update_map) { int bit = vp56_rac_get_prob(c, s->prob->segmentid[0]); *segment = vp56_rac_get_prob(c, s->prob->segmentid[1+bit]) + 2*bit; } else if (s->segmentation.enabled) *segment = ref ? *ref : *segment; mb->segment = *segment; mb->skip = s->mbskip_enabled ? vp56_rac_get_prob(c, s->prob->mbskip) : 0; if (s->keyframe) { mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_intra, vp8_pred16x16_prob_intra); if (mb->mode == MODE_I4x4) { decode_intra4x4_modes(s, c, mb, mb_x, 1, layout); } else { const uint32_t modes = (is_vp7 ? vp7_pred4x4_mode : vp8_pred4x4_mode)[mb->mode] * 0x01010101u; if (s->mb_layout) AV_WN32A(mb->intra4x4_pred_mode_top, modes); else AV_WN32A(s->intra4x4_pred_mode_top + 4 * mb_x, modes); AV_WN32A(s->intra4x4_pred_mode_left, modes); } mb->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, vp8_pred8x8c_prob_intra); mb->ref_frame = VP56_FRAME_CURRENT; } else if (vp56_rac_get_prob_branchy(c, s->prob->intra)) { // inter MB, 16.2 if (vp56_rac_get_prob_branchy(c, s->prob->last)) mb->ref_frame = (!is_vp7 && vp56_rac_get_prob(c, s->prob->golden)) ? VP56_FRAME_GOLDEN2 /* altref */ : VP56_FRAME_GOLDEN; else mb->ref_frame = VP56_FRAME_PREVIOUS; s->ref_count[mb->ref_frame - 1]++; // motion vectors, 16.3 if (is_vp7) vp7_decode_mvs(s, mb, mb_x, mb_y, layout); else vp8_decode_mvs(s, mb, mb_x, mb_y, layout); } else { // intra MB, 16.1 mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, s->prob->pred16x16); if (mb->mode == MODE_I4x4) decode_intra4x4_modes(s, c, mb, mb_x, 0, layout); mb->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, s->prob->pred8x8c); mb->ref_frame = VP56_FRAME_CURRENT; mb->partitioning = VP8_SPLITMVMODE_NONE; AV_ZERO32(&mb->bmv[0]); } }
true
FFmpeg
fed92adbb3fc6cbf735e3df9a2f7d0a2917fcfbd
void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_t *segment, uint8_t *ref, int layout, int is_vp7) { VP56RangeCoder *c = &s->c; static const char *vp7_feature_name[] = { "q-index", "lf-delta", "partial-golden-update", "blit-pitch" }; if (is_vp7) { int i; *segment = 0; for (i = 0; i < 4; i++) { if (s->feature_enabled[i]) { if (vp56_rac_get_prob_branchy(c, s->feature_present_prob[i])) { int index = vp8_rac_get_tree(c, vp7_feature_index_tree, s->feature_index_prob[i]); av_log(s->avctx, AV_LOG_WARNING, "Feature %s present in macroblock (value 0x%x)\n", vp7_feature_name[i], s->feature_value[i][index]); } } } } else if (s->segmentation.update_map) { int bit = vp56_rac_get_prob(c, s->prob->segmentid[0]); *segment = vp56_rac_get_prob(c, s->prob->segmentid[1+bit]) + 2*bit; } else if (s->segmentation.enabled) *segment = ref ? *ref : *segment; mb->segment = *segment; mb->skip = s->mbskip_enabled ? vp56_rac_get_prob(c, s->prob->mbskip) : 0; if (s->keyframe) { mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_intra, vp8_pred16x16_prob_intra); if (mb->mode == MODE_I4x4) { decode_intra4x4_modes(s, c, mb, mb_x, 1, layout); } else { const uint32_t modes = (is_vp7 ? vp7_pred4x4_mode : vp8_pred4x4_mode)[mb->mode] * 0x01010101u; if (s->mb_layout) AV_WN32A(mb->intra4x4_pred_mode_top, modes); else AV_WN32A(s->intra4x4_pred_mode_top + 4 * mb_x, modes); AV_WN32A(s->intra4x4_pred_mode_left, modes); } mb->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, vp8_pred8x8c_prob_intra); mb->ref_frame = VP56_FRAME_CURRENT; } else if (vp56_rac_get_prob_branchy(c, s->prob->intra)) { if (vp56_rac_get_prob_branchy(c, s->prob->last)) mb->ref_frame = (!is_vp7 && vp56_rac_get_prob(c, s->prob->golden)) ? VP56_FRAME_GOLDEN2 : VP56_FRAME_GOLDEN; else mb->ref_frame = VP56_FRAME_PREVIOUS; s->ref_count[mb->ref_frame - 1]++; if (is_vp7) vp7_decode_mvs(s, mb, mb_x, mb_y, layout); else vp8_decode_mvs(s, mb, mb_x, mb_y, layout); } else { mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, s->prob->pred16x16); if (mb->mode == MODE_I4x4) decode_intra4x4_modes(s, c, mb, mb_x, 0, layout); mb->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, s->prob->pred8x8c); mb->ref_frame = VP56_FRAME_CURRENT; mb->partitioning = VP8_SPLITMVMODE_NONE; AV_ZERO32(&mb->bmv[0]); } }
{ "code": [ "void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y,", " vp8_decode_mvs(s, mb, mb_x, mb_y, layout);" ], "line_no": [ 1, 129 ] }
void FUNC_0(VP8Context *VAR_0, VP8Macroblock *VAR_1, int VAR_2, int VAR_3, uint8_t *VAR_4, uint8_t *VAR_5, int VAR_6, int VAR_7) { VP56RangeCoder *c = &VAR_0->c; static const char *VAR_8[] = { "q-VAR_10", "lf-delta", "partial-golden-update", "blit-pitch" }; if (VAR_7) { int VAR_9; *VAR_4 = 0; for (VAR_9 = 0; VAR_9 < 4; VAR_9++) { if (VAR_0->feature_enabled[VAR_9]) { if (vp56_rac_get_prob_branchy(c, VAR_0->feature_present_prob[VAR_9])) { int VAR_10 = vp8_rac_get_tree(c, vp7_feature_index_tree, VAR_0->feature_index_prob[VAR_9]); av_log(VAR_0->avctx, AV_LOG_WARNING, "Feature %VAR_0 present in macroblock (value 0x%x)\n", VAR_8[VAR_9], VAR_0->feature_value[VAR_9][VAR_10]); } } } } else if (VAR_0->segmentation.update_map) { int VAR_11 = vp56_rac_get_prob(c, VAR_0->prob->segmentid[0]); *VAR_4 = vp56_rac_get_prob(c, VAR_0->prob->segmentid[1+VAR_11]) + 2*VAR_11; } else if (VAR_0->segmentation.enabled) *VAR_4 = VAR_5 ? *VAR_5 : *VAR_4; VAR_1->VAR_4 = *VAR_4; VAR_1->skip = VAR_0->mbskip_enabled ? vp56_rac_get_prob(c, VAR_0->prob->mbskip) : 0; if (VAR_0->keyframe) { VAR_1->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_intra, vp8_pred16x16_prob_intra); if (VAR_1->mode == MODE_I4x4) { decode_intra4x4_modes(VAR_0, c, VAR_1, VAR_2, 1, VAR_6); } else { const uint32_t VAR_12 = (VAR_7 ? vp7_pred4x4_mode : vp8_pred4x4_mode)[VAR_1->mode] * 0x01010101u; if (VAR_0->mb_layout) AV_WN32A(VAR_1->intra4x4_pred_mode_top, VAR_12); else AV_WN32A(VAR_0->intra4x4_pred_mode_top + 4 * VAR_2, VAR_12); AV_WN32A(VAR_0->intra4x4_pred_mode_left, VAR_12); } VAR_1->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, vp8_pred8x8c_prob_intra); VAR_1->ref_frame = VP56_FRAME_CURRENT; } else if (vp56_rac_get_prob_branchy(c, VAR_0->prob->intra)) { if (vp56_rac_get_prob_branchy(c, VAR_0->prob->last)) VAR_1->ref_frame = (!VAR_7 && vp56_rac_get_prob(c, VAR_0->prob->golden)) ? VP56_FRAME_GOLDEN2 : VP56_FRAME_GOLDEN; else VAR_1->ref_frame = VP56_FRAME_PREVIOUS; VAR_0->ref_count[VAR_1->ref_frame - 1]++; if (VAR_7) vp7_decode_mvs(VAR_0, VAR_1, VAR_2, VAR_3, VAR_6); else vp8_decode_mvs(VAR_0, VAR_1, VAR_2, VAR_3, VAR_6); } else { VAR_1->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, VAR_0->prob->pred16x16); if (VAR_1->mode == MODE_I4x4) decode_intra4x4_modes(VAR_0, c, VAR_1, VAR_2, 0, VAR_6); VAR_1->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, VAR_0->prob->pred8x8c); VAR_1->ref_frame = VP56_FRAME_CURRENT; VAR_1->partitioning = VP8_SPLITMVMODE_NONE; AV_ZERO32(&VAR_1->bmv[0]); } }
[ "void FUNC_0(VP8Context *VAR_0, VP8Macroblock *VAR_1, int VAR_2, int VAR_3,\nuint8_t *VAR_4, uint8_t *VAR_5, int VAR_6, int VAR_7)\n{", "VP56RangeCoder *c = &VAR_0->c;", "static const char *VAR_8[] = { \"q-VAR_10\",", "\"lf-delta\",\n\"partial-golden-update\",\n\"blit-pitch\" };", "if (VAR_7) {", "int VAR_9;", "*VAR_4 = 0;", "for (VAR_9 = 0; VAR_9 < 4; VAR_9++) {", "if (VAR_0->feature_enabled[VAR_9]) {", "if (vp56_rac_get_prob_branchy(c, VAR_0->feature_present_prob[VAR_9])) {", "int VAR_10 = vp8_rac_get_tree(c, vp7_feature_index_tree,\nVAR_0->feature_index_prob[VAR_9]);", "av_log(VAR_0->avctx, AV_LOG_WARNING,\n\"Feature %VAR_0 present in macroblock (value 0x%x)\\n\",\nVAR_8[VAR_9], VAR_0->feature_value[VAR_9][VAR_10]);", "}", "}", "}", "} else if (VAR_0->segmentation.update_map) {", "int VAR_11 = vp56_rac_get_prob(c, VAR_0->prob->segmentid[0]);", "*VAR_4 = vp56_rac_get_prob(c, VAR_0->prob->segmentid[1+VAR_11]) + 2*VAR_11;", "} else if (VAR_0->segmentation.enabled)", "*VAR_4 = VAR_5 ? *VAR_5 : *VAR_4;", "VAR_1->VAR_4 = *VAR_4;", "VAR_1->skip = VAR_0->mbskip_enabled ? vp56_rac_get_prob(c, VAR_0->prob->mbskip) : 0;", "if (VAR_0->keyframe) {", "VAR_1->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_intra,\nvp8_pred16x16_prob_intra);", "if (VAR_1->mode == MODE_I4x4) {", "decode_intra4x4_modes(VAR_0, c, VAR_1, VAR_2, 1, VAR_6);", "} else {", "const uint32_t VAR_12 = (VAR_7 ? vp7_pred4x4_mode\n: vp8_pred4x4_mode)[VAR_1->mode] * 0x01010101u;", "if (VAR_0->mb_layout)\nAV_WN32A(VAR_1->intra4x4_pred_mode_top, VAR_12);", "else\nAV_WN32A(VAR_0->intra4x4_pred_mode_top + 4 * VAR_2, VAR_12);", "AV_WN32A(VAR_0->intra4x4_pred_mode_left, VAR_12);", "}", "VAR_1->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree,\nvp8_pred8x8c_prob_intra);", "VAR_1->ref_frame = VP56_FRAME_CURRENT;", "} else if (vp56_rac_get_prob_branchy(c, VAR_0->prob->intra)) {", "if (vp56_rac_get_prob_branchy(c, VAR_0->prob->last))\nVAR_1->ref_frame =\n(!VAR_7 && vp56_rac_get_prob(c, VAR_0->prob->golden)) ? VP56_FRAME_GOLDEN2\n: VP56_FRAME_GOLDEN;", "else\nVAR_1->ref_frame = VP56_FRAME_PREVIOUS;", "VAR_0->ref_count[VAR_1->ref_frame - 1]++;", "if (VAR_7)\nvp7_decode_mvs(VAR_0, VAR_1, VAR_2, VAR_3, VAR_6);", "else\nvp8_decode_mvs(VAR_0, VAR_1, VAR_2, VAR_3, VAR_6);", "} else {", "VAR_1->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, VAR_0->prob->pred16x16);", "if (VAR_1->mode == MODE_I4x4)\ndecode_intra4x4_modes(VAR_0, c, VAR_1, VAR_2, 0, VAR_6);", "VAR_1->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree,\nVAR_0->prob->pred8x8c);", "VAR_1->ref_frame = VP56_FRAME_CURRENT;", "VAR_1->partitioning = VP8_SPLITMVMODE_NONE;", "AV_ZERO32(&VAR_1->bmv[0]);", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 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 ], [ 59 ], [ 63 ], [ 65, 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81, 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 105, 107, 109, 111 ], [ 113, 115 ], [ 117 ], [ 123, 125 ], [ 127, 129 ], [ 131 ], [ 135 ], [ 139, 141 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ] ]
10,595
static void asfrtp_close_context(PayloadContext *asf) { ffio_free_dyn_buf(&asf->pktbuf); av_freep(&asf->buf); av_free(asf); }
true
FFmpeg
1dc19729e92a96620000e09eba8e58cb458c9486
static void asfrtp_close_context(PayloadContext *asf) { ffio_free_dyn_buf(&asf->pktbuf); av_freep(&asf->buf); av_free(asf); }
{ "code": [ " av_free(asf);" ], "line_no": [ 9 ] }
static void FUNC_0(PayloadContext *VAR_0) { ffio_free_dyn_buf(&VAR_0->pktbuf); av_freep(&VAR_0->buf); av_free(VAR_0); }
[ "static void FUNC_0(PayloadContext *VAR_0)\n{", "ffio_free_dyn_buf(&VAR_0->pktbuf);", "av_freep(&VAR_0->buf);", "av_free(VAR_0);", "}" ]
[ 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
10,597
static av_cold int dilate_init(AVFilterContext *ctx, const char *args) { OCVContext *ocv = ctx->priv; DilateContext *dilate = ocv->priv; char default_kernel_str[] = "3x3+0x0/rect"; char *kernel_str; const char *buf = args; int ret; dilate->nb_iterations = 1; if (args) kernel_str = av_get_token(&buf, "|"); if ((ret = parse_iplconvkernel(&dilate->kernel, *kernel_str ? kernel_str : default_kernel_str, ctx)) < 0) return ret; av_free(kernel_str); sscanf(buf, "|%d", &dilate->nb_iterations); av_log(ctx, AV_LOG_VERBOSE, "iterations_nb:%d\n", dilate->nb_iterations); if (dilate->nb_iterations <= 0) { av_log(ctx, AV_LOG_ERROR, "Invalid non-positive value '%d' for nb_iterations\n", dilate->nb_iterations); return AVERROR(EINVAL); } return 0; }
true
FFmpeg
f16a6f667c993a158643b52815ec42961508b0a9
static av_cold int dilate_init(AVFilterContext *ctx, const char *args) { OCVContext *ocv = ctx->priv; DilateContext *dilate = ocv->priv; char default_kernel_str[] = "3x3+0x0/rect"; char *kernel_str; const char *buf = args; int ret; dilate->nb_iterations = 1; if (args) kernel_str = av_get_token(&buf, "|"); if ((ret = parse_iplconvkernel(&dilate->kernel, *kernel_str ? kernel_str : default_kernel_str, ctx)) < 0) return ret; av_free(kernel_str); sscanf(buf, "|%d", &dilate->nb_iterations); av_log(ctx, AV_LOG_VERBOSE, "iterations_nb:%d\n", dilate->nb_iterations); if (dilate->nb_iterations <= 0) { av_log(ctx, AV_LOG_ERROR, "Invalid non-positive value '%d' for nb_iterations\n", dilate->nb_iterations); return AVERROR(EINVAL); } return 0; }
{ "code": [ " dilate->nb_iterations = 1;", " if ((ret = parse_iplconvkernel(&dilate->kernel,", " *kernel_str ? kernel_str : default_kernel_str,", " ctx)) < 0)", " sscanf(buf, \"|%d\", &dilate->nb_iterations);" ], "line_no": [ 19, 27, 29, 31, 39 ] }
static av_cold int FUNC_0(AVFilterContext *ctx, const char *args) { OCVContext *ocv = ctx->priv; DilateContext *dilate = ocv->priv; char VAR_0[] = "3x3+0x0/rect"; char *VAR_1; const char *VAR_2 = args; int VAR_3; dilate->nb_iterations = 1; if (args) VAR_1 = av_get_token(&VAR_2, "|"); if ((VAR_3 = parse_iplconvkernel(&dilate->kernel, *VAR_1 ? VAR_1 : VAR_0, ctx)) < 0) return VAR_3; av_free(VAR_1); sscanf(VAR_2, "|%d", &dilate->nb_iterations); av_log(ctx, AV_LOG_VERBOSE, "iterations_nb:%d\n", dilate->nb_iterations); if (dilate->nb_iterations <= 0) { av_log(ctx, AV_LOG_ERROR, "Invalid non-positive value '%d' for nb_iterations\n", dilate->nb_iterations); return AVERROR(EINVAL); } return 0; }
[ "static av_cold int FUNC_0(AVFilterContext *ctx, const char *args)\n{", "OCVContext *ocv = ctx->priv;", "DilateContext *dilate = ocv->priv;", "char VAR_0[] = \"3x3+0x0/rect\";", "char *VAR_1;", "const char *VAR_2 = args;", "int VAR_3;", "dilate->nb_iterations = 1;", "if (args)\nVAR_1 = av_get_token(&VAR_2, \"|\");", "if ((VAR_3 = parse_iplconvkernel(&dilate->kernel,\n*VAR_1 ? VAR_1 : VAR_0,\nctx)) < 0)\nreturn VAR_3;", "av_free(VAR_1);", "sscanf(VAR_2, \"|%d\", &dilate->nb_iterations);", "av_log(ctx, AV_LOG_VERBOSE, \"iterations_nb:%d\\n\", dilate->nb_iterations);", "if (dilate->nb_iterations <= 0) {", "av_log(ctx, AV_LOG_ERROR, \"Invalid non-positive value '%d' for nb_iterations\\n\",\ndilate->nb_iterations);", "return AVERROR(EINVAL);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23, 25 ], [ 27, 29, 31, 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ] ]
10,598
BlockDriverState *bdrv_new(void) { BlockDriverState *bs; int i; bs = g_new0(BlockDriverState, 1); QLIST_INIT(&bs->dirty_bitmaps); for (i = 0; i < BLOCK_OP_TYPE_MAX; i++) { QLIST_INIT(&bs->op_blockers[i]); } notifier_with_return_list_init(&bs->before_write_notifiers); bs->refcnt = 1; bs->aio_context = qemu_get_aio_context(); QTAILQ_INSERT_TAIL(&all_bdrv_states, bs, bs_list); return bs; }
true
qemu
3ff2f67a7c24183fcbcfe1332e5223ac6f96438c
BlockDriverState *bdrv_new(void) { BlockDriverState *bs; int i; bs = g_new0(BlockDriverState, 1); QLIST_INIT(&bs->dirty_bitmaps); for (i = 0; i < BLOCK_OP_TYPE_MAX; i++) { QLIST_INIT(&bs->op_blockers[i]); } notifier_with_return_list_init(&bs->before_write_notifiers); bs->refcnt = 1; bs->aio_context = qemu_get_aio_context(); QTAILQ_INSERT_TAIL(&all_bdrv_states, bs, bs_list); return bs; }
{ "code": [], "line_no": [] }
BlockDriverState *FUNC_0(void) { BlockDriverState *bs; int VAR_0; bs = g_new0(BlockDriverState, 1); QLIST_INIT(&bs->dirty_bitmaps); for (VAR_0 = 0; VAR_0 < BLOCK_OP_TYPE_MAX; VAR_0++) { QLIST_INIT(&bs->op_blockers[VAR_0]); } notifier_with_return_list_init(&bs->before_write_notifiers); bs->refcnt = 1; bs->aio_context = qemu_get_aio_context(); QTAILQ_INSERT_TAIL(&all_bdrv_states, bs, bs_list); return bs; }
[ "BlockDriverState *FUNC_0(void)\n{", "BlockDriverState *bs;", "int VAR_0;", "bs = g_new0(BlockDriverState, 1);", "QLIST_INIT(&bs->dirty_bitmaps);", "for (VAR_0 = 0; VAR_0 < BLOCK_OP_TYPE_MAX; VAR_0++) {", "QLIST_INIT(&bs->op_blockers[VAR_0]);", "}", "notifier_with_return_list_init(&bs->before_write_notifiers);", "bs->refcnt = 1;", "bs->aio_context = qemu_get_aio_context();", "QTAILQ_INSERT_TAIL(&all_bdrv_states, bs, bs_list);", "return bs;", "}" ]
[ 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 ] ]
10,600
static inline void RENAME(bgr32ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width) { int i; assert(src1 == src2); for(i=0; i<width; i++) { const int a= ((uint32_t*)src1)[2*i+0]; const int e= ((uint32_t*)src1)[2*i+1]; const int l= (a&0xFF00FF) + (e&0xFF00FF); const int h= (a&0x00FF00) + (e&0x00FF00); const int b= l&0x3FF; const int g= h>>8; const int r= l>>16; dstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128; dstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128; } }
true
FFmpeg
2da0d70d5eebe42f9fcd27ee554419ebe2a5da06
static inline void RENAME(bgr32ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width) { int i; assert(src1 == src2); for(i=0; i<width; i++) { const int a= ((uint32_t*)src1)[2*i+0]; const int e= ((uint32_t*)src1)[2*i+1]; const int l= (a&0xFF00FF) + (e&0xFF00FF); const int h= (a&0x00FF00) + (e&0x00FF00); const int b= l&0x3FF; const int g= h>>8; const int r= l>>16; dstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128; dstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128; } }
{ "code": [ "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", " assert(src1 == src2);", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", " assert(src1 == src2);", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", " assert(src1 == src2);", "\tfor(i=0; i<width; i++)", "\t\tconst int a= ((uint32_t*)src1)[2*i+0];", "\t\tconst int e= ((uint32_t*)src1)[2*i+1];", "\t\tconst int l= (a&0xFF00FF) + (e&0xFF00FF);", "\t\tconst int h= (a&0x00FF00) + (e&0x00FF00);", " \t\tconst int b= l&0x3FF;", "\t\tconst int g= h>>8;", "\t\tconst int r= l>>16;", "\t\tdstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\t\tdstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\t\tdstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\t\tdstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128;", " assert(src1 == src2);", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\t\tconst int a= ((uint32_t*)src1)[2*i+0];", "\t\tconst int e= ((uint32_t*)src1)[2*i+1];", "\t\tconst int l= (a&0xFF00FF) + (e&0xFF00FF);", "\t\tconst int h= (a&0x00FF00) + (e&0x00FF00);", "\t\tconst int g= h>>8;", "\t\tdstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\t\tdstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\t\tdstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\t\tdstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", " assert(src1 == src2);", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", " assert(src1 == src2);", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", " assert(src1 == src2);", "\tfor(i=0; i<width; i++)", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;" ], "line_no": [ 5, 5, 5, 5, 9, 5, 9, 7, 5, 9, 5, 9, 7, 5, 9, 5, 7, 9, 13, 15, 17, 19, 21, 23, 25, 29, 31, 5, 9, 5, 9, 29, 31, 7, 5, 9, 5, 9, 5, 9, 5, 9, 5, 9, 5, 9, 13, 15, 17, 19, 23, 29, 31, 5, 9, 5, 9, 29, 31, 5, 9, 5, 7, 9, 5, 9, 5, 7, 9, 5, 9, 5, 7, 9, 5, 5, 5, 5, 5 ] }
static inline void FUNC_0(bgr32ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width) { int VAR_0; assert(src1 == src2); for(VAR_0=0; VAR_0<width; VAR_0++) { const int a= ((uint32_t*)src1)[2*VAR_0+0]; const int e= ((uint32_t*)src1)[2*VAR_0+1]; const int l= (a&0xFF00FF) + (e&0xFF00FF); const int h= (a&0x00FF00) + (e&0x00FF00); const int b= l&0x3FF; const int g= h>>8; const int r= l>>16; dstU[VAR_0]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128; dstV[VAR_0]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128; } }
[ "static inline void FUNC_0(bgr32ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)\n{", "int VAR_0;", "assert(src1 == src2);", "for(VAR_0=0; VAR_0<width; VAR_0++)", "{", "const int a= ((uint32_t*)src1)[2*VAR_0+0];", "const int e= ((uint32_t*)src1)[2*VAR_0+1];", "const int l= (a&0xFF00FF) + (e&0xFF00FF);", "const int h= (a&0x00FF00) + (e&0x00FF00);", "const int b= l&0x3FF;", "const int g= h>>8;", "const int r= l>>16;", "dstU[VAR_0]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128;", "dstV[VAR_0]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128;", "}", "}" ]
[ 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
10,601
static int qemu_rdma_init_ram_blocks(RDMAContext *rdma) { RDMALocalBlocks *local = &rdma->local_ram_blocks; assert(rdma->blockmap == NULL); rdma->blockmap = g_hash_table_new(g_direct_hash, g_direct_equal); memset(local, 0, sizeof *local); qemu_ram_foreach_block(qemu_rdma_init_one_block, rdma); DPRINTF("Allocated %d local ram block structures\n", local->nb_blocks); rdma->block = (RDMARemoteBlock *) g_malloc0(sizeof(RDMARemoteBlock) * rdma->local_ram_blocks.nb_blocks); local->init = true; return 0; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static int qemu_rdma_init_ram_blocks(RDMAContext *rdma) { RDMALocalBlocks *local = &rdma->local_ram_blocks; assert(rdma->blockmap == NULL); rdma->blockmap = g_hash_table_new(g_direct_hash, g_direct_equal); memset(local, 0, sizeof *local); qemu_ram_foreach_block(qemu_rdma_init_one_block, rdma); DPRINTF("Allocated %d local ram block structures\n", local->nb_blocks); rdma->block = (RDMARemoteBlock *) g_malloc0(sizeof(RDMARemoteBlock) * rdma->local_ram_blocks.nb_blocks); local->init = true; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(RDMAContext *VAR_0) { RDMALocalBlocks *local = &VAR_0->local_ram_blocks; assert(VAR_0->blockmap == NULL); VAR_0->blockmap = g_hash_table_new(g_direct_hash, g_direct_equal); memset(local, 0, sizeof *local); qemu_ram_foreach_block(qemu_rdma_init_one_block, VAR_0); DPRINTF("Allocated %d local ram block structures\n", local->nb_blocks); VAR_0->block = (RDMARemoteBlock *) g_malloc0(sizeof(RDMARemoteBlock) * VAR_0->local_ram_blocks.nb_blocks); local->init = true; return 0; }
[ "static int FUNC_0(RDMAContext *VAR_0)\n{", "RDMALocalBlocks *local = &VAR_0->local_ram_blocks;", "assert(VAR_0->blockmap == NULL);", "VAR_0->blockmap = g_hash_table_new(g_direct_hash, g_direct_equal);", "memset(local, 0, sizeof *local);", "qemu_ram_foreach_block(qemu_rdma_init_one_block, VAR_0);", "DPRINTF(\"Allocated %d local ram block structures\\n\", local->nb_blocks);", "VAR_0->block = (RDMARemoteBlock *) g_malloc0(sizeof(RDMARemoteBlock) *\nVAR_0->local_ram_blocks.nb_blocks);", "local->init = true;", "return 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 ] ]
10,602
static always_inline void gen_op_subfeo (void) { gen_op_move_T2_T0(); gen_op_subfe(); gen_op_check_subfo(); }
true
qemu
c3e10c7b4377c1cbc0a4fbc12312c2cf41c0cda7
static always_inline void gen_op_subfeo (void) { gen_op_move_T2_T0(); gen_op_subfe(); gen_op_check_subfo(); }
{ "code": [ " gen_op_move_T2_T0();", " gen_op_check_subfo();", " gen_op_move_T2_T0();", " gen_op_move_T2_T0();", " gen_op_check_subfo();", " gen_op_move_T2_T0();", " gen_op_move_T2_T0();", " gen_op_check_subfo();", " gen_op_move_T2_T0();" ], "line_no": [ 5, 9, 5, 5, 9, 5, 5, 9, 5 ] }
static always_inline void FUNC_0 (void) { gen_op_move_T2_T0(); gen_op_subfe(); gen_op_check_subfo(); }
[ "static always_inline void FUNC_0 (void)\n{", "gen_op_move_T2_T0();", "gen_op_subfe();", "gen_op_check_subfo();", "}" ]
[ 0, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
10,603
void commit_start(BlockDriverState *bs, BlockDriverState *base, BlockDriverState *top, int64_t speed, BlockdevOnError on_error, BlockDriverCompletionFunc *cb, void *opaque, Error **errp) { CommitBlockJob *s; BlockReopenQueue *reopen_queue = NULL; int orig_overlay_flags; int orig_base_flags; BlockDriverState *overlay_bs; Error *local_err = NULL; if ((on_error == BLOCKDEV_ON_ERROR_STOP || on_error == BLOCKDEV_ON_ERROR_ENOSPC) && !bdrv_iostatus_is_enabled(bs)) { error_set(errp, QERR_INVALID_PARAMETER_COMBINATION); return; } /* Once we support top == active layer, remove this check */ if (top == bs) { error_setg(errp, "Top image as the active layer is currently unsupported"); return; } if (top == base) { error_setg(errp, "Invalid files for merge: top and base are the same"); return; } /* top and base may be valid, but let's make sure that base is reachable * from top */ if (bdrv_find_backing_image(top, base->filename) != base) { error_setg(errp, "Base (%s) is not reachable from top (%s)", base->filename, top->filename); return; } overlay_bs = bdrv_find_overlay(bs, top); if (overlay_bs == NULL) { error_setg(errp, "Could not find overlay image for %s:", top->filename); return; } orig_base_flags = bdrv_get_flags(base); orig_overlay_flags = bdrv_get_flags(overlay_bs); /* convert base & overlay_bs to r/w, if necessary */ if (!(orig_base_flags & BDRV_O_RDWR)) { reopen_queue = bdrv_reopen_queue(reopen_queue, base, orig_base_flags | BDRV_O_RDWR); } if (!(orig_overlay_flags & BDRV_O_RDWR)) { reopen_queue = bdrv_reopen_queue(reopen_queue, overlay_bs, orig_overlay_flags | BDRV_O_RDWR); } if (reopen_queue) { bdrv_reopen_multiple(reopen_queue, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); return; } } s = block_job_create(&commit_job_type, bs, speed, cb, opaque, errp); if (!s) { return; } s->base = base; s->top = top; s->active = bs; s->base_flags = orig_base_flags; s->orig_overlay_flags = orig_overlay_flags; s->on_error = on_error; s->common.co = qemu_coroutine_create(commit_run); trace_commit_start(bs, base, top, s, s->common.co, opaque); qemu_coroutine_enter(s->common.co, s); }
true
qemu
d5208c45be38ab858db6ec5a5097aa1c1a8ebbc9
void commit_start(BlockDriverState *bs, BlockDriverState *base, BlockDriverState *top, int64_t speed, BlockdevOnError on_error, BlockDriverCompletionFunc *cb, void *opaque, Error **errp) { CommitBlockJob *s; BlockReopenQueue *reopen_queue = NULL; int orig_overlay_flags; int orig_base_flags; BlockDriverState *overlay_bs; Error *local_err = NULL; if ((on_error == BLOCKDEV_ON_ERROR_STOP || on_error == BLOCKDEV_ON_ERROR_ENOSPC) && !bdrv_iostatus_is_enabled(bs)) { error_set(errp, QERR_INVALID_PARAMETER_COMBINATION); return; } if (top == bs) { error_setg(errp, "Top image as the active layer is currently unsupported"); return; } if (top == base) { error_setg(errp, "Invalid files for merge: top and base are the same"); return; } if (bdrv_find_backing_image(top, base->filename) != base) { error_setg(errp, "Base (%s) is not reachable from top (%s)", base->filename, top->filename); return; } overlay_bs = bdrv_find_overlay(bs, top); if (overlay_bs == NULL) { error_setg(errp, "Could not find overlay image for %s:", top->filename); return; } orig_base_flags = bdrv_get_flags(base); orig_overlay_flags = bdrv_get_flags(overlay_bs); if (!(orig_base_flags & BDRV_O_RDWR)) { reopen_queue = bdrv_reopen_queue(reopen_queue, base, orig_base_flags | BDRV_O_RDWR); } if (!(orig_overlay_flags & BDRV_O_RDWR)) { reopen_queue = bdrv_reopen_queue(reopen_queue, overlay_bs, orig_overlay_flags | BDRV_O_RDWR); } if (reopen_queue) { bdrv_reopen_multiple(reopen_queue, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); return; } } s = block_job_create(&commit_job_type, bs, speed, cb, opaque, errp); if (!s) { return; } s->base = base; s->top = top; s->active = bs; s->base_flags = orig_base_flags; s->orig_overlay_flags = orig_overlay_flags; s->on_error = on_error; s->common.co = qemu_coroutine_create(commit_run); trace_commit_start(bs, base, top, s, s->common.co, opaque); qemu_coroutine_enter(s->common.co, s); }
{ "code": [ " if (bdrv_find_backing_image(top, base->filename) != base) {", " error_setg(errp,", " \"Base (%s) is not reachable from top (%s)\",", " base->filename, top->filename);" ], "line_no": [ 67, 43, 71, 73 ] }
void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1, BlockDriverState *VAR_2, int64_t VAR_3, BlockdevOnError VAR_4, BlockDriverCompletionFunc *VAR_5, void *VAR_6, Error **VAR_7) { CommitBlockJob *s; BlockReopenQueue *reopen_queue = NULL; int VAR_8; int VAR_9; BlockDriverState *overlay_bs; Error *local_err = NULL; if ((VAR_4 == BLOCKDEV_ON_ERROR_STOP || VAR_4 == BLOCKDEV_ON_ERROR_ENOSPC) && !bdrv_iostatus_is_enabled(VAR_0)) { error_set(VAR_7, QERR_INVALID_PARAMETER_COMBINATION); return; } if (VAR_2 == VAR_0) { error_setg(VAR_7, "Top image as the active layer is currently unsupported"); return; } if (VAR_2 == VAR_1) { error_setg(VAR_7, "Invalid files for merge: VAR_2 and VAR_1 are the same"); return; } if (bdrv_find_backing_image(VAR_2, VAR_1->filename) != VAR_1) { error_setg(VAR_7, "Base (%s) is not reachable from VAR_2 (%s)", VAR_1->filename, VAR_2->filename); return; } overlay_bs = bdrv_find_overlay(VAR_0, VAR_2); if (overlay_bs == NULL) { error_setg(VAR_7, "Could not find overlay image for %s:", VAR_2->filename); return; } VAR_9 = bdrv_get_flags(VAR_1); VAR_8 = bdrv_get_flags(overlay_bs); if (!(VAR_9 & BDRV_O_RDWR)) { reopen_queue = bdrv_reopen_queue(reopen_queue, VAR_1, VAR_9 | BDRV_O_RDWR); } if (!(VAR_8 & BDRV_O_RDWR)) { reopen_queue = bdrv_reopen_queue(reopen_queue, overlay_bs, VAR_8 | BDRV_O_RDWR); } if (reopen_queue) { bdrv_reopen_multiple(reopen_queue, &local_err); if (local_err != NULL) { error_propagate(VAR_7, local_err); return; } } s = block_job_create(&commit_job_type, VAR_0, VAR_3, VAR_5, VAR_6, VAR_7); if (!s) { return; } s->VAR_1 = VAR_1; s->VAR_2 = VAR_2; s->active = VAR_0; s->base_flags = VAR_9; s->VAR_8 = VAR_8; s->VAR_4 = VAR_4; s->common.co = qemu_coroutine_create(commit_run); trace_commit_start(VAR_0, VAR_1, VAR_2, s, s->common.co, VAR_6); qemu_coroutine_enter(s->common.co, s); }
[ "void FUNC_0(BlockDriverState *VAR_0, BlockDriverState *VAR_1,\nBlockDriverState *VAR_2, int64_t VAR_3,\nBlockdevOnError VAR_4, BlockDriverCompletionFunc *VAR_5,\nvoid *VAR_6, Error **VAR_7)\n{", "CommitBlockJob *s;", "BlockReopenQueue *reopen_queue = NULL;", "int VAR_8;", "int VAR_9;", "BlockDriverState *overlay_bs;", "Error *local_err = NULL;", "if ((VAR_4 == BLOCKDEV_ON_ERROR_STOP ||\nVAR_4 == BLOCKDEV_ON_ERROR_ENOSPC) &&\n!bdrv_iostatus_is_enabled(VAR_0)) {", "error_set(VAR_7, QERR_INVALID_PARAMETER_COMBINATION);", "return;", "}", "if (VAR_2 == VAR_0) {", "error_setg(VAR_7,\n\"Top image as the active layer is currently unsupported\");", "return;", "}", "if (VAR_2 == VAR_1) {", "error_setg(VAR_7, \"Invalid files for merge: VAR_2 and VAR_1 are the same\");", "return;", "}", "if (bdrv_find_backing_image(VAR_2, VAR_1->filename) != VAR_1) {", "error_setg(VAR_7,\n\"Base (%s) is not reachable from VAR_2 (%s)\",\nVAR_1->filename, VAR_2->filename);", "return;", "}", "overlay_bs = bdrv_find_overlay(VAR_0, VAR_2);", "if (overlay_bs == NULL) {", "error_setg(VAR_7, \"Could not find overlay image for %s:\", VAR_2->filename);", "return;", "}", "VAR_9 = bdrv_get_flags(VAR_1);", "VAR_8 = bdrv_get_flags(overlay_bs);", "if (!(VAR_9 & BDRV_O_RDWR)) {", "reopen_queue = bdrv_reopen_queue(reopen_queue, VAR_1,\nVAR_9 | BDRV_O_RDWR);", "}", "if (!(VAR_8 & BDRV_O_RDWR)) {", "reopen_queue = bdrv_reopen_queue(reopen_queue, overlay_bs,\nVAR_8 | BDRV_O_RDWR);", "}", "if (reopen_queue) {", "bdrv_reopen_multiple(reopen_queue, &local_err);", "if (local_err != NULL) {", "error_propagate(VAR_7, local_err);", "return;", "}", "}", "s = block_job_create(&commit_job_type, VAR_0, VAR_3, VAR_5, VAR_6, VAR_7);", "if (!s) {", "return;", "}", "s->VAR_1 = VAR_1;", "s->VAR_2 = VAR_2;", "s->active = VAR_0;", "s->base_flags = VAR_9;", "s->VAR_8 = VAR_8;", "s->VAR_4 = VAR_4;", "s->common.co = qemu_coroutine_create(commit_run);", "trace_commit_start(VAR_0, VAR_1, VAR_2, s, s->common.co, VAR_6);", "qemu_coroutine_enter(s->common.co, s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 67 ], [ 69, 71, 73 ], [ 75 ], [ 77 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ] ]
10,604
static void check_guest_output(const testdef_t *test, int fd) { bool output_ok = false; int i, nbr, pos = 0; char ch; /* Poll serial output... Wait at most 60 seconds */ for (i = 0; i < 6000; ++i) { while ((nbr = read(fd, &ch, 1)) == 1) { if (ch == test->expect[pos]) { pos += 1; if (test->expect[pos] == '\0') { /* We've reached the end of the expected string! */ output_ok = true; goto done; } } else { pos = 0; } } g_assert(nbr >= 0); g_usleep(10000); } done: g_assert(output_ok); }
true
qemu
92b540dac9fc3a572c7342edd0b073000f5a6abf
static void check_guest_output(const testdef_t *test, int fd) { bool output_ok = false; int i, nbr, pos = 0; char ch; for (i = 0; i < 6000; ++i) { while ((nbr = read(fd, &ch, 1)) == 1) { if (ch == test->expect[pos]) { pos += 1; if (test->expect[pos] == '\0') { output_ok = true; goto done; } } else { pos = 0; } } g_assert(nbr >= 0); g_usleep(10000); } done: g_assert(output_ok); }
{ "code": [ " int i, nbr, pos = 0;", " while ((nbr = read(fd, &ch, 1)) == 1) {" ], "line_no": [ 7, 17 ] }
static void FUNC_0(const testdef_t *VAR_0, int VAR_1) { bool output_ok = false; int VAR_2, VAR_3, VAR_4 = 0; char VAR_5; for (VAR_2 = 0; VAR_2 < 6000; ++VAR_2) { while ((VAR_3 = read(VAR_1, &VAR_5, 1)) == 1) { if (VAR_5 == VAR_0->expect[VAR_4]) { VAR_4 += 1; if (VAR_0->expect[VAR_4] == '\0') { output_ok = true; goto done; } } else { VAR_4 = 0; } } g_assert(VAR_3 >= 0); g_usleep(10000); } done: g_assert(output_ok); }
[ "static void FUNC_0(const testdef_t *VAR_0, int VAR_1)\n{", "bool output_ok = false;", "int VAR_2, VAR_3, VAR_4 = 0;", "char VAR_5;", "for (VAR_2 = 0; VAR_2 < 6000; ++VAR_2) {", "while ((VAR_3 = read(VAR_1, &VAR_5, 1)) == 1) {", "if (VAR_5 == VAR_0->expect[VAR_4]) {", "VAR_4 += 1;", "if (VAR_0->expect[VAR_4] == '\\0') {", "output_ok = true;", "goto done;", "}", "} else {", "VAR_4 = 0;", "}", "}", "g_assert(VAR_3 >= 0);", "g_usleep(10000);", "}", "done:\ng_assert(output_ok);", "}" ]
[ 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 53 ] ]
10,605
static void do_subtitle_out(AVFormatContext *s, AVOutputStream *ost, AVInputStream *ist, AVSubtitle *sub, int64_t pts) { static uint8_t *subtitle_out = NULL; int subtitle_out_max_size = 65536; int subtitle_out_size, nb, i; AVCodecContext *enc; AVPacket pkt; if (pts == AV_NOPTS_VALUE) { fprintf(stderr, "Subtitle packets must have a pts\n"); if (exit_on_error) return; enc = ost->st->codec; if (!subtitle_out) { subtitle_out = av_malloc(subtitle_out_max_size); /* Note: DVB subtitle need one packet to draw them and one other packet to clear them */ /* XXX: signal it in the codec context ? */ if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) nb = 2; else nb = 1; for(i = 0; i < nb; i++) { sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q); subtitle_out_size = avcodec_encode_subtitle(enc, subtitle_out, subtitle_out_max_size, sub); av_init_packet(&pkt); pkt.stream_index = ost->index; pkt.data = subtitle_out; pkt.size = subtitle_out_size; pkt.pts = av_rescale_q(pts, ist->st->time_base, ost->st->time_base); if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) { /* XXX: the pts correction is handled here. Maybe handling it in the codec would be better */ if (i == 0) pkt.pts += 90 * sub->start_display_time; else pkt.pts += 90 * sub->end_display_time; write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]);
true
FFmpeg
266649a52fe258c09bbe5d2e222431c6a864af3f
static void do_subtitle_out(AVFormatContext *s, AVOutputStream *ost, AVInputStream *ist, AVSubtitle *sub, int64_t pts) { static uint8_t *subtitle_out = NULL; int subtitle_out_max_size = 65536; int subtitle_out_size, nb, i; AVCodecContext *enc; AVPacket pkt; if (pts == AV_NOPTS_VALUE) { fprintf(stderr, "Subtitle packets must have a pts\n"); if (exit_on_error) return; enc = ost->st->codec; if (!subtitle_out) { subtitle_out = av_malloc(subtitle_out_max_size); if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) nb = 2; else nb = 1; for(i = 0; i < nb; i++) { sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q); subtitle_out_size = avcodec_encode_subtitle(enc, subtitle_out, subtitle_out_max_size, sub); av_init_packet(&pkt); pkt.stream_index = ost->index; pkt.data = subtitle_out; pkt.size = subtitle_out_size; pkt.pts = av_rescale_q(pts, ist->st->time_base, ost->st->time_base); if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) { if (i == 0) pkt.pts += 90 * sub->start_display_time; else pkt.pts += 90 * sub->end_display_time; write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]);
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, AVOutputStream *VAR_1, AVInputStream *VAR_2, AVSubtitle *VAR_3, int64_t VAR_4) { static uint8_t *VAR_5 = NULL; int VAR_6 = 65536; int VAR_7, VAR_8, VAR_9; AVCodecContext *enc; AVPacket pkt; if (VAR_4 == AV_NOPTS_VALUE) { fprintf(stderr, "Subtitle packets must have a VAR_4\n"); if (exit_on_error) return; enc = VAR_1->st->codec; if (!VAR_5) { VAR_5 = av_malloc(VAR_6); if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) VAR_8 = 2; else VAR_8 = 1; for(VAR_9 = 0; VAR_9 < VAR_8; VAR_9++) { VAR_3->VAR_4 = av_rescale_q(VAR_4, VAR_2->st->time_base, AV_TIME_BASE_Q); VAR_7 = avcodec_encode_subtitle(enc, VAR_5, VAR_6, VAR_3); av_init_packet(&pkt); pkt.stream_index = VAR_1->index; pkt.data = VAR_5; pkt.size = VAR_7; pkt.VAR_4 = av_rescale_q(VAR_4, VAR_2->st->time_base, VAR_1->st->time_base); if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) { if (VAR_9 == 0) pkt.VAR_4 += 90 * VAR_3->start_display_time; else pkt.VAR_4 += 90 * VAR_3->end_display_time; write_frame(VAR_0, &pkt, VAR_1->st->codec, bitstream_filters[VAR_1->file_index][pkt.stream_index]);
[ "static void FUNC_0(AVFormatContext *VAR_0,\nAVOutputStream *VAR_1,\nAVInputStream *VAR_2,\nAVSubtitle *VAR_3,\nint64_t VAR_4)\n{", "static uint8_t *VAR_5 = NULL;", "int VAR_6 = 65536;", "int VAR_7, VAR_8, VAR_9;", "AVCodecContext *enc;", "AVPacket pkt;", "if (VAR_4 == AV_NOPTS_VALUE) {", "fprintf(stderr, \"Subtitle packets must have a VAR_4\\n\");", "if (exit_on_error)\nreturn;", "enc = VAR_1->st->codec;", "if (!VAR_5) {", "VAR_5 = av_malloc(VAR_6);", "if (enc->codec_id == CODEC_ID_DVB_SUBTITLE)\nVAR_8 = 2;", "else\nVAR_8 = 1;", "for(VAR_9 = 0; VAR_9 < VAR_8; VAR_9++) {", "VAR_3->VAR_4 = av_rescale_q(VAR_4, VAR_2->st->time_base, AV_TIME_BASE_Q);", "VAR_7 = avcodec_encode_subtitle(enc, VAR_5,\nVAR_6, VAR_3);", "av_init_packet(&pkt);", "pkt.stream_index = VAR_1->index;", "pkt.data = VAR_5;", "pkt.size = VAR_7;", "pkt.VAR_4 = av_rescale_q(VAR_4, VAR_2->st->time_base, VAR_1->st->time_base);", "if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) {", "if (VAR_9 == 0)\npkt.VAR_4 += 90 * VAR_3->start_display_time;", "else\npkt.VAR_4 += 90 * VAR_3->end_display_time;", "write_frame(VAR_0, &pkt, VAR_1->st->codec, bitstream_filters[VAR_1->file_index][pkt.stream_index]);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29, 32 ], [ 37 ], [ 41 ], [ 43 ], [ 54, 56 ], [ 58, 60 ], [ 64 ], [ 66 ], [ 68, 70 ], [ 78 ], [ 80 ], [ 82 ], [ 84 ], [ 86 ], [ 88 ], [ 94, 96 ], [ 98, 100 ], [ 103 ] ]
10,607
static int handle_sw_breakpoint(S390CPU *cpu, struct kvm_run *run) { CPUS390XState *env = &cpu->env; unsigned long pc; cpu_synchronize_state(CPU(cpu)); pc = env->psw.addr - 4; if (kvm_find_sw_breakpoint(CPU(cpu), pc)) { env->psw.addr = pc; return EXCP_DEBUG; } return -ENOENT; }
true
qemu
b60fae32ff33cbaab76d14cc5f55b979cf58516d
static int handle_sw_breakpoint(S390CPU *cpu, struct kvm_run *run) { CPUS390XState *env = &cpu->env; unsigned long pc; cpu_synchronize_state(CPU(cpu)); pc = env->psw.addr - 4; if (kvm_find_sw_breakpoint(CPU(cpu), pc)) { env->psw.addr = pc; return EXCP_DEBUG; } return -ENOENT; }
{ "code": [ " pc = env->psw.addr - 4;" ], "line_no": [ 15 ] }
static int FUNC_0(S390CPU *VAR_0, struct kvm_run *VAR_1) { CPUS390XState *env = &VAR_0->env; unsigned long VAR_2; cpu_synchronize_state(CPU(VAR_0)); VAR_2 = env->psw.addr - 4; if (kvm_find_sw_breakpoint(CPU(VAR_0), VAR_2)) { env->psw.addr = VAR_2; return EXCP_DEBUG; } return -ENOENT; }
[ "static int FUNC_0(S390CPU *VAR_0, struct kvm_run *VAR_1)\n{", "CPUS390XState *env = &VAR_0->env;", "unsigned long VAR_2;", "cpu_synchronize_state(CPU(VAR_0));", "VAR_2 = env->psw.addr - 4;", "if (kvm_find_sw_breakpoint(CPU(VAR_0), VAR_2)) {", "env->psw.addr = VAR_2;", "return EXCP_DEBUG;", "}", "return -ENOENT;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
10,610
static void vhost_dev_sync_region(struct vhost_dev *dev, MemoryRegionSection *section, uint64_t mfirst, uint64_t mlast, uint64_t rfirst, uint64_t rlast) { uint64_t start = MAX(mfirst, rfirst); uint64_t end = MIN(mlast, rlast); vhost_log_chunk_t *from = dev->log + start / VHOST_LOG_CHUNK; vhost_log_chunk_t *to = dev->log + end / VHOST_LOG_CHUNK + 1; uint64_t addr = (start / VHOST_LOG_CHUNK) * VHOST_LOG_CHUNK; if (end < start) { return; } assert(end / VHOST_LOG_CHUNK < dev->log_size); assert(start / VHOST_LOG_CHUNK < dev->log_size); for (;from < to; ++from) { vhost_log_chunk_t log; int bit; /* We first check with non-atomic: much cheaper, * and we expect non-dirty to be the common case. */ if (!*from) { addr += VHOST_LOG_CHUNK; continue; } /* Data must be read atomically. We don't really * need the barrier semantics of __sync * builtins, but it's easier to use them than * roll our own. */ log = __sync_fetch_and_and(from, 0); while ((bit = sizeof(log) > sizeof(int) ? ffsll(log) : ffs(log))) { ram_addr_t ram_addr; bit -= 1; ram_addr = section->offset_within_region + bit * VHOST_LOG_PAGE; memory_region_set_dirty(section->mr, ram_addr, VHOST_LOG_PAGE); log &= ~(0x1ull << bit); } addr += VHOST_LOG_CHUNK; } }
true
qemu
6b37a23df98faa26391a93373930bfb15b943e00
static void vhost_dev_sync_region(struct vhost_dev *dev, MemoryRegionSection *section, uint64_t mfirst, uint64_t mlast, uint64_t rfirst, uint64_t rlast) { uint64_t start = MAX(mfirst, rfirst); uint64_t end = MIN(mlast, rlast); vhost_log_chunk_t *from = dev->log + start / VHOST_LOG_CHUNK; vhost_log_chunk_t *to = dev->log + end / VHOST_LOG_CHUNK + 1; uint64_t addr = (start / VHOST_LOG_CHUNK) * VHOST_LOG_CHUNK; if (end < start) { return; } assert(end / VHOST_LOG_CHUNK < dev->log_size); assert(start / VHOST_LOG_CHUNK < dev->log_size); for (;from < to; ++from) { vhost_log_chunk_t log; int bit; if (!*from) { addr += VHOST_LOG_CHUNK; continue; } log = __sync_fetch_and_and(from, 0); while ((bit = sizeof(log) > sizeof(int) ? ffsll(log) : ffs(log))) { ram_addr_t ram_addr; bit -= 1; ram_addr = section->offset_within_region + bit * VHOST_LOG_PAGE; memory_region_set_dirty(section->mr, ram_addr, VHOST_LOG_PAGE); log &= ~(0x1ull << bit); } addr += VHOST_LOG_CHUNK; } }
{ "code": [ " ram_addr_t ram_addr;", " ram_addr = section->offset_within_region + bit * VHOST_LOG_PAGE;", " memory_region_set_dirty(section->mr, ram_addr, VHOST_LOG_PAGE);" ], "line_no": [ 67, 71, 73 ] }
static void FUNC_0(struct vhost_dev *VAR_0, MemoryRegionSection *VAR_1, uint64_t VAR_2, uint64_t VAR_3, uint64_t VAR_4, uint64_t VAR_5) { uint64_t start = MAX(VAR_2, VAR_4); uint64_t end = MIN(VAR_3, VAR_5); vhost_log_chunk_t *from = VAR_0->log + start / VHOST_LOG_CHUNK; vhost_log_chunk_t *to = VAR_0->log + end / VHOST_LOG_CHUNK + 1; uint64_t addr = (start / VHOST_LOG_CHUNK) * VHOST_LOG_CHUNK; if (end < start) { return; } assert(end / VHOST_LOG_CHUNK < VAR_0->log_size); assert(start / VHOST_LOG_CHUNK < VAR_0->log_size); for (;from < to; ++from) { vhost_log_chunk_t log; int bit; if (!*from) { addr += VHOST_LOG_CHUNK; continue; } log = __sync_fetch_and_and(from, 0); while ((bit = sizeof(log) > sizeof(int) ? ffsll(log) : ffs(log))) { ram_addr_t ram_addr; bit -= 1; ram_addr = VAR_1->offset_within_region + bit * VHOST_LOG_PAGE; memory_region_set_dirty(VAR_1->mr, ram_addr, VHOST_LOG_PAGE); log &= ~(0x1ull << bit); } addr += VHOST_LOG_CHUNK; } }
[ "static void FUNC_0(struct vhost_dev *VAR_0,\nMemoryRegionSection *VAR_1,\nuint64_t VAR_2, uint64_t VAR_3,\nuint64_t VAR_4, uint64_t VAR_5)\n{", "uint64_t start = MAX(VAR_2, VAR_4);", "uint64_t end = MIN(VAR_3, VAR_5);", "vhost_log_chunk_t *from = VAR_0->log + start / VHOST_LOG_CHUNK;", "vhost_log_chunk_t *to = VAR_0->log + end / VHOST_LOG_CHUNK + 1;", "uint64_t addr = (start / VHOST_LOG_CHUNK) * VHOST_LOG_CHUNK;", "if (end < start) {", "return;", "}", "assert(end / VHOST_LOG_CHUNK < VAR_0->log_size);", "assert(start / VHOST_LOG_CHUNK < VAR_0->log_size);", "for (;from < to; ++from) {", "vhost_log_chunk_t log;", "int bit;", "if (!*from) {", "addr += VHOST_LOG_CHUNK;", "continue;", "}", "log = __sync_fetch_and_and(from, 0);", "while ((bit = sizeof(log) > sizeof(int) ?\nffsll(log) : ffs(log))) {", "ram_addr_t ram_addr;", "bit -= 1;", "ram_addr = VAR_1->offset_within_region + bit * VHOST_LOG_PAGE;", "memory_region_set_dirty(VAR_1->mr, ram_addr, VHOST_LOG_PAGE);", "log &= ~(0x1ull << bit);", "}", "addr += VHOST_LOG_CHUNK;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ] ]
10,612
int nbd_client_co_pdiscard(BlockDriverState *bs, int64_t offset, int count) { NBDClientSession *client = nbd_get_client_session(bs); NBDRequest request = { .type = NBD_CMD_TRIM, .from = offset, .len = count, }; NBDReply reply; ssize_t ret; if (!(client->nbdflags & NBD_FLAG_SEND_TRIM)) { return 0; } nbd_coroutine_start(client, &request); ret = nbd_co_send_request(bs, &request, NULL); if (ret < 0) { reply.error = -ret; } else { nbd_co_receive_reply(client, &request, &reply, NULL); } nbd_coroutine_end(bs, &request); return -reply.error; }
true
qemu
6bdcc018a6ed760b9dfe43539124e420aed83092
int nbd_client_co_pdiscard(BlockDriverState *bs, int64_t offset, int count) { NBDClientSession *client = nbd_get_client_session(bs); NBDRequest request = { .type = NBD_CMD_TRIM, .from = offset, .len = count, }; NBDReply reply; ssize_t ret; if (!(client->nbdflags & NBD_FLAG_SEND_TRIM)) { return 0; } nbd_coroutine_start(client, &request); ret = nbd_co_send_request(bs, &request, NULL); if (ret < 0) { reply.error = -ret; } else { nbd_co_receive_reply(client, &request, &reply, NULL); } nbd_coroutine_end(bs, &request); return -reply.error; }
{ "code": [ " nbd_coroutine_start(client, &request);", " nbd_coroutine_start(client, &request);", " nbd_coroutine_start(client, &request);", " nbd_coroutine_start(client, &request);", " nbd_coroutine_start(client, &request);" ], "line_no": [ 31, 31, 31, 31, 31 ] }
int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, int VAR_2) { NBDClientSession *client = nbd_get_client_session(VAR_0); NBDRequest request = { .type = NBD_CMD_TRIM, .from = VAR_1, .len = VAR_2, }; NBDReply reply; ssize_t ret; if (!(client->nbdflags & NBD_FLAG_SEND_TRIM)) { return 0; } nbd_coroutine_start(client, &request); ret = nbd_co_send_request(VAR_0, &request, NULL); if (ret < 0) { reply.error = -ret; } else { nbd_co_receive_reply(client, &request, &reply, NULL); } nbd_coroutine_end(VAR_0, &request); return -reply.error; }
[ "int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, int VAR_2)\n{", "NBDClientSession *client = nbd_get_client_session(VAR_0);", "NBDRequest request = {", ".type = NBD_CMD_TRIM,\n.from = VAR_1,\n.len = VAR_2,\n};", "NBDReply reply;", "ssize_t ret;", "if (!(client->nbdflags & NBD_FLAG_SEND_TRIM)) {", "return 0;", "}", "nbd_coroutine_start(client, &request);", "ret = nbd_co_send_request(VAR_0, &request, NULL);", "if (ret < 0) {", "reply.error = -ret;", "} else {", "nbd_co_receive_reply(client, &request, &reply, NULL);", "}", "nbd_coroutine_end(VAR_0, &request);", "return -reply.error;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ] ]
10,613
int qcow2_check_refcounts(BlockDriverState *bs) { BDRVQcowState *s = bs->opaque; int64_t size; int nb_clusters, refcount1, refcount2, i; QCowSnapshot *sn; uint16_t *refcount_table; int ret, errors = 0; size = bdrv_getlength(bs->file); nb_clusters = size_to_clusters(s, size); refcount_table = qemu_mallocz(nb_clusters * sizeof(uint16_t)); /* header */ errors += inc_refcounts(bs, refcount_table, nb_clusters, 0, s->cluster_size); /* current L1 table */ ret = check_refcounts_l1(bs, refcount_table, nb_clusters, s->l1_table_offset, s->l1_size, 1); if (ret < 0) { return ret; } errors += ret; /* snapshots */ for(i = 0; i < s->nb_snapshots; i++) { sn = s->snapshots + i; check_refcounts_l1(bs, refcount_table, nb_clusters, sn->l1_table_offset, sn->l1_size, 0); } errors += inc_refcounts(bs, refcount_table, nb_clusters, s->snapshots_offset, s->snapshots_size); /* refcount data */ errors += inc_refcounts(bs, refcount_table, nb_clusters, s->refcount_table_offset, s->refcount_table_size * sizeof(uint64_t)); for(i = 0; i < s->refcount_table_size; i++) { int64_t offset; offset = s->refcount_table[i]; /* Refcount blocks are cluster aligned */ if (offset & (s->cluster_size - 1)) { fprintf(stderr, "ERROR refcount block %d is not " "cluster aligned; refcount table entry corrupted\n", i); errors++; } if (offset != 0) { errors += inc_refcounts(bs, refcount_table, nb_clusters, offset, s->cluster_size); if (refcount_table[offset / s->cluster_size] != 1) { fprintf(stderr, "ERROR refcount block %d refcount=%d\n", i, refcount_table[offset / s->cluster_size]); } } } /* compare ref counts */ for(i = 0; i < nb_clusters; i++) { refcount1 = get_refcount(bs, i); if (refcount1 < 0) { fprintf(stderr, "Can't get refcount for cluster %d: %s\n", i, strerror(-refcount1)); } refcount2 = refcount_table[i]; if (refcount1 != refcount2) { fprintf(stderr, "ERROR cluster %d refcount=%d reference=%d\n", i, refcount1, refcount2); errors++; } } qemu_free(refcount_table); return errors; }
true
qemu
6882c8fa78dcc4882640d3e11232d995fda7d5c4
int qcow2_check_refcounts(BlockDriverState *bs) { BDRVQcowState *s = bs->opaque; int64_t size; int nb_clusters, refcount1, refcount2, i; QCowSnapshot *sn; uint16_t *refcount_table; int ret, errors = 0; size = bdrv_getlength(bs->file); nb_clusters = size_to_clusters(s, size); refcount_table = qemu_mallocz(nb_clusters * sizeof(uint16_t)); errors += inc_refcounts(bs, refcount_table, nb_clusters, 0, s->cluster_size); ret = check_refcounts_l1(bs, refcount_table, nb_clusters, s->l1_table_offset, s->l1_size, 1); if (ret < 0) { return ret; } errors += ret; for(i = 0; i < s->nb_snapshots; i++) { sn = s->snapshots + i; check_refcounts_l1(bs, refcount_table, nb_clusters, sn->l1_table_offset, sn->l1_size, 0); } errors += inc_refcounts(bs, refcount_table, nb_clusters, s->snapshots_offset, s->snapshots_size); errors += inc_refcounts(bs, refcount_table, nb_clusters, s->refcount_table_offset, s->refcount_table_size * sizeof(uint64_t)); for(i = 0; i < s->refcount_table_size; i++) { int64_t offset; offset = s->refcount_table[i]; if (offset & (s->cluster_size - 1)) { fprintf(stderr, "ERROR refcount block %d is not " "cluster aligned; refcount table entry corrupted\n", i); errors++; } if (offset != 0) { errors += inc_refcounts(bs, refcount_table, nb_clusters, offset, s->cluster_size); if (refcount_table[offset / s->cluster_size] != 1) { fprintf(stderr, "ERROR refcount block %d refcount=%d\n", i, refcount_table[offset / s->cluster_size]); } } } for(i = 0; i < nb_clusters; i++) { refcount1 = get_refcount(bs, i); if (refcount1 < 0) { fprintf(stderr, "Can't get refcount for cluster %d: %s\n", i, strerror(-refcount1)); } refcount2 = refcount_table[i]; if (refcount1 != refcount2) { fprintf(stderr, "ERROR cluster %d refcount=%d reference=%d\n", i, refcount1, refcount2); errors++; } } qemu_free(refcount_table); return errors; }
{ "code": [ " int64_t offset;", " if (refcount_table[offset / s->cluster_size] != 1) {", " i, refcount_table[offset / s->cluster_size]);" ], "line_no": [ 79, 105, 109 ] }
int FUNC_0(BlockDriverState *VAR_0) { BDRVQcowState *s = VAR_0->opaque; int64_t size; int VAR_1, VAR_2, VAR_3, VAR_4; QCowSnapshot *sn; uint16_t *refcount_table; int VAR_5, VAR_6 = 0; size = bdrv_getlength(VAR_0->file); VAR_1 = size_to_clusters(s, size); refcount_table = qemu_mallocz(VAR_1 * sizeof(uint16_t)); VAR_6 += inc_refcounts(VAR_0, refcount_table, VAR_1, 0, s->cluster_size); VAR_5 = check_refcounts_l1(VAR_0, refcount_table, VAR_1, s->l1_table_offset, s->l1_size, 1); if (VAR_5 < 0) { return VAR_5; } VAR_6 += VAR_5; for(VAR_4 = 0; VAR_4 < s->nb_snapshots; VAR_4++) { sn = s->snapshots + VAR_4; check_refcounts_l1(VAR_0, refcount_table, VAR_1, sn->l1_table_offset, sn->l1_size, 0); } VAR_6 += inc_refcounts(VAR_0, refcount_table, VAR_1, s->snapshots_offset, s->snapshots_size); VAR_6 += inc_refcounts(VAR_0, refcount_table, VAR_1, s->refcount_table_offset, s->refcount_table_size * sizeof(uint64_t)); for(VAR_4 = 0; VAR_4 < s->refcount_table_size; VAR_4++) { int64_t offset; offset = s->refcount_table[VAR_4]; if (offset & (s->cluster_size - 1)) { fprintf(stderr, "ERROR refcount block %d is not " "cluster aligned; refcount table entry corrupted\n", VAR_4); VAR_6++; } if (offset != 0) { VAR_6 += inc_refcounts(VAR_0, refcount_table, VAR_1, offset, s->cluster_size); if (refcount_table[offset / s->cluster_size] != 1) { fprintf(stderr, "ERROR refcount block %d refcount=%d\n", VAR_4, refcount_table[offset / s->cluster_size]); } } } for(VAR_4 = 0; VAR_4 < VAR_1; VAR_4++) { VAR_2 = get_refcount(VAR_0, VAR_4); if (VAR_2 < 0) { fprintf(stderr, "Can't get refcount for cluster %d: %s\n", VAR_4, strerror(-VAR_2)); } VAR_3 = refcount_table[VAR_4]; if (VAR_2 != VAR_3) { fprintf(stderr, "ERROR cluster %d refcount=%d reference=%d\n", VAR_4, VAR_2, VAR_3); VAR_6++; } } qemu_free(refcount_table); return VAR_6; }
[ "int FUNC_0(BlockDriverState *VAR_0)\n{", "BDRVQcowState *s = VAR_0->opaque;", "int64_t size;", "int VAR_1, VAR_2, VAR_3, VAR_4;", "QCowSnapshot *sn;", "uint16_t *refcount_table;", "int VAR_5, VAR_6 = 0;", "size = bdrv_getlength(VAR_0->file);", "VAR_1 = size_to_clusters(s, size);", "refcount_table = qemu_mallocz(VAR_1 * sizeof(uint16_t));", "VAR_6 += inc_refcounts(VAR_0, refcount_table, VAR_1,\n0, s->cluster_size);", "VAR_5 = check_refcounts_l1(VAR_0, refcount_table, VAR_1,\ns->l1_table_offset, s->l1_size, 1);", "if (VAR_5 < 0) {", "return VAR_5;", "}", "VAR_6 += VAR_5;", "for(VAR_4 = 0; VAR_4 < s->nb_snapshots; VAR_4++) {", "sn = s->snapshots + VAR_4;", "check_refcounts_l1(VAR_0, refcount_table, VAR_1,\nsn->l1_table_offset, sn->l1_size, 0);", "}", "VAR_6 += inc_refcounts(VAR_0, refcount_table, VAR_1,\ns->snapshots_offset, s->snapshots_size);", "VAR_6 += inc_refcounts(VAR_0, refcount_table, VAR_1,\ns->refcount_table_offset,\ns->refcount_table_size * sizeof(uint64_t));", "for(VAR_4 = 0; VAR_4 < s->refcount_table_size; VAR_4++) {", "int64_t offset;", "offset = s->refcount_table[VAR_4];", "if (offset & (s->cluster_size - 1)) {", "fprintf(stderr, \"ERROR refcount block %d is not \"\n\"cluster aligned; refcount table entry corrupted\\n\", VAR_4);", "VAR_6++;", "}", "if (offset != 0) {", "VAR_6 += inc_refcounts(VAR_0, refcount_table, VAR_1,\noffset, s->cluster_size);", "if (refcount_table[offset / s->cluster_size] != 1) {", "fprintf(stderr, \"ERROR refcount block %d refcount=%d\\n\",\nVAR_4, refcount_table[offset / s->cluster_size]);", "}", "}", "}", "for(VAR_4 = 0; VAR_4 < VAR_1; VAR_4++) {", "VAR_2 = get_refcount(VAR_0, VAR_4);", "if (VAR_2 < 0) {", "fprintf(stderr, \"Can't get refcount for cluster %d: %s\\n\",\nVAR_4, strerror(-VAR_2));", "}", "VAR_3 = refcount_table[VAR_4];", "if (VAR_2 != VAR_3) {", "fprintf(stderr, \"ERROR cluster %d refcount=%d reference=%d\\n\",\nVAR_4, VAR_2, VAR_3);", "VAR_6++;", "}", "}", "qemu_free(refcount_table);", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 29, 31 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63, 65 ], [ 71, 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 155 ], [ 157 ] ]
10,614
static int caf_write_trailer(AVFormatContext *s) { AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; if (pb->seekable) { CAFContext *caf = s->priv_data; int64_t file_size = avio_tell(pb); avio_seek(pb, caf->data, SEEK_SET); avio_wb64(pb, file_size - caf->data - 8); avio_seek(pb, file_size, SEEK_SET); if (!enc->block_align) { ffio_wfourcc(pb, "pakt"); avio_wb64(pb, caf->size_entries_used + 24); avio_wb64(pb, caf->packets); ///< mNumberPackets avio_wb64(pb, caf->packets * samples_per_packet(enc->codec_id, enc->channels)); ///< mNumberValidFrames avio_wb32(pb, 0); ///< mPrimingFrames avio_wb32(pb, 0); ///< mRemainderFrames avio_write(pb, caf->pkt_sizes, caf->size_entries_used); av_freep(&caf->pkt_sizes); caf->size_buffer_size = 0; } avio_flush(pb); } return 0; }
true
FFmpeg
c46400ddecab3a47e8f1aec9a405bbe2a321b06a
static int caf_write_trailer(AVFormatContext *s) { AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; if (pb->seekable) { CAFContext *caf = s->priv_data; int64_t file_size = avio_tell(pb); avio_seek(pb, caf->data, SEEK_SET); avio_wb64(pb, file_size - caf->data - 8); avio_seek(pb, file_size, SEEK_SET); if (!enc->block_align) { ffio_wfourcc(pb, "pakt"); avio_wb64(pb, caf->size_entries_used + 24); avio_wb64(pb, caf->packets); avio_wb64(pb, caf->packets * samples_per_packet(enc->codec_id, enc->channels)); avio_wb32(pb, 0); avio_wb32(pb, 0); avio_write(pb, caf->pkt_sizes, caf->size_entries_used); av_freep(&caf->pkt_sizes); caf->size_buffer_size = 0; } avio_flush(pb); } return 0; }
{ "code": [ " CAFContext *caf = s->priv_data;", " av_freep(&caf->pkt_sizes);" ], "line_no": [ 13, 41 ] }
static int FUNC_0(AVFormatContext *VAR_0) { AVIOContext *pb = VAR_0->pb; AVCodecContext *enc = VAR_0->streams[0]->codec; if (pb->seekable) { CAFContext *caf = VAR_0->priv_data; int64_t file_size = avio_tell(pb); avio_seek(pb, caf->data, SEEK_SET); avio_wb64(pb, file_size - caf->data - 8); avio_seek(pb, file_size, SEEK_SET); if (!enc->block_align) { ffio_wfourcc(pb, "pakt"); avio_wb64(pb, caf->size_entries_used + 24); avio_wb64(pb, caf->packets); avio_wb64(pb, caf->packets * samples_per_packet(enc->codec_id, enc->channels)); avio_wb32(pb, 0); avio_wb32(pb, 0); avio_write(pb, caf->pkt_sizes, caf->size_entries_used); av_freep(&caf->pkt_sizes); caf->size_buffer_size = 0; } avio_flush(pb); } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "AVIOContext *pb = VAR_0->pb;", "AVCodecContext *enc = VAR_0->streams[0]->codec;", "if (pb->seekable) {", "CAFContext *caf = VAR_0->priv_data;", "int64_t file_size = avio_tell(pb);", "avio_seek(pb, caf->data, SEEK_SET);", "avio_wb64(pb, file_size - caf->data - 8);", "avio_seek(pb, file_size, SEEK_SET);", "if (!enc->block_align) {", "ffio_wfourcc(pb, \"pakt\");", "avio_wb64(pb, caf->size_entries_used + 24);", "avio_wb64(pb, caf->packets);", "avio_wb64(pb, caf->packets * samples_per_packet(enc->codec_id, enc->channels));", "avio_wb32(pb, 0);", "avio_wb32(pb, 0);", "avio_write(pb, caf->pkt_sizes, caf->size_entries_used);", "av_freep(&caf->pkt_sizes);", "caf->size_buffer_size = 0;", "}", "avio_flush(pb);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
10,615
static void init_proc_970GX (CPUPPCState *env) { gen_spr_ne_601(env); gen_spr_7xx(env); /* Time base */ gen_tbl(env); /* Hardware implementation registers */ /* XXX : not implemented */ spr_register(env, SPR_HID0, "HID0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_clear, 0x60000000); /* XXX : not implemented */ spr_register(env, SPR_HID1, "HID1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_750_HID2, "HID2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_970_HID5, "HID5", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, #if defined(CONFIG_USER_ONLY) 0x00000080 #else 0x00000000 #endif ); /* Memory management */ /* XXX: not correct */ gen_low_BATs(env); #if 0 // TODO env->slb_nr = 32; #endif init_excp_970(env); env->dcache_line_size = 128; env->icache_line_size = 128; /* Allocate hardware IRQ controller */ ppc970_irq_init(env); }
true
qemu
12de9a396acbc95e25c5d60ed097cc55777eaaed
static void init_proc_970GX (CPUPPCState *env) { gen_spr_ne_601(env); gen_spr_7xx(env); gen_tbl(env); spr_register(env, SPR_HID0, "HID0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_clear, 0x60000000); spr_register(env, SPR_HID1, "HID1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_HID2, "HID2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_970_HID5, "HID5", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, #if defined(CONFIG_USER_ONLY) 0x00000080 #else 0x00000000 #endif ); gen_low_BATs(env); #if 0 env->slb_nr = 32; #endif init_excp_970(env); env->dcache_line_size = 128; env->icache_line_size = 128; ppc970_irq_init(env); }
{ "code": [ "#endif", "#else", "#endif", " env->slb_nr = 32;", " env->slb_nr = 32;", " env->slb_nr = 32;" ], "line_no": [ 61, 57, 61, 73, 73, 73 ] }
static void FUNC_0 (CPUPPCState *VAR_0) { gen_spr_ne_601(VAR_0); gen_spr_7xx(VAR_0); gen_tbl(VAR_0); spr_register(VAR_0, SPR_HID0, "HID0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_clear, 0x60000000); spr_register(VAR_0, SPR_HID1, "HID1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(VAR_0, SPR_750_HID2, "HID2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(VAR_0, SPR_970_HID5, "HID5", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, #if defined(CONFIG_USER_ONLY) 0x00000080 #else 0x00000000 #endif ); gen_low_BATs(VAR_0); #if 0 VAR_0->slb_nr = 32; #endif init_excp_970(VAR_0); VAR_0->dcache_line_size = 128; VAR_0->icache_line_size = 128; ppc970_irq_init(VAR_0); }
[ "static void FUNC_0 (CPUPPCState *VAR_0)\n{", "gen_spr_ne_601(VAR_0);", "gen_spr_7xx(VAR_0);", "gen_tbl(VAR_0);", "spr_register(VAR_0, SPR_HID0, \"HID0\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_clear,\n0x60000000);", "spr_register(VAR_0, SPR_HID1, \"HID1\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);", "spr_register(VAR_0, SPR_750_HID2, \"HID2\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);", "spr_register(VAR_0, SPR_970_HID5, \"HID5\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n#if defined(CONFIG_USER_ONLY)\n0x00000080\n#else\n0x00000000\n#endif\n);", "gen_low_BATs(VAR_0);", "#if 0\nVAR_0->slb_nr = 32;", "#endif\ninit_excp_970(VAR_0);", "VAR_0->dcache_line_size = 128;", "VAR_0->icache_line_size = 128;", "ppc970_irq_init(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17, 19, 21, 23 ], [ 27, 29, 31, 33 ], [ 37, 39, 41, 43 ], [ 47, 49, 51, 53, 55, 57, 59, 61, 63 ], [ 69 ], [ 71, 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ] ]
10,616
static int find_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end) { const uint8_t *buf_ptr; unsigned int v, v2; int val; int skipped = 0; buf_ptr = *pbuf_ptr; while (buf_ptr < buf_end) { v = *buf_ptr++; v2 = *buf_ptr; if ((v == 0xff) && (v2 >= 0xc0) && (v2 <= 0xfe) && buf_ptr < buf_end) { val = *buf_ptr++; goto found; } skipped++; } val = -1; found: av_dlog(NULL, "find_marker skipped %d bytes\n", skipped); *pbuf_ptr = buf_ptr; return val; }
true
FFmpeg
16a0d75c769a7df6f457b2200dbc9a7cc73798c6
static int find_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end) { const uint8_t *buf_ptr; unsigned int v, v2; int val; int skipped = 0; buf_ptr = *pbuf_ptr; while (buf_ptr < buf_end) { v = *buf_ptr++; v2 = *buf_ptr; if ((v == 0xff) && (v2 >= 0xc0) && (v2 <= 0xfe) && buf_ptr < buf_end) { val = *buf_ptr++; goto found; } skipped++; } val = -1; found: av_dlog(NULL, "find_marker skipped %d bytes\n", skipped); *pbuf_ptr = buf_ptr; return val; }
{ "code": [ " while (buf_ptr < buf_end) {" ], "line_no": [ 17 ] }
static int FUNC_0(const uint8_t **VAR_0, const uint8_t *VAR_1) { const uint8_t *VAR_2; unsigned int VAR_3, VAR_4; int VAR_5; int VAR_6 = 0; VAR_2 = *VAR_0; while (VAR_2 < VAR_1) { VAR_3 = *VAR_2++; VAR_4 = *VAR_2; if ((VAR_3 == 0xff) && (VAR_4 >= 0xc0) && (VAR_4 <= 0xfe) && VAR_2 < VAR_1) { VAR_5 = *VAR_2++; goto found; } VAR_6++; } VAR_5 = -1; found: av_dlog(NULL, "FUNC_0 VAR_6 %d bytes\n", VAR_6); *VAR_0 = VAR_2; return VAR_5; }
[ "static int FUNC_0(const uint8_t **VAR_0, const uint8_t *VAR_1)\n{", "const uint8_t *VAR_2;", "unsigned int VAR_3, VAR_4;", "int VAR_5;", "int VAR_6 = 0;", "VAR_2 = *VAR_0;", "while (VAR_2 < VAR_1) {", "VAR_3 = *VAR_2++;", "VAR_4 = *VAR_2;", "if ((VAR_3 == 0xff) && (VAR_4 >= 0xc0) && (VAR_4 <= 0xfe) && VAR_2 < VAR_1) {", "VAR_5 = *VAR_2++;", "goto found;", "}", "VAR_6++;", "}", "VAR_5 = -1;", "found:\nav_dlog(NULL, \"FUNC_0 VAR_6 %d bytes\\n\", VAR_6);", "*VAR_0 = VAR_2;", "return VAR_5;", "}" ]
[ 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 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ] ]
10,617
static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AVSContext *h = avctx->priv_data; MpegEncContext *s = &h->s; int input_size; const uint8_t *buf_end; const uint8_t *buf_ptr; AVFrame *picture = data; uint32_t stc = -1; s->avctx = avctx; if (buf_size == 0) { if (!s->low_delay && h->DPB[0].f.data[0]) { *data_size = sizeof(AVPicture); *picture = *(AVFrame *) &h->DPB[0]; } return 0; } buf_ptr = buf; buf_end = buf + buf_size; for(;;) { buf_ptr = ff_find_start_code(buf_ptr,buf_end, &stc); if(stc & 0xFFFFFE00) return FFMAX(0, buf_ptr - buf - s->parse_context.last_index); input_size = (buf_end - buf_ptr)*8; switch(stc) { case CAVS_START_CODE: init_get_bits(&s->gb, buf_ptr, input_size); decode_seq_header(h); break; case PIC_I_START_CODE: if(!h->got_keyframe) { if(h->DPB[0].f.data[0]) avctx->release_buffer(avctx, (AVFrame *)&h->DPB[0]); if(h->DPB[1].f.data[0]) avctx->release_buffer(avctx, (AVFrame *)&h->DPB[1]); h->got_keyframe = 1; } case PIC_PB_START_CODE: *data_size = 0; if(!h->got_keyframe) break; init_get_bits(&s->gb, buf_ptr, input_size); h->stc = stc; if(decode_pic(h)) break; *data_size = sizeof(AVPicture); if(h->pic_type != AV_PICTURE_TYPE_B) { if(h->DPB[1].f.data[0]) { *picture = *(AVFrame *) &h->DPB[1]; } else { *data_size = 0; } } else *picture = *(AVFrame *) &h->picture; break; case EXT_START_CODE: //mpeg_decode_extension(avctx,buf_ptr, input_size); break; case USER_START_CODE: //mpeg_decode_user_data(avctx,buf_ptr, input_size); break; default: if (stc <= SLICE_MAX_START_CODE) { init_get_bits(&s->gb, buf_ptr, input_size); decode_slice_header(h, &s->gb); } break; } } }
true
FFmpeg
4a71da0f3ab7f5542decd11c81994f849d5b2c78
static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AVSContext *h = avctx->priv_data; MpegEncContext *s = &h->s; int input_size; const uint8_t *buf_end; const uint8_t *buf_ptr; AVFrame *picture = data; uint32_t stc = -1; s->avctx = avctx; if (buf_size == 0) { if (!s->low_delay && h->DPB[0].f.data[0]) { *data_size = sizeof(AVPicture); *picture = *(AVFrame *) &h->DPB[0]; } return 0; } buf_ptr = buf; buf_end = buf + buf_size; for(;;) { buf_ptr = ff_find_start_code(buf_ptr,buf_end, &stc); if(stc & 0xFFFFFE00) return FFMAX(0, buf_ptr - buf - s->parse_context.last_index); input_size = (buf_end - buf_ptr)*8; switch(stc) { case CAVS_START_CODE: init_get_bits(&s->gb, buf_ptr, input_size); decode_seq_header(h); break; case PIC_I_START_CODE: if(!h->got_keyframe) { if(h->DPB[0].f.data[0]) avctx->release_buffer(avctx, (AVFrame *)&h->DPB[0]); if(h->DPB[1].f.data[0]) avctx->release_buffer(avctx, (AVFrame *)&h->DPB[1]); h->got_keyframe = 1; } case PIC_PB_START_CODE: *data_size = 0; if(!h->got_keyframe) break; init_get_bits(&s->gb, buf_ptr, input_size); h->stc = stc; if(decode_pic(h)) break; *data_size = sizeof(AVPicture); if(h->pic_type != AV_PICTURE_TYPE_B) { if(h->DPB[1].f.data[0]) { *picture = *(AVFrame *) &h->DPB[1]; } else { *data_size = 0; } } else *picture = *(AVFrame *) &h->picture; break; case EXT_START_CODE: break; case USER_START_CODE: break; default: if (stc <= SLICE_MAX_START_CODE) { init_get_bits(&s->gb, buf_ptr, input_size); decode_slice_header(h, &s->gb); } break; } } }
{ "code": [ " if(stc & 0xFFFFFE00)" ], "line_no": [ 53 ] }
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; AVSContext *h = VAR_0->priv_data; MpegEncContext *s = &h->s; int VAR_6; const uint8_t *VAR_7; const uint8_t *VAR_8; AVFrame *picture = VAR_1; uint32_t stc = -1; s->VAR_0 = VAR_0; if (VAR_5 == 0) { if (!s->low_delay && h->DPB[0].f.VAR_1[0]) { *VAR_2 = sizeof(AVPicture); *picture = *(AVFrame *) &h->DPB[0]; } return 0; } VAR_8 = VAR_4; VAR_7 = VAR_4 + VAR_5; for(;;) { VAR_8 = ff_find_start_code(VAR_8,VAR_7, &stc); if(stc & 0xFFFFFE00) return FFMAX(0, VAR_8 - VAR_4 - s->parse_context.last_index); VAR_6 = (VAR_7 - VAR_8)*8; switch(stc) { case CAVS_START_CODE: init_get_bits(&s->gb, VAR_8, VAR_6); decode_seq_header(h); break; case PIC_I_START_CODE: if(!h->got_keyframe) { if(h->DPB[0].f.VAR_1[0]) VAR_0->release_buffer(VAR_0, (AVFrame *)&h->DPB[0]); if(h->DPB[1].f.VAR_1[0]) VAR_0->release_buffer(VAR_0, (AVFrame *)&h->DPB[1]); h->got_keyframe = 1; } case PIC_PB_START_CODE: *VAR_2 = 0; if(!h->got_keyframe) break; init_get_bits(&s->gb, VAR_8, VAR_6); h->stc = stc; if(decode_pic(h)) break; *VAR_2 = sizeof(AVPicture); if(h->pic_type != AV_PICTURE_TYPE_B) { if(h->DPB[1].f.VAR_1[0]) { *picture = *(AVFrame *) &h->DPB[1]; } else { *VAR_2 = 0; } } else *picture = *(AVFrame *) &h->picture; break; case EXT_START_CODE: break; case USER_START_CODE: break; default: if (stc <= SLICE_MAX_START_CODE) { init_get_bits(&s->gb, VAR_8, VAR_6); decode_slice_header(h, &s->gb); } break; } } }
[ "static int FUNC_0(AVCodecContext * VAR_0,void *VAR_1, int *VAR_2,\nAVPacket *VAR_3) {", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "AVSContext *h = VAR_0->priv_data;", "MpegEncContext *s = &h->s;", "int VAR_6;", "const uint8_t *VAR_7;", "const uint8_t *VAR_8;", "AVFrame *picture = VAR_1;", "uint32_t stc = -1;", "s->VAR_0 = VAR_0;", "if (VAR_5 == 0) {", "if (!s->low_delay && h->DPB[0].f.VAR_1[0]) {", "*VAR_2 = sizeof(AVPicture);", "*picture = *(AVFrame *) &h->DPB[0];", "}", "return 0;", "}", "VAR_8 = VAR_4;", "VAR_7 = VAR_4 + VAR_5;", "for(;;) {", "VAR_8 = ff_find_start_code(VAR_8,VAR_7, &stc);", "if(stc & 0xFFFFFE00)\nreturn FFMAX(0, VAR_8 - VAR_4 - s->parse_context.last_index);", "VAR_6 = (VAR_7 - VAR_8)*8;", "switch(stc) {", "case CAVS_START_CODE:\ninit_get_bits(&s->gb, VAR_8, VAR_6);", "decode_seq_header(h);", "break;", "case PIC_I_START_CODE:\nif(!h->got_keyframe) {", "if(h->DPB[0].f.VAR_1[0])\nVAR_0->release_buffer(VAR_0, (AVFrame *)&h->DPB[0]);", "if(h->DPB[1].f.VAR_1[0])\nVAR_0->release_buffer(VAR_0, (AVFrame *)&h->DPB[1]);", "h->got_keyframe = 1;", "}", "case PIC_PB_START_CODE:\n*VAR_2 = 0;", "if(!h->got_keyframe)\nbreak;", "init_get_bits(&s->gb, VAR_8, VAR_6);", "h->stc = stc;", "if(decode_pic(h))\nbreak;", "*VAR_2 = sizeof(AVPicture);", "if(h->pic_type != AV_PICTURE_TYPE_B) {", "if(h->DPB[1].f.VAR_1[0]) {", "*picture = *(AVFrame *) &h->DPB[1];", "} else {", "*VAR_2 = 0;", "}", "} else", "*picture = *(AVFrame *) &h->picture;", "break;", "case EXT_START_CODE:\nbreak;", "case USER_START_CODE:\nbreak;", "default:\nif (stc <= SLICE_MAX_START_CODE) {", "init_get_bits(&s->gb, VAR_8, VAR_6);", "decode_slice_header(h, &s->gb);", "}", "break;", "}", "}", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73, 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 125 ], [ 127, 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ] ]
10,618
static int get_pci_config_device(QEMUFile *f, void *pv, size_t size) { PCIDevice *s = container_of(pv, PCIDevice, config); uint8_t config[size]; int i; qemu_get_buffer(f, config, size); for (i = 0; i < size; ++i) if ((config[i] ^ s->config[i]) & s->cmask[i] & ~s->wmask[i]) return -EINVAL; memcpy(s->config, config, size); pci_update_mappings(s); return 0; }
true
qemu
05fcfada5e45b900c32ca6bccf0ce52cb5422509
static int get_pci_config_device(QEMUFile *f, void *pv, size_t size) { PCIDevice *s = container_of(pv, PCIDevice, config); uint8_t config[size]; int i; qemu_get_buffer(f, config, size); for (i = 0; i < size; ++i) if ((config[i] ^ s->config[i]) & s->cmask[i] & ~s->wmask[i]) return -EINVAL; memcpy(s->config, config, size); pci_update_mappings(s); return 0; }
{ "code": [ " uint8_t config[size];", " qemu_get_buffer(f, config, size);", " for (i = 0; i < size; ++i)", " memcpy(s->config, config, size);" ], "line_no": [ 7, 13, 15, 21 ] }
static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, size_t VAR_2) { PCIDevice *s = container_of(VAR_1, PCIDevice, config); uint8_t config[VAR_2]; int VAR_3; qemu_get_buffer(VAR_0, config, VAR_2); for (VAR_3 = 0; VAR_3 < VAR_2; ++VAR_3) if ((config[VAR_3] ^ s->config[VAR_3]) & s->cmask[VAR_3] & ~s->wmask[VAR_3]) return -EINVAL; memcpy(s->config, config, VAR_2); pci_update_mappings(s); return 0; }
[ "static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, size_t VAR_2)\n{", "PCIDevice *s = container_of(VAR_1, PCIDevice, config);", "uint8_t config[VAR_2];", "int VAR_3;", "qemu_get_buffer(VAR_0, config, VAR_2);", "for (VAR_3 = 0; VAR_3 < VAR_2; ++VAR_3)", "if ((config[VAR_3] ^ s->config[VAR_3]) & s->cmask[VAR_3] & ~s->wmask[VAR_3])\nreturn -EINVAL;", "memcpy(s->config, config, VAR_2);", "pci_update_mappings(s);", "return 0;", "}" ]
[ 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ] ]
10,619
static void update_md5_sum(FlacEncodeContext *s, const int16_t *samples) { #if HAVE_BIGENDIAN int i; for (i = 0; i < s->frame.blocksize * s->channels; i++) { int16_t smp = av_le2ne16(samples[i]); av_md5_update(s->md5ctx, (uint8_t *)&smp, 2); } #else av_md5_update(s->md5ctx, (const uint8_t *)samples, s->frame.blocksize*s->channels*2); #endif }
false
FFmpeg
6a744d261930f8101132bc6d207b6eac41d9cf18
static void update_md5_sum(FlacEncodeContext *s, const int16_t *samples) { #if HAVE_BIGENDIAN int i; for (i = 0; i < s->frame.blocksize * s->channels; i++) { int16_t smp = av_le2ne16(samples[i]); av_md5_update(s->md5ctx, (uint8_t *)&smp, 2); } #else av_md5_update(s->md5ctx, (const uint8_t *)samples, s->frame.blocksize*s->channels*2); #endif }
{ "code": [], "line_no": [] }
static void FUNC_0(FlacEncodeContext *VAR_0, const int16_t *VAR_1) { #if HAVE_BIGENDIAN int i; for (i = 0; i < VAR_0->frame.blocksize * VAR_0->channels; i++) { int16_t smp = av_le2ne16(VAR_1[i]); av_md5_update(VAR_0->md5ctx, (uint8_t *)&smp, 2); } #else av_md5_update(VAR_0->md5ctx, (const uint8_t *)VAR_1, VAR_0->frame.blocksize*VAR_0->channels*2); #endif }
[ "static void FUNC_0(FlacEncodeContext *VAR_0, const int16_t *VAR_1)\n{", "#if HAVE_BIGENDIAN\nint i;", "for (i = 0; i < VAR_0->frame.blocksize * VAR_0->channels; i++) {", "int16_t smp = av_le2ne16(VAR_1[i]);", "av_md5_update(VAR_0->md5ctx, (uint8_t *)&smp, 2);", "}", "#else\nav_md5_update(VAR_0->md5ctx, (const uint8_t *)VAR_1, VAR_0->frame.blocksize*VAR_0->channels*2);", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21, 23 ] ]
10,621
static int cuvid_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { CuvidContext *ctx = avctx->priv_data; AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)ctx->hwdevice->data; AVCUDADeviceContext *device_hwctx = device_ctx->hwctx; CUcontext dummy, cuda_ctx = device_hwctx->cuda_ctx; AVFrame *frame = data; CUVIDSOURCEDATAPACKET cupkt; AVPacket filter_packet = { 0 }; AVPacket filtered_packet = { 0 }; CUdeviceptr mapped_frame = 0; int ret = 0, eret = 0; if (ctx->bsf && avpkt->size) { if ((ret = av_packet_ref(&filter_packet, avpkt)) < 0) { av_log(avctx, AV_LOG_ERROR, "av_packet_ref failed\n"); return ret; } if ((ret = av_bsf_send_packet(ctx->bsf, &filter_packet)) < 0) { av_log(avctx, AV_LOG_ERROR, "av_bsf_send_packet failed\n"); av_packet_unref(&filter_packet); return ret; } if ((ret = av_bsf_receive_packet(ctx->bsf, &filtered_packet)) < 0) { av_log(avctx, AV_LOG_ERROR, "av_bsf_receive_packet failed\n"); return ret; } avpkt = &filtered_packet; } ret = CHECK_CU(cuCtxPushCurrent(cuda_ctx)); if (ret < 0) { av_packet_unref(&filtered_packet); return ret; } memset(&cupkt, 0, sizeof(cupkt)); if (avpkt->size) { cupkt.payload_size = avpkt->size; cupkt.payload = avpkt->data; if (avpkt->pts != AV_NOPTS_VALUE) { cupkt.flags = CUVID_PKT_TIMESTAMP; cupkt.timestamp = av_rescale_q(avpkt->pts, avctx->pkt_timebase, (AVRational){1, 10000000}); } } else { cupkt.flags = CUVID_PKT_ENDOFSTREAM; } ret = CHECK_CU(cuvidParseVideoData(ctx->cuparser, &cupkt)); av_packet_unref(&filtered_packet); if (ret < 0) { if (ctx->internal_error) ret = ctx->internal_error; goto error; } if (av_fifo_size(ctx->frame_queue)) { CUVIDPARSERDISPINFO dispinfo; CUVIDPROCPARAMS params; unsigned int pitch = 0; int offset = 0; int i; av_fifo_generic_read(ctx->frame_queue, &dispinfo, sizeof(CUVIDPARSERDISPINFO), NULL); memset(&params, 0, sizeof(params)); params.progressive_frame = dispinfo.progressive_frame; params.second_field = 0; params.top_field_first = dispinfo.top_field_first; ret = CHECK_CU(cuvidMapVideoFrame(ctx->cudecoder, dispinfo.picture_index, &mapped_frame, &pitch, &params)); if (ret < 0) goto error; if (avctx->pix_fmt == AV_PIX_FMT_CUDA) { ret = av_hwframe_get_buffer(ctx->hwframe, frame, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "av_hwframe_get_buffer failed\n"); goto error; } ret = ff_decode_frame_props(avctx, frame); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "ff_decode_frame_props failed\n"); goto error; } for (i = 0; i < 2; i++) { CUDA_MEMCPY2D cpy = { .srcMemoryType = CU_MEMORYTYPE_DEVICE, .dstMemoryType = CU_MEMORYTYPE_DEVICE, .srcDevice = mapped_frame, .dstDevice = (CUdeviceptr)frame->data[i], .srcPitch = pitch, .dstPitch = frame->linesize[i], .srcY = offset, .WidthInBytes = FFMIN(pitch, frame->linesize[i]), .Height = avctx->coded_height >> (i ? 1 : 0), }; ret = CHECK_CU(cuMemcpy2D(&cpy)); if (ret < 0) goto error; offset += avctx->coded_height; } } else if (avctx->pix_fmt == AV_PIX_FMT_NV12) { AVFrame *tmp_frame = av_frame_alloc(); if (!tmp_frame) { av_log(avctx, AV_LOG_ERROR, "av_frame_alloc failed\n"); ret = AVERROR(ENOMEM); goto error; } tmp_frame->format = AV_PIX_FMT_CUDA; tmp_frame->hw_frames_ctx = av_buffer_ref(ctx->hwframe); tmp_frame->data[0] = (uint8_t*)mapped_frame; tmp_frame->linesize[0] = pitch; tmp_frame->data[1] = (uint8_t*)(mapped_frame + avctx->coded_height * pitch); tmp_frame->linesize[1] = pitch; tmp_frame->width = avctx->width; tmp_frame->height = avctx->height; ret = ff_get_buffer(avctx, frame, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "ff_get_buffer failed\n"); av_frame_free(&tmp_frame); goto error; } ret = av_hwframe_transfer_data(frame, tmp_frame, 0); if (ret) { av_log(avctx, AV_LOG_ERROR, "av_hwframe_transfer_data failed\n"); av_frame_free(&tmp_frame); goto error; } av_frame_free(&tmp_frame); } else { ret = AVERROR_BUG; goto error; } frame->width = avctx->width; frame->height = avctx->height; frame->pts = av_rescale_q(dispinfo.timestamp, (AVRational){1, 10000000}, avctx->pkt_timebase); /* CUVIDs opaque reordering breaks the internal pkt logic. * So set pkt_pts and clear all the other pkt_ fields. */ frame->pkt_pts = frame->pts; av_frame_set_pkt_pos(frame, -1); av_frame_set_pkt_duration(frame, 0); av_frame_set_pkt_size(frame, -1); frame->interlaced_frame = !dispinfo.progressive_frame; if (!dispinfo.progressive_frame) frame->top_field_first = dispinfo.top_field_first; *got_frame = 1; } else { *got_frame = 0; } error: if (mapped_frame) eret = CHECK_CU(cuvidUnmapVideoFrame(ctx->cudecoder, mapped_frame)); eret = CHECK_CU(cuCtxPopCurrent(&dummy)); if (eret < 0) return eret; else return ret; }
false
FFmpeg
b91e0e59874d28f35a28acb4f886ab1e7d80cacb
static int cuvid_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { CuvidContext *ctx = avctx->priv_data; AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)ctx->hwdevice->data; AVCUDADeviceContext *device_hwctx = device_ctx->hwctx; CUcontext dummy, cuda_ctx = device_hwctx->cuda_ctx; AVFrame *frame = data; CUVIDSOURCEDATAPACKET cupkt; AVPacket filter_packet = { 0 }; AVPacket filtered_packet = { 0 }; CUdeviceptr mapped_frame = 0; int ret = 0, eret = 0; if (ctx->bsf && avpkt->size) { if ((ret = av_packet_ref(&filter_packet, avpkt)) < 0) { av_log(avctx, AV_LOG_ERROR, "av_packet_ref failed\n"); return ret; } if ((ret = av_bsf_send_packet(ctx->bsf, &filter_packet)) < 0) { av_log(avctx, AV_LOG_ERROR, "av_bsf_send_packet failed\n"); av_packet_unref(&filter_packet); return ret; } if ((ret = av_bsf_receive_packet(ctx->bsf, &filtered_packet)) < 0) { av_log(avctx, AV_LOG_ERROR, "av_bsf_receive_packet failed\n"); return ret; } avpkt = &filtered_packet; } ret = CHECK_CU(cuCtxPushCurrent(cuda_ctx)); if (ret < 0) { av_packet_unref(&filtered_packet); return ret; } memset(&cupkt, 0, sizeof(cupkt)); if (avpkt->size) { cupkt.payload_size = avpkt->size; cupkt.payload = avpkt->data; if (avpkt->pts != AV_NOPTS_VALUE) { cupkt.flags = CUVID_PKT_TIMESTAMP; cupkt.timestamp = av_rescale_q(avpkt->pts, avctx->pkt_timebase, (AVRational){1, 10000000}); } } else { cupkt.flags = CUVID_PKT_ENDOFSTREAM; } ret = CHECK_CU(cuvidParseVideoData(ctx->cuparser, &cupkt)); av_packet_unref(&filtered_packet); if (ret < 0) { if (ctx->internal_error) ret = ctx->internal_error; goto error; } if (av_fifo_size(ctx->frame_queue)) { CUVIDPARSERDISPINFO dispinfo; CUVIDPROCPARAMS params; unsigned int pitch = 0; int offset = 0; int i; av_fifo_generic_read(ctx->frame_queue, &dispinfo, sizeof(CUVIDPARSERDISPINFO), NULL); memset(&params, 0, sizeof(params)); params.progressive_frame = dispinfo.progressive_frame; params.second_field = 0; params.top_field_first = dispinfo.top_field_first; ret = CHECK_CU(cuvidMapVideoFrame(ctx->cudecoder, dispinfo.picture_index, &mapped_frame, &pitch, &params)); if (ret < 0) goto error; if (avctx->pix_fmt == AV_PIX_FMT_CUDA) { ret = av_hwframe_get_buffer(ctx->hwframe, frame, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "av_hwframe_get_buffer failed\n"); goto error; } ret = ff_decode_frame_props(avctx, frame); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "ff_decode_frame_props failed\n"); goto error; } for (i = 0; i < 2; i++) { CUDA_MEMCPY2D cpy = { .srcMemoryType = CU_MEMORYTYPE_DEVICE, .dstMemoryType = CU_MEMORYTYPE_DEVICE, .srcDevice = mapped_frame, .dstDevice = (CUdeviceptr)frame->data[i], .srcPitch = pitch, .dstPitch = frame->linesize[i], .srcY = offset, .WidthInBytes = FFMIN(pitch, frame->linesize[i]), .Height = avctx->coded_height >> (i ? 1 : 0), }; ret = CHECK_CU(cuMemcpy2D(&cpy)); if (ret < 0) goto error; offset += avctx->coded_height; } } else if (avctx->pix_fmt == AV_PIX_FMT_NV12) { AVFrame *tmp_frame = av_frame_alloc(); if (!tmp_frame) { av_log(avctx, AV_LOG_ERROR, "av_frame_alloc failed\n"); ret = AVERROR(ENOMEM); goto error; } tmp_frame->format = AV_PIX_FMT_CUDA; tmp_frame->hw_frames_ctx = av_buffer_ref(ctx->hwframe); tmp_frame->data[0] = (uint8_t*)mapped_frame; tmp_frame->linesize[0] = pitch; tmp_frame->data[1] = (uint8_t*)(mapped_frame + avctx->coded_height * pitch); tmp_frame->linesize[1] = pitch; tmp_frame->width = avctx->width; tmp_frame->height = avctx->height; ret = ff_get_buffer(avctx, frame, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "ff_get_buffer failed\n"); av_frame_free(&tmp_frame); goto error; } ret = av_hwframe_transfer_data(frame, tmp_frame, 0); if (ret) { av_log(avctx, AV_LOG_ERROR, "av_hwframe_transfer_data failed\n"); av_frame_free(&tmp_frame); goto error; } av_frame_free(&tmp_frame); } else { ret = AVERROR_BUG; goto error; } frame->width = avctx->width; frame->height = avctx->height; frame->pts = av_rescale_q(dispinfo.timestamp, (AVRational){1, 10000000}, avctx->pkt_timebase); frame->pkt_pts = frame->pts; av_frame_set_pkt_pos(frame, -1); av_frame_set_pkt_duration(frame, 0); av_frame_set_pkt_size(frame, -1); frame->interlaced_frame = !dispinfo.progressive_frame; if (!dispinfo.progressive_frame) frame->top_field_first = dispinfo.top_field_first; *got_frame = 1; } else { *got_frame = 0; } error: if (mapped_frame) eret = CHECK_CU(cuvidUnmapVideoFrame(ctx->cudecoder, mapped_frame)); eret = CHECK_CU(cuCtxPopCurrent(&dummy)); if (eret < 0) return eret; else return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { CuvidContext *ctx = VAR_0->priv_data; AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)ctx->hwdevice->VAR_1; AVCUDADeviceContext *device_hwctx = device_ctx->hwctx; CUcontext dummy, cuda_ctx = device_hwctx->cuda_ctx; AVFrame *frame = VAR_1; CUVIDSOURCEDATAPACKET cupkt; AVPacket filter_packet = { 0 }; AVPacket filtered_packet = { 0 }; CUdeviceptr mapped_frame = 0; int VAR_4 = 0, VAR_5 = 0; if (ctx->bsf && VAR_3->size) { if ((VAR_4 = av_packet_ref(&filter_packet, VAR_3)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "av_packet_ref failed\n"); return VAR_4; } if ((VAR_4 = av_bsf_send_packet(ctx->bsf, &filter_packet)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "av_bsf_send_packet failed\n"); av_packet_unref(&filter_packet); return VAR_4; } if ((VAR_4 = av_bsf_receive_packet(ctx->bsf, &filtered_packet)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "av_bsf_receive_packet failed\n"); return VAR_4; } VAR_3 = &filtered_packet; } VAR_4 = CHECK_CU(cuCtxPushCurrent(cuda_ctx)); if (VAR_4 < 0) { av_packet_unref(&filtered_packet); return VAR_4; } memset(&cupkt, 0, sizeof(cupkt)); if (VAR_3->size) { cupkt.payload_size = VAR_3->size; cupkt.payload = VAR_3->VAR_1; if (VAR_3->pts != AV_NOPTS_VALUE) { cupkt.flags = CUVID_PKT_TIMESTAMP; cupkt.timestamp = av_rescale_q(VAR_3->pts, VAR_0->pkt_timebase, (AVRational){1, 10000000}); } } else { cupkt.flags = CUVID_PKT_ENDOFSTREAM; } VAR_4 = CHECK_CU(cuvidParseVideoData(ctx->cuparser, &cupkt)); av_packet_unref(&filtered_packet); if (VAR_4 < 0) { if (ctx->internal_error) VAR_4 = ctx->internal_error; goto error; } if (av_fifo_size(ctx->frame_queue)) { CUVIDPARSERDISPINFO dispinfo; CUVIDPROCPARAMS params; unsigned int VAR_6 = 0; int VAR_7 = 0; int VAR_8; av_fifo_generic_read(ctx->frame_queue, &dispinfo, sizeof(CUVIDPARSERDISPINFO), NULL); memset(&params, 0, sizeof(params)); params.progressive_frame = dispinfo.progressive_frame; params.second_field = 0; params.top_field_first = dispinfo.top_field_first; VAR_4 = CHECK_CU(cuvidMapVideoFrame(ctx->cudecoder, dispinfo.picture_index, &mapped_frame, &VAR_6, &params)); if (VAR_4 < 0) goto error; if (VAR_0->pix_fmt == AV_PIX_FMT_CUDA) { VAR_4 = av_hwframe_get_buffer(ctx->hwframe, frame, 0); if (VAR_4 < 0) { av_log(VAR_0, AV_LOG_ERROR, "av_hwframe_get_buffer failed\n"); goto error; } VAR_4 = ff_decode_frame_props(VAR_0, frame); if (VAR_4 < 0) { av_log(VAR_0, AV_LOG_ERROR, "ff_decode_frame_props failed\n"); goto error; } for (VAR_8 = 0; VAR_8 < 2; VAR_8++) { CUDA_MEMCPY2D cpy = { .srcMemoryType = CU_MEMORYTYPE_DEVICE, .dstMemoryType = CU_MEMORYTYPE_DEVICE, .srcDevice = mapped_frame, .dstDevice = (CUdeviceptr)frame->VAR_1[VAR_8], .srcPitch = VAR_6, .dstPitch = frame->linesize[VAR_8], .srcY = VAR_7, .WidthInBytes = FFMIN(VAR_6, frame->linesize[VAR_8]), .Height = VAR_0->coded_height >> (VAR_8 ? 1 : 0), }; VAR_4 = CHECK_CU(cuMemcpy2D(&cpy)); if (VAR_4 < 0) goto error; VAR_7 += VAR_0->coded_height; } } else if (VAR_0->pix_fmt == AV_PIX_FMT_NV12) { AVFrame *tmp_frame = av_frame_alloc(); if (!tmp_frame) { av_log(VAR_0, AV_LOG_ERROR, "av_frame_alloc failed\n"); VAR_4 = AVERROR(ENOMEM); goto error; } tmp_frame->format = AV_PIX_FMT_CUDA; tmp_frame->hw_frames_ctx = av_buffer_ref(ctx->hwframe); tmp_frame->VAR_1[0] = (uint8_t*)mapped_frame; tmp_frame->linesize[0] = VAR_6; tmp_frame->VAR_1[1] = (uint8_t*)(mapped_frame + VAR_0->coded_height * VAR_6); tmp_frame->linesize[1] = VAR_6; tmp_frame->width = VAR_0->width; tmp_frame->height = VAR_0->height; VAR_4 = ff_get_buffer(VAR_0, frame, 0); if (VAR_4 < 0) { av_log(VAR_0, AV_LOG_ERROR, "ff_get_buffer failed\n"); av_frame_free(&tmp_frame); goto error; } VAR_4 = av_hwframe_transfer_data(frame, tmp_frame, 0); if (VAR_4) { av_log(VAR_0, AV_LOG_ERROR, "av_hwframe_transfer_data failed\n"); av_frame_free(&tmp_frame); goto error; } av_frame_free(&tmp_frame); } else { VAR_4 = AVERROR_BUG; goto error; } frame->width = VAR_0->width; frame->height = VAR_0->height; frame->pts = av_rescale_q(dispinfo.timestamp, (AVRational){1, 10000000}, VAR_0->pkt_timebase); frame->pkt_pts = frame->pts; av_frame_set_pkt_pos(frame, -1); av_frame_set_pkt_duration(frame, 0); av_frame_set_pkt_size(frame, -1); frame->interlaced_frame = !dispinfo.progressive_frame; if (!dispinfo.progressive_frame) frame->top_field_first = dispinfo.top_field_first; *VAR_2 = 1; } else { *VAR_2 = 0; } error: if (mapped_frame) VAR_5 = CHECK_CU(cuvidUnmapVideoFrame(ctx->cudecoder, mapped_frame)); VAR_5 = CHECK_CU(cuCtxPopCurrent(&dummy)); if (VAR_5 < 0) return VAR_5; else return VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3)\n{", "CuvidContext *ctx = VAR_0->priv_data;", "AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)ctx->hwdevice->VAR_1;", "AVCUDADeviceContext *device_hwctx = device_ctx->hwctx;", "CUcontext dummy, cuda_ctx = device_hwctx->cuda_ctx;", "AVFrame *frame = VAR_1;", "CUVIDSOURCEDATAPACKET cupkt;", "AVPacket filter_packet = { 0 };", "AVPacket filtered_packet = { 0 };", "CUdeviceptr mapped_frame = 0;", "int VAR_4 = 0, VAR_5 = 0;", "if (ctx->bsf && VAR_3->size) {", "if ((VAR_4 = av_packet_ref(&filter_packet, VAR_3)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"av_packet_ref failed\\n\");", "return VAR_4;", "}", "if ((VAR_4 = av_bsf_send_packet(ctx->bsf, &filter_packet)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"av_bsf_send_packet failed\\n\");", "av_packet_unref(&filter_packet);", "return VAR_4;", "}", "if ((VAR_4 = av_bsf_receive_packet(ctx->bsf, &filtered_packet)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"av_bsf_receive_packet failed\\n\");", "return VAR_4;", "}", "VAR_3 = &filtered_packet;", "}", "VAR_4 = CHECK_CU(cuCtxPushCurrent(cuda_ctx));", "if (VAR_4 < 0) {", "av_packet_unref(&filtered_packet);", "return VAR_4;", "}", "memset(&cupkt, 0, sizeof(cupkt));", "if (VAR_3->size) {", "cupkt.payload_size = VAR_3->size;", "cupkt.payload = VAR_3->VAR_1;", "if (VAR_3->pts != AV_NOPTS_VALUE) {", "cupkt.flags = CUVID_PKT_TIMESTAMP;", "cupkt.timestamp = av_rescale_q(VAR_3->pts, VAR_0->pkt_timebase, (AVRational){1, 10000000});", "}", "} else {", "cupkt.flags = CUVID_PKT_ENDOFSTREAM;", "}", "VAR_4 = CHECK_CU(cuvidParseVideoData(ctx->cuparser, &cupkt));", "av_packet_unref(&filtered_packet);", "if (VAR_4 < 0) {", "if (ctx->internal_error)\nVAR_4 = ctx->internal_error;", "goto error;", "}", "if (av_fifo_size(ctx->frame_queue)) {", "CUVIDPARSERDISPINFO dispinfo;", "CUVIDPROCPARAMS params;", "unsigned int VAR_6 = 0;", "int VAR_7 = 0;", "int VAR_8;", "av_fifo_generic_read(ctx->frame_queue, &dispinfo, sizeof(CUVIDPARSERDISPINFO), NULL);", "memset(&params, 0, sizeof(params));", "params.progressive_frame = dispinfo.progressive_frame;", "params.second_field = 0;", "params.top_field_first = dispinfo.top_field_first;", "VAR_4 = CHECK_CU(cuvidMapVideoFrame(ctx->cudecoder, dispinfo.picture_index, &mapped_frame, &VAR_6, &params));", "if (VAR_4 < 0)\ngoto error;", "if (VAR_0->pix_fmt == AV_PIX_FMT_CUDA) {", "VAR_4 = av_hwframe_get_buffer(ctx->hwframe, frame, 0);", "if (VAR_4 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"av_hwframe_get_buffer failed\\n\");", "goto error;", "}", "VAR_4 = ff_decode_frame_props(VAR_0, frame);", "if (VAR_4 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"ff_decode_frame_props failed\\n\");", "goto error;", "}", "for (VAR_8 = 0; VAR_8 < 2; VAR_8++) {", "CUDA_MEMCPY2D cpy = {", ".srcMemoryType = CU_MEMORYTYPE_DEVICE,\n.dstMemoryType = CU_MEMORYTYPE_DEVICE,\n.srcDevice = mapped_frame,\n.dstDevice = (CUdeviceptr)frame->VAR_1[VAR_8],\n.srcPitch = VAR_6,\n.dstPitch = frame->linesize[VAR_8],\n.srcY = VAR_7,\n.WidthInBytes = FFMIN(VAR_6, frame->linesize[VAR_8]),\n.Height = VAR_0->coded_height >> (VAR_8 ? 1 : 0),\n};", "VAR_4 = CHECK_CU(cuMemcpy2D(&cpy));", "if (VAR_4 < 0)\ngoto error;", "VAR_7 += VAR_0->coded_height;", "}", "} else if (VAR_0->pix_fmt == AV_PIX_FMT_NV12) {", "AVFrame *tmp_frame = av_frame_alloc();", "if (!tmp_frame) {", "av_log(VAR_0, AV_LOG_ERROR, \"av_frame_alloc failed\\n\");", "VAR_4 = AVERROR(ENOMEM);", "goto error;", "}", "tmp_frame->format = AV_PIX_FMT_CUDA;", "tmp_frame->hw_frames_ctx = av_buffer_ref(ctx->hwframe);", "tmp_frame->VAR_1[0] = (uint8_t*)mapped_frame;", "tmp_frame->linesize[0] = VAR_6;", "tmp_frame->VAR_1[1] = (uint8_t*)(mapped_frame + VAR_0->coded_height * VAR_6);", "tmp_frame->linesize[1] = VAR_6;", "tmp_frame->width = VAR_0->width;", "tmp_frame->height = VAR_0->height;", "VAR_4 = ff_get_buffer(VAR_0, frame, 0);", "if (VAR_4 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"ff_get_buffer failed\\n\");", "av_frame_free(&tmp_frame);", "goto error;", "}", "VAR_4 = av_hwframe_transfer_data(frame, tmp_frame, 0);", "if (VAR_4) {", "av_log(VAR_0, AV_LOG_ERROR, \"av_hwframe_transfer_data failed\\n\");", "av_frame_free(&tmp_frame);", "goto error;", "}", "av_frame_free(&tmp_frame);", "} else {", "VAR_4 = AVERROR_BUG;", "goto error;", "}", "frame->width = VAR_0->width;", "frame->height = VAR_0->height;", "frame->pts = av_rescale_q(dispinfo.timestamp, (AVRational){1, 10000000}, VAR_0->pkt_timebase);", "frame->pkt_pts = frame->pts;", "av_frame_set_pkt_pos(frame, -1);", "av_frame_set_pkt_duration(frame, 0);", "av_frame_set_pkt_size(frame, -1);", "frame->interlaced_frame = !dispinfo.progressive_frame;", "if (!dispinfo.progressive_frame)\nframe->top_field_first = dispinfo.top_field_first;", "*VAR_2 = 1;", "} else {", "*VAR_2 = 0;", "}", "error:\nif (mapped_frame)\nVAR_5 = CHECK_CU(cuvidUnmapVideoFrame(ctx->cudecoder, mapped_frame));", "VAR_5 = CHECK_CU(cuCtxPopCurrent(&dummy));", "if (VAR_5 < 0)\nreturn VAR_5;", "else\nreturn VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 111 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157, 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193, 195, 197, 199, 201, 203, 205, 207, 209, 211 ], [ 215 ], [ 217, 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 301 ], [ 303 ], [ 305 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 325 ], [ 329, 331 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 345, 347, 349 ], [ 353 ], [ 357, 359 ], [ 361, 363 ], [ 365 ] ]
10,623
static void intra_predict_mad_cow_dc_0lt_8x8_msa(uint8_t *src, int32_t stride) { uint8_t lp_cnt; uint32_t src0, src1, src2 = 0, src3; uint32_t out0, out1, out2, out3; v16u8 src_top; v8u16 add; v4u32 sum; src_top = LD_UB(src - stride); add = __msa_hadd_u_h(src_top, src_top); sum = __msa_hadd_u_w(add, add); src0 = __msa_copy_u_w((v4i32) sum, 0); src1 = __msa_copy_u_w((v4i32) sum, 1); for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) { src2 += src[(4 + lp_cnt) * stride - 1]; } src0 = (src0 + 2) >> 2; src3 = (src1 + src2 + 4) >> 3; src1 = (src1 + 2) >> 2; src2 = (src2 + 2) >> 2; out0 = src0 * 0x01010101; out1 = src1 * 0x01010101; out2 = src2 * 0x01010101; out3 = src3 * 0x01010101; for (lp_cnt = 4; lp_cnt--;) { SW(out0, src); SW(out1, src + 4); SW(out2, src + stride * 4); SW(out3, src + stride * 4 + 4); src += stride; } }
false
FFmpeg
d6737539e77e78fca9a04914d51996cfd1ccc55c
static void intra_predict_mad_cow_dc_0lt_8x8_msa(uint8_t *src, int32_t stride) { uint8_t lp_cnt; uint32_t src0, src1, src2 = 0, src3; uint32_t out0, out1, out2, out3; v16u8 src_top; v8u16 add; v4u32 sum; src_top = LD_UB(src - stride); add = __msa_hadd_u_h(src_top, src_top); sum = __msa_hadd_u_w(add, add); src0 = __msa_copy_u_w((v4i32) sum, 0); src1 = __msa_copy_u_w((v4i32) sum, 1); for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) { src2 += src[(4 + lp_cnt) * stride - 1]; } src0 = (src0 + 2) >> 2; src3 = (src1 + src2 + 4) >> 3; src1 = (src1 + 2) >> 2; src2 = (src2 + 2) >> 2; out0 = src0 * 0x01010101; out1 = src1 * 0x01010101; out2 = src2 * 0x01010101; out3 = src3 * 0x01010101; for (lp_cnt = 4; lp_cnt--;) { SW(out0, src); SW(out1, src + 4); SW(out2, src + stride * 4); SW(out3, src + stride * 4 + 4); src += stride; } }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, int32_t VAR_1) { uint8_t lp_cnt; uint32_t src0, src1, src2 = 0, src3; uint32_t out0, out1, out2, out3; v16u8 src_top; v8u16 add; v4u32 sum; src_top = LD_UB(VAR_0 - VAR_1); add = __msa_hadd_u_h(src_top, src_top); sum = __msa_hadd_u_w(add, add); src0 = __msa_copy_u_w((v4i32) sum, 0); src1 = __msa_copy_u_w((v4i32) sum, 1); for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) { src2 += VAR_0[(4 + lp_cnt) * VAR_1 - 1]; } src0 = (src0 + 2) >> 2; src3 = (src1 + src2 + 4) >> 3; src1 = (src1 + 2) >> 2; src2 = (src2 + 2) >> 2; out0 = src0 * 0x01010101; out1 = src1 * 0x01010101; out2 = src2 * 0x01010101; out3 = src3 * 0x01010101; for (lp_cnt = 4; lp_cnt--;) { SW(out0, VAR_0); SW(out1, VAR_0 + 4); SW(out2, VAR_0 + VAR_1 * 4); SW(out3, VAR_0 + VAR_1 * 4 + 4); VAR_0 += VAR_1; } }
[ "static void FUNC_0(uint8_t *VAR_0, int32_t VAR_1)\n{", "uint8_t lp_cnt;", "uint32_t src0, src1, src2 = 0, src3;", "uint32_t out0, out1, out2, out3;", "v16u8 src_top;", "v8u16 add;", "v4u32 sum;", "src_top = LD_UB(VAR_0 - VAR_1);", "add = __msa_hadd_u_h(src_top, src_top);", "sum = __msa_hadd_u_w(add, add);", "src0 = __msa_copy_u_w((v4i32) sum, 0);", "src1 = __msa_copy_u_w((v4i32) sum, 1);", "for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) {", "src2 += VAR_0[(4 + lp_cnt) * VAR_1 - 1];", "}", "src0 = (src0 + 2) >> 2;", "src3 = (src1 + src2 + 4) >> 3;", "src1 = (src1 + 2) >> 2;", "src2 = (src2 + 2) >> 2;", "out0 = src0 * 0x01010101;", "out1 = src1 * 0x01010101;", "out2 = src2 * 0x01010101;", "out3 = src3 * 0x01010101;", "for (lp_cnt = 4; lp_cnt--;) {", "SW(out0, VAR_0);", "SW(out1, VAR_0 + 4);", "SW(out2, VAR_0 + VAR_1 * 4);", "SW(out3, VAR_0 + VAR_1 * 4 + 4);", "VAR_0 += VAR_1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
10,624
static int img_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { VideoDemuxData *s1 = s->priv_data; if (timestamp < 0 || timestamp > s1->img_last - s1->img_first) return -1; s1->img_number = timestamp + s1->img_first; return 0; }
false
FFmpeg
05340be97bc395ca0b544c6d856469894ecbf5eb
static int img_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { VideoDemuxData *s1 = s->priv_data; if (timestamp < 0 || timestamp > s1->img_last - s1->img_first) return -1; s1->img_number = timestamp + s1->img_first; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3) { VideoDemuxData *s1 = VAR_0->priv_data; if (VAR_2 < 0 || VAR_2 > s1->img_last - s1->img_first) return -1; s1->img_number = VAR_2 + s1->img_first; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3)\n{", "VideoDemuxData *s1 = VAR_0->priv_data;", "if (VAR_2 < 0 || VAR_2 > s1->img_last - s1->img_first)\nreturn -1;", "s1->img_number = VAR_2 + s1->img_first;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ] ]
10,625
static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp, unsigned int channel, unsigned int filter) { FilterParams *fp = &m->channel_params[channel].filter_params[filter]; const int max_order = filter ? MAX_IIR_ORDER : MAX_FIR_ORDER; const char fchar = filter ? 'I' : 'F'; int i, order; // Filter is 0 for FIR, 1 for IIR. assert(filter < 2); m->filter_changed[channel][filter]++; order = get_bits(gbp, 4); if (order > max_order) { av_log(m->avctx, AV_LOG_ERROR, "%cIR filter order %d is greater than maximum %d.\n", fchar, order, max_order); return -1; } fp->order = order; if (order > 0) { int coeff_bits, coeff_shift; fp->shift = get_bits(gbp, 4); coeff_bits = get_bits(gbp, 5); coeff_shift = get_bits(gbp, 3); if (coeff_bits < 1 || coeff_bits > 16) { av_log(m->avctx, AV_LOG_ERROR, "%cIR filter coeff_bits must be between 1 and 16.\n", fchar); return -1; } if (coeff_bits + coeff_shift > 16) { av_log(m->avctx, AV_LOG_ERROR, "Sum of coeff_bits and coeff_shift for %cIR filter must be 16 or less.\n", fchar); return -1; } for (i = 0; i < order; i++) fp->coeff[i] = get_sbits(gbp, coeff_bits) << coeff_shift; if (get_bits1(gbp)) { int state_bits, state_shift; if (filter == FIR) { av_log(m->avctx, AV_LOG_ERROR, "FIR filter has state data specified.\n"); return -1; } state_bits = get_bits(gbp, 4); state_shift = get_bits(gbp, 4); /* TODO: Check validity of state data. */ for (i = 0; i < order; i++) fp->state[i] = get_sbits(gbp, state_bits) << state_shift; } } return 0; }
false
FFmpeg
5d9e4eaa6d991718b24c7ce24318ee91419f593a
static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp, unsigned int channel, unsigned int filter) { FilterParams *fp = &m->channel_params[channel].filter_params[filter]; const int max_order = filter ? MAX_IIR_ORDER : MAX_FIR_ORDER; const char fchar = filter ? 'I' : 'F'; int i, order; assert(filter < 2); m->filter_changed[channel][filter]++; order = get_bits(gbp, 4); if (order > max_order) { av_log(m->avctx, AV_LOG_ERROR, "%cIR filter order %d is greater than maximum %d.\n", fchar, order, max_order); return -1; } fp->order = order; if (order > 0) { int coeff_bits, coeff_shift; fp->shift = get_bits(gbp, 4); coeff_bits = get_bits(gbp, 5); coeff_shift = get_bits(gbp, 3); if (coeff_bits < 1 || coeff_bits > 16) { av_log(m->avctx, AV_LOG_ERROR, "%cIR filter coeff_bits must be between 1 and 16.\n", fchar); return -1; } if (coeff_bits + coeff_shift > 16) { av_log(m->avctx, AV_LOG_ERROR, "Sum of coeff_bits and coeff_shift for %cIR filter must be 16 or less.\n", fchar); return -1; } for (i = 0; i < order; i++) fp->coeff[i] = get_sbits(gbp, coeff_bits) << coeff_shift; if (get_bits1(gbp)) { int state_bits, state_shift; if (filter == FIR) { av_log(m->avctx, AV_LOG_ERROR, "FIR filter has state data specified.\n"); return -1; } state_bits = get_bits(gbp, 4); state_shift = get_bits(gbp, 4); for (i = 0; i < order; i++) fp->state[i] = get_sbits(gbp, state_bits) << state_shift; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MLPDecodeContext *VAR_0, GetBitContext *VAR_1, unsigned int VAR_2, unsigned int VAR_3) { FilterParams *fp = &VAR_0->channel_params[VAR_2].filter_params[VAR_3]; const int VAR_4 = VAR_3 ? MAX_IIR_ORDER : MAX_FIR_ORDER; const char VAR_5 = VAR_3 ? 'I' : 'F'; int VAR_6, VAR_7; assert(VAR_3 < 2); VAR_0->filter_changed[VAR_2][VAR_3]++; VAR_7 = get_bits(VAR_1, 4); if (VAR_7 > VAR_4) { av_log(VAR_0->avctx, AV_LOG_ERROR, "%cIR VAR_3 VAR_7 %d is greater than maximum %d.\n", VAR_5, VAR_7, VAR_4); return -1; } fp->VAR_7 = VAR_7; if (VAR_7 > 0) { int VAR_8, VAR_9; fp->shift = get_bits(VAR_1, 4); VAR_8 = get_bits(VAR_1, 5); VAR_9 = get_bits(VAR_1, 3); if (VAR_8 < 1 || VAR_8 > 16) { av_log(VAR_0->avctx, AV_LOG_ERROR, "%cIR VAR_3 VAR_8 must be between 1 and 16.\n", VAR_5); return -1; } if (VAR_8 + VAR_9 > 16) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Sum of VAR_8 and VAR_9 for %cIR VAR_3 must be 16 or less.\n", VAR_5); return -1; } for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++) fp->coeff[VAR_6] = get_sbits(VAR_1, VAR_8) << VAR_9; if (get_bits1(VAR_1)) { int VAR_10, VAR_11; if (VAR_3 == FIR) { av_log(VAR_0->avctx, AV_LOG_ERROR, "FIR VAR_3 has state data specified.\n"); return -1; } VAR_10 = get_bits(VAR_1, 4); VAR_11 = get_bits(VAR_1, 4); for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++) fp->state[VAR_6] = get_sbits(VAR_1, VAR_10) << VAR_11; } } return 0; }
[ "static int FUNC_0(MLPDecodeContext *VAR_0, GetBitContext *VAR_1,\nunsigned int VAR_2, unsigned int VAR_3)\n{", "FilterParams *fp = &VAR_0->channel_params[VAR_2].filter_params[VAR_3];", "const int VAR_4 = VAR_3 ? MAX_IIR_ORDER : MAX_FIR_ORDER;", "const char VAR_5 = VAR_3 ? 'I' : 'F';", "int VAR_6, VAR_7;", "assert(VAR_3 < 2);", "VAR_0->filter_changed[VAR_2][VAR_3]++;", "VAR_7 = get_bits(VAR_1, 4);", "if (VAR_7 > VAR_4) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"%cIR VAR_3 VAR_7 %d is greater than maximum %d.\\n\",\nVAR_5, VAR_7, VAR_4);", "return -1;", "}", "fp->VAR_7 = VAR_7;", "if (VAR_7 > 0) {", "int VAR_8, VAR_9;", "fp->shift = get_bits(VAR_1, 4);", "VAR_8 = get_bits(VAR_1, 5);", "VAR_9 = get_bits(VAR_1, 3);", "if (VAR_8 < 1 || VAR_8 > 16) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"%cIR VAR_3 VAR_8 must be between 1 and 16.\\n\",\nVAR_5);", "return -1;", "}", "if (VAR_8 + VAR_9 > 16) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Sum of VAR_8 and VAR_9 for %cIR VAR_3 must be 16 or less.\\n\",\nVAR_5);", "return -1;", "}", "for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++)", "fp->coeff[VAR_6] = get_sbits(VAR_1, VAR_8) << VAR_9;", "if (get_bits1(VAR_1)) {", "int VAR_10, VAR_11;", "if (VAR_3 == FIR) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"FIR VAR_3 has state data specified.\\n\");", "return -1;", "}", "VAR_10 = get_bits(VAR_1, 4);", "VAR_11 = get_bits(VAR_1, 4);", "for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++)", "fp->state[VAR_6] = get_sbits(VAR_1, VAR_10) << VAR_11;", "}", "}", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75, 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ] ]
10,626
static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; int size; int32_t yaw, pitch, roll; size_t l = 0, t = 0, r = 0, b = 0; size_t padding = 0; uint32_t tag; enum AVSphericalProjection projection; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams - 1]; sc = st->priv_data; if (atom.size < 8) { av_log(c->fc, AV_LOG_ERROR, "Empty spherical video box\n"); return AVERROR_INVALIDDATA; } size = avio_rb32(pb); if (size <= 12 || size > atom.size) return AVERROR_INVALIDDATA; tag = avio_rl32(pb); if (tag != MKTAG('s','v','h','d')) { av_log(c->fc, AV_LOG_ERROR, "Missing spherical video header\n"); return 0; } avio_skip(pb, 4); /* version + flags */ avio_skip(pb, size - 12); /* metadata_source */ size = avio_rb32(pb); if (size > atom.size) return AVERROR_INVALIDDATA; tag = avio_rl32(pb); if (tag != MKTAG('p','r','o','j')) { av_log(c->fc, AV_LOG_ERROR, "Missing projection box\n"); return 0; } size = avio_rb32(pb); if (size > atom.size) return AVERROR_INVALIDDATA; tag = avio_rl32(pb); if (tag != MKTAG('p','r','h','d')) { av_log(c->fc, AV_LOG_ERROR, "Missing projection header box\n"); return 0; } avio_skip(pb, 4); /* version + flags */ /* 16.16 fixed point */ yaw = avio_rb32(pb); pitch = avio_rb32(pb); roll = avio_rb32(pb); size = avio_rb32(pb); if (size > atom.size) return AVERROR_INVALIDDATA; tag = avio_rl32(pb); avio_skip(pb, 4); /* version + flags */ switch (tag) { case MKTAG('c','b','m','p'): projection = AV_SPHERICAL_CUBEMAP; padding = avio_rb32(pb); break; case MKTAG('e','q','u','i'): t = avio_rb32(pb); b = avio_rb32(pb); l = avio_rb32(pb); r = avio_rb32(pb); if (b >= UINT_MAX - t || r >= UINT_MAX - l) { av_log(c->fc, AV_LOG_ERROR, "Invalid bounding rectangle coordinates %"SIZE_SPECIFIER"," "%"SIZE_SPECIFIER",%"SIZE_SPECIFIER",%"SIZE_SPECIFIER"\n", l, t, r, b); return AVERROR_INVALIDDATA; } if (l || t || r || b) projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE; else projection = AV_SPHERICAL_EQUIRECTANGULAR; break; default: av_log(c->fc, AV_LOG_ERROR, "Unknown projection type\n"); return 0; } sc->spherical = av_spherical_alloc(&sc->spherical_size); if (!sc->spherical) return AVERROR(ENOMEM); sc->spherical->projection = projection; sc->spherical->yaw = yaw; sc->spherical->pitch = pitch; sc->spherical->roll = roll; sc->spherical->padding = padding; sc->spherical->bound_left = l; sc->spherical->bound_top = t; sc->spherical->bound_right = r; sc->spherical->bound_bottom = b; return 0; }
false
FFmpeg
ac8c72f8f1f758ae7606db42eac83d04418aec48
static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; int size; int32_t yaw, pitch, roll; size_t l = 0, t = 0, r = 0, b = 0; size_t padding = 0; uint32_t tag; enum AVSphericalProjection projection; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams - 1]; sc = st->priv_data; if (atom.size < 8) { av_log(c->fc, AV_LOG_ERROR, "Empty spherical video box\n"); return AVERROR_INVALIDDATA; } size = avio_rb32(pb); if (size <= 12 || size > atom.size) return AVERROR_INVALIDDATA; tag = avio_rl32(pb); if (tag != MKTAG('s','v','h','d')) { av_log(c->fc, AV_LOG_ERROR, "Missing spherical video header\n"); return 0; } avio_skip(pb, 4); avio_skip(pb, size - 12); size = avio_rb32(pb); if (size > atom.size) return AVERROR_INVALIDDATA; tag = avio_rl32(pb); if (tag != MKTAG('p','r','o','j')) { av_log(c->fc, AV_LOG_ERROR, "Missing projection box\n"); return 0; } size = avio_rb32(pb); if (size > atom.size) return AVERROR_INVALIDDATA; tag = avio_rl32(pb); if (tag != MKTAG('p','r','h','d')) { av_log(c->fc, AV_LOG_ERROR, "Missing projection header box\n"); return 0; } avio_skip(pb, 4); yaw = avio_rb32(pb); pitch = avio_rb32(pb); roll = avio_rb32(pb); size = avio_rb32(pb); if (size > atom.size) return AVERROR_INVALIDDATA; tag = avio_rl32(pb); avio_skip(pb, 4); switch (tag) { case MKTAG('c','b','m','p'): projection = AV_SPHERICAL_CUBEMAP; padding = avio_rb32(pb); break; case MKTAG('e','q','u','i'): t = avio_rb32(pb); b = avio_rb32(pb); l = avio_rb32(pb); r = avio_rb32(pb); if (b >= UINT_MAX - t || r >= UINT_MAX - l) { av_log(c->fc, AV_LOG_ERROR, "Invalid bounding rectangle coordinates %"SIZE_SPECIFIER"," "%"SIZE_SPECIFIER",%"SIZE_SPECIFIER",%"SIZE_SPECIFIER"\n", l, t, r, b); return AVERROR_INVALIDDATA; } if (l || t || r || b) projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE; else projection = AV_SPHERICAL_EQUIRECTANGULAR; break; default: av_log(c->fc, AV_LOG_ERROR, "Unknown projection type\n"); return 0; } sc->spherical = av_spherical_alloc(&sc->spherical_size); if (!sc->spherical) return AVERROR(ENOMEM); sc->spherical->projection = projection; sc->spherical->yaw = yaw; sc->spherical->pitch = pitch; sc->spherical->roll = roll; sc->spherical->padding = padding; sc->spherical->bound_left = l; sc->spherical->bound_top = t; sc->spherical->bound_right = r; sc->spherical->bound_bottom = b; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st; MOVStreamContext *sc; int VAR_3; int32_t yaw, pitch, roll; size_t l = 0, t = 0, r = 0, b = 0; size_t padding = 0; uint32_t tag; enum AVSphericalProjection VAR_4; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams - 1]; sc = st->priv_data; if (VAR_2.VAR_3 < 8) { av_log(VAR_0->fc, AV_LOG_ERROR, "Empty spherical video box\n"); return AVERROR_INVALIDDATA; } VAR_3 = avio_rb32(VAR_1); if (VAR_3 <= 12 || VAR_3 > VAR_2.VAR_3) return AVERROR_INVALIDDATA; tag = avio_rl32(VAR_1); if (tag != MKTAG('s','v','h','d')) { av_log(VAR_0->fc, AV_LOG_ERROR, "Missing spherical video header\n"); return 0; } avio_skip(VAR_1, 4); avio_skip(VAR_1, VAR_3 - 12); VAR_3 = avio_rb32(VAR_1); if (VAR_3 > VAR_2.VAR_3) return AVERROR_INVALIDDATA; tag = avio_rl32(VAR_1); if (tag != MKTAG('p','r','o','j')) { av_log(VAR_0->fc, AV_LOG_ERROR, "Missing VAR_4 box\n"); return 0; } VAR_3 = avio_rb32(VAR_1); if (VAR_3 > VAR_2.VAR_3) return AVERROR_INVALIDDATA; tag = avio_rl32(VAR_1); if (tag != MKTAG('p','r','h','d')) { av_log(VAR_0->fc, AV_LOG_ERROR, "Missing VAR_4 header box\n"); return 0; } avio_skip(VAR_1, 4); yaw = avio_rb32(VAR_1); pitch = avio_rb32(VAR_1); roll = avio_rb32(VAR_1); VAR_3 = avio_rb32(VAR_1); if (VAR_3 > VAR_2.VAR_3) return AVERROR_INVALIDDATA; tag = avio_rl32(VAR_1); avio_skip(VAR_1, 4); switch (tag) { case MKTAG('VAR_0','b','m','p'): VAR_4 = AV_SPHERICAL_CUBEMAP; padding = avio_rb32(VAR_1); break; case MKTAG('e','q','u','i'): t = avio_rb32(VAR_1); b = avio_rb32(VAR_1); l = avio_rb32(VAR_1); r = avio_rb32(VAR_1); if (b >= UINT_MAX - t || r >= UINT_MAX - l) { av_log(VAR_0->fc, AV_LOG_ERROR, "Invalid bounding rectangle coordinates %"SIZE_SPECIFIER"," "%"SIZE_SPECIFIER",%"SIZE_SPECIFIER",%"SIZE_SPECIFIER"\n", l, t, r, b); return AVERROR_INVALIDDATA; } if (l || t || r || b) VAR_4 = AV_SPHERICAL_EQUIRECTANGULAR_TILE; else VAR_4 = AV_SPHERICAL_EQUIRECTANGULAR; break; default: av_log(VAR_0->fc, AV_LOG_ERROR, "Unknown VAR_4 type\n"); return 0; } sc->spherical = av_spherical_alloc(&sc->spherical_size); if (!sc->spherical) return AVERROR(ENOMEM); sc->spherical->VAR_4 = VAR_4; sc->spherical->yaw = yaw; sc->spherical->pitch = pitch; sc->spherical->roll = roll; sc->spherical->padding = padding; sc->spherical->bound_left = l; sc->spherical->bound_top = t; sc->spherical->bound_right = r; sc->spherical->bound_bottom = b; return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st;", "MOVStreamContext *sc;", "int VAR_3;", "int32_t yaw, pitch, roll;", "size_t l = 0, t = 0, r = 0, b = 0;", "size_t padding = 0;", "uint32_t tag;", "enum AVSphericalProjection VAR_4;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams - 1];", "sc = st->priv_data;", "if (VAR_2.VAR_3 < 8) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"Empty spherical video box\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_3 = avio_rb32(VAR_1);", "if (VAR_3 <= 12 || VAR_3 > VAR_2.VAR_3)\nreturn AVERROR_INVALIDDATA;", "tag = avio_rl32(VAR_1);", "if (tag != MKTAG('s','v','h','d')) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"Missing spherical video header\\n\");", "return 0;", "}", "avio_skip(VAR_1, 4);", "avio_skip(VAR_1, VAR_3 - 12);", "VAR_3 = avio_rb32(VAR_1);", "if (VAR_3 > VAR_2.VAR_3)\nreturn AVERROR_INVALIDDATA;", "tag = avio_rl32(VAR_1);", "if (tag != MKTAG('p','r','o','j')) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"Missing VAR_4 box\\n\");", "return 0;", "}", "VAR_3 = avio_rb32(VAR_1);", "if (VAR_3 > VAR_2.VAR_3)\nreturn AVERROR_INVALIDDATA;", "tag = avio_rl32(VAR_1);", "if (tag != MKTAG('p','r','h','d')) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"Missing VAR_4 header box\\n\");", "return 0;", "}", "avio_skip(VAR_1, 4);", "yaw = avio_rb32(VAR_1);", "pitch = avio_rb32(VAR_1);", "roll = avio_rb32(VAR_1);", "VAR_3 = avio_rb32(VAR_1);", "if (VAR_3 > VAR_2.VAR_3)\nreturn AVERROR_INVALIDDATA;", "tag = avio_rl32(VAR_1);", "avio_skip(VAR_1, 4);", "switch (tag) {", "case MKTAG('VAR_0','b','m','p'):\nVAR_4 = AV_SPHERICAL_CUBEMAP;", "padding = avio_rb32(VAR_1);", "break;", "case MKTAG('e','q','u','i'):\nt = avio_rb32(VAR_1);", "b = avio_rb32(VAR_1);", "l = avio_rb32(VAR_1);", "r = avio_rb32(VAR_1);", "if (b >= UINT_MAX - t || r >= UINT_MAX - l) {", "av_log(VAR_0->fc, AV_LOG_ERROR,\n\"Invalid bounding rectangle coordinates %\"SIZE_SPECIFIER\",\"\n\"%\"SIZE_SPECIFIER\",%\"SIZE_SPECIFIER\",%\"SIZE_SPECIFIER\"\\n\",\nl, t, r, b);", "return AVERROR_INVALIDDATA;", "}", "if (l || t || r || b)\nVAR_4 = AV_SPHERICAL_EQUIRECTANGULAR_TILE;", "else\nVAR_4 = AV_SPHERICAL_EQUIRECTANGULAR;", "break;", "default:\nav_log(VAR_0->fc, AV_LOG_ERROR, \"Unknown VAR_4 type\\n\");", "return 0;", "}", "sc->spherical = av_spherical_alloc(&sc->spherical_size);", "if (!sc->spherical)\nreturn AVERROR(ENOMEM);", "sc->spherical->VAR_4 = VAR_4;", "sc->spherical->yaw = yaw;", "sc->spherical->pitch = pitch;", "sc->spherical->roll = roll;", "sc->spherical->padding = padding;", "sc->spherical->bound_left = l;", "sc->spherical->bound_top = t;", "sc->spherical->bound_right = r;", "sc->spherical->bound_bottom = b;", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71, 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91, 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123, 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157, 159, 161, 163 ], [ 165 ], [ 167 ], [ 171, 173 ], [ 175, 177 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193, 195 ], [ 199 ], [ 203 ], [ 205 ], [ 207 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 225 ], [ 227 ] ]
10,627
struct tm *brktimegm(time_t secs, struct tm *tm) { int days, y, ny, m; int md[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; days = secs / 86400; secs %= 86400; tm->tm_hour = secs / 3600; tm->tm_min = (secs % 3600) / 60; tm->tm_sec = secs % 60; /* oh well, may be someone some day will invent a formula for this stuff */ y = 1970; /* start "guessing" */ while (days >= (ISLEAP(y)?366:365)) { ny = (y + days/366); days -= (ny - y) * 365 + LEAPS_COUNT(ny - 1) - LEAPS_COUNT(y - 1); y = ny; } md[1] = ISLEAP(y)?29:28; for (m=0; days >= md[m]; m++) days -= md[m]; tm->tm_year = y; /* unlike gmtime_r we store complete year here */ tm->tm_mon = m+1; /* unlike gmtime_r tm_mon is from 1 to 12 */ tm->tm_mday = days+1; return tm; }
false
FFmpeg
392f227393f479ab9a461aba68ae4c6b6da685a4
struct tm *brktimegm(time_t secs, struct tm *tm) { int days, y, ny, m; int md[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; days = secs / 86400; secs %= 86400; tm->tm_hour = secs / 3600; tm->tm_min = (secs % 3600) / 60; tm->tm_sec = secs % 60; y = 1970; while (days >= (ISLEAP(y)?366:365)) { ny = (y + days/366); days -= (ny - y) * 365 + LEAPS_COUNT(ny - 1) - LEAPS_COUNT(y - 1); y = ny; } md[1] = ISLEAP(y)?29:28; for (m=0; days >= md[m]; m++) days -= md[m]; tm->tm_year = y; tm->tm_mon = m+1; tm->tm_mday = days+1; return tm; }
{ "code": [], "line_no": [] }
struct VAR_1 *FUNC_0(time_t VAR_0, struct VAR_1 *VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5; int VAR_6[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; VAR_2 = VAR_0 / 86400; VAR_0 %= 86400; VAR_1->tm_hour = VAR_0 / 3600; VAR_1->tm_min = (VAR_0 % 3600) / 60; VAR_1->tm_sec = VAR_0 % 60; VAR_3 = 1970; while (VAR_2 >= (ISLEAP(VAR_3)?366:365)) { VAR_4 = (VAR_3 + VAR_2/366); VAR_2 -= (VAR_4 - VAR_3) * 365 + LEAPS_COUNT(VAR_4 - 1) - LEAPS_COUNT(VAR_3 - 1); VAR_3 = VAR_4; } VAR_6[1] = ISLEAP(VAR_3)?29:28; for (VAR_5=0; VAR_2 >= VAR_6[VAR_5]; VAR_5++) VAR_2 -= VAR_6[VAR_5]; VAR_1->tm_year = VAR_3; VAR_1->tm_mon = VAR_5+1; VAR_1->tm_mday = VAR_2+1; return VAR_1; }
[ "struct VAR_1 *FUNC_0(time_t VAR_0, struct VAR_1 *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5;", "int VAR_6[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };", "VAR_2 = VAR_0 / 86400;", "VAR_0 %= 86400;", "VAR_1->tm_hour = VAR_0 / 3600;", "VAR_1->tm_min = (VAR_0 % 3600) / 60;", "VAR_1->tm_sec = VAR_0 % 60;", "VAR_3 = 1970;", "while (VAR_2 >= (ISLEAP(VAR_3)?366:365)) {", "VAR_4 = (VAR_3 + VAR_2/366);", "VAR_2 -= (VAR_4 - VAR_3) * 365 + LEAPS_COUNT(VAR_4 - 1) - LEAPS_COUNT(VAR_3 - 1);", "VAR_3 = VAR_4;", "}", "VAR_6[1] = ISLEAP(VAR_3)?29:28;", "for (VAR_5=0; VAR_2 >= VAR_6[VAR_5]; VAR_5++)", "VAR_2 -= VAR_6[VAR_5];", "VAR_1->tm_year = VAR_3;", "VAR_1->tm_mon = VAR_5+1;", "VAR_1->tm_mday = VAR_2+1;", "return VAR_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 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
10,628
static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row, AVFrame *frame, int x, int y) { int shift1 = ctx->bit_depth >= 10; int dct_linesize_luma = frame->linesize[0]; int dct_linesize_chroma = frame->linesize[1]; uint8_t *dest_y, *dest_u, *dest_v; int dct_y_offset, dct_x_offset; int qscale, i, act; int interlaced_mb = 0; if (ctx->mbaff) { interlaced_mb = get_bits1(&row->gb); qscale = get_bits(&row->gb, 10); } else { qscale = get_bits(&row->gb, 11); } act = get_bits1(&row->gb); if (act) { static int warned = 0; if (!warned) { warned = 1; av_log(ctx->avctx, AV_LOG_ERROR, "Unsupported adaptive color transform, patch welcome.\n"); } } if (qscale != row->last_qscale) { for (i = 0; i < 64; i++) { row->luma_scale[i] = qscale * ctx->cid_table->luma_weight[i]; row->chroma_scale[i] = qscale * ctx->cid_table->chroma_weight[i]; } row->last_qscale = qscale; } for (i = 0; i < 8 + 4 * ctx->is_444; i++) { if (ctx->decode_dct_block(ctx, row, i) < 0) return AVERROR_INVALIDDATA; } if (frame->interlaced_frame) { dct_linesize_luma <<= 1; dct_linesize_chroma <<= 1; } dest_y = frame->data[0] + ((y * dct_linesize_luma) << 4) + (x << (4 + shift1)); dest_u = frame->data[1] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444)); dest_v = frame->data[2] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444)); if (frame->interlaced_frame && ctx->cur_field) { dest_y += frame->linesize[0]; dest_u += frame->linesize[1]; dest_v += frame->linesize[2]; } if (interlaced_mb) { dct_linesize_luma <<= 1; dct_linesize_chroma <<= 1; } dct_y_offset = interlaced_mb ? frame->linesize[0] : (dct_linesize_luma << 3); dct_x_offset = 8 << shift1; if (!ctx->is_444) { ctx->idsp.idct_put(dest_y, dct_linesize_luma, row->blocks[0]); ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, row->blocks[1]); ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, row->blocks[4]); ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, row->blocks[5]); if (!(ctx->avctx->flags & AV_CODEC_FLAG_GRAY)) { dct_y_offset = interlaced_mb ? frame->linesize[1] : (dct_linesize_chroma << 3); ctx->idsp.idct_put(dest_u, dct_linesize_chroma, row->blocks[2]); ctx->idsp.idct_put(dest_v, dct_linesize_chroma, row->blocks[3]); ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, row->blocks[6]); ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, row->blocks[7]); } } else { ctx->idsp.idct_put(dest_y, dct_linesize_luma, row->blocks[0]); ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, row->blocks[1]); ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, row->blocks[6]); ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, row->blocks[7]); if (!(ctx->avctx->flags & AV_CODEC_FLAG_GRAY)) { dct_y_offset = interlaced_mb ? frame->linesize[1] : (dct_linesize_chroma << 3); ctx->idsp.idct_put(dest_u, dct_linesize_chroma, row->blocks[2]); ctx->idsp.idct_put(dest_u + dct_x_offset, dct_linesize_chroma, row->blocks[3]); ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, row->blocks[8]); ctx->idsp.idct_put(dest_u + dct_y_offset + dct_x_offset, dct_linesize_chroma, row->blocks[9]); ctx->idsp.idct_put(dest_v, dct_linesize_chroma, row->blocks[4]); ctx->idsp.idct_put(dest_v + dct_x_offset, dct_linesize_chroma, row->blocks[5]); ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, row->blocks[10]); ctx->idsp.idct_put(dest_v + dct_y_offset + dct_x_offset, dct_linesize_chroma, row->blocks[11]); } } return 0; }
false
FFmpeg
71199ee9077da7d92a8728e2a694fb1ab31488a7
static int dnxhd_decode_macroblock(const DNXHDContext *ctx, RowContext *row, AVFrame *frame, int x, int y) { int shift1 = ctx->bit_depth >= 10; int dct_linesize_luma = frame->linesize[0]; int dct_linesize_chroma = frame->linesize[1]; uint8_t *dest_y, *dest_u, *dest_v; int dct_y_offset, dct_x_offset; int qscale, i, act; int interlaced_mb = 0; if (ctx->mbaff) { interlaced_mb = get_bits1(&row->gb); qscale = get_bits(&row->gb, 10); } else { qscale = get_bits(&row->gb, 11); } act = get_bits1(&row->gb); if (act) { static int warned = 0; if (!warned) { warned = 1; av_log(ctx->avctx, AV_LOG_ERROR, "Unsupported adaptive color transform, patch welcome.\n"); } } if (qscale != row->last_qscale) { for (i = 0; i < 64; i++) { row->luma_scale[i] = qscale * ctx->cid_table->luma_weight[i]; row->chroma_scale[i] = qscale * ctx->cid_table->chroma_weight[i]; } row->last_qscale = qscale; } for (i = 0; i < 8 + 4 * ctx->is_444; i++) { if (ctx->decode_dct_block(ctx, row, i) < 0) return AVERROR_INVALIDDATA; } if (frame->interlaced_frame) { dct_linesize_luma <<= 1; dct_linesize_chroma <<= 1; } dest_y = frame->data[0] + ((y * dct_linesize_luma) << 4) + (x << (4 + shift1)); dest_u = frame->data[1] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444)); dest_v = frame->data[2] + ((y * dct_linesize_chroma) << 4) + (x << (3 + shift1 + ctx->is_444)); if (frame->interlaced_frame && ctx->cur_field) { dest_y += frame->linesize[0]; dest_u += frame->linesize[1]; dest_v += frame->linesize[2]; } if (interlaced_mb) { dct_linesize_luma <<= 1; dct_linesize_chroma <<= 1; } dct_y_offset = interlaced_mb ? frame->linesize[0] : (dct_linesize_luma << 3); dct_x_offset = 8 << shift1; if (!ctx->is_444) { ctx->idsp.idct_put(dest_y, dct_linesize_luma, row->blocks[0]); ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, row->blocks[1]); ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, row->blocks[4]); ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, row->blocks[5]); if (!(ctx->avctx->flags & AV_CODEC_FLAG_GRAY)) { dct_y_offset = interlaced_mb ? frame->linesize[1] : (dct_linesize_chroma << 3); ctx->idsp.idct_put(dest_u, dct_linesize_chroma, row->blocks[2]); ctx->idsp.idct_put(dest_v, dct_linesize_chroma, row->blocks[3]); ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, row->blocks[6]); ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, row->blocks[7]); } } else { ctx->idsp.idct_put(dest_y, dct_linesize_luma, row->blocks[0]); ctx->idsp.idct_put(dest_y + dct_x_offset, dct_linesize_luma, row->blocks[1]); ctx->idsp.idct_put(dest_y + dct_y_offset, dct_linesize_luma, row->blocks[6]); ctx->idsp.idct_put(dest_y + dct_y_offset + dct_x_offset, dct_linesize_luma, row->blocks[7]); if (!(ctx->avctx->flags & AV_CODEC_FLAG_GRAY)) { dct_y_offset = interlaced_mb ? frame->linesize[1] : (dct_linesize_chroma << 3); ctx->idsp.idct_put(dest_u, dct_linesize_chroma, row->blocks[2]); ctx->idsp.idct_put(dest_u + dct_x_offset, dct_linesize_chroma, row->blocks[3]); ctx->idsp.idct_put(dest_u + dct_y_offset, dct_linesize_chroma, row->blocks[8]); ctx->idsp.idct_put(dest_u + dct_y_offset + dct_x_offset, dct_linesize_chroma, row->blocks[9]); ctx->idsp.idct_put(dest_v, dct_linesize_chroma, row->blocks[4]); ctx->idsp.idct_put(dest_v + dct_x_offset, dct_linesize_chroma, row->blocks[5]); ctx->idsp.idct_put(dest_v + dct_y_offset, dct_linesize_chroma, row->blocks[10]); ctx->idsp.idct_put(dest_v + dct_y_offset + dct_x_offset, dct_linesize_chroma, row->blocks[11]); } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(const DNXHDContext *VAR_0, RowContext *VAR_1, AVFrame *VAR_2, int VAR_3, int VAR_4) { int VAR_5 = VAR_0->bit_depth >= 10; int VAR_6 = VAR_2->linesize[0]; int VAR_7 = VAR_2->linesize[1]; uint8_t *dest_y, *dest_u, *dest_v; int VAR_8, VAR_9; int VAR_10, VAR_11, VAR_12; int VAR_13 = 0; if (VAR_0->mbaff) { VAR_13 = get_bits1(&VAR_1->gb); VAR_10 = get_bits(&VAR_1->gb, 10); } else { VAR_10 = get_bits(&VAR_1->gb, 11); } VAR_12 = get_bits1(&VAR_1->gb); if (VAR_12) { static int VAR_14 = 0; if (!VAR_14) { VAR_14 = 1; av_log(VAR_0->avctx, AV_LOG_ERROR, "Unsupported adaptive color transform, patch welcome.\n"); } } if (VAR_10 != VAR_1->last_qscale) { for (VAR_11 = 0; VAR_11 < 64; VAR_11++) { VAR_1->luma_scale[VAR_11] = VAR_10 * VAR_0->cid_table->luma_weight[VAR_11]; VAR_1->chroma_scale[VAR_11] = VAR_10 * VAR_0->cid_table->chroma_weight[VAR_11]; } VAR_1->last_qscale = VAR_10; } for (VAR_11 = 0; VAR_11 < 8 + 4 * VAR_0->is_444; VAR_11++) { if (VAR_0->decode_dct_block(VAR_0, VAR_1, VAR_11) < 0) return AVERROR_INVALIDDATA; } if (VAR_2->interlaced_frame) { VAR_6 <<= 1; VAR_7 <<= 1; } dest_y = VAR_2->data[0] + ((VAR_4 * VAR_6) << 4) + (VAR_3 << (4 + VAR_5)); dest_u = VAR_2->data[1] + ((VAR_4 * VAR_7) << 4) + (VAR_3 << (3 + VAR_5 + VAR_0->is_444)); dest_v = VAR_2->data[2] + ((VAR_4 * VAR_7) << 4) + (VAR_3 << (3 + VAR_5 + VAR_0->is_444)); if (VAR_2->interlaced_frame && VAR_0->cur_field) { dest_y += VAR_2->linesize[0]; dest_u += VAR_2->linesize[1]; dest_v += VAR_2->linesize[2]; } if (VAR_13) { VAR_6 <<= 1; VAR_7 <<= 1; } VAR_8 = VAR_13 ? VAR_2->linesize[0] : (VAR_6 << 3); VAR_9 = 8 << VAR_5; if (!VAR_0->is_444) { VAR_0->idsp.idct_put(dest_y, VAR_6, VAR_1->blocks[0]); VAR_0->idsp.idct_put(dest_y + VAR_9, VAR_6, VAR_1->blocks[1]); VAR_0->idsp.idct_put(dest_y + VAR_8, VAR_6, VAR_1->blocks[4]); VAR_0->idsp.idct_put(dest_y + VAR_8 + VAR_9, VAR_6, VAR_1->blocks[5]); if (!(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) { VAR_8 = VAR_13 ? VAR_2->linesize[1] : (VAR_7 << 3); VAR_0->idsp.idct_put(dest_u, VAR_7, VAR_1->blocks[2]); VAR_0->idsp.idct_put(dest_v, VAR_7, VAR_1->blocks[3]); VAR_0->idsp.idct_put(dest_u + VAR_8, VAR_7, VAR_1->blocks[6]); VAR_0->idsp.idct_put(dest_v + VAR_8, VAR_7, VAR_1->blocks[7]); } } else { VAR_0->idsp.idct_put(dest_y, VAR_6, VAR_1->blocks[0]); VAR_0->idsp.idct_put(dest_y + VAR_9, VAR_6, VAR_1->blocks[1]); VAR_0->idsp.idct_put(dest_y + VAR_8, VAR_6, VAR_1->blocks[6]); VAR_0->idsp.idct_put(dest_y + VAR_8 + VAR_9, VAR_6, VAR_1->blocks[7]); if (!(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) { VAR_8 = VAR_13 ? VAR_2->linesize[1] : (VAR_7 << 3); VAR_0->idsp.idct_put(dest_u, VAR_7, VAR_1->blocks[2]); VAR_0->idsp.idct_put(dest_u + VAR_9, VAR_7, VAR_1->blocks[3]); VAR_0->idsp.idct_put(dest_u + VAR_8, VAR_7, VAR_1->blocks[8]); VAR_0->idsp.idct_put(dest_u + VAR_8 + VAR_9, VAR_7, VAR_1->blocks[9]); VAR_0->idsp.idct_put(dest_v, VAR_7, VAR_1->blocks[4]); VAR_0->idsp.idct_put(dest_v + VAR_9, VAR_7, VAR_1->blocks[5]); VAR_0->idsp.idct_put(dest_v + VAR_8, VAR_7, VAR_1->blocks[10]); VAR_0->idsp.idct_put(dest_v + VAR_8 + VAR_9, VAR_7, VAR_1->blocks[11]); } } return 0; }
[ "static int FUNC_0(const DNXHDContext *VAR_0, RowContext *VAR_1,\nAVFrame *VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5 = VAR_0->bit_depth >= 10;", "int VAR_6 = VAR_2->linesize[0];", "int VAR_7 = VAR_2->linesize[1];", "uint8_t *dest_y, *dest_u, *dest_v;", "int VAR_8, VAR_9;", "int VAR_10, VAR_11, VAR_12;", "int VAR_13 = 0;", "if (VAR_0->mbaff) {", "VAR_13 = get_bits1(&VAR_1->gb);", "VAR_10 = get_bits(&VAR_1->gb, 10);", "} else {", "VAR_10 = get_bits(&VAR_1->gb, 11);", "}", "VAR_12 = get_bits1(&VAR_1->gb);", "if (VAR_12) {", "static int VAR_14 = 0;", "if (!VAR_14) {", "VAR_14 = 1;", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"Unsupported adaptive color transform, patch welcome.\\n\");", "}", "}", "if (VAR_10 != VAR_1->last_qscale) {", "for (VAR_11 = 0; VAR_11 < 64; VAR_11++) {", "VAR_1->luma_scale[VAR_11] = VAR_10 * VAR_0->cid_table->luma_weight[VAR_11];", "VAR_1->chroma_scale[VAR_11] = VAR_10 * VAR_0->cid_table->chroma_weight[VAR_11];", "}", "VAR_1->last_qscale = VAR_10;", "}", "for (VAR_11 = 0; VAR_11 < 8 + 4 * VAR_0->is_444; VAR_11++) {", "if (VAR_0->decode_dct_block(VAR_0, VAR_1, VAR_11) < 0)\nreturn AVERROR_INVALIDDATA;", "}", "if (VAR_2->interlaced_frame) {", "VAR_6 <<= 1;", "VAR_7 <<= 1;", "}", "dest_y = VAR_2->data[0] + ((VAR_4 * VAR_6) << 4) + (VAR_3 << (4 + VAR_5));", "dest_u = VAR_2->data[1] + ((VAR_4 * VAR_7) << 4) + (VAR_3 << (3 + VAR_5 + VAR_0->is_444));", "dest_v = VAR_2->data[2] + ((VAR_4 * VAR_7) << 4) + (VAR_3 << (3 + VAR_5 + VAR_0->is_444));", "if (VAR_2->interlaced_frame && VAR_0->cur_field) {", "dest_y += VAR_2->linesize[0];", "dest_u += VAR_2->linesize[1];", "dest_v += VAR_2->linesize[2];", "}", "if (VAR_13) {", "VAR_6 <<= 1;", "VAR_7 <<= 1;", "}", "VAR_8 = VAR_13 ? VAR_2->linesize[0] : (VAR_6 << 3);", "VAR_9 = 8 << VAR_5;", "if (!VAR_0->is_444) {", "VAR_0->idsp.idct_put(dest_y, VAR_6, VAR_1->blocks[0]);", "VAR_0->idsp.idct_put(dest_y + VAR_9, VAR_6, VAR_1->blocks[1]);", "VAR_0->idsp.idct_put(dest_y + VAR_8, VAR_6, VAR_1->blocks[4]);", "VAR_0->idsp.idct_put(dest_y + VAR_8 + VAR_9, VAR_6, VAR_1->blocks[5]);", "if (!(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) {", "VAR_8 = VAR_13 ? VAR_2->linesize[1] : (VAR_7 << 3);", "VAR_0->idsp.idct_put(dest_u, VAR_7, VAR_1->blocks[2]);", "VAR_0->idsp.idct_put(dest_v, VAR_7, VAR_1->blocks[3]);", "VAR_0->idsp.idct_put(dest_u + VAR_8, VAR_7, VAR_1->blocks[6]);", "VAR_0->idsp.idct_put(dest_v + VAR_8, VAR_7, VAR_1->blocks[7]);", "}", "} else {", "VAR_0->idsp.idct_put(dest_y, VAR_6, VAR_1->blocks[0]);", "VAR_0->idsp.idct_put(dest_y + VAR_9, VAR_6, VAR_1->blocks[1]);", "VAR_0->idsp.idct_put(dest_y + VAR_8, VAR_6, VAR_1->blocks[6]);", "VAR_0->idsp.idct_put(dest_y + VAR_8 + VAR_9, VAR_6, VAR_1->blocks[7]);", "if (!(VAR_0->avctx->flags & AV_CODEC_FLAG_GRAY)) {", "VAR_8 = VAR_13 ? VAR_2->linesize[1] : (VAR_7 << 3);", "VAR_0->idsp.idct_put(dest_u, VAR_7, VAR_1->blocks[2]);", "VAR_0->idsp.idct_put(dest_u + VAR_9, VAR_7, VAR_1->blocks[3]);", "VAR_0->idsp.idct_put(dest_u + VAR_8, VAR_7, VAR_1->blocks[8]);", "VAR_0->idsp.idct_put(dest_u + VAR_8 + VAR_9, VAR_7, VAR_1->blocks[9]);", "VAR_0->idsp.idct_put(dest_v, VAR_7, VAR_1->blocks[4]);", "VAR_0->idsp.idct_put(dest_v + VAR_9, VAR_7, VAR_1->blocks[5]);", "VAR_0->idsp.idct_put(dest_v + VAR_8, VAR_7, VAR_1->blocks[10]);", "VAR_0->idsp.idct_put(dest_v + VAR_8 + VAR_9, VAR_7, VAR_1->blocks[11]);", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 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 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ] ]
10,629
static int get_audio_flags(AVCodecContext *enc){ int flags = (enc->bits_per_coded_sample == 16) ? FLV_SAMPLESSIZE_16BIT : FLV_SAMPLESSIZE_8BIT; if (enc->codec_id == CODEC_ID_AAC) // specs force these parameters return FLV_CODECID_AAC | FLV_SAMPLERATE_44100HZ | FLV_SAMPLESSIZE_16BIT | FLV_STEREO; else if (enc->codec_id == CODEC_ID_SPEEX) { if (enc->sample_rate != 16000) { av_log(enc, AV_LOG_ERROR, "flv only supports wideband (16kHz) Speex audio\n"); return -1; } if (enc->channels != 1) { av_log(enc, AV_LOG_ERROR, "flv only supports mono Speex audio\n"); return -1; } if (enc->frame_size / 320 > 8) { av_log(enc, AV_LOG_WARNING, "Warning: Speex stream has more than " "8 frames per packet. Adobe Flash " "Player cannot handle this!\n"); } return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | FLV_SAMPLESSIZE_16BIT; } else { switch (enc->sample_rate) { case 44100: flags |= FLV_SAMPLERATE_44100HZ; break; case 22050: flags |= FLV_SAMPLERATE_22050HZ; break; case 11025: flags |= FLV_SAMPLERATE_11025HZ; break; case 8000: //nellymoser only case 5512: //not mp3 if(enc->codec_id != CODEC_ID_MP3){ flags |= FLV_SAMPLERATE_SPECIAL; break; } default: av_log(enc, AV_LOG_ERROR, "flv does not support that sample rate, choose from (44100, 22050, 11025).\n"); return -1; } } if (enc->channels > 1) { flags |= FLV_STEREO; } switch(enc->codec_id){ case CODEC_ID_MP3: flags |= FLV_CODECID_MP3 | FLV_SAMPLESSIZE_16BIT; break; case CODEC_ID_PCM_U8: flags |= FLV_CODECID_PCM | FLV_SAMPLESSIZE_8BIT; break; case CODEC_ID_PCM_S16BE: flags |= FLV_CODECID_PCM | FLV_SAMPLESSIZE_16BIT; break; case CODEC_ID_PCM_S16LE: flags |= FLV_CODECID_PCM_LE | FLV_SAMPLESSIZE_16BIT; break; case CODEC_ID_ADPCM_SWF: flags |= FLV_CODECID_ADPCM | FLV_SAMPLESSIZE_16BIT; break; case CODEC_ID_NELLYMOSER: if (enc->sample_rate == 8000) { flags |= FLV_CODECID_NELLYMOSER_8KHZ_MONO | FLV_SAMPLESSIZE_16BIT; } else { flags |= FLV_CODECID_NELLYMOSER | FLV_SAMPLESSIZE_16BIT; } break; case 0: flags |= enc->codec_tag<<4; break; default: av_log(enc, AV_LOG_ERROR, "codec not compatible with flv\n"); return -1; } return flags; }
false
FFmpeg
4ee247a2bdf2fbe81026a428d4affc46c81f28db
static int get_audio_flags(AVCodecContext *enc){ int flags = (enc->bits_per_coded_sample == 16) ? FLV_SAMPLESSIZE_16BIT : FLV_SAMPLESSIZE_8BIT; if (enc->codec_id == CODEC_ID_AAC) return FLV_CODECID_AAC | FLV_SAMPLERATE_44100HZ | FLV_SAMPLESSIZE_16BIT | FLV_STEREO; else if (enc->codec_id == CODEC_ID_SPEEX) { if (enc->sample_rate != 16000) { av_log(enc, AV_LOG_ERROR, "flv only supports wideband (16kHz) Speex audio\n"); return -1; } if (enc->channels != 1) { av_log(enc, AV_LOG_ERROR, "flv only supports mono Speex audio\n"); return -1; } if (enc->frame_size / 320 > 8) { av_log(enc, AV_LOG_WARNING, "Warning: Speex stream has more than " "8 frames per packet. Adobe Flash " "Player cannot handle this!\n"); } return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | FLV_SAMPLESSIZE_16BIT; } else { switch (enc->sample_rate) { case 44100: flags |= FLV_SAMPLERATE_44100HZ; break; case 22050: flags |= FLV_SAMPLERATE_22050HZ; break; case 11025: flags |= FLV_SAMPLERATE_11025HZ; break; case 8000: case 5512: if(enc->codec_id != CODEC_ID_MP3){ flags |= FLV_SAMPLERATE_SPECIAL; break; } default: av_log(enc, AV_LOG_ERROR, "flv does not support that sample rate, choose from (44100, 22050, 11025).\n"); return -1; } } if (enc->channels > 1) { flags |= FLV_STEREO; } switch(enc->codec_id){ case CODEC_ID_MP3: flags |= FLV_CODECID_MP3 | FLV_SAMPLESSIZE_16BIT; break; case CODEC_ID_PCM_U8: flags |= FLV_CODECID_PCM | FLV_SAMPLESSIZE_8BIT; break; case CODEC_ID_PCM_S16BE: flags |= FLV_CODECID_PCM | FLV_SAMPLESSIZE_16BIT; break; case CODEC_ID_PCM_S16LE: flags |= FLV_CODECID_PCM_LE | FLV_SAMPLESSIZE_16BIT; break; case CODEC_ID_ADPCM_SWF: flags |= FLV_CODECID_ADPCM | FLV_SAMPLESSIZE_16BIT; break; case CODEC_ID_NELLYMOSER: if (enc->sample_rate == 8000) { flags |= FLV_CODECID_NELLYMOSER_8KHZ_MONO | FLV_SAMPLESSIZE_16BIT; } else { flags |= FLV_CODECID_NELLYMOSER | FLV_SAMPLESSIZE_16BIT; } break; case 0: flags |= enc->codec_tag<<4; break; default: av_log(enc, AV_LOG_ERROR, "codec not compatible with flv\n"); return -1; } return flags; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0){ int VAR_1 = (VAR_0->bits_per_coded_sample == 16) ? FLV_SAMPLESSIZE_16BIT : FLV_SAMPLESSIZE_8BIT; if (VAR_0->codec_id == CODEC_ID_AAC) return FLV_CODECID_AAC | FLV_SAMPLERATE_44100HZ | FLV_SAMPLESSIZE_16BIT | FLV_STEREO; else if (VAR_0->codec_id == CODEC_ID_SPEEX) { if (VAR_0->sample_rate != 16000) { av_log(VAR_0, AV_LOG_ERROR, "flv only supports wideband (16kHz) Speex audio\n"); return -1; } if (VAR_0->channels != 1) { av_log(VAR_0, AV_LOG_ERROR, "flv only supports mono Speex audio\n"); return -1; } if (VAR_0->frame_size / 320 > 8) { av_log(VAR_0, AV_LOG_WARNING, "Warning: Speex stream has more than " "8 frames per packet. Adobe Flash " "Player cannot handle this!\n"); } return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | FLV_SAMPLESSIZE_16BIT; } else { switch (VAR_0->sample_rate) { case 44100: VAR_1 |= FLV_SAMPLERATE_44100HZ; break; case 22050: VAR_1 |= FLV_SAMPLERATE_22050HZ; break; case 11025: VAR_1 |= FLV_SAMPLERATE_11025HZ; break; case 8000: case 5512: if(VAR_0->codec_id != CODEC_ID_MP3){ VAR_1 |= FLV_SAMPLERATE_SPECIAL; break; } default: av_log(VAR_0, AV_LOG_ERROR, "flv does not support that sample rate, choose from (44100, 22050, 11025).\n"); return -1; } } if (VAR_0->channels > 1) { VAR_1 |= FLV_STEREO; } switch(VAR_0->codec_id){ case CODEC_ID_MP3: VAR_1 |= FLV_CODECID_MP3 | FLV_SAMPLESSIZE_16BIT; break; case CODEC_ID_PCM_U8: VAR_1 |= FLV_CODECID_PCM | FLV_SAMPLESSIZE_8BIT; break; case CODEC_ID_PCM_S16BE: VAR_1 |= FLV_CODECID_PCM | FLV_SAMPLESSIZE_16BIT; break; case CODEC_ID_PCM_S16LE: VAR_1 |= FLV_CODECID_PCM_LE | FLV_SAMPLESSIZE_16BIT; break; case CODEC_ID_ADPCM_SWF: VAR_1 |= FLV_CODECID_ADPCM | FLV_SAMPLESSIZE_16BIT; break; case CODEC_ID_NELLYMOSER: if (VAR_0->sample_rate == 8000) { VAR_1 |= FLV_CODECID_NELLYMOSER_8KHZ_MONO | FLV_SAMPLESSIZE_16BIT; } else { VAR_1 |= FLV_CODECID_NELLYMOSER | FLV_SAMPLESSIZE_16BIT; } break; case 0: VAR_1 |= VAR_0->codec_tag<<4; break; default: av_log(VAR_0, AV_LOG_ERROR, "codec not compatible with flv\n"); return -1; } return VAR_1; }
[ "static int FUNC_0(AVCodecContext *VAR_0){", "int VAR_1 = (VAR_0->bits_per_coded_sample == 16) ? FLV_SAMPLESSIZE_16BIT : FLV_SAMPLESSIZE_8BIT;", "if (VAR_0->codec_id == CODEC_ID_AAC)\nreturn FLV_CODECID_AAC | FLV_SAMPLERATE_44100HZ | FLV_SAMPLESSIZE_16BIT | FLV_STEREO;", "else if (VAR_0->codec_id == CODEC_ID_SPEEX) {", "if (VAR_0->sample_rate != 16000) {", "av_log(VAR_0, AV_LOG_ERROR, \"flv only supports wideband (16kHz) Speex audio\\n\");", "return -1;", "}", "if (VAR_0->channels != 1) {", "av_log(VAR_0, AV_LOG_ERROR, \"flv only supports mono Speex audio\\n\");", "return -1;", "}", "if (VAR_0->frame_size / 320 > 8) {", "av_log(VAR_0, AV_LOG_WARNING, \"Warning: Speex stream has more than \"\n\"8 frames per packet. Adobe Flash \"\n\"Player cannot handle this!\\n\");", "}", "return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | FLV_SAMPLESSIZE_16BIT;", "} else {", "switch (VAR_0->sample_rate) {", "case 44100:\nVAR_1 |= FLV_SAMPLERATE_44100HZ;", "break;", "case 22050:\nVAR_1 |= FLV_SAMPLERATE_22050HZ;", "break;", "case 11025:\nVAR_1 |= FLV_SAMPLERATE_11025HZ;", "break;", "case 8000:\ncase 5512:\nif(VAR_0->codec_id != CODEC_ID_MP3){", "VAR_1 |= FLV_SAMPLERATE_SPECIAL;", "break;", "}", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"flv does not support that sample rate, choose from (44100, 22050, 11025).\\n\");", "return -1;", "}", "}", "if (VAR_0->channels > 1) {", "VAR_1 |= FLV_STEREO;", "}", "switch(VAR_0->codec_id){", "case CODEC_ID_MP3:\nVAR_1 |= FLV_CODECID_MP3 | FLV_SAMPLESSIZE_16BIT;", "break;", "case CODEC_ID_PCM_U8:\nVAR_1 |= FLV_CODECID_PCM | FLV_SAMPLESSIZE_8BIT;", "break;", "case CODEC_ID_PCM_S16BE:\nVAR_1 |= FLV_CODECID_PCM | FLV_SAMPLESSIZE_16BIT;", "break;", "case CODEC_ID_PCM_S16LE:\nVAR_1 |= FLV_CODECID_PCM_LE | FLV_SAMPLESSIZE_16BIT;", "break;", "case CODEC_ID_ADPCM_SWF:\nVAR_1 |= FLV_CODECID_ADPCM | FLV_SAMPLESSIZE_16BIT;", "break;", "case CODEC_ID_NELLYMOSER:\nif (VAR_0->sample_rate == 8000) {", "VAR_1 |= FLV_CODECID_NELLYMOSER_8KHZ_MONO | FLV_SAMPLESSIZE_16BIT;", "} else {", "VAR_1 |= FLV_CODECID_NELLYMOSER | FLV_SAMPLESSIZE_16BIT;", "}", "break;", "case 0:\nVAR_1 |= VAR_0->codec_tag<<4;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"codec not compatible with flv\\n\");", "return -1;", "}", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63, 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ] ]
10,630
static int init_output_stream_encode(OutputStream *ost) { InputStream *ist = get_input_stream(ost); AVCodecContext *enc_ctx = ost->enc_ctx; AVCodecContext *dec_ctx = NULL; AVFormatContext *oc = output_files[ost->file_index]->ctx; int j, ret; set_encoder_id(output_files[ost->file_index], ost); if (ist) { ost->st->disposition = ist->st->disposition; dec_ctx = ist->dec_ctx; enc_ctx->chroma_sample_location = dec_ctx->chroma_sample_location; } else { for (j = 0; j < oc->nb_streams; j++) { AVStream *st = oc->streams[j]; if (st != ost->st && st->codecpar->codec_type == ost->st->codecpar->codec_type) break; } if (j == oc->nb_streams) if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) ost->st->disposition = AV_DISPOSITION_DEFAULT; } if ((enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO || enc_ctx->codec_type == AVMEDIA_TYPE_AUDIO) && filtergraph_is_simple(ost->filter->graph)) { FilterGraph *fg = ost->filter->graph; if (configure_filtergraph(fg)) { av_log(NULL, AV_LOG_FATAL, "Error opening filters!\n"); exit_program(1); } } if (enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO) { if (!ost->frame_rate.num) ost->frame_rate = av_buffersink_get_frame_rate(ost->filter->filter); if (ist && !ost->frame_rate.num) ost->frame_rate = ist->framerate; if (ist && !ost->frame_rate.num) ost->frame_rate = ist->st->r_frame_rate; if (ist && !ost->frame_rate.num) { ost->frame_rate = (AVRational){25, 1}; av_log(NULL, AV_LOG_WARNING, "No information " "about the input framerate is available. Falling " "back to a default value of 25fps for output stream #%d:%d. Use the -r option " "if you want a different framerate.\n", ost->file_index, ost->index); } // ost->frame_rate = ist->st->avg_frame_rate.num ? ist->st->avg_frame_rate : (AVRational){25, 1}; if (ost->enc && ost->enc->supported_framerates && !ost->force_fps) { int idx = av_find_nearest_q_idx(ost->frame_rate, ost->enc->supported_framerates); ost->frame_rate = ost->enc->supported_framerates[idx]; } // reduce frame rate for mpeg4 to be within the spec limits if (enc_ctx->codec_id == AV_CODEC_ID_MPEG4) { av_reduce(&ost->frame_rate.num, &ost->frame_rate.den, ost->frame_rate.num, ost->frame_rate.den, 65535); } } switch (enc_ctx->codec_type) { case AVMEDIA_TYPE_AUDIO: enc_ctx->sample_fmt = av_buffersink_get_format(ost->filter->filter); if (dec_ctx) enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, av_get_bytes_per_sample(enc_ctx->sample_fmt) << 3); enc_ctx->sample_rate = av_buffersink_get_sample_rate(ost->filter->filter); enc_ctx->channel_layout = av_buffersink_get_channel_layout(ost->filter->filter); enc_ctx->channels = av_buffersink_get_channels(ost->filter->filter); enc_ctx->time_base = (AVRational){ 1, enc_ctx->sample_rate }; break; case AVMEDIA_TYPE_VIDEO: enc_ctx->time_base = av_inv_q(ost->frame_rate); if (!(enc_ctx->time_base.num && enc_ctx->time_base.den)) enc_ctx->time_base = av_buffersink_get_time_base(ost->filter->filter); if ( av_q2d(enc_ctx->time_base) < 0.001 && video_sync_method != VSYNC_PASSTHROUGH && (video_sync_method == VSYNC_CFR || video_sync_method == VSYNC_VSCFR || (video_sync_method == VSYNC_AUTO && !(oc->oformat->flags & AVFMT_VARIABLE_FPS)))){ av_log(oc, AV_LOG_WARNING, "Frame rate very high for a muxer not efficiently supporting it.\n" "Please consider specifying a lower framerate, a different muxer or -vsync 2\n"); } for (j = 0; j < ost->forced_kf_count; j++) ost->forced_kf_pts[j] = av_rescale_q(ost->forced_kf_pts[j], AV_TIME_BASE_Q, enc_ctx->time_base); enc_ctx->width = av_buffersink_get_w(ost->filter->filter); enc_ctx->height = av_buffersink_get_h(ost->filter->filter); enc_ctx->sample_aspect_ratio = ost->st->sample_aspect_ratio = ost->frame_aspect_ratio.num ? // overridden by the -aspect cli option av_mul_q(ost->frame_aspect_ratio, (AVRational){ enc_ctx->height, enc_ctx->width }) : av_buffersink_get_sample_aspect_ratio(ost->filter->filter); if (!strncmp(ost->enc->name, "libx264", 7) && enc_ctx->pix_fmt == AV_PIX_FMT_NONE && av_buffersink_get_format(ost->filter->filter) != AV_PIX_FMT_YUV420P) av_log(NULL, AV_LOG_WARNING, "No pixel format specified, %s for H.264 encoding chosen.\n" "Use -pix_fmt yuv420p for compatibility with outdated media players.\n", av_get_pix_fmt_name(av_buffersink_get_format(ost->filter->filter))); if (!strncmp(ost->enc->name, "mpeg2video", 10) && enc_ctx->pix_fmt == AV_PIX_FMT_NONE && av_buffersink_get_format(ost->filter->filter) != AV_PIX_FMT_YUV420P) av_log(NULL, AV_LOG_WARNING, "No pixel format specified, %s for MPEG-2 encoding chosen.\n" "Use -pix_fmt yuv420p for compatibility with outdated media players.\n", av_get_pix_fmt_name(av_buffersink_get_format(ost->filter->filter))); enc_ctx->pix_fmt = av_buffersink_get_format(ost->filter->filter); if (dec_ctx) enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth); ost->st->avg_frame_rate = ost->frame_rate; if (!dec_ctx || enc_ctx->width != dec_ctx->width || enc_ctx->height != dec_ctx->height || enc_ctx->pix_fmt != dec_ctx->pix_fmt) { enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample; } if (ost->forced_keyframes) { if (!strncmp(ost->forced_keyframes, "expr:", 5)) { ret = av_expr_parse(&ost->forced_keyframes_pexpr, ost->forced_keyframes+5, forced_keyframes_const_names, NULL, NULL, NULL, NULL, 0, NULL); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid force_key_frames expression '%s'\n", ost->forced_keyframes+5); return ret; } ost->forced_keyframes_expr_const_values[FKF_N] = 0; ost->forced_keyframes_expr_const_values[FKF_N_FORCED] = 0; ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N] = NAN; ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T] = NAN; // Don't parse the 'forced_keyframes' in case of 'keep-source-keyframes', // parse it only for static kf timings } else if(strncmp(ost->forced_keyframes, "source", 6)) { parse_forced_key_frames(ost->forced_keyframes, ost, ost->enc_ctx); } } break; case AVMEDIA_TYPE_SUBTITLE: enc_ctx->time_base = (AVRational){1, 1000}; if (!enc_ctx->width) { enc_ctx->width = input_streams[ost->source_index]->st->codecpar->width; enc_ctx->height = input_streams[ost->source_index]->st->codecpar->height; } break; case AVMEDIA_TYPE_DATA: break; default: abort(); break; } return 0; }
false
FFmpeg
dfc6e30cd4b9d1817b78579c11fc6881e40b9733
static int init_output_stream_encode(OutputStream *ost) { InputStream *ist = get_input_stream(ost); AVCodecContext *enc_ctx = ost->enc_ctx; AVCodecContext *dec_ctx = NULL; AVFormatContext *oc = output_files[ost->file_index]->ctx; int j, ret; set_encoder_id(output_files[ost->file_index], ost); if (ist) { ost->st->disposition = ist->st->disposition; dec_ctx = ist->dec_ctx; enc_ctx->chroma_sample_location = dec_ctx->chroma_sample_location; } else { for (j = 0; j < oc->nb_streams; j++) { AVStream *st = oc->streams[j]; if (st != ost->st && st->codecpar->codec_type == ost->st->codecpar->codec_type) break; } if (j == oc->nb_streams) if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) ost->st->disposition = AV_DISPOSITION_DEFAULT; } if ((enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO || enc_ctx->codec_type == AVMEDIA_TYPE_AUDIO) && filtergraph_is_simple(ost->filter->graph)) { FilterGraph *fg = ost->filter->graph; if (configure_filtergraph(fg)) { av_log(NULL, AV_LOG_FATAL, "Error opening filters!\n"); exit_program(1); } } if (enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO) { if (!ost->frame_rate.num) ost->frame_rate = av_buffersink_get_frame_rate(ost->filter->filter); if (ist && !ost->frame_rate.num) ost->frame_rate = ist->framerate; if (ist && !ost->frame_rate.num) ost->frame_rate = ist->st->r_frame_rate; if (ist && !ost->frame_rate.num) { ost->frame_rate = (AVRational){25, 1}; av_log(NULL, AV_LOG_WARNING, "No information " "about the input framerate is available. Falling " "back to a default value of 25fps for output stream #%d:%d. Use the -r option " "if you want a different framerate.\n", ost->file_index, ost->index); } if (ost->enc && ost->enc->supported_framerates && !ost->force_fps) { int idx = av_find_nearest_q_idx(ost->frame_rate, ost->enc->supported_framerates); ost->frame_rate = ost->enc->supported_framerates[idx]; } if (enc_ctx->codec_id == AV_CODEC_ID_MPEG4) { av_reduce(&ost->frame_rate.num, &ost->frame_rate.den, ost->frame_rate.num, ost->frame_rate.den, 65535); } } switch (enc_ctx->codec_type) { case AVMEDIA_TYPE_AUDIO: enc_ctx->sample_fmt = av_buffersink_get_format(ost->filter->filter); if (dec_ctx) enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, av_get_bytes_per_sample(enc_ctx->sample_fmt) << 3); enc_ctx->sample_rate = av_buffersink_get_sample_rate(ost->filter->filter); enc_ctx->channel_layout = av_buffersink_get_channel_layout(ost->filter->filter); enc_ctx->channels = av_buffersink_get_channels(ost->filter->filter); enc_ctx->time_base = (AVRational){ 1, enc_ctx->sample_rate }; break; case AVMEDIA_TYPE_VIDEO: enc_ctx->time_base = av_inv_q(ost->frame_rate); if (!(enc_ctx->time_base.num && enc_ctx->time_base.den)) enc_ctx->time_base = av_buffersink_get_time_base(ost->filter->filter); if ( av_q2d(enc_ctx->time_base) < 0.001 && video_sync_method != VSYNC_PASSTHROUGH && (video_sync_method == VSYNC_CFR || video_sync_method == VSYNC_VSCFR || (video_sync_method == VSYNC_AUTO && !(oc->oformat->flags & AVFMT_VARIABLE_FPS)))){ av_log(oc, AV_LOG_WARNING, "Frame rate very high for a muxer not efficiently supporting it.\n" "Please consider specifying a lower framerate, a different muxer or -vsync 2\n"); } for (j = 0; j < ost->forced_kf_count; j++) ost->forced_kf_pts[j] = av_rescale_q(ost->forced_kf_pts[j], AV_TIME_BASE_Q, enc_ctx->time_base); enc_ctx->width = av_buffersink_get_w(ost->filter->filter); enc_ctx->height = av_buffersink_get_h(ost->filter->filter); enc_ctx->sample_aspect_ratio = ost->st->sample_aspect_ratio = ost->frame_aspect_ratio.num ? av_mul_q(ost->frame_aspect_ratio, (AVRational){ enc_ctx->height, enc_ctx->width }) : av_buffersink_get_sample_aspect_ratio(ost->filter->filter); if (!strncmp(ost->enc->name, "libx264", 7) && enc_ctx->pix_fmt == AV_PIX_FMT_NONE && av_buffersink_get_format(ost->filter->filter) != AV_PIX_FMT_YUV420P) av_log(NULL, AV_LOG_WARNING, "No pixel format specified, %s for H.264 encoding chosen.\n" "Use -pix_fmt yuv420p for compatibility with outdated media players.\n", av_get_pix_fmt_name(av_buffersink_get_format(ost->filter->filter))); if (!strncmp(ost->enc->name, "mpeg2video", 10) && enc_ctx->pix_fmt == AV_PIX_FMT_NONE && av_buffersink_get_format(ost->filter->filter) != AV_PIX_FMT_YUV420P) av_log(NULL, AV_LOG_WARNING, "No pixel format specified, %s for MPEG-2 encoding chosen.\n" "Use -pix_fmt yuv420p for compatibility with outdated media players.\n", av_get_pix_fmt_name(av_buffersink_get_format(ost->filter->filter))); enc_ctx->pix_fmt = av_buffersink_get_format(ost->filter->filter); if (dec_ctx) enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth); ost->st->avg_frame_rate = ost->frame_rate; if (!dec_ctx || enc_ctx->width != dec_ctx->width || enc_ctx->height != dec_ctx->height || enc_ctx->pix_fmt != dec_ctx->pix_fmt) { enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample; } if (ost->forced_keyframes) { if (!strncmp(ost->forced_keyframes, "expr:", 5)) { ret = av_expr_parse(&ost->forced_keyframes_pexpr, ost->forced_keyframes+5, forced_keyframes_const_names, NULL, NULL, NULL, NULL, 0, NULL); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid force_key_frames expression '%s'\n", ost->forced_keyframes+5); return ret; } ost->forced_keyframes_expr_const_values[FKF_N] = 0; ost->forced_keyframes_expr_const_values[FKF_N_FORCED] = 0; ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N] = NAN; ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T] = NAN; } else if(strncmp(ost->forced_keyframes, "source", 6)) { parse_forced_key_frames(ost->forced_keyframes, ost, ost->enc_ctx); } } break; case AVMEDIA_TYPE_SUBTITLE: enc_ctx->time_base = (AVRational){1, 1000}; if (!enc_ctx->width) { enc_ctx->width = input_streams[ost->source_index]->st->codecpar->width; enc_ctx->height = input_streams[ost->source_index]->st->codecpar->height; } break; case AVMEDIA_TYPE_DATA: break; default: abort(); break; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(OutputStream *VAR_0) { InputStream *ist = get_input_stream(VAR_0); AVCodecContext *enc_ctx = VAR_0->enc_ctx; AVCodecContext *dec_ctx = NULL; AVFormatContext *oc = output_files[VAR_0->file_index]->ctx; int VAR_1, VAR_2; set_encoder_id(output_files[VAR_0->file_index], VAR_0); if (ist) { VAR_0->st->disposition = ist->st->disposition; dec_ctx = ist->dec_ctx; enc_ctx->chroma_sample_location = dec_ctx->chroma_sample_location; } else { for (VAR_1 = 0; VAR_1 < oc->nb_streams; VAR_1++) { AVStream *st = oc->streams[VAR_1]; if (st != VAR_0->st && st->codecpar->codec_type == VAR_0->st->codecpar->codec_type) break; } if (VAR_1 == oc->nb_streams) if (VAR_0->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || VAR_0->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) VAR_0->st->disposition = AV_DISPOSITION_DEFAULT; } if ((enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO || enc_ctx->codec_type == AVMEDIA_TYPE_AUDIO) && filtergraph_is_simple(VAR_0->filter->graph)) { FilterGraph *fg = VAR_0->filter->graph; if (configure_filtergraph(fg)) { av_log(NULL, AV_LOG_FATAL, "Error opening filters!\n"); exit_program(1); } } if (enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO) { if (!VAR_0->frame_rate.num) VAR_0->frame_rate = av_buffersink_get_frame_rate(VAR_0->filter->filter); if (ist && !VAR_0->frame_rate.num) VAR_0->frame_rate = ist->framerate; if (ist && !VAR_0->frame_rate.num) VAR_0->frame_rate = ist->st->r_frame_rate; if (ist && !VAR_0->frame_rate.num) { VAR_0->frame_rate = (AVRational){25, 1}; av_log(NULL, AV_LOG_WARNING, "No information " "about the input framerate is available. Falling " "back to a default value of 25fps for output stream #%d:%d. Use the -r option " "if you want a different framerate.\n", VAR_0->file_index, VAR_0->index); } if (VAR_0->enc && VAR_0->enc->supported_framerates && !VAR_0->force_fps) { int VAR_3 = av_find_nearest_q_idx(VAR_0->frame_rate, VAR_0->enc->supported_framerates); VAR_0->frame_rate = VAR_0->enc->supported_framerates[VAR_3]; } if (enc_ctx->codec_id == AV_CODEC_ID_MPEG4) { av_reduce(&VAR_0->frame_rate.num, &VAR_0->frame_rate.den, VAR_0->frame_rate.num, VAR_0->frame_rate.den, 65535); } } switch (enc_ctx->codec_type) { case AVMEDIA_TYPE_AUDIO: enc_ctx->sample_fmt = av_buffersink_get_format(VAR_0->filter->filter); if (dec_ctx) enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, av_get_bytes_per_sample(enc_ctx->sample_fmt) << 3); enc_ctx->sample_rate = av_buffersink_get_sample_rate(VAR_0->filter->filter); enc_ctx->channel_layout = av_buffersink_get_channel_layout(VAR_0->filter->filter); enc_ctx->channels = av_buffersink_get_channels(VAR_0->filter->filter); enc_ctx->time_base = (AVRational){ 1, enc_ctx->sample_rate }; break; case AVMEDIA_TYPE_VIDEO: enc_ctx->time_base = av_inv_q(VAR_0->frame_rate); if (!(enc_ctx->time_base.num && enc_ctx->time_base.den)) enc_ctx->time_base = av_buffersink_get_time_base(VAR_0->filter->filter); if ( av_q2d(enc_ctx->time_base) < 0.001 && video_sync_method != VSYNC_PASSTHROUGH && (video_sync_method == VSYNC_CFR || video_sync_method == VSYNC_VSCFR || (video_sync_method == VSYNC_AUTO && !(oc->oformat->flags & AVFMT_VARIABLE_FPS)))){ av_log(oc, AV_LOG_WARNING, "Frame rate very high for a muxer not efficiently supporting it.\n" "Please consider specifying a lower framerate, a different muxer or -vsync 2\n"); } for (VAR_1 = 0; VAR_1 < VAR_0->forced_kf_count; VAR_1++) VAR_0->forced_kf_pts[VAR_1] = av_rescale_q(VAR_0->forced_kf_pts[VAR_1], AV_TIME_BASE_Q, enc_ctx->time_base); enc_ctx->width = av_buffersink_get_w(VAR_0->filter->filter); enc_ctx->height = av_buffersink_get_h(VAR_0->filter->filter); enc_ctx->sample_aspect_ratio = VAR_0->st->sample_aspect_ratio = VAR_0->frame_aspect_ratio.num ? av_mul_q(VAR_0->frame_aspect_ratio, (AVRational){ enc_ctx->height, enc_ctx->width }) : av_buffersink_get_sample_aspect_ratio(VAR_0->filter->filter); if (!strncmp(VAR_0->enc->name, "libx264", 7) && enc_ctx->pix_fmt == AV_PIX_FMT_NONE && av_buffersink_get_format(VAR_0->filter->filter) != AV_PIX_FMT_YUV420P) av_log(NULL, AV_LOG_WARNING, "No pixel format specified, %s for H.264 encoding chosen.\n" "Use -pix_fmt yuv420p for compatibility with outdated media players.\n", av_get_pix_fmt_name(av_buffersink_get_format(VAR_0->filter->filter))); if (!strncmp(VAR_0->enc->name, "mpeg2video", 10) && enc_ctx->pix_fmt == AV_PIX_FMT_NONE && av_buffersink_get_format(VAR_0->filter->filter) != AV_PIX_FMT_YUV420P) av_log(NULL, AV_LOG_WARNING, "No pixel format specified, %s for MPEG-2 encoding chosen.\n" "Use -pix_fmt yuv420p for compatibility with outdated media players.\n", av_get_pix_fmt_name(av_buffersink_get_format(VAR_0->filter->filter))); enc_ctx->pix_fmt = av_buffersink_get_format(VAR_0->filter->filter); if (dec_ctx) enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth); VAR_0->st->avg_frame_rate = VAR_0->frame_rate; if (!dec_ctx || enc_ctx->width != dec_ctx->width || enc_ctx->height != dec_ctx->height || enc_ctx->pix_fmt != dec_ctx->pix_fmt) { enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample; } if (VAR_0->forced_keyframes) { if (!strncmp(VAR_0->forced_keyframes, "expr:", 5)) { VAR_2 = av_expr_parse(&VAR_0->forced_keyframes_pexpr, VAR_0->forced_keyframes+5, forced_keyframes_const_names, NULL, NULL, NULL, NULL, 0, NULL); if (VAR_2 < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid force_key_frames expression '%s'\n", VAR_0->forced_keyframes+5); return VAR_2; } VAR_0->forced_keyframes_expr_const_values[FKF_N] = 0; VAR_0->forced_keyframes_expr_const_values[FKF_N_FORCED] = 0; VAR_0->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N] = NAN; VAR_0->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T] = NAN; } else if(strncmp(VAR_0->forced_keyframes, "source", 6)) { parse_forced_key_frames(VAR_0->forced_keyframes, VAR_0, VAR_0->enc_ctx); } } break; case AVMEDIA_TYPE_SUBTITLE: enc_ctx->time_base = (AVRational){1, 1000}; if (!enc_ctx->width) { enc_ctx->width = input_streams[VAR_0->source_index]->st->codecpar->width; enc_ctx->height = input_streams[VAR_0->source_index]->st->codecpar->height; } break; case AVMEDIA_TYPE_DATA: break; default: abort(); break; } return 0; }
[ "static int FUNC_0(OutputStream *VAR_0)\n{", "InputStream *ist = get_input_stream(VAR_0);", "AVCodecContext *enc_ctx = VAR_0->enc_ctx;", "AVCodecContext *dec_ctx = NULL;", "AVFormatContext *oc = output_files[VAR_0->file_index]->ctx;", "int VAR_1, VAR_2;", "set_encoder_id(output_files[VAR_0->file_index], VAR_0);", "if (ist) {", "VAR_0->st->disposition = ist->st->disposition;", "dec_ctx = ist->dec_ctx;", "enc_ctx->chroma_sample_location = dec_ctx->chroma_sample_location;", "} else {", "for (VAR_1 = 0; VAR_1 < oc->nb_streams; VAR_1++) {", "AVStream *st = oc->streams[VAR_1];", "if (st != VAR_0->st && st->codecpar->codec_type == VAR_0->st->codecpar->codec_type)\nbreak;", "}", "if (VAR_1 == oc->nb_streams)\nif (VAR_0->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO ||\nVAR_0->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)\nVAR_0->st->disposition = AV_DISPOSITION_DEFAULT;", "}", "if ((enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||\nenc_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&\nfiltergraph_is_simple(VAR_0->filter->graph)) {", "FilterGraph *fg = VAR_0->filter->graph;", "if (configure_filtergraph(fg)) {", "av_log(NULL, AV_LOG_FATAL, \"Error opening filters!\\n\");", "exit_program(1);", "}", "}", "if (enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {", "if (!VAR_0->frame_rate.num)\nVAR_0->frame_rate = av_buffersink_get_frame_rate(VAR_0->filter->filter);", "if (ist && !VAR_0->frame_rate.num)\nVAR_0->frame_rate = ist->framerate;", "if (ist && !VAR_0->frame_rate.num)\nVAR_0->frame_rate = ist->st->r_frame_rate;", "if (ist && !VAR_0->frame_rate.num) {", "VAR_0->frame_rate = (AVRational){25, 1};", "av_log(NULL, AV_LOG_WARNING,\n\"No information \"\n\"about the input framerate is available. Falling \"\n\"back to a default value of 25fps for output stream #%d:%d. Use the -r option \"\n\"if you want a different framerate.\\n\",\nVAR_0->file_index, VAR_0->index);", "}", "if (VAR_0->enc && VAR_0->enc->supported_framerates && !VAR_0->force_fps) {", "int VAR_3 = av_find_nearest_q_idx(VAR_0->frame_rate, VAR_0->enc->supported_framerates);", "VAR_0->frame_rate = VAR_0->enc->supported_framerates[VAR_3];", "}", "if (enc_ctx->codec_id == AV_CODEC_ID_MPEG4) {", "av_reduce(&VAR_0->frame_rate.num, &VAR_0->frame_rate.den,\nVAR_0->frame_rate.num, VAR_0->frame_rate.den, 65535);", "}", "}", "switch (enc_ctx->codec_type) {", "case AVMEDIA_TYPE_AUDIO:\nenc_ctx->sample_fmt = av_buffersink_get_format(VAR_0->filter->filter);", "if (dec_ctx)\nenc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample,\nav_get_bytes_per_sample(enc_ctx->sample_fmt) << 3);", "enc_ctx->sample_rate = av_buffersink_get_sample_rate(VAR_0->filter->filter);", "enc_ctx->channel_layout = av_buffersink_get_channel_layout(VAR_0->filter->filter);", "enc_ctx->channels = av_buffersink_get_channels(VAR_0->filter->filter);", "enc_ctx->time_base = (AVRational){ 1, enc_ctx->sample_rate };", "break;", "case AVMEDIA_TYPE_VIDEO:\nenc_ctx->time_base = av_inv_q(VAR_0->frame_rate);", "if (!(enc_ctx->time_base.num && enc_ctx->time_base.den))\nenc_ctx->time_base = av_buffersink_get_time_base(VAR_0->filter->filter);", "if ( av_q2d(enc_ctx->time_base) < 0.001 && video_sync_method != VSYNC_PASSTHROUGH\n&& (video_sync_method == VSYNC_CFR || video_sync_method == VSYNC_VSCFR || (video_sync_method == VSYNC_AUTO && !(oc->oformat->flags & AVFMT_VARIABLE_FPS)))){", "av_log(oc, AV_LOG_WARNING, \"Frame rate very high for a muxer not efficiently supporting it.\\n\"\n\"Please consider specifying a lower framerate, a different muxer or -vsync 2\\n\");", "}", "for (VAR_1 = 0; VAR_1 < VAR_0->forced_kf_count; VAR_1++)", "VAR_0->forced_kf_pts[VAR_1] = av_rescale_q(VAR_0->forced_kf_pts[VAR_1],\nAV_TIME_BASE_Q,\nenc_ctx->time_base);", "enc_ctx->width = av_buffersink_get_w(VAR_0->filter->filter);", "enc_ctx->height = av_buffersink_get_h(VAR_0->filter->filter);", "enc_ctx->sample_aspect_ratio = VAR_0->st->sample_aspect_ratio =\nVAR_0->frame_aspect_ratio.num ?\nav_mul_q(VAR_0->frame_aspect_ratio, (AVRational){ enc_ctx->height, enc_ctx->width }) :", "av_buffersink_get_sample_aspect_ratio(VAR_0->filter->filter);", "if (!strncmp(VAR_0->enc->name, \"libx264\", 7) &&\nenc_ctx->pix_fmt == AV_PIX_FMT_NONE &&\nav_buffersink_get_format(VAR_0->filter->filter) != AV_PIX_FMT_YUV420P)\nav_log(NULL, AV_LOG_WARNING,\n\"No pixel format specified, %s for H.264 encoding chosen.\\n\"\n\"Use -pix_fmt yuv420p for compatibility with outdated media players.\\n\",\nav_get_pix_fmt_name(av_buffersink_get_format(VAR_0->filter->filter)));", "if (!strncmp(VAR_0->enc->name, \"mpeg2video\", 10) &&\nenc_ctx->pix_fmt == AV_PIX_FMT_NONE &&\nav_buffersink_get_format(VAR_0->filter->filter) != AV_PIX_FMT_YUV420P)\nav_log(NULL, AV_LOG_WARNING,\n\"No pixel format specified, %s for MPEG-2 encoding chosen.\\n\"\n\"Use -pix_fmt yuv420p for compatibility with outdated media players.\\n\",\nav_get_pix_fmt_name(av_buffersink_get_format(VAR_0->filter->filter)));", "enc_ctx->pix_fmt = av_buffersink_get_format(VAR_0->filter->filter);", "if (dec_ctx)\nenc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample,\nav_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth);", "VAR_0->st->avg_frame_rate = VAR_0->frame_rate;", "if (!dec_ctx ||\nenc_ctx->width != dec_ctx->width ||\nenc_ctx->height != dec_ctx->height ||\nenc_ctx->pix_fmt != dec_ctx->pix_fmt) {", "enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample;", "}", "if (VAR_0->forced_keyframes) {", "if (!strncmp(VAR_0->forced_keyframes, \"expr:\", 5)) {", "VAR_2 = av_expr_parse(&VAR_0->forced_keyframes_pexpr, VAR_0->forced_keyframes+5,\nforced_keyframes_const_names, NULL, NULL, NULL, NULL, 0, NULL);", "if (VAR_2 < 0) {", "av_log(NULL, AV_LOG_ERROR,\n\"Invalid force_key_frames expression '%s'\\n\", VAR_0->forced_keyframes+5);", "return VAR_2;", "}", "VAR_0->forced_keyframes_expr_const_values[FKF_N] = 0;", "VAR_0->forced_keyframes_expr_const_values[FKF_N_FORCED] = 0;", "VAR_0->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N] = NAN;", "VAR_0->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T] = NAN;", "} else if(strncmp(VAR_0->forced_keyframes, \"source\", 6)) {", "parse_forced_key_frames(VAR_0->forced_keyframes, VAR_0, VAR_0->enc_ctx);", "}", "}", "break;", "case AVMEDIA_TYPE_SUBTITLE:\nenc_ctx->time_base = (AVRational){1, 1000};", "if (!enc_ctx->width) {", "enc_ctx->width = input_streams[VAR_0->source_index]->st->codecpar->width;", "enc_ctx->height = input_streams[VAR_0->source_index]->st->codecpar->height;", "}", "break;", "case AVMEDIA_TYPE_DATA:\nbreak;", "default:\nabort();", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47, 49, 51 ], [ 53 ], [ 57, 59, 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81, 83 ], [ 85, 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97, 99, 101, 103, 105, 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137, 139 ], [ 141, 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161, 163 ], [ 165, 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177, 179, 181 ], [ 185 ], [ 187 ], [ 189, 191, 193 ], [ 195 ], [ 197, 199, 201, 203, 205, 207, 209 ], [ 211, 213, 215, 217, 219, 221, 223 ], [ 225 ], [ 227, 229, 231 ], [ 235 ], [ 239, 241, 243, 245 ], [ 247 ], [ 249 ], [ 253 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 263, 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295, 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309, 311 ], [ 313, 315 ], [ 317 ], [ 319 ], [ 323 ], [ 325 ] ]
10,631
int avio_put_str16le(AVIOContext *s, const char *str) { const uint8_t *q = str; int ret = 0; while (*q) { uint32_t ch; uint16_t tmp; GET_UTF8(ch, *q++, break;) PUT_UTF16(ch, tmp, avio_wl16(s, tmp); ret += 2;) } avio_wl16(s, 0); ret += 2; return ret; }
false
FFmpeg
b52ae27edf392e5a0df95054d394d850b8e57d35
int avio_put_str16le(AVIOContext *s, const char *str) { const uint8_t *q = str; int ret = 0; while (*q) { uint32_t ch; uint16_t tmp; GET_UTF8(ch, *q++, break;) PUT_UTF16(ch, tmp, avio_wl16(s, tmp); ret += 2;) } avio_wl16(s, 0); ret += 2; return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(AVIOContext *VAR_0, const char *VAR_1) { const uint8_t *VAR_2 = VAR_1; int VAR_3 = 0; while (*VAR_2) { uint32_t ch; uint16_t tmp; GET_UTF8(ch, *VAR_2++, break;) PUT_UTF16(ch, tmp, avio_wl16(VAR_0, tmp); VAR_3 += 2;) } avio_wl16(VAR_0, 0); VAR_3 += 2; return VAR_3; }
[ "int FUNC_0(AVIOContext *VAR_0, const char *VAR_1)\n{", "const uint8_t *VAR_2 = VAR_1;", "int VAR_3 = 0;", "while (*VAR_2) {", "uint32_t ch;", "uint16_t tmp;", "GET_UTF8(ch, *VAR_2++, break;)", "PUT_UTF16(ch, tmp, avio_wl16(VAR_0, tmp); VAR_3 += 2;)", "}", "avio_wl16(VAR_0, 0);", "VAR_3 += 2;", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
10,632
void init_get_bits(GetBitContext *s, UINT8 *buffer, int buffer_size) { s->buffer= buffer; s->size= buffer_size; s->buffer_end= buffer + buffer_size; #ifdef ALT_BITSTREAM_READER s->index=0; #elif defined LIBMPEG2_BITSTREAM_READER s->buffer_ptr = buffer; s->bit_count = 16; s->cache = 0; #elif defined A32_BITSTREAM_READER s->buffer_ptr = (uint32_t*)buffer; s->bit_count = 32; s->cache0 = 0; s->cache1 = 0; #endif { OPEN_READER(re, s) UPDATE_CACHE(re, s) // UPDATE_CACHE(re, s) CLOSE_READER(re, s) } #ifdef A32_BITSTREAM_READER s->cache1 = 0; #endif }
false
FFmpeg
68f593b48433842f3407586679fe07f3e5199ab9
void init_get_bits(GetBitContext *s, UINT8 *buffer, int buffer_size) { s->buffer= buffer; s->size= buffer_size; s->buffer_end= buffer + buffer_size; #ifdef ALT_BITSTREAM_READER s->index=0; #elif defined LIBMPEG2_BITSTREAM_READER s->buffer_ptr = buffer; s->bit_count = 16; s->cache = 0; #elif defined A32_BITSTREAM_READER s->buffer_ptr = (uint32_t*)buffer; s->bit_count = 32; s->cache0 = 0; s->cache1 = 0; #endif { OPEN_READER(re, s) UPDATE_CACHE(re, s) CLOSE_READER(re, s) } #ifdef A32_BITSTREAM_READER s->cache1 = 0; #endif }
{ "code": [], "line_no": [] }
void FUNC_0(GetBitContext *VAR_0, UINT8 *VAR_1, int VAR_2) { VAR_0->VAR_1= VAR_1; VAR_0->size= VAR_2; VAR_0->buffer_end= VAR_1 + VAR_2; #ifdef ALT_BITSTREAM_READER VAR_0->index=0; #elif defined LIBMPEG2_BITSTREAM_READER VAR_0->buffer_ptr = VAR_1; VAR_0->bit_count = 16; VAR_0->cache = 0; #elif defined A32_BITSTREAM_READER VAR_0->buffer_ptr = (uint32_t*)VAR_1; VAR_0->bit_count = 32; VAR_0->cache0 = 0; VAR_0->cache1 = 0; #endif { OPEN_READER(re, VAR_0) UPDATE_CACHE(re, VAR_0) CLOSE_READER(re, VAR_0) } #ifdef A32_BITSTREAM_READER VAR_0->cache1 = 0; #endif }
[ "void FUNC_0(GetBitContext *VAR_0,\nUINT8 *VAR_1, int VAR_2)\n{", "VAR_0->VAR_1= VAR_1;", "VAR_0->size= VAR_2;", "VAR_0->buffer_end= VAR_1 + VAR_2;", "#ifdef ALT_BITSTREAM_READER\nVAR_0->index=0;", "#elif defined LIBMPEG2_BITSTREAM_READER\nVAR_0->buffer_ptr = VAR_1;", "VAR_0->bit_count = 16;", "VAR_0->cache = 0;", "#elif defined A32_BITSTREAM_READER\nVAR_0->buffer_ptr = (uint32_t*)VAR_1;", "VAR_0->bit_count = 32;", "VAR_0->cache0 = 0;", "VAR_0->cache1 = 0;", "#endif\n{", "OPEN_READER(re, VAR_0)\nUPDATE_CACHE(re, VAR_0)\nCLOSE_READER(re, VAR_0)\n}", "#ifdef A32_BITSTREAM_READER\nVAR_0->cache1 = 0;", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39, 41, 45, 47 ], [ 49, 51 ], [ 53, 55 ] ]
10,633
static int sdp_parse_rtpmap(AVCodecContext *codec, RTSPStream *rtsp_st, int payload_type, const char *p) { char buf[256]; int i; AVCodec *c; const char *c_name; /* Loop into AVRtpDynamicPayloadTypes[] and AVRtpPayloadTypes[] and see if we can handle this kind of payload */ get_word_sep(buf, sizeof(buf), "/", &p); if (payload_type >= RTP_PT_PRIVATE) { RTPDynamicProtocolHandler *handler= RTPFirstDynamicPayloadHandler; while(handler) { if (!strcasecmp(buf, handler->enc_name) && (codec->codec_type == handler->codec_type)) { codec->codec_id = handler->codec_id; rtsp_st->dynamic_handler= handler; if(handler->open) { rtsp_st->dynamic_protocol_context= handler->open(); } break; } handler= handler->next; } } else { /* We are in a standard case ( from http://www.iana.org/assignments/rtp-parameters) */ /* search into AVRtpPayloadTypes[] */ codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type); } c = avcodec_find_decoder(codec->codec_id); if (c && c->name) c_name = c->name; else c_name = (char *)NULL; if (c_name) { get_word_sep(buf, sizeof(buf), "/", &p); i = atoi(buf); switch (codec->codec_type) { case CODEC_TYPE_AUDIO: av_log(codec, AV_LOG_DEBUG, " audio codec set to : %s\n", c_name); codec->sample_rate = RTSP_DEFAULT_AUDIO_SAMPLERATE; codec->channels = RTSP_DEFAULT_NB_AUDIO_CHANNELS; if (i > 0) { codec->sample_rate = i; get_word_sep(buf, sizeof(buf), "/", &p); i = atoi(buf); if (i > 0) codec->channels = i; // TODO: there is a bug here; if it is a mono stream, and less than 22000Hz, faad upconverts to stereo and twice the // frequency. No problem, but the sample rate is being set here by the sdp line. Upcoming patch forthcoming. (rdm) } av_log(codec, AV_LOG_DEBUG, " audio samplerate set to : %i\n", codec->sample_rate); av_log(codec, AV_LOG_DEBUG, " audio channels set to : %i\n", codec->channels); break; case CODEC_TYPE_VIDEO: av_log(codec, AV_LOG_DEBUG, " video codec set to : %s\n", c_name); break; default: break; } return 0; } return -1; }
false
FFmpeg
c89658008705d949c319df3fa6f400c481ad73e1
static int sdp_parse_rtpmap(AVCodecContext *codec, RTSPStream *rtsp_st, int payload_type, const char *p) { char buf[256]; int i; AVCodec *c; const char *c_name; get_word_sep(buf, sizeof(buf), "/", &p); if (payload_type >= RTP_PT_PRIVATE) { RTPDynamicProtocolHandler *handler= RTPFirstDynamicPayloadHandler; while(handler) { if (!strcasecmp(buf, handler->enc_name) && (codec->codec_type == handler->codec_type)) { codec->codec_id = handler->codec_id; rtsp_st->dynamic_handler= handler; if(handler->open) { rtsp_st->dynamic_protocol_context= handler->open(); } break; } handler= handler->next; } } else { codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type); } c = avcodec_find_decoder(codec->codec_id); if (c && c->name) c_name = c->name; else c_name = (char *)NULL; if (c_name) { get_word_sep(buf, sizeof(buf), "/", &p); i = atoi(buf); switch (codec->codec_type) { case CODEC_TYPE_AUDIO: av_log(codec, AV_LOG_DEBUG, " audio codec set to : %s\n", c_name); codec->sample_rate = RTSP_DEFAULT_AUDIO_SAMPLERATE; codec->channels = RTSP_DEFAULT_NB_AUDIO_CHANNELS; if (i > 0) { codec->sample_rate = i; get_word_sep(buf, sizeof(buf), "/", &p); i = atoi(buf); if (i > 0) codec->channels = i; } av_log(codec, AV_LOG_DEBUG, " audio samplerate set to : %i\n", codec->sample_rate); av_log(codec, AV_LOG_DEBUG, " audio channels set to : %i\n", codec->channels); break; case CODEC_TYPE_VIDEO: av_log(codec, AV_LOG_DEBUG, " video codec set to : %s\n", c_name); break; default: break; } return 0; } return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, RTSPStream *VAR_1, int VAR_2, const char *VAR_3) { char VAR_4[256]; int VAR_5; AVCodec *c; const char *VAR_6; get_word_sep(VAR_4, sizeof(VAR_4), "/", &VAR_3); if (VAR_2 >= RTP_PT_PRIVATE) { RTPDynamicProtocolHandler *handler= RTPFirstDynamicPayloadHandler; while(handler) { if (!strcasecmp(VAR_4, handler->enc_name) && (VAR_0->codec_type == handler->codec_type)) { VAR_0->codec_id = handler->codec_id; VAR_1->dynamic_handler= handler; if(handler->open) { VAR_1->dynamic_protocol_context= handler->open(); } break; } handler= handler->next; } } else { VAR_0->codec_id = ff_rtp_codec_id(VAR_4, VAR_0->codec_type); } c = avcodec_find_decoder(VAR_0->codec_id); if (c && c->name) VAR_6 = c->name; else VAR_6 = (char *)NULL; if (VAR_6) { get_word_sep(VAR_4, sizeof(VAR_4), "/", &VAR_3); VAR_5 = atoi(VAR_4); switch (VAR_0->codec_type) { case CODEC_TYPE_AUDIO: av_log(VAR_0, AV_LOG_DEBUG, " audio VAR_0 set to : %s\n", VAR_6); VAR_0->sample_rate = RTSP_DEFAULT_AUDIO_SAMPLERATE; VAR_0->channels = RTSP_DEFAULT_NB_AUDIO_CHANNELS; if (VAR_5 > 0) { VAR_0->sample_rate = VAR_5; get_word_sep(VAR_4, sizeof(VAR_4), "/", &VAR_3); VAR_5 = atoi(VAR_4); if (VAR_5 > 0) VAR_0->channels = VAR_5; } av_log(VAR_0, AV_LOG_DEBUG, " audio samplerate set to : %VAR_5\n", VAR_0->sample_rate); av_log(VAR_0, AV_LOG_DEBUG, " audio channels set to : %VAR_5\n", VAR_0->channels); break; case CODEC_TYPE_VIDEO: av_log(VAR_0, AV_LOG_DEBUG, " video VAR_0 set to : %s\n", VAR_6); break; default: break; } return 0; } return -1; }
[ "static int FUNC_0(AVCodecContext *VAR_0, RTSPStream *VAR_1, int VAR_2, const char *VAR_3)\n{", "char VAR_4[256];", "int VAR_5;", "AVCodec *c;", "const char *VAR_6;", "get_word_sep(VAR_4, sizeof(VAR_4), \"/\", &VAR_3);", "if (VAR_2 >= RTP_PT_PRIVATE) {", "RTPDynamicProtocolHandler *handler= RTPFirstDynamicPayloadHandler;", "while(handler) {", "if (!strcasecmp(VAR_4, handler->enc_name) && (VAR_0->codec_type == handler->codec_type)) {", "VAR_0->codec_id = handler->codec_id;", "VAR_1->dynamic_handler= handler;", "if(handler->open) {", "VAR_1->dynamic_protocol_context= handler->open();", "}", "break;", "}", "handler= handler->next;", "}", "} else {", "VAR_0->codec_id = ff_rtp_codec_id(VAR_4, VAR_0->codec_type);", "}", "c = avcodec_find_decoder(VAR_0->codec_id);", "if (c && c->name)\nVAR_6 = c->name;", "else\nVAR_6 = (char *)NULL;", "if (VAR_6) {", "get_word_sep(VAR_4, sizeof(VAR_4), \"/\", &VAR_3);", "VAR_5 = atoi(VAR_4);", "switch (VAR_0->codec_type) {", "case CODEC_TYPE_AUDIO:\nav_log(VAR_0, AV_LOG_DEBUG, \" audio VAR_0 set to : %s\\n\", VAR_6);", "VAR_0->sample_rate = RTSP_DEFAULT_AUDIO_SAMPLERATE;", "VAR_0->channels = RTSP_DEFAULT_NB_AUDIO_CHANNELS;", "if (VAR_5 > 0) {", "VAR_0->sample_rate = VAR_5;", "get_word_sep(VAR_4, sizeof(VAR_4), \"/\", &VAR_3);", "VAR_5 = atoi(VAR_4);", "if (VAR_5 > 0)\nVAR_0->channels = VAR_5;", "}", "av_log(VAR_0, AV_LOG_DEBUG, \" audio samplerate set to : %VAR_5\\n\", VAR_0->sample_rate);", "av_log(VAR_0, AV_LOG_DEBUG, \" audio channels set to : %VAR_5\\n\", VAR_0->channels);", "break;", "case CODEC_TYPE_VIDEO:\nav_log(VAR_0, AV_LOG_DEBUG, \" video VAR_0 set to : %s\\n\", VAR_6);", "break;", "default:\nbreak;", "}", "return 0;", "}", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 59 ], [ 61, 63 ], [ 65, 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ] ]
10,634
static void virtio_net_device_realize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIONet *n = VIRTIO_NET(dev); NetClientState *nc; int i; virtio_init(vdev, "virtio-net", VIRTIO_ID_NET, n->config_size); n->max_queues = MAX(n->nic_conf.peers.queues, 1); n->vqs = g_malloc0(sizeof(VirtIONetQueue) * n->max_queues); n->vqs[0].rx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_rx); n->curr_queues = 1; n->vqs[0].n = n; n->tx_timeout = n->net_conf.txtimer; if (n->net_conf.tx && strcmp(n->net_conf.tx, "timer") && strcmp(n->net_conf.tx, "bh")) { error_report("virtio-net: " "Unknown option tx=%s, valid options: \"timer\" \"bh\"", n->net_conf.tx); error_report("Defaulting to \"bh\""); if (n->net_conf.tx && !strcmp(n->net_conf.tx, "timer")) { n->vqs[0].tx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_tx_timer); n->vqs[0].tx_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, virtio_net_tx_timer, &n->vqs[0]); } else { n->vqs[0].tx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_tx_bh); n->vqs[0].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[0]); n->ctrl_vq = virtio_add_queue(vdev, 64, virtio_net_handle_ctrl); qemu_macaddr_default_if_unset(&n->nic_conf.macaddr); memcpy(&n->mac[0], &n->nic_conf.macaddr, sizeof(n->mac)); n->status = VIRTIO_NET_S_LINK_UP; n->announce_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, virtio_net_announce_timer, n); if (n->netclient_type) { /* * Happen when virtio_net_set_netclient_name has been called. */ n->nic = qemu_new_nic(&net_virtio_info, &n->nic_conf, n->netclient_type, n->netclient_name, n); } else { n->nic = qemu_new_nic(&net_virtio_info, &n->nic_conf, object_get_typename(OBJECT(dev)), dev->id, n); peer_test_vnet_hdr(n); if (peer_has_vnet_hdr(n)) { for (i = 0; i < n->max_queues; i++) { qemu_using_vnet_hdr(qemu_get_subqueue(n->nic, i)->peer, true); n->host_hdr_len = sizeof(struct virtio_net_hdr); } else { n->host_hdr_len = 0; qemu_format_nic_info_str(qemu_get_queue(n->nic), n->nic_conf.macaddr.a); n->vqs[0].tx_waiting = 0; n->tx_burst = n->net_conf.txburst; virtio_net_set_mrg_rx_bufs(n, 0); n->promisc = 1; /* for compatibility */ n->mac_table.macs = g_malloc0(MAC_TABLE_ENTRIES * ETH_ALEN); n->vlans = g_malloc0(MAX_VLAN >> 3); nc = qemu_get_queue(n->nic); nc->rxfilter_notify_enabled = 1; n->qdev = dev; register_savevm(dev, "virtio-net", -1, VIRTIO_NET_VM_VERSION, virtio_net_save, virtio_net_load, n);
true
qemu
7e0e736ecdfeac6d3517513d3a702304e4f6cf59
static void virtio_net_device_realize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIONet *n = VIRTIO_NET(dev); NetClientState *nc; int i; virtio_init(vdev, "virtio-net", VIRTIO_ID_NET, n->config_size); n->max_queues = MAX(n->nic_conf.peers.queues, 1); n->vqs = g_malloc0(sizeof(VirtIONetQueue) * n->max_queues); n->vqs[0].rx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_rx); n->curr_queues = 1; n->vqs[0].n = n; n->tx_timeout = n->net_conf.txtimer; if (n->net_conf.tx && strcmp(n->net_conf.tx, "timer") && strcmp(n->net_conf.tx, "bh")) { error_report("virtio-net: " "Unknown option tx=%s, valid options: \"timer\" \"bh\"", n->net_conf.tx); error_report("Defaulting to \"bh\""); if (n->net_conf.tx && !strcmp(n->net_conf.tx, "timer")) { n->vqs[0].tx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_tx_timer); n->vqs[0].tx_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, virtio_net_tx_timer, &n->vqs[0]); } else { n->vqs[0].tx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_tx_bh); n->vqs[0].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[0]); n->ctrl_vq = virtio_add_queue(vdev, 64, virtio_net_handle_ctrl); qemu_macaddr_default_if_unset(&n->nic_conf.macaddr); memcpy(&n->mac[0], &n->nic_conf.macaddr, sizeof(n->mac)); n->status = VIRTIO_NET_S_LINK_UP; n->announce_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, virtio_net_announce_timer, n); if (n->netclient_type) { n->nic = qemu_new_nic(&net_virtio_info, &n->nic_conf, n->netclient_type, n->netclient_name, n); } else { n->nic = qemu_new_nic(&net_virtio_info, &n->nic_conf, object_get_typename(OBJECT(dev)), dev->id, n); peer_test_vnet_hdr(n); if (peer_has_vnet_hdr(n)) { for (i = 0; i < n->max_queues; i++) { qemu_using_vnet_hdr(qemu_get_subqueue(n->nic, i)->peer, true); n->host_hdr_len = sizeof(struct virtio_net_hdr); } else { n->host_hdr_len = 0; qemu_format_nic_info_str(qemu_get_queue(n->nic), n->nic_conf.macaddr.a); n->vqs[0].tx_waiting = 0; n->tx_burst = n->net_conf.txburst; virtio_net_set_mrg_rx_bufs(n, 0); n->promisc = 1; n->mac_table.macs = g_malloc0(MAC_TABLE_ENTRIES * ETH_ALEN); n->vlans = g_malloc0(MAX_VLAN >> 3); nc = qemu_get_queue(n->nic); nc->rxfilter_notify_enabled = 1; n->qdev = dev; register_savevm(dev, "virtio-net", -1, VIRTIO_NET_VM_VERSION, virtio_net_save, virtio_net_load, n);
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0); VirtIONet *n = VIRTIO_NET(VAR_0); NetClientState *nc; int VAR_2; virtio_init(vdev, "virtio-net", VIRTIO_ID_NET, n->config_size); n->max_queues = MAX(n->nic_conf.peers.queues, 1); n->vqs = g_malloc0(sizeof(VirtIONetQueue) * n->max_queues); n->vqs[0].rx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_rx); n->curr_queues = 1; n->vqs[0].n = n; n->tx_timeout = n->net_conf.txtimer; if (n->net_conf.tx && strcmp(n->net_conf.tx, "timer") && strcmp(n->net_conf.tx, "bh")) { error_report("virtio-net: " "Unknown option tx=%s, valid options: \"timer\" \"bh\"", n->net_conf.tx); error_report("Defaulting to \"bh\""); if (n->net_conf.tx && !strcmp(n->net_conf.tx, "timer")) { n->vqs[0].tx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_tx_timer); n->vqs[0].tx_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, virtio_net_tx_timer, &n->vqs[0]); } else { n->vqs[0].tx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_tx_bh); n->vqs[0].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[0]); n->ctrl_vq = virtio_add_queue(vdev, 64, virtio_net_handle_ctrl); qemu_macaddr_default_if_unset(&n->nic_conf.macaddr); memcpy(&n->mac[0], &n->nic_conf.macaddr, sizeof(n->mac)); n->status = VIRTIO_NET_S_LINK_UP; n->announce_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, virtio_net_announce_timer, n); if (n->netclient_type) { n->nic = qemu_new_nic(&net_virtio_info, &n->nic_conf, n->netclient_type, n->netclient_name, n); } else { n->nic = qemu_new_nic(&net_virtio_info, &n->nic_conf, object_get_typename(OBJECT(VAR_0)), VAR_0->id, n); peer_test_vnet_hdr(n); if (peer_has_vnet_hdr(n)) { for (VAR_2 = 0; VAR_2 < n->max_queues; VAR_2++) { qemu_using_vnet_hdr(qemu_get_subqueue(n->nic, VAR_2)->peer, true); n->host_hdr_len = sizeof(struct virtio_net_hdr); } else { n->host_hdr_len = 0; qemu_format_nic_info_str(qemu_get_queue(n->nic), n->nic_conf.macaddr.a); n->vqs[0].tx_waiting = 0; n->tx_burst = n->net_conf.txburst; virtio_net_set_mrg_rx_bufs(n, 0); n->promisc = 1; n->mac_table.macs = g_malloc0(MAC_TABLE_ENTRIES * ETH_ALEN); n->vlans = g_malloc0(MAX_VLAN >> 3); nc = qemu_get_queue(n->nic); nc->rxfilter_notify_enabled = 1; n->qdev = VAR_0; register_savevm(VAR_0, "virtio-net", -1, VIRTIO_NET_VM_VERSION, virtio_net_save, virtio_net_load, n);
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0);", "VirtIONet *n = VIRTIO_NET(VAR_0);", "NetClientState *nc;", "int VAR_2;", "virtio_init(vdev, \"virtio-net\", VIRTIO_ID_NET, n->config_size);", "n->max_queues = MAX(n->nic_conf.peers.queues, 1);", "n->vqs = g_malloc0(sizeof(VirtIONetQueue) * n->max_queues);", "n->vqs[0].rx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_rx);", "n->curr_queues = 1;", "n->vqs[0].n = n;", "n->tx_timeout = n->net_conf.txtimer;", "if (n->net_conf.tx && strcmp(n->net_conf.tx, \"timer\")\n&& strcmp(n->net_conf.tx, \"bh\")) {", "error_report(\"virtio-net: \"\n\"Unknown option tx=%s, valid options: \\\"timer\\\" \\\"bh\\\"\",\nn->net_conf.tx);", "error_report(\"Defaulting to \\\"bh\\\"\");", "if (n->net_conf.tx && !strcmp(n->net_conf.tx, \"timer\")) {", "n->vqs[0].tx_vq = virtio_add_queue(vdev, 256,\nvirtio_net_handle_tx_timer);", "n->vqs[0].tx_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, virtio_net_tx_timer,\n&n->vqs[0]);", "} else {", "n->vqs[0].tx_vq = virtio_add_queue(vdev, 256,\nvirtio_net_handle_tx_bh);", "n->vqs[0].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[0]);", "n->ctrl_vq = virtio_add_queue(vdev, 64, virtio_net_handle_ctrl);", "qemu_macaddr_default_if_unset(&n->nic_conf.macaddr);", "memcpy(&n->mac[0], &n->nic_conf.macaddr, sizeof(n->mac));", "n->status = VIRTIO_NET_S_LINK_UP;", "n->announce_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL,\nvirtio_net_announce_timer, n);", "if (n->netclient_type) {", "n->nic = qemu_new_nic(&net_virtio_info, &n->nic_conf,\nn->netclient_type, n->netclient_name, n);", "} else {", "n->nic = qemu_new_nic(&net_virtio_info, &n->nic_conf,\nobject_get_typename(OBJECT(VAR_0)), VAR_0->id, n);", "peer_test_vnet_hdr(n);", "if (peer_has_vnet_hdr(n)) {", "for (VAR_2 = 0; VAR_2 < n->max_queues; VAR_2++) {", "qemu_using_vnet_hdr(qemu_get_subqueue(n->nic, VAR_2)->peer, true);", "n->host_hdr_len = sizeof(struct virtio_net_hdr);", "} else {", "n->host_hdr_len = 0;", "qemu_format_nic_info_str(qemu_get_queue(n->nic), n->nic_conf.macaddr.a);", "n->vqs[0].tx_waiting = 0;", "n->tx_burst = n->net_conf.txburst;", "virtio_net_set_mrg_rx_bufs(n, 0);", "n->promisc = 1;", "n->mac_table.macs = g_malloc0(MAC_TABLE_ENTRIES * ETH_ALEN);", "n->vlans = g_malloc0(MAX_VLAN >> 3);", "nc = qemu_get_queue(n->nic);", "nc->rxfilter_notify_enabled = 1;", "n->qdev = VAR_0;", "register_savevm(VAR_0, \"virtio-net\", -1, VIRTIO_NET_VM_VERSION,\nvirtio_net_save, virtio_net_load, n);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 28 ], [ 30 ], [ 32 ], [ 34 ], [ 36 ], [ 40, 42 ], [ 44, 46, 48 ], [ 50 ], [ 55 ], [ 57, 59 ], [ 61, 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 74 ], [ 76 ], [ 78 ], [ 80 ], [ 82, 84 ], [ 88 ], [ 96, 98 ], [ 100 ], [ 102, 104 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 118 ], [ 120 ], [ 122 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 145 ], [ 149 ], [ 151 ], [ 155 ], [ 157, 159 ] ]
10,635
static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AVIContext *avi = s->priv_data; AVStream *st; int i, index; int64_t pos, pos_min; AVIStream *ast; /* Does not matter which stream is requested dv in avi has the * stream information in the first video stream. */ if (avi->dv_demux) stream_index = 0; if (!avi->index_loaded) { /* we only load the index on demand */ avi_load_index(s); avi->index_loaded |= 1; } av_assert0(stream_index >= 0); st = s->streams[stream_index]; ast = st->priv_data; index = av_index_search_timestamp(st, timestamp * FFMAX(ast->sample_size, 1), flags); if (index < 0) { if (st->nb_index_entries > 0) av_log(s, AV_LOG_DEBUG, "Failed to find timestamp %"PRId64 " in index %"PRId64 " .. %"PRId64 "\n", timestamp * FFMAX(ast->sample_size, 1), st->index_entries[0].timestamp, st->index_entries[st->nb_index_entries - 1].timestamp); return AVERROR_INVALIDDATA; } /* find the position */ pos = st->index_entries[index].pos; timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1); av_log(s, AV_LOG_TRACE, "XX %"PRId64" %d %"PRId64"\n", timestamp, index, st->index_entries[index].timestamp); if (CONFIG_DV_DEMUXER && avi->dv_demux) { /* One and only one real stream for DV in AVI, and it has video */ /* offsets. Calling with other stream indexes should have failed */ /* the av_index_search_timestamp call above. */ if (avio_seek(s->pb, pos, SEEK_SET) < 0) return -1; /* Feed the DV video stream version of the timestamp to the */ /* DV demux so it can synthesize correct timestamps. */ ff_dv_offset_reset(avi->dv_demux, timestamp); avi->stream_index = -1; return 0; } pos_min = pos; for (i = 0; i < s->nb_streams; i++) { AVStream *st2 = s->streams[i]; AVIStream *ast2 = st2->priv_data; ast2->packet_size = ast2->remaining = 0; if (ast2->sub_ctx) { seek_subtitle(st, st2, timestamp); continue; } if (st2->nb_index_entries <= 0) continue; // av_assert1(st2->codecpar->block_align); av_assert0(fabs(av_q2d(st2->time_base) - ast2->scale / (double)ast2->rate) < av_q2d(st2->time_base) * 0.00000001); index = av_index_search_timestamp(st2, av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1), flags | AVSEEK_FLAG_BACKWARD | (st2->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0)); if (index < 0) index = 0; ast2->seek_pos = st2->index_entries[index].pos; pos_min = FFMIN(pos_min,ast2->seek_pos); } for (i = 0; i < s->nb_streams; i++) { AVStream *st2 = s->streams[i]; AVIStream *ast2 = st2->priv_data; if (ast2->sub_ctx || st2->nb_index_entries <= 0) continue; index = av_index_search_timestamp( st2, av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1), flags | AVSEEK_FLAG_BACKWARD | (st2->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0)); if (index < 0) index = 0; while (!avi->non_interleaved && index>0 && st2->index_entries[index-1].pos >= pos_min) index--; ast2->frame_offset = st2->index_entries[index].timestamp; } /* do the seek */ if (avio_seek(s->pb, pos_min, SEEK_SET) < 0) { av_log(s, AV_LOG_ERROR, "Seek failed\n"); return -1; } avi->stream_index = -1; avi->dts_max = INT_MIN; return 0; }
true
FFmpeg
14bac7e00d72eac687612d9b125e585011a56d4f
static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AVIContext *avi = s->priv_data; AVStream *st; int i, index; int64_t pos, pos_min; AVIStream *ast; if (avi->dv_demux) stream_index = 0; if (!avi->index_loaded) { avi_load_index(s); avi->index_loaded |= 1; } av_assert0(stream_index >= 0); st = s->streams[stream_index]; ast = st->priv_data; index = av_index_search_timestamp(st, timestamp * FFMAX(ast->sample_size, 1), flags); if (index < 0) { if (st->nb_index_entries > 0) av_log(s, AV_LOG_DEBUG, "Failed to find timestamp %"PRId64 " in index %"PRId64 " .. %"PRId64 "\n", timestamp * FFMAX(ast->sample_size, 1), st->index_entries[0].timestamp, st->index_entries[st->nb_index_entries - 1].timestamp); return AVERROR_INVALIDDATA; } pos = st->index_entries[index].pos; timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1); av_log(s, AV_LOG_TRACE, "XX %"PRId64" %d %"PRId64"\n", timestamp, index, st->index_entries[index].timestamp); if (CONFIG_DV_DEMUXER && avi->dv_demux) { if (avio_seek(s->pb, pos, SEEK_SET) < 0) return -1; ff_dv_offset_reset(avi->dv_demux, timestamp); avi->stream_index = -1; return 0; } pos_min = pos; for (i = 0; i < s->nb_streams; i++) { AVStream *st2 = s->streams[i]; AVIStream *ast2 = st2->priv_data; ast2->packet_size = ast2->remaining = 0; if (ast2->sub_ctx) { seek_subtitle(st, st2, timestamp); continue; } if (st2->nb_index_entries <= 0) continue; av_assert0(fabs(av_q2d(st2->time_base) - ast2->scale / (double)ast2->rate) < av_q2d(st2->time_base) * 0.00000001); index = av_index_search_timestamp(st2, av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1), flags | AVSEEK_FLAG_BACKWARD | (st2->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0)); if (index < 0) index = 0; ast2->seek_pos = st2->index_entries[index].pos; pos_min = FFMIN(pos_min,ast2->seek_pos); } for (i = 0; i < s->nb_streams; i++) { AVStream *st2 = s->streams[i]; AVIStream *ast2 = st2->priv_data; if (ast2->sub_ctx || st2->nb_index_entries <= 0) continue; index = av_index_search_timestamp( st2, av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1), flags | AVSEEK_FLAG_BACKWARD | (st2->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0)); if (index < 0) index = 0; while (!avi->non_interleaved && index>0 && st2->index_entries[index-1].pos >= pos_min) index--; ast2->frame_offset = st2->index_entries[index].timestamp; } if (avio_seek(s->pb, pos_min, SEEK_SET) < 0) { av_log(s, AV_LOG_ERROR, "Seek failed\n"); return -1; } avi->stream_index = -1; avi->dts_max = INT_MIN; return 0; }
{ "code": [ " av_assert0(fabs(av_q2d(st2->time_base) - ast2->scale / (double)ast2->rate) < av_q2d(st2->time_base) * 0.00000001);" ], "line_no": [ 153 ] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3) { AVIContext *avi = VAR_0->priv_data; AVStream *st; int VAR_4, VAR_5; int64_t pos, pos_min; AVIStream *ast; if (avi->dv_demux) VAR_1 = 0; if (!avi->index_loaded) { avi_load_index(VAR_0); avi->index_loaded |= 1; } av_assert0(VAR_1 >= 0); st = VAR_0->streams[VAR_1]; ast = st->priv_data; VAR_5 = av_index_search_timestamp(st, VAR_2 * FFMAX(ast->sample_size, 1), VAR_3); if (VAR_5 < 0) { if (st->nb_index_entries > 0) av_log(VAR_0, AV_LOG_DEBUG, "Failed to find VAR_2 %"PRId64 " in VAR_5 %"PRId64 " .. %"PRId64 "\n", VAR_2 * FFMAX(ast->sample_size, 1), st->index_entries[0].VAR_2, st->index_entries[st->nb_index_entries - 1].VAR_2); return AVERROR_INVALIDDATA; } pos = st->index_entries[VAR_5].pos; VAR_2 = st->index_entries[VAR_5].VAR_2 / FFMAX(ast->sample_size, 1); av_log(VAR_0, AV_LOG_TRACE, "XX %"PRId64" %d %"PRId64"\n", VAR_2, VAR_5, st->index_entries[VAR_5].VAR_2); if (CONFIG_DV_DEMUXER && avi->dv_demux) { if (avio_seek(VAR_0->pb, pos, SEEK_SET) < 0) return -1; ff_dv_offset_reset(avi->dv_demux, VAR_2); avi->VAR_1 = -1; return 0; } pos_min = pos; for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) { AVStream *st2 = VAR_0->streams[VAR_4]; AVIStream *ast2 = st2->priv_data; ast2->packet_size = ast2->remaining = 0; if (ast2->sub_ctx) { seek_subtitle(st, st2, VAR_2); continue; } if (st2->nb_index_entries <= 0) continue; av_assert0(fabs(av_q2d(st2->time_base) - ast2->scale / (double)ast2->rate) < av_q2d(st2->time_base) * 0.00000001); VAR_5 = av_index_search_timestamp(st2, av_rescale_q(VAR_2, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1), VAR_3 | AVSEEK_FLAG_BACKWARD | (st2->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0)); if (VAR_5 < 0) VAR_5 = 0; ast2->seek_pos = st2->index_entries[VAR_5].pos; pos_min = FFMIN(pos_min,ast2->seek_pos); } for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) { AVStream *st2 = VAR_0->streams[VAR_4]; AVIStream *ast2 = st2->priv_data; if (ast2->sub_ctx || st2->nb_index_entries <= 0) continue; VAR_5 = av_index_search_timestamp( st2, av_rescale_q(VAR_2, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1), VAR_3 | AVSEEK_FLAG_BACKWARD | (st2->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0)); if (VAR_5 < 0) VAR_5 = 0; while (!avi->non_interleaved && VAR_5>0 && st2->index_entries[VAR_5-1].pos >= pos_min) VAR_5--; ast2->frame_offset = st2->index_entries[VAR_5].VAR_2; } if (avio_seek(VAR_0->pb, pos_min, SEEK_SET) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Seek failed\n"); return -1; } avi->VAR_1 = -1; avi->dts_max = INT_MIN; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1,\nint64_t VAR_2, int VAR_3)\n{", "AVIContext *avi = VAR_0->priv_data;", "AVStream *st;", "int VAR_4, VAR_5;", "int64_t pos, pos_min;", "AVIStream *ast;", "if (avi->dv_demux)\nVAR_1 = 0;", "if (!avi->index_loaded) {", "avi_load_index(VAR_0);", "avi->index_loaded |= 1;", "}", "av_assert0(VAR_1 >= 0);", "st = VAR_0->streams[VAR_1];", "ast = st->priv_data;", "VAR_5 = av_index_search_timestamp(st,\nVAR_2 * FFMAX(ast->sample_size, 1),\nVAR_3);", "if (VAR_5 < 0) {", "if (st->nb_index_entries > 0)\nav_log(VAR_0, AV_LOG_DEBUG, \"Failed to find VAR_2 %\"PRId64 \" in VAR_5 %\"PRId64 \" .. %\"PRId64 \"\\n\",\nVAR_2 * FFMAX(ast->sample_size, 1),\nst->index_entries[0].VAR_2,\nst->index_entries[st->nb_index_entries - 1].VAR_2);", "return AVERROR_INVALIDDATA;", "}", "pos = st->index_entries[VAR_5].pos;", "VAR_2 = st->index_entries[VAR_5].VAR_2 / FFMAX(ast->sample_size, 1);", "av_log(VAR_0, AV_LOG_TRACE, \"XX %\"PRId64\" %d %\"PRId64\"\\n\",\nVAR_2, VAR_5, st->index_entries[VAR_5].VAR_2);", "if (CONFIG_DV_DEMUXER && avi->dv_demux) {", "if (avio_seek(VAR_0->pb, pos, SEEK_SET) < 0)\nreturn -1;", "ff_dv_offset_reset(avi->dv_demux, VAR_2);", "avi->VAR_1 = -1;", "return 0;", "}", "pos_min = pos;", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) {", "AVStream *st2 = VAR_0->streams[VAR_4];", "AVIStream *ast2 = st2->priv_data;", "ast2->packet_size =\nast2->remaining = 0;", "if (ast2->sub_ctx) {", "seek_subtitle(st, st2, VAR_2);", "continue;", "}", "if (st2->nb_index_entries <= 0)\ncontinue;", "av_assert0(fabs(av_q2d(st2->time_base) - ast2->scale / (double)ast2->rate) < av_q2d(st2->time_base) * 0.00000001);", "VAR_5 = av_index_search_timestamp(st2,\nav_rescale_q(VAR_2,\nst->time_base,\nst2->time_base) *\nFFMAX(ast2->sample_size, 1),\nVAR_3 |\nAVSEEK_FLAG_BACKWARD |\n(st2->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0));", "if (VAR_5 < 0)\nVAR_5 = 0;", "ast2->seek_pos = st2->index_entries[VAR_5].pos;", "pos_min = FFMIN(pos_min,ast2->seek_pos);", "}", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) {", "AVStream *st2 = VAR_0->streams[VAR_4];", "AVIStream *ast2 = st2->priv_data;", "if (ast2->sub_ctx || st2->nb_index_entries <= 0)\ncontinue;", "VAR_5 = av_index_search_timestamp(\nst2,\nav_rescale_q(VAR_2, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1),\nVAR_3 | AVSEEK_FLAG_BACKWARD | (st2->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0));", "if (VAR_5 < 0)\nVAR_5 = 0;", "while (!avi->non_interleaved && VAR_5>0 && st2->index_entries[VAR_5-1].pos >= pos_min)\nVAR_5--;", "ast2->frame_offset = st2->index_entries[VAR_5].VAR_2;", "}", "if (avio_seek(VAR_0->pb, pos_min, SEEK_SET) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Seek failed\\n\");", "return -1;", "}", "avi->VAR_1 = -1;", "avi->dts_max = INT_MIN;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 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 ], [ 25, 27 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49, 51, 53 ], [ 55 ], [ 57, 59, 61, 63, 65 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 87 ], [ 97, 99 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129, 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145, 147 ], [ 153 ], [ 155, 157, 159, 161, 163, 165, 167, 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189, 191 ], [ 195, 197, 199, 201 ], [ 203, 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ] ]
10,636
void ff_aac_coder_init_mips(AACEncContext *c) { #if HAVE_INLINE_ASM AACCoefficientsEncoder *e = c->coder; int option = c->options.aac_coder; if (option == 2) { e->quantize_and_encode_band = quantize_and_encode_band_mips; e->encode_window_bands_info = codebook_trellis_rate; #if HAVE_MIPSFPU e->search_for_quantizers = search_for_quantizers_twoloop; #endif /* HAVE_MIPSFPU */ } #if HAVE_MIPSFPU e->search_for_ms = search_for_ms_mips; #endif /* HAVE_MIPSFPU */ #endif /* HAVE_INLINE_ASM */ }
true
FFmpeg
97437bd17a8c5d4135b2f3b1b299bd7bb72ce02c
void ff_aac_coder_init_mips(AACEncContext *c) { #if HAVE_INLINE_ASM AACCoefficientsEncoder *e = c->coder; int option = c->options.aac_coder; if (option == 2) { e->quantize_and_encode_band = quantize_and_encode_band_mips; e->encode_window_bands_info = codebook_trellis_rate; #if HAVE_MIPSFPU e->search_for_quantizers = search_for_quantizers_twoloop; #endif } #if HAVE_MIPSFPU e->search_for_ms = search_for_ms_mips; #endif #endif }
{ "code": [ "#if HAVE_INLINE_ASM" ], "line_no": [ 3 ] }
void FUNC_0(AACEncContext *VAR_0) { #if HAVE_INLINE_ASM AACCoefficientsEncoder *e = VAR_0->coder; int option = VAR_0->options.aac_coder; if (option == 2) { e->quantize_and_encode_band = quantize_and_encode_band_mips; e->encode_window_bands_info = codebook_trellis_rate; #if HAVE_MIPSFPU e->search_for_quantizers = search_for_quantizers_twoloop; #endif } #if HAVE_MIPSFPU e->search_for_ms = search_for_ms_mips; #endif #endif }
[ "void FUNC_0(AACEncContext *VAR_0) {", "#if HAVE_INLINE_ASM\nAACCoefficientsEncoder *e = VAR_0->coder;", "int option = VAR_0->options.aac_coder;", "if (option == 2) {", "e->quantize_and_encode_band = quantize_and_encode_band_mips;", "e->encode_window_bands_info = codebook_trellis_rate;", "#if HAVE_MIPSFPU\ne->search_for_quantizers = search_for_quantizers_twoloop;", "#endif\n}", "#if HAVE_MIPSFPU\ne->search_for_ms = search_for_ms_mips;", "#endif\n#endif\n}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21, 23 ], [ 25, 27 ], [ 29, 31, 33 ] ]
10,637
static void gen_wsr_ps(DisasContext *dc, uint32_t sr, TCGv_i32 v) { uint32_t mask = PS_WOE | PS_CALLINC | PS_OWB | PS_UM | PS_EXCM | PS_INTLEVEL; if (option_enabled(dc, XTENSA_OPTION_MMU)) { mask |= PS_RING; } tcg_gen_andi_i32(cpu_SR[sr], v, mask); /* This can change mmu index, so exit tb */ gen_jumpi(dc, dc->next_pc, -1); }
true
qemu
797d780b1375b1af1d7713685589bfdec9908dc3
static void gen_wsr_ps(DisasContext *dc, uint32_t sr, TCGv_i32 v) { uint32_t mask = PS_WOE | PS_CALLINC | PS_OWB | PS_UM | PS_EXCM | PS_INTLEVEL; if (option_enabled(dc, XTENSA_OPTION_MMU)) { mask |= PS_RING; } tcg_gen_andi_i32(cpu_SR[sr], v, mask); gen_jumpi(dc, dc->next_pc, -1); }
{ "code": [ " gen_jumpi(dc, dc->next_pc, -1);" ], "line_no": [ 21 ] }
static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1, TCGv_i32 VAR_2) { uint32_t mask = PS_WOE | PS_CALLINC | PS_OWB | PS_UM | PS_EXCM | PS_INTLEVEL; if (option_enabled(VAR_0, XTENSA_OPTION_MMU)) { mask |= PS_RING; } tcg_gen_andi_i32(cpu_SR[VAR_1], VAR_2, mask); gen_jumpi(VAR_0, VAR_0->next_pc, -1); }
[ "static void FUNC_0(DisasContext *VAR_0, uint32_t VAR_1, TCGv_i32 VAR_2)\n{", "uint32_t mask = PS_WOE | PS_CALLINC | PS_OWB |\nPS_UM | PS_EXCM | PS_INTLEVEL;", "if (option_enabled(VAR_0, XTENSA_OPTION_MMU)) {", "mask |= PS_RING;", "}", "tcg_gen_andi_i32(cpu_SR[VAR_1], VAR_2, mask);", "gen_jumpi(VAR_0, VAR_0->next_pc, -1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ] ]
10,638
uint64_t HELPER(neon_abdl_s32)(uint32_t a, uint32_t b) { uint64_t tmp; uint64_t result; DO_ABD(result, a, b, int16_t); DO_ABD(tmp, a >> 16, b >> 16, int16_t); return result | (tmp << 32); }
true
qemu
4d9ad7f793605abd9806fc932b3e04e028894565
uint64_t HELPER(neon_abdl_s32)(uint32_t a, uint32_t b) { uint64_t tmp; uint64_t result; DO_ABD(result, a, b, int16_t); DO_ABD(tmp, a >> 16, b >> 16, int16_t); return result | (tmp << 32); }
{ "code": [ " DO_ABD(result, a, b, int16_t);", " DO_ABD(tmp, a >> 16, b >> 16, int16_t);" ], "line_no": [ 9, 11 ] }
uint64_t FUNC_0(neon_abdl_s32)(uint32_t a, uint32_t b) { uint64_t tmp; uint64_t result; DO_ABD(result, a, b, int16_t); DO_ABD(tmp, a >> 16, b >> 16, int16_t); return result | (tmp << 32); }
[ "uint64_t FUNC_0(neon_abdl_s32)(uint32_t a, uint32_t b)\n{", "uint64_t tmp;", "uint64_t result;", "DO_ABD(result, a, b, int16_t);", "DO_ABD(tmp, a >> 16, b >> 16, int16_t);", "return result | (tmp << 32);", "}" ]
[ 0, 0, 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
10,639
static int get_cox(J2kDecoderContext *s, J2kCodingStyle *c) { if (s->buf_end - s->buf < 5) return AVERROR(EINVAL); c->nreslevels = bytestream_get_byte(&s->buf) + 1; // num of resolution levels - 1 c->log2_cblk_width = bytestream_get_byte(&s->buf) + 2; // cblk width c->log2_cblk_height = bytestream_get_byte(&s->buf) + 2; // cblk height c->cblk_style = bytestream_get_byte(&s->buf); if (c->cblk_style != 0){ // cblk style av_log(s->avctx, AV_LOG_WARNING, "extra cblk styles %X\n", c->cblk_style); } c->transform = bytestream_get_byte(&s->buf); // transformation if (c->csty & J2K_CSTY_PREC) { int i; for (i = 0; i < c->nreslevels; i++) bytestream_get_byte(&s->buf); } return 0; }
true
FFmpeg
ddfa3751c092feaf1e080f66587024689dfe603c
static int get_cox(J2kDecoderContext *s, J2kCodingStyle *c) { if (s->buf_end - s->buf < 5) return AVERROR(EINVAL); c->nreslevels = bytestream_get_byte(&s->buf) + 1; c->log2_cblk_width = bytestream_get_byte(&s->buf) + 2; c->log2_cblk_height = bytestream_get_byte(&s->buf) + 2; c->cblk_style = bytestream_get_byte(&s->buf); if (c->cblk_style != 0){ av_log(s->avctx, AV_LOG_WARNING, "extra cblk styles %X\n", c->cblk_style); } c->transform = bytestream_get_byte(&s->buf); if (c->csty & J2K_CSTY_PREC) { int i; for (i = 0; i < c->nreslevels; i++) bytestream_get_byte(&s->buf); } return 0; }
{ "code": [ " return AVERROR(EINVAL);", " if (s->buf_end - s->buf < 5)", " c->cblk_style = bytestream_get_byte(&s->buf);", " bytestream_get_byte(&s->buf);", " if (s->buf_end - s->buf < 5)" ], "line_no": [ 7, 5, 17, 33, 5 ] }
static int FUNC_0(J2kDecoderContext *VAR_0, J2kCodingStyle *VAR_1) { if (VAR_0->buf_end - VAR_0->buf < 5) return AVERROR(EINVAL); VAR_1->nreslevels = bytestream_get_byte(&VAR_0->buf) + 1; VAR_1->log2_cblk_width = bytestream_get_byte(&VAR_0->buf) + 2; VAR_1->log2_cblk_height = bytestream_get_byte(&VAR_0->buf) + 2; VAR_1->cblk_style = bytestream_get_byte(&VAR_0->buf); if (VAR_1->cblk_style != 0){ av_log(VAR_0->avctx, AV_LOG_WARNING, "extra cblk styles %X\n", VAR_1->cblk_style); } VAR_1->transform = bytestream_get_byte(&VAR_0->buf); if (VAR_1->csty & J2K_CSTY_PREC) { int VAR_2; for (VAR_2 = 0; VAR_2 < VAR_1->nreslevels; VAR_2++) bytestream_get_byte(&VAR_0->buf); } return 0; }
[ "static int FUNC_0(J2kDecoderContext *VAR_0, J2kCodingStyle *VAR_1)\n{", "if (VAR_0->buf_end - VAR_0->buf < 5)\nreturn AVERROR(EINVAL);", "VAR_1->nreslevels = bytestream_get_byte(&VAR_0->buf) + 1;", "VAR_1->log2_cblk_width = bytestream_get_byte(&VAR_0->buf) + 2;", "VAR_1->log2_cblk_height = bytestream_get_byte(&VAR_0->buf) + 2;", "VAR_1->cblk_style = bytestream_get_byte(&VAR_0->buf);", "if (VAR_1->cblk_style != 0){", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"extra cblk styles %X\\n\", VAR_1->cblk_style);", "}", "VAR_1->transform = bytestream_get_byte(&VAR_0->buf);", "if (VAR_1->csty & J2K_CSTY_PREC) {", "int VAR_2;", "for (VAR_2 = 0; VAR_2 < VAR_1->nreslevels; VAR_2++)", "bytestream_get_byte(&VAR_0->buf);", "}", "return 0;", "}" ]
[ 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
10,641
QFloat *qobject_to_qfloat(const QObject *obj) { if (qobject_type(obj) != QTYPE_QFLOAT) return NULL; return container_of(obj, QFloat, base); }
true
qemu
fcf73f66a67f5e58c18216f8c8651e38cf4d90af
QFloat *qobject_to_qfloat(const QObject *obj) { if (qobject_type(obj) != QTYPE_QFLOAT) return NULL; return container_of(obj, QFloat, base); }
{ "code": [ " if (qobject_type(obj) != QTYPE_QFLOAT)" ], "line_no": [ 5 ] }
QFloat *FUNC_0(const QObject *obj) { if (qobject_type(obj) != QTYPE_QFLOAT) return NULL; return container_of(obj, QFloat, base); }
[ "QFloat *FUNC_0(const QObject *obj)\n{", "if (qobject_type(obj) != QTYPE_QFLOAT)\nreturn NULL;", "return container_of(obj, QFloat, base);", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11 ], [ 13 ] ]
10,642
void HELPER(divu)(CPUM68KState *env, uint32_t word) { uint32_t num; uint32_t den; uint32_t quot; uint32_t rem; num = env->div1; den = env->div2; /* ??? This needs to make sure the throwing location is accurate. */ if (den == 0) { raise_exception(env, EXCP_DIV0); } quot = num / den; rem = num % den; env->cc_v = (word && quot > 0xffff ? -1 : 0); env->cc_z = quot; env->cc_n = quot; env->cc_c = 0; env->div1 = quot; env->div2 = rem; }
true
qemu
0ccb9c1d8128a020720d5c6abf99a470742a1b94
void HELPER(divu)(CPUM68KState *env, uint32_t word) { uint32_t num; uint32_t den; uint32_t quot; uint32_t rem; num = env->div1; den = env->div2; if (den == 0) { raise_exception(env, EXCP_DIV0); } quot = num / den; rem = num % den; env->cc_v = (word && quot > 0xffff ? -1 : 0); env->cc_z = quot; env->cc_n = quot; env->cc_c = 0; env->div1 = quot; env->div2 = rem; }
{ "code": [ "void HELPER(divu)(CPUM68KState *env, uint32_t word)", " uint32_t num;", " uint32_t den;", " uint32_t quot;", " uint32_t rem;", " num = env->div1;", " den = env->div2;", " raise_exception(env, EXCP_DIV0);", " env->cc_v = (word && quot > 0xffff ? -1 : 0);", " env->div1 = quot;", " env->div2 = rem;", " num = env->div1;", " den = env->div2;", " raise_exception(env, EXCP_DIV0);", " env->cc_c = 0;", " env->div1 = quot;", " env->div2 = rem;" ], "line_no": [ 1, 5, 7, 9, 11, 15, 17, 23, 33, 43, 45, 15, 17, 23, 39, 43, 45 ] }
void FUNC_0(divu)(CPUM68KState *env, uint32_t word) { uint32_t num; uint32_t den; uint32_t quot; uint32_t rem; num = env->div1; den = env->div2; if (den == 0) { raise_exception(env, EXCP_DIV0); } quot = num / den; rem = num % den; env->cc_v = (word && quot > 0xffff ? -1 : 0); env->cc_z = quot; env->cc_n = quot; env->cc_c = 0; env->div1 = quot; env->div2 = rem; }
[ "void FUNC_0(divu)(CPUM68KState *env, uint32_t word)\n{", "uint32_t num;", "uint32_t den;", "uint32_t quot;", "uint32_t rem;", "num = env->div1;", "den = env->div2;", "if (den == 0) {", "raise_exception(env, EXCP_DIV0);", "}", "quot = num / den;", "rem = num % den;", "env->cc_v = (word && quot > 0xffff ? -1 : 0);", "env->cc_z = quot;", "env->cc_n = quot;", "env->cc_c = 0;", "env->div1 = quot;", "env->div2 = rem;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ] ]
10,643
void cpu_dump_state(CPUState *env, FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...), int flags) { int i, x; cpu_fprintf(f, "pc: " TARGET_FMT_lx " npc: " TARGET_FMT_lx "\n", env->pc, env->npc); cpu_fprintf(f, "General Registers:\n"); for (i = 0; i < 4; i++) cpu_fprintf(f, "%%g%c: " TARGET_FMT_lx "\t", i + '0', env->gregs[i]); cpu_fprintf(f, "\n"); for (; i < 8; i++) cpu_fprintf(f, "%%g%c: " TARGET_FMT_lx "\t", i + '0', env->gregs[i]); cpu_fprintf(f, "\nCurrent Register Window:\n"); for (x = 0; x < 3; x++) { for (i = 0; i < 4; i++) cpu_fprintf(f, "%%%c%d: " TARGET_FMT_lx "\t", (x == 0 ? 'o' : (x == 1 ? 'l' : 'i')), i, env->regwptr[i + x * 8]); cpu_fprintf(f, "\n"); for (; i < 8; i++) cpu_fprintf(f, "%%%c%d: " TARGET_FMT_lx "\t", (x == 0 ? 'o' : x == 1 ? 'l' : 'i'), i, env->regwptr[i + x * 8]); cpu_fprintf(f, "\n"); } cpu_fprintf(f, "\nFloating Point Registers:\n"); for (i = 0; i < 32; i++) { if ((i & 3) == 0) cpu_fprintf(f, "%%f%02d:", i); cpu_fprintf(f, " %016lf", env->fpr[i]); if ((i & 3) == 3) cpu_fprintf(f, "\n"); } #ifdef TARGET_SPARC64 cpu_fprintf(f, "pstate: 0x%08x ccr: 0x%02x asi: 0x%02x tl: %d fprs: %d\n", env->pstate, GET_CCR(env), env->asi, env->tl, env->fprs); cpu_fprintf(f, "cansave: %d canrestore: %d otherwin: %d wstate %d " "cleanwin %d cwp %d\n", env->cansave, env->canrestore, env->otherwin, env->wstate, env->cleanwin, env->nwindows - 1 - env->cwp); #else cpu_fprintf(f, "psr: 0x%08x -> %c%c%c%c %c%c%c wim: 0x%08x\n", GET_PSR(env), GET_FLAG(PSR_ZERO, 'Z'), GET_FLAG(PSR_OVF, 'V'), GET_FLAG(PSR_NEG, 'N'), GET_FLAG(PSR_CARRY, 'C'), env->psrs?'S':'-', env->psrps?'P':'-', env->psret?'E':'-', env->wim); #endif cpu_fprintf(f, "fsr: 0x%08x\n", GET_FSR32(env)); }
true
qemu
a37ee56cb7f2094a65fff14ed5d4ff325652b802
void cpu_dump_state(CPUState *env, FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...), int flags) { int i, x; cpu_fprintf(f, "pc: " TARGET_FMT_lx " npc: " TARGET_FMT_lx "\n", env->pc, env->npc); cpu_fprintf(f, "General Registers:\n"); for (i = 0; i < 4; i++) cpu_fprintf(f, "%%g%c: " TARGET_FMT_lx "\t", i + '0', env->gregs[i]); cpu_fprintf(f, "\n"); for (; i < 8; i++) cpu_fprintf(f, "%%g%c: " TARGET_FMT_lx "\t", i + '0', env->gregs[i]); cpu_fprintf(f, "\nCurrent Register Window:\n"); for (x = 0; x < 3; x++) { for (i = 0; i < 4; i++) cpu_fprintf(f, "%%%c%d: " TARGET_FMT_lx "\t", (x == 0 ? 'o' : (x == 1 ? 'l' : 'i')), i, env->regwptr[i + x * 8]); cpu_fprintf(f, "\n"); for (; i < 8; i++) cpu_fprintf(f, "%%%c%d: " TARGET_FMT_lx "\t", (x == 0 ? 'o' : x == 1 ? 'l' : 'i'), i, env->regwptr[i + x * 8]); cpu_fprintf(f, "\n"); } cpu_fprintf(f, "\nFloating Point Registers:\n"); for (i = 0; i < 32; i++) { if ((i & 3) == 0) cpu_fprintf(f, "%%f%02d:", i); cpu_fprintf(f, " %016lf", env->fpr[i]); if ((i & 3) == 3) cpu_fprintf(f, "\n"); } #ifdef TARGET_SPARC64 cpu_fprintf(f, "pstate: 0x%08x ccr: 0x%02x asi: 0x%02x tl: %d fprs: %d\n", env->pstate, GET_CCR(env), env->asi, env->tl, env->fprs); cpu_fprintf(f, "cansave: %d canrestore: %d otherwin: %d wstate %d " "cleanwin %d cwp %d\n", env->cansave, env->canrestore, env->otherwin, env->wstate, env->cleanwin, env->nwindows - 1 - env->cwp); #else cpu_fprintf(f, "psr: 0x%08x -> %c%c%c%c %c%c%c wim: 0x%08x\n", GET_PSR(env), GET_FLAG(PSR_ZERO, 'Z'), GET_FLAG(PSR_OVF, 'V'), GET_FLAG(PSR_NEG, 'N'), GET_FLAG(PSR_CARRY, 'C'), env->psrs?'S':'-', env->psrps?'P':'-', env->psret?'E':'-', env->wim); #endif cpu_fprintf(f, "fsr: 0x%08x\n", GET_FSR32(env)); }
{ "code": [ " cpu_fprintf(f, \" %016lf\", env->fpr[i]);" ], "line_no": [ 63 ] }
void FUNC_0(CPUState *VAR_0, FILE *VAR_3, int (*VAR_2)(FILE *VAR_3, const char *VAR_3, ...), int VAR_4) { int VAR_5, VAR_6; VAR_2(VAR_3, "pc: " TARGET_FMT_lx " npc: " TARGET_FMT_lx "\n", VAR_0->pc, VAR_0->npc); VAR_2(VAR_3, "General Registers:\n"); for (VAR_5 = 0; VAR_5 < 4; VAR_5++) VAR_2(VAR_3, "%%g%c: " TARGET_FMT_lx "\t", VAR_5 + '0', VAR_0->gregs[VAR_5]); VAR_2(VAR_3, "\n"); for (; VAR_5 < 8; VAR_5++) VAR_2(VAR_3, "%%g%c: " TARGET_FMT_lx "\t", VAR_5 + '0', VAR_0->gregs[VAR_5]); VAR_2(VAR_3, "\nCurrent Register Window:\n"); for (VAR_6 = 0; VAR_6 < 3; VAR_6++) { for (VAR_5 = 0; VAR_5 < 4; VAR_5++) VAR_2(VAR_3, "%%%c%d: " TARGET_FMT_lx "\t", (VAR_6 == 0 ? 'o' : (VAR_6 == 1 ? 'l' : 'VAR_5')), VAR_5, VAR_0->regwptr[VAR_5 + VAR_6 * 8]); VAR_2(VAR_3, "\n"); for (; VAR_5 < 8; VAR_5++) VAR_2(VAR_3, "%%%c%d: " TARGET_FMT_lx "\t", (VAR_6 == 0 ? 'o' : VAR_6 == 1 ? 'l' : 'VAR_5'), VAR_5, VAR_0->regwptr[VAR_5 + VAR_6 * 8]); VAR_2(VAR_3, "\n"); } VAR_2(VAR_3, "\nFloating Point Registers:\n"); for (VAR_5 = 0; VAR_5 < 32; VAR_5++) { if ((VAR_5 & 3) == 0) VAR_2(VAR_3, "%%VAR_3%02d:", VAR_5); VAR_2(VAR_3, " %016lf", VAR_0->fpr[VAR_5]); if ((VAR_5 & 3) == 3) VAR_2(VAR_3, "\n"); } #ifdef TARGET_SPARC64 VAR_2(VAR_3, "pstate: 0x%08x ccr: 0x%02x asi: 0x%02x tl: %d fprs: %d\n", VAR_0->pstate, GET_CCR(VAR_0), VAR_0->asi, VAR_0->tl, VAR_0->fprs); VAR_2(VAR_3, "cansave: %d canrestore: %d otherwin: %d wstate %d " "cleanwin %d cwp %d\n", VAR_0->cansave, VAR_0->canrestore, VAR_0->otherwin, VAR_0->wstate, VAR_0->cleanwin, VAR_0->nwindows - 1 - VAR_0->cwp); #else VAR_2(VAR_3, "psr: 0x%08x -> %c%c%c%c %c%c%c wim: 0x%08x\n", GET_PSR(VAR_0), GET_FLAG(PSR_ZERO, 'Z'), GET_FLAG(PSR_OVF, 'V'), GET_FLAG(PSR_NEG, 'N'), GET_FLAG(PSR_CARRY, 'C'), VAR_0->psrs?'S':'-', VAR_0->psrps?'P':'-', VAR_0->psret?'E':'-', VAR_0->wim); #endif VAR_2(VAR_3, "fsr: 0x%08x\n", GET_FSR32(VAR_0)); }
[ "void FUNC_0(CPUState *VAR_0, FILE *VAR_3,\nint (*VAR_2)(FILE *VAR_3, const char *VAR_3, ...),\nint VAR_4)\n{", "int VAR_5, VAR_6;", "VAR_2(VAR_3, \"pc: \" TARGET_FMT_lx \" npc: \" TARGET_FMT_lx \"\\n\", VAR_0->pc,\nVAR_0->npc);", "VAR_2(VAR_3, \"General Registers:\\n\");", "for (VAR_5 = 0; VAR_5 < 4; VAR_5++)", "VAR_2(VAR_3, \"%%g%c: \" TARGET_FMT_lx \"\\t\", VAR_5 + '0', VAR_0->gregs[VAR_5]);", "VAR_2(VAR_3, \"\\n\");", "for (; VAR_5 < 8; VAR_5++)", "VAR_2(VAR_3, \"%%g%c: \" TARGET_FMT_lx \"\\t\", VAR_5 + '0', VAR_0->gregs[VAR_5]);", "VAR_2(VAR_3, \"\\nCurrent Register Window:\\n\");", "for (VAR_6 = 0; VAR_6 < 3; VAR_6++) {", "for (VAR_5 = 0; VAR_5 < 4; VAR_5++)", "VAR_2(VAR_3, \"%%%c%d: \" TARGET_FMT_lx \"\\t\",\n(VAR_6 == 0 ? 'o' : (VAR_6 == 1 ? 'l' : 'VAR_5')), VAR_5,\nVAR_0->regwptr[VAR_5 + VAR_6 * 8]);", "VAR_2(VAR_3, \"\\n\");", "for (; VAR_5 < 8; VAR_5++)", "VAR_2(VAR_3, \"%%%c%d: \" TARGET_FMT_lx \"\\t\",\n(VAR_6 == 0 ? 'o' : VAR_6 == 1 ? 'l' : 'VAR_5'), VAR_5,\nVAR_0->regwptr[VAR_5 + VAR_6 * 8]);", "VAR_2(VAR_3, \"\\n\");", "}", "VAR_2(VAR_3, \"\\nFloating Point Registers:\\n\");", "for (VAR_5 = 0; VAR_5 < 32; VAR_5++) {", "if ((VAR_5 & 3) == 0)\nVAR_2(VAR_3, \"%%VAR_3%02d:\", VAR_5);", "VAR_2(VAR_3, \" %016lf\", VAR_0->fpr[VAR_5]);", "if ((VAR_5 & 3) == 3)\nVAR_2(VAR_3, \"\\n\");", "}", "#ifdef TARGET_SPARC64\nVAR_2(VAR_3, \"pstate: 0x%08x ccr: 0x%02x asi: 0x%02x tl: %d fprs: %d\\n\",\nVAR_0->pstate, GET_CCR(VAR_0), VAR_0->asi, VAR_0->tl, VAR_0->fprs);", "VAR_2(VAR_3, \"cansave: %d canrestore: %d otherwin: %d wstate %d \"\n\"cleanwin %d cwp %d\\n\",\nVAR_0->cansave, VAR_0->canrestore, VAR_0->otherwin, VAR_0->wstate,\nVAR_0->cleanwin, VAR_0->nwindows - 1 - VAR_0->cwp);", "#else\nVAR_2(VAR_3, \"psr: 0x%08x -> %c%c%c%c %c%c%c wim: 0x%08x\\n\",\nGET_PSR(VAR_0), GET_FLAG(PSR_ZERO, 'Z'), GET_FLAG(PSR_OVF, 'V'),\nGET_FLAG(PSR_NEG, 'N'), GET_FLAG(PSR_CARRY, 'C'),\nVAR_0->psrs?'S':'-', VAR_0->psrps?'P':'-',\nVAR_0->psret?'E':'-', VAR_0->wim);", "#endif\nVAR_2(VAR_3, \"fsr: 0x%08x\\n\", GET_FSR32(VAR_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 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37, 39 ], [ 41 ], [ 43 ], [ 45, 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73, 75 ], [ 77, 79, 81, 83 ], [ 85, 87, 89, 91, 93, 95 ], [ 97, 99 ], [ 101 ] ]
10,644
static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req) { uint32_t dw10 = le32_to_cpu(cmd->cdw10); uint32_t dw11 = le32_to_cpu(cmd->cdw11); switch (dw10) { case NVME_VOLATILE_WRITE_CACHE: blk_set_enable_write_cache(n->conf.blk, dw11 & 1); break; case NVME_NUMBER_OF_QUEUES: req->cqe.result = cpu_to_le32((n->num_queues - 1) | ((n->num_queues - 1) << 16)); break; default: return NVME_INVALID_FIELD | NVME_DNR; } return NVME_SUCCESS; }
true
qemu
cdd346371e09709be8e46398bb097dc690a746f2
static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req) { uint32_t dw10 = le32_to_cpu(cmd->cdw10); uint32_t dw11 = le32_to_cpu(cmd->cdw11); switch (dw10) { case NVME_VOLATILE_WRITE_CACHE: blk_set_enable_write_cache(n->conf.blk, dw11 & 1); break; case NVME_NUMBER_OF_QUEUES: req->cqe.result = cpu_to_le32((n->num_queues - 1) | ((n->num_queues - 1) << 16)); break; default: return NVME_INVALID_FIELD | NVME_DNR; } return NVME_SUCCESS; }
{ "code": [ " cpu_to_le32((n->num_queues - 1) | ((n->num_queues - 1) << 16));" ], "line_no": [ 23 ] }
static uint16_t FUNC_0(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req) { uint32_t dw10 = le32_to_cpu(cmd->cdw10); uint32_t dw11 = le32_to_cpu(cmd->cdw11); switch (dw10) { case NVME_VOLATILE_WRITE_CACHE: blk_set_enable_write_cache(n->conf.blk, dw11 & 1); break; case NVME_NUMBER_OF_QUEUES: req->cqe.result = cpu_to_le32((n->num_queues - 1) | ((n->num_queues - 1) << 16)); break; default: return NVME_INVALID_FIELD | NVME_DNR; } return NVME_SUCCESS; }
[ "static uint16_t FUNC_0(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req)\n{", "uint32_t dw10 = le32_to_cpu(cmd->cdw10);", "uint32_t dw11 = le32_to_cpu(cmd->cdw11);", "switch (dw10) {", "case NVME_VOLATILE_WRITE_CACHE:\nblk_set_enable_write_cache(n->conf.blk, dw11 & 1);", "break;", "case NVME_NUMBER_OF_QUEUES:\nreq->cqe.result =\ncpu_to_le32((n->num_queues - 1) | ((n->num_queues - 1) << 16));", "break;", "default:\nreturn NVME_INVALID_FIELD | NVME_DNR;", "}", "return NVME_SUCCESS;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19, 21, 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ] ]
10,645
static int flic_decode_frame_8BPP(AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *buf, int buf_size) { FlicDecodeContext *s = avctx->priv_data; GetByteContext g2; int pixel_ptr; int palette_ptr; unsigned char palette_idx1; unsigned char palette_idx2; unsigned int frame_size; int num_chunks; unsigned int chunk_size; int chunk_type; int i, j, ret; int color_packets; int color_changes; int color_shift; unsigned char r, g, b; int lines; int compressed_lines; int starting_line; signed short line_packets; int y_ptr; int byte_run; int pixel_skip; int pixel_countdown; unsigned char *pixels; unsigned int pixel_limit; bytestream2_init(&g2, buf, buf_size); if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; pixels = s->frame->data[0]; pixel_limit = s->avctx->height * s->frame->linesize[0]; if (buf_size < 16 || buf_size > INT_MAX - (3 * 256 + AV_INPUT_BUFFER_PADDING_SIZE)) frame_size = bytestream2_get_le32(&g2); if (frame_size > buf_size) frame_size = buf_size; bytestream2_skip(&g2, 2); /* skip the magic number */ num_chunks = bytestream2_get_le16(&g2); bytestream2_skip(&g2, 8); /* skip padding */ if (frame_size < 16) frame_size -= 16; /* iterate through the chunks */ while ((frame_size >= 6) && (num_chunks > 0) && bytestream2_get_bytes_left(&g2) >= 4) { int stream_ptr_after_chunk; chunk_size = bytestream2_get_le32(&g2); if (chunk_size > frame_size) { av_log(avctx, AV_LOG_WARNING, "Invalid chunk_size = %u > frame_size = %u\n", chunk_size, frame_size); chunk_size = frame_size; } stream_ptr_after_chunk = bytestream2_tell(&g2) - 4 + chunk_size; chunk_type = bytestream2_get_le16(&g2); switch (chunk_type) { case FLI_256_COLOR: case FLI_COLOR: /* check special case: If this file is from the Magic Carpet * game and uses 6-bit colors even though it reports 256-color * chunks in a 0xAF12-type file (fli_type is set to 0xAF13 during * initialization) */ if ((chunk_type == FLI_256_COLOR) && (s->fli_type != FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE)) color_shift = 0; else color_shift = 2; /* set up the palette */ color_packets = bytestream2_get_le16(&g2); palette_ptr = 0; for (i = 0; i < color_packets; i++) { /* first byte is how many colors to skip */ palette_ptr += bytestream2_get_byte(&g2); /* next byte indicates how many entries to change */ color_changes = bytestream2_get_byte(&g2); /* if there are 0 color changes, there are actually 256 */ if (color_changes == 0) color_changes = 256; if (bytestream2_tell(&g2) + color_changes * 3 > stream_ptr_after_chunk) break; for (j = 0; j < color_changes; j++) { unsigned int entry; /* wrap around, for good measure */ if ((unsigned)palette_ptr >= 256) palette_ptr = 0; r = bytestream2_get_byte(&g2) << color_shift; g = bytestream2_get_byte(&g2) << color_shift; b = bytestream2_get_byte(&g2) << color_shift; entry = 0xFFU << 24 | r << 16 | g << 8 | b; if (color_shift == 2) entry |= entry >> 6 & 0x30303; if (s->palette[palette_ptr] != entry) s->new_palette = 1; s->palette[palette_ptr++] = entry; } } break; case FLI_DELTA: y_ptr = 0; compressed_lines = bytestream2_get_le16(&g2); while (compressed_lines > 0) { if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; if (y_ptr > pixel_limit) line_packets = bytestream2_get_le16(&g2); if ((line_packets & 0xC000) == 0xC000) { // line skip opcode line_packets = -line_packets; if (line_packets > s->avctx->height) y_ptr += line_packets * s->frame->linesize[0]; } else if ((line_packets & 0xC000) == 0x4000) { av_log(avctx, AV_LOG_ERROR, "Undefined opcode (%x) in DELTA_FLI\n", line_packets); } else if ((line_packets & 0xC000) == 0x8000) { // "last byte" opcode pixel_ptr= y_ptr + s->frame->linesize[0] - 1; CHECK_PIXEL_PTR(0); pixels[pixel_ptr] = line_packets & 0xff; } else { compressed_lines--; pixel_ptr = y_ptr; CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; for (i = 0; i < line_packets; i++) { if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; /* account for the skip bytes */ pixel_skip = bytestream2_get_byte(&g2); pixel_ptr += pixel_skip; pixel_countdown -= pixel_skip; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run < 0) { byte_run = -byte_run; palette_idx1 = bytestream2_get_byte(&g2); palette_idx2 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run * 2); for (j = 0; j < byte_run; j++, pixel_countdown -= 2) { pixels[pixel_ptr++] = palette_idx1; pixels[pixel_ptr++] = palette_idx2; } } else { CHECK_PIXEL_PTR(byte_run * 2); if (bytestream2_tell(&g2) + byte_run * 2 > stream_ptr_after_chunk) break; for (j = 0; j < byte_run * 2; j++, pixel_countdown--) { pixels[pixel_ptr++] = bytestream2_get_byte(&g2); } } } y_ptr += s->frame->linesize[0]; } } break; case FLI_LC: /* line compressed */ starting_line = bytestream2_get_le16(&g2); y_ptr = 0; y_ptr += starting_line * s->frame->linesize[0]; compressed_lines = bytestream2_get_le16(&g2); while (compressed_lines > 0) { pixel_ptr = y_ptr; CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; line_packets = bytestream2_get_byte(&g2); if (line_packets > 0) { for (i = 0; i < line_packets; i++) { /* account for the skip bytes */ if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; pixel_skip = bytestream2_get_byte(&g2); pixel_ptr += pixel_skip; pixel_countdown -= pixel_skip; byte_run = sign_extend(bytestream2_get_byte(&g2),8); if (byte_run > 0) { CHECK_PIXEL_PTR(byte_run); if (bytestream2_tell(&g2) + byte_run > stream_ptr_after_chunk) break; for (j = 0; j < byte_run; j++, pixel_countdown--) { pixels[pixel_ptr++] = bytestream2_get_byte(&g2); } } else if (byte_run < 0) { byte_run = -byte_run; palette_idx1 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++, pixel_countdown--) { pixels[pixel_ptr++] = palette_idx1; } } } } y_ptr += s->frame->linesize[0]; compressed_lines--; } break; case FLI_BLACK: /* set the whole frame to color 0 (which is usually black) */ memset(pixels, 0, s->frame->linesize[0] * s->avctx->height); break; case FLI_BRUN: /* Byte run compression: This chunk type only occurs in the first * FLI frame and it will update the entire frame. */ y_ptr = 0; for (lines = 0; lines < s->avctx->height; lines++) { pixel_ptr = y_ptr; /* disregard the line packets; instead, iterate through all * pixels on a row */ bytestream2_skip(&g2, 1); pixel_countdown = s->avctx->width; while (pixel_countdown > 0) { if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (!byte_run) { av_log(avctx, AV_LOG_ERROR, "Invalid byte run value.\n"); } if (byte_run > 0) { palette_idx1 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { pixels[pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n", pixel_countdown, lines); } } else { /* copy bytes if byte_run < 0 */ byte_run = -byte_run; CHECK_PIXEL_PTR(byte_run); if (bytestream2_tell(&g2) + byte_run > stream_ptr_after_chunk) break; for (j = 0; j < byte_run; j++) { pixels[pixel_ptr++] = bytestream2_get_byte(&g2); pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n", pixel_countdown, lines); } } } y_ptr += s->frame->linesize[0]; } break; case FLI_COPY: /* copy the chunk (uncompressed frame) */ if (chunk_size - 6 != FFALIGN(s->avctx->width, 4) * s->avctx->height) { av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \ "has incorrect size, skipping chunk\n", chunk_size - 6); bytestream2_skip(&g2, chunk_size - 6); } else { for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height; y_ptr += s->frame->linesize[0]) { bytestream2_get_buffer(&g2, &pixels[y_ptr], s->avctx->width); if (s->avctx->width & 3) bytestream2_skip(&g2, 4 - (s->avctx->width & 3)); } } break; case FLI_MINI: /* some sort of a thumbnail? disregard this chunk... */ break; default: av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type); break; } if (stream_ptr_after_chunk - bytestream2_tell(&g2) >= 0) { bytestream2_skip(&g2, stream_ptr_after_chunk - bytestream2_tell(&g2)); } else { av_log(avctx, AV_LOG_ERROR, "Chunk overread\n"); break; } frame_size -= chunk_size; num_chunks--; } /* by the end of the chunk, the stream ptr should equal the frame * size (minus 1 or 2, possibly); if it doesn't, issue a warning */ if (bytestream2_get_bytes_left(&g2) > 2) av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \ "and final chunk ptr = %d\n", buf_size, buf_size - bytestream2_get_bytes_left(&g2)); /* make the palette available on the way out */ memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE); if (s->new_palette) { s->frame->palette_has_changed = 1; s->new_palette = 0; } if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; return buf_size; }
true
FFmpeg
90e8317b3b33dcb54ae01e419d85cbbfbd874963
static int flic_decode_frame_8BPP(AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *buf, int buf_size) { FlicDecodeContext *s = avctx->priv_data; GetByteContext g2; int pixel_ptr; int palette_ptr; unsigned char palette_idx1; unsigned char palette_idx2; unsigned int frame_size; int num_chunks; unsigned int chunk_size; int chunk_type; int i, j, ret; int color_packets; int color_changes; int color_shift; unsigned char r, g, b; int lines; int compressed_lines; int starting_line; signed short line_packets; int y_ptr; int byte_run; int pixel_skip; int pixel_countdown; unsigned char *pixels; unsigned int pixel_limit; bytestream2_init(&g2, buf, buf_size); if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; pixels = s->frame->data[0]; pixel_limit = s->avctx->height * s->frame->linesize[0]; if (buf_size < 16 || buf_size > INT_MAX - (3 * 256 + AV_INPUT_BUFFER_PADDING_SIZE)) frame_size = bytestream2_get_le32(&g2); if (frame_size > buf_size) frame_size = buf_size; bytestream2_skip(&g2, 2); num_chunks = bytestream2_get_le16(&g2); bytestream2_skip(&g2, 8); if (frame_size < 16) frame_size -= 16; while ((frame_size >= 6) && (num_chunks > 0) && bytestream2_get_bytes_left(&g2) >= 4) { int stream_ptr_after_chunk; chunk_size = bytestream2_get_le32(&g2); if (chunk_size > frame_size) { av_log(avctx, AV_LOG_WARNING, "Invalid chunk_size = %u > frame_size = %u\n", chunk_size, frame_size); chunk_size = frame_size; } stream_ptr_after_chunk = bytestream2_tell(&g2) - 4 + chunk_size; chunk_type = bytestream2_get_le16(&g2); switch (chunk_type) { case FLI_256_COLOR: case FLI_COLOR: if ((chunk_type == FLI_256_COLOR) && (s->fli_type != FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE)) color_shift = 0; else color_shift = 2; color_packets = bytestream2_get_le16(&g2); palette_ptr = 0; for (i = 0; i < color_packets; i++) { palette_ptr += bytestream2_get_byte(&g2); color_changes = bytestream2_get_byte(&g2); if (color_changes == 0) color_changes = 256; if (bytestream2_tell(&g2) + color_changes * 3 > stream_ptr_after_chunk) break; for (j = 0; j < color_changes; j++) { unsigned int entry; if ((unsigned)palette_ptr >= 256) palette_ptr = 0; r = bytestream2_get_byte(&g2) << color_shift; g = bytestream2_get_byte(&g2) << color_shift; b = bytestream2_get_byte(&g2) << color_shift; entry = 0xFFU << 24 | r << 16 | g << 8 | b; if (color_shift == 2) entry |= entry >> 6 & 0x30303; if (s->palette[palette_ptr] != entry) s->new_palette = 1; s->palette[palette_ptr++] = entry; } } break; case FLI_DELTA: y_ptr = 0; compressed_lines = bytestream2_get_le16(&g2); while (compressed_lines > 0) { if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; if (y_ptr > pixel_limit) line_packets = bytestream2_get_le16(&g2); if ((line_packets & 0xC000) == 0xC000) { line_packets = -line_packets; if (line_packets > s->avctx->height) y_ptr += line_packets * s->frame->linesize[0]; } else if ((line_packets & 0xC000) == 0x4000) { av_log(avctx, AV_LOG_ERROR, "Undefined opcode (%x) in DELTA_FLI\n", line_packets); } else if ((line_packets & 0xC000) == 0x8000) { pixel_ptr= y_ptr + s->frame->linesize[0] - 1; CHECK_PIXEL_PTR(0); pixels[pixel_ptr] = line_packets & 0xff; } else { compressed_lines--; pixel_ptr = y_ptr; CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; for (i = 0; i < line_packets; i++) { if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; pixel_skip = bytestream2_get_byte(&g2); pixel_ptr += pixel_skip; pixel_countdown -= pixel_skip; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run < 0) { byte_run = -byte_run; palette_idx1 = bytestream2_get_byte(&g2); palette_idx2 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run * 2); for (j = 0; j < byte_run; j++, pixel_countdown -= 2) { pixels[pixel_ptr++] = palette_idx1; pixels[pixel_ptr++] = palette_idx2; } } else { CHECK_PIXEL_PTR(byte_run * 2); if (bytestream2_tell(&g2) + byte_run * 2 > stream_ptr_after_chunk) break; for (j = 0; j < byte_run * 2; j++, pixel_countdown--) { pixels[pixel_ptr++] = bytestream2_get_byte(&g2); } } } y_ptr += s->frame->linesize[0]; } } break; case FLI_LC: starting_line = bytestream2_get_le16(&g2); y_ptr = 0; y_ptr += starting_line * s->frame->linesize[0]; compressed_lines = bytestream2_get_le16(&g2); while (compressed_lines > 0) { pixel_ptr = y_ptr; CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; line_packets = bytestream2_get_byte(&g2); if (line_packets > 0) { for (i = 0; i < line_packets; i++) { if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; pixel_skip = bytestream2_get_byte(&g2); pixel_ptr += pixel_skip; pixel_countdown -= pixel_skip; byte_run = sign_extend(bytestream2_get_byte(&g2),8); if (byte_run > 0) { CHECK_PIXEL_PTR(byte_run); if (bytestream2_tell(&g2) + byte_run > stream_ptr_after_chunk) break; for (j = 0; j < byte_run; j++, pixel_countdown--) { pixels[pixel_ptr++] = bytestream2_get_byte(&g2); } } else if (byte_run < 0) { byte_run = -byte_run; palette_idx1 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++, pixel_countdown--) { pixels[pixel_ptr++] = palette_idx1; } } } } y_ptr += s->frame->linesize[0]; compressed_lines--; } break; case FLI_BLACK: memset(pixels, 0, s->frame->linesize[0] * s->avctx->height); break; case FLI_BRUN: y_ptr = 0; for (lines = 0; lines < s->avctx->height; lines++) { pixel_ptr = y_ptr; bytestream2_skip(&g2, 1); pixel_countdown = s->avctx->width; while (pixel_countdown > 0) { if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (!byte_run) { av_log(avctx, AV_LOG_ERROR, "Invalid byte run value.\n"); } if (byte_run > 0) { palette_idx1 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { pixels[pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n", pixel_countdown, lines); } } else { byte_run = -byte_run; CHECK_PIXEL_PTR(byte_run); if (bytestream2_tell(&g2) + byte_run > stream_ptr_after_chunk) break; for (j = 0; j < byte_run; j++) { pixels[pixel_ptr++] = bytestream2_get_byte(&g2); pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n", pixel_countdown, lines); } } } y_ptr += s->frame->linesize[0]; } break; case FLI_COPY: if (chunk_size - 6 != FFALIGN(s->avctx->width, 4) * s->avctx->height) { av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \ "has incorrect size, skipping chunk\n", chunk_size - 6); bytestream2_skip(&g2, chunk_size - 6); } else { for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height; y_ptr += s->frame->linesize[0]) { bytestream2_get_buffer(&g2, &pixels[y_ptr], s->avctx->width); if (s->avctx->width & 3) bytestream2_skip(&g2, 4 - (s->avctx->width & 3)); } } break; case FLI_MINI: break; default: av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type); break; } if (stream_ptr_after_chunk - bytestream2_tell(&g2) >= 0) { bytestream2_skip(&g2, stream_ptr_after_chunk - bytestream2_tell(&g2)); } else { av_log(avctx, AV_LOG_ERROR, "Chunk overread\n"); break; } frame_size -= chunk_size; num_chunks--; } if (bytestream2_get_bytes_left(&g2) > 2) av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \ "and final chunk ptr = %d\n", buf_size, buf_size - bytestream2_get_bytes_left(&g2)); memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE); if (s->new_palette) { s->frame->palette_has_changed = 1; s->new_palette = 0; } if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, const uint8_t *VAR_3, int VAR_4) { FlicDecodeContext *s = VAR_0->priv_data; GetByteContext g2; int VAR_5; int VAR_6; unsigned char VAR_7; unsigned char VAR_8; unsigned int VAR_9; int VAR_10; unsigned int VAR_11; int VAR_12; int VAR_13, VAR_14, VAR_15; int VAR_16; int VAR_17; int VAR_18; unsigned char VAR_19, VAR_20, VAR_21; int VAR_22; int VAR_23; int VAR_24; signed short VAR_25; int VAR_26; int VAR_27; int VAR_28; int VAR_29; unsigned char *VAR_30; unsigned int VAR_31; bytestream2_init(&g2, VAR_3, VAR_4); if ((VAR_15 = ff_reget_buffer(VAR_0, s->frame)) < 0) return VAR_15; VAR_30 = s->frame->VAR_1[0]; VAR_31 = s->VAR_0->height * s->frame->linesize[0]; if (VAR_4 < 16 || VAR_4 > INT_MAX - (3 * 256 + AV_INPUT_BUFFER_PADDING_SIZE)) VAR_9 = bytestream2_get_le32(&g2); if (VAR_9 > VAR_4) VAR_9 = VAR_4; bytestream2_skip(&g2, 2); VAR_10 = bytestream2_get_le16(&g2); bytestream2_skip(&g2, 8); if (VAR_9 < 16) VAR_9 -= 16; while ((VAR_9 >= 6) && (VAR_10 > 0) && bytestream2_get_bytes_left(&g2) >= 4) { int VAR_32; VAR_11 = bytestream2_get_le32(&g2); if (VAR_11 > VAR_9) { av_log(VAR_0, AV_LOG_WARNING, "Invalid VAR_11 = %u > VAR_9 = %u\n", VAR_11, VAR_9); VAR_11 = VAR_9; } VAR_32 = bytestream2_tell(&g2) - 4 + VAR_11; VAR_12 = bytestream2_get_le16(&g2); switch (VAR_12) { case FLI_256_COLOR: case FLI_COLOR: if ((VAR_12 == FLI_256_COLOR) && (s->fli_type != FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE)) VAR_18 = 0; else VAR_18 = 2; VAR_16 = bytestream2_get_le16(&g2); VAR_6 = 0; for (VAR_13 = 0; VAR_13 < VAR_16; VAR_13++) { VAR_6 += bytestream2_get_byte(&g2); VAR_17 = bytestream2_get_byte(&g2); if (VAR_17 == 0) VAR_17 = 256; if (bytestream2_tell(&g2) + VAR_17 * 3 > VAR_32) break; for (VAR_14 = 0; VAR_14 < VAR_17; VAR_14++) { unsigned int VAR_33; if ((unsigned)VAR_6 >= 256) VAR_6 = 0; VAR_19 = bytestream2_get_byte(&g2) << VAR_18; VAR_20 = bytestream2_get_byte(&g2) << VAR_18; VAR_21 = bytestream2_get_byte(&g2) << VAR_18; VAR_33 = 0xFFU << 24 | VAR_19 << 16 | VAR_20 << 8 | VAR_21; if (VAR_18 == 2) VAR_33 |= VAR_33 >> 6 & 0x30303; if (s->palette[VAR_6] != VAR_33) s->new_palette = 1; s->palette[VAR_6++] = VAR_33; } } break; case FLI_DELTA: VAR_26 = 0; VAR_23 = bytestream2_get_le16(&g2); while (VAR_23 > 0) { if (bytestream2_tell(&g2) + 2 > VAR_32) break; if (VAR_26 > VAR_31) VAR_25 = bytestream2_get_le16(&g2); if ((VAR_25 & 0xC000) == 0xC000) { VAR_25 = -VAR_25; if (VAR_25 > s->VAR_0->height) VAR_26 += VAR_25 * s->frame->linesize[0]; } else if ((VAR_25 & 0xC000) == 0x4000) { av_log(VAR_0, AV_LOG_ERROR, "Undefined opcode (%x) in DELTA_FLI\n", VAR_25); } else if ((VAR_25 & 0xC000) == 0x8000) { VAR_5= VAR_26 + s->frame->linesize[0] - 1; CHECK_PIXEL_PTR(0); VAR_30[VAR_5] = VAR_25 & 0xff; } else { VAR_23--; VAR_5 = VAR_26; CHECK_PIXEL_PTR(0); VAR_29 = s->VAR_0->width; for (VAR_13 = 0; VAR_13 < VAR_25; VAR_13++) { if (bytestream2_tell(&g2) + 2 > VAR_32) break; VAR_28 = bytestream2_get_byte(&g2); VAR_5 += VAR_28; VAR_29 -= VAR_28; VAR_27 = sign_extend(bytestream2_get_byte(&g2), 8); if (VAR_27 < 0) { VAR_27 = -VAR_27; VAR_7 = bytestream2_get_byte(&g2); VAR_8 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(VAR_27 * 2); for (VAR_14 = 0; VAR_14 < VAR_27; VAR_14++, VAR_29 -= 2) { VAR_30[VAR_5++] = VAR_7; VAR_30[VAR_5++] = VAR_8; } } else { CHECK_PIXEL_PTR(VAR_27 * 2); if (bytestream2_tell(&g2) + VAR_27 * 2 > VAR_32) break; for (VAR_14 = 0; VAR_14 < VAR_27 * 2; VAR_14++, VAR_29--) { VAR_30[VAR_5++] = bytestream2_get_byte(&g2); } } } VAR_26 += s->frame->linesize[0]; } } break; case FLI_LC: VAR_24 = bytestream2_get_le16(&g2); VAR_26 = 0; VAR_26 += VAR_24 * s->frame->linesize[0]; VAR_23 = bytestream2_get_le16(&g2); while (VAR_23 > 0) { VAR_5 = VAR_26; CHECK_PIXEL_PTR(0); VAR_29 = s->VAR_0->width; if (bytestream2_tell(&g2) + 1 > VAR_32) break; VAR_25 = bytestream2_get_byte(&g2); if (VAR_25 > 0) { for (VAR_13 = 0; VAR_13 < VAR_25; VAR_13++) { if (bytestream2_tell(&g2) + 1 > VAR_32) break; VAR_28 = bytestream2_get_byte(&g2); VAR_5 += VAR_28; VAR_29 -= VAR_28; VAR_27 = sign_extend(bytestream2_get_byte(&g2),8); if (VAR_27 > 0) { CHECK_PIXEL_PTR(VAR_27); if (bytestream2_tell(&g2) + VAR_27 > VAR_32) break; for (VAR_14 = 0; VAR_14 < VAR_27; VAR_14++, VAR_29--) { VAR_30[VAR_5++] = bytestream2_get_byte(&g2); } } else if (VAR_27 < 0) { VAR_27 = -VAR_27; VAR_7 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(VAR_27); for (VAR_14 = 0; VAR_14 < VAR_27; VAR_14++, VAR_29--) { VAR_30[VAR_5++] = VAR_7; } } } } VAR_26 += s->frame->linesize[0]; VAR_23--; } break; case FLI_BLACK: memset(VAR_30, 0, s->frame->linesize[0] * s->VAR_0->height); break; case FLI_BRUN: VAR_26 = 0; for (VAR_22 = 0; VAR_22 < s->VAR_0->height; VAR_22++) { VAR_5 = VAR_26; bytestream2_skip(&g2, 1); VAR_29 = s->VAR_0->width; while (VAR_29 > 0) { if (bytestream2_tell(&g2) + 1 > VAR_32) break; VAR_27 = sign_extend(bytestream2_get_byte(&g2), 8); if (!VAR_27) { av_log(VAR_0, AV_LOG_ERROR, "Invalid byte run value.\n"); } if (VAR_27 > 0) { VAR_7 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(VAR_27); for (VAR_14 = 0; VAR_14 < VAR_27; VAR_14++) { VAR_30[VAR_5++] = VAR_7; VAR_29--; if (VAR_29 < 0) av_log(VAR_0, AV_LOG_ERROR, "VAR_29 < 0 (%d) at line %d\n", VAR_29, VAR_22); } } else { VAR_27 = -VAR_27; CHECK_PIXEL_PTR(VAR_27); if (bytestream2_tell(&g2) + VAR_27 > VAR_32) break; for (VAR_14 = 0; VAR_14 < VAR_27; VAR_14++) { VAR_30[VAR_5++] = bytestream2_get_byte(&g2); VAR_29--; if (VAR_29 < 0) av_log(VAR_0, AV_LOG_ERROR, "VAR_29 < 0 (%d) at line %d\n", VAR_29, VAR_22); } } } VAR_26 += s->frame->linesize[0]; } break; case FLI_COPY: if (VAR_11 - 6 != FFALIGN(s->VAR_0->width, 4) * s->VAR_0->height) { av_log(VAR_0, AV_LOG_ERROR, "In chunk FLI_COPY : source VAR_1 (%d bytes) " \ "has incorrect size, skipping chunk\n", VAR_11 - 6); bytestream2_skip(&g2, VAR_11 - 6); } else { for (VAR_26 = 0; VAR_26 < s->frame->linesize[0] * s->VAR_0->height; VAR_26 += s->frame->linesize[0]) { bytestream2_get_buffer(&g2, &VAR_30[VAR_26], s->VAR_0->width); if (s->VAR_0->width & 3) bytestream2_skip(&g2, 4 - (s->VAR_0->width & 3)); } } break; case FLI_MINI: break; default: av_log(VAR_0, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", VAR_12); break; } if (VAR_32 - bytestream2_tell(&g2) >= 0) { bytestream2_skip(&g2, VAR_32 - bytestream2_tell(&g2)); } else { av_log(VAR_0, AV_LOG_ERROR, "Chunk overread\n"); break; } VAR_9 -= VAR_11; VAR_10--; } if (bytestream2_get_bytes_left(&g2) > 2) av_log(VAR_0, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \ "and final chunk ptr = %d\n", VAR_4, VAR_4 - bytestream2_get_bytes_left(&g2)); memcpy(s->frame->VAR_1[1], s->palette, AVPALETTE_SIZE); if (s->new_palette) { s->frame->palette_has_changed = 1; s->new_palette = 0; } if ((VAR_15 = av_frame_ref(VAR_1, s->frame)) < 0) return VAR_15; *VAR_2 = 1; return VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nconst uint8_t *VAR_3, int VAR_4)\n{", "FlicDecodeContext *s = VAR_0->priv_data;", "GetByteContext g2;", "int VAR_5;", "int VAR_6;", "unsigned char VAR_7;", "unsigned char VAR_8;", "unsigned int VAR_9;", "int VAR_10;", "unsigned int VAR_11;", "int VAR_12;", "int VAR_13, VAR_14, VAR_15;", "int VAR_16;", "int VAR_17;", "int VAR_18;", "unsigned char VAR_19, VAR_20, VAR_21;", "int VAR_22;", "int VAR_23;", "int VAR_24;", "signed short VAR_25;", "int VAR_26;", "int VAR_27;", "int VAR_28;", "int VAR_29;", "unsigned char *VAR_30;", "unsigned int VAR_31;", "bytestream2_init(&g2, VAR_3, VAR_4);", "if ((VAR_15 = ff_reget_buffer(VAR_0, s->frame)) < 0)\nreturn VAR_15;", "VAR_30 = s->frame->VAR_1[0];", "VAR_31 = s->VAR_0->height * s->frame->linesize[0];", "if (VAR_4 < 16 || VAR_4 > INT_MAX - (3 * 256 + AV_INPUT_BUFFER_PADDING_SIZE))\nVAR_9 = bytestream2_get_le32(&g2);", "if (VAR_9 > VAR_4)\nVAR_9 = VAR_4;", "bytestream2_skip(&g2, 2);", "VAR_10 = bytestream2_get_le16(&g2);", "bytestream2_skip(&g2, 8);", "if (VAR_9 < 16)\nVAR_9 -= 16;", "while ((VAR_9 >= 6) && (VAR_10 > 0) &&\nbytestream2_get_bytes_left(&g2) >= 4) {", "int VAR_32;", "VAR_11 = bytestream2_get_le32(&g2);", "if (VAR_11 > VAR_9) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"Invalid VAR_11 = %u > VAR_9 = %u\\n\", VAR_11, VAR_9);", "VAR_11 = VAR_9;", "}", "VAR_32 = bytestream2_tell(&g2) - 4 + VAR_11;", "VAR_12 = bytestream2_get_le16(&g2);", "switch (VAR_12) {", "case FLI_256_COLOR:\ncase FLI_COLOR:\nif ((VAR_12 == FLI_256_COLOR) && (s->fli_type != FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE))\nVAR_18 = 0;", "else\nVAR_18 = 2;", "VAR_16 = bytestream2_get_le16(&g2);", "VAR_6 = 0;", "for (VAR_13 = 0; VAR_13 < VAR_16; VAR_13++) {", "VAR_6 += bytestream2_get_byte(&g2);", "VAR_17 = bytestream2_get_byte(&g2);", "if (VAR_17 == 0)\nVAR_17 = 256;", "if (bytestream2_tell(&g2) + VAR_17 * 3 > VAR_32)\nbreak;", "for (VAR_14 = 0; VAR_14 < VAR_17; VAR_14++) {", "unsigned int VAR_33;", "if ((unsigned)VAR_6 >= 256)\nVAR_6 = 0;", "VAR_19 = bytestream2_get_byte(&g2) << VAR_18;", "VAR_20 = bytestream2_get_byte(&g2) << VAR_18;", "VAR_21 = bytestream2_get_byte(&g2) << VAR_18;", "VAR_33 = 0xFFU << 24 | VAR_19 << 16 | VAR_20 << 8 | VAR_21;", "if (VAR_18 == 2)\nVAR_33 |= VAR_33 >> 6 & 0x30303;", "if (s->palette[VAR_6] != VAR_33)\ns->new_palette = 1;", "s->palette[VAR_6++] = VAR_33;", "}", "}", "break;", "case FLI_DELTA:\nVAR_26 = 0;", "VAR_23 = bytestream2_get_le16(&g2);", "while (VAR_23 > 0) {", "if (bytestream2_tell(&g2) + 2 > VAR_32)\nbreak;", "if (VAR_26 > VAR_31)\nVAR_25 = bytestream2_get_le16(&g2);", "if ((VAR_25 & 0xC000) == 0xC000) {", "VAR_25 = -VAR_25;", "if (VAR_25 > s->VAR_0->height)\nVAR_26 += VAR_25 * s->frame->linesize[0];", "} else if ((VAR_25 & 0xC000) == 0x4000) {", "av_log(VAR_0, AV_LOG_ERROR, \"Undefined opcode (%x) in DELTA_FLI\\n\", VAR_25);", "} else if ((VAR_25 & 0xC000) == 0x8000) {", "VAR_5= VAR_26 + s->frame->linesize[0] - 1;", "CHECK_PIXEL_PTR(0);", "VAR_30[VAR_5] = VAR_25 & 0xff;", "} else {", "VAR_23--;", "VAR_5 = VAR_26;", "CHECK_PIXEL_PTR(0);", "VAR_29 = s->VAR_0->width;", "for (VAR_13 = 0; VAR_13 < VAR_25; VAR_13++) {", "if (bytestream2_tell(&g2) + 2 > VAR_32)\nbreak;", "VAR_28 = bytestream2_get_byte(&g2);", "VAR_5 += VAR_28;", "VAR_29 -= VAR_28;", "VAR_27 = sign_extend(bytestream2_get_byte(&g2), 8);", "if (VAR_27 < 0) {", "VAR_27 = -VAR_27;", "VAR_7 = bytestream2_get_byte(&g2);", "VAR_8 = bytestream2_get_byte(&g2);", "CHECK_PIXEL_PTR(VAR_27 * 2);", "for (VAR_14 = 0; VAR_14 < VAR_27; VAR_14++, VAR_29 -= 2) {", "VAR_30[VAR_5++] = VAR_7;", "VAR_30[VAR_5++] = VAR_8;", "}", "} else {", "CHECK_PIXEL_PTR(VAR_27 * 2);", "if (bytestream2_tell(&g2) + VAR_27 * 2 > VAR_32)\nbreak;", "for (VAR_14 = 0; VAR_14 < VAR_27 * 2; VAR_14++, VAR_29--) {", "VAR_30[VAR_5++] = bytestream2_get_byte(&g2);", "}", "}", "}", "VAR_26 += s->frame->linesize[0];", "}", "}", "break;", "case FLI_LC:\nVAR_24 = bytestream2_get_le16(&g2);", "VAR_26 = 0;", "VAR_26 += VAR_24 * s->frame->linesize[0];", "VAR_23 = bytestream2_get_le16(&g2);", "while (VAR_23 > 0) {", "VAR_5 = VAR_26;", "CHECK_PIXEL_PTR(0);", "VAR_29 = s->VAR_0->width;", "if (bytestream2_tell(&g2) + 1 > VAR_32)\nbreak;", "VAR_25 = bytestream2_get_byte(&g2);", "if (VAR_25 > 0) {", "for (VAR_13 = 0; VAR_13 < VAR_25; VAR_13++) {", "if (bytestream2_tell(&g2) + 1 > VAR_32)\nbreak;", "VAR_28 = bytestream2_get_byte(&g2);", "VAR_5 += VAR_28;", "VAR_29 -= VAR_28;", "VAR_27 = sign_extend(bytestream2_get_byte(&g2),8);", "if (VAR_27 > 0) {", "CHECK_PIXEL_PTR(VAR_27);", "if (bytestream2_tell(&g2) + VAR_27 > VAR_32)\nbreak;", "for (VAR_14 = 0; VAR_14 < VAR_27; VAR_14++, VAR_29--) {", "VAR_30[VAR_5++] = bytestream2_get_byte(&g2);", "}", "} else if (VAR_27 < 0) {", "VAR_27 = -VAR_27;", "VAR_7 = bytestream2_get_byte(&g2);", "CHECK_PIXEL_PTR(VAR_27);", "for (VAR_14 = 0; VAR_14 < VAR_27; VAR_14++, VAR_29--) {", "VAR_30[VAR_5++] = VAR_7;", "}", "}", "}", "}", "VAR_26 += s->frame->linesize[0];", "VAR_23--;", "}", "break;", "case FLI_BLACK:\nmemset(VAR_30, 0,\ns->frame->linesize[0] * s->VAR_0->height);", "break;", "case FLI_BRUN:\nVAR_26 = 0;", "for (VAR_22 = 0; VAR_22 < s->VAR_0->height; VAR_22++) {", "VAR_5 = VAR_26;", "bytestream2_skip(&g2, 1);", "VAR_29 = s->VAR_0->width;", "while (VAR_29 > 0) {", "if (bytestream2_tell(&g2) + 1 > VAR_32)\nbreak;", "VAR_27 = sign_extend(bytestream2_get_byte(&g2), 8);", "if (!VAR_27) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid byte run value.\\n\");", "}", "if (VAR_27 > 0) {", "VAR_7 = bytestream2_get_byte(&g2);", "CHECK_PIXEL_PTR(VAR_27);", "for (VAR_14 = 0; VAR_14 < VAR_27; VAR_14++) {", "VAR_30[VAR_5++] = VAR_7;", "VAR_29--;", "if (VAR_29 < 0)\nav_log(VAR_0, AV_LOG_ERROR, \"VAR_29 < 0 (%d) at line %d\\n\",\nVAR_29, VAR_22);", "}", "} else {", "VAR_27 = -VAR_27;", "CHECK_PIXEL_PTR(VAR_27);", "if (bytestream2_tell(&g2) + VAR_27 > VAR_32)\nbreak;", "for (VAR_14 = 0; VAR_14 < VAR_27; VAR_14++) {", "VAR_30[VAR_5++] = bytestream2_get_byte(&g2);", "VAR_29--;", "if (VAR_29 < 0)\nav_log(VAR_0, AV_LOG_ERROR, \"VAR_29 < 0 (%d) at line %d\\n\",\nVAR_29, VAR_22);", "}", "}", "}", "VAR_26 += s->frame->linesize[0];", "}", "break;", "case FLI_COPY:\nif (VAR_11 - 6 != FFALIGN(s->VAR_0->width, 4) * s->VAR_0->height) {", "av_log(VAR_0, AV_LOG_ERROR, \"In chunk FLI_COPY : source VAR_1 (%d bytes) \" \\\n\"has incorrect size, skipping chunk\\n\", VAR_11 - 6);", "bytestream2_skip(&g2, VAR_11 - 6);", "} else {", "for (VAR_26 = 0; VAR_26 < s->frame->linesize[0] * s->VAR_0->height;", "VAR_26 += s->frame->linesize[0]) {", "bytestream2_get_buffer(&g2, &VAR_30[VAR_26],\ns->VAR_0->width);", "if (s->VAR_0->width & 3)\nbytestream2_skip(&g2, 4 - (s->VAR_0->width & 3));", "}", "}", "break;", "case FLI_MINI:\nbreak;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unrecognized chunk type: %d\\n\", VAR_12);", "break;", "}", "if (VAR_32 - bytestream2_tell(&g2) >= 0) {", "bytestream2_skip(&g2, VAR_32 - bytestream2_tell(&g2));", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"Chunk overread\\n\");", "break;", "}", "VAR_9 -= VAR_11;", "VAR_10--;", "}", "if (bytestream2_get_bytes_left(&g2) > 2)\nav_log(VAR_0, AV_LOG_ERROR, \"Processed FLI chunk where chunk size = %d \" \\\n\"and final chunk ptr = %d\\n\", VAR_4,\nVAR_4 - bytestream2_get_bytes_left(&g2));", "memcpy(s->frame->VAR_1[1], s->palette, AVPALETTE_SIZE);", "if (s->new_palette) {", "s->frame->palette_has_changed = 1;", "s->new_palette = 0;", "}", "if ((VAR_15 = av_frame_ref(VAR_1, s->frame)) < 0)\nreturn VAR_15;", "*VAR_2 = 1;", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77, 79 ], [ 83 ], [ 85 ], [ 87, 90 ], [ 92, 94 ], [ 96 ], [ 98 ], [ 100 ], [ 104, 109 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 141 ], [ 143, 145, 155, 157 ], [ 159, 161 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 179 ], [ 185, 187 ], [ 191, 193 ], [ 197 ], [ 199 ], [ 205, 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219, 221 ], [ 223, 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237, 239 ], [ 241 ], [ 243 ], [ 245, 247 ], [ 249, 252 ], [ 254 ], [ 258 ], [ 260, 263 ], [ 265 ], [ 267 ], [ 269 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291, 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327, 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 353, 357 ], [ 361 ], [ 363 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377, 379 ], [ 381 ], [ 383 ], [ 385 ], [ 389, 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405, 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 447, 451, 453 ], [ 455 ], [ 459, 465 ], [ 467 ], [ 469 ], [ 475 ], [ 477 ], [ 479 ], [ 481, 483 ], [ 485 ], [ 487 ], [ 489 ], [ 492 ], [ 496 ], [ 498 ], [ 500 ], [ 502 ], [ 504 ], [ 506 ], [ 508, 510, 512 ], [ 514 ], [ 516 ], [ 518 ], [ 520 ], [ 522, 524 ], [ 526 ], [ 528 ], [ 530 ], [ 532, 534, 536 ], [ 538 ], [ 540 ], [ 542 ], [ 546 ], [ 548 ], [ 550 ], [ 554, 558 ], [ 560, 562 ], [ 564 ], [ 566 ], [ 568 ], [ 570 ], [ 572, 574 ], [ 576, 578 ], [ 580 ], [ 582 ], [ 584 ], [ 588, 592 ], [ 596, 598 ], [ 600 ], [ 602 ], [ 606 ], [ 608 ], [ 610 ], [ 612 ], [ 614 ], [ 616 ], [ 620 ], [ 622 ], [ 624 ], [ 632, 634, 636, 638 ], [ 644 ], [ 646 ], [ 648 ], [ 650 ], [ 652 ], [ 656, 658 ], [ 662 ], [ 666 ], [ 668 ] ]
10,646
static int pci_read_devaddr(Monitor *mon, const char *addr, int *busp, unsigned *slotp) { int dom; /* strip legacy tag */ if (!strncmp(addr, "pci_addr=", 9)) { addr += 9; } if (pci_parse_devaddr(addr, &dom, busp, slotp, NULL)) { monitor_printf(mon, "Invalid pci address\n"); return -1; } if (dom != 0) { monitor_printf(mon, "Multiple PCI domains not supported, use device_add\n"); return -1; } return 0; }
true
qemu
f51074cdc6e750daa3b6df727d83449a7e42b391
static int pci_read_devaddr(Monitor *mon, const char *addr, int *busp, unsigned *slotp) { int dom; if (!strncmp(addr, "pci_addr=", 9)) { addr += 9; } if (pci_parse_devaddr(addr, &dom, busp, slotp, NULL)) { monitor_printf(mon, "Invalid pci address\n"); return -1; } if (dom != 0) { monitor_printf(mon, "Multiple PCI domains not supported, use device_add\n"); return -1; } return 0; }
{ "code": [ "static int pci_read_devaddr(Monitor *mon, const char *addr,", " int *busp, unsigned *slotp)", " int dom;", " if (!strncmp(addr, \"pci_addr=\", 9)) {", " addr += 9;", " if (pci_parse_devaddr(addr, &dom, busp, slotp, NULL)) {", " monitor_printf(mon, \"Invalid pci address\\n\");", " return -1;", " if (dom != 0) {", " monitor_printf(mon, \"Multiple PCI domains not supported, use device_add\\n\");", " return -1;", " return 0;", " return -1;", " return 0;", " return 0;", " return -1;", " return -1;", " return -1;", " return -1;", " return 0;" ], "line_no": [ 1, 3, 7, 13, 15, 19, 21, 23, 27, 29, 23, 35, 23, 35, 35, 23, 23, 23, 23, 35 ] }
static int FUNC_0(Monitor *VAR_0, const char *VAR_1, int *VAR_2, unsigned *VAR_3) { int VAR_4; if (!strncmp(VAR_1, "pci_addr=", 9)) { VAR_1 += 9; } if (pci_parse_devaddr(VAR_1, &VAR_4, VAR_2, VAR_3, NULL)) { monitor_printf(VAR_0, "Invalid pci address\n"); return -1; } if (VAR_4 != 0) { monitor_printf(VAR_0, "Multiple PCI domains not supported, use device_add\n"); return -1; } return 0; }
[ "static int FUNC_0(Monitor *VAR_0, const char *VAR_1,\nint *VAR_2, unsigned *VAR_3)\n{", "int VAR_4;", "if (!strncmp(VAR_1, \"pci_addr=\", 9)) {", "VAR_1 += 9;", "}", "if (pci_parse_devaddr(VAR_1, &VAR_4, VAR_2, VAR_3, NULL)) {", "monitor_printf(VAR_0, \"Invalid pci address\\n\");", "return -1;", "}", "if (VAR_4 != 0) {", "monitor_printf(VAR_0, \"Multiple PCI domains not supported, use device_add\\n\");", "return -1;", "}", "return 0;", "}" ]
[ 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
10,647
static void write_streaminfo(FlacEncodeContext *s, uint8_t *header) { PutBitContext pb; memset(header, 0, FLAC_STREAMINFO_SIZE); init_put_bits(&pb, header, FLAC_STREAMINFO_SIZE); /* streaminfo metadata block */ put_bits(&pb, 16, s->avctx->frame_size); put_bits(&pb, 16, s->avctx->frame_size); put_bits(&pb, 24, 0); put_bits(&pb, 24, s->max_framesize); put_bits(&pb, 20, s->samplerate); put_bits(&pb, 3, s->channels-1); put_bits(&pb, 5, 15); /* bits per sample - 1 */ /* write 36-bit sample count in 2 put_bits() calls */ put_bits(&pb, 24, (s->sample_count & 0xFFFFFF000LL) >> 12); put_bits(&pb, 12, s->sample_count & 0x000000FFFLL); flush_put_bits(&pb); /* MD5 signature = 0 */ }
false
FFmpeg
a9f8587e152c16e943c645ff295e015384ccd76d
static void write_streaminfo(FlacEncodeContext *s, uint8_t *header) { PutBitContext pb; memset(header, 0, FLAC_STREAMINFO_SIZE); init_put_bits(&pb, header, FLAC_STREAMINFO_SIZE); put_bits(&pb, 16, s->avctx->frame_size); put_bits(&pb, 16, s->avctx->frame_size); put_bits(&pb, 24, 0); put_bits(&pb, 24, s->max_framesize); put_bits(&pb, 20, s->samplerate); put_bits(&pb, 3, s->channels-1); put_bits(&pb, 5, 15); put_bits(&pb, 24, (s->sample_count & 0xFFFFFF000LL) >> 12); put_bits(&pb, 12, s->sample_count & 0x000000FFFLL); flush_put_bits(&pb); }
{ "code": [], "line_no": [] }
static void FUNC_0(FlacEncodeContext *VAR_0, uint8_t *VAR_1) { PutBitContext pb; memset(VAR_1, 0, FLAC_STREAMINFO_SIZE); init_put_bits(&pb, VAR_1, FLAC_STREAMINFO_SIZE); put_bits(&pb, 16, VAR_0->avctx->frame_size); put_bits(&pb, 16, VAR_0->avctx->frame_size); put_bits(&pb, 24, 0); put_bits(&pb, 24, VAR_0->max_framesize); put_bits(&pb, 20, VAR_0->samplerate); put_bits(&pb, 3, VAR_0->channels-1); put_bits(&pb, 5, 15); put_bits(&pb, 24, (VAR_0->sample_count & 0xFFFFFF000LL) >> 12); put_bits(&pb, 12, VAR_0->sample_count & 0x000000FFFLL); flush_put_bits(&pb); }
[ "static void FUNC_0(FlacEncodeContext *VAR_0, uint8_t *VAR_1)\n{", "PutBitContext pb;", "memset(VAR_1, 0, FLAC_STREAMINFO_SIZE);", "init_put_bits(&pb, VAR_1, FLAC_STREAMINFO_SIZE);", "put_bits(&pb, 16, VAR_0->avctx->frame_size);", "put_bits(&pb, 16, VAR_0->avctx->frame_size);", "put_bits(&pb, 24, 0);", "put_bits(&pb, 24, VAR_0->max_framesize);", "put_bits(&pb, 20, VAR_0->samplerate);", "put_bits(&pb, 3, VAR_0->channels-1);", "put_bits(&pb, 5, 15);", "put_bits(&pb, 24, (VAR_0->sample_count & 0xFFFFFF000LL) >> 12);", "put_bits(&pb, 12, VAR_0->sample_count & 0x000000FFFLL);", "flush_put_bits(&pb);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ] ]
10,649
static void slavio_check_interrupts(SLAVIO_INTCTLState *s, int set_irqs) { uint32_t pending = s->intregm_pending, pil_pending; unsigned int i, j; pending &= ~s->intregm_disabled; trace_slavio_check_interrupts(pending, s->intregm_disabled); for (i = 0; i < MAX_CPUS; i++) { pil_pending = 0; /* If we are the current interrupt target, get hard interrupts */ if (pending && !(s->intregm_disabled & MASTER_DISABLE) && (i == s->target_cpu)) { for (j = 0; j < 32; j++) { if ((pending & (1 << j)) && intbit_to_level[j]) { pil_pending |= 1 << intbit_to_level[j]; } } } /* Calculate current pending hard interrupts for display */ s->slaves[i].intreg_pending &= CPU_SOFTIRQ_MASK | CPU_IRQ_INT15_IN | CPU_IRQ_TIMER_IN; if (i == s->target_cpu) { for (j = 0; j < 32; j++) { if ((s->intregm_pending & (1 << j)) && intbit_to_level[j]) { s->slaves[i].intreg_pending |= 1 << intbit_to_level[j]; } } } /* Level 15 and CPU timer interrupts are only masked when the MASTER_DISABLE bit is set */ if (!(s->intregm_disabled & MASTER_DISABLE)) { pil_pending |= s->slaves[i].intreg_pending & (CPU_IRQ_INT15_IN | CPU_IRQ_TIMER_IN); } /* Add soft interrupts */ pil_pending |= (s->slaves[i].intreg_pending & CPU_SOFTIRQ_MASK) >> 16; if (set_irqs) { for (j = MAX_PILS; j > 0; j--) { if (pil_pending & (1 << j)) { if (!(s->slaves[i].irl_out & (1 << j))) { qemu_irq_raise(s->cpu_irqs[i][j]); } } else { if (s->slaves[i].irl_out & (1 << j)) { qemu_irq_lower(s->cpu_irqs[i][j]); } } } } s->slaves[i].irl_out = pil_pending; } }
true
qemu
c84a88d8cb298b6757ad01a12a8bbba66cb6eaa2
static void slavio_check_interrupts(SLAVIO_INTCTLState *s, int set_irqs) { uint32_t pending = s->intregm_pending, pil_pending; unsigned int i, j; pending &= ~s->intregm_disabled; trace_slavio_check_interrupts(pending, s->intregm_disabled); for (i = 0; i < MAX_CPUS; i++) { pil_pending = 0; if (pending && !(s->intregm_disabled & MASTER_DISABLE) && (i == s->target_cpu)) { for (j = 0; j < 32; j++) { if ((pending & (1 << j)) && intbit_to_level[j]) { pil_pending |= 1 << intbit_to_level[j]; } } } s->slaves[i].intreg_pending &= CPU_SOFTIRQ_MASK | CPU_IRQ_INT15_IN | CPU_IRQ_TIMER_IN; if (i == s->target_cpu) { for (j = 0; j < 32; j++) { if ((s->intregm_pending & (1 << j)) && intbit_to_level[j]) { s->slaves[i].intreg_pending |= 1 << intbit_to_level[j]; } } } if (!(s->intregm_disabled & MASTER_DISABLE)) { pil_pending |= s->slaves[i].intreg_pending & (CPU_IRQ_INT15_IN | CPU_IRQ_TIMER_IN); } pil_pending |= (s->slaves[i].intreg_pending & CPU_SOFTIRQ_MASK) >> 16; if (set_irqs) { for (j = MAX_PILS; j > 0; j--) { if (pil_pending & (1 << j)) { if (!(s->slaves[i].irl_out & (1 << j))) { qemu_irq_raise(s->cpu_irqs[i][j]); } } else { if (s->slaves[i].irl_out & (1 << j)) { qemu_irq_lower(s->cpu_irqs[i][j]); } } } } s->slaves[i].irl_out = pil_pending; } }
{ "code": [ " for (j = MAX_PILS; j > 0; j--) {" ], "line_no": [ 87 ] }
static void FUNC_0(SLAVIO_INTCTLState *VAR_0, int VAR_1) { uint32_t pending = VAR_0->intregm_pending, pil_pending; unsigned int VAR_2, VAR_3; pending &= ~VAR_0->intregm_disabled; trace_slavio_check_interrupts(pending, VAR_0->intregm_disabled); for (VAR_2 = 0; VAR_2 < MAX_CPUS; VAR_2++) { pil_pending = 0; if (pending && !(VAR_0->intregm_disabled & MASTER_DISABLE) && (VAR_2 == VAR_0->target_cpu)) { for (VAR_3 = 0; VAR_3 < 32; VAR_3++) { if ((pending & (1 << VAR_3)) && intbit_to_level[VAR_3]) { pil_pending |= 1 << intbit_to_level[VAR_3]; } } } VAR_0->slaves[VAR_2].intreg_pending &= CPU_SOFTIRQ_MASK | CPU_IRQ_INT15_IN | CPU_IRQ_TIMER_IN; if (VAR_2 == VAR_0->target_cpu) { for (VAR_3 = 0; VAR_3 < 32; VAR_3++) { if ((VAR_0->intregm_pending & (1 << VAR_3)) && intbit_to_level[VAR_3]) { VAR_0->slaves[VAR_2].intreg_pending |= 1 << intbit_to_level[VAR_3]; } } } if (!(VAR_0->intregm_disabled & MASTER_DISABLE)) { pil_pending |= VAR_0->slaves[VAR_2].intreg_pending & (CPU_IRQ_INT15_IN | CPU_IRQ_TIMER_IN); } pil_pending |= (VAR_0->slaves[VAR_2].intreg_pending & CPU_SOFTIRQ_MASK) >> 16; if (VAR_1) { for (VAR_3 = MAX_PILS; VAR_3 > 0; VAR_3--) { if (pil_pending & (1 << VAR_3)) { if (!(VAR_0->slaves[VAR_2].irl_out & (1 << VAR_3))) { qemu_irq_raise(VAR_0->cpu_irqs[VAR_2][VAR_3]); } } else { if (VAR_0->slaves[VAR_2].irl_out & (1 << VAR_3)) { qemu_irq_lower(VAR_0->cpu_irqs[VAR_2][VAR_3]); } } } } VAR_0->slaves[VAR_2].irl_out = pil_pending; } }
[ "static void FUNC_0(SLAVIO_INTCTLState *VAR_0, int VAR_1)\n{", "uint32_t pending = VAR_0->intregm_pending, pil_pending;", "unsigned int VAR_2, VAR_3;", "pending &= ~VAR_0->intregm_disabled;", "trace_slavio_check_interrupts(pending, VAR_0->intregm_disabled);", "for (VAR_2 = 0; VAR_2 < MAX_CPUS; VAR_2++) {", "pil_pending = 0;", "if (pending && !(VAR_0->intregm_disabled & MASTER_DISABLE) &&\n(VAR_2 == VAR_0->target_cpu)) {", "for (VAR_3 = 0; VAR_3 < 32; VAR_3++) {", "if ((pending & (1 << VAR_3)) && intbit_to_level[VAR_3]) {", "pil_pending |= 1 << intbit_to_level[VAR_3];", "}", "}", "}", "VAR_0->slaves[VAR_2].intreg_pending &= CPU_SOFTIRQ_MASK | CPU_IRQ_INT15_IN |\nCPU_IRQ_TIMER_IN;", "if (VAR_2 == VAR_0->target_cpu) {", "for (VAR_3 = 0; VAR_3 < 32; VAR_3++) {", "if ((VAR_0->intregm_pending & (1 << VAR_3)) && intbit_to_level[VAR_3]) {", "VAR_0->slaves[VAR_2].intreg_pending |= 1 << intbit_to_level[VAR_3];", "}", "}", "}", "if (!(VAR_0->intregm_disabled & MASTER_DISABLE)) {", "pil_pending |= VAR_0->slaves[VAR_2].intreg_pending &\n(CPU_IRQ_INT15_IN | CPU_IRQ_TIMER_IN);", "}", "pil_pending |= (VAR_0->slaves[VAR_2].intreg_pending & CPU_SOFTIRQ_MASK) >> 16;", "if (VAR_1) {", "for (VAR_3 = MAX_PILS; VAR_3 > 0; VAR_3--) {", "if (pil_pending & (1 << VAR_3)) {", "if (!(VAR_0->slaves[VAR_2].irl_out & (1 << VAR_3))) {", "qemu_irq_raise(VAR_0->cpu_irqs[VAR_2][VAR_3]);", "}", "} else {", "if (VAR_0->slaves[VAR_2].irl_out & (1 << VAR_3)) {", "qemu_irq_lower(VAR_0->cpu_irqs[VAR_2][VAR_3]);", "}", "}", "}", "}", "VAR_0->slaves[VAR_2].irl_out = pil_pending;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ] ]
10,650
static struct ioreq *ioreq_start(struct XenBlkDev *blkdev) { struct ioreq *ioreq = NULL; if (QLIST_EMPTY(&blkdev->freelist)) { if (blkdev->requests_total >= max_requests) { goto out; } /* allocate new struct */ ioreq = g_malloc0(sizeof(*ioreq)); ioreq->blkdev = blkdev; blkdev->requests_total++; qemu_iovec_init(&ioreq->v, BLKIF_MAX_SEGMENTS_PER_REQUEST); } else { /* get one from freelist */ ioreq = QLIST_FIRST(&blkdev->freelist); QLIST_REMOVE(ioreq, list); qemu_iovec_reset(&ioreq->v); } QLIST_INSERT_HEAD(&blkdev->inflight, ioreq, list); blkdev->requests_inflight++; out: return ioreq; }
true
qemu
282c6a2f292705f823554447ca0b7731b6f81a97
static struct ioreq *ioreq_start(struct XenBlkDev *blkdev) { struct ioreq *ioreq = NULL; if (QLIST_EMPTY(&blkdev->freelist)) { if (blkdev->requests_total >= max_requests) { goto out; } ioreq = g_malloc0(sizeof(*ioreq)); ioreq->blkdev = blkdev; blkdev->requests_total++; qemu_iovec_init(&ioreq->v, BLKIF_MAX_SEGMENTS_PER_REQUEST); } else { ioreq = QLIST_FIRST(&blkdev->freelist); QLIST_REMOVE(ioreq, list); qemu_iovec_reset(&ioreq->v); } QLIST_INSERT_HEAD(&blkdev->inflight, ioreq, list); blkdev->requests_inflight++; out: return ioreq; }
{ "code": [ " qemu_iovec_reset(&ioreq->v);" ], "line_no": [ 35 ] }
static struct VAR_1 *FUNC_0(struct XenBlkDev *VAR_0) { struct VAR_1 *VAR_1 = NULL; if (QLIST_EMPTY(&VAR_0->freelist)) { if (VAR_0->requests_total >= max_requests) { goto out; } VAR_1 = g_malloc0(sizeof(*VAR_1)); VAR_1->VAR_0 = VAR_0; VAR_0->requests_total++; qemu_iovec_init(&VAR_1->v, BLKIF_MAX_SEGMENTS_PER_REQUEST); } else { VAR_1 = QLIST_FIRST(&VAR_0->freelist); QLIST_REMOVE(VAR_1, list); qemu_iovec_reset(&VAR_1->v); } QLIST_INSERT_HEAD(&VAR_0->inflight, VAR_1, list); VAR_0->requests_inflight++; out: return VAR_1; }
[ "static struct VAR_1 *FUNC_0(struct XenBlkDev *VAR_0)\n{", "struct VAR_1 *VAR_1 = NULL;", "if (QLIST_EMPTY(&VAR_0->freelist)) {", "if (VAR_0->requests_total >= max_requests) {", "goto out;", "}", "VAR_1 = g_malloc0(sizeof(*VAR_1));", "VAR_1->VAR_0 = VAR_0;", "VAR_0->requests_total++;", "qemu_iovec_init(&VAR_1->v, BLKIF_MAX_SEGMENTS_PER_REQUEST);", "} else {", "VAR_1 = QLIST_FIRST(&VAR_0->freelist);", "QLIST_REMOVE(VAR_1, list);", "qemu_iovec_reset(&VAR_1->v);", "}", "QLIST_INSERT_HEAD(&VAR_0->inflight, VAR_1, list);", "VAR_0->requests_inflight++;", "out:\nreturn VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ] ]
10,651
static void dequantize_slice_buffered(SnowContext *s, slice_buffer * sb, SubBand *b, IDWTELEM *src, int stride, int start_y, int end_y){ const int w= b->width; const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); const int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; int x,y; if(s->qlog == LOSSLESS_QLOG) return; for(y=start_y; y<end_y; y++){ // DWTELEM * line = slice_buffer_get_line_from_address(sb, src + (y * stride)); IDWTELEM * line = slice_buffer_get_line(sb, (y * b->stride_line) + b->buf_y_offset) + b->buf_x_offset; for(x=0; x<w; x++){ int i= line[x]; if(i<0){ line[x]= -((-i*qmul + qadd)>>(QEXPSHIFT)); //FIXME try different bias }else if(i>0){ line[x]= (( i*qmul + qadd)>>(QEXPSHIFT)); } } } }
true
FFmpeg
14b6adfd4627421223894c6909476d229cb6d07d
static void dequantize_slice_buffered(SnowContext *s, slice_buffer * sb, SubBand *b, IDWTELEM *src, int stride, int start_y, int end_y){ const int w= b->width; const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16); const int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT); const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; int x,y; if(s->qlog == LOSSLESS_QLOG) return; for(y=start_y; y<end_y; y++){ IDWTELEM * line = slice_buffer_get_line(sb, (y * b->stride_line) + b->buf_y_offset) + b->buf_x_offset; for(x=0; x<w; x++){ int i= line[x]; if(i<0){ line[x]= -((-i*qmul + qadd)>>(QEXPSHIFT)); }else if(i>0){ line[x]= (( i*qmul + qadd)>>(QEXPSHIFT)); } } } }
{ "code": [ " line[x]= (( i*qmul + qadd)>>(QEXPSHIFT));" ], "line_no": [ 35 ] }
static void FUNC_0(SnowContext *VAR_0, slice_buffer * VAR_1, SubBand *VAR_2, IDWTELEM *VAR_3, int VAR_4, int VAR_5, int VAR_6){ const int VAR_7= VAR_2->width; const int VAR_8= av_clip(VAR_0->VAR_8 + VAR_2->VAR_8, 0, QROOT*16); const int VAR_9= ff_qexp[VAR_8&(QROOT-1)]<<(VAR_8>>QSHIFT); const int VAR_10= (VAR_0->qbias*VAR_9)>>QBIAS_SHIFT; int VAR_11,VAR_12; if(VAR_0->VAR_8 == LOSSLESS_QLOG) return; for(VAR_12=VAR_5; VAR_12<VAR_6; VAR_12++){ IDWTELEM * line = slice_buffer_get_line(VAR_1, (VAR_12 * VAR_2->stride_line) + VAR_2->buf_y_offset) + VAR_2->buf_x_offset; for(VAR_11=0; VAR_11<VAR_7; VAR_11++){ int VAR_13= line[VAR_11]; if(VAR_13<0){ line[VAR_11]= -((-VAR_13*VAR_9 + VAR_10)>>(QEXPSHIFT)); }else if(VAR_13>0){ line[VAR_11]= (( VAR_13*VAR_9 + VAR_10)>>(QEXPSHIFT)); } } } }
[ "static void FUNC_0(SnowContext *VAR_0, slice_buffer * VAR_1, SubBand *VAR_2, IDWTELEM *VAR_3, int VAR_4, int VAR_5, int VAR_6){", "const int VAR_7= VAR_2->width;", "const int VAR_8= av_clip(VAR_0->VAR_8 + VAR_2->VAR_8, 0, QROOT*16);", "const int VAR_9= ff_qexp[VAR_8&(QROOT-1)]<<(VAR_8>>QSHIFT);", "const int VAR_10= (VAR_0->qbias*VAR_9)>>QBIAS_SHIFT;", "int VAR_11,VAR_12;", "if(VAR_0->VAR_8 == LOSSLESS_QLOG) return;", "for(VAR_12=VAR_5; VAR_12<VAR_6; VAR_12++){", "IDWTELEM * line = slice_buffer_get_line(VAR_1, (VAR_12 * VAR_2->stride_line) + VAR_2->buf_y_offset) + VAR_2->buf_x_offset;", "for(VAR_11=0; VAR_11<VAR_7; VAR_11++){", "int VAR_13= line[VAR_11];", "if(VAR_13<0){", "line[VAR_11]= -((-VAR_13*VAR_9 + VAR_10)>>(QEXPSHIFT));", "}else if(VAR_13>0){", "line[VAR_11]= (( VAR_13*VAR_9 + VAR_10)>>(QEXPSHIFT));", "}", "}", "}", "}" ]
[ 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 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
10,652
static int kvm_irqchip_create(MachineState *machine, KVMState *s) { int ret; if (!machine_kernel_irqchip_allowed(machine) || (!kvm_check_extension(s, KVM_CAP_IRQCHIP) && (kvm_vm_enable_cap(s, KVM_CAP_S390_IRQCHIP, 0) < 0))) { return 0; } /* First probe and see if there's a arch-specific hook to create the * in-kernel irqchip for us */ ret = kvm_arch_irqchip_create(s); if (ret < 0) { return ret; } else if (ret == 0) { ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP); if (ret < 0) { fprintf(stderr, "Create kernel irqchip failed\n"); return ret; } } kvm_kernel_irqchip = true; /* If we have an in-kernel IRQ chip then we must have asynchronous * interrupt delivery (though the reverse is not necessarily true) */ kvm_async_interrupts_allowed = true; kvm_halt_in_kernel_allowed = true; kvm_init_irq_routing(s); return 0; }
true
qemu
8db4936bb648e15173d687bc162be14fd0d4260c
static int kvm_irqchip_create(MachineState *machine, KVMState *s) { int ret; if (!machine_kernel_irqchip_allowed(machine) || (!kvm_check_extension(s, KVM_CAP_IRQCHIP) && (kvm_vm_enable_cap(s, KVM_CAP_S390_IRQCHIP, 0) < 0))) { return 0; } ret = kvm_arch_irqchip_create(s); if (ret < 0) { return ret; } else if (ret == 0) { ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP); if (ret < 0) { fprintf(stderr, "Create kernel irqchip failed\n"); return ret; } } kvm_kernel_irqchip = true; kvm_async_interrupts_allowed = true; kvm_halt_in_kernel_allowed = true; kvm_init_irq_routing(s); return 0; }
{ "code": [ "static int kvm_irqchip_create(MachineState *machine, KVMState *s)", " if (!machine_kernel_irqchip_allowed(machine) ||", " (!kvm_check_extension(s, KVM_CAP_IRQCHIP) &&", " (kvm_vm_enable_cap(s, KVM_CAP_S390_IRQCHIP, 0) < 0))) {", " return 0;", " if (ret < 0) {", " return ret;", " } else if (ret == 0) {", " if (ret < 0) {", " fprintf(stderr, \"Create kernel irqchip failed\\n\");", " return ret;", " return 0;", " if (ret < 0) {" ], "line_no": [ 1, 9, 11, 13, 15, 27, 29, 31, 35, 37, 39, 65, 27 ] }
static int FUNC_0(MachineState *VAR_0, KVMState *VAR_1) { int VAR_2; if (!machine_kernel_irqchip_allowed(VAR_0) || (!kvm_check_extension(VAR_1, KVM_CAP_IRQCHIP) && (kvm_vm_enable_cap(VAR_1, KVM_CAP_S390_IRQCHIP, 0) < 0))) { return 0; } VAR_2 = kvm_arch_irqchip_create(VAR_1); if (VAR_2 < 0) { return VAR_2; } else if (VAR_2 == 0) { VAR_2 = kvm_vm_ioctl(VAR_1, KVM_CREATE_IRQCHIP); if (VAR_2 < 0) { fprintf(stderr, "Create kernel irqchip failed\n"); return VAR_2; } } kvm_kernel_irqchip = true; kvm_async_interrupts_allowed = true; kvm_halt_in_kernel_allowed = true; kvm_init_irq_routing(VAR_1); return 0; }
[ "static int FUNC_0(MachineState *VAR_0, KVMState *VAR_1)\n{", "int VAR_2;", "if (!machine_kernel_irqchip_allowed(VAR_0) ||\n(!kvm_check_extension(VAR_1, KVM_CAP_IRQCHIP) &&\n(kvm_vm_enable_cap(VAR_1, KVM_CAP_S390_IRQCHIP, 0) < 0))) {", "return 0;", "}", "VAR_2 = kvm_arch_irqchip_create(VAR_1);", "if (VAR_2 < 0) {", "return VAR_2;", "} else if (VAR_2 == 0) {", "VAR_2 = kvm_vm_ioctl(VAR_1, KVM_CREATE_IRQCHIP);", "if (VAR_2 < 0) {", "fprintf(stderr, \"Create kernel irqchip failed\\n\");", "return VAR_2;", "}", "}", "kvm_kernel_irqchip = true;", "kvm_async_interrupts_allowed = true;", "kvm_halt_in_kernel_allowed = true;", "kvm_init_irq_routing(VAR_1);", "return 0;", "}" ]
[ 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13 ], [ 15 ], [ 17 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ] ]
10,653
static void qemu_clock_init(QEMUClockType type) { QEMUClock *clock = qemu_clock_ptr(type); clock->type = type; clock->enabled = true; clock->last = INT64_MIN; QLIST_INIT(&clock->timerlists); notifier_list_init(&clock->reset_notifiers); main_loop_tlg.tl[type] = timerlist_new(type, NULL, NULL); }
true
qemu
02ce232c5051854bf49e6d2816c65e00f6d7e036
static void qemu_clock_init(QEMUClockType type) { QEMUClock *clock = qemu_clock_ptr(type); clock->type = type; clock->enabled = true; clock->last = INT64_MIN; QLIST_INIT(&clock->timerlists); notifier_list_init(&clock->reset_notifiers); main_loop_tlg.tl[type] = timerlist_new(type, NULL, NULL); }
{ "code": [], "line_no": [] }
static void FUNC_0(QEMUClockType VAR_0) { QEMUClock *clock = qemu_clock_ptr(VAR_0); clock->VAR_0 = VAR_0; clock->enabled = true; clock->last = INT64_MIN; QLIST_INIT(&clock->timerlists); notifier_list_init(&clock->reset_notifiers); main_loop_tlg.tl[VAR_0] = timerlist_new(VAR_0, NULL, NULL); }
[ "static void FUNC_0(QEMUClockType VAR_0)\n{", "QEMUClock *clock = qemu_clock_ptr(VAR_0);", "clock->VAR_0 = VAR_0;", "clock->enabled = true;", "clock->last = INT64_MIN;", "QLIST_INIT(&clock->timerlists);", "notifier_list_init(&clock->reset_notifiers);", "main_loop_tlg.tl[VAR_0] = timerlist_new(VAR_0, NULL, NULL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ] ]
10,654
static void gen_mfdcr(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGv dcrn; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } /* NIP cannot be restored if the memory exception comes from an helper */ gen_update_nip(ctx, ctx->nip - 4); dcrn = tcg_const_tl(SPR(ctx->opcode)); gen_helper_load_dcr(cpu_gpr[rD(ctx->opcode)], cpu_env, dcrn); tcg_temp_free(dcrn); #endif }
true
qemu
9b2fadda3e0196ffd485adde4fe9cdd6fae35300
static void gen_mfdcr(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGv dcrn; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } gen_update_nip(ctx, ctx->nip - 4); dcrn = tcg_const_tl(SPR(ctx->opcode)); gen_helper_load_dcr(cpu_gpr[rD(ctx->opcode)], cpu_env, dcrn); tcg_temp_free(dcrn); #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 dcrn; if (unlikely(VAR_0->pr)) { gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG); return; } gen_update_nip(VAR_0, VAR_0->nip - 4); dcrn = tcg_const_tl(SPR(VAR_0->opcode)); gen_helper_load_dcr(cpu_gpr[rD(VAR_0->opcode)], cpu_env, dcrn); tcg_temp_free(dcrn); #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 dcrn;", "if (unlikely(VAR_0->pr)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_REG);", "return;", "}", "gen_update_nip(VAR_0, VAR_0->nip - 4);", "dcrn = tcg_const_tl(SPR(VAR_0->opcode));", "gen_helper_load_dcr(cpu_gpr[rD(VAR_0->opcode)], cpu_env, dcrn);", "tcg_temp_free(dcrn);", "#endif\n}" ]
[ 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ] ]
10,655
static int wav_write_header(AVFormatContext *s) { WAVContext *wav = s->priv_data; AVIOContext *pb = s->pb; int64_t fmt, fact; ffio_wfourcc(pb, "RIFF"); avio_wl32(pb, 0); /* file length */ ffio_wfourcc(pb, "WAVE"); /* format header */ fmt = ff_start_tag(pb, "fmt "); if (ff_put_wav_header(pb, s->streams[0]->codec) < 0) { av_log(s, AV_LOG_ERROR, "%s codec not supported in WAVE format\n", s->streams[0]->codec->codec ? s->streams[0]->codec->codec->name : "NONE"); av_free(wav); return -1; } ff_end_tag(pb, fmt); if (s->streams[0]->codec->codec_tag != 0x01 /* hence for all other than PCM */ && s->pb->seekable) { fact = ff_start_tag(pb, "fact"); avio_wl32(pb, 0); ff_end_tag(pb, fact); } av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate); wav->maxpts = wav->last_duration = 0; wav->minpts = INT64_MAX; /* data header */ wav->data = ff_start_tag(pb, "data"); avio_flush(pb); return 0; }
false
FFmpeg
8d0786ec6d066f892f29da6593e99e73a7dfd014
static int wav_write_header(AVFormatContext *s) { WAVContext *wav = s->priv_data; AVIOContext *pb = s->pb; int64_t fmt, fact; ffio_wfourcc(pb, "RIFF"); avio_wl32(pb, 0); ffio_wfourcc(pb, "WAVE"); fmt = ff_start_tag(pb, "fmt "); if (ff_put_wav_header(pb, s->streams[0]->codec) < 0) { av_log(s, AV_LOG_ERROR, "%s codec not supported in WAVE format\n", s->streams[0]->codec->codec ? s->streams[0]->codec->codec->name : "NONE"); av_free(wav); return -1; } ff_end_tag(pb, fmt); if (s->streams[0]->codec->codec_tag != 0x01 && s->pb->seekable) { fact = ff_start_tag(pb, "fact"); avio_wl32(pb, 0); ff_end_tag(pb, fact); } av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate); wav->maxpts = wav->last_duration = 0; wav->minpts = INT64_MAX; wav->data = ff_start_tag(pb, "data"); avio_flush(pb); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { WAVContext *wav = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; int64_t fmt, fact; ffio_wfourcc(pb, "RIFF"); avio_wl32(pb, 0); ffio_wfourcc(pb, "WAVE"); fmt = ff_start_tag(pb, "fmt "); if (ff_put_wav_header(pb, VAR_0->streams[0]->codec) < 0) { av_log(VAR_0, AV_LOG_ERROR, "%VAR_0 codec not supported in WAVE format\n", VAR_0->streams[0]->codec->codec ? VAR_0->streams[0]->codec->codec->name : "NONE"); av_free(wav); return -1; } ff_end_tag(pb, fmt); if (VAR_0->streams[0]->codec->codec_tag != 0x01 && VAR_0->pb->seekable) { fact = ff_start_tag(pb, "fact"); avio_wl32(pb, 0); ff_end_tag(pb, fact); } av_set_pts_info(VAR_0->streams[0], 64, 1, VAR_0->streams[0]->codec->sample_rate); wav->maxpts = wav->last_duration = 0; wav->minpts = INT64_MAX; wav->data = ff_start_tag(pb, "data"); avio_flush(pb); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "WAVContext *wav = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "int64_t fmt, fact;", "ffio_wfourcc(pb, \"RIFF\");", "avio_wl32(pb, 0);", "ffio_wfourcc(pb, \"WAVE\");", "fmt = ff_start_tag(pb, \"fmt \");", "if (ff_put_wav_header(pb, VAR_0->streams[0]->codec) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"%VAR_0 codec not supported in WAVE format\\n\",\nVAR_0->streams[0]->codec->codec ? VAR_0->streams[0]->codec->codec->name : \"NONE\");", "av_free(wav);", "return -1;", "}", "ff_end_tag(pb, fmt);", "if (VAR_0->streams[0]->codec->codec_tag != 0x01\n&& VAR_0->pb->seekable) {", "fact = ff_start_tag(pb, \"fact\");", "avio_wl32(pb, 0);", "ff_end_tag(pb, fact);", "}", "av_set_pts_info(VAR_0->streams[0], 64, 1, VAR_0->streams[0]->codec->sample_rate);", "wav->maxpts = wav->last_duration = 0;", "wav->minpts = INT64_MAX;", "wav->data = ff_start_tag(pb, \"data\");", "avio_flush(pb);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 69 ], [ 73 ], [ 75 ] ]
10,656
void ff_llviddsp_init_x86(LLVidDSPContext *c) { int cpu_flags = av_get_cpu_flags(); #if HAVE_INLINE_ASM && HAVE_7REGS && ARCH_X86_32 if (cpu_flags & AV_CPU_FLAG_CMOV) c->add_median_pred = add_median_pred_cmov; #endif if (ARCH_X86_32 && EXTERNAL_MMX(cpu_flags)) { c->add_bytes = ff_add_bytes_mmx; } if (ARCH_X86_32 && EXTERNAL_MMXEXT(cpu_flags)) { /* slower than cmov version on AMD */ if (!(cpu_flags & AV_CPU_FLAG_3DNOW)) c->add_median_pred = ff_add_median_pred_mmxext; } if (EXTERNAL_SSE2(cpu_flags)) { c->add_bytes = ff_add_bytes_sse2; c->add_median_pred = ff_add_median_pred_sse2; } if (EXTERNAL_SSSE3(cpu_flags)) { c->add_left_pred = ff_add_left_pred_ssse3; c->add_left_pred_int16 = ff_add_left_pred_int16_ssse3; c->add_gradient_pred = ff_add_gradient_pred_ssse3; } if (EXTERNAL_SSSE3_FAST(cpu_flags)) { c->add_left_pred = ff_add_left_pred_unaligned_ssse3; } if (EXTERNAL_SSE4(cpu_flags)) { c->add_left_pred_int16 = ff_add_left_pred_int16_sse4; } if (EXTERNAL_AVX2_FAST(cpu_flags)) { c->add_bytes = ff_add_bytes_avx2; c->add_left_pred = ff_add_left_pred_unaligned_avx2; c->add_gradient_pred = ff_add_gradient_pred_avx2; } }
false
FFmpeg
438f884fc48b4b956fa713df2a722bd484f5646b
void ff_llviddsp_init_x86(LLVidDSPContext *c) { int cpu_flags = av_get_cpu_flags(); #if HAVE_INLINE_ASM && HAVE_7REGS && ARCH_X86_32 if (cpu_flags & AV_CPU_FLAG_CMOV) c->add_median_pred = add_median_pred_cmov; #endif if (ARCH_X86_32 && EXTERNAL_MMX(cpu_flags)) { c->add_bytes = ff_add_bytes_mmx; } if (ARCH_X86_32 && EXTERNAL_MMXEXT(cpu_flags)) { if (!(cpu_flags & AV_CPU_FLAG_3DNOW)) c->add_median_pred = ff_add_median_pred_mmxext; } if (EXTERNAL_SSE2(cpu_flags)) { c->add_bytes = ff_add_bytes_sse2; c->add_median_pred = ff_add_median_pred_sse2; } if (EXTERNAL_SSSE3(cpu_flags)) { c->add_left_pred = ff_add_left_pred_ssse3; c->add_left_pred_int16 = ff_add_left_pred_int16_ssse3; c->add_gradient_pred = ff_add_gradient_pred_ssse3; } if (EXTERNAL_SSSE3_FAST(cpu_flags)) { c->add_left_pred = ff_add_left_pred_unaligned_ssse3; } if (EXTERNAL_SSE4(cpu_flags)) { c->add_left_pred_int16 = ff_add_left_pred_int16_sse4; } if (EXTERNAL_AVX2_FAST(cpu_flags)) { c->add_bytes = ff_add_bytes_avx2; c->add_left_pred = ff_add_left_pred_unaligned_avx2; c->add_gradient_pred = ff_add_gradient_pred_avx2; } }
{ "code": [], "line_no": [] }
void FUNC_0(LLVidDSPContext *VAR_0) { int VAR_1 = av_get_cpu_flags(); #if HAVE_INLINE_ASM && HAVE_7REGS && ARCH_X86_32 if (VAR_1 & AV_CPU_FLAG_CMOV) VAR_0->add_median_pred = add_median_pred_cmov; #endif if (ARCH_X86_32 && EXTERNAL_MMX(VAR_1)) { VAR_0->add_bytes = ff_add_bytes_mmx; } if (ARCH_X86_32 && EXTERNAL_MMXEXT(VAR_1)) { if (!(VAR_1 & AV_CPU_FLAG_3DNOW)) VAR_0->add_median_pred = ff_add_median_pred_mmxext; } if (EXTERNAL_SSE2(VAR_1)) { VAR_0->add_bytes = ff_add_bytes_sse2; VAR_0->add_median_pred = ff_add_median_pred_sse2; } if (EXTERNAL_SSSE3(VAR_1)) { VAR_0->add_left_pred = ff_add_left_pred_ssse3; VAR_0->add_left_pred_int16 = ff_add_left_pred_int16_ssse3; VAR_0->add_gradient_pred = ff_add_gradient_pred_ssse3; } if (EXTERNAL_SSSE3_FAST(VAR_1)) { VAR_0->add_left_pred = ff_add_left_pred_unaligned_ssse3; } if (EXTERNAL_SSE4(VAR_1)) { VAR_0->add_left_pred_int16 = ff_add_left_pred_int16_sse4; } if (EXTERNAL_AVX2_FAST(VAR_1)) { VAR_0->add_bytes = ff_add_bytes_avx2; VAR_0->add_left_pred = ff_add_left_pred_unaligned_avx2; VAR_0->add_gradient_pred = ff_add_gradient_pred_avx2; } }
[ "void FUNC_0(LLVidDSPContext *VAR_0)\n{", "int VAR_1 = av_get_cpu_flags();", "#if HAVE_INLINE_ASM && HAVE_7REGS && ARCH_X86_32\nif (VAR_1 & AV_CPU_FLAG_CMOV)\nVAR_0->add_median_pred = add_median_pred_cmov;", "#endif\nif (ARCH_X86_32 && EXTERNAL_MMX(VAR_1)) {", "VAR_0->add_bytes = ff_add_bytes_mmx;", "}", "if (ARCH_X86_32 && EXTERNAL_MMXEXT(VAR_1)) {", "if (!(VAR_1 & AV_CPU_FLAG_3DNOW))\nVAR_0->add_median_pred = ff_add_median_pred_mmxext;", "}", "if (EXTERNAL_SSE2(VAR_1)) {", "VAR_0->add_bytes = ff_add_bytes_sse2;", "VAR_0->add_median_pred = ff_add_median_pred_sse2;", "}", "if (EXTERNAL_SSSE3(VAR_1)) {", "VAR_0->add_left_pred = ff_add_left_pred_ssse3;", "VAR_0->add_left_pred_int16 = ff_add_left_pred_int16_ssse3;", "VAR_0->add_gradient_pred = ff_add_gradient_pred_ssse3;", "}", "if (EXTERNAL_SSSE3_FAST(VAR_1)) {", "VAR_0->add_left_pred = ff_add_left_pred_unaligned_ssse3;", "}", "if (EXTERNAL_SSE4(VAR_1)) {", "VAR_0->add_left_pred_int16 = ff_add_left_pred_int16_sse4;", "}", "if (EXTERNAL_AVX2_FAST(VAR_1)) {", "VAR_0->add_bytes = ff_add_bytes_avx2;", "VAR_0->add_left_pred = ff_add_left_pred_unaligned_avx2;", "VAR_0->add_gradient_pred = ff_add_gradient_pred_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 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13 ], [ 15, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ] ]
10,657
static av_cold int libgsm_init(AVCodecContext *avctx) { if (avctx->channels > 1) { av_log(avctx, AV_LOG_ERROR, "Mono required for GSM, got %d channels\n", avctx->channels); return -1; } if(avctx->codec->decode){ if(!avctx->channels) avctx->channels= 1; if(!avctx->sample_rate) avctx->sample_rate= 8000; avctx->sample_fmt = AV_SAMPLE_FMT_S16; }else{ if (avctx->sample_rate != 8000) { av_log(avctx, AV_LOG_ERROR, "Sample rate 8000Hz required for GSM, got %dHz\n", avctx->sample_rate); if(avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) return -1; } if (avctx->bit_rate != 13000 /* Official */ && avctx->bit_rate != 13200 /* Very common */ && avctx->bit_rate != 0 /* Unknown; a.o. mov does not set bitrate when decoding */ ) { av_log(avctx, AV_LOG_ERROR, "Bitrate 13000bps required for GSM, got %dbps\n", avctx->bit_rate); if(avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) return -1; } } avctx->priv_data = gsm_create(); switch(avctx->codec_id) { case CODEC_ID_GSM: avctx->frame_size = GSM_FRAME_SIZE; avctx->block_align = GSM_BLOCK_SIZE; break; case CODEC_ID_GSM_MS: { int one = 1; gsm_option(avctx->priv_data, GSM_OPT_WAV49, &one); avctx->frame_size = 2*GSM_FRAME_SIZE; avctx->block_align = GSM_MS_BLOCK_SIZE; } } avctx->coded_frame= avcodec_alloc_frame(); avctx->coded_frame->key_frame= 1; return 0; }
false
FFmpeg
8febd6afbca652b331ddd8e75e356656c153cad1
static av_cold int libgsm_init(AVCodecContext *avctx) { if (avctx->channels > 1) { av_log(avctx, AV_LOG_ERROR, "Mono required for GSM, got %d channels\n", avctx->channels); return -1; } if(avctx->codec->decode){ if(!avctx->channels) avctx->channels= 1; if(!avctx->sample_rate) avctx->sample_rate= 8000; avctx->sample_fmt = AV_SAMPLE_FMT_S16; }else{ if (avctx->sample_rate != 8000) { av_log(avctx, AV_LOG_ERROR, "Sample rate 8000Hz required for GSM, got %dHz\n", avctx->sample_rate); if(avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) return -1; } if (avctx->bit_rate != 13000 && avctx->bit_rate != 13200 && avctx->bit_rate != 0 ) { av_log(avctx, AV_LOG_ERROR, "Bitrate 13000bps required for GSM, got %dbps\n", avctx->bit_rate); if(avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) return -1; } } avctx->priv_data = gsm_create(); switch(avctx->codec_id) { case CODEC_ID_GSM: avctx->frame_size = GSM_FRAME_SIZE; avctx->block_align = GSM_BLOCK_SIZE; break; case CODEC_ID_GSM_MS: { int one = 1; gsm_option(avctx->priv_data, GSM_OPT_WAV49, &one); avctx->frame_size = 2*GSM_FRAME_SIZE; avctx->block_align = GSM_MS_BLOCK_SIZE; } } avctx->coded_frame= avcodec_alloc_frame(); avctx->coded_frame->key_frame= 1; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { if (avctx->channels > 1) { av_log(avctx, AV_LOG_ERROR, "Mono required for GSM, got %d channels\n", avctx->channels); return -1; } if(avctx->codec->decode){ if(!avctx->channels) avctx->channels= 1; if(!avctx->sample_rate) avctx->sample_rate= 8000; avctx->sample_fmt = AV_SAMPLE_FMT_S16; }else{ if (avctx->sample_rate != 8000) { av_log(avctx, AV_LOG_ERROR, "Sample rate 8000Hz required for GSM, got %dHz\n", avctx->sample_rate); if(avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) return -1; } if (avctx->bit_rate != 13000 && avctx->bit_rate != 13200 && avctx->bit_rate != 0 ) { av_log(avctx, AV_LOG_ERROR, "Bitrate 13000bps required for GSM, got %dbps\n", avctx->bit_rate); if(avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) return -1; } } avctx->priv_data = gsm_create(); switch(avctx->codec_id) { case CODEC_ID_GSM: avctx->frame_size = GSM_FRAME_SIZE; avctx->block_align = GSM_BLOCK_SIZE; break; case CODEC_ID_GSM_MS: { int VAR_0 = 1; gsm_option(avctx->priv_data, GSM_OPT_WAV49, &VAR_0); avctx->frame_size = 2*GSM_FRAME_SIZE; avctx->block_align = GSM_MS_BLOCK_SIZE; } } avctx->coded_frame= avcodec_alloc_frame(); avctx->coded_frame->key_frame= 1; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx) {", "if (avctx->channels > 1) {", "av_log(avctx, AV_LOG_ERROR, \"Mono required for GSM, got %d channels\\n\",\navctx->channels);", "return -1;", "}", "if(avctx->codec->decode){", "if(!avctx->channels)\navctx->channels= 1;", "if(!avctx->sample_rate)\navctx->sample_rate= 8000;", "avctx->sample_fmt = AV_SAMPLE_FMT_S16;", "}else{", "if (avctx->sample_rate != 8000) {", "av_log(avctx, AV_LOG_ERROR, \"Sample rate 8000Hz required for GSM, got %dHz\\n\",\navctx->sample_rate);", "if(avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL)\nreturn -1;", "}", "if (avctx->bit_rate != 13000 &&\navctx->bit_rate != 13200 &&\navctx->bit_rate != 0 ) {", "av_log(avctx, AV_LOG_ERROR, \"Bitrate 13000bps required for GSM, got %dbps\\n\",\navctx->bit_rate);", "if(avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL)\nreturn -1;", "}", "}", "avctx->priv_data = gsm_create();", "switch(avctx->codec_id) {", "case CODEC_ID_GSM:\navctx->frame_size = GSM_FRAME_SIZE;", "avctx->block_align = GSM_BLOCK_SIZE;", "break;", "case CODEC_ID_GSM_MS: {", "int VAR_0 = 1;", "gsm_option(avctx->priv_data, GSM_OPT_WAV49, &VAR_0);", "avctx->frame_size = 2*GSM_FRAME_SIZE;", "avctx->block_align = GSM_MS_BLOCK_SIZE;", "}", "}", "avctx->coded_frame= avcodec_alloc_frame();", "avctx->coded_frame->key_frame= 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 ]
[ [ 1 ], [ 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 45, 47, 49 ], [ 51, 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 65 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ] ]
10,658
static int h261_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { H261Context *h= avctx->priv_data; MpegEncContext *s = &h->s; int ret; AVFrame *pict = data; #ifdef DEBUG printf("*****frame %d size=%d\n", avctx->frame_number, buf_size); printf("bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); #endif s->flags= avctx->flags; s->flags2= avctx->flags2; /* no supplementary picture */ if (buf_size == 0) { return 0; } h->gob_start_code_skipped=0; retry: init_get_bits(&s->gb, buf, buf_size*8); if(!s->context_initialized){ if (MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix return -1; } //we need to set current_picture_ptr before reading the header, otherwise we cant store anyting im there if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){ int i= ff_find_unused_picture(s, 0); s->current_picture_ptr= &s->picture[i]; } ret = h261_decode_picture_header(h); /* skip if the header was thrashed */ if (ret < 0){ av_log(s->avctx, AV_LOG_ERROR, "header damaged\n"); return -1; } if (s->width != avctx->coded_width || s->height != avctx->coded_height){ ParseContext pc= s->parse_context; //FIXME move these demuxng hack to avformat s->parse_context.buffer=0; MPV_common_end(s); s->parse_context= pc; } if (!s->context_initialized) { avcodec_set_dimensions(avctx, s->width, s->height); goto retry; } // for hurry_up==5 s->current_picture.pict_type= s->pict_type; s->current_picture.key_frame= s->pict_type == I_TYPE; /* skip everything if we are in a hurry>=5 */ if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size); if(MPV_frame_start(s, avctx) < 0) return -1; ff_er_frame_start(s); /* decode each macroblock */ s->mb_x=0; s->mb_y=0; while(h->gob_number < (s->mb_height==18 ? 12 : 5)){ if(ff_h261_resync(h)<0) break; h261_decode_gob(h); } MPV_frame_end(s); assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type); assert(s->current_picture.pict_type == s->pict_type); *pict= *(AVFrame*)s->current_picture_ptr; ff_print_debug_info(s, pict); /* Return the Picture timestamp as the frame number */ /* we substract 1 because it is added on utils.c */ avctx->frame_number = s->picture_number - 1; *data_size = sizeof(AVFrame); return get_consumed_bytes(s, buf_size); }
false
FFmpeg
934982c4ace1a3d5d627b518782ed092a456c49e
static int h261_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { H261Context *h= avctx->priv_data; MpegEncContext *s = &h->s; int ret; AVFrame *pict = data; #ifdef DEBUG printf("*****frame %d size=%d\n", avctx->frame_number, buf_size); printf("bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); #endif s->flags= avctx->flags; s->flags2= avctx->flags2; if (buf_size == 0) { return 0; } h->gob_start_code_skipped=0; retry: init_get_bits(&s->gb, buf, buf_size*8); if(!s->context_initialized){ if (MPV_common_init(s) < 0) return -1; } if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){ int i= ff_find_unused_picture(s, 0); s->current_picture_ptr= &s->picture[i]; } ret = h261_decode_picture_header(h); if (ret < 0){ av_log(s->avctx, AV_LOG_ERROR, "header damaged\n"); return -1; } if (s->width != avctx->coded_width || s->height != avctx->coded_height){ ParseContext pc= s->parse_context; s->parse_context.buffer=0; MPV_common_end(s); s->parse_context= pc; } if (!s->context_initialized) { avcodec_set_dimensions(avctx, s->width, s->height); goto retry; } s->current_picture.pict_type= s->pict_type; s->current_picture.key_frame= s->pict_type == I_TYPE; if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size); if(MPV_frame_start(s, avctx) < 0) return -1; ff_er_frame_start(s); s->mb_x=0; s->mb_y=0; while(h->gob_number < (s->mb_height==18 ? 12 : 5)){ if(ff_h261_resync(h)<0) break; h261_decode_gob(h); } MPV_frame_end(s); assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type); assert(s->current_picture.pict_type == s->pict_type); *pict= *(AVFrame*)s->current_picture_ptr; ff_print_debug_info(s, pict); avctx->frame_number = s->picture_number - 1; *data_size = sizeof(AVFrame); return get_consumed_bytes(s, buf_size); }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, uint8_t *VAR_3, int VAR_4) { H261Context *h= VAR_0->priv_data; MpegEncContext *s = &h->s; int VAR_5; AVFrame *pict = VAR_1; #ifdef DEBUG printf("*****frame %d size=%d\n", VAR_0->frame_number, VAR_4); printf("bytes=%x %x %x %x\n", VAR_3[0], VAR_3[1], VAR_3[2], VAR_3[3]); #endif s->flags= VAR_0->flags; s->flags2= VAR_0->flags2; if (VAR_4 == 0) { return 0; } h->gob_start_code_skipped=0; retry: init_get_bits(&s->gb, VAR_3, VAR_4*8); if(!s->context_initialized){ if (MPV_common_init(s) < 0) return -1; } if(s->current_picture_ptr==NULL || s->current_picture_ptr->VAR_1[0]){ int VAR_6= ff_find_unused_picture(s, 0); s->current_picture_ptr= &s->picture[VAR_6]; } VAR_5 = h261_decode_picture_header(h); if (VAR_5 < 0){ av_log(s->VAR_0, AV_LOG_ERROR, "header damaged\n"); return -1; } if (s->width != VAR_0->coded_width || s->height != VAR_0->coded_height){ ParseContext pc= s->parse_context; s->parse_context.buffer=0; MPV_common_end(s); s->parse_context= pc; } if (!s->context_initialized) { avcodec_set_dimensions(VAR_0, s->width, s->height); goto retry; } s->current_picture.pict_type= s->pict_type; s->current_picture.key_frame= s->pict_type == I_TYPE; if(VAR_0->hurry_up>=5) return get_consumed_bytes(s, VAR_4); if(MPV_frame_start(s, VAR_0) < 0) return -1; ff_er_frame_start(s); s->mb_x=0; s->mb_y=0; while(h->gob_number < (s->mb_height==18 ? 12 : 5)){ if(ff_h261_resync(h)<0) break; h261_decode_gob(h); } MPV_frame_end(s); assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type); assert(s->current_picture.pict_type == s->pict_type); *pict= *(AVFrame*)s->current_picture_ptr; ff_print_debug_info(s, pict); VAR_0->frame_number = s->picture_number - 1; *VAR_2 = sizeof(AVFrame); return get_consumed_bytes(s, VAR_4); }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nuint8_t *VAR_3, int VAR_4)\n{", "H261Context *h= VAR_0->priv_data;", "MpegEncContext *s = &h->s;", "int VAR_5;", "AVFrame *pict = VAR_1;", "#ifdef DEBUG\nprintf(\"*****frame %d size=%d\\n\", VAR_0->frame_number, VAR_4);", "printf(\"bytes=%x %x %x %x\\n\", VAR_3[0], VAR_3[1], VAR_3[2], VAR_3[3]);", "#endif\ns->flags= VAR_0->flags;", "s->flags2= VAR_0->flags2;", "if (VAR_4 == 0) {", "return 0;", "}", "h->gob_start_code_skipped=0;", "retry:\ninit_get_bits(&s->gb, VAR_3, VAR_4*8);", "if(!s->context_initialized){", "if (MPV_common_init(s) < 0)\nreturn -1;", "}", "if(s->current_picture_ptr==NULL || s->current_picture_ptr->VAR_1[0]){", "int VAR_6= ff_find_unused_picture(s, 0);", "s->current_picture_ptr= &s->picture[VAR_6];", "}", "VAR_5 = h261_decode_picture_header(h);", "if (VAR_5 < 0){", "av_log(s->VAR_0, AV_LOG_ERROR, \"header damaged\\n\");", "return -1;", "}", "if (s->width != VAR_0->coded_width || s->height != VAR_0->coded_height){", "ParseContext pc= s->parse_context;", "s->parse_context.buffer=0;", "MPV_common_end(s);", "s->parse_context= pc;", "}", "if (!s->context_initialized) {", "avcodec_set_dimensions(VAR_0, s->width, s->height);", "goto retry;", "}", "s->current_picture.pict_type= s->pict_type;", "s->current_picture.key_frame= s->pict_type == I_TYPE;", "if(VAR_0->hurry_up>=5) return get_consumed_bytes(s, VAR_4);", "if(MPV_frame_start(s, VAR_0) < 0)\nreturn -1;", "ff_er_frame_start(s);", "s->mb_x=0;", "s->mb_y=0;", "while(h->gob_number < (s->mb_height==18 ? 12 : 5)){", "if(ff_h261_resync(h)<0)\nbreak;", "h261_decode_gob(h);", "}", "MPV_frame_end(s);", "assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);", "assert(s->current_picture.pict_type == s->pict_type);", "*pict= *(AVFrame*)s->current_picture_ptr;", "ff_print_debug_info(s, pict);", "VAR_0->frame_number = s->picture_number - 1;", "*VAR_2 = sizeof(AVFrame);", "return get_consumed_bytes(s, 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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47, 51 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 119 ], [ 121 ], [ 127 ], [ 131, 133 ], [ 137 ], [ 143 ], [ 145 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 177 ], [ 181 ], [ 185 ], [ 187 ] ]
10,660
static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; int64_t ret; uint8_t uuid[16]; static const uint8_t uuid_isml_manifest[] = { 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd, 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 }; static const uint8_t uuid_xmp[] = { 0xbe, 0x7a, 0xcf, 0xcb, 0x97, 0xa9, 0x42, 0xe8, 0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac }; static const uint8_t uuid_spherical[] = { 0xff, 0xcc, 0x82, 0x63, 0xf8, 0x55, 0x4a, 0x93, 0x88, 0x14, 0x58, 0x7a, 0x02, 0x52, 0x1f, 0xdd, }; if (atom.size < sizeof(uuid) || atom.size == INT64_MAX) return AVERROR_INVALIDDATA; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams - 1]; sc = st->priv_data; ret = avio_read(pb, uuid, sizeof(uuid)); if (ret < 0) { return ret; } else if (ret != sizeof(uuid)) { return AVERROR_INVALIDDATA; } if (!memcmp(uuid, uuid_isml_manifest, sizeof(uuid))) { uint8_t *buffer, *ptr; char *endptr; size_t len = atom.size - sizeof(uuid); if (len < 4) { return AVERROR_INVALIDDATA; } ret = avio_skip(pb, 4); // zeroes len -= 4; buffer = av_mallocz(len + 1); if (!buffer) { return AVERROR(ENOMEM); } ret = avio_read(pb, buffer, len); if (ret < 0) { av_free(buffer); return ret; } else if (ret != len) { av_free(buffer); return AVERROR_INVALIDDATA; } ptr = buffer; while ((ptr = av_stristr(ptr, "systemBitrate=\""))) { ptr += sizeof("systemBitrate=\"") - 1; c->bitrates_count++; c->bitrates = av_realloc_f(c->bitrates, c->bitrates_count, sizeof(*c->bitrates)); if (!c->bitrates) { c->bitrates_count = 0; av_free(buffer); return AVERROR(ENOMEM); } errno = 0; ret = strtol(ptr, &endptr, 10); if (ret < 0 || errno || *endptr != '"') { c->bitrates[c->bitrates_count - 1] = 0; } else { c->bitrates[c->bitrates_count - 1] = ret; } } av_free(buffer); } else if (!memcmp(uuid, uuid_xmp, sizeof(uuid))) { uint8_t *buffer; size_t len = atom.size - sizeof(uuid); if (c->export_xmp) { buffer = av_mallocz(len + 1); if (!buffer) { return AVERROR(ENOMEM); } ret = avio_read(pb, buffer, len); if (ret < 0) { av_free(buffer); return ret; } else if (ret != len) { av_free(buffer); return AVERROR_INVALIDDATA; } buffer[len] = '\0'; av_dict_set(&c->fc->metadata, "xmp", buffer, 0); av_free(buffer); } else { // skip all uuid atom, which makes it fast for long uuid-xmp file ret = avio_skip(pb, len); if (ret < 0) return ret; } } else if (!memcmp(uuid, uuid_spherical, sizeof(uuid))) { size_t len = atom.size - sizeof(uuid); ret = mov_parse_uuid_spherical(sc, pb, len); if (ret < 0) return ret; if (!sc->spherical) av_log(c->fc, AV_LOG_WARNING, "Invalid spherical metadata found\n"); } return 0; }
false
FFmpeg
2d453188c2303da641dafb048dc1806790526dfd
static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; int64_t ret; uint8_t uuid[16]; static const uint8_t uuid_isml_manifest[] = { 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd, 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 }; static const uint8_t uuid_xmp[] = { 0xbe, 0x7a, 0xcf, 0xcb, 0x97, 0xa9, 0x42, 0xe8, 0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac }; static const uint8_t uuid_spherical[] = { 0xff, 0xcc, 0x82, 0x63, 0xf8, 0x55, 0x4a, 0x93, 0x88, 0x14, 0x58, 0x7a, 0x02, 0x52, 0x1f, 0xdd, }; if (atom.size < sizeof(uuid) || atom.size == INT64_MAX) return AVERROR_INVALIDDATA; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams - 1]; sc = st->priv_data; ret = avio_read(pb, uuid, sizeof(uuid)); if (ret < 0) { return ret; } else if (ret != sizeof(uuid)) { return AVERROR_INVALIDDATA; } if (!memcmp(uuid, uuid_isml_manifest, sizeof(uuid))) { uint8_t *buffer, *ptr; char *endptr; size_t len = atom.size - sizeof(uuid); if (len < 4) { return AVERROR_INVALIDDATA; } ret = avio_skip(pb, 4); len -= 4; buffer = av_mallocz(len + 1); if (!buffer) { return AVERROR(ENOMEM); } ret = avio_read(pb, buffer, len); if (ret < 0) { av_free(buffer); return ret; } else if (ret != len) { av_free(buffer); return AVERROR_INVALIDDATA; } ptr = buffer; while ((ptr = av_stristr(ptr, "systemBitrate=\""))) { ptr += sizeof("systemBitrate=\"") - 1; c->bitrates_count++; c->bitrates = av_realloc_f(c->bitrates, c->bitrates_count, sizeof(*c->bitrates)); if (!c->bitrates) { c->bitrates_count = 0; av_free(buffer); return AVERROR(ENOMEM); } errno = 0; ret = strtol(ptr, &endptr, 10); if (ret < 0 || errno || *endptr != '"') { c->bitrates[c->bitrates_count - 1] = 0; } else { c->bitrates[c->bitrates_count - 1] = ret; } } av_free(buffer); } else if (!memcmp(uuid, uuid_xmp, sizeof(uuid))) { uint8_t *buffer; size_t len = atom.size - sizeof(uuid); if (c->export_xmp) { buffer = av_mallocz(len + 1); if (!buffer) { return AVERROR(ENOMEM); } ret = avio_read(pb, buffer, len); if (ret < 0) { av_free(buffer); return ret; } else if (ret != len) { av_free(buffer); return AVERROR_INVALIDDATA; } buffer[len] = '\0'; av_dict_set(&c->fc->metadata, "xmp", buffer, 0); av_free(buffer); } else { ret = avio_skip(pb, len); if (ret < 0) return ret; } } else if (!memcmp(uuid, uuid_spherical, sizeof(uuid))) { size_t len = atom.size - sizeof(uuid); ret = mov_parse_uuid_spherical(sc, pb, len); if (ret < 0) return ret; if (!sc->spherical) av_log(c->fc, AV_LOG_WARNING, "Invalid spherical metadata found\n"); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st; MOVStreamContext *sc; int64_t ret; uint8_t uuid[16]; static const uint8_t VAR_3[] = { 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd, 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 }; static const uint8_t VAR_4[] = { 0xbe, 0x7a, 0xcf, 0xcb, 0x97, 0xa9, 0x42, 0xe8, 0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac }; static const uint8_t VAR_5[] = { 0xff, 0xcc, 0x82, 0x63, 0xf8, 0x55, 0x4a, 0x93, 0x88, 0x14, 0x58, 0x7a, 0x02, 0x52, 0x1f, 0xdd, }; if (VAR_2.size < sizeof(uuid) || VAR_2.size == INT64_MAX) return AVERROR_INVALIDDATA; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams - 1]; sc = st->priv_data; ret = avio_read(VAR_1, uuid, sizeof(uuid)); if (ret < 0) { return ret; } else if (ret != sizeof(uuid)) { return AVERROR_INVALIDDATA; } if (!memcmp(uuid, VAR_3, sizeof(uuid))) { uint8_t *buffer, *ptr; char *VAR_6; size_t len = VAR_2.size - sizeof(uuid); if (len < 4) { return AVERROR_INVALIDDATA; } ret = avio_skip(VAR_1, 4); len -= 4; buffer = av_mallocz(len + 1); if (!buffer) { return AVERROR(ENOMEM); } ret = avio_read(VAR_1, buffer, len); if (ret < 0) { av_free(buffer); return ret; } else if (ret != len) { av_free(buffer); return AVERROR_INVALIDDATA; } ptr = buffer; while ((ptr = av_stristr(ptr, "systemBitrate=\""))) { ptr += sizeof("systemBitrate=\"") - 1; VAR_0->bitrates_count++; VAR_0->bitrates = av_realloc_f(VAR_0->bitrates, VAR_0->bitrates_count, sizeof(*VAR_0->bitrates)); if (!VAR_0->bitrates) { VAR_0->bitrates_count = 0; av_free(buffer); return AVERROR(ENOMEM); } errno = 0; ret = strtol(ptr, &VAR_6, 10); if (ret < 0 || errno || *VAR_6 != '"') { VAR_0->bitrates[VAR_0->bitrates_count - 1] = 0; } else { VAR_0->bitrates[VAR_0->bitrates_count - 1] = ret; } } av_free(buffer); } else if (!memcmp(uuid, VAR_4, sizeof(uuid))) { uint8_t *buffer; size_t len = VAR_2.size - sizeof(uuid); if (VAR_0->export_xmp) { buffer = av_mallocz(len + 1); if (!buffer) { return AVERROR(ENOMEM); } ret = avio_read(VAR_1, buffer, len); if (ret < 0) { av_free(buffer); return ret; } else if (ret != len) { av_free(buffer); return AVERROR_INVALIDDATA; } buffer[len] = '\0'; av_dict_set(&VAR_0->fc->metadata, "xmp", buffer, 0); av_free(buffer); } else { ret = avio_skip(VAR_1, len); if (ret < 0) return ret; } } else if (!memcmp(uuid, VAR_5, sizeof(uuid))) { size_t len = VAR_2.size - sizeof(uuid); ret = mov_parse_uuid_spherical(sc, VAR_1, len); if (ret < 0) return ret; if (!sc->spherical) av_log(VAR_0->fc, AV_LOG_WARNING, "Invalid spherical metadata found\n"); } return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st;", "MOVStreamContext *sc;", "int64_t ret;", "uint8_t uuid[16];", "static const uint8_t VAR_3[] = {", "0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,\n0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66\n};", "static const uint8_t VAR_4[] = {", "0xbe, 0x7a, 0xcf, 0xcb, 0x97, 0xa9, 0x42, 0xe8,\n0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac\n};", "static const uint8_t VAR_5[] = {", "0xff, 0xcc, 0x82, 0x63, 0xf8, 0x55, 0x4a, 0x93,\n0x88, 0x14, 0x58, 0x7a, 0x02, 0x52, 0x1f, 0xdd,\n};", "if (VAR_2.size < sizeof(uuid) || VAR_2.size == INT64_MAX)\nreturn AVERROR_INVALIDDATA;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams - 1];", "sc = st->priv_data;", "ret = avio_read(VAR_1, uuid, sizeof(uuid));", "if (ret < 0) {", "return ret;", "} else if (ret != sizeof(uuid)) {", "return AVERROR_INVALIDDATA;", "}", "if (!memcmp(uuid, VAR_3, sizeof(uuid))) {", "uint8_t *buffer, *ptr;", "char *VAR_6;", "size_t len = VAR_2.size - sizeof(uuid);", "if (len < 4) {", "return AVERROR_INVALIDDATA;", "}", "ret = avio_skip(VAR_1, 4);", "len -= 4;", "buffer = av_mallocz(len + 1);", "if (!buffer) {", "return AVERROR(ENOMEM);", "}", "ret = avio_read(VAR_1, buffer, len);", "if (ret < 0) {", "av_free(buffer);", "return ret;", "} else if (ret != len) {", "av_free(buffer);", "return AVERROR_INVALIDDATA;", "}", "ptr = buffer;", "while ((ptr = av_stristr(ptr, \"systemBitrate=\\\"\"))) {", "ptr += sizeof(\"systemBitrate=\\\"\") - 1;", "VAR_0->bitrates_count++;", "VAR_0->bitrates = av_realloc_f(VAR_0->bitrates, VAR_0->bitrates_count, sizeof(*VAR_0->bitrates));", "if (!VAR_0->bitrates) {", "VAR_0->bitrates_count = 0;", "av_free(buffer);", "return AVERROR(ENOMEM);", "}", "errno = 0;", "ret = strtol(ptr, &VAR_6, 10);", "if (ret < 0 || errno || *VAR_6 != '\"') {", "VAR_0->bitrates[VAR_0->bitrates_count - 1] = 0;", "} else {", "VAR_0->bitrates[VAR_0->bitrates_count - 1] = ret;", "}", "}", "av_free(buffer);", "} else if (!memcmp(uuid, VAR_4, sizeof(uuid))) {", "uint8_t *buffer;", "size_t len = VAR_2.size - sizeof(uuid);", "if (VAR_0->export_xmp) {", "buffer = av_mallocz(len + 1);", "if (!buffer) {", "return AVERROR(ENOMEM);", "}", "ret = avio_read(VAR_1, buffer, len);", "if (ret < 0) {", "av_free(buffer);", "return ret;", "} else if (ret != len) {", "av_free(buffer);", "return AVERROR_INVALIDDATA;", "}", "buffer[len] = '\\0';", "av_dict_set(&VAR_0->fc->metadata, \"xmp\", buffer, 0);", "av_free(buffer);", "} else {", "ret = avio_skip(VAR_1, len);", "if (ret < 0)\nreturn ret;", "}", "} else if (!memcmp(uuid, VAR_5, sizeof(uuid))) {", "size_t len = VAR_2.size - sizeof(uuid);", "ret = mov_parse_uuid_spherical(sc, VAR_1, len);", "if (ret < 0)\nreturn ret;", "if (!sc->spherical)\nav_log(VAR_0->fc, AV_LOG_WARNING, \"Invalid spherical metadata found\\n\"); }", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 39, 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 199, 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211, 213 ], [ 215, 217 ], [ 221 ], [ 223 ] ]
10,661
uint64_t HELPER(neon_abdl_u16)(uint32_t a, uint32_t b) { uint64_t tmp; uint64_t result; DO_ABD(result, a, b, uint8_t); DO_ABD(tmp, a >> 8, b >> 8, uint8_t); result |= tmp << 16; DO_ABD(tmp, a >> 16, b >> 16, uint8_t); result |= tmp << 32; DO_ABD(tmp, a >> 24, b >> 24, uint8_t); result |= tmp << 48; return result; }
true
qemu
4d9ad7f793605abd9806fc932b3e04e028894565
uint64_t HELPER(neon_abdl_u16)(uint32_t a, uint32_t b) { uint64_t tmp; uint64_t result; DO_ABD(result, a, b, uint8_t); DO_ABD(tmp, a >> 8, b >> 8, uint8_t); result |= tmp << 16; DO_ABD(tmp, a >> 16, b >> 16, uint8_t); result |= tmp << 32; DO_ABD(tmp, a >> 24, b >> 24, uint8_t); result |= tmp << 48; return result; }
{ "code": [ " DO_ABD(result, a, b, uint8_t);", " DO_ABD(tmp, a >> 8, b >> 8, uint8_t);", " DO_ABD(tmp, a >> 16, b >> 16, uint8_t);", " DO_ABD(tmp, a >> 24, b >> 24, uint8_t);" ], "line_no": [ 9, 11, 15, 19 ] }
uint64_t FUNC_0(neon_abdl_u16)(uint32_t a, uint32_t b) { uint64_t tmp; uint64_t result; DO_ABD(result, a, b, uint8_t); DO_ABD(tmp, a >> 8, b >> 8, uint8_t); result |= tmp << 16; DO_ABD(tmp, a >> 16, b >> 16, uint8_t); result |= tmp << 32; DO_ABD(tmp, a >> 24, b >> 24, uint8_t); result |= tmp << 48; return result; }
[ "uint64_t FUNC_0(neon_abdl_u16)(uint32_t a, uint32_t b)\n{", "uint64_t tmp;", "uint64_t result;", "DO_ABD(result, a, b, uint8_t);", "DO_ABD(tmp, a >> 8, b >> 8, uint8_t);", "result |= tmp << 16;", "DO_ABD(tmp, a >> 16, b >> 16, uint8_t);", "result |= tmp << 32;", "DO_ABD(tmp, a >> 24, b >> 24, uint8_t);", "result |= tmp << 48;", "return result;", "}" ]
[ 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
10,663
static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s, AVFrame *frame) { int x, y; unsigned char P[8]; int flags = 0; bytestream2_get_buffer(&s->stream_ptr, P, 4); /* 4-color encoding for each 4x4 quadrant, or 4-color encoding on * either top and bottom or left and right halves */ if (P[0] <= P[1]) { /* 4-color encoding for each quadrant; need 32 bytes */ for (y = 0; y < 16; y++) { // new values for each 4x4 block if (!(y & 3)) { if (y) bytestream2_get_buffer(&s->stream_ptr, P, 4); flags = bytestream2_get_le32(&s->stream_ptr); for (x = 0; x < 4; x++, flags >>= 2) *s->pixel_ptr++ = P[flags & 0x03]; s->pixel_ptr += s->stride - 4; // switch to right half if (y == 7) s->pixel_ptr -= 8 * s->stride - 4; } else { // vertical split? int vert; uint64_t flags = bytestream2_get_le64(&s->stream_ptr); bytestream2_get_buffer(&s->stream_ptr, P + 4, 4); vert = P[4] <= P[5]; /* 4-color encoding for either left and right or top and bottom * halves */ for (y = 0; y < 16; y++) { for (x = 0; x < 4; x++, flags >>= 2) *s->pixel_ptr++ = P[flags & 0x03]; if (vert) { s->pixel_ptr += s->stride - 4; // switch to right half if (y == 7) s->pixel_ptr -= 8 * s->stride - 4; } else if (y & 1) s->pixel_ptr += s->line_inc; // load values for second half if (y == 7) { memcpy(P, P + 4, 4); flags = bytestream2_get_le64(&s->stream_ptr); /* report success */ return 0;
true
FFmpeg
ff1e30c059386db05131fe2f5bca1f35e1f5ac7e
static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s, AVFrame *frame) { int x, y; unsigned char P[8]; int flags = 0; bytestream2_get_buffer(&s->stream_ptr, P, 4); if (P[0] <= P[1]) { for (y = 0; y < 16; y++) { if (!(y & 3)) { if (y) bytestream2_get_buffer(&s->stream_ptr, P, 4); flags = bytestream2_get_le32(&s->stream_ptr); for (x = 0; x < 4; x++, flags >>= 2) *s->pixel_ptr++ = P[flags & 0x03]; s->pixel_ptr += s->stride - 4; if (y == 7) s->pixel_ptr -= 8 * s->stride - 4; } else { int vert; uint64_t flags = bytestream2_get_le64(&s->stream_ptr); bytestream2_get_buffer(&s->stream_ptr, P + 4, 4); vert = P[4] <= P[5]; for (y = 0; y < 16; y++) { for (x = 0; x < 4; x++, flags >>= 2) *s->pixel_ptr++ = P[flags & 0x03]; if (vert) { s->pixel_ptr += s->stride - 4; if (y == 7) s->pixel_ptr -= 8 * s->stride - 4; } else if (y & 1) s->pixel_ptr += s->line_inc; if (y == 7) { memcpy(P, P + 4, 4); flags = bytestream2_get_le64(&s->stream_ptr); return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(IpvideoContext *VAR_0, AVFrame *VAR_1) { int VAR_2, VAR_3; unsigned char VAR_4[8]; int VAR_5 = 0; bytestream2_get_buffer(&VAR_0->stream_ptr, VAR_4, 4); if (VAR_4[0] <= VAR_4[1]) { for (VAR_3 = 0; VAR_3 < 16; VAR_3++) { if (!(VAR_3 & 3)) { if (VAR_3) bytestream2_get_buffer(&VAR_0->stream_ptr, VAR_4, 4); VAR_5 = bytestream2_get_le32(&VAR_0->stream_ptr); for (VAR_2 = 0; VAR_2 < 4; VAR_2++, VAR_5 >>= 2) *VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 0x03]; VAR_0->pixel_ptr += VAR_0->stride - 4; if (VAR_3 == 7) VAR_0->pixel_ptr -= 8 * VAR_0->stride - 4; } else { int VAR_6; uint64_t VAR_5 = bytestream2_get_le64(&VAR_0->stream_ptr); bytestream2_get_buffer(&VAR_0->stream_ptr, VAR_4 + 4, 4); VAR_6 = VAR_4[4] <= VAR_4[5]; for (VAR_3 = 0; VAR_3 < 16; VAR_3++) { for (VAR_2 = 0; VAR_2 < 4; VAR_2++, VAR_5 >>= 2) *VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 0x03]; if (VAR_6) { VAR_0->pixel_ptr += VAR_0->stride - 4; if (VAR_3 == 7) VAR_0->pixel_ptr -= 8 * VAR_0->stride - 4; } else if (VAR_3 & 1) VAR_0->pixel_ptr += VAR_0->line_inc; if (VAR_3 == 7) { memcpy(VAR_4, VAR_4 + 4, 4); VAR_5 = bytestream2_get_le64(&VAR_0->stream_ptr); return 0;
[ "static int FUNC_0(IpvideoContext *VAR_0, AVFrame *VAR_1)\n{", "int VAR_2, VAR_3;", "unsigned char VAR_4[8];", "int VAR_5 = 0;", "bytestream2_get_buffer(&VAR_0->stream_ptr, VAR_4, 4);", "if (VAR_4[0] <= VAR_4[1]) {", "for (VAR_3 = 0; VAR_3 < 16; VAR_3++) {", "if (!(VAR_3 & 3)) {", "if (VAR_3) bytestream2_get_buffer(&VAR_0->stream_ptr, VAR_4, 4);", "VAR_5 = bytestream2_get_le32(&VAR_0->stream_ptr);", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++, VAR_5 >>= 2)", "*VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 0x03];", "VAR_0->pixel_ptr += VAR_0->stride - 4;", "if (VAR_3 == 7) VAR_0->pixel_ptr -= 8 * VAR_0->stride - 4;", "} else {", "int VAR_6;", "uint64_t VAR_5 = bytestream2_get_le64(&VAR_0->stream_ptr);", "bytestream2_get_buffer(&VAR_0->stream_ptr, VAR_4 + 4, 4);", "VAR_6 = VAR_4[4] <= VAR_4[5];", "for (VAR_3 = 0; VAR_3 < 16; VAR_3++) {", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++, VAR_5 >>= 2)", "*VAR_0->pixel_ptr++ = VAR_4[VAR_5 & 0x03];", "if (VAR_6) {", "VAR_0->pixel_ptr += VAR_0->stride - 4;", "if (VAR_3 == 7) VAR_0->pixel_ptr -= 8 * VAR_0->stride - 4;", "} else if (VAR_3 & 1) VAR_0->pixel_ptr += VAR_0->line_inc;", "if (VAR_3 == 7) {", "memcpy(VAR_4, VAR_4 + 4, 4);", "VAR_5 = bytestream2_get_le64(&VAR_0->stream_ptr);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 9 ], [ 11 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 20 ], [ 21 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 35 ], [ 36 ], [ 38 ], [ 39 ], [ 40 ], [ 42 ] ]
10,664
static av_cold int truemotion1_decode_init(AVCodecContext *avctx) { TrueMotion1Context *s = avctx->priv_data; s->avctx = avctx; // FIXME: it may change ? // if (avctx->bits_per_sample == 24) // avctx->pix_fmt = AV_PIX_FMT_RGB24; // else // avctx->pix_fmt = AV_PIX_FMT_RGB555; s->frame = av_frame_alloc(); if (!s->frame) return AVERROR(ENOMEM); /* there is a vertical predictor for each pixel in a line; each vertical * predictor is 0 to start with */ av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int)); if (!s->vert_pred) return AVERROR(ENOMEM); return 0; }
true
FFmpeg
46e75617d9700be8840a843237f8571061a63a8e
static av_cold int truemotion1_decode_init(AVCodecContext *avctx) { TrueMotion1Context *s = avctx->priv_data; s->avctx = avctx; s->frame = av_frame_alloc(); if (!s->frame) return AVERROR(ENOMEM); av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int)); if (!s->vert_pred) return AVERROR(ENOMEM); return 0; }
{ "code": [ " if (!s->vert_pred)" ], "line_no": [ 39 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { TrueMotion1Context *s = avctx->priv_data; s->avctx = avctx; s->frame = av_frame_alloc(); if (!s->frame) return AVERROR(ENOMEM); av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int)); if (!s->vert_pred) return AVERROR(ENOMEM); return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "TrueMotion1Context *s = avctx->priv_data;", "s->avctx = avctx;", "s->frame = av_frame_alloc();", "if (!s->frame)\nreturn AVERROR(ENOMEM);", "av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int));", "if (!s->vert_pred)\nreturn AVERROR(ENOMEM);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 25 ], [ 27, 29 ], [ 37 ], [ 39, 41 ], [ 45 ], [ 47 ] ]
10,666
static uint32_t suov32(CPUTriCoreState *env, int64_t arg) { uint32_t ret; int64_t max_pos = UINT32_MAX; if (arg > max_pos) { env->PSW_USB_V = (1 << 31); env->PSW_USB_SV = (1 << 31); ret = (target_ulong)max_pos; } else { if (arg < 0) { env->PSW_USB_V = (1 << 31); env->PSW_USB_SV = (1 << 31); ret = 0; } else { env->PSW_USB_V = 0; ret = (target_ulong)arg; } } env->PSW_USB_AV = arg ^ arg * 2u; env->PSW_USB_SAV |= env->PSW_USB_AV; return ret; }
true
qemu
85d604af5f96c32734af9974ec6ddb625b6716a2
static uint32_t suov32(CPUTriCoreState *env, int64_t arg) { uint32_t ret; int64_t max_pos = UINT32_MAX; if (arg > max_pos) { env->PSW_USB_V = (1 << 31); env->PSW_USB_SV = (1 << 31); ret = (target_ulong)max_pos; } else { if (arg < 0) { env->PSW_USB_V = (1 << 31); env->PSW_USB_SV = (1 << 31); ret = 0; } else { env->PSW_USB_V = 0; ret = (target_ulong)arg; } } env->PSW_USB_AV = arg ^ arg * 2u; env->PSW_USB_SAV |= env->PSW_USB_AV; return ret; }
{ "code": [ "static uint32_t suov32(CPUTriCoreState *env, int64_t arg)", " int64_t max_pos = UINT32_MAX;", " if (arg < 0) {", " env->PSW_USB_V = (1 << 31);", " env->PSW_USB_SV = (1 << 31);", " ret = 0;", " } else {", " env->PSW_USB_V = 0;", " ret = (target_ulong)arg;" ], "line_no": [ 1, 7, 19, 21, 23, 25, 27, 29, 31 ] }
static uint32_t FUNC_0(CPUTriCoreState *env, int64_t arg) { uint32_t ret; int64_t max_pos = UINT32_MAX; if (arg > max_pos) { env->PSW_USB_V = (1 << 31); env->PSW_USB_SV = (1 << 31); ret = (target_ulong)max_pos; } else { if (arg < 0) { env->PSW_USB_V = (1 << 31); env->PSW_USB_SV = (1 << 31); ret = 0; } else { env->PSW_USB_V = 0; ret = (target_ulong)arg; } } env->PSW_USB_AV = arg ^ arg * 2u; env->PSW_USB_SAV |= env->PSW_USB_AV; return ret; }
[ "static uint32_t FUNC_0(CPUTriCoreState *env, int64_t arg)\n{", "uint32_t ret;", "int64_t max_pos = UINT32_MAX;", "if (arg > max_pos) {", "env->PSW_USB_V = (1 << 31);", "env->PSW_USB_SV = (1 << 31);", "ret = (target_ulong)max_pos;", "} else {", "if (arg < 0) {", "env->PSW_USB_V = (1 << 31);", "env->PSW_USB_SV = (1 << 31);", "ret = 0;", "} else {", "env->PSW_USB_V = 0;", "ret = (target_ulong)arg;", "}", "}", "env->PSW_USB_AV = arg ^ arg * 2u;", "env->PSW_USB_SAV |= env->PSW_USB_AV;", "return ret;", "}" ]
[ 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 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 ] ]
10,667
static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt) { DiracContext *s = avctx->priv_data; AVFrame *picture = data; uint8_t *buf = pkt->data; int buf_size = pkt->size; int i, data_unit_size, buf_idx = 0; int ret; /* release unused frames */ for (i = 0; i < MAX_FRAMES; i++) if (s->all_frames[i].avframe->data[0] && !s->all_frames[i].avframe->reference) { av_frame_unref(s->all_frames[i].avframe); memset(s->all_frames[i].interpolated, 0, sizeof(s->all_frames[i].interpolated)); } s->current_picture = NULL; *got_frame = 0; /* end of stream, so flush delayed pics */ if (buf_size == 0) return get_delayed_pic(s, (AVFrame *)data, got_frame); for (;;) { /*[DIRAC_STD] Here starts the code from parse_info() defined in 9.6 [DIRAC_STD] PARSE_INFO_PREFIX = "BBCD" as defined in ISO/IEC 646 BBCD start code search */ for (; buf_idx + DATA_UNIT_HEADER_SIZE < buf_size; buf_idx++) { if (buf[buf_idx ] == 'B' && buf[buf_idx+1] == 'B' && buf[buf_idx+2] == 'C' && buf[buf_idx+3] == 'D') break; } /* BBCD found or end of data */ if (buf_idx + DATA_UNIT_HEADER_SIZE >= buf_size) break; data_unit_size = AV_RB32(buf+buf_idx+5); if (data_unit_size > buf_size - buf_idx || !data_unit_size) { if(data_unit_size > buf_size - buf_idx) av_log(s->avctx, AV_LOG_ERROR, "Data unit with size %d is larger than input buffer, discarding\n", data_unit_size); buf_idx += 4; continue; } /* [DIRAC_STD] dirac_decode_data_unit makes reference to the while defined in 9.3 inside the function parse_sequence() */ ret = dirac_decode_data_unit(avctx, buf+buf_idx, data_unit_size); if (ret < 0) { av_log(s->avctx, AV_LOG_ERROR,"Error in dirac_decode_data_unit\n"); return ret; } buf_idx += data_unit_size; } if (!s->current_picture) return buf_size; if (s->current_picture->avframe->display_picture_number > s->frame_number) { DiracFrame *delayed_frame = remove_frame(s->delay_frames, s->frame_number); s->current_picture->avframe->reference |= DELAYED_PIC_REF; if (add_frame(s->delay_frames, MAX_DELAY, s->current_picture)) { int min_num = s->delay_frames[0]->avframe->display_picture_number; /* Too many delayed frames, so we display the frame with the lowest pts */ av_log(avctx, AV_LOG_ERROR, "Delay frame overflow\n"); for (i = 1; s->delay_frames[i]; i++) if (s->delay_frames[i]->avframe->display_picture_number < min_num) min_num = s->delay_frames[i]->avframe->display_picture_number; delayed_frame = remove_frame(s->delay_frames, min_num); add_frame(s->delay_frames, MAX_DELAY, s->current_picture); } if (delayed_frame) { delayed_frame->avframe->reference ^= DELAYED_PIC_REF; if((ret=av_frame_ref(data, delayed_frame->avframe)) < 0) return ret; *got_frame = 1; } } else if (s->current_picture->avframe->display_picture_number == s->frame_number) { /* The right frame at the right time :-) */ if((ret=av_frame_ref(data, s->current_picture->avframe)) < 0) return ret; *got_frame = 1; } if (*got_frame) s->frame_number = picture->display_picture_number + 1; return buf_idx; }
false
FFmpeg
8f1afde11d4d76fc2444074b45d76a5113d1d748
static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt) { DiracContext *s = avctx->priv_data; AVFrame *picture = data; uint8_t *buf = pkt->data; int buf_size = pkt->size; int i, data_unit_size, buf_idx = 0; int ret; for (i = 0; i < MAX_FRAMES; i++) if (s->all_frames[i].avframe->data[0] && !s->all_frames[i].avframe->reference) { av_frame_unref(s->all_frames[i].avframe); memset(s->all_frames[i].interpolated, 0, sizeof(s->all_frames[i].interpolated)); } s->current_picture = NULL; *got_frame = 0; if (buf_size == 0) return get_delayed_pic(s, (AVFrame *)data, got_frame); for (;;) { for (; buf_idx + DATA_UNIT_HEADER_SIZE < buf_size; buf_idx++) { if (buf[buf_idx ] == 'B' && buf[buf_idx+1] == 'B' && buf[buf_idx+2] == 'C' && buf[buf_idx+3] == 'D') break; } if (buf_idx + DATA_UNIT_HEADER_SIZE >= buf_size) break; data_unit_size = AV_RB32(buf+buf_idx+5); if (data_unit_size > buf_size - buf_idx || !data_unit_size) { if(data_unit_size > buf_size - buf_idx) av_log(s->avctx, AV_LOG_ERROR, "Data unit with size %d is larger than input buffer, discarding\n", data_unit_size); buf_idx += 4; continue; } ret = dirac_decode_data_unit(avctx, buf+buf_idx, data_unit_size); if (ret < 0) { av_log(s->avctx, AV_LOG_ERROR,"Error in dirac_decode_data_unit\n"); return ret; } buf_idx += data_unit_size; } if (!s->current_picture) return buf_size; if (s->current_picture->avframe->display_picture_number > s->frame_number) { DiracFrame *delayed_frame = remove_frame(s->delay_frames, s->frame_number); s->current_picture->avframe->reference |= DELAYED_PIC_REF; if (add_frame(s->delay_frames, MAX_DELAY, s->current_picture)) { int min_num = s->delay_frames[0]->avframe->display_picture_number; av_log(avctx, AV_LOG_ERROR, "Delay frame overflow\n"); for (i = 1; s->delay_frames[i]; i++) if (s->delay_frames[i]->avframe->display_picture_number < min_num) min_num = s->delay_frames[i]->avframe->display_picture_number; delayed_frame = remove_frame(s->delay_frames, min_num); add_frame(s->delay_frames, MAX_DELAY, s->current_picture); } if (delayed_frame) { delayed_frame->avframe->reference ^= DELAYED_PIC_REF; if((ret=av_frame_ref(data, delayed_frame->avframe)) < 0) return ret; *got_frame = 1; } } else if (s->current_picture->avframe->display_picture_number == s->frame_number) { if((ret=av_frame_ref(data, s->current_picture->avframe)) < 0) return ret; *got_frame = 1; } if (*got_frame) s->frame_number = picture->display_picture_number + 1; return buf_idx; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { DiracContext *s = VAR_0->priv_data; AVFrame *picture = VAR_1; uint8_t *buf = VAR_3->VAR_1; int VAR_4 = VAR_3->size; int VAR_5, VAR_6, VAR_7 = 0; int VAR_8; for (VAR_5 = 0; VAR_5 < MAX_FRAMES; VAR_5++) if (s->all_frames[VAR_5].avframe->VAR_1[0] && !s->all_frames[VAR_5].avframe->reference) { av_frame_unref(s->all_frames[VAR_5].avframe); memset(s->all_frames[VAR_5].interpolated, 0, sizeof(s->all_frames[VAR_5].interpolated)); } s->current_picture = NULL; *VAR_2 = 0; if (VAR_4 == 0) return get_delayed_pic(s, (AVFrame *)VAR_1, VAR_2); for (;;) { for (; VAR_7 + DATA_UNIT_HEADER_SIZE < VAR_4; VAR_7++) { if (buf[VAR_7 ] == 'B' && buf[VAR_7+1] == 'B' && buf[VAR_7+2] == 'C' && buf[VAR_7+3] == 'D') break; } if (VAR_7 + DATA_UNIT_HEADER_SIZE >= VAR_4) break; VAR_6 = AV_RB32(buf+VAR_7+5); if (VAR_6 > VAR_4 - VAR_7 || !VAR_6) { if(VAR_6 > VAR_4 - VAR_7) av_log(s->VAR_0, AV_LOG_ERROR, "Data unit with size %d is larger than input buffer, discarding\n", VAR_6); VAR_7 += 4; continue; } VAR_8 = dirac_decode_data_unit(VAR_0, buf+VAR_7, VAR_6); if (VAR_8 < 0) { av_log(s->VAR_0, AV_LOG_ERROR,"Error in dirac_decode_data_unit\n"); return VAR_8; } VAR_7 += VAR_6; } if (!s->current_picture) return VAR_4; if (s->current_picture->avframe->display_picture_number > s->frame_number) { DiracFrame *delayed_frame = remove_frame(s->delay_frames, s->frame_number); s->current_picture->avframe->reference |= DELAYED_PIC_REF; if (add_frame(s->delay_frames, MAX_DELAY, s->current_picture)) { int VAR_9 = s->delay_frames[0]->avframe->display_picture_number; av_log(VAR_0, AV_LOG_ERROR, "Delay frame overflow\n"); for (VAR_5 = 1; s->delay_frames[VAR_5]; VAR_5++) if (s->delay_frames[VAR_5]->avframe->display_picture_number < VAR_9) VAR_9 = s->delay_frames[VAR_5]->avframe->display_picture_number; delayed_frame = remove_frame(s->delay_frames, VAR_9); add_frame(s->delay_frames, MAX_DELAY, s->current_picture); } if (delayed_frame) { delayed_frame->avframe->reference ^= DELAYED_PIC_REF; if((VAR_8=av_frame_ref(VAR_1, delayed_frame->avframe)) < 0) return VAR_8; *VAR_2 = 1; } } else if (s->current_picture->avframe->display_picture_number == s->frame_number) { if((VAR_8=av_frame_ref(VAR_1, s->current_picture->avframe)) < 0) return VAR_8; *VAR_2 = 1; } if (*VAR_2) s->frame_number = picture->display_picture_number + 1; return VAR_7; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3)\n{", "DiracContext *s = VAR_0->priv_data;", "AVFrame *picture = VAR_1;", "uint8_t *buf = VAR_3->VAR_1;", "int VAR_4 = VAR_3->size;", "int VAR_5, VAR_6, VAR_7 = 0;", "int VAR_8;", "for (VAR_5 = 0; VAR_5 < MAX_FRAMES; VAR_5++)", "if (s->all_frames[VAR_5].avframe->VAR_1[0] && !s->all_frames[VAR_5].avframe->reference) {", "av_frame_unref(s->all_frames[VAR_5].avframe);", "memset(s->all_frames[VAR_5].interpolated, 0, sizeof(s->all_frames[VAR_5].interpolated));", "}", "s->current_picture = NULL;", "*VAR_2 = 0;", "if (VAR_4 == 0)\nreturn get_delayed_pic(s, (AVFrame *)VAR_1, VAR_2);", "for (;;) {", "for (; VAR_7 + DATA_UNIT_HEADER_SIZE < VAR_4; VAR_7++) {", "if (buf[VAR_7 ] == 'B' && buf[VAR_7+1] == 'B' &&\nbuf[VAR_7+2] == 'C' && buf[VAR_7+3] == 'D')\nbreak;", "}", "if (VAR_7 + DATA_UNIT_HEADER_SIZE >= VAR_4)\nbreak;", "VAR_6 = AV_RB32(buf+VAR_7+5);", "if (VAR_6 > VAR_4 - VAR_7 || !VAR_6) {", "if(VAR_6 > VAR_4 - VAR_7)\nav_log(s->VAR_0, AV_LOG_ERROR,\n\"Data unit with size %d is larger than input buffer, discarding\\n\",\nVAR_6);", "VAR_7 += 4;", "continue;", "}", "VAR_8 = dirac_decode_data_unit(VAR_0, buf+VAR_7, VAR_6);", "if (VAR_8 < 0)\n{", "av_log(s->VAR_0, AV_LOG_ERROR,\"Error in dirac_decode_data_unit\\n\");", "return VAR_8;", "}", "VAR_7 += VAR_6;", "}", "if (!s->current_picture)\nreturn VAR_4;", "if (s->current_picture->avframe->display_picture_number > s->frame_number) {", "DiracFrame *delayed_frame = remove_frame(s->delay_frames, s->frame_number);", "s->current_picture->avframe->reference |= DELAYED_PIC_REF;", "if (add_frame(s->delay_frames, MAX_DELAY, s->current_picture)) {", "int VAR_9 = s->delay_frames[0]->avframe->display_picture_number;", "av_log(VAR_0, AV_LOG_ERROR, \"Delay frame overflow\\n\");", "for (VAR_5 = 1; s->delay_frames[VAR_5]; VAR_5++)", "if (s->delay_frames[VAR_5]->avframe->display_picture_number < VAR_9)\nVAR_9 = s->delay_frames[VAR_5]->avframe->display_picture_number;", "delayed_frame = remove_frame(s->delay_frames, VAR_9);", "add_frame(s->delay_frames, MAX_DELAY, s->current_picture);", "}", "if (delayed_frame) {", "delayed_frame->avframe->reference ^= DELAYED_PIC_REF;", "if((VAR_8=av_frame_ref(VAR_1, delayed_frame->avframe)) < 0)\nreturn VAR_8;", "*VAR_2 = 1;", "}", "} else if (s->current_picture->avframe->display_picture_number == s->frame_number) {", "if((VAR_8=av_frame_ref(VAR_1, s->current_picture->avframe)) < 0)\nreturn VAR_8;", "*VAR_2 = 1;", "}", "if (*VAR_2)\ns->frame_number = picture->display_picture_number + 1;", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 41, 43 ], [ 47 ], [ 55 ], [ 57, 59, 61 ], [ 63 ], [ 67, 69 ], [ 73 ], [ 75 ], [ 77, 79, 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111, 113 ], [ 117 ], [ 119 ], [ 123 ], [ 127 ], [ 129 ], [ 133 ], [ 137 ], [ 139, 141 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 179, 181 ], [ 185 ], [ 187 ] ]
10,668
static int decode_svq1_block (bit_buffer_t *bitbuf, uint8_t *pixels, int pitch, int intra) { uint32_t bit_cache; vlc_code_t *vlc; uint8_t *list[63]; uint32_t *dst; uint32_t *codebook; int entries[6]; int i, j, m, n; int mean, stages; int x, y, width, height, level; uint32_t n1, n2, n3, n4; /* initialize list for breadth first processing of vectors */ list[0] = pixels; /* recursively process vector */ for (i=0, m=1, n=1, level=5; i < n; i++) { for (; level > 0; i++) { /* process next depth */ if (i == m) { m = n; if (--level == 0) break; } /* divide block if next bit set */ if (get_bits (bitbuf, 1) == 0) break; /* add child nodes */ list[n++] = list[i]; list[n++] = list[i] + (((level & 1) ? pitch : 1) << ((level / 2) + 1)); } /* destination address and vector size */ dst = (uint32_t *) list[i]; width = 1 << ((4 + level) /2); height = 1 << ((3 + level) /2); /* get number of stages (-1 skips vector, 0 for mean only) */ bit_cache = get_bit_cache (bitbuf); if (intra) vlc = &intra_vector_tables[level][bit_cache >> (32 - 7)]; else vlc = &inter_vector_tables[level][bit_cache >> (32 - 6)]; /* flush bits */ stages = vlc->value; skip_bits(bitbuf,vlc->length); if (stages == -1) { if (intra) { for (y=0; y < height; y++) { memset (&dst[y*(pitch / 4)], 0, width); } } continue; /* skip vector */ } if ((stages > 0) && (level >= 4)) { #ifdef DEBUG_SVQ1 printf("Error (decode_svq1_block): invalid vector: stages=%i level=%i\n",stages,level); #endif return -1; /* invalid vector */ } /* get mean value for vector */ bit_cache = get_bit_cache (bitbuf); if (intra) { if (bit_cache >= 0x25000000) vlc = &intra_mean_table_0[(bit_cache >> (32 - 8)) - 37]; else if (bit_cache >= 0x03400000) vlc = &intra_mean_table_1[(bit_cache >> (32 - 10)) - 13]; else if (bit_cache >= 0x00040000) vlc = &intra_mean_table_2[(bit_cache >> (32 - 14)) - 1]; else vlc = &intra_mean_table_3[bit_cache >> (32 - 20)]; } else { if (bit_cache >= 0x0B000000) vlc = &inter_mean_table_0[(bit_cache >> (32 - 8)) - 11]; else if (bit_cache >= 0x01200000) vlc = &inter_mean_table_1[(bit_cache >> (32 - 12)) - 18]; else if (bit_cache >= 0x002E0000) vlc = &inter_mean_table_2[(bit_cache >> (32 - 15)) - 23]; else if (bit_cache >= 0x00094000) vlc = &inter_mean_table_3[(bit_cache >> (32 - 18)) - 37]; else if (bit_cache >= 0x00049000) vlc = &inter_mean_table_4[(bit_cache >> (32 - 20)) - 73]; else vlc = &inter_mean_table_5[bit_cache >> (32 - 22)]; } /* flush bits */ mean = vlc->value; skip_bits(bitbuf,vlc->length); if (intra && stages == 0) { for (y=0; y < height; y++) { memset (&dst[y*(pitch / 4)], mean, width); } } else { codebook = (uint32_t *) (intra ? intra_codebooks[level] : inter_codebooks[level]); bit_cache = get_bits (bitbuf, 4*stages); /* calculate codebook entries for this vector */ for (j=0; j < stages; j++) { entries[j] = (((bit_cache >> (4*(stages - j - 1))) & 0xF) + 16*j) << (level + 1); } mean -= (stages * 128); n4 = ((mean + (mean >> 31)) << 16) | (mean & 0xFFFF); for (y=0; y < height; y++) { for (x=0; x < (width / 4); x++, codebook++) { if (intra) { n1 = n4; n2 = n4; } else { n3 = dst[x]; /* add mean value to vector */ n1 = ((n3 & 0xFF00FF00) >> 8) + n4; n2 = (n3 & 0x00FF00FF) + n4; } /* add codebook entries to vector */ for (j=0; j < stages; j++) { n3 = codebook[entries[j]] ^ 0x80808080; n1 += ((n3 & 0xFF00FF00) >> 8); n2 += (n3 & 0x00FF00FF); } /* clip to [0..255] */ if (n1 & 0xFF00FF00) { n3 = ((( n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001; n1 += 0x7F007F00; n1 |= (((~n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001; n1 &= (n3 & 0x00FF00FF); } if (n2 & 0xFF00FF00) { n3 = ((( n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001; n2 += 0x7F007F00; n2 |= (((~n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001; n2 &= (n3 & 0x00FF00FF); } /* store result */ dst[x] = (n1 << 8) | n2; } dst += (pitch / 4); } } } return 0; }
false
FFmpeg
82dd7d0dec29ee59af91ce18c29eb151b363ff37
static int decode_svq1_block (bit_buffer_t *bitbuf, uint8_t *pixels, int pitch, int intra) { uint32_t bit_cache; vlc_code_t *vlc; uint8_t *list[63]; uint32_t *dst; uint32_t *codebook; int entries[6]; int i, j, m, n; int mean, stages; int x, y, width, height, level; uint32_t n1, n2, n3, n4; list[0] = pixels; for (i=0, m=1, n=1, level=5; i < n; i++) { for (; level > 0; i++) { if (i == m) { m = n; if (--level == 0) break; } if (get_bits (bitbuf, 1) == 0) break; list[n++] = list[i]; list[n++] = list[i] + (((level & 1) ? pitch : 1) << ((level / 2) + 1)); } dst = (uint32_t *) list[i]; width = 1 << ((4 + level) /2); height = 1 << ((3 + level) /2); bit_cache = get_bit_cache (bitbuf); if (intra) vlc = &intra_vector_tables[level][bit_cache >> (32 - 7)]; else vlc = &inter_vector_tables[level][bit_cache >> (32 - 6)]; stages = vlc->value; skip_bits(bitbuf,vlc->length); if (stages == -1) { if (intra) { for (y=0; y < height; y++) { memset (&dst[y*(pitch / 4)], 0, width); } } continue; } if ((stages > 0) && (level >= 4)) { #ifdef DEBUG_SVQ1 printf("Error (decode_svq1_block): invalid vector: stages=%i level=%i\n",stages,level); #endif return -1; } bit_cache = get_bit_cache (bitbuf); if (intra) { if (bit_cache >= 0x25000000) vlc = &intra_mean_table_0[(bit_cache >> (32 - 8)) - 37]; else if (bit_cache >= 0x03400000) vlc = &intra_mean_table_1[(bit_cache >> (32 - 10)) - 13]; else if (bit_cache >= 0x00040000) vlc = &intra_mean_table_2[(bit_cache >> (32 - 14)) - 1]; else vlc = &intra_mean_table_3[bit_cache >> (32 - 20)]; } else { if (bit_cache >= 0x0B000000) vlc = &inter_mean_table_0[(bit_cache >> (32 - 8)) - 11]; else if (bit_cache >= 0x01200000) vlc = &inter_mean_table_1[(bit_cache >> (32 - 12)) - 18]; else if (bit_cache >= 0x002E0000) vlc = &inter_mean_table_2[(bit_cache >> (32 - 15)) - 23]; else if (bit_cache >= 0x00094000) vlc = &inter_mean_table_3[(bit_cache >> (32 - 18)) - 37]; else if (bit_cache >= 0x00049000) vlc = &inter_mean_table_4[(bit_cache >> (32 - 20)) - 73]; else vlc = &inter_mean_table_5[bit_cache >> (32 - 22)]; } mean = vlc->value; skip_bits(bitbuf,vlc->length); if (intra && stages == 0) { for (y=0; y < height; y++) { memset (&dst[y*(pitch / 4)], mean, width); } } else { codebook = (uint32_t *) (intra ? intra_codebooks[level] : inter_codebooks[level]); bit_cache = get_bits (bitbuf, 4*stages); for (j=0; j < stages; j++) { entries[j] = (((bit_cache >> (4*(stages - j - 1))) & 0xF) + 16*j) << (level + 1); } mean -= (stages * 128); n4 = ((mean + (mean >> 31)) << 16) | (mean & 0xFFFF); for (y=0; y < height; y++) { for (x=0; x < (width / 4); x++, codebook++) { if (intra) { n1 = n4; n2 = n4; } else { n3 = dst[x]; n1 = ((n3 & 0xFF00FF00) >> 8) + n4; n2 = (n3 & 0x00FF00FF) + n4; } for (j=0; j < stages; j++) { n3 = codebook[entries[j]] ^ 0x80808080; n1 += ((n3 & 0xFF00FF00) >> 8); n2 += (n3 & 0x00FF00FF); } if (n1 & 0xFF00FF00) { n3 = ((( n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001; n1 += 0x7F007F00; n1 |= (((~n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001; n1 &= (n3 & 0x00FF00FF); } if (n2 & 0xFF00FF00) { n3 = ((( n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001; n2 += 0x7F007F00; n2 |= (((~n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001; n2 &= (n3 & 0x00FF00FF); } dst[x] = (n1 << 8) | n2; } dst += (pitch / 4); } } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0 (bit_buffer_t *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3) { uint32_t bit_cache; vlc_code_t *vlc; uint8_t *list[63]; uint32_t *dst; uint32_t *codebook; int VAR_4[6]; int VAR_5, VAR_6, VAR_7, VAR_8; int VAR_9, VAR_10; int VAR_11, VAR_12, VAR_13, VAR_14, VAR_15; uint32_t n1, n2, n3, n4; list[0] = VAR_1; for (VAR_5=0, VAR_7=1, VAR_8=1, VAR_15=5; VAR_5 < VAR_8; VAR_5++) { for (; VAR_15 > 0; VAR_5++) { if (VAR_5 == VAR_7) { VAR_7 = VAR_8; if (--VAR_15 == 0) break; } if (get_bits (VAR_0, 1) == 0) break; list[VAR_8++] = list[VAR_5]; list[VAR_8++] = list[VAR_5] + (((VAR_15 & 1) ? VAR_2 : 1) << ((VAR_15 / 2) + 1)); } dst = (uint32_t *) list[VAR_5]; VAR_13 = 1 << ((4 + VAR_15) /2); VAR_14 = 1 << ((3 + VAR_15) /2); bit_cache = get_bit_cache (VAR_0); if (VAR_3) vlc = &intra_vector_tables[VAR_15][bit_cache >> (32 - 7)]; else vlc = &inter_vector_tables[VAR_15][bit_cache >> (32 - 6)]; VAR_10 = vlc->value; skip_bits(VAR_0,vlc->length); if (VAR_10 == -1) { if (VAR_3) { for (VAR_12=0; VAR_12 < VAR_14; VAR_12++) { memset (&dst[VAR_12*(VAR_2 / 4)], 0, VAR_13); } } continue; } if ((VAR_10 > 0) && (VAR_15 >= 4)) { #ifdef DEBUG_SVQ1 printf("Error (FUNC_0): invalid vector: VAR_10=%VAR_5 VAR_15=%VAR_5\VAR_8",VAR_10,VAR_15); #endif return -1; } bit_cache = get_bit_cache (VAR_0); if (VAR_3) { if (bit_cache >= 0x25000000) vlc = &intra_mean_table_0[(bit_cache >> (32 - 8)) - 37]; else if (bit_cache >= 0x03400000) vlc = &intra_mean_table_1[(bit_cache >> (32 - 10)) - 13]; else if (bit_cache >= 0x00040000) vlc = &intra_mean_table_2[(bit_cache >> (32 - 14)) - 1]; else vlc = &intra_mean_table_3[bit_cache >> (32 - 20)]; } else { if (bit_cache >= 0x0B000000) vlc = &inter_mean_table_0[(bit_cache >> (32 - 8)) - 11]; else if (bit_cache >= 0x01200000) vlc = &inter_mean_table_1[(bit_cache >> (32 - 12)) - 18]; else if (bit_cache >= 0x002E0000) vlc = &inter_mean_table_2[(bit_cache >> (32 - 15)) - 23]; else if (bit_cache >= 0x00094000) vlc = &inter_mean_table_3[(bit_cache >> (32 - 18)) - 37]; else if (bit_cache >= 0x00049000) vlc = &inter_mean_table_4[(bit_cache >> (32 - 20)) - 73]; else vlc = &inter_mean_table_5[bit_cache >> (32 - 22)]; } VAR_9 = vlc->value; skip_bits(VAR_0,vlc->length); if (VAR_3 && VAR_10 == 0) { for (VAR_12=0; VAR_12 < VAR_14; VAR_12++) { memset (&dst[VAR_12*(VAR_2 / 4)], VAR_9, VAR_13); } } else { codebook = (uint32_t *) (VAR_3 ? intra_codebooks[VAR_15] : inter_codebooks[VAR_15]); bit_cache = get_bits (VAR_0, 4*VAR_10); for (VAR_6=0; VAR_6 < VAR_10; VAR_6++) { VAR_4[VAR_6] = (((bit_cache >> (4*(VAR_10 - VAR_6 - 1))) & 0xF) + 16*VAR_6) << (VAR_15 + 1); } VAR_9 -= (VAR_10 * 128); n4 = ((VAR_9 + (VAR_9 >> 31)) << 16) | (VAR_9 & 0xFFFF); for (VAR_12=0; VAR_12 < VAR_14; VAR_12++) { for (VAR_11=0; VAR_11 < (VAR_13 / 4); VAR_11++, codebook++) { if (VAR_3) { n1 = n4; n2 = n4; } else { n3 = dst[VAR_11]; n1 = ((n3 & 0xFF00FF00) >> 8) + n4; n2 = (n3 & 0x00FF00FF) + n4; } for (VAR_6=0; VAR_6 < VAR_10; VAR_6++) { n3 = codebook[VAR_4[VAR_6]] ^ 0x80808080; n1 += ((n3 & 0xFF00FF00) >> 8); n2 += (n3 & 0x00FF00FF); } if (n1 & 0xFF00FF00) { n3 = ((( n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001; n1 += 0x7F007F00; n1 |= (((~n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001; n1 &= (n3 & 0x00FF00FF); } if (n2 & 0xFF00FF00) { n3 = ((( n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001; n2 += 0x7F007F00; n2 |= (((~n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001; n2 &= (n3 & 0x00FF00FF); } dst[VAR_11] = (n1 << 8) | n2; } dst += (VAR_2 / 4); } } } return 0; }
[ "static int FUNC_0 (bit_buffer_t *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3) {", "uint32_t bit_cache;", "vlc_code_t *vlc;", "uint8_t *list[63];", "uint32_t *dst;", "uint32_t *codebook;", "int\t VAR_4[6];", "int\t VAR_5, VAR_6, VAR_7, VAR_8;", "int\t VAR_9, VAR_10;", "int\t VAR_11, VAR_12, VAR_13, VAR_14, VAR_15;", "uint32_t n1, n2, n3, n4;", "list[0] = VAR_1;", "for (VAR_5=0, VAR_7=1, VAR_8=1, VAR_15=5; VAR_5 < VAR_8; VAR_5++) {", "for (; VAR_15 > 0; VAR_5++) {", "if (VAR_5 == VAR_7) {", "VAR_7 = VAR_8;", "if (--VAR_15 == 0)\nbreak;", "}", "if (get_bits (VAR_0, 1) == 0)\nbreak;", "list[VAR_8++] = list[VAR_5];", "list[VAR_8++] = list[VAR_5] + (((VAR_15 & 1) ? VAR_2 : 1) << ((VAR_15 / 2) + 1));", "}", "dst = (uint32_t *) list[VAR_5];", "VAR_13 = 1 << ((4 + VAR_15) /2);", "VAR_14 = 1 << ((3 + VAR_15) /2);", "bit_cache = get_bit_cache (VAR_0);", "if (VAR_3)\nvlc = &intra_vector_tables[VAR_15][bit_cache >> (32 - 7)];", "else\nvlc = &inter_vector_tables[VAR_15][bit_cache >> (32 - 6)];", "VAR_10\t = vlc->value;", "skip_bits(VAR_0,vlc->length);", "if (VAR_10 == -1) {", "if (VAR_3) {", "for (VAR_12=0; VAR_12 < VAR_14; VAR_12++) {", "memset (&dst[VAR_12*(VAR_2 / 4)], 0, VAR_13);", "}", "}", "continue;", "}", "if ((VAR_10 > 0) && (VAR_15 >= 4)) {", "#ifdef DEBUG_SVQ1\nprintf(\"Error (FUNC_0): invalid vector: VAR_10=%VAR_5 VAR_15=%VAR_5\\VAR_8\",VAR_10,VAR_15);", "#endif\nreturn -1;", "}", "bit_cache = get_bit_cache (VAR_0);", "if (VAR_3) {", "if (bit_cache >= 0x25000000)\nvlc = &intra_mean_table_0[(bit_cache >> (32 - 8)) - 37];", "else if (bit_cache >= 0x03400000)\nvlc = &intra_mean_table_1[(bit_cache >> (32 - 10)) - 13];", "else if (bit_cache >= 0x00040000)\nvlc = &intra_mean_table_2[(bit_cache >> (32 - 14)) - 1];", "else\nvlc = &intra_mean_table_3[bit_cache >> (32 - 20)];", "} else {", "if (bit_cache >= 0x0B000000)\nvlc = &inter_mean_table_0[(bit_cache >> (32 - 8)) - 11];", "else if (bit_cache >= 0x01200000)\nvlc = &inter_mean_table_1[(bit_cache >> (32 - 12)) - 18];", "else if (bit_cache >= 0x002E0000)\nvlc = &inter_mean_table_2[(bit_cache >> (32 - 15)) - 23];", "else if (bit_cache >= 0x00094000)\nvlc = &inter_mean_table_3[(bit_cache >> (32 - 18)) - 37];", "else if (bit_cache >= 0x00049000)\nvlc = &inter_mean_table_4[(bit_cache >> (32 - 20)) - 73];", "else\nvlc = &inter_mean_table_5[bit_cache >> (32 - 22)];", "}", "VAR_9\t = vlc->value;", "skip_bits(VAR_0,vlc->length);", "if (VAR_3 && VAR_10 == 0) {", "for (VAR_12=0; VAR_12 < VAR_14; VAR_12++) {", "memset (&dst[VAR_12*(VAR_2 / 4)], VAR_9, VAR_13);", "}", "} else {", "codebook = (uint32_t *) (VAR_3 ? intra_codebooks[VAR_15] : inter_codebooks[VAR_15]);", "bit_cache = get_bits (VAR_0, 4*VAR_10);", "for (VAR_6=0; VAR_6 < VAR_10; VAR_6++) {", "VAR_4[VAR_6] = (((bit_cache >> (4*(VAR_10 - VAR_6 - 1))) & 0xF) + 16*VAR_6) << (VAR_15 + 1);", "}", "VAR_9 -= (VAR_10 * 128);", "n4 = ((VAR_9 + (VAR_9 >> 31)) << 16) | (VAR_9 & 0xFFFF);", "for (VAR_12=0; VAR_12 < VAR_14; VAR_12++) {", "for (VAR_11=0; VAR_11 < (VAR_13 / 4); VAR_11++, codebook++) {", "if (VAR_3) {", "n1 = n4;", "n2 = n4;", "} else {", "n3 = dst[VAR_11];", "n1 = ((n3 & 0xFF00FF00) >> 8) + n4;", "n2 = (n3 & 0x00FF00FF)\t + n4;", "}", "for (VAR_6=0; VAR_6 < VAR_10; VAR_6++) {", "n3 = codebook[VAR_4[VAR_6]] ^ 0x80808080;", "n1 += ((n3 & 0xFF00FF00) >> 8);", "n2 += (n3 & 0x00FF00FF);", "}", "if (n1 & 0xFF00FF00) {", "n3 = ((( n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;", "n1 += 0x7F007F00;", "n1 |= (((~n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;", "n1 &= (n3 & 0x00FF00FF);", "}", "if (n2 & 0xFF00FF00) {", "n3 = ((( n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;", "n2 += 0x7F007F00;", "n2 |= (((~n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;", "n2 &= (n3 & 0x00FF00FF);", "}", "dst[VAR_11] = (n1 << 8) | n2;", "}", "dst += (VAR_2 / 4);", "}", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 51 ], [ 57, 59 ], [ 65 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 85 ], [ 89, 91 ], [ 93, 95 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127, 129 ], [ 131, 133 ], [ 135 ], [ 141 ], [ 145 ], [ 147, 149 ], [ 151, 153 ], [ 155, 157 ], [ 159, 161 ], [ 163 ], [ 165, 167 ], [ 169, 171 ], [ 173, 175 ], [ 177, 179 ], [ 181, 183 ], [ 185, 187 ], [ 189 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 229 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 251 ], [ 253 ], [ 255 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 305 ], [ 307 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 321 ], [ 323 ] ]
10,669
static int mov_init(AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; AVDictionaryEntry *global_tcr = av_dict_get(s->metadata, "timecode", NULL, 0); int i, ret; mov->fc = s; /* Default mode == MP4 */ mov->mode = MODE_MP4; if (s->oformat) { if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3GP|MODE_3G2; else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV; else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP; else if (!strcmp("ipod",s->oformat->name)) mov->mode = MODE_IPOD; else if (!strcmp("ismv",s->oformat->name)) mov->mode = MODE_ISM; else if (!strcmp("f4v", s->oformat->name)) mov->mode = MODE_F4V; } if (mov->flags & FF_MOV_FLAG_DELAY_MOOV) mov->flags |= FF_MOV_FLAG_EMPTY_MOOV; /* Set the FRAGMENT flag if any of the fragmentation methods are * enabled. */ if (mov->max_fragment_duration || mov->max_fragment_size || mov->flags & (FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_FRAG_KEYFRAME | FF_MOV_FLAG_FRAG_CUSTOM)) mov->flags |= FF_MOV_FLAG_FRAGMENT; /* Set other implicit flags immediately */ if (mov->mode == MODE_ISM) mov->flags |= FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_SEPARATE_MOOF | FF_MOV_FLAG_FRAGMENT; if (mov->flags & FF_MOV_FLAG_DASH) mov->flags |= FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_DEFAULT_BASE_MOOF; if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && s->flags & AVFMT_FLAG_AUTO_BSF) { av_log(s, AV_LOG_VERBOSE, "Empty MOOV enabled; disabling automatic bitstream filtering\n"); s->flags &= ~AVFMT_FLAG_AUTO_BSF; } if (mov->flags & FF_MOV_FLAG_FASTSTART) { mov->reserved_moov_size = -1; } if (mov->use_editlist < 0) { mov->use_editlist = 1; if (mov->flags & FF_MOV_FLAG_FRAGMENT && !(mov->flags & FF_MOV_FLAG_DELAY_MOOV)) { // If we can avoid needing an edit list by shifting the // tracks, prefer that over (trying to) write edit lists // in fragmented output. if (s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_AUTO || s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO) mov->use_editlist = 0; } } if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && !(mov->flags & FF_MOV_FLAG_DELAY_MOOV) && mov->use_editlist) av_log(s, AV_LOG_WARNING, "No meaningful edit list will be written when using empty_moov without delay_moov\n"); if (!mov->use_editlist && s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_AUTO) s->avoid_negative_ts = AVFMT_AVOID_NEG_TS_MAKE_ZERO; /* Clear the omit_tfhd_offset flag if default_base_moof is set; * if the latter is set that's enough and omit_tfhd_offset doesn't * add anything extra on top of that. */ if (mov->flags & FF_MOV_FLAG_OMIT_TFHD_OFFSET && mov->flags & FF_MOV_FLAG_DEFAULT_BASE_MOOF) mov->flags &= ~FF_MOV_FLAG_OMIT_TFHD_OFFSET; if (mov->frag_interleave && mov->flags & (FF_MOV_FLAG_OMIT_TFHD_OFFSET | FF_MOV_FLAG_SEPARATE_MOOF)) { av_log(s, AV_LOG_ERROR, "Sample interleaving in fragments is mutually exclusive with " "omit_tfhd_offset and separate_moof\n"); return AVERROR(EINVAL); } /* Non-seekable output is ok if using fragmentation. If ism_lookahead * is enabled, we don't support non-seekable output at all. */ if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) && (!(mov->flags & FF_MOV_FLAG_FRAGMENT) || mov->ism_lookahead)) { av_log(s, AV_LOG_ERROR, "muxer does not support non seekable output\n"); return AVERROR(EINVAL); } mov->nb_streams = s->nb_streams; if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters) mov->chapter_track = mov->nb_streams++; if (mov->flags & FF_MOV_FLAG_RTP_HINT) { /* Add hint tracks for each audio and video stream */ for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { mov->nb_streams++; } } } if ( mov->write_tmcd == -1 && (mov->mode == MODE_MOV || mov->mode == MODE_MP4) || mov->write_tmcd == 1) { /* +1 tmcd track for each video stream with a timecode */ for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; AVDictionaryEntry *t = global_tcr; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && (t || (t=av_dict_get(st->metadata, "timecode", NULL, 0)))) { AVTimecode tc; ret = mov_check_timecode_track(s, &tc, i, t->value); if (ret >= 0) mov->nb_meta_tmcd++; } } /* check if there is already a tmcd track to remux */ if (mov->nb_meta_tmcd) { for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->codecpar->codec_tag == MKTAG('t','m','c','d')) { av_log(s, AV_LOG_WARNING, "You requested a copy of the original timecode track " "so timecode metadata are now ignored\n"); mov->nb_meta_tmcd = 0; } } } mov->nb_streams += mov->nb_meta_tmcd; } // Reserve an extra stream for chapters for the case where chapters // are written in the trailer mov->tracks = av_mallocz_array((mov->nb_streams + 1), sizeof(*mov->tracks)); if (!mov->tracks) return AVERROR(ENOMEM); if (mov->encryption_scheme_str != NULL && strcmp(mov->encryption_scheme_str, "none") != 0) { if (strcmp(mov->encryption_scheme_str, "cenc-aes-ctr") == 0) { mov->encryption_scheme = MOV_ENC_CENC_AES_CTR; if (mov->encryption_key_len != AES_CTR_KEY_SIZE) { av_log(s, AV_LOG_ERROR, "Invalid encryption key len %d expected %d\n", mov->encryption_key_len, AES_CTR_KEY_SIZE); return AVERROR(EINVAL); } if (mov->encryption_kid_len != CENC_KID_SIZE) { av_log(s, AV_LOG_ERROR, "Invalid encryption kid len %d expected %d\n", mov->encryption_kid_len, CENC_KID_SIZE); return AVERROR(EINVAL); } } else { av_log(s, AV_LOG_ERROR, "unsupported encryption scheme %s\n", mov->encryption_scheme_str); return AVERROR(EINVAL); } } for (i = 0; i < s->nb_streams; i++) { AVStream *st= s->streams[i]; MOVTrack *track= &mov->tracks[i]; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0); track->st = st; track->par = st->codecpar; track->language = ff_mov_iso639_to_lang(lang?lang->value:"und", mov->mode!=MODE_MOV); if (track->language < 0) track->language = 0; track->mode = mov->mode; track->tag = mov_find_codec_tag(s, track); if (!track->tag) { av_log(s, AV_LOG_ERROR, "Could not find tag for codec %s in stream #%d, " "codec not currently supported in container\n", avcodec_get_name(st->codecpar->codec_id), i); return AVERROR(EINVAL); } /* If hinting of this track is enabled by a later hint track, * this is updated. */ track->hint_track = -1; track->start_dts = AV_NOPTS_VALUE; track->start_cts = AV_NOPTS_VALUE; track->end_pts = AV_NOPTS_VALUE; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { if (track->tag == MKTAG('m','x','3','p') || track->tag == MKTAG('m','x','3','n') || track->tag == MKTAG('m','x','4','p') || track->tag == MKTAG('m','x','4','n') || track->tag == MKTAG('m','x','5','p') || track->tag == MKTAG('m','x','5','n')) { if (st->codecpar->width != 720 || (st->codecpar->height != 608 && st->codecpar->height != 512)) { av_log(s, AV_LOG_ERROR, "D-10/IMX must use 720x608 or 720x512 video resolution\n"); return AVERROR(EINVAL); } track->height = track->tag >> 24 == 'n' ? 486 : 576; } if (mov->video_track_timescale) { track->timescale = mov->video_track_timescale; } else { track->timescale = st->time_base.den; while(track->timescale < 10000) track->timescale *= 2; } if (st->codecpar->width > 65535 || st->codecpar->height > 65535) { av_log(s, AV_LOG_ERROR, "Resolution %dx%d too large for mov/mp4\n", st->codecpar->width, st->codecpar->height); return AVERROR(EINVAL); } if (track->mode == MODE_MOV && track->timescale > 100000) av_log(s, AV_LOG_WARNING, "WARNING codec timebase is very high. If duration is too long,\n" "file may not be playable by quicktime. Specify a shorter timebase\n" "or choose different container.\n"); if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_RAWVIDEO && track->tag == MKTAG('r','a','w',' ')) { enum AVPixelFormat pix_fmt = track->par->format; if (pix_fmt == AV_PIX_FMT_NONE && track->par->bits_per_coded_sample == 1) pix_fmt = AV_PIX_FMT_MONOWHITE; track->is_unaligned_qt_rgb = pix_fmt == AV_PIX_FMT_RGB24 || pix_fmt == AV_PIX_FMT_BGR24 || pix_fmt == AV_PIX_FMT_PAL8 || pix_fmt == AV_PIX_FMT_GRAY8 || pix_fmt == AV_PIX_FMT_MONOWHITE || pix_fmt == AV_PIX_FMT_MONOBLACK; } if (track->par->codec_id == AV_CODEC_ID_VP9) { if (track->mode != MODE_MP4) { av_log(s, AV_LOG_ERROR, "VP9 only supported in MP4.\n"); return AVERROR(EINVAL); } if (s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { av_log(s, AV_LOG_ERROR, "VP9 in MP4 support is experimental, add " "'-strict %d' if you want to use it.\n", FF_COMPLIANCE_EXPERIMENTAL); return AVERROR_EXPERIMENTAL; } } } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { track->timescale = st->codecpar->sample_rate; if (!st->codecpar->frame_size && !av_get_bits_per_sample(st->codecpar->codec_id)) { av_log(s, AV_LOG_WARNING, "track %d: codec frame size is not set\n", i); track->audio_vbr = 1; }else if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_MS || st->codecpar->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV || st->codecpar->codec_id == AV_CODEC_ID_ILBC){ if (!st->codecpar->block_align) { av_log(s, AV_LOG_ERROR, "track %d: codec block align is not set for adpcm\n", i); return AVERROR(EINVAL); } track->sample_size = st->codecpar->block_align; }else if (st->codecpar->frame_size > 1){ /* assume compressed audio */ track->audio_vbr = 1; }else{ track->sample_size = (av_get_bits_per_sample(st->codecpar->codec_id) >> 3) * st->codecpar->channels; } if (st->codecpar->codec_id == AV_CODEC_ID_ILBC || st->codecpar->codec_id == AV_CODEC_ID_ADPCM_IMA_QT) { track->audio_vbr = 1; } if (track->mode != MODE_MOV && track->par->codec_id == AV_CODEC_ID_MP3 && track->timescale < 16000) { if (s->strict_std_compliance >= FF_COMPLIANCE_NORMAL) { av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not standard, to mux anyway set strict to -1\n", i, track->par->sample_rate); return AVERROR(EINVAL); } else { av_log(s, AV_LOG_WARNING, "track %d: muxing mp3 at %dhz is not standard in MP4\n", i, track->par->sample_rate); } } if (track->par->codec_id == AV_CODEC_ID_FLAC || track->par->codec_id == AV_CODEC_ID_OPUS) { if (track->mode != MODE_MP4) { av_log(s, AV_LOG_ERROR, "%s only supported in MP4.\n", avcodec_get_name(track->par->codec_id)); return AVERROR(EINVAL); } if (s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { av_log(s, AV_LOG_ERROR, "%s in MP4 support is experimental, add " "'-strict %d' if you want to use it.\n", avcodec_get_name(track->par->codec_id), FF_COMPLIANCE_EXPERIMENTAL); return AVERROR_EXPERIMENTAL; } } } else if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) { track->timescale = st->time_base.den; } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) { track->timescale = st->time_base.den; } else { track->timescale = MOV_TIMESCALE; } if (!track->height) track->height = st->codecpar->height; /* The ism specific timescale isn't mandatory, but is assumed by * some tools, such as mp4split. */ if (mov->mode == MODE_ISM) track->timescale = 10000000; avpriv_set_pts_info(st, 64, 1, track->timescale); if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) { ret = ff_mov_cenc_init(&track->cenc, mov->encryption_key, track->par->codec_id == AV_CODEC_ID_H264, s->flags & AVFMT_FLAG_BITEXACT); if (ret) return ret; } } enable_tracks(s); return 0; }
false
FFmpeg
5ff31babfccd16cdee6575ae015ff67e9a08e35d
static int mov_init(AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; AVDictionaryEntry *global_tcr = av_dict_get(s->metadata, "timecode", NULL, 0); int i, ret; mov->fc = s; mov->mode = MODE_MP4; if (s->oformat) { if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3GP|MODE_3G2; else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV; else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP; else if (!strcmp("ipod",s->oformat->name)) mov->mode = MODE_IPOD; else if (!strcmp("ismv",s->oformat->name)) mov->mode = MODE_ISM; else if (!strcmp("f4v", s->oformat->name)) mov->mode = MODE_F4V; } if (mov->flags & FF_MOV_FLAG_DELAY_MOOV) mov->flags |= FF_MOV_FLAG_EMPTY_MOOV; if (mov->max_fragment_duration || mov->max_fragment_size || mov->flags & (FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_FRAG_KEYFRAME | FF_MOV_FLAG_FRAG_CUSTOM)) mov->flags |= FF_MOV_FLAG_FRAGMENT; if (mov->mode == MODE_ISM) mov->flags |= FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_SEPARATE_MOOF | FF_MOV_FLAG_FRAGMENT; if (mov->flags & FF_MOV_FLAG_DASH) mov->flags |= FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_DEFAULT_BASE_MOOF; if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && s->flags & AVFMT_FLAG_AUTO_BSF) { av_log(s, AV_LOG_VERBOSE, "Empty MOOV enabled; disabling automatic bitstream filtering\n"); s->flags &= ~AVFMT_FLAG_AUTO_BSF; } if (mov->flags & FF_MOV_FLAG_FASTSTART) { mov->reserved_moov_size = -1; } if (mov->use_editlist < 0) { mov->use_editlist = 1; if (mov->flags & FF_MOV_FLAG_FRAGMENT && !(mov->flags & FF_MOV_FLAG_DELAY_MOOV)) { if (s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_AUTO || s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO) mov->use_editlist = 0; } } if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && !(mov->flags & FF_MOV_FLAG_DELAY_MOOV) && mov->use_editlist) av_log(s, AV_LOG_WARNING, "No meaningful edit list will be written when using empty_moov without delay_moov\n"); if (!mov->use_editlist && s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_AUTO) s->avoid_negative_ts = AVFMT_AVOID_NEG_TS_MAKE_ZERO; if (mov->flags & FF_MOV_FLAG_OMIT_TFHD_OFFSET && mov->flags & FF_MOV_FLAG_DEFAULT_BASE_MOOF) mov->flags &= ~FF_MOV_FLAG_OMIT_TFHD_OFFSET; if (mov->frag_interleave && mov->flags & (FF_MOV_FLAG_OMIT_TFHD_OFFSET | FF_MOV_FLAG_SEPARATE_MOOF)) { av_log(s, AV_LOG_ERROR, "Sample interleaving in fragments is mutually exclusive with " "omit_tfhd_offset and separate_moof\n"); return AVERROR(EINVAL); } if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) && (!(mov->flags & FF_MOV_FLAG_FRAGMENT) || mov->ism_lookahead)) { av_log(s, AV_LOG_ERROR, "muxer does not support non seekable output\n"); return AVERROR(EINVAL); } mov->nb_streams = s->nb_streams; if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters) mov->chapter_track = mov->nb_streams++; if (mov->flags & FF_MOV_FLAG_RTP_HINT) { for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { mov->nb_streams++; } } } if ( mov->write_tmcd == -1 && (mov->mode == MODE_MOV || mov->mode == MODE_MP4) || mov->write_tmcd == 1) { for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; AVDictionaryEntry *t = global_tcr; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && (t || (t=av_dict_get(st->metadata, "timecode", NULL, 0)))) { AVTimecode tc; ret = mov_check_timecode_track(s, &tc, i, t->value); if (ret >= 0) mov->nb_meta_tmcd++; } } if (mov->nb_meta_tmcd) { for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->codecpar->codec_tag == MKTAG('t','m','c','d')) { av_log(s, AV_LOG_WARNING, "You requested a copy of the original timecode track " "so timecode metadata are now ignored\n"); mov->nb_meta_tmcd = 0; } } } mov->nb_streams += mov->nb_meta_tmcd; } mov->tracks = av_mallocz_array((mov->nb_streams + 1), sizeof(*mov->tracks)); if (!mov->tracks) return AVERROR(ENOMEM); if (mov->encryption_scheme_str != NULL && strcmp(mov->encryption_scheme_str, "none") != 0) { if (strcmp(mov->encryption_scheme_str, "cenc-aes-ctr") == 0) { mov->encryption_scheme = MOV_ENC_CENC_AES_CTR; if (mov->encryption_key_len != AES_CTR_KEY_SIZE) { av_log(s, AV_LOG_ERROR, "Invalid encryption key len %d expected %d\n", mov->encryption_key_len, AES_CTR_KEY_SIZE); return AVERROR(EINVAL); } if (mov->encryption_kid_len != CENC_KID_SIZE) { av_log(s, AV_LOG_ERROR, "Invalid encryption kid len %d expected %d\n", mov->encryption_kid_len, CENC_KID_SIZE); return AVERROR(EINVAL); } } else { av_log(s, AV_LOG_ERROR, "unsupported encryption scheme %s\n", mov->encryption_scheme_str); return AVERROR(EINVAL); } } for (i = 0; i < s->nb_streams; i++) { AVStream *st= s->streams[i]; MOVTrack *track= &mov->tracks[i]; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0); track->st = st; track->par = st->codecpar; track->language = ff_mov_iso639_to_lang(lang?lang->value:"und", mov->mode!=MODE_MOV); if (track->language < 0) track->language = 0; track->mode = mov->mode; track->tag = mov_find_codec_tag(s, track); if (!track->tag) { av_log(s, AV_LOG_ERROR, "Could not find tag for codec %s in stream #%d, " "codec not currently supported in container\n", avcodec_get_name(st->codecpar->codec_id), i); return AVERROR(EINVAL); } track->hint_track = -1; track->start_dts = AV_NOPTS_VALUE; track->start_cts = AV_NOPTS_VALUE; track->end_pts = AV_NOPTS_VALUE; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { if (track->tag == MKTAG('m','x','3','p') || track->tag == MKTAG('m','x','3','n') || track->tag == MKTAG('m','x','4','p') || track->tag == MKTAG('m','x','4','n') || track->tag == MKTAG('m','x','5','p') || track->tag == MKTAG('m','x','5','n')) { if (st->codecpar->width != 720 || (st->codecpar->height != 608 && st->codecpar->height != 512)) { av_log(s, AV_LOG_ERROR, "D-10/IMX must use 720x608 or 720x512 video resolution\n"); return AVERROR(EINVAL); } track->height = track->tag >> 24 == 'n' ? 486 : 576; } if (mov->video_track_timescale) { track->timescale = mov->video_track_timescale; } else { track->timescale = st->time_base.den; while(track->timescale < 10000) track->timescale *= 2; } if (st->codecpar->width > 65535 || st->codecpar->height > 65535) { av_log(s, AV_LOG_ERROR, "Resolution %dx%d too large for mov/mp4\n", st->codecpar->width, st->codecpar->height); return AVERROR(EINVAL); } if (track->mode == MODE_MOV && track->timescale > 100000) av_log(s, AV_LOG_WARNING, "WARNING codec timebase is very high. If duration is too long,\n" "file may not be playable by quicktime. Specify a shorter timebase\n" "or choose different container.\n"); if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_RAWVIDEO && track->tag == MKTAG('r','a','w',' ')) { enum AVPixelFormat pix_fmt = track->par->format; if (pix_fmt == AV_PIX_FMT_NONE && track->par->bits_per_coded_sample == 1) pix_fmt = AV_PIX_FMT_MONOWHITE; track->is_unaligned_qt_rgb = pix_fmt == AV_PIX_FMT_RGB24 || pix_fmt == AV_PIX_FMT_BGR24 || pix_fmt == AV_PIX_FMT_PAL8 || pix_fmt == AV_PIX_FMT_GRAY8 || pix_fmt == AV_PIX_FMT_MONOWHITE || pix_fmt == AV_PIX_FMT_MONOBLACK; } if (track->par->codec_id == AV_CODEC_ID_VP9) { if (track->mode != MODE_MP4) { av_log(s, AV_LOG_ERROR, "VP9 only supported in MP4.\n"); return AVERROR(EINVAL); } if (s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { av_log(s, AV_LOG_ERROR, "VP9 in MP4 support is experimental, add " "'-strict %d' if you want to use it.\n", FF_COMPLIANCE_EXPERIMENTAL); return AVERROR_EXPERIMENTAL; } } } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { track->timescale = st->codecpar->sample_rate; if (!st->codecpar->frame_size && !av_get_bits_per_sample(st->codecpar->codec_id)) { av_log(s, AV_LOG_WARNING, "track %d: codec frame size is not set\n", i); track->audio_vbr = 1; }else if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_MS || st->codecpar->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV || st->codecpar->codec_id == AV_CODEC_ID_ILBC){ if (!st->codecpar->block_align) { av_log(s, AV_LOG_ERROR, "track %d: codec block align is not set for adpcm\n", i); return AVERROR(EINVAL); } track->sample_size = st->codecpar->block_align; }else if (st->codecpar->frame_size > 1){ track->audio_vbr = 1; }else{ track->sample_size = (av_get_bits_per_sample(st->codecpar->codec_id) >> 3) * st->codecpar->channels; } if (st->codecpar->codec_id == AV_CODEC_ID_ILBC || st->codecpar->codec_id == AV_CODEC_ID_ADPCM_IMA_QT) { track->audio_vbr = 1; } if (track->mode != MODE_MOV && track->par->codec_id == AV_CODEC_ID_MP3 && track->timescale < 16000) { if (s->strict_std_compliance >= FF_COMPLIANCE_NORMAL) { av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not standard, to mux anyway set strict to -1\n", i, track->par->sample_rate); return AVERROR(EINVAL); } else { av_log(s, AV_LOG_WARNING, "track %d: muxing mp3 at %dhz is not standard in MP4\n", i, track->par->sample_rate); } } if (track->par->codec_id == AV_CODEC_ID_FLAC || track->par->codec_id == AV_CODEC_ID_OPUS) { if (track->mode != MODE_MP4) { av_log(s, AV_LOG_ERROR, "%s only supported in MP4.\n", avcodec_get_name(track->par->codec_id)); return AVERROR(EINVAL); } if (s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { av_log(s, AV_LOG_ERROR, "%s in MP4 support is experimental, add " "'-strict %d' if you want to use it.\n", avcodec_get_name(track->par->codec_id), FF_COMPLIANCE_EXPERIMENTAL); return AVERROR_EXPERIMENTAL; } } } else if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) { track->timescale = st->time_base.den; } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) { track->timescale = st->time_base.den; } else { track->timescale = MOV_TIMESCALE; } if (!track->height) track->height = st->codecpar->height; if (mov->mode == MODE_ISM) track->timescale = 10000000; avpriv_set_pts_info(st, 64, 1, track->timescale); if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) { ret = ff_mov_cenc_init(&track->cenc, mov->encryption_key, track->par->codec_id == AV_CODEC_ID_H264, s->flags & AVFMT_FLAG_BITEXACT); if (ret) return ret; } } enable_tracks(s); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { MOVMuxContext *mov = VAR_0->priv_data; AVDictionaryEntry *global_tcr = av_dict_get(VAR_0->metadata, "timecode", NULL, 0); int VAR_1, VAR_2; mov->fc = VAR_0; mov->mode = MODE_MP4; if (VAR_0->oformat) { if (!strcmp("3gp", VAR_0->oformat->name)) mov->mode = MODE_3GP; else if (!strcmp("3g2", VAR_0->oformat->name)) mov->mode = MODE_3GP|MODE_3G2; else if (!strcmp("mov", VAR_0->oformat->name)) mov->mode = MODE_MOV; else if (!strcmp("psp", VAR_0->oformat->name)) mov->mode = MODE_PSP; else if (!strcmp("ipod",VAR_0->oformat->name)) mov->mode = MODE_IPOD; else if (!strcmp("ismv",VAR_0->oformat->name)) mov->mode = MODE_ISM; else if (!strcmp("f4v", VAR_0->oformat->name)) mov->mode = MODE_F4V; } if (mov->flags & FF_MOV_FLAG_DELAY_MOOV) mov->flags |= FF_MOV_FLAG_EMPTY_MOOV; if (mov->max_fragment_duration || mov->max_fragment_size || mov->flags & (FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_FRAG_KEYFRAME | FF_MOV_FLAG_FRAG_CUSTOM)) mov->flags |= FF_MOV_FLAG_FRAGMENT; if (mov->mode == MODE_ISM) mov->flags |= FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_SEPARATE_MOOF | FF_MOV_FLAG_FRAGMENT; if (mov->flags & FF_MOV_FLAG_DASH) mov->flags |= FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_DEFAULT_BASE_MOOF; if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && VAR_0->flags & AVFMT_FLAG_AUTO_BSF) { av_log(VAR_0, AV_LOG_VERBOSE, "Empty MOOV enabled; disabling automatic bitstream filtering\n"); VAR_0->flags &= ~AVFMT_FLAG_AUTO_BSF; } if (mov->flags & FF_MOV_FLAG_FASTSTART) { mov->reserved_moov_size = -1; } if (mov->use_editlist < 0) { mov->use_editlist = 1; if (mov->flags & FF_MOV_FLAG_FRAGMENT && !(mov->flags & FF_MOV_FLAG_DELAY_MOOV)) { if (VAR_0->avoid_negative_ts == AVFMT_AVOID_NEG_TS_AUTO || VAR_0->avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO) mov->use_editlist = 0; } } if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && !(mov->flags & FF_MOV_FLAG_DELAY_MOOV) && mov->use_editlist) av_log(VAR_0, AV_LOG_WARNING, "No meaningful edit list will be written when using empty_moov without delay_moov\n"); if (!mov->use_editlist && VAR_0->avoid_negative_ts == AVFMT_AVOID_NEG_TS_AUTO) VAR_0->avoid_negative_ts = AVFMT_AVOID_NEG_TS_MAKE_ZERO; if (mov->flags & FF_MOV_FLAG_OMIT_TFHD_OFFSET && mov->flags & FF_MOV_FLAG_DEFAULT_BASE_MOOF) mov->flags &= ~FF_MOV_FLAG_OMIT_TFHD_OFFSET; if (mov->frag_interleave && mov->flags & (FF_MOV_FLAG_OMIT_TFHD_OFFSET | FF_MOV_FLAG_SEPARATE_MOOF)) { av_log(VAR_0, AV_LOG_ERROR, "Sample interleaving in fragments is mutually exclusive with " "omit_tfhd_offset and separate_moof\n"); return AVERROR(EINVAL); } if (!(VAR_0->pb->seekable & AVIO_SEEKABLE_NORMAL) && (!(mov->flags & FF_MOV_FLAG_FRAGMENT) || mov->ism_lookahead)) { av_log(VAR_0, AV_LOG_ERROR, "muxer does not support non seekable output\n"); return AVERROR(EINVAL); } mov->nb_streams = VAR_0->nb_streams; if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && VAR_0->nb_chapters) mov->chapter_track = mov->nb_streams++; if (mov->flags & FF_MOV_FLAG_RTP_HINT) { for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { AVStream *st = VAR_0->streams[VAR_1]; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { mov->nb_streams++; } } } if ( mov->write_tmcd == -1 && (mov->mode == MODE_MOV || mov->mode == MODE_MP4) || mov->write_tmcd == 1) { for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { AVStream *st = VAR_0->streams[VAR_1]; AVDictionaryEntry *t = global_tcr; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && (t || (t=av_dict_get(st->metadata, "timecode", NULL, 0)))) { AVTimecode tc; VAR_2 = mov_check_timecode_track(VAR_0, &tc, VAR_1, t->value); if (VAR_2 >= 0) mov->nb_meta_tmcd++; } } if (mov->nb_meta_tmcd) { for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { AVStream *st = VAR_0->streams[VAR_1]; if (st->codecpar->codec_tag == MKTAG('t','m','c','d')) { av_log(VAR_0, AV_LOG_WARNING, "You requested a copy of the original timecode track " "so timecode metadata are now ignored\n"); mov->nb_meta_tmcd = 0; } } } mov->nb_streams += mov->nb_meta_tmcd; } mov->tracks = av_mallocz_array((mov->nb_streams + 1), sizeof(*mov->tracks)); if (!mov->tracks) return AVERROR(ENOMEM); if (mov->encryption_scheme_str != NULL && strcmp(mov->encryption_scheme_str, "none") != 0) { if (strcmp(mov->encryption_scheme_str, "cenc-aes-ctr") == 0) { mov->encryption_scheme = MOV_ENC_CENC_AES_CTR; if (mov->encryption_key_len != AES_CTR_KEY_SIZE) { av_log(VAR_0, AV_LOG_ERROR, "Invalid encryption key len %d expected %d\n", mov->encryption_key_len, AES_CTR_KEY_SIZE); return AVERROR(EINVAL); } if (mov->encryption_kid_len != CENC_KID_SIZE) { av_log(VAR_0, AV_LOG_ERROR, "Invalid encryption kid len %d expected %d\n", mov->encryption_kid_len, CENC_KID_SIZE); return AVERROR(EINVAL); } } else { av_log(VAR_0, AV_LOG_ERROR, "unsupported encryption scheme %VAR_0\n", mov->encryption_scheme_str); return AVERROR(EINVAL); } } for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { AVStream *st= VAR_0->streams[VAR_1]; MOVTrack *track= &mov->tracks[VAR_1]; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0); track->st = st; track->par = st->codecpar; track->language = ff_mov_iso639_to_lang(lang?lang->value:"und", mov->mode!=MODE_MOV); if (track->language < 0) track->language = 0; track->mode = mov->mode; track->tag = mov_find_codec_tag(VAR_0, track); if (!track->tag) { av_log(VAR_0, AV_LOG_ERROR, "Could not find tag for codec %VAR_0 in stream #%d, " "codec not currently supported in container\n", avcodec_get_name(st->codecpar->codec_id), VAR_1); return AVERROR(EINVAL); } track->hint_track = -1; track->start_dts = AV_NOPTS_VALUE; track->start_cts = AV_NOPTS_VALUE; track->end_pts = AV_NOPTS_VALUE; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { if (track->tag == MKTAG('m','x','3','p') || track->tag == MKTAG('m','x','3','n') || track->tag == MKTAG('m','x','4','p') || track->tag == MKTAG('m','x','4','n') || track->tag == MKTAG('m','x','5','p') || track->tag == MKTAG('m','x','5','n')) { if (st->codecpar->width != 720 || (st->codecpar->height != 608 && st->codecpar->height != 512)) { av_log(VAR_0, AV_LOG_ERROR, "D-10/IMX must use 720x608 or 720x512 video resolution\n"); return AVERROR(EINVAL); } track->height = track->tag >> 24 == 'n' ? 486 : 576; } if (mov->video_track_timescale) { track->timescale = mov->video_track_timescale; } else { track->timescale = st->time_base.den; while(track->timescale < 10000) track->timescale *= 2; } if (st->codecpar->width > 65535 || st->codecpar->height > 65535) { av_log(VAR_0, AV_LOG_ERROR, "Resolution %dx%d too large for mov/mp4\n", st->codecpar->width, st->codecpar->height); return AVERROR(EINVAL); } if (track->mode == MODE_MOV && track->timescale > 100000) av_log(VAR_0, AV_LOG_WARNING, "WARNING codec timebase is very high. If duration is too long,\n" "file may not be playable by quicktime. Specify a shorter timebase\n" "or choose different container.\n"); if (track->mode == MODE_MOV && track->par->codec_id == AV_CODEC_ID_RAWVIDEO && track->tag == MKTAG('r','a','w',' ')) { enum AVPixelFormat pix_fmt = track->par->format; if (pix_fmt == AV_PIX_FMT_NONE && track->par->bits_per_coded_sample == 1) pix_fmt = AV_PIX_FMT_MONOWHITE; track->is_unaligned_qt_rgb = pix_fmt == AV_PIX_FMT_RGB24 || pix_fmt == AV_PIX_FMT_BGR24 || pix_fmt == AV_PIX_FMT_PAL8 || pix_fmt == AV_PIX_FMT_GRAY8 || pix_fmt == AV_PIX_FMT_MONOWHITE || pix_fmt == AV_PIX_FMT_MONOBLACK; } if (track->par->codec_id == AV_CODEC_ID_VP9) { if (track->mode != MODE_MP4) { av_log(VAR_0, AV_LOG_ERROR, "VP9 only supported in MP4.\n"); return AVERROR(EINVAL); } if (VAR_0->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { av_log(VAR_0, AV_LOG_ERROR, "VP9 in MP4 support is experimental, add " "'-strict %d' if you want to use it.\n", FF_COMPLIANCE_EXPERIMENTAL); return AVERROR_EXPERIMENTAL; } } } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { track->timescale = st->codecpar->sample_rate; if (!st->codecpar->frame_size && !av_get_bits_per_sample(st->codecpar->codec_id)) { av_log(VAR_0, AV_LOG_WARNING, "track %d: codec frame size is not set\n", VAR_1); track->audio_vbr = 1; }else if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_MS || st->codecpar->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV || st->codecpar->codec_id == AV_CODEC_ID_ILBC){ if (!st->codecpar->block_align) { av_log(VAR_0, AV_LOG_ERROR, "track %d: codec block align is not set for adpcm\n", VAR_1); return AVERROR(EINVAL); } track->sample_size = st->codecpar->block_align; }else if (st->codecpar->frame_size > 1){ track->audio_vbr = 1; }else{ track->sample_size = (av_get_bits_per_sample(st->codecpar->codec_id) >> 3) * st->codecpar->channels; } if (st->codecpar->codec_id == AV_CODEC_ID_ILBC || st->codecpar->codec_id == AV_CODEC_ID_ADPCM_IMA_QT) { track->audio_vbr = 1; } if (track->mode != MODE_MOV && track->par->codec_id == AV_CODEC_ID_MP3 && track->timescale < 16000) { if (VAR_0->strict_std_compliance >= FF_COMPLIANCE_NORMAL) { av_log(VAR_0, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not standard, to mux anyway set strict to -1\n", VAR_1, track->par->sample_rate); return AVERROR(EINVAL); } else { av_log(VAR_0, AV_LOG_WARNING, "track %d: muxing mp3 at %dhz is not standard in MP4\n", VAR_1, track->par->sample_rate); } } if (track->par->codec_id == AV_CODEC_ID_FLAC || track->par->codec_id == AV_CODEC_ID_OPUS) { if (track->mode != MODE_MP4) { av_log(VAR_0, AV_LOG_ERROR, "%VAR_0 only supported in MP4.\n", avcodec_get_name(track->par->codec_id)); return AVERROR(EINVAL); } if (VAR_0->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { av_log(VAR_0, AV_LOG_ERROR, "%VAR_0 in MP4 support is experimental, add " "'-strict %d' if you want to use it.\n", avcodec_get_name(track->par->codec_id), FF_COMPLIANCE_EXPERIMENTAL); return AVERROR_EXPERIMENTAL; } } } else if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) { track->timescale = st->time_base.den; } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) { track->timescale = st->time_base.den; } else { track->timescale = MOV_TIMESCALE; } if (!track->height) track->height = st->codecpar->height; if (mov->mode == MODE_ISM) track->timescale = 10000000; avpriv_set_pts_info(st, 64, 1, track->timescale); if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) { VAR_2 = ff_mov_cenc_init(&track->cenc, mov->encryption_key, track->par->codec_id == AV_CODEC_ID_H264, VAR_0->flags & AVFMT_FLAG_BITEXACT); if (VAR_2) return VAR_2; } } enable_tracks(VAR_0); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "MOVMuxContext *mov = VAR_0->priv_data;", "AVDictionaryEntry *global_tcr = av_dict_get(VAR_0->metadata, \"timecode\", NULL, 0);", "int VAR_1, VAR_2;", "mov->fc = VAR_0;", "mov->mode = MODE_MP4;", "if (VAR_0->oformat) {", "if (!strcmp(\"3gp\", VAR_0->oformat->name)) mov->mode = MODE_3GP;", "else if (!strcmp(\"3g2\", VAR_0->oformat->name)) mov->mode = MODE_3GP|MODE_3G2;", "else if (!strcmp(\"mov\", VAR_0->oformat->name)) mov->mode = MODE_MOV;", "else if (!strcmp(\"psp\", VAR_0->oformat->name)) mov->mode = MODE_PSP;", "else if (!strcmp(\"ipod\",VAR_0->oformat->name)) mov->mode = MODE_IPOD;", "else if (!strcmp(\"ismv\",VAR_0->oformat->name)) mov->mode = MODE_ISM;", "else if (!strcmp(\"f4v\", VAR_0->oformat->name)) mov->mode = MODE_F4V;", "}", "if (mov->flags & FF_MOV_FLAG_DELAY_MOOV)\nmov->flags |= FF_MOV_FLAG_EMPTY_MOOV;", "if (mov->max_fragment_duration || mov->max_fragment_size ||\nmov->flags & (FF_MOV_FLAG_EMPTY_MOOV |\nFF_MOV_FLAG_FRAG_KEYFRAME |\nFF_MOV_FLAG_FRAG_CUSTOM))\nmov->flags |= FF_MOV_FLAG_FRAGMENT;", "if (mov->mode == MODE_ISM)\nmov->flags |= FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_SEPARATE_MOOF |\nFF_MOV_FLAG_FRAGMENT;", "if (mov->flags & FF_MOV_FLAG_DASH)\nmov->flags |= FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_EMPTY_MOOV |\nFF_MOV_FLAG_DEFAULT_BASE_MOOF;", "if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && VAR_0->flags & AVFMT_FLAG_AUTO_BSF) {", "av_log(VAR_0, AV_LOG_VERBOSE, \"Empty MOOV enabled; disabling automatic bitstream filtering\\n\");", "VAR_0->flags &= ~AVFMT_FLAG_AUTO_BSF;", "}", "if (mov->flags & FF_MOV_FLAG_FASTSTART) {", "mov->reserved_moov_size = -1;", "}", "if (mov->use_editlist < 0) {", "mov->use_editlist = 1;", "if (mov->flags & FF_MOV_FLAG_FRAGMENT &&\n!(mov->flags & FF_MOV_FLAG_DELAY_MOOV)) {", "if (VAR_0->avoid_negative_ts == AVFMT_AVOID_NEG_TS_AUTO ||\nVAR_0->avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO)\nmov->use_editlist = 0;", "}", "}", "if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV &&\n!(mov->flags & FF_MOV_FLAG_DELAY_MOOV) && mov->use_editlist)\nav_log(VAR_0, AV_LOG_WARNING, \"No meaningful edit list will be written when using empty_moov without delay_moov\\n\");", "if (!mov->use_editlist && VAR_0->avoid_negative_ts == AVFMT_AVOID_NEG_TS_AUTO)\nVAR_0->avoid_negative_ts = AVFMT_AVOID_NEG_TS_MAKE_ZERO;", "if (mov->flags & FF_MOV_FLAG_OMIT_TFHD_OFFSET &&\nmov->flags & FF_MOV_FLAG_DEFAULT_BASE_MOOF)\nmov->flags &= ~FF_MOV_FLAG_OMIT_TFHD_OFFSET;", "if (mov->frag_interleave &&\nmov->flags & (FF_MOV_FLAG_OMIT_TFHD_OFFSET | FF_MOV_FLAG_SEPARATE_MOOF)) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Sample interleaving in fragments is mutually exclusive with \"\n\"omit_tfhd_offset and separate_moof\\n\");", "return AVERROR(EINVAL);", "}", "if (!(VAR_0->pb->seekable & AVIO_SEEKABLE_NORMAL) &&\n(!(mov->flags & FF_MOV_FLAG_FRAGMENT) || mov->ism_lookahead)) {", "av_log(VAR_0, AV_LOG_ERROR, \"muxer does not support non seekable output\\n\");", "return AVERROR(EINVAL);", "}", "mov->nb_streams = VAR_0->nb_streams;", "if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && VAR_0->nb_chapters)\nmov->chapter_track = mov->nb_streams++;", "if (mov->flags & FF_MOV_FLAG_RTP_HINT) {", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {", "AVStream *st = VAR_0->streams[VAR_1];", "if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ||\nst->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {", "mov->nb_streams++;", "}", "}", "}", "if ( mov->write_tmcd == -1 && (mov->mode == MODE_MOV || mov->mode == MODE_MP4)\n|| mov->write_tmcd == 1) {", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {", "AVStream *st = VAR_0->streams[VAR_1];", "AVDictionaryEntry *t = global_tcr;", "if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&\n(t || (t=av_dict_get(st->metadata, \"timecode\", NULL, 0)))) {", "AVTimecode tc;", "VAR_2 = mov_check_timecode_track(VAR_0, &tc, VAR_1, t->value);", "if (VAR_2 >= 0)\nmov->nb_meta_tmcd++;", "}", "}", "if (mov->nb_meta_tmcd) {", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {", "AVStream *st = VAR_0->streams[VAR_1];", "if (st->codecpar->codec_tag == MKTAG('t','m','c','d')) {", "av_log(VAR_0, AV_LOG_WARNING, \"You requested a copy of the original timecode track \"\n\"so timecode metadata are now ignored\\n\");", "mov->nb_meta_tmcd = 0;", "}", "}", "}", "mov->nb_streams += mov->nb_meta_tmcd;", "}", "mov->tracks = av_mallocz_array((mov->nb_streams + 1), sizeof(*mov->tracks));", "if (!mov->tracks)\nreturn AVERROR(ENOMEM);", "if (mov->encryption_scheme_str != NULL && strcmp(mov->encryption_scheme_str, \"none\") != 0) {", "if (strcmp(mov->encryption_scheme_str, \"cenc-aes-ctr\") == 0) {", "mov->encryption_scheme = MOV_ENC_CENC_AES_CTR;", "if (mov->encryption_key_len != AES_CTR_KEY_SIZE) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid encryption key len %d expected %d\\n\",\nmov->encryption_key_len, AES_CTR_KEY_SIZE);", "return AVERROR(EINVAL);", "}", "if (mov->encryption_kid_len != CENC_KID_SIZE) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid encryption kid len %d expected %d\\n\",\nmov->encryption_kid_len, CENC_KID_SIZE);", "return AVERROR(EINVAL);", "}", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"unsupported encryption scheme %VAR_0\\n\",\nmov->encryption_scheme_str);", "return AVERROR(EINVAL);", "}", "}", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {", "AVStream *st= VAR_0->streams[VAR_1];", "MOVTrack *track= &mov->tracks[VAR_1];", "AVDictionaryEntry *lang = av_dict_get(st->metadata, \"language\", NULL,0);", "track->st = st;", "track->par = st->codecpar;", "track->language = ff_mov_iso639_to_lang(lang?lang->value:\"und\", mov->mode!=MODE_MOV);", "if (track->language < 0)\ntrack->language = 0;", "track->mode = mov->mode;", "track->tag = mov_find_codec_tag(VAR_0, track);", "if (!track->tag) {", "av_log(VAR_0, AV_LOG_ERROR, \"Could not find tag for codec %VAR_0 in stream #%d, \"\n\"codec not currently supported in container\\n\",\navcodec_get_name(st->codecpar->codec_id), VAR_1);", "return AVERROR(EINVAL);", "}", "track->hint_track = -1;", "track->start_dts = AV_NOPTS_VALUE;", "track->start_cts = AV_NOPTS_VALUE;", "track->end_pts = AV_NOPTS_VALUE;", "if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {", "if (track->tag == MKTAG('m','x','3','p') || track->tag == MKTAG('m','x','3','n') ||\ntrack->tag == MKTAG('m','x','4','p') || track->tag == MKTAG('m','x','4','n') ||\ntrack->tag == MKTAG('m','x','5','p') || track->tag == MKTAG('m','x','5','n')) {", "if (st->codecpar->width != 720 || (st->codecpar->height != 608 && st->codecpar->height != 512)) {", "av_log(VAR_0, AV_LOG_ERROR, \"D-10/IMX must use 720x608 or 720x512 video resolution\\n\");", "return AVERROR(EINVAL);", "}", "track->height = track->tag >> 24 == 'n' ? 486 : 576;", "}", "if (mov->video_track_timescale) {", "track->timescale = mov->video_track_timescale;", "} else {", "track->timescale = st->time_base.den;", "while(track->timescale < 10000)\ntrack->timescale *= 2;", "}", "if (st->codecpar->width > 65535 || st->codecpar->height > 65535) {", "av_log(VAR_0, AV_LOG_ERROR, \"Resolution %dx%d too large for mov/mp4\\n\", st->codecpar->width, st->codecpar->height);", "return AVERROR(EINVAL);", "}", "if (track->mode == MODE_MOV && track->timescale > 100000)\nav_log(VAR_0, AV_LOG_WARNING,\n\"WARNING codec timebase is very high. If duration is too long,\\n\"\n\"file may not be playable by quicktime. Specify a shorter timebase\\n\"\n\"or choose different container.\\n\");", "if (track->mode == MODE_MOV &&\ntrack->par->codec_id == AV_CODEC_ID_RAWVIDEO &&\ntrack->tag == MKTAG('r','a','w',' ')) {", "enum AVPixelFormat pix_fmt = track->par->format;", "if (pix_fmt == AV_PIX_FMT_NONE && track->par->bits_per_coded_sample == 1)\npix_fmt = AV_PIX_FMT_MONOWHITE;", "track->is_unaligned_qt_rgb =\npix_fmt == AV_PIX_FMT_RGB24 ||\npix_fmt == AV_PIX_FMT_BGR24 ||\npix_fmt == AV_PIX_FMT_PAL8 ||\npix_fmt == AV_PIX_FMT_GRAY8 ||\npix_fmt == AV_PIX_FMT_MONOWHITE ||\npix_fmt == AV_PIX_FMT_MONOBLACK;", "}", "if (track->par->codec_id == AV_CODEC_ID_VP9) {", "if (track->mode != MODE_MP4) {", "av_log(VAR_0, AV_LOG_ERROR, \"VP9 only supported in MP4.\\n\");", "return AVERROR(EINVAL);", "}", "if (VAR_0->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"VP9 in MP4 support is experimental, add \"\n\"'-strict %d' if you want to use it.\\n\",\nFF_COMPLIANCE_EXPERIMENTAL);", "return AVERROR_EXPERIMENTAL;", "}", "}", "} else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {", "track->timescale = st->codecpar->sample_rate;", "if (!st->codecpar->frame_size && !av_get_bits_per_sample(st->codecpar->codec_id)) {", "av_log(VAR_0, AV_LOG_WARNING, \"track %d: codec frame size is not set\\n\", VAR_1);", "track->audio_vbr = 1;", "}else if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_MS ||", "st->codecpar->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV ||\nst->codecpar->codec_id == AV_CODEC_ID_ILBC){", "if (!st->codecpar->block_align) {", "av_log(VAR_0, AV_LOG_ERROR, \"track %d: codec block align is not set for adpcm\\n\", VAR_1);", "return AVERROR(EINVAL);", "}", "track->sample_size = st->codecpar->block_align;", "}else if (st->codecpar->frame_size > 1){", "track->audio_vbr = 1;", "}else{", "track->sample_size = (av_get_bits_per_sample(st->codecpar->codec_id) >> 3) * st->codecpar->channels;", "}", "if (st->codecpar->codec_id == AV_CODEC_ID_ILBC ||\nst->codecpar->codec_id == AV_CODEC_ID_ADPCM_IMA_QT) {", "track->audio_vbr = 1;", "}", "if (track->mode != MODE_MOV &&\ntrack->par->codec_id == AV_CODEC_ID_MP3 && track->timescale < 16000) {", "if (VAR_0->strict_std_compliance >= FF_COMPLIANCE_NORMAL) {", "av_log(VAR_0, AV_LOG_ERROR, \"track %d: muxing mp3 at %dhz is not standard, to mux anyway set strict to -1\\n\",\nVAR_1, track->par->sample_rate);", "return AVERROR(EINVAL);", "} else {", "av_log(VAR_0, AV_LOG_WARNING, \"track %d: muxing mp3 at %dhz is not standard in MP4\\n\",\nVAR_1, track->par->sample_rate);", "}", "}", "if (track->par->codec_id == AV_CODEC_ID_FLAC ||\ntrack->par->codec_id == AV_CODEC_ID_OPUS) {", "if (track->mode != MODE_MP4) {", "av_log(VAR_0, AV_LOG_ERROR, \"%VAR_0 only supported in MP4.\\n\", avcodec_get_name(track->par->codec_id));", "return AVERROR(EINVAL);", "}", "if (VAR_0->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"%VAR_0 in MP4 support is experimental, add \"\n\"'-strict %d' if you want to use it.\\n\",\navcodec_get_name(track->par->codec_id), FF_COMPLIANCE_EXPERIMENTAL);", "return AVERROR_EXPERIMENTAL;", "}", "}", "} else if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) {", "track->timescale = st->time_base.den;", "} else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {", "track->timescale = st->time_base.den;", "} else {", "track->timescale = MOV_TIMESCALE;", "}", "if (!track->height)\ntrack->height = st->codecpar->height;", "if (mov->mode == MODE_ISM)\ntrack->timescale = 10000000;", "avpriv_set_pts_info(st, 64, 1, track->timescale);", "if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) {", "VAR_2 = ff_mov_cenc_init(&track->cenc, mov->encryption_key,\ntrack->par->codec_id == AV_CODEC_ID_H264, VAR_0->flags & AVFMT_FLAG_BITEXACT);", "if (VAR_2)\nreturn VAR_2;", "}", "}", "enable_tracks(VAR_0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 53, 55, 57, 59, 61 ], [ 67, 69, 71 ], [ 73, 75, 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 113, 115, 117 ], [ 119 ], [ 121 ], [ 123, 125, 127 ], [ 131, 133 ], [ 143, 145, 147 ], [ 151, 153 ], [ 155, 157, 159 ], [ 161 ], [ 163 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185, 187 ], [ 191 ], [ 195 ], [ 197 ], [ 199, 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 213, 215 ], [ 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253, 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 277 ], [ 279, 281 ], [ 285 ], [ 287 ], [ 289 ], [ 293 ], [ 295, 297 ], [ 299 ], [ 301 ], [ 305 ], [ 307, 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317, 319 ], [ 321 ], [ 323 ], [ 325 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 339 ], [ 341 ], [ 343 ], [ 345, 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355, 357, 359 ], [ 361 ], [ 363 ], [ 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 ], [ 599, 601 ], [ 605 ], [ 609 ], [ 611, 613 ], [ 615, 617 ], [ 619 ], [ 621 ], [ 625 ], [ 627 ], [ 629 ] ]
10,674
static GThread *trace_thread_create(GThreadFunc fn) { GThread *thread; #ifndef _WIN32 sigset_t set, oldset; sigfillset(&set); pthread_sigmask(SIG_SETMASK, &set, &oldset); #endif thread = g_thread_create(writeout_thread, NULL, FALSE, NULL); #ifndef _WIN32 pthread_sigmask(SIG_SETMASK, &oldset, NULL); #endif return thread; }
true
qemu
db3bf8696358e105903b00432cad0aa50d3c0cb6
static GThread *trace_thread_create(GThreadFunc fn) { GThread *thread; #ifndef _WIN32 sigset_t set, oldset; sigfillset(&set); pthread_sigmask(SIG_SETMASK, &set, &oldset); #endif thread = g_thread_create(writeout_thread, NULL, FALSE, NULL); #ifndef _WIN32 pthread_sigmask(SIG_SETMASK, &oldset, NULL); #endif return thread; }
{ "code": [ " thread = g_thread_create(writeout_thread, NULL, FALSE, NULL);" ], "line_no": [ 19 ] }
static GThread *FUNC_0(GThreadFunc fn) { GThread *thread; #ifndef _WIN32 sigset_t set, oldset; sigfillset(&set); pthread_sigmask(SIG_SETMASK, &set, &oldset); #endif thread = g_thread_create(writeout_thread, NULL, FALSE, NULL); #ifndef _WIN32 pthread_sigmask(SIG_SETMASK, &oldset, NULL); #endif return thread; }
[ "static GThread *FUNC_0(GThreadFunc fn)\n{", "GThread *thread;", "#ifndef _WIN32\nsigset_t set, oldset;", "sigfillset(&set);", "pthread_sigmask(SIG_SETMASK, &set, &oldset);", "#endif\nthread = g_thread_create(writeout_thread, NULL, FALSE, NULL);", "#ifndef _WIN32\npthread_sigmask(SIG_SETMASK, &oldset, NULL);", "#endif\nreturn thread;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21, 23 ], [ 25, 29 ], [ 31 ] ]
10,675
static void visit_type_TestStruct(Visitor *v, TestStruct **obj, const char *name, Error **errp) { Error *err = NULL; visit_start_struct(v, (void **)obj, "TestStruct", name, sizeof(TestStruct), &err); if (err) { goto out; } visit_type_int(v, &(*obj)->integer, "integer", &err); visit_type_bool(v, &(*obj)->boolean, "boolean", &err); visit_type_str(v, &(*obj)->string, "string", &err); visit_end_struct(v, &err); out: error_propagate(errp, err); }
true
qemu
297a3646c2947ee64a6d42ca264039732c6218e0
static void visit_type_TestStruct(Visitor *v, TestStruct **obj, const char *name, Error **errp) { Error *err = NULL; visit_start_struct(v, (void **)obj, "TestStruct", name, sizeof(TestStruct), &err); if (err) { goto out; } visit_type_int(v, &(*obj)->integer, "integer", &err); visit_type_bool(v, &(*obj)->boolean, "boolean", &err); visit_type_str(v, &(*obj)->string, "string", &err); visit_end_struct(v, &err); out: error_propagate(errp, err); }
{ "code": [ " visit_end_struct(v, &err);", " goto out;", " Error *err = NULL;" ], "line_no": [ 31, 17, 7 ] }
static void FUNC_0(Visitor *VAR_0, TestStruct **VAR_1, const char *VAR_2, Error **VAR_3) { Error *err = NULL; visit_start_struct(VAR_0, (void **)VAR_1, "TestStruct", VAR_2, sizeof(TestStruct), &err); if (err) { goto out; } visit_type_int(VAR_0, &(*VAR_1)->integer, "integer", &err); visit_type_bool(VAR_0, &(*VAR_1)->boolean, "boolean", &err); visit_type_str(VAR_0, &(*VAR_1)->string, "string", &err); visit_end_struct(VAR_0, &err); out: error_propagate(VAR_3, err); }
[ "static void FUNC_0(Visitor *VAR_0, TestStruct **VAR_1,\nconst char *VAR_2, Error **VAR_3)\n{", "Error *err = NULL;", "visit_start_struct(VAR_0, (void **)VAR_1, \"TestStruct\", VAR_2, sizeof(TestStruct),\n&err);", "if (err) {", "goto out;", "}", "visit_type_int(VAR_0, &(*VAR_1)->integer, \"integer\", &err);", "visit_type_bool(VAR_0, &(*VAR_1)->boolean, \"boolean\", &err);", "visit_type_str(VAR_0, &(*VAR_1)->string, \"string\", &err);", "visit_end_struct(VAR_0, &err);", "out:\nerror_propagate(VAR_3, err);", "}" ]
[ 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35, 37 ], [ 39 ] ]
10,676
static float get_band_cost_ZERO_mips(struct AACEncContext *s, PutBitContext *pb, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits) { int i; float cost = 0; for (i = 0; i < size; i += 4) { cost += in[i ] * in[i ]; cost += in[i+1] * in[i+1]; cost += in[i+2] * in[i+2]; cost += in[i+3] * in[i+3]; } if (bits) *bits = 0; return cost * lambda; }
true
FFmpeg
01ecb7172b684f1c4b3e748f95c5a9a494ca36ec
static float get_band_cost_ZERO_mips(struct AACEncContext *s, PutBitContext *pb, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits) { int i; float cost = 0; for (i = 0; i < size; i += 4) { cost += in[i ] * in[i ]; cost += in[i+1] * in[i+1]; cost += in[i+2] * in[i+2]; cost += in[i+3] * in[i+3]; } if (bits) *bits = 0; return cost * lambda; }
{ "code": [ " int *bits)", " int *bits)" ], "line_no": [ 9, 9 ] }
static float FUNC_0(struct AACEncContext *VAR_0, PutBitContext *VAR_1, const float *VAR_2, const float *VAR_3, int VAR_4, int VAR_5, int VAR_6, const float VAR_7, const float VAR_8, int *VAR_9) { int VAR_10; float VAR_11 = 0; for (VAR_10 = 0; VAR_10 < VAR_4; VAR_10 += 4) { VAR_11 += VAR_2[VAR_10 ] * VAR_2[VAR_10 ]; VAR_11 += VAR_2[VAR_10+1] * VAR_2[VAR_10+1]; VAR_11 += VAR_2[VAR_10+2] * VAR_2[VAR_10+2]; VAR_11 += VAR_2[VAR_10+3] * VAR_2[VAR_10+3]; } if (VAR_9) *VAR_9 = 0; return VAR_11 * VAR_7; }
[ "static float FUNC_0(struct AACEncContext *VAR_0,\nPutBitContext *VAR_1, const float *VAR_2,\nconst float *VAR_3, int VAR_4, int VAR_5,\nint VAR_6, const float VAR_7, const float VAR_8,\nint *VAR_9)\n{", "int VAR_10;", "float VAR_11 = 0;", "for (VAR_10 = 0; VAR_10 < VAR_4; VAR_10 += 4) {", "VAR_11 += VAR_2[VAR_10 ] * VAR_2[VAR_10 ];", "VAR_11 += VAR_2[VAR_10+1] * VAR_2[VAR_10+1];", "VAR_11 += VAR_2[VAR_10+2] * VAR_2[VAR_10+2];", "VAR_11 += VAR_2[VAR_10+3] * VAR_2[VAR_10+3];", "}", "if (VAR_9)\n*VAR_9 = 0;", "return VAR_11 * VAR_7;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ] ]
10,677
static int decode_thread(void *arg) { VideoState *is = arg; AVFormatContext *ic; int err, i, ret; int st_index[AVMEDIA_TYPE_NB]; AVPacket pkt1, *pkt = &pkt1; AVFormatParameters params, *ap = &params; int eof=0; int pkt_in_play_range = 0; ic = avformat_alloc_context(); memset(st_index, -1, sizeof(st_index)); is->video_stream = -1; is->audio_stream = -1; is->subtitle_stream = -1; global_video_state = is; url_set_interrupt_cb(decode_interrupt_cb); memset(ap, 0, sizeof(*ap)); ap->prealloced_context = 1; ap->width = frame_width; ap->height= frame_height; ap->time_base= (AVRational){1, 25}; ap->pix_fmt = frame_pix_fmt; set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM, NULL); err = av_open_input_file(&ic, is->filename, is->iformat, 0, ap); if (err < 0) { print_error(is->filename, err); ret = -1; goto fail; } is->ic = ic; if(genpts) ic->flags |= AVFMT_FLAG_GENPTS; err = av_find_stream_info(ic); if (err < 0) { fprintf(stderr, "%s: could not find codec parameters\n", is->filename); ret = -1; goto fail; } if(ic->pb) ic->pb->eof_reached= 0; //FIXME hack, ffplay maybe should not use url_feof() to test for the end if(seek_by_bytes<0) seek_by_bytes= !!(ic->iformat->flags & AVFMT_TS_DISCONT); /* if seeking requested, we execute it */ if (start_time != AV_NOPTS_VALUE) { int64_t timestamp; timestamp = start_time; /* add the stream start time */ if (ic->start_time != AV_NOPTS_VALUE) timestamp += ic->start_time; ret = avformat_seek_file(ic, -1, INT64_MIN, timestamp, INT64_MAX, 0); if (ret < 0) { fprintf(stderr, "%s: could not seek to position %0.3f\n", is->filename, (double)timestamp / AV_TIME_BASE); } } for (i = 0; i < ic->nb_streams; i++) ic->streams[i]->discard = AVDISCARD_ALL; if (!video_disable) st_index[AVMEDIA_TYPE_VIDEO] = av_find_best_stream(ic, AVMEDIA_TYPE_VIDEO, wanted_stream[AVMEDIA_TYPE_VIDEO], -1, NULL, 0); if (!audio_disable) st_index[AVMEDIA_TYPE_AUDIO] = av_find_best_stream(ic, AVMEDIA_TYPE_AUDIO, wanted_stream[AVMEDIA_TYPE_AUDIO], st_index[AVMEDIA_TYPE_VIDEO], NULL, 0); if (!video_disable) st_index[AVMEDIA_TYPE_SUBTITLE] = av_find_best_stream(ic, AVMEDIA_TYPE_SUBTITLE, wanted_stream[AVMEDIA_TYPE_SUBTITLE], (st_index[AVMEDIA_TYPE_AUDIO] >= 0 ? st_index[AVMEDIA_TYPE_AUDIO] : st_index[AVMEDIA_TYPE_VIDEO]), NULL, 0); if (show_status) { av_dump_format(ic, 0, is->filename, 0); } /* open the streams */ if (st_index[AVMEDIA_TYPE_AUDIO] >= 0) { stream_component_open(is, st_index[AVMEDIA_TYPE_AUDIO]); } ret=-1; if (st_index[AVMEDIA_TYPE_VIDEO] >= 0) { ret= stream_component_open(is, st_index[AVMEDIA_TYPE_VIDEO]); } is->refresh_tid = SDL_CreateThread(refresh_thread, is); if(ret<0) { if (!display_disable) is->show_audio = 2; } if (st_index[AVMEDIA_TYPE_SUBTITLE] >= 0) { stream_component_open(is, st_index[AVMEDIA_TYPE_SUBTITLE]); } if (is->video_stream < 0 && is->audio_stream < 0) { fprintf(stderr, "%s: could not open codecs\n", is->filename); ret = -1; goto fail; } for(;;) { if (is->abort_request) break; if (is->paused != is->last_paused) { is->last_paused = is->paused; if (is->paused) is->read_pause_return= av_read_pause(ic); else av_read_play(ic); } #if CONFIG_RTSP_DEMUXER if (is->paused && !strcmp(ic->iformat->name, "rtsp")) { /* wait 10 ms to avoid trying to get another packet */ /* XXX: horrible */ SDL_Delay(10); continue; } #endif if (is->seek_req) { int64_t seek_target= is->seek_pos; int64_t seek_min= is->seek_rel > 0 ? seek_target - is->seek_rel + 2: INT64_MIN; int64_t seek_max= is->seek_rel < 0 ? seek_target - is->seek_rel - 2: INT64_MAX; //FIXME the +-2 is due to rounding being not done in the correct direction in generation // of the seek_pos/seek_rel variables ret = avformat_seek_file(is->ic, -1, seek_min, seek_target, seek_max, is->seek_flags); if (ret < 0) { fprintf(stderr, "%s: error while seeking\n", is->ic->filename); }else{ if (is->audio_stream >= 0) { packet_queue_flush(&is->audioq); packet_queue_put(&is->audioq, &flush_pkt); } if (is->subtitle_stream >= 0) { packet_queue_flush(&is->subtitleq); packet_queue_put(&is->subtitleq, &flush_pkt); } if (is->video_stream >= 0) { packet_queue_flush(&is->videoq); packet_queue_put(&is->videoq, &flush_pkt); } } is->seek_req = 0; eof= 0; } /* if the queue are full, no need to read more */ if ( is->audioq.size + is->videoq.size + is->subtitleq.size > MAX_QUEUE_SIZE || ( (is->audioq .size > MIN_AUDIOQ_SIZE || is->audio_stream<0) && (is->videoq .nb_packets > MIN_FRAMES || is->video_stream<0) && (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream<0))) { /* wait 10 ms */ SDL_Delay(10); continue; } if(eof) { if(is->video_stream >= 0){ av_init_packet(pkt); pkt->data=NULL; pkt->size=0; pkt->stream_index= is->video_stream; packet_queue_put(&is->videoq, pkt); } SDL_Delay(10); if(is->audioq.size + is->videoq.size + is->subtitleq.size ==0){ if(loop!=1 && (!loop || --loop)){ stream_seek(cur_stream, start_time != AV_NOPTS_VALUE ? start_time : 0, 0, 0); }else if(autoexit){ ret=AVERROR_EOF; goto fail; } } continue; } ret = av_read_frame(ic, pkt); if (ret < 0) { if (ret == AVERROR_EOF || ic->pb->eof_reached) eof=1; if (ic->pb->error) break; SDL_Delay(100); /* wait for user event */ continue; } /* check if packet is in play range specified by user, then queue, otherwise discard */ pkt_in_play_range = duration == AV_NOPTS_VALUE || (pkt->pts - ic->streams[pkt->stream_index]->start_time) * av_q2d(ic->streams[pkt->stream_index]->time_base) - (double)(start_time != AV_NOPTS_VALUE ? start_time : 0)/1000000 <= ((double)duration/1000000); if (pkt->stream_index == is->audio_stream && pkt_in_play_range) { packet_queue_put(&is->audioq, pkt); } else if (pkt->stream_index == is->video_stream && pkt_in_play_range) { packet_queue_put(&is->videoq, pkt); } else if (pkt->stream_index == is->subtitle_stream && pkt_in_play_range) { packet_queue_put(&is->subtitleq, pkt); } else { av_free_packet(pkt); } } /* wait until the end */ while (!is->abort_request) { SDL_Delay(100); } ret = 0; fail: /* disable interrupting */ global_video_state = NULL; /* close each stream */ if (is->audio_stream >= 0) stream_component_close(is, is->audio_stream); if (is->video_stream >= 0) stream_component_close(is, is->video_stream); if (is->subtitle_stream >= 0) stream_component_close(is, is->subtitle_stream); if (is->ic) { av_close_input_file(is->ic); is->ic = NULL; /* safety */ } url_set_interrupt_cb(NULL); if (ret != 0) { SDL_Event event; event.type = FF_QUIT_EVENT; event.user.data1 = is; SDL_PushEvent(&event); } return 0; }
true
FFmpeg
648c79624fa70414dfb644fcb84b9de15e6568b0
static int decode_thread(void *arg) { VideoState *is = arg; AVFormatContext *ic; int err, i, ret; int st_index[AVMEDIA_TYPE_NB]; AVPacket pkt1, *pkt = &pkt1; AVFormatParameters params, *ap = &params; int eof=0; int pkt_in_play_range = 0; ic = avformat_alloc_context(); memset(st_index, -1, sizeof(st_index)); is->video_stream = -1; is->audio_stream = -1; is->subtitle_stream = -1; global_video_state = is; url_set_interrupt_cb(decode_interrupt_cb); memset(ap, 0, sizeof(*ap)); ap->prealloced_context = 1; ap->width = frame_width; ap->height= frame_height; ap->time_base= (AVRational){1, 25}; ap->pix_fmt = frame_pix_fmt; set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM, NULL); err = av_open_input_file(&ic, is->filename, is->iformat, 0, ap); if (err < 0) { print_error(is->filename, err); ret = -1; goto fail; } is->ic = ic; if(genpts) ic->flags |= AVFMT_FLAG_GENPTS; err = av_find_stream_info(ic); if (err < 0) { fprintf(stderr, "%s: could not find codec parameters\n", is->filename); ret = -1; goto fail; } if(ic->pb) ic->pb->eof_reached= 0; if(seek_by_bytes<0) seek_by_bytes= !!(ic->iformat->flags & AVFMT_TS_DISCONT); if (start_time != AV_NOPTS_VALUE) { int64_t timestamp; timestamp = start_time; if (ic->start_time != AV_NOPTS_VALUE) timestamp += ic->start_time; ret = avformat_seek_file(ic, -1, INT64_MIN, timestamp, INT64_MAX, 0); if (ret < 0) { fprintf(stderr, "%s: could not seek to position %0.3f\n", is->filename, (double)timestamp / AV_TIME_BASE); } } for (i = 0; i < ic->nb_streams; i++) ic->streams[i]->discard = AVDISCARD_ALL; if (!video_disable) st_index[AVMEDIA_TYPE_VIDEO] = av_find_best_stream(ic, AVMEDIA_TYPE_VIDEO, wanted_stream[AVMEDIA_TYPE_VIDEO], -1, NULL, 0); if (!audio_disable) st_index[AVMEDIA_TYPE_AUDIO] = av_find_best_stream(ic, AVMEDIA_TYPE_AUDIO, wanted_stream[AVMEDIA_TYPE_AUDIO], st_index[AVMEDIA_TYPE_VIDEO], NULL, 0); if (!video_disable) st_index[AVMEDIA_TYPE_SUBTITLE] = av_find_best_stream(ic, AVMEDIA_TYPE_SUBTITLE, wanted_stream[AVMEDIA_TYPE_SUBTITLE], (st_index[AVMEDIA_TYPE_AUDIO] >= 0 ? st_index[AVMEDIA_TYPE_AUDIO] : st_index[AVMEDIA_TYPE_VIDEO]), NULL, 0); if (show_status) { av_dump_format(ic, 0, is->filename, 0); } if (st_index[AVMEDIA_TYPE_AUDIO] >= 0) { stream_component_open(is, st_index[AVMEDIA_TYPE_AUDIO]); } ret=-1; if (st_index[AVMEDIA_TYPE_VIDEO] >= 0) { ret= stream_component_open(is, st_index[AVMEDIA_TYPE_VIDEO]); } is->refresh_tid = SDL_CreateThread(refresh_thread, is); if(ret<0) { if (!display_disable) is->show_audio = 2; } if (st_index[AVMEDIA_TYPE_SUBTITLE] >= 0) { stream_component_open(is, st_index[AVMEDIA_TYPE_SUBTITLE]); } if (is->video_stream < 0 && is->audio_stream < 0) { fprintf(stderr, "%s: could not open codecs\n", is->filename); ret = -1; goto fail; } for(;;) { if (is->abort_request) break; if (is->paused != is->last_paused) { is->last_paused = is->paused; if (is->paused) is->read_pause_return= av_read_pause(ic); else av_read_play(ic); } #if CONFIG_RTSP_DEMUXER if (is->paused && !strcmp(ic->iformat->name, "rtsp")) { SDL_Delay(10); continue; } #endif if (is->seek_req) { int64_t seek_target= is->seek_pos; int64_t seek_min= is->seek_rel > 0 ? seek_target - is->seek_rel + 2: INT64_MIN; int64_t seek_max= is->seek_rel < 0 ? seek_target - is->seek_rel - 2: INT64_MAX; ret = avformat_seek_file(is->ic, -1, seek_min, seek_target, seek_max, is->seek_flags); if (ret < 0) { fprintf(stderr, "%s: error while seeking\n", is->ic->filename); }else{ if (is->audio_stream >= 0) { packet_queue_flush(&is->audioq); packet_queue_put(&is->audioq, &flush_pkt); } if (is->subtitle_stream >= 0) { packet_queue_flush(&is->subtitleq); packet_queue_put(&is->subtitleq, &flush_pkt); } if (is->video_stream >= 0) { packet_queue_flush(&is->videoq); packet_queue_put(&is->videoq, &flush_pkt); } } is->seek_req = 0; eof= 0; } if ( is->audioq.size + is->videoq.size + is->subtitleq.size > MAX_QUEUE_SIZE || ( (is->audioq .size > MIN_AUDIOQ_SIZE || is->audio_stream<0) && (is->videoq .nb_packets > MIN_FRAMES || is->video_stream<0) && (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream<0))) { SDL_Delay(10); continue; } if(eof) { if(is->video_stream >= 0){ av_init_packet(pkt); pkt->data=NULL; pkt->size=0; pkt->stream_index= is->video_stream; packet_queue_put(&is->videoq, pkt); } SDL_Delay(10); if(is->audioq.size + is->videoq.size + is->subtitleq.size ==0){ if(loop!=1 && (!loop || --loop)){ stream_seek(cur_stream, start_time != AV_NOPTS_VALUE ? start_time : 0, 0, 0); }else if(autoexit){ ret=AVERROR_EOF; goto fail; } } continue; } ret = av_read_frame(ic, pkt); if (ret < 0) { if (ret == AVERROR_EOF || ic->pb->eof_reached) eof=1; if (ic->pb->error) break; SDL_Delay(100); continue; } pkt_in_play_range = duration == AV_NOPTS_VALUE || (pkt->pts - ic->streams[pkt->stream_index]->start_time) * av_q2d(ic->streams[pkt->stream_index]->time_base) - (double)(start_time != AV_NOPTS_VALUE ? start_time : 0)/1000000 <= ((double)duration/1000000); if (pkt->stream_index == is->audio_stream && pkt_in_play_range) { packet_queue_put(&is->audioq, pkt); } else if (pkt->stream_index == is->video_stream && pkt_in_play_range) { packet_queue_put(&is->videoq, pkt); } else if (pkt->stream_index == is->subtitle_stream && pkt_in_play_range) { packet_queue_put(&is->subtitleq, pkt); } else { av_free_packet(pkt); } } while (!is->abort_request) { SDL_Delay(100); } ret = 0; fail: global_video_state = NULL; if (is->audio_stream >= 0) stream_component_close(is, is->audio_stream); if (is->video_stream >= 0) stream_component_close(is, is->video_stream); if (is->subtitle_stream >= 0) stream_component_close(is, is->subtitle_stream); if (is->ic) { av_close_input_file(is->ic); is->ic = NULL; } url_set_interrupt_cb(NULL); if (ret != 0) { SDL_Event event; event.type = FF_QUIT_EVENT; event.user.data1 = is; SDL_PushEvent(&event); } return 0; }
{ "code": [ " if (ret == AVERROR_EOF || ic->pb->eof_reached)", " if (ic->pb->error)" ], "line_no": [ 389, 393 ] }
static int FUNC_0(void *VAR_0) { VideoState *is = VAR_0; AVFormatContext *ic; int VAR_1, VAR_2, VAR_3; int VAR_4[AVMEDIA_TYPE_NB]; AVPacket pkt1, *pkt = &pkt1; AVFormatParameters params, *ap = &params; int VAR_5=0; int VAR_6 = 0; ic = avformat_alloc_context(); memset(VAR_4, -1, sizeof(VAR_4)); is->video_stream = -1; is->audio_stream = -1; is->subtitle_stream = -1; global_video_state = is; url_set_interrupt_cb(decode_interrupt_cb); memset(ap, 0, sizeof(*ap)); ap->prealloced_context = 1; ap->width = frame_width; ap->height= frame_height; ap->time_base= (AVRational){1, 25}; ap->pix_fmt = frame_pix_fmt; set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM, NULL); VAR_1 = av_open_input_file(&ic, is->filename, is->iformat, 0, ap); if (VAR_1 < 0) { print_error(is->filename, VAR_1); VAR_3 = -1; goto fail; } is->ic = ic; if(genpts) ic->flags |= AVFMT_FLAG_GENPTS; VAR_1 = av_find_stream_info(ic); if (VAR_1 < 0) { fprintf(stderr, "%s: could not find codec parameters\n", is->filename); VAR_3 = -1; goto fail; } if(ic->pb) ic->pb->eof_reached= 0; if(seek_by_bytes<0) seek_by_bytes= !!(ic->iformat->flags & AVFMT_TS_DISCONT); if (start_time != AV_NOPTS_VALUE) { int64_t timestamp; timestamp = start_time; if (ic->start_time != AV_NOPTS_VALUE) timestamp += ic->start_time; VAR_3 = avformat_seek_file(ic, -1, INT64_MIN, timestamp, INT64_MAX, 0); if (VAR_3 < 0) { fprintf(stderr, "%s: could not seek to position %0.3f\n", is->filename, (double)timestamp / AV_TIME_BASE); } } for (VAR_2 = 0; VAR_2 < ic->nb_streams; VAR_2++) ic->streams[VAR_2]->discard = AVDISCARD_ALL; if (!video_disable) VAR_4[AVMEDIA_TYPE_VIDEO] = av_find_best_stream(ic, AVMEDIA_TYPE_VIDEO, wanted_stream[AVMEDIA_TYPE_VIDEO], -1, NULL, 0); if (!audio_disable) VAR_4[AVMEDIA_TYPE_AUDIO] = av_find_best_stream(ic, AVMEDIA_TYPE_AUDIO, wanted_stream[AVMEDIA_TYPE_AUDIO], VAR_4[AVMEDIA_TYPE_VIDEO], NULL, 0); if (!video_disable) VAR_4[AVMEDIA_TYPE_SUBTITLE] = av_find_best_stream(ic, AVMEDIA_TYPE_SUBTITLE, wanted_stream[AVMEDIA_TYPE_SUBTITLE], (VAR_4[AVMEDIA_TYPE_AUDIO] >= 0 ? VAR_4[AVMEDIA_TYPE_AUDIO] : VAR_4[AVMEDIA_TYPE_VIDEO]), NULL, 0); if (show_status) { av_dump_format(ic, 0, is->filename, 0); } if (VAR_4[AVMEDIA_TYPE_AUDIO] >= 0) { stream_component_open(is, VAR_4[AVMEDIA_TYPE_AUDIO]); } VAR_3=-1; if (VAR_4[AVMEDIA_TYPE_VIDEO] >= 0) { VAR_3= stream_component_open(is, VAR_4[AVMEDIA_TYPE_VIDEO]); } is->refresh_tid = SDL_CreateThread(refresh_thread, is); if(VAR_3<0) { if (!display_disable) is->show_audio = 2; } if (VAR_4[AVMEDIA_TYPE_SUBTITLE] >= 0) { stream_component_open(is, VAR_4[AVMEDIA_TYPE_SUBTITLE]); } if (is->video_stream < 0 && is->audio_stream < 0) { fprintf(stderr, "%s: could not open codecs\n", is->filename); VAR_3 = -1; goto fail; } for(;;) { if (is->abort_request) break; if (is->paused != is->last_paused) { is->last_paused = is->paused; if (is->paused) is->read_pause_return= av_read_pause(ic); else av_read_play(ic); } #if CONFIG_RTSP_DEMUXER if (is->paused && !strcmp(ic->iformat->name, "rtsp")) { SDL_Delay(10); continue; } #endif if (is->seek_req) { int64_t seek_target= is->seek_pos; int64_t seek_min= is->seek_rel > 0 ? seek_target - is->seek_rel + 2: INT64_MIN; int64_t seek_max= is->seek_rel < 0 ? seek_target - is->seek_rel - 2: INT64_MAX; VAR_3 = avformat_seek_file(is->ic, -1, seek_min, seek_target, seek_max, is->seek_flags); if (VAR_3 < 0) { fprintf(stderr, "%s: error while seeking\n", is->ic->filename); }else{ if (is->audio_stream >= 0) { packet_queue_flush(&is->audioq); packet_queue_put(&is->audioq, &flush_pkt); } if (is->subtitle_stream >= 0) { packet_queue_flush(&is->subtitleq); packet_queue_put(&is->subtitleq, &flush_pkt); } if (is->video_stream >= 0) { packet_queue_flush(&is->videoq); packet_queue_put(&is->videoq, &flush_pkt); } } is->seek_req = 0; VAR_5= 0; } if ( is->audioq.size + is->videoq.size + is->subtitleq.size > MAX_QUEUE_SIZE || ( (is->audioq .size > MIN_AUDIOQ_SIZE || is->audio_stream<0) && (is->videoq .nb_packets > MIN_FRAMES || is->video_stream<0) && (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream<0))) { SDL_Delay(10); continue; } if(VAR_5) { if(is->video_stream >= 0){ av_init_packet(pkt); pkt->data=NULL; pkt->size=0; pkt->stream_index= is->video_stream; packet_queue_put(&is->videoq, pkt); } SDL_Delay(10); if(is->audioq.size + is->videoq.size + is->subtitleq.size ==0){ if(loop!=1 && (!loop || --loop)){ stream_seek(cur_stream, start_time != AV_NOPTS_VALUE ? start_time : 0, 0, 0); }else if(autoexit){ VAR_3=AVERROR_EOF; goto fail; } } continue; } VAR_3 = av_read_frame(ic, pkt); if (VAR_3 < 0) { if (VAR_3 == AVERROR_EOF || ic->pb->eof_reached) VAR_5=1; if (ic->pb->error) break; SDL_Delay(100); continue; } VAR_6 = duration == AV_NOPTS_VALUE || (pkt->pts - ic->streams[pkt->stream_index]->start_time) * av_q2d(ic->streams[pkt->stream_index]->time_base) - (double)(start_time != AV_NOPTS_VALUE ? start_time : 0)/1000000 <= ((double)duration/1000000); if (pkt->stream_index == is->audio_stream && VAR_6) { packet_queue_put(&is->audioq, pkt); } else if (pkt->stream_index == is->video_stream && VAR_6) { packet_queue_put(&is->videoq, pkt); } else if (pkt->stream_index == is->subtitle_stream && VAR_6) { packet_queue_put(&is->subtitleq, pkt); } else { av_free_packet(pkt); } } while (!is->abort_request) { SDL_Delay(100); } VAR_3 = 0; fail: global_video_state = NULL; if (is->audio_stream >= 0) stream_component_close(is, is->audio_stream); if (is->video_stream >= 0) stream_component_close(is, is->video_stream); if (is->subtitle_stream >= 0) stream_component_close(is, is->subtitle_stream); if (is->ic) { av_close_input_file(is->ic); is->ic = NULL; } url_set_interrupt_cb(NULL); if (VAR_3 != 0) { SDL_Event event; event.type = FF_QUIT_EVENT; event.user.data1 = is; SDL_PushEvent(&event); } return 0; }
[ "static int FUNC_0(void *VAR_0)\n{", "VideoState *is = VAR_0;", "AVFormatContext *ic;", "int VAR_1, VAR_2, VAR_3;", "int VAR_4[AVMEDIA_TYPE_NB];", "AVPacket pkt1, *pkt = &pkt1;", "AVFormatParameters params, *ap = &params;", "int VAR_5=0;", "int VAR_6 = 0;", "ic = avformat_alloc_context();", "memset(VAR_4, -1, sizeof(VAR_4));", "is->video_stream = -1;", "is->audio_stream = -1;", "is->subtitle_stream = -1;", "global_video_state = is;", "url_set_interrupt_cb(decode_interrupt_cb);", "memset(ap, 0, sizeof(*ap));", "ap->prealloced_context = 1;", "ap->width = frame_width;", "ap->height= frame_height;", "ap->time_base= (AVRational){1, 25};", "ap->pix_fmt = frame_pix_fmt;", "set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM, NULL);", "VAR_1 = av_open_input_file(&ic, is->filename, is->iformat, 0, ap);", "if (VAR_1 < 0) {", "print_error(is->filename, VAR_1);", "VAR_3 = -1;", "goto fail;", "}", "is->ic = ic;", "if(genpts)\nic->flags |= AVFMT_FLAG_GENPTS;", "VAR_1 = av_find_stream_info(ic);", "if (VAR_1 < 0) {", "fprintf(stderr, \"%s: could not find codec parameters\\n\", is->filename);", "VAR_3 = -1;", "goto fail;", "}", "if(ic->pb)\nic->pb->eof_reached= 0;", "if(seek_by_bytes<0)\nseek_by_bytes= !!(ic->iformat->flags & AVFMT_TS_DISCONT);", "if (start_time != AV_NOPTS_VALUE) {", "int64_t timestamp;", "timestamp = start_time;", "if (ic->start_time != AV_NOPTS_VALUE)\ntimestamp += ic->start_time;", "VAR_3 = avformat_seek_file(ic, -1, INT64_MIN, timestamp, INT64_MAX, 0);", "if (VAR_3 < 0) {", "fprintf(stderr, \"%s: could not seek to position %0.3f\\n\",\nis->filename, (double)timestamp / AV_TIME_BASE);", "}", "}", "for (VAR_2 = 0; VAR_2 < ic->nb_streams; VAR_2++)", "ic->streams[VAR_2]->discard = AVDISCARD_ALL;", "if (!video_disable)\nVAR_4[AVMEDIA_TYPE_VIDEO] =\nav_find_best_stream(ic, AVMEDIA_TYPE_VIDEO,\nwanted_stream[AVMEDIA_TYPE_VIDEO], -1, NULL, 0);", "if (!audio_disable)\nVAR_4[AVMEDIA_TYPE_AUDIO] =\nav_find_best_stream(ic, AVMEDIA_TYPE_AUDIO,\nwanted_stream[AVMEDIA_TYPE_AUDIO],\nVAR_4[AVMEDIA_TYPE_VIDEO],\nNULL, 0);", "if (!video_disable)\nVAR_4[AVMEDIA_TYPE_SUBTITLE] =\nav_find_best_stream(ic, AVMEDIA_TYPE_SUBTITLE,\nwanted_stream[AVMEDIA_TYPE_SUBTITLE],\n(VAR_4[AVMEDIA_TYPE_AUDIO] >= 0 ?\nVAR_4[AVMEDIA_TYPE_AUDIO] :\nVAR_4[AVMEDIA_TYPE_VIDEO]),\nNULL, 0);", "if (show_status) {", "av_dump_format(ic, 0, is->filename, 0);", "}", "if (VAR_4[AVMEDIA_TYPE_AUDIO] >= 0) {", "stream_component_open(is, VAR_4[AVMEDIA_TYPE_AUDIO]);", "}", "VAR_3=-1;", "if (VAR_4[AVMEDIA_TYPE_VIDEO] >= 0) {", "VAR_3= stream_component_open(is, VAR_4[AVMEDIA_TYPE_VIDEO]);", "}", "is->refresh_tid = SDL_CreateThread(refresh_thread, is);", "if(VAR_3<0) {", "if (!display_disable)\nis->show_audio = 2;", "}", "if (VAR_4[AVMEDIA_TYPE_SUBTITLE] >= 0) {", "stream_component_open(is, VAR_4[AVMEDIA_TYPE_SUBTITLE]);", "}", "if (is->video_stream < 0 && is->audio_stream < 0) {", "fprintf(stderr, \"%s: could not open codecs\\n\", is->filename);", "VAR_3 = -1;", "goto fail;", "}", "for(;;) {", "if (is->abort_request)\nbreak;", "if (is->paused != is->last_paused) {", "is->last_paused = is->paused;", "if (is->paused)\nis->read_pause_return= av_read_pause(ic);", "else\nav_read_play(ic);", "}", "#if CONFIG_RTSP_DEMUXER\nif (is->paused && !strcmp(ic->iformat->name, \"rtsp\")) {", "SDL_Delay(10);", "continue;", "}", "#endif\nif (is->seek_req) {", "int64_t seek_target= is->seek_pos;", "int64_t seek_min= is->seek_rel > 0 ? seek_target - is->seek_rel + 2: INT64_MIN;", "int64_t seek_max= is->seek_rel < 0 ? seek_target - is->seek_rel - 2: INT64_MAX;", "VAR_3 = avformat_seek_file(is->ic, -1, seek_min, seek_target, seek_max, is->seek_flags);", "if (VAR_3 < 0) {", "fprintf(stderr, \"%s: error while seeking\\n\", is->ic->filename);", "}else{", "if (is->audio_stream >= 0) {", "packet_queue_flush(&is->audioq);", "packet_queue_put(&is->audioq, &flush_pkt);", "}", "if (is->subtitle_stream >= 0) {", "packet_queue_flush(&is->subtitleq);", "packet_queue_put(&is->subtitleq, &flush_pkt);", "}", "if (is->video_stream >= 0) {", "packet_queue_flush(&is->videoq);", "packet_queue_put(&is->videoq, &flush_pkt);", "}", "}", "is->seek_req = 0;", "VAR_5= 0;", "}", "if ( is->audioq.size + is->videoq.size + is->subtitleq.size > MAX_QUEUE_SIZE\n|| ( (is->audioq .size > MIN_AUDIOQ_SIZE || is->audio_stream<0)\n&& (is->videoq .nb_packets > MIN_FRAMES || is->video_stream<0)\n&& (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream<0))) {", "SDL_Delay(10);", "continue;", "}", "if(VAR_5) {", "if(is->video_stream >= 0){", "av_init_packet(pkt);", "pkt->data=NULL;", "pkt->size=0;", "pkt->stream_index= is->video_stream;", "packet_queue_put(&is->videoq, pkt);", "}", "SDL_Delay(10);", "if(is->audioq.size + is->videoq.size + is->subtitleq.size ==0){", "if(loop!=1 && (!loop || --loop)){", "stream_seek(cur_stream, start_time != AV_NOPTS_VALUE ? start_time : 0, 0, 0);", "}else if(autoexit){", "VAR_3=AVERROR_EOF;", "goto fail;", "}", "}", "continue;", "}", "VAR_3 = av_read_frame(ic, pkt);", "if (VAR_3 < 0) {", "if (VAR_3 == AVERROR_EOF || ic->pb->eof_reached)\nVAR_5=1;", "if (ic->pb->error)\nbreak;", "SDL_Delay(100);", "continue;", "}", "VAR_6 = duration == AV_NOPTS_VALUE ||\n(pkt->pts - ic->streams[pkt->stream_index]->start_time) *\nav_q2d(ic->streams[pkt->stream_index]->time_base) -\n(double)(start_time != AV_NOPTS_VALUE ? start_time : 0)/1000000\n<= ((double)duration/1000000);", "if (pkt->stream_index == is->audio_stream && VAR_6) {", "packet_queue_put(&is->audioq, pkt);", "} else if (pkt->stream_index == is->video_stream && VAR_6) {", "packet_queue_put(&is->videoq, pkt);", "} else if (pkt->stream_index == is->subtitle_stream && VAR_6) {", "packet_queue_put(&is->subtitleq, pkt);", "} else {", "av_free_packet(pkt);", "}", "}", "while (!is->abort_request) {", "SDL_Delay(100);", "}", "VAR_3 = 0;", "fail:\nglobal_video_state = NULL;", "if (is->audio_stream >= 0)\nstream_component_close(is, is->audio_stream);", "if (is->video_stream >= 0)\nstream_component_close(is, is->video_stream);", "if (is->subtitle_stream >= 0)\nstream_component_close(is, is->subtitle_stream);", "if (is->ic) {", "av_close_input_file(is->ic);", "is->ic = NULL;", "}", "url_set_interrupt_cb(NULL);", "if (VAR_3 != 0) {", "SDL_Event event;", "event.type = FF_QUIT_EVENT;", "event.user.data1 = is;", "SDL_PushEvent(&event);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 103, 105 ], [ 111 ], [ 113 ], [ 117 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143, 145, 147, 149 ], [ 151, 153, 155, 157, 159, 161 ], [ 163, 165, 167, 169, 171, 173, 175, 177 ], [ 179 ], [ 181 ], [ 183 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209, 211 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 247, 249 ], [ 251, 253 ], [ 255 ], [ 257, 259 ], [ 265 ], [ 267 ], [ 269 ], [ 271, 273 ], [ 275 ], [ 277 ], [ 279 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 331, 333, 335, 337 ], [ 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 ], [ 405, 407, 409, 411, 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 437 ], [ 439 ], [ 441 ], [ 445 ], [ 447, 451 ], [ 457, 459 ], [ 461, 463 ], [ 465, 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 481 ], [ 483 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ] ]
10,678
static int restore_sigcontext(CPUSH4State *regs, struct target_sigcontext *sc, target_ulong *r0_p) { unsigned int err = 0; int i; #define COPY(x) __get_user(regs->x, &sc->sc_##x) COPY(gregs[1]); COPY(gregs[2]); COPY(gregs[3]); COPY(gregs[4]); COPY(gregs[5]); COPY(gregs[6]); COPY(gregs[7]); COPY(gregs[8]); COPY(gregs[9]); COPY(gregs[10]); COPY(gregs[11]); COPY(gregs[12]); COPY(gregs[13]); COPY(gregs[14]); COPY(gregs[15]); COPY(gbr); COPY(mach); COPY(macl); COPY(pr); COPY(sr); COPY(pc); #undef COPY for (i=0; i<16; i++) { __get_user(regs->fregs[i], &sc->sc_fpregs[i]); } __get_user(regs->fpscr, &sc->sc_fpscr); __get_user(regs->fpul, &sc->sc_fpul); regs->tra = -1; /* disable syscall checks */ __get_user(*r0_p, &sc->sc_gregs[0]); return err; }
true
qemu
016d2e1dfa21b64a524d3629fdd317d4c25bc3b8
static int restore_sigcontext(CPUSH4State *regs, struct target_sigcontext *sc, target_ulong *r0_p) { unsigned int err = 0; int i; #define COPY(x) __get_user(regs->x, &sc->sc_##x) COPY(gregs[1]); COPY(gregs[2]); COPY(gregs[3]); COPY(gregs[4]); COPY(gregs[5]); COPY(gregs[6]); COPY(gregs[7]); COPY(gregs[8]); COPY(gregs[9]); COPY(gregs[10]); COPY(gregs[11]); COPY(gregs[12]); COPY(gregs[13]); COPY(gregs[14]); COPY(gregs[15]); COPY(gbr); COPY(mach); COPY(macl); COPY(pr); COPY(sr); COPY(pc); #undef COPY for (i=0; i<16; i++) { __get_user(regs->fregs[i], &sc->sc_fpregs[i]); } __get_user(regs->fpscr, &sc->sc_fpscr); __get_user(regs->fpul, &sc->sc_fpul); regs->tra = -1; __get_user(*r0_p, &sc->sc_gregs[0]); return err; }
{ "code": [ " return err;", "static int restore_sigcontext(CPUSH4State *regs, struct target_sigcontext *sc,", " unsigned int err = 0;", " return err;", " return err;", " return err;" ], "line_no": [ 57, 1, 7, 57, 57, 57 ] }
static int FUNC_0(CPUSH4State *VAR_0, struct target_sigcontext *VAR_1, target_ulong *VAR_2) { unsigned int VAR_3 = 0; int VAR_4; #define COPY(x) __get_user(VAR_0->x, &VAR_1->sc_##x) COPY(gregs[1]); COPY(gregs[2]); COPY(gregs[3]); COPY(gregs[4]); COPY(gregs[5]); COPY(gregs[6]); COPY(gregs[7]); COPY(gregs[8]); COPY(gregs[9]); COPY(gregs[10]); COPY(gregs[11]); COPY(gregs[12]); COPY(gregs[13]); COPY(gregs[14]); COPY(gregs[15]); COPY(gbr); COPY(mach); COPY(macl); COPY(pr); COPY(sr); COPY(pc); #undef COPY for (VAR_4=0; VAR_4<16; VAR_4++) { __get_user(VAR_0->fregs[VAR_4], &VAR_1->sc_fpregs[VAR_4]); } __get_user(VAR_0->fpscr, &VAR_1->sc_fpscr); __get_user(VAR_0->fpul, &VAR_1->sc_fpul); VAR_0->tra = -1; __get_user(*VAR_2, &VAR_1->sc_gregs[0]); return VAR_3; }
[ "static int FUNC_0(CPUSH4State *VAR_0, struct target_sigcontext *VAR_1,\ntarget_ulong *VAR_2)\n{", "unsigned int VAR_3 = 0;", "int VAR_4;", "#define COPY(x) __get_user(VAR_0->x, &VAR_1->sc_##x)\nCOPY(gregs[1]);", "COPY(gregs[2]); COPY(gregs[3]);", "COPY(gregs[4]); COPY(gregs[5]);", "COPY(gregs[6]); COPY(gregs[7]);", "COPY(gregs[8]); COPY(gregs[9]);", "COPY(gregs[10]); COPY(gregs[11]);", "COPY(gregs[12]); COPY(gregs[13]);", "COPY(gregs[14]); COPY(gregs[15]);", "COPY(gbr); COPY(mach);", "COPY(macl); COPY(pr);", "COPY(sr); COPY(pc);", "#undef COPY\nfor (VAR_4=0; VAR_4<16; VAR_4++) {", "__get_user(VAR_0->fregs[VAR_4], &VAR_1->sc_fpregs[VAR_4]);", "}", "__get_user(VAR_0->fpscr, &VAR_1->sc_fpscr);", "__get_user(VAR_0->fpul, &VAR_1->sc_fpul);", "VAR_0->tra = -1;", "__get_user(*VAR_2, &VAR_1->sc_gregs[0]);", "return VAR_3;", "}" ]
[ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
10,680
void do_rfi (void) { env->nip = env->spr[SPR_SRR0] & ~0x00000003; T0 = env->spr[SPR_SRR1] & ~0xFFFF0000UL; do_store_msr(env, T0); #if defined (DEBUG_OP) dump_rfi(); #endif env->interrupt_request |= CPU_INTERRUPT_EXITTB; }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
void do_rfi (void) { env->nip = env->spr[SPR_SRR0] & ~0x00000003; T0 = env->spr[SPR_SRR1] & ~0xFFFF0000UL; do_store_msr(env, T0); #if defined (DEBUG_OP) dump_rfi(); #endif env->interrupt_request |= CPU_INTERRUPT_EXITTB; }
{ "code": [ " env->nip = env->spr[SPR_SRR0] & ~0x00000003;", " T0 = env->spr[SPR_SRR1] & ~0xFFFF0000UL;", "#endif", "#endif" ], "line_no": [ 5, 7, 15, 15 ] }
void FUNC_0 (void) { env->nip = env->spr[SPR_SRR0] & ~0x00000003; T0 = env->spr[SPR_SRR1] & ~0xFFFF0000UL; do_store_msr(env, T0); #if defined (DEBUG_OP) dump_rfi(); #endif env->interrupt_request |= CPU_INTERRUPT_EXITTB; }
[ "void FUNC_0 (void)\n{", "env->nip = env->spr[SPR_SRR0] & ~0x00000003;", "T0 = env->spr[SPR_SRR1] & ~0xFFFF0000UL;", "do_store_msr(env, T0);", "#if defined (DEBUG_OP)\ndump_rfi();", "#endif\nenv->interrupt_request |= CPU_INTERRUPT_EXITTB;", "}" ]
[ 0, 1, 1, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19 ] ]
10,681
restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc, int *peax) { unsigned int err = 0; abi_ulong fpstate_addr; unsigned int tmpflags; cpu_x86_load_seg(env, R_GS, tswap16(sc->gs)); cpu_x86_load_seg(env, R_FS, tswap16(sc->fs)); cpu_x86_load_seg(env, R_ES, tswap16(sc->es)); cpu_x86_load_seg(env, R_DS, tswap16(sc->ds)); env->regs[R_EDI] = tswapl(sc->edi); env->regs[R_ESI] = tswapl(sc->esi); env->regs[R_EBP] = tswapl(sc->ebp); env->regs[R_ESP] = tswapl(sc->esp); env->regs[R_EBX] = tswapl(sc->ebx); env->regs[R_EDX] = tswapl(sc->edx); env->regs[R_ECX] = tswapl(sc->ecx); env->eip = tswapl(sc->eip); cpu_x86_load_seg(env, R_CS, lduw(&sc->cs) | 3); cpu_x86_load_seg(env, R_SS, lduw(&sc->ss) | 3); tmpflags = tswapl(sc->eflags); env->eflags = (env->eflags & ~0x40DD5) | (tmpflags & 0x40DD5); // regs->orig_eax = -1; /* disable syscall checks */ fpstate_addr = tswapl(sc->fpstate); if (fpstate_addr != 0) { if (!access_ok(VERIFY_READ, fpstate_addr, sizeof(struct target_fpstate))) goto badframe; cpu_x86_frstor(env, fpstate_addr, 1); } *peax = tswapl(sc->eax); return err; badframe: return 1; }
true
qemu
9a826d7854baf6b90de46fea785d1bfc5d2c22a7
restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc, int *peax) { unsigned int err = 0; abi_ulong fpstate_addr; unsigned int tmpflags; cpu_x86_load_seg(env, R_GS, tswap16(sc->gs)); cpu_x86_load_seg(env, R_FS, tswap16(sc->fs)); cpu_x86_load_seg(env, R_ES, tswap16(sc->es)); cpu_x86_load_seg(env, R_DS, tswap16(sc->ds)); env->regs[R_EDI] = tswapl(sc->edi); env->regs[R_ESI] = tswapl(sc->esi); env->regs[R_EBP] = tswapl(sc->ebp); env->regs[R_ESP] = tswapl(sc->esp); env->regs[R_EBX] = tswapl(sc->ebx); env->regs[R_EDX] = tswapl(sc->edx); env->regs[R_ECX] = tswapl(sc->ecx); env->eip = tswapl(sc->eip); cpu_x86_load_seg(env, R_CS, lduw(&sc->cs) | 3); cpu_x86_load_seg(env, R_SS, lduw(&sc->ss) | 3); tmpflags = tswapl(sc->eflags); env->eflags = (env->eflags & ~0x40DD5) | (tmpflags & 0x40DD5); fpstate_addr = tswapl(sc->fpstate); if (fpstate_addr != 0) { if (!access_ok(VERIFY_READ, fpstate_addr, sizeof(struct target_fpstate))) goto badframe; cpu_x86_frstor(env, fpstate_addr, 1); } *peax = tswapl(sc->eax); return err; badframe: return 1; }
{ "code": [ " cpu_x86_load_seg(env, R_CS, lduw(&sc->cs) | 3);", " cpu_x86_load_seg(env, R_SS, lduw(&sc->ss) | 3);" ], "line_no": [ 41, 43 ] }
FUNC_0(CPUX86State *VAR_0, struct target_sigcontext *VAR_1, int *VAR_2) { unsigned int VAR_3 = 0; abi_ulong fpstate_addr; unsigned int VAR_4; cpu_x86_load_seg(VAR_0, R_GS, tswap16(VAR_1->gs)); cpu_x86_load_seg(VAR_0, R_FS, tswap16(VAR_1->fs)); cpu_x86_load_seg(VAR_0, R_ES, tswap16(VAR_1->es)); cpu_x86_load_seg(VAR_0, R_DS, tswap16(VAR_1->ds)); VAR_0->regs[R_EDI] = tswapl(VAR_1->edi); VAR_0->regs[R_ESI] = tswapl(VAR_1->esi); VAR_0->regs[R_EBP] = tswapl(VAR_1->ebp); VAR_0->regs[R_ESP] = tswapl(VAR_1->esp); VAR_0->regs[R_EBX] = tswapl(VAR_1->ebx); VAR_0->regs[R_EDX] = tswapl(VAR_1->edx); VAR_0->regs[R_ECX] = tswapl(VAR_1->ecx); VAR_0->eip = tswapl(VAR_1->eip); cpu_x86_load_seg(VAR_0, R_CS, lduw(&VAR_1->cs) | 3); cpu_x86_load_seg(VAR_0, R_SS, lduw(&VAR_1->ss) | 3); VAR_4 = tswapl(VAR_1->eflags); VAR_0->eflags = (VAR_0->eflags & ~0x40DD5) | (VAR_4 & 0x40DD5); fpstate_addr = tswapl(VAR_1->fpstate); if (fpstate_addr != 0) { if (!access_ok(VERIFY_READ, fpstate_addr, sizeof(struct target_fpstate))) goto badframe; cpu_x86_frstor(VAR_0, fpstate_addr, 1); } *VAR_2 = tswapl(VAR_1->eax); return VAR_3; badframe: return 1; }
[ "FUNC_0(CPUX86State *VAR_0, struct target_sigcontext *VAR_1, int *VAR_2)\n{", "unsigned int VAR_3 = 0;", "abi_ulong fpstate_addr;", "unsigned int VAR_4;", "cpu_x86_load_seg(VAR_0, R_GS, tswap16(VAR_1->gs));", "cpu_x86_load_seg(VAR_0, R_FS, tswap16(VAR_1->fs));", "cpu_x86_load_seg(VAR_0, R_ES, tswap16(VAR_1->es));", "cpu_x86_load_seg(VAR_0, R_DS, tswap16(VAR_1->ds));", "VAR_0->regs[R_EDI] = tswapl(VAR_1->edi);", "VAR_0->regs[R_ESI] = tswapl(VAR_1->esi);", "VAR_0->regs[R_EBP] = tswapl(VAR_1->ebp);", "VAR_0->regs[R_ESP] = tswapl(VAR_1->esp);", "VAR_0->regs[R_EBX] = tswapl(VAR_1->ebx);", "VAR_0->regs[R_EDX] = tswapl(VAR_1->edx);", "VAR_0->regs[R_ECX] = tswapl(VAR_1->ecx);", "VAR_0->eip = tswapl(VAR_1->eip);", "cpu_x86_load_seg(VAR_0, R_CS, lduw(&VAR_1->cs) | 3);", "cpu_x86_load_seg(VAR_0, R_SS, lduw(&VAR_1->ss) | 3);", "VAR_4 = tswapl(VAR_1->eflags);", "VAR_0->eflags = (VAR_0->eflags & ~0x40DD5) | (VAR_4 & 0x40DD5);", "fpstate_addr = tswapl(VAR_1->fpstate);", "if (fpstate_addr != 0) {", "if (!access_ok(VERIFY_READ, fpstate_addr,\nsizeof(struct target_fpstate)))\ngoto badframe;", "cpu_x86_frstor(VAR_0, fpstate_addr, 1);", "}", "*VAR_2 = tswapl(VAR_1->eax);", "return VAR_3;", "badframe:\nreturn 1;", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59, 61, 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ] ]
10,682
static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path, char *buf, size_t bufsz) { ssize_t tsize = -1; char *buffer; char *path = fs_path->data; if ((fs_ctx->export_flags & V9FS_SM_MAPPED) || (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) { int fd; buffer = rpath(fs_ctx, path); fd = open(buffer, O_RDONLY | O_NOFOLLOW); g_free(buffer); if (fd == -1) { return -1; } do { tsize = read(fd, (void *)buf, bufsz); } while (tsize == -1 && errno == EINTR); close(fd); } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { buffer = rpath(fs_ctx, path); tsize = readlink(buffer, buf, bufsz); g_free(buffer); } return tsize; }
true
qemu
bec1e9546e03b9e7f5152cf3e8c95cf8acff5e12
static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path, char *buf, size_t bufsz) { ssize_t tsize = -1; char *buffer; char *path = fs_path->data; if ((fs_ctx->export_flags & V9FS_SM_MAPPED) || (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) { int fd; buffer = rpath(fs_ctx, path); fd = open(buffer, O_RDONLY | O_NOFOLLOW); g_free(buffer); if (fd == -1) { return -1; } do { tsize = read(fd, (void *)buf, bufsz); } while (tsize == -1 && errno == EINTR); close(fd); } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { buffer = rpath(fs_ctx, path); tsize = readlink(buffer, buf, bufsz); g_free(buffer); } return tsize; }
{ "code": [ " char *buffer;", " char *path = fs_path->data;", " buffer = rpath(fs_ctx, path);", " fd = open(buffer, O_RDONLY | O_NOFOLLOW);", " g_free(buffer);", " close(fd);", " buffer = rpath(fs_ctx, path);", " tsize = readlink(buffer, buf, bufsz);", " g_free(buffer);" ], "line_no": [ 9, 11, 21, 23, 25, 39, 21, 47, 25 ] }
static ssize_t FUNC_0(FsContext *fs_ctx, V9fsPath *fs_path, char *buf, size_t bufsz) { ssize_t tsize = -1; char *VAR_0; char *VAR_1 = fs_path->data; if ((fs_ctx->export_flags & V9FS_SM_MAPPED) || (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) { int VAR_2; VAR_0 = rpath(fs_ctx, VAR_1); VAR_2 = open(VAR_0, O_RDONLY | O_NOFOLLOW); g_free(VAR_0); if (VAR_2 == -1) { return -1; } do { tsize = read(VAR_2, (void *)buf, bufsz); } while (tsize == -1 && errno == EINTR); close(VAR_2); } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { VAR_0 = rpath(fs_ctx, VAR_1); tsize = readlink(VAR_0, buf, bufsz); g_free(VAR_0); } return tsize; }
[ "static ssize_t FUNC_0(FsContext *fs_ctx, V9fsPath *fs_path,\nchar *buf, size_t bufsz)\n{", "ssize_t tsize = -1;", "char *VAR_0;", "char *VAR_1 = fs_path->data;", "if ((fs_ctx->export_flags & V9FS_SM_MAPPED) ||\n(fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) {", "int VAR_2;", "VAR_0 = rpath(fs_ctx, VAR_1);", "VAR_2 = open(VAR_0, O_RDONLY | O_NOFOLLOW);", "g_free(VAR_0);", "if (VAR_2 == -1) {", "return -1;", "}", "do {", "tsize = read(VAR_2, (void *)buf, bufsz);", "} while (tsize == -1 && errno == EINTR);", "close(VAR_2);", "} else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||", "(fs_ctx->export_flags & V9FS_SM_NONE)) {", "VAR_0 = rpath(fs_ctx, VAR_1);", "tsize = readlink(VAR_0, buf, bufsz);", "g_free(VAR_0);", "}", "return tsize;", "}" ]
[ 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ] ]
10,684
static void htab_save_first_pass(QEMUFile *f, sPAPRMachineState *spapr, int64_t max_ns) { bool has_timeout = max_ns != -1; int htabslots = HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; int index = spapr->htab_save_index; int64_t starttime = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); assert(spapr->htab_first_pass); do { int chunkstart; /* Consume invalid HPTEs */ while ((index < htabslots) && !HPTE_VALID(HPTE(spapr->htab, index))) { index++; CLEAN_HPTE(HPTE(spapr->htab, index)); } /* Consume valid HPTEs */ chunkstart = index; while ((index < htabslots) && (index - chunkstart < USHRT_MAX) && HPTE_VALID(HPTE(spapr->htab, index))) { index++; CLEAN_HPTE(HPTE(spapr->htab, index)); } if (index > chunkstart) { int n_valid = index - chunkstart; qemu_put_be32(f, chunkstart); qemu_put_be16(f, n_valid); qemu_put_be16(f, 0); qemu_put_buffer(f, HPTE(spapr->htab, chunkstart), HASH_PTE_SIZE_64 * n_valid); if (has_timeout && (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) > max_ns) { break; } } } while ((index < htabslots) && !qemu_file_rate_limit(f)); if (index >= htabslots) { assert(index == htabslots); index = 0; spapr->htab_first_pass = false; } spapr->htab_save_index = index; }
true
qemu
24ec2863b147aadd8cbd63f87ad0467210164304
static void htab_save_first_pass(QEMUFile *f, sPAPRMachineState *spapr, int64_t max_ns) { bool has_timeout = max_ns != -1; int htabslots = HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; int index = spapr->htab_save_index; int64_t starttime = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); assert(spapr->htab_first_pass); do { int chunkstart; while ((index < htabslots) && !HPTE_VALID(HPTE(spapr->htab, index))) { index++; CLEAN_HPTE(HPTE(spapr->htab, index)); } chunkstart = index; while ((index < htabslots) && (index - chunkstart < USHRT_MAX) && HPTE_VALID(HPTE(spapr->htab, index))) { index++; CLEAN_HPTE(HPTE(spapr->htab, index)); } if (index > chunkstart) { int n_valid = index - chunkstart; qemu_put_be32(f, chunkstart); qemu_put_be16(f, n_valid); qemu_put_be16(f, 0); qemu_put_buffer(f, HPTE(spapr->htab, chunkstart), HASH_PTE_SIZE_64 * n_valid); if (has_timeout && (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) > max_ns) { break; } } } while ((index < htabslots) && !qemu_file_rate_limit(f)); if (index >= htabslots) { assert(index == htabslots); index = 0; spapr->htab_first_pass = false; } spapr->htab_save_index = index; }
{ "code": [ " index++;", " index++;" ], "line_no": [ 33, 33 ] }
static void FUNC_0(QEMUFile *VAR_0, sPAPRMachineState *VAR_1, int64_t VAR_2) { bool has_timeout = VAR_2 != -1; int VAR_3 = HTAB_SIZE(VAR_1) / HASH_PTE_SIZE_64; int VAR_4 = VAR_1->htab_save_index; int64_t starttime = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); assert(VAR_1->htab_first_pass); do { int VAR_5; while ((VAR_4 < VAR_3) && !HPTE_VALID(HPTE(VAR_1->htab, VAR_4))) { VAR_4++; CLEAN_HPTE(HPTE(VAR_1->htab, VAR_4)); } VAR_5 = VAR_4; while ((VAR_4 < VAR_3) && (VAR_4 - VAR_5 < USHRT_MAX) && HPTE_VALID(HPTE(VAR_1->htab, VAR_4))) { VAR_4++; CLEAN_HPTE(HPTE(VAR_1->htab, VAR_4)); } if (VAR_4 > VAR_5) { int VAR_6 = VAR_4 - VAR_5; qemu_put_be32(VAR_0, VAR_5); qemu_put_be16(VAR_0, VAR_6); qemu_put_be16(VAR_0, 0); qemu_put_buffer(VAR_0, HPTE(VAR_1->htab, VAR_5), HASH_PTE_SIZE_64 * VAR_6); if (has_timeout && (qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) > VAR_2) { break; } } } while ((VAR_4 < VAR_3) && !qemu_file_rate_limit(VAR_0)); if (VAR_4 >= VAR_3) { assert(VAR_4 == VAR_3); VAR_4 = 0; VAR_1->htab_first_pass = false; } VAR_1->htab_save_index = VAR_4; }
[ "static void FUNC_0(QEMUFile *VAR_0, sPAPRMachineState *VAR_1,\nint64_t VAR_2)\n{", "bool has_timeout = VAR_2 != -1;", "int VAR_3 = HTAB_SIZE(VAR_1) / HASH_PTE_SIZE_64;", "int VAR_4 = VAR_1->htab_save_index;", "int64_t starttime = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);", "assert(VAR_1->htab_first_pass);", "do {", "int VAR_5;", "while ((VAR_4 < VAR_3)\n&& !HPTE_VALID(HPTE(VAR_1->htab, VAR_4))) {", "VAR_4++;", "CLEAN_HPTE(HPTE(VAR_1->htab, VAR_4));", "}", "VAR_5 = VAR_4;", "while ((VAR_4 < VAR_3) && (VAR_4 - VAR_5 < USHRT_MAX)\n&& HPTE_VALID(HPTE(VAR_1->htab, VAR_4))) {", "VAR_4++;", "CLEAN_HPTE(HPTE(VAR_1->htab, VAR_4));", "}", "if (VAR_4 > VAR_5) {", "int VAR_6 = VAR_4 - VAR_5;", "qemu_put_be32(VAR_0, VAR_5);", "qemu_put_be16(VAR_0, VAR_6);", "qemu_put_be16(VAR_0, 0);", "qemu_put_buffer(VAR_0, HPTE(VAR_1->htab, VAR_5),\nHASH_PTE_SIZE_64 * VAR_6);", "if (has_timeout &&\n(qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) > VAR_2) {", "break;", "}", "}", "} while ((VAR_4 < VAR_3) && !qemu_file_rate_limit(VAR_0));", "if (VAR_4 >= VAR_3) {", "assert(VAR_4 == VAR_3);", "VAR_4 = 0;", "VAR_1->htab_first_pass = false;", "}", "VAR_1->htab_save_index = VAR_4;", "}" ]
[ 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ] ]
10,686
void OPPROTO op_check_addo_64 (void) { if (likely(!(((uint64_t)T2 ^ (uint64_t)T1 ^ UINT64_MAX) & ((uint64_t)T2 ^ (uint64_t)T0) & (1ULL << 63)))) { xer_ov = 0; } else { xer_so = 1; xer_ov = 1; } RETURN(); }
true
qemu
966439a67830239a6c520c5df6c55627b8153c8b
void OPPROTO op_check_addo_64 (void) { if (likely(!(((uint64_t)T2 ^ (uint64_t)T1 ^ UINT64_MAX) & ((uint64_t)T2 ^ (uint64_t)T0) & (1ULL << 63)))) { xer_ov = 0; } else { xer_so = 1; xer_ov = 1; } RETURN(); }
{ "code": [ " xer_so = 1;", " xer_so = 1;", " xer_so = 1;", " xer_so = 1;", " xer_so = 1;", " xer_so = 1;", " xer_so = 1;", " xer_so = 1;", " xer_so = 1;", " xer_so = 1;", " xer_so = 1;", " xer_so = 1;" ], "line_no": [ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13 ] }
void VAR_0 op_check_addo_64 (void) { if (likely(!(((uint64_t)T2 ^ (uint64_t)T1 ^ UINT64_MAX) & ((uint64_t)T2 ^ (uint64_t)T0) & (1ULL << 63)))) { xer_ov = 0; } else { xer_so = 1; xer_ov = 1; } RETURN(); }
[ "void VAR_0 op_check_addo_64 (void)\n{", "if (likely(!(((uint64_t)T2 ^ (uint64_t)T1 ^ UINT64_MAX) &\n((uint64_t)T2 ^ (uint64_t)T0) & (1ULL << 63)))) {", "xer_ov = 0;", "} else {", "xer_so = 1;", "xer_ov = 1;", "}", "RETURN();", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
10,687
static void vnc_dpy_resize(DisplayChangeListener *dcl, DisplayState *ds) { VncDisplay *vd = ds->opaque; VncState *vs; vnc_abort_display_jobs(vd); /* server surface */ qemu_pixman_image_unref(vd->server); vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT, ds_get_width(ds), ds_get_height(ds), NULL, 0); /* guest surface */ #if 0 /* FIXME */ if (ds_get_bytes_per_pixel(ds) != vd->guest.ds->pf.bytes_per_pixel) console_color_init(ds); #endif qemu_pixman_image_unref(vd->guest.fb); vd->guest.fb = pixman_image_ref(ds->surface->image); vd->guest.format = ds->surface->format; memset(vd->guest.dirty, 0xFF, sizeof(vd->guest.dirty)); QTAILQ_FOREACH(vs, &vd->clients, next) { vnc_colordepth(vs); vnc_desktop_resize(vs); if (vs->vd->cursor) { vnc_cursor_define(vs); } memset(vs->dirty, 0xFF, sizeof(vs->dirty)); } }
true
qemu
21ef45d71221b4577330fe3aacfb06afad91ad46
static void vnc_dpy_resize(DisplayChangeListener *dcl, DisplayState *ds) { VncDisplay *vd = ds->opaque; VncState *vs; vnc_abort_display_jobs(vd); qemu_pixman_image_unref(vd->server); vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT, ds_get_width(ds), ds_get_height(ds), NULL, 0); #if 0 if (ds_get_bytes_per_pixel(ds) != vd->guest.ds->pf.bytes_per_pixel) console_color_init(ds); #endif qemu_pixman_image_unref(vd->guest.fb); vd->guest.fb = pixman_image_ref(ds->surface->image); vd->guest.format = ds->surface->format; memset(vd->guest.dirty, 0xFF, sizeof(vd->guest.dirty)); QTAILQ_FOREACH(vs, &vd->clients, next) { vnc_colordepth(vs); vnc_desktop_resize(vs); if (vs->vd->cursor) { vnc_cursor_define(vs); } memset(vs->dirty, 0xFF, sizeof(vs->dirty)); } }
{ "code": [ " VncDisplay *vd = ds->opaque;", " VncDisplay *vd = ds->opaque;", " VncDisplay *vd = ds->opaque;", " VncDisplay *vd = ds->opaque;" ], "line_no": [ 7, 7, 7, 7 ] }
static void FUNC_0(DisplayChangeListener *VAR_0, DisplayState *VAR_1) { VncDisplay *vd = VAR_1->opaque; VncState *vs; vnc_abort_display_jobs(vd); qemu_pixman_image_unref(vd->server); vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT, ds_get_width(VAR_1), ds_get_height(VAR_1), NULL, 0); #if 0 if (ds_get_bytes_per_pixel(VAR_1) != vd->guest.VAR_1->pf.bytes_per_pixel) console_color_init(VAR_1); #endif qemu_pixman_image_unref(vd->guest.fb); vd->guest.fb = pixman_image_ref(VAR_1->surface->image); vd->guest.format = VAR_1->surface->format; memset(vd->guest.dirty, 0xFF, sizeof(vd->guest.dirty)); QTAILQ_FOREACH(vs, &vd->clients, next) { vnc_colordepth(vs); vnc_desktop_resize(vs); if (vs->vd->cursor) { vnc_cursor_define(vs); } memset(vs->dirty, 0xFF, sizeof(vs->dirty)); } }
[ "static void FUNC_0(DisplayChangeListener *VAR_0,\nDisplayState *VAR_1)\n{", "VncDisplay *vd = VAR_1->opaque;", "VncState *vs;", "vnc_abort_display_jobs(vd);", "qemu_pixman_image_unref(vd->server);", "vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT,\nds_get_width(VAR_1),\nds_get_height(VAR_1),\nNULL, 0);", "#if 0\nif (ds_get_bytes_per_pixel(VAR_1) != vd->guest.VAR_1->pf.bytes_per_pixel)\nconsole_color_init(VAR_1);", "#endif\nqemu_pixman_image_unref(vd->guest.fb);", "vd->guest.fb = pixman_image_ref(VAR_1->surface->image);", "vd->guest.format = VAR_1->surface->format;", "memset(vd->guest.dirty, 0xFF, sizeof(vd->guest.dirty));", "QTAILQ_FOREACH(vs, &vd->clients, next) {", "vnc_colordepth(vs);", "vnc_desktop_resize(vs);", "if (vs->vd->cursor) {", "vnc_cursor_define(vs);", "}", "memset(vs->dirty, 0xFF, sizeof(vs->dirty));", "}", "}" ]
[ 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 ], [ 13 ], [ 19 ], [ 21, 23, 25, 27 ], [ 33, 35, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ] ]
10,688
void hbitmap_iter_init(HBitmapIter *hbi, const HBitmap *hb, uint64_t first) { unsigned i, bit; uint64_t pos; hbi->hb = hb; pos = first >> hb->granularity; hbi->pos = pos >> BITS_PER_LEVEL; hbi->granularity = hb->granularity; for (i = HBITMAP_LEVELS; i-- > 0; ) { bit = pos & (BITS_PER_LONG - 1); pos >>= BITS_PER_LEVEL; /* Drop bits representing items before first. */ hbi->cur[i] = hb->levels[i][pos] & ~((1UL << bit) - 1); /* We have already added level i+1, so the lowest set bit has * been processed. Clear it. */ if (i != HBITMAP_LEVELS - 1) { hbi->cur[i] &= ~(1UL << bit); } } }
true
qemu
1b0952445522af73b0e78420a9078b3653923703
void hbitmap_iter_init(HBitmapIter *hbi, const HBitmap *hb, uint64_t first) { unsigned i, bit; uint64_t pos; hbi->hb = hb; pos = first >> hb->granularity; hbi->pos = pos >> BITS_PER_LEVEL; hbi->granularity = hb->granularity; for (i = HBITMAP_LEVELS; i-- > 0; ) { bit = pos & (BITS_PER_LONG - 1); pos >>= BITS_PER_LEVEL; hbi->cur[i] = hb->levels[i][pos] & ~((1UL << bit) - 1); if (i != HBITMAP_LEVELS - 1) { hbi->cur[i] &= ~(1UL << bit); } } }
{ "code": [], "line_no": [] }
void FUNC_0(HBitmapIter *VAR_0, const HBitmap *VAR_1, uint64_t VAR_2) { unsigned VAR_3, VAR_4; uint64_t pos; VAR_0->VAR_1 = VAR_1; pos = VAR_2 >> VAR_1->granularity; VAR_0->pos = pos >> BITS_PER_LEVEL; VAR_0->granularity = VAR_1->granularity; for (VAR_3 = HBITMAP_LEVELS; VAR_3-- > 0; ) { VAR_4 = pos & (BITS_PER_LONG - 1); pos >>= BITS_PER_LEVEL; VAR_0->cur[VAR_3] = VAR_1->levels[VAR_3][pos] & ~((1UL << VAR_4) - 1); if (VAR_3 != HBITMAP_LEVELS - 1) { VAR_0->cur[VAR_3] &= ~(1UL << VAR_4); } } }
[ "void FUNC_0(HBitmapIter *VAR_0, const HBitmap *VAR_1, uint64_t VAR_2)\n{", "unsigned VAR_3, VAR_4;", "uint64_t pos;", "VAR_0->VAR_1 = VAR_1;", "pos = VAR_2 >> VAR_1->granularity;", "VAR_0->pos = pos >> BITS_PER_LEVEL;", "VAR_0->granularity = VAR_1->granularity;", "for (VAR_3 = HBITMAP_LEVELS; VAR_3-- > 0; ) {", "VAR_4 = pos & (BITS_PER_LONG - 1);", "pos >>= BITS_PER_LEVEL;", "VAR_0->cur[VAR_3] = VAR_1->levels[VAR_3][pos] & ~((1UL << VAR_4) - 1);", "if (VAR_3 != HBITMAP_LEVELS - 1) {", "VAR_0->cur[VAR_3] &= ~(1UL << VAR_4);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 16 ], [ 18 ], [ 22 ], [ 24 ], [ 26 ], [ 32 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 50 ] ]
10,689
print_ipc_cmd(int cmd) { #define output_cmd(val) \ if( cmd == val ) { \ gemu_log(#val); \ return; \ } cmd &= 0xff; /* General IPC commands */ output_cmd( IPC_RMID ); output_cmd( IPC_SET ); output_cmd( IPC_STAT ); output_cmd( IPC_INFO ); /* msgctl() commands */ #ifdef __USER_MISC output_cmd( MSG_STAT ); output_cmd( MSG_INFO ); #endif /* shmctl() commands */ output_cmd( SHM_LOCK ); output_cmd( SHM_UNLOCK ); output_cmd( SHM_STAT ); output_cmd( SHM_INFO ); /* semctl() commands */ output_cmd( GETPID ); output_cmd( GETVAL ); output_cmd( GETALL ); output_cmd( GETNCNT ); output_cmd( GETZCNT ); output_cmd( SETVAL ); output_cmd( SETALL ); output_cmd( SEM_STAT ); output_cmd( SEM_INFO ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); /* Some value we don't recognize */ gemu_log("%d",cmd); }
true
qemu
b9a0be9239ef58630c6b436ac7ed2cf0bc3a028d
print_ipc_cmd(int cmd) { #define output_cmd(val) \ if( cmd == val ) { \ gemu_log(#val); \ return; \ } cmd &= 0xff; output_cmd( IPC_RMID ); output_cmd( IPC_SET ); output_cmd( IPC_STAT ); output_cmd( IPC_INFO ); #ifdef __USER_MISC output_cmd( MSG_STAT ); output_cmd( MSG_INFO ); #endif output_cmd( SHM_LOCK ); output_cmd( SHM_UNLOCK ); output_cmd( SHM_STAT ); output_cmd( SHM_INFO ); output_cmd( GETPID ); output_cmd( GETVAL ); output_cmd( GETALL ); output_cmd( GETNCNT ); output_cmd( GETZCNT ); output_cmd( SETVAL ); output_cmd( SETALL ); output_cmd( SEM_STAT ); output_cmd( SEM_INFO ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); gemu_log("%d",cmd); }
{ "code": [ " #ifdef __USER_MISC", " #endif" ], "line_no": [ 33, 39 ] }
FUNC_0(int VAR_0) { #define output_cmd(val) \ if( VAR_0 == val ) { \ gemu_log(#val); \ return; \ } VAR_0 &= 0xff; output_cmd( IPC_RMID ); output_cmd( IPC_SET ); output_cmd( IPC_STAT ); output_cmd( IPC_INFO ); #ifdef __USER_MISC output_cmd( MSG_STAT ); output_cmd( MSG_INFO ); #endif output_cmd( SHM_LOCK ); output_cmd( SHM_UNLOCK ); output_cmd( SHM_STAT ); output_cmd( SHM_INFO ); output_cmd( GETPID ); output_cmd( GETVAL ); output_cmd( GETALL ); output_cmd( GETNCNT ); output_cmd( GETZCNT ); output_cmd( SETVAL ); output_cmd( SETALL ); output_cmd( SEM_STAT ); output_cmd( SEM_INFO ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); output_cmd( IPC_RMID ); gemu_log("%d",VAR_0); }
[ "FUNC_0(int VAR_0)\n{", "#define output_cmd(val) \\\nif( VAR_0 == val ) { \\", "gemu_log(#val); \\", "return; \\", "}", "VAR_0 &= 0xff;", "output_cmd( IPC_RMID );", "output_cmd( IPC_SET );", "output_cmd( IPC_STAT );", "output_cmd( IPC_INFO );", "#ifdef __USER_MISC\noutput_cmd( MSG_STAT );", "output_cmd( MSG_INFO );", "#endif\noutput_cmd( SHM_LOCK );", "output_cmd( SHM_UNLOCK );", "output_cmd( SHM_STAT );", "output_cmd( SHM_INFO );", "output_cmd( GETPID );", "output_cmd( GETVAL );", "output_cmd( GETALL );", "output_cmd( GETNCNT );", "output_cmd( GETZCNT );", "output_cmd( SETVAL );", "output_cmd( SETALL );", "output_cmd( SEM_STAT );", "output_cmd( SEM_INFO );", "output_cmd( IPC_RMID );", "output_cmd( IPC_RMID );", "output_cmd( IPC_RMID );", "output_cmd( IPC_RMID );", "output_cmd( IPC_RMID );", "output_cmd( IPC_RMID );", "output_cmd( IPC_RMID );", "output_cmd( IPC_RMID );", "output_cmd( IPC_RMID );", "gemu_log(\"%d\",VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 37 ], [ 39, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 93 ], [ 95 ] ]
10,690
static void extract_mpeg4_header(AVFormatContext *infile) { int mpeg4_count, i, size; AVPacket pkt; AVStream *st; const uint8_t *p; mpeg4_count = 0; for(i=0;i<infile->nb_streams;i++) { st = infile->streams[i]; if (st->codec.codec_id == CODEC_ID_MPEG4 && st->codec.extradata_size == 0) { mpeg4_count++; } } if (!mpeg4_count) return; printf("MPEG4 without extra data: trying to find header\n"); while (mpeg4_count > 0) { if (av_read_packet(infile, &pkt) < 0) break; st = infile->streams[pkt.stream_index]; if (st->codec.codec_id == CODEC_ID_MPEG4 && st->codec.extradata_size == 0) { av_freep(&st->codec.extradata); /* fill extradata with the header */ /* XXX: we make hard suppositions here ! */ p = pkt.data; while (p < pkt.data + pkt.size - 4) { /* stop when vop header is found */ if (p[0] == 0x00 && p[1] == 0x00 && p[2] == 0x01 && p[3] == 0xb6) { size = p - pkt.data; // av_hex_dump(pkt.data, size); st->codec.extradata = av_malloc(size); st->codec.extradata_size = size; memcpy(st->codec.extradata, pkt.data, size); break; } p++; } mpeg4_count--; } av_free_packet(&pkt); } }
true
FFmpeg
d445a7e9cc31b94ab1eceb228a7634c79d37496e
static void extract_mpeg4_header(AVFormatContext *infile) { int mpeg4_count, i, size; AVPacket pkt; AVStream *st; const uint8_t *p; mpeg4_count = 0; for(i=0;i<infile->nb_streams;i++) { st = infile->streams[i]; if (st->codec.codec_id == CODEC_ID_MPEG4 && st->codec.extradata_size == 0) { mpeg4_count++; } } if (!mpeg4_count) return; printf("MPEG4 without extra data: trying to find header\n"); while (mpeg4_count > 0) { if (av_read_packet(infile, &pkt) < 0) break; st = infile->streams[pkt.stream_index]; if (st->codec.codec_id == CODEC_ID_MPEG4 && st->codec.extradata_size == 0) { av_freep(&st->codec.extradata); p = pkt.data; while (p < pkt.data + pkt.size - 4) { if (p[0] == 0x00 && p[1] == 0x00 && p[2] == 0x01 && p[3] == 0xb6) { size = p - pkt.data; st->codec.extradata = av_malloc(size); st->codec.extradata_size = size; memcpy(st->codec.extradata, pkt.data, size); break; } p++; } mpeg4_count--; } av_free_packet(&pkt); } }
{ "code": [ " printf(\"MPEG4 without extra data: trying to find header\\n\");" ], "line_no": [ 37 ] }
static void FUNC_0(AVFormatContext *VAR_0) { int VAR_1, VAR_2, VAR_3; AVPacket pkt; AVStream *st; const uint8_t *VAR_4; VAR_1 = 0; for(VAR_2=0;VAR_2<VAR_0->nb_streams;VAR_2++) { st = VAR_0->streams[VAR_2]; if (st->codec.codec_id == CODEC_ID_MPEG4 && st->codec.extradata_size == 0) { VAR_1++; } } if (!VAR_1) return; printf("MPEG4 without extra data: trying to find header\n"); while (VAR_1 > 0) { if (av_read_packet(VAR_0, &pkt) < 0) break; st = VAR_0->streams[pkt.stream_index]; if (st->codec.codec_id == CODEC_ID_MPEG4 && st->codec.extradata_size == 0) { av_freep(&st->codec.extradata); VAR_4 = pkt.data; while (VAR_4 < pkt.data + pkt.VAR_3 - 4) { if (VAR_4[0] == 0x00 && VAR_4[1] == 0x00 && VAR_4[2] == 0x01 && VAR_4[3] == 0xb6) { VAR_3 = VAR_4 - pkt.data; st->codec.extradata = av_malloc(VAR_3); st->codec.extradata_size = VAR_3; memcpy(st->codec.extradata, pkt.data, VAR_3); break; } VAR_4++; } VAR_1--; } av_free_packet(&pkt); } }
[ "static void FUNC_0(AVFormatContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3;", "AVPacket pkt;", "AVStream *st;", "const uint8_t *VAR_4;", "VAR_1 = 0;", "for(VAR_2=0;VAR_2<VAR_0->nb_streams;VAR_2++) {", "st = VAR_0->streams[VAR_2];", "if (st->codec.codec_id == CODEC_ID_MPEG4 &&\nst->codec.extradata_size == 0) {", "VAR_1++;", "}", "}", "if (!VAR_1)\nreturn;", "printf(\"MPEG4 without extra data: trying to find header\\n\");", "while (VAR_1 > 0) {", "if (av_read_packet(VAR_0, &pkt) < 0)\nbreak;", "st = VAR_0->streams[pkt.stream_index];", "if (st->codec.codec_id == CODEC_ID_MPEG4 &&\nst->codec.extradata_size == 0) {", "av_freep(&st->codec.extradata);", "VAR_4 = pkt.data;", "while (VAR_4 < pkt.data + pkt.VAR_3 - 4) {", "if (VAR_4[0] == 0x00 && VAR_4[1] == 0x00 &&\nVAR_4[2] == 0x01 && VAR_4[3] == 0xb6) {", "VAR_3 = VAR_4 - pkt.data;", "st->codec.extradata = av_malloc(VAR_3);", "st->codec.extradata_size = VAR_3;", "memcpy(st->codec.extradata, pkt.data, VAR_3);", "break;", "}", "VAR_4++;", "}", "VAR_1--;", "}", "av_free_packet(&pkt);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 57 ], [ 59 ], [ 63, 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
10,691
void avfilter_unref_buffer(AVFilterBufferRef *ref) { if (!ref) return; av_assert0(ref->buf->refcount > 0); if (!(--ref->buf->refcount)) { if (!ref->buf->free) { store_in_pool(ref); return; } ref->buf->free(ref->buf); } if (ref->extended_data != ref->data) av_freep(&ref->extended_data); if (ref->video) av_freep(&ref->video->qp_table); av_freep(&ref->video); av_freep(&ref->audio); av_free(ref); }
true
FFmpeg
6fb2fd895e858ab93f46e656a322778ee181c307
void avfilter_unref_buffer(AVFilterBufferRef *ref) { if (!ref) return; av_assert0(ref->buf->refcount > 0); if (!(--ref->buf->refcount)) { if (!ref->buf->free) { store_in_pool(ref); return; } ref->buf->free(ref->buf); } if (ref->extended_data != ref->data) av_freep(&ref->extended_data); if (ref->video) av_freep(&ref->video->qp_table); av_freep(&ref->video); av_freep(&ref->audio); av_free(ref); }
{ "code": [], "line_no": [] }
void FUNC_0(AVFilterBufferRef *VAR_0) { if (!VAR_0) return; av_assert0(VAR_0->buf->refcount > 0); if (!(--VAR_0->buf->refcount)) { if (!VAR_0->buf->free) { store_in_pool(VAR_0); return; } VAR_0->buf->free(VAR_0->buf); } if (VAR_0->extended_data != VAR_0->data) av_freep(&VAR_0->extended_data); if (VAR_0->video) av_freep(&VAR_0->video->qp_table); av_freep(&VAR_0->video); av_freep(&VAR_0->audio); av_free(VAR_0); }
[ "void FUNC_0(AVFilterBufferRef *VAR_0)\n{", "if (!VAR_0)\nreturn;", "av_assert0(VAR_0->buf->refcount > 0);", "if (!(--VAR_0->buf->refcount)) {", "if (!VAR_0->buf->free) {", "store_in_pool(VAR_0);", "return;", "}", "VAR_0->buf->free(VAR_0->buf);", "}", "if (VAR_0->extended_data != VAR_0->data)\nav_freep(&VAR_0->extended_data);", "if (VAR_0->video)\nav_freep(&VAR_0->video->qp_table);", "av_freep(&VAR_0->video);", "av_freep(&VAR_0->audio);", "av_free(VAR_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 ], [ 38 ], [ 40 ] ]
10,693
QmpInputVisitor *qmp_input_visitor_new(QObject *obj, bool strict) { QmpInputVisitor *v; v = g_malloc0(sizeof(*v)); v->visitor.type = VISITOR_INPUT; v->visitor.start_struct = qmp_input_start_struct; v->visitor.end_struct = qmp_input_end_struct; v->visitor.start_list = qmp_input_start_list; v->visitor.next_list = qmp_input_next_list; v->visitor.end_list = qmp_input_end_list; v->visitor.start_alternate = qmp_input_start_alternate; v->visitor.type_int64 = qmp_input_type_int64; v->visitor.type_uint64 = qmp_input_type_uint64; v->visitor.type_bool = qmp_input_type_bool; v->visitor.type_str = qmp_input_type_str; v->visitor.type_number = qmp_input_type_number; v->visitor.type_any = qmp_input_type_any; v->visitor.type_null = qmp_input_type_null; v->visitor.optional = qmp_input_optional; v->strict = strict; v->root = obj; qobject_incref(obj); return v; }
true
qemu
15c2f669e3fb2bc97f7b42d1871f595c0ac24af8
QmpInputVisitor *qmp_input_visitor_new(QObject *obj, bool strict) { QmpInputVisitor *v; v = g_malloc0(sizeof(*v)); v->visitor.type = VISITOR_INPUT; v->visitor.start_struct = qmp_input_start_struct; v->visitor.end_struct = qmp_input_end_struct; v->visitor.start_list = qmp_input_start_list; v->visitor.next_list = qmp_input_next_list; v->visitor.end_list = qmp_input_end_list; v->visitor.start_alternate = qmp_input_start_alternate; v->visitor.type_int64 = qmp_input_type_int64; v->visitor.type_uint64 = qmp_input_type_uint64; v->visitor.type_bool = qmp_input_type_bool; v->visitor.type_str = qmp_input_type_str; v->visitor.type_number = qmp_input_type_number; v->visitor.type_any = qmp_input_type_any; v->visitor.type_null = qmp_input_type_null; v->visitor.optional = qmp_input_optional; v->strict = strict; v->root = obj; qobject_incref(obj); return v; }
{ "code": [ " v->visitor.end_struct = qmp_input_end_struct;", " v->visitor.end_list = qmp_input_end_list;" ], "line_no": [ 17, 23 ] }
QmpInputVisitor *FUNC_0(QObject *obj, bool strict) { QmpInputVisitor *v; v = g_malloc0(sizeof(*v)); v->visitor.type = VISITOR_INPUT; v->visitor.start_struct = qmp_input_start_struct; v->visitor.end_struct = qmp_input_end_struct; v->visitor.start_list = qmp_input_start_list; v->visitor.next_list = qmp_input_next_list; v->visitor.end_list = qmp_input_end_list; v->visitor.start_alternate = qmp_input_start_alternate; v->visitor.type_int64 = qmp_input_type_int64; v->visitor.type_uint64 = qmp_input_type_uint64; v->visitor.type_bool = qmp_input_type_bool; v->visitor.type_str = qmp_input_type_str; v->visitor.type_number = qmp_input_type_number; v->visitor.type_any = qmp_input_type_any; v->visitor.type_null = qmp_input_type_null; v->visitor.optional = qmp_input_optional; v->strict = strict; v->root = obj; qobject_incref(obj); return v; }
[ "QmpInputVisitor *FUNC_0(QObject *obj, bool strict)\n{", "QmpInputVisitor *v;", "v = g_malloc0(sizeof(*v));", "v->visitor.type = VISITOR_INPUT;", "v->visitor.start_struct = qmp_input_start_struct;", "v->visitor.end_struct = qmp_input_end_struct;", "v->visitor.start_list = qmp_input_start_list;", "v->visitor.next_list = qmp_input_next_list;", "v->visitor.end_list = qmp_input_end_list;", "v->visitor.start_alternate = qmp_input_start_alternate;", "v->visitor.type_int64 = qmp_input_type_int64;", "v->visitor.type_uint64 = qmp_input_type_uint64;", "v->visitor.type_bool = qmp_input_type_bool;", "v->visitor.type_str = qmp_input_type_str;", "v->visitor.type_number = qmp_input_type_number;", "v->visitor.type_any = qmp_input_type_any;", "v->visitor.type_null = qmp_input_type_null;", "v->visitor.optional = qmp_input_optional;", "v->strict = strict;", "v->root = obj;", "qobject_incref(obj);", "return v;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 1, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ] ]
10,694
static void imx_eth_enable_rx(IMXFECState *s) { IMXFECBufDesc bd; bool rx_ring_full; imx_fec_read_bd(&bd, s->rx_descriptor); rx_ring_full = !(bd.flags & ENET_BD_E); if (rx_ring_full) { FEC_PRINTF("RX buffer full\n"); } else if (!s->regs[ENET_RDAR]) { qemu_flush_queued_packets(qemu_get_queue(s->nic)); } s->regs[ENET_RDAR] = rx_ring_full ? 0 : ENET_RDAR_RDAR; }
true
qemu
b2b012afdd9c03ba8a1619f45301d34f358d367b
static void imx_eth_enable_rx(IMXFECState *s) { IMXFECBufDesc bd; bool rx_ring_full; imx_fec_read_bd(&bd, s->rx_descriptor); rx_ring_full = !(bd.flags & ENET_BD_E); if (rx_ring_full) { FEC_PRINTF("RX buffer full\n"); } else if (!s->regs[ENET_RDAR]) { qemu_flush_queued_packets(qemu_get_queue(s->nic)); } s->regs[ENET_RDAR] = rx_ring_full ? 0 : ENET_RDAR_RDAR; }
{ "code": [ "static void imx_eth_enable_rx(IMXFECState *s)", " } else if (!s->regs[ENET_RDAR]) {" ], "line_no": [ 1, 23 ] }
static void FUNC_0(IMXFECState *VAR_0) { IMXFECBufDesc bd; bool rx_ring_full; imx_fec_read_bd(&bd, VAR_0->rx_descriptor); rx_ring_full = !(bd.flags & ENET_BD_E); if (rx_ring_full) { FEC_PRINTF("RX buffer full\n"); } else if (!VAR_0->regs[ENET_RDAR]) { qemu_flush_queued_packets(qemu_get_queue(VAR_0->nic)); } VAR_0->regs[ENET_RDAR] = rx_ring_full ? 0 : ENET_RDAR_RDAR; }
[ "static void FUNC_0(IMXFECState *VAR_0)\n{", "IMXFECBufDesc bd;", "bool rx_ring_full;", "imx_fec_read_bd(&bd, VAR_0->rx_descriptor);", "rx_ring_full = !(bd.flags & ENET_BD_E);", "if (rx_ring_full) {", "FEC_PRINTF(\"RX buffer full\\n\");", "} else if (!VAR_0->regs[ENET_RDAR]) {", "qemu_flush_queued_packets(qemu_get_queue(VAR_0->nic));", "}", "VAR_0->regs[ENET_RDAR] = rx_ring_full ? 0 : ENET_RDAR_RDAR;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ] ]
10,695
static inline void FUNC(idctSparseColAdd)(pixel *dest, int line_size, DCTELEM *col) { int a0, a1, a2, a3, b0, b1, b2, b3; INIT_CLIP; IDCT_COLS; dest[0] = CLIP(dest[0] + ((a0 + b0) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a1 + b1) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a2 + b2) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a3 + b3) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a3 - b3) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a2 - b2) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a1 - b1) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a0 - b0) >> COL_SHIFT)); }
true
FFmpeg
c23acbaed40101c677dfcfbbfe0d2c230a8e8f44
static inline void FUNC(idctSparseColAdd)(pixel *dest, int line_size, DCTELEM *col) { int a0, a1, a2, a3, b0, b1, b2, b3; INIT_CLIP; IDCT_COLS; dest[0] = CLIP(dest[0] + ((a0 + b0) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a1 + b1) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a2 + b2) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a3 + b3) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a3 - b3) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a2 - b2) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a1 - b1) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((a0 - b0) >> COL_SHIFT)); }
{ "code": [ " INIT_CLIP;", " INIT_CLIP;", " dest[0] = CLIP(dest[0] + ((a0 + b0) >> COL_SHIFT));", " dest[0] = CLIP(dest[0] + ((a1 + b1) >> COL_SHIFT));", " dest[0] = CLIP(dest[0] + ((a2 + b2) >> COL_SHIFT));", " dest[0] = CLIP(dest[0] + ((a3 + b3) >> COL_SHIFT));", " dest[0] = CLIP(dest[0] + ((a3 - b3) >> COL_SHIFT));", " dest[0] = CLIP(dest[0] + ((a2 - b2) >> COL_SHIFT));", " dest[0] = CLIP(dest[0] + ((a1 - b1) >> COL_SHIFT));", " dest[0] = CLIP(dest[0] + ((a0 - b0) >> COL_SHIFT));" ], "line_no": [ 9, 9, 17, 21, 25, 29, 33, 37, 41, 45 ] }
static inline void FUNC_0(idctSparseColAdd)(pixel *dest, int line_size, DCTELEM *col) { int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; INIT_CLIP; IDCT_COLS; dest[0] = CLIP(dest[0] + ((VAR_0 + VAR_4) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((VAR_1 + VAR_5) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((VAR_2 + VAR_6) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((VAR_3 + VAR_7) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((VAR_3 - VAR_7) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((VAR_2 - VAR_6) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((VAR_1 - VAR_5) >> COL_SHIFT)); dest += line_size; dest[0] = CLIP(dest[0] + ((VAR_0 - VAR_4) >> COL_SHIFT)); }
[ "static inline void FUNC_0(idctSparseColAdd)(pixel *dest, int line_size,\nDCTELEM *col)\n{", "int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;", "INIT_CLIP;", "IDCT_COLS;", "dest[0] = CLIP(dest[0] + ((VAR_0 + VAR_4) >> COL_SHIFT));", "dest += line_size;", "dest[0] = CLIP(dest[0] + ((VAR_1 + VAR_5) >> COL_SHIFT));", "dest += line_size;", "dest[0] = CLIP(dest[0] + ((VAR_2 + VAR_6) >> COL_SHIFT));", "dest += line_size;", "dest[0] = CLIP(dest[0] + ((VAR_3 + VAR_7) >> COL_SHIFT));", "dest += line_size;", "dest[0] = CLIP(dest[0] + ((VAR_3 - VAR_7) >> COL_SHIFT));", "dest += line_size;", "dest[0] = CLIP(dest[0] + ((VAR_2 - VAR_6) >> COL_SHIFT));", "dest += line_size;", "dest[0] = CLIP(dest[0] + ((VAR_1 - VAR_5) >> COL_SHIFT));", "dest += line_size;", "dest[0] = CLIP(dest[0] + ((VAR_0 - VAR_4) >> COL_SHIFT));", "}" ]
[ 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
10,696
static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) { BFIContext *bfi = s->priv_data; AVIOContext *pb = s->pb; int ret, audio_offset, video_offset, chunk_size, audio_size = 0; if (bfi->nframes == 0 || pb->eof_reached) { return AVERROR(EIO); /* If all previous chunks were completely read, then find a new one... */ if (!bfi->avflag) { uint32_t state = 0; while(state != MKTAG('S','A','V','I')){ if (pb->eof_reached) return AVERROR(EIO); state = 256*state + avio_r8(pb); /* Now that the chunk's location is confirmed, we proceed... */ chunk_size = avio_rl32(pb); avio_rl32(pb); audio_offset = avio_rl32(pb); avio_rl32(pb); video_offset = avio_rl32(pb); audio_size = video_offset - audio_offset; bfi->video_size = chunk_size - video_offset; //Tossing an audio packet at the audio decoder. ret = av_get_packet(pb, pkt, audio_size); if (ret < 0) return ret; pkt->pts = bfi->audio_frame; bfi->audio_frame += ret; } else if (bfi->video_size > 0) { //Tossing a video packet at the video decoder. ret = av_get_packet(pb, pkt, bfi->video_size); if (ret < 0) return ret; pkt->pts = bfi->video_frame; bfi->video_frame += ret / bfi->video_size; /* One less frame to read. A cursory decrement. */ bfi->nframes--; } else { /* Empty video packet */ ret = AVERROR(EAGAIN); bfi->avflag = !bfi->avflag; pkt->stream_index = bfi->avflag; return ret;
true
FFmpeg
640a2427aafa774b83316b7a8c5c2bdc28bfd269
static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) { BFIContext *bfi = s->priv_data; AVIOContext *pb = s->pb; int ret, audio_offset, video_offset, chunk_size, audio_size = 0; if (bfi->nframes == 0 || pb->eof_reached) { return AVERROR(EIO); if (!bfi->avflag) { uint32_t state = 0; while(state != MKTAG('S','A','V','I')){ if (pb->eof_reached) return AVERROR(EIO); state = 256*state + avio_r8(pb); chunk_size = avio_rl32(pb); avio_rl32(pb); audio_offset = avio_rl32(pb); avio_rl32(pb); video_offset = avio_rl32(pb); audio_size = video_offset - audio_offset; bfi->video_size = chunk_size - video_offset; ret = av_get_packet(pb, pkt, audio_size); if (ret < 0) return ret; pkt->pts = bfi->audio_frame; bfi->audio_frame += ret; } else if (bfi->video_size > 0) { ret = av_get_packet(pb, pkt, bfi->video_size); if (ret < 0) return ret; pkt->pts = bfi->video_frame; bfi->video_frame += ret / bfi->video_size; bfi->nframes--; } else { ret = AVERROR(EAGAIN); bfi->avflag = !bfi->avflag; pkt->stream_index = bfi->avflag; return ret;
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext * VAR_0, AVPacket * VAR_1) { BFIContext *bfi = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6 = 0; if (bfi->nframes == 0 || pb->eof_reached) { return AVERROR(EIO); if (!bfi->avflag) { uint32_t state = 0; while(state != MKTAG('S','A','V','I')){ if (pb->eof_reached) return AVERROR(EIO); state = 256*state + avio_r8(pb); VAR_5 = avio_rl32(pb); avio_rl32(pb); VAR_3 = avio_rl32(pb); avio_rl32(pb); VAR_4 = avio_rl32(pb); VAR_6 = VAR_4 - VAR_3; bfi->video_size = VAR_5 - VAR_4; VAR_2 = av_get_packet(pb, VAR_1, VAR_6); if (VAR_2 < 0) return VAR_2; VAR_1->pts = bfi->audio_frame; bfi->audio_frame += VAR_2; } else if (bfi->video_size > 0) { VAR_2 = av_get_packet(pb, VAR_1, bfi->video_size); if (VAR_2 < 0) return VAR_2; VAR_1->pts = bfi->video_frame; bfi->video_frame += VAR_2 / bfi->video_size; bfi->nframes--; } else { VAR_2 = AVERROR(EAGAIN); bfi->avflag = !bfi->avflag; VAR_1->stream_index = bfi->avflag; return VAR_2;
[ "static int FUNC_0(AVFormatContext * VAR_0, AVPacket * VAR_1)\n{", "BFIContext *bfi = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6 = 0;", "if (bfi->nframes == 0 || pb->eof_reached) {", "return AVERROR(EIO);", "if (!bfi->avflag) {", "uint32_t state = 0;", "while(state != MKTAG('S','A','V','I')){", "if (pb->eof_reached)\nreturn AVERROR(EIO);", "state = 256*state + avio_r8(pb);", "VAR_5 = avio_rl32(pb);", "avio_rl32(pb);", "VAR_3 = avio_rl32(pb);", "avio_rl32(pb);", "VAR_4 = avio_rl32(pb);", "VAR_6 = VAR_4 - VAR_3;", "bfi->video_size = VAR_5 - VAR_4;", "VAR_2 = av_get_packet(pb, VAR_1, VAR_6);", "if (VAR_2 < 0)\nreturn VAR_2;", "VAR_1->pts = bfi->audio_frame;", "bfi->audio_frame += VAR_2;", "} else if (bfi->video_size > 0) {", "VAR_2 = av_get_packet(pb, VAR_1, bfi->video_size);", "if (VAR_2 < 0)\nreturn VAR_2;", "VAR_1->pts = bfi->video_frame;", "bfi->video_frame += VAR_2 / bfi->video_size;", "bfi->nframes--;", "} else {", "VAR_2 = AVERROR(EAGAIN);", "bfi->avflag = !bfi->avflag;", "VAR_1->stream_index = bfi->avflag;", "return VAR_2;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 20 ], [ 22 ], [ 24 ], [ 26, 28 ], [ 30 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 57 ], [ 59, 61 ], [ 65 ], [ 67 ], [ 69 ], [ 75 ], [ 77, 79 ], [ 83 ], [ 85 ], [ 91 ], [ 93 ], [ 97 ], [ 102 ], [ 104 ], [ 106 ] ]
10,697
static int mpc7_decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MPCContext *c = avctx->priv_data; GetBitContext gb; uint8_t *bits; int i, ch, t; int mb = -1; Band *bands = c->bands; int off; int bits_used, bits_avail; memset(bands, 0, sizeof(bands)); if(buf_size <= 4){ av_log(avctx, AV_LOG_ERROR, "Too small buffer passed (%i bytes)\n", buf_size); } bits = av_malloc(((buf_size - 1) & ~3) + FF_INPUT_BUFFER_PADDING_SIZE); c->dsp.bswap_buf((uint32_t*)bits, (const uint32_t*)(buf + 4), (buf_size - 4) >> 2); init_get_bits(&gb, bits, (buf_size - 4)* 8); skip_bits(&gb, buf[0]); /* read subband indexes */ for(i = 0; i <= c->maxbands; i++){ for(ch = 0; ch < 2; ch++){ if(i) t = get_vlc2(&gb, hdr_vlc.table, MPC7_HDR_BITS, 1) - 5; if(!i || (t == 4)) bands[i].res[ch] = get_bits(&gb, 4); else bands[i].res[ch] = bands[i-1].res[ch] + t; } if(bands[i].res[0] || bands[i].res[1]){ mb = i; if(c->MSS) bands[i].msf = get_bits1(&gb); } } /* get scale indexes coding method */ for(i = 0; i <= mb; i++) for(ch = 0; ch < 2; ch++) if(bands[i].res[ch]) bands[i].scfi[ch] = get_vlc2(&gb, scfi_vlc.table, MPC7_SCFI_BITS, 1); /* get scale indexes */ for(i = 0; i <= mb; i++){ for(ch = 0; ch < 2; ch++){ if(bands[i].res[ch]){ bands[i].scf_idx[ch][2] = c->oldDSCF[ch][i]; bands[i].scf_idx[ch][0] = get_scale_idx(&gb, bands[i].scf_idx[ch][2]); switch(bands[i].scfi[ch]){ case 0: bands[i].scf_idx[ch][1] = get_scale_idx(&gb, bands[i].scf_idx[ch][0]); bands[i].scf_idx[ch][2] = get_scale_idx(&gb, bands[i].scf_idx[ch][1]); break; case 1: bands[i].scf_idx[ch][1] = get_scale_idx(&gb, bands[i].scf_idx[ch][0]); bands[i].scf_idx[ch][2] = bands[i].scf_idx[ch][1]; break; case 2: bands[i].scf_idx[ch][1] = bands[i].scf_idx[ch][0]; bands[i].scf_idx[ch][2] = get_scale_idx(&gb, bands[i].scf_idx[ch][1]); break; case 3: bands[i].scf_idx[ch][2] = bands[i].scf_idx[ch][1] = bands[i].scf_idx[ch][0]; break; } c->oldDSCF[ch][i] = bands[i].scf_idx[ch][2]; } } } /* get quantizers */ memset(c->Q, 0, sizeof(c->Q)); off = 0; for(i = 0; i < BANDS; i++, off += SAMPLES_PER_BAND) for(ch = 0; ch < 2; ch++) idx_to_quant(c, &gb, bands[i].res[ch], c->Q[ch] + off); ff_mpc_dequantize_and_synth(c, mb, data); av_free(bits); bits_used = get_bits_count(&gb); bits_avail = (buf_size - 4) * 8; if(!buf[1] && ((bits_avail < bits_used) || (bits_used + 32 <= bits_avail))){ av_log(NULL,0, "Error decoding frame: used %i of %i bits\n", bits_used, bits_avail); return -1; } if(c->frames_to_skip){ c->frames_to_skip--; *data_size = 0; return buf_size; } *data_size = (buf[1] ? c->lastframelen : MPC_FRAME_SIZE) * 4; return buf_size; }
true
FFmpeg
836fc7778513fa97c1852444155f82627ecbb8cd
static int mpc7_decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MPCContext *c = avctx->priv_data; GetBitContext gb; uint8_t *bits; int i, ch, t; int mb = -1; Band *bands = c->bands; int off; int bits_used, bits_avail; memset(bands, 0, sizeof(bands)); if(buf_size <= 4){ av_log(avctx, AV_LOG_ERROR, "Too small buffer passed (%i bytes)\n", buf_size); } bits = av_malloc(((buf_size - 1) & ~3) + FF_INPUT_BUFFER_PADDING_SIZE); c->dsp.bswap_buf((uint32_t*)bits, (const uint32_t*)(buf + 4), (buf_size - 4) >> 2); init_get_bits(&gb, bits, (buf_size - 4)* 8); skip_bits(&gb, buf[0]); for(i = 0; i <= c->maxbands; i++){ for(ch = 0; ch < 2; ch++){ if(i) t = get_vlc2(&gb, hdr_vlc.table, MPC7_HDR_BITS, 1) - 5; if(!i || (t == 4)) bands[i].res[ch] = get_bits(&gb, 4); else bands[i].res[ch] = bands[i-1].res[ch] + t; } if(bands[i].res[0] || bands[i].res[1]){ mb = i; if(c->MSS) bands[i].msf = get_bits1(&gb); } } for(i = 0; i <= mb; i++) for(ch = 0; ch < 2; ch++) if(bands[i].res[ch]) bands[i].scfi[ch] = get_vlc2(&gb, scfi_vlc.table, MPC7_SCFI_BITS, 1); for(i = 0; i <= mb; i++){ for(ch = 0; ch < 2; ch++){ if(bands[i].res[ch]){ bands[i].scf_idx[ch][2] = c->oldDSCF[ch][i]; bands[i].scf_idx[ch][0] = get_scale_idx(&gb, bands[i].scf_idx[ch][2]); switch(bands[i].scfi[ch]){ case 0: bands[i].scf_idx[ch][1] = get_scale_idx(&gb, bands[i].scf_idx[ch][0]); bands[i].scf_idx[ch][2] = get_scale_idx(&gb, bands[i].scf_idx[ch][1]); break; case 1: bands[i].scf_idx[ch][1] = get_scale_idx(&gb, bands[i].scf_idx[ch][0]); bands[i].scf_idx[ch][2] = bands[i].scf_idx[ch][1]; break; case 2: bands[i].scf_idx[ch][1] = bands[i].scf_idx[ch][0]; bands[i].scf_idx[ch][2] = get_scale_idx(&gb, bands[i].scf_idx[ch][1]); break; case 3: bands[i].scf_idx[ch][2] = bands[i].scf_idx[ch][1] = bands[i].scf_idx[ch][0]; break; } c->oldDSCF[ch][i] = bands[i].scf_idx[ch][2]; } } } memset(c->Q, 0, sizeof(c->Q)); off = 0; for(i = 0; i < BANDS; i++, off += SAMPLES_PER_BAND) for(ch = 0; ch < 2; ch++) idx_to_quant(c, &gb, bands[i].res[ch], c->Q[ch] + off); ff_mpc_dequantize_and_synth(c, mb, data); av_free(bits); bits_used = get_bits_count(&gb); bits_avail = (buf_size - 4) * 8; if(!buf[1] && ((bits_avail < bits_used) || (bits_used + 32 <= bits_avail))){ av_log(NULL,0, "Error decoding frame: used %i of %i bits\n", bits_used, bits_avail); return -1; } if(c->frames_to_skip){ c->frames_to_skip--; *data_size = 0; return buf_size; } *data_size = (buf[1] ? c->lastframelen : MPC_FRAME_SIZE) * 4; return buf_size; }
{ "code": [ " int i, ch, t;", " if(!i || (t == 4)) bands[i].res[ch] = get_bits(&gb, 4);" ], "line_no": [ 19, 59 ] }
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; MPCContext *c = VAR_0->priv_data; GetBitContext gb; uint8_t *bits; int VAR_6, VAR_7, VAR_8; int VAR_9 = -1; Band *bands = c->bands; int VAR_10; int VAR_11, VAR_12; memset(bands, 0, sizeof(bands)); if(VAR_5 <= 4){ av_log(VAR_0, AV_LOG_ERROR, "Too small buffer passed (%VAR_6 bytes)\n", VAR_5); } bits = av_malloc(((VAR_5 - 1) & ~3) + FF_INPUT_BUFFER_PADDING_SIZE); c->dsp.bswap_buf((uint32_t*)bits, (const uint32_t*)(VAR_4 + 4), (VAR_5 - 4) >> 2); init_get_bits(&gb, bits, (VAR_5 - 4)* 8); skip_bits(&gb, VAR_4[0]); for(VAR_6 = 0; VAR_6 <= c->maxbands; VAR_6++){ for(VAR_7 = 0; VAR_7 < 2; VAR_7++){ if(VAR_6) VAR_8 = get_vlc2(&gb, hdr_vlc.table, MPC7_HDR_BITS, 1) - 5; if(!VAR_6 || (VAR_8 == 4)) bands[VAR_6].res[VAR_7] = get_bits(&gb, 4); else bands[VAR_6].res[VAR_7] = bands[VAR_6-1].res[VAR_7] + VAR_8; } if(bands[VAR_6].res[0] || bands[VAR_6].res[1]){ VAR_9 = VAR_6; if(c->MSS) bands[VAR_6].msf = get_bits1(&gb); } } for(VAR_6 = 0; VAR_6 <= VAR_9; VAR_6++) for(VAR_7 = 0; VAR_7 < 2; VAR_7++) if(bands[VAR_6].res[VAR_7]) bands[VAR_6].scfi[VAR_7] = get_vlc2(&gb, scfi_vlc.table, MPC7_SCFI_BITS, 1); for(VAR_6 = 0; VAR_6 <= VAR_9; VAR_6++){ for(VAR_7 = 0; VAR_7 < 2; VAR_7++){ if(bands[VAR_6].res[VAR_7]){ bands[VAR_6].scf_idx[VAR_7][2] = c->oldDSCF[VAR_7][VAR_6]; bands[VAR_6].scf_idx[VAR_7][0] = get_scale_idx(&gb, bands[VAR_6].scf_idx[VAR_7][2]); switch(bands[VAR_6].scfi[VAR_7]){ case 0: bands[VAR_6].scf_idx[VAR_7][1] = get_scale_idx(&gb, bands[VAR_6].scf_idx[VAR_7][0]); bands[VAR_6].scf_idx[VAR_7][2] = get_scale_idx(&gb, bands[VAR_6].scf_idx[VAR_7][1]); break; case 1: bands[VAR_6].scf_idx[VAR_7][1] = get_scale_idx(&gb, bands[VAR_6].scf_idx[VAR_7][0]); bands[VAR_6].scf_idx[VAR_7][2] = bands[VAR_6].scf_idx[VAR_7][1]; break; case 2: bands[VAR_6].scf_idx[VAR_7][1] = bands[VAR_6].scf_idx[VAR_7][0]; bands[VAR_6].scf_idx[VAR_7][2] = get_scale_idx(&gb, bands[VAR_6].scf_idx[VAR_7][1]); break; case 3: bands[VAR_6].scf_idx[VAR_7][2] = bands[VAR_6].scf_idx[VAR_7][1] = bands[VAR_6].scf_idx[VAR_7][0]; break; } c->oldDSCF[VAR_7][VAR_6] = bands[VAR_6].scf_idx[VAR_7][2]; } } } memset(c->Q, 0, sizeof(c->Q)); VAR_10 = 0; for(VAR_6 = 0; VAR_6 < BANDS; VAR_6++, VAR_10 += SAMPLES_PER_BAND) for(VAR_7 = 0; VAR_7 < 2; VAR_7++) idx_to_quant(c, &gb, bands[VAR_6].res[VAR_7], c->Q[VAR_7] + VAR_10); ff_mpc_dequantize_and_synth(c, VAR_9, VAR_1); av_free(bits); VAR_11 = get_bits_count(&gb); VAR_12 = (VAR_5 - 4) * 8; if(!VAR_4[1] && ((VAR_12 < VAR_11) || (VAR_11 + 32 <= VAR_12))){ av_log(NULL,0, "Error decoding frame: used %VAR_6 of %VAR_6 bits\n", VAR_11, VAR_12); return -1; } if(c->frames_to_skip){ c->frames_to_skip--; *VAR_2 = 0; return VAR_5; } *VAR_2 = (VAR_4[1] ? c->lastframelen : MPC_FRAME_SIZE) * 4; return VAR_5; }
[ "static int FUNC_0(AVCodecContext * VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "MPCContext *c = VAR_0->priv_data;", "GetBitContext gb;", "uint8_t *bits;", "int VAR_6, VAR_7, VAR_8;", "int VAR_9 = -1;", "Band *bands = c->bands;", "int VAR_10;", "int VAR_11, VAR_12;", "memset(bands, 0, sizeof(bands));", "if(VAR_5 <= 4){", "av_log(VAR_0, AV_LOG_ERROR, \"Too small buffer passed (%VAR_6 bytes)\\n\", VAR_5);", "}", "bits = av_malloc(((VAR_5 - 1) & ~3) + FF_INPUT_BUFFER_PADDING_SIZE);", "c->dsp.bswap_buf((uint32_t*)bits, (const uint32_t*)(VAR_4 + 4), (VAR_5 - 4) >> 2);", "init_get_bits(&gb, bits, (VAR_5 - 4)* 8);", "skip_bits(&gb, VAR_4[0]);", "for(VAR_6 = 0; VAR_6 <= c->maxbands; VAR_6++){", "for(VAR_7 = 0; VAR_7 < 2; VAR_7++){", "if(VAR_6) VAR_8 = get_vlc2(&gb, hdr_vlc.table, MPC7_HDR_BITS, 1) - 5;", "if(!VAR_6 || (VAR_8 == 4)) bands[VAR_6].res[VAR_7] = get_bits(&gb, 4);", "else bands[VAR_6].res[VAR_7] = bands[VAR_6-1].res[VAR_7] + VAR_8;", "}", "if(bands[VAR_6].res[0] || bands[VAR_6].res[1]){", "VAR_9 = VAR_6;", "if(c->MSS) bands[VAR_6].msf = get_bits1(&gb);", "}", "}", "for(VAR_6 = 0; VAR_6 <= VAR_9; VAR_6++)", "for(VAR_7 = 0; VAR_7 < 2; VAR_7++)", "if(bands[VAR_6].res[VAR_7]) bands[VAR_6].scfi[VAR_7] = get_vlc2(&gb, scfi_vlc.table, MPC7_SCFI_BITS, 1);", "for(VAR_6 = 0; VAR_6 <= VAR_9; VAR_6++){", "for(VAR_7 = 0; VAR_7 < 2; VAR_7++){", "if(bands[VAR_6].res[VAR_7]){", "bands[VAR_6].scf_idx[VAR_7][2] = c->oldDSCF[VAR_7][VAR_6];", "bands[VAR_6].scf_idx[VAR_7][0] = get_scale_idx(&gb, bands[VAR_6].scf_idx[VAR_7][2]);", "switch(bands[VAR_6].scfi[VAR_7]){", "case 0:\nbands[VAR_6].scf_idx[VAR_7][1] = get_scale_idx(&gb, bands[VAR_6].scf_idx[VAR_7][0]);", "bands[VAR_6].scf_idx[VAR_7][2] = get_scale_idx(&gb, bands[VAR_6].scf_idx[VAR_7][1]);", "break;", "case 1:\nbands[VAR_6].scf_idx[VAR_7][1] = get_scale_idx(&gb, bands[VAR_6].scf_idx[VAR_7][0]);", "bands[VAR_6].scf_idx[VAR_7][2] = bands[VAR_6].scf_idx[VAR_7][1];", "break;", "case 2:\nbands[VAR_6].scf_idx[VAR_7][1] = bands[VAR_6].scf_idx[VAR_7][0];", "bands[VAR_6].scf_idx[VAR_7][2] = get_scale_idx(&gb, bands[VAR_6].scf_idx[VAR_7][1]);", "break;", "case 3:\nbands[VAR_6].scf_idx[VAR_7][2] = bands[VAR_6].scf_idx[VAR_7][1] = bands[VAR_6].scf_idx[VAR_7][0];", "break;", "}", "c->oldDSCF[VAR_7][VAR_6] = bands[VAR_6].scf_idx[VAR_7][2];", "}", "}", "}", "memset(c->Q, 0, sizeof(c->Q));", "VAR_10 = 0;", "for(VAR_6 = 0; VAR_6 < BANDS; VAR_6++, VAR_10 += SAMPLES_PER_BAND)", "for(VAR_7 = 0; VAR_7 < 2; VAR_7++)", "idx_to_quant(c, &gb, bands[VAR_6].res[VAR_7], c->Q[VAR_7] + VAR_10);", "ff_mpc_dequantize_and_synth(c, VAR_9, VAR_1);", "av_free(bits);", "VAR_11 = get_bits_count(&gb);", "VAR_12 = (VAR_5 - 4) * 8;", "if(!VAR_4[1] && ((VAR_12 < VAR_11) || (VAR_11 + 32 <= VAR_12))){", "av_log(NULL,0, \"Error decoding frame: used %VAR_6 of %VAR_6 bits\\n\", VAR_11, VAR_12);", "return -1;", "}", "if(c->frames_to_skip){", "c->frames_to_skip--;", "*VAR_2 = 0;", "return VAR_5;", "}", "*VAR_2 = (VAR_4[1] ? c->lastframelen : MPC_FRAME_SIZE) * 4;", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ] ]
10,698
static void qpeg_decode_intra(uint8_t *src, uint8_t *dst, int size, int stride, int width, int height) { int i; int code; int c0, c1; int run, copy; int filled = 0; height--; dst = dst + height * stride; while(size > 0) { code = *src++; size--; run = copy = 0; if(code == 0xFC) /* end-of-picture code */ break; if(code >= 0xF8) { /* very long run */ c0 = *src++; c1 = *src++; size -= 2; run = ((code & 0x7) << 16) + (c0 << 8) + c1 + 2; } else if (code >= 0xF0) { /* long run */ c0 = *src++; size--; run = ((code & 0xF) << 8) + c0 + 2; } else if (code >= 0xE0) { /* short run */ run = (code & 0x1F) + 2; } else if (code >= 0xC0) { /* very long copy */ c0 = *src++; c1 = *src++; size -= 2; copy = ((code & 0x3F) << 16) + (c0 << 8) + c1 + 1; } else if (code >= 0x80) { /* long copy */ c0 = *src++; size--; copy = ((code & 0x7F) << 8) + c0 + 1; } else { /* short copy */ copy = code + 1; } /* perform actual run or copy */ if(run) { int p; p = *src++; size--; for(i = 0; i < run; i++) { dst[filled++] = p; if (filled >= width) { filled = 0; dst -= stride; } } } else { for(i = 0; i < copy; i++) { dst[filled++] = *src++; if (filled >= width) { filled = 0; dst -= stride; } } size -= copy; } } }
true
FFmpeg
f63166f8dff65942c633adf32da9847ee1da3a47
static void qpeg_decode_intra(uint8_t *src, uint8_t *dst, int size, int stride, int width, int height) { int i; int code; int c0, c1; int run, copy; int filled = 0; height--; dst = dst + height * stride; while(size > 0) { code = *src++; size--; run = copy = 0; if(code == 0xFC) break; if(code >= 0xF8) { c0 = *src++; c1 = *src++; size -= 2; run = ((code & 0x7) << 16) + (c0 << 8) + c1 + 2; } else if (code >= 0xF0) { c0 = *src++; size--; run = ((code & 0xF) << 8) + c0 + 2; } else if (code >= 0xE0) { run = (code & 0x1F) + 2; } else if (code >= 0xC0) { c0 = *src++; c1 = *src++; size -= 2; copy = ((code & 0x3F) << 16) + (c0 << 8) + c1 + 1; } else if (code >= 0x80) { c0 = *src++; size--; copy = ((code & 0x7F) << 8) + c0 + 1; } else { copy = code + 1; } if(run) { int p; p = *src++; size--; for(i = 0; i < run; i++) { dst[filled++] = p; if (filled >= width) { filled = 0; dst -= stride; } } } else { for(i = 0; i < copy; i++) { dst[filled++] = *src++; if (filled >= width) { filled = 0; dst -= stride; } } size -= copy; } } }
{ "code": [ " while(size > 0) {", "\t size -= copy;", " while(size > 0) {" ], "line_no": [ 25, 127, 25 ] }
static void FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5) { int VAR_6; int VAR_7; int VAR_8, VAR_9; int VAR_10, VAR_11; int VAR_12 = 0; VAR_5--; VAR_1 = VAR_1 + VAR_5 * VAR_3; while(VAR_2 > 0) { VAR_7 = *VAR_0++; VAR_2--; VAR_10 = VAR_11 = 0; if(VAR_7 == 0xFC) break; if(VAR_7 >= 0xF8) { VAR_8 = *VAR_0++; VAR_9 = *VAR_0++; VAR_2 -= 2; VAR_10 = ((VAR_7 & 0x7) << 16) + (VAR_8 << 8) + VAR_9 + 2; } else if (VAR_7 >= 0xF0) { VAR_8 = *VAR_0++; VAR_2--; VAR_10 = ((VAR_7 & 0xF) << 8) + VAR_8 + 2; } else if (VAR_7 >= 0xE0) { VAR_10 = (VAR_7 & 0x1F) + 2; } else if (VAR_7 >= 0xC0) { VAR_8 = *VAR_0++; VAR_9 = *VAR_0++; VAR_2 -= 2; VAR_11 = ((VAR_7 & 0x3F) << 16) + (VAR_8 << 8) + VAR_9 + 1; } else if (VAR_7 >= 0x80) { VAR_8 = *VAR_0++; VAR_2--; VAR_11 = ((VAR_7 & 0x7F) << 8) + VAR_8 + 1; } else { VAR_11 = VAR_7 + 1; } if(VAR_10) { int VAR_13; VAR_13 = *VAR_0++; VAR_2--; for(VAR_6 = 0; VAR_6 < VAR_10; VAR_6++) { VAR_1[VAR_12++] = VAR_13; if (VAR_12 >= VAR_4) { VAR_12 = 0; VAR_1 -= VAR_3; } } } else { for(VAR_6 = 0; VAR_6 < VAR_11; VAR_6++) { VAR_1[VAR_12++] = *VAR_0++; if (VAR_12 >= VAR_4) { VAR_12 = 0; VAR_1 -= VAR_3; } } VAR_2 -= VAR_11; } } }
[ "static void FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int VAR_5)\n{", "int VAR_6;", "int VAR_7;", "int VAR_8, VAR_9;", "int VAR_10, VAR_11;", "int VAR_12 = 0;", "VAR_5--;", "VAR_1 = VAR_1 + VAR_5 * VAR_3;", "while(VAR_2 > 0) {", "VAR_7 = *VAR_0++;", "VAR_2--;", "VAR_10 = VAR_11 = 0;", "if(VAR_7 == 0xFC)\nbreak;", "if(VAR_7 >= 0xF8) {", "VAR_8 = *VAR_0++;", "VAR_9 = *VAR_0++;", "VAR_2 -= 2;", "VAR_10 = ((VAR_7 & 0x7) << 16) + (VAR_8 << 8) + VAR_9 + 2;", "} else if (VAR_7 >= 0xF0) {", "VAR_8 = *VAR_0++;", "VAR_2--;", "VAR_10 = ((VAR_7 & 0xF) << 8) + VAR_8 + 2;", "} else if (VAR_7 >= 0xE0) {", "VAR_10 = (VAR_7 & 0x1F) + 2;", "} else if (VAR_7 >= 0xC0) {", "VAR_8 = *VAR_0++;", "VAR_9 = *VAR_0++;", "VAR_2 -= 2;", "VAR_11 = ((VAR_7 & 0x3F) << 16) + (VAR_8 << 8) + VAR_9 + 1;", "} else if (VAR_7 >= 0x80) {", "VAR_8 = *VAR_0++;", "VAR_2--;", "VAR_11 = ((VAR_7 & 0x7F) << 8) + VAR_8 + 1;", "} else {", "VAR_11 = VAR_7 + 1;", "}", "if(VAR_10) {", "int VAR_13;", "VAR_13 = *VAR_0++;", "VAR_2--;", "for(VAR_6 = 0; VAR_6 < VAR_10; VAR_6++) {", "VAR_1[VAR_12++] = VAR_13;", "if (VAR_12 >= VAR_4) {", "VAR_12 = 0;", "VAR_1 -= VAR_3;", "}", "}", "} else {", "for(VAR_6 = 0; VAR_6 < VAR_11; VAR_6++) {", "VAR_1[VAR_12++] = *VAR_0++;", "if (VAR_12 >= VAR_4) {", "VAR_12 = 0;", "VAR_1 -= VAR_3;", "}", "}", "VAR_2 -= VAR_11;", "}", "}", "}" ]
[ 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, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 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 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ] ]
10,700
static void usb_mtp_handle_reset(USBDevice *dev) { MTPState *s = USB_MTP(dev); trace_usb_mtp_reset(s->dev.addr); #ifdef __linux__ usb_mtp_inotify_cleanup(s); #endif usb_mtp_object_free(s, QTAILQ_FIRST(&s->objects)); s->session = 0; usb_mtp_data_free(s->data_in); s->data_in = NULL; usb_mtp_data_free(s->data_out); s->data_out = NULL; g_free(s->result); s->result = NULL; }
true
qemu
983bff3530782d51c46c8d7c0e17e2a9dfe5fb77
static void usb_mtp_handle_reset(USBDevice *dev) { MTPState *s = USB_MTP(dev); trace_usb_mtp_reset(s->dev.addr); #ifdef __linux__ usb_mtp_inotify_cleanup(s); #endif usb_mtp_object_free(s, QTAILQ_FIRST(&s->objects)); s->session = 0; usb_mtp_data_free(s->data_in); s->data_in = NULL; usb_mtp_data_free(s->data_out); s->data_out = NULL; g_free(s->result); s->result = NULL; }
{ "code": [ "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__", "#ifdef __linux__" ], "line_no": [ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13 ] }
static void FUNC_0(USBDevice *VAR_0) { MTPState *s = USB_MTP(VAR_0); trace_usb_mtp_reset(s->VAR_0.addr); #ifdef __linux__ usb_mtp_inotify_cleanup(s); #endif usb_mtp_object_free(s, QTAILQ_FIRST(&s->objects)); s->session = 0; usb_mtp_data_free(s->data_in); s->data_in = NULL; usb_mtp_data_free(s->data_out); s->data_out = NULL; g_free(s->result); s->result = NULL; }
[ "static void FUNC_0(USBDevice *VAR_0)\n{", "MTPState *s = USB_MTP(VAR_0);", "trace_usb_mtp_reset(s->VAR_0.addr);", "#ifdef __linux__\nusb_mtp_inotify_cleanup(s);", "#endif\nusb_mtp_object_free(s, QTAILQ_FIRST(&s->objects));", "s->session = 0;", "usb_mtp_data_free(s->data_in);", "s->data_in = NULL;", "usb_mtp_data_free(s->data_out);", "s->data_out = NULL;", "g_free(s->result);", "s->result = NULL;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13, 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
10,701
int vfio_region_mmap(VFIORegion *region) { int i, prot = 0; char *name; if (!region->mem) { return 0; } prot |= region->flags & VFIO_REGION_INFO_FLAG_READ ? PROT_READ : 0; prot |= region->flags & VFIO_REGION_INFO_FLAG_WRITE ? PROT_WRITE : 0; for (i = 0; i < region->nr_mmaps; i++) { region->mmaps[i].mmap = mmap(NULL, region->mmaps[i].size, prot, MAP_SHARED, region->vbasedev->fd, region->fd_offset + region->mmaps[i].offset); if (region->mmaps[i].mmap == MAP_FAILED) { int ret = -errno; trace_vfio_region_mmap_fault(memory_region_name(region->mem), i, region->fd_offset + region->mmaps[i].offset, region->fd_offset + region->mmaps[i].offset + region->mmaps[i].size - 1, ret); region->mmaps[i].mmap = NULL; for (i--; i >= 0; i--) { memory_region_del_subregion(region->mem, &region->mmaps[i].mem); munmap(region->mmaps[i].mmap, region->mmaps[i].size); object_unparent(OBJECT(&region->mmaps[i].mem)); region->mmaps[i].mmap = NULL; } return ret; } name = g_strdup_printf("%s mmaps[%d]", memory_region_name(region->mem), i); memory_region_init_ram_ptr(&region->mmaps[i].mem, memory_region_owner(region->mem), name, region->mmaps[i].size, region->mmaps[i].mmap); g_free(name); memory_region_set_skip_dump(&region->mmaps[i].mem); memory_region_add_subregion(region->mem, region->mmaps[i].offset, &region->mmaps[i].mem); trace_vfio_region_mmap(memory_region_name(&region->mmaps[i].mem), region->mmaps[i].offset, region->mmaps[i].offset + region->mmaps[i].size - 1); } return 0; }
false
qemu
21e00fa55f3fdfcbb20da7c6876c91ef3609b387
int vfio_region_mmap(VFIORegion *region) { int i, prot = 0; char *name; if (!region->mem) { return 0; } prot |= region->flags & VFIO_REGION_INFO_FLAG_READ ? PROT_READ : 0; prot |= region->flags & VFIO_REGION_INFO_FLAG_WRITE ? PROT_WRITE : 0; for (i = 0; i < region->nr_mmaps; i++) { region->mmaps[i].mmap = mmap(NULL, region->mmaps[i].size, prot, MAP_SHARED, region->vbasedev->fd, region->fd_offset + region->mmaps[i].offset); if (region->mmaps[i].mmap == MAP_FAILED) { int ret = -errno; trace_vfio_region_mmap_fault(memory_region_name(region->mem), i, region->fd_offset + region->mmaps[i].offset, region->fd_offset + region->mmaps[i].offset + region->mmaps[i].size - 1, ret); region->mmaps[i].mmap = NULL; for (i--; i >= 0; i--) { memory_region_del_subregion(region->mem, &region->mmaps[i].mem); munmap(region->mmaps[i].mmap, region->mmaps[i].size); object_unparent(OBJECT(&region->mmaps[i].mem)); region->mmaps[i].mmap = NULL; } return ret; } name = g_strdup_printf("%s mmaps[%d]", memory_region_name(region->mem), i); memory_region_init_ram_ptr(&region->mmaps[i].mem, memory_region_owner(region->mem), name, region->mmaps[i].size, region->mmaps[i].mmap); g_free(name); memory_region_set_skip_dump(&region->mmaps[i].mem); memory_region_add_subregion(region->mem, region->mmaps[i].offset, &region->mmaps[i].mem); trace_vfio_region_mmap(memory_region_name(&region->mmaps[i].mem), region->mmaps[i].offset, region->mmaps[i].offset + region->mmaps[i].size - 1); } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(VFIORegion *VAR_0) { int VAR_1, VAR_2 = 0; char *VAR_3; if (!VAR_0->mem) { return 0; } VAR_2 |= VAR_0->flags & VFIO_REGION_INFO_FLAG_READ ? PROT_READ : 0; VAR_2 |= VAR_0->flags & VFIO_REGION_INFO_FLAG_WRITE ? PROT_WRITE : 0; for (VAR_1 = 0; VAR_1 < VAR_0->nr_mmaps; VAR_1++) { VAR_0->mmaps[VAR_1].mmap = mmap(NULL, VAR_0->mmaps[VAR_1].size, VAR_2, MAP_SHARED, VAR_0->vbasedev->fd, VAR_0->fd_offset + VAR_0->mmaps[VAR_1].offset); if (VAR_0->mmaps[VAR_1].mmap == MAP_FAILED) { int ret = -errno; trace_vfio_region_mmap_fault(memory_region_name(VAR_0->mem), VAR_1, VAR_0->fd_offset + VAR_0->mmaps[VAR_1].offset, VAR_0->fd_offset + VAR_0->mmaps[VAR_1].offset + VAR_0->mmaps[VAR_1].size - 1, ret); VAR_0->mmaps[VAR_1].mmap = NULL; for (VAR_1--; VAR_1 >= 0; VAR_1--) { memory_region_del_subregion(VAR_0->mem, &VAR_0->mmaps[VAR_1].mem); munmap(VAR_0->mmaps[VAR_1].mmap, VAR_0->mmaps[VAR_1].size); object_unparent(OBJECT(&VAR_0->mmaps[VAR_1].mem)); VAR_0->mmaps[VAR_1].mmap = NULL; } return ret; } VAR_3 = g_strdup_printf("%s mmaps[%d]", memory_region_name(VAR_0->mem), VAR_1); memory_region_init_ram_ptr(&VAR_0->mmaps[VAR_1].mem, memory_region_owner(VAR_0->mem), VAR_3, VAR_0->mmaps[VAR_1].size, VAR_0->mmaps[VAR_1].mmap); g_free(VAR_3); memory_region_set_skip_dump(&VAR_0->mmaps[VAR_1].mem); memory_region_add_subregion(VAR_0->mem, VAR_0->mmaps[VAR_1].offset, &VAR_0->mmaps[VAR_1].mem); trace_vfio_region_mmap(memory_region_name(&VAR_0->mmaps[VAR_1].mem), VAR_0->mmaps[VAR_1].offset, VAR_0->mmaps[VAR_1].offset + VAR_0->mmaps[VAR_1].size - 1); } return 0; }
[ "int FUNC_0(VFIORegion *VAR_0)\n{", "int VAR_1, VAR_2 = 0;", "char *VAR_3;", "if (!VAR_0->mem) {", "return 0;", "}", "VAR_2 |= VAR_0->flags & VFIO_REGION_INFO_FLAG_READ ? PROT_READ : 0;", "VAR_2 |= VAR_0->flags & VFIO_REGION_INFO_FLAG_WRITE ? PROT_WRITE : 0;", "for (VAR_1 = 0; VAR_1 < VAR_0->nr_mmaps; VAR_1++) {", "VAR_0->mmaps[VAR_1].mmap = mmap(NULL, VAR_0->mmaps[VAR_1].size, VAR_2,\nMAP_SHARED, VAR_0->vbasedev->fd,\nVAR_0->fd_offset +\nVAR_0->mmaps[VAR_1].offset);", "if (VAR_0->mmaps[VAR_1].mmap == MAP_FAILED) {", "int ret = -errno;", "trace_vfio_region_mmap_fault(memory_region_name(VAR_0->mem), VAR_1,\nVAR_0->fd_offset +\nVAR_0->mmaps[VAR_1].offset,\nVAR_0->fd_offset +\nVAR_0->mmaps[VAR_1].offset +\nVAR_0->mmaps[VAR_1].size - 1, ret);", "VAR_0->mmaps[VAR_1].mmap = NULL;", "for (VAR_1--; VAR_1 >= 0; VAR_1--) {", "memory_region_del_subregion(VAR_0->mem, &VAR_0->mmaps[VAR_1].mem);", "munmap(VAR_0->mmaps[VAR_1].mmap, VAR_0->mmaps[VAR_1].size);", "object_unparent(OBJECT(&VAR_0->mmaps[VAR_1].mem));", "VAR_0->mmaps[VAR_1].mmap = NULL;", "}", "return ret;", "}", "VAR_3 = g_strdup_printf(\"%s mmaps[%d]\",\nmemory_region_name(VAR_0->mem), VAR_1);", "memory_region_init_ram_ptr(&VAR_0->mmaps[VAR_1].mem,\nmemory_region_owner(VAR_0->mem),\nVAR_3, VAR_0->mmaps[VAR_1].size,\nVAR_0->mmaps[VAR_1].mmap);", "g_free(VAR_3);", "memory_region_set_skip_dump(&VAR_0->mmaps[VAR_1].mem);", "memory_region_add_subregion(VAR_0->mem, VAR_0->mmaps[VAR_1].offset,\n&VAR_0->mmaps[VAR_1].mem);", "trace_vfio_region_mmap(memory_region_name(&VAR_0->mmaps[VAR_1].mem),\nVAR_0->mmaps[VAR_1].offset,\nVAR_0->mmaps[VAR_1].offset +\nVAR_0->mmaps[VAR_1].size - 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29, 31, 33 ], [ 35 ], [ 37 ], [ 41, 43, 45, 47, 49, 51 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83, 85, 87, 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 101, 103, 105, 107 ], [ 109 ], [ 113 ], [ 115 ] ]
10,702
float64 HELPER(ucf64_subd)(float64 a, float64 b, CPUUniCore32State *env) { return float64_sub(a, b, &env->ucf64.fp_status); }
false
qemu
e8ede0a8bb5298a6979bcf7ed84ef64a64a4e3fe
float64 HELPER(ucf64_subd)(float64 a, float64 b, CPUUniCore32State *env) { return float64_sub(a, b, &env->ucf64.fp_status); }
{ "code": [], "line_no": [] }
float64 FUNC_0(ucf64_subd)(float64 a, float64 b, CPUUniCore32State *env) { return float64_sub(a, b, &env->ucf64.fp_status); }
[ "float64 FUNC_0(ucf64_subd)(float64 a, float64 b, CPUUniCore32State *env)\n{", "return float64_sub(a, b, &env->ucf64.fp_status);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
10,703
static void text_console_do_init(CharDriverState *chr, DisplayState *ds) { TextConsole *s; static int color_inited; s = chr->opaque; chr->chr_write = console_puts; chr->chr_send_event = console_send_event; s->out_fifo.buf = s->out_fifo_buf; s->out_fifo.buf_size = sizeof(s->out_fifo_buf); s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s); s->ds = ds; if (!color_inited) { color_inited = 1; console_color_init(s->ds); } s->y_displayed = 0; s->y_base = 0; s->total_height = DEFAULT_BACKSCROLL; s->x = 0; s->y = 0; if (s->console_type == TEXT_CONSOLE) { s->g_width = ds_get_width(s->ds); s->g_height = ds_get_height(s->ds); } s->hw_invalidate = text_console_invalidate; s->hw_text_update = text_console_update; s->hw = s; /* Set text attribute defaults */ s->t_attrib_default.bold = 0; s->t_attrib_default.uline = 0; s->t_attrib_default.blink = 0; s->t_attrib_default.invers = 0; s->t_attrib_default.unvisible = 0; s->t_attrib_default.fgcol = COLOR_WHITE; s->t_attrib_default.bgcol = COLOR_BLACK; /* set current text attributes to default */ s->t_attrib = s->t_attrib_default; text_console_resize(s); if (chr->label) { char msg[128]; int len; s->t_attrib.bgcol = COLOR_BLUE; len = snprintf(msg, sizeof(msg), "%s console\r\n", chr->label); console_puts(chr, (uint8_t*)msg, len); s->t_attrib = s->t_attrib_default; } qemu_chr_generic_open(chr); if (chr->init) chr->init(chr); }
false
qemu
7bd427d801e1e3293a634d3c83beadaa90ffb911
static void text_console_do_init(CharDriverState *chr, DisplayState *ds) { TextConsole *s; static int color_inited; s = chr->opaque; chr->chr_write = console_puts; chr->chr_send_event = console_send_event; s->out_fifo.buf = s->out_fifo_buf; s->out_fifo.buf_size = sizeof(s->out_fifo_buf); s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s); s->ds = ds; if (!color_inited) { color_inited = 1; console_color_init(s->ds); } s->y_displayed = 0; s->y_base = 0; s->total_height = DEFAULT_BACKSCROLL; s->x = 0; s->y = 0; if (s->console_type == TEXT_CONSOLE) { s->g_width = ds_get_width(s->ds); s->g_height = ds_get_height(s->ds); } s->hw_invalidate = text_console_invalidate; s->hw_text_update = text_console_update; s->hw = s; s->t_attrib_default.bold = 0; s->t_attrib_default.uline = 0; s->t_attrib_default.blink = 0; s->t_attrib_default.invers = 0; s->t_attrib_default.unvisible = 0; s->t_attrib_default.fgcol = COLOR_WHITE; s->t_attrib_default.bgcol = COLOR_BLACK; s->t_attrib = s->t_attrib_default; text_console_resize(s); if (chr->label) { char msg[128]; int len; s->t_attrib.bgcol = COLOR_BLUE; len = snprintf(msg, sizeof(msg), "%s console\r\n", chr->label); console_puts(chr, (uint8_t*)msg, len); s->t_attrib = s->t_attrib_default; } qemu_chr_generic_open(chr); if (chr->init) chr->init(chr); }
{ "code": [], "line_no": [] }
static void FUNC_0(CharDriverState *VAR_0, DisplayState *VAR_1) { TextConsole *s; static int VAR_2; s = VAR_0->opaque; VAR_0->chr_write = console_puts; VAR_0->chr_send_event = console_send_event; s->out_fifo.buf = s->out_fifo_buf; s->out_fifo.buf_size = sizeof(s->out_fifo_buf); s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s); s->VAR_1 = VAR_1; if (!VAR_2) { VAR_2 = 1; console_color_init(s->VAR_1); } s->y_displayed = 0; s->y_base = 0; s->total_height = DEFAULT_BACKSCROLL; s->x = 0; s->y = 0; if (s->console_type == TEXT_CONSOLE) { s->g_width = ds_get_width(s->VAR_1); s->g_height = ds_get_height(s->VAR_1); } s->hw_invalidate = text_console_invalidate; s->hw_text_update = text_console_update; s->hw = s; s->t_attrib_default.bold = 0; s->t_attrib_default.uline = 0; s->t_attrib_default.blink = 0; s->t_attrib_default.invers = 0; s->t_attrib_default.unvisible = 0; s->t_attrib_default.fgcol = COLOR_WHITE; s->t_attrib_default.bgcol = COLOR_BLACK; s->t_attrib = s->t_attrib_default; text_console_resize(s); if (VAR_0->label) { char VAR_3[128]; int VAR_4; s->t_attrib.bgcol = COLOR_BLUE; VAR_4 = snprintf(VAR_3, sizeof(VAR_3), "%s console\r\n", VAR_0->label); console_puts(VAR_0, (uint8_t*)VAR_3, VAR_4); s->t_attrib = s->t_attrib_default; } qemu_chr_generic_open(VAR_0); if (VAR_0->init) VAR_0->init(VAR_0); }
[ "static void FUNC_0(CharDriverState *VAR_0, DisplayState *VAR_1)\n{", "TextConsole *s;", "static int VAR_2;", "s = VAR_0->opaque;", "VAR_0->chr_write = console_puts;", "VAR_0->chr_send_event = console_send_event;", "s->out_fifo.buf = s->out_fifo_buf;", "s->out_fifo.buf_size = sizeof(s->out_fifo_buf);", "s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s);", "s->VAR_1 = VAR_1;", "if (!VAR_2) {", "VAR_2 = 1;", "console_color_init(s->VAR_1);", "}", "s->y_displayed = 0;", "s->y_base = 0;", "s->total_height = DEFAULT_BACKSCROLL;", "s->x = 0;", "s->y = 0;", "if (s->console_type == TEXT_CONSOLE) {", "s->g_width = ds_get_width(s->VAR_1);", "s->g_height = ds_get_height(s->VAR_1);", "}", "s->hw_invalidate = text_console_invalidate;", "s->hw_text_update = text_console_update;", "s->hw = s;", "s->t_attrib_default.bold = 0;", "s->t_attrib_default.uline = 0;", "s->t_attrib_default.blink = 0;", "s->t_attrib_default.invers = 0;", "s->t_attrib_default.unvisible = 0;", "s->t_attrib_default.fgcol = COLOR_WHITE;", "s->t_attrib_default.bgcol = COLOR_BLACK;", "s->t_attrib = s->t_attrib_default;", "text_console_resize(s);", "if (VAR_0->label) {", "char VAR_3[128];", "int VAR_4;", "s->t_attrib.bgcol = COLOR_BLUE;", "VAR_4 = snprintf(VAR_3, sizeof(VAR_3), \"%s console\\r\\n\", VAR_0->label);", "console_puts(VAR_0, (uint8_t*)VAR_3, VAR_4);", "s->t_attrib = s->t_attrib_default;", "}", "qemu_chr_generic_open(VAR_0);", "if (VAR_0->init)\nVAR_0->init(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113, 115 ], [ 117 ] ]