id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
listlengths
1
2.8k
label
listlengths
1
2.8k
line_no
listlengths
1
2.8k
13,336
void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, PCIBus *root_bus, MemoryRegion *address_space_io, bool bridges_enabled) { s->io_len = ACPI_PCIHP_SIZE; s->io_base = ACPI_PCIHP_ADDR; s->root= root_bus; s->legacy_piix = !bridges_enabled; if (s->legacy_piix) { unsigned *bus_bsel = g_malloc(sizeof *bus_bsel); s->io_len = ACPI_PCIHP_LEGACY_SIZE; *bus_bsel = ACPI_PCIHP_BSEL_DEFAULT; object_property_add_uint32_ptr(OBJECT(root_bus), ACPI_PCIHP_PROP_BSEL, bus_bsel, NULL); } memory_region_init_io(&s->io, owner, &acpi_pcihp_io_ops, s, "acpi-pci-hotplug", s->io_len); memory_region_add_subregion(address_space_io, s->io_base, &s->io); object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_BASE_PROP, &s->io_base, &error_abort); object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_LEN_PROP, &s->io_len, &error_abort); }
true
qemu
f0c9d64a68b776374ec4732424a3e27753ce37b6
void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, PCIBus *root_bus, MemoryRegion *address_space_io, bool bridges_enabled) { s->io_len = ACPI_PCIHP_SIZE; s->io_base = ACPI_PCIHP_ADDR; s->root= root_bus; s->legacy_piix = !bridges_enabled; if (s->legacy_piix) { unsigned *bus_bsel = g_malloc(sizeof *bus_bsel); s->io_len = ACPI_PCIHP_LEGACY_SIZE; *bus_bsel = ACPI_PCIHP_BSEL_DEFAULT; object_property_add_uint32_ptr(OBJECT(root_bus), ACPI_PCIHP_PROP_BSEL, bus_bsel, NULL); } memory_region_init_io(&s->io, owner, &acpi_pcihp_io_ops, s, "acpi-pci-hotplug", s->io_len); memory_region_add_subregion(address_space_io, s->io_base, &s->io); object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_BASE_PROP, &s->io_base, &error_abort); object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_LEN_PROP, &s->io_len, &error_abort); }
{ "code": [ " if (s->legacy_piix) {", " unsigned *bus_bsel = g_malloc(sizeof *bus_bsel);", " s->io_len = ACPI_PCIHP_LEGACY_SIZE;", " *bus_bsel = ACPI_PCIHP_BSEL_DEFAULT;", " object_property_add_uint32_ptr(OBJECT(root_bus), ACPI_PCIHP_PROP_BSEL,", " bus_bsel, NULL);", " bus_bsel, NULL);" ], "line_no": [ 19, 21, 25, 29, 31, 33, 33 ] }
void FUNC_0(Object *VAR_0, AcpiPciHpState *VAR_1, PCIBus *VAR_2, MemoryRegion *VAR_3, bool VAR_4) { VAR_1->io_len = ACPI_PCIHP_SIZE; VAR_1->io_base = ACPI_PCIHP_ADDR; VAR_1->root= VAR_2; VAR_1->legacy_piix = !VAR_4; if (VAR_1->legacy_piix) { unsigned *VAR_5 = g_malloc(sizeof *VAR_5); VAR_1->io_len = ACPI_PCIHP_LEGACY_SIZE; *VAR_5 = ACPI_PCIHP_BSEL_DEFAULT; object_property_add_uint32_ptr(OBJECT(VAR_2), ACPI_PCIHP_PROP_BSEL, VAR_5, NULL); } memory_region_init_io(&VAR_1->io, VAR_0, &acpi_pcihp_io_ops, VAR_1, "acpi-pci-hotplug", VAR_1->io_len); memory_region_add_subregion(VAR_3, VAR_1->io_base, &VAR_1->io); object_property_add_uint16_ptr(VAR_0, ACPI_PCIHP_IO_BASE_PROP, &VAR_1->io_base, &error_abort); object_property_add_uint16_ptr(VAR_0, ACPI_PCIHP_IO_LEN_PROP, &VAR_1->io_len, &error_abort); }
[ "void FUNC_0(Object *VAR_0, AcpiPciHpState *VAR_1, PCIBus *VAR_2,\nMemoryRegion *VAR_3, bool VAR_4)\n{", "VAR_1->io_len = ACPI_PCIHP_SIZE;", "VAR_1->io_base = ACPI_PCIHP_ADDR;", "VAR_1->root= VAR_2;", "VAR_1->legacy_piix = !VAR_4;", "if (VAR_1->legacy_piix) {", "unsigned *VAR_5 = g_malloc(sizeof *VAR_5);", "VAR_1->io_len = ACPI_PCIHP_LEGACY_SIZE;", "*VAR_5 = ACPI_PCIHP_BSEL_DEFAULT;", "object_property_add_uint32_ptr(OBJECT(VAR_2), ACPI_PCIHP_PROP_BSEL,\nVAR_5, NULL);", "}", "memory_region_init_io(&VAR_1->io, VAR_0, &acpi_pcihp_io_ops, VAR_1,\n\"acpi-pci-hotplug\", VAR_1->io_len);", "memory_region_add_subregion(VAR_3, VAR_1->io_base, &VAR_1->io);", "object_property_add_uint16_ptr(VAR_0, ACPI_PCIHP_IO_BASE_PROP, &VAR_1->io_base,\n&error_abort);", "object_property_add_uint16_ptr(VAR_0, ACPI_PCIHP_IO_LEN_PROP, &VAR_1->io_len,\n&error_abort);", "}" ]
[ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 47, 49 ], [ 51, 53 ], [ 55 ] ]
13,338
paint_mouse_pointer(XImage *image, struct x11grab *s) { int x_off = s->x_off; int y_off = s->y_off; int width = s->width; int height = s->height; Display *dpy = s->dpy; XFixesCursorImage *xcim; int x, y; int line, column; int to_line, to_column; int pixstride = image->bits_per_pixel >> 3; /* Warning: in its insanity, xlib provides unsigned image data through a * char* pointer, so we have to make it uint8_t to make things not break. * Anyone who performs further investigation of the xlib API likely risks * permanent brain damage. */ uint8_t *pix = image->data; Cursor c; Window w; XSetWindowAttributes attr; /* Code doesn't currently support 16-bit or PAL8 */ if (image->bits_per_pixel != 24 && image->bits_per_pixel != 32) return; c = XCreateFontCursor(dpy, XC_left_ptr); w = DefaultRootWindow(dpy); attr.cursor = c; XChangeWindowAttributes(dpy, w, CWCursor, &attr); xcim = XFixesGetCursorImage(dpy); x = xcim->x - xcim->xhot; y = xcim->y - xcim->yhot; to_line = FFMIN((y + xcim->height), (height + y_off)); to_column = FFMIN((x + xcim->width), (width + x_off)); for (line = FFMAX(y, y_off); line < to_line; line++) { for (column = FFMAX(x, x_off); column < to_column; column++) { int xcim_addr = (line - y) * xcim->width + column - x; int image_addr = ((line - y_off) * width + column - x_off) * pixstride; int r = (uint8_t)(xcim->pixels[xcim_addr] >> 0); int g = (uint8_t)(xcim->pixels[xcim_addr] >> 8); int b = (uint8_t)(xcim->pixels[xcim_addr] >> 16); int a = (uint8_t)(xcim->pixels[xcim_addr] >> 24); if (a == 255) { pix[image_addr+0] = r; pix[image_addr+1] = g; pix[image_addr+2] = b; } else if (a) { /* pixel values from XFixesGetCursorImage come premultiplied by alpha */ pix[image_addr+0] = r + (pix[image_addr+0]*(255-a) + 255/2) / 255; pix[image_addr+1] = g + (pix[image_addr+1]*(255-a) + 255/2) / 255; pix[image_addr+2] = b + (pix[image_addr+2]*(255-a) + 255/2) / 255; } } } XFree(xcim); xcim = NULL; }
true
FFmpeg
1ee8fadb811f3b1ef370c7d6c7bf62088f1cc954
paint_mouse_pointer(XImage *image, struct x11grab *s) { int x_off = s->x_off; int y_off = s->y_off; int width = s->width; int height = s->height; Display *dpy = s->dpy; XFixesCursorImage *xcim; int x, y; int line, column; int to_line, to_column; int pixstride = image->bits_per_pixel >> 3; uint8_t *pix = image->data; Cursor c; Window w; XSetWindowAttributes attr; if (image->bits_per_pixel != 24 && image->bits_per_pixel != 32) return; c = XCreateFontCursor(dpy, XC_left_ptr); w = DefaultRootWindow(dpy); attr.cursor = c; XChangeWindowAttributes(dpy, w, CWCursor, &attr); xcim = XFixesGetCursorImage(dpy); x = xcim->x - xcim->xhot; y = xcim->y - xcim->yhot; to_line = FFMIN((y + xcim->height), (height + y_off)); to_column = FFMIN((x + xcim->width), (width + x_off)); for (line = FFMAX(y, y_off); line < to_line; line++) { for (column = FFMAX(x, x_off); column < to_column; column++) { int xcim_addr = (line - y) * xcim->width + column - x; int image_addr = ((line - y_off) * width + column - x_off) * pixstride; int r = (uint8_t)(xcim->pixels[xcim_addr] >> 0); int g = (uint8_t)(xcim->pixels[xcim_addr] >> 8); int b = (uint8_t)(xcim->pixels[xcim_addr] >> 16); int a = (uint8_t)(xcim->pixels[xcim_addr] >> 24); if (a == 255) { pix[image_addr+0] = r; pix[image_addr+1] = g; pix[image_addr+2] = b; } else if (a) { pix[image_addr+0] = r + (pix[image_addr+0]*(255-a) + 255/2) / 255; pix[image_addr+1] = g + (pix[image_addr+1]*(255-a) + 255/2) / 255; pix[image_addr+2] = b + (pix[image_addr+2]*(255-a) + 255/2) / 255; } } } XFree(xcim); xcim = NULL; }
{ "code": [ " Cursor c;", " c = XCreateFontCursor(dpy, XC_left_ptr);", " attr.cursor = c;" ], "line_no": [ 35, 51, 55 ] }
FUNC_0(XImage *VAR_0, struct x11grab *VAR_1) { int VAR_2 = VAR_1->VAR_2; int VAR_3 = VAR_1->VAR_3; int VAR_4 = VAR_1->VAR_4; int VAR_5 = VAR_1->VAR_5; Display *dpy = VAR_1->dpy; XFixesCursorImage *xcim; int VAR_6, VAR_7; int VAR_8, VAR_9; int VAR_10, VAR_11; int VAR_12 = VAR_0->bits_per_pixel >> 3; uint8_t *pix = VAR_0->data; Cursor c; Window w; XSetWindowAttributes attr; if (VAR_0->bits_per_pixel != 24 && VAR_0->bits_per_pixel != 32) return; c = XCreateFontCursor(dpy, XC_left_ptr); w = DefaultRootWindow(dpy); attr.cursor = c; XChangeWindowAttributes(dpy, w, CWCursor, &attr); xcim = XFixesGetCursorImage(dpy); VAR_6 = xcim->VAR_6 - xcim->xhot; VAR_7 = xcim->VAR_7 - xcim->yhot; VAR_10 = FFMIN((VAR_7 + xcim->VAR_5), (VAR_5 + VAR_3)); VAR_11 = FFMIN((VAR_6 + xcim->VAR_4), (VAR_4 + VAR_2)); for (VAR_8 = FFMAX(VAR_7, VAR_3); VAR_8 < VAR_10; VAR_8++) { for (VAR_9 = FFMAX(VAR_6, VAR_2); VAR_9 < VAR_11; VAR_9++) { int VAR_13 = (VAR_8 - VAR_7) * xcim->VAR_4 + VAR_9 - VAR_6; int VAR_14 = ((VAR_8 - VAR_3) * VAR_4 + VAR_9 - VAR_2) * VAR_12; int VAR_15 = (uint8_t)(xcim->pixels[VAR_13] >> 0); int VAR_16 = (uint8_t)(xcim->pixels[VAR_13] >> 8); int VAR_17 = (uint8_t)(xcim->pixels[VAR_13] >> 16); int VAR_18 = (uint8_t)(xcim->pixels[VAR_13] >> 24); if (VAR_18 == 255) { pix[VAR_14+0] = VAR_15; pix[VAR_14+1] = VAR_16; pix[VAR_14+2] = VAR_17; } else if (VAR_18) { pix[VAR_14+0] = VAR_15 + (pix[VAR_14+0]*(255-VAR_18) + 255/2) / 255; pix[VAR_14+1] = VAR_16 + (pix[VAR_14+1]*(255-VAR_18) + 255/2) / 255; pix[VAR_14+2] = VAR_17 + (pix[VAR_14+2]*(255-VAR_18) + 255/2) / 255; } } } XFree(xcim); xcim = NULL; }
[ "FUNC_0(XImage *VAR_0, struct x11grab *VAR_1)\n{", "int VAR_2 = VAR_1->VAR_2;", "int VAR_3 = VAR_1->VAR_3;", "int VAR_4 = VAR_1->VAR_4;", "int VAR_5 = VAR_1->VAR_5;", "Display *dpy = VAR_1->dpy;", "XFixesCursorImage *xcim;", "int VAR_6, VAR_7;", "int VAR_8, VAR_9;", "int VAR_10, VAR_11;", "int VAR_12 = VAR_0->bits_per_pixel >> 3;", "uint8_t *pix = VAR_0->data;", "Cursor c;", "Window w;", "XSetWindowAttributes attr;", "if (VAR_0->bits_per_pixel != 24 && VAR_0->bits_per_pixel != 32)\nreturn;", "c = XCreateFontCursor(dpy, XC_left_ptr);", "w = DefaultRootWindow(dpy);", "attr.cursor = c;", "XChangeWindowAttributes(dpy, w, CWCursor, &attr);", "xcim = XFixesGetCursorImage(dpy);", "VAR_6 = xcim->VAR_6 - xcim->xhot;", "VAR_7 = xcim->VAR_7 - xcim->yhot;", "VAR_10 = FFMIN((VAR_7 + xcim->VAR_5), (VAR_5 + VAR_3));", "VAR_11 = FFMIN((VAR_6 + xcim->VAR_4), (VAR_4 + VAR_2));", "for (VAR_8 = FFMAX(VAR_7, VAR_3); VAR_8 < VAR_10; VAR_8++) {", "for (VAR_9 = FFMAX(VAR_6, VAR_2); VAR_9 < VAR_11; VAR_9++) {", "int VAR_13 = (VAR_8 - VAR_7) * xcim->VAR_4 + VAR_9 - VAR_6;", "int VAR_14 = ((VAR_8 - VAR_3) * VAR_4 + VAR_9 - VAR_2) * VAR_12;", "int VAR_15 = (uint8_t)(xcim->pixels[VAR_13] >> 0);", "int VAR_16 = (uint8_t)(xcim->pixels[VAR_13] >> 8);", "int VAR_17 = (uint8_t)(xcim->pixels[VAR_13] >> 16);", "int VAR_18 = (uint8_t)(xcim->pixels[VAR_13] >> 24);", "if (VAR_18 == 255) {", "pix[VAR_14+0] = VAR_15;", "pix[VAR_14+1] = VAR_16;", "pix[VAR_14+2] = VAR_17;", "} else if (VAR_18) {", "pix[VAR_14+0] = VAR_15 + (pix[VAR_14+0]*(255-VAR_18) + 255/2) / 255;", "pix[VAR_14+1] = VAR_16 + (pix[VAR_14+1]*(255-VAR_18) + 255/2) / 255;", "pix[VAR_14+2] = VAR_17 + (pix[VAR_14+2]*(255-VAR_18) + 255/2) / 255;", "}", "}", "}", "XFree(xcim);", "xcim = NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ] ]
13,340
int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) { BdrvTrackedRequest req; int max_pdiscard, ret; int head, tail, align; return -ENOMEDIUM; if (bdrv_has_readonly_bitmaps(bs)) { return -EPERM; ret = bdrv_check_byte_request(bs, offset, bytes); if (ret < 0) { return ret; } else if (bs->read_only) { return -EPERM; assert(!(bs->open_flags & BDRV_O_INACTIVE)); /* Do nothing if disabled. */ if (!(bs->open_flags & BDRV_O_UNMAP)) { return 0; if (!bs->drv->bdrv_co_pdiscard && !bs->drv->bdrv_aio_pdiscard) { return 0; /* Discard is advisory, but some devices track and coalesce * unaligned requests, so we must pass everything down rather than * round here. Still, most devices will just silently ignore * unaligned requests (by returning -ENOTSUP), so we must fragment * the request accordingly. */ align = MAX(bs->bl.pdiscard_alignment, bs->bl.request_alignment); assert(align % bs->bl.request_alignment == 0); head = offset % align; tail = (offset + bytes) % align; bdrv_inc_in_flight(bs); tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_DISCARD); ret = notifier_with_return_list_notify(&bs->before_write_notifiers, &req); if (ret < 0) { max_pdiscard = QEMU_ALIGN_DOWN(MIN_NON_ZERO(bs->bl.max_pdiscard, INT_MAX), align); assert(max_pdiscard >= bs->bl.request_alignment); while (bytes > 0) { int num = bytes; if (head) { /* Make small requests to get to alignment boundaries. */ num = MIN(bytes, align - head); if (!QEMU_IS_ALIGNED(num, bs->bl.request_alignment)) { num %= bs->bl.request_alignment; head = (head + num) % align; assert(num < max_pdiscard); } else if (tail) { if (num > align) { /* Shorten the request to the last aligned cluster. */ num -= tail; } else if (!QEMU_IS_ALIGNED(tail, bs->bl.request_alignment) && tail > bs->bl.request_alignment) { tail %= bs->bl.request_alignment; num -= tail; /* limit request size */ if (num > max_pdiscard) { num = max_pdiscard; if (bs->drv->bdrv_co_pdiscard) { ret = bs->drv->bdrv_co_pdiscard(bs, offset, num); } else { BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; acb = bs->drv->bdrv_aio_pdiscard(bs, offset, num, bdrv_co_io_em_complete, &co); if (acb == NULL) { ret = -EIO; } else { qemu_coroutine_yield(); ret = co.ret; if (ret && ret != -ENOTSUP) { offset += num; bytes -= num; ret = 0; out: atomic_inc(&bs->write_gen); bdrv_set_dirty(bs, req.offset, req.bytes); tracked_request_end(&req); bdrv_dec_in_flight(bs); return ret;
true
qemu
d470ad42acfc73c45d3e8ed5311a491160b4c100
int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) { BdrvTrackedRequest req; int max_pdiscard, ret; int head, tail, align; return -ENOMEDIUM; if (bdrv_has_readonly_bitmaps(bs)) { return -EPERM; ret = bdrv_check_byte_request(bs, offset, bytes); if (ret < 0) { return ret; } else if (bs->read_only) { return -EPERM; assert(!(bs->open_flags & BDRV_O_INACTIVE)); if (!(bs->open_flags & BDRV_O_UNMAP)) { return 0; if (!bs->drv->bdrv_co_pdiscard && !bs->drv->bdrv_aio_pdiscard) { return 0; align = MAX(bs->bl.pdiscard_alignment, bs->bl.request_alignment); assert(align % bs->bl.request_alignment == 0); head = offset % align; tail = (offset + bytes) % align; bdrv_inc_in_flight(bs); tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_DISCARD); ret = notifier_with_return_list_notify(&bs->before_write_notifiers, &req); if (ret < 0) { max_pdiscard = QEMU_ALIGN_DOWN(MIN_NON_ZERO(bs->bl.max_pdiscard, INT_MAX), align); assert(max_pdiscard >= bs->bl.request_alignment); while (bytes > 0) { int num = bytes; if (head) { num = MIN(bytes, align - head); if (!QEMU_IS_ALIGNED(num, bs->bl.request_alignment)) { num %= bs->bl.request_alignment; head = (head + num) % align; assert(num < max_pdiscard); } else if (tail) { if (num > align) { num -= tail; } else if (!QEMU_IS_ALIGNED(tail, bs->bl.request_alignment) && tail > bs->bl.request_alignment) { tail %= bs->bl.request_alignment; num -= tail; if (num > max_pdiscard) { num = max_pdiscard; if (bs->drv->bdrv_co_pdiscard) { ret = bs->drv->bdrv_co_pdiscard(bs, offset, num); } else { BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; acb = bs->drv->bdrv_aio_pdiscard(bs, offset, num, bdrv_co_io_em_complete, &co); if (acb == NULL) { ret = -EIO; } else { qemu_coroutine_yield(); ret = co.ret; if (ret && ret != -ENOTSUP) { offset += num; bytes -= num; ret = 0; out: atomic_inc(&bs->write_gen); bdrv_set_dirty(bs, req.offset, req.bytes); tracked_request_end(&req); bdrv_dec_in_flight(bs); return ret;
{ "code": [], "line_no": [] }
int VAR_0 bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) { BdrvTrackedRequest req; int max_pdiscard, ret; int head, tail, align; return -ENOMEDIUM; if (bdrv_has_readonly_bitmaps(bs)) { return -EPERM; ret = bdrv_check_byte_request(bs, offset, bytes); if (ret < 0) { return ret; } else if (bs->read_only) { return -EPERM; assert(!(bs->open_flags & BDRV_O_INACTIVE)); if (!(bs->open_flags & BDRV_O_UNMAP)) { return 0; if (!bs->drv->bdrv_co_pdiscard && !bs->drv->bdrv_aio_pdiscard) { return 0; align = MAX(bs->bl.pdiscard_alignment, bs->bl.request_alignment); assert(align % bs->bl.request_alignment == 0); head = offset % align; tail = (offset + bytes) % align; bdrv_inc_in_flight(bs); tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_DISCARD); ret = notifier_with_return_list_notify(&bs->before_write_notifiers, &req); if (ret < 0) { max_pdiscard = QEMU_ALIGN_DOWN(MIN_NON_ZERO(bs->bl.max_pdiscard, INT_MAX), align); assert(max_pdiscard >= bs->bl.request_alignment); while (bytes > 0) { int num = bytes; if (head) { num = MIN(bytes, align - head); if (!QEMU_IS_ALIGNED(num, bs->bl.request_alignment)) { num %= bs->bl.request_alignment; head = (head + num) % align; assert(num < max_pdiscard); } else if (tail) { if (num > align) { num -= tail; } else if (!QEMU_IS_ALIGNED(tail, bs->bl.request_alignment) && tail > bs->bl.request_alignment) { tail %= bs->bl.request_alignment; num -= tail; if (num > max_pdiscard) { num = max_pdiscard; if (bs->drv->bdrv_co_pdiscard) { ret = bs->drv->bdrv_co_pdiscard(bs, offset, num); } else { BlockAIOCB *acb; CoroutineIOCompletion co = { .coroutine = qemu_coroutine_self(), }; acb = bs->drv->bdrv_aio_pdiscard(bs, offset, num, bdrv_co_io_em_complete, &co); if (acb == NULL) { ret = -EIO; } else { qemu_coroutine_yield(); ret = co.ret; if (ret && ret != -ENOTSUP) { offset += num; bytes -= num; ret = 0; out: atomic_inc(&bs->write_gen); bdrv_set_dirty(bs, req.offset, req.bytes); tracked_request_end(&req); bdrv_dec_in_flight(bs); return ret;
[ "int VAR_0 bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset,\nint bytes)\n{", "BdrvTrackedRequest req;", "int max_pdiscard, ret;", "int head, tail, align;", "return -ENOMEDIUM;", "if (bdrv_has_readonly_bitmaps(bs)) {", "return -EPERM;", "ret = bdrv_check_byte_request(bs, offset, bytes);", "if (ret < 0) {", "return ret;", "} else if (bs->read_only) {", "return -EPERM;", "assert(!(bs->open_flags & BDRV_O_INACTIVE));", "if (!(bs->open_flags & BDRV_O_UNMAP)) {", "return 0;", "if (!bs->drv->bdrv_co_pdiscard && !bs->drv->bdrv_aio_pdiscard) {", "return 0;", "align = MAX(bs->bl.pdiscard_alignment, bs->bl.request_alignment);", "assert(align % bs->bl.request_alignment == 0);", "head = offset % align;", "tail = (offset + bytes) % align;", "bdrv_inc_in_flight(bs);", "tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_DISCARD);", "ret = notifier_with_return_list_notify(&bs->before_write_notifiers, &req);", "if (ret < 0) {", "max_pdiscard = QEMU_ALIGN_DOWN(MIN_NON_ZERO(bs->bl.max_pdiscard, INT_MAX),\nalign);", "assert(max_pdiscard >= bs->bl.request_alignment);", "while (bytes > 0) {", "int num = bytes;", "if (head) {", "num = MIN(bytes, align - head);", "if (!QEMU_IS_ALIGNED(num, bs->bl.request_alignment)) {", "num %= bs->bl.request_alignment;", "head = (head + num) % align;", "assert(num < max_pdiscard);", "} else if (tail) {", "if (num > align) {", "num -= tail;", "} else if (!QEMU_IS_ALIGNED(tail, bs->bl.request_alignment) &&", "tail > bs->bl.request_alignment) {", "tail %= bs->bl.request_alignment;", "num -= tail;", "if (num > max_pdiscard) {", "num = max_pdiscard;", "if (bs->drv->bdrv_co_pdiscard) {", "ret = bs->drv->bdrv_co_pdiscard(bs, offset, num);", "} else {", "BlockAIOCB *acb;", "CoroutineIOCompletion co = {", ".coroutine = qemu_coroutine_self(),\n};", "acb = bs->drv->bdrv_aio_pdiscard(bs, offset, num,\nbdrv_co_io_em_complete, &co);", "if (acb == NULL) {", "ret = -EIO;", "} else {", "qemu_coroutine_yield();", "ret = co.ret;", "if (ret && ret != -ENOTSUP) {", "offset += num;", "bytes -= num;", "ret = 0;", "out:\natomic_inc(&bs->write_gen);", "bdrv_set_dirty(bs, req.offset, req.bytes);", "tracked_request_end(&req);", "bdrv_dec_in_flight(bs);", "return ret;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 16 ], [ 21 ], [ 23 ], [ 28 ], [ 30 ], [ 32 ], [ 34 ], [ 36 ], [ 39 ], [ 45 ], [ 47 ], [ 52 ], [ 54 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 93, 95 ], [ 97 ], [ 101 ], [ 103 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 118 ], [ 120 ], [ 122 ], [ 124 ], [ 128 ], [ 130 ], [ 132 ], [ 134 ], [ 136 ], [ 142 ], [ 144 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 178 ], [ 180 ], [ 182 ], [ 186 ], [ 192 ], [ 194 ], [ 197 ], [ 199, 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ] ]
13,341
int ff_mediacodec_dec_close(AVCodecContext *avctx, MediaCodecDecContext *s) { if (s->codec) { ff_AMediaCodec_delete(s->codec); s->codec = NULL; } if (s->format) { ff_AMediaFormat_delete(s->format); s->format = NULL; } return 0; }
true
FFmpeg
31fe3c4d23aab8b43614b1ea825603080775677e
int ff_mediacodec_dec_close(AVCodecContext *avctx, MediaCodecDecContext *s) { if (s->codec) { ff_AMediaCodec_delete(s->codec); s->codec = NULL; } if (s->format) { ff_AMediaFormat_delete(s->format); s->format = NULL; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, MediaCodecDecContext *VAR_1) { if (VAR_1->codec) { ff_AMediaCodec_delete(VAR_1->codec); VAR_1->codec = NULL; } if (VAR_1->format) { ff_AMediaFormat_delete(VAR_1->format); VAR_1->format = NULL; } return 0; }
[ "int FUNC_0(AVCodecContext *VAR_0, MediaCodecDecContext *VAR_1)\n{", "if (VAR_1->codec) {", "ff_AMediaCodec_delete(VAR_1->codec);", "VAR_1->codec = NULL;", "}", "if (VAR_1->format) {", "ff_AMediaFormat_delete(VAR_1->format);", "VAR_1->format = NULL;", "}", "return 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,342
static void uhci_async_validate_end(UHCIState *s) { UHCIQueue *queue, *n; QTAILQ_FOREACH_SAFE(queue, &s->queues, next, n) { if (!queue->valid) { uhci_queue_free(queue); } } }
true
qemu
66a08cbe6ad1aebec8eecf58b3ba042e19dd1649
static void uhci_async_validate_end(UHCIState *s) { UHCIQueue *queue, *n; QTAILQ_FOREACH_SAFE(queue, &s->queues, next, n) { if (!queue->valid) { uhci_queue_free(queue); } } }
{ "code": [ " uhci_queue_free(queue);" ], "line_no": [ 13 ] }
static void FUNC_0(UHCIState *VAR_0) { UHCIQueue *queue, *n; QTAILQ_FOREACH_SAFE(queue, &VAR_0->queues, next, n) { if (!queue->valid) { uhci_queue_free(queue); } } }
[ "static void FUNC_0(UHCIState *VAR_0)\n{", "UHCIQueue *queue, *n;", "QTAILQ_FOREACH_SAFE(queue, &VAR_0->queues, next, n) {", "if (!queue->valid) {", "uhci_queue_free(queue);", "}", "}", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
13,343
static int fic_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { FICContext *ctx = avctx->priv_data; uint8_t *src = avpkt->data; int ret; int slice, nslices; int msize; int tsize; int cur_x, cur_y; int skip_cursor = ctx->skip_cursor; uint8_t *sdata; if ((ret = ff_reget_buffer(avctx, ctx->frame)) < 0) return ret; /* Header + at least one slice (4) */ if (avpkt->size < FIC_HEADER_SIZE + 4) { av_log(avctx, AV_LOG_ERROR, "Frame data is too small.\n"); return AVERROR_INVALIDDATA; } /* Check for header. */ if (memcmp(src, fic_header, 7)) av_log(avctx, AV_LOG_WARNING, "Invalid FIC Header.\n"); /* Is it a skip frame? */ if (src[17]) { if (!ctx->final_frame) { av_log(avctx, AV_LOG_WARNING, "Initial frame is skipped\n"); return AVERROR_INVALIDDATA; } goto skip; } nslices = src[13]; if (!nslices) { av_log(avctx, AV_LOG_ERROR, "Zero slices found.\n"); return AVERROR_INVALIDDATA; } /* High or Low Quality Matrix? */ ctx->qmat = src[23] ? fic_qmat_hq : fic_qmat_lq; /* Skip cursor data. */ tsize = AV_RB24(src + 24); if (tsize > avpkt->size - FIC_HEADER_SIZE) { av_log(avctx, AV_LOG_ERROR, "Packet is too small to contain cursor (%d vs %d bytes).\n", tsize, avpkt->size - FIC_HEADER_SIZE); return AVERROR_INVALIDDATA; } if (!tsize || !AV_RL16(src + 37) || !AV_RL16(src + 39)) skip_cursor = 1; if (!skip_cursor && tsize < 32) { av_log(avctx, AV_LOG_WARNING, "Cursor data too small. Skipping cursor.\n"); skip_cursor = 1; } /* Cursor position. */ cur_x = AV_RL16(src + 33); cur_y = AV_RL16(src + 35); if (!skip_cursor && (cur_x > avctx->width || cur_y > avctx->height)) { av_log(avctx, AV_LOG_DEBUG, "Invalid cursor position: (%d,%d). Skipping cursor.\n", cur_x, cur_y); skip_cursor = 1; } if (!skip_cursor && (AV_RL16(src + 37) != 32 || AV_RL16(src + 39) != 32)) { av_log(avctx, AV_LOG_WARNING, "Invalid cursor size. Skipping cursor.\n"); skip_cursor = 1; } /* Slice height for all but the last slice. */ ctx->slice_h = 16 * (ctx->aligned_height >> 4) / nslices; if (ctx->slice_h % 16) ctx->slice_h = FFALIGN(ctx->slice_h - 16, 16); /* First slice offset and remaining data. */ sdata = src + tsize + FIC_HEADER_SIZE + 4 * nslices; msize = avpkt->size - nslices * 4 - tsize - FIC_HEADER_SIZE; if (msize <= 0) { av_log(avctx, AV_LOG_ERROR, "Not enough frame data to decode.\n"); return AVERROR_INVALIDDATA; } /* * Set the frametype to I initially. It will be set to P if the frame * has any dependencies (skip blocks). There will be a race condition * inside the slice decode function to set these, but we do not care. * since they will only ever be set to 0/P. */ ctx->frame->key_frame = 1; ctx->frame->pict_type = AV_PICTURE_TYPE_I; /* Allocate slice data. */ av_fast_malloc(&ctx->slice_data, &ctx->slice_data_size, nslices * sizeof(ctx->slice_data[0])); if (!ctx->slice_data_size) { av_log(avctx, AV_LOG_ERROR, "Could not allocate slice data.\n"); return AVERROR(ENOMEM); } memset(ctx->slice_data, 0, nslices * sizeof(ctx->slice_data[0])); for (slice = 0; slice < nslices; slice++) { unsigned slice_off = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4); unsigned slice_size; int y_off = ctx->slice_h * slice; int slice_h = ctx->slice_h; /* * Either read the slice size, or consume all data left. * Also, special case the last slight height. */ if (slice == nslices - 1) { slice_size = msize; slice_h = FFALIGN(avctx->height - ctx->slice_h * (nslices - 1), 16); } else { slice_size = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4 + 4); } if (slice_size < slice_off || slice_size > msize) continue; slice_size -= slice_off; ctx->slice_data[slice].src = sdata + slice_off; ctx->slice_data[slice].src_size = slice_size; ctx->slice_data[slice].slice_h = slice_h; ctx->slice_data[slice].y_off = y_off; } if ((ret = avctx->execute(avctx, fic_decode_slice, ctx->slice_data, NULL, nslices, sizeof(ctx->slice_data[0]))) < 0) return ret; av_frame_free(&ctx->final_frame); ctx->final_frame = av_frame_clone(ctx->frame); if (!ctx->final_frame) { av_log(avctx, AV_LOG_ERROR, "Could not clone frame buffer.\n"); return AVERROR(ENOMEM); } /* Make sure we use a user-supplied buffer. */ if ((ret = ff_reget_buffer(avctx, ctx->final_frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "Could not make frame writable.\n"); return ret; } /* Draw cursor. */ if (!skip_cursor) { memcpy(ctx->cursor_buf, src + 59, 32 * 32 * 4); fic_draw_cursor(avctx, cur_x, cur_y); } skip: *got_frame = 1; if ((ret = av_frame_ref(data, ctx->final_frame)) < 0) return ret; return avpkt->size; }
true
FFmpeg
73f863d751df84db7a0ca1bd83cdff1b95dc94dd
static int fic_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { FICContext *ctx = avctx->priv_data; uint8_t *src = avpkt->data; int ret; int slice, nslices; int msize; int tsize; int cur_x, cur_y; int skip_cursor = ctx->skip_cursor; uint8_t *sdata; if ((ret = ff_reget_buffer(avctx, ctx->frame)) < 0) return ret; if (avpkt->size < FIC_HEADER_SIZE + 4) { av_log(avctx, AV_LOG_ERROR, "Frame data is too small.\n"); return AVERROR_INVALIDDATA; } if (memcmp(src, fic_header, 7)) av_log(avctx, AV_LOG_WARNING, "Invalid FIC Header.\n"); if (src[17]) { if (!ctx->final_frame) { av_log(avctx, AV_LOG_WARNING, "Initial frame is skipped\n"); return AVERROR_INVALIDDATA; } goto skip; } nslices = src[13]; if (!nslices) { av_log(avctx, AV_LOG_ERROR, "Zero slices found.\n"); return AVERROR_INVALIDDATA; } ctx->qmat = src[23] ? fic_qmat_hq : fic_qmat_lq; tsize = AV_RB24(src + 24); if (tsize > avpkt->size - FIC_HEADER_SIZE) { av_log(avctx, AV_LOG_ERROR, "Packet is too small to contain cursor (%d vs %d bytes).\n", tsize, avpkt->size - FIC_HEADER_SIZE); return AVERROR_INVALIDDATA; } if (!tsize || !AV_RL16(src + 37) || !AV_RL16(src + 39)) skip_cursor = 1; if (!skip_cursor && tsize < 32) { av_log(avctx, AV_LOG_WARNING, "Cursor data too small. Skipping cursor.\n"); skip_cursor = 1; } cur_x = AV_RL16(src + 33); cur_y = AV_RL16(src + 35); if (!skip_cursor && (cur_x > avctx->width || cur_y > avctx->height)) { av_log(avctx, AV_LOG_DEBUG, "Invalid cursor position: (%d,%d). Skipping cursor.\n", cur_x, cur_y); skip_cursor = 1; } if (!skip_cursor && (AV_RL16(src + 37) != 32 || AV_RL16(src + 39) != 32)) { av_log(avctx, AV_LOG_WARNING, "Invalid cursor size. Skipping cursor.\n"); skip_cursor = 1; } ctx->slice_h = 16 * (ctx->aligned_height >> 4) / nslices; if (ctx->slice_h % 16) ctx->slice_h = FFALIGN(ctx->slice_h - 16, 16); sdata = src + tsize + FIC_HEADER_SIZE + 4 * nslices; msize = avpkt->size - nslices * 4 - tsize - FIC_HEADER_SIZE; if (msize <= 0) { av_log(avctx, AV_LOG_ERROR, "Not enough frame data to decode.\n"); return AVERROR_INVALIDDATA; } ctx->frame->key_frame = 1; ctx->frame->pict_type = AV_PICTURE_TYPE_I; av_fast_malloc(&ctx->slice_data, &ctx->slice_data_size, nslices * sizeof(ctx->slice_data[0])); if (!ctx->slice_data_size) { av_log(avctx, AV_LOG_ERROR, "Could not allocate slice data.\n"); return AVERROR(ENOMEM); } memset(ctx->slice_data, 0, nslices * sizeof(ctx->slice_data[0])); for (slice = 0; slice < nslices; slice++) { unsigned slice_off = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4); unsigned slice_size; int y_off = ctx->slice_h * slice; int slice_h = ctx->slice_h; if (slice == nslices - 1) { slice_size = msize; slice_h = FFALIGN(avctx->height - ctx->slice_h * (nslices - 1), 16); } else { slice_size = AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4 + 4); } if (slice_size < slice_off || slice_size > msize) continue; slice_size -= slice_off; ctx->slice_data[slice].src = sdata + slice_off; ctx->slice_data[slice].src_size = slice_size; ctx->slice_data[slice].slice_h = slice_h; ctx->slice_data[slice].y_off = y_off; } if ((ret = avctx->execute(avctx, fic_decode_slice, ctx->slice_data, NULL, nslices, sizeof(ctx->slice_data[0]))) < 0) return ret; av_frame_free(&ctx->final_frame); ctx->final_frame = av_frame_clone(ctx->frame); if (!ctx->final_frame) { av_log(avctx, AV_LOG_ERROR, "Could not clone frame buffer.\n"); return AVERROR(ENOMEM); } if ((ret = ff_reget_buffer(avctx, ctx->final_frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "Could not make frame writable.\n"); return ret; } if (!skip_cursor) { memcpy(ctx->cursor_buf, src + 59, 32 * 32 * 4); fic_draw_cursor(avctx, cur_x, cur_y); } skip: *got_frame = 1; if ((ret = av_frame_ref(data, ctx->final_frame)) < 0) return ret; return avpkt->size; }
{ "code": [ " ctx->frame->key_frame = 1;", " ctx->frame->pict_type = AV_PICTURE_TYPE_I;" ], "line_no": [ 197, 199 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { FICContext *ctx = VAR_0->priv_data; uint8_t *src = VAR_3->VAR_1; int VAR_4; int VAR_5, VAR_6; int VAR_7; int VAR_8; int VAR_9, VAR_10; int VAR_11 = ctx->VAR_11; uint8_t *sdata; if ((VAR_4 = ff_reget_buffer(VAR_0, ctx->frame)) < 0) return VAR_4; if (VAR_3->size < FIC_HEADER_SIZE + 4) { av_log(VAR_0, AV_LOG_ERROR, "Frame VAR_1 is too small.\n"); return AVERROR_INVALIDDATA; } if (memcmp(src, fic_header, 7)) av_log(VAR_0, AV_LOG_WARNING, "Invalid FIC Header.\n"); if (src[17]) { if (!ctx->final_frame) { av_log(VAR_0, AV_LOG_WARNING, "Initial frame is skipped\n"); return AVERROR_INVALIDDATA; } goto skip; } VAR_6 = src[13]; if (!VAR_6) { av_log(VAR_0, AV_LOG_ERROR, "Zero slices found.\n"); return AVERROR_INVALIDDATA; } ctx->qmat = src[23] ? fic_qmat_hq : fic_qmat_lq; VAR_8 = AV_RB24(src + 24); if (VAR_8 > VAR_3->size - FIC_HEADER_SIZE) { av_log(VAR_0, AV_LOG_ERROR, "Packet is too small to contain cursor (%d vs %d bytes).\n", VAR_8, VAR_3->size - FIC_HEADER_SIZE); return AVERROR_INVALIDDATA; } if (!VAR_8 || !AV_RL16(src + 37) || !AV_RL16(src + 39)) VAR_11 = 1; if (!VAR_11 && VAR_8 < 32) { av_log(VAR_0, AV_LOG_WARNING, "Cursor VAR_1 too small. Skipping cursor.\n"); VAR_11 = 1; } VAR_9 = AV_RL16(src + 33); VAR_10 = AV_RL16(src + 35); if (!VAR_11 && (VAR_9 > VAR_0->width || VAR_10 > VAR_0->height)) { av_log(VAR_0, AV_LOG_DEBUG, "Invalid cursor position: (%d,%d). Skipping cursor.\n", VAR_9, VAR_10); VAR_11 = 1; } if (!VAR_11 && (AV_RL16(src + 37) != 32 || AV_RL16(src + 39) != 32)) { av_log(VAR_0, AV_LOG_WARNING, "Invalid cursor size. Skipping cursor.\n"); VAR_11 = 1; } ctx->VAR_15 = 16 * (ctx->aligned_height >> 4) / VAR_6; if (ctx->VAR_15 % 16) ctx->VAR_15 = FFALIGN(ctx->VAR_15 - 16, 16); sdata = src + VAR_8 + FIC_HEADER_SIZE + 4 * VAR_6; VAR_7 = VAR_3->size - VAR_6 * 4 - VAR_8 - FIC_HEADER_SIZE; if (VAR_7 <= 0) { av_log(VAR_0, AV_LOG_ERROR, "Not enough frame VAR_1 to decode.\n"); return AVERROR_INVALIDDATA; } ctx->frame->key_frame = 1; ctx->frame->pict_type = AV_PICTURE_TYPE_I; av_fast_malloc(&ctx->slice_data, &ctx->slice_data_size, VAR_6 * sizeof(ctx->slice_data[0])); if (!ctx->slice_data_size) { av_log(VAR_0, AV_LOG_ERROR, "Could not allocate VAR_5 VAR_1.\n"); return AVERROR(ENOMEM); } memset(ctx->slice_data, 0, VAR_6 * sizeof(ctx->slice_data[0])); for (VAR_5 = 0; VAR_5 < VAR_6; VAR_5++) { unsigned VAR_12 = AV_RB32(src + VAR_8 + FIC_HEADER_SIZE + VAR_5 * 4); unsigned VAR_13; int VAR_14 = ctx->VAR_15 * VAR_5; int VAR_15 = ctx->VAR_15; if (VAR_5 == VAR_6 - 1) { VAR_13 = VAR_7; VAR_15 = FFALIGN(VAR_0->height - ctx->VAR_15 * (VAR_6 - 1), 16); } else { VAR_13 = AV_RB32(src + VAR_8 + FIC_HEADER_SIZE + VAR_5 * 4 + 4); } if (VAR_13 < VAR_12 || VAR_13 > VAR_7) continue; VAR_13 -= VAR_12; ctx->slice_data[VAR_5].src = sdata + VAR_12; ctx->slice_data[VAR_5].src_size = VAR_13; ctx->slice_data[VAR_5].VAR_15 = VAR_15; ctx->slice_data[VAR_5].VAR_14 = VAR_14; } if ((VAR_4 = VAR_0->execute(VAR_0, fic_decode_slice, ctx->slice_data, NULL, VAR_6, sizeof(ctx->slice_data[0]))) < 0) return VAR_4; av_frame_free(&ctx->final_frame); ctx->final_frame = av_frame_clone(ctx->frame); if (!ctx->final_frame) { av_log(VAR_0, AV_LOG_ERROR, "Could not clone frame buffer.\n"); return AVERROR(ENOMEM); } if ((VAR_4 = ff_reget_buffer(VAR_0, ctx->final_frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Could not make frame writable.\n"); return VAR_4; } if (!VAR_11) { memcpy(ctx->cursor_buf, src + 59, 32 * 32 * 4); fic_draw_cursor(VAR_0, VAR_9, VAR_10); } skip: *VAR_2 = 1; if ((VAR_4 = av_frame_ref(VAR_1, ctx->final_frame)) < 0) return VAR_4; return VAR_3->size; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "FICContext *ctx = VAR_0->priv_data;", "uint8_t *src = VAR_3->VAR_1;", "int VAR_4;", "int VAR_5, VAR_6;", "int VAR_7;", "int VAR_8;", "int VAR_9, VAR_10;", "int VAR_11 = ctx->VAR_11;", "uint8_t *sdata;", "if ((VAR_4 = ff_reget_buffer(VAR_0, ctx->frame)) < 0)\nreturn VAR_4;", "if (VAR_3->size < FIC_HEADER_SIZE + 4) {", "av_log(VAR_0, AV_LOG_ERROR, \"Frame VAR_1 is too small.\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (memcmp(src, fic_header, 7))\nav_log(VAR_0, AV_LOG_WARNING, \"Invalid FIC Header.\\n\");", "if (src[17]) {", "if (!ctx->final_frame) {", "av_log(VAR_0, AV_LOG_WARNING, \"Initial frame is skipped\\n\");", "return AVERROR_INVALIDDATA;", "}", "goto skip;", "}", "VAR_6 = src[13];", "if (!VAR_6) {", "av_log(VAR_0, AV_LOG_ERROR, \"Zero slices found.\\n\");", "return AVERROR_INVALIDDATA;", "}", "ctx->qmat = src[23] ? fic_qmat_hq : fic_qmat_lq;", "VAR_8 = AV_RB24(src + 24);", "if (VAR_8 > VAR_3->size - FIC_HEADER_SIZE) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Packet is too small to contain cursor (%d vs %d bytes).\\n\",\nVAR_8, VAR_3->size - FIC_HEADER_SIZE);", "return AVERROR_INVALIDDATA;", "}", "if (!VAR_8 || !AV_RL16(src + 37) || !AV_RL16(src + 39))\nVAR_11 = 1;", "if (!VAR_11 && VAR_8 < 32) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"Cursor VAR_1 too small. Skipping cursor.\\n\");", "VAR_11 = 1;", "}", "VAR_9 = AV_RL16(src + 33);", "VAR_10 = AV_RL16(src + 35);", "if (!VAR_11 && (VAR_9 > VAR_0->width || VAR_10 > VAR_0->height)) {", "av_log(VAR_0, AV_LOG_DEBUG,\n\"Invalid cursor position: (%d,%d). Skipping cursor.\\n\",\nVAR_9, VAR_10);", "VAR_11 = 1;", "}", "if (!VAR_11 && (AV_RL16(src + 37) != 32 || AV_RL16(src + 39) != 32)) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"Invalid cursor size. Skipping cursor.\\n\");", "VAR_11 = 1;", "}", "ctx->VAR_15 = 16 * (ctx->aligned_height >> 4) / VAR_6;", "if (ctx->VAR_15 % 16)\nctx->VAR_15 = FFALIGN(ctx->VAR_15 - 16, 16);", "sdata = src + VAR_8 + FIC_HEADER_SIZE + 4 * VAR_6;", "VAR_7 = VAR_3->size - VAR_6 * 4 - VAR_8 - FIC_HEADER_SIZE;", "if (VAR_7 <= 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Not enough frame VAR_1 to decode.\\n\");", "return AVERROR_INVALIDDATA;", "}", "ctx->frame->key_frame = 1;", "ctx->frame->pict_type = AV_PICTURE_TYPE_I;", "av_fast_malloc(&ctx->slice_data, &ctx->slice_data_size,\nVAR_6 * sizeof(ctx->slice_data[0]));", "if (!ctx->slice_data_size) {", "av_log(VAR_0, AV_LOG_ERROR, \"Could not allocate VAR_5 VAR_1.\\n\");", "return AVERROR(ENOMEM);", "}", "memset(ctx->slice_data, 0, VAR_6 * sizeof(ctx->slice_data[0]));", "for (VAR_5 = 0; VAR_5 < VAR_6; VAR_5++) {", "unsigned VAR_12 = AV_RB32(src + VAR_8 + FIC_HEADER_SIZE + VAR_5 * 4);", "unsigned VAR_13;", "int VAR_14 = ctx->VAR_15 * VAR_5;", "int VAR_15 = ctx->VAR_15;", "if (VAR_5 == VAR_6 - 1) {", "VAR_13 = VAR_7;", "VAR_15 = FFALIGN(VAR_0->height - ctx->VAR_15 * (VAR_6 - 1), 16);", "} else {", "VAR_13 = AV_RB32(src + VAR_8 + FIC_HEADER_SIZE + VAR_5 * 4 + 4);", "}", "if (VAR_13 < VAR_12 || VAR_13 > VAR_7)\ncontinue;", "VAR_13 -= VAR_12;", "ctx->slice_data[VAR_5].src = sdata + VAR_12;", "ctx->slice_data[VAR_5].src_size = VAR_13;", "ctx->slice_data[VAR_5].VAR_15 = VAR_15;", "ctx->slice_data[VAR_5].VAR_14 = VAR_14;", "}", "if ((VAR_4 = VAR_0->execute(VAR_0, fic_decode_slice, ctx->slice_data,\nNULL, VAR_6, sizeof(ctx->slice_data[0]))) < 0)\nreturn VAR_4;", "av_frame_free(&ctx->final_frame);", "ctx->final_frame = av_frame_clone(ctx->frame);", "if (!ctx->final_frame) {", "av_log(VAR_0, AV_LOG_ERROR, \"Could not clone frame buffer.\\n\");", "return AVERROR(ENOMEM);", "}", "if ((VAR_4 = ff_reget_buffer(VAR_0, ctx->final_frame)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Could not make frame writable.\\n\");", "return VAR_4;", "}", "if (!VAR_11) {", "memcpy(ctx->cursor_buf, src + 59, 32 * 32 * 4);", "fic_draw_cursor(VAR_0, VAR_9, VAR_10);", "}", "skip:\n*VAR_2 = 1;", "if ((VAR_4 = av_frame_ref(VAR_1, ctx->final_frame)) < 0)\nreturn VAR_4;", "return VAR_3->size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 47, 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 85 ], [ 91 ], [ 93 ], [ 95, 97, 99 ], [ 101 ], [ 103 ], [ 107, 109 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135, 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 159 ], [ 161, 163 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 197 ], [ 199 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 255, 257 ], [ 261 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 277, 279, 281 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 323, 325 ], [ 327, 329 ], [ 333 ], [ 335 ] ]
13,344
static void cdrom_pio_impl(int nblocks) { QPCIDevice *dev; void *bmdma_base, *ide_base; FILE *fh; int patt_blocks = MAX(16, nblocks); size_t patt_len = ATAPI_BLOCK_SIZE * patt_blocks; char *pattern = g_malloc(patt_len); size_t rxsize = ATAPI_BLOCK_SIZE * nblocks; uint16_t *rx = g_malloc0(rxsize); int i, j; uint8_t data; uint16_t limit; /* Prepopulate the CDROM with an interesting pattern */ generate_pattern(pattern, patt_len, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); fwrite(pattern, ATAPI_BLOCK_SIZE, patt_blocks, fh); fclose(fh); ide_test_start("-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 " "-device ide-cd,drive=sr0,bus=ide.0", tmp_path); dev = get_pci_device(&bmdma_base, &ide_base); qtest_irq_intercept_in(global_qtest, "ioapic"); /* PACKET command on device 0 */ qpci_io_writeb(dev, ide_base + reg_device, 0); qpci_io_writeb(dev, ide_base + reg_lba_middle, BYTE_COUNT_LIMIT & 0xFF); qpci_io_writeb(dev, ide_base + reg_lba_high, (BYTE_COUNT_LIMIT >> 8 & 0xFF)); qpci_io_writeb(dev, ide_base + reg_command, CMD_PACKET); /* HP0: Check_Status_A State */ nsleep(400); data = ide_wait_clear(BSY); /* HP1: Send_Packet State */ assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); /* SCSI CDB (READ10) -- read n*2048 bytes from block 0 */ send_scsi_cdb_read10(dev, ide_base, 0, nblocks); /* Read data back: occurs in bursts of 'BYTE_COUNT_LIMIT' bytes. * If BYTE_COUNT_LIMIT is odd, we transfer BYTE_COUNT_LIMIT - 1 bytes. * We allow an odd limit only when the remaining transfer size is * less than BYTE_COUNT_LIMIT. However, SCSI's read10 command can only * request n blocks, so our request size is always even. * For this reason, we assume there is never a hanging byte to fetch. */ g_assert(!(rxsize & 1)); limit = BYTE_COUNT_LIMIT & ~1; for (i = 0; i < DIV_ROUND_UP(rxsize, limit); i++) { size_t offset = i * (limit / 2); size_t rem = (rxsize / 2) - offset; /* HP3: INTRQ_Wait */ ide_wait_intr(IDE_PRIMARY_IRQ); /* HP2: Check_Status_B (and clear IRQ) */ data = ide_wait_clear(BSY); assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); /* HP4: Transfer_Data */ for (j = 0; j < MIN((limit / 2), rem); j++) { rx[offset + j] = cpu_to_le16(qpci_io_readw(dev, ide_base + reg_data)); } } /* Check for final completion IRQ */ ide_wait_intr(IDE_PRIMARY_IRQ); /* Sanity check final state */ data = ide_wait_clear(DRQ); assert_bit_set(data, DRDY); assert_bit_clear(data, DRQ | ERR | DF | BSY); g_assert_cmpint(memcmp(pattern, rx, rxsize), ==, 0); g_free(pattern); g_free(rx); test_bmdma_teardown(); }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
static void cdrom_pio_impl(int nblocks) { QPCIDevice *dev; void *bmdma_base, *ide_base; FILE *fh; int patt_blocks = MAX(16, nblocks); size_t patt_len = ATAPI_BLOCK_SIZE * patt_blocks; char *pattern = g_malloc(patt_len); size_t rxsize = ATAPI_BLOCK_SIZE * nblocks; uint16_t *rx = g_malloc0(rxsize); int i, j; uint8_t data; uint16_t limit; generate_pattern(pattern, patt_len, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); fwrite(pattern, ATAPI_BLOCK_SIZE, patt_blocks, fh); fclose(fh); ide_test_start("-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 " "-device ide-cd,drive=sr0,bus=ide.0", tmp_path); dev = get_pci_device(&bmdma_base, &ide_base); qtest_irq_intercept_in(global_qtest, "ioapic"); qpci_io_writeb(dev, ide_base + reg_device, 0); qpci_io_writeb(dev, ide_base + reg_lba_middle, BYTE_COUNT_LIMIT & 0xFF); qpci_io_writeb(dev, ide_base + reg_lba_high, (BYTE_COUNT_LIMIT >> 8 & 0xFF)); qpci_io_writeb(dev, ide_base + reg_command, CMD_PACKET); nsleep(400); data = ide_wait_clear(BSY); assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); send_scsi_cdb_read10(dev, ide_base, 0, nblocks); g_assert(!(rxsize & 1)); limit = BYTE_COUNT_LIMIT & ~1; for (i = 0; i < DIV_ROUND_UP(rxsize, limit); i++) { size_t offset = i * (limit / 2); size_t rem = (rxsize / 2) - offset; ide_wait_intr(IDE_PRIMARY_IRQ); data = ide_wait_clear(BSY); assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); for (j = 0; j < MIN((limit / 2), rem); j++) { rx[offset + j] = cpu_to_le16(qpci_io_readw(dev, ide_base + reg_data)); } } ide_wait_intr(IDE_PRIMARY_IRQ); data = ide_wait_clear(DRQ); assert_bit_set(data, DRDY); assert_bit_clear(data, DRQ | ERR | DF | BSY); g_assert_cmpint(memcmp(pattern, rx, rxsize), ==, 0); g_free(pattern); g_free(rx); test_bmdma_teardown(); }
{ "code": [ " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " qpci_io_writeb(dev, ide_base + reg_device, 0);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " qpci_io_writeb(dev, ide_base + reg_device, 0);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " qpci_io_writeb(dev, ide_base + reg_device, 0);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " qpci_io_writeb(dev, ide_base + reg_device, 0);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " void *bmdma_base, *ide_base;", " dev = get_pci_device(&bmdma_base, &ide_base);", " qpci_io_writeb(dev, ide_base + reg_device, 0);", " qpci_io_writeb(dev, ide_base + reg_lba_middle, BYTE_COUNT_LIMIT & 0xFF);", " qpci_io_writeb(dev, ide_base + reg_lba_high,", " (BYTE_COUNT_LIMIT >> 8 & 0xFF));", " qpci_io_writeb(dev, ide_base + reg_command, CMD_PACKET);", " send_scsi_cdb_read10(dev, ide_base, 0, nblocks);", " rx[offset + j] = cpu_to_le16(qpci_io_readw(dev,", " ide_base + reg_data));" ], "line_no": [ 45, 7, 45, 7, 45, 7, 45, 7, 45, 7, 45, 7, 45, 53, 7, 45, 7, 45, 53, 7, 45, 53, 7, 45, 53, 7, 45, 7, 45, 53, 55, 57, 59, 61, 79, 127, 129 ] }
static void FUNC_0(int VAR_0) { QPCIDevice *dev; void *VAR_1, *VAR_2; FILE *fh; int VAR_3 = MAX(16, VAR_0); size_t patt_len = ATAPI_BLOCK_SIZE * VAR_3; char *VAR_4 = g_malloc(patt_len); size_t rxsize = ATAPI_BLOCK_SIZE * VAR_0; uint16_t *rx = g_malloc0(rxsize); int VAR_5, VAR_6; uint8_t data; uint16_t limit; generate_pattern(VAR_4, patt_len, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); fwrite(VAR_4, ATAPI_BLOCK_SIZE, VAR_3, fh); fclose(fh); ide_test_start("-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 " "-device ide-cd,drive=sr0,bus=ide.0", tmp_path); dev = get_pci_device(&VAR_1, &VAR_2); qtest_irq_intercept_in(global_qtest, "ioapic"); qpci_io_writeb(dev, VAR_2 + reg_device, 0); qpci_io_writeb(dev, VAR_2 + reg_lba_middle, BYTE_COUNT_LIMIT & 0xFF); qpci_io_writeb(dev, VAR_2 + reg_lba_high, (BYTE_COUNT_LIMIT >> 8 & 0xFF)); qpci_io_writeb(dev, VAR_2 + reg_command, CMD_PACKET); nsleep(400); data = ide_wait_clear(BSY); assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); send_scsi_cdb_read10(dev, VAR_2, 0, VAR_0); g_assert(!(rxsize & 1)); limit = BYTE_COUNT_LIMIT & ~1; for (VAR_5 = 0; VAR_5 < DIV_ROUND_UP(rxsize, limit); VAR_5++) { size_t offset = VAR_5 * (limit / 2); size_t rem = (rxsize / 2) - offset; ide_wait_intr(IDE_PRIMARY_IRQ); data = ide_wait_clear(BSY); assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); for (VAR_6 = 0; VAR_6 < MIN((limit / 2), rem); VAR_6++) { rx[offset + VAR_6] = cpu_to_le16(qpci_io_readw(dev, VAR_2 + reg_data)); } } ide_wait_intr(IDE_PRIMARY_IRQ); data = ide_wait_clear(DRQ); assert_bit_set(data, DRDY); assert_bit_clear(data, DRQ | ERR | DF | BSY); g_assert_cmpint(memcmp(VAR_4, rx, rxsize), ==, 0); g_free(VAR_4); g_free(rx); test_bmdma_teardown(); }
[ "static void FUNC_0(int VAR_0)\n{", "QPCIDevice *dev;", "void *VAR_1, *VAR_2;", "FILE *fh;", "int VAR_3 = MAX(16, VAR_0);", "size_t patt_len = ATAPI_BLOCK_SIZE * VAR_3;", "char *VAR_4 = g_malloc(patt_len);", "size_t rxsize = ATAPI_BLOCK_SIZE * VAR_0;", "uint16_t *rx = g_malloc0(rxsize);", "int VAR_5, VAR_6;", "uint8_t data;", "uint16_t limit;", "generate_pattern(VAR_4, patt_len, ATAPI_BLOCK_SIZE);", "fh = fopen(tmp_path, \"w+\");", "fwrite(VAR_4, ATAPI_BLOCK_SIZE, VAR_3, fh);", "fclose(fh);", "ide_test_start(\"-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 \"\n\"-device ide-cd,drive=sr0,bus=ide.0\", tmp_path);", "dev = get_pci_device(&VAR_1, &VAR_2);", "qtest_irq_intercept_in(global_qtest, \"ioapic\");", "qpci_io_writeb(dev, VAR_2 + reg_device, 0);", "qpci_io_writeb(dev, VAR_2 + reg_lba_middle, BYTE_COUNT_LIMIT & 0xFF);", "qpci_io_writeb(dev, VAR_2 + reg_lba_high,\n(BYTE_COUNT_LIMIT >> 8 & 0xFF));", "qpci_io_writeb(dev, VAR_2 + reg_command, CMD_PACKET);", "nsleep(400);", "data = ide_wait_clear(BSY);", "assert_bit_set(data, DRQ | DRDY);", "assert_bit_clear(data, ERR | DF | BSY);", "send_scsi_cdb_read10(dev, VAR_2, 0, VAR_0);", "g_assert(!(rxsize & 1));", "limit = BYTE_COUNT_LIMIT & ~1;", "for (VAR_5 = 0; VAR_5 < DIV_ROUND_UP(rxsize, limit); VAR_5++) {", "size_t offset = VAR_5 * (limit / 2);", "size_t rem = (rxsize / 2) - offset;", "ide_wait_intr(IDE_PRIMARY_IRQ);", "data = ide_wait_clear(BSY);", "assert_bit_set(data, DRQ | DRDY);", "assert_bit_clear(data, ERR | DF | BSY);", "for (VAR_6 = 0; VAR_6 < MIN((limit / 2), rem); VAR_6++) {", "rx[offset + VAR_6] = cpu_to_le16(qpci_io_readw(dev,\nVAR_2 + reg_data));", "}", "}", "ide_wait_intr(IDE_PRIMARY_IRQ);", "data = ide_wait_clear(DRQ);", "assert_bit_set(data, DRDY);", "assert_bit_clear(data, DRQ | ERR | DF | BSY);", "g_assert_cmpint(memcmp(VAR_4, rx, rxsize), ==, 0);", "g_free(VAR_4);", "g_free(rx);", "test_bmdma_teardown();", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 79 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 109 ], [ 115 ], [ 117 ], [ 119 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 139 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ] ]
13,345
static int append_to_cached_buf(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { DVDSubContext *ctx = avctx->priv_data; if (ctx->buf_size > 0xffff - buf_size) { av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct " "too large SPU packets aborted.\n"); av_freep(&ctx->buf); return AVERROR_INVALIDDATA; } ctx->buf = av_realloc(ctx->buf, ctx->buf_size + buf_size); if (!ctx->buf) return AVERROR(ENOMEM); memcpy(ctx->buf + ctx->buf_size, buf, buf_size); ctx->buf_size += buf_size; return 0; }
true
FFmpeg
816577716bc6170bccfea3b9e865618b69a4b426
static int append_to_cached_buf(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { DVDSubContext *ctx = avctx->priv_data; if (ctx->buf_size > 0xffff - buf_size) { av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct " "too large SPU packets aborted.\n"); av_freep(&ctx->buf); return AVERROR_INVALIDDATA; } ctx->buf = av_realloc(ctx->buf, ctx->buf_size + buf_size); if (!ctx->buf) return AVERROR(ENOMEM); memcpy(ctx->buf + ctx->buf_size, buf, buf_size); ctx->buf_size += buf_size; return 0; }
{ "code": [ " if (ctx->buf_size > 0xffff - buf_size) {", " av_freep(&ctx->buf);", " ctx->buf = av_realloc(ctx->buf, ctx->buf_size + buf_size);", " if (!ctx->buf)", " return AVERROR(ENOMEM);" ], "line_no": [ 11, 17, 23, 25, 27 ] }
static int FUNC_0(AVCodecContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { DVDSubContext *ctx = VAR_0->priv_data; if (ctx->VAR_2 > 0xffff - VAR_2) { av_log(VAR_0, AV_LOG_WARNING, "Attempt to reconstruct " "too large SPU packets aborted.\n"); av_freep(&ctx->VAR_1); return AVERROR_INVALIDDATA; } ctx->VAR_1 = av_realloc(ctx->VAR_1, ctx->VAR_2 + VAR_2); if (!ctx->VAR_1) return AVERROR(ENOMEM); memcpy(ctx->VAR_1 + ctx->VAR_2, VAR_1, VAR_2); ctx->VAR_2 += VAR_2; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nconst uint8_t *VAR_1, int VAR_2)\n{", "DVDSubContext *ctx = VAR_0->priv_data;", "if (ctx->VAR_2 > 0xffff - VAR_2) {", "av_log(VAR_0, AV_LOG_WARNING, \"Attempt to reconstruct \"\n\"too large SPU packets aborted.\\n\");", "av_freep(&ctx->VAR_1);", "return AVERROR_INVALIDDATA;", "}", "ctx->VAR_1 = av_realloc(ctx->VAR_1, ctx->VAR_2 + VAR_2);", "if (!ctx->VAR_1)\nreturn AVERROR(ENOMEM);", "memcpy(ctx->VAR_1 + ctx->VAR_2, VAR_1, VAR_2);", "ctx->VAR_2 += VAR_2;", "return 0;", "}" ]
[ 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
13,348
static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc) { VirtIONet *n = qemu_get_nic_opaque(nc); VirtIODevice *vdev = VIRTIO_DEVICE(n); RxFilterInfo *info; strList *str_list, *entry; int i; info = g_malloc0(sizeof(*info)); info->name = g_strdup(nc->name); info->promiscuous = n->promisc; if (n->nouni) { info->unicast = RX_STATE_NONE; } else if (n->alluni) { info->unicast = RX_STATE_ALL; } else { info->unicast = RX_STATE_NORMAL; } if (n->nomulti) { info->multicast = RX_STATE_NONE; } else if (n->allmulti) { info->multicast = RX_STATE_ALL; } else { info->multicast = RX_STATE_NORMAL; } info->broadcast_allowed = n->nobcast; info->multicast_overflow = n->mac_table.multi_overflow; info->unicast_overflow = n->mac_table.uni_overflow; info->main_mac = mac_strdup_printf(n->mac); str_list = NULL; for (i = 0; i < n->mac_table.first_multi; i++) { entry = g_malloc0(sizeof(*entry)); entry->value = mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN); entry->next = str_list; str_list = entry; } info->unicast_table = str_list; str_list = NULL; for (i = n->mac_table.first_multi; i < n->mac_table.in_use; i++) { entry = g_malloc0(sizeof(*entry)); entry->value = mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN); entry->next = str_list; str_list = entry; } info->multicast_table = str_list; info->vlan_table = get_vlan_table(n); if (!((1 << VIRTIO_NET_F_CTRL_VLAN) & vdev->guest_features)) { info->vlan = RX_STATE_ALL; } else if (!info->vlan_table) { info->vlan = RX_STATE_NONE; } else { info->vlan = RX_STATE_NORMAL; } /* enable event notification after query */ nc->rxfilter_notify_enabled = 1; return info; }
false
qemu
ef546f1275f6563e8934dd5e338d29d9f9909ca6
static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc) { VirtIONet *n = qemu_get_nic_opaque(nc); VirtIODevice *vdev = VIRTIO_DEVICE(n); RxFilterInfo *info; strList *str_list, *entry; int i; info = g_malloc0(sizeof(*info)); info->name = g_strdup(nc->name); info->promiscuous = n->promisc; if (n->nouni) { info->unicast = RX_STATE_NONE; } else if (n->alluni) { info->unicast = RX_STATE_ALL; } else { info->unicast = RX_STATE_NORMAL; } if (n->nomulti) { info->multicast = RX_STATE_NONE; } else if (n->allmulti) { info->multicast = RX_STATE_ALL; } else { info->multicast = RX_STATE_NORMAL; } info->broadcast_allowed = n->nobcast; info->multicast_overflow = n->mac_table.multi_overflow; info->unicast_overflow = n->mac_table.uni_overflow; info->main_mac = mac_strdup_printf(n->mac); str_list = NULL; for (i = 0; i < n->mac_table.first_multi; i++) { entry = g_malloc0(sizeof(*entry)); entry->value = mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN); entry->next = str_list; str_list = entry; } info->unicast_table = str_list; str_list = NULL; for (i = n->mac_table.first_multi; i < n->mac_table.in_use; i++) { entry = g_malloc0(sizeof(*entry)); entry->value = mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN); entry->next = str_list; str_list = entry; } info->multicast_table = str_list; info->vlan_table = get_vlan_table(n); if (!((1 << VIRTIO_NET_F_CTRL_VLAN) & vdev->guest_features)) { info->vlan = RX_STATE_ALL; } else if (!info->vlan_table) { info->vlan = RX_STATE_NONE; } else { info->vlan = RX_STATE_NORMAL; } nc->rxfilter_notify_enabled = 1; return info; }
{ "code": [], "line_no": [] }
static RxFilterInfo *FUNC_0(NetClientState *nc) { VirtIONet *n = qemu_get_nic_opaque(nc); VirtIODevice *vdev = VIRTIO_DEVICE(n); RxFilterInfo *info; strList *str_list, *entry; int VAR_0; info = g_malloc0(sizeof(*info)); info->name = g_strdup(nc->name); info->promiscuous = n->promisc; if (n->nouni) { info->unicast = RX_STATE_NONE; } else if (n->alluni) { info->unicast = RX_STATE_ALL; } else { info->unicast = RX_STATE_NORMAL; } if (n->nomulti) { info->multicast = RX_STATE_NONE; } else if (n->allmulti) { info->multicast = RX_STATE_ALL; } else { info->multicast = RX_STATE_NORMAL; } info->broadcast_allowed = n->nobcast; info->multicast_overflow = n->mac_table.multi_overflow; info->unicast_overflow = n->mac_table.uni_overflow; info->main_mac = mac_strdup_printf(n->mac); str_list = NULL; for (VAR_0 = 0; VAR_0 < n->mac_table.first_multi; VAR_0++) { entry = g_malloc0(sizeof(*entry)); entry->value = mac_strdup_printf(n->mac_table.macs + VAR_0 * ETH_ALEN); entry->next = str_list; str_list = entry; } info->unicast_table = str_list; str_list = NULL; for (VAR_0 = n->mac_table.first_multi; VAR_0 < n->mac_table.in_use; VAR_0++) { entry = g_malloc0(sizeof(*entry)); entry->value = mac_strdup_printf(n->mac_table.macs + VAR_0 * ETH_ALEN); entry->next = str_list; str_list = entry; } info->multicast_table = str_list; info->vlan_table = get_vlan_table(n); if (!((1 << VIRTIO_NET_F_CTRL_VLAN) & vdev->guest_features)) { info->vlan = RX_STATE_ALL; } else if (!info->vlan_table) { info->vlan = RX_STATE_NONE; } else { info->vlan = RX_STATE_NORMAL; } nc->rxfilter_notify_enabled = 1; return info; }
[ "static RxFilterInfo *FUNC_0(NetClientState *nc)\n{", "VirtIONet *n = qemu_get_nic_opaque(nc);", "VirtIODevice *vdev = VIRTIO_DEVICE(n);", "RxFilterInfo *info;", "strList *str_list, *entry;", "int VAR_0;", "info = g_malloc0(sizeof(*info));", "info->name = g_strdup(nc->name);", "info->promiscuous = n->promisc;", "if (n->nouni) {", "info->unicast = RX_STATE_NONE;", "} else if (n->alluni) {", "info->unicast = RX_STATE_ALL;", "} else {", "info->unicast = RX_STATE_NORMAL;", "}", "if (n->nomulti) {", "info->multicast = RX_STATE_NONE;", "} else if (n->allmulti) {", "info->multicast = RX_STATE_ALL;", "} else {", "info->multicast = RX_STATE_NORMAL;", "}", "info->broadcast_allowed = n->nobcast;", "info->multicast_overflow = n->mac_table.multi_overflow;", "info->unicast_overflow = n->mac_table.uni_overflow;", "info->main_mac = mac_strdup_printf(n->mac);", "str_list = NULL;", "for (VAR_0 = 0; VAR_0 < n->mac_table.first_multi; VAR_0++) {", "entry = g_malloc0(sizeof(*entry));", "entry->value = mac_strdup_printf(n->mac_table.macs + VAR_0 * ETH_ALEN);", "entry->next = str_list;", "str_list = entry;", "}", "info->unicast_table = str_list;", "str_list = NULL;", "for (VAR_0 = n->mac_table.first_multi; VAR_0 < n->mac_table.in_use; VAR_0++) {", "entry = g_malloc0(sizeof(*entry));", "entry->value = mac_strdup_printf(n->mac_table.macs + VAR_0 * ETH_ALEN);", "entry->next = str_list;", "str_list = entry;", "}", "info->multicast_table = str_list;", "info->vlan_table = get_vlan_table(n);", "if (!((1 << VIRTIO_NET_F_CTRL_VLAN) & vdev->guest_features)) {", "info->vlan = RX_STATE_ALL;", "} else if (!info->vlan_table) {", "info->vlan = RX_STATE_NONE;", "} else {", "info->vlan = RX_STATE_NORMAL;", "}", "nc->rxfilter_notify_enabled = 1;", "return info;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 125 ], [ 129 ], [ 131 ] ]
13,349
static inline int64_t get_sector_offset(BlockDriverState *bs, int64_t sector_num, int write) { BDRVVPCState *s = bs->opaque; uint64_t offset = sector_num * 512; uint64_t bitmap_offset, block_offset; uint32_t pagetable_index, pageentry_index; pagetable_index = offset / s->block_size; pageentry_index = (offset % s->block_size) / 512; if (pagetable_index >= s->max_table_entries || s->pagetable[pagetable_index] == 0xffffffff) return -1; // not allocated bitmap_offset = 512 * (uint64_t) s->pagetable[pagetable_index]; block_offset = bitmap_offset + s->bitmap_size + (512 * pageentry_index); // We must ensure that we don't write to any sectors which are marked as // unused in the bitmap. We get away with setting all bits in the block // bitmap each time we write to a new block. This might cause Virtual PC to // miss sparse read optimization, but it's not a problem in terms of // correctness. if (write && (s->last_bitmap_offset != bitmap_offset)) { uint8_t bitmap[s->bitmap_size]; s->last_bitmap_offset = bitmap_offset; memset(bitmap, 0xff, s->bitmap_size); bdrv_pwrite_sync(bs->file, bitmap_offset, bitmap, s->bitmap_size); } // printf("sector: %" PRIx64 ", index: %x, offset: %x, bioff: %" PRIx64 ", bloff: %" PRIx64 "\n", // sector_num, pagetable_index, pageentry_index, // bitmap_offset, block_offset); // disabled by reason #if 0 #ifdef CACHE if (bitmap_offset != s->last_bitmap) { lseek(s->fd, bitmap_offset, SEEK_SET); s->last_bitmap = bitmap_offset; // Scary! Bitmap is stored as big endian 32bit entries, // while we used to look it up byte by byte read(s->fd, s->pageentry_u8, 512); for (i = 0; i < 128; i++) be32_to_cpus(&s->pageentry_u32[i]); } if ((s->pageentry_u8[pageentry_index / 8] >> (pageentry_index % 8)) & 1) return -1; #else lseek(s->fd, bitmap_offset + (pageentry_index / 8), SEEK_SET); read(s->fd, &bitmap_entry, 1); if ((bitmap_entry >> (pageentry_index % 8)) & 1) return -1; // not allocated #endif #endif return block_offset; }
false
qemu
304ee9174f4761d3f4da611352a815ab27baba06
static inline int64_t get_sector_offset(BlockDriverState *bs, int64_t sector_num, int write) { BDRVVPCState *s = bs->opaque; uint64_t offset = sector_num * 512; uint64_t bitmap_offset, block_offset; uint32_t pagetable_index, pageentry_index; pagetable_index = offset / s->block_size; pageentry_index = (offset % s->block_size) / 512; if (pagetable_index >= s->max_table_entries || s->pagetable[pagetable_index] == 0xffffffff) return -1; bitmap_offset = 512 * (uint64_t) s->pagetable[pagetable_index]; block_offset = bitmap_offset + s->bitmap_size + (512 * pageentry_index); if (write && (s->last_bitmap_offset != bitmap_offset)) { uint8_t bitmap[s->bitmap_size]; s->last_bitmap_offset = bitmap_offset; memset(bitmap, 0xff, s->bitmap_size); bdrv_pwrite_sync(bs->file, bitmap_offset, bitmap, s->bitmap_size); } #if 0 #ifdef CACHE if (bitmap_offset != s->last_bitmap) { lseek(s->fd, bitmap_offset, SEEK_SET); s->last_bitmap = bitmap_offset; read(s->fd, s->pageentry_u8, 512); for (i = 0; i < 128; i++) be32_to_cpus(&s->pageentry_u32[i]); } if ((s->pageentry_u8[pageentry_index / 8] >> (pageentry_index % 8)) & 1) return -1; #else lseek(s->fd, bitmap_offset + (pageentry_index / 8), SEEK_SET); read(s->fd, &bitmap_entry, 1); if ((bitmap_entry >> (pageentry_index % 8)) & 1) return -1; #endif #endif return block_offset; }
{ "code": [], "line_no": [] }
static inline int64_t FUNC_0(BlockDriverState *bs, int64_t sector_num, int write) { BDRVVPCState *s = bs->opaque; uint64_t offset = sector_num * 512; uint64_t bitmap_offset, block_offset; uint32_t pagetable_index, pageentry_index; pagetable_index = offset / s->block_size; pageentry_index = (offset % s->block_size) / 512; if (pagetable_index >= s->max_table_entries || s->pagetable[pagetable_index] == 0xffffffff) return -1; bitmap_offset = 512 * (uint64_t) s->pagetable[pagetable_index]; block_offset = bitmap_offset + s->bitmap_size + (512 * pageentry_index); if (write && (s->last_bitmap_offset != bitmap_offset)) { uint8_t bitmap[s->bitmap_size]; s->last_bitmap_offset = bitmap_offset; memset(bitmap, 0xff, s->bitmap_size); bdrv_pwrite_sync(bs->file, bitmap_offset, bitmap, s->bitmap_size); } #if 0 #ifdef CACHE if (bitmap_offset != s->last_bitmap) { lseek(s->fd, bitmap_offset, SEEK_SET); s->last_bitmap = bitmap_offset; read(s->fd, s->pageentry_u8, 512); for (i = 0; i < 128; i++) be32_to_cpus(&s->pageentry_u32[i]); } if ((s->pageentry_u8[pageentry_index / 8] >> (pageentry_index % 8)) & 1) return -1; #else lseek(s->fd, bitmap_offset + (pageentry_index / 8), SEEK_SET); read(s->fd, &bitmap_entry, 1); if ((bitmap_entry >> (pageentry_index % 8)) & 1) return -1; #endif #endif return block_offset; }
[ "static inline int64_t FUNC_0(BlockDriverState *bs,\nint64_t sector_num, int write)\n{", "BDRVVPCState *s = bs->opaque;", "uint64_t offset = sector_num * 512;", "uint64_t bitmap_offset, block_offset;", "uint32_t pagetable_index, pageentry_index;", "pagetable_index = offset / s->block_size;", "pageentry_index = (offset % s->block_size) / 512;", "if (pagetable_index >= s->max_table_entries || s->pagetable[pagetable_index] == 0xffffffff)\nreturn -1;", "bitmap_offset = 512 * (uint64_t) s->pagetable[pagetable_index];", "block_offset = bitmap_offset + s->bitmap_size + (512 * pageentry_index);", "if (write && (s->last_bitmap_offset != bitmap_offset)) {", "uint8_t bitmap[s->bitmap_size];", "s->last_bitmap_offset = bitmap_offset;", "memset(bitmap, 0xff, s->bitmap_size);", "bdrv_pwrite_sync(bs->file, bitmap_offset, bitmap, s->bitmap_size);", "}", "#if 0\n#ifdef CACHE\nif (bitmap_offset != s->last_bitmap)\n{", "lseek(s->fd, bitmap_offset, SEEK_SET);", "s->last_bitmap = bitmap_offset;", "read(s->fd, s->pageentry_u8, 512);", "for (i = 0; i < 128; i++)", "be32_to_cpus(&s->pageentry_u32[i]);", "}", "if ((s->pageentry_u8[pageentry_index / 8] >> (pageentry_index % 8)) & 1)\nreturn -1;", "#else\nlseek(s->fd, bitmap_offset + (pageentry_index / 8), SEEK_SET);", "read(s->fd, &bitmap_entry, 1);", "if ((bitmap_entry >> (pageentry_index % 8)) & 1)\nreturn -1;", "#endif\n#endif\nreturn block_offset;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 71, 73, 75, 77 ], [ 79 ], [ 83 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101, 103 ], [ 105, 107 ], [ 111 ], [ 115, 117 ], [ 119, 121, 125 ], [ 127 ] ]
13,350
av_cold void ff_dcadsp_init_x86(DCADSPContext *s) { int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_SSE(cpu_flags)) { #if ARCH_X86_32 s->int8x8_fmul_int32 = ff_int8x8_fmul_int32_sse; #endif s->lfe_fir[0] = ff_dca_lfe_fir0_sse; s->lfe_fir[1] = ff_dca_lfe_fir1_sse; } if (EXTERNAL_SSE2(cpu_flags)) { s->int8x8_fmul_int32 = ff_int8x8_fmul_int32_sse2; } if (EXTERNAL_SSE4(cpu_flags)) { s->int8x8_fmul_int32 = ff_int8x8_fmul_int32_sse4; } }
false
FFmpeg
4cb6964244fd6c099383d8b7e99731e72cc844b9
av_cold void ff_dcadsp_init_x86(DCADSPContext *s) { int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_SSE(cpu_flags)) { #if ARCH_X86_32 s->int8x8_fmul_int32 = ff_int8x8_fmul_int32_sse; #endif s->lfe_fir[0] = ff_dca_lfe_fir0_sse; s->lfe_fir[1] = ff_dca_lfe_fir1_sse; } if (EXTERNAL_SSE2(cpu_flags)) { s->int8x8_fmul_int32 = ff_int8x8_fmul_int32_sse2; } if (EXTERNAL_SSE4(cpu_flags)) { s->int8x8_fmul_int32 = ff_int8x8_fmul_int32_sse4; } }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(DCADSPContext *s) { int VAR_0 = av_get_cpu_flags(); if (EXTERNAL_SSE(VAR_0)) { #if ARCH_X86_32 s->int8x8_fmul_int32 = ff_int8x8_fmul_int32_sse; #endif s->lfe_fir[0] = ff_dca_lfe_fir0_sse; s->lfe_fir[1] = ff_dca_lfe_fir1_sse; } if (EXTERNAL_SSE2(VAR_0)) { s->int8x8_fmul_int32 = ff_int8x8_fmul_int32_sse2; } if (EXTERNAL_SSE4(VAR_0)) { s->int8x8_fmul_int32 = ff_int8x8_fmul_int32_sse4; } }
[ "av_cold void FUNC_0(DCADSPContext *s)\n{", "int VAR_0 = av_get_cpu_flags();", "if (EXTERNAL_SSE(VAR_0)) {", "#if ARCH_X86_32\ns->int8x8_fmul_int32 = ff_int8x8_fmul_int32_sse;", "#endif\ns->lfe_fir[0] = ff_dca_lfe_fir0_sse;", "s->lfe_fir[1] = ff_dca_lfe_fir1_sse;", "}", "if (EXTERNAL_SSE2(VAR_0)) {", "s->int8x8_fmul_int32 = ff_int8x8_fmul_int32_sse2;", "}", "if (EXTERNAL_SSE4(VAR_0)) {", "s->int8x8_fmul_int32 = ff_int8x8_fmul_int32_sse4;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
13,351
vpc_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { BDRVVPCState *s = bs->opaque; int ret; int64_t image_offset; int64_t n_bytes; int64_t bytes_done = 0; VHDFooter *footer = (VHDFooter *) s->footer_buf; QEMUIOVector local_qiov; if (be32_to_cpu(footer->type) == VHD_FIXED) { return bdrv_co_preadv(bs->file->bs, offset, bytes, qiov, 0); } qemu_co_mutex_lock(&s->lock); qemu_iovec_init(&local_qiov, qiov->niov); while (bytes > 0) { image_offset = get_image_offset(bs, offset, false); n_bytes = MIN(bytes, s->block_size - (offset % s->block_size)); if (image_offset == -1) { qemu_iovec_memset(qiov, bytes_done, 0, n_bytes); } else { qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); ret = bdrv_co_preadv(bs->file->bs, image_offset, n_bytes, &local_qiov, 0); if (ret < 0) { goto fail; } } bytes -= n_bytes; offset += n_bytes; bytes_done += n_bytes; } ret = 0; fail: qemu_iovec_destroy(&local_qiov); qemu_co_mutex_unlock(&s->lock); return ret; }
false
qemu
a03ef88f77af045a2eb9629b5ce774a3fb973c5e
vpc_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { BDRVVPCState *s = bs->opaque; int ret; int64_t image_offset; int64_t n_bytes; int64_t bytes_done = 0; VHDFooter *footer = (VHDFooter *) s->footer_buf; QEMUIOVector local_qiov; if (be32_to_cpu(footer->type) == VHD_FIXED) { return bdrv_co_preadv(bs->file->bs, offset, bytes, qiov, 0); } qemu_co_mutex_lock(&s->lock); qemu_iovec_init(&local_qiov, qiov->niov); while (bytes > 0) { image_offset = get_image_offset(bs, offset, false); n_bytes = MIN(bytes, s->block_size - (offset % s->block_size)); if (image_offset == -1) { qemu_iovec_memset(qiov, bytes_done, 0, n_bytes); } else { qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); ret = bdrv_co_preadv(bs->file->bs, image_offset, n_bytes, &local_qiov, 0); if (ret < 0) { goto fail; } } bytes -= n_bytes; offset += n_bytes; bytes_done += n_bytes; } ret = 0; fail: qemu_iovec_destroy(&local_qiov); qemu_co_mutex_unlock(&s->lock); return ret; }
{ "code": [], "line_no": [] }
FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint64_t VAR_2, QEMUIOVector *VAR_3, int VAR_4) { BDRVVPCState *s = VAR_0->opaque; int VAR_5; int64_t image_offset; int64_t n_bytes; int64_t bytes_done = 0; VHDFooter *footer = (VHDFooter *) s->footer_buf; QEMUIOVector local_qiov; if (be32_to_cpu(footer->type) == VHD_FIXED) { return bdrv_co_preadv(VAR_0->file->VAR_0, VAR_1, VAR_2, VAR_3, 0); } qemu_co_mutex_lock(&s->lock); qemu_iovec_init(&local_qiov, VAR_3->niov); while (VAR_2 > 0) { image_offset = get_image_offset(VAR_0, VAR_1, false); n_bytes = MIN(VAR_2, s->block_size - (VAR_1 % s->block_size)); if (image_offset == -1) { qemu_iovec_memset(VAR_3, bytes_done, 0, n_bytes); } else { qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, VAR_3, bytes_done, n_bytes); VAR_5 = bdrv_co_preadv(VAR_0->file->VAR_0, image_offset, n_bytes, &local_qiov, 0); if (VAR_5 < 0) { goto fail; } } VAR_2 -= n_bytes; VAR_1 += n_bytes; bytes_done += n_bytes; } VAR_5 = 0; fail: qemu_iovec_destroy(&local_qiov); qemu_co_mutex_unlock(&s->lock); return VAR_5; }
[ "FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint64_t VAR_2,\nQEMUIOVector *VAR_3, int VAR_4)\n{", "BDRVVPCState *s = VAR_0->opaque;", "int VAR_5;", "int64_t image_offset;", "int64_t n_bytes;", "int64_t bytes_done = 0;", "VHDFooter *footer = (VHDFooter *) s->footer_buf;", "QEMUIOVector local_qiov;", "if (be32_to_cpu(footer->type) == VHD_FIXED) {", "return bdrv_co_preadv(VAR_0->file->VAR_0, VAR_1, VAR_2, VAR_3, 0);", "}", "qemu_co_mutex_lock(&s->lock);", "qemu_iovec_init(&local_qiov, VAR_3->niov);", "while (VAR_2 > 0) {", "image_offset = get_image_offset(VAR_0, VAR_1, false);", "n_bytes = MIN(VAR_2, s->block_size - (VAR_1 % s->block_size));", "if (image_offset == -1) {", "qemu_iovec_memset(VAR_3, bytes_done, 0, n_bytes);", "} else {", "qemu_iovec_reset(&local_qiov);", "qemu_iovec_concat(&local_qiov, VAR_3, bytes_done, n_bytes);", "VAR_5 = bdrv_co_preadv(VAR_0->file->VAR_0, image_offset, n_bytes,\n&local_qiov, 0);", "if (VAR_5 < 0) {", "goto fail;", "}", "}", "VAR_2 -= n_bytes;", "VAR_1 += n_bytes;", "bytes_done += n_bytes;", "}", "VAR_5 = 0;", "fail:\nqemu_iovec_destroy(&local_qiov);", "qemu_co_mutex_unlock(&s->lock);", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 91 ], [ 93 ] ]
13,352
void do_store_dcr (void) { if (unlikely(env->dcr_env == NULL)) { if (loglevel != 0) { fprintf(logfile, "No DCR environment\n"); } do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_INVAL); } else if (unlikely(ppc_dcr_write(env->dcr_env, T0, T1) != 0)) { if (loglevel != 0) { fprintf(logfile, "DCR write error %d %03x\n", (int)T0, (int)T0); } do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_PRIV_REG); } }
false
qemu
e1833e1f96456fd8fc17463246fe0b2050e68efb
void do_store_dcr (void) { if (unlikely(env->dcr_env == NULL)) { if (loglevel != 0) { fprintf(logfile, "No DCR environment\n"); } do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_INVAL); } else if (unlikely(ppc_dcr_write(env->dcr_env, T0, T1) != 0)) { if (loglevel != 0) { fprintf(logfile, "DCR write error %d %03x\n", (int)T0, (int)T0); } do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_PRIV_REG); } }
{ "code": [], "line_no": [] }
void FUNC_0 (void) { if (unlikely(env->dcr_env == NULL)) { if (loglevel != 0) { fprintf(logfile, "No DCR environment\n"); } do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_INVAL); } else if (unlikely(ppc_dcr_write(env->dcr_env, T0, T1) != 0)) { if (loglevel != 0) { fprintf(logfile, "DCR write error %d %03x\n", (int)T0, (int)T0); } do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_PRIV_REG); } }
[ "void FUNC_0 (void)\n{", "if (unlikely(env->dcr_env == NULL)) {", "if (loglevel != 0) {", "fprintf(logfile, \"No DCR environment\\n\");", "}", "do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_INVAL);", "} else if (unlikely(ppc_dcr_write(env->dcr_env, T0, T1) != 0)) {", "if (loglevel != 0) {", "fprintf(logfile, \"DCR write error %d %03x\\n\", (int)T0, (int)T0);", "}", "do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_PRIV_REG);", "}", "}" ]
[ 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 ] ]
13,353
static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, int flags) { BlockDriver *drv = bs->drv; BdrvTrackedRequest req; int ret; int64_t sector_num = offset >> BDRV_SECTOR_BITS; unsigned int nb_sectors = bytes >> BDRV_SECTOR_BITS; assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); if (bs->copy_on_read_in_flight) { wait_for_overlapping_requests(bs, offset, bytes); } tracked_request_begin(&req, bs, offset, bytes, true); ret = notifier_with_return_list_notify(&bs->before_write_notifiers, &req); if (ret < 0) { /* Do nothing, write notifier decided to fail this request */ } else if (flags & BDRV_REQ_ZERO_WRITE) { ret = bdrv_co_do_write_zeroes(bs, sector_num, nb_sectors, flags); } else { ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov); } if (ret == 0 && !bs->enable_write_cache) { ret = bdrv_co_flush(bs); } bdrv_set_dirty(bs, sector_num, nb_sectors); if (bs->wr_highest_sector < sector_num + nb_sectors - 1) { bs->wr_highest_sector = sector_num + nb_sectors - 1; } if (bs->growable && ret >= 0) { bs->total_sectors = MAX(bs->total_sectors, sector_num + nb_sectors); } tracked_request_end(&req); return ret; }
false
qemu
65afd211c71fc91750d8a18f9604c1e57a5202fb
static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, int flags) { BlockDriver *drv = bs->drv; BdrvTrackedRequest req; int ret; int64_t sector_num = offset >> BDRV_SECTOR_BITS; unsigned int nb_sectors = bytes >> BDRV_SECTOR_BITS; assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); if (bs->copy_on_read_in_flight) { wait_for_overlapping_requests(bs, offset, bytes); } tracked_request_begin(&req, bs, offset, bytes, true); ret = notifier_with_return_list_notify(&bs->before_write_notifiers, &req); if (ret < 0) { } else if (flags & BDRV_REQ_ZERO_WRITE) { ret = bdrv_co_do_write_zeroes(bs, sector_num, nb_sectors, flags); } else { ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov); } if (ret == 0 && !bs->enable_write_cache) { ret = bdrv_co_flush(bs); } bdrv_set_dirty(bs, sector_num, nb_sectors); if (bs->wr_highest_sector < sector_num + nb_sectors - 1) { bs->wr_highest_sector = sector_num + nb_sectors - 1; } if (bs->growable && ret >= 0) { bs->total_sectors = MAX(bs->total_sectors, sector_num + nb_sectors); } tracked_request_end(&req); return ret; }
{ "code": [], "line_no": [] }
static int VAR_0 bdrv_aligned_pwritev(BlockDriverState *bs, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, int flags) { BlockDriver *drv = bs->drv; BdrvTrackedRequest req; int ret; int64_t sector_num = offset >> BDRV_SECTOR_BITS; unsigned int nb_sectors = bytes >> BDRV_SECTOR_BITS; assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0); assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0); if (bs->copy_on_read_in_flight) { wait_for_overlapping_requests(bs, offset, bytes); } tracked_request_begin(&req, bs, offset, bytes, true); ret = notifier_with_return_list_notify(&bs->before_write_notifiers, &req); if (ret < 0) { } else if (flags & BDRV_REQ_ZERO_WRITE) { ret = bdrv_co_do_write_zeroes(bs, sector_num, nb_sectors, flags); } else { ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov); } if (ret == 0 && !bs->enable_write_cache) { ret = bdrv_co_flush(bs); } bdrv_set_dirty(bs, sector_num, nb_sectors); if (bs->wr_highest_sector < sector_num + nb_sectors - 1) { bs->wr_highest_sector = sector_num + nb_sectors - 1; } if (bs->growable && ret >= 0) { bs->total_sectors = MAX(bs->total_sectors, sector_num + nb_sectors); } tracked_request_end(&req); return ret; }
[ "static int VAR_0 bdrv_aligned_pwritev(BlockDriverState *bs,\nint64_t offset, unsigned int bytes, QEMUIOVector *qiov, int flags)\n{", "BlockDriver *drv = bs->drv;", "BdrvTrackedRequest req;", "int ret;", "int64_t sector_num = offset >> BDRV_SECTOR_BITS;", "unsigned int nb_sectors = bytes >> BDRV_SECTOR_BITS;", "assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);", "assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);", "if (bs->copy_on_read_in_flight) {", "wait_for_overlapping_requests(bs, offset, bytes);", "}", "tracked_request_begin(&req, bs, offset, bytes, true);", "ret = notifier_with_return_list_notify(&bs->before_write_notifiers, &req);", "if (ret < 0) {", "} else if (flags & BDRV_REQ_ZERO_WRITE) {", "ret = bdrv_co_do_write_zeroes(bs, sector_num, nb_sectors, flags);", "} else {", "ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);", "}", "if (ret == 0 && !bs->enable_write_cache) {", "ret = bdrv_co_flush(bs);", "}", "bdrv_set_dirty(bs, sector_num, nb_sectors);", "if (bs->wr_highest_sector < sector_num + nb_sectors - 1) {", "bs->wr_highest_sector = sector_num + nb_sectors - 1;", "}", "if (bs->growable && ret >= 0) {", "bs->total_sectors = MAX(bs->total_sectors, sector_num + nb_sectors);", "}", "tracked_request_end(&req);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 89 ], [ 91 ] ]
13,354
INLINE flag extractFloat64Sign( float64 a ) { return a>>63; }
false
qemu
f090c9d4ad5812fb92843d6470a1111c15190c4c
INLINE flag extractFloat64Sign( float64 a ) { return a>>63; }
{ "code": [], "line_no": [] }
INLINE VAR_0 extractFloat64Sign( float64 a ) { return a>>63; }
[ "INLINE VAR_0 extractFloat64Sign( float64 a )\n{", "return a>>63;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 11 ] ]
13,355
static void read_storage_element1_info(SCLPDevice *sclp, SCCB *sccb) { ReadStorageElementInfo *storage_info = (ReadStorageElementInfo *) sccb; sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev(); assert(mhd); if ((mhd->standby_mem_size >> mhd->increment_size) >= 0x10000) { sccb->h.response_code = cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VIOLATION); return; } /* Return information regarding standby memory */ storage_info->max_id = cpu_to_be16(mhd->standby_mem_size ? 1 : 0); storage_info->assigned = cpu_to_be16(mhd->standby_mem_size >> mhd->increment_size); storage_info->standby = cpu_to_be16(mhd->standby_mem_size >> mhd->increment_size); sccb->h.response_code = cpu_to_be16(SCLP_RC_STANDBY_READ_COMPLETION); }
false
qemu
b02ef3d92b19ad304a84433d3817f0903296ebc7
static void read_storage_element1_info(SCLPDevice *sclp, SCCB *sccb) { ReadStorageElementInfo *storage_info = (ReadStorageElementInfo *) sccb; sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev(); assert(mhd); if ((mhd->standby_mem_size >> mhd->increment_size) >= 0x10000) { sccb->h.response_code = cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VIOLATION); return; } storage_info->max_id = cpu_to_be16(mhd->standby_mem_size ? 1 : 0); storage_info->assigned = cpu_to_be16(mhd->standby_mem_size >> mhd->increment_size); storage_info->standby = cpu_to_be16(mhd->standby_mem_size >> mhd->increment_size); sccb->h.response_code = cpu_to_be16(SCLP_RC_STANDBY_READ_COMPLETION); }
{ "code": [], "line_no": [] }
static void FUNC_0(SCLPDevice *VAR_0, SCCB *VAR_1) { ReadStorageElementInfo *storage_info = (ReadStorageElementInfo *) VAR_1; sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev(); assert(mhd); if ((mhd->standby_mem_size >> mhd->increment_size) >= 0x10000) { VAR_1->h.response_code = cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VIOLATION); return; } storage_info->max_id = cpu_to_be16(mhd->standby_mem_size ? 1 : 0); storage_info->assigned = cpu_to_be16(mhd->standby_mem_size >> mhd->increment_size); storage_info->standby = cpu_to_be16(mhd->standby_mem_size >> mhd->increment_size); VAR_1->h.response_code = cpu_to_be16(SCLP_RC_STANDBY_READ_COMPLETION); }
[ "static void FUNC_0(SCLPDevice *VAR_0, SCCB *VAR_1)\n{", "ReadStorageElementInfo *storage_info = (ReadStorageElementInfo *) VAR_1;", "sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev();", "assert(mhd);", "if ((mhd->standby_mem_size >> mhd->increment_size) >= 0x10000) {", "VAR_1->h.response_code = cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VIOLATION);", "return;", "}", "storage_info->max_id = cpu_to_be16(mhd->standby_mem_size ? 1 : 0);", "storage_info->assigned = cpu_to_be16(mhd->standby_mem_size >>\nmhd->increment_size);", "storage_info->standby = cpu_to_be16(mhd->standby_mem_size >>\nmhd->increment_size);", "VAR_1->h.response_code = cpu_to_be16(SCLP_RC_STANDBY_READ_COMPLETION);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29, 31 ], [ 33, 35 ], [ 37 ], [ 39 ] ]
13,356
uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn) { cpu_abort(env, "cp15 insn %08x\n", insn); return 0; }
false
qemu
3f26c1227e3b08010f2a65379cecf4cb4b5933fa
uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn) { cpu_abort(env, "cp15 insn %08x\n", insn); return 0; }
{ "code": [], "line_no": [] }
uint32_t FUNC_0(get_cp15)(CPUState *env, uint32_t insn) { cpu_abort(env, "cp15 insn %08x\n", insn); return 0; }
[ "uint32_t FUNC_0(get_cp15)(CPUState *env, uint32_t insn)\n{", "cpu_abort(env, \"cp15 insn %08x\\n\", insn);", "return 0;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
13,358
static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, TCGReg arg1, intptr_t arg2) { uint8_t *old_code_ptr = s->code_ptr; if (type == TCG_TYPE_I32) { tcg_out_op_t(s, INDEX_op_st_i32); tcg_out_r(s, arg); tcg_out_r(s, arg1); tcg_out32(s, arg2); } else { assert(type == TCG_TYPE_I64); #if TCG_TARGET_REG_BITS == 64 tcg_out_op_t(s, INDEX_op_st_i64); tcg_out_r(s, arg); tcg_out_r(s, arg1); tcg_out32(s, arg2); #else TODO(); #endif } old_code_ptr[1] = s->code_ptr - old_code_ptr; }
false
qemu
eabb7b91b36b202b4dac2df2d59d698e3aff197a
static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, TCGReg arg1, intptr_t arg2) { uint8_t *old_code_ptr = s->code_ptr; if (type == TCG_TYPE_I32) { tcg_out_op_t(s, INDEX_op_st_i32); tcg_out_r(s, arg); tcg_out_r(s, arg1); tcg_out32(s, arg2); } else { assert(type == TCG_TYPE_I64); #if TCG_TARGET_REG_BITS == 64 tcg_out_op_t(s, INDEX_op_st_i64); tcg_out_r(s, arg); tcg_out_r(s, arg1); tcg_out32(s, arg2); #else TODO(); #endif } old_code_ptr[1] = s->code_ptr - old_code_ptr; }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGReg VAR_2, TCGReg VAR_3, intptr_t VAR_4) { uint8_t *old_code_ptr = VAR_0->code_ptr; if (VAR_1 == TCG_TYPE_I32) { tcg_out_op_t(VAR_0, INDEX_op_st_i32); tcg_out_r(VAR_0, VAR_2); tcg_out_r(VAR_0, VAR_3); tcg_out32(VAR_0, VAR_4); } else { assert(VAR_1 == TCG_TYPE_I64); #if TCG_TARGET_REG_BITS == 64 tcg_out_op_t(VAR_0, INDEX_op_st_i64); tcg_out_r(VAR_0, VAR_2); tcg_out_r(VAR_0, VAR_3); tcg_out32(VAR_0, VAR_4); #else TODO(); #endif } old_code_ptr[1] = VAR_0->code_ptr - old_code_ptr; }
[ "static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGReg VAR_2, TCGReg VAR_3,\nintptr_t VAR_4)\n{", "uint8_t *old_code_ptr = VAR_0->code_ptr;", "if (VAR_1 == TCG_TYPE_I32) {", "tcg_out_op_t(VAR_0, INDEX_op_st_i32);", "tcg_out_r(VAR_0, VAR_2);", "tcg_out_r(VAR_0, VAR_3);", "tcg_out32(VAR_0, VAR_4);", "} else {", "assert(VAR_1 == TCG_TYPE_I64);", "#if TCG_TARGET_REG_BITS == 64\ntcg_out_op_t(VAR_0, INDEX_op_st_i64);", "tcg_out_r(VAR_0, VAR_2);", "tcg_out_r(VAR_0, VAR_3);", "tcg_out32(VAR_0, VAR_4);", "#else\nTODO();", "#endif\n}", "old_code_ptr[1] = VAR_0->code_ptr - old_code_ptr;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 43 ] ]
13,359
static void sdram_unmap_bcr (ppc4xx_sdram_t *sdram) { int i; for (i = 0; i < sdram->nbanks; i++) { #ifdef DEBUG_SDRAM printf("%s: Unmap RAM area " TARGET_FMT_plx " " TARGET_FMT_lx "\n", __func__, sdram_base(sdram->bcr[i]), sdram_size(sdram->bcr[i])); #endif cpu_register_physical_memory(sdram_base(sdram->bcr[i]), sdram_size(sdram->bcr[i]), IO_MEM_UNASSIGNED); } }
false
qemu
b6dcbe086c77ec683f5ff0b693593cda1d61f3a1
static void sdram_unmap_bcr (ppc4xx_sdram_t *sdram) { int i; for (i = 0; i < sdram->nbanks; i++) { #ifdef DEBUG_SDRAM printf("%s: Unmap RAM area " TARGET_FMT_plx " " TARGET_FMT_lx "\n", __func__, sdram_base(sdram->bcr[i]), sdram_size(sdram->bcr[i])); #endif cpu_register_physical_memory(sdram_base(sdram->bcr[i]), sdram_size(sdram->bcr[i]), IO_MEM_UNASSIGNED); } }
{ "code": [], "line_no": [] }
static void FUNC_0 (ppc4xx_sdram_t *VAR_0) { int VAR_1; for (VAR_1 = 0; VAR_1 < VAR_0->nbanks; VAR_1++) { #ifdef DEBUG_SDRAM printf("%s: Unmap RAM area " TARGET_FMT_plx " " TARGET_FMT_lx "\n", __func__, sdram_base(VAR_0->bcr[VAR_1]), sdram_size(VAR_0->bcr[VAR_1])); #endif cpu_register_physical_memory(sdram_base(VAR_0->bcr[VAR_1]), sdram_size(VAR_0->bcr[VAR_1]), IO_MEM_UNASSIGNED); } }
[ "static void FUNC_0 (ppc4xx_sdram_t *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < VAR_0->nbanks; VAR_1++) {", "#ifdef DEBUG_SDRAM\nprintf(\"%s: Unmap RAM area \" TARGET_FMT_plx \" \" TARGET_FMT_lx \"\\n\",\n__func__, sdram_base(VAR_0->bcr[VAR_1]), sdram_size(VAR_0->bcr[VAR_1]));", "#endif\ncpu_register_physical_memory(sdram_base(VAR_0->bcr[VAR_1]),\nsdram_size(VAR_0->bcr[VAR_1]),\nIO_MEM_UNASSIGNED);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13, 15 ], [ 17, 19, 21, 23 ], [ 25 ], [ 27 ] ]
13,362
static int find_pte64(CPUPPCState *env, struct mmu_ctx_hash64 *ctx, int h, int rw, int type, int target_page_bits) { hwaddr pteg_off; target_ulong pte0, pte1; int i, good = -1; int ret, r; ret = -1; /* No entry found */ pteg_off = (ctx->hash[h] * HASH_PTEG_SIZE_64) & env->htab_mask; for (i = 0; i < HPTES_PER_GROUP; i++) { pte0 = ppc_hash64_load_hpte0(env, pteg_off + i*HASH_PTE_SIZE_64); pte1 = ppc_hash64_load_hpte1(env, pteg_off + i*HASH_PTE_SIZE_64); r = pte64_check(ctx, pte0, pte1, h, rw, type); LOG_MMU("Load pte from %016" HWADDR_PRIx " => " TARGET_FMT_lx " " TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n", pteg_off + (i * 16), pte0, pte1, (int)(pte0 & 1), h, (int)((pte0 >> 1) & 1), ctx->ptem); switch (r) { case -3: /* PTE inconsistency */ return -1; case -2: /* Access violation */ ret = -2; good = i; break; case -1: default: /* No PTE match */ break; case 0: /* access granted */ /* XXX: we should go on looping to check all PTEs consistency * but if we can speed-up the whole thing as the * result would be undefined if PTEs are not consistent. */ ret = 0; good = i; goto done; } } if (good != -1) { done: LOG_MMU("found PTE at addr %08" HWADDR_PRIx " prot=%01x ret=%d\n", ctx->raddr, ctx->prot, ret); /* Update page flags */ pte1 = ctx->raddr; if (ppc_hash64_pte_update_flags(ctx, &pte1, ret, rw) == 1) { ppc_hash64_store_hpte1(env, pteg_off + good * HASH_PTE_SIZE_64, pte1); } } /* We have a TLB that saves 4K pages, so let's * split a huge page to 4k chunks */ if (target_page_bits != TARGET_PAGE_BITS) { ctx->raddr |= (ctx->eaddr & ((1 << target_page_bits) - 1)) & TARGET_PAGE_MASK; } return ret; }
false
qemu
91cda45b69e45a089f9989979a65db3f710c9925
static int find_pte64(CPUPPCState *env, struct mmu_ctx_hash64 *ctx, int h, int rw, int type, int target_page_bits) { hwaddr pteg_off; target_ulong pte0, pte1; int i, good = -1; int ret, r; ret = -1; pteg_off = (ctx->hash[h] * HASH_PTEG_SIZE_64) & env->htab_mask; for (i = 0; i < HPTES_PER_GROUP; i++) { pte0 = ppc_hash64_load_hpte0(env, pteg_off + i*HASH_PTE_SIZE_64); pte1 = ppc_hash64_load_hpte1(env, pteg_off + i*HASH_PTE_SIZE_64); r = pte64_check(ctx, pte0, pte1, h, rw, type); LOG_MMU("Load pte from %016" HWADDR_PRIx " => " TARGET_FMT_lx " " TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n", pteg_off + (i * 16), pte0, pte1, (int)(pte0 & 1), h, (int)((pte0 >> 1) & 1), ctx->ptem); switch (r) { case -3: return -1; case -2: ret = -2; good = i; break; case -1: default: break; case 0: ret = 0; good = i; goto done; } } if (good != -1) { done: LOG_MMU("found PTE at addr %08" HWADDR_PRIx " prot=%01x ret=%d\n", ctx->raddr, ctx->prot, ret); pte1 = ctx->raddr; if (ppc_hash64_pte_update_flags(ctx, &pte1, ret, rw) == 1) { ppc_hash64_store_hpte1(env, pteg_off + good * HASH_PTE_SIZE_64, pte1); } } if (target_page_bits != TARGET_PAGE_BITS) { ctx->raddr |= (ctx->eaddr & ((1 << target_page_bits) - 1)) & TARGET_PAGE_MASK; } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUPPCState *VAR_0, struct mmu_ctx_hash64 *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5) { hwaddr pteg_off; target_ulong pte0, pte1; int VAR_6, VAR_7 = -1; int VAR_8, VAR_9; VAR_8 = -1; pteg_off = (VAR_1->hash[VAR_2] * HASH_PTEG_SIZE_64) & VAR_0->htab_mask; for (VAR_6 = 0; VAR_6 < HPTES_PER_GROUP; VAR_6++) { pte0 = ppc_hash64_load_hpte0(VAR_0, pteg_off + VAR_6*HASH_PTE_SIZE_64); pte1 = ppc_hash64_load_hpte1(VAR_0, pteg_off + VAR_6*HASH_PTE_SIZE_64); VAR_9 = pte64_check(VAR_1, pte0, pte1, VAR_2, VAR_3, VAR_4); LOG_MMU("Load pte from %016" HWADDR_PRIx " => " TARGET_FMT_lx " " TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n", pteg_off + (VAR_6 * 16), pte0, pte1, (int)(pte0 & 1), VAR_2, (int)((pte0 >> 1) & 1), VAR_1->ptem); switch (VAR_9) { case -3: return -1; case -2: VAR_8 = -2; VAR_7 = VAR_6; break; case -1: default: break; case 0: VAR_8 = 0; VAR_7 = VAR_6; goto done; } } if (VAR_7 != -1) { done: LOG_MMU("found PTE at addr %08" HWADDR_PRIx " prot=%01x VAR_8=%d\n", VAR_1->raddr, VAR_1->prot, VAR_8); pte1 = VAR_1->raddr; if (ppc_hash64_pte_update_flags(VAR_1, &pte1, VAR_8, VAR_3) == 1) { ppc_hash64_store_hpte1(VAR_0, pteg_off + VAR_7 * HASH_PTE_SIZE_64, pte1); } } if (VAR_5 != TARGET_PAGE_BITS) { VAR_1->raddr |= (VAR_1->eaddr & ((1 << VAR_5) - 1)) & TARGET_PAGE_MASK; } return VAR_8; }
[ "static int FUNC_0(CPUPPCState *VAR_0, struct mmu_ctx_hash64 *VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int VAR_5)\n{", "hwaddr pteg_off;", "target_ulong pte0, pte1;", "int VAR_6, VAR_7 = -1;", "int VAR_8, VAR_9;", "VAR_8 = -1;", "pteg_off = (VAR_1->hash[VAR_2] * HASH_PTEG_SIZE_64) & VAR_0->htab_mask;", "for (VAR_6 = 0; VAR_6 < HPTES_PER_GROUP; VAR_6++) {", "pte0 = ppc_hash64_load_hpte0(VAR_0, pteg_off + VAR_6*HASH_PTE_SIZE_64);", "pte1 = ppc_hash64_load_hpte1(VAR_0, pteg_off + VAR_6*HASH_PTE_SIZE_64);", "VAR_9 = pte64_check(VAR_1, pte0, pte1, VAR_2, VAR_3, VAR_4);", "LOG_MMU(\"Load pte from %016\" HWADDR_PRIx \" => \" TARGET_FMT_lx \" \"\nTARGET_FMT_lx \" %d %d %d \" TARGET_FMT_lx \"\\n\",\npteg_off + (VAR_6 * 16), pte0, pte1, (int)(pte0 & 1), VAR_2,\n(int)((pte0 >> 1) & 1), VAR_1->ptem);", "switch (VAR_9) {", "case -3:\nreturn -1;", "case -2:\nVAR_8 = -2;", "VAR_7 = VAR_6;", "break;", "case -1:\ndefault:\nbreak;", "case 0:\nVAR_8 = 0;", "VAR_7 = VAR_6;", "goto done;", "}", "}", "if (VAR_7 != -1) {", "done:\nLOG_MMU(\"found PTE at addr %08\" HWADDR_PRIx \" prot=%01x VAR_8=%d\\n\",\nVAR_1->raddr, VAR_1->prot, VAR_8);", "pte1 = VAR_1->raddr;", "if (ppc_hash64_pte_update_flags(VAR_1, &pte1, VAR_8, VAR_3) == 1) {", "ppc_hash64_store_hpte1(VAR_0, pteg_off + VAR_7 * HASH_PTE_SIZE_64, pte1);", "}", "}", "if (VAR_5 != TARGET_PAGE_BITS) {", "VAR_1->raddr |= (VAR_1->eaddr & ((1 << VAR_5) - 1))\n& TARGET_PAGE_MASK;", "}", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33, 35, 37 ], [ 39 ], [ 41, 45 ], [ 47, 51 ], [ 53 ], [ 55 ], [ 57, 59, 63 ], [ 65, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91, 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ] ]
13,364
int qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, uint64_t offset) { int ret = -EINPROGRESS; qed_read_l2_table(s, request, offset, qed_sync_cb, &ret); while (ret == -EINPROGRESS) { aio_poll(bdrv_get_aio_context(s->bs), true); } return ret; }
false
qemu
88b062c2036cfd05b5111147736a08ba05ea05a9
int qed_read_l2_table_sync(BDRVQEDState *s, QEDRequest *request, uint64_t offset) { int ret = -EINPROGRESS; qed_read_l2_table(s, request, offset, qed_sync_cb, &ret); while (ret == -EINPROGRESS) { aio_poll(bdrv_get_aio_context(s->bs), true); } return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(BDRVQEDState *VAR_0, QEDRequest *VAR_1, uint64_t VAR_2) { int VAR_3 = -EINPROGRESS; qed_read_l2_table(VAR_0, VAR_1, VAR_2, qed_sync_cb, &VAR_3); while (VAR_3 == -EINPROGRESS) { aio_poll(bdrv_get_aio_context(VAR_0->bs), true); } return VAR_3; }
[ "int FUNC_0(BDRVQEDState *VAR_0, QEDRequest *VAR_1, uint64_t VAR_2)\n{", "int VAR_3 = -EINPROGRESS;", "qed_read_l2_table(VAR_0, VAR_1, VAR_2, qed_sync_cb, &VAR_3);", "while (VAR_3 == -EINPROGRESS) {", "aio_poll(bdrv_get_aio_context(VAR_0->bs), true);", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ] ]
13,368
static void kvm_getput_reg(__u64 *kvm_reg, target_ulong *qemu_reg, int set) { if (set) *kvm_reg = *qemu_reg; else *qemu_reg = *kvm_reg; }
false
qemu
b9bec74bcb16519a876ec21cd5277c526a9b512d
static void kvm_getput_reg(__u64 *kvm_reg, target_ulong *qemu_reg, int set) { if (set) *kvm_reg = *qemu_reg; else *qemu_reg = *kvm_reg; }
{ "code": [], "line_no": [] }
static void FUNC_0(__u64 *VAR_0, target_ulong *VAR_1, int VAR_2) { if (VAR_2) *VAR_0 = *VAR_1; else *VAR_1 = *VAR_0; }
[ "static void FUNC_0(__u64 *VAR_0, target_ulong *VAR_1, int VAR_2)\n{", "if (VAR_2)\n*VAR_0 = *VAR_1;", "else\n*VAR_1 = *VAR_0;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ] ]
13,369
static bool sensor_type_is_dr(uint32_t sensor_type) { switch (sensor_type) { case RTAS_SENSOR_TYPE_ISOLATION_STATE: case RTAS_SENSOR_TYPE_DR: case RTAS_SENSOR_TYPE_ALLOCATION_STATE: return true; } return false; }
false
qemu
7b7258f810d2bd40e2fb99c469c5db318d6c3d92
static bool sensor_type_is_dr(uint32_t sensor_type) { switch (sensor_type) { case RTAS_SENSOR_TYPE_ISOLATION_STATE: case RTAS_SENSOR_TYPE_DR: case RTAS_SENSOR_TYPE_ALLOCATION_STATE: return true; } return false; }
{ "code": [], "line_no": [] }
static bool FUNC_0(uint32_t sensor_type) { switch (sensor_type) { case RTAS_SENSOR_TYPE_ISOLATION_STATE: case RTAS_SENSOR_TYPE_DR: case RTAS_SENSOR_TYPE_ALLOCATION_STATE: return true; } return false; }
[ "static bool FUNC_0(uint32_t sensor_type)\n{", "switch (sensor_type) {", "case RTAS_SENSOR_TYPE_ISOLATION_STATE:\ncase RTAS_SENSOR_TYPE_DR:\ncase RTAS_SENSOR_TYPE_ALLOCATION_STATE:\nreturn true;", "}", "return false;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11, 13 ], [ 15 ], [ 19 ], [ 21 ] ]
13,370
static uint64_t omap_mpuio_read(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_mpuio_s *s = (struct omap_mpuio_s *) opaque; int offset = addr & OMAP_MPUI_REG_MASK; uint16_t ret; if (size != 2) { return omap_badwidth_read16(opaque, addr); } switch (offset) { case 0x00: /* INPUT_LATCH */ return s->inputs; case 0x04: /* OUTPUT_REG */ return s->outputs; case 0x08: /* IO_CNTL */ return s->dir; case 0x10: /* KBR_LATCH */ return s->row_latch; case 0x14: /* KBC_REG */ return s->cols; case 0x18: /* GPIO_EVENT_MODE_REG */ return s->event; case 0x1c: /* GPIO_INT_EDGE_REG */ return s->edge; case 0x20: /* KBD_INT */ return (~s->row_latch & 0x1f) && !s->kbd_mask; case 0x24: /* GPIO_INT */ ret = s->ints; s->ints &= s->mask; if (ret) qemu_irq_lower(s->irq); return ret; case 0x28: /* KBD_MASKIT */ return s->kbd_mask; case 0x2c: /* GPIO_MASKIT */ return s->mask; case 0x30: /* GPIO_DEBOUNCING_REG */ return s->debounce; case 0x34: /* GPIO_LATCH_REG */ return s->latch; } OMAP_BAD_REG(addr); return 0; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t omap_mpuio_read(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_mpuio_s *s = (struct omap_mpuio_s *) opaque; int offset = addr & OMAP_MPUI_REG_MASK; uint16_t ret; if (size != 2) { return omap_badwidth_read16(opaque, addr); } switch (offset) { case 0x00: return s->inputs; case 0x04: return s->outputs; case 0x08: return s->dir; case 0x10: return s->row_latch; case 0x14: return s->cols; case 0x18: return s->event; case 0x1c: return s->edge; case 0x20: return (~s->row_latch & 0x1f) && !s->kbd_mask; case 0x24: ret = s->ints; s->ints &= s->mask; if (ret) qemu_irq_lower(s->irq); return ret; case 0x28: return s->kbd_mask; case 0x2c: return s->mask; case 0x30: return s->debounce; case 0x34: return s->latch; } OMAP_BAD_REG(addr); return 0; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_mpuio_s *VAR_0 = (struct omap_mpuio_s *) opaque; int VAR_1 = addr & OMAP_MPUI_REG_MASK; uint16_t ret; if (size != 2) { return omap_badwidth_read16(opaque, addr); } switch (VAR_1) { case 0x00: return VAR_0->inputs; case 0x04: return VAR_0->outputs; case 0x08: return VAR_0->dir; case 0x10: return VAR_0->row_latch; case 0x14: return VAR_0->cols; case 0x18: return VAR_0->event; case 0x1c: return VAR_0->edge; case 0x20: return (~VAR_0->row_latch & 0x1f) && !VAR_0->kbd_mask; case 0x24: ret = VAR_0->ints; VAR_0->ints &= VAR_0->mask; if (ret) qemu_irq_lower(VAR_0->irq); return ret; case 0x28: return VAR_0->kbd_mask; case 0x2c: return VAR_0->mask; case 0x30: return VAR_0->debounce; case 0x34: return VAR_0->latch; } OMAP_BAD_REG(addr); return 0; }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "struct omap_mpuio_s *VAR_0 = (struct omap_mpuio_s *) opaque;", "int VAR_1 = addr & OMAP_MPUI_REG_MASK;", "uint16_t ret;", "if (size != 2) {", "return omap_badwidth_read16(opaque, addr);", "}", "switch (VAR_1) {", "case 0x00:\nreturn VAR_0->inputs;", "case 0x04:\nreturn VAR_0->outputs;", "case 0x08:\nreturn VAR_0->dir;", "case 0x10:\nreturn VAR_0->row_latch;", "case 0x14:\nreturn VAR_0->cols;", "case 0x18:\nreturn VAR_0->event;", "case 0x1c:\nreturn VAR_0->edge;", "case 0x20:\nreturn (~VAR_0->row_latch & 0x1f) && !VAR_0->kbd_mask;", "case 0x24:\nret = VAR_0->ints;", "VAR_0->ints &= VAR_0->mask;", "if (ret)\nqemu_irq_lower(VAR_0->irq);", "return ret;", "case 0x28:\nreturn VAR_0->kbd_mask;", "case 0x2c:\nreturn VAR_0->mask;", "case 0x30:\nreturn VAR_0->debounce;", "case 0x34:\nreturn VAR_0->latch;", "}", "OMAP_BAD_REG(addr);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 31, 33 ], [ 37, 39 ], [ 43, 45 ], [ 49, 51 ], [ 55, 57 ], [ 61, 63 ], [ 67, 69 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 87, 89 ], [ 93, 95 ], [ 99, 101 ], [ 105, 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ] ]
13,371
int64_t qemu_get_clock_ns(QEMUClock *clock) { return 0; }
false
qemu
cbcfa0418f0c196afa765f5c9837b9344d1adcf3
int64_t qemu_get_clock_ns(QEMUClock *clock) { return 0; }
{ "code": [], "line_no": [] }
int64_t FUNC_0(QEMUClock *clock) { return 0; }
[ "int64_t FUNC_0(QEMUClock *clock)\n{", "return 0;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
13,374
static always_inline void gen_qemu_stf (TCGv t0, TCGv t1, int flags) { TCGv tmp = tcg_temp_new(TCG_TYPE_I32); tcg_gen_helper_1_1(helper_f_to_memory, tmp, t0); tcg_gen_qemu_st32(tmp, t1, flags); tcg_temp_free(tmp); }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static always_inline void gen_qemu_stf (TCGv t0, TCGv t1, int flags) { TCGv tmp = tcg_temp_new(TCG_TYPE_I32); tcg_gen_helper_1_1(helper_f_to_memory, tmp, t0); tcg_gen_qemu_st32(tmp, t1, flags); tcg_temp_free(tmp); }
{ "code": [], "line_no": [] }
static always_inline void FUNC_0 (TCGv t0, TCGv t1, int flags) { TCGv tmp = tcg_temp_new(TCG_TYPE_I32); tcg_gen_helper_1_1(helper_f_to_memory, tmp, t0); tcg_gen_qemu_st32(tmp, t1, flags); tcg_temp_free(tmp); }
[ "static always_inline void FUNC_0 (TCGv t0, TCGv t1, int flags)\n{", "TCGv tmp = tcg_temp_new(TCG_TYPE_I32);", "tcg_gen_helper_1_1(helper_f_to_memory, tmp, t0);", "tcg_gen_qemu_st32(tmp, t1, flags);", "tcg_temp_free(tmp);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
13,376
static void vfio_put_group(VFIOGroup *group) { if (!QLIST_EMPTY(&group->device_list)) { return; } vfio_kvm_device_del_group(group); vfio_disconnect_container(group); QLIST_REMOVE(group, next); trace_vfio_put_group(group->fd); close(group->fd); g_free(group); if (QLIST_EMPTY(&group_list)) { qemu_unregister_reset(vfio_pci_reset_handler, NULL); } }
false
qemu
b47d8efa9f430c332bf96ce6eede169eb48422ad
static void vfio_put_group(VFIOGroup *group) { if (!QLIST_EMPTY(&group->device_list)) { return; } vfio_kvm_device_del_group(group); vfio_disconnect_container(group); QLIST_REMOVE(group, next); trace_vfio_put_group(group->fd); close(group->fd); g_free(group); if (QLIST_EMPTY(&group_list)) { qemu_unregister_reset(vfio_pci_reset_handler, NULL); } }
{ "code": [], "line_no": [] }
static void FUNC_0(VFIOGroup *VAR_0) { if (!QLIST_EMPTY(&VAR_0->device_list)) { return; } vfio_kvm_device_del_group(VAR_0); vfio_disconnect_container(VAR_0); QLIST_REMOVE(VAR_0, next); trace_vfio_put_group(VAR_0->fd); close(VAR_0->fd); g_free(VAR_0); if (QLIST_EMPTY(&group_list)) { qemu_unregister_reset(vfio_pci_reset_handler, NULL); } }
[ "static void FUNC_0(VFIOGroup *VAR_0)\n{", "if (!QLIST_EMPTY(&VAR_0->device_list)) {", "return;", "}", "vfio_kvm_device_del_group(VAR_0);", "vfio_disconnect_container(VAR_0);", "QLIST_REMOVE(VAR_0, next);", "trace_vfio_put_group(VAR_0->fd);", "close(VAR_0->fd);", "g_free(VAR_0);", "if (QLIST_EMPTY(&group_list)) {", "qemu_unregister_reset(vfio_pci_reset_handler, NULL);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
13,378
static void virtio_ccw_start_ioeventfd(VirtioCcwDevice *dev) { VirtIODevice *vdev; int n, r; if (!(dev->flags & VIRTIO_CCW_FLAG_USE_IOEVENTFD) || dev->ioeventfd_disabled || dev->ioeventfd_started) { return; } vdev = virtio_bus_get_device(&dev->bus); for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { if (!virtio_queue_get_num(vdev, n)) { continue; } r = virtio_ccw_set_guest2host_notifier(dev, n, true, true); if (r < 0) { goto assign_error; } } dev->ioeventfd_started = true; return; assign_error: while (--n >= 0) { if (!virtio_queue_get_num(vdev, n)) { continue; } r = virtio_ccw_set_guest2host_notifier(dev, n, false, false); assert(r >= 0); } dev->ioeventfd_started = false; /* Disable ioeventfd for this device. */ dev->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD; error_report("%s: failed. Fallback to userspace (slower).", __func__); }
false
qemu
8dfbaa6ac450c4ec2646b1ca08a4017052a90c1d
static void virtio_ccw_start_ioeventfd(VirtioCcwDevice *dev) { VirtIODevice *vdev; int n, r; if (!(dev->flags & VIRTIO_CCW_FLAG_USE_IOEVENTFD) || dev->ioeventfd_disabled || dev->ioeventfd_started) { return; } vdev = virtio_bus_get_device(&dev->bus); for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { if (!virtio_queue_get_num(vdev, n)) { continue; } r = virtio_ccw_set_guest2host_notifier(dev, n, true, true); if (r < 0) { goto assign_error; } } dev->ioeventfd_started = true; return; assign_error: while (--n >= 0) { if (!virtio_queue_get_num(vdev, n)) { continue; } r = virtio_ccw_set_guest2host_notifier(dev, n, false, false); assert(r >= 0); } dev->ioeventfd_started = false; dev->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD; error_report("%s: failed. Fallback to userspace (slower).", __func__); }
{ "code": [], "line_no": [] }
static void FUNC_0(VirtioCcwDevice *VAR_0) { VirtIODevice *vdev; int VAR_1, VAR_2; if (!(VAR_0->flags & VIRTIO_CCW_FLAG_USE_IOEVENTFD) || VAR_0->ioeventfd_disabled || VAR_0->ioeventfd_started) { return; } vdev = virtio_bus_get_device(&VAR_0->bus); for (VAR_1 = 0; VAR_1 < VIRTIO_PCI_QUEUE_MAX; VAR_1++) { if (!virtio_queue_get_num(vdev, VAR_1)) { continue; } VAR_2 = virtio_ccw_set_guest2host_notifier(VAR_0, VAR_1, true, true); if (VAR_2 < 0) { goto assign_error; } } VAR_0->ioeventfd_started = true; return; assign_error: while (--VAR_1 >= 0) { if (!virtio_queue_get_num(vdev, VAR_1)) { continue; } VAR_2 = virtio_ccw_set_guest2host_notifier(VAR_0, VAR_1, false, false); assert(VAR_2 >= 0); } VAR_0->ioeventfd_started = false; VAR_0->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD; error_report("%s: failed. Fallback to userspace (slower).", __func__); }
[ "static void FUNC_0(VirtioCcwDevice *VAR_0)\n{", "VirtIODevice *vdev;", "int VAR_1, VAR_2;", "if (!(VAR_0->flags & VIRTIO_CCW_FLAG_USE_IOEVENTFD) ||\nVAR_0->ioeventfd_disabled ||\nVAR_0->ioeventfd_started) {", "return;", "}", "vdev = virtio_bus_get_device(&VAR_0->bus);", "for (VAR_1 = 0; VAR_1 < VIRTIO_PCI_QUEUE_MAX; VAR_1++) {", "if (!virtio_queue_get_num(vdev, VAR_1)) {", "continue;", "}", "VAR_2 = virtio_ccw_set_guest2host_notifier(VAR_0, VAR_1, true, true);", "if (VAR_2 < 0) {", "goto assign_error;", "}", "}", "VAR_0->ioeventfd_started = true;", "return;", "assign_error:\nwhile (--VAR_1 >= 0) {", "if (!virtio_queue_get_num(vdev, VAR_1)) {", "continue;", "}", "VAR_2 = virtio_ccw_set_guest2host_notifier(VAR_0, VAR_1, false, false);", "assert(VAR_2 >= 0);", "}", "VAR_0->ioeventfd_started = false;", "VAR_0->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD;", "error_report(\"%s: failed. Fallback to userspace (slower).\", __func__);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ] ]
13,379
void bdrv_set_read_only(BlockDriverState *bs, bool read_only) { bs->read_only = read_only; }
false
qemu
e2b8247a322cd92945785edf25f09e6b3e8285f9
void bdrv_set_read_only(BlockDriverState *bs, bool read_only) { bs->read_only = read_only; }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0, bool VAR_1) { VAR_0->VAR_1 = VAR_1; }
[ "void FUNC_0(BlockDriverState *VAR_0, bool VAR_1)\n{", "VAR_0->VAR_1 = VAR_1;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
13,380
void HELPER(crypto_aesmc)(CPUARMState *env, uint32_t rd, uint32_t rm, uint32_t decrypt) { static uint32_t const mc[][256] = { { /* MixColumns lookup table */ 0x00000000, 0x03010102, 0x06020204, 0x05030306, 0x0c040408, 0x0f05050a, 0x0a06060c, 0x0907070e, 0x18080810, 0x1b090912, 0x1e0a0a14, 0x1d0b0b16, 0x140c0c18, 0x170d0d1a, 0x120e0e1c, 0x110f0f1e, 0x30101020, 0x33111122, 0x36121224, 0x35131326, 0x3c141428, 0x3f15152a, 0x3a16162c, 0x3917172e, 0x28181830, 0x2b191932, 0x2e1a1a34, 0x2d1b1b36, 0x241c1c38, 0x271d1d3a, 0x221e1e3c, 0x211f1f3e, 0x60202040, 0x63212142, 0x66222244, 0x65232346, 0x6c242448, 0x6f25254a, 0x6a26264c, 0x6927274e, 0x78282850, 0x7b292952, 0x7e2a2a54, 0x7d2b2b56, 0x742c2c58, 0x772d2d5a, 0x722e2e5c, 0x712f2f5e, 0x50303060, 0x53313162, 0x56323264, 0x55333366, 0x5c343468, 0x5f35356a, 0x5a36366c, 0x5937376e, 0x48383870, 0x4b393972, 0x4e3a3a74, 0x4d3b3b76, 0x443c3c78, 0x473d3d7a, 0x423e3e7c, 0x413f3f7e, 0xc0404080, 0xc3414182, 0xc6424284, 0xc5434386, 0xcc444488, 0xcf45458a, 0xca46468c, 0xc947478e, 0xd8484890, 0xdb494992, 0xde4a4a94, 0xdd4b4b96, 0xd44c4c98, 0xd74d4d9a, 0xd24e4e9c, 0xd14f4f9e, 0xf05050a0, 0xf35151a2, 0xf65252a4, 0xf55353a6, 0xfc5454a8, 0xff5555aa, 0xfa5656ac, 0xf95757ae, 0xe85858b0, 0xeb5959b2, 0xee5a5ab4, 0xed5b5bb6, 0xe45c5cb8, 0xe75d5dba, 0xe25e5ebc, 0xe15f5fbe, 0xa06060c0, 0xa36161c2, 0xa66262c4, 0xa56363c6, 0xac6464c8, 0xaf6565ca, 0xaa6666cc, 0xa96767ce, 0xb86868d0, 0xbb6969d2, 0xbe6a6ad4, 0xbd6b6bd6, 0xb46c6cd8, 0xb76d6dda, 0xb26e6edc, 0xb16f6fde, 0x907070e0, 0x937171e2, 0x967272e4, 0x957373e6, 0x9c7474e8, 0x9f7575ea, 0x9a7676ec, 0x997777ee, 0x887878f0, 0x8b7979f2, 0x8e7a7af4, 0x8d7b7bf6, 0x847c7cf8, 0x877d7dfa, 0x827e7efc, 0x817f7ffe, 0x9b80801b, 0x98818119, 0x9d82821f, 0x9e83831d, 0x97848413, 0x94858511, 0x91868617, 0x92878715, 0x8388880b, 0x80898909, 0x858a8a0f, 0x868b8b0d, 0x8f8c8c03, 0x8c8d8d01, 0x898e8e07, 0x8a8f8f05, 0xab90903b, 0xa8919139, 0xad92923f, 0xae93933d, 0xa7949433, 0xa4959531, 0xa1969637, 0xa2979735, 0xb398982b, 0xb0999929, 0xb59a9a2f, 0xb69b9b2d, 0xbf9c9c23, 0xbc9d9d21, 0xb99e9e27, 0xba9f9f25, 0xfba0a05b, 0xf8a1a159, 0xfda2a25f, 0xfea3a35d, 0xf7a4a453, 0xf4a5a551, 0xf1a6a657, 0xf2a7a755, 0xe3a8a84b, 0xe0a9a949, 0xe5aaaa4f, 0xe6abab4d, 0xefacac43, 0xecadad41, 0xe9aeae47, 0xeaafaf45, 0xcbb0b07b, 0xc8b1b179, 0xcdb2b27f, 0xceb3b37d, 0xc7b4b473, 0xc4b5b571, 0xc1b6b677, 0xc2b7b775, 0xd3b8b86b, 0xd0b9b969, 0xd5baba6f, 0xd6bbbb6d, 0xdfbcbc63, 0xdcbdbd61, 0xd9bebe67, 0xdabfbf65, 0x5bc0c09b, 0x58c1c199, 0x5dc2c29f, 0x5ec3c39d, 0x57c4c493, 0x54c5c591, 0x51c6c697, 0x52c7c795, 0x43c8c88b, 0x40c9c989, 0x45caca8f, 0x46cbcb8d, 0x4fcccc83, 0x4ccdcd81, 0x49cece87, 0x4acfcf85, 0x6bd0d0bb, 0x68d1d1b9, 0x6dd2d2bf, 0x6ed3d3bd, 0x67d4d4b3, 0x64d5d5b1, 0x61d6d6b7, 0x62d7d7b5, 0x73d8d8ab, 0x70d9d9a9, 0x75dadaaf, 0x76dbdbad, 0x7fdcdca3, 0x7cdddda1, 0x79dedea7, 0x7adfdfa5, 0x3be0e0db, 0x38e1e1d9, 0x3de2e2df, 0x3ee3e3dd, 0x37e4e4d3, 0x34e5e5d1, 0x31e6e6d7, 0x32e7e7d5, 0x23e8e8cb, 0x20e9e9c9, 0x25eaeacf, 0x26ebebcd, 0x2fececc3, 0x2cededc1, 0x29eeeec7, 0x2aefefc5, 0x0bf0f0fb, 0x08f1f1f9, 0x0df2f2ff, 0x0ef3f3fd, 0x07f4f4f3, 0x04f5f5f1, 0x01f6f6f7, 0x02f7f7f5, 0x13f8f8eb, 0x10f9f9e9, 0x15fafaef, 0x16fbfbed, 0x1ffcfce3, 0x1cfdfde1, 0x19fefee7, 0x1affffe5, }, { /* Inverse MixColumns lookup table */ 0x00000000, 0x0b0d090e, 0x161a121c, 0x1d171b12, 0x2c342438, 0x27392d36, 0x3a2e3624, 0x31233f2a, 0x58684870, 0x5365417e, 0x4e725a6c, 0x457f5362, 0x745c6c48, 0x7f516546, 0x62467e54, 0x694b775a, 0xb0d090e0, 0xbbdd99ee, 0xa6ca82fc, 0xadc78bf2, 0x9ce4b4d8, 0x97e9bdd6, 0x8afea6c4, 0x81f3afca, 0xe8b8d890, 0xe3b5d19e, 0xfea2ca8c, 0xf5afc382, 0xc48cfca8, 0xcf81f5a6, 0xd296eeb4, 0xd99be7ba, 0x7bbb3bdb, 0x70b632d5, 0x6da129c7, 0x66ac20c9, 0x578f1fe3, 0x5c8216ed, 0x41950dff, 0x4a9804f1, 0x23d373ab, 0x28de7aa5, 0x35c961b7, 0x3ec468b9, 0x0fe75793, 0x04ea5e9d, 0x19fd458f, 0x12f04c81, 0xcb6bab3b, 0xc066a235, 0xdd71b927, 0xd67cb029, 0xe75f8f03, 0xec52860d, 0xf1459d1f, 0xfa489411, 0x9303e34b, 0x980eea45, 0x8519f157, 0x8e14f859, 0xbf37c773, 0xb43ace7d, 0xa92dd56f, 0xa220dc61, 0xf66d76ad, 0xfd607fa3, 0xe07764b1, 0xeb7a6dbf, 0xda595295, 0xd1545b9b, 0xcc434089, 0xc74e4987, 0xae053edd, 0xa50837d3, 0xb81f2cc1, 0xb31225cf, 0x82311ae5, 0x893c13eb, 0x942b08f9, 0x9f2601f7, 0x46bde64d, 0x4db0ef43, 0x50a7f451, 0x5baafd5f, 0x6a89c275, 0x6184cb7b, 0x7c93d069, 0x779ed967, 0x1ed5ae3d, 0x15d8a733, 0x08cfbc21, 0x03c2b52f, 0x32e18a05, 0x39ec830b, 0x24fb9819, 0x2ff69117, 0x8dd64d76, 0x86db4478, 0x9bcc5f6a, 0x90c15664, 0xa1e2694e, 0xaaef6040, 0xb7f87b52, 0xbcf5725c, 0xd5be0506, 0xdeb30c08, 0xc3a4171a, 0xc8a91e14, 0xf98a213e, 0xf2872830, 0xef903322, 0xe49d3a2c, 0x3d06dd96, 0x360bd498, 0x2b1ccf8a, 0x2011c684, 0x1132f9ae, 0x1a3ff0a0, 0x0728ebb2, 0x0c25e2bc, 0x656e95e6, 0x6e639ce8, 0x737487fa, 0x78798ef4, 0x495ab1de, 0x4257b8d0, 0x5f40a3c2, 0x544daacc, 0xf7daec41, 0xfcd7e54f, 0xe1c0fe5d, 0xeacdf753, 0xdbeec879, 0xd0e3c177, 0xcdf4da65, 0xc6f9d36b, 0xafb2a431, 0xa4bfad3f, 0xb9a8b62d, 0xb2a5bf23, 0x83868009, 0x888b8907, 0x959c9215, 0x9e919b1b, 0x470a7ca1, 0x4c0775af, 0x51106ebd, 0x5a1d67b3, 0x6b3e5899, 0x60335197, 0x7d244a85, 0x7629438b, 0x1f6234d1, 0x146f3ddf, 0x097826cd, 0x02752fc3, 0x335610e9, 0x385b19e7, 0x254c02f5, 0x2e410bfb, 0x8c61d79a, 0x876cde94, 0x9a7bc586, 0x9176cc88, 0xa055f3a2, 0xab58faac, 0xb64fe1be, 0xbd42e8b0, 0xd4099fea, 0xdf0496e4, 0xc2138df6, 0xc91e84f8, 0xf83dbbd2, 0xf330b2dc, 0xee27a9ce, 0xe52aa0c0, 0x3cb1477a, 0x37bc4e74, 0x2aab5566, 0x21a65c68, 0x10856342, 0x1b886a4c, 0x069f715e, 0x0d927850, 0x64d90f0a, 0x6fd40604, 0x72c31d16, 0x79ce1418, 0x48ed2b32, 0x43e0223c, 0x5ef7392e, 0x55fa3020, 0x01b79aec, 0x0aba93e2, 0x17ad88f0, 0x1ca081fe, 0x2d83bed4, 0x268eb7da, 0x3b99acc8, 0x3094a5c6, 0x59dfd29c, 0x52d2db92, 0x4fc5c080, 0x44c8c98e, 0x75ebf6a4, 0x7ee6ffaa, 0x63f1e4b8, 0x68fcedb6, 0xb1670a0c, 0xba6a0302, 0xa77d1810, 0xac70111e, 0x9d532e34, 0x965e273a, 0x8b493c28, 0x80443526, 0xe90f427c, 0xe2024b72, 0xff155060, 0xf418596e, 0xc53b6644, 0xce366f4a, 0xd3217458, 0xd82c7d56, 0x7a0ca137, 0x7101a839, 0x6c16b32b, 0x671bba25, 0x5638850f, 0x5d358c01, 0x40229713, 0x4b2f9e1d, 0x2264e947, 0x2969e049, 0x347efb5b, 0x3f73f255, 0x0e50cd7f, 0x055dc471, 0x184adf63, 0x1347d66d, 0xcadc31d7, 0xc1d138d9, 0xdcc623cb, 0xd7cb2ac5, 0xe6e815ef, 0xede51ce1, 0xf0f207f3, 0xfbff0efd, 0x92b479a7, 0x99b970a9, 0x84ae6bbb, 0x8fa362b5, 0xbe805d9f, 0xb58d5491, 0xa89a4f83, 0xa397468d, } }; union AES_STATE st = { .l = { float64_val(env->vfp.regs[rm]), float64_val(env->vfp.regs[rm + 1]) } }; int i; assert(decrypt < 2); for (i = 0; i < 16; i += 4) { st.cols[i >> 2] = cpu_to_le32( mc[decrypt][st.bytes[i]] ^ rol32(mc[decrypt][st.bytes[i + 1]], 8) ^ rol32(mc[decrypt][st.bytes[i + 2]], 16) ^ rol32(mc[decrypt][st.bytes[i + 3]], 24)); } env->vfp.regs[rd] = make_float64(st.l[0]); env->vfp.regs[rd + 1] = make_float64(st.l[1]); }
false
qemu
f1ecb913d81199758383b8cbc15f4eb435b91753
void HELPER(crypto_aesmc)(CPUARMState *env, uint32_t rd, uint32_t rm, uint32_t decrypt) { static uint32_t const mc[][256] = { { 0x00000000, 0x03010102, 0x06020204, 0x05030306, 0x0c040408, 0x0f05050a, 0x0a06060c, 0x0907070e, 0x18080810, 0x1b090912, 0x1e0a0a14, 0x1d0b0b16, 0x140c0c18, 0x170d0d1a, 0x120e0e1c, 0x110f0f1e, 0x30101020, 0x33111122, 0x36121224, 0x35131326, 0x3c141428, 0x3f15152a, 0x3a16162c, 0x3917172e, 0x28181830, 0x2b191932, 0x2e1a1a34, 0x2d1b1b36, 0x241c1c38, 0x271d1d3a, 0x221e1e3c, 0x211f1f3e, 0x60202040, 0x63212142, 0x66222244, 0x65232346, 0x6c242448, 0x6f25254a, 0x6a26264c, 0x6927274e, 0x78282850, 0x7b292952, 0x7e2a2a54, 0x7d2b2b56, 0x742c2c58, 0x772d2d5a, 0x722e2e5c, 0x712f2f5e, 0x50303060, 0x53313162, 0x56323264, 0x55333366, 0x5c343468, 0x5f35356a, 0x5a36366c, 0x5937376e, 0x48383870, 0x4b393972, 0x4e3a3a74, 0x4d3b3b76, 0x443c3c78, 0x473d3d7a, 0x423e3e7c, 0x413f3f7e, 0xc0404080, 0xc3414182, 0xc6424284, 0xc5434386, 0xcc444488, 0xcf45458a, 0xca46468c, 0xc947478e, 0xd8484890, 0xdb494992, 0xde4a4a94, 0xdd4b4b96, 0xd44c4c98, 0xd74d4d9a, 0xd24e4e9c, 0xd14f4f9e, 0xf05050a0, 0xf35151a2, 0xf65252a4, 0xf55353a6, 0xfc5454a8, 0xff5555aa, 0xfa5656ac, 0xf95757ae, 0xe85858b0, 0xeb5959b2, 0xee5a5ab4, 0xed5b5bb6, 0xe45c5cb8, 0xe75d5dba, 0xe25e5ebc, 0xe15f5fbe, 0xa06060c0, 0xa36161c2, 0xa66262c4, 0xa56363c6, 0xac6464c8, 0xaf6565ca, 0xaa6666cc, 0xa96767ce, 0xb86868d0, 0xbb6969d2, 0xbe6a6ad4, 0xbd6b6bd6, 0xb46c6cd8, 0xb76d6dda, 0xb26e6edc, 0xb16f6fde, 0x907070e0, 0x937171e2, 0x967272e4, 0x957373e6, 0x9c7474e8, 0x9f7575ea, 0x9a7676ec, 0x997777ee, 0x887878f0, 0x8b7979f2, 0x8e7a7af4, 0x8d7b7bf6, 0x847c7cf8, 0x877d7dfa, 0x827e7efc, 0x817f7ffe, 0x9b80801b, 0x98818119, 0x9d82821f, 0x9e83831d, 0x97848413, 0x94858511, 0x91868617, 0x92878715, 0x8388880b, 0x80898909, 0x858a8a0f, 0x868b8b0d, 0x8f8c8c03, 0x8c8d8d01, 0x898e8e07, 0x8a8f8f05, 0xab90903b, 0xa8919139, 0xad92923f, 0xae93933d, 0xa7949433, 0xa4959531, 0xa1969637, 0xa2979735, 0xb398982b, 0xb0999929, 0xb59a9a2f, 0xb69b9b2d, 0xbf9c9c23, 0xbc9d9d21, 0xb99e9e27, 0xba9f9f25, 0xfba0a05b, 0xf8a1a159, 0xfda2a25f, 0xfea3a35d, 0xf7a4a453, 0xf4a5a551, 0xf1a6a657, 0xf2a7a755, 0xe3a8a84b, 0xe0a9a949, 0xe5aaaa4f, 0xe6abab4d, 0xefacac43, 0xecadad41, 0xe9aeae47, 0xeaafaf45, 0xcbb0b07b, 0xc8b1b179, 0xcdb2b27f, 0xceb3b37d, 0xc7b4b473, 0xc4b5b571, 0xc1b6b677, 0xc2b7b775, 0xd3b8b86b, 0xd0b9b969, 0xd5baba6f, 0xd6bbbb6d, 0xdfbcbc63, 0xdcbdbd61, 0xd9bebe67, 0xdabfbf65, 0x5bc0c09b, 0x58c1c199, 0x5dc2c29f, 0x5ec3c39d, 0x57c4c493, 0x54c5c591, 0x51c6c697, 0x52c7c795, 0x43c8c88b, 0x40c9c989, 0x45caca8f, 0x46cbcb8d, 0x4fcccc83, 0x4ccdcd81, 0x49cece87, 0x4acfcf85, 0x6bd0d0bb, 0x68d1d1b9, 0x6dd2d2bf, 0x6ed3d3bd, 0x67d4d4b3, 0x64d5d5b1, 0x61d6d6b7, 0x62d7d7b5, 0x73d8d8ab, 0x70d9d9a9, 0x75dadaaf, 0x76dbdbad, 0x7fdcdca3, 0x7cdddda1, 0x79dedea7, 0x7adfdfa5, 0x3be0e0db, 0x38e1e1d9, 0x3de2e2df, 0x3ee3e3dd, 0x37e4e4d3, 0x34e5e5d1, 0x31e6e6d7, 0x32e7e7d5, 0x23e8e8cb, 0x20e9e9c9, 0x25eaeacf, 0x26ebebcd, 0x2fececc3, 0x2cededc1, 0x29eeeec7, 0x2aefefc5, 0x0bf0f0fb, 0x08f1f1f9, 0x0df2f2ff, 0x0ef3f3fd, 0x07f4f4f3, 0x04f5f5f1, 0x01f6f6f7, 0x02f7f7f5, 0x13f8f8eb, 0x10f9f9e9, 0x15fafaef, 0x16fbfbed, 0x1ffcfce3, 0x1cfdfde1, 0x19fefee7, 0x1affffe5, }, { 0x00000000, 0x0b0d090e, 0x161a121c, 0x1d171b12, 0x2c342438, 0x27392d36, 0x3a2e3624, 0x31233f2a, 0x58684870, 0x5365417e, 0x4e725a6c, 0x457f5362, 0x745c6c48, 0x7f516546, 0x62467e54, 0x694b775a, 0xb0d090e0, 0xbbdd99ee, 0xa6ca82fc, 0xadc78bf2, 0x9ce4b4d8, 0x97e9bdd6, 0x8afea6c4, 0x81f3afca, 0xe8b8d890, 0xe3b5d19e, 0xfea2ca8c, 0xf5afc382, 0xc48cfca8, 0xcf81f5a6, 0xd296eeb4, 0xd99be7ba, 0x7bbb3bdb, 0x70b632d5, 0x6da129c7, 0x66ac20c9, 0x578f1fe3, 0x5c8216ed, 0x41950dff, 0x4a9804f1, 0x23d373ab, 0x28de7aa5, 0x35c961b7, 0x3ec468b9, 0x0fe75793, 0x04ea5e9d, 0x19fd458f, 0x12f04c81, 0xcb6bab3b, 0xc066a235, 0xdd71b927, 0xd67cb029, 0xe75f8f03, 0xec52860d, 0xf1459d1f, 0xfa489411, 0x9303e34b, 0x980eea45, 0x8519f157, 0x8e14f859, 0xbf37c773, 0xb43ace7d, 0xa92dd56f, 0xa220dc61, 0xf66d76ad, 0xfd607fa3, 0xe07764b1, 0xeb7a6dbf, 0xda595295, 0xd1545b9b, 0xcc434089, 0xc74e4987, 0xae053edd, 0xa50837d3, 0xb81f2cc1, 0xb31225cf, 0x82311ae5, 0x893c13eb, 0x942b08f9, 0x9f2601f7, 0x46bde64d, 0x4db0ef43, 0x50a7f451, 0x5baafd5f, 0x6a89c275, 0x6184cb7b, 0x7c93d069, 0x779ed967, 0x1ed5ae3d, 0x15d8a733, 0x08cfbc21, 0x03c2b52f, 0x32e18a05, 0x39ec830b, 0x24fb9819, 0x2ff69117, 0x8dd64d76, 0x86db4478, 0x9bcc5f6a, 0x90c15664, 0xa1e2694e, 0xaaef6040, 0xb7f87b52, 0xbcf5725c, 0xd5be0506, 0xdeb30c08, 0xc3a4171a, 0xc8a91e14, 0xf98a213e, 0xf2872830, 0xef903322, 0xe49d3a2c, 0x3d06dd96, 0x360bd498, 0x2b1ccf8a, 0x2011c684, 0x1132f9ae, 0x1a3ff0a0, 0x0728ebb2, 0x0c25e2bc, 0x656e95e6, 0x6e639ce8, 0x737487fa, 0x78798ef4, 0x495ab1de, 0x4257b8d0, 0x5f40a3c2, 0x544daacc, 0xf7daec41, 0xfcd7e54f, 0xe1c0fe5d, 0xeacdf753, 0xdbeec879, 0xd0e3c177, 0xcdf4da65, 0xc6f9d36b, 0xafb2a431, 0xa4bfad3f, 0xb9a8b62d, 0xb2a5bf23, 0x83868009, 0x888b8907, 0x959c9215, 0x9e919b1b, 0x470a7ca1, 0x4c0775af, 0x51106ebd, 0x5a1d67b3, 0x6b3e5899, 0x60335197, 0x7d244a85, 0x7629438b, 0x1f6234d1, 0x146f3ddf, 0x097826cd, 0x02752fc3, 0x335610e9, 0x385b19e7, 0x254c02f5, 0x2e410bfb, 0x8c61d79a, 0x876cde94, 0x9a7bc586, 0x9176cc88, 0xa055f3a2, 0xab58faac, 0xb64fe1be, 0xbd42e8b0, 0xd4099fea, 0xdf0496e4, 0xc2138df6, 0xc91e84f8, 0xf83dbbd2, 0xf330b2dc, 0xee27a9ce, 0xe52aa0c0, 0x3cb1477a, 0x37bc4e74, 0x2aab5566, 0x21a65c68, 0x10856342, 0x1b886a4c, 0x069f715e, 0x0d927850, 0x64d90f0a, 0x6fd40604, 0x72c31d16, 0x79ce1418, 0x48ed2b32, 0x43e0223c, 0x5ef7392e, 0x55fa3020, 0x01b79aec, 0x0aba93e2, 0x17ad88f0, 0x1ca081fe, 0x2d83bed4, 0x268eb7da, 0x3b99acc8, 0x3094a5c6, 0x59dfd29c, 0x52d2db92, 0x4fc5c080, 0x44c8c98e, 0x75ebf6a4, 0x7ee6ffaa, 0x63f1e4b8, 0x68fcedb6, 0xb1670a0c, 0xba6a0302, 0xa77d1810, 0xac70111e, 0x9d532e34, 0x965e273a, 0x8b493c28, 0x80443526, 0xe90f427c, 0xe2024b72, 0xff155060, 0xf418596e, 0xc53b6644, 0xce366f4a, 0xd3217458, 0xd82c7d56, 0x7a0ca137, 0x7101a839, 0x6c16b32b, 0x671bba25, 0x5638850f, 0x5d358c01, 0x40229713, 0x4b2f9e1d, 0x2264e947, 0x2969e049, 0x347efb5b, 0x3f73f255, 0x0e50cd7f, 0x055dc471, 0x184adf63, 0x1347d66d, 0xcadc31d7, 0xc1d138d9, 0xdcc623cb, 0xd7cb2ac5, 0xe6e815ef, 0xede51ce1, 0xf0f207f3, 0xfbff0efd, 0x92b479a7, 0x99b970a9, 0x84ae6bbb, 0x8fa362b5, 0xbe805d9f, 0xb58d5491, 0xa89a4f83, 0xa397468d, } }; union AES_STATE st = { .l = { float64_val(env->vfp.regs[rm]), float64_val(env->vfp.regs[rm + 1]) } }; int i; assert(decrypt < 2); for (i = 0; i < 16; i += 4) { st.cols[i >> 2] = cpu_to_le32( mc[decrypt][st.bytes[i]] ^ rol32(mc[decrypt][st.bytes[i + 1]], 8) ^ rol32(mc[decrypt][st.bytes[i + 2]], 16) ^ rol32(mc[decrypt][st.bytes[i + 3]], 24)); } env->vfp.regs[rd] = make_float64(st.l[0]); env->vfp.regs[rd + 1] = make_float64(st.l[1]); }
{ "code": [], "line_no": [] }
void FUNC_0(crypto_aesmc)(CPUARMState *env, uint32_t rd, uint32_t rm, uint32_t decrypt) { static uint32_t const VAR_0[][256] = { { 0x00000000, 0x03010102, 0x06020204, 0x05030306, 0x0c040408, 0x0f05050a, 0x0a06060c, 0x0907070e, 0x18080810, 0x1b090912, 0x1e0a0a14, 0x1d0b0b16, 0x140c0c18, 0x170d0d1a, 0x120e0e1c, 0x110f0f1e, 0x30101020, 0x33111122, 0x36121224, 0x35131326, 0x3c141428, 0x3f15152a, 0x3a16162c, 0x3917172e, 0x28181830, 0x2b191932, 0x2e1a1a34, 0x2d1b1b36, 0x241c1c38, 0x271d1d3a, 0x221e1e3c, 0x211f1f3e, 0x60202040, 0x63212142, 0x66222244, 0x65232346, 0x6c242448, 0x6f25254a, 0x6a26264c, 0x6927274e, 0x78282850, 0x7b292952, 0x7e2a2a54, 0x7d2b2b56, 0x742c2c58, 0x772d2d5a, 0x722e2e5c, 0x712f2f5e, 0x50303060, 0x53313162, 0x56323264, 0x55333366, 0x5c343468, 0x5f35356a, 0x5a36366c, 0x5937376e, 0x48383870, 0x4b393972, 0x4e3a3a74, 0x4d3b3b76, 0x443c3c78, 0x473d3d7a, 0x423e3e7c, 0x413f3f7e, 0xc0404080, 0xc3414182, 0xc6424284, 0xc5434386, 0xcc444488, 0xcf45458a, 0xca46468c, 0xc947478e, 0xd8484890, 0xdb494992, 0xde4a4a94, 0xdd4b4b96, 0xd44c4c98, 0xd74d4d9a, 0xd24e4e9c, 0xd14f4f9e, 0xf05050a0, 0xf35151a2, 0xf65252a4, 0xf55353a6, 0xfc5454a8, 0xff5555aa, 0xfa5656ac, 0xf95757ae, 0xe85858b0, 0xeb5959b2, 0xee5a5ab4, 0xed5b5bb6, 0xe45c5cb8, 0xe75d5dba, 0xe25e5ebc, 0xe15f5fbe, 0xa06060c0, 0xa36161c2, 0xa66262c4, 0xa56363c6, 0xac6464c8, 0xaf6565ca, 0xaa6666cc, 0xa96767ce, 0xb86868d0, 0xbb6969d2, 0xbe6a6ad4, 0xbd6b6bd6, 0xb46c6cd8, 0xb76d6dda, 0xb26e6edc, 0xb16f6fde, 0x907070e0, 0x937171e2, 0x967272e4, 0x957373e6, 0x9c7474e8, 0x9f7575ea, 0x9a7676ec, 0x997777ee, 0x887878f0, 0x8b7979f2, 0x8e7a7af4, 0x8d7b7bf6, 0x847c7cf8, 0x877d7dfa, 0x827e7efc, 0x817f7ffe, 0x9b80801b, 0x98818119, 0x9d82821f, 0x9e83831d, 0x97848413, 0x94858511, 0x91868617, 0x92878715, 0x8388880b, 0x80898909, 0x858a8a0f, 0x868b8b0d, 0x8f8c8c03, 0x8c8d8d01, 0x898e8e07, 0x8a8f8f05, 0xab90903b, 0xa8919139, 0xad92923f, 0xae93933d, 0xa7949433, 0xa4959531, 0xa1969637, 0xa2979735, 0xb398982b, 0xb0999929, 0xb59a9a2f, 0xb69b9b2d, 0xbf9c9c23, 0xbc9d9d21, 0xb99e9e27, 0xba9f9f25, 0xfba0a05b, 0xf8a1a159, 0xfda2a25f, 0xfea3a35d, 0xf7a4a453, 0xf4a5a551, 0xf1a6a657, 0xf2a7a755, 0xe3a8a84b, 0xe0a9a949, 0xe5aaaa4f, 0xe6abab4d, 0xefacac43, 0xecadad41, 0xe9aeae47, 0xeaafaf45, 0xcbb0b07b, 0xc8b1b179, 0xcdb2b27f, 0xceb3b37d, 0xc7b4b473, 0xc4b5b571, 0xc1b6b677, 0xc2b7b775, 0xd3b8b86b, 0xd0b9b969, 0xd5baba6f, 0xd6bbbb6d, 0xdfbcbc63, 0xdcbdbd61, 0xd9bebe67, 0xdabfbf65, 0x5bc0c09b, 0x58c1c199, 0x5dc2c29f, 0x5ec3c39d, 0x57c4c493, 0x54c5c591, 0x51c6c697, 0x52c7c795, 0x43c8c88b, 0x40c9c989, 0x45caca8f, 0x46cbcb8d, 0x4fcccc83, 0x4ccdcd81, 0x49cece87, 0x4acfcf85, 0x6bd0d0bb, 0x68d1d1b9, 0x6dd2d2bf, 0x6ed3d3bd, 0x67d4d4b3, 0x64d5d5b1, 0x61d6d6b7, 0x62d7d7b5, 0x73d8d8ab, 0x70d9d9a9, 0x75dadaaf, 0x76dbdbad, 0x7fdcdca3, 0x7cdddda1, 0x79dedea7, 0x7adfdfa5, 0x3be0e0db, 0x38e1e1d9, 0x3de2e2df, 0x3ee3e3dd, 0x37e4e4d3, 0x34e5e5d1, 0x31e6e6d7, 0x32e7e7d5, 0x23e8e8cb, 0x20e9e9c9, 0x25eaeacf, 0x26ebebcd, 0x2fececc3, 0x2cededc1, 0x29eeeec7, 0x2aefefc5, 0x0bf0f0fb, 0x08f1f1f9, 0x0df2f2ff, 0x0ef3f3fd, 0x07f4f4f3, 0x04f5f5f1, 0x01f6f6f7, 0x02f7f7f5, 0x13f8f8eb, 0x10f9f9e9, 0x15fafaef, 0x16fbfbed, 0x1ffcfce3, 0x1cfdfde1, 0x19fefee7, 0x1affffe5, }, { 0x00000000, 0x0b0d090e, 0x161a121c, 0x1d171b12, 0x2c342438, 0x27392d36, 0x3a2e3624, 0x31233f2a, 0x58684870, 0x5365417e, 0x4e725a6c, 0x457f5362, 0x745c6c48, 0x7f516546, 0x62467e54, 0x694b775a, 0xb0d090e0, 0xbbdd99ee, 0xa6ca82fc, 0xadc78bf2, 0x9ce4b4d8, 0x97e9bdd6, 0x8afea6c4, 0x81f3afca, 0xe8b8d890, 0xe3b5d19e, 0xfea2ca8c, 0xf5afc382, 0xc48cfca8, 0xcf81f5a6, 0xd296eeb4, 0xd99be7ba, 0x7bbb3bdb, 0x70b632d5, 0x6da129c7, 0x66ac20c9, 0x578f1fe3, 0x5c8216ed, 0x41950dff, 0x4a9804f1, 0x23d373ab, 0x28de7aa5, 0x35c961b7, 0x3ec468b9, 0x0fe75793, 0x04ea5e9d, 0x19fd458f, 0x12f04c81, 0xcb6bab3b, 0xc066a235, 0xdd71b927, 0xd67cb029, 0xe75f8f03, 0xec52860d, 0xf1459d1f, 0xfa489411, 0x9303e34b, 0x980eea45, 0x8519f157, 0x8e14f859, 0xbf37c773, 0xb43ace7d, 0xa92dd56f, 0xa220dc61, 0xf66d76ad, 0xfd607fa3, 0xe07764b1, 0xeb7a6dbf, 0xda595295, 0xd1545b9b, 0xcc434089, 0xc74e4987, 0xae053edd, 0xa50837d3, 0xb81f2cc1, 0xb31225cf, 0x82311ae5, 0x893c13eb, 0x942b08f9, 0x9f2601f7, 0x46bde64d, 0x4db0ef43, 0x50a7f451, 0x5baafd5f, 0x6a89c275, 0x6184cb7b, 0x7c93d069, 0x779ed967, 0x1ed5ae3d, 0x15d8a733, 0x08cfbc21, 0x03c2b52f, 0x32e18a05, 0x39ec830b, 0x24fb9819, 0x2ff69117, 0x8dd64d76, 0x86db4478, 0x9bcc5f6a, 0x90c15664, 0xa1e2694e, 0xaaef6040, 0xb7f87b52, 0xbcf5725c, 0xd5be0506, 0xdeb30c08, 0xc3a4171a, 0xc8a91e14, 0xf98a213e, 0xf2872830, 0xef903322, 0xe49d3a2c, 0x3d06dd96, 0x360bd498, 0x2b1ccf8a, 0x2011c684, 0x1132f9ae, 0x1a3ff0a0, 0x0728ebb2, 0x0c25e2bc, 0x656e95e6, 0x6e639ce8, 0x737487fa, 0x78798ef4, 0x495ab1de, 0x4257b8d0, 0x5f40a3c2, 0x544daacc, 0xf7daec41, 0xfcd7e54f, 0xe1c0fe5d, 0xeacdf753, 0xdbeec879, 0xd0e3c177, 0xcdf4da65, 0xc6f9d36b, 0xafb2a431, 0xa4bfad3f, 0xb9a8b62d, 0xb2a5bf23, 0x83868009, 0x888b8907, 0x959c9215, 0x9e919b1b, 0x470a7ca1, 0x4c0775af, 0x51106ebd, 0x5a1d67b3, 0x6b3e5899, 0x60335197, 0x7d244a85, 0x7629438b, 0x1f6234d1, 0x146f3ddf, 0x097826cd, 0x02752fc3, 0x335610e9, 0x385b19e7, 0x254c02f5, 0x2e410bfb, 0x8c61d79a, 0x876cde94, 0x9a7bc586, 0x9176cc88, 0xa055f3a2, 0xab58faac, 0xb64fe1be, 0xbd42e8b0, 0xd4099fea, 0xdf0496e4, 0xc2138df6, 0xc91e84f8, 0xf83dbbd2, 0xf330b2dc, 0xee27a9ce, 0xe52aa0c0, 0x3cb1477a, 0x37bc4e74, 0x2aab5566, 0x21a65c68, 0x10856342, 0x1b886a4c, 0x069f715e, 0x0d927850, 0x64d90f0a, 0x6fd40604, 0x72c31d16, 0x79ce1418, 0x48ed2b32, 0x43e0223c, 0x5ef7392e, 0x55fa3020, 0x01b79aec, 0x0aba93e2, 0x17ad88f0, 0x1ca081fe, 0x2d83bed4, 0x268eb7da, 0x3b99acc8, 0x3094a5c6, 0x59dfd29c, 0x52d2db92, 0x4fc5c080, 0x44c8c98e, 0x75ebf6a4, 0x7ee6ffaa, 0x63f1e4b8, 0x68fcedb6, 0xb1670a0c, 0xba6a0302, 0xa77d1810, 0xac70111e, 0x9d532e34, 0x965e273a, 0x8b493c28, 0x80443526, 0xe90f427c, 0xe2024b72, 0xff155060, 0xf418596e, 0xc53b6644, 0xce366f4a, 0xd3217458, 0xd82c7d56, 0x7a0ca137, 0x7101a839, 0x6c16b32b, 0x671bba25, 0x5638850f, 0x5d358c01, 0x40229713, 0x4b2f9e1d, 0x2264e947, 0x2969e049, 0x347efb5b, 0x3f73f255, 0x0e50cd7f, 0x055dc471, 0x184adf63, 0x1347d66d, 0xcadc31d7, 0xc1d138d9, 0xdcc623cb, 0xd7cb2ac5, 0xe6e815ef, 0xede51ce1, 0xf0f207f3, 0xfbff0efd, 0x92b479a7, 0x99b970a9, 0x84ae6bbb, 0x8fa362b5, 0xbe805d9f, 0xb58d5491, 0xa89a4f83, 0xa397468d, } }; union AES_STATE VAR_1 = { .l = { float64_val(env->vfp.regs[rm]), float64_val(env->vfp.regs[rm + 1]) } }; int VAR_2; assert(decrypt < 2); for (VAR_2 = 0; VAR_2 < 16; VAR_2 += 4) { VAR_1.cols[VAR_2 >> 2] = cpu_to_le32( VAR_0[decrypt][VAR_1.bytes[VAR_2]] ^ rol32(VAR_0[decrypt][VAR_1.bytes[VAR_2 + 1]], 8) ^ rol32(VAR_0[decrypt][VAR_1.bytes[VAR_2 + 2]], 16) ^ rol32(VAR_0[decrypt][VAR_1.bytes[VAR_2 + 3]], 24)); } env->vfp.regs[rd] = make_float64(VAR_1.l[0]); env->vfp.regs[rd + 1] = make_float64(VAR_1.l[1]); }
[ "void FUNC_0(crypto_aesmc)(CPUARMState *env, uint32_t rd, uint32_t rm,\nuint32_t decrypt)\n{", "static uint32_t const VAR_0[][256] = { {", "0x00000000, 0x03010102, 0x06020204, 0x05030306,\n0x0c040408, 0x0f05050a, 0x0a06060c, 0x0907070e,\n0x18080810, 0x1b090912, 0x1e0a0a14, 0x1d0b0b16,\n0x140c0c18, 0x170d0d1a, 0x120e0e1c, 0x110f0f1e,\n0x30101020, 0x33111122, 0x36121224, 0x35131326,\n0x3c141428, 0x3f15152a, 0x3a16162c, 0x3917172e,\n0x28181830, 0x2b191932, 0x2e1a1a34, 0x2d1b1b36,\n0x241c1c38, 0x271d1d3a, 0x221e1e3c, 0x211f1f3e,\n0x60202040, 0x63212142, 0x66222244, 0x65232346,\n0x6c242448, 0x6f25254a, 0x6a26264c, 0x6927274e,\n0x78282850, 0x7b292952, 0x7e2a2a54, 0x7d2b2b56,\n0x742c2c58, 0x772d2d5a, 0x722e2e5c, 0x712f2f5e,\n0x50303060, 0x53313162, 0x56323264, 0x55333366,\n0x5c343468, 0x5f35356a, 0x5a36366c, 0x5937376e,\n0x48383870, 0x4b393972, 0x4e3a3a74, 0x4d3b3b76,\n0x443c3c78, 0x473d3d7a, 0x423e3e7c, 0x413f3f7e,\n0xc0404080, 0xc3414182, 0xc6424284, 0xc5434386,\n0xcc444488, 0xcf45458a, 0xca46468c, 0xc947478e,\n0xd8484890, 0xdb494992, 0xde4a4a94, 0xdd4b4b96,\n0xd44c4c98, 0xd74d4d9a, 0xd24e4e9c, 0xd14f4f9e,\n0xf05050a0, 0xf35151a2, 0xf65252a4, 0xf55353a6,\n0xfc5454a8, 0xff5555aa, 0xfa5656ac, 0xf95757ae,\n0xe85858b0, 0xeb5959b2, 0xee5a5ab4, 0xed5b5bb6,\n0xe45c5cb8, 0xe75d5dba, 0xe25e5ebc, 0xe15f5fbe,\n0xa06060c0, 0xa36161c2, 0xa66262c4, 0xa56363c6,\n0xac6464c8, 0xaf6565ca, 0xaa6666cc, 0xa96767ce,\n0xb86868d0, 0xbb6969d2, 0xbe6a6ad4, 0xbd6b6bd6,\n0xb46c6cd8, 0xb76d6dda, 0xb26e6edc, 0xb16f6fde,\n0x907070e0, 0x937171e2, 0x967272e4, 0x957373e6,\n0x9c7474e8, 0x9f7575ea, 0x9a7676ec, 0x997777ee,\n0x887878f0, 0x8b7979f2, 0x8e7a7af4, 0x8d7b7bf6,\n0x847c7cf8, 0x877d7dfa, 0x827e7efc, 0x817f7ffe,\n0x9b80801b, 0x98818119, 0x9d82821f, 0x9e83831d,\n0x97848413, 0x94858511, 0x91868617, 0x92878715,\n0x8388880b, 0x80898909, 0x858a8a0f, 0x868b8b0d,\n0x8f8c8c03, 0x8c8d8d01, 0x898e8e07, 0x8a8f8f05,\n0xab90903b, 0xa8919139, 0xad92923f, 0xae93933d,\n0xa7949433, 0xa4959531, 0xa1969637, 0xa2979735,\n0xb398982b, 0xb0999929, 0xb59a9a2f, 0xb69b9b2d,\n0xbf9c9c23, 0xbc9d9d21, 0xb99e9e27, 0xba9f9f25,\n0xfba0a05b, 0xf8a1a159, 0xfda2a25f, 0xfea3a35d,\n0xf7a4a453, 0xf4a5a551, 0xf1a6a657, 0xf2a7a755,\n0xe3a8a84b, 0xe0a9a949, 0xe5aaaa4f, 0xe6abab4d,\n0xefacac43, 0xecadad41, 0xe9aeae47, 0xeaafaf45,\n0xcbb0b07b, 0xc8b1b179, 0xcdb2b27f, 0xceb3b37d,\n0xc7b4b473, 0xc4b5b571, 0xc1b6b677, 0xc2b7b775,\n0xd3b8b86b, 0xd0b9b969, 0xd5baba6f, 0xd6bbbb6d,\n0xdfbcbc63, 0xdcbdbd61, 0xd9bebe67, 0xdabfbf65,\n0x5bc0c09b, 0x58c1c199, 0x5dc2c29f, 0x5ec3c39d,\n0x57c4c493, 0x54c5c591, 0x51c6c697, 0x52c7c795,\n0x43c8c88b, 0x40c9c989, 0x45caca8f, 0x46cbcb8d,\n0x4fcccc83, 0x4ccdcd81, 0x49cece87, 0x4acfcf85,\n0x6bd0d0bb, 0x68d1d1b9, 0x6dd2d2bf, 0x6ed3d3bd,\n0x67d4d4b3, 0x64d5d5b1, 0x61d6d6b7, 0x62d7d7b5,\n0x73d8d8ab, 0x70d9d9a9, 0x75dadaaf, 0x76dbdbad,\n0x7fdcdca3, 0x7cdddda1, 0x79dedea7, 0x7adfdfa5,\n0x3be0e0db, 0x38e1e1d9, 0x3de2e2df, 0x3ee3e3dd,\n0x37e4e4d3, 0x34e5e5d1, 0x31e6e6d7, 0x32e7e7d5,\n0x23e8e8cb, 0x20e9e9c9, 0x25eaeacf, 0x26ebebcd,\n0x2fececc3, 0x2cededc1, 0x29eeeec7, 0x2aefefc5,\n0x0bf0f0fb, 0x08f1f1f9, 0x0df2f2ff, 0x0ef3f3fd,\n0x07f4f4f3, 0x04f5f5f1, 0x01f6f6f7, 0x02f7f7f5,\n0x13f8f8eb, 0x10f9f9e9, 0x15fafaef, 0x16fbfbed,\n0x1ffcfce3, 0x1cfdfde1, 0x19fefee7, 0x1affffe5,\n}, {", "0x00000000, 0x0b0d090e, 0x161a121c, 0x1d171b12,\n0x2c342438, 0x27392d36, 0x3a2e3624, 0x31233f2a,\n0x58684870, 0x5365417e, 0x4e725a6c, 0x457f5362,\n0x745c6c48, 0x7f516546, 0x62467e54, 0x694b775a,\n0xb0d090e0, 0xbbdd99ee, 0xa6ca82fc, 0xadc78bf2,\n0x9ce4b4d8, 0x97e9bdd6, 0x8afea6c4, 0x81f3afca,\n0xe8b8d890, 0xe3b5d19e, 0xfea2ca8c, 0xf5afc382,\n0xc48cfca8, 0xcf81f5a6, 0xd296eeb4, 0xd99be7ba,\n0x7bbb3bdb, 0x70b632d5, 0x6da129c7, 0x66ac20c9,\n0x578f1fe3, 0x5c8216ed, 0x41950dff, 0x4a9804f1,\n0x23d373ab, 0x28de7aa5, 0x35c961b7, 0x3ec468b9,\n0x0fe75793, 0x04ea5e9d, 0x19fd458f, 0x12f04c81,\n0xcb6bab3b, 0xc066a235, 0xdd71b927, 0xd67cb029,\n0xe75f8f03, 0xec52860d, 0xf1459d1f, 0xfa489411,\n0x9303e34b, 0x980eea45, 0x8519f157, 0x8e14f859,\n0xbf37c773, 0xb43ace7d, 0xa92dd56f, 0xa220dc61,\n0xf66d76ad, 0xfd607fa3, 0xe07764b1, 0xeb7a6dbf,\n0xda595295, 0xd1545b9b, 0xcc434089, 0xc74e4987,\n0xae053edd, 0xa50837d3, 0xb81f2cc1, 0xb31225cf,\n0x82311ae5, 0x893c13eb, 0x942b08f9, 0x9f2601f7,\n0x46bde64d, 0x4db0ef43, 0x50a7f451, 0x5baafd5f,\n0x6a89c275, 0x6184cb7b, 0x7c93d069, 0x779ed967,\n0x1ed5ae3d, 0x15d8a733, 0x08cfbc21, 0x03c2b52f,\n0x32e18a05, 0x39ec830b, 0x24fb9819, 0x2ff69117,\n0x8dd64d76, 0x86db4478, 0x9bcc5f6a, 0x90c15664,\n0xa1e2694e, 0xaaef6040, 0xb7f87b52, 0xbcf5725c,\n0xd5be0506, 0xdeb30c08, 0xc3a4171a, 0xc8a91e14,\n0xf98a213e, 0xf2872830, 0xef903322, 0xe49d3a2c,\n0x3d06dd96, 0x360bd498, 0x2b1ccf8a, 0x2011c684,\n0x1132f9ae, 0x1a3ff0a0, 0x0728ebb2, 0x0c25e2bc,\n0x656e95e6, 0x6e639ce8, 0x737487fa, 0x78798ef4,\n0x495ab1de, 0x4257b8d0, 0x5f40a3c2, 0x544daacc,\n0xf7daec41, 0xfcd7e54f, 0xe1c0fe5d, 0xeacdf753,\n0xdbeec879, 0xd0e3c177, 0xcdf4da65, 0xc6f9d36b,\n0xafb2a431, 0xa4bfad3f, 0xb9a8b62d, 0xb2a5bf23,\n0x83868009, 0x888b8907, 0x959c9215, 0x9e919b1b,\n0x470a7ca1, 0x4c0775af, 0x51106ebd, 0x5a1d67b3,\n0x6b3e5899, 0x60335197, 0x7d244a85, 0x7629438b,\n0x1f6234d1, 0x146f3ddf, 0x097826cd, 0x02752fc3,\n0x335610e9, 0x385b19e7, 0x254c02f5, 0x2e410bfb,\n0x8c61d79a, 0x876cde94, 0x9a7bc586, 0x9176cc88,\n0xa055f3a2, 0xab58faac, 0xb64fe1be, 0xbd42e8b0,\n0xd4099fea, 0xdf0496e4, 0xc2138df6, 0xc91e84f8,\n0xf83dbbd2, 0xf330b2dc, 0xee27a9ce, 0xe52aa0c0,\n0x3cb1477a, 0x37bc4e74, 0x2aab5566, 0x21a65c68,\n0x10856342, 0x1b886a4c, 0x069f715e, 0x0d927850,\n0x64d90f0a, 0x6fd40604, 0x72c31d16, 0x79ce1418,\n0x48ed2b32, 0x43e0223c, 0x5ef7392e, 0x55fa3020,\n0x01b79aec, 0x0aba93e2, 0x17ad88f0, 0x1ca081fe,\n0x2d83bed4, 0x268eb7da, 0x3b99acc8, 0x3094a5c6,\n0x59dfd29c, 0x52d2db92, 0x4fc5c080, 0x44c8c98e,\n0x75ebf6a4, 0x7ee6ffaa, 0x63f1e4b8, 0x68fcedb6,\n0xb1670a0c, 0xba6a0302, 0xa77d1810, 0xac70111e,\n0x9d532e34, 0x965e273a, 0x8b493c28, 0x80443526,\n0xe90f427c, 0xe2024b72, 0xff155060, 0xf418596e,\n0xc53b6644, 0xce366f4a, 0xd3217458, 0xd82c7d56,\n0x7a0ca137, 0x7101a839, 0x6c16b32b, 0x671bba25,\n0x5638850f, 0x5d358c01, 0x40229713, 0x4b2f9e1d,\n0x2264e947, 0x2969e049, 0x347efb5b, 0x3f73f255,\n0x0e50cd7f, 0x055dc471, 0x184adf63, 0x1347d66d,\n0xcadc31d7, 0xc1d138d9, 0xdcc623cb, 0xd7cb2ac5,\n0xe6e815ef, 0xede51ce1, 0xf0f207f3, 0xfbff0efd,\n0x92b479a7, 0x99b970a9, 0x84ae6bbb, 0x8fa362b5,\n0xbe805d9f, 0xb58d5491, 0xa89a4f83, 0xa397468d,\n} };", "union AES_STATE VAR_1 = { .l = {", "float64_val(env->vfp.regs[rm]),\nfloat64_val(env->vfp.regs[rm + 1])\n} };", "int VAR_2;", "assert(decrypt < 2);", "for (VAR_2 = 0; VAR_2 < 16; VAR_2 += 4) {", "VAR_1.cols[VAR_2 >> 2] = cpu_to_le32(\nVAR_0[decrypt][VAR_1.bytes[VAR_2]] ^\nrol32(VAR_0[decrypt][VAR_1.bytes[VAR_2 + 1]], 8) ^\nrol32(VAR_0[decrypt][VAR_1.bytes[VAR_2 + 2]], 16) ^\nrol32(VAR_0[decrypt][VAR_1.bytes[VAR_2 + 3]], 24));", "}", "env->vfp.regs[rd] = make_float64(VAR_1.l[0]);", "env->vfp.regs[rd + 1] = make_float64(VAR_1.l[1]);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139 ], [ 143, 145, 147, 149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, 267, 269, 271 ], [ 273 ], [ 275, 277, 279 ], [ 281 ], [ 285 ], [ 289 ], [ 291, 293, 295, 297, 299 ], [ 301 ], [ 305 ], [ 307 ], [ 309 ] ]
13,381
int qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t offset, int *num, uint64_t *cluster_offset) { BDRVQcowState *s = bs->opaque; unsigned int l2_index; uint64_t l1_index, l2_offset, *l2_table; int l1_bits, c; unsigned int index_in_cluster, nb_clusters; uint64_t nb_available, nb_needed; int ret; index_in_cluster = (offset >> 9) & (s->cluster_sectors - 1); nb_needed = *num + index_in_cluster; l1_bits = s->l2_bits + s->cluster_bits; /* compute how many bytes there are between the offset and * the end of the l1 entry */ nb_available = (1ULL << l1_bits) - (offset & ((1ULL << l1_bits) - 1)); /* compute the number of available sectors */ nb_available = (nb_available >> 9) + index_in_cluster; if (nb_needed > nb_available) { nb_needed = nb_available; } *cluster_offset = 0; /* seek the the l2 offset in the l1 table */ l1_index = offset >> l1_bits; if (l1_index >= s->l1_size) { ret = QCOW2_CLUSTER_UNALLOCATED; goto out; } l2_offset = s->l1_table[l1_index] & L1E_OFFSET_MASK; if (!l2_offset) { ret = QCOW2_CLUSTER_UNALLOCATED; goto out; } /* load the l2 table in memory */ ret = l2_load(bs, l2_offset, &l2_table); if (ret < 0) { return ret; } /* find the cluster offset for the given disk offset */ l2_index = (offset >> s->cluster_bits) & (s->l2_size - 1); *cluster_offset = be64_to_cpu(l2_table[l2_index]); nb_clusters = size_to_clusters(s, nb_needed << 9); ret = qcow2_get_cluster_type(*cluster_offset); switch (ret) { case QCOW2_CLUSTER_COMPRESSED: /* Compressed clusters can only be processed one by one */ c = 1; *cluster_offset &= L2E_COMPRESSED_OFFSET_SIZE_MASK; break; case QCOW2_CLUSTER_ZERO: if (s->qcow_version < 3) { qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); return -EIO; } c = count_contiguous_clusters(nb_clusters, s->cluster_size, &l2_table[l2_index], QCOW_OFLAG_ZERO); *cluster_offset = 0; break; case QCOW2_CLUSTER_UNALLOCATED: /* how many empty clusters ? */ c = count_contiguous_free_clusters(nb_clusters, &l2_table[l2_index]); *cluster_offset = 0; break; case QCOW2_CLUSTER_NORMAL: /* how many allocated clusters ? */ c = count_contiguous_clusters(nb_clusters, s->cluster_size, &l2_table[l2_index], QCOW_OFLAG_ZERO); *cluster_offset &= L2E_OFFSET_MASK; break; default: abort(); } qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); nb_available = (c * s->cluster_sectors); out: if (nb_available > nb_needed) nb_available = nb_needed; *num = nb_available - index_in_cluster; return ret; }
false
qemu
a97c67ee6c1546b985c1048c7a1f9e4fc13d9ee1
int qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t offset, int *num, uint64_t *cluster_offset) { BDRVQcowState *s = bs->opaque; unsigned int l2_index; uint64_t l1_index, l2_offset, *l2_table; int l1_bits, c; unsigned int index_in_cluster, nb_clusters; uint64_t nb_available, nb_needed; int ret; index_in_cluster = (offset >> 9) & (s->cluster_sectors - 1); nb_needed = *num + index_in_cluster; l1_bits = s->l2_bits + s->cluster_bits; nb_available = (1ULL << l1_bits) - (offset & ((1ULL << l1_bits) - 1)); nb_available = (nb_available >> 9) + index_in_cluster; if (nb_needed > nb_available) { nb_needed = nb_available; } *cluster_offset = 0; l1_index = offset >> l1_bits; if (l1_index >= s->l1_size) { ret = QCOW2_CLUSTER_UNALLOCATED; goto out; } l2_offset = s->l1_table[l1_index] & L1E_OFFSET_MASK; if (!l2_offset) { ret = QCOW2_CLUSTER_UNALLOCATED; goto out; } ret = l2_load(bs, l2_offset, &l2_table); if (ret < 0) { return ret; } l2_index = (offset >> s->cluster_bits) & (s->l2_size - 1); *cluster_offset = be64_to_cpu(l2_table[l2_index]); nb_clusters = size_to_clusters(s, nb_needed << 9); ret = qcow2_get_cluster_type(*cluster_offset); switch (ret) { case QCOW2_CLUSTER_COMPRESSED: c = 1; *cluster_offset &= L2E_COMPRESSED_OFFSET_SIZE_MASK; break; case QCOW2_CLUSTER_ZERO: if (s->qcow_version < 3) { qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); return -EIO; } c = count_contiguous_clusters(nb_clusters, s->cluster_size, &l2_table[l2_index], QCOW_OFLAG_ZERO); *cluster_offset = 0; break; case QCOW2_CLUSTER_UNALLOCATED: c = count_contiguous_free_clusters(nb_clusters, &l2_table[l2_index]); *cluster_offset = 0; break; case QCOW2_CLUSTER_NORMAL: c = count_contiguous_clusters(nb_clusters, s->cluster_size, &l2_table[l2_index], QCOW_OFLAG_ZERO); *cluster_offset &= L2E_OFFSET_MASK; break; default: abort(); } qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); nb_available = (c * s->cluster_sectors); out: if (nb_available > nb_needed) nb_available = nb_needed; *num = nb_available - index_in_cluster; return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, int *VAR_2, uint64_t *VAR_3) { BDRVQcowState *s = VAR_0->opaque; unsigned int VAR_4; uint64_t l1_index, l2_offset, *l2_table; int VAR_5, VAR_6; unsigned int VAR_7, VAR_8; uint64_t nb_available, nb_needed; int VAR_9; VAR_7 = (VAR_1 >> 9) & (s->cluster_sectors - 1); nb_needed = *VAR_2 + VAR_7; VAR_5 = s->l2_bits + s->cluster_bits; nb_available = (1ULL << VAR_5) - (VAR_1 & ((1ULL << VAR_5) - 1)); nb_available = (nb_available >> 9) + VAR_7; if (nb_needed > nb_available) { nb_needed = nb_available; } *VAR_3 = 0; l1_index = VAR_1 >> VAR_5; if (l1_index >= s->l1_size) { VAR_9 = QCOW2_CLUSTER_UNALLOCATED; goto out; } l2_offset = s->l1_table[l1_index] & L1E_OFFSET_MASK; if (!l2_offset) { VAR_9 = QCOW2_CLUSTER_UNALLOCATED; goto out; } VAR_9 = l2_load(VAR_0, l2_offset, &l2_table); if (VAR_9 < 0) { return VAR_9; } VAR_4 = (VAR_1 >> s->cluster_bits) & (s->l2_size - 1); *VAR_3 = be64_to_cpu(l2_table[VAR_4]); VAR_8 = size_to_clusters(s, nb_needed << 9); VAR_9 = qcow2_get_cluster_type(*VAR_3); switch (VAR_9) { case QCOW2_CLUSTER_COMPRESSED: VAR_6 = 1; *VAR_3 &= L2E_COMPRESSED_OFFSET_SIZE_MASK; break; case QCOW2_CLUSTER_ZERO: if (s->qcow_version < 3) { qcow2_cache_put(VAR_0, s->l2_table_cache, (void**) &l2_table); return -EIO; } VAR_6 = count_contiguous_clusters(VAR_8, s->cluster_size, &l2_table[VAR_4], QCOW_OFLAG_ZERO); *VAR_3 = 0; break; case QCOW2_CLUSTER_UNALLOCATED: VAR_6 = count_contiguous_free_clusters(VAR_8, &l2_table[VAR_4]); *VAR_3 = 0; break; case QCOW2_CLUSTER_NORMAL: VAR_6 = count_contiguous_clusters(VAR_8, s->cluster_size, &l2_table[VAR_4], QCOW_OFLAG_ZERO); *VAR_3 &= L2E_OFFSET_MASK; break; default: abort(); } qcow2_cache_put(VAR_0, s->l2_table_cache, (void**) &l2_table); nb_available = (VAR_6 * s->cluster_sectors); out: if (nb_available > nb_needed) nb_available = nb_needed; *VAR_2 = nb_available - VAR_7; return VAR_9; }
[ "int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,\nint *VAR_2, uint64_t *VAR_3)\n{", "BDRVQcowState *s = VAR_0->opaque;", "unsigned int VAR_4;", "uint64_t l1_index, l2_offset, *l2_table;", "int VAR_5, VAR_6;", "unsigned int VAR_7, VAR_8;", "uint64_t nb_available, nb_needed;", "int VAR_9;", "VAR_7 = (VAR_1 >> 9) & (s->cluster_sectors - 1);", "nb_needed = *VAR_2 + VAR_7;", "VAR_5 = s->l2_bits + s->cluster_bits;", "nb_available = (1ULL << VAR_5) - (VAR_1 & ((1ULL << VAR_5) - 1));", "nb_available = (nb_available >> 9) + VAR_7;", "if (nb_needed > nb_available) {", "nb_needed = nb_available;", "}", "*VAR_3 = 0;", "l1_index = VAR_1 >> VAR_5;", "if (l1_index >= s->l1_size) {", "VAR_9 = QCOW2_CLUSTER_UNALLOCATED;", "goto out;", "}", "l2_offset = s->l1_table[l1_index] & L1E_OFFSET_MASK;", "if (!l2_offset) {", "VAR_9 = QCOW2_CLUSTER_UNALLOCATED;", "goto out;", "}", "VAR_9 = l2_load(VAR_0, l2_offset, &l2_table);", "if (VAR_9 < 0) {", "return VAR_9;", "}", "VAR_4 = (VAR_1 >> s->cluster_bits) & (s->l2_size - 1);", "*VAR_3 = be64_to_cpu(l2_table[VAR_4]);", "VAR_8 = size_to_clusters(s, nb_needed << 9);", "VAR_9 = qcow2_get_cluster_type(*VAR_3);", "switch (VAR_9) {", "case QCOW2_CLUSTER_COMPRESSED:\nVAR_6 = 1;", "*VAR_3 &= L2E_COMPRESSED_OFFSET_SIZE_MASK;", "break;", "case QCOW2_CLUSTER_ZERO:\nif (s->qcow_version < 3) {", "qcow2_cache_put(VAR_0, s->l2_table_cache, (void**) &l2_table);", "return -EIO;", "}", "VAR_6 = count_contiguous_clusters(VAR_8, s->cluster_size,\n&l2_table[VAR_4], QCOW_OFLAG_ZERO);", "*VAR_3 = 0;", "break;", "case QCOW2_CLUSTER_UNALLOCATED:\nVAR_6 = count_contiguous_free_clusters(VAR_8, &l2_table[VAR_4]);", "*VAR_3 = 0;", "break;", "case QCOW2_CLUSTER_NORMAL:\nVAR_6 = count_contiguous_clusters(VAR_8, s->cluster_size,\n&l2_table[VAR_4], QCOW_OFLAG_ZERO);", "*VAR_3 &= L2E_OFFSET_MASK;", "break;", "default:\nabort();", "}", "qcow2_cache_put(VAR_0, s->l2_table_cache, (void**) &l2_table);", "nb_available = (VAR_6 * s->cluster_sectors);", "out:\nif (nb_available > nb_needed)\nnb_available = nb_needed;", "*VAR_2 = nb_available - VAR_7;", "return VAR_9;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 41 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123, 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151, 155 ], [ 157 ], [ 159 ], [ 161, 165, 167 ], [ 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 181 ], [ 185 ], [ 189, 191, 193 ], [ 197 ], [ 201 ], [ 203 ] ]
13,382
static int v9fs_synth_mkdir(FsContext *fs_ctx, V9fsPath *path, const char *buf, FsCred *credp) { errno = EPERM; return -1; }
false
qemu
364031f17932814484657e5551ba12957d993d7e
static int v9fs_synth_mkdir(FsContext *fs_ctx, V9fsPath *path, const char *buf, FsCred *credp) { errno = EPERM; return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, const char *VAR_2, FsCred *VAR_3) { errno = EPERM; return -1; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,\nconst char *VAR_2, FsCred *VAR_3)\n{", "errno = EPERM;", "return -1;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
13,383
static int rm_write_packet(AVFormatContext *s, AVPacket *pkt) { if (s->streams[pkt->stream_index]->codec.codec_type == CODEC_TYPE_AUDIO) return rm_write_audio(s, pkt->data, pkt->size); else return rm_write_video(s, pkt->data, pkt->size); }
false
FFmpeg
3c895fc098f7637f6d5ec3a9d6766e724a8b9e41
static int rm_write_packet(AVFormatContext *s, AVPacket *pkt) { if (s->streams[pkt->stream_index]->codec.codec_type == CODEC_TYPE_AUDIO) return rm_write_audio(s, pkt->data, pkt->size); else return rm_write_video(s, pkt->data, pkt->size); }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { if (VAR_0->streams[VAR_1->stream_index]->codec.codec_type == CODEC_TYPE_AUDIO) return rm_write_audio(VAR_0, VAR_1->data, VAR_1->size); else return rm_write_video(VAR_0, VAR_1->data, VAR_1->size); }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "if (VAR_0->streams[VAR_1->stream_index]->codec.codec_type ==\nCODEC_TYPE_AUDIO)\nreturn rm_write_audio(VAR_0, VAR_1->data, VAR_1->size);", "else\nreturn rm_write_video(VAR_0, VAR_1->data, VAR_1->size);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9 ], [ 11, 13 ], [ 15 ] ]
13,384
static uint64_t cs_mem_read(void *opaque, target_phys_addr_t addr, unsigned size) { CSState *s = opaque; uint32_t saddr, ret; saddr = addr >> 2; switch (saddr) { case 1: switch (CS_RAP(s)) { case 3: // Write only ret = 0; break; default: ret = s->dregs[CS_RAP(s)]; break; } trace_cs4231_mem_readl_dreg(CS_RAP(s), ret); break; default: ret = s->regs[saddr]; trace_cs4231_mem_readl_reg(saddr, ret); break; } return ret; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t cs_mem_read(void *opaque, target_phys_addr_t addr, unsigned size) { CSState *s = opaque; uint32_t saddr, ret; saddr = addr >> 2; switch (saddr) { case 1: switch (CS_RAP(s)) { case 3: ret = 0; break; default: ret = s->dregs[CS_RAP(s)]; break; } trace_cs4231_mem_readl_dreg(CS_RAP(s), ret); break; default: ret = s->regs[saddr]; trace_cs4231_mem_readl_reg(saddr, ret); break; } return ret; }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { CSState *s = opaque; uint32_t saddr, ret; saddr = addr >> 2; switch (saddr) { case 1: switch (CS_RAP(s)) { case 3: ret = 0; break; default: ret = s->dregs[CS_RAP(s)]; break; } trace_cs4231_mem_readl_dreg(CS_RAP(s), ret); break; default: ret = s->regs[saddr]; trace_cs4231_mem_readl_reg(saddr, ret); break; } return ret; }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "CSState *s = opaque;", "uint32_t saddr, ret;", "saddr = addr >> 2;", "switch (saddr) {", "case 1:\nswitch (CS_RAP(s)) {", "case 3:\nret = 0;", "break;", "default:\nret = s->dregs[CS_RAP(s)];", "break;", "}", "trace_cs4231_mem_readl_dreg(CS_RAP(s), ret);", "break;", "default:\nret = s->regs[saddr];", "trace_cs4231_mem_readl_reg(saddr, ret);", "break;", "}", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
13,386
static int sctp_write(URLContext *h, const uint8_t *buf, int size) { SCTPContext *s = h->priv_data; int ret; if (!(h->flags & AVIO_FLAG_NONBLOCK)) { ret = sctp_wait_fd(s->fd, 1); if (ret < 0) return ret; } if (s->max_streams) { /*StreamId is introduced as a 2byte code into the stream*/ struct sctp_sndrcvinfo info = { 0 }; info.sinfo_stream = AV_RB16(buf); if (info.sinfo_stream > s->max_streams) abort(); ret = ff_sctp_send(s->fd, buf + 2, size - 2, &info, MSG_EOR); } else ret = send(s->fd, buf, size, 0); return ret < 0 ? ff_neterrno() : ret; }
false
FFmpeg
2e59142fa9a0db5fab8aa2e676ba524f61280b83
static int sctp_write(URLContext *h, const uint8_t *buf, int size) { SCTPContext *s = h->priv_data; int ret; if (!(h->flags & AVIO_FLAG_NONBLOCK)) { ret = sctp_wait_fd(s->fd, 1); if (ret < 0) return ret; } if (s->max_streams) { struct sctp_sndrcvinfo info = { 0 }; info.sinfo_stream = AV_RB16(buf); if (info.sinfo_stream > s->max_streams) abort(); ret = ff_sctp_send(s->fd, buf + 2, size - 2, &info, MSG_EOR); } else ret = send(s->fd, buf, size, 0); return ret < 0 ? ff_neterrno() : ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(URLContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { SCTPContext *s = VAR_0->priv_data; int VAR_3; if (!(VAR_0->flags & AVIO_FLAG_NONBLOCK)) { VAR_3 = sctp_wait_fd(s->fd, 1); if (VAR_3 < 0) return VAR_3; } if (s->max_streams) { struct sctp_sndrcvinfo VAR_4 = { 0 }; VAR_4.sinfo_stream = AV_RB16(VAR_1); if (VAR_4.sinfo_stream > s->max_streams) abort(); VAR_3 = ff_sctp_send(s->fd, VAR_1 + 2, VAR_2 - 2, &VAR_4, MSG_EOR); } else VAR_3 = send(s->fd, VAR_1, VAR_2, 0); return VAR_3 < 0 ? ff_neterrno() : VAR_3; }
[ "static int FUNC_0(URLContext *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "SCTPContext *s = VAR_0->priv_data;", "int VAR_3;", "if (!(VAR_0->flags & AVIO_FLAG_NONBLOCK)) {", "VAR_3 = sctp_wait_fd(s->fd, 1);", "if (VAR_3 < 0)\nreturn VAR_3;", "}", "if (s->max_streams) {", "struct sctp_sndrcvinfo VAR_4 = { 0 };", "VAR_4.sinfo_stream = AV_RB16(VAR_1);", "if (VAR_4.sinfo_stream > s->max_streams)\nabort();", "VAR_3 = ff_sctp_send(s->fd, VAR_1 + 2, VAR_2 - 2, &VAR_4, MSG_EOR);", "} else", "VAR_3 = send(s->fd, VAR_1, VAR_2, 0);", "return VAR_3 < 0 ? ff_neterrno() : VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ] ]
13,387
int avformat_network_init(void) { #if CONFIG_NETWORK int ret; ff_network_inited_globally = 1; if ((ret = ff_network_init()) < 0) return ret; if ((ret = ff_tls_init()) < 0) return ret; #endif return 0; }
false
FFmpeg
631c56a8e46dea41585f3e7b3ef9c52b49faa385
int avformat_network_init(void) { #if CONFIG_NETWORK int ret; ff_network_inited_globally = 1; if ((ret = ff_network_init()) < 0) return ret; if ((ret = ff_tls_init()) < 0) return ret; #endif return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(void) { #if CONFIG_NETWORK int ret; ff_network_inited_globally = 1; if ((ret = ff_network_init()) < 0) return ret; if ((ret = ff_tls_init()) < 0) return ret; #endif return 0; }
[ "int FUNC_0(void)\n{", "#if CONFIG_NETWORK\nint ret;", "ff_network_inited_globally = 1;", "if ((ret = ff_network_init()) < 0)\nreturn ret;", "if ((ret = ff_tls_init()) < 0)\nreturn ret;", "#endif\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ] ]
13,390
static inline void cvtyuvtoRGB (SwsContext *c, vector signed short Y, vector signed short U, vector signed short V, vector signed short *R, vector signed short *G, vector signed short *B) { vector signed short vx,ux,uvx; Y = vec_mradds (Y, c->CY, c->OY); U = vec_sub (U,(vector signed short)(128)); V = vec_sub (V,(vector signed short)(128)); // ux = (CBU*(u<<c->CSHIFT)+0x4000)>>15; ux = vec_sl (U, c->CSHIFT); *B = vec_mradds (ux, c->CBU, Y); // vx = (CRV*(v<<c->CSHIFT)+0x4000)>>15; vx = vec_sl (V, c->CSHIFT); *R = vec_mradds (vx, c->CRV, Y); // uvx = ((CGU*u) + (CGV*v))>>15; uvx = vec_mradds (U, c->CGU, Y); *G = vec_mradds (V, c->CGV, uvx); }
false
FFmpeg
582552fb56ba6559cb1d094a7e7ae5dde3073c5c
static inline void cvtyuvtoRGB (SwsContext *c, vector signed short Y, vector signed short U, vector signed short V, vector signed short *R, vector signed short *G, vector signed short *B) { vector signed short vx,ux,uvx; Y = vec_mradds (Y, c->CY, c->OY); U = vec_sub (U,(vector signed short)(128)); V = vec_sub (V,(vector signed short)(128)); ux = vec_sl (U, c->CSHIFT); *B = vec_mradds (ux, c->CBU, Y); vx = vec_sl (V, c->CSHIFT); *R = vec_mradds (vx, c->CRV, Y); uvx = vec_mradds (U, c->CGU, Y); *G = vec_mradds (V, c->CGV, uvx); }
{ "code": [], "line_no": [] }
static inline void FUNC_0 (SwsContext *VAR_0, vector signed short VAR_1, vector signed short VAR_2, vector signed short VAR_3, vector signed short *VAR_4, vector signed short *VAR_5, vector signed short *VAR_6) { vector signed short vx,ux,uvx; VAR_1 = vec_mradds (VAR_1, VAR_0->CY, VAR_0->OY); VAR_2 = vec_sub (VAR_2,(vector signed short)(128)); VAR_3 = vec_sub (VAR_3,(vector signed short)(128)); ux = vec_sl (VAR_2, VAR_0->CSHIFT); *VAR_6 = vec_mradds (ux, VAR_0->CBU, VAR_1); vx = vec_sl (VAR_3, VAR_0->CSHIFT); *VAR_4 = vec_mradds (vx, VAR_0->CRV, VAR_1); uvx = vec_mradds (VAR_2, VAR_0->CGU, VAR_1); *VAR_5 = vec_mradds (VAR_3, VAR_0->CGV, uvx); }
[ "static inline void FUNC_0 (SwsContext *VAR_0,\nvector signed short VAR_1, vector signed short VAR_2, vector signed short VAR_3,\nvector signed short *VAR_4, vector signed short *VAR_5, vector signed short *VAR_6)\n{", "vector signed short vx,ux,uvx;", "VAR_1 = vec_mradds (VAR_1, VAR_0->CY, VAR_0->OY);", "VAR_2 = vec_sub (VAR_2,(vector signed short)(128));", "VAR_3 = vec_sub (VAR_3,(vector signed short)(128));", "ux = vec_sl (VAR_2, VAR_0->CSHIFT);", "*VAR_6 = vec_mradds (ux, VAR_0->CBU, VAR_1);", "vx = vec_sl (VAR_3, VAR_0->CSHIFT);", "*VAR_4 = vec_mradds (vx, VAR_0->CRV, VAR_1);", "uvx = vec_mradds (VAR_2, VAR_0->CGU, VAR_1);", "*VAR_5 = vec_mradds (VAR_3, VAR_0->CGV, uvx);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ] ]
13,391
static void vaapi_encode_h264_write_sei(PutBitContext *pbc, VAAPIEncodeContext *ctx, VAAPIEncodePicture *pic) { VAAPIEncodeH264Context *priv = ctx->priv_data; PutBitContext payload_bits; char payload[256]; int payload_type, payload_size, i; void (*write_payload)(PutBitContext *pbc, VAAPIEncodeContext *ctx, VAAPIEncodePicture *pic) = NULL; vaapi_encode_h264_write_nal_header(pbc, NAL_SEI, 0); for (payload_type = 0; payload_type < 64; payload_type++) { switch (payload_type) { case SEI_TYPE_BUFFERING_PERIOD: if (!priv->send_timing_sei || pic->type != PICTURE_TYPE_IDR) continue; write_payload = &vaapi_encode_h264_write_buffering_period; break; case SEI_TYPE_PIC_TIMING: if (!priv->send_timing_sei) continue; write_payload = &vaapi_encode_h264_write_pic_timing; break; case SEI_TYPE_USER_DATA_UNREGISTERED: if (pic->encode_order != 0) continue; write_payload = &vaapi_encode_h264_write_identifier; break; default: continue; } init_put_bits(&payload_bits, payload, sizeof(payload)); write_payload(&payload_bits, ctx, pic); if (put_bits_count(&payload_bits) & 7) { write_u(&payload_bits, 1, 1, bit_equal_to_one); while (put_bits_count(&payload_bits) & 7) write_u(&payload_bits, 1, 0, bit_equal_to_zero); } payload_size = put_bits_count(&payload_bits) / 8; flush_put_bits(&payload_bits); u(8, payload_type, last_payload_type_byte); u(8, payload_size, last_payload_size_byte); for (i = 0; i < payload_size; i++) u(8, payload[i] & 0xff, sei_payload); } vaapi_encode_h264_write_trailing_rbsp(pbc); }
false
FFmpeg
5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c
static void vaapi_encode_h264_write_sei(PutBitContext *pbc, VAAPIEncodeContext *ctx, VAAPIEncodePicture *pic) { VAAPIEncodeH264Context *priv = ctx->priv_data; PutBitContext payload_bits; char payload[256]; int payload_type, payload_size, i; void (*write_payload)(PutBitContext *pbc, VAAPIEncodeContext *ctx, VAAPIEncodePicture *pic) = NULL; vaapi_encode_h264_write_nal_header(pbc, NAL_SEI, 0); for (payload_type = 0; payload_type < 64; payload_type++) { switch (payload_type) { case SEI_TYPE_BUFFERING_PERIOD: if (!priv->send_timing_sei || pic->type != PICTURE_TYPE_IDR) continue; write_payload = &vaapi_encode_h264_write_buffering_period; break; case SEI_TYPE_PIC_TIMING: if (!priv->send_timing_sei) continue; write_payload = &vaapi_encode_h264_write_pic_timing; break; case SEI_TYPE_USER_DATA_UNREGISTERED: if (pic->encode_order != 0) continue; write_payload = &vaapi_encode_h264_write_identifier; break; default: continue; } init_put_bits(&payload_bits, payload, sizeof(payload)); write_payload(&payload_bits, ctx, pic); if (put_bits_count(&payload_bits) & 7) { write_u(&payload_bits, 1, 1, bit_equal_to_one); while (put_bits_count(&payload_bits) & 7) write_u(&payload_bits, 1, 0, bit_equal_to_zero); } payload_size = put_bits_count(&payload_bits) / 8; flush_put_bits(&payload_bits); u(8, payload_type, last_payload_type_byte); u(8, payload_size, last_payload_size_byte); for (i = 0; i < payload_size; i++) u(8, payload[i] & 0xff, sei_payload); } vaapi_encode_h264_write_trailing_rbsp(pbc); }
{ "code": [], "line_no": [] }
static void FUNC_0(PutBitContext *VAR_8, VAAPIEncodeContext *VAR_8, VAAPIEncodePicture *VAR_8) { VAAPIEncodeH264Context *priv = VAR_8->priv_data; PutBitContext payload_bits; char VAR_3[256]; int VAR_4, VAR_5, VAR_6; void (*VAR_7)(PutBitContext *VAR_8, VAAPIEncodeContext *VAR_8, VAAPIEncodePicture *VAR_8) = NULL; vaapi_encode_h264_write_nal_header(VAR_8, NAL_SEI, 0); for (VAR_4 = 0; VAR_4 < 64; VAR_4++) { switch (VAR_4) { case SEI_TYPE_BUFFERING_PERIOD: if (!priv->send_timing_sei || VAR_8->type != PICTURE_TYPE_IDR) continue; VAR_7 = &vaapi_encode_h264_write_buffering_period; break; case SEI_TYPE_PIC_TIMING: if (!priv->send_timing_sei) continue; VAR_7 = &vaapi_encode_h264_write_pic_timing; break; case SEI_TYPE_USER_DATA_UNREGISTERED: if (VAR_8->encode_order != 0) continue; VAR_7 = &vaapi_encode_h264_write_identifier; break; default: continue; } init_put_bits(&payload_bits, VAR_3, sizeof(VAR_3)); VAR_7(&payload_bits, VAR_8, VAR_8); if (put_bits_count(&payload_bits) & 7) { write_u(&payload_bits, 1, 1, bit_equal_to_one); while (put_bits_count(&payload_bits) & 7) write_u(&payload_bits, 1, 0, bit_equal_to_zero); } VAR_5 = put_bits_count(&payload_bits) / 8; flush_put_bits(&payload_bits); u(8, VAR_4, last_payload_type_byte); u(8, VAR_5, last_payload_size_byte); for (VAR_6 = 0; VAR_6 < VAR_5; VAR_6++) u(8, VAR_3[VAR_6] & 0xff, sei_payload); } vaapi_encode_h264_write_trailing_rbsp(VAR_8); }
[ "static void FUNC_0(PutBitContext *VAR_8,\nVAAPIEncodeContext *VAR_8,\nVAAPIEncodePicture *VAR_8)\n{", "VAAPIEncodeH264Context *priv = VAR_8->priv_data;", "PutBitContext payload_bits;", "char VAR_3[256];", "int VAR_4, VAR_5, VAR_6;", "void (*VAR_7)(PutBitContext *VAR_8,\nVAAPIEncodeContext *VAR_8,\nVAAPIEncodePicture *VAR_8) = NULL;", "vaapi_encode_h264_write_nal_header(VAR_8, NAL_SEI, 0);", "for (VAR_4 = 0; VAR_4 < 64; VAR_4++) {", "switch (VAR_4) {", "case SEI_TYPE_BUFFERING_PERIOD:\nif (!priv->send_timing_sei ||\nVAR_8->type != PICTURE_TYPE_IDR)\ncontinue;", "VAR_7 = &vaapi_encode_h264_write_buffering_period;", "break;", "case SEI_TYPE_PIC_TIMING:\nif (!priv->send_timing_sei)\ncontinue;", "VAR_7 = &vaapi_encode_h264_write_pic_timing;", "break;", "case SEI_TYPE_USER_DATA_UNREGISTERED:\nif (VAR_8->encode_order != 0)\ncontinue;", "VAR_7 = &vaapi_encode_h264_write_identifier;", "break;", "default:\ncontinue;", "}", "init_put_bits(&payload_bits, VAR_3, sizeof(VAR_3));", "VAR_7(&payload_bits, VAR_8, VAR_8);", "if (put_bits_count(&payload_bits) & 7) {", "write_u(&payload_bits, 1, 1, bit_equal_to_one);", "while (put_bits_count(&payload_bits) & 7)\nwrite_u(&payload_bits, 1, 0, bit_equal_to_zero);", "}", "VAR_5 = put_bits_count(&payload_bits) / 8;", "flush_put_bits(&payload_bits);", "u(8, VAR_4, last_payload_type_byte);", "u(8, VAR_5, last_payload_size_byte);", "for (VAR_6 = 0; VAR_6 < VAR_5; VAR_6++)", "u(8, VAR_3[VAR_6] & 0xff, sei_payload);", "}", "vaapi_encode_h264_write_trailing_rbsp(VAR_8);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19, 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33, 35, 37, 39 ], [ 41 ], [ 43 ], [ 45, 47, 49 ], [ 51 ], [ 53 ], [ 55, 57, 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ] ]
13,392
Visitor *visitor_input_test_init(TestInputVisitorData *data, const char *json_string, ...) { Visitor *v; va_list ap; va_start(ap, json_string); data->obj = qobject_from_jsonv(json_string, &ap); va_end(ap); g_assert(data->obj != NULL); data->qiv = qmp_input_visitor_new(data->obj); g_assert(data->qiv != NULL); v = qmp_input_get_visitor(data->qiv); g_assert(v != NULL); return v; }
true
qemu
0920a17199d23b3def3a60fa1fbbdeadcdda452d
Visitor *visitor_input_test_init(TestInputVisitorData *data, const char *json_string, ...) { Visitor *v; va_list ap; va_start(ap, json_string); data->obj = qobject_from_jsonv(json_string, &ap); va_end(ap); g_assert(data->obj != NULL); data->qiv = qmp_input_visitor_new(data->obj); g_assert(data->qiv != NULL); v = qmp_input_get_visitor(data->qiv); g_assert(v != NULL); return v; }
{ "code": [ " data->obj = qobject_from_jsonv(json_string, &ap);", " g_assert(data->obj != NULL);", " g_assert(data->qiv != NULL);", " v = qmp_input_get_visitor(data->qiv);", " g_assert(v != NULL);", " Visitor *v;", " g_assert(data->obj != NULL);", " g_assert(data->qiv != NULL);", " v = qmp_input_get_visitor(data->qiv);", " g_assert(v != NULL);", " return v;", " data->obj = qobject_from_jsonv(json_string, &ap);", " g_assert(data->obj != NULL);", " data->qiv = qmp_input_visitor_new(data->obj);", " g_assert(data->qiv != NULL);", " v = qmp_input_get_visitor(data->qiv);", " g_assert(v != NULL);", " Visitor *v;", " g_assert(data->obj != NULL);", " data->qiv = qmp_input_visitor_new(data->obj);", " g_assert(data->qiv != NULL);", " v = qmp_input_get_visitor(data->qiv);", " g_assert(v != NULL);", " return v;" ], "line_no": [ 15, 21, 27, 31, 33, 7, 21, 27, 31, 33, 37, 15, 21, 25, 27, 31, 33, 7, 21, 25, 27, 31, 33, 37 ] }
Visitor *FUNC_0(TestInputVisitorData *data, const char *json_string, ...) { Visitor *v; va_list ap; va_start(ap, json_string); data->obj = qobject_from_jsonv(json_string, &ap); va_end(ap); g_assert(data->obj != NULL); data->qiv = qmp_input_visitor_new(data->obj); g_assert(data->qiv != NULL); v = qmp_input_get_visitor(data->qiv); g_assert(v != NULL); return v; }
[ "Visitor *FUNC_0(TestInputVisitorData *data,\nconst char *json_string, ...)\n{", "Visitor *v;", "va_list ap;", "va_start(ap, json_string);", "data->obj = qobject_from_jsonv(json_string, &ap);", "va_end(ap);", "g_assert(data->obj != NULL);", "data->qiv = qmp_input_visitor_new(data->obj);", "g_assert(data->qiv != NULL);", "v = qmp_input_get_visitor(data->qiv);", "g_assert(v != NULL);", "return v;", "}" ]
[ 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ] ]
13,393
static void dump_syscall(CPUState *env) { fprintf(logfile, "syscall r0=0x%08x r3=0x%08x r4=0x%08x " "r5=0x%08x r6=0x%08x nip=0x%08x\n", env->gpr[0], env->gpr[3], env->gpr[4], env->gpr[5], env->gpr[6], env->nip); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
static void dump_syscall(CPUState *env) { fprintf(logfile, "syscall r0=0x%08x r3=0x%08x r4=0x%08x " "r5=0x%08x r6=0x%08x nip=0x%08x\n", env->gpr[0], env->gpr[3], env->gpr[4], env->gpr[5], env->gpr[6], env->nip); }
{ "code": [ " fprintf(logfile, \"syscall r0=0x%08x r3=0x%08x r4=0x%08x \"", " \"r5=0x%08x r6=0x%08x nip=0x%08x\\n\"," ], "line_no": [ 5, 7 ] }
static void FUNC_0(CPUState *VAR_0) { fprintf(logfile, "syscall r0=0x%08x r3=0x%08x r4=0x%08x " "r5=0x%08x r6=0x%08x nip=0x%08x\n", VAR_0->gpr[0], VAR_0->gpr[3], VAR_0->gpr[4], VAR_0->gpr[5], VAR_0->gpr[6], VAR_0->nip); }
[ "static void FUNC_0(CPUState *VAR_0)\n{", "fprintf(logfile, \"syscall r0=0x%08x r3=0x%08x r4=0x%08x \"\n\"r5=0x%08x r6=0x%08x nip=0x%08x\\n\",\nVAR_0->gpr[0], VAR_0->gpr[3], VAR_0->gpr[4],\nVAR_0->gpr[5], VAR_0->gpr[6], VAR_0->nip);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5, 7, 9, 11 ], [ 13 ] ]
13,394
static int vnc_auth_sasl_check_ssf(VncState *vs) { const void *val; int err, ssf; if (!vs->sasl.wantSSF) return 1; err = sasl_getprop(vs->sasl.conn, SASL_SSF, &val); if (err != SASL_OK) return 0; ssf = *(const int *)val; VNC_DEBUG("negotiated an SSF of %d\n", ssf); if (ssf < 56) return 0; /* 56 is good for Kerberos */ /* Only setup for read initially, because we're about to send an RPC * reply which must be in plain text. When the next incoming RPC * arrives, we'll switch on writes too * * cf qemudClientReadSASL in qemud.c */ vs->sasl.runSSF = 1; /* We have a SSF that's good enough */ return 1; }
true
qemu
7364dbdabb7824d5bde1e341bb6d928282f01c83
static int vnc_auth_sasl_check_ssf(VncState *vs) { const void *val; int err, ssf; if (!vs->sasl.wantSSF) return 1; err = sasl_getprop(vs->sasl.conn, SASL_SSF, &val); if (err != SASL_OK) return 0; ssf = *(const int *)val; VNC_DEBUG("negotiated an SSF of %d\n", ssf); if (ssf < 56) return 0; vs->sasl.runSSF = 1; return 1; }
{ "code": [ " VNC_DEBUG(\"negotiated an SSF of %d\\n\", ssf);" ], "line_no": [ 27 ] }
static int FUNC_0(VncState *VAR_0) { const void *VAR_1; int VAR_2, VAR_3; if (!VAR_0->sasl.wantSSF) return 1; VAR_2 = sasl_getprop(VAR_0->sasl.conn, SASL_SSF, &VAR_1); if (VAR_2 != SASL_OK) return 0; VAR_3 = *(const int *)VAR_1; VNC_DEBUG("negotiated an SSF of %d\n", VAR_3); if (VAR_3 < 56) return 0; VAR_0->sasl.runSSF = 1; return 1; }
[ "static int FUNC_0(VncState *VAR_0)\n{", "const void *VAR_1;", "int VAR_2, VAR_3;", "if (!VAR_0->sasl.wantSSF)\nreturn 1;", "VAR_2 = sasl_getprop(VAR_0->sasl.conn, SASL_SSF, &VAR_1);", "if (VAR_2 != SASL_OK)\nreturn 0;", "VAR_3 = *(const int *)VAR_1;", "VNC_DEBUG(\"negotiated an SSF of %d\\n\", VAR_3);", "if (VAR_3 < 56)\nreturn 0;", "VAR_0->sasl.runSSF = 1;", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 47 ], [ 53 ], [ 55 ] ]
13,395
static int parse_metadata(DBEContext *s) { int i, ret, key = parse_key(s), mtd_size; if ((ret = convert_input(s, 1, key)) < 0) return ret; skip_bits(&s->gb, 4); mtd_size = get_bits(&s->gb, 10); if (!mtd_size) { av_log(s->avctx, AV_LOG_ERROR, "Invalid metadata size\n"); return AVERROR_INVALIDDATA; } if ((ret = convert_input(s, mtd_size, key)) < 0) return ret; skip_bits(&s->gb, 14); s->prog_conf = get_bits(&s->gb, 6); if (s->prog_conf > MAX_PROG_CONF) { av_log(s->avctx, AV_LOG_ERROR, "Invalid program configuration\n"); return AVERROR_INVALIDDATA; } s->nb_channels = nb_channels_tab[s->prog_conf]; s->nb_programs = nb_programs_tab[s->prog_conf]; s->fr_code = get_bits(&s->gb, 4); s->fr_code_orig = get_bits(&s->gb, 4); if (!sample_rate_tab[s->fr_code] || !sample_rate_tab[s->fr_code_orig]) { av_log(s->avctx, AV_LOG_ERROR, "Invalid frame rate code\n"); return AVERROR_INVALIDDATA; } skip_bits_long(&s->gb, 88); for (i = 0; i < s->nb_channels; i++) s->ch_size[i] = get_bits(&s->gb, 10); s->mtd_ext_size = get_bits(&s->gb, 8); s->meter_size = get_bits(&s->gb, 8); skip_bits_long(&s->gb, 10 * s->nb_programs); for (i = 0; i < s->nb_channels; i++) { s->rev_id[i] = get_bits(&s->gb, 4); skip_bits1(&s->gb); s->begin_gain[i] = get_bits(&s->gb, 10); s->end_gain[i] = get_bits(&s->gb, 10); } if (get_bits_left(&s->gb) < 0) { av_log(s->avctx, AV_LOG_ERROR, "Read past end of metadata\n"); return AVERROR_INVALIDDATA; } skip_input(s, mtd_size + 1); return 0; }
true
FFmpeg
5e715b583dab85735660b15a8d217a69164675fe
static int parse_metadata(DBEContext *s) { int i, ret, key = parse_key(s), mtd_size; if ((ret = convert_input(s, 1, key)) < 0) return ret; skip_bits(&s->gb, 4); mtd_size = get_bits(&s->gb, 10); if (!mtd_size) { av_log(s->avctx, AV_LOG_ERROR, "Invalid metadata size\n"); return AVERROR_INVALIDDATA; } if ((ret = convert_input(s, mtd_size, key)) < 0) return ret; skip_bits(&s->gb, 14); s->prog_conf = get_bits(&s->gb, 6); if (s->prog_conf > MAX_PROG_CONF) { av_log(s->avctx, AV_LOG_ERROR, "Invalid program configuration\n"); return AVERROR_INVALIDDATA; } s->nb_channels = nb_channels_tab[s->prog_conf]; s->nb_programs = nb_programs_tab[s->prog_conf]; s->fr_code = get_bits(&s->gb, 4); s->fr_code_orig = get_bits(&s->gb, 4); if (!sample_rate_tab[s->fr_code] || !sample_rate_tab[s->fr_code_orig]) { av_log(s->avctx, AV_LOG_ERROR, "Invalid frame rate code\n"); return AVERROR_INVALIDDATA; } skip_bits_long(&s->gb, 88); for (i = 0; i < s->nb_channels; i++) s->ch_size[i] = get_bits(&s->gb, 10); s->mtd_ext_size = get_bits(&s->gb, 8); s->meter_size = get_bits(&s->gb, 8); skip_bits_long(&s->gb, 10 * s->nb_programs); for (i = 0; i < s->nb_channels; i++) { s->rev_id[i] = get_bits(&s->gb, 4); skip_bits1(&s->gb); s->begin_gain[i] = get_bits(&s->gb, 10); s->end_gain[i] = get_bits(&s->gb, 10); } if (get_bits_left(&s->gb) < 0) { av_log(s->avctx, AV_LOG_ERROR, "Read past end of metadata\n"); return AVERROR_INVALIDDATA; } skip_input(s, mtd_size + 1); return 0; }
{ "code": [ " int i, ret, key = parse_key(s), mtd_size;", " skip_input(s, mtd_size + 1);", " return 0;", " return 0;" ], "line_no": [ 5, 109, 111, 111 ] }
static int FUNC_0(DBEContext *VAR_0) { int VAR_1, VAR_2, VAR_3 = parse_key(VAR_0), VAR_4; if ((VAR_2 = convert_input(VAR_0, 1, VAR_3)) < 0) return VAR_2; skip_bits(&VAR_0->gb, 4); VAR_4 = get_bits(&VAR_0->gb, 10); if (!VAR_4) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid metadata size\n"); return AVERROR_INVALIDDATA; } if ((VAR_2 = convert_input(VAR_0, VAR_4, VAR_3)) < 0) return VAR_2; skip_bits(&VAR_0->gb, 14); VAR_0->prog_conf = get_bits(&VAR_0->gb, 6); if (VAR_0->prog_conf > MAX_PROG_CONF) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid program configuration\n"); return AVERROR_INVALIDDATA; } VAR_0->nb_channels = nb_channels_tab[VAR_0->prog_conf]; VAR_0->nb_programs = nb_programs_tab[VAR_0->prog_conf]; VAR_0->fr_code = get_bits(&VAR_0->gb, 4); VAR_0->fr_code_orig = get_bits(&VAR_0->gb, 4); if (!sample_rate_tab[VAR_0->fr_code] || !sample_rate_tab[VAR_0->fr_code_orig]) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid frame rate code\n"); return AVERROR_INVALIDDATA; } skip_bits_long(&VAR_0->gb, 88); for (VAR_1 = 0; VAR_1 < VAR_0->nb_channels; VAR_1++) VAR_0->ch_size[VAR_1] = get_bits(&VAR_0->gb, 10); VAR_0->mtd_ext_size = get_bits(&VAR_0->gb, 8); VAR_0->meter_size = get_bits(&VAR_0->gb, 8); skip_bits_long(&VAR_0->gb, 10 * VAR_0->nb_programs); for (VAR_1 = 0; VAR_1 < VAR_0->nb_channels; VAR_1++) { VAR_0->rev_id[VAR_1] = get_bits(&VAR_0->gb, 4); skip_bits1(&VAR_0->gb); VAR_0->begin_gain[VAR_1] = get_bits(&VAR_0->gb, 10); VAR_0->end_gain[VAR_1] = get_bits(&VAR_0->gb, 10); } if (get_bits_left(&VAR_0->gb) < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Read past end of metadata\n"); return AVERROR_INVALIDDATA; } skip_input(VAR_0, VAR_4 + 1); return 0; }
[ "static int FUNC_0(DBEContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3 = parse_key(VAR_0), VAR_4;", "if ((VAR_2 = convert_input(VAR_0, 1, VAR_3)) < 0)\nreturn VAR_2;", "skip_bits(&VAR_0->gb, 4);", "VAR_4 = get_bits(&VAR_0->gb, 10);", "if (!VAR_4) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid metadata size\\n\");", "return AVERROR_INVALIDDATA;", "}", "if ((VAR_2 = convert_input(VAR_0, VAR_4, VAR_3)) < 0)\nreturn VAR_2;", "skip_bits(&VAR_0->gb, 14);", "VAR_0->prog_conf = get_bits(&VAR_0->gb, 6);", "if (VAR_0->prog_conf > MAX_PROG_CONF) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid program configuration\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_0->nb_channels = nb_channels_tab[VAR_0->prog_conf];", "VAR_0->nb_programs = nb_programs_tab[VAR_0->prog_conf];", "VAR_0->fr_code = get_bits(&VAR_0->gb, 4);", "VAR_0->fr_code_orig = get_bits(&VAR_0->gb, 4);", "if (!sample_rate_tab[VAR_0->fr_code] ||\n!sample_rate_tab[VAR_0->fr_code_orig]) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid frame rate code\\n\");", "return AVERROR_INVALIDDATA;", "}", "skip_bits_long(&VAR_0->gb, 88);", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_channels; VAR_1++)", "VAR_0->ch_size[VAR_1] = get_bits(&VAR_0->gb, 10);", "VAR_0->mtd_ext_size = get_bits(&VAR_0->gb, 8);", "VAR_0->meter_size = get_bits(&VAR_0->gb, 8);", "skip_bits_long(&VAR_0->gb, 10 * VAR_0->nb_programs);", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_channels; VAR_1++) {", "VAR_0->rev_id[VAR_1] = get_bits(&VAR_0->gb, 4);", "skip_bits1(&VAR_0->gb);", "VAR_0->begin_gain[VAR_1] = get_bits(&VAR_0->gb, 10);", "VAR_0->end_gain[VAR_1] = get_bits(&VAR_0->gb, 10);", "}", "if (get_bits_left(&VAR_0->gb) < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Read past end of metadata\\n\");", "return AVERROR_INVALIDDATA;", "}", "skip_input(VAR_0, VAR_4 + 1);", "return 0;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ] ]
13,397
static void vp8_release_frame(VP8Context *s, AVFrame *f, int is_close) { if (!is_close) { if (f->ref_index[0]) { assert(s->num_maps_to_be_freed < FF_ARRAY_ELEMS(s->segmentation_maps)); s->segmentation_maps[s->num_maps_to_be_freed++] = f->ref_index[0]; f->ref_index[0] = NULL; } } else { av_freep(&f->ref_index[0]); } ff_thread_release_buffer(s->avctx, f); }
true
FFmpeg
bfa0f96586fe2c257cfa574ffb991da493a54da1
static void vp8_release_frame(VP8Context *s, AVFrame *f, int is_close) { if (!is_close) { if (f->ref_index[0]) { assert(s->num_maps_to_be_freed < FF_ARRAY_ELEMS(s->segmentation_maps)); s->segmentation_maps[s->num_maps_to_be_freed++] = f->ref_index[0]; f->ref_index[0] = NULL; } } else { av_freep(&f->ref_index[0]); } ff_thread_release_buffer(s->avctx, f); }
{ "code": [ "static void vp8_release_frame(VP8Context *s, AVFrame *f, int is_close)", " if (!is_close) {", " if (f->ref_index[0]) {", " assert(s->num_maps_to_be_freed < FF_ARRAY_ELEMS(s->segmentation_maps));", " s->segmentation_maps[s->num_maps_to_be_freed++] = f->ref_index[0];", " } else {", " av_freep(&f->ref_index[0]);" ], "line_no": [ 1, 5, 7, 9, 11, 17, 19 ] }
static void FUNC_0(VP8Context *VAR_0, AVFrame *VAR_1, int VAR_2) { if (!VAR_2) { if (VAR_1->ref_index[0]) { assert(VAR_0->num_maps_to_be_freed < FF_ARRAY_ELEMS(VAR_0->segmentation_maps)); VAR_0->segmentation_maps[VAR_0->num_maps_to_be_freed++] = VAR_1->ref_index[0]; VAR_1->ref_index[0] = NULL; } } else { av_freep(&VAR_1->ref_index[0]); } ff_thread_release_buffer(VAR_0->avctx, VAR_1); }
[ "static void FUNC_0(VP8Context *VAR_0, AVFrame *VAR_1, int VAR_2)\n{", "if (!VAR_2) {", "if (VAR_1->ref_index[0]) {", "assert(VAR_0->num_maps_to_be_freed < FF_ARRAY_ELEMS(VAR_0->segmentation_maps));", "VAR_0->segmentation_maps[VAR_0->num_maps_to_be_freed++] = VAR_1->ref_index[0];", "VAR_1->ref_index[0] = NULL;", "}", "} else {", "av_freep(&VAR_1->ref_index[0]);", "}", "ff_thread_release_buffer(VAR_0->avctx, VAR_1);", "}" ]
[ 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
13,398
int qemu_socket(int domain, int type, int protocol) { int ret; #ifdef SOCK_CLOEXEC ret = socket(domain, type | SOCK_CLOEXEC, protocol); #else ret = socket(domain, type, protocol); if (ret >= 0) { qemu_set_cloexec(ret); } #endif return ret; }
true
qemu
3a03bfa5a219fe06779706315f2555622b51193c
int qemu_socket(int domain, int type, int protocol) { int ret; #ifdef SOCK_CLOEXEC ret = socket(domain, type | SOCK_CLOEXEC, protocol); #else ret = socket(domain, type, protocol); if (ret >= 0) { qemu_set_cloexec(ret); } #endif return ret; }
{ "code": [ "#else", "#endif", "#else", "#endif", "#else", "#endif" ], "line_no": [ 13, 23, 13, 23, 13, 23 ] }
int FUNC_0(int VAR_0, int VAR_1, int VAR_2) { int VAR_3; #ifdef SOCK_CLOEXEC VAR_3 = socket(VAR_0, VAR_1 | SOCK_CLOEXEC, VAR_2); #else VAR_3 = socket(VAR_0, VAR_1, VAR_2); if (VAR_3 >= 0) { qemu_set_cloexec(VAR_3); } #endif return VAR_3; }
[ "int FUNC_0(int VAR_0, int VAR_1, int VAR_2)\n{", "int VAR_3;", "#ifdef SOCK_CLOEXEC\nVAR_3 = socket(VAR_0, VAR_1 | SOCK_CLOEXEC, VAR_2);", "#else\nVAR_3 = socket(VAR_0, VAR_1, VAR_2);", "if (VAR_3 >= 0) {", "qemu_set_cloexec(VAR_3);", "}", "#endif\nreturn VAR_3;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 27 ], [ 29 ] ]
13,399
static int smacker_probe(AVProbeData *p) { if(p->buf[0] == 'S' && p->buf[1] == 'M' && p->buf[2] == 'K' && (p->buf[3] == '2' || p->buf[3] == '4')) return AVPROBE_SCORE_MAX; else return 0; }
true
FFmpeg
0062869ae25007c8506517dcfcbe6f439dc6958a
static int smacker_probe(AVProbeData *p) { if(p->buf[0] == 'S' && p->buf[1] == 'M' && p->buf[2] == 'K' && (p->buf[3] == '2' || p->buf[3] == '4')) return AVPROBE_SCORE_MAX; else return 0; }
{ "code": [ " if(p->buf[0] == 'S' && p->buf[1] == 'M' && p->buf[2] == 'K'", " && (p->buf[3] == '2' || p->buf[3] == '4'))", " return AVPROBE_SCORE_MAX;" ], "line_no": [ 5, 7, 9 ] }
static int FUNC_0(AVProbeData *VAR_0) { if(VAR_0->buf[0] == 'S' && VAR_0->buf[1] == 'M' && VAR_0->buf[2] == 'K' && (VAR_0->buf[3] == '2' || VAR_0->buf[3] == '4')) return AVPROBE_SCORE_MAX; else return 0; }
[ "static int FUNC_0(AVProbeData *VAR_0)\n{", "if(VAR_0->buf[0] == 'S' && VAR_0->buf[1] == 'M' && VAR_0->buf[2] == 'K'\n&& (VAR_0->buf[3] == '2' || VAR_0->buf[3] == '4'))\nreturn AVPROBE_SCORE_MAX;", "else\nreturn 0;", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9 ], [ 11, 13 ], [ 15 ] ]
13,400
static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl) { const int mb_x = h->mb_x; const int mb_y = h->mb_y; const int mb_xy = h->mb_xy; const int mb_type = h->cur_pic.mb_type[mb_xy]; uint8_t *dest_y, *dest_cb, *dest_cr; int linesize, uvlinesize /*dct_offset*/; int i, j; int *block_offset = &h->block_offset[0]; const int transform_bypass = !SIMPLE && (sl->qscale == 0 && h->sps.transform_bypass); /* is_h264 should always be true if SVQ3 is disabled. */ const int is_h264 = !CONFIG_SVQ3_DECODER || SIMPLE || h->avctx->codec_id == AV_CODEC_ID_H264; void (*idct_add)(uint8_t *dst, int16_t *block, int stride); const int block_h = 16 >> h->chroma_y_shift; const int chroma422 = CHROMA422(h); dest_y = h->cur_pic.f.data[0] + ((mb_x << PIXEL_SHIFT) + mb_y * h->linesize) * 16; dest_cb = h->cur_pic.f.data[1] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * h->uvlinesize * block_h; dest_cr = h->cur_pic.f.data[2] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * h->uvlinesize * block_h; h->vdsp.prefetch(dest_y + (h->mb_x & 3) * 4 * h->linesize + (64 << PIXEL_SHIFT), h->linesize, 4); h->vdsp.prefetch(dest_cb + (h->mb_x & 7) * h->uvlinesize + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2); h->list_counts[mb_xy] = sl->list_count; if (!SIMPLE && MB_FIELD(h)) { linesize = sl->mb_linesize = h->linesize * 2; uvlinesize = sl->mb_uvlinesize = h->uvlinesize * 2; block_offset = &h->block_offset[48]; if (mb_y & 1) { // FIXME move out of this function? dest_y -= h->linesize * 15; dest_cb -= h->uvlinesize * (block_h - 1); dest_cr -= h->uvlinesize * (block_h - 1); } if (FRAME_MBAFF(h)) { int list; for (list = 0; list < sl->list_count; list++) { if (!USES_LIST(mb_type, list)) continue; if (IS_16X16(mb_type)) { int8_t *ref = &sl->ref_cache[list][scan8[0]]; fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (h->mb_y & 1), 1); } else { for (i = 0; i < 16; i += 4) { int ref = sl->ref_cache[list][scan8[i]]; if (ref >= 0) fill_rectangle(&sl->ref_cache[list][scan8[i]], 2, 2, 8, (16 + ref) ^ (h->mb_y & 1), 1); } } } } } else { linesize = sl->mb_linesize = h->linesize; uvlinesize = sl->mb_uvlinesize = h->uvlinesize; // dct_offset = s->linesize * 16; } if (!SIMPLE && IS_INTRA_PCM(mb_type)) { if (PIXEL_SHIFT) { const int bit_depth = h->sps.bit_depth_luma; int j; GetBitContext gb; init_get_bits(&gb, sl->intra_pcm_ptr, ff_h264_mb_sizes[h->sps.chroma_format_idc] * bit_depth); for (i = 0; i < 16; i++) { uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize); for (j = 0; j < 16; j++) tmp_y[j] = get_bits(&gb, bit_depth); } if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) { if (!h->sps.chroma_format_idc) { for (i = 0; i < block_h; i++) { uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize); for (j = 0; j < 8; j++) tmp_cb[j] = 1 << (bit_depth - 1); } for (i = 0; i < block_h; i++) { uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize); for (j = 0; j < 8; j++) tmp_cr[j] = 1 << (bit_depth - 1); } } else { for (i = 0; i < block_h; i++) { uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize); for (j = 0; j < 8; j++) tmp_cb[j] = get_bits(&gb, bit_depth); } for (i = 0; i < block_h; i++) { uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize); for (j = 0; j < 8; j++) tmp_cr[j] = get_bits(&gb, bit_depth); } } } } else { for (i = 0; i < 16; i++) memcpy(dest_y + i * linesize, sl->intra_pcm_ptr + i * 16, 16); if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) { if (!h->sps.chroma_format_idc) { for (i = 0; i < block_h; i++) { memset(dest_cb + i * uvlinesize, 128, 8); memset(dest_cr + i * uvlinesize, 128, 8); } } else { const uint8_t *src_cb = sl->intra_pcm_ptr + 256; const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + block_h * 8; for (i = 0; i < block_h; i++) { memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8); memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8); } } } } } else { if (IS_INTRA(mb_type)) { if (h->deblocking_filter) xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1, 0, SIMPLE, PIXEL_SHIFT); if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) { h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, uvlinesize); h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, uvlinesize); } hl_decode_mb_predict_luma(h, sl, mb_type, is_h264, SIMPLE, transform_bypass, PIXEL_SHIFT, block_offset, linesize, dest_y, 0); if (h->deblocking_filter) xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0, 0, SIMPLE, PIXEL_SHIFT); } else if (is_h264) { if (chroma422) { FUNC(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr, h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab, h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab, h->h264dsp.weight_h264_pixels_tab, h->h264dsp.biweight_h264_pixels_tab); } else { FUNC(hl_motion_420)(h, sl, dest_y, dest_cb, dest_cr, h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab, h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab, h->h264dsp.weight_h264_pixels_tab, h->h264dsp.biweight_h264_pixels_tab); } } hl_decode_mb_idct_luma(h, sl, mb_type, is_h264, SIMPLE, transform_bypass, PIXEL_SHIFT, block_offset, linesize, dest_y, 0); if ((SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) && (sl->cbp & 0x30)) { uint8_t *dest[2] = { dest_cb, dest_cr }; if (transform_bypass) { if (IS_INTRA(mb_type) && h->sps.profile_idc == 244 && (sl->chroma_pred_mode == VERT_PRED8x8 || sl->chroma_pred_mode == HOR_PRED8x8)) { h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0], block_offset + 16, sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), uvlinesize); h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1], block_offset + 32, sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), uvlinesize); } else { idct_add = h->h264dsp.h264_add_pixels4_clear; for (j = 1; j < 3; j++) { for (i = j * 16; i < j * 16 + 4; i++) if (sl->non_zero_count_cache[scan8[i]] || dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) idct_add(dest[j - 1] + block_offset[i], sl->mb + (i * 16 << PIXEL_SHIFT), uvlinesize); if (chroma422) { for (i = j * 16 + 4; i < j * 16 + 8; i++) if (sl->non_zero_count_cache[scan8[i + 4]] || dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) idct_add(dest[j - 1] + block_offset[i + 4], sl->mb + (i * 16 << PIXEL_SHIFT), uvlinesize); } } } } else { if (is_h264) { int qp[2]; if (chroma422) { qp[0] = sl->chroma_qp[0] + 3; qp[1] = sl->chroma_qp[1] + 3; } else { qp[0] = sl->chroma_qp[0]; qp[1] = sl->chroma_qp[1]; } if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]]) h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), h->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]); if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]]) h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), h->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]); h->h264dsp.h264_idct_add8(dest, block_offset, sl->mb, uvlinesize, sl->non_zero_count_cache); } else if (CONFIG_SVQ3_DECODER) { h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + 16 * 16 * 1, h->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][sl->chroma_qp[0]][0]); h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + 16 * 16 * 2, h->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][sl->chroma_qp[1]][0]); for (j = 1; j < 3; j++) { for (i = j * 16; i < j * 16 + 4; i++) if (sl->non_zero_count_cache[scan8[i]] || sl->mb[i * 16]) { uint8_t *const ptr = dest[j - 1] + block_offset[i]; ff_svq3_add_idct_c(ptr, sl->mb + i * 16, uvlinesize, ff_h264_chroma_qp[0][sl->qscale + 12] - 12, 2); } } } } } } }
false
FFmpeg
e6c90ce94f1b07f50cea2babf7471af455cca0ff
static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl) { const int mb_x = h->mb_x; const int mb_y = h->mb_y; const int mb_xy = h->mb_xy; const int mb_type = h->cur_pic.mb_type[mb_xy]; uint8_t *dest_y, *dest_cb, *dest_cr; int linesize, uvlinesize ; int i, j; int *block_offset = &h->block_offset[0]; const int transform_bypass = !SIMPLE && (sl->qscale == 0 && h->sps.transform_bypass); const int is_h264 = !CONFIG_SVQ3_DECODER || SIMPLE || h->avctx->codec_id == AV_CODEC_ID_H264; void (*idct_add)(uint8_t *dst, int16_t *block, int stride); const int block_h = 16 >> h->chroma_y_shift; const int chroma422 = CHROMA422(h); dest_y = h->cur_pic.f.data[0] + ((mb_x << PIXEL_SHIFT) + mb_y * h->linesize) * 16; dest_cb = h->cur_pic.f.data[1] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * h->uvlinesize * block_h; dest_cr = h->cur_pic.f.data[2] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * h->uvlinesize * block_h; h->vdsp.prefetch(dest_y + (h->mb_x & 3) * 4 * h->linesize + (64 << PIXEL_SHIFT), h->linesize, 4); h->vdsp.prefetch(dest_cb + (h->mb_x & 7) * h->uvlinesize + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2); h->list_counts[mb_xy] = sl->list_count; if (!SIMPLE && MB_FIELD(h)) { linesize = sl->mb_linesize = h->linesize * 2; uvlinesize = sl->mb_uvlinesize = h->uvlinesize * 2; block_offset = &h->block_offset[48]; if (mb_y & 1) { dest_y -= h->linesize * 15; dest_cb -= h->uvlinesize * (block_h - 1); dest_cr -= h->uvlinesize * (block_h - 1); } if (FRAME_MBAFF(h)) { int list; for (list = 0; list < sl->list_count; list++) { if (!USES_LIST(mb_type, list)) continue; if (IS_16X16(mb_type)) { int8_t *ref = &sl->ref_cache[list][scan8[0]]; fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (h->mb_y & 1), 1); } else { for (i = 0; i < 16; i += 4) { int ref = sl->ref_cache[list][scan8[i]]; if (ref >= 0) fill_rectangle(&sl->ref_cache[list][scan8[i]], 2, 2, 8, (16 + ref) ^ (h->mb_y & 1), 1); } } } } } else { linesize = sl->mb_linesize = h->linesize; uvlinesize = sl->mb_uvlinesize = h->uvlinesize; } if (!SIMPLE && IS_INTRA_PCM(mb_type)) { if (PIXEL_SHIFT) { const int bit_depth = h->sps.bit_depth_luma; int j; GetBitContext gb; init_get_bits(&gb, sl->intra_pcm_ptr, ff_h264_mb_sizes[h->sps.chroma_format_idc] * bit_depth); for (i = 0; i < 16; i++) { uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize); for (j = 0; j < 16; j++) tmp_y[j] = get_bits(&gb, bit_depth); } if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) { if (!h->sps.chroma_format_idc) { for (i = 0; i < block_h; i++) { uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize); for (j = 0; j < 8; j++) tmp_cb[j] = 1 << (bit_depth - 1); } for (i = 0; i < block_h; i++) { uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize); for (j = 0; j < 8; j++) tmp_cr[j] = 1 << (bit_depth - 1); } } else { for (i = 0; i < block_h; i++) { uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize); for (j = 0; j < 8; j++) tmp_cb[j] = get_bits(&gb, bit_depth); } for (i = 0; i < block_h; i++) { uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize); for (j = 0; j < 8; j++) tmp_cr[j] = get_bits(&gb, bit_depth); } } } } else { for (i = 0; i < 16; i++) memcpy(dest_y + i * linesize, sl->intra_pcm_ptr + i * 16, 16); if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) { if (!h->sps.chroma_format_idc) { for (i = 0; i < block_h; i++) { memset(dest_cb + i * uvlinesize, 128, 8); memset(dest_cr + i * uvlinesize, 128, 8); } } else { const uint8_t *src_cb = sl->intra_pcm_ptr + 256; const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + block_h * 8; for (i = 0; i < block_h; i++) { memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8); memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8); } } } } } else { if (IS_INTRA(mb_type)) { if (h->deblocking_filter) xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1, 0, SIMPLE, PIXEL_SHIFT); if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) { h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, uvlinesize); h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, uvlinesize); } hl_decode_mb_predict_luma(h, sl, mb_type, is_h264, SIMPLE, transform_bypass, PIXEL_SHIFT, block_offset, linesize, dest_y, 0); if (h->deblocking_filter) xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0, 0, SIMPLE, PIXEL_SHIFT); } else if (is_h264) { if (chroma422) { FUNC(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr, h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab, h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab, h->h264dsp.weight_h264_pixels_tab, h->h264dsp.biweight_h264_pixels_tab); } else { FUNC(hl_motion_420)(h, sl, dest_y, dest_cb, dest_cr, h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab, h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab, h->h264dsp.weight_h264_pixels_tab, h->h264dsp.biweight_h264_pixels_tab); } } hl_decode_mb_idct_luma(h, sl, mb_type, is_h264, SIMPLE, transform_bypass, PIXEL_SHIFT, block_offset, linesize, dest_y, 0); if ((SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) && (sl->cbp & 0x30)) { uint8_t *dest[2] = { dest_cb, dest_cr }; if (transform_bypass) { if (IS_INTRA(mb_type) && h->sps.profile_idc == 244 && (sl->chroma_pred_mode == VERT_PRED8x8 || sl->chroma_pred_mode == HOR_PRED8x8)) { h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0], block_offset + 16, sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), uvlinesize); h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1], block_offset + 32, sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), uvlinesize); } else { idct_add = h->h264dsp.h264_add_pixels4_clear; for (j = 1; j < 3; j++) { for (i = j * 16; i < j * 16 + 4; i++) if (sl->non_zero_count_cache[scan8[i]] || dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) idct_add(dest[j - 1] + block_offset[i], sl->mb + (i * 16 << PIXEL_SHIFT), uvlinesize); if (chroma422) { for (i = j * 16 + 4; i < j * 16 + 8; i++) if (sl->non_zero_count_cache[scan8[i + 4]] || dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16)) idct_add(dest[j - 1] + block_offset[i + 4], sl->mb + (i * 16 << PIXEL_SHIFT), uvlinesize); } } } } else { if (is_h264) { int qp[2]; if (chroma422) { qp[0] = sl->chroma_qp[0] + 3; qp[1] = sl->chroma_qp[1] + 3; } else { qp[0] = sl->chroma_qp[0]; qp[1] = sl->chroma_qp[1]; } if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]]) h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), h->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]); if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]]) h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), h->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]); h->h264dsp.h264_idct_add8(dest, block_offset, sl->mb, uvlinesize, sl->non_zero_count_cache); } else if (CONFIG_SVQ3_DECODER) { h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + 16 * 16 * 1, h->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][sl->chroma_qp[0]][0]); h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + 16 * 16 * 2, h->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][sl->chroma_qp[1]][0]); for (j = 1; j < 3; j++) { for (i = j * 16; i < j * 16 + 4; i++) if (sl->non_zero_count_cache[scan8[i]] || sl->mb[i * 16]) { uint8_t *const ptr = dest[j - 1] + block_offset[i]; ff_svq3_add_idct_c(ptr, sl->mb + i * 16, uvlinesize, ff_h264_chroma_qp[0][sl->qscale + 12] - 12, 2); } } } } } } }
{ "code": [], "line_no": [] }
static av_noinline void FUNC_0(hl_decode_mb)(H264Context *h, H264SliceContext *sl) { const int VAR_0 = h->VAR_0; const int VAR_1 = h->VAR_1; const int VAR_2 = h->VAR_2; const int VAR_3 = h->cur_pic.VAR_3[VAR_2]; uint8_t *dest_y, *dest_cb, *dest_cr; int VAR_4, VAR_5 ; int VAR_6, VAR_19; int *VAR_8 = &h->VAR_8[0]; const int VAR_9 = !SIMPLE && (sl->qscale == 0 && h->sps.VAR_9); const int VAR_10 = !CONFIG_SVQ3_DECODER || SIMPLE || h->avctx->codec_id == AV_CODEC_ID_H264; void (*VAR_11)(uint8_t *VAR_12, int16_t *VAR_13, int VAR_14); const int VAR_15 = 16 >> h->chroma_y_shift; const int VAR_16 = CHROMA422(h); dest_y = h->cur_pic.f.data[0] + ((VAR_0 << PIXEL_SHIFT) + VAR_1 * h->VAR_4) * 16; dest_cb = h->cur_pic.f.data[1] + (VAR_0 << PIXEL_SHIFT) * 8 + VAR_1 * h->VAR_5 * VAR_15; dest_cr = h->cur_pic.f.data[2] + (VAR_0 << PIXEL_SHIFT) * 8 + VAR_1 * h->VAR_5 * VAR_15; h->vdsp.prefetch(dest_y + (h->VAR_0 & 3) * 4 * h->VAR_4 + (64 << PIXEL_SHIFT), h->VAR_4, 4); h->vdsp.prefetch(dest_cb + (h->VAR_0 & 7) * h->VAR_5 + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2); h->list_counts[VAR_2] = sl->list_count; if (!SIMPLE && MB_FIELD(h)) { VAR_4 = sl->mb_linesize = h->VAR_4 * 2; VAR_5 = sl->mb_uvlinesize = h->VAR_5 * 2; VAR_8 = &h->VAR_8[48]; if (VAR_1 & 1) { dest_y -= h->VAR_4 * 15; dest_cb -= h->VAR_5 * (VAR_15 - 1); dest_cr -= h->VAR_5 * (VAR_15 - 1); } if (FRAME_MBAFF(h)) { int VAR_17; for (VAR_17 = 0; VAR_17 < sl->list_count; VAR_17++) { if (!USES_LIST(VAR_3, VAR_17)) continue; if (IS_16X16(VAR_3)) { int8_t *ref = &sl->ref_cache[VAR_17][scan8[0]]; fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (h->VAR_1 & 1), 1); } else { for (VAR_6 = 0; VAR_6 < 16; VAR_6 += 4) { int ref = sl->ref_cache[VAR_17][scan8[VAR_6]]; if (ref >= 0) fill_rectangle(&sl->ref_cache[VAR_17][scan8[VAR_6]], 2, 2, 8, (16 + ref) ^ (h->VAR_1 & 1), 1); } } } } } else { VAR_4 = sl->mb_linesize = h->VAR_4; VAR_5 = sl->mb_uvlinesize = h->VAR_5; } if (!SIMPLE && IS_INTRA_PCM(VAR_3)) { if (PIXEL_SHIFT) { const int VAR_18 = h->sps.bit_depth_luma; int VAR_19; GetBitContext gb; init_get_bits(&gb, sl->intra_pcm_ptr, ff_h264_mb_sizes[h->sps.chroma_format_idc] * VAR_18); for (VAR_6 = 0; VAR_6 < 16; VAR_6++) { uint16_t *tmp_y = (uint16_t *)(dest_y + VAR_6 * VAR_4); for (VAR_19 = 0; VAR_19 < 16; VAR_19++) tmp_y[VAR_19] = get_bits(&gb, VAR_18); } if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) { if (!h->sps.chroma_format_idc) { for (VAR_6 = 0; VAR_6 < VAR_15; VAR_6++) { uint16_t *tmp_cb = (uint16_t *)(dest_cb + VAR_6 * VAR_5); for (VAR_19 = 0; VAR_19 < 8; VAR_19++) tmp_cb[VAR_19] = 1 << (VAR_18 - 1); } for (VAR_6 = 0; VAR_6 < VAR_15; VAR_6++) { uint16_t *tmp_cr = (uint16_t *)(dest_cr + VAR_6 * VAR_5); for (VAR_19 = 0; VAR_19 < 8; VAR_19++) tmp_cr[VAR_19] = 1 << (VAR_18 - 1); } } else { for (VAR_6 = 0; VAR_6 < VAR_15; VAR_6++) { uint16_t *tmp_cb = (uint16_t *)(dest_cb + VAR_6 * VAR_5); for (VAR_19 = 0; VAR_19 < 8; VAR_19++) tmp_cb[VAR_19] = get_bits(&gb, VAR_18); } for (VAR_6 = 0; VAR_6 < VAR_15; VAR_6++) { uint16_t *tmp_cr = (uint16_t *)(dest_cr + VAR_6 * VAR_5); for (VAR_19 = 0; VAR_19 < 8; VAR_19++) tmp_cr[VAR_19] = get_bits(&gb, VAR_18); } } } } else { for (VAR_6 = 0; VAR_6 < 16; VAR_6++) memcpy(dest_y + VAR_6 * VAR_4, sl->intra_pcm_ptr + VAR_6 * 16, 16); if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) { if (!h->sps.chroma_format_idc) { for (VAR_6 = 0; VAR_6 < VAR_15; VAR_6++) { memset(dest_cb + VAR_6 * VAR_5, 128, 8); memset(dest_cr + VAR_6 * VAR_5, 128, 8); } } else { const uint8_t *VAR_19 = sl->intra_pcm_ptr + 256; const uint8_t *VAR_20 = sl->intra_pcm_ptr + 256 + VAR_15 * 8; for (VAR_6 = 0; VAR_6 < VAR_15; VAR_6++) { memcpy(dest_cb + VAR_6 * VAR_5, VAR_19 + VAR_6 * 8, 8); memcpy(dest_cr + VAR_6 * VAR_5, VAR_20 + VAR_6 * 8, 8); } } } } } else { if (IS_INTRA(VAR_3)) { if (h->deblocking_filter) xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, VAR_4, VAR_5, 1, 0, SIMPLE, PIXEL_SHIFT); if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) { h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, VAR_5); h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, VAR_5); } hl_decode_mb_predict_luma(h, sl, VAR_3, VAR_10, SIMPLE, VAR_9, PIXEL_SHIFT, VAR_8, VAR_4, dest_y, 0); if (h->deblocking_filter) xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, VAR_4, VAR_5, 0, 0, SIMPLE, PIXEL_SHIFT); } else if (VAR_10) { if (VAR_16) { FUNC_0(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr, h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab, h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab, h->h264dsp.weight_h264_pixels_tab, h->h264dsp.biweight_h264_pixels_tab); } else { FUNC_0(hl_motion_420)(h, sl, dest_y, dest_cb, dest_cr, h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab, h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab, h->h264dsp.weight_h264_pixels_tab, h->h264dsp.biweight_h264_pixels_tab); } } hl_decode_mb_idct_luma(h, sl, VAR_3, VAR_10, SIMPLE, VAR_9, PIXEL_SHIFT, VAR_8, VAR_4, dest_y, 0); if ((SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) && (sl->cbp & 0x30)) { uint8_t *dest[2] = { dest_cb, dest_cr }; if (VAR_9) { if (IS_INTRA(VAR_3) && h->sps.profile_idc == 244 && (sl->chroma_pred_mode == VERT_PRED8x8 || sl->chroma_pred_mode == HOR_PRED8x8)) { h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0], VAR_8 + 16, sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), VAR_5); h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1], VAR_8 + 32, sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), VAR_5); } else { VAR_11 = h->h264dsp.h264_add_pixels4_clear; for (VAR_19 = 1; VAR_19 < 3; VAR_19++) { for (VAR_6 = VAR_19 * 16; VAR_6 < VAR_19 * 16 + 4; VAR_6++) if (sl->non_zero_count_cache[scan8[VAR_6]] || dctcoef_get(sl->mb, PIXEL_SHIFT, VAR_6 * 16)) VAR_11(dest[VAR_19 - 1] + VAR_8[VAR_6], sl->mb + (VAR_6 * 16 << PIXEL_SHIFT), VAR_5); if (VAR_16) { for (VAR_6 = VAR_19 * 16 + 4; VAR_6 < VAR_19 * 16 + 8; VAR_6++) if (sl->non_zero_count_cache[scan8[VAR_6 + 4]] || dctcoef_get(sl->mb, PIXEL_SHIFT, VAR_6 * 16)) VAR_11(dest[VAR_19 - 1] + VAR_8[VAR_6 + 4], sl->mb + (VAR_6 * 16 << PIXEL_SHIFT), VAR_5); } } } } else { if (VAR_10) { int VAR_21[2]; if (VAR_16) { VAR_21[0] = sl->chroma_qp[0] + 3; VAR_21[1] = sl->chroma_qp[1] + 3; } else { VAR_21[0] = sl->chroma_qp[0]; VAR_21[1] = sl->chroma_qp[1]; } if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]]) h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT), h->dequant4_coeff[IS_INTRA(VAR_3) ? 1 : 4][VAR_21[0]][0]); if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]]) h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT), h->dequant4_coeff[IS_INTRA(VAR_3) ? 2 : 5][VAR_21[1]][0]); h->h264dsp.h264_idct_add8(dest, VAR_8, sl->mb, VAR_5, sl->non_zero_count_cache); } else if (CONFIG_SVQ3_DECODER) { h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + 16 * 16 * 1, h->dequant4_coeff[IS_INTRA(VAR_3) ? 1 : 4][sl->chroma_qp[0]][0]); h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + 16 * 16 * 2, h->dequant4_coeff[IS_INTRA(VAR_3) ? 2 : 5][sl->chroma_qp[1]][0]); for (VAR_19 = 1; VAR_19 < 3; VAR_19++) { for (VAR_6 = VAR_19 * 16; VAR_6 < VAR_19 * 16 + 4; VAR_6++) if (sl->non_zero_count_cache[scan8[VAR_6]] || sl->mb[VAR_6 * 16]) { uint8_t *const ptr = dest[VAR_19 - 1] + VAR_8[VAR_6]; ff_svq3_add_idct_c(ptr, sl->mb + VAR_6 * 16, VAR_5, ff_h264_chroma_qp[0][sl->qscale + 12] - 12, 2); } } } } } } }
[ "static av_noinline void FUNC_0(hl_decode_mb)(H264Context *h, H264SliceContext *sl)\n{", "const int VAR_0 = h->VAR_0;", "const int VAR_1 = h->VAR_1;", "const int VAR_2 = h->VAR_2;", "const int VAR_3 = h->cur_pic.VAR_3[VAR_2];", "uint8_t *dest_y, *dest_cb, *dest_cr;", "int VAR_4, VAR_5 ;", "int VAR_6, VAR_19;", "int *VAR_8 = &h->VAR_8[0];", "const int VAR_9 = !SIMPLE && (sl->qscale == 0 && h->sps.VAR_9);", "const int VAR_10 = !CONFIG_SVQ3_DECODER || SIMPLE || h->avctx->codec_id == AV_CODEC_ID_H264;", "void (*VAR_11)(uint8_t *VAR_12, int16_t *VAR_13, int VAR_14);", "const int VAR_15 = 16 >> h->chroma_y_shift;", "const int VAR_16 = CHROMA422(h);", "dest_y = h->cur_pic.f.data[0] + ((VAR_0 << PIXEL_SHIFT) + VAR_1 * h->VAR_4) * 16;", "dest_cb = h->cur_pic.f.data[1] + (VAR_0 << PIXEL_SHIFT) * 8 + VAR_1 * h->VAR_5 * VAR_15;", "dest_cr = h->cur_pic.f.data[2] + (VAR_0 << PIXEL_SHIFT) * 8 + VAR_1 * h->VAR_5 * VAR_15;", "h->vdsp.prefetch(dest_y + (h->VAR_0 & 3) * 4 * h->VAR_4 + (64 << PIXEL_SHIFT), h->VAR_4, 4);", "h->vdsp.prefetch(dest_cb + (h->VAR_0 & 7) * h->VAR_5 + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2);", "h->list_counts[VAR_2] = sl->list_count;", "if (!SIMPLE && MB_FIELD(h)) {", "VAR_4 = sl->mb_linesize = h->VAR_4 * 2;", "VAR_5 = sl->mb_uvlinesize = h->VAR_5 * 2;", "VAR_8 = &h->VAR_8[48];", "if (VAR_1 & 1) {", "dest_y -= h->VAR_4 * 15;", "dest_cb -= h->VAR_5 * (VAR_15 - 1);", "dest_cr -= h->VAR_5 * (VAR_15 - 1);", "}", "if (FRAME_MBAFF(h)) {", "int VAR_17;", "for (VAR_17 = 0; VAR_17 < sl->list_count; VAR_17++) {", "if (!USES_LIST(VAR_3, VAR_17))\ncontinue;", "if (IS_16X16(VAR_3)) {", "int8_t *ref = &sl->ref_cache[VAR_17][scan8[0]];", "fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (h->VAR_1 & 1), 1);", "} else {", "for (VAR_6 = 0; VAR_6 < 16; VAR_6 += 4) {", "int ref = sl->ref_cache[VAR_17][scan8[VAR_6]];", "if (ref >= 0)\nfill_rectangle(&sl->ref_cache[VAR_17][scan8[VAR_6]], 2, 2,\n8, (16 + ref) ^ (h->VAR_1 & 1), 1);", "}", "}", "}", "}", "} else {", "VAR_4 = sl->mb_linesize = h->VAR_4;", "VAR_5 = sl->mb_uvlinesize = h->VAR_5;", "}", "if (!SIMPLE && IS_INTRA_PCM(VAR_3)) {", "if (PIXEL_SHIFT) {", "const int VAR_18 = h->sps.bit_depth_luma;", "int VAR_19;", "GetBitContext gb;", "init_get_bits(&gb, sl->intra_pcm_ptr,\nff_h264_mb_sizes[h->sps.chroma_format_idc] * VAR_18);", "for (VAR_6 = 0; VAR_6 < 16; VAR_6++) {", "uint16_t *tmp_y = (uint16_t *)(dest_y + VAR_6 * VAR_4);", "for (VAR_19 = 0; VAR_19 < 16; VAR_19++)", "tmp_y[VAR_19] = get_bits(&gb, VAR_18);", "}", "if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {", "if (!h->sps.chroma_format_idc) {", "for (VAR_6 = 0; VAR_6 < VAR_15; VAR_6++) {", "uint16_t *tmp_cb = (uint16_t *)(dest_cb + VAR_6 * VAR_5);", "for (VAR_19 = 0; VAR_19 < 8; VAR_19++)", "tmp_cb[VAR_19] = 1 << (VAR_18 - 1);", "}", "for (VAR_6 = 0; VAR_6 < VAR_15; VAR_6++) {", "uint16_t *tmp_cr = (uint16_t *)(dest_cr + VAR_6 * VAR_5);", "for (VAR_19 = 0; VAR_19 < 8; VAR_19++)", "tmp_cr[VAR_19] = 1 << (VAR_18 - 1);", "}", "} else {", "for (VAR_6 = 0; VAR_6 < VAR_15; VAR_6++) {", "uint16_t *tmp_cb = (uint16_t *)(dest_cb + VAR_6 * VAR_5);", "for (VAR_19 = 0; VAR_19 < 8; VAR_19++)", "tmp_cb[VAR_19] = get_bits(&gb, VAR_18);", "}", "for (VAR_6 = 0; VAR_6 < VAR_15; VAR_6++) {", "uint16_t *tmp_cr = (uint16_t *)(dest_cr + VAR_6 * VAR_5);", "for (VAR_19 = 0; VAR_19 < 8; VAR_19++)", "tmp_cr[VAR_19] = get_bits(&gb, VAR_18);", "}", "}", "}", "} else {", "for (VAR_6 = 0; VAR_6 < 16; VAR_6++)", "memcpy(dest_y + VAR_6 * VAR_4, sl->intra_pcm_ptr + VAR_6 * 16, 16);", "if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {", "if (!h->sps.chroma_format_idc) {", "for (VAR_6 = 0; VAR_6 < VAR_15; VAR_6++) {", "memset(dest_cb + VAR_6 * VAR_5, 128, 8);", "memset(dest_cr + VAR_6 * VAR_5, 128, 8);", "}", "} else {", "const uint8_t *VAR_19 = sl->intra_pcm_ptr + 256;", "const uint8_t *VAR_20 = sl->intra_pcm_ptr + 256 + VAR_15 * 8;", "for (VAR_6 = 0; VAR_6 < VAR_15; VAR_6++) {", "memcpy(dest_cb + VAR_6 * VAR_5, VAR_19 + VAR_6 * 8, 8);", "memcpy(dest_cr + VAR_6 * VAR_5, VAR_20 + VAR_6 * 8, 8);", "}", "}", "}", "}", "} else {", "if (IS_INTRA(VAR_3)) {", "if (h->deblocking_filter)\nxchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, VAR_4,\nVAR_5, 1, 0, SIMPLE, PIXEL_SHIFT);", "if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {", "h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, VAR_5);", "h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, VAR_5);", "}", "hl_decode_mb_predict_luma(h, sl, VAR_3, VAR_10, SIMPLE,\nVAR_9, PIXEL_SHIFT,\nVAR_8, VAR_4, dest_y, 0);", "if (h->deblocking_filter)\nxchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, VAR_4,\nVAR_5, 0, 0, SIMPLE, PIXEL_SHIFT);", "} else if (VAR_10) {", "if (VAR_16) {", "FUNC_0(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr,\nh->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,\nh->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,\nh->h264dsp.weight_h264_pixels_tab,\nh->h264dsp.biweight_h264_pixels_tab);", "} else {", "FUNC_0(hl_motion_420)(h, sl, dest_y, dest_cb, dest_cr,\nh->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,\nh->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,\nh->h264dsp.weight_h264_pixels_tab,\nh->h264dsp.biweight_h264_pixels_tab);", "}", "}", "hl_decode_mb_idct_luma(h, sl, VAR_3, VAR_10, SIMPLE, VAR_9,\nPIXEL_SHIFT, VAR_8, VAR_4, dest_y, 0);", "if ((SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) &&\n(sl->cbp & 0x30)) {", "uint8_t *dest[2] = { dest_cb, dest_cr };", "if (VAR_9) {", "if (IS_INTRA(VAR_3) && h->sps.profile_idc == 244 &&\n(sl->chroma_pred_mode == VERT_PRED8x8 ||\nsl->chroma_pred_mode == HOR_PRED8x8)) {", "h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0],\nVAR_8 + 16,\nsl->mb + (16 * 16 * 1 << PIXEL_SHIFT),\nVAR_5);", "h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1],\nVAR_8 + 32,\nsl->mb + (16 * 16 * 2 << PIXEL_SHIFT),\nVAR_5);", "} else {", "VAR_11 = h->h264dsp.h264_add_pixels4_clear;", "for (VAR_19 = 1; VAR_19 < 3; VAR_19++) {", "for (VAR_6 = VAR_19 * 16; VAR_6 < VAR_19 * 16 + 4; VAR_6++)", "if (sl->non_zero_count_cache[scan8[VAR_6]] ||\ndctcoef_get(sl->mb, PIXEL_SHIFT, VAR_6 * 16))\nVAR_11(dest[VAR_19 - 1] + VAR_8[VAR_6],\nsl->mb + (VAR_6 * 16 << PIXEL_SHIFT),\nVAR_5);", "if (VAR_16) {", "for (VAR_6 = VAR_19 * 16 + 4; VAR_6 < VAR_19 * 16 + 8; VAR_6++)", "if (sl->non_zero_count_cache[scan8[VAR_6 + 4]] ||\ndctcoef_get(sl->mb, PIXEL_SHIFT, VAR_6 * 16))\nVAR_11(dest[VAR_19 - 1] + VAR_8[VAR_6 + 4],\nsl->mb + (VAR_6 * 16 << PIXEL_SHIFT),\nVAR_5);", "}", "}", "}", "} else {", "if (VAR_10) {", "int VAR_21[2];", "if (VAR_16) {", "VAR_21[0] = sl->chroma_qp[0] + 3;", "VAR_21[1] = sl->chroma_qp[1] + 3;", "} else {", "VAR_21[0] = sl->chroma_qp[0];", "VAR_21[1] = sl->chroma_qp[1];", "}", "if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]])\nh->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT),\nh->dequant4_coeff[IS_INTRA(VAR_3) ? 1 : 4][VAR_21[0]][0]);", "if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]])\nh->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT),\nh->dequant4_coeff[IS_INTRA(VAR_3) ? 2 : 5][VAR_21[1]][0]);", "h->h264dsp.h264_idct_add8(dest, VAR_8,\nsl->mb, VAR_5,\nsl->non_zero_count_cache);", "} else if (CONFIG_SVQ3_DECODER) {", "h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + 16 * 16 * 1,\nh->dequant4_coeff[IS_INTRA(VAR_3) ? 1 : 4][sl->chroma_qp[0]][0]);", "h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + 16 * 16 * 2,\nh->dequant4_coeff[IS_INTRA(VAR_3) ? 2 : 5][sl->chroma_qp[1]][0]);", "for (VAR_19 = 1; VAR_19 < 3; VAR_19++) {", "for (VAR_6 = VAR_19 * 16; VAR_6 < VAR_19 * 16 + 4; VAR_6++)", "if (sl->non_zero_count_cache[scan8[VAR_6]] || sl->mb[VAR_6 * 16]) {", "uint8_t *const ptr = dest[VAR_19 - 1] + VAR_8[VAR_6];", "ff_svq3_add_idct_c(ptr, sl->mb + VAR_6 * 16,\nVAR_5,\nff_h264_chroma_qp[0][sl->qscale + 12] - 12, 2);", "}", "}", "}", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49 ], [ 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 ], [ 115 ], [ 119 ], [ 121 ], [ 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 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237, 239, 241 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 255, 257, 259 ], [ 263, 265, 267 ], [ 269 ], [ 271 ], [ 273, 275, 277, 279, 281 ], [ 283 ], [ 285, 287, 289, 291, 293 ], [ 295 ], [ 297 ], [ 301, 303 ], [ 307, 309 ], [ 311 ], [ 313 ], [ 315, 317, 319 ], [ 321, 323, 325, 327 ], [ 329, 331, 333, 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345, 347, 349, 351, 353 ], [ 355 ], [ 357 ], [ 359, 361, 363, 365, 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395, 397, 399 ], [ 401, 403, 405 ], [ 407, 409, 411 ], [ 413 ], [ 415, 417 ], [ 419, 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431, 433, 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ] ]
13,401
static int hds_write_header(AVFormatContext *s) { HDSContext *c = s->priv_data; int ret = 0, i; AVOutputFormat *oformat; mkdir(s->filename, 0777); oformat = av_guess_format("flv", NULL, NULL); if (!oformat) { ret = AVERROR_MUXER_NOT_FOUND; goto fail; } c->streams = av_mallocz(sizeof(*c->streams) * s->nb_streams); if (!c->streams) { ret = AVERROR(ENOMEM); goto fail; } for (i = 0; i < s->nb_streams; i++) { OutputStream *os = &c->streams[c->nb_streams]; AVFormatContext *ctx; AVStream *st = s->streams[i]; if (!st->codec->bit_rate) { av_log(s, AV_LOG_ERROR, "No bit rate set for stream %d\n", i); ret = AVERROR(EINVAL); goto fail; } if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if (os->has_video) { c->nb_streams++; os++; } os->has_video = 1; } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if (os->has_audio) { c->nb_streams++; os++; } os->has_audio = 1; } else { av_log(s, AV_LOG_ERROR, "Unsupported stream type in stream %d\n", i); ret = AVERROR(EINVAL); goto fail; } os->bitrate += s->streams[i]->codec->bit_rate; if (!os->ctx) { os->first_stream = i; ctx = avformat_alloc_context(); if (!ctx) { ret = AVERROR(ENOMEM); goto fail; } os->ctx = ctx; ctx->oformat = oformat; ctx->interrupt_callback = s->interrupt_callback; ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), AVIO_FLAG_WRITE, os, NULL, hds_write, NULL); if (!ctx->pb) { ret = AVERROR(ENOMEM); goto fail; } } else { ctx = os->ctx; } s->streams[i]->id = c->nb_streams; if (!(st = avformat_new_stream(ctx, NULL))) { ret = AVERROR(ENOMEM); goto fail; } avcodec_copy_context(st->codec, s->streams[i]->codec); st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; } if (c->streams[c->nb_streams].ctx) c->nb_streams++; for (i = 0; i < c->nb_streams; i++) { OutputStream *os = &c->streams[i]; int j; if ((ret = avformat_write_header(os->ctx, NULL)) < 0) { goto fail; } os->ctx_inited = 1; avio_flush(os->ctx->pb); for (j = 0; j < os->ctx->nb_streams; j++) s->streams[os->first_stream + j]->time_base = os->ctx->streams[j]->time_base; snprintf(os->temp_filename, sizeof(os->temp_filename), "%s/stream%d_temp", s->filename, i); ret = init_file(s, os, 0); if (ret < 0) goto fail; if (!os->has_video && c->min_frag_duration <= 0) { av_log(s, AV_LOG_WARNING, "No video stream in output stream %d and no min frag duration set\n", i); ret = AVERROR(EINVAL); } os->fragment_index = 1; write_abst(s, os, 0); } ret = write_manifest(s, 0); fail: if (ret) hds_free(s); return ret; }
true
FFmpeg
803e82276b3716bf6012ec69e8854dae14a4fd2b
static int hds_write_header(AVFormatContext *s) { HDSContext *c = s->priv_data; int ret = 0, i; AVOutputFormat *oformat; mkdir(s->filename, 0777); oformat = av_guess_format("flv", NULL, NULL); if (!oformat) { ret = AVERROR_MUXER_NOT_FOUND; goto fail; } c->streams = av_mallocz(sizeof(*c->streams) * s->nb_streams); if (!c->streams) { ret = AVERROR(ENOMEM); goto fail; } for (i = 0; i < s->nb_streams; i++) { OutputStream *os = &c->streams[c->nb_streams]; AVFormatContext *ctx; AVStream *st = s->streams[i]; if (!st->codec->bit_rate) { av_log(s, AV_LOG_ERROR, "No bit rate set for stream %d\n", i); ret = AVERROR(EINVAL); goto fail; } if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if (os->has_video) { c->nb_streams++; os++; } os->has_video = 1; } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if (os->has_audio) { c->nb_streams++; os++; } os->has_audio = 1; } else { av_log(s, AV_LOG_ERROR, "Unsupported stream type in stream %d\n", i); ret = AVERROR(EINVAL); goto fail; } os->bitrate += s->streams[i]->codec->bit_rate; if (!os->ctx) { os->first_stream = i; ctx = avformat_alloc_context(); if (!ctx) { ret = AVERROR(ENOMEM); goto fail; } os->ctx = ctx; ctx->oformat = oformat; ctx->interrupt_callback = s->interrupt_callback; ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), AVIO_FLAG_WRITE, os, NULL, hds_write, NULL); if (!ctx->pb) { ret = AVERROR(ENOMEM); goto fail; } } else { ctx = os->ctx; } s->streams[i]->id = c->nb_streams; if (!(st = avformat_new_stream(ctx, NULL))) { ret = AVERROR(ENOMEM); goto fail; } avcodec_copy_context(st->codec, s->streams[i]->codec); st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; } if (c->streams[c->nb_streams].ctx) c->nb_streams++; for (i = 0; i < c->nb_streams; i++) { OutputStream *os = &c->streams[i]; int j; if ((ret = avformat_write_header(os->ctx, NULL)) < 0) { goto fail; } os->ctx_inited = 1; avio_flush(os->ctx->pb); for (j = 0; j < os->ctx->nb_streams; j++) s->streams[os->first_stream + j]->time_base = os->ctx->streams[j]->time_base; snprintf(os->temp_filename, sizeof(os->temp_filename), "%s/stream%d_temp", s->filename, i); ret = init_file(s, os, 0); if (ret < 0) goto fail; if (!os->has_video && c->min_frag_duration <= 0) { av_log(s, AV_LOG_WARNING, "No video stream in output stream %d and no min frag duration set\n", i); ret = AVERROR(EINVAL); } os->fragment_index = 1; write_abst(s, os, 0); } ret = write_manifest(s, 0); fail: if (ret) hds_free(s); return ret; }
{ "code": [ " mkdir(s->filename, 0777);", " mkdir(s->filename, 0777);" ], "line_no": [ 13, 13 ] }
static int FUNC_0(AVFormatContext *VAR_0) { HDSContext *c = VAR_0->priv_data; int VAR_1 = 0, VAR_2; AVOutputFormat *oformat; mkdir(VAR_0->filename, 0777); oformat = av_guess_format("flv", NULL, NULL); if (!oformat) { VAR_1 = AVERROR_MUXER_NOT_FOUND; goto fail; } c->streams = av_mallocz(sizeof(*c->streams) * VAR_0->nb_streams); if (!c->streams) { VAR_1 = AVERROR(ENOMEM); goto fail; } for (VAR_2 = 0; VAR_2 < VAR_0->nb_streams; VAR_2++) { OutputStream *os = &c->streams[c->nb_streams]; AVFormatContext *ctx; AVStream *st = VAR_0->streams[VAR_2]; if (!st->codec->bit_rate) { av_log(VAR_0, AV_LOG_ERROR, "No bit rate set for stream %d\n", VAR_2); VAR_1 = AVERROR(EINVAL); goto fail; } if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if (os->has_video) { c->nb_streams++; os++; } os->has_video = 1; } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if (os->has_audio) { c->nb_streams++; os++; } os->has_audio = 1; } else { av_log(VAR_0, AV_LOG_ERROR, "Unsupported stream type in stream %d\n", VAR_2); VAR_1 = AVERROR(EINVAL); goto fail; } os->bitrate += VAR_0->streams[VAR_2]->codec->bit_rate; if (!os->ctx) { os->first_stream = VAR_2; ctx = avformat_alloc_context(); if (!ctx) { VAR_1 = AVERROR(ENOMEM); goto fail; } os->ctx = ctx; ctx->oformat = oformat; ctx->interrupt_callback = VAR_0->interrupt_callback; ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), AVIO_FLAG_WRITE, os, NULL, hds_write, NULL); if (!ctx->pb) { VAR_1 = AVERROR(ENOMEM); goto fail; } } else { ctx = os->ctx; } VAR_0->streams[VAR_2]->id = c->nb_streams; if (!(st = avformat_new_stream(ctx, NULL))) { VAR_1 = AVERROR(ENOMEM); goto fail; } avcodec_copy_context(st->codec, VAR_0->streams[VAR_2]->codec); st->sample_aspect_ratio = VAR_0->streams[VAR_2]->sample_aspect_ratio; } if (c->streams[c->nb_streams].ctx) c->nb_streams++; for (VAR_2 = 0; VAR_2 < c->nb_streams; VAR_2++) { OutputStream *os = &c->streams[VAR_2]; int j; if ((VAR_1 = avformat_write_header(os->ctx, NULL)) < 0) { goto fail; } os->ctx_inited = 1; avio_flush(os->ctx->pb); for (j = 0; j < os->ctx->nb_streams; j++) VAR_0->streams[os->first_stream + j]->time_base = os->ctx->streams[j]->time_base; snprintf(os->temp_filename, sizeof(os->temp_filename), "%VAR_0/stream%d_temp", VAR_0->filename, VAR_2); VAR_1 = init_file(VAR_0, os, 0); if (VAR_1 < 0) goto fail; if (!os->has_video && c->min_frag_duration <= 0) { av_log(VAR_0, AV_LOG_WARNING, "No video stream in output stream %d and no min frag duration set\n", VAR_2); VAR_1 = AVERROR(EINVAL); } os->fragment_index = 1; write_abst(VAR_0, os, 0); } VAR_1 = write_manifest(VAR_0, 0); fail: if (VAR_1) hds_free(VAR_0); return VAR_1; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "HDSContext *c = VAR_0->priv_data;", "int VAR_1 = 0, VAR_2;", "AVOutputFormat *oformat;", "mkdir(VAR_0->filename, 0777);", "oformat = av_guess_format(\"flv\", NULL, NULL);", "if (!oformat) {", "VAR_1 = AVERROR_MUXER_NOT_FOUND;", "goto fail;", "}", "c->streams = av_mallocz(sizeof(*c->streams) * VAR_0->nb_streams);", "if (!c->streams) {", "VAR_1 = AVERROR(ENOMEM);", "goto fail;", "}", "for (VAR_2 = 0; VAR_2 < VAR_0->nb_streams; VAR_2++) {", "OutputStream *os = &c->streams[c->nb_streams];", "AVFormatContext *ctx;", "AVStream *st = VAR_0->streams[VAR_2];", "if (!st->codec->bit_rate) {", "av_log(VAR_0, AV_LOG_ERROR, \"No bit rate set for stream %d\\n\", VAR_2);", "VAR_1 = AVERROR(EINVAL);", "goto fail;", "}", "if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {", "if (os->has_video) {", "c->nb_streams++;", "os++;", "}", "os->has_video = 1;", "} else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {", "if (os->has_audio) {", "c->nb_streams++;", "os++;", "}", "os->has_audio = 1;", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"Unsupported stream type in stream %d\\n\", VAR_2);", "VAR_1 = AVERROR(EINVAL);", "goto fail;", "}", "os->bitrate += VAR_0->streams[VAR_2]->codec->bit_rate;", "if (!os->ctx) {", "os->first_stream = VAR_2;", "ctx = avformat_alloc_context();", "if (!ctx) {", "VAR_1 = AVERROR(ENOMEM);", "goto fail;", "}", "os->ctx = ctx;", "ctx->oformat = oformat;", "ctx->interrupt_callback = VAR_0->interrupt_callback;", "ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf),\nAVIO_FLAG_WRITE, os,\nNULL, hds_write, NULL);", "if (!ctx->pb) {", "VAR_1 = AVERROR(ENOMEM);", "goto fail;", "}", "} else {", "ctx = os->ctx;", "}", "VAR_0->streams[VAR_2]->id = c->nb_streams;", "if (!(st = avformat_new_stream(ctx, NULL))) {", "VAR_1 = AVERROR(ENOMEM);", "goto fail;", "}", "avcodec_copy_context(st->codec, VAR_0->streams[VAR_2]->codec);", "st->sample_aspect_ratio = VAR_0->streams[VAR_2]->sample_aspect_ratio;", "}", "if (c->streams[c->nb_streams].ctx)\nc->nb_streams++;", "for (VAR_2 = 0; VAR_2 < c->nb_streams; VAR_2++) {", "OutputStream *os = &c->streams[VAR_2];", "int j;", "if ((VAR_1 = avformat_write_header(os->ctx, NULL)) < 0) {", "goto fail;", "}", "os->ctx_inited = 1;", "avio_flush(os->ctx->pb);", "for (j = 0; j < os->ctx->nb_streams; j++)", "VAR_0->streams[os->first_stream + j]->time_base = os->ctx->streams[j]->time_base;", "snprintf(os->temp_filename, sizeof(os->temp_filename),\n\"%VAR_0/stream%d_temp\", VAR_0->filename, VAR_2);", "VAR_1 = init_file(VAR_0, os, 0);", "if (VAR_1 < 0)\ngoto fail;", "if (!os->has_video && c->min_frag_duration <= 0) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"No video stream in output stream %d and no min frag duration set\\n\", VAR_2);", "VAR_1 = AVERROR(EINVAL);", "}", "os->fragment_index = 1;", "write_abst(VAR_0, os, 0);", "}", "VAR_1 = write_manifest(VAR_0, 0);", "fail:\nif (VAR_1)\nhds_free(VAR_0);", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121, 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187, 189 ], [ 191 ], [ 193, 195 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 219, 221, 223 ], [ 225 ], [ 227 ] ]
13,402
static int disas_coproc_insn(DisasContext *s, uint32_t insn) { int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2; const ARMCPRegInfo *ri; cpnum = (insn >> 8) & 0xf; /* First check for coprocessor space used for XScale/iwMMXt insns */ if (arm_dc_feature(s, ARM_FEATURE_XSCALE) && (cpnum < 2)) { if (extract32(s->c15_cpar, cpnum, 1) == 0) { return 1; } if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) { return disas_iwmmxt_insn(s, insn); } else if (arm_dc_feature(s, ARM_FEATURE_XSCALE)) { return disas_dsp_insn(s, insn); } return 1; } /* Otherwise treat as a generic register access */ is64 = (insn & (1 << 25)) == 0; if (!is64 && ((insn & (1 << 4)) == 0)) { /* cdp */ return 1; } crm = insn & 0xf; if (is64) { crn = 0; opc1 = (insn >> 4) & 0xf; opc2 = 0; rt2 = (insn >> 16) & 0xf; } else { crn = (insn >> 16) & 0xf; opc1 = (insn >> 21) & 7; opc2 = (insn >> 5) & 7; rt2 = 0; } isread = (insn >> 20) & 1; rt = (insn >> 12) & 0xf; ri = get_arm_cp_reginfo(s->cp_regs, ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2)); if (ri) { /* Check access permissions */ if (!cp_access_ok(s->current_el, ri, isread)) { return 1; } if (ri->accessfn || (arm_dc_feature(s, ARM_FEATURE_XSCALE) && cpnum < 14)) { /* Emit code to perform further access permissions checks at * runtime; this may result in an exception. * Note that on XScale all cp0..c13 registers do an access check * call in order to handle c15_cpar. */ TCGv_ptr tmpptr; TCGv_i32 tcg_syn; uint32_t syndrome; /* Note that since we are an implementation which takes an * exception on a trapped conditional instruction only if the * instruction passes its condition code check, we can take * advantage of the clause in the ARM ARM that allows us to set * the COND field in the instruction to 0xE in all cases. * We could fish the actual condition out of the insn (ARM) * or the condexec bits (Thumb) but it isn't necessary. */ switch (cpnum) { case 14: if (is64) { syndrome = syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, isread, s->thumb); } else { syndrome = syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, rt, isread, s->thumb); } break; case 15: if (is64) { syndrome = syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, isread, s->thumb); } else { syndrome = syn_cp15_rt_trap(1, 0xe, opc1, opc2, crn, crm, rt, isread, s->thumb); } break; default: /* ARMv8 defines that only coprocessors 14 and 15 exist, * so this can only happen if this is an ARMv7 or earlier CPU, * in which case the syndrome information won't actually be * guest visible. */ assert(!arm_dc_feature(s, ARM_FEATURE_V8)); syndrome = syn_uncategorized(); break; } gen_set_pc_im(s, s->pc); tmpptr = tcg_const_ptr(ri); tcg_syn = tcg_const_i32(syndrome); gen_helper_access_check_cp_reg(cpu_env, tmpptr, tcg_syn); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tcg_syn); } /* Handle special cases first */ switch (ri->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) { case ARM_CP_NOP: return 0; case ARM_CP_WFI: if (isread) { return 1; } gen_set_pc_im(s, s->pc); s->is_jmp = DISAS_WFI; return 0; default: break; } if ((s->tb->cflags & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) { gen_io_start(); } if (isread) { /* Read */ if (is64) { TCGv_i64 tmp64; TCGv_i32 tmp; if (ri->type & ARM_CP_CONST) { tmp64 = tcg_const_i64(ri->resetvalue); } else if (ri->readfn) { TCGv_ptr tmpptr; tmp64 = tcg_temp_new_i64(); tmpptr = tcg_const_ptr(ri); gen_helper_get_cp_reg64(tmp64, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp64 = tcg_temp_new_i64(); tcg_gen_ld_i64(tmp64, cpu_env, ri->fieldoffset); } tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); store_reg(s, rt, tmp); tcg_gen_shri_i64(tmp64, tmp64, 32); tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); store_reg(s, rt2, tmp); } else { TCGv_i32 tmp; if (ri->type & ARM_CP_CONST) { tmp = tcg_const_i32(ri->resetvalue); } else if (ri->readfn) { TCGv_ptr tmpptr; tmp = tcg_temp_new_i32(); tmpptr = tcg_const_ptr(ri); gen_helper_get_cp_reg(tmp, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp = load_cpu_offset(ri->fieldoffset); } if (rt == 15) { /* Destination register of r15 for 32 bit loads sets * the condition codes from the high 4 bits of the value */ gen_set_nzcv(tmp); tcg_temp_free_i32(tmp); } else { store_reg(s, rt, tmp); } } } else { /* Write */ if (ri->type & ARM_CP_CONST) { /* If not forbidden by access permissions, treat as WI */ return 0; } if (is64) { TCGv_i32 tmplo, tmphi; TCGv_i64 tmp64 = tcg_temp_new_i64(); tmplo = load_reg(s, rt); tmphi = load_reg(s, rt2); tcg_gen_concat_i32_i64(tmp64, tmplo, tmphi); tcg_temp_free_i32(tmplo); tcg_temp_free_i32(tmphi); if (ri->writefn) { TCGv_ptr tmpptr = tcg_const_ptr(ri); gen_helper_set_cp_reg64(cpu_env, tmpptr, tmp64); tcg_temp_free_ptr(tmpptr); } else { tcg_gen_st_i64(tmp64, cpu_env, ri->fieldoffset); } tcg_temp_free_i64(tmp64); } else { if (ri->writefn) { TCGv_i32 tmp; TCGv_ptr tmpptr; tmp = load_reg(s, rt); tmpptr = tcg_const_ptr(ri); gen_helper_set_cp_reg(cpu_env, tmpptr, tmp); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tmp); } else { TCGv_i32 tmp = load_reg(s, rt); store_cpu_offset(tmp, ri->fieldoffset); } } } if ((s->tb->cflags & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) { /* I/O operations must end the TB here (whether read or write) */ gen_io_end(); gen_lookup_tb(s); } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { /* We default to ending the TB on a coprocessor register write, * but allow this to be suppressed by the register definition * (usually only necessary to work around guest bugs). */ gen_lookup_tb(s); } return 0; } /* Unknown register; this might be a guest error or a QEMU * unimplemented feature. */ if (is64) { qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " "64 bit system register cp:%d opc1: %d crm:%d " "(%s)\n", isread ? "read" : "write", cpnum, opc1, crm, s->ns ? "non-secure" : "secure"); } else { qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " "system register cp:%d opc1:%d crn:%d crm:%d opc2:%d " "(%s)\n", isread ? "read" : "write", cpnum, opc1, crn, crm, opc2, s->ns ? "non-secure" : "secure"); } return 1; }
true
qemu
3977ee5d7a9f2e3664dd8b233f3224694e23b62b
static int disas_coproc_insn(DisasContext *s, uint32_t insn) { int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2; const ARMCPRegInfo *ri; cpnum = (insn >> 8) & 0xf; if (arm_dc_feature(s, ARM_FEATURE_XSCALE) && (cpnum < 2)) { if (extract32(s->c15_cpar, cpnum, 1) == 0) { return 1; } if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) { return disas_iwmmxt_insn(s, insn); } else if (arm_dc_feature(s, ARM_FEATURE_XSCALE)) { return disas_dsp_insn(s, insn); } return 1; } is64 = (insn & (1 << 25)) == 0; if (!is64 && ((insn & (1 << 4)) == 0)) { return 1; } crm = insn & 0xf; if (is64) { crn = 0; opc1 = (insn >> 4) & 0xf; opc2 = 0; rt2 = (insn >> 16) & 0xf; } else { crn = (insn >> 16) & 0xf; opc1 = (insn >> 21) & 7; opc2 = (insn >> 5) & 7; rt2 = 0; } isread = (insn >> 20) & 1; rt = (insn >> 12) & 0xf; ri = get_arm_cp_reginfo(s->cp_regs, ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2)); if (ri) { if (!cp_access_ok(s->current_el, ri, isread)) { return 1; } if (ri->accessfn || (arm_dc_feature(s, ARM_FEATURE_XSCALE) && cpnum < 14)) { TCGv_ptr tmpptr; TCGv_i32 tcg_syn; uint32_t syndrome; switch (cpnum) { case 14: if (is64) { syndrome = syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, isread, s->thumb); } else { syndrome = syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, rt, isread, s->thumb); } break; case 15: if (is64) { syndrome = syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, isread, s->thumb); } else { syndrome = syn_cp15_rt_trap(1, 0xe, opc1, opc2, crn, crm, rt, isread, s->thumb); } break; default: assert(!arm_dc_feature(s, ARM_FEATURE_V8)); syndrome = syn_uncategorized(); break; } gen_set_pc_im(s, s->pc); tmpptr = tcg_const_ptr(ri); tcg_syn = tcg_const_i32(syndrome); gen_helper_access_check_cp_reg(cpu_env, tmpptr, tcg_syn); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tcg_syn); } switch (ri->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) { case ARM_CP_NOP: return 0; case ARM_CP_WFI: if (isread) { return 1; } gen_set_pc_im(s, s->pc); s->is_jmp = DISAS_WFI; return 0; default: break; } if ((s->tb->cflags & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) { gen_io_start(); } if (isread) { if (is64) { TCGv_i64 tmp64; TCGv_i32 tmp; if (ri->type & ARM_CP_CONST) { tmp64 = tcg_const_i64(ri->resetvalue); } else if (ri->readfn) { TCGv_ptr tmpptr; tmp64 = tcg_temp_new_i64(); tmpptr = tcg_const_ptr(ri); gen_helper_get_cp_reg64(tmp64, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp64 = tcg_temp_new_i64(); tcg_gen_ld_i64(tmp64, cpu_env, ri->fieldoffset); } tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); store_reg(s, rt, tmp); tcg_gen_shri_i64(tmp64, tmp64, 32); tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); store_reg(s, rt2, tmp); } else { TCGv_i32 tmp; if (ri->type & ARM_CP_CONST) { tmp = tcg_const_i32(ri->resetvalue); } else if (ri->readfn) { TCGv_ptr tmpptr; tmp = tcg_temp_new_i32(); tmpptr = tcg_const_ptr(ri); gen_helper_get_cp_reg(tmp, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp = load_cpu_offset(ri->fieldoffset); } if (rt == 15) { gen_set_nzcv(tmp); tcg_temp_free_i32(tmp); } else { store_reg(s, rt, tmp); } } } else { if (ri->type & ARM_CP_CONST) { return 0; } if (is64) { TCGv_i32 tmplo, tmphi; TCGv_i64 tmp64 = tcg_temp_new_i64(); tmplo = load_reg(s, rt); tmphi = load_reg(s, rt2); tcg_gen_concat_i32_i64(tmp64, tmplo, tmphi); tcg_temp_free_i32(tmplo); tcg_temp_free_i32(tmphi); if (ri->writefn) { TCGv_ptr tmpptr = tcg_const_ptr(ri); gen_helper_set_cp_reg64(cpu_env, tmpptr, tmp64); tcg_temp_free_ptr(tmpptr); } else { tcg_gen_st_i64(tmp64, cpu_env, ri->fieldoffset); } tcg_temp_free_i64(tmp64); } else { if (ri->writefn) { TCGv_i32 tmp; TCGv_ptr tmpptr; tmp = load_reg(s, rt); tmpptr = tcg_const_ptr(ri); gen_helper_set_cp_reg(cpu_env, tmpptr, tmp); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tmp); } else { TCGv_i32 tmp = load_reg(s, rt); store_cpu_offset(tmp, ri->fieldoffset); } } } if ((s->tb->cflags & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) { gen_io_end(); gen_lookup_tb(s); } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { gen_lookup_tb(s); } return 0; } if (is64) { qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " "64 bit system register cp:%d opc1: %d crm:%d " "(%s)\n", isread ? "read" : "write", cpnum, opc1, crm, s->ns ? "non-secure" : "secure"); } else { qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " "system register cp:%d opc1:%d crn:%d crm:%d opc2:%d " "(%s)\n", isread ? "read" : "write", cpnum, opc1, crn, crm, opc2, s->ns ? "non-secure" : "secure"); } return 1; }
{ "code": [ " gen_set_pc_im(s, s->pc);" ], "line_no": [ 199 ] }
static int FUNC_0(DisasContext *VAR_0, uint32_t VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; const ARMCPRegInfo *VAR_11; VAR_2 = (VAR_1 >> 8) & 0xf; if (arm_dc_feature(VAR_0, ARM_FEATURE_XSCALE) && (VAR_2 < 2)) { if (extract32(VAR_0->c15_cpar, VAR_2, 1) == 0) { return 1; } if (arm_dc_feature(VAR_0, ARM_FEATURE_IWMMXT)) { return disas_iwmmxt_insn(VAR_0, VAR_1); } else if (arm_dc_feature(VAR_0, ARM_FEATURE_XSCALE)) { return disas_dsp_insn(VAR_0, VAR_1); } return 1; } VAR_3 = (VAR_1 & (1 << 25)) == 0; if (!VAR_3 && ((VAR_1 & (1 << 4)) == 0)) { return 1; } VAR_5 = VAR_1 & 0xf; if (VAR_3) { VAR_4 = 0; VAR_6 = (VAR_1 >> 4) & 0xf; VAR_7 = 0; VAR_10 = (VAR_1 >> 16) & 0xf; } else { VAR_4 = (VAR_1 >> 16) & 0xf; VAR_6 = (VAR_1 >> 21) & 7; VAR_7 = (VAR_1 >> 5) & 7; VAR_10 = 0; } VAR_8 = (VAR_1 >> 20) & 1; VAR_9 = (VAR_1 >> 12) & 0xf; VAR_11 = get_arm_cp_reginfo(VAR_0->cp_regs, ENCODE_CP_REG(VAR_2, VAR_3, VAR_0->ns, VAR_4, VAR_5, VAR_6, VAR_7)); if (VAR_11) { if (!cp_access_ok(VAR_0->current_el, VAR_11, VAR_8)) { return 1; } if (VAR_11->accessfn || (arm_dc_feature(VAR_0, ARM_FEATURE_XSCALE) && VAR_2 < 14)) { TCGv_ptr tmpptr; TCGv_i32 tcg_syn; uint32_t syndrome; switch (VAR_2) { case 14: if (VAR_3) { syndrome = syn_cp14_rrt_trap(1, 0xe, VAR_6, VAR_5, VAR_9, VAR_10, VAR_8, VAR_0->thumb); } else { syndrome = syn_cp14_rt_trap(1, 0xe, VAR_6, VAR_7, VAR_4, VAR_5, VAR_9, VAR_8, VAR_0->thumb); } break; case 15: if (VAR_3) { syndrome = syn_cp15_rrt_trap(1, 0xe, VAR_6, VAR_5, VAR_9, VAR_10, VAR_8, VAR_0->thumb); } else { syndrome = syn_cp15_rt_trap(1, 0xe, VAR_6, VAR_7, VAR_4, VAR_5, VAR_9, VAR_8, VAR_0->thumb); } break; default: assert(!arm_dc_feature(VAR_0, ARM_FEATURE_V8)); syndrome = syn_uncategorized(); break; } gen_set_pc_im(VAR_0, VAR_0->pc); tmpptr = tcg_const_ptr(VAR_11); tcg_syn = tcg_const_i32(syndrome); gen_helper_access_check_cp_reg(cpu_env, tmpptr, tcg_syn); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tcg_syn); } switch (VAR_11->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) { case ARM_CP_NOP: return 0; case ARM_CP_WFI: if (VAR_8) { return 1; } gen_set_pc_im(VAR_0, VAR_0->pc); VAR_0->is_jmp = DISAS_WFI; return 0; default: break; } if ((VAR_0->tb->cflags & CF_USE_ICOUNT) && (VAR_11->type & ARM_CP_IO)) { gen_io_start(); } if (VAR_8) { if (VAR_3) { TCGv_i64 tmp64; TCGv_i32 tmp; if (VAR_11->type & ARM_CP_CONST) { tmp64 = tcg_const_i64(VAR_11->resetvalue); } else if (VAR_11->readfn) { TCGv_ptr tmpptr; tmp64 = tcg_temp_new_i64(); tmpptr = tcg_const_ptr(VAR_11); gen_helper_get_cp_reg64(tmp64, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp64 = tcg_temp_new_i64(); tcg_gen_ld_i64(tmp64, cpu_env, VAR_11->fieldoffset); } tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); store_reg(VAR_0, VAR_9, tmp); tcg_gen_shri_i64(tmp64, tmp64, 32); tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); store_reg(VAR_0, VAR_10, tmp); } else { TCGv_i32 tmp; if (VAR_11->type & ARM_CP_CONST) { tmp = tcg_const_i32(VAR_11->resetvalue); } else if (VAR_11->readfn) { TCGv_ptr tmpptr; tmp = tcg_temp_new_i32(); tmpptr = tcg_const_ptr(VAR_11); gen_helper_get_cp_reg(tmp, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp = load_cpu_offset(VAR_11->fieldoffset); } if (VAR_9 == 15) { gen_set_nzcv(tmp); tcg_temp_free_i32(tmp); } else { store_reg(VAR_0, VAR_9, tmp); } } } else { if (VAR_11->type & ARM_CP_CONST) { return 0; } if (VAR_3) { TCGv_i32 tmplo, tmphi; TCGv_i64 tmp64 = tcg_temp_new_i64(); tmplo = load_reg(VAR_0, VAR_9); tmphi = load_reg(VAR_0, VAR_10); tcg_gen_concat_i32_i64(tmp64, tmplo, tmphi); tcg_temp_free_i32(tmplo); tcg_temp_free_i32(tmphi); if (VAR_11->writefn) { TCGv_ptr tmpptr = tcg_const_ptr(VAR_11); gen_helper_set_cp_reg64(cpu_env, tmpptr, tmp64); tcg_temp_free_ptr(tmpptr); } else { tcg_gen_st_i64(tmp64, cpu_env, VAR_11->fieldoffset); } tcg_temp_free_i64(tmp64); } else { if (VAR_11->writefn) { TCGv_i32 tmp; TCGv_ptr tmpptr; tmp = load_reg(VAR_0, VAR_9); tmpptr = tcg_const_ptr(VAR_11); gen_helper_set_cp_reg(cpu_env, tmpptr, tmp); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tmp); } else { TCGv_i32 tmp = load_reg(VAR_0, VAR_9); store_cpu_offset(tmp, VAR_11->fieldoffset); } } } if ((VAR_0->tb->cflags & CF_USE_ICOUNT) && (VAR_11->type & ARM_CP_IO)) { gen_io_end(); gen_lookup_tb(VAR_0); } else if (!VAR_8 && !(VAR_11->type & ARM_CP_SUPPRESS_TB_END)) { gen_lookup_tb(VAR_0); } return 0; } if (VAR_3) { qemu_log_mask(LOG_UNIMP, "%VAR_0 access to unsupported AArch32 " "64 bit system register cp:%d VAR_6: %d VAR_5:%d " "(%VAR_0)\n", VAR_8 ? "read" : "write", VAR_2, VAR_6, VAR_5, VAR_0->ns ? "non-secure" : "secure"); } else { qemu_log_mask(LOG_UNIMP, "%VAR_0 access to unsupported AArch32 " "system register cp:%d VAR_6:%d VAR_4:%d VAR_5:%d VAR_7:%d " "(%VAR_0)\n", VAR_8 ? "read" : "write", VAR_2, VAR_6, VAR_4, VAR_5, VAR_7, VAR_0->ns ? "non-secure" : "secure"); } return 1; }
[ "static int FUNC_0(DisasContext *VAR_0, uint32_t VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "const ARMCPRegInfo *VAR_11;", "VAR_2 = (VAR_1 >> 8) & 0xf;", "if (arm_dc_feature(VAR_0, ARM_FEATURE_XSCALE) && (VAR_2 < 2)) {", "if (extract32(VAR_0->c15_cpar, VAR_2, 1) == 0) {", "return 1;", "}", "if (arm_dc_feature(VAR_0, ARM_FEATURE_IWMMXT)) {", "return disas_iwmmxt_insn(VAR_0, VAR_1);", "} else if (arm_dc_feature(VAR_0, ARM_FEATURE_XSCALE)) {", "return disas_dsp_insn(VAR_0, VAR_1);", "}", "return 1;", "}", "VAR_3 = (VAR_1 & (1 << 25)) == 0;", "if (!VAR_3 && ((VAR_1 & (1 << 4)) == 0)) {", "return 1;", "}", "VAR_5 = VAR_1 & 0xf;", "if (VAR_3) {", "VAR_4 = 0;", "VAR_6 = (VAR_1 >> 4) & 0xf;", "VAR_7 = 0;", "VAR_10 = (VAR_1 >> 16) & 0xf;", "} else {", "VAR_4 = (VAR_1 >> 16) & 0xf;", "VAR_6 = (VAR_1 >> 21) & 7;", "VAR_7 = (VAR_1 >> 5) & 7;", "VAR_10 = 0;", "}", "VAR_8 = (VAR_1 >> 20) & 1;", "VAR_9 = (VAR_1 >> 12) & 0xf;", "VAR_11 = get_arm_cp_reginfo(VAR_0->cp_regs,\nENCODE_CP_REG(VAR_2, VAR_3, VAR_0->ns, VAR_4, VAR_5, VAR_6, VAR_7));", "if (VAR_11) {", "if (!cp_access_ok(VAR_0->current_el, VAR_11, VAR_8)) {", "return 1;", "}", "if (VAR_11->accessfn ||\n(arm_dc_feature(VAR_0, ARM_FEATURE_XSCALE) && VAR_2 < 14)) {", "TCGv_ptr tmpptr;", "TCGv_i32 tcg_syn;", "uint32_t syndrome;", "switch (VAR_2) {", "case 14:\nif (VAR_3) {", "syndrome = syn_cp14_rrt_trap(1, 0xe, VAR_6, VAR_5, VAR_9, VAR_10,\nVAR_8, VAR_0->thumb);", "} else {", "syndrome = syn_cp14_rt_trap(1, 0xe, VAR_6, VAR_7, VAR_4, VAR_5,\nVAR_9, VAR_8, VAR_0->thumb);", "}", "break;", "case 15:\nif (VAR_3) {", "syndrome = syn_cp15_rrt_trap(1, 0xe, VAR_6, VAR_5, VAR_9, VAR_10,\nVAR_8, VAR_0->thumb);", "} else {", "syndrome = syn_cp15_rt_trap(1, 0xe, VAR_6, VAR_7, VAR_4, VAR_5,\nVAR_9, VAR_8, VAR_0->thumb);", "}", "break;", "default:\nassert(!arm_dc_feature(VAR_0, ARM_FEATURE_V8));", "syndrome = syn_uncategorized();", "break;", "}", "gen_set_pc_im(VAR_0, VAR_0->pc);", "tmpptr = tcg_const_ptr(VAR_11);", "tcg_syn = tcg_const_i32(syndrome);", "gen_helper_access_check_cp_reg(cpu_env, tmpptr, tcg_syn);", "tcg_temp_free_ptr(tmpptr);", "tcg_temp_free_i32(tcg_syn);", "}", "switch (VAR_11->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) {", "case ARM_CP_NOP:\nreturn 0;", "case ARM_CP_WFI:\nif (VAR_8) {", "return 1;", "}", "gen_set_pc_im(VAR_0, VAR_0->pc);", "VAR_0->is_jmp = DISAS_WFI;", "return 0;", "default:\nbreak;", "}", "if ((VAR_0->tb->cflags & CF_USE_ICOUNT) && (VAR_11->type & ARM_CP_IO)) {", "gen_io_start();", "}", "if (VAR_8) {", "if (VAR_3) {", "TCGv_i64 tmp64;", "TCGv_i32 tmp;", "if (VAR_11->type & ARM_CP_CONST) {", "tmp64 = tcg_const_i64(VAR_11->resetvalue);", "} else if (VAR_11->readfn) {", "TCGv_ptr tmpptr;", "tmp64 = tcg_temp_new_i64();", "tmpptr = tcg_const_ptr(VAR_11);", "gen_helper_get_cp_reg64(tmp64, cpu_env, tmpptr);", "tcg_temp_free_ptr(tmpptr);", "} else {", "tmp64 = tcg_temp_new_i64();", "tcg_gen_ld_i64(tmp64, cpu_env, VAR_11->fieldoffset);", "}", "tmp = tcg_temp_new_i32();", "tcg_gen_trunc_i64_i32(tmp, tmp64);", "store_reg(VAR_0, VAR_9, tmp);", "tcg_gen_shri_i64(tmp64, tmp64, 32);", "tmp = tcg_temp_new_i32();", "tcg_gen_trunc_i64_i32(tmp, tmp64);", "tcg_temp_free_i64(tmp64);", "store_reg(VAR_0, VAR_10, tmp);", "} else {", "TCGv_i32 tmp;", "if (VAR_11->type & ARM_CP_CONST) {", "tmp = tcg_const_i32(VAR_11->resetvalue);", "} else if (VAR_11->readfn) {", "TCGv_ptr tmpptr;", "tmp = tcg_temp_new_i32();", "tmpptr = tcg_const_ptr(VAR_11);", "gen_helper_get_cp_reg(tmp, cpu_env, tmpptr);", "tcg_temp_free_ptr(tmpptr);", "} else {", "tmp = load_cpu_offset(VAR_11->fieldoffset);", "}", "if (VAR_9 == 15) {", "gen_set_nzcv(tmp);", "tcg_temp_free_i32(tmp);", "} else {", "store_reg(VAR_0, VAR_9, tmp);", "}", "}", "} else {", "if (VAR_11->type & ARM_CP_CONST) {", "return 0;", "}", "if (VAR_3) {", "TCGv_i32 tmplo, tmphi;", "TCGv_i64 tmp64 = tcg_temp_new_i64();", "tmplo = load_reg(VAR_0, VAR_9);", "tmphi = load_reg(VAR_0, VAR_10);", "tcg_gen_concat_i32_i64(tmp64, tmplo, tmphi);", "tcg_temp_free_i32(tmplo);", "tcg_temp_free_i32(tmphi);", "if (VAR_11->writefn) {", "TCGv_ptr tmpptr = tcg_const_ptr(VAR_11);", "gen_helper_set_cp_reg64(cpu_env, tmpptr, tmp64);", "tcg_temp_free_ptr(tmpptr);", "} else {", "tcg_gen_st_i64(tmp64, cpu_env, VAR_11->fieldoffset);", "}", "tcg_temp_free_i64(tmp64);", "} else {", "if (VAR_11->writefn) {", "TCGv_i32 tmp;", "TCGv_ptr tmpptr;", "tmp = load_reg(VAR_0, VAR_9);", "tmpptr = tcg_const_ptr(VAR_11);", "gen_helper_set_cp_reg(cpu_env, tmpptr, tmp);", "tcg_temp_free_ptr(tmpptr);", "tcg_temp_free_i32(tmp);", "} else {", "TCGv_i32 tmp = load_reg(VAR_0, VAR_9);", "store_cpu_offset(tmp, VAR_11->fieldoffset);", "}", "}", "}", "if ((VAR_0->tb->cflags & CF_USE_ICOUNT) && (VAR_11->type & ARM_CP_IO)) {", "gen_io_end();", "gen_lookup_tb(VAR_0);", "} else if (!VAR_8 && !(VAR_11->type & ARM_CP_SUPPRESS_TB_END)) {", "gen_lookup_tb(VAR_0);", "}", "return 0;", "}", "if (VAR_3) {", "qemu_log_mask(LOG_UNIMP, \"%VAR_0 access to unsupported AArch32 \"\n\"64 bit system register cp:%d VAR_6: %d VAR_5:%d \"\n\"(%VAR_0)\\n\",\nVAR_8 ? \"read\" : \"write\", VAR_2, VAR_6, VAR_5,\nVAR_0->ns ? \"non-secure\" : \"secure\");", "} else {", "qemu_log_mask(LOG_UNIMP, \"%VAR_0 access to unsupported AArch32 \"\n\"system register cp:%d VAR_6:%d VAR_4:%d VAR_5:%d VAR_7:%d \"\n\"(%VAR_0)\\n\",\nVAR_8 ? \"read\" : \"write\", VAR_2, VAR_6, VAR_4, VAR_5, VAR_7,\nVAR_0->ns ? \"non-secure\" : \"secure\");", "}", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 101, 103 ], [ 115 ], [ 117 ], [ 119 ], [ 139 ], [ 141, 143 ], [ 145, 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163, 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177, 189 ], [ 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 217 ], [ 219, 221 ], [ 223, 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241 ], [ 245 ], [ 247 ], [ 249 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 353 ], [ 357 ], [ 359 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 427 ], [ 431 ], [ 433 ], [ 435 ], [ 445 ], [ 447 ], [ 451 ], [ 453 ], [ 463 ], [ 465, 467, 469, 471, 473 ], [ 475 ], [ 477, 479, 481, 483, 485 ], [ 487 ], [ 491 ], [ 493 ] ]
13,403
static inline int round_sample(int64_t *sum) { int sum1; sum1 = (int)((*sum) >> OUT_SHIFT); *sum &= (1<<OUT_SHIFT)-1; return av_clip(sum1, OUT_MIN, OUT_MAX); }
false
FFmpeg
92ea249d7db4baf64680f412c6bd99ff85860723
static inline int round_sample(int64_t *sum) { int sum1; sum1 = (int)((*sum) >> OUT_SHIFT); *sum &= (1<<OUT_SHIFT)-1; return av_clip(sum1, OUT_MIN, OUT_MAX); }
{ "code": [], "line_no": [] }
static inline int FUNC_0(int64_t *VAR_0) { int VAR_1; VAR_1 = (int)((*VAR_0) >> OUT_SHIFT); *VAR_0 &= (1<<OUT_SHIFT)-1; return av_clip(VAR_1, OUT_MIN, OUT_MAX); }
[ "static inline int FUNC_0(int64_t *VAR_0)\n{", "int VAR_1;", "VAR_1 = (int)((*VAR_0) >> OUT_SHIFT);", "*VAR_0 &= (1<<OUT_SHIFT)-1;", "return av_clip(VAR_1, OUT_MIN, OUT_MAX);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
13,404
bool virtio_is_big_endian(void) { #if defined(TARGET_WORDS_BIGENDIAN) return true; #else return false; #endif }
false
qemu
9807caccd605d09a72495637959568d690e10175
bool virtio_is_big_endian(void) { #if defined(TARGET_WORDS_BIGENDIAN) return true; #else return false; #endif }
{ "code": [], "line_no": [] }
bool FUNC_0(void) { #if defined(TARGET_WORDS_BIGENDIAN) return true; #else return false; #endif }
[ "bool FUNC_0(void)\n{", "#if defined(TARGET_WORDS_BIGENDIAN)\nreturn true;", "#else\nreturn false;", "#endif\n}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13, 15 ] ]
13,405
static int check_opt(const CmdArgs *cmd_args, const char *name, QDict *args) { if (!cmd_args->optional) { qerror_report(QERR_MISSING_PARAMETER, name); return -1; } if (cmd_args->type == '-') { /* handlers expect a value, they need to be changed */ qdict_put(args, name, qint_from_int(0)); } return 0; }
false
qemu
eb159d13ee36a9ef2a83e3ab66f1b2ae1cc2d9f1
static int check_opt(const CmdArgs *cmd_args, const char *name, QDict *args) { if (!cmd_args->optional) { qerror_report(QERR_MISSING_PARAMETER, name); return -1; } if (cmd_args->type == '-') { qdict_put(args, name, qint_from_int(0)); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(const CmdArgs *VAR_0, const char *VAR_1, QDict *VAR_2) { if (!VAR_0->optional) { qerror_report(QERR_MISSING_PARAMETER, VAR_1); return -1; } if (VAR_0->type == '-') { qdict_put(VAR_2, VAR_1, qint_from_int(0)); } return 0; }
[ "static int FUNC_0(const CmdArgs *VAR_0, const char *VAR_1, QDict *VAR_2)\n{", "if (!VAR_0->optional) {", "qerror_report(QERR_MISSING_PARAMETER, VAR_1);", "return -1;", "}", "if (VAR_0->type == '-') {", "qdict_put(VAR_2, VAR_1, qint_from_int(0));", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
13,406
static void i440fx_pcihost_get_pci_hole_end(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj); uint32_t value = s->pci_hole.end; visit_type_uint32(v, name, &value, errp); }
false
qemu
a0efbf16604770b9d805bcf210ec29942321134f
static void i440fx_pcihost_get_pci_hole_end(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj); uint32_t value = s->pci_hole.end; visit_type_uint32(v, name, &value, errp); }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0, Visitor *VAR_1, const char *VAR_2, void *VAR_3, Error **VAR_4) { I440FXState *s = I440FX_PCI_HOST_BRIDGE(VAR_0); uint32_t value = s->pci_hole.end; visit_type_uint32(VAR_1, VAR_2, &value, VAR_4); }
[ "static void FUNC_0(Object *VAR_0, Visitor *VAR_1,\nconst char *VAR_2, void *VAR_3,\nError **VAR_4)\n{", "I440FXState *s = I440FX_PCI_HOST_BRIDGE(VAR_0);", "uint32_t value = s->pci_hole.end;", "visit_type_uint32(VAR_1, VAR_2, &value, VAR_4);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ] ]
13,407
bool vring_enable_notification(VirtIODevice *vdev, Vring *vring) { if (vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX)) { vring_avail_event(&vring->vr) = vring->vr.avail->idx; } else { vring_clear_used_flags(vdev, vring, VRING_USED_F_NO_NOTIFY); } smp_mb(); /* ensure update is seen before reading avail_idx */ return !vring_more_avail(vdev, vring); }
false
qemu
ef546f1275f6563e8934dd5e338d29d9f9909ca6
bool vring_enable_notification(VirtIODevice *vdev, Vring *vring) { if (vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX)) { vring_avail_event(&vring->vr) = vring->vr.avail->idx; } else { vring_clear_used_flags(vdev, vring, VRING_USED_F_NO_NOTIFY); } smp_mb(); return !vring_more_avail(vdev, vring); }
{ "code": [], "line_no": [] }
bool FUNC_0(VirtIODevice *vdev, Vring *vring) { if (vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX)) { vring_avail_event(&vring->vr) = vring->vr.avail->idx; } else { vring_clear_used_flags(vdev, vring, VRING_USED_F_NO_NOTIFY); } smp_mb(); return !vring_more_avail(vdev, vring); }
[ "bool FUNC_0(VirtIODevice *vdev, Vring *vring)\n{", "if (vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX)) {", "vring_avail_event(&vring->vr) = vring->vr.avail->idx;", "} else {", "vring_clear_used_flags(vdev, vring, VRING_USED_F_NO_NOTIFY);", "}", "smp_mb();", "return !vring_more_avail(vdev, vring);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
13,408
void helper_fcmpu (uint64_t arg1, uint64_t arg2, uint32_t crfD) { CPU_DoubleU farg1, farg2; uint32_t ret = 0; farg1.ll = arg1; farg2.ll = arg2; if (unlikely(float64_is_nan(farg1.d) || float64_is_nan(farg2.d))) { ret = 0x01UL; } else if (float64_lt(farg1.d, farg2.d, &env->fp_status)) { ret = 0x08UL; } else if (!float64_le(farg1.d, farg2.d, &env->fp_status)) { ret = 0x04UL; } else { ret = 0x02UL; } env->fpscr &= ~(0x0F << FPSCR_FPRF); env->fpscr |= ret << FPSCR_FPRF; env->crf[crfD] = ret; if (unlikely(ret == 0x01UL && (float64_is_signaling_nan(farg1.d) || float64_is_signaling_nan(farg2.d)))) { /* sNaN comparison */ fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN); } }
false
qemu
185698715dfb18c82ad2a5dbc169908602d43e81
void helper_fcmpu (uint64_t arg1, uint64_t arg2, uint32_t crfD) { CPU_DoubleU farg1, farg2; uint32_t ret = 0; farg1.ll = arg1; farg2.ll = arg2; if (unlikely(float64_is_nan(farg1.d) || float64_is_nan(farg2.d))) { ret = 0x01UL; } else if (float64_lt(farg1.d, farg2.d, &env->fp_status)) { ret = 0x08UL; } else if (!float64_le(farg1.d, farg2.d, &env->fp_status)) { ret = 0x04UL; } else { ret = 0x02UL; } env->fpscr &= ~(0x0F << FPSCR_FPRF); env->fpscr |= ret << FPSCR_FPRF; env->crf[crfD] = ret; if (unlikely(ret == 0x01UL && (float64_is_signaling_nan(farg1.d) || float64_is_signaling_nan(farg2.d)))) { fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN); } }
{ "code": [], "line_no": [] }
void FUNC_0 (uint64_t VAR_0, uint64_t VAR_1, uint32_t VAR_2) { CPU_DoubleU farg1, farg2; uint32_t ret = 0; farg1.ll = VAR_0; farg2.ll = VAR_1; if (unlikely(float64_is_nan(farg1.d) || float64_is_nan(farg2.d))) { ret = 0x01UL; } else if (float64_lt(farg1.d, farg2.d, &env->fp_status)) { ret = 0x08UL; } else if (!float64_le(farg1.d, farg2.d, &env->fp_status)) { ret = 0x04UL; } else { ret = 0x02UL; } env->fpscr &= ~(0x0F << FPSCR_FPRF); env->fpscr |= ret << FPSCR_FPRF; env->crf[VAR_2] = ret; if (unlikely(ret == 0x01UL && (float64_is_signaling_nan(farg1.d) || float64_is_signaling_nan(farg2.d)))) { fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN); } }
[ "void FUNC_0 (uint64_t VAR_0, uint64_t VAR_1, uint32_t VAR_2)\n{", "CPU_DoubleU farg1, farg2;", "uint32_t ret = 0;", "farg1.ll = VAR_0;", "farg2.ll = VAR_1;", "if (unlikely(float64_is_nan(farg1.d) ||\nfloat64_is_nan(farg2.d))) {", "ret = 0x01UL;", "} else if (float64_lt(farg1.d, farg2.d, &env->fp_status)) {", "ret = 0x08UL;", "} else if (!float64_le(farg1.d, farg2.d, &env->fp_status)) {", "ret = 0x04UL;", "} else {", "ret = 0x02UL;", "}", "env->fpscr &= ~(0x0F << FPSCR_FPRF);", "env->fpscr |= ret << FPSCR_FPRF;", "env->crf[VAR_2] = ret;", "if (unlikely(ret == 0x01UL\n&& (float64_is_signaling_nan(farg1.d) ||\nfloat64_is_signaling_nan(farg2.d)))) {", "fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);", "}", "}" ]
[ 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 ], [ 51 ], [ 53 ], [ 55 ] ]
13,409
static void dec_fpu(DisasContext *dc) { if ((dc->tb_flags & MSR_EE_FLAG) && !(dc->env->pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK) && !((dc->env->pvr.regs[2] & PVR2_USE_FPU_MASK))) { tcg_gen_movi_tl(cpu_SR[SR_ESR], ESR_EC_ILLEGAL_OP); t_gen_raise_exception(dc, EXCP_HW_EXCP); return; } qemu_log ("unimplemented FPU insn pc=%x opc=%x\n", dc->pc, dc->opcode); dc->abort_at_next_insn = 1; }
false
qemu
97f90cbfe810bb153fc44bde732d9639610783bb
static void dec_fpu(DisasContext *dc) { if ((dc->tb_flags & MSR_EE_FLAG) && !(dc->env->pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK) && !((dc->env->pvr.regs[2] & PVR2_USE_FPU_MASK))) { tcg_gen_movi_tl(cpu_SR[SR_ESR], ESR_EC_ILLEGAL_OP); t_gen_raise_exception(dc, EXCP_HW_EXCP); return; } qemu_log ("unimplemented FPU insn pc=%x opc=%x\n", dc->pc, dc->opcode); dc->abort_at_next_insn = 1; }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0) { if ((VAR_0->tb_flags & MSR_EE_FLAG) && !(VAR_0->env->pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK) && !((VAR_0->env->pvr.regs[2] & PVR2_USE_FPU_MASK))) { tcg_gen_movi_tl(cpu_SR[SR_ESR], ESR_EC_ILLEGAL_OP); t_gen_raise_exception(VAR_0, EXCP_HW_EXCP); return; } qemu_log ("unimplemented FPU insn pc=%x opc=%x\n", VAR_0->pc, VAR_0->opcode); VAR_0->abort_at_next_insn = 1; }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "if ((VAR_0->tb_flags & MSR_EE_FLAG)\n&& !(VAR_0->env->pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK)\n&& !((VAR_0->env->pvr.regs[2] & PVR2_USE_FPU_MASK))) {", "tcg_gen_movi_tl(cpu_SR[SR_ESR], ESR_EC_ILLEGAL_OP);", "t_gen_raise_exception(VAR_0, EXCP_HW_EXCP);", "return;", "}", "qemu_log (\"unimplemented FPU insn pc=%x opc=%x\\n\", VAR_0->pc, VAR_0->opcode);", "VAR_0->abort_at_next_insn = 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ] ]
13,410
static void cdrom_pio_impl(int nblocks) { QPCIDevice *dev; QPCIBar bmdma_bar, ide_bar; FILE *fh; int patt_blocks = MAX(16, nblocks); size_t patt_len = ATAPI_BLOCK_SIZE * patt_blocks; char *pattern = g_malloc(patt_len); size_t rxsize = ATAPI_BLOCK_SIZE * nblocks; uint16_t *rx = g_malloc0(rxsize); int i, j; uint8_t data; uint16_t limit; /* Prepopulate the CDROM with an interesting pattern */ generate_pattern(pattern, patt_len, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); fwrite(pattern, ATAPI_BLOCK_SIZE, patt_blocks, fh); fclose(fh); ide_test_start("-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 " "-device ide-cd,drive=sr0,bus=ide.0", tmp_path); dev = get_pci_device(&bmdma_bar, &ide_bar); qtest_irq_intercept_in(global_qtest, "ioapic"); /* PACKET command on device 0 */ qpci_io_writeb(dev, ide_bar, reg_device, 0); qpci_io_writeb(dev, ide_bar, reg_lba_middle, BYTE_COUNT_LIMIT & 0xFF); qpci_io_writeb(dev, ide_bar, reg_lba_high, (BYTE_COUNT_LIMIT >> 8 & 0xFF)); qpci_io_writeb(dev, ide_bar, reg_command, CMD_PACKET); /* HP0: Check_Status_A State */ nsleep(400); data = ide_wait_clear(BSY); /* HP1: Send_Packet State */ assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); /* SCSI CDB (READ10) -- read n*2048 bytes from block 0 */ send_scsi_cdb_read10(dev, ide_bar, 0, nblocks); /* Read data back: occurs in bursts of 'BYTE_COUNT_LIMIT' bytes. * If BYTE_COUNT_LIMIT is odd, we transfer BYTE_COUNT_LIMIT - 1 bytes. * We allow an odd limit only when the remaining transfer size is * less than BYTE_COUNT_LIMIT. However, SCSI's read10 command can only * request n blocks, so our request size is always even. * For this reason, we assume there is never a hanging byte to fetch. */ g_assert(!(rxsize & 1)); limit = BYTE_COUNT_LIMIT & ~1; for (i = 0; i < DIV_ROUND_UP(rxsize, limit); i++) { size_t offset = i * (limit / 2); size_t rem = (rxsize / 2) - offset; /* HP3: INTRQ_Wait */ ide_wait_intr(IDE_PRIMARY_IRQ); /* HP2: Check_Status_B (and clear IRQ) */ data = ide_wait_clear(BSY); assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); /* HP4: Transfer_Data */ for (j = 0; j < MIN((limit / 2), rem); j++) { rx[offset + j] = cpu_to_le16(qpci_io_readw(dev, ide_bar, reg_data)); } } /* Check for final completion IRQ */ ide_wait_intr(IDE_PRIMARY_IRQ); /* Sanity check final state */ data = ide_wait_clear(DRQ); assert_bit_set(data, DRDY); assert_bit_clear(data, DRQ | ERR | DF | BSY); g_assert_cmpint(memcmp(pattern, rx, rxsize), ==, 0); g_free(pattern); g_free(rx); test_bmdma_teardown(); free_pci_device(dev); }
false
qemu
543f8f13e256a081dd820375e9575439b659ccd8
static void cdrom_pio_impl(int nblocks) { QPCIDevice *dev; QPCIBar bmdma_bar, ide_bar; FILE *fh; int patt_blocks = MAX(16, nblocks); size_t patt_len = ATAPI_BLOCK_SIZE * patt_blocks; char *pattern = g_malloc(patt_len); size_t rxsize = ATAPI_BLOCK_SIZE * nblocks; uint16_t *rx = g_malloc0(rxsize); int i, j; uint8_t data; uint16_t limit; generate_pattern(pattern, patt_len, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); fwrite(pattern, ATAPI_BLOCK_SIZE, patt_blocks, fh); fclose(fh); ide_test_start("-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 " "-device ide-cd,drive=sr0,bus=ide.0", tmp_path); dev = get_pci_device(&bmdma_bar, &ide_bar); qtest_irq_intercept_in(global_qtest, "ioapic"); qpci_io_writeb(dev, ide_bar, reg_device, 0); qpci_io_writeb(dev, ide_bar, reg_lba_middle, BYTE_COUNT_LIMIT & 0xFF); qpci_io_writeb(dev, ide_bar, reg_lba_high, (BYTE_COUNT_LIMIT >> 8 & 0xFF)); qpci_io_writeb(dev, ide_bar, reg_command, CMD_PACKET); nsleep(400); data = ide_wait_clear(BSY); assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); send_scsi_cdb_read10(dev, ide_bar, 0, nblocks); g_assert(!(rxsize & 1)); limit = BYTE_COUNT_LIMIT & ~1; for (i = 0; i < DIV_ROUND_UP(rxsize, limit); i++) { size_t offset = i * (limit / 2); size_t rem = (rxsize / 2) - offset; ide_wait_intr(IDE_PRIMARY_IRQ); data = ide_wait_clear(BSY); assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); for (j = 0; j < MIN((limit / 2), rem); j++) { rx[offset + j] = cpu_to_le16(qpci_io_readw(dev, ide_bar, reg_data)); } } ide_wait_intr(IDE_PRIMARY_IRQ); data = ide_wait_clear(DRQ); assert_bit_set(data, DRDY); assert_bit_clear(data, DRQ | ERR | DF | BSY); g_assert_cmpint(memcmp(pattern, rx, rxsize), ==, 0); g_free(pattern); g_free(rx); test_bmdma_teardown(); free_pci_device(dev); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0) { QPCIDevice *dev; QPCIBar bmdma_bar, ide_bar; FILE *fh; int VAR_1 = MAX(16, VAR_0); size_t patt_len = ATAPI_BLOCK_SIZE * VAR_1; char *VAR_2 = g_malloc(patt_len); size_t rxsize = ATAPI_BLOCK_SIZE * VAR_0; uint16_t *rx = g_malloc0(rxsize); int VAR_3, VAR_4; uint8_t data; uint16_t limit; generate_pattern(VAR_2, patt_len, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); fwrite(VAR_2, ATAPI_BLOCK_SIZE, VAR_1, fh); fclose(fh); ide_test_start("-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 " "-device ide-cd,drive=sr0,bus=ide.0", tmp_path); dev = get_pci_device(&bmdma_bar, &ide_bar); qtest_irq_intercept_in(global_qtest, "ioapic"); qpci_io_writeb(dev, ide_bar, reg_device, 0); qpci_io_writeb(dev, ide_bar, reg_lba_middle, BYTE_COUNT_LIMIT & 0xFF); qpci_io_writeb(dev, ide_bar, reg_lba_high, (BYTE_COUNT_LIMIT >> 8 & 0xFF)); qpci_io_writeb(dev, ide_bar, reg_command, CMD_PACKET); nsleep(400); data = ide_wait_clear(BSY); assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); send_scsi_cdb_read10(dev, ide_bar, 0, VAR_0); g_assert(!(rxsize & 1)); limit = BYTE_COUNT_LIMIT & ~1; for (VAR_3 = 0; VAR_3 < DIV_ROUND_UP(rxsize, limit); VAR_3++) { size_t offset = VAR_3 * (limit / 2); size_t rem = (rxsize / 2) - offset; ide_wait_intr(IDE_PRIMARY_IRQ); data = ide_wait_clear(BSY); assert_bit_set(data, DRQ | DRDY); assert_bit_clear(data, ERR | DF | BSY); for (VAR_4 = 0; VAR_4 < MIN((limit / 2), rem); VAR_4++) { rx[offset + VAR_4] = cpu_to_le16(qpci_io_readw(dev, ide_bar, reg_data)); } } ide_wait_intr(IDE_PRIMARY_IRQ); data = ide_wait_clear(DRQ); assert_bit_set(data, DRDY); assert_bit_clear(data, DRQ | ERR | DF | BSY); g_assert_cmpint(memcmp(VAR_2, rx, rxsize), ==, 0); g_free(VAR_2); g_free(rx); test_bmdma_teardown(); free_pci_device(dev); }
[ "static void FUNC_0(int VAR_0)\n{", "QPCIDevice *dev;", "QPCIBar bmdma_bar, ide_bar;", "FILE *fh;", "int VAR_1 = MAX(16, VAR_0);", "size_t patt_len = ATAPI_BLOCK_SIZE * VAR_1;", "char *VAR_2 = g_malloc(patt_len);", "size_t rxsize = ATAPI_BLOCK_SIZE * VAR_0;", "uint16_t *rx = g_malloc0(rxsize);", "int VAR_3, VAR_4;", "uint8_t data;", "uint16_t limit;", "generate_pattern(VAR_2, patt_len, ATAPI_BLOCK_SIZE);", "fh = fopen(tmp_path, \"w+\");", "fwrite(VAR_2, ATAPI_BLOCK_SIZE, VAR_1, fh);", "fclose(fh);", "ide_test_start(\"-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 \"\n\"-device ide-cd,drive=sr0,bus=ide.0\", tmp_path);", "dev = get_pci_device(&bmdma_bar, &ide_bar);", "qtest_irq_intercept_in(global_qtest, \"ioapic\");", "qpci_io_writeb(dev, ide_bar, reg_device, 0);", "qpci_io_writeb(dev, ide_bar, reg_lba_middle, BYTE_COUNT_LIMIT & 0xFF);", "qpci_io_writeb(dev, ide_bar, reg_lba_high, (BYTE_COUNT_LIMIT >> 8 & 0xFF));", "qpci_io_writeb(dev, ide_bar, reg_command, CMD_PACKET);", "nsleep(400);", "data = ide_wait_clear(BSY);", "assert_bit_set(data, DRQ | DRDY);", "assert_bit_clear(data, ERR | DF | BSY);", "send_scsi_cdb_read10(dev, ide_bar, 0, VAR_0);", "g_assert(!(rxsize & 1));", "limit = BYTE_COUNT_LIMIT & ~1;", "for (VAR_3 = 0; VAR_3 < DIV_ROUND_UP(rxsize, limit); VAR_3++) {", "size_t offset = VAR_3 * (limit / 2);", "size_t rem = (rxsize / 2) - offset;", "ide_wait_intr(IDE_PRIMARY_IRQ);", "data = ide_wait_clear(BSY);", "assert_bit_set(data, DRQ | DRDY);", "assert_bit_clear(data, ERR | DF | BSY);", "for (VAR_4 = 0; VAR_4 < MIN((limit / 2), rem); VAR_4++) {", "rx[offset + VAR_4] = cpu_to_le16(qpci_io_readw(dev, ide_bar,\nreg_data));", "}", "}", "ide_wait_intr(IDE_PRIMARY_IRQ);", "data = ide_wait_clear(DRQ);", "assert_bit_set(data, DRDY);", "assert_bit_clear(data, DRQ | ERR | DF | BSY);", "g_assert_cmpint(memcmp(VAR_2, rx, rxsize), ==, 0);", "g_free(VAR_2);", "g_free(rx);", "test_bmdma_teardown();", "free_pci_device(dev);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 77 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 107 ], [ 113 ], [ 115 ], [ 117 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 137 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ] ]
13,411
static uint32_t m5206_mbar_readw(void *opaque, target_phys_addr_t offset) { m5206_mbar_state *s = (m5206_mbar_state *)opaque; int width; offset &= 0x3ff; if (offset >= 0x200) { hw_error("Bad MBAR read offset 0x%x", (int)offset); } width = m5206_mbar_width[offset >> 2]; if (width > 2) { uint32_t val; val = m5206_mbar_readl(opaque, offset & ~3); if ((offset & 3) == 0) val >>= 16; return val & 0xffff; } else if (width < 2) { uint16_t val; val = m5206_mbar_readb(opaque, offset) << 8; val |= m5206_mbar_readb(opaque, offset + 1); return val; } return m5206_mbar_read(s, offset, 2); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint32_t m5206_mbar_readw(void *opaque, target_phys_addr_t offset) { m5206_mbar_state *s = (m5206_mbar_state *)opaque; int width; offset &= 0x3ff; if (offset >= 0x200) { hw_error("Bad MBAR read offset 0x%x", (int)offset); } width = m5206_mbar_width[offset >> 2]; if (width > 2) { uint32_t val; val = m5206_mbar_readl(opaque, offset & ~3); if ((offset & 3) == 0) val >>= 16; return val & 0xffff; } else if (width < 2) { uint16_t val; val = m5206_mbar_readb(opaque, offset) << 8; val |= m5206_mbar_readb(opaque, offset + 1); return val; } return m5206_mbar_read(s, offset, 2); }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(void *opaque, target_phys_addr_t offset) { m5206_mbar_state *s = (m5206_mbar_state *)opaque; int VAR_0; offset &= 0x3ff; if (offset >= 0x200) { hw_error("Bad MBAR read offset 0x%x", (int)offset); } VAR_0 = m5206_mbar_width[offset >> 2]; if (VAR_0 > 2) { uint32_t val; val = m5206_mbar_readl(opaque, offset & ~3); if ((offset & 3) == 0) val >>= 16; return val & 0xffff; } else if (VAR_0 < 2) { uint16_t val; val = m5206_mbar_readb(opaque, offset) << 8; val |= m5206_mbar_readb(opaque, offset + 1); return val; } return m5206_mbar_read(s, offset, 2); }
[ "static uint32_t FUNC_0(void *opaque, target_phys_addr_t offset)\n{", "m5206_mbar_state *s = (m5206_mbar_state *)opaque;", "int VAR_0;", "offset &= 0x3ff;", "if (offset >= 0x200) {", "hw_error(\"Bad MBAR read offset 0x%x\", (int)offset);", "}", "VAR_0 = m5206_mbar_width[offset >> 2];", "if (VAR_0 > 2) {", "uint32_t val;", "val = m5206_mbar_readl(opaque, offset & ~3);", "if ((offset & 3) == 0)\nval >>= 16;", "return val & 0xffff;", "} else if (VAR_0 < 2) {", "uint16_t val;", "val = m5206_mbar_readb(opaque, offset) << 8;", "val |= m5206_mbar_readb(opaque, offset + 1);", "return val;", "}", "return m5206_mbar_read(s, offset, 2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
13,412
static void test_visitor_out_bool(TestOutputVisitorData *data, const void *unused) { bool value = true; QObject *obj; visit_type_bool(data->ov, NULL, &value, &error_abort); obj = visitor_get(data); g_assert(qobject_type(obj) == QTYPE_QBOOL); g_assert(qbool_get_bool(qobject_to_qbool(obj)) == value); }
false
qemu
b3db211f3c80bb996a704d665fe275619f728bd4
static void test_visitor_out_bool(TestOutputVisitorData *data, const void *unused) { bool value = true; QObject *obj; visit_type_bool(data->ov, NULL, &value, &error_abort); obj = visitor_get(data); g_assert(qobject_type(obj) == QTYPE_QBOOL); g_assert(qbool_get_bool(qobject_to_qbool(obj)) == value); }
{ "code": [], "line_no": [] }
static void FUNC_0(TestOutputVisitorData *VAR_0, const void *VAR_1) { bool value = true; QObject *obj; visit_type_bool(VAR_0->ov, NULL, &value, &error_abort); obj = visitor_get(VAR_0); g_assert(qobject_type(obj) == QTYPE_QBOOL); g_assert(qbool_get_bool(qobject_to_qbool(obj)) == value); }
[ "static void FUNC_0(TestOutputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "bool value = true;", "QObject *obj;", "visit_type_bool(VAR_0->ov, NULL, &value, &error_abort);", "obj = visitor_get(VAR_0);", "g_assert(qobject_type(obj) == QTYPE_QBOOL);", "g_assert(qbool_get_bool(qobject_to_qbool(obj)) == value);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
13,413
static void do_dcbz(target_ulong addr, int dcache_line_size) { addr &= ~(dcache_line_size - 1); int i; for (i = 0 ; i < dcache_line_size ; i += 4) { stl(addr + i , 0); } if (env->reserve == addr) env->reserve = (target_ulong)-1ULL; }
false
qemu
18b21a2f83a26c3d6a9e7f0bdc4e8eb2b177e8f6
static void do_dcbz(target_ulong addr, int dcache_line_size) { addr &= ~(dcache_line_size - 1); int i; for (i = 0 ; i < dcache_line_size ; i += 4) { stl(addr + i , 0); } if (env->reserve == addr) env->reserve = (target_ulong)-1ULL; }
{ "code": [], "line_no": [] }
static void FUNC_0(target_ulong VAR_0, int VAR_1) { VAR_0 &= ~(VAR_1 - 1); int VAR_2; for (VAR_2 = 0 ; VAR_2 < VAR_1 ; VAR_2 += 4) { stl(VAR_0 + VAR_2 , 0); } if (env->reserve == VAR_0) env->reserve = (target_ulong)-1ULL; }
[ "static void FUNC_0(target_ulong VAR_0, int VAR_1)\n{", "VAR_0 &= ~(VAR_1 - 1);", "int VAR_2;", "for (VAR_2 = 0 ; VAR_2 < VAR_1 ; VAR_2 += 4) {", "stl(VAR_0 + VAR_2 , 0);", "}", "if (env->reserve == VAR_0)\nenv->reserve = (target_ulong)-1ULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ] ]
13,414
static void render_slice(Vp3DecodeContext *s, int slice) { int x, y; int m, n; int i; /* indicates current fragment */ int16_t *dequantizer; DCTELEM __align16 block[64]; unsigned char *output_plane; unsigned char *last_plane; unsigned char *golden_plane; int stride; int motion_x = 0xdeadbeef, motion_y = 0xdeadbeef; int upper_motion_limit, lower_motion_limit; int motion_halfpel_index; uint8_t *motion_source; int plane; int plane_width; int plane_height; int slice_height; int current_macroblock_entry = slice * s->macroblock_width * 6; if (slice >= s->macroblock_height) return; for (plane = 0; plane < 3; plane++) { /* set up plane-specific parameters */ if (plane == 0) { output_plane = s->current_frame.data[0]; last_plane = s->last_frame.data[0]; golden_plane = s->golden_frame.data[0]; stride = s->current_frame.linesize[0]; if (!s->flipped_image) stride = -stride; upper_motion_limit = 7 * s->current_frame.linesize[0]; lower_motion_limit = s->height * s->current_frame.linesize[0] + s->width - 8; y = slice * FRAGMENT_PIXELS * 2; plane_width = s->width; plane_height = s->height; slice_height = y + FRAGMENT_PIXELS * 2; i = s->macroblock_fragments[current_macroblock_entry + 0]; } else if (plane == 1) { output_plane = s->current_frame.data[1]; last_plane = s->last_frame.data[1]; golden_plane = s->golden_frame.data[1]; stride = s->current_frame.linesize[1]; if (!s->flipped_image) stride = -stride; upper_motion_limit = 7 * s->current_frame.linesize[1]; lower_motion_limit = (s->height / 2) * s->current_frame.linesize[1] + (s->width / 2) - 8; y = slice * FRAGMENT_PIXELS; plane_width = s->width / 2; plane_height = s->height / 2; slice_height = y + FRAGMENT_PIXELS; i = s->macroblock_fragments[current_macroblock_entry + 4]; } else { output_plane = s->current_frame.data[2]; last_plane = s->last_frame.data[2]; golden_plane = s->golden_frame.data[2]; stride = s->current_frame.linesize[2]; if (!s->flipped_image) stride = -stride; upper_motion_limit = 7 * s->current_frame.linesize[2]; lower_motion_limit = (s->height / 2) * s->current_frame.linesize[2] + (s->width / 2) - 8; y = slice * FRAGMENT_PIXELS; plane_width = s->width / 2; plane_height = s->height / 2; slice_height = y + FRAGMENT_PIXELS; i = s->macroblock_fragments[current_macroblock_entry + 5]; } if(ABS(stride) > 2048) return; //various tables are fixed size /* for each fragment row in the slice (both of them)... */ for (; y < slice_height; y += 8) { /* for each fragment in a row... */ for (x = 0; x < plane_width; x += 8, i++) { if ((i < 0) || (i >= s->fragment_count)) { av_log(s->avctx, AV_LOG_ERROR, " vp3:render_slice(): bad fragment number (%d)\n", i); return; } /* transform if this block was coded */ if ((s->all_fragments[i].coding_method != MODE_COPY) && !((s->avctx->flags & CODEC_FLAG_GRAY) && plane)) { if ((s->all_fragments[i].coding_method == MODE_USING_GOLDEN) || (s->all_fragments[i].coding_method == MODE_GOLDEN_MV)) motion_source= golden_plane; else motion_source= last_plane; motion_source += s->all_fragments[i].first_pixel; motion_halfpel_index = 0; /* sort out the motion vector if this fragment is coded * using a motion vector method */ if ((s->all_fragments[i].coding_method > MODE_INTRA) && (s->all_fragments[i].coding_method != MODE_USING_GOLDEN)) { int src_x, src_y; motion_x = s->all_fragments[i].motion_x; motion_y = s->all_fragments[i].motion_y; if(plane){ motion_x= (motion_x>>1) | (motion_x&1); motion_y= (motion_y>>1) | (motion_y&1); } src_x= (motion_x>>1) + x; src_y= (motion_y>>1) + y; if ((motion_x == 127) || (motion_y == 127)) av_log(s->avctx, AV_LOG_ERROR, " help! got invalid motion vector! (%X, %X)\n", motion_x, motion_y); motion_halfpel_index = motion_x & 0x01; motion_source += (motion_x >> 1); motion_halfpel_index |= (motion_y & 0x01) << 1; motion_source += ((motion_y >> 1) * stride); if(src_x<0 || src_y<0 || src_x + 9 >= plane_width || src_y + 9 >= plane_height){ uint8_t *temp= s->edge_emu_buffer; if(stride<0) temp -= 9*stride; else temp += 9*stride; ff_emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height); motion_source= temp; } } /* first, take care of copying a block from either the * previous or the golden frame */ if (s->all_fragments[i].coding_method != MODE_INTRA) { /* Note, it is possible to implement all MC cases with put_no_rnd_pixels_l2 which would look more like the VP3 source but this would be slower as put_no_rnd_pixels_tab is better optimzed */ if(motion_halfpel_index != 3){ s->dsp.put_no_rnd_pixels_tab[1][motion_halfpel_index]( output_plane + s->all_fragments[i].first_pixel, motion_source, stride, 8); }else{ int d= (motion_x ^ motion_y)>>31; // d is 0 if motion_x and _y have the same sign, else -1 s->dsp.put_no_rnd_pixels_l2[1]( output_plane + s->all_fragments[i].first_pixel, motion_source - d, motion_source + stride + 1 + d, stride, 8); } dequantizer = s->inter_dequant; }else{ if (plane == 0) dequantizer = s->intra_y_dequant; else dequantizer = s->intra_c_dequant; } /* dequantize the DCT coefficients */ debug_idct("fragment %d, coding mode %d, DC = %d, dequant = %d:\n", i, s->all_fragments[i].coding_method, DC_COEFF(i), dequantizer[0]); if(s->avctx->idct_algo==FF_IDCT_VP3){ Coeff *coeff= s->coeffs + i; memset(block, 0, sizeof(block)); while(coeff->next){ block[coeff->index]= coeff->coeff * dequantizer[coeff->index]; coeff= coeff->next; } }else{ Coeff *coeff= s->coeffs + i; memset(block, 0, sizeof(block)); while(coeff->next){ block[coeff->index]= (coeff->coeff * dequantizer[coeff->index] + 2)>>2; coeff= coeff->next; } } /* invert DCT and place (or add) in final output */ if (s->all_fragments[i].coding_method == MODE_INTRA) { if(s->avctx->idct_algo!=FF_IDCT_VP3) block[0] += 128<<3; s->dsp.idct_put( output_plane + s->all_fragments[i].first_pixel, stride, block); } else { s->dsp.idct_add( output_plane + s->all_fragments[i].first_pixel, stride, block); } debug_idct("block after idct_%s():\n", (s->all_fragments[i].coding_method == MODE_INTRA)? "put" : "add"); for (m = 0; m < 8; m++) { for (n = 0; n < 8; n++) { debug_idct(" %3d", *(output_plane + s->all_fragments[i].first_pixel + (m * stride + n))); } debug_idct("\n"); } debug_idct("\n"); } else { /* copy directly from the previous frame */ s->dsp.put_pixels_tab[1][0]( output_plane + s->all_fragments[i].first_pixel, last_plane + s->all_fragments[i].first_pixel, stride, 8); } } } } /* future loop filter logic goes here... */ /* algorithm: * if (slice != 0) * run filter on 1st row of Y slice * run filter on U slice * run filter on V slice * run filter on 2nd row of Y slice */ /* this looks like a good place for slice dispatch... */ /* algorithm: * if (slice > 0) * dispatch (slice - 1); * if (slice == s->macroblock_height - 1) * dispatch (slice); // handle last slice */ emms_c(); }
false
FFmpeg
f44b08a5a0ee46b52a9a608cbf2d075eab93db61
static void render_slice(Vp3DecodeContext *s, int slice) { int x, y; int m, n; int i; int16_t *dequantizer; DCTELEM __align16 block[64]; unsigned char *output_plane; unsigned char *last_plane; unsigned char *golden_plane; int stride; int motion_x = 0xdeadbeef, motion_y = 0xdeadbeef; int upper_motion_limit, lower_motion_limit; int motion_halfpel_index; uint8_t *motion_source; int plane; int plane_width; int plane_height; int slice_height; int current_macroblock_entry = slice * s->macroblock_width * 6; if (slice >= s->macroblock_height) return; for (plane = 0; plane < 3; plane++) { if (plane == 0) { output_plane = s->current_frame.data[0]; last_plane = s->last_frame.data[0]; golden_plane = s->golden_frame.data[0]; stride = s->current_frame.linesize[0]; if (!s->flipped_image) stride = -stride; upper_motion_limit = 7 * s->current_frame.linesize[0]; lower_motion_limit = s->height * s->current_frame.linesize[0] + s->width - 8; y = slice * FRAGMENT_PIXELS * 2; plane_width = s->width; plane_height = s->height; slice_height = y + FRAGMENT_PIXELS * 2; i = s->macroblock_fragments[current_macroblock_entry + 0]; } else if (plane == 1) { output_plane = s->current_frame.data[1]; last_plane = s->last_frame.data[1]; golden_plane = s->golden_frame.data[1]; stride = s->current_frame.linesize[1]; if (!s->flipped_image) stride = -stride; upper_motion_limit = 7 * s->current_frame.linesize[1]; lower_motion_limit = (s->height / 2) * s->current_frame.linesize[1] + (s->width / 2) - 8; y = slice * FRAGMENT_PIXELS; plane_width = s->width / 2; plane_height = s->height / 2; slice_height = y + FRAGMENT_PIXELS; i = s->macroblock_fragments[current_macroblock_entry + 4]; } else { output_plane = s->current_frame.data[2]; last_plane = s->last_frame.data[2]; golden_plane = s->golden_frame.data[2]; stride = s->current_frame.linesize[2]; if (!s->flipped_image) stride = -stride; upper_motion_limit = 7 * s->current_frame.linesize[2]; lower_motion_limit = (s->height / 2) * s->current_frame.linesize[2] + (s->width / 2) - 8; y = slice * FRAGMENT_PIXELS; plane_width = s->width / 2; plane_height = s->height / 2; slice_height = y + FRAGMENT_PIXELS; i = s->macroblock_fragments[current_macroblock_entry + 5]; } if(ABS(stride) > 2048) return; for (; y < slice_height; y += 8) { for (x = 0; x < plane_width; x += 8, i++) { if ((i < 0) || (i >= s->fragment_count)) { av_log(s->avctx, AV_LOG_ERROR, " vp3:render_slice(): bad fragment number (%d)\n", i); return; } if ((s->all_fragments[i].coding_method != MODE_COPY) && !((s->avctx->flags & CODEC_FLAG_GRAY) && plane)) { if ((s->all_fragments[i].coding_method == MODE_USING_GOLDEN) || (s->all_fragments[i].coding_method == MODE_GOLDEN_MV)) motion_source= golden_plane; else motion_source= last_plane; motion_source += s->all_fragments[i].first_pixel; motion_halfpel_index = 0; if ((s->all_fragments[i].coding_method > MODE_INTRA) && (s->all_fragments[i].coding_method != MODE_USING_GOLDEN)) { int src_x, src_y; motion_x = s->all_fragments[i].motion_x; motion_y = s->all_fragments[i].motion_y; if(plane){ motion_x= (motion_x>>1) | (motion_x&1); motion_y= (motion_y>>1) | (motion_y&1); } src_x= (motion_x>>1) + x; src_y= (motion_y>>1) + y; if ((motion_x == 127) || (motion_y == 127)) av_log(s->avctx, AV_LOG_ERROR, " help! got invalid motion vector! (%X, %X)\n", motion_x, motion_y); motion_halfpel_index = motion_x & 0x01; motion_source += (motion_x >> 1); motion_halfpel_index |= (motion_y & 0x01) << 1; motion_source += ((motion_y >> 1) * stride); if(src_x<0 || src_y<0 || src_x + 9 >= plane_width || src_y + 9 >= plane_height){ uint8_t *temp= s->edge_emu_buffer; if(stride<0) temp -= 9*stride; else temp += 9*stride; ff_emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height); motion_source= temp; } } if (s->all_fragments[i].coding_method != MODE_INTRA) { if(motion_halfpel_index != 3){ s->dsp.put_no_rnd_pixels_tab[1][motion_halfpel_index]( output_plane + s->all_fragments[i].first_pixel, motion_source, stride, 8); }else{ int d= (motion_x ^ motion_y)>>31; s->dsp.put_no_rnd_pixels_l2[1]( output_plane + s->all_fragments[i].first_pixel, motion_source - d, motion_source + stride + 1 + d, stride, 8); } dequantizer = s->inter_dequant; }else{ if (plane == 0) dequantizer = s->intra_y_dequant; else dequantizer = s->intra_c_dequant; } debug_idct("fragment %d, coding mode %d, DC = %d, dequant = %d:\n", i, s->all_fragments[i].coding_method, DC_COEFF(i), dequantizer[0]); if(s->avctx->idct_algo==FF_IDCT_VP3){ Coeff *coeff= s->coeffs + i; memset(block, 0, sizeof(block)); while(coeff->next){ block[coeff->index]= coeff->coeff * dequantizer[coeff->index]; coeff= coeff->next; } }else{ Coeff *coeff= s->coeffs + i; memset(block, 0, sizeof(block)); while(coeff->next){ block[coeff->index]= (coeff->coeff * dequantizer[coeff->index] + 2)>>2; coeff= coeff->next; } } if (s->all_fragments[i].coding_method == MODE_INTRA) { if(s->avctx->idct_algo!=FF_IDCT_VP3) block[0] += 128<<3; s->dsp.idct_put( output_plane + s->all_fragments[i].first_pixel, stride, block); } else { s->dsp.idct_add( output_plane + s->all_fragments[i].first_pixel, stride, block); } debug_idct("block after idct_%s():\n", (s->all_fragments[i].coding_method == MODE_INTRA)? "put" : "add"); for (m = 0; m < 8; m++) { for (n = 0; n < 8; n++) { debug_idct(" %3d", *(output_plane + s->all_fragments[i].first_pixel + (m * stride + n))); } debug_idct("\n"); } debug_idct("\n"); } else { s->dsp.put_pixels_tab[1][0]( output_plane + s->all_fragments[i].first_pixel, last_plane + s->all_fragments[i].first_pixel, stride, 8); } } } } emms_c(); }
{ "code": [], "line_no": [] }
static void FUNC_0(Vp3DecodeContext *VAR_0, int VAR_1) { int VAR_2, VAR_3; int VAR_4, VAR_5; int VAR_6; int16_t *dequantizer; DCTELEM __align16 block[64]; unsigned char *VAR_7; unsigned char *VAR_8; unsigned char *VAR_9; int VAR_10; int VAR_11 = 0xdeadbeef, VAR_12 = 0xdeadbeef; int VAR_13, VAR_14; int VAR_15; uint8_t *motion_source; int VAR_16; int VAR_17; int VAR_18; int VAR_19; int VAR_20 = VAR_1 * VAR_0->macroblock_width * 6; if (VAR_1 >= VAR_0->macroblock_height) return; for (VAR_16 = 0; VAR_16 < 3; VAR_16++) { if (VAR_16 == 0) { VAR_7 = VAR_0->current_frame.data[0]; VAR_8 = VAR_0->last_frame.data[0]; VAR_9 = VAR_0->golden_frame.data[0]; VAR_10 = VAR_0->current_frame.linesize[0]; if (!VAR_0->flipped_image) VAR_10 = -VAR_10; VAR_13 = 7 * VAR_0->current_frame.linesize[0]; VAR_14 = VAR_0->height * VAR_0->current_frame.linesize[0] + VAR_0->width - 8; VAR_3 = VAR_1 * FRAGMENT_PIXELS * 2; VAR_17 = VAR_0->width; VAR_18 = VAR_0->height; VAR_19 = VAR_3 + FRAGMENT_PIXELS * 2; VAR_6 = VAR_0->macroblock_fragments[VAR_20 + 0]; } else if (VAR_16 == 1) { VAR_7 = VAR_0->current_frame.data[1]; VAR_8 = VAR_0->last_frame.data[1]; VAR_9 = VAR_0->golden_frame.data[1]; VAR_10 = VAR_0->current_frame.linesize[1]; if (!VAR_0->flipped_image) VAR_10 = -VAR_10; VAR_13 = 7 * VAR_0->current_frame.linesize[1]; VAR_14 = (VAR_0->height / 2) * VAR_0->current_frame.linesize[1] + (VAR_0->width / 2) - 8; VAR_3 = VAR_1 * FRAGMENT_PIXELS; VAR_17 = VAR_0->width / 2; VAR_18 = VAR_0->height / 2; VAR_19 = VAR_3 + FRAGMENT_PIXELS; VAR_6 = VAR_0->macroblock_fragments[VAR_20 + 4]; } else { VAR_7 = VAR_0->current_frame.data[2]; VAR_8 = VAR_0->last_frame.data[2]; VAR_9 = VAR_0->golden_frame.data[2]; VAR_10 = VAR_0->current_frame.linesize[2]; if (!VAR_0->flipped_image) VAR_10 = -VAR_10; VAR_13 = 7 * VAR_0->current_frame.linesize[2]; VAR_14 = (VAR_0->height / 2) * VAR_0->current_frame.linesize[2] + (VAR_0->width / 2) - 8; VAR_3 = VAR_1 * FRAGMENT_PIXELS; VAR_17 = VAR_0->width / 2; VAR_18 = VAR_0->height / 2; VAR_19 = VAR_3 + FRAGMENT_PIXELS; VAR_6 = VAR_0->macroblock_fragments[VAR_20 + 5]; } if(ABS(VAR_10) > 2048) return; for (; VAR_3 < VAR_19; VAR_3 += 8) { for (VAR_2 = 0; VAR_2 < VAR_17; VAR_2 += 8, VAR_6++) { if ((VAR_6 < 0) || (VAR_6 >= VAR_0->fragment_count)) { av_log(VAR_0->avctx, AV_LOG_ERROR, " vp3:FUNC_0(): bad fragment number (%VAR_23)\VAR_5", VAR_6); return; } if ((VAR_0->all_fragments[VAR_6].coding_method != MODE_COPY) && !((VAR_0->avctx->flags & CODEC_FLAG_GRAY) && VAR_16)) { if ((VAR_0->all_fragments[VAR_6].coding_method == MODE_USING_GOLDEN) || (VAR_0->all_fragments[VAR_6].coding_method == MODE_GOLDEN_MV)) motion_source= VAR_9; else motion_source= VAR_8; motion_source += VAR_0->all_fragments[VAR_6].first_pixel; VAR_15 = 0; if ((VAR_0->all_fragments[VAR_6].coding_method > MODE_INTRA) && (VAR_0->all_fragments[VAR_6].coding_method != MODE_USING_GOLDEN)) { int VAR_21, VAR_22; VAR_11 = VAR_0->all_fragments[VAR_6].VAR_11; VAR_12 = VAR_0->all_fragments[VAR_6].VAR_12; if(VAR_16){ VAR_11= (VAR_11>>1) | (VAR_11&1); VAR_12= (VAR_12>>1) | (VAR_12&1); } VAR_21= (VAR_11>>1) + VAR_2; VAR_22= (VAR_12>>1) + VAR_3; if ((VAR_11 == 127) || (VAR_12 == 127)) av_log(VAR_0->avctx, AV_LOG_ERROR, " help! got invalid motion vector! (%X, %X)\VAR_5", VAR_11, VAR_12); VAR_15 = VAR_11 & 0x01; motion_source += (VAR_11 >> 1); VAR_15 |= (VAR_12 & 0x01) << 1; motion_source += ((VAR_12 >> 1) * VAR_10); if(VAR_21<0 || VAR_22<0 || VAR_21 + 9 >= VAR_17 || VAR_22 + 9 >= VAR_18){ uint8_t *temp= VAR_0->edge_emu_buffer; if(VAR_10<0) temp -= 9*VAR_10; else temp += 9*VAR_10; ff_emulated_edge_mc(temp, motion_source, VAR_10, 9, 9, VAR_21, VAR_22, VAR_17, VAR_18); motion_source= temp; } } if (VAR_0->all_fragments[VAR_6].coding_method != MODE_INTRA) { if(VAR_15 != 3){ VAR_0->dsp.put_no_rnd_pixels_tab[1][VAR_15]( VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel, motion_source, VAR_10, 8); }else{ int VAR_23= (VAR_11 ^ VAR_12)>>31; VAR_0->dsp.put_no_rnd_pixels_l2[1]( VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel, motion_source - VAR_23, motion_source + VAR_10 + 1 + VAR_23, VAR_10, 8); } dequantizer = VAR_0->inter_dequant; }else{ if (VAR_16 == 0) dequantizer = VAR_0->intra_y_dequant; else dequantizer = VAR_0->intra_c_dequant; } debug_idct("fragment %VAR_23, coding mode %VAR_23, DC = %VAR_23, dequant = %VAR_23:\VAR_5", VAR_6, VAR_0->all_fragments[VAR_6].coding_method, DC_COEFF(VAR_6), dequantizer[0]); if(VAR_0->avctx->idct_algo==FF_IDCT_VP3){ Coeff *coeff= VAR_0->coeffs + VAR_6; memset(block, 0, sizeof(block)); while(coeff->next){ block[coeff->index]= coeff->coeff * dequantizer[coeff->index]; coeff= coeff->next; } }else{ Coeff *coeff= VAR_0->coeffs + VAR_6; memset(block, 0, sizeof(block)); while(coeff->next){ block[coeff->index]= (coeff->coeff * dequantizer[coeff->index] + 2)>>2; coeff= coeff->next; } } if (VAR_0->all_fragments[VAR_6].coding_method == MODE_INTRA) { if(VAR_0->avctx->idct_algo!=FF_IDCT_VP3) block[0] += 128<<3; VAR_0->dsp.idct_put( VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel, VAR_10, block); } else { VAR_0->dsp.idct_add( VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel, VAR_10, block); } debug_idct("block after idct_%VAR_0():\VAR_5", (VAR_0->all_fragments[VAR_6].coding_method == MODE_INTRA)? "put" : "add"); for (VAR_4 = 0; VAR_4 < 8; VAR_4++) { for (VAR_5 = 0; VAR_5 < 8; VAR_5++) { debug_idct(" %3d", *(VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel + (VAR_4 * VAR_10 + VAR_5))); } debug_idct("\VAR_5"); } debug_idct("\VAR_5"); } else { VAR_0->dsp.put_pixels_tab[1][0]( VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel, VAR_8 + VAR_0->all_fragments[VAR_6].first_pixel, VAR_10, 8); } } } } emms_c(); }
[ "static void FUNC_0(Vp3DecodeContext *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3;", "int VAR_4, VAR_5;", "int VAR_6;", "int16_t *dequantizer;", "DCTELEM __align16 block[64];", "unsigned char *VAR_7;", "unsigned char *VAR_8;", "unsigned char *VAR_9;", "int VAR_10;", "int VAR_11 = 0xdeadbeef, VAR_12 = 0xdeadbeef;", "int VAR_13, VAR_14;", "int VAR_15;", "uint8_t *motion_source;", "int VAR_16;", "int VAR_17;", "int VAR_18;", "int VAR_19;", "int VAR_20 = VAR_1 * VAR_0->macroblock_width * 6;", "if (VAR_1 >= VAR_0->macroblock_height)\nreturn;", "for (VAR_16 = 0; VAR_16 < 3; VAR_16++) {", "if (VAR_16 == 0) {", "VAR_7 = VAR_0->current_frame.data[0];", "VAR_8 = VAR_0->last_frame.data[0];", "VAR_9 = VAR_0->golden_frame.data[0];", "VAR_10 = VAR_0->current_frame.linesize[0];", "if (!VAR_0->flipped_image) VAR_10 = -VAR_10;", "VAR_13 = 7 * VAR_0->current_frame.linesize[0];", "VAR_14 = VAR_0->height * VAR_0->current_frame.linesize[0] + VAR_0->width - 8;", "VAR_3 = VAR_1 * FRAGMENT_PIXELS * 2;", "VAR_17 = VAR_0->width;", "VAR_18 = VAR_0->height;", "VAR_19 = VAR_3 + FRAGMENT_PIXELS * 2;", "VAR_6 = VAR_0->macroblock_fragments[VAR_20 + 0];", "} else if (VAR_16 == 1) {", "VAR_7 = VAR_0->current_frame.data[1];", "VAR_8 = VAR_0->last_frame.data[1];", "VAR_9 = VAR_0->golden_frame.data[1];", "VAR_10 = VAR_0->current_frame.linesize[1];", "if (!VAR_0->flipped_image) VAR_10 = -VAR_10;", "VAR_13 = 7 * VAR_0->current_frame.linesize[1];", "VAR_14 = (VAR_0->height / 2) * VAR_0->current_frame.linesize[1] + (VAR_0->width / 2) - 8;", "VAR_3 = VAR_1 * FRAGMENT_PIXELS;", "VAR_17 = VAR_0->width / 2;", "VAR_18 = VAR_0->height / 2;", "VAR_19 = VAR_3 + FRAGMENT_PIXELS;", "VAR_6 = VAR_0->macroblock_fragments[VAR_20 + 4];", "} else {", "VAR_7 = VAR_0->current_frame.data[2];", "VAR_8 = VAR_0->last_frame.data[2];", "VAR_9 = VAR_0->golden_frame.data[2];", "VAR_10 = VAR_0->current_frame.linesize[2];", "if (!VAR_0->flipped_image) VAR_10 = -VAR_10;", "VAR_13 = 7 * VAR_0->current_frame.linesize[2];", "VAR_14 = (VAR_0->height / 2) * VAR_0->current_frame.linesize[2] + (VAR_0->width / 2) - 8;", "VAR_3 = VAR_1 * FRAGMENT_PIXELS;", "VAR_17 = VAR_0->width / 2;", "VAR_18 = VAR_0->height / 2;", "VAR_19 = VAR_3 + FRAGMENT_PIXELS;", "VAR_6 = VAR_0->macroblock_fragments[VAR_20 + 5];", "}", "if(ABS(VAR_10) > 2048)\nreturn;", "for (; VAR_3 < VAR_19; VAR_3 += 8) {", "for (VAR_2 = 0; VAR_2 < VAR_17; VAR_2 += 8, VAR_6++) {", "if ((VAR_6 < 0) || (VAR_6 >= VAR_0->fragment_count)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \" vp3:FUNC_0(): bad fragment number (%VAR_23)\\VAR_5\", VAR_6);", "return;", "}", "if ((VAR_0->all_fragments[VAR_6].coding_method != MODE_COPY) &&\n!((VAR_0->avctx->flags & CODEC_FLAG_GRAY) && VAR_16)) {", "if ((VAR_0->all_fragments[VAR_6].coding_method == MODE_USING_GOLDEN) ||\n(VAR_0->all_fragments[VAR_6].coding_method == MODE_GOLDEN_MV))\nmotion_source= VAR_9;", "else\nmotion_source= VAR_8;", "motion_source += VAR_0->all_fragments[VAR_6].first_pixel;", "VAR_15 = 0;", "if ((VAR_0->all_fragments[VAR_6].coding_method > MODE_INTRA) &&\n(VAR_0->all_fragments[VAR_6].coding_method != MODE_USING_GOLDEN)) {", "int VAR_21, VAR_22;", "VAR_11 = VAR_0->all_fragments[VAR_6].VAR_11;", "VAR_12 = VAR_0->all_fragments[VAR_6].VAR_12;", "if(VAR_16){", "VAR_11= (VAR_11>>1) | (VAR_11&1);", "VAR_12= (VAR_12>>1) | (VAR_12&1);", "}", "VAR_21= (VAR_11>>1) + VAR_2;", "VAR_22= (VAR_12>>1) + VAR_3;", "if ((VAR_11 == 127) || (VAR_12 == 127))\nav_log(VAR_0->avctx, AV_LOG_ERROR, \" help! got invalid motion vector! (%X, %X)\\VAR_5\", VAR_11, VAR_12);", "VAR_15 = VAR_11 & 0x01;", "motion_source += (VAR_11 >> 1);", "VAR_15 |= (VAR_12 & 0x01) << 1;", "motion_source += ((VAR_12 >> 1) * VAR_10);", "if(VAR_21<0 || VAR_22<0 || VAR_21 + 9 >= VAR_17 || VAR_22 + 9 >= VAR_18){", "uint8_t *temp= VAR_0->edge_emu_buffer;", "if(VAR_10<0) temp -= 9*VAR_10;", "else temp += 9*VAR_10;", "ff_emulated_edge_mc(temp, motion_source, VAR_10, 9, 9, VAR_21, VAR_22, VAR_17, VAR_18);", "motion_source= temp;", "}", "}", "if (VAR_0->all_fragments[VAR_6].coding_method != MODE_INTRA) {", "if(VAR_15 != 3){", "VAR_0->dsp.put_no_rnd_pixels_tab[1][VAR_15](\nVAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,\nmotion_source, VAR_10, 8);", "}else{", "int VAR_23= (VAR_11 ^ VAR_12)>>31;", "VAR_0->dsp.put_no_rnd_pixels_l2[1](\nVAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,\nmotion_source - VAR_23,\nmotion_source + VAR_10 + 1 + VAR_23,\nVAR_10, 8);", "}", "dequantizer = VAR_0->inter_dequant;", "}else{", "if (VAR_16 == 0)\ndequantizer = VAR_0->intra_y_dequant;", "else\ndequantizer = VAR_0->intra_c_dequant;", "}", "debug_idct(\"fragment %VAR_23, coding mode %VAR_23, DC = %VAR_23, dequant = %VAR_23:\\VAR_5\",\nVAR_6, VAR_0->all_fragments[VAR_6].coding_method,\nDC_COEFF(VAR_6), dequantizer[0]);", "if(VAR_0->avctx->idct_algo==FF_IDCT_VP3){", "Coeff *coeff= VAR_0->coeffs + VAR_6;", "memset(block, 0, sizeof(block));", "while(coeff->next){", "block[coeff->index]= coeff->coeff * dequantizer[coeff->index];", "coeff= coeff->next;", "}", "}else{", "Coeff *coeff= VAR_0->coeffs + VAR_6;", "memset(block, 0, sizeof(block));", "while(coeff->next){", "block[coeff->index]= (coeff->coeff * dequantizer[coeff->index] + 2)>>2;", "coeff= coeff->next;", "}", "}", "if (VAR_0->all_fragments[VAR_6].coding_method == MODE_INTRA) {", "if(VAR_0->avctx->idct_algo!=FF_IDCT_VP3)\nblock[0] += 128<<3;", "VAR_0->dsp.idct_put(\nVAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,\nVAR_10,\nblock);", "} else {", "VAR_0->dsp.idct_add(\nVAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,\nVAR_10,\nblock);", "}", "debug_idct(\"block after idct_%VAR_0():\\VAR_5\",\n(VAR_0->all_fragments[VAR_6].coding_method == MODE_INTRA)?\n\"put\" : \"add\");", "for (VAR_4 = 0; VAR_4 < 8; VAR_4++) {", "for (VAR_5 = 0; VAR_5 < 8; VAR_5++) {", "debug_idct(\" %3d\", *(VAR_7 +\nVAR_0->all_fragments[VAR_6].first_pixel + (VAR_4 * VAR_10 + VAR_5)));", "}", "debug_idct(\"\\VAR_5\");", "}", "debug_idct(\"\\VAR_5\");", "} else {", "VAR_0->dsp.put_pixels_tab[1][0](\nVAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,\nVAR_8 + VAR_0->all_fragments[VAR_6].first_pixel,\nVAR_10, 8);", "}", "}", "}", "}", "emms_c();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 49 ], [ 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 ], [ 137, 139 ], [ 145 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 167, 169 ], [ 173, 175, 177 ], [ 179, 181 ], [ 185 ], [ 187 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219, 221 ], [ 225 ], [ 227 ], [ 231 ], [ 233 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 263 ], [ 273 ], [ 275, 277, 279 ], [ 281 ], [ 283 ], [ 285, 287, 289, 291, 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301, 303 ], [ 305, 307 ], [ 309 ], [ 315, 317, 319 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 359 ], [ 361, 363 ], [ 365, 367, 369, 371 ], [ 373 ], [ 375, 377, 379, 381 ], [ 383 ], [ 387, 389, 391 ], [ 393 ], [ 395 ], [ 397, 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 411 ], [ 417, 419, 421, 423 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 471 ], [ 473 ] ]
13,416
match_insn_m68k (bfd_vma memaddr, disassemble_info * info, const struct m68k_opcode * best, struct private * priv) { unsigned char *save_p; unsigned char *p; const char *d; bfd_byte *buffer = priv->the_buffer; fprintf_ftype save_printer = info->fprintf_func; void (* save_print_address) (bfd_vma, struct disassemble_info *) = info->print_address_func; /* Point at first word of argument data, and at descriptor for first argument. */ p = buffer + 2; /* Figure out how long the fixed-size portion of the instruction is. The only place this is stored in the opcode table is in the arguments--look for arguments which specify fields in the 2nd or 3rd words of the instruction. */ for (d = best->args; *d; d += 2) { /* I don't think it is necessary to be checking d[0] here; I suspect all this could be moved to the case statement below. */ if (d[0] == '#') { if (d[1] == 'l' && p - buffer < 6) p = buffer + 6; else if (p - buffer < 4 && d[1] != 'C' && d[1] != '8') p = buffer + 4; } if ((d[0] == 'L' || d[0] == 'l') && d[1] == 'w' && p - buffer < 4) p = buffer + 4; switch (d[1]) { case '1': case '2': case '3': case '7': case '8': case '9': case 'i': if (p - buffer < 4) p = buffer + 4; break; case '4': case '5': case '6': if (p - buffer < 6) p = buffer + 6; break; default: break; } } /* pflusha is an exceptions. It takes no arguments but is two words long. Recognize it by looking at the lower 16 bits of the mask. */ if (p - buffer < 4 && (best->match & 0xFFFF) != 0) p = buffer + 4; /* lpstop is another exception. It takes a one word argument but is three words long. */ if (p - buffer < 6 && (best->match & 0xffff) == 0xffff && best->args[0] == '#' && best->args[1] == 'w') { /* Copy the one word argument into the usual location for a one word argument, to simplify printing it. We can get away with this because we know exactly what the second word is, and we aren't going to print anything based on it. */ p = buffer + 6; FETCH_DATA (info, p); buffer[2] = buffer[4]; buffer[3] = buffer[5]; } FETCH_DATA (info, p); d = best->args; save_p = p; info->print_address_func = dummy_print_address; info->fprintf_func = (fprintf_ftype) dummy_printer; /* We scan the operands twice. The first time we don't print anything, but look for errors. */ for (; *d; d += 2) { int eaten = print_insn_arg (d, buffer, p, memaddr + (p - buffer), info); if (eaten >= 0) p += eaten; else if (eaten == -1) { info->fprintf_func = save_printer; info->print_address_func = save_print_address; return 0; } else { info->fprintf_func (info->stream, /* xgettext:c-format */ _("<internal error in opcode table: %s %s>\n"), best->name, best->args); info->fprintf_func = save_printer; info->print_address_func = save_print_address; return 2; } } p = save_p; info->fprintf_func = save_printer; info->print_address_func = save_print_address; d = best->args; info->fprintf_func (info->stream, "%s", best->name); if (*d) info->fprintf_func (info->stream, " "); while (*d) { p += print_insn_arg (d, buffer, p, memaddr + (p - buffer), info); d += 2; if (*d && *(d - 2) != 'I' && *d != 'k') info->fprintf_func (info->stream, ","); } return p - buffer; }
false
qemu
d14a68b6dc0cc01ddd4c1c7c5907b95c3938679c
match_insn_m68k (bfd_vma memaddr, disassemble_info * info, const struct m68k_opcode * best, struct private * priv) { unsigned char *save_p; unsigned char *p; const char *d; bfd_byte *buffer = priv->the_buffer; fprintf_ftype save_printer = info->fprintf_func; void (* save_print_address) (bfd_vma, struct disassemble_info *) = info->print_address_func; p = buffer + 2; for (d = best->args; *d; d += 2) { if (d[0] == '#') { if (d[1] == 'l' && p - buffer < 6) p = buffer + 6; else if (p - buffer < 4 && d[1] != 'C' && d[1] != '8') p = buffer + 4; } if ((d[0] == 'L' || d[0] == 'l') && d[1] == 'w' && p - buffer < 4) p = buffer + 4; switch (d[1]) { case '1': case '2': case '3': case '7': case '8': case '9': case 'i': if (p - buffer < 4) p = buffer + 4; break; case '4': case '5': case '6': if (p - buffer < 6) p = buffer + 6; break; default: break; } } if (p - buffer < 4 && (best->match & 0xFFFF) != 0) p = buffer + 4; if (p - buffer < 6 && (best->match & 0xffff) == 0xffff && best->args[0] == '#' && best->args[1] == 'w') { p = buffer + 6; FETCH_DATA (info, p); buffer[2] = buffer[4]; buffer[3] = buffer[5]; } FETCH_DATA (info, p); d = best->args; save_p = p; info->print_address_func = dummy_print_address; info->fprintf_func = (fprintf_ftype) dummy_printer; for (; *d; d += 2) { int eaten = print_insn_arg (d, buffer, p, memaddr + (p - buffer), info); if (eaten >= 0) p += eaten; else if (eaten == -1) { info->fprintf_func = save_printer; info->print_address_func = save_print_address; return 0; } else { info->fprintf_func (info->stream, _("<internal error in opcode table: %s %s>\n"), best->name, best->args); info->fprintf_func = save_printer; info->print_address_func = save_print_address; return 2; } } p = save_p; info->fprintf_func = save_printer; info->print_address_func = save_print_address; d = best->args; info->fprintf_func (info->stream, "%s", best->name); if (*d) info->fprintf_func (info->stream, " "); while (*d) { p += print_insn_arg (d, buffer, p, memaddr + (p - buffer), info); d += 2; if (*d && *(d - 2) != 'I' && *d != 'k') info->fprintf_func (info->stream, ","); } return p - buffer; }
{ "code": [], "line_no": [] }
FUNC_0 (bfd_vma VAR_0, disassemble_info * VAR_1, const struct m68k_opcode * VAR_2, struct private * VAR_3) { unsigned char *VAR_4; unsigned char *VAR_5; const char *VAR_6; bfd_byte *buffer = VAR_3->the_buffer; fprintf_ftype save_printer = VAR_1->fprintf_func; void (* VAR_7) (bfd_vma, struct disassemble_info *) = VAR_1->print_address_func; VAR_5 = buffer + 2; for (VAR_6 = VAR_2->args; *VAR_6; VAR_6 += 2) { if (VAR_6[0] == '#') { if (VAR_6[1] == 'l' && VAR_5 - buffer < 6) VAR_5 = buffer + 6; else if (VAR_5 - buffer < 4 && VAR_6[1] != 'C' && VAR_6[1] != '8') VAR_5 = buffer + 4; } if ((VAR_6[0] == 'L' || VAR_6[0] == 'l') && VAR_6[1] == 'w' && VAR_5 - buffer < 4) VAR_5 = buffer + 4; switch (VAR_6[1]) { case '1': case '2': case '3': case '7': case '8': case '9': case 'i': if (VAR_5 - buffer < 4) VAR_5 = buffer + 4; break; case '4': case '5': case '6': if (VAR_5 - buffer < 6) VAR_5 = buffer + 6; break; default: break; } } if (VAR_5 - buffer < 4 && (VAR_2->match & 0xFFFF) != 0) VAR_5 = buffer + 4; if (VAR_5 - buffer < 6 && (VAR_2->match & 0xffff) == 0xffff && VAR_2->args[0] == '#' && VAR_2->args[1] == 'w') { VAR_5 = buffer + 6; FETCH_DATA (VAR_1, VAR_5); buffer[2] = buffer[4]; buffer[3] = buffer[5]; } FETCH_DATA (VAR_1, VAR_5); VAR_6 = VAR_2->args; VAR_4 = VAR_5; VAR_1->print_address_func = dummy_print_address; VAR_1->fprintf_func = (fprintf_ftype) dummy_printer; for (; *VAR_6; VAR_6 += 2) { int VAR_8 = print_insn_arg (VAR_6, buffer, VAR_5, VAR_0 + (VAR_5 - buffer), VAR_1); if (VAR_8 >= 0) VAR_5 += VAR_8; else if (VAR_8 == -1) { VAR_1->fprintf_func = save_printer; VAR_1->print_address_func = VAR_7; return 0; } else { VAR_1->fprintf_func (VAR_1->stream, _("<internal error in opcode table: %s %s>\n"), VAR_2->name, VAR_2->args); VAR_1->fprintf_func = save_printer; VAR_1->print_address_func = VAR_7; return 2; } } VAR_5 = VAR_4; VAR_1->fprintf_func = save_printer; VAR_1->print_address_func = VAR_7; VAR_6 = VAR_2->args; VAR_1->fprintf_func (VAR_1->stream, "%s", VAR_2->name); if (*VAR_6) VAR_1->fprintf_func (VAR_1->stream, " "); while (*VAR_6) { VAR_5 += print_insn_arg (VAR_6, buffer, VAR_5, VAR_0 + (VAR_5 - buffer), VAR_1); VAR_6 += 2; if (*VAR_6 && *(VAR_6 - 2) != 'I' && *VAR_6 != 'k') VAR_1->fprintf_func (VAR_1->stream, ","); } return VAR_5 - buffer; }
[ "FUNC_0 (bfd_vma VAR_0,\ndisassemble_info * VAR_1,\nconst struct m68k_opcode * VAR_2,\nstruct private * VAR_3)\n{", "unsigned char *VAR_4;", "unsigned char *VAR_5;", "const char *VAR_6;", "bfd_byte *buffer = VAR_3->the_buffer;", "fprintf_ftype save_printer = VAR_1->fprintf_func;", "void (* VAR_7) (bfd_vma, struct disassemble_info *)\n= VAR_1->print_address_func;", "VAR_5 = buffer + 2;", "for (VAR_6 = VAR_2->args; *VAR_6; VAR_6 += 2)", "{", "if (VAR_6[0] == '#')\n{", "if (VAR_6[1] == 'l' && VAR_5 - buffer < 6)\nVAR_5 = buffer + 6;", "else if (VAR_5 - buffer < 4 && VAR_6[1] != 'C' && VAR_6[1] != '8')\nVAR_5 = buffer + 4;", "}", "if ((VAR_6[0] == 'L' || VAR_6[0] == 'l') && VAR_6[1] == 'w' && VAR_5 - buffer < 4)\nVAR_5 = buffer + 4;", "switch (VAR_6[1])\n{", "case '1':\ncase '2':\ncase '3':\ncase '7':\ncase '8':\ncase '9':\ncase 'i':\nif (VAR_5 - buffer < 4)\nVAR_5 = buffer + 4;", "break;", "case '4':\ncase '5':\ncase '6':\nif (VAR_5 - buffer < 6)\nVAR_5 = buffer + 6;", "break;", "default:\nbreak;", "}", "}", "if (VAR_5 - buffer < 4 && (VAR_2->match & 0xFFFF) != 0)\nVAR_5 = buffer + 4;", "if (VAR_5 - buffer < 6\n&& (VAR_2->match & 0xffff) == 0xffff\n&& VAR_2->args[0] == '#'\n&& VAR_2->args[1] == 'w')\n{", "VAR_5 = buffer + 6;", "FETCH_DATA (VAR_1, VAR_5);", "buffer[2] = buffer[4];", "buffer[3] = buffer[5];", "}", "FETCH_DATA (VAR_1, VAR_5);", "VAR_6 = VAR_2->args;", "VAR_4 = VAR_5;", "VAR_1->print_address_func = dummy_print_address;", "VAR_1->fprintf_func = (fprintf_ftype) dummy_printer;", "for (; *VAR_6; VAR_6 += 2)", "{", "int VAR_8 = print_insn_arg (VAR_6, buffer, VAR_5, VAR_0 + (VAR_5 - buffer), VAR_1);", "if (VAR_8 >= 0)\nVAR_5 += VAR_8;", "else if (VAR_8 == -1)\n{", "VAR_1->fprintf_func = save_printer;", "VAR_1->print_address_func = VAR_7;", "return 0;", "}", "else\n{", "VAR_1->fprintf_func (VAR_1->stream,\n_(\"<internal error in opcode table: %s %s>\\n\"),\nVAR_2->name, VAR_2->args);", "VAR_1->fprintf_func = save_printer;", "VAR_1->print_address_func = VAR_7;", "return 2;", "}", "}", "VAR_5 = VAR_4;", "VAR_1->fprintf_func = save_printer;", "VAR_1->print_address_func = VAR_7;", "VAR_6 = VAR_2->args;", "VAR_1->fprintf_func (VAR_1->stream, \"%s\", VAR_2->name);", "if (*VAR_6)\nVAR_1->fprintf_func (VAR_1->stream, \" \");", "while (*VAR_6)\n{", "VAR_5 += print_insn_arg (VAR_6, buffer, VAR_5, VAR_0 + (VAR_5 - buffer), VAR_1);", "VAR_6 += 2;", "if (*VAR_6 && *(VAR_6 - 2) != 'I' && *VAR_6 != 'k')\nVAR_1->fprintf_func (VAR_1->stream, \",\");", "}", "return VAR_5 - buffer;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 45 ], [ 47 ], [ 53, 55 ], [ 57, 59 ], [ 61, 63 ], [ 65 ], [ 69, 71 ], [ 75, 77 ], [ 79, 81, 83, 85, 87, 89, 91, 93, 95 ], [ 97 ], [ 99, 101, 103, 105, 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 125, 127 ], [ 135, 137, 139, 141, 143 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 185 ], [ 187 ], [ 189 ], [ 193, 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209, 211 ], [ 213, 217, 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 235 ], [ 237 ], [ 241 ], [ 245 ], [ 249, 251 ], [ 255, 257 ], [ 259 ], [ 261 ], [ 265, 267 ], [ 269 ], [ 273 ], [ 275 ] ]
13,417
static void rcu_qtest_init(void) { struct list_element *new_el; int i; nthreadsrunning = 0; srand(time(0)); for (i = 0; i < RCU_Q_LEN; i++) { new_el = g_new(struct list_element, 1); new_el->val = i; QLIST_INSERT_HEAD_RCU(&Q_list_head, new_el, entry); } atomic_add(&n_nodes, RCU_Q_LEN); }
false
qemu
8a5956ad6392f115521dad774055c737c49fb0dd
static void rcu_qtest_init(void) { struct list_element *new_el; int i; nthreadsrunning = 0; srand(time(0)); for (i = 0; i < RCU_Q_LEN; i++) { new_el = g_new(struct list_element, 1); new_el->val = i; QLIST_INSERT_HEAD_RCU(&Q_list_head, new_el, entry); } atomic_add(&n_nodes, RCU_Q_LEN); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { struct list_element *VAR_0; int VAR_1; nthreadsrunning = 0; srand(time(0)); for (VAR_1 = 0; VAR_1 < RCU_Q_LEN; VAR_1++) { VAR_0 = g_new(struct list_element, 1); VAR_0->val = VAR_1; QLIST_INSERT_HEAD_RCU(&Q_list_head, VAR_0, entry); } atomic_add(&n_nodes, RCU_Q_LEN); }
[ "static void FUNC_0(void)\n{", "struct list_element *VAR_0;", "int VAR_1;", "nthreadsrunning = 0;", "srand(time(0));", "for (VAR_1 = 0; VAR_1 < RCU_Q_LEN; VAR_1++) {", "VAR_0 = g_new(struct list_element, 1);", "VAR_0->val = VAR_1;", "QLIST_INSERT_HEAD_RCU(&Q_list_head, VAR_0, entry);", "}", "atomic_add(&n_nodes, RCU_Q_LEN);", "}" ]
[ 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 ] ]
13,418
static void virtio_ccw_bus_class_init(ObjectClass *klass, void *data) { VirtioBusClass *k = VIRTIO_BUS_CLASS(klass); BusClass *bus_class = BUS_CLASS(klass); bus_class->max_dev = 1; k->notify = virtio_ccw_notify; k->vmstate_change = virtio_ccw_vmstate_change; k->query_guest_notifiers = virtio_ccw_query_guest_notifiers; k->set_guest_notifiers = virtio_ccw_set_guest_notifiers; k->save_queue = virtio_ccw_save_queue; k->load_queue = virtio_ccw_load_queue; k->save_config = virtio_ccw_save_config; k->load_config = virtio_ccw_load_config; k->device_plugged = virtio_ccw_device_plugged; k->post_plugged = virtio_ccw_post_plugged; k->device_unplugged = virtio_ccw_device_unplugged; k->ioeventfd_started = virtio_ccw_ioeventfd_started; k->ioeventfd_set_started = virtio_ccw_ioeventfd_set_started; k->ioeventfd_disabled = virtio_ccw_ioeventfd_disabled; k->ioeventfd_set_disabled = virtio_ccw_ioeventfd_set_disabled; k->ioeventfd_assign = virtio_ccw_ioeventfd_assign; }
false
qemu
d1b4259f1ab18af24e6a297edb6a8f71691f3256
static void virtio_ccw_bus_class_init(ObjectClass *klass, void *data) { VirtioBusClass *k = VIRTIO_BUS_CLASS(klass); BusClass *bus_class = BUS_CLASS(klass); bus_class->max_dev = 1; k->notify = virtio_ccw_notify; k->vmstate_change = virtio_ccw_vmstate_change; k->query_guest_notifiers = virtio_ccw_query_guest_notifiers; k->set_guest_notifiers = virtio_ccw_set_guest_notifiers; k->save_queue = virtio_ccw_save_queue; k->load_queue = virtio_ccw_load_queue; k->save_config = virtio_ccw_save_config; k->load_config = virtio_ccw_load_config; k->device_plugged = virtio_ccw_device_plugged; k->post_plugged = virtio_ccw_post_plugged; k->device_unplugged = virtio_ccw_device_unplugged; k->ioeventfd_started = virtio_ccw_ioeventfd_started; k->ioeventfd_set_started = virtio_ccw_ioeventfd_set_started; k->ioeventfd_disabled = virtio_ccw_ioeventfd_disabled; k->ioeventfd_set_disabled = virtio_ccw_ioeventfd_set_disabled; k->ioeventfd_assign = virtio_ccw_ioeventfd_assign; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { VirtioBusClass *k = VIRTIO_BUS_CLASS(VAR_0); BusClass *bus_class = BUS_CLASS(VAR_0); bus_class->max_dev = 1; k->notify = virtio_ccw_notify; k->vmstate_change = virtio_ccw_vmstate_change; k->query_guest_notifiers = virtio_ccw_query_guest_notifiers; k->set_guest_notifiers = virtio_ccw_set_guest_notifiers; k->save_queue = virtio_ccw_save_queue; k->load_queue = virtio_ccw_load_queue; k->save_config = virtio_ccw_save_config; k->load_config = virtio_ccw_load_config; k->device_plugged = virtio_ccw_device_plugged; k->post_plugged = virtio_ccw_post_plugged; k->device_unplugged = virtio_ccw_device_unplugged; k->ioeventfd_started = virtio_ccw_ioeventfd_started; k->ioeventfd_set_started = virtio_ccw_ioeventfd_set_started; k->ioeventfd_disabled = virtio_ccw_ioeventfd_disabled; k->ioeventfd_set_disabled = virtio_ccw_ioeventfd_set_disabled; k->ioeventfd_assign = virtio_ccw_ioeventfd_assign; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "VirtioBusClass *k = VIRTIO_BUS_CLASS(VAR_0);", "BusClass *bus_class = BUS_CLASS(VAR_0);", "bus_class->max_dev = 1;", "k->notify = virtio_ccw_notify;", "k->vmstate_change = virtio_ccw_vmstate_change;", "k->query_guest_notifiers = virtio_ccw_query_guest_notifiers;", "k->set_guest_notifiers = virtio_ccw_set_guest_notifiers;", "k->save_queue = virtio_ccw_save_queue;", "k->load_queue = virtio_ccw_load_queue;", "k->save_config = virtio_ccw_save_config;", "k->load_config = virtio_ccw_load_config;", "k->device_plugged = virtio_ccw_device_plugged;", "k->post_plugged = virtio_ccw_post_plugged;", "k->device_unplugged = virtio_ccw_device_unplugged;", "k->ioeventfd_started = virtio_ccw_ioeventfd_started;", "k->ioeventfd_set_started = virtio_ccw_ioeventfd_set_started;", "k->ioeventfd_disabled = virtio_ccw_ioeventfd_disabled;", "k->ioeventfd_set_disabled = virtio_ccw_ioeventfd_set_disabled;", "k->ioeventfd_assign = virtio_ccw_ioeventfd_assign;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
13,419
static void lan9118_cleanup(NetClientState *nc) { lan9118_state *s = qemu_get_nic_opaque(nc); s->nic = NULL; }
false
qemu
57407ea44cc0a3d630b9b89a2be011f1955ce5c1
static void lan9118_cleanup(NetClientState *nc) { lan9118_state *s = qemu_get_nic_opaque(nc); s->nic = NULL; }
{ "code": [], "line_no": [] }
static void FUNC_0(NetClientState *VAR_0) { lan9118_state *s = qemu_get_nic_opaque(VAR_0); s->nic = NULL; }
[ "static void FUNC_0(NetClientState *VAR_0)\n{", "lan9118_state *s = qemu_get_nic_opaque(VAR_0);", "s->nic = NULL;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
13,420
void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base, unsigned long vga_ram_offset, int vga_ram_size) { PCICirrusVGAState *d; uint8_t *pci_conf; CirrusVGAState *s; int device_id; device_id = CIRRUS_ID_CLGD5446; /* setup PCI configuration registers */ d = (PCICirrusVGAState *)pci_register_device(bus, "Cirrus VGA", sizeof(PCICirrusVGAState), -1, NULL, NULL); pci_conf = d->dev.config; pci_conf[0x00] = (uint8_t) (PCI_VENDOR_CIRRUS & 0xff); pci_conf[0x01] = (uint8_t) (PCI_VENDOR_CIRRUS >> 8); pci_conf[0x02] = (uint8_t) (device_id & 0xff); pci_conf[0x03] = (uint8_t) (device_id >> 8); pci_conf[0x04] = PCI_COMMAND_IOACCESS | PCI_COMMAND_MEMACCESS; pci_conf[0x0a] = PCI_CLASS_SUB_VGA; pci_conf[0x0b] = PCI_CLASS_BASE_DISPLAY; pci_conf[0x0e] = PCI_CLASS_HEADERTYPE_00h; /* setup VGA */ s = &d->cirrus_vga; vga_common_init((VGAState *)s, ds, vga_ram_base, vga_ram_offset, vga_ram_size); cirrus_init_common(s, device_id, 1); s->console = graphic_console_init(s->ds, s->update, s->invalidate, s->screen_dump, s->text_update, s); s->pci_dev = (PCIDevice *)d; /* setup memory space */ /* memory #0 LFB */ /* memory #1 memory-mapped I/O */ /* XXX: s->vram_size must be a power of two */ pci_register_io_region((PCIDevice *)d, 0, 0x2000000, PCI_ADDRESS_SPACE_MEM_PREFETCH, cirrus_pci_lfb_map); if (device_id == CIRRUS_ID_CLGD5446) { pci_register_io_region((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE, PCI_ADDRESS_SPACE_MEM, cirrus_pci_mmio_map); } /* XXX: ROM BIOS */ }
false
qemu
4efe27556dea874030f1cd53a6d70452ee064fba
void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base, unsigned long vga_ram_offset, int vga_ram_size) { PCICirrusVGAState *d; uint8_t *pci_conf; CirrusVGAState *s; int device_id; device_id = CIRRUS_ID_CLGD5446; d = (PCICirrusVGAState *)pci_register_device(bus, "Cirrus VGA", sizeof(PCICirrusVGAState), -1, NULL, NULL); pci_conf = d->dev.config; pci_conf[0x00] = (uint8_t) (PCI_VENDOR_CIRRUS & 0xff); pci_conf[0x01] = (uint8_t) (PCI_VENDOR_CIRRUS >> 8); pci_conf[0x02] = (uint8_t) (device_id & 0xff); pci_conf[0x03] = (uint8_t) (device_id >> 8); pci_conf[0x04] = PCI_COMMAND_IOACCESS | PCI_COMMAND_MEMACCESS; pci_conf[0x0a] = PCI_CLASS_SUB_VGA; pci_conf[0x0b] = PCI_CLASS_BASE_DISPLAY; pci_conf[0x0e] = PCI_CLASS_HEADERTYPE_00h; s = &d->cirrus_vga; vga_common_init((VGAState *)s, ds, vga_ram_base, vga_ram_offset, vga_ram_size); cirrus_init_common(s, device_id, 1); s->console = graphic_console_init(s->ds, s->update, s->invalidate, s->screen_dump, s->text_update, s); s->pci_dev = (PCIDevice *)d; pci_register_io_region((PCIDevice *)d, 0, 0x2000000, PCI_ADDRESS_SPACE_MEM_PREFETCH, cirrus_pci_lfb_map); if (device_id == CIRRUS_ID_CLGD5446) { pci_register_io_region((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE, PCI_ADDRESS_SPACE_MEM, cirrus_pci_mmio_map); } }
{ "code": [], "line_no": [] }
void FUNC_0(PCIBus *VAR_0, DisplayState *VAR_1, uint8_t *VAR_2, unsigned long VAR_3, int VAR_4) { PCICirrusVGAState *d; uint8_t *pci_conf; CirrusVGAState *s; int VAR_5; VAR_5 = CIRRUS_ID_CLGD5446; d = (PCICirrusVGAState *)pci_register_device(VAR_0, "Cirrus VGA", sizeof(PCICirrusVGAState), -1, NULL, NULL); pci_conf = d->dev.config; pci_conf[0x00] = (uint8_t) (PCI_VENDOR_CIRRUS & 0xff); pci_conf[0x01] = (uint8_t) (PCI_VENDOR_CIRRUS >> 8); pci_conf[0x02] = (uint8_t) (VAR_5 & 0xff); pci_conf[0x03] = (uint8_t) (VAR_5 >> 8); pci_conf[0x04] = PCI_COMMAND_IOACCESS | PCI_COMMAND_MEMACCESS; pci_conf[0x0a] = PCI_CLASS_SUB_VGA; pci_conf[0x0b] = PCI_CLASS_BASE_DISPLAY; pci_conf[0x0e] = PCI_CLASS_HEADERTYPE_00h; s = &d->cirrus_vga; vga_common_init((VGAState *)s, VAR_1, VAR_2, VAR_3, VAR_4); cirrus_init_common(s, VAR_5, 1); s->console = graphic_console_init(s->VAR_1, s->update, s->invalidate, s->screen_dump, s->text_update, s); s->pci_dev = (PCIDevice *)d; pci_register_io_region((PCIDevice *)d, 0, 0x2000000, PCI_ADDRESS_SPACE_MEM_PREFETCH, cirrus_pci_lfb_map); if (VAR_5 == CIRRUS_ID_CLGD5446) { pci_register_io_region((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE, PCI_ADDRESS_SPACE_MEM, cirrus_pci_mmio_map); } }
[ "void FUNC_0(PCIBus *VAR_0, DisplayState *VAR_1, uint8_t *VAR_2,\nunsigned long VAR_3, int VAR_4)\n{", "PCICirrusVGAState *d;", "uint8_t *pci_conf;", "CirrusVGAState *s;", "int VAR_5;", "VAR_5 = CIRRUS_ID_CLGD5446;", "d = (PCICirrusVGAState *)pci_register_device(VAR_0, \"Cirrus VGA\",\nsizeof(PCICirrusVGAState),\n-1, NULL, NULL);", "pci_conf = d->dev.config;", "pci_conf[0x00] = (uint8_t) (PCI_VENDOR_CIRRUS & 0xff);", "pci_conf[0x01] = (uint8_t) (PCI_VENDOR_CIRRUS >> 8);", "pci_conf[0x02] = (uint8_t) (VAR_5 & 0xff);", "pci_conf[0x03] = (uint8_t) (VAR_5 >> 8);", "pci_conf[0x04] = PCI_COMMAND_IOACCESS | PCI_COMMAND_MEMACCESS;", "pci_conf[0x0a] = PCI_CLASS_SUB_VGA;", "pci_conf[0x0b] = PCI_CLASS_BASE_DISPLAY;", "pci_conf[0x0e] = PCI_CLASS_HEADERTYPE_00h;", "s = &d->cirrus_vga;", "vga_common_init((VGAState *)s,\nVAR_1, VAR_2, VAR_3, VAR_4);", "cirrus_init_common(s, VAR_5, 1);", "s->console = graphic_console_init(s->VAR_1, s->update, s->invalidate,\ns->screen_dump, s->text_update, s);", "s->pci_dev = (PCIDevice *)d;", "pci_register_io_region((PCIDevice *)d, 0, 0x2000000,\nPCI_ADDRESS_SPACE_MEM_PREFETCH, cirrus_pci_lfb_map);", "if (VAR_5 == CIRRUS_ID_CLGD5446) {", "pci_register_io_region((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE,\nPCI_ADDRESS_SPACE_MEM, cirrus_pci_mmio_map);", "}", "}" ]
[ 0, 0, 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 ], [ 23, 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 61, 63 ], [ 67 ], [ 79, 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 93 ] ]
13,421
static void spapr_io_write(void *opaque, hwaddr addr, uint64_t data, unsigned size) { switch (size) { case 1: cpu_outb(addr, data); return; case 2: cpu_outw(addr, data); return; case 4: cpu_outl(addr, data); return; } assert(0); }
false
qemu
a178274efabcbbc5d44805b51def874e47051325
static void spapr_io_write(void *opaque, hwaddr addr, uint64_t data, unsigned size) { switch (size) { case 1: cpu_outb(addr, data); return; case 2: cpu_outw(addr, data); return; case 4: cpu_outl(addr, data); return; } assert(0); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { switch (VAR_3) { case 1: cpu_outb(VAR_1, VAR_2); return; case 2: cpu_outw(VAR_1, VAR_2); return; case 4: cpu_outl(VAR_1, VAR_2); return; } assert(0); }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "switch (VAR_3) {", "case 1:\ncpu_outb(VAR_1, VAR_2);", "return;", "case 2:\ncpu_outw(VAR_1, VAR_2);", "return;", "case 4:\ncpu_outl(VAR_1, VAR_2);", "return;", "}", "assert(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 ] ]
13,422
static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); int buflen = 0; if (req->cmd.buf[1] & 0x2) { /* Command support data - optional, not implemented */ BADF("optional INQUIRY command support request not implemented\n"); return -1; } if (req->cmd.buf[1] & 0x1) { /* Vital product data */ uint8_t page_code = req->cmd.buf[2]; if (req->cmd.xfer < 4) { BADF("Error: Inquiry (EVPD[%02X]) buffer size %zd is " "less than 4\n", page_code, req->cmd.xfer); return -1; } if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) { outbuf[buflen++] = 5; } else { outbuf[buflen++] = 0; } outbuf[buflen++] = page_code ; // this page outbuf[buflen++] = 0x00; switch (page_code) { case 0x00: /* Supported page codes, mandatory */ DPRINTF("Inquiry EVPD[Supported pages] " "buffer size %zd\n", req->cmd.xfer); outbuf[buflen++] = 4; // number of pages outbuf[buflen++] = 0x00; // list of supported pages (this page) outbuf[buflen++] = 0x80; // unit serial number outbuf[buflen++] = 0x83; // device identification outbuf[buflen++] = 0xb0; // block device characteristics break; case 0x80: /* Device serial number, optional */ { const char *serial = req->dev->conf.dinfo->serial ? req->dev->conf.dinfo->serial : "0"; int l = strlen(serial); if (l > req->cmd.xfer) l = req->cmd.xfer; if (l > 20) l = 20; DPRINTF("Inquiry EVPD[Serial number] " "buffer size %zd\n", req->cmd.xfer); outbuf[buflen++] = l; memcpy(outbuf+buflen, serial, l); buflen += l; break; } case 0x83: /* Device identification page, mandatory */ { int max_len = 255 - 8; int id_len = strlen(bdrv_get_device_name(s->bs)); if (id_len > max_len) id_len = max_len; DPRINTF("Inquiry EVPD[Device identification] " "buffer size %zd\n", req->cmd.xfer); outbuf[buflen++] = 3 + id_len; outbuf[buflen++] = 0x2; // ASCII outbuf[buflen++] = 0; // not officially assigned outbuf[buflen++] = 0; // reserved outbuf[buflen++] = id_len; // length of data following memcpy(outbuf+buflen, bdrv_get_device_name(s->bs), id_len); buflen += id_len; break; } case 0xb0: /* block device characteristics */ { unsigned int min_io_size = s->qdev.conf.min_io_size >> 9; unsigned int opt_io_size = s->qdev.conf.opt_io_size >> 9; /* required VPD size with unmap support */ outbuf[3] = buflen = 0x3c; memset(outbuf + 4, 0, buflen - 4); /* optimal transfer length granularity */ outbuf[6] = (min_io_size >> 8) & 0xff; outbuf[7] = min_io_size & 0xff; /* optimal transfer length */ outbuf[12] = (opt_io_size >> 24) & 0xff; outbuf[13] = (opt_io_size >> 16) & 0xff; outbuf[14] = (opt_io_size >> 8) & 0xff; outbuf[15] = opt_io_size & 0xff; break; } default: BADF("Error: unsupported Inquiry (EVPD[%02X]) " "buffer size %zd\n", page_code, req->cmd.xfer); return -1; } /* done with EVPD */ return buflen; } /* Standard INQUIRY data */ if (req->cmd.buf[2] != 0) { BADF("Error: Inquiry (STANDARD) page or code " "is non-zero [%02X]\n", req->cmd.buf[2]); return -1; } /* PAGE CODE == 0 */ if (req->cmd.xfer < 5) { BADF("Error: Inquiry (STANDARD) buffer size %zd " "is less than 5\n", req->cmd.xfer); return -1; } buflen = req->cmd.xfer; if (buflen > SCSI_MAX_INQUIRY_LEN) buflen = SCSI_MAX_INQUIRY_LEN; memset(outbuf, 0, buflen); if (req->lun || req->cmd.buf[1] >> 5) { outbuf[0] = 0x7f; /* LUN not supported */ return buflen; } if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) { outbuf[0] = 5; outbuf[1] = 0x80; memcpy(&outbuf[16], "QEMU CD-ROM ", 16); } else { outbuf[0] = 0; memcpy(&outbuf[16], "QEMU HARDDISK ", 16); } memcpy(&outbuf[8], "QEMU ", 8); memcpy(&outbuf[32], s->version ? s->version : QEMU_VERSION, 4); /* * We claim conformance to SPC-3, which is required for guests * to ask for modern features like READ CAPACITY(16) or the * block characteristics VPD page by default. Not all of SPC-3 * is actually implemented, but we're good enough. */ outbuf[2] = 5; outbuf[3] = 2; /* Format 2 */ if (buflen > 36) { outbuf[4] = buflen - 5; /* Additional Length = (Len - 1) - 4 */ } else { /* If the allocation length of CDB is too small, the additional length is not adjusted */ outbuf[4] = 36 - 5; } /* Sync data transfer and TCQ. */ outbuf[7] = 0x10 | (req->bus->tcq ? 0x02 : 0); return buflen; }
false
qemu
8cfacf079047c50d272ce64e45a78d816db8b36e
static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); int buflen = 0; if (req->cmd.buf[1] & 0x2) { BADF("optional INQUIRY command support request not implemented\n"); return -1; } if (req->cmd.buf[1] & 0x1) { uint8_t page_code = req->cmd.buf[2]; if (req->cmd.xfer < 4) { BADF("Error: Inquiry (EVPD[%02X]) buffer size %zd is " "less than 4\n", page_code, req->cmd.xfer); return -1; } if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) { outbuf[buflen++] = 5; } else { outbuf[buflen++] = 0; } outbuf[buflen++] = page_code ; outbuf[buflen++] = 0x00; switch (page_code) { case 0x00: DPRINTF("Inquiry EVPD[Supported pages] " "buffer size %zd\n", req->cmd.xfer); outbuf[buflen++] = 4; outbuf[buflen++] = 0x00; outbuf[buflen++] = 0x80; outbuf[buflen++] = 0x83; outbuf[buflen++] = 0xb0; break; case 0x80: { const char *serial = req->dev->conf.dinfo->serial ? req->dev->conf.dinfo->serial : "0"; int l = strlen(serial); if (l > req->cmd.xfer) l = req->cmd.xfer; if (l > 20) l = 20; DPRINTF("Inquiry EVPD[Serial number] " "buffer size %zd\n", req->cmd.xfer); outbuf[buflen++] = l; memcpy(outbuf+buflen, serial, l); buflen += l; break; } case 0x83: { int max_len = 255 - 8; int id_len = strlen(bdrv_get_device_name(s->bs)); if (id_len > max_len) id_len = max_len; DPRINTF("Inquiry EVPD[Device identification] " "buffer size %zd\n", req->cmd.xfer); outbuf[buflen++] = 3 + id_len; outbuf[buflen++] = 0x2; outbuf[buflen++] = 0; outbuf[buflen++] = 0; outbuf[buflen++] = id_len; memcpy(outbuf+buflen, bdrv_get_device_name(s->bs), id_len); buflen += id_len; break; } case 0xb0: { unsigned int min_io_size = s->qdev.conf.min_io_size >> 9; unsigned int opt_io_size = s->qdev.conf.opt_io_size >> 9; outbuf[3] = buflen = 0x3c; memset(outbuf + 4, 0, buflen - 4); outbuf[6] = (min_io_size >> 8) & 0xff; outbuf[7] = min_io_size & 0xff; outbuf[12] = (opt_io_size >> 24) & 0xff; outbuf[13] = (opt_io_size >> 16) & 0xff; outbuf[14] = (opt_io_size >> 8) & 0xff; outbuf[15] = opt_io_size & 0xff; break; } default: BADF("Error: unsupported Inquiry (EVPD[%02X]) " "buffer size %zd\n", page_code, req->cmd.xfer); return -1; } return buflen; } if (req->cmd.buf[2] != 0) { BADF("Error: Inquiry (STANDARD) page or code " "is non-zero [%02X]\n", req->cmd.buf[2]); return -1; } if (req->cmd.xfer < 5) { BADF("Error: Inquiry (STANDARD) buffer size %zd " "is less than 5\n", req->cmd.xfer); return -1; } buflen = req->cmd.xfer; if (buflen > SCSI_MAX_INQUIRY_LEN) buflen = SCSI_MAX_INQUIRY_LEN; memset(outbuf, 0, buflen); if (req->lun || req->cmd.buf[1] >> 5) { outbuf[0] = 0x7f; return buflen; } if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) { outbuf[0] = 5; outbuf[1] = 0x80; memcpy(&outbuf[16], "QEMU CD-ROM ", 16); } else { outbuf[0] = 0; memcpy(&outbuf[16], "QEMU HARDDISK ", 16); } memcpy(&outbuf[8], "QEMU ", 8); memcpy(&outbuf[32], s->version ? s->version : QEMU_VERSION, 4); outbuf[2] = 5; outbuf[3] = 2; if (buflen > 36) { outbuf[4] = buflen - 5; } else { outbuf[4] = 36 - 5; } outbuf[7] = 0x10 | (req->bus->tcq ? 0x02 : 0); return buflen; }
{ "code": [], "line_no": [] }
static int FUNC_0(SCSIRequest *VAR_0, uint8_t *VAR_1) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, VAR_0->dev); int VAR_2 = 0; if (VAR_0->cmd.buf[1] & 0x2) { BADF("optional INQUIRY command support request not implemented\n"); return -1; } if (VAR_0->cmd.buf[1] & 0x1) { uint8_t page_code = VAR_0->cmd.buf[2]; if (VAR_0->cmd.xfer < 4) { BADF("Error: Inquiry (EVPD[%02X]) buffer size %zd is " "less than 4\n", page_code, VAR_0->cmd.xfer); return -1; } if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) { VAR_1[VAR_2++] = 5; } else { VAR_1[VAR_2++] = 0; } VAR_1[VAR_2++] = page_code ; VAR_1[VAR_2++] = 0x00; switch (page_code) { case 0x00: DPRINTF("Inquiry EVPD[Supported pages] " "buffer size %zd\n", VAR_0->cmd.xfer); VAR_1[VAR_2++] = 4; VAR_1[VAR_2++] = 0x00; VAR_1[VAR_2++] = 0x80; VAR_1[VAR_2++] = 0x83; VAR_1[VAR_2++] = 0xb0; break; case 0x80: { const char *VAR_3 = VAR_0->dev->conf.dinfo->VAR_3 ? VAR_0->dev->conf.dinfo->VAR_3 : "0"; int VAR_4 = strlen(VAR_3); if (VAR_4 > VAR_0->cmd.xfer) VAR_4 = VAR_0->cmd.xfer; if (VAR_4 > 20) VAR_4 = 20; DPRINTF("Inquiry EVPD[Serial number] " "buffer size %zd\n", VAR_0->cmd.xfer); VAR_1[VAR_2++] = VAR_4; memcpy(VAR_1+VAR_2, VAR_3, VAR_4); VAR_2 += VAR_4; break; } case 0x83: { int VAR_5 = 255 - 8; int VAR_6 = strlen(bdrv_get_device_name(s->bs)); if (VAR_6 > VAR_5) VAR_6 = VAR_5; DPRINTF("Inquiry EVPD[Device identification] " "buffer size %zd\n", VAR_0->cmd.xfer); VAR_1[VAR_2++] = 3 + VAR_6; VAR_1[VAR_2++] = 0x2; VAR_1[VAR_2++] = 0; VAR_1[VAR_2++] = 0; VAR_1[VAR_2++] = VAR_6; memcpy(VAR_1+VAR_2, bdrv_get_device_name(s->bs), VAR_6); VAR_2 += VAR_6; break; } case 0xb0: { unsigned int VAR_7 = s->qdev.conf.VAR_7 >> 9; unsigned int VAR_8 = s->qdev.conf.VAR_8 >> 9; VAR_1[3] = VAR_2 = 0x3c; memset(VAR_1 + 4, 0, VAR_2 - 4); VAR_1[6] = (VAR_7 >> 8) & 0xff; VAR_1[7] = VAR_7 & 0xff; VAR_1[12] = (VAR_8 >> 24) & 0xff; VAR_1[13] = (VAR_8 >> 16) & 0xff; VAR_1[14] = (VAR_8 >> 8) & 0xff; VAR_1[15] = VAR_8 & 0xff; break; } default: BADF("Error: unsupported Inquiry (EVPD[%02X]) " "buffer size %zd\n", page_code, VAR_0->cmd.xfer); return -1; } return VAR_2; } if (VAR_0->cmd.buf[2] != 0) { BADF("Error: Inquiry (STANDARD) page or code " "is non-zero [%02X]\n", VAR_0->cmd.buf[2]); return -1; } if (VAR_0->cmd.xfer < 5) { BADF("Error: Inquiry (STANDARD) buffer size %zd " "is less than 5\n", VAR_0->cmd.xfer); return -1; } VAR_2 = VAR_0->cmd.xfer; if (VAR_2 > SCSI_MAX_INQUIRY_LEN) VAR_2 = SCSI_MAX_INQUIRY_LEN; memset(VAR_1, 0, VAR_2); if (VAR_0->lun || VAR_0->cmd.buf[1] >> 5) { VAR_1[0] = 0x7f; return VAR_2; } if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) { VAR_1[0] = 5; VAR_1[1] = 0x80; memcpy(&VAR_1[16], "QEMU CD-ROM ", 16); } else { VAR_1[0] = 0; memcpy(&VAR_1[16], "QEMU HARDDISK ", 16); } memcpy(&VAR_1[8], "QEMU ", 8); memcpy(&VAR_1[32], s->version ? s->version : QEMU_VERSION, 4); VAR_1[2] = 5; VAR_1[3] = 2; if (VAR_2 > 36) { VAR_1[4] = VAR_2 - 5; } else { VAR_1[4] = 36 - 5; } VAR_1[7] = 0x10 | (VAR_0->bus->tcq ? 0x02 : 0); return VAR_2; }
[ "static int FUNC_0(SCSIRequest *VAR_0, uint8_t *VAR_1)\n{", "SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, VAR_0->dev);", "int VAR_2 = 0;", "if (VAR_0->cmd.buf[1] & 0x2) {", "BADF(\"optional INQUIRY command support request not implemented\\n\");", "return -1;", "}", "if (VAR_0->cmd.buf[1] & 0x1) {", "uint8_t page_code = VAR_0->cmd.buf[2];", "if (VAR_0->cmd.xfer < 4) {", "BADF(\"Error: Inquiry (EVPD[%02X]) buffer size %zd is \"\n\"less than 4\\n\", page_code, VAR_0->cmd.xfer);", "return -1;", "}", "if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {", "VAR_1[VAR_2++] = 5;", "} else {", "VAR_1[VAR_2++] = 0;", "}", "VAR_1[VAR_2++] = page_code ;", "VAR_1[VAR_2++] = 0x00;", "switch (page_code) {", "case 0x00:\nDPRINTF(\"Inquiry EVPD[Supported pages] \"\n\"buffer size %zd\\n\", VAR_0->cmd.xfer);", "VAR_1[VAR_2++] = 4;", "VAR_1[VAR_2++] = 0x00;", "VAR_1[VAR_2++] = 0x80;", "VAR_1[VAR_2++] = 0x83;", "VAR_1[VAR_2++] = 0xb0;", "break;", "case 0x80:\n{", "const char *VAR_3 = VAR_0->dev->conf.dinfo->VAR_3 ?\nVAR_0->dev->conf.dinfo->VAR_3 : \"0\";", "int VAR_4 = strlen(VAR_3);", "if (VAR_4 > VAR_0->cmd.xfer)\nVAR_4 = VAR_0->cmd.xfer;", "if (VAR_4 > 20)\nVAR_4 = 20;", "DPRINTF(\"Inquiry EVPD[Serial number] \"\n\"buffer size %zd\\n\", VAR_0->cmd.xfer);", "VAR_1[VAR_2++] = VAR_4;", "memcpy(VAR_1+VAR_2, VAR_3, VAR_4);", "VAR_2 += VAR_4;", "break;", "}", "case 0x83:\n{", "int VAR_5 = 255 - 8;", "int VAR_6 = strlen(bdrv_get_device_name(s->bs));", "if (VAR_6 > VAR_5)\nVAR_6 = VAR_5;", "DPRINTF(\"Inquiry EVPD[Device identification] \"\n\"buffer size %zd\\n\", VAR_0->cmd.xfer);", "VAR_1[VAR_2++] = 3 + VAR_6;", "VAR_1[VAR_2++] = 0x2;", "VAR_1[VAR_2++] = 0;", "VAR_1[VAR_2++] = 0;", "VAR_1[VAR_2++] = VAR_6;", "memcpy(VAR_1+VAR_2, bdrv_get_device_name(s->bs), VAR_6);", "VAR_2 += VAR_6;", "break;", "}", "case 0xb0:\n{", "unsigned int VAR_7 = s->qdev.conf.VAR_7 >> 9;", "unsigned int VAR_8 = s->qdev.conf.VAR_8 >> 9;", "VAR_1[3] = VAR_2 = 0x3c;", "memset(VAR_1 + 4, 0, VAR_2 - 4);", "VAR_1[6] = (VAR_7 >> 8) & 0xff;", "VAR_1[7] = VAR_7 & 0xff;", "VAR_1[12] = (VAR_8 >> 24) & 0xff;", "VAR_1[13] = (VAR_8 >> 16) & 0xff;", "VAR_1[14] = (VAR_8 >> 8) & 0xff;", "VAR_1[15] = VAR_8 & 0xff;", "break;", "}", "default:\nBADF(\"Error: unsupported Inquiry (EVPD[%02X]) \"\n\"buffer size %zd\\n\", page_code, VAR_0->cmd.xfer);", "return -1;", "}", "return VAR_2;", "}", "if (VAR_0->cmd.buf[2] != 0) {", "BADF(\"Error: Inquiry (STANDARD) page or code \"\n\"is non-zero [%02X]\\n\", VAR_0->cmd.buf[2]);", "return -1;", "}", "if (VAR_0->cmd.xfer < 5) {", "BADF(\"Error: Inquiry (STANDARD) buffer size %zd \"\n\"is less than 5\\n\", VAR_0->cmd.xfer);", "return -1;", "}", "VAR_2 = VAR_0->cmd.xfer;", "if (VAR_2 > SCSI_MAX_INQUIRY_LEN)\nVAR_2 = SCSI_MAX_INQUIRY_LEN;", "memset(VAR_1, 0, VAR_2);", "if (VAR_0->lun || VAR_0->cmd.buf[1] >> 5) {", "VAR_1[0] = 0x7f;", "return VAR_2;", "}", "if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {", "VAR_1[0] = 5;", "VAR_1[1] = 0x80;", "memcpy(&VAR_1[16], \"QEMU CD-ROM \", 16);", "} else {", "VAR_1[0] = 0;", "memcpy(&VAR_1[16], \"QEMU HARDDISK \", 16);", "}", "memcpy(&VAR_1[8], \"QEMU \", 8);", "memcpy(&VAR_1[32], s->version ? s->version : QEMU_VERSION, 4);", "VAR_1[2] = 5;", "VAR_1[3] = 2;", "if (VAR_2 > 36) {", "VAR_1[4] = VAR_2 - 5;", "} else {", "VAR_1[4] = 36 - 5;", "}", "VAR_1[7] = 0x10 | (VAR_0->bus->tcq ? 0x02 : 0);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59, 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83, 85 ], [ 87 ], [ 91, 93 ], [ 95, 97 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 127, 129 ], [ 131, 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 169 ], [ 173 ], [ 179 ], [ 181 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199, 201, 203 ], [ 205 ], [ 207 ], [ 211 ], [ 213 ], [ 219 ], [ 221, 223 ], [ 225 ], [ 227 ], [ 233 ], [ 235, 237 ], [ 239 ], [ 241 ], [ 245 ], [ 247, 249 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 299 ], [ 301 ], [ 305 ], [ 307 ], [ 309 ], [ 315 ], [ 317 ], [ 323 ], [ 325 ], [ 327 ] ]
13,423
static AddressSpace *memory_region_to_address_space(MemoryRegion *mr) { AddressSpace *as; while (mr->container) { mr = mr->container; } QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) { if (mr == as->root) { return as; } } abort(); }
false
qemu
eed2bacfd2519e45498b585a147f11b0fd01c3c7
static AddressSpace *memory_region_to_address_space(MemoryRegion *mr) { AddressSpace *as; while (mr->container) { mr = mr->container; } QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) { if (mr == as->root) { return as; } } abort(); }
{ "code": [], "line_no": [] }
static AddressSpace *FUNC_0(MemoryRegion *mr) { AddressSpace *as; while (mr->container) { mr = mr->container; } QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) { if (mr == as->root) { return as; } } abort(); }
[ "static AddressSpace *FUNC_0(MemoryRegion *mr)\n{", "AddressSpace *as;", "while (mr->container) {", "mr = mr->container;", "}", "QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {", "if (mr == as->root) {", "return as;", "}", "}", "abort();", "}" ]
[ 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 ] ]
13,425
static void bastardized_rice_decompress(ALACContext *alac, int32_t *output_buffer, int output_size, int readsamplesize, /* arg_10 */ int rice_initialhistory, /* arg424->b */ int rice_kmodifier, /* arg424->d */ int rice_historymult, /* arg424->c */ int rice_kmodifier_mask /* arg424->e */ ) { int output_count; unsigned int history = rice_initialhistory; int sign_modifier = 0; for (output_count = 0; output_count < output_size; output_count++) { int32_t x; int32_t x_modified; int32_t final_val; /* read x - number of 1s before 0 represent the rice */ x = get_unary_0_9(&alac->gb); if (x > 8) { /* RICE THRESHOLD */ /* use alternative encoding */ x = get_bits(&alac->gb, readsamplesize); } else { /* standard rice encoding */ int extrabits; int k; /* size of extra bits */ /* read k, that is bits as is */ k = 31 - count_leading_zeros((history >> 9) + 3); if (k >= rice_kmodifier) k = rice_kmodifier; if (k != 1) { extrabits = show_bits(&alac->gb, k); /* multiply x by 2^k - 1, as part of their strange algorithm */ x = (x << k) - x; if (extrabits > 1) { x += extrabits - 1; skip_bits(&alac->gb, k); } else skip_bits(&alac->gb, k - 1); } } x_modified = sign_modifier + x; final_val = (x_modified + 1) / 2; if (x_modified & 1) final_val *= -1; output_buffer[output_count] = final_val; sign_modifier = 0; /* now update the history */ history += x_modified * rice_historymult - ((history * rice_historymult) >> 9); if (x_modified > 0xffff) history = 0xffff; /* special case: there may be compressed blocks of 0 */ if ((history < 128) && (output_count+1 < output_size)) { int block_size; sign_modifier = 1; x = get_unary_0_9(&alac->gb); if (x > 8) { block_size = get_bits(&alac->gb, 16); } else { int k; int extrabits; k = count_leading_zeros(history) + ((history + 16) >> 6 /* / 64 */) - 24; extrabits = show_bits(&alac->gb, k); block_size = (((1 << k) - 1) & rice_kmodifier_mask) * x + extrabits - 1; if (extrabits < 2) { x = 1 - extrabits; block_size += x; skip_bits(&alac->gb, k - 1); } else { skip_bits(&alac->gb, k); } } if (block_size > 0) { memset(&output_buffer[output_count+1], 0, block_size * 4); output_count += block_size; } if (block_size > 0xffff) sign_modifier = 0; history = 0; } } }
false
FFmpeg
c49c5e23dc3fb273b46440656f74d416bcc9ab41
static void bastardized_rice_decompress(ALACContext *alac, int32_t *output_buffer, int output_size, int readsamplesize, int rice_initialhistory, int rice_kmodifier, int rice_historymult, int rice_kmodifier_mask ) { int output_count; unsigned int history = rice_initialhistory; int sign_modifier = 0; for (output_count = 0; output_count < output_size; output_count++) { int32_t x; int32_t x_modified; int32_t final_val; x = get_unary_0_9(&alac->gb); if (x > 8) { x = get_bits(&alac->gb, readsamplesize); } else { int extrabits; int k; k = 31 - count_leading_zeros((history >> 9) + 3); if (k >= rice_kmodifier) k = rice_kmodifier; if (k != 1) { extrabits = show_bits(&alac->gb, k); x = (x << k) - x; if (extrabits > 1) { x += extrabits - 1; skip_bits(&alac->gb, k); } else skip_bits(&alac->gb, k - 1); } } x_modified = sign_modifier + x; final_val = (x_modified + 1) / 2; if (x_modified & 1) final_val *= -1; output_buffer[output_count] = final_val; sign_modifier = 0; history += x_modified * rice_historymult - ((history * rice_historymult) >> 9); if (x_modified > 0xffff) history = 0xffff; if ((history < 128) && (output_count+1 < output_size)) { int block_size; sign_modifier = 1; x = get_unary_0_9(&alac->gb); if (x > 8) { block_size = get_bits(&alac->gb, 16); } else { int k; int extrabits; k = count_leading_zeros(history) + ((history + 16) >> 6 ) - 24; extrabits = show_bits(&alac->gb, k); block_size = (((1 << k) - 1) & rice_kmodifier_mask) * x + extrabits - 1; if (extrabits < 2) { x = 1 - extrabits; block_size += x; skip_bits(&alac->gb, k - 1); } else { skip_bits(&alac->gb, k); } } if (block_size > 0) { memset(&output_buffer[output_count+1], 0, block_size * 4); output_count += block_size; } if (block_size > 0xffff) sign_modifier = 0; history = 0; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(ALACContext *VAR_0, int32_t *VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, int VAR_7 ) { int VAR_8; unsigned int VAR_9 = VAR_4; int VAR_10 = 0; for (VAR_8 = 0; VAR_8 < VAR_2; VAR_8++) { int32_t x; int32_t x_modified; int32_t final_val; x = get_unary_0_9(&VAR_0->gb); if (x > 8) { x = get_bits(&VAR_0->gb, VAR_3); } else { int VAR_14; int VAR_14; VAR_14 = 31 - count_leading_zeros((VAR_9 >> 9) + 3); if (VAR_14 >= VAR_5) VAR_14 = VAR_5; if (VAR_14 != 1) { VAR_14 = show_bits(&VAR_0->gb, VAR_14); x = (x << VAR_14) - x; if (VAR_14 > 1) { x += VAR_14 - 1; skip_bits(&VAR_0->gb, VAR_14); } else skip_bits(&VAR_0->gb, VAR_14 - 1); } } x_modified = VAR_10 + x; final_val = (x_modified + 1) / 2; if (x_modified & 1) final_val *= -1; VAR_1[VAR_8] = final_val; VAR_10 = 0; VAR_9 += x_modified * VAR_6 - ((VAR_9 * VAR_6) >> 9); if (x_modified > 0xffff) VAR_9 = 0xffff; if ((VAR_9 < 128) && (VAR_8+1 < VAR_2)) { int VAR_13; VAR_10 = 1; x = get_unary_0_9(&VAR_0->gb); if (x > 8) { VAR_13 = get_bits(&VAR_0->gb, 16); } else { int VAR_14; int VAR_14; VAR_14 = count_leading_zeros(VAR_9) + ((VAR_9 + 16) >> 6 ) - 24; VAR_14 = show_bits(&VAR_0->gb, VAR_14); VAR_13 = (((1 << VAR_14) - 1) & VAR_7) * x + VAR_14 - 1; if (VAR_14 < 2) { x = 1 - VAR_14; VAR_13 += x; skip_bits(&VAR_0->gb, VAR_14 - 1); } else { skip_bits(&VAR_0->gb, VAR_14); } } if (VAR_13 > 0) { memset(&VAR_1[VAR_8+1], 0, VAR_13 * 4); VAR_8 += VAR_13; } if (VAR_13 > 0xffff) VAR_10 = 0; VAR_9 = 0; } } }
[ "static void FUNC_0(ALACContext *VAR_0,\nint32_t *VAR_1,\nint VAR_2,\nint VAR_3,\nint VAR_4,\nint VAR_5,\nint VAR_6,\nint VAR_7\n)\n{", "int VAR_8;", "unsigned int VAR_9 = VAR_4;", "int VAR_10 = 0;", "for (VAR_8 = 0; VAR_8 < VAR_2; VAR_8++) {", "int32_t x;", "int32_t x_modified;", "int32_t final_val;", "x = get_unary_0_9(&VAR_0->gb);", "if (x > 8) {", "x = get_bits(&VAR_0->gb, VAR_3);", "} else {", "int VAR_14;", "int VAR_14;", "VAR_14 = 31 - count_leading_zeros((VAR_9 >> 9) + 3);", "if (VAR_14 >= VAR_5)\nVAR_14 = VAR_5;", "if (VAR_14 != 1) {", "VAR_14 = show_bits(&VAR_0->gb, VAR_14);", "x = (x << VAR_14) - x;", "if (VAR_14 > 1) {", "x += VAR_14 - 1;", "skip_bits(&VAR_0->gb, VAR_14);", "} else", "skip_bits(&VAR_0->gb, VAR_14 - 1);", "}", "}", "x_modified = VAR_10 + x;", "final_val = (x_modified + 1) / 2;", "if (x_modified & 1) final_val *= -1;", "VAR_1[VAR_8] = final_val;", "VAR_10 = 0;", "VAR_9 += x_modified * VAR_6\n- ((VAR_9 * VAR_6) >> 9);", "if (x_modified > 0xffff)\nVAR_9 = 0xffff;", "if ((VAR_9 < 128) && (VAR_8+1 < VAR_2)) {", "int VAR_13;", "VAR_10 = 1;", "x = get_unary_0_9(&VAR_0->gb);", "if (x > 8) {", "VAR_13 = get_bits(&VAR_0->gb, 16);", "} else {", "int VAR_14;", "int VAR_14;", "VAR_14 = count_leading_zeros(VAR_9) + ((VAR_9 + 16) >> 6 ) - 24;", "VAR_14 = show_bits(&VAR_0->gb, VAR_14);", "VAR_13 = (((1 << VAR_14) - 1) & VAR_7) * x\n+ VAR_14 - 1;", "if (VAR_14 < 2) {", "x = 1 - VAR_14;", "VAR_13 += x;", "skip_bits(&VAR_0->gb, VAR_14 - 1);", "} else {", "skip_bits(&VAR_0->gb, VAR_14);", "}", "}", "if (VAR_13 > 0) {", "memset(&VAR_1[VAR_8+1], 0, VAR_13 * 4);", "VAR_8 += VAR_13;", "}", "if (VAR_13 > 0xffff)\nVAR_10 = 0;", "VAR_9 = 0;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 63 ], [ 67, 69 ], [ 73 ], [ 75 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 113 ], [ 119, 121 ], [ 125, 127 ], [ 133 ], [ 135 ], [ 139 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 163 ], [ 167, 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201, 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ] ]
13,428
void OPPROTO op_int_im(void) { EIP = PARAM1; raise_exception(EXCP0D_GPF); }
false
qemu
504e56ebdca53bf8e8d379aa994e90a2e3b0d564
void OPPROTO op_int_im(void) { EIP = PARAM1; raise_exception(EXCP0D_GPF); }
{ "code": [], "line_no": [] }
void VAR_0 op_int_im(void) { EIP = PARAM1; raise_exception(EXCP0D_GPF); }
[ "void VAR_0 op_int_im(void)\n{", "EIP = PARAM1;", "raise_exception(EXCP0D_GPF);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
13,430
static inline TCGv gen_ld16s(TCGv addr, int index) { TCGv tmp = new_tmp(); tcg_gen_qemu_ld16s(tmp, addr, index); return tmp; }
true
qemu
7d1b0095bff7157e856d1d0e6c4295641ced2752
static inline TCGv gen_ld16s(TCGv addr, int index) { TCGv tmp = new_tmp(); tcg_gen_qemu_ld16s(tmp, addr, index); return tmp; }
{ "code": [ " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();", " TCGv tmp = new_tmp();" ], "line_no": [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ] }
static inline TCGv FUNC_0(TCGv addr, int index) { TCGv tmp = new_tmp(); tcg_gen_qemu_ld16s(tmp, addr, index); return tmp; }
[ "static inline TCGv FUNC_0(TCGv addr, int index)\n{", "TCGv tmp = new_tmp();", "tcg_gen_qemu_ld16s(tmp, addr, index);", "return tmp;", "}" ]
[ 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
13,431
static av_cold int vc2_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { int ret; int max_frame_bytes, sig_size = 256; VC2EncContext *s = avctx->priv_data; const char aux_data[] = LIBAVCODEC_IDENT; const int aux_data_size = sizeof(aux_data); const int header_size = 100 + aux_data_size; int64_t r_bitrate = avctx->bit_rate >> (s->interlaced); s->avctx = avctx; s->size_scaler = 1; s->prefix_bytes = 0; s->last_parse_code = 0; s->next_parse_offset = 0; /* Rate control */ max_frame_bytes = (av_rescale(r_bitrate, s->avctx->time_base.num, s->avctx->time_base.den) >> 3) - header_size; /* Find an appropriate size scaler */ while (sig_size > 255) { s->slice_max_bytes = FFALIGN(av_rescale(max_frame_bytes, 1, s->num_x*s->num_y), s->size_scaler); s->slice_max_bytes += 4 + s->prefix_bytes; sig_size = s->slice_max_bytes/s->size_scaler; /* Signalled slize size */ s->size_scaler <<= 1; } s->slice_min_bytes = s->slice_max_bytes - s->slice_max_bytes*(s->tolerance/100.0f); ret = ff_alloc_packet2(avctx, avpkt, max_frame_bytes*3, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } else { init_put_bits(&s->pb, avpkt->data, avpkt->size); } encode_frame(s, frame, aux_data, s->interlaced); if (s->interlaced) encode_frame(s, frame, NULL, 2); flush_put_bits(&s->pb); avpkt->size = put_bits_count(&s->pb) >> 3; *got_packet_ptr = 1; return 0; }
true
FFmpeg
b88be742fac7a77a8095e8155ba8790db4b77568
static av_cold int vc2_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { int ret; int max_frame_bytes, sig_size = 256; VC2EncContext *s = avctx->priv_data; const char aux_data[] = LIBAVCODEC_IDENT; const int aux_data_size = sizeof(aux_data); const int header_size = 100 + aux_data_size; int64_t r_bitrate = avctx->bit_rate >> (s->interlaced); s->avctx = avctx; s->size_scaler = 1; s->prefix_bytes = 0; s->last_parse_code = 0; s->next_parse_offset = 0; max_frame_bytes = (av_rescale(r_bitrate, s->avctx->time_base.num, s->avctx->time_base.den) >> 3) - header_size; while (sig_size > 255) { s->slice_max_bytes = FFALIGN(av_rescale(max_frame_bytes, 1, s->num_x*s->num_y), s->size_scaler); s->slice_max_bytes += 4 + s->prefix_bytes; sig_size = s->slice_max_bytes/s->size_scaler; s->size_scaler <<= 1; } s->slice_min_bytes = s->slice_max_bytes - s->slice_max_bytes*(s->tolerance/100.0f); ret = ff_alloc_packet2(avctx, avpkt, max_frame_bytes*3, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } else { init_put_bits(&s->pb, avpkt->data, avpkt->size); } encode_frame(s, frame, aux_data, s->interlaced); if (s->interlaced) encode_frame(s, frame, NULL, 2); flush_put_bits(&s->pb); avpkt->size = put_bits_count(&s->pb) >> 3; *got_packet_ptr = 1; return 0; }
{ "code": [ " } else {", " } else {", " int ret;", " int max_frame_bytes, sig_size = 256;", " int64_t r_bitrate = avctx->bit_rate >> (s->interlaced);", " ret = ff_alloc_packet2(avctx, avpkt, max_frame_bytes*3, 0);", " if (ret < 0) {", " av_log(avctx, AV_LOG_ERROR, \"Error getting output packet.\\n\");", " } else {", " init_put_bits(&s->pb, avpkt->data, avpkt->size);", " encode_frame(s, frame, aux_data, s->interlaced);", " if (s->interlaced)", " encode_frame(s, frame, NULL, 2);" ], "line_no": [ 73, 73, 7, 9, 19, 65, 67, 69, 73, 75, 81, 83, 85 ] }
static av_cold int FUNC_0(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { int VAR_0; int VAR_1, VAR_2 = 256; VC2EncContext *s = avctx->priv_data; const char VAR_3[] = LIBAVCODEC_IDENT; const int VAR_4 = sizeof(VAR_3); const int VAR_5 = 100 + VAR_4; int64_t r_bitrate = avctx->bit_rate >> (s->interlaced); s->avctx = avctx; s->size_scaler = 1; s->prefix_bytes = 0; s->last_parse_code = 0; s->next_parse_offset = 0; VAR_1 = (av_rescale(r_bitrate, s->avctx->time_base.num, s->avctx->time_base.den) >> 3) - VAR_5; while (VAR_2 > 255) { s->slice_max_bytes = FFALIGN(av_rescale(VAR_1, 1, s->num_x*s->num_y), s->size_scaler); s->slice_max_bytes += 4 + s->prefix_bytes; VAR_2 = s->slice_max_bytes/s->size_scaler; s->size_scaler <<= 1; } s->slice_min_bytes = s->slice_max_bytes - s->slice_max_bytes*(s->tolerance/100.0f); VAR_0 = ff_alloc_packet2(avctx, avpkt, VAR_1*3, 0); if (VAR_0 < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return VAR_0; } else { init_put_bits(&s->pb, avpkt->data, avpkt->size); } encode_frame(s, frame, VAR_3, s->interlaced); if (s->interlaced) encode_frame(s, frame, NULL, 2); flush_put_bits(&s->pb); avpkt->size = put_bits_count(&s->pb) >> 3; *got_packet_ptr = 1; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx, AVPacket *avpkt,\nconst AVFrame *frame, int *got_packet_ptr)\n{", "int VAR_0;", "int VAR_1, VAR_2 = 256;", "VC2EncContext *s = avctx->priv_data;", "const char VAR_3[] = LIBAVCODEC_IDENT;", "const int VAR_4 = sizeof(VAR_3);", "const int VAR_5 = 100 + VAR_4;", "int64_t r_bitrate = avctx->bit_rate >> (s->interlaced);", "s->avctx = avctx;", "s->size_scaler = 1;", "s->prefix_bytes = 0;", "s->last_parse_code = 0;", "s->next_parse_offset = 0;", "VAR_1 = (av_rescale(r_bitrate, s->avctx->time_base.num,\ns->avctx->time_base.den) >> 3) - VAR_5;", "while (VAR_2 > 255) {", "s->slice_max_bytes = FFALIGN(av_rescale(VAR_1, 1,\ns->num_x*s->num_y), s->size_scaler);", "s->slice_max_bytes += 4 + s->prefix_bytes;", "VAR_2 = s->slice_max_bytes/s->size_scaler;", "s->size_scaler <<= 1;", "}", "s->slice_min_bytes = s->slice_max_bytes - s->slice_max_bytes*(s->tolerance/100.0f);", "VAR_0 = ff_alloc_packet2(avctx, avpkt, VAR_1*3, 0);", "if (VAR_0 < 0) {", "av_log(avctx, AV_LOG_ERROR, \"Error getting output packet.\\n\");", "return VAR_0;", "} else {", "init_put_bits(&s->pb, avpkt->data, avpkt->size);", "}", "encode_frame(s, frame, VAR_3, s->interlaced);", "if (s->interlaced)\nencode_frame(s, frame, NULL, 2);", "flush_put_bits(&s->pb);", "avpkt->size = put_bits_count(&s->pb) >> 3;", "*got_packet_ptr = 1;", "return 0;", "}" ]
[ 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 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 ], [ 37, 39 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83, 85 ], [ 89 ], [ 91 ], [ 95 ], [ 99 ], [ 101 ] ]
13,432
static inline int xhci_running(XHCIState *xhci) { return !(xhci->usbsts & USBSTS_HCH) && !xhci->intr[0].er_full; }
true
qemu
898248a32915024a4f01ce4f0c3519509fb703cb
static inline int xhci_running(XHCIState *xhci) { return !(xhci->usbsts & USBSTS_HCH) && !xhci->intr[0].er_full; }
{ "code": [ " return !(xhci->usbsts & USBSTS_HCH) && !xhci->intr[0].er_full;" ], "line_no": [ 5 ] }
static inline int FUNC_0(XHCIState *VAR_0) { return !(VAR_0->usbsts & USBSTS_HCH) && !VAR_0->intr[0].er_full; }
[ "static inline int FUNC_0(XHCIState *VAR_0)\n{", "return !(VAR_0->usbsts & USBSTS_HCH) && !VAR_0->intr[0].er_full;", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
13,433
static int local_utimensat(FsContext *s, V9fsPath *fs_path, const struct timespec *buf) { char *buffer; int ret; char *path = fs_path->data; buffer = rpath(s, path); ret = qemu_utimens(buffer, buf); g_free(buffer); return ret; }
true
qemu
a33eda0dd99e00faa3bacae43d19490bb9500e07
static int local_utimensat(FsContext *s, V9fsPath *fs_path, const struct timespec *buf) { char *buffer; int ret; char *path = fs_path->data; buffer = rpath(s, path); ret = qemu_utimens(buffer, buf); g_free(buffer); return ret; }
{ "code": [ " char *buffer;", " int ret;", " char *path = fs_path->data;", " buffer = rpath(s, path);", " ret = qemu_utimens(buffer, buf);", " g_free(buffer);" ], "line_no": [ 7, 9, 11, 15, 17, 19 ] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, const struct timespec *VAR_2) { char *VAR_3; int VAR_4; char *VAR_5 = VAR_1->data; VAR_3 = rpath(VAR_0, VAR_5); VAR_4 = qemu_utimens(VAR_3, VAR_2); g_free(VAR_3); return VAR_4; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,\nconst struct timespec *VAR_2)\n{", "char *VAR_3;", "int VAR_4;", "char *VAR_5 = VAR_1->data;", "VAR_3 = rpath(VAR_0, VAR_5);", "VAR_4 = qemu_utimens(VAR_3, VAR_2);", "g_free(VAR_3);", "return VAR_4;", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
13,434
static int qemu_chr_open_stdio(QemuOpts *opts, CharDriverState **_chr) { CharDriverState *chr; if (stdio_nb_clients >= STDIO_MAX_CLIENTS) { return -EBUSY; } if (stdio_nb_clients == 0) { old_fd0_flags = fcntl(0, F_GETFL); tcgetattr (0, &oldtty); fcntl(0, F_SETFL, O_NONBLOCK); atexit(term_exit); } chr = qemu_chr_open_fd(0, 1); chr->chr_close = qemu_chr_close_stdio; chr->chr_set_echo = qemu_chr_set_echo_stdio; qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr); stdio_nb_clients++; stdio_allow_signal = qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC); qemu_chr_fe_set_echo(chr, false); *_chr = chr; return 0; }
true
qemu
1f51470d044852592922f91000e741c381582cdc
static int qemu_chr_open_stdio(QemuOpts *opts, CharDriverState **_chr) { CharDriverState *chr; if (stdio_nb_clients >= STDIO_MAX_CLIENTS) { return -EBUSY; } if (stdio_nb_clients == 0) { old_fd0_flags = fcntl(0, F_GETFL); tcgetattr (0, &oldtty); fcntl(0, F_SETFL, O_NONBLOCK); atexit(term_exit); } chr = qemu_chr_open_fd(0, 1); chr->chr_close = qemu_chr_close_stdio; chr->chr_set_echo = qemu_chr_set_echo_stdio; qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr); stdio_nb_clients++; stdio_allow_signal = qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC); qemu_chr_fe_set_echo(chr, false); *_chr = chr; return 0; }
{ "code": [ " return -EBUSY;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " return 0;", " return 0;", " return 0;", "static int qemu_chr_open_stdio(QemuOpts *opts, CharDriverState **_chr)", " if (stdio_nb_clients >= STDIO_MAX_CLIENTS) {", " return -EBUSY;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;", " *_chr = chr;", " return 0;" ], "line_no": [ 11, 49, 51, 49, 51, 49, 51, 51, 51, 51, 1, 9, 11, 49, 51, 49, 51, 49, 51, 49, 51, 49, 51, 49, 51, 49, 51, 51, 49, 51, 49, 51, 49, 51, 49, 51 ] }
static int FUNC_0(QemuOpts *VAR_0, CharDriverState **VAR_1) { CharDriverState *chr; if (stdio_nb_clients >= STDIO_MAX_CLIENTS) { return -EBUSY; } if (stdio_nb_clients == 0) { old_fd0_flags = fcntl(0, F_GETFL); tcgetattr (0, &oldtty); fcntl(0, F_SETFL, O_NONBLOCK); atexit(term_exit); } chr = qemu_chr_open_fd(0, 1); chr->chr_close = qemu_chr_close_stdio; chr->chr_set_echo = qemu_chr_set_echo_stdio; qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr); stdio_nb_clients++; stdio_allow_signal = qemu_opt_get_bool(VAR_0, "signal", display_type != DT_NOGRAPHIC); qemu_chr_fe_set_echo(chr, false); *VAR_1 = chr; return 0; }
[ "static int FUNC_0(QemuOpts *VAR_0, CharDriverState **VAR_1)\n{", "CharDriverState *chr;", "if (stdio_nb_clients >= STDIO_MAX_CLIENTS) {", "return -EBUSY;", "}", "if (stdio_nb_clients == 0) {", "old_fd0_flags = fcntl(0, F_GETFL);", "tcgetattr (0, &oldtty);", "fcntl(0, F_SETFL, O_NONBLOCK);", "atexit(term_exit);", "}", "chr = qemu_chr_open_fd(0, 1);", "chr->chr_close = qemu_chr_close_stdio;", "chr->chr_set_echo = qemu_chr_set_echo_stdio;", "qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr);", "stdio_nb_clients++;", "stdio_allow_signal = qemu_opt_get_bool(VAR_0, \"signal\",\ndisplay_type != DT_NOGRAPHIC);", "qemu_chr_fe_set_echo(chr, false);", "*VAR_1 = chr;", "return 0;", "}" ]
[ 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ] ]
13,435
static int qemu_gluster_reopen_prepare(BDRVReopenState *state, BlockReopenQueue *queue, Error **errp) { int ret = 0; BDRVGlusterReopenState *reop_s; GlusterConf *gconf = NULL; int open_flags = 0; assert(state != NULL); assert(state->bs != NULL); state->opaque = g_malloc0(sizeof(BDRVGlusterReopenState)); reop_s = state->opaque; qemu_gluster_parse_flags(state->flags, &open_flags); gconf = g_malloc0(sizeof(GlusterConf)); reop_s->glfs = qemu_gluster_init(gconf, state->bs->filename, errp); if (reop_s->glfs == NULL) { ret = -errno; goto exit; } reop_s->fd = glfs_open(reop_s->glfs, gconf->image, open_flags); if (reop_s->fd == NULL) { /* reops->glfs will be cleaned up in _abort */ ret = -errno; goto exit; } exit: /* state->opaque will be freed in either the _abort or _commit */ qemu_gluster_gconf_free(gconf); return ret; }
true
qemu
5839e53bbc0fec56021d758aab7610df421ed8c8
static int qemu_gluster_reopen_prepare(BDRVReopenState *state, BlockReopenQueue *queue, Error **errp) { int ret = 0; BDRVGlusterReopenState *reop_s; GlusterConf *gconf = NULL; int open_flags = 0; assert(state != NULL); assert(state->bs != NULL); state->opaque = g_malloc0(sizeof(BDRVGlusterReopenState)); reop_s = state->opaque; qemu_gluster_parse_flags(state->flags, &open_flags); gconf = g_malloc0(sizeof(GlusterConf)); reop_s->glfs = qemu_gluster_init(gconf, state->bs->filename, errp); if (reop_s->glfs == NULL) { ret = -errno; goto exit; } reop_s->fd = glfs_open(reop_s->glfs, gconf->image, open_flags); if (reop_s->fd == NULL) { ret = -errno; goto exit; } exit: qemu_gluster_gconf_free(gconf); return ret; }
{ "code": [ " state->opaque = g_malloc0(sizeof(BDRVGlusterReopenState));", " gconf = g_malloc0(sizeof(GlusterConf));" ], "line_no": [ 23, 33 ] }
static int FUNC_0(BDRVReopenState *VAR_0, BlockReopenQueue *VAR_1, Error **VAR_2) { int VAR_3 = 0; BDRVGlusterReopenState *reop_s; GlusterConf *gconf = NULL; int VAR_4 = 0; assert(VAR_0 != NULL); assert(VAR_0->bs != NULL); VAR_0->opaque = g_malloc0(sizeof(BDRVGlusterReopenState)); reop_s = VAR_0->opaque; qemu_gluster_parse_flags(VAR_0->flags, &VAR_4); gconf = g_malloc0(sizeof(GlusterConf)); reop_s->glfs = qemu_gluster_init(gconf, VAR_0->bs->filename, VAR_2); if (reop_s->glfs == NULL) { VAR_3 = -errno; goto exit; } reop_s->fd = glfs_open(reop_s->glfs, gconf->image, VAR_4); if (reop_s->fd == NULL) { VAR_3 = -errno; goto exit; } exit: qemu_gluster_gconf_free(gconf); return VAR_3; }
[ "static int FUNC_0(BDRVReopenState *VAR_0,\nBlockReopenQueue *VAR_1, Error **VAR_2)\n{", "int VAR_3 = 0;", "BDRVGlusterReopenState *reop_s;", "GlusterConf *gconf = NULL;", "int VAR_4 = 0;", "assert(VAR_0 != NULL);", "assert(VAR_0->bs != NULL);", "VAR_0->opaque = g_malloc0(sizeof(BDRVGlusterReopenState));", "reop_s = VAR_0->opaque;", "qemu_gluster_parse_flags(VAR_0->flags, &VAR_4);", "gconf = g_malloc0(sizeof(GlusterConf));", "reop_s->glfs = qemu_gluster_init(gconf, VAR_0->bs->filename, VAR_2);", "if (reop_s->glfs == NULL) {", "VAR_3 = -errno;", "goto exit;", "}", "reop_s->fd = glfs_open(reop_s->glfs, gconf->image, VAR_4);", "if (reop_s->fd == NULL) {", "VAR_3 = -errno;", "goto exit;", "}", "exit:\nqemu_gluster_gconf_free(gconf);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 63, 67 ], [ 69 ], [ 71 ] ]
13,436
static void cabac_reinit(HEVCLocalContext *lc) { skip_bytes(&lc->cc, 0); }
true
FFmpeg
4ff94558f23a5de43aed4ca3429963dd1d995250
static void cabac_reinit(HEVCLocalContext *lc) { skip_bytes(&lc->cc, 0); }
{ "code": [ "static void cabac_reinit(HEVCLocalContext *lc)", " skip_bytes(&lc->cc, 0);" ], "line_no": [ 1, 5 ] }
static void FUNC_0(HEVCLocalContext *VAR_0) { skip_bytes(&VAR_0->cc, 0); }
[ "static void FUNC_0(HEVCLocalContext *VAR_0)\n{", "skip_bytes(&VAR_0->cc, 0);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
13,438
static int write_option(void *optctx, const OptionDef *po, const char *opt, const char *arg) { /* new-style options contain an offset into optctx, old-style address of * a global var*/ void *dst = po->flags & (OPT_OFFSET | OPT_SPEC) ? (uint8_t *)optctx + po->u.off : po->u.dst_ptr; int *dstcount; if (po->flags & OPT_SPEC) { SpecifierOpt **so = dst; char *p = strchr(opt, ':'); dstcount = (int *)(so + 1); *so = grow_array(*so, sizeof(**so), dstcount, *dstcount + 1); (*so)[*dstcount - 1].specifier = av_strdup(p ? p + 1 : ""); dst = &(*so)[*dstcount - 1].u; } if (po->flags & OPT_STRING) { char *str; str = av_strdup(arg); av_freep(dst); *(char **)dst = str; } else if (po->flags & OPT_BOOL || po->flags & OPT_INT) { *(int *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX); } else if (po->flags & OPT_INT64) { *(int64_t *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX); } else if (po->flags & OPT_TIME) { *(int64_t *)dst = parse_time_or_die(opt, arg, 1); } else if (po->flags & OPT_FLOAT) { *(float *)dst = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY); } else if (po->flags & OPT_DOUBLE) { *(double *)dst = parse_number_or_die(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY); } else if (po->u.func_arg) { int ret = po->u.func_arg(optctx, opt, arg); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Failed to set value '%s' for option '%s'\n", arg, opt); return ret; } } if (po->flags & OPT_EXIT) exit(0); return 0; }
true
FFmpeg
636ced8e1dc8248a1353b416240b93d70ad03edb
static int write_option(void *optctx, const OptionDef *po, const char *opt, const char *arg) { void *dst = po->flags & (OPT_OFFSET | OPT_SPEC) ? (uint8_t *)optctx + po->u.off : po->u.dst_ptr; int *dstcount; if (po->flags & OPT_SPEC) { SpecifierOpt **so = dst; char *p = strchr(opt, ':'); dstcount = (int *)(so + 1); *so = grow_array(*so, sizeof(**so), dstcount, *dstcount + 1); (*so)[*dstcount - 1].specifier = av_strdup(p ? p + 1 : ""); dst = &(*so)[*dstcount - 1].u; } if (po->flags & OPT_STRING) { char *str; str = av_strdup(arg); av_freep(dst); *(char **)dst = str; } else if (po->flags & OPT_BOOL || po->flags & OPT_INT) { *(int *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX); } else if (po->flags & OPT_INT64) { *(int64_t *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX); } else if (po->flags & OPT_TIME) { *(int64_t *)dst = parse_time_or_die(opt, arg, 1); } else if (po->flags & OPT_FLOAT) { *(float *)dst = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY); } else if (po->flags & OPT_DOUBLE) { *(double *)dst = parse_number_or_die(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY); } else if (po->u.func_arg) { int ret = po->u.func_arg(optctx, opt, arg); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Failed to set value '%s' for option '%s'\n", arg, opt); return ret; } } if (po->flags & OPT_EXIT) exit(0); return 0; }
{ "code": [ " exit(0);" ], "line_no": [ 87 ] }
static int FUNC_0(void *VAR_0, const OptionDef *VAR_1, const char *VAR_2, const char *VAR_3) { void *VAR_4 = VAR_1->flags & (OPT_OFFSET | OPT_SPEC) ? (uint8_t *)VAR_0 + VAR_1->u.off : VAR_1->u.dst_ptr; int *VAR_5; if (VAR_1->flags & OPT_SPEC) { SpecifierOpt **so = VAR_4; char *VAR_6 = strchr(VAR_2, ':'); VAR_5 = (int *)(so + 1); *so = grow_array(*so, sizeof(**so), VAR_5, *VAR_5 + 1); (*so)[*VAR_5 - 1].specifier = av_strdup(VAR_6 ? VAR_6 + 1 : ""); VAR_4 = &(*so)[*VAR_5 - 1].u; } if (VAR_1->flags & OPT_STRING) { char *VAR_7; VAR_7 = av_strdup(VAR_3); av_freep(VAR_4); *(char **)VAR_4 = VAR_7; } else if (VAR_1->flags & OPT_BOOL || VAR_1->flags & OPT_INT) { *(int *)VAR_4 = parse_number_or_die(VAR_2, VAR_3, OPT_INT64, INT_MIN, INT_MAX); } else if (VAR_1->flags & OPT_INT64) { *(int64_t *)VAR_4 = parse_number_or_die(VAR_2, VAR_3, OPT_INT64, INT64_MIN, INT64_MAX); } else if (VAR_1->flags & OPT_TIME) { *(int64_t *)VAR_4 = parse_time_or_die(VAR_2, VAR_3, 1); } else if (VAR_1->flags & OPT_FLOAT) { *(float *)VAR_4 = parse_number_or_die(VAR_2, VAR_3, OPT_FLOAT, -INFINITY, INFINITY); } else if (VAR_1->flags & OPT_DOUBLE) { *(double *)VAR_4 = parse_number_or_die(VAR_2, VAR_3, OPT_DOUBLE, -INFINITY, INFINITY); } else if (VAR_1->u.func_arg) { int VAR_8 = VAR_1->u.func_arg(VAR_0, VAR_2, VAR_3); if (VAR_8 < 0) { av_log(NULL, AV_LOG_ERROR, "Failed to set value '%s' for option '%s'\n", VAR_3, VAR_2); return VAR_8; } } if (VAR_1->flags & OPT_EXIT) exit(0); return 0; }
[ "static int FUNC_0(void *VAR_0, const OptionDef *VAR_1, const char *VAR_2,\nconst char *VAR_3)\n{", "void *VAR_4 = VAR_1->flags & (OPT_OFFSET | OPT_SPEC) ?\n(uint8_t *)VAR_0 + VAR_1->u.off : VAR_1->u.dst_ptr;", "int *VAR_5;", "if (VAR_1->flags & OPT_SPEC) {", "SpecifierOpt **so = VAR_4;", "char *VAR_6 = strchr(VAR_2, ':');", "VAR_5 = (int *)(so + 1);", "*so = grow_array(*so, sizeof(**so), VAR_5, *VAR_5 + 1);", "(*so)[*VAR_5 - 1].specifier = av_strdup(VAR_6 ? VAR_6 + 1 : \"\");", "VAR_4 = &(*so)[*VAR_5 - 1].u;", "}", "if (VAR_1->flags & OPT_STRING) {", "char *VAR_7;", "VAR_7 = av_strdup(VAR_3);", "av_freep(VAR_4);", "*(char **)VAR_4 = VAR_7;", "} else if (VAR_1->flags & OPT_BOOL || VAR_1->flags & OPT_INT) {", "*(int *)VAR_4 = parse_number_or_die(VAR_2, VAR_3, OPT_INT64, INT_MIN, INT_MAX);", "} else if (VAR_1->flags & OPT_INT64) {", "*(int64_t *)VAR_4 = parse_number_or_die(VAR_2, VAR_3, OPT_INT64, INT64_MIN, INT64_MAX);", "} else if (VAR_1->flags & OPT_TIME) {", "*(int64_t *)VAR_4 = parse_time_or_die(VAR_2, VAR_3, 1);", "} else if (VAR_1->flags & OPT_FLOAT) {", "*(float *)VAR_4 = parse_number_or_die(VAR_2, VAR_3, OPT_FLOAT, -INFINITY, INFINITY);", "} else if (VAR_1->flags & OPT_DOUBLE) {", "*(double *)VAR_4 = parse_number_or_die(VAR_2, VAR_3, OPT_DOUBLE, -INFINITY, INFINITY);", "} else if (VAR_1->u.func_arg) {", "int VAR_8 = VAR_1->u.func_arg(VAR_0, VAR_2, VAR_3);", "if (VAR_8 < 0) {", "av_log(NULL, AV_LOG_ERROR,\n\"Failed to set value '%s' for option '%s'\\n\", VAR_3, VAR_2);", "return VAR_8;", "}", "}", "if (VAR_1->flags & OPT_EXIT)\nexit(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, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 11, 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 91 ], [ 93 ] ]
13,439
static uint32_t serial_ioport_read(void *opaque, uint32_t addr) { SerialState *s = opaque; uint32_t ret; addr &= 7; switch(addr) { default: case 0: if (s->lcr & UART_LCR_DLAB) { ret = s->divider & 0xff; } else { ret = s->rbr; s->lsr &= ~(UART_LSR_DR | UART_LSR_BI); serial_update_irq(s); if (!(s->mcr & UART_MCR_LOOP)) { /* in loopback mode, don't receive any data */ qemu_chr_accept_input(s->chr); } } break; case 1: if (s->lcr & UART_LCR_DLAB) { ret = (s->divider >> 8) & 0xff; } else { ret = s->ier; } break; case 2: ret = s->iir; /* reset THR pending bit */ if ((ret & 0x7) == UART_IIR_THRI) s->thr_ipending = 0; serial_update_irq(s); break; case 3: ret = s->lcr; break; case 4: ret = s->mcr; break; case 5: ret = s->lsr; break; case 6: if (s->mcr & UART_MCR_LOOP) { /* in loopback, the modem output pins are connected to the inputs */ ret = (s->mcr & 0x0c) << 4; ret |= (s->mcr & 0x02) << 3; ret |= (s->mcr & 0x01) << 5; } else { ret = s->msr; } break; case 7: ret = s->scr; break; } #ifdef DEBUG_SERIAL printf("serial: read addr=0x%02x val=0x%02x\n", addr, ret); #endif return ret; }
true
qemu
81174dae3f9189519cd60c7b79e91c291b021bbe
static uint32_t serial_ioport_read(void *opaque, uint32_t addr) { SerialState *s = opaque; uint32_t ret; addr &= 7; switch(addr) { default: case 0: if (s->lcr & UART_LCR_DLAB) { ret = s->divider & 0xff; } else { ret = s->rbr; s->lsr &= ~(UART_LSR_DR | UART_LSR_BI); serial_update_irq(s); if (!(s->mcr & UART_MCR_LOOP)) { qemu_chr_accept_input(s->chr); } } break; case 1: if (s->lcr & UART_LCR_DLAB) { ret = (s->divider >> 8) & 0xff; } else { ret = s->ier; } break; case 2: ret = s->iir; if ((ret & 0x7) == UART_IIR_THRI) s->thr_ipending = 0; serial_update_irq(s); break; case 3: ret = s->lcr; break; case 4: ret = s->mcr; break; case 5: ret = s->lsr; break; case 6: if (s->mcr & UART_MCR_LOOP) { ret = (s->mcr & 0x0c) << 4; ret |= (s->mcr & 0x02) << 3; ret |= (s->mcr & 0x01) << 5; } else { ret = s->msr; } break; case 7: ret = s->scr; break; } #ifdef DEBUG_SERIAL printf("serial: read addr=0x%02x val=0x%02x\n", addr, ret); #endif return ret; }
{ "code": [ " SerialState *s = opaque;", " if (!(s->mcr & UART_MCR_LOOP)) {", " serial_update_irq(s);", " ret = s->rbr;", " s->lsr &= ~(UART_LSR_DR | UART_LSR_BI);", " if ((ret & 0x7) == UART_IIR_THRI)" ], "line_no": [ 5, 31, 29, 25, 27, 63 ] }
static uint32_t FUNC_0(void *opaque, uint32_t addr) { SerialState *s = opaque; uint32_t ret; addr &= 7; switch(addr) { default: case 0: if (s->lcr & UART_LCR_DLAB) { ret = s->divider & 0xff; } else { ret = s->rbr; s->lsr &= ~(UART_LSR_DR | UART_LSR_BI); serial_update_irq(s); if (!(s->mcr & UART_MCR_LOOP)) { qemu_chr_accept_input(s->chr); } } break; case 1: if (s->lcr & UART_LCR_DLAB) { ret = (s->divider >> 8) & 0xff; } else { ret = s->ier; } break; case 2: ret = s->iir; if ((ret & 0x7) == UART_IIR_THRI) s->thr_ipending = 0; serial_update_irq(s); break; case 3: ret = s->lcr; break; case 4: ret = s->mcr; break; case 5: ret = s->lsr; break; case 6: if (s->mcr & UART_MCR_LOOP) { ret = (s->mcr & 0x0c) << 4; ret |= (s->mcr & 0x02) << 3; ret |= (s->mcr & 0x01) << 5; } else { ret = s->msr; } break; case 7: ret = s->scr; break; } #ifdef DEBUG_SERIAL printf("serial: read addr=0x%02x val=0x%02x\n", addr, ret); #endif return ret; }
[ "static uint32_t FUNC_0(void *opaque, uint32_t addr)\n{", "SerialState *s = opaque;", "uint32_t ret;", "addr &= 7;", "switch(addr) {", "default:\ncase 0:\nif (s->lcr & UART_LCR_DLAB) {", "ret = s->divider & 0xff;", "} else {", "ret = s->rbr;", "s->lsr &= ~(UART_LSR_DR | UART_LSR_BI);", "serial_update_irq(s);", "if (!(s->mcr & UART_MCR_LOOP)) {", "qemu_chr_accept_input(s->chr);", "}", "}", "break;", "case 1:\nif (s->lcr & UART_LCR_DLAB) {", "ret = (s->divider >> 8) & 0xff;", "} else {", "ret = s->ier;", "}", "break;", "case 2:\nret = s->iir;", "if ((ret & 0x7) == UART_IIR_THRI)\ns->thr_ipending = 0;", "serial_update_irq(s);", "break;", "case 3:\nret = s->lcr;", "break;", "case 4:\nret = s->mcr;", "break;", "case 5:\nret = s->lsr;", "break;", "case 6:\nif (s->mcr & UART_MCR_LOOP) {", "ret = (s->mcr & 0x0c) << 4;", "ret |= (s->mcr & 0x02) << 3;", "ret |= (s->mcr & 0x01) << 5;", "} else {", "ret = s->msr;", "}", "break;", "case 7:\nret = s->scr;", "break;", "}", "#ifdef DEBUG_SERIAL\nprintf(\"serial: read addr=0x%02x val=0x%02x\\n\", addr, ret);", "#endif\nreturn ret;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 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 ], [ 11 ], [ 13 ], [ 15, 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123, 125 ], [ 127 ] ]
13,440
e1000e_init_msix(E1000EState *s) { PCIDevice *d = PCI_DEVICE(s); int res = msix_init(PCI_DEVICE(s), E1000E_MSIX_VEC_NUM, &s->msix, E1000E_MSIX_IDX, E1000E_MSIX_TABLE, &s->msix, E1000E_MSIX_IDX, E1000E_MSIX_PBA, 0xA0); if (res < 0) { trace_e1000e_msix_init_fail(res); } else { if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) { msix_uninit(d, &s->msix, &s->msix); } } }
true
qemu
ee640c625e190a0c0e6b8966adc0e4720fb75200
e1000e_init_msix(E1000EState *s) { PCIDevice *d = PCI_DEVICE(s); int res = msix_init(PCI_DEVICE(s), E1000E_MSIX_VEC_NUM, &s->msix, E1000E_MSIX_IDX, E1000E_MSIX_TABLE, &s->msix, E1000E_MSIX_IDX, E1000E_MSIX_PBA, 0xA0); if (res < 0) { trace_e1000e_msix_init_fail(res); } else { if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) { msix_uninit(d, &s->msix, &s->msix); } } }
{ "code": [ " 0xA0);" ], "line_no": [ 17 ] }
FUNC_0(E1000EState *VAR_0) { PCIDevice *d = PCI_DEVICE(VAR_0); int VAR_1 = msix_init(PCI_DEVICE(VAR_0), E1000E_MSIX_VEC_NUM, &VAR_0->msix, E1000E_MSIX_IDX, E1000E_MSIX_TABLE, &VAR_0->msix, E1000E_MSIX_IDX, E1000E_MSIX_PBA, 0xA0); if (VAR_1 < 0) { trace_e1000e_msix_init_fail(VAR_1); } else { if (!e1000e_use_msix_vectors(VAR_0, E1000E_MSIX_VEC_NUM)) { msix_uninit(d, &VAR_0->msix, &VAR_0->msix); } } }
[ "FUNC_0(E1000EState *VAR_0)\n{", "PCIDevice *d = PCI_DEVICE(VAR_0);", "int VAR_1 = msix_init(PCI_DEVICE(VAR_0), E1000E_MSIX_VEC_NUM,\n&VAR_0->msix,\nE1000E_MSIX_IDX, E1000E_MSIX_TABLE,\n&VAR_0->msix,\nE1000E_MSIX_IDX, E1000E_MSIX_PBA,\n0xA0);", "if (VAR_1 < 0) {", "trace_e1000e_msix_init_fail(VAR_1);", "} else {", "if (!e1000e_use_msix_vectors(VAR_0, E1000E_MSIX_VEC_NUM)) {", "msix_uninit(d, &VAR_0->msix, &VAR_0->msix);", "}", "}", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11, 13, 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
13,441
static int RENAME(resample_linear)(ResampleContext *c, DELEM *dst, const DELEM *src, int n, int update_ctx) { int dst_index; int index= c->index; int frac= c->frac; int sample_index = index >> c->phase_shift; #if FILTER_SHIFT == 0 double inv_src_incr = 1.0 / c->src_incr; #endif index &= c->phase_mask; for (dst_index = 0; dst_index < n; dst_index++) { FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index; FELEM2 val=0, v2 = 0; int i; for (i = 0; i < c->filter_length; i++) { val += src[sample_index + i] * (FELEM2)filter[i]; v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_alloc]; } #ifdef FELEML val += (v2 - val) * (FELEML) frac / c->src_incr; #else # if FILTER_SHIFT == 0 val += (v2 - val) * inv_src_incr * frac; # else val += (v2 - val) / c->src_incr * frac; # endif #endif OUT(dst[dst_index], val); frac += c->dst_incr_mod; index += c->dst_incr_div; if (frac >= c->src_incr) { frac -= c->src_incr; index++; } sample_index += index >> c->phase_shift; index &= c->phase_mask; } if(update_ctx){ c->frac= frac; c->index= index; } return sample_index; }
false
FFmpeg
857cd1f33bcf86005529af2a77f861f884327be5
static int RENAME(resample_linear)(ResampleContext *c, DELEM *dst, const DELEM *src, int n, int update_ctx) { int dst_index; int index= c->index; int frac= c->frac; int sample_index = index >> c->phase_shift; #if FILTER_SHIFT == 0 double inv_src_incr = 1.0 / c->src_incr; #endif index &= c->phase_mask; for (dst_index = 0; dst_index < n; dst_index++) { FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index; FELEM2 val=0, v2 = 0; int i; for (i = 0; i < c->filter_length; i++) { val += src[sample_index + i] * (FELEM2)filter[i]; v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_alloc]; } #ifdef FELEML val += (v2 - val) * (FELEML) frac / c->src_incr; #else # if FILTER_SHIFT == 0 val += (v2 - val) * inv_src_incr * frac; # else val += (v2 - val) / c->src_incr * frac; # endif #endif OUT(dst[dst_index], val); frac += c->dst_incr_mod; index += c->dst_incr_div; if (frac >= c->src_incr) { frac -= c->src_incr; index++; } sample_index += index >> c->phase_shift; index &= c->phase_mask; } if(update_ctx){ c->frac= frac; c->index= index; } return sample_index; }
{ "code": [], "line_no": [] }
static int FUNC_0(resample_linear)(ResampleContext *c, DELEM *dst, const DELEM *src, int n, int update_ctx) { int VAR_0; int VAR_1= c->VAR_1; int VAR_2= c->VAR_2; int VAR_3 = VAR_1 >> c->phase_shift; #if FILTER_SHIFT == 0 double VAR_4 = 1.0 / c->src_incr; #endif VAR_1 &= c->phase_mask; for (VAR_0 = 0; VAR_0 < n; VAR_0++) { FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * VAR_1; FELEM2 val=0, v2 = 0; int i; for (i = 0; i < c->filter_length; i++) { val += src[VAR_3 + i] * (FELEM2)filter[i]; v2 += src[VAR_3 + i] * (FELEM2)filter[i + c->filter_alloc]; } #ifdef FELEML val += (v2 - val) * (FELEML) VAR_2 / c->src_incr; #else # if FILTER_SHIFT == 0 val += (v2 - val) * VAR_4 * VAR_2; # else val += (v2 - val) / c->src_incr * VAR_2; # endif #endif OUT(dst[VAR_0], val); VAR_2 += c->dst_incr_mod; VAR_1 += c->dst_incr_div; if (VAR_2 >= c->src_incr) { VAR_2 -= c->src_incr; VAR_1++; } VAR_3 += VAR_1 >> c->phase_shift; VAR_1 &= c->phase_mask; } if(update_ctx){ c->VAR_2= VAR_2; c->VAR_1= VAR_1; } return VAR_3; }
[ "static int FUNC_0(resample_linear)(ResampleContext *c,\nDELEM *dst, const DELEM *src,\nint n, int update_ctx)\n{", "int VAR_0;", "int VAR_1= c->VAR_1;", "int VAR_2= c->VAR_2;", "int VAR_3 = VAR_1 >> c->phase_shift;", "#if FILTER_SHIFT == 0\ndouble VAR_4 = 1.0 / c->src_incr;", "#endif\nVAR_1 &= c->phase_mask;", "for (VAR_0 = 0; VAR_0 < n; VAR_0++) {", "FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * VAR_1;", "FELEM2 val=0, v2 = 0;", "int i;", "for (i = 0; i < c->filter_length; i++) {", "val += src[VAR_3 + i] * (FELEM2)filter[i];", "v2 += src[VAR_3 + i] * (FELEM2)filter[i + c->filter_alloc];", "}", "#ifdef FELEML\nval += (v2 - val) * (FELEML) VAR_2 / c->src_incr;", "#else\n# if FILTER_SHIFT == 0\nval += (v2 - val) * VAR_4 * VAR_2;", "# else\nval += (v2 - val) / c->src_incr * VAR_2;", "# endif\n#endif\nOUT(dst[VAR_0], val);", "VAR_2 += c->dst_incr_mod;", "VAR_1 += c->dst_incr_div;", "if (VAR_2 >= c->src_incr) {", "VAR_2 -= c->src_incr;", "VAR_1++;", "}", "VAR_3 += VAR_1 >> c->phase_shift;", "VAR_1 &= c->phase_mask;", "}", "if(update_ctx){", "c->VAR_2= VAR_2;", "c->VAR_1= VAR_1;", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49, 51, 53 ], [ 55, 57 ], [ 59, 61, 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ] ]
13,443
int ff_h263_resync(MpegEncContext *s){ int left, ret; if(s->codec_id==CODEC_ID_MPEG4) skip_bits1(&s->gb); align_get_bits(&s->gb); if(show_bits(&s->gb, 16)==0){ if(s->codec_id==CODEC_ID_MPEG4) ret= mpeg4_decode_video_packet_header(s); else ret= h263_decode_gob_header(s); if(ret>=0) return 0; } //ok, its not where its supposed to be ... s->gb= s->last_resync_gb; align_get_bits(&s->gb); left= s->gb.size*8 - get_bits_count(&s->gb); for(;left>16+1+5+5; left-=8){ if(show_bits(&s->gb, 16)==0){ GetBitContext bak= s->gb; if(s->codec_id==CODEC_ID_MPEG4) ret= mpeg4_decode_video_packet_header(s); else ret= h263_decode_gob_header(s); if(ret>=0) return 0; s->gb= bak; } skip_bits(&s->gb, 8); } return -1; }
false
FFmpeg
68f593b48433842f3407586679fe07f3e5199ab9
int ff_h263_resync(MpegEncContext *s){ int left, ret; if(s->codec_id==CODEC_ID_MPEG4) skip_bits1(&s->gb); align_get_bits(&s->gb); if(show_bits(&s->gb, 16)==0){ if(s->codec_id==CODEC_ID_MPEG4) ret= mpeg4_decode_video_packet_header(s); else ret= h263_decode_gob_header(s); if(ret>=0) return 0; } s->gb= s->last_resync_gb; align_get_bits(&s->gb); left= s->gb.size*8 - get_bits_count(&s->gb); for(;left>16+1+5+5; left-=8){ if(show_bits(&s->gb, 16)==0){ GetBitContext bak= s->gb; if(s->codec_id==CODEC_ID_MPEG4) ret= mpeg4_decode_video_packet_header(s); else ret= h263_decode_gob_header(s); if(ret>=0) return 0; s->gb= bak; } skip_bits(&s->gb, 8); } return -1; }
{ "code": [], "line_no": [] }
int FUNC_0(MpegEncContext *VAR_0){ int VAR_1, VAR_2; if(VAR_0->codec_id==CODEC_ID_MPEG4) skip_bits1(&VAR_0->gb); align_get_bits(&VAR_0->gb); if(show_bits(&VAR_0->gb, 16)==0){ if(VAR_0->codec_id==CODEC_ID_MPEG4) VAR_2= mpeg4_decode_video_packet_header(VAR_0); else VAR_2= h263_decode_gob_header(VAR_0); if(VAR_2>=0) return 0; } VAR_0->gb= VAR_0->last_resync_gb; align_get_bits(&VAR_0->gb); VAR_1= VAR_0->gb.size*8 - get_bits_count(&VAR_0->gb); for(;VAR_1>16+1+5+5; VAR_1-=8){ if(show_bits(&VAR_0->gb, 16)==0){ GetBitContext bak= VAR_0->gb; if(VAR_0->codec_id==CODEC_ID_MPEG4) VAR_2= mpeg4_decode_video_packet_header(VAR_0); else VAR_2= h263_decode_gob_header(VAR_0); if(VAR_2>=0) return 0; VAR_0->gb= bak; } skip_bits(&VAR_0->gb, 8); } return -1; }
[ "int FUNC_0(MpegEncContext *VAR_0){", "int VAR_1, VAR_2;", "if(VAR_0->codec_id==CODEC_ID_MPEG4)\nskip_bits1(&VAR_0->gb);", "align_get_bits(&VAR_0->gb);", "if(show_bits(&VAR_0->gb, 16)==0){", "if(VAR_0->codec_id==CODEC_ID_MPEG4)\nVAR_2= mpeg4_decode_video_packet_header(VAR_0);", "else\nVAR_2= h263_decode_gob_header(VAR_0);", "if(VAR_2>=0)\nreturn 0;", "}", "VAR_0->gb= VAR_0->last_resync_gb;", "align_get_bits(&VAR_0->gb);", "VAR_1= VAR_0->gb.size*8 - get_bits_count(&VAR_0->gb);", "for(;VAR_1>16+1+5+5; VAR_1-=8){", "if(show_bits(&VAR_0->gb, 16)==0){", "GetBitContext bak= VAR_0->gb;", "if(VAR_0->codec_id==CODEC_ID_MPEG4)\nVAR_2= mpeg4_decode_video_packet_header(VAR_0);", "else\nVAR_2= h263_decode_gob_header(VAR_0);", "if(VAR_2>=0)\nreturn 0;", "VAR_0->gb= bak;", "}", "skip_bits(&VAR_0->gb, 8);", "}", "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 ]
[ [ 1 ], [ 3 ], [ 7, 9 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55, 57 ], [ 59, 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ] ]
13,444
static void aio_write_done(void *opaque, int ret) { struct aio_ctx *ctx = opaque; struct timeval t2; gettimeofday(&t2, NULL); if (ret < 0) { printf("aio_write failed: %s\n", strerror(-ret)); goto out; } if (ctx->qflag) { goto out; } /* Finally, report back -- -C gives a parsable format */ t2 = tsub(t2, ctx->t1); print_report("wrote", &t2, ctx->offset, ctx->qiov.size, ctx->qiov.size, 1, ctx->Cflag); out: qemu_io_free(ctx->buf); g_free(ctx); }
true
qemu
9e559533bd825a3e371497875576137a8586c831
static void aio_write_done(void *opaque, int ret) { struct aio_ctx *ctx = opaque; struct timeval t2; gettimeofday(&t2, NULL); if (ret < 0) { printf("aio_write failed: %s\n", strerror(-ret)); goto out; } if (ctx->qflag) { goto out; } t2 = tsub(t2, ctx->t1); print_report("wrote", &t2, ctx->offset, ctx->qiov.size, ctx->qiov.size, 1, ctx->Cflag); out: qemu_io_free(ctx->buf); g_free(ctx); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1) { struct aio_ctx *VAR_2 = VAR_0; struct timeval VAR_3; gettimeofday(&VAR_3, NULL); if (VAR_1 < 0) { printf("aio_write failed: %s\n", strerror(-VAR_1)); goto out; } if (VAR_2->qflag) { goto out; } VAR_3 = tsub(VAR_3, VAR_2->t1); print_report("wrote", &VAR_3, VAR_2->offset, VAR_2->qiov.size, VAR_2->qiov.size, 1, VAR_2->Cflag); out: qemu_io_free(VAR_2->buf); g_free(VAR_2); }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "struct aio_ctx *VAR_2 = VAR_0;", "struct timeval VAR_3;", "gettimeofday(&VAR_3, NULL);", "if (VAR_1 < 0) {", "printf(\"aio_write failed: %s\\n\", strerror(-VAR_1));", "goto out;", "}", "if (VAR_2->qflag) {", "goto out;", "}", "VAR_3 = tsub(VAR_3, VAR_2->t1);", "print_report(\"wrote\", &VAR_3, VAR_2->offset, VAR_2->qiov.size,\nVAR_2->qiov.size, 1, VAR_2->Cflag);", "out:\nqemu_io_free(VAR_2->buf);", "g_free(VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 37 ], [ 39, 41 ], [ 43, 45 ], [ 48 ], [ 50 ] ]
13,445
static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels, int line_size) { int i; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; /* read the pixels */ for(i=0;i<2;i++) { pixels[0] = cm[pixels[0] + block[0]]; pixels[1] = cm[pixels[1] + block[1]]; pixels += line_size; block += 8; } }
true
FFmpeg
c23acbaed40101c677dfcfbbfe0d2c230a8e8f44
static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels, int line_size) { int i; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; for(i=0;i<2;i++) { pixels[0] = cm[pixels[0] + block[0]]; pixels[1] = cm[pixels[1] + block[1]]; pixels += line_size; block += 8; } }
{ "code": [ " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " pixels[0] = cm[pixels[0] + block[0]];", " pixels[1] = cm[pixels[1] + block[1]];", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " pixels[0] = cm[pixels[0] + block[0]];", " pixels[1] = cm[pixels[1] + block[1]];", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " pixels[0] = cm[pixels[0] + block[0]];", " pixels[1] = cm[pixels[1] + block[1]];", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", " uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;" ], "line_no": [ 9, 9, 9, 9, 17, 19, 9, 17, 19, 9, 17, 19, 9, 9, 9, 9, 9, 9, 9 ] }
static void FUNC_0(const DCTELEM *VAR_0, uint8_t *restrict VAR_1, int VAR_2) { int VAR_3; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; for(VAR_3=0;VAR_3<2;VAR_3++) { VAR_1[0] = cm[VAR_1[0] + VAR_0[0]]; VAR_1[1] = cm[VAR_1[1] + VAR_0[1]]; VAR_1 += VAR_2; VAR_0 += 8; } }
[ "static void FUNC_0(const DCTELEM *VAR_0, uint8_t *restrict VAR_1,\nint VAR_2)\n{", "int VAR_3;", "uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;", "for(VAR_3=0;VAR_3<2;VAR_3++) {", "VAR_1[0] = cm[VAR_1[0] + VAR_0[0]];", "VAR_1[1] = cm[VAR_1[1] + VAR_0[1]];", "VAR_1 += VAR_2;", "VAR_0 += 8;", "}", "}" ]
[ 0, 0, 1, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
13,446
static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s) { Jpeg2000CodingStyle *codsty = s->codsty; Jpeg2000QuantStyle *qntsty = s->qntsty; uint8_t *properties = s->properties; for (;;) { int len, ret = 0; uint16_t marker; int oldpos; if (bytestream2_get_bytes_left(&s->g) < 2) { av_log(s->avctx, AV_LOG_ERROR, "Missing EOC\n"); break; } marker = bytestream2_get_be16u(&s->g); oldpos = bytestream2_tell(&s->g); if (marker == JPEG2000_EOC) break; if (bytestream2_get_bytes_left(&s->g) < 2) return AVERROR_INVALIDDATA; len = bytestream2_get_be16u(&s->g); switch (marker) { case JPEG2000_SIZ: ret = get_siz(s); break; case JPEG2000_COC: ret = get_coc(s, codsty, properties); break; case JPEG2000_COD: ret = get_cod(s, codsty, properties); break; case JPEG2000_QCC: ret = get_qcc(s, len, qntsty, properties); break; case JPEG2000_QCD: ret = get_qcd(s, len, qntsty, properties); break; case JPEG2000_SOT: ret = get_sot(s, len); break; case JPEG2000_COM: // the comment is ignored bytestream2_skip(&s->g, len - 2); break; case JPEG2000_TLM: // Tile-part lengths ret = get_tlm(s, len); break; default: av_log(s->avctx, AV_LOG_ERROR, "unsupported marker 0x%.4X at pos 0x%X\n", marker, bytestream2_tell(&s->g) - 4); bytestream2_skip(&s->g, len - 2); break; } if (((bytestream2_tell(&s->g) - oldpos != len) && (marker != JPEG2000_SOT)) || ret) { av_log(s->avctx, AV_LOG_ERROR, "error during processing marker segment %.4x\n", marker); return ret ? ret : -1; } } return 0; }
true
FFmpeg
fd54dd028bc9f7bfb80ebf823a533dc84b73f936
static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s) { Jpeg2000CodingStyle *codsty = s->codsty; Jpeg2000QuantStyle *qntsty = s->qntsty; uint8_t *properties = s->properties; for (;;) { int len, ret = 0; uint16_t marker; int oldpos; if (bytestream2_get_bytes_left(&s->g) < 2) { av_log(s->avctx, AV_LOG_ERROR, "Missing EOC\n"); break; } marker = bytestream2_get_be16u(&s->g); oldpos = bytestream2_tell(&s->g); if (marker == JPEG2000_EOC) break; if (bytestream2_get_bytes_left(&s->g) < 2) return AVERROR_INVALIDDATA; len = bytestream2_get_be16u(&s->g); switch (marker) { case JPEG2000_SIZ: ret = get_siz(s); break; case JPEG2000_COC: ret = get_coc(s, codsty, properties); break; case JPEG2000_COD: ret = get_cod(s, codsty, properties); break; case JPEG2000_QCC: ret = get_qcc(s, len, qntsty, properties); break; case JPEG2000_QCD: ret = get_qcd(s, len, qntsty, properties); break; case JPEG2000_SOT: ret = get_sot(s, len); break; case JPEG2000_COM: bytestream2_skip(&s->g, len - 2); break; case JPEG2000_TLM: ret = get_tlm(s, len); break; default: av_log(s->avctx, AV_LOG_ERROR, "unsupported marker 0x%.4X at pos 0x%X\n", marker, bytestream2_tell(&s->g) - 4); bytestream2_skip(&s->g, len - 2); break; } if (((bytestream2_tell(&s->g) - oldpos != len) && (marker != JPEG2000_SOT)) || ret) { av_log(s->avctx, AV_LOG_ERROR, "error during processing marker segment %.4x\n", marker); return ret ? ret : -1; } } return 0; }
{ "code": [ " if (bytestream2_get_bytes_left(&s->g) < 2)", " return AVERROR_INVALIDDATA;" ], "line_no": [ 45, 47 ] }
static int FUNC_0(Jpeg2000DecoderContext *VAR_0) { Jpeg2000CodingStyle *codsty = VAR_0->codsty; Jpeg2000QuantStyle *qntsty = VAR_0->qntsty; uint8_t *properties = VAR_0->properties; for (;;) { int VAR_1, VAR_2 = 0; uint16_t marker; int VAR_3; if (bytestream2_get_bytes_left(&VAR_0->g) < 2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Missing EOC\n"); break; } marker = bytestream2_get_be16u(&VAR_0->g); VAR_3 = bytestream2_tell(&VAR_0->g); if (marker == JPEG2000_EOC) break; if (bytestream2_get_bytes_left(&VAR_0->g) < 2) return AVERROR_INVALIDDATA; VAR_1 = bytestream2_get_be16u(&VAR_0->g); switch (marker) { case JPEG2000_SIZ: VAR_2 = get_siz(VAR_0); break; case JPEG2000_COC: VAR_2 = get_coc(VAR_0, codsty, properties); break; case JPEG2000_COD: VAR_2 = get_cod(VAR_0, codsty, properties); break; case JPEG2000_QCC: VAR_2 = get_qcc(VAR_0, VAR_1, qntsty, properties); break; case JPEG2000_QCD: VAR_2 = get_qcd(VAR_0, VAR_1, qntsty, properties); break; case JPEG2000_SOT: VAR_2 = get_sot(VAR_0, VAR_1); break; case JPEG2000_COM: bytestream2_skip(&VAR_0->g, VAR_1 - 2); break; case JPEG2000_TLM: VAR_2 = get_tlm(VAR_0, VAR_1); break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "unsupported marker 0x%.4X at pos 0x%X\n", marker, bytestream2_tell(&VAR_0->g) - 4); bytestream2_skip(&VAR_0->g, VAR_1 - 2); break; } if (((bytestream2_tell(&VAR_0->g) - VAR_3 != VAR_1) && (marker != JPEG2000_SOT)) || VAR_2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "error during processing marker segment %.4x\n", marker); return VAR_2 ? VAR_2 : -1; } } return 0; }
[ "static int FUNC_0(Jpeg2000DecoderContext *VAR_0)\n{", "Jpeg2000CodingStyle *codsty = VAR_0->codsty;", "Jpeg2000QuantStyle *qntsty = VAR_0->qntsty;", "uint8_t *properties = VAR_0->properties;", "for (;;) {", "int VAR_1, VAR_2 = 0;", "uint16_t marker;", "int VAR_3;", "if (bytestream2_get_bytes_left(&VAR_0->g) < 2) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Missing EOC\\n\");", "break;", "}", "marker = bytestream2_get_be16u(&VAR_0->g);", "VAR_3 = bytestream2_tell(&VAR_0->g);", "if (marker == JPEG2000_EOC)\nbreak;", "if (bytestream2_get_bytes_left(&VAR_0->g) < 2)\nreturn AVERROR_INVALIDDATA;", "VAR_1 = bytestream2_get_be16u(&VAR_0->g);", "switch (marker) {", "case JPEG2000_SIZ:\nVAR_2 = get_siz(VAR_0);", "break;", "case JPEG2000_COC:\nVAR_2 = get_coc(VAR_0, codsty, properties);", "break;", "case JPEG2000_COD:\nVAR_2 = get_cod(VAR_0, codsty, properties);", "break;", "case JPEG2000_QCC:\nVAR_2 = get_qcc(VAR_0, VAR_1, qntsty, properties);", "break;", "case JPEG2000_QCD:\nVAR_2 = get_qcd(VAR_0, VAR_1, qntsty, properties);", "break;", "case JPEG2000_SOT:\nVAR_2 = get_sot(VAR_0, VAR_1);", "break;", "case JPEG2000_COM:\nbytestream2_skip(&VAR_0->g, VAR_1 - 2);", "break;", "case JPEG2000_TLM:\nVAR_2 = get_tlm(VAR_0, VAR_1);", "break;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR,\n\"unsupported marker 0x%.4X at pos 0x%X\\n\",\nmarker, bytestream2_tell(&VAR_0->g) - 4);", "bytestream2_skip(&VAR_0->g, VAR_1 - 2);", "break;", "}", "if (((bytestream2_tell(&VAR_0->g) - VAR_3 != VAR_1) && (marker != JPEG2000_SOT)) || VAR_2) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"error during processing marker segment %.4x\\n\", marker);", "return VAR_2 ? VAR_2 : -1;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 93 ], [ 95 ], [ 97, 101 ], [ 103 ], [ 105, 107, 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ] ]
13,447
static void ehci_reset(void *opaque) { EHCIState *s = opaque; int i; USBDevice *devs[NB_PORTS]; trace_usb_ehci_reset(); /* * Do the detach before touching portsc, so that it correctly gets send to * us or to our companion based on PORTSC_POWNER before the reset. */ for(i = 0; i < NB_PORTS; i++) { devs[i] = s->ports[i].dev; if (devs[i] && devs[i]->attached) { usb_detach(&s->ports[i]); } } memset(&s->mmio[OPREGBASE], 0x00, MMIO_SIZE - OPREGBASE); s->usbcmd = NB_MAXINTRATE << USBCMD_ITC_SH; s->usbsts = USBSTS_HALT; s->usbsts_pending = 0; s->usbsts_frindex = 0; s->astate = EST_INACTIVE; s->pstate = EST_INACTIVE; for(i = 0; i < NB_PORTS; i++) { if (s->companion_ports[i]) { s->portsc[i] = PORTSC_POWNER | PORTSC_PPOWER; } else { s->portsc[i] = PORTSC_PPOWER; } if (devs[i] && devs[i]->attached) { usb_attach(&s->ports[i]); usb_device_reset(devs[i]); } } ehci_queues_rip_all(s, 0); ehci_queues_rip_all(s, 1); qemu_del_timer(s->frame_timer); qemu_bh_cancel(s->async_bh); }
true
qemu
3e4f910c8d490a1490409a7e381dbbb229f9d272
static void ehci_reset(void *opaque) { EHCIState *s = opaque; int i; USBDevice *devs[NB_PORTS]; trace_usb_ehci_reset(); for(i = 0; i < NB_PORTS; i++) { devs[i] = s->ports[i].dev; if (devs[i] && devs[i]->attached) { usb_detach(&s->ports[i]); } } memset(&s->mmio[OPREGBASE], 0x00, MMIO_SIZE - OPREGBASE); s->usbcmd = NB_MAXINTRATE << USBCMD_ITC_SH; s->usbsts = USBSTS_HALT; s->usbsts_pending = 0; s->usbsts_frindex = 0; s->astate = EST_INACTIVE; s->pstate = EST_INACTIVE; for(i = 0; i < NB_PORTS; i++) { if (s->companion_ports[i]) { s->portsc[i] = PORTSC_POWNER | PORTSC_PPOWER; } else { s->portsc[i] = PORTSC_PPOWER; } if (devs[i] && devs[i]->attached) { usb_attach(&s->ports[i]); usb_device_reset(devs[i]); } } ehci_queues_rip_all(s, 0); ehci_queues_rip_all(s, 1); qemu_del_timer(s->frame_timer); qemu_bh_cancel(s->async_bh); }
{ "code": [ " memset(&s->mmio[OPREGBASE], 0x00, MMIO_SIZE - OPREGBASE);" ], "line_no": [ 39 ] }
static void FUNC_0(void *VAR_0) { EHCIState *s = VAR_0; int VAR_1; USBDevice *devs[NB_PORTS]; trace_usb_ehci_reset(); for(VAR_1 = 0; VAR_1 < NB_PORTS; VAR_1++) { devs[VAR_1] = s->ports[VAR_1].dev; if (devs[VAR_1] && devs[VAR_1]->attached) { usb_detach(&s->ports[VAR_1]); } } memset(&s->mmio[OPREGBASE], 0x00, MMIO_SIZE - OPREGBASE); s->usbcmd = NB_MAXINTRATE << USBCMD_ITC_SH; s->usbsts = USBSTS_HALT; s->usbsts_pending = 0; s->usbsts_frindex = 0; s->astate = EST_INACTIVE; s->pstate = EST_INACTIVE; for(VAR_1 = 0; VAR_1 < NB_PORTS; VAR_1++) { if (s->companion_ports[VAR_1]) { s->portsc[VAR_1] = PORTSC_POWNER | PORTSC_PPOWER; } else { s->portsc[VAR_1] = PORTSC_PPOWER; } if (devs[VAR_1] && devs[VAR_1]->attached) { usb_attach(&s->ports[VAR_1]); usb_device_reset(devs[VAR_1]); } } ehci_queues_rip_all(s, 0); ehci_queues_rip_all(s, 1); qemu_del_timer(s->frame_timer); qemu_bh_cancel(s->async_bh); }
[ "static void FUNC_0(void *VAR_0)\n{", "EHCIState *s = VAR_0;", "int VAR_1;", "USBDevice *devs[NB_PORTS];", "trace_usb_ehci_reset();", "for(VAR_1 = 0; VAR_1 < NB_PORTS; VAR_1++) {", "devs[VAR_1] = s->ports[VAR_1].dev;", "if (devs[VAR_1] && devs[VAR_1]->attached) {", "usb_detach(&s->ports[VAR_1]);", "}", "}", "memset(&s->mmio[OPREGBASE], 0x00, MMIO_SIZE - OPREGBASE);", "s->usbcmd = NB_MAXINTRATE << USBCMD_ITC_SH;", "s->usbsts = USBSTS_HALT;", "s->usbsts_pending = 0;", "s->usbsts_frindex = 0;", "s->astate = EST_INACTIVE;", "s->pstate = EST_INACTIVE;", "for(VAR_1 = 0; VAR_1 < NB_PORTS; VAR_1++) {", "if (s->companion_ports[VAR_1]) {", "s->portsc[VAR_1] = PORTSC_POWNER | PORTSC_PPOWER;", "} else {", "s->portsc[VAR_1] = PORTSC_PPOWER;", "}", "if (devs[VAR_1] && devs[VAR_1]->attached) {", "usb_attach(&s->ports[VAR_1]);", "usb_device_reset(devs[VAR_1]);", "}", "}", "ehci_queues_rip_all(s, 0);", "ehci_queues_rip_all(s, 1);", "qemu_del_timer(s->frame_timer);", "qemu_bh_cancel(s->async_bh);", "}" ]
[ 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 ], [ 13 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ] ]
13,450
void OPPROTO op_POWER_slq (void) { uint32_t msk = -1, tmp; msk = msk << (T1 & 0x1FUL); if (T1 & 0x20UL) msk = ~msk; T1 &= 0x1FUL; tmp = rotl32(T0, T1); T0 = tmp & msk; env->spr[SPR_MQ] = tmp; RETURN(); }
true
qemu
6f2d8978728c48ca46f5c01835438508aace5c64
void OPPROTO op_POWER_slq (void) { uint32_t msk = -1, tmp; msk = msk << (T1 & 0x1FUL); if (T1 & 0x20UL) msk = ~msk; T1 &= 0x1FUL; tmp = rotl32(T0, T1); T0 = tmp & msk; env->spr[SPR_MQ] = tmp; RETURN(); }
{ "code": [ " uint32_t msk = -1, tmp;" ], "line_no": [ 5 ] }
void VAR_0 op_POWER_slq (void) { uint32_t msk = -1, tmp; msk = msk << (T1 & 0x1FUL); if (T1 & 0x20UL) msk = ~msk; T1 &= 0x1FUL; tmp = rotl32(T0, T1); T0 = tmp & msk; env->spr[SPR_MQ] = tmp; RETURN(); }
[ "void VAR_0 op_POWER_slq (void)\n{", "uint32_t msk = -1, tmp;", "msk = msk << (T1 & 0x1FUL);", "if (T1 & 0x20UL)\nmsk = ~msk;", "T1 &= 0x1FUL;", "tmp = rotl32(T0, T1);", "T0 = tmp & msk;", "env->spr[SPR_MQ] = tmp;", "RETURN();", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
13,451
int ff_MPV_lowest_referenced_row(MpegEncContext *s, int dir) { int my_max = INT_MIN, my_min = INT_MAX, qpel_shift = !s->quarter_sample; int my, off, i, mvs; if (s->picture_structure != PICT_FRAME) goto unhandled; switch (s->mv_type) { case MV_TYPE_16X16: mvs = 1; break; case MV_TYPE_16X8: mvs = 2; break; case MV_TYPE_8X8: mvs = 4; break; default: goto unhandled; } for (i = 0; i < mvs; i++) { my = s->mv[dir][i][1]<<qpel_shift; my_max = FFMAX(my_max, my); my_min = FFMIN(my_min, my); } off = (FFMAX(-my_min, my_max) + 63) >> 6; return FFMIN(FFMAX(s->mb_y + off, 0), s->mb_height-1); unhandled: return s->mb_height-1; }
true
FFmpeg
5e885275f1eda3f0281747d9c78d072adb8bc940
int ff_MPV_lowest_referenced_row(MpegEncContext *s, int dir) { int my_max = INT_MIN, my_min = INT_MAX, qpel_shift = !s->quarter_sample; int my, off, i, mvs; if (s->picture_structure != PICT_FRAME) goto unhandled; switch (s->mv_type) { case MV_TYPE_16X16: mvs = 1; break; case MV_TYPE_16X8: mvs = 2; break; case MV_TYPE_8X8: mvs = 4; break; default: goto unhandled; } for (i = 0; i < mvs; i++) { my = s->mv[dir][i][1]<<qpel_shift; my_max = FFMAX(my_max, my); my_min = FFMIN(my_min, my); } off = (FFMAX(-my_min, my_max) + 63) >> 6; return FFMIN(FFMAX(s->mb_y + off, 0), s->mb_height-1); unhandled: return s->mb_height-1; }
{ "code": [ " if (s->picture_structure != PICT_FRAME) goto unhandled;" ], "line_no": [ 11 ] }
int FUNC_0(MpegEncContext *VAR_0, int VAR_1) { int VAR_2 = INT_MIN, VAR_3 = INT_MAX, VAR_4 = !VAR_0->quarter_sample; int VAR_5, VAR_6, VAR_7, VAR_8; if (VAR_0->picture_structure != PICT_FRAME) goto unhandled; switch (VAR_0->mv_type) { case MV_TYPE_16X16: VAR_8 = 1; break; case MV_TYPE_16X8: VAR_8 = 2; break; case MV_TYPE_8X8: VAR_8 = 4; break; default: goto unhandled; } for (VAR_7 = 0; VAR_7 < VAR_8; VAR_7++) { VAR_5 = VAR_0->mv[VAR_1][VAR_7][1]<<VAR_4; VAR_2 = FFMAX(VAR_2, VAR_5); VAR_3 = FFMIN(VAR_3, VAR_5); } VAR_6 = (FFMAX(-VAR_3, VAR_2) + 63) >> 6; return FFMIN(FFMAX(VAR_0->mb_y + VAR_6, 0), VAR_0->mb_height-1); unhandled: return VAR_0->mb_height-1; }
[ "int FUNC_0(MpegEncContext *VAR_0, int VAR_1)\n{", "int VAR_2 = INT_MIN, VAR_3 = INT_MAX, VAR_4 = !VAR_0->quarter_sample;", "int VAR_5, VAR_6, VAR_7, VAR_8;", "if (VAR_0->picture_structure != PICT_FRAME) goto unhandled;", "switch (VAR_0->mv_type) {", "case MV_TYPE_16X16:\nVAR_8 = 1;", "break;", "case MV_TYPE_16X8:\nVAR_8 = 2;", "break;", "case MV_TYPE_8X8:\nVAR_8 = 4;", "break;", "default:\ngoto unhandled;", "}", "for (VAR_7 = 0; VAR_7 < VAR_8; VAR_7++) {", "VAR_5 = VAR_0->mv[VAR_1][VAR_7][1]<<VAR_4;", "VAR_2 = FFMAX(VAR_2, VAR_5);", "VAR_3 = FFMIN(VAR_3, VAR_5);", "}", "VAR_6 = (FFMAX(-VAR_3, VAR_2) + 63) >> 6;", "return FFMIN(FFMAX(VAR_0->mb_y + VAR_6, 0), VAR_0->mb_height-1);", "unhandled:\nreturn VAR_0->mb_height-1;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 59 ], [ 61, 63 ], [ 65 ] ]
13,452
static inline int snake_search(MpegEncContext * s, int *best, int dmin, UINT8 *new_pic, UINT8 *old_pic, int pic_stride, int pred_x, int pred_y, UINT16 *mv_penalty, int quant, int xmin, int ymin, int xmax, int ymax, int shift) { int dir=0; int c=1; static int x_dir[8]= {1,1,0,-1,-1,-1, 0, 1}; static int y_dir[8]= {0,1,1, 1, 0,-1,-1,-1}; int fails=0; int last_d[2]={dmin, dmin}; /*static int good=0; static int bad=0; static int point=0; point++; if(256*256*256*64%point==0) { printf("%d %d %d\n", good, bad, point); }*/ for(;;){ int x= best[0]; int y= best[1]; int d; x+=x_dir[dir]; y+=y_dir[dir]; if(x>=xmin && x<=xmax && y>=ymin && y<=ymax){ d = pix_abs16x16(new_pic, old_pic + (x) + (y)*pic_stride, pic_stride); d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*quant; }else{ d = dmin + 10000; //FIXME smarter boundary handling } if(d<dmin){ best[0]=x; best[1]=y; dmin=d; if(last_d[1] - last_d[0] > last_d[0] - d) c= -c; dir+=c; fails=0; //good++; last_d[1]=last_d[0]; last_d[0]=d; }else{ //bad++; if(fails){ if(fails>=3) return dmin; }else{ c= -c; } dir+=c*2; fails++; } dir&=7; } }
false
FFmpeg
0d21a84605bad4e75dacb8196e5859902ed36f01
static inline int snake_search(MpegEncContext * s, int *best, int dmin, UINT8 *new_pic, UINT8 *old_pic, int pic_stride, int pred_x, int pred_y, UINT16 *mv_penalty, int quant, int xmin, int ymin, int xmax, int ymax, int shift) { int dir=0; int c=1; static int x_dir[8]= {1,1,0,-1,-1,-1, 0, 1}; static int y_dir[8]= {0,1,1, 1, 0,-1,-1,-1}; int fails=0; int last_d[2]={dmin, dmin}; for(;;){ int x= best[0]; int y= best[1]; int d; x+=x_dir[dir]; y+=y_dir[dir]; if(x>=xmin && x<=xmax && y>=ymin && y<=ymax){ d = pix_abs16x16(new_pic, old_pic + (x) + (y)*pic_stride, pic_stride); d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*quant; }else{ d = dmin + 10000; } if(d<dmin){ best[0]=x; best[1]=y; dmin=d; if(last_d[1] - last_d[0] > last_d[0] - d) c= -c; dir+=c; fails=0; last_d[1]=last_d[0]; last_d[0]=d; }else{ if(fails){ if(fails>=3) return dmin; }else{ c= -c; } dir+=c*2; fails++; } dir&=7; } }
{ "code": [], "line_no": [] }
static inline int FUNC_0(MpegEncContext * VAR_0, int *VAR_1, int VAR_2, UINT8 *VAR_3, UINT8 *VAR_4, int VAR_5, int VAR_6, int VAR_7, UINT16 *VAR_8, int VAR_9, int VAR_10, int VAR_11, int VAR_12, int VAR_13, int VAR_14) { int VAR_15=0; int VAR_16=1; static int VAR_17[8]= {1,1,0,-1,-1,-1, 0, 1}; static int VAR_18[8]= {0,1,1, 1, 0,-1,-1,-1}; int VAR_19=0; int VAR_20[2]={VAR_2, VAR_2}; for(;;){ int VAR_21= VAR_1[0]; int VAR_22= VAR_1[1]; int VAR_23; VAR_21+=VAR_17[VAR_15]; VAR_22+=VAR_18[VAR_15]; if(VAR_21>=VAR_10 && VAR_21<=VAR_12 && VAR_22>=VAR_11 && VAR_22<=VAR_13){ VAR_23 = pix_abs16x16(VAR_3, VAR_4 + (VAR_21) + (VAR_22)*VAR_5, VAR_5); VAR_23 += (VAR_8[((VAR_21)<<VAR_14)-VAR_6] + VAR_8[((VAR_22)<<VAR_14)-VAR_7])*VAR_9; }else{ VAR_23 = VAR_2 + 10000; } if(VAR_23<VAR_2){ VAR_1[0]=VAR_21; VAR_1[1]=VAR_22; VAR_2=VAR_23; if(VAR_20[1] - VAR_20[0] > VAR_20[0] - VAR_23) VAR_16= -VAR_16; VAR_15+=VAR_16; VAR_19=0; VAR_20[1]=VAR_20[0]; VAR_20[0]=VAR_23; }else{ if(VAR_19){ if(VAR_19>=3) return VAR_2; }else{ VAR_16= -VAR_16; } VAR_15+=VAR_16*2; VAR_19++; } VAR_15&=7; } }
[ "static inline int FUNC_0(MpegEncContext * VAR_0, int *VAR_1, int VAR_2,\nUINT8 *VAR_3, UINT8 *VAR_4, int VAR_5,\nint VAR_6, int VAR_7, UINT16 *VAR_8, int VAR_9,\nint VAR_10, int VAR_11, int VAR_12, int VAR_13, int VAR_14)\n{", "int VAR_15=0;", "int VAR_16=1;", "static int VAR_17[8]= {1,1,0,-1,-1,-1, 0, 1};", "static int VAR_18[8]= {0,1,1, 1, 0,-1,-1,-1};", "int VAR_19=0;", "int VAR_20[2]={VAR_2, VAR_2};", "for(;;){", "int VAR_21= VAR_1[0];", "int VAR_22= VAR_1[1];", "int VAR_23;", "VAR_21+=VAR_17[VAR_15];", "VAR_22+=VAR_18[VAR_15];", "if(VAR_21>=VAR_10 && VAR_21<=VAR_12 && VAR_22>=VAR_11 && VAR_22<=VAR_13){", "VAR_23 = pix_abs16x16(VAR_3, VAR_4 + (VAR_21) + (VAR_22)*VAR_5, VAR_5);", "VAR_23 += (VAR_8[((VAR_21)<<VAR_14)-VAR_6] + VAR_8[((VAR_22)<<VAR_14)-VAR_7])*VAR_9;", "}else{", "VAR_23 = VAR_2 + 10000;", "}", "if(VAR_23<VAR_2){", "VAR_1[0]=VAR_21;", "VAR_1[1]=VAR_22;", "VAR_2=VAR_23;", "if(VAR_20[1] - VAR_20[0] > VAR_20[0] - VAR_23) VAR_16= -VAR_16;", "VAR_15+=VAR_16;", "VAR_19=0;", "VAR_20[1]=VAR_20[0];", "VAR_20[0]=VAR_23;", "}else{", "if(VAR_19){", "if(VAR_19>=3) return VAR_2;", "}else{", "VAR_16= -VAR_16;", "}", "VAR_15+=VAR_16*2;", "VAR_19++;", "}", "VAR_15&=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 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ] ]
13,453
static int qio_channel_command_close(QIOChannel *ioc, Error **errp) { QIOChannelCommand *cioc = QIO_CHANNEL_COMMAND(ioc); int rv = 0; /* We close FDs before killing, because that * gives a better chance of clean shutdown */ if (close(cioc->writefd) < 0) { rv = -1; } if (close(cioc->readfd) < 0) { rv = -1; } #ifndef WIN32 if (qio_channel_command_abort(cioc, errp) < 0) { return -1; } #endif if (rv < 0) { error_setg_errno(errp, errno, "%s", "Unable to close command"); } return rv; }
true
qemu
e155494cf0b876c45c3c68a9ab6c641aac22dfdf
static int qio_channel_command_close(QIOChannel *ioc, Error **errp) { QIOChannelCommand *cioc = QIO_CHANNEL_COMMAND(ioc); int rv = 0; if (close(cioc->writefd) < 0) { rv = -1; } if (close(cioc->readfd) < 0) { rv = -1; } #ifndef WIN32 if (qio_channel_command_abort(cioc, errp) < 0) { return -1; } #endif if (rv < 0) { error_setg_errno(errp, errno, "%s", "Unable to close command"); } return rv; }
{ "code": [ " if (close(cioc->writefd) < 0) {", " if (close(cioc->readfd) < 0) {" ], "line_no": [ 19, 25 ] }
static int FUNC_0(QIOChannel *VAR_0, Error **VAR_1) { QIOChannelCommand *cioc = QIO_CHANNEL_COMMAND(VAR_0); int VAR_2 = 0; if (close(cioc->writefd) < 0) { VAR_2 = -1; } if (close(cioc->readfd) < 0) { VAR_2 = -1; } #ifndef WIN32 if (qio_channel_command_abort(cioc, VAR_1) < 0) { return -1; } #endif if (VAR_2 < 0) { error_setg_errno(VAR_1, errno, "%s", "Unable to close command"); } return VAR_2; }
[ "static int FUNC_0(QIOChannel *VAR_0,\nError **VAR_1)\n{", "QIOChannelCommand *cioc = QIO_CHANNEL_COMMAND(VAR_0);", "int VAR_2 = 0;", "if (close(cioc->writefd) < 0) {", "VAR_2 = -1;", "}", "if (close(cioc->readfd) < 0) {", "VAR_2 = -1;", "}", "#ifndef WIN32\nif (qio_channel_command_abort(cioc, VAR_1) < 0) {", "return -1;", "}", "#endif\nif (VAR_2 < 0) {", "error_setg_errno(VAR_1, errno, \"%s\",\n\"Unable to close command\");", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ] ]
13,454
AVFixedDSPContext * avpriv_alloc_fixed_dsp(int bit_exact) { AVFixedDSPContext * fdsp = av_malloc(sizeof(AVFixedDSPContext)); fdsp->vector_fmul_window_scaled = vector_fmul_window_fixed_scaled_c; fdsp->vector_fmul_window = vector_fmul_window_fixed_c; return fdsp; }
true
FFmpeg
c3b6454d801638b091b51fe62937e6831a3a37b2
AVFixedDSPContext * avpriv_alloc_fixed_dsp(int bit_exact) { AVFixedDSPContext * fdsp = av_malloc(sizeof(AVFixedDSPContext)); fdsp->vector_fmul_window_scaled = vector_fmul_window_fixed_scaled_c; fdsp->vector_fmul_window = vector_fmul_window_fixed_c; return fdsp; }
{ "code": [], "line_no": [] }
AVFixedDSPContext * FUNC_0(int bit_exact) { AVFixedDSPContext * fdsp = av_malloc(sizeof(AVFixedDSPContext)); fdsp->vector_fmul_window_scaled = vector_fmul_window_fixed_scaled_c; fdsp->vector_fmul_window = vector_fmul_window_fixed_c; return fdsp; }
[ "AVFixedDSPContext * FUNC_0(int bit_exact)\n{", "AVFixedDSPContext * fdsp = av_malloc(sizeof(AVFixedDSPContext));", "fdsp->vector_fmul_window_scaled = vector_fmul_window_fixed_scaled_c;", "fdsp->vector_fmul_window = vector_fmul_window_fixed_c;", "return fdsp;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ] ]
13,455
static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count) { int16_t weight[8][64]; int16_t orig[8][64]; const int mb_x = s->mb_x; const int mb_y = s->mb_y; int i; int skip_dct[8]; int dct_offset = s->linesize * 8; // default for progressive frames uint8_t *ptr_y, *ptr_cb, *ptr_cr; ptrdiff_t wrap_y, wrap_c; for (i = 0; i < mb_block_count; i++) skip_dct[i] = s->skipdct; if (s->adaptive_quant) { const int last_qp = s->qscale; const int mb_xy = mb_x + mb_y * s->mb_stride; s->lambda = s->lambda_table[mb_xy]; update_qscale(s); if (!(s->mpv_flags & FF_MPV_FLAG_QP_RD)) { s->qscale = s->current_picture_ptr->qscale_table[mb_xy]; s->dquant = s->qscale - last_qp; if (s->out_format == FMT_H263) { s->dquant = av_clip(s->dquant, -2, 2); if (s->codec_id == AV_CODEC_ID_MPEG4) { if (!s->mb_intra) { if (s->pict_type == AV_PICTURE_TYPE_B) { if (s->dquant & 1 || s->mv_dir & MV_DIRECT) s->dquant = 0; } if (s->mv_type == MV_TYPE_8X8) s->dquant = 0; } } } } ff_set_qscale(s, last_qp + s->dquant); } else if (s->mpv_flags & FF_MPV_FLAG_QP_RD) ff_set_qscale(s, s->qscale + s->dquant); wrap_y = s->linesize; wrap_c = s->uvlinesize; ptr_y = s->new_picture.f.data[0] + (mb_y * 16 * wrap_y) + mb_x * 16; ptr_cb = s->new_picture.f.data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; ptr_cr = s->new_picture.f.data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; if (mb_x * 16 + 16 > s->width || mb_y * 16 + 16 > s->height) { uint8_t *ebuf = s->edge_emu_buffer + 32; s->vdsp.emulated_edge_mc(ebuf, ptr_y, wrap_y, wrap_y, 16, 16, mb_x * 16, mb_y * 16, s->width, s->height); ptr_y = ebuf; s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y, ptr_cb, wrap_c, wrap_c, 8, mb_block_height, mb_x * 8, mb_y * 8, s->width >> 1, s->height >> 1); ptr_cb = ebuf + 18 * wrap_y; s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y + 8, ptr_cr, wrap_c, wrap_c, 8, mb_block_height, mb_x * 8, mb_y * 8, s->width >> 1, s->height >> 1); ptr_cr = ebuf + 18 * wrap_y + 8; } if (s->mb_intra) { if (s->flags & CODEC_FLAG_INTERLACED_DCT) { int progressive_score, interlaced_score; s->interlaced_dct = 0; progressive_score = s->dsp.ildct_cmp[4](s, ptr_y, NULL, wrap_y, 8) + s->dsp.ildct_cmp[4](s, ptr_y + wrap_y * 8, NULL, wrap_y, 8) - 400; if (progressive_score > 0) { interlaced_score = s->dsp.ildct_cmp[4](s, ptr_y, NULL, wrap_y * 2, 8) + s->dsp.ildct_cmp[4](s, ptr_y + wrap_y, NULL, wrap_y * 2, 8); if (progressive_score > interlaced_score) { s->interlaced_dct = 1; dct_offset = wrap_y; wrap_y <<= 1; if (s->chroma_format == CHROMA_422) wrap_c <<= 1; } } } s->dsp.get_pixels(s->block[0], ptr_y , wrap_y); s->dsp.get_pixels(s->block[1], ptr_y + 8 , wrap_y); s->dsp.get_pixels(s->block[2], ptr_y + dct_offset , wrap_y); s->dsp.get_pixels(s->block[3], ptr_y + dct_offset + 8 , wrap_y); if (s->flags & CODEC_FLAG_GRAY) { skip_dct[4] = 1; skip_dct[5] = 1; } else { s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c); s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c); if (!s->chroma_y_shift) { /* 422 */ s->dsp.get_pixels(s->block[6], ptr_cb + (dct_offset >> 1), wrap_c); s->dsp.get_pixels(s->block[7], ptr_cr + (dct_offset >> 1), wrap_c); } } } else { op_pixels_func (*op_pix)[4]; qpel_mc_func (*op_qpix)[16]; uint8_t *dest_y, *dest_cb, *dest_cr; dest_y = s->dest[0]; dest_cb = s->dest[1]; dest_cr = s->dest[2]; if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) { op_pix = s->hdsp.put_pixels_tab; op_qpix = s->dsp.put_qpel_pixels_tab; } else { op_pix = s->hdsp.put_no_rnd_pixels_tab; op_qpix = s->dsp.put_no_rnd_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix); op_pix = s->hdsp.avg_pixels_tab; op_qpix = s->dsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix, op_qpix); } if (s->flags & CODEC_FLAG_INTERLACED_DCT) { int progressive_score, interlaced_score; s->interlaced_dct = 0; progressive_score = s->dsp.ildct_cmp[0](s, dest_y, ptr_y, wrap_y, 8) + s->dsp.ildct_cmp[0](s, dest_y + wrap_y * 8, ptr_y + wrap_y * 8, wrap_y, 8) - 400; if (s->avctx->ildct_cmp == FF_CMP_VSSE) progressive_score -= 400; if (progressive_score > 0) { interlaced_score = s->dsp.ildct_cmp[0](s, dest_y, ptr_y, wrap_y * 2, 8) + s->dsp.ildct_cmp[0](s, dest_y + wrap_y, ptr_y + wrap_y, wrap_y * 2, 8); if (progressive_score > interlaced_score) { s->interlaced_dct = 1; dct_offset = wrap_y; wrap_y <<= 1; if (s->chroma_format == CHROMA_422) wrap_c <<= 1; } } } s->dsp.diff_pixels(s->block[0], ptr_y, dest_y, wrap_y); s->dsp.diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y); s->dsp.diff_pixels(s->block[2], ptr_y + dct_offset, dest_y + dct_offset, wrap_y); s->dsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y); if (s->flags & CODEC_FLAG_GRAY) { skip_dct[4] = 1; skip_dct[5] = 1; } else { s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c); s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c); if (!s->chroma_y_shift) { /* 422 */ s->dsp.diff_pixels(s->block[6], ptr_cb + (dct_offset >> 1), dest_cb + (dct_offset >> 1), wrap_c); s->dsp.diff_pixels(s->block[7], ptr_cr + (dct_offset >> 1), dest_cr + (dct_offset >> 1), wrap_c); } } /* pre quantization */ if (s->current_picture.mc_mb_var[s->mb_stride * mb_y + mb_x] < 2 * s->qscale * s->qscale) { // FIXME optimize if (s->dsp.sad[1](NULL, ptr_y , dest_y, wrap_y, 8) < 20 * s->qscale) skip_dct[0] = 1; if (s->dsp.sad[1](NULL, ptr_y + 8, dest_y + 8, wrap_y, 8) < 20 * s->qscale) skip_dct[1] = 1; if (s->dsp.sad[1](NULL, ptr_y + dct_offset, dest_y + dct_offset, wrap_y, 8) < 20 * s->qscale) skip_dct[2] = 1; if (s->dsp.sad[1](NULL, ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y, 8) < 20 * s->qscale) skip_dct[3] = 1; if (s->dsp.sad[1](NULL, ptr_cb, dest_cb, wrap_c, 8) < 20 * s->qscale) skip_dct[4] = 1; if (s->dsp.sad[1](NULL, ptr_cr, dest_cr, wrap_c, 8) < 20 * s->qscale) skip_dct[5] = 1; if (!s->chroma_y_shift) { /* 422 */ if (s->dsp.sad[1](NULL, ptr_cb + (dct_offset >> 1), dest_cb + (dct_offset >> 1), wrap_c, 8) < 20 * s->qscale) skip_dct[6] = 1; if (s->dsp.sad[1](NULL, ptr_cr + (dct_offset >> 1), dest_cr + (dct_offset >> 1), wrap_c, 8) < 20 * s->qscale) skip_dct[7] = 1; } } } if (s->quantizer_noise_shaping) { if (!skip_dct[0]) get_visual_weight(weight[0], ptr_y , wrap_y); if (!skip_dct[1]) get_visual_weight(weight[1], ptr_y + 8, wrap_y); if (!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset , wrap_y); if (!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y); if (!skip_dct[4]) get_visual_weight(weight[4], ptr_cb , wrap_c); if (!skip_dct[5]) get_visual_weight(weight[5], ptr_cr , wrap_c); if (!s->chroma_y_shift) { /* 422 */ if (!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset >> 1), wrap_c); if (!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset >> 1), wrap_c); } memcpy(orig[0], s->block[0], sizeof(int16_t) * 64 * mb_block_count); } /* DCT & quantize */ assert(s->out_format != FMT_MJPEG || s->qscale == 8); { for (i = 0; i < mb_block_count; i++) { if (!skip_dct[i]) { int overflow; s->block_last_index[i] = s->dct_quantize(s, s->block[i], i, s->qscale, &overflow); // FIXME we could decide to change to quantizer instead of // clipping // JS: I don't think that would be a good idea it could lower // quality instead of improve it. Just INTRADC clipping // deserves changes in quantizer if (overflow) clip_coeffs(s, s->block[i], s->block_last_index[i]); } else s->block_last_index[i] = -1; } if (s->quantizer_noise_shaping) { for (i = 0; i < mb_block_count; i++) { if (!skip_dct[i]) { s->block_last_index[i] = dct_quantize_refine(s, s->block[i], weight[i], orig[i], i, s->qscale); } } } if (s->luma_elim_threshold && !s->mb_intra) for (i = 0; i < 4; i++) dct_single_coeff_elimination(s, i, s->luma_elim_threshold); if (s->chroma_elim_threshold && !s->mb_intra) for (i = 4; i < mb_block_count; i++) dct_single_coeff_elimination(s, i, s->chroma_elim_threshold); if (s->mpv_flags & FF_MPV_FLAG_CBP_RD) { for (i = 0; i < mb_block_count; i++) { if (s->block_last_index[i] == -1) s->coded_score[i] = INT_MAX / 256; } } } if ((s->flags & CODEC_FLAG_GRAY) && s->mb_intra) { s->block_last_index[4] = s->block_last_index[5] = 0; s->block[4][0] = s->block[5][0] = (1024 + s->c_dc_scale / 2) / s->c_dc_scale; } // non c quantize code returns incorrect block_last_index FIXME if (s->alternate_scan && s->dct_quantize != ff_dct_quantize_c) { for (i = 0; i < mb_block_count; i++) { int j; if (s->block_last_index[i] > 0) { for (j = 63; j > 0; j--) { if (s->block[i][s->intra_scantable.permutated[j]]) break; } s->block_last_index[i] = j; } } } /* huffman encode */ switch(s->codec_id){ //FIXME funct ptr could be slightly faster case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) ff_mpeg1_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_MPEG4: if (CONFIG_MPEG4_ENCODER) ff_mpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_MSMPEG4V2: case AV_CODEC_ID_MSMPEG4V3: case AV_CODEC_ID_WMV1: if (CONFIG_MSMPEG4_ENCODER) ff_msmpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_WMV2: if (CONFIG_WMV2_ENCODER) ff_wmv2_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_H261: if (CONFIG_H261_ENCODER) ff_h261_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_H263: case AV_CODEC_ID_H263P: case AV_CODEC_ID_FLV1: case AV_CODEC_ID_RV10: case AV_CODEC_ID_RV20: if (CONFIG_H263_ENCODER) ff_h263_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_MJPEG: if (CONFIG_MJPEG_ENCODER) ff_mjpeg_encode_mb(s, s->block); break; default: assert(0); } }
true
FFmpeg
f6774f905fb3cfdc319523ac640be30b14c1bc55
static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count) { int16_t weight[8][64]; int16_t orig[8][64]; const int mb_x = s->mb_x; const int mb_y = s->mb_y; int i; int skip_dct[8]; int dct_offset = s->linesize * 8; uint8_t *ptr_y, *ptr_cb, *ptr_cr; ptrdiff_t wrap_y, wrap_c; for (i = 0; i < mb_block_count; i++) skip_dct[i] = s->skipdct; if (s->adaptive_quant) { const int last_qp = s->qscale; const int mb_xy = mb_x + mb_y * s->mb_stride; s->lambda = s->lambda_table[mb_xy]; update_qscale(s); if (!(s->mpv_flags & FF_MPV_FLAG_QP_RD)) { s->qscale = s->current_picture_ptr->qscale_table[mb_xy]; s->dquant = s->qscale - last_qp; if (s->out_format == FMT_H263) { s->dquant = av_clip(s->dquant, -2, 2); if (s->codec_id == AV_CODEC_ID_MPEG4) { if (!s->mb_intra) { if (s->pict_type == AV_PICTURE_TYPE_B) { if (s->dquant & 1 || s->mv_dir & MV_DIRECT) s->dquant = 0; } if (s->mv_type == MV_TYPE_8X8) s->dquant = 0; } } } } ff_set_qscale(s, last_qp + s->dquant); } else if (s->mpv_flags & FF_MPV_FLAG_QP_RD) ff_set_qscale(s, s->qscale + s->dquant); wrap_y = s->linesize; wrap_c = s->uvlinesize; ptr_y = s->new_picture.f.data[0] + (mb_y * 16 * wrap_y) + mb_x * 16; ptr_cb = s->new_picture.f.data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; ptr_cr = s->new_picture.f.data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; if (mb_x * 16 + 16 > s->width || mb_y * 16 + 16 > s->height) { uint8_t *ebuf = s->edge_emu_buffer + 32; s->vdsp.emulated_edge_mc(ebuf, ptr_y, wrap_y, wrap_y, 16, 16, mb_x * 16, mb_y * 16, s->width, s->height); ptr_y = ebuf; s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y, ptr_cb, wrap_c, wrap_c, 8, mb_block_height, mb_x * 8, mb_y * 8, s->width >> 1, s->height >> 1); ptr_cb = ebuf + 18 * wrap_y; s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y + 8, ptr_cr, wrap_c, wrap_c, 8, mb_block_height, mb_x * 8, mb_y * 8, s->width >> 1, s->height >> 1); ptr_cr = ebuf + 18 * wrap_y + 8; } if (s->mb_intra) { if (s->flags & CODEC_FLAG_INTERLACED_DCT) { int progressive_score, interlaced_score; s->interlaced_dct = 0; progressive_score = s->dsp.ildct_cmp[4](s, ptr_y, NULL, wrap_y, 8) + s->dsp.ildct_cmp[4](s, ptr_y + wrap_y * 8, NULL, wrap_y, 8) - 400; if (progressive_score > 0) { interlaced_score = s->dsp.ildct_cmp[4](s, ptr_y, NULL, wrap_y * 2, 8) + s->dsp.ildct_cmp[4](s, ptr_y + wrap_y, NULL, wrap_y * 2, 8); if (progressive_score > interlaced_score) { s->interlaced_dct = 1; dct_offset = wrap_y; wrap_y <<= 1; if (s->chroma_format == CHROMA_422) wrap_c <<= 1; } } } s->dsp.get_pixels(s->block[0], ptr_y , wrap_y); s->dsp.get_pixels(s->block[1], ptr_y + 8 , wrap_y); s->dsp.get_pixels(s->block[2], ptr_y + dct_offset , wrap_y); s->dsp.get_pixels(s->block[3], ptr_y + dct_offset + 8 , wrap_y); if (s->flags & CODEC_FLAG_GRAY) { skip_dct[4] = 1; skip_dct[5] = 1; } else { s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c); s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c); if (!s->chroma_y_shift) { s->dsp.get_pixels(s->block[6], ptr_cb + (dct_offset >> 1), wrap_c); s->dsp.get_pixels(s->block[7], ptr_cr + (dct_offset >> 1), wrap_c); } } } else { op_pixels_func (*op_pix)[4]; qpel_mc_func (*op_qpix)[16]; uint8_t *dest_y, *dest_cb, *dest_cr; dest_y = s->dest[0]; dest_cb = s->dest[1]; dest_cr = s->dest[2]; if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) { op_pix = s->hdsp.put_pixels_tab; op_qpix = s->dsp.put_qpel_pixels_tab; } else { op_pix = s->hdsp.put_no_rnd_pixels_tab; op_qpix = s->dsp.put_no_rnd_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix); op_pix = s->hdsp.avg_pixels_tab; op_qpix = s->dsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix, op_qpix); } if (s->flags & CODEC_FLAG_INTERLACED_DCT) { int progressive_score, interlaced_score; s->interlaced_dct = 0; progressive_score = s->dsp.ildct_cmp[0](s, dest_y, ptr_y, wrap_y, 8) + s->dsp.ildct_cmp[0](s, dest_y + wrap_y * 8, ptr_y + wrap_y * 8, wrap_y, 8) - 400; if (s->avctx->ildct_cmp == FF_CMP_VSSE) progressive_score -= 400; if (progressive_score > 0) { interlaced_score = s->dsp.ildct_cmp[0](s, dest_y, ptr_y, wrap_y * 2, 8) + s->dsp.ildct_cmp[0](s, dest_y + wrap_y, ptr_y + wrap_y, wrap_y * 2, 8); if (progressive_score > interlaced_score) { s->interlaced_dct = 1; dct_offset = wrap_y; wrap_y <<= 1; if (s->chroma_format == CHROMA_422) wrap_c <<= 1; } } } s->dsp.diff_pixels(s->block[0], ptr_y, dest_y, wrap_y); s->dsp.diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y); s->dsp.diff_pixels(s->block[2], ptr_y + dct_offset, dest_y + dct_offset, wrap_y); s->dsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y); if (s->flags & CODEC_FLAG_GRAY) { skip_dct[4] = 1; skip_dct[5] = 1; } else { s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c); s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c); if (!s->chroma_y_shift) { s->dsp.diff_pixels(s->block[6], ptr_cb + (dct_offset >> 1), dest_cb + (dct_offset >> 1), wrap_c); s->dsp.diff_pixels(s->block[7], ptr_cr + (dct_offset >> 1), dest_cr + (dct_offset >> 1), wrap_c); } } if (s->current_picture.mc_mb_var[s->mb_stride * mb_y + mb_x] < 2 * s->qscale * s->qscale) { if (s->dsp.sad[1](NULL, ptr_y , dest_y, wrap_y, 8) < 20 * s->qscale) skip_dct[0] = 1; if (s->dsp.sad[1](NULL, ptr_y + 8, dest_y + 8, wrap_y, 8) < 20 * s->qscale) skip_dct[1] = 1; if (s->dsp.sad[1](NULL, ptr_y + dct_offset, dest_y + dct_offset, wrap_y, 8) < 20 * s->qscale) skip_dct[2] = 1; if (s->dsp.sad[1](NULL, ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y, 8) < 20 * s->qscale) skip_dct[3] = 1; if (s->dsp.sad[1](NULL, ptr_cb, dest_cb, wrap_c, 8) < 20 * s->qscale) skip_dct[4] = 1; if (s->dsp.sad[1](NULL, ptr_cr, dest_cr, wrap_c, 8) < 20 * s->qscale) skip_dct[5] = 1; if (!s->chroma_y_shift) { if (s->dsp.sad[1](NULL, ptr_cb + (dct_offset >> 1), dest_cb + (dct_offset >> 1), wrap_c, 8) < 20 * s->qscale) skip_dct[6] = 1; if (s->dsp.sad[1](NULL, ptr_cr + (dct_offset >> 1), dest_cr + (dct_offset >> 1), wrap_c, 8) < 20 * s->qscale) skip_dct[7] = 1; } } } if (s->quantizer_noise_shaping) { if (!skip_dct[0]) get_visual_weight(weight[0], ptr_y , wrap_y); if (!skip_dct[1]) get_visual_weight(weight[1], ptr_y + 8, wrap_y); if (!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset , wrap_y); if (!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y); if (!skip_dct[4]) get_visual_weight(weight[4], ptr_cb , wrap_c); if (!skip_dct[5]) get_visual_weight(weight[5], ptr_cr , wrap_c); if (!s->chroma_y_shift) { if (!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset >> 1), wrap_c); if (!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset >> 1), wrap_c); } memcpy(orig[0], s->block[0], sizeof(int16_t) * 64 * mb_block_count); } assert(s->out_format != FMT_MJPEG || s->qscale == 8); { for (i = 0; i < mb_block_count; i++) { if (!skip_dct[i]) { int overflow; s->block_last_index[i] = s->dct_quantize(s, s->block[i], i, s->qscale, &overflow); if (overflow) clip_coeffs(s, s->block[i], s->block_last_index[i]); } else s->block_last_index[i] = -1; } if (s->quantizer_noise_shaping) { for (i = 0; i < mb_block_count; i++) { if (!skip_dct[i]) { s->block_last_index[i] = dct_quantize_refine(s, s->block[i], weight[i], orig[i], i, s->qscale); } } } if (s->luma_elim_threshold && !s->mb_intra) for (i = 0; i < 4; i++) dct_single_coeff_elimination(s, i, s->luma_elim_threshold); if (s->chroma_elim_threshold && !s->mb_intra) for (i = 4; i < mb_block_count; i++) dct_single_coeff_elimination(s, i, s->chroma_elim_threshold); if (s->mpv_flags & FF_MPV_FLAG_CBP_RD) { for (i = 0; i < mb_block_count; i++) { if (s->block_last_index[i] == -1) s->coded_score[i] = INT_MAX / 256; } } } if ((s->flags & CODEC_FLAG_GRAY) && s->mb_intra) { s->block_last_index[4] = s->block_last_index[5] = 0; s->block[4][0] = s->block[5][0] = (1024 + s->c_dc_scale / 2) / s->c_dc_scale; } if (s->alternate_scan && s->dct_quantize != ff_dct_quantize_c) { for (i = 0; i < mb_block_count; i++) { int j; if (s->block_last_index[i] > 0) { for (j = 63; j > 0; j--) { if (s->block[i][s->intra_scantable.permutated[j]]) break; } s->block_last_index[i] = j; } } } switch(s->codec_id){ case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) ff_mpeg1_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_MPEG4: if (CONFIG_MPEG4_ENCODER) ff_mpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_MSMPEG4V2: case AV_CODEC_ID_MSMPEG4V3: case AV_CODEC_ID_WMV1: if (CONFIG_MSMPEG4_ENCODER) ff_msmpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_WMV2: if (CONFIG_WMV2_ENCODER) ff_wmv2_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_H261: if (CONFIG_H261_ENCODER) ff_h261_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_H263: case AV_CODEC_ID_H263P: case AV_CODEC_ID_FLV1: case AV_CODEC_ID_RV10: case AV_CODEC_ID_RV20: if (CONFIG_H263_ENCODER) ff_h263_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_MJPEG: if (CONFIG_MJPEG_ENCODER) ff_mjpeg_encode_mb(s, s->block); break; default: assert(0); } }
{ "code": [ " ptr_y = s->new_picture.f.data[0] +", " ptr_cb = s->new_picture.f.data[1] +", " ptr_cr = s->new_picture.f.data[2] +", " s->last_picture.f.data,", " s->next_picture.f.data," ], "line_no": [ 101, 105, 109, 279, 293 ] }
static av_always_inline void FUNC_0(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count) { int16_t weight[8][64]; int16_t orig[8][64]; const int VAR_0 = s->VAR_0; const int VAR_1 = s->VAR_1; int VAR_2; int VAR_3[8]; int VAR_4 = s->linesize * 8; uint8_t *ptr_y, *ptr_cb, *ptr_cr; ptrdiff_t wrap_y, wrap_c; for (VAR_2 = 0; VAR_2 < mb_block_count; VAR_2++) VAR_3[VAR_2] = s->skipdct; if (s->adaptive_quant) { const int VAR_5 = s->qscale; const int VAR_6 = VAR_0 + VAR_1 * s->mb_stride; s->lambda = s->lambda_table[VAR_6]; update_qscale(s); if (!(s->mpv_flags & FF_MPV_FLAG_QP_RD)) { s->qscale = s->current_picture_ptr->qscale_table[VAR_6]; s->dquant = s->qscale - VAR_5; if (s->out_format == FMT_H263) { s->dquant = av_clip(s->dquant, -2, 2); if (s->codec_id == AV_CODEC_ID_MPEG4) { if (!s->mb_intra) { if (s->pict_type == AV_PICTURE_TYPE_B) { if (s->dquant & 1 || s->mv_dir & MV_DIRECT) s->dquant = 0; } if (s->mv_type == MV_TYPE_8X8) s->dquant = 0; } } } } ff_set_qscale(s, VAR_5 + s->dquant); } else if (s->mpv_flags & FF_MPV_FLAG_QP_RD) ff_set_qscale(s, s->qscale + s->dquant); wrap_y = s->linesize; wrap_c = s->uvlinesize; ptr_y = s->new_picture.f.data[0] + (VAR_1 * 16 * wrap_y) + VAR_0 * 16; ptr_cb = s->new_picture.f.data[1] + (VAR_1 * mb_block_height * wrap_c) + VAR_0 * 8; ptr_cr = s->new_picture.f.data[2] + (VAR_1 * mb_block_height * wrap_c) + VAR_0 * 8; if (VAR_0 * 16 + 16 > s->width || VAR_1 * 16 + 16 > s->height) { uint8_t *ebuf = s->edge_emu_buffer + 32; s->vdsp.emulated_edge_mc(ebuf, ptr_y, wrap_y, wrap_y, 16, 16, VAR_0 * 16, VAR_1 * 16, s->width, s->height); ptr_y = ebuf; s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y, ptr_cb, wrap_c, wrap_c, 8, mb_block_height, VAR_0 * 8, VAR_1 * 8, s->width >> 1, s->height >> 1); ptr_cb = ebuf + 18 * wrap_y; s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y + 8, ptr_cr, wrap_c, wrap_c, 8, mb_block_height, VAR_0 * 8, VAR_1 * 8, s->width >> 1, s->height >> 1); ptr_cr = ebuf + 18 * wrap_y + 8; } if (s->mb_intra) { if (s->flags & CODEC_FLAG_INTERLACED_DCT) { int VAR_9, VAR_9; s->interlaced_dct = 0; VAR_9 = s->dsp.ildct_cmp[4](s, ptr_y, NULL, wrap_y, 8) + s->dsp.ildct_cmp[4](s, ptr_y + wrap_y * 8, NULL, wrap_y, 8) - 400; if (VAR_9 > 0) { VAR_9 = s->dsp.ildct_cmp[4](s, ptr_y, NULL, wrap_y * 2, 8) + s->dsp.ildct_cmp[4](s, ptr_y + wrap_y, NULL, wrap_y * 2, 8); if (VAR_9 > VAR_9) { s->interlaced_dct = 1; VAR_4 = wrap_y; wrap_y <<= 1; if (s->chroma_format == CHROMA_422) wrap_c <<= 1; } } } s->dsp.get_pixels(s->block[0], ptr_y , wrap_y); s->dsp.get_pixels(s->block[1], ptr_y + 8 , wrap_y); s->dsp.get_pixels(s->block[2], ptr_y + VAR_4 , wrap_y); s->dsp.get_pixels(s->block[3], ptr_y + VAR_4 + 8 , wrap_y); if (s->flags & CODEC_FLAG_GRAY) { VAR_3[4] = 1; VAR_3[5] = 1; } else { s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c); s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c); if (!s->chroma_y_shift) { s->dsp.get_pixels(s->block[6], ptr_cb + (VAR_4 >> 1), wrap_c); s->dsp.get_pixels(s->block[7], ptr_cr + (VAR_4 >> 1), wrap_c); } } } else { op_pixels_func (*op_pix)[4]; qpel_mc_func (*op_qpix)[16]; uint8_t *dest_y, *dest_cb, *dest_cr; dest_y = s->dest[0]; dest_cb = s->dest[1]; dest_cr = s->dest[2]; if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) { op_pix = s->hdsp.put_pixels_tab; op_qpix = s->dsp.put_qpel_pixels_tab; } else { op_pix = s->hdsp.put_no_rnd_pixels_tab; op_qpix = s->dsp.put_no_rnd_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix); op_pix = s->hdsp.avg_pixels_tab; op_qpix = s->dsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix, op_qpix); } if (s->flags & CODEC_FLAG_INTERLACED_DCT) { int VAR_9, VAR_9; s->interlaced_dct = 0; VAR_9 = s->dsp.ildct_cmp[0](s, dest_y, ptr_y, wrap_y, 8) + s->dsp.ildct_cmp[0](s, dest_y + wrap_y * 8, ptr_y + wrap_y * 8, wrap_y, 8) - 400; if (s->avctx->ildct_cmp == FF_CMP_VSSE) VAR_9 -= 400; if (VAR_9 > 0) { VAR_9 = s->dsp.ildct_cmp[0](s, dest_y, ptr_y, wrap_y * 2, 8) + s->dsp.ildct_cmp[0](s, dest_y + wrap_y, ptr_y + wrap_y, wrap_y * 2, 8); if (VAR_9 > VAR_9) { s->interlaced_dct = 1; VAR_4 = wrap_y; wrap_y <<= 1; if (s->chroma_format == CHROMA_422) wrap_c <<= 1; } } } s->dsp.diff_pixels(s->block[0], ptr_y, dest_y, wrap_y); s->dsp.diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y); s->dsp.diff_pixels(s->block[2], ptr_y + VAR_4, dest_y + VAR_4, wrap_y); s->dsp.diff_pixels(s->block[3], ptr_y + VAR_4 + 8, dest_y + VAR_4 + 8, wrap_y); if (s->flags & CODEC_FLAG_GRAY) { VAR_3[4] = 1; VAR_3[5] = 1; } else { s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c); s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c); if (!s->chroma_y_shift) { s->dsp.diff_pixels(s->block[6], ptr_cb + (VAR_4 >> 1), dest_cb + (VAR_4 >> 1), wrap_c); s->dsp.diff_pixels(s->block[7], ptr_cr + (VAR_4 >> 1), dest_cr + (VAR_4 >> 1), wrap_c); } } if (s->current_picture.mc_mb_var[s->mb_stride * VAR_1 + VAR_0] < 2 * s->qscale * s->qscale) { if (s->dsp.sad[1](NULL, ptr_y , dest_y, wrap_y, 8) < 20 * s->qscale) VAR_3[0] = 1; if (s->dsp.sad[1](NULL, ptr_y + 8, dest_y + 8, wrap_y, 8) < 20 * s->qscale) VAR_3[1] = 1; if (s->dsp.sad[1](NULL, ptr_y + VAR_4, dest_y + VAR_4, wrap_y, 8) < 20 * s->qscale) VAR_3[2] = 1; if (s->dsp.sad[1](NULL, ptr_y + VAR_4 + 8, dest_y + VAR_4 + 8, wrap_y, 8) < 20 * s->qscale) VAR_3[3] = 1; if (s->dsp.sad[1](NULL, ptr_cb, dest_cb, wrap_c, 8) < 20 * s->qscale) VAR_3[4] = 1; if (s->dsp.sad[1](NULL, ptr_cr, dest_cr, wrap_c, 8) < 20 * s->qscale) VAR_3[5] = 1; if (!s->chroma_y_shift) { if (s->dsp.sad[1](NULL, ptr_cb + (VAR_4 >> 1), dest_cb + (VAR_4 >> 1), wrap_c, 8) < 20 * s->qscale) VAR_3[6] = 1; if (s->dsp.sad[1](NULL, ptr_cr + (VAR_4 >> 1), dest_cr + (VAR_4 >> 1), wrap_c, 8) < 20 * s->qscale) VAR_3[7] = 1; } } } if (s->quantizer_noise_shaping) { if (!VAR_3[0]) get_visual_weight(weight[0], ptr_y , wrap_y); if (!VAR_3[1]) get_visual_weight(weight[1], ptr_y + 8, wrap_y); if (!VAR_3[2]) get_visual_weight(weight[2], ptr_y + VAR_4 , wrap_y); if (!VAR_3[3]) get_visual_weight(weight[3], ptr_y + VAR_4 + 8, wrap_y); if (!VAR_3[4]) get_visual_weight(weight[4], ptr_cb , wrap_c); if (!VAR_3[5]) get_visual_weight(weight[5], ptr_cr , wrap_c); if (!s->chroma_y_shift) { if (!VAR_3[6]) get_visual_weight(weight[6], ptr_cb + (VAR_4 >> 1), wrap_c); if (!VAR_3[7]) get_visual_weight(weight[7], ptr_cr + (VAR_4 >> 1), wrap_c); } memcpy(orig[0], s->block[0], sizeof(int16_t) * 64 * mb_block_count); } assert(s->out_format != FMT_MJPEG || s->qscale == 8); { for (VAR_2 = 0; VAR_2 < mb_block_count; VAR_2++) { if (!VAR_3[VAR_2]) { int VAR_9; s->block_last_index[VAR_2] = s->dct_quantize(s, s->block[VAR_2], VAR_2, s->qscale, &VAR_9); if (VAR_9) clip_coeffs(s, s->block[VAR_2], s->block_last_index[VAR_2]); } else s->block_last_index[VAR_2] = -1; } if (s->quantizer_noise_shaping) { for (VAR_2 = 0; VAR_2 < mb_block_count; VAR_2++) { if (!VAR_3[VAR_2]) { s->block_last_index[VAR_2] = dct_quantize_refine(s, s->block[VAR_2], weight[VAR_2], orig[VAR_2], VAR_2, s->qscale); } } } if (s->luma_elim_threshold && !s->mb_intra) for (VAR_2 = 0; VAR_2 < 4; VAR_2++) dct_single_coeff_elimination(s, VAR_2, s->luma_elim_threshold); if (s->chroma_elim_threshold && !s->mb_intra) for (VAR_2 = 4; VAR_2 < mb_block_count; VAR_2++) dct_single_coeff_elimination(s, VAR_2, s->chroma_elim_threshold); if (s->mpv_flags & FF_MPV_FLAG_CBP_RD) { for (VAR_2 = 0; VAR_2 < mb_block_count; VAR_2++) { if (s->block_last_index[VAR_2] == -1) s->coded_score[VAR_2] = INT_MAX / 256; } } } if ((s->flags & CODEC_FLAG_GRAY) && s->mb_intra) { s->block_last_index[4] = s->block_last_index[5] = 0; s->block[4][0] = s->block[5][0] = (1024 + s->c_dc_scale / 2) / s->c_dc_scale; } if (s->alternate_scan && s->dct_quantize != ff_dct_quantize_c) { for (VAR_2 = 0; VAR_2 < mb_block_count; VAR_2++) { int VAR_10; if (s->block_last_index[VAR_2] > 0) { for (VAR_10 = 63; VAR_10 > 0; VAR_10--) { if (s->block[VAR_2][s->intra_scantable.permutated[VAR_10]]) break; } s->block_last_index[VAR_2] = VAR_10; } } } switch(s->codec_id){ case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) ff_mpeg1_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_MPEG4: if (CONFIG_MPEG4_ENCODER) ff_mpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_MSMPEG4V2: case AV_CODEC_ID_MSMPEG4V3: case AV_CODEC_ID_WMV1: if (CONFIG_MSMPEG4_ENCODER) ff_msmpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_WMV2: if (CONFIG_WMV2_ENCODER) ff_wmv2_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_H261: if (CONFIG_H261_ENCODER) ff_h261_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_H263: case AV_CODEC_ID_H263P: case AV_CODEC_ID_FLV1: case AV_CODEC_ID_RV10: case AV_CODEC_ID_RV20: if (CONFIG_H263_ENCODER) ff_h263_encode_mb(s, s->block, motion_x, motion_y); break; case AV_CODEC_ID_MJPEG: if (CONFIG_MJPEG_ENCODER) ff_mjpeg_encode_mb(s, s->block); break; default: assert(0); } }
[ "static av_always_inline void FUNC_0(MpegEncContext *s,\nint motion_x, int motion_y,\nint mb_block_height,\nint mb_block_count)\n{", "int16_t weight[8][64];", "int16_t orig[8][64];", "const int VAR_0 = s->VAR_0;", "const int VAR_1 = s->VAR_1;", "int VAR_2;", "int VAR_3[8];", "int VAR_4 = s->linesize * 8;", "uint8_t *ptr_y, *ptr_cb, *ptr_cr;", "ptrdiff_t wrap_y, wrap_c;", "for (VAR_2 = 0; VAR_2 < mb_block_count; VAR_2++)", "VAR_3[VAR_2] = s->skipdct;", "if (s->adaptive_quant) {", "const int VAR_5 = s->qscale;", "const int VAR_6 = VAR_0 + VAR_1 * s->mb_stride;", "s->lambda = s->lambda_table[VAR_6];", "update_qscale(s);", "if (!(s->mpv_flags & FF_MPV_FLAG_QP_RD)) {", "s->qscale = s->current_picture_ptr->qscale_table[VAR_6];", "s->dquant = s->qscale - VAR_5;", "if (s->out_format == FMT_H263) {", "s->dquant = av_clip(s->dquant, -2, 2);", "if (s->codec_id == AV_CODEC_ID_MPEG4) {", "if (!s->mb_intra) {", "if (s->pict_type == AV_PICTURE_TYPE_B) {", "if (s->dquant & 1 || s->mv_dir & MV_DIRECT)\ns->dquant = 0;", "}", "if (s->mv_type == MV_TYPE_8X8)\ns->dquant = 0;", "}", "}", "}", "}", "ff_set_qscale(s, VAR_5 + s->dquant);", "} else if (s->mpv_flags & FF_MPV_FLAG_QP_RD)", "ff_set_qscale(s, s->qscale + s->dquant);", "wrap_y = s->linesize;", "wrap_c = s->uvlinesize;", "ptr_y = s->new_picture.f.data[0] +\n(VAR_1 * 16 * wrap_y) + VAR_0 * 16;", "ptr_cb = s->new_picture.f.data[1] +\n(VAR_1 * mb_block_height * wrap_c) + VAR_0 * 8;", "ptr_cr = s->new_picture.f.data[2] +\n(VAR_1 * mb_block_height * wrap_c) + VAR_0 * 8;", "if (VAR_0 * 16 + 16 > s->width || VAR_1 * 16 + 16 > s->height) {", "uint8_t *ebuf = s->edge_emu_buffer + 32;", "s->vdsp.emulated_edge_mc(ebuf, ptr_y,\nwrap_y, wrap_y,\n16, 16, VAR_0 * 16, VAR_1 * 16,\ns->width, s->height);", "ptr_y = ebuf;", "s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y, ptr_cb,\nwrap_c, wrap_c,\n8, mb_block_height, VAR_0 * 8, VAR_1 * 8,\ns->width >> 1, s->height >> 1);", "ptr_cb = ebuf + 18 * wrap_y;", "s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y + 8, ptr_cr,\nwrap_c, wrap_c,\n8, mb_block_height, VAR_0 * 8, VAR_1 * 8,\ns->width >> 1, s->height >> 1);", "ptr_cr = ebuf + 18 * wrap_y + 8;", "}", "if (s->mb_intra) {", "if (s->flags & CODEC_FLAG_INTERLACED_DCT) {", "int VAR_9, VAR_9;", "s->interlaced_dct = 0;", "VAR_9 = s->dsp.ildct_cmp[4](s, ptr_y,\nNULL, wrap_y, 8) +\ns->dsp.ildct_cmp[4](s, ptr_y + wrap_y * 8,\nNULL, wrap_y, 8) - 400;", "if (VAR_9 > 0) {", "VAR_9 = s->dsp.ildct_cmp[4](s, ptr_y,\nNULL, wrap_y * 2, 8) +\ns->dsp.ildct_cmp[4](s, ptr_y + wrap_y,\nNULL, wrap_y * 2, 8);", "if (VAR_9 > VAR_9) {", "s->interlaced_dct = 1;", "VAR_4 = wrap_y;", "wrap_y <<= 1;", "if (s->chroma_format == CHROMA_422)\nwrap_c <<= 1;", "}", "}", "}", "s->dsp.get_pixels(s->block[0], ptr_y , wrap_y);", "s->dsp.get_pixels(s->block[1], ptr_y + 8 , wrap_y);", "s->dsp.get_pixels(s->block[2], ptr_y + VAR_4 , wrap_y);", "s->dsp.get_pixels(s->block[3], ptr_y + VAR_4 + 8 , wrap_y);", "if (s->flags & CODEC_FLAG_GRAY) {", "VAR_3[4] = 1;", "VAR_3[5] = 1;", "} else {", "s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c);", "s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c);", "if (!s->chroma_y_shift) {", "s->dsp.get_pixels(s->block[6],\nptr_cb + (VAR_4 >> 1), wrap_c);", "s->dsp.get_pixels(s->block[7],\nptr_cr + (VAR_4 >> 1), wrap_c);", "}", "}", "} else {", "op_pixels_func (*op_pix)[4];", "qpel_mc_func (*op_qpix)[16];", "uint8_t *dest_y, *dest_cb, *dest_cr;", "dest_y = s->dest[0];", "dest_cb = s->dest[1];", "dest_cr = s->dest[2];", "if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) {", "op_pix = s->hdsp.put_pixels_tab;", "op_qpix = s->dsp.put_qpel_pixels_tab;", "} else {", "op_pix = s->hdsp.put_no_rnd_pixels_tab;", "op_qpix = s->dsp.put_no_rnd_qpel_pixels_tab;", "}", "if (s->mv_dir & MV_DIR_FORWARD) {", "ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 0,\ns->last_picture.f.data,\nop_pix, op_qpix);", "op_pix = s->hdsp.avg_pixels_tab;", "op_qpix = s->dsp.avg_qpel_pixels_tab;", "}", "if (s->mv_dir & MV_DIR_BACKWARD) {", "ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 1,\ns->next_picture.f.data,\nop_pix, op_qpix);", "}", "if (s->flags & CODEC_FLAG_INTERLACED_DCT) {", "int VAR_9, VAR_9;", "s->interlaced_dct = 0;", "VAR_9 = s->dsp.ildct_cmp[0](s, dest_y,\nptr_y, wrap_y,\n8) +\ns->dsp.ildct_cmp[0](s, dest_y + wrap_y * 8,\nptr_y + wrap_y * 8, wrap_y,\n8) - 400;", "if (s->avctx->ildct_cmp == FF_CMP_VSSE)\nVAR_9 -= 400;", "if (VAR_9 > 0) {", "VAR_9 = s->dsp.ildct_cmp[0](s, dest_y,\nptr_y,\nwrap_y * 2, 8) +\ns->dsp.ildct_cmp[0](s, dest_y + wrap_y,\nptr_y + wrap_y,\nwrap_y * 2, 8);", "if (VAR_9 > VAR_9) {", "s->interlaced_dct = 1;", "VAR_4 = wrap_y;", "wrap_y <<= 1;", "if (s->chroma_format == CHROMA_422)\nwrap_c <<= 1;", "}", "}", "}", "s->dsp.diff_pixels(s->block[0], ptr_y, dest_y, wrap_y);", "s->dsp.diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y);", "s->dsp.diff_pixels(s->block[2], ptr_y + VAR_4,\ndest_y + VAR_4, wrap_y);", "s->dsp.diff_pixels(s->block[3], ptr_y + VAR_4 + 8,\ndest_y + VAR_4 + 8, wrap_y);", "if (s->flags & CODEC_FLAG_GRAY) {", "VAR_3[4] = 1;", "VAR_3[5] = 1;", "} else {", "s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c);", "s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c);", "if (!s->chroma_y_shift) {", "s->dsp.diff_pixels(s->block[6], ptr_cb + (VAR_4 >> 1),\ndest_cb + (VAR_4 >> 1), wrap_c);", "s->dsp.diff_pixels(s->block[7], ptr_cr + (VAR_4 >> 1),\ndest_cr + (VAR_4 >> 1), wrap_c);", "}", "}", "if (s->current_picture.mc_mb_var[s->mb_stride * VAR_1 + VAR_0] <\n2 * s->qscale * s->qscale) {", "if (s->dsp.sad[1](NULL, ptr_y , dest_y,\nwrap_y, 8) < 20 * s->qscale)\nVAR_3[0] = 1;", "if (s->dsp.sad[1](NULL, ptr_y + 8,\ndest_y + 8, wrap_y, 8) < 20 * s->qscale)\nVAR_3[1] = 1;", "if (s->dsp.sad[1](NULL, ptr_y + VAR_4,\ndest_y + VAR_4, wrap_y, 8) < 20 * s->qscale)\nVAR_3[2] = 1;", "if (s->dsp.sad[1](NULL, ptr_y + VAR_4 + 8,\ndest_y + VAR_4 + 8,\nwrap_y, 8) < 20 * s->qscale)\nVAR_3[3] = 1;", "if (s->dsp.sad[1](NULL, ptr_cb, dest_cb,\nwrap_c, 8) < 20 * s->qscale)\nVAR_3[4] = 1;", "if (s->dsp.sad[1](NULL, ptr_cr, dest_cr,\nwrap_c, 8) < 20 * s->qscale)\nVAR_3[5] = 1;", "if (!s->chroma_y_shift) {", "if (s->dsp.sad[1](NULL, ptr_cb + (VAR_4 >> 1),\ndest_cb + (VAR_4 >> 1),\nwrap_c, 8) < 20 * s->qscale)\nVAR_3[6] = 1;", "if (s->dsp.sad[1](NULL, ptr_cr + (VAR_4 >> 1),\ndest_cr + (VAR_4 >> 1),\nwrap_c, 8) < 20 * s->qscale)\nVAR_3[7] = 1;", "}", "}", "}", "if (s->quantizer_noise_shaping) {", "if (!VAR_3[0])\nget_visual_weight(weight[0], ptr_y , wrap_y);", "if (!VAR_3[1])\nget_visual_weight(weight[1], ptr_y + 8, wrap_y);", "if (!VAR_3[2])\nget_visual_weight(weight[2], ptr_y + VAR_4 , wrap_y);", "if (!VAR_3[3])\nget_visual_weight(weight[3], ptr_y + VAR_4 + 8, wrap_y);", "if (!VAR_3[4])\nget_visual_weight(weight[4], ptr_cb , wrap_c);", "if (!VAR_3[5])\nget_visual_weight(weight[5], ptr_cr , wrap_c);", "if (!s->chroma_y_shift) {", "if (!VAR_3[6])\nget_visual_weight(weight[6], ptr_cb + (VAR_4 >> 1),\nwrap_c);", "if (!VAR_3[7])\nget_visual_weight(weight[7], ptr_cr + (VAR_4 >> 1),\nwrap_c);", "}", "memcpy(orig[0], s->block[0], sizeof(int16_t) * 64 * mb_block_count);", "}", "assert(s->out_format != FMT_MJPEG || s->qscale == 8);", "{", "for (VAR_2 = 0; VAR_2 < mb_block_count; VAR_2++) {", "if (!VAR_3[VAR_2]) {", "int VAR_9;", "s->block_last_index[VAR_2] = s->dct_quantize(s, s->block[VAR_2], VAR_2, s->qscale, &VAR_9);", "if (VAR_9)\nclip_coeffs(s, s->block[VAR_2], s->block_last_index[VAR_2]);", "} else", "s->block_last_index[VAR_2] = -1;", "}", "if (s->quantizer_noise_shaping) {", "for (VAR_2 = 0; VAR_2 < mb_block_count; VAR_2++) {", "if (!VAR_3[VAR_2]) {", "s->block_last_index[VAR_2] =\ndct_quantize_refine(s, s->block[VAR_2], weight[VAR_2],\norig[VAR_2], VAR_2, s->qscale);", "}", "}", "}", "if (s->luma_elim_threshold && !s->mb_intra)\nfor (VAR_2 = 0; VAR_2 < 4; VAR_2++)", "dct_single_coeff_elimination(s, VAR_2, s->luma_elim_threshold);", "if (s->chroma_elim_threshold && !s->mb_intra)\nfor (VAR_2 = 4; VAR_2 < mb_block_count; VAR_2++)", "dct_single_coeff_elimination(s, VAR_2, s->chroma_elim_threshold);", "if (s->mpv_flags & FF_MPV_FLAG_CBP_RD) {", "for (VAR_2 = 0; VAR_2 < mb_block_count; VAR_2++) {", "if (s->block_last_index[VAR_2] == -1)\ns->coded_score[VAR_2] = INT_MAX / 256;", "}", "}", "}", "if ((s->flags & CODEC_FLAG_GRAY) && s->mb_intra) {", "s->block_last_index[4] =\ns->block_last_index[5] = 0;", "s->block[4][0] =\ns->block[5][0] = (1024 + s->c_dc_scale / 2) / s->c_dc_scale;", "}", "if (s->alternate_scan && s->dct_quantize != ff_dct_quantize_c) {", "for (VAR_2 = 0; VAR_2 < mb_block_count; VAR_2++) {", "int VAR_10;", "if (s->block_last_index[VAR_2] > 0) {", "for (VAR_10 = 63; VAR_10 > 0; VAR_10--) {", "if (s->block[VAR_2][s->intra_scantable.permutated[VAR_10]])\nbreak;", "}", "s->block_last_index[VAR_2] = VAR_10;", "}", "}", "}", "switch(s->codec_id){", "case AV_CODEC_ID_MPEG1VIDEO:\ncase AV_CODEC_ID_MPEG2VIDEO:\nif (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER)\nff_mpeg1_encode_mb(s, s->block, motion_x, motion_y);", "break;", "case AV_CODEC_ID_MPEG4:\nif (CONFIG_MPEG4_ENCODER)\nff_mpeg4_encode_mb(s, s->block, motion_x, motion_y);", "break;", "case AV_CODEC_ID_MSMPEG4V2:\ncase AV_CODEC_ID_MSMPEG4V3:\ncase AV_CODEC_ID_WMV1:\nif (CONFIG_MSMPEG4_ENCODER)\nff_msmpeg4_encode_mb(s, s->block, motion_x, motion_y);", "break;", "case AV_CODEC_ID_WMV2:\nif (CONFIG_WMV2_ENCODER)\nff_wmv2_encode_mb(s, s->block, motion_x, motion_y);", "break;", "case AV_CODEC_ID_H261:\nif (CONFIG_H261_ENCODER)\nff_h261_encode_mb(s, s->block, motion_x, motion_y);", "break;", "case AV_CODEC_ID_H263:\ncase AV_CODEC_ID_H263P:\ncase AV_CODEC_ID_FLV1:\ncase AV_CODEC_ID_RV10:\ncase AV_CODEC_ID_RV20:\nif (CONFIG_H263_ENCODER)\nff_h263_encode_mb(s, s->block, motion_x, motion_y);", "break;", "case AV_CODEC_ID_MJPEG:\nif (CONFIG_MJPEG_ENCODER)\nff_mjpeg_encode_mb(s, s->block);", "break;", "default:\nassert(0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 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 ], [ 161 ], [ 163, 165, 167, 169 ], [ 173 ], [ 175, 177, 179, 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229, 231 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251 ], [ 253 ], [ 255 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 275 ], [ 277, 279, 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291, 293, 295 ], [ 297 ], [ 301 ], [ 303 ], [ 307 ], [ 309, 311, 313, 315, 317, 319 ], [ 323, 325 ], [ 329 ], [ 331, 333, 335, 337, 339, 341 ], [ 345 ], [ 347 ], [ 351 ], [ 353 ], [ 355, 357 ], [ 359 ], [ 361 ], [ 363 ], [ 367 ], [ 369 ], [ 371, 373 ], [ 375, 377 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395, 397 ], [ 399, 401 ], [ 403 ], [ 405 ], [ 409, 411 ], [ 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 ], [ 479 ], [ 481, 483 ], [ 485, 487 ], [ 489, 491 ], [ 493, 495 ], [ 497, 499 ], [ 501, 503 ], [ 505 ], [ 507, 509, 511 ], [ 513, 515, 517 ], [ 519 ], [ 521 ], [ 523 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 551, 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567, 569, 571 ], [ 573 ], [ 575 ], [ 577 ], [ 581, 583 ], [ 585 ], [ 587, 589 ], [ 591 ], [ 595 ], [ 597 ], [ 599, 601 ], [ 603 ], [ 605 ], [ 607 ], [ 611 ], [ 613, 615 ], [ 617, 619 ], [ 621 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637, 639 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 655 ], [ 657, 659, 661, 663 ], [ 665 ], [ 667, 669, 671 ], [ 673 ], [ 675, 677, 679, 681, 683 ], [ 685 ], [ 687, 689, 691 ], [ 693 ], [ 695, 697, 699 ], [ 701 ], [ 703, 705, 707, 709, 711, 713, 715 ], [ 717 ], [ 719, 721, 723 ], [ 725 ], [ 727, 729 ], [ 731 ], [ 733 ] ]
13,456
void sh_intc_register_sources(struct intc_desc *desc, struct intc_vect *vectors, int nr_vectors, struct intc_group *groups, int nr_groups) { unsigned int i, k; struct intc_source *s; for (i = 0; i < nr_vectors; i++) { struct intc_vect *vect = vectors + i; sh_intc_register_source(desc, vect->enum_id, groups, nr_groups); s = sh_intc_source(desc, vect->enum_id); if (s) s->vect = vect->vect; #ifdef DEBUG_INTC_SOURCES printf("sh_intc: registered source %d -> 0x%04x (%d/%d)\n", vect->enum_id, s->vect, s->enable_count, s->enable_max); #endif } if (groups) { for (i = 0; i < nr_groups; i++) { struct intc_group *gr = groups + i; s = sh_intc_source(desc, gr->enum_id); s->next_enum_id = gr->enum_ids[0]; for (k = 1; k < ARRAY_SIZE(gr->enum_ids); k++) { if (!gr->enum_ids[k]) continue; s = sh_intc_source(desc, gr->enum_ids[k - 1]); s->next_enum_id = gr->enum_ids[k]; } #ifdef DEBUG_INTC_SOURCES printf("sh_intc: registered group %d (%d/%d)\n", gr->enum_id, s->enable_count, s->enable_max); #endif } } }
true
qemu
6f9faa91f5fb3a866f5bf592207c9498a017740d
void sh_intc_register_sources(struct intc_desc *desc, struct intc_vect *vectors, int nr_vectors, struct intc_group *groups, int nr_groups) { unsigned int i, k; struct intc_source *s; for (i = 0; i < nr_vectors; i++) { struct intc_vect *vect = vectors + i; sh_intc_register_source(desc, vect->enum_id, groups, nr_groups); s = sh_intc_source(desc, vect->enum_id); if (s) s->vect = vect->vect; #ifdef DEBUG_INTC_SOURCES printf("sh_intc: registered source %d -> 0x%04x (%d/%d)\n", vect->enum_id, s->vect, s->enable_count, s->enable_max); #endif } if (groups) { for (i = 0; i < nr_groups; i++) { struct intc_group *gr = groups + i; s = sh_intc_source(desc, gr->enum_id); s->next_enum_id = gr->enum_ids[0]; for (k = 1; k < ARRAY_SIZE(gr->enum_ids); k++) { if (!gr->enum_ids[k]) continue; s = sh_intc_source(desc, gr->enum_ids[k - 1]); s->next_enum_id = gr->enum_ids[k]; } #ifdef DEBUG_INTC_SOURCES printf("sh_intc: registered group %d (%d/%d)\n", gr->enum_id, s->enable_count, s->enable_max); #endif } } }
{ "code": [ "\tif (s)", "\t s->vect = vect->vect;", "\tprintf(\"sh_intc: registered source %d -> 0x%04x (%d/%d)\\n\",", "\t vect->enum_id, s->vect, s->enable_count, s->enable_max);" ], "line_no": [ 29, 31, 37, 39 ] }
void FUNC_0(struct intc_desc *VAR_0, struct intc_vect *VAR_1, int VAR_2, struct intc_group *VAR_3, int VAR_4) { unsigned int VAR_5, VAR_6; struct intc_source *VAR_7; for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) { struct intc_vect *VAR_8 = VAR_1 + VAR_5; sh_intc_register_source(VAR_0, VAR_8->enum_id, VAR_3, VAR_4); VAR_7 = sh_intc_source(VAR_0, VAR_8->enum_id); if (VAR_7) VAR_7->VAR_8 = VAR_8->VAR_8; #ifdef DEBUG_INTC_SOURCES printf("sh_intc: registered source %d -> 0x%04x (%d/%d)\n", VAR_8->enum_id, VAR_7->VAR_8, VAR_7->enable_count, VAR_7->enable_max); #endif } if (VAR_3) { for (VAR_5 = 0; VAR_5 < VAR_4; VAR_5++) { struct intc_group *VAR_9 = VAR_3 + VAR_5; VAR_7 = sh_intc_source(VAR_0, VAR_9->enum_id); VAR_7->next_enum_id = VAR_9->enum_ids[0]; for (VAR_6 = 1; VAR_6 < ARRAY_SIZE(VAR_9->enum_ids); VAR_6++) { if (!VAR_9->enum_ids[VAR_6]) continue; VAR_7 = sh_intc_source(VAR_0, VAR_9->enum_ids[VAR_6 - 1]); VAR_7->next_enum_id = VAR_9->enum_ids[VAR_6]; } #ifdef DEBUG_INTC_SOURCES printf("sh_intc: registered group %d (%d/%d)\n", VAR_9->enum_id, VAR_7->enable_count, VAR_7->enable_max); #endif } } }
[ "void FUNC_0(struct intc_desc *VAR_0,\nstruct intc_vect *VAR_1,\nint VAR_2,\nstruct intc_group *VAR_3,\nint VAR_4)\n{", "unsigned int VAR_5, VAR_6;", "struct intc_source *VAR_7;", "for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) {", "struct intc_vect *VAR_8 = VAR_1 + VAR_5;", "sh_intc_register_source(VAR_0, VAR_8->enum_id, VAR_3, VAR_4);", "VAR_7 = sh_intc_source(VAR_0, VAR_8->enum_id);", "if (VAR_7)\nVAR_7->VAR_8 = VAR_8->VAR_8;", "#ifdef DEBUG_INTC_SOURCES\nprintf(\"sh_intc: registered source %d -> 0x%04x (%d/%d)\\n\",\nVAR_8->enum_id, VAR_7->VAR_8, VAR_7->enable_count, VAR_7->enable_max);", "#endif\n}", "if (VAR_3) {", "for (VAR_5 = 0; VAR_5 < VAR_4; VAR_5++) {", "struct intc_group *VAR_9 = VAR_3 + VAR_5;", "VAR_7 = sh_intc_source(VAR_0, VAR_9->enum_id);", "VAR_7->next_enum_id = VAR_9->enum_ids[0];", "for (VAR_6 = 1; VAR_6 < ARRAY_SIZE(VAR_9->enum_ids); VAR_6++) {", "if (!VAR_9->enum_ids[VAR_6])\ncontinue;", "VAR_7 = sh_intc_source(VAR_0, VAR_9->enum_ids[VAR_6 - 1]);", "VAR_7->next_enum_id = VAR_9->enum_ids[VAR_6];", "}", "#ifdef DEBUG_INTC_SOURCES\nprintf(\"sh_intc: registered group %d (%d/%d)\\n\",\nVAR_9->enum_id, VAR_7->enable_count, VAR_7->enable_max);", "#endif\n}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 35, 37, 39 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 73 ], [ 77, 79, 81 ], [ 83, 85 ], [ 87 ], [ 89 ] ]
13,458
void sparc64_get_context(CPUSPARCState *env) { abi_ulong ucp_addr; struct target_ucontext *ucp; target_mc_gregset_t *grp; target_mcontext_t *mcp; abi_ulong fp, i7, w_addr; int err; unsigned int i; target_sigset_t target_set; sigset_t set; ucp_addr = env->regwptr[UREG_I0]; if (!lock_user_struct(VERIFY_WRITE, ucp, ucp_addr, 0)) { goto do_sigsegv; } mcp = &ucp->tuc_mcontext; grp = &mcp->mc_gregs; /* Skip over the trap instruction, first. */ env->pc = env->npc; env->npc += 4; err = 0; do_sigprocmask(0, NULL, &set); host_to_target_sigset_internal(&target_set, &set); if (TARGET_NSIG_WORDS == 1) { __put_user(target_set.sig[0], (abi_ulong *)&ucp->tuc_sigmask); } else { abi_ulong *src, *dst; src = target_set.sig; dst = ucp->tuc_sigmask.sig; for (i = 0; i < TARGET_NSIG_WORDS; i++, dst++, src++) { __put_user(*src, dst); } if (err) goto do_sigsegv; } /* XXX: tstate must be saved properly */ // __put_user(env->tstate, &((*grp)[MC_TSTATE])); __put_user(env->pc, &((*grp)[MC_PC])); __put_user(env->npc, &((*grp)[MC_NPC])); __put_user(env->y, &((*grp)[MC_Y])); __put_user(env->gregs[1], &((*grp)[MC_G1])); __put_user(env->gregs[2], &((*grp)[MC_G2])); __put_user(env->gregs[3], &((*grp)[MC_G3])); __put_user(env->gregs[4], &((*grp)[MC_G4])); __put_user(env->gregs[5], &((*grp)[MC_G5])); __put_user(env->gregs[6], &((*grp)[MC_G6])); __put_user(env->gregs[7], &((*grp)[MC_G7])); __put_user(env->regwptr[UREG_I0], &((*grp)[MC_O0])); __put_user(env->regwptr[UREG_I1], &((*grp)[MC_O1])); __put_user(env->regwptr[UREG_I2], &((*grp)[MC_O2])); __put_user(env->regwptr[UREG_I3], &((*grp)[MC_O3])); __put_user(env->regwptr[UREG_I4], &((*grp)[MC_O4])); __put_user(env->regwptr[UREG_I5], &((*grp)[MC_O5])); __put_user(env->regwptr[UREG_I6], &((*grp)[MC_O6])); __put_user(env->regwptr[UREG_I7], &((*grp)[MC_O7])); w_addr = TARGET_STACK_BIAS+env->regwptr[UREG_I6]; fp = i7 = 0; if (get_user(fp, w_addr + offsetof(struct target_reg_window, ins[6]), abi_ulong) != 0) { goto do_sigsegv; } if (get_user(i7, w_addr + offsetof(struct target_reg_window, ins[7]), abi_ulong) != 0) { goto do_sigsegv; } __put_user(fp, &(mcp->mc_fp)); __put_user(i7, &(mcp->mc_i7)); { uint32_t *dst = ucp->tuc_mcontext.mc_fpregs.mcfpu_fregs.sregs; for (i = 0; i < 64; i++, dst++) { if (i & 1) { __put_user(env->fpr[i/2].l.lower, dst); } else { __put_user(env->fpr[i/2].l.upper, dst); } } } __put_user(env->fsr, &(mcp->mc_fpregs.mcfpu_fsr)); __put_user(env->gsr, &(mcp->mc_fpregs.mcfpu_gsr)); __put_user(env->fprs, &(mcp->mc_fpregs.mcfpu_fprs)); if (err) goto do_sigsegv; unlock_user_struct(ucp, ucp_addr, 1); return; do_sigsegv: unlock_user_struct(ucp, ucp_addr, 1); force_sig(TARGET_SIGSEGV); }
true
qemu
3d3efba020da1de57a715e2087cf761ed0ad0904
void sparc64_get_context(CPUSPARCState *env) { abi_ulong ucp_addr; struct target_ucontext *ucp; target_mc_gregset_t *grp; target_mcontext_t *mcp; abi_ulong fp, i7, w_addr; int err; unsigned int i; target_sigset_t target_set; sigset_t set; ucp_addr = env->regwptr[UREG_I0]; if (!lock_user_struct(VERIFY_WRITE, ucp, ucp_addr, 0)) { goto do_sigsegv; } mcp = &ucp->tuc_mcontext; grp = &mcp->mc_gregs; env->pc = env->npc; env->npc += 4; err = 0; do_sigprocmask(0, NULL, &set); host_to_target_sigset_internal(&target_set, &set); if (TARGET_NSIG_WORDS == 1) { __put_user(target_set.sig[0], (abi_ulong *)&ucp->tuc_sigmask); } else { abi_ulong *src, *dst; src = target_set.sig; dst = ucp->tuc_sigmask.sig; for (i = 0; i < TARGET_NSIG_WORDS; i++, dst++, src++) { __put_user(*src, dst); } if (err) goto do_sigsegv; } __put_user(env->pc, &((*grp)[MC_PC])); __put_user(env->npc, &((*grp)[MC_NPC])); __put_user(env->y, &((*grp)[MC_Y])); __put_user(env->gregs[1], &((*grp)[MC_G1])); __put_user(env->gregs[2], &((*grp)[MC_G2])); __put_user(env->gregs[3], &((*grp)[MC_G3])); __put_user(env->gregs[4], &((*grp)[MC_G4])); __put_user(env->gregs[5], &((*grp)[MC_G5])); __put_user(env->gregs[6], &((*grp)[MC_G6])); __put_user(env->gregs[7], &((*grp)[MC_G7])); __put_user(env->regwptr[UREG_I0], &((*grp)[MC_O0])); __put_user(env->regwptr[UREG_I1], &((*grp)[MC_O1])); __put_user(env->regwptr[UREG_I2], &((*grp)[MC_O2])); __put_user(env->regwptr[UREG_I3], &((*grp)[MC_O3])); __put_user(env->regwptr[UREG_I4], &((*grp)[MC_O4])); __put_user(env->regwptr[UREG_I5], &((*grp)[MC_O5])); __put_user(env->regwptr[UREG_I6], &((*grp)[MC_O6])); __put_user(env->regwptr[UREG_I7], &((*grp)[MC_O7])); w_addr = TARGET_STACK_BIAS+env->regwptr[UREG_I6]; fp = i7 = 0; if (get_user(fp, w_addr + offsetof(struct target_reg_window, ins[6]), abi_ulong) != 0) { goto do_sigsegv; } if (get_user(i7, w_addr + offsetof(struct target_reg_window, ins[7]), abi_ulong) != 0) { goto do_sigsegv; } __put_user(fp, &(mcp->mc_fp)); __put_user(i7, &(mcp->mc_i7)); { uint32_t *dst = ucp->tuc_mcontext.mc_fpregs.mcfpu_fregs.sregs; for (i = 0; i < 64; i++, dst++) { if (i & 1) { __put_user(env->fpr[i/2].l.lower, dst); } else { __put_user(env->fpr[i/2].l.upper, dst); } } } __put_user(env->fsr, &(mcp->mc_fpregs.mcfpu_fsr)); __put_user(env->gsr, &(mcp->mc_fpregs.mcfpu_gsr)); __put_user(env->fprs, &(mcp->mc_fpregs.mcfpu_fprs)); if (err) goto do_sigsegv; unlock_user_struct(ucp, ucp_addr, 1); return; do_sigsegv: unlock_user_struct(ucp, ucp_addr, 1); force_sig(TARGET_SIGSEGV); }
{ "code": [ " err = 0;", " do_sigprocmask(0, NULL, &set);" ], "line_no": [ 49, 53 ] }
void FUNC_0(CPUSPARCState *VAR_0) { abi_ulong ucp_addr; struct target_ucontext *VAR_1; target_mc_gregset_t *grp; target_mcontext_t *mcp; abi_ulong fp, i7, w_addr; int VAR_2; unsigned int VAR_3; target_sigset_t target_set; sigset_t set; ucp_addr = VAR_0->regwptr[UREG_I0]; if (!lock_user_struct(VERIFY_WRITE, VAR_1, ucp_addr, 0)) { goto do_sigsegv; } mcp = &VAR_1->tuc_mcontext; grp = &mcp->mc_gregs; VAR_0->pc = VAR_0->npc; VAR_0->npc += 4; VAR_2 = 0; do_sigprocmask(0, NULL, &set); host_to_target_sigset_internal(&target_set, &set); if (TARGET_NSIG_WORDS == 1) { __put_user(target_set.sig[0], (abi_ulong *)&VAR_1->tuc_sigmask); } else { abi_ulong *src, *dst; src = target_set.sig; dst = VAR_1->tuc_sigmask.sig; for (VAR_3 = 0; VAR_3 < TARGET_NSIG_WORDS; VAR_3++, dst++, src++) { __put_user(*src, dst); } if (VAR_2) goto do_sigsegv; } __put_user(VAR_0->pc, &((*grp)[MC_PC])); __put_user(VAR_0->npc, &((*grp)[MC_NPC])); __put_user(VAR_0->y, &((*grp)[MC_Y])); __put_user(VAR_0->gregs[1], &((*grp)[MC_G1])); __put_user(VAR_0->gregs[2], &((*grp)[MC_G2])); __put_user(VAR_0->gregs[3], &((*grp)[MC_G3])); __put_user(VAR_0->gregs[4], &((*grp)[MC_G4])); __put_user(VAR_0->gregs[5], &((*grp)[MC_G5])); __put_user(VAR_0->gregs[6], &((*grp)[MC_G6])); __put_user(VAR_0->gregs[7], &((*grp)[MC_G7])); __put_user(VAR_0->regwptr[UREG_I0], &((*grp)[MC_O0])); __put_user(VAR_0->regwptr[UREG_I1], &((*grp)[MC_O1])); __put_user(VAR_0->regwptr[UREG_I2], &((*grp)[MC_O2])); __put_user(VAR_0->regwptr[UREG_I3], &((*grp)[MC_O3])); __put_user(VAR_0->regwptr[UREG_I4], &((*grp)[MC_O4])); __put_user(VAR_0->regwptr[UREG_I5], &((*grp)[MC_O5])); __put_user(VAR_0->regwptr[UREG_I6], &((*grp)[MC_O6])); __put_user(VAR_0->regwptr[UREG_I7], &((*grp)[MC_O7])); w_addr = TARGET_STACK_BIAS+VAR_0->regwptr[UREG_I6]; fp = i7 = 0; if (get_user(fp, w_addr + offsetof(struct target_reg_window, ins[6]), abi_ulong) != 0) { goto do_sigsegv; } if (get_user(i7, w_addr + offsetof(struct target_reg_window, ins[7]), abi_ulong) != 0) { goto do_sigsegv; } __put_user(fp, &(mcp->mc_fp)); __put_user(i7, &(mcp->mc_i7)); { uint32_t *dst = VAR_1->tuc_mcontext.mc_fpregs.mcfpu_fregs.sregs; for (VAR_3 = 0; VAR_3 < 64; VAR_3++, dst++) { if (VAR_3 & 1) { __put_user(VAR_0->fpr[VAR_3/2].l.lower, dst); } else { __put_user(VAR_0->fpr[VAR_3/2].l.upper, dst); } } } __put_user(VAR_0->fsr, &(mcp->mc_fpregs.mcfpu_fsr)); __put_user(VAR_0->gsr, &(mcp->mc_fpregs.mcfpu_gsr)); __put_user(VAR_0->fprs, &(mcp->mc_fpregs.mcfpu_fprs)); if (VAR_2) goto do_sigsegv; unlock_user_struct(VAR_1, ucp_addr, 1); return; do_sigsegv: unlock_user_struct(VAR_1, ucp_addr, 1); force_sig(TARGET_SIGSEGV); }
[ "void FUNC_0(CPUSPARCState *VAR_0)\n{", "abi_ulong ucp_addr;", "struct target_ucontext *VAR_1;", "target_mc_gregset_t *grp;", "target_mcontext_t *mcp;", "abi_ulong fp, i7, w_addr;", "int VAR_2;", "unsigned int VAR_3;", "target_sigset_t target_set;", "sigset_t set;", "ucp_addr = VAR_0->regwptr[UREG_I0];", "if (!lock_user_struct(VERIFY_WRITE, VAR_1, ucp_addr, 0)) {", "goto do_sigsegv;", "}", "mcp = &VAR_1->tuc_mcontext;", "grp = &mcp->mc_gregs;", "VAR_0->pc = VAR_0->npc;", "VAR_0->npc += 4;", "VAR_2 = 0;", "do_sigprocmask(0, NULL, &set);", "host_to_target_sigset_internal(&target_set, &set);", "if (TARGET_NSIG_WORDS == 1) {", "__put_user(target_set.sig[0],\n(abi_ulong *)&VAR_1->tuc_sigmask);", "} else {", "abi_ulong *src, *dst;", "src = target_set.sig;", "dst = VAR_1->tuc_sigmask.sig;", "for (VAR_3 = 0; VAR_3 < TARGET_NSIG_WORDS; VAR_3++, dst++, src++) {", "__put_user(*src, dst);", "}", "if (VAR_2)\ngoto do_sigsegv;", "}", "__put_user(VAR_0->pc, &((*grp)[MC_PC]));", "__put_user(VAR_0->npc, &((*grp)[MC_NPC]));", "__put_user(VAR_0->y, &((*grp)[MC_Y]));", "__put_user(VAR_0->gregs[1], &((*grp)[MC_G1]));", "__put_user(VAR_0->gregs[2], &((*grp)[MC_G2]));", "__put_user(VAR_0->gregs[3], &((*grp)[MC_G3]));", "__put_user(VAR_0->gregs[4], &((*grp)[MC_G4]));", "__put_user(VAR_0->gregs[5], &((*grp)[MC_G5]));", "__put_user(VAR_0->gregs[6], &((*grp)[MC_G6]));", "__put_user(VAR_0->gregs[7], &((*grp)[MC_G7]));", "__put_user(VAR_0->regwptr[UREG_I0], &((*grp)[MC_O0]));", "__put_user(VAR_0->regwptr[UREG_I1], &((*grp)[MC_O1]));", "__put_user(VAR_0->regwptr[UREG_I2], &((*grp)[MC_O2]));", "__put_user(VAR_0->regwptr[UREG_I3], &((*grp)[MC_O3]));", "__put_user(VAR_0->regwptr[UREG_I4], &((*grp)[MC_O4]));", "__put_user(VAR_0->regwptr[UREG_I5], &((*grp)[MC_O5]));", "__put_user(VAR_0->regwptr[UREG_I6], &((*grp)[MC_O6]));", "__put_user(VAR_0->regwptr[UREG_I7], &((*grp)[MC_O7]));", "w_addr = TARGET_STACK_BIAS+VAR_0->regwptr[UREG_I6];", "fp = i7 = 0;", "if (get_user(fp, w_addr + offsetof(struct target_reg_window, ins[6]),\nabi_ulong) != 0) {", "goto do_sigsegv;", "}", "if (get_user(i7, w_addr + offsetof(struct target_reg_window, ins[7]),\nabi_ulong) != 0) {", "goto do_sigsegv;", "}", "__put_user(fp, &(mcp->mc_fp));", "__put_user(i7, &(mcp->mc_i7));", "{", "uint32_t *dst = VAR_1->tuc_mcontext.mc_fpregs.mcfpu_fregs.sregs;", "for (VAR_3 = 0; VAR_3 < 64; VAR_3++, dst++) {", "if (VAR_3 & 1) {", "__put_user(VAR_0->fpr[VAR_3/2].l.lower, dst);", "} else {", "__put_user(VAR_0->fpr[VAR_3/2].l.upper, dst);", "}", "}", "}", "__put_user(VAR_0->fsr, &(mcp->mc_fpregs.mcfpu_fsr));", "__put_user(VAR_0->gsr, &(mcp->mc_fpregs.mcfpu_gsr));", "__put_user(VAR_0->fprs, &(mcp->mc_fpregs.mcfpu_fprs));", "if (VAR_2)\ngoto do_sigsegv;", "unlock_user_struct(VAR_1, ucp_addr, 1);", "return;", "do_sigsegv:\nunlock_user_struct(VAR_1, ucp_addr, 1);", "force_sig(TARGET_SIGSEGV);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 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 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195 ] ]
13,461
void av_close_input_file(AVFormatContext *s) { int i; if (s->iformat->read_close) s->iformat->read_close(s); for(i=0;i<s->nb_streams;i++) { av_free(s->streams[i]); } if (s->packet_buffer) { AVPacketList *p, *p1; p = s->packet_buffer; while (p != NULL) { p1 = p->next; av_free_packet(&p->pkt); av_free(p); p = p1; } s->packet_buffer = NULL; } if (!(s->iformat->flags & AVFMT_NOFILE)) { url_fclose(&s->pb); } av_free(s->priv_data); av_free(s); }
false
FFmpeg
a8dbe9514f865f6a8efb304a720025cb1ef9ae3f
void av_close_input_file(AVFormatContext *s) { int i; if (s->iformat->read_close) s->iformat->read_close(s); for(i=0;i<s->nb_streams;i++) { av_free(s->streams[i]); } if (s->packet_buffer) { AVPacketList *p, *p1; p = s->packet_buffer; while (p != NULL) { p1 = p->next; av_free_packet(&p->pkt); av_free(p); p = p1; } s->packet_buffer = NULL; } if (!(s->iformat->flags & AVFMT_NOFILE)) { url_fclose(&s->pb); } av_free(s->priv_data); av_free(s); }
{ "code": [], "line_no": [] }
void FUNC_0(AVFormatContext *VAR_0) { int VAR_1; if (VAR_0->iformat->read_close) VAR_0->iformat->read_close(VAR_0); for(VAR_1=0;VAR_1<VAR_0->nb_streams;VAR_1++) { av_free(VAR_0->streams[VAR_1]); } if (VAR_0->packet_buffer) { AVPacketList *p, *p1; p = VAR_0->packet_buffer; while (p != NULL) { p1 = p->next; av_free_packet(&p->pkt); av_free(p); p = p1; } VAR_0->packet_buffer = NULL; } if (!(VAR_0->iformat->flags & AVFMT_NOFILE)) { url_fclose(&VAR_0->pb); } av_free(VAR_0->priv_data); av_free(VAR_0); }
[ "void FUNC_0(AVFormatContext *VAR_0)\n{", "int VAR_1;", "if (VAR_0->iformat->read_close)\nVAR_0->iformat->read_close(VAR_0);", "for(VAR_1=0;VAR_1<VAR_0->nb_streams;VAR_1++) {", "av_free(VAR_0->streams[VAR_1]);", "}", "if (VAR_0->packet_buffer) {", "AVPacketList *p, *p1;", "p = VAR_0->packet_buffer;", "while (p != NULL) {", "p1 = p->next;", "av_free_packet(&p->pkt);", "av_free(p);", "p = p1;", "}", "VAR_0->packet_buffer = NULL;", "}", "if (!(VAR_0->iformat->flags & AVFMT_NOFILE)) {", "url_fclose(&VAR_0->pb);", "}", "av_free(VAR_0->priv_data);", "av_free(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 ]
[ [ 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 ] ]
13,463
void stw_tce(VIOsPAPRDevice *dev, uint64_t taddr, uint32_t val) { val = tswap32(val); spapr_tce_dma_write(dev, taddr, &val, sizeof(val)); }
true
qemu
ad0ebb91cd8b5fdc4a583b03645677771f420a46
void stw_tce(VIOsPAPRDevice *dev, uint64_t taddr, uint32_t val) { val = tswap32(val); spapr_tce_dma_write(dev, taddr, &val, sizeof(val)); }
{ "code": [ " spapr_tce_dma_write(dev, taddr, &val, sizeof(val));", " spapr_tce_dma_write(dev, taddr, &val, sizeof(val));", "void stw_tce(VIOsPAPRDevice *dev, uint64_t taddr, uint32_t val)", " val = tswap32(val);", " spapr_tce_dma_write(dev, taddr, &val, sizeof(val));", " spapr_tce_dma_write(dev, taddr, &val, sizeof(val));" ], "line_no": [ 7, 7, 1, 5, 7, 7 ] }
void FUNC_0(VIOsPAPRDevice *VAR_0, uint64_t VAR_1, uint32_t VAR_2) { VAR_2 = tswap32(VAR_2); spapr_tce_dma_write(VAR_0, VAR_1, &VAR_2, sizeof(VAR_2)); }
[ "void FUNC_0(VIOsPAPRDevice *VAR_0, uint64_t VAR_1, uint32_t VAR_2)\n{", "VAR_2 = tswap32(VAR_2);", "spapr_tce_dma_write(VAR_0, VAR_1, &VAR_2, sizeof(VAR_2));", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
13,464
static inline void RENAME(rgb32to24)(const uint8_t *src,uint8_t *dst,long src_size) { uint8_t *dest = dst; const uint8_t *s = src; const uint8_t *end; #ifdef HAVE_MMX const uint8_t *mm_end; #endif end = s + src_size; #ifdef HAVE_MMX __asm __volatile(PREFETCH" %0"::"m"(*s):"memory"); mm_end = end - 31; while(s < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movq %1, %%mm0\n\t" "movq 8%1, %%mm1\n\t" "movq 16%1, %%mm4\n\t" "movq 24%1, %%mm5\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm1, %%mm3\n\t" "movq %%mm4, %%mm6\n\t" "movq %%mm5, %%mm7\n\t" "psrlq $8, %%mm2\n\t" "psrlq $8, %%mm3\n\t" "psrlq $8, %%mm6\n\t" "psrlq $8, %%mm7\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm1\n\t" "pand %2, %%mm4\n\t" "pand %2, %%mm5\n\t" "pand %3, %%mm2\n\t" "pand %3, %%mm3\n\t" "pand %3, %%mm6\n\t" "pand %3, %%mm7\n\t" "por %%mm2, %%mm0\n\t" "por %%mm3, %%mm1\n\t" "por %%mm6, %%mm4\n\t" "por %%mm7, %%mm5\n\t" "movq %%mm1, %%mm2\n\t" "movq %%mm4, %%mm3\n\t" "psllq $48, %%mm2\n\t" "psllq $32, %%mm3\n\t" "pand %4, %%mm2\n\t" "pand %5, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "psrlq $16, %%mm1\n\t" "psrlq $32, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm3, %%mm1\n\t" "pand %6, %%mm5\n\t" "por %%mm5, %%mm4\n\t" MOVNTQ" %%mm0, %0\n\t" MOVNTQ" %%mm1, 8%0\n\t" MOVNTQ" %%mm4, 16%0" :"=m"(*dest) :"m"(*s),"m"(mask24l), "m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh) :"memory"); dest += 24; s += 32; } __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(s < end) { #ifdef WORDS_BIGENDIAN /* RGB32 (= A,B,G,R) -> RGB24 (= R,G,B) */ s++; dest[2] = *s++; dest[1] = *s++; dest[0] = *s++; dest += 3; #else *dest++ = *s++; *dest++ = *s++; *dest++ = *s++; s++; #endif } }
true
FFmpeg
6e42e6c4b410dbef8b593c2d796a5dad95f89ee4
static inline void RENAME(rgb32to24)(const uint8_t *src,uint8_t *dst,long src_size) { uint8_t *dest = dst; const uint8_t *s = src; const uint8_t *end; #ifdef HAVE_MMX const uint8_t *mm_end; #endif end = s + src_size; #ifdef HAVE_MMX __asm __volatile(PREFETCH" %0"::"m"(*s):"memory"); mm_end = end - 31; while(s < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movq %1, %%mm0\n\t" "movq 8%1, %%mm1\n\t" "movq 16%1, %%mm4\n\t" "movq 24%1, %%mm5\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm1, %%mm3\n\t" "movq %%mm4, %%mm6\n\t" "movq %%mm5, %%mm7\n\t" "psrlq $8, %%mm2\n\t" "psrlq $8, %%mm3\n\t" "psrlq $8, %%mm6\n\t" "psrlq $8, %%mm7\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm1\n\t" "pand %2, %%mm4\n\t" "pand %2, %%mm5\n\t" "pand %3, %%mm2\n\t" "pand %3, %%mm3\n\t" "pand %3, %%mm6\n\t" "pand %3, %%mm7\n\t" "por %%mm2, %%mm0\n\t" "por %%mm3, %%mm1\n\t" "por %%mm6, %%mm4\n\t" "por %%mm7, %%mm5\n\t" "movq %%mm1, %%mm2\n\t" "movq %%mm4, %%mm3\n\t" "psllq $48, %%mm2\n\t" "psllq $32, %%mm3\n\t" "pand %4, %%mm2\n\t" "pand %5, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "psrlq $16, %%mm1\n\t" "psrlq $32, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm3, %%mm1\n\t" "pand %6, %%mm5\n\t" "por %%mm5, %%mm4\n\t" MOVNTQ" %%mm0, %0\n\t" MOVNTQ" %%mm1, 8%0\n\t" MOVNTQ" %%mm4, 16%0" :"=m"(*dest) :"m"(*s),"m"(mask24l), "m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh) :"memory"); dest += 24; s += 32; } __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(s < end) { #ifdef WORDS_BIGENDIAN s++; dest[2] = *s++; dest[1] = *s++; dest[0] = *s++; dest += 3; #else *dest++ = *s++; *dest++ = *s++; *dest++ = *s++; s++; #endif } }
{ "code": [ " uint8_t *dest = dst;", " const uint8_t *s = src;", " const uint8_t *end;", "#ifdef HAVE_MMX", " const uint8_t *mm_end;", "#endif", " end = s + src_size;", "#ifdef HAVE_MMX", " __asm __volatile(PREFETCH\"\t%0\"::\"m\"(*s):\"memory\");", " while(s < mm_end)", " __asm __volatile(", "\tPREFETCH\"\t32%1\\n\\t\"", "\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\tMOVNTQ\"\t%%mm1, 8%0\\n\\t\"", "\t:\"=m\"(*dest)", "\t:\"memory\");", " __asm __volatile(SFENCE:::\"memory\");", " __asm __volatile(EMMS:::\"memory\");", "#endif", " while(s < end)", "#ifdef WORDS_BIGENDIAN", "#else", " *dest++ = *s++;", " *dest++ = *s++;", " *dest++ = *s++;", "#endif", " uint8_t *dest = dst;", " const uint8_t *s = src;", " const uint8_t *end;", " const uint8_t *mm_end;", " end = s + src_size;", " __asm __volatile(PREFETCH\"\t%0\"::\"m\"(*s):\"memory\");", " mm_end = end - 31;", " while(s < mm_end)", " __asm __volatile(", "\tPREFETCH\"\t32%1\\n\\t\"", "\t\"movq\t%1, %%mm0\\n\\t\"", "\t\"movq\t8%1, %%mm1\\n\\t\"", "\t\"movq\t16%1, %%mm4\\n\\t\"", "\t\"movq\t24%1, %%mm5\\n\\t\"", "\t\"movq\t%%mm0, %%mm2\\n\\t\"", "\t\"movq\t%%mm1, %%mm3\\n\\t\"", "\t\"movq\t%%mm4, %%mm6\\n\\t\"", "\t\"movq\t%%mm5, %%mm7\\n\\t\"", "\t\"psrlq\t$8, %%mm2\\n\\t\"", "\t\"psrlq\t$8, %%mm3\\n\\t\"", "\t\"psrlq\t$8, %%mm6\\n\\t\"", "\t\"psrlq\t$8, %%mm7\\n\\t\"", "\t\"pand\t%2, %%mm0\\n\\t\"", "\t\"pand\t%2, %%mm1\\n\\t\"", "\t\"pand\t%2, %%mm4\\n\\t\"", "\t\"pand\t%2, %%mm5\\n\\t\"", "\t\"pand\t%3, %%mm2\\n\\t\"", "\t\"pand\t%3, %%mm3\\n\\t\"", "\t\"pand\t%3, %%mm6\\n\\t\"", "\t\"pand\t%3, %%mm7\\n\\t\"", "\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\"por\t%%mm3, %%mm1\\n\\t\"", "\t\"por\t%%mm6, %%mm4\\n\\t\"", "\t\"por\t%%mm7, %%mm5\\n\\t\"", "\t\"movq\t%%mm1, %%mm2\\n\\t\"", "\t\"movq\t%%mm4, %%mm3\\n\\t\"", "\t\"psllq\t$48, %%mm2\\n\\t\"", "\t\"psllq\t$32, %%mm3\\n\\t\"", "\t\"pand\t%4, %%mm2\\n\\t\"", "\t\"pand\t%5, %%mm3\\n\\t\"", "\t\"por\t%%mm2, %%mm0\\n\\t\"", "\t\"psrlq\t$16, %%mm1\\n\\t\"", "\t\"psrlq\t$32, %%mm4\\n\\t\"", "\t\"psllq\t$16, %%mm5\\n\\t\"", "\t\"por\t%%mm3, %%mm1\\n\\t\"", "\t\"pand\t%6, %%mm5\\n\\t\"", "\t\"por\t%%mm5, %%mm4\\n\\t\"", "\tMOVNTQ\"\t%%mm0, %0\\n\\t\"", "\tMOVNTQ\"\t%%mm1, 8%0\\n\\t\"", "\tMOVNTQ\"\t%%mm4, 16%0\"", "\t:\"=m\"(*dest)", "\t:\"m\"(*s),\"m\"(mask24l),", "\t \"m\"(mask24h),\"m\"(mask24hh),\"m\"(mask24hhh),\"m\"(mask24hhhh)", "\t:\"memory\");", " dest += 24;", " s += 32;", " __asm __volatile(SFENCE:::\"memory\");", " __asm __volatile(EMMS:::\"memory\");", "#endif", " while(s < end)", " s++;", " dest[2] = *s++;", " dest[1] = *s++;", " dest[0] = *s++;", " dest += 3;", " *dest++ = *s++;", " *dest++ = *s++;", " *dest++ = *s++;", " s++;", " const uint8_t *mm_end;", " end = s + src_size;", " __asm __volatile(SFENCE:::\"memory\");", " __asm __volatile(EMMS:::\"memory\");", " const uint8_t *mm_end;", " end = s + src_size;", " __asm __volatile(SFENCE:::\"memory\");", " __asm __volatile(EMMS:::\"memory\");", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif", "#endif" ], "line_no": [ 5, 7, 9, 11, 13, 15, 17, 11, 21, 25, 29, 31, 111, 113, 117, 123, 131, 133, 15, 137, 141, 155, 157, 157, 157, 15, 5, 7, 9, 13, 17, 21, 23, 25, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 83, 85, 87, 89, 91, 93, 73, 97, 99, 101, 75, 105, 107, 111, 113, 115, 117, 119, 121, 123, 125, 127, 131, 133, 15, 137, 145, 147, 149, 151, 153, 157, 157, 157, 145, 13, 17, 131, 133, 13, 17, 131, 133, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 ] }
static inline void FUNC_0(rgb32to24)(const uint8_t *src,uint8_t *dst,long src_size) { uint8_t *dest = dst; const uint8_t *VAR_0 = src; const uint8_t *VAR_1; #ifdef HAVE_MMX const uint8_t *mm_end; #endif VAR_1 = VAR_0 + src_size; #ifdef HAVE_MMX __asm __volatile(PREFETCH" %0"::"m"(*VAR_0):"memory"); mm_end = VAR_1 - 31; while(VAR_0 < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movq %1, %%mm0\n\t" "movq 8%1, %%mm1\n\t" "movq 16%1, %%mm4\n\t" "movq 24%1, %%mm5\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm1, %%mm3\n\t" "movq %%mm4, %%mm6\n\t" "movq %%mm5, %%mm7\n\t" "psrlq $8, %%mm2\n\t" "psrlq $8, %%mm3\n\t" "psrlq $8, %%mm6\n\t" "psrlq $8, %%mm7\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm1\n\t" "pand %2, %%mm4\n\t" "pand %2, %%mm5\n\t" "pand %3, %%mm2\n\t" "pand %3, %%mm3\n\t" "pand %3, %%mm6\n\t" "pand %3, %%mm7\n\t" "por %%mm2, %%mm0\n\t" "por %%mm3, %%mm1\n\t" "por %%mm6, %%mm4\n\t" "por %%mm7, %%mm5\n\t" "movq %%mm1, %%mm2\n\t" "movq %%mm4, %%mm3\n\t" "psllq $48, %%mm2\n\t" "psllq $32, %%mm3\n\t" "pand %4, %%mm2\n\t" "pand %5, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "psrlq $16, %%mm1\n\t" "psrlq $32, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm3, %%mm1\n\t" "pand %6, %%mm5\n\t" "por %%mm5, %%mm4\n\t" MOVNTQ" %%mm0, %0\n\t" MOVNTQ" %%mm1, 8%0\n\t" MOVNTQ" %%mm4, 16%0" :"=m"(*dest) :"m"(*VAR_0),"m"(mask24l), "m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh) :"memory"); dest += 24; VAR_0 += 32; } __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(VAR_0 < VAR_1) { #ifdef WORDS_BIGENDIAN VAR_0++; dest[2] = *VAR_0++; dest[1] = *VAR_0++; dest[0] = *VAR_0++; dest += 3; #else *dest++ = *VAR_0++; *dest++ = *VAR_0++; *dest++ = *VAR_0++; VAR_0++; #endif } }
[ "static inline void FUNC_0(rgb32to24)(const uint8_t *src,uint8_t *dst,long src_size)\n{", "uint8_t *dest = dst;", "const uint8_t *VAR_0 = src;", "const uint8_t *VAR_1;", "#ifdef HAVE_MMX\nconst uint8_t *mm_end;", "#endif\nVAR_1 = VAR_0 + src_size;", "#ifdef HAVE_MMX\n__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*VAR_0):\"memory\");", "mm_end = VAR_1 - 31;", "while(VAR_0 < mm_end)\n{", "__asm __volatile(\nPREFETCH\"\t32%1\\n\\t\"\n\"movq\t%1, %%mm0\\n\\t\"\n\"movq\t8%1, %%mm1\\n\\t\"\n\"movq\t16%1, %%mm4\\n\\t\"\n\"movq\t24%1, %%mm5\\n\\t\"\n\"movq\t%%mm0, %%mm2\\n\\t\"\n\"movq\t%%mm1, %%mm3\\n\\t\"\n\"movq\t%%mm4, %%mm6\\n\\t\"\n\"movq\t%%mm5, %%mm7\\n\\t\"\n\"psrlq\t$8, %%mm2\\n\\t\"\n\"psrlq\t$8, %%mm3\\n\\t\"\n\"psrlq\t$8, %%mm6\\n\\t\"\n\"psrlq\t$8, %%mm7\\n\\t\"\n\"pand\t%2, %%mm0\\n\\t\"\n\"pand\t%2, %%mm1\\n\\t\"\n\"pand\t%2, %%mm4\\n\\t\"\n\"pand\t%2, %%mm5\\n\\t\"\n\"pand\t%3, %%mm2\\n\\t\"\n\"pand\t%3, %%mm3\\n\\t\"\n\"pand\t%3, %%mm6\\n\\t\"\n\"pand\t%3, %%mm7\\n\\t\"\n\"por\t%%mm2, %%mm0\\n\\t\"\n\"por\t%%mm3, %%mm1\\n\\t\"\n\"por\t%%mm6, %%mm4\\n\\t\"\n\"por\t%%mm7, %%mm5\\n\\t\"\n\"movq\t%%mm1, %%mm2\\n\\t\"\n\"movq\t%%mm4, %%mm3\\n\\t\"\n\"psllq\t$48, %%mm2\\n\\t\"\n\"psllq\t$32, %%mm3\\n\\t\"\n\"pand\t%4, %%mm2\\n\\t\"\n\"pand\t%5, %%mm3\\n\\t\"\n\"por\t%%mm2, %%mm0\\n\\t\"\n\"psrlq\t$16, %%mm1\\n\\t\"\n\"psrlq\t$32, %%mm4\\n\\t\"\n\"psllq\t$16, %%mm5\\n\\t\"\n\"por\t%%mm3, %%mm1\\n\\t\"\n\"pand\t%6, %%mm5\\n\\t\"\n\"por\t%%mm5, %%mm4\\n\\t\"\nMOVNTQ\"\t%%mm0, %0\\n\\t\"\nMOVNTQ\"\t%%mm1, 8%0\\n\\t\"\nMOVNTQ\"\t%%mm4, 16%0\"\n:\"=m\"(*dest)\n:\"m\"(*VAR_0),\"m\"(mask24l),\n\"m\"(mask24h),\"m\"(mask24hh),\"m\"(mask24hhh),\"m\"(mask24hhhh)\n:\"memory\");", "dest += 24;", "VAR_0 += 32;", "}", "__asm __volatile(SFENCE:::\"memory\");", "__asm __volatile(EMMS:::\"memory\");", "#endif\nwhile(VAR_0 < VAR_1)\n{", "#ifdef WORDS_BIGENDIAN\nVAR_0++;", "dest[2] = *VAR_0++;", "dest[1] = *VAR_0++;", "dest[0] = *VAR_0++;", "dest += 3;", "#else\n*dest++ = *VAR_0++;", "*dest++ = *VAR_0++;", "*dest++ = *VAR_0++;", "VAR_0++;", "#endif\n}", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 111, 113, 115, 117, 119, 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137, 139 ], [ 141, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165, 167 ], [ 169 ] ]
13,465
static void term_exit(void) { tcsetattr(0, TCSANOW, &oldtty); }
true
qemu
788cf9f8c8cbda53843e060540f3e91a060eb744
static void term_exit(void) { tcsetattr(0, TCSANOW, &oldtty); }
{ "code": [ "static void term_exit(void)", " tcsetattr(0, TCSANOW, &oldtty);" ], "line_no": [ 1, 5 ] }
static void FUNC_0(void) { tcsetattr(0, TCSANOW, &oldtty); }
[ "static void FUNC_0(void)\n{", "tcsetattr(0, TCSANOW, &oldtty);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
13,466
static inline int ohci_put_hcca(OHCIState *ohci, uint32_t addr, struct ohci_hcca *hcca) { cpu_physical_memory_write(addr + ohci->localmem_base, hcca, sizeof(*hcca)); return 1; }
true
qemu
86e18cae209f8101ff9a6013a1ff6ae620c06944
static inline int ohci_put_hcca(OHCIState *ohci, uint32_t addr, struct ohci_hcca *hcca) { cpu_physical_memory_write(addr + ohci->localmem_base, hcca, sizeof(*hcca)); return 1; }
{ "code": [ " cpu_physical_memory_write(addr + ohci->localmem_base, hcca, sizeof(*hcca));" ], "line_no": [ 7 ] }
static inline int FUNC_0(OHCIState *VAR_0, uint32_t VAR_1, struct ohci_hcca *VAR_2) { cpu_physical_memory_write(VAR_1 + VAR_0->localmem_base, VAR_2, sizeof(*VAR_2)); return 1; }
[ "static inline int FUNC_0(OHCIState *VAR_0,\nuint32_t VAR_1, struct ohci_hcca *VAR_2)\n{", "cpu_physical_memory_write(VAR_1 + VAR_0->localmem_base, VAR_2, sizeof(*VAR_2));", "return 1;", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
13,469
static int vqf_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { VqfContext *c = s->priv_data; AVStream *st; int ret; int64_t pos; st = s->streams[stream_index]; pos = av_rescale_rnd(timestamp * st->codec->bit_rate, st->time_base.num, st->time_base.den * (int64_t)c->frame_bit_len, (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP); pos *= c->frame_bit_len; st->cur_dts = av_rescale(pos, st->time_base.den, st->codec->bit_rate * (int64_t)st->time_base.num); if ((ret = avio_seek(s->pb, ((pos-7) >> 3) + s->internal->data_offset, SEEK_SET)) < 0) return ret; c->remaining_bits = -7 - ((pos-7)&7); return 0; }
true
FFmpeg
cb08687180683a755d0fe9d425280d0e4d1e6db2
static int vqf_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { VqfContext *c = s->priv_data; AVStream *st; int ret; int64_t pos; st = s->streams[stream_index]; pos = av_rescale_rnd(timestamp * st->codec->bit_rate, st->time_base.num, st->time_base.den * (int64_t)c->frame_bit_len, (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP); pos *= c->frame_bit_len; st->cur_dts = av_rescale(pos, st->time_base.den, st->codec->bit_rate * (int64_t)st->time_base.num); if ((ret = avio_seek(s->pb, ((pos-7) >> 3) + s->internal->data_offset, SEEK_SET)) < 0) return ret; c->remaining_bits = -7 - ((pos-7)&7); return 0; }
{ "code": [ " int ret;" ], "line_no": [ 11 ] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int VAR_3) { VqfContext *c = VAR_0->priv_data; AVStream *st; int VAR_4; int64_t pos; st = VAR_0->streams[VAR_1]; pos = av_rescale_rnd(VAR_2 * st->codec->bit_rate, st->time_base.num, st->time_base.den * (int64_t)c->frame_bit_len, (VAR_3 & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP); pos *= c->frame_bit_len; st->cur_dts = av_rescale(pos, st->time_base.den, st->codec->bit_rate * (int64_t)st->time_base.num); if ((VAR_4 = avio_seek(VAR_0->pb, ((pos-7) >> 3) + VAR_0->internal->data_offset, SEEK_SET)) < 0) return VAR_4; c->remaining_bits = -7 - ((pos-7)&7); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nint VAR_1, int64_t VAR_2, int VAR_3)\n{", "VqfContext *c = VAR_0->priv_data;", "AVStream *st;", "int VAR_4;", "int64_t pos;", "st = VAR_0->streams[VAR_1];", "pos = av_rescale_rnd(VAR_2 * st->codec->bit_rate,\nst->time_base.num,\nst->time_base.den * (int64_t)c->frame_bit_len,\n(VAR_3 & AVSEEK_FLAG_BACKWARD) ?\nAV_ROUND_DOWN : AV_ROUND_UP);", "pos *= c->frame_bit_len;", "st->cur_dts = av_rescale(pos, st->time_base.den,\nst->codec->bit_rate * (int64_t)st->time_base.num);", "if ((VAR_4 = avio_seek(VAR_0->pb, ((pos-7) >> 3) + VAR_0->internal->data_offset, SEEK_SET)) < 0)\nreturn VAR_4;", "c->remaining_bits = -7 - ((pos-7)&7);", "return 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21, 23, 25, 27 ], [ 29 ], [ 33, 35 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ] ]